@libp2p/multistream-select 5.1.10-7aec7bd45 → 5.1.10-90d10b565

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,15 +1,15 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PMultistreamSelect = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PMultistreamSelect=(()=>{var Ot=Object.create;var ne=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty;var Ft=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),U=(r,t)=>{for(var e in t)ne(r,e,{get:t[e],enumerable:!0})},We=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ct(t))!_t.call(r,o)&&o!==e&&ne(r,o,{get:()=>t[o],enumerable:!(n=Tt(t,o))||n.enumerable});return r};var Pt=(r,t,e)=>(e=r!=null?Ot(It(r)):{},We(t||!r||!r.__esModule?ne(e,"default",{value:r,enumerable:!0}):e,r)),Mt=r=>We(ne({},"__esModule",{value:!0}),r);var Dt=Ft((Ho,Ut)=>{"use strict";function Rt(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function rn(r,t,e){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return Rt(r,e)}catch{e.message=r.message,e.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),Rt(new o,e)}}Ut.exports=rn});var sn={};U(sn,{PROTOCOL_ID:()=>x,handle:()=>Nt,select:()=>St});var x="/multistream/1.0.0";var k=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};function _(r=0){return new Uint8Array(r)}function N(r=0){return new Uint8Array(r)}function we(r,t){t==null&&(t=r.reduce((o,i)=>o+i.length,0));let e=N(t),n=0;for(let o of r)e.set(o,n),n+=o.length;return e}function Ye(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var Qe=Symbol.for("@achingbrain/uint8arraylist");function Ke(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let o=e+n.byteLength;if(t<o)return{buf:n,index:t-e};e=o}throw new RangeError("index is out of bounds")}function oe(r){return!!r?.[Qe]}var L=class r{bufs;length;[Qe]=!0;constructor(...t){this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(let n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(oe(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(let n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(oe(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){let e=Ke(this.bufs,t);return e.buf[e.index]}set(t,e){let n=Ke(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(oe(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){let{bufs:n,length:o}=this._subList(t,e);return we(n,o)}subarray(t,e){let{bufs:n,length:o}=this._subList(t,e);return n.length===1?n[0]:we(n,o)}sublist(t,e){let{bufs:n,length:o}=this._subList(t,e),i=new r;return i.length=o,i.bufs=[...n],i}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let i=0;i<this.bufs.length;i++){let s=this.bufs[i],a=o,c=a+s.byteLength;if(o=c,t>=c)continue;let f=t>=a&&t<c,d=e>a&&e<=c;if(f&&d){if(t===a&&e===c){n.push(s);break}let h=t-a;n.push(s.subarray(h,h+(e-t)));break}if(f){if(t===0){n.push(s);continue}n.push(s.subarray(t-a));continue}if(d){if(e===c){n.push(s);break}n.push(s.subarray(0,e-a));break}n.push(s)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!oe(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let i=256,s=new Int32Array(i);for(let h=0;h<i;h++)s[h]=-1;for(let h=0;h<o;h++)s[n[h]]=h;let a=s,c=this.byteLength-n.byteLength,f=n.byteLength-1,d;for(let h=e;h<=c;h+=d){d=0;for(let b=f;b>=0;b--){let M=this.get(h+b);if(n[b]!==M){d=Math.max(1,b-a[M]);break}}if(d===0)return h}return-1}getInt8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){let n=N(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){let o=_(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,e,n),this.write(o,t)}getInt32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){let o=_(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,e,n),this.write(o,t)}getBigInt64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){let o=_(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,e,n),this.write(o,t)}getUint8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){let n=N(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){let o=_(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,e,n),this.write(o,t)}getUint32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){let o=_(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,e,n),this.write(o,t)}getBigUint64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){let o=_(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,e,n),this.write(o,t)}getFloat32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){let o=_(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,e,n),this.write(o,t)}getFloat64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){let o=_(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,e,n),this.write(o,t)}equals(t){if(t==null||!(t instanceof r)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!Ye(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){let n=new r;return n.bufs=t,e==null&&(e=t.reduce((o,i)=>o+i.byteLength,0)),n.length=e,n}};function O(){let r={};return r.promise=new Promise((t,e)=>{r.resolve=t,r.reject=e}),r}var ie=class extends Error{type;code;constructor(t,e){super(t??"The operation was aborted"),this.type="aborted",this.name="AbortError",this.code=e??"ABORT_ERR"}};async function se(r,t,e){if(t==null)return r;if(t.aborted)return Promise.reject(new ie(e?.errorMessage,e?.errorCode));let n,o=new ie(e?.errorMessage,e?.errorCode);try{return await Promise.race([r,new Promise((i,s)=>{n=()=>{s(o)},t.addEventListener("abort",n)})])}finally{n!=null&&t.removeEventListener("abort",n)}}var be=class{readNext;haveNext;ended;nextResult;constructor(){this.ended=!1,this.readNext=O(),this.haveNext=O()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");let t=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=O(),t}async throw(t){return this.ended=!0,t!=null&&this.haveNext.reject(t),{done:!0,value:void 0}}async return(){let t={done:!0,value:void 0};return await this._push(void 0),t}async push(t,e){await this._push(t,e)}async end(t,e){t!=null?await this.throw(t):await this._push(void 0,e)}async _push(t,e){if(t!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");if(this.nextResult!=null&&(await this.readNext.promise,this.nextResult!=null))throw new Error("NeedNext promise resolved but nextResult was not consumed");t!=null?this.nextResult={done:!1,value:t}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=O(),await se(this.readNext.promise,e?.signal,e)}};function Ze(){return new be}var ae=class extends Error{code;constructor(t,e){super(t),this.code=e}},ye=class extends ae{type;constructor(t){super(t,"ABORT_ERR"),this.type="aborted"}};function et(r,t){let e=Ze();r.sink(e).catch(async s=>{await e.end(s)}),r.sink=async s=>{for await(let a of s)await e.push(a);await e.end()};let n=r.source;r.source[Symbol.iterator]!=null?n=r.source[Symbol.iterator]():r.source[Symbol.asyncIterator]!=null&&(n=r.source[Symbol.asyncIterator]());let o=new L;return{read:async(s,a)=>{a?.signal?.throwIfAborted();let c,f=new Promise((d,h)=>{c=()=>{h(new ye("Read aborted"))},a?.signal?.addEventListener("abort",c)});try{if(s==null){let{done:h,value:b}=await Promise.race([n.next(),f]);return h===!0?new L:b}for(;o.byteLength<s;){let{value:h,done:b}=await Promise.race([n.next(),f]);if(b===!0)throw new ae("unexpected end of input","ERR_UNEXPECTED_EOF");o.append(h)}let d=o.sublist(0,s);return o.consume(s),d}finally{c!=null&&a?.signal?.removeEventListener("abort",c)}},write:async(s,a)=>{a?.signal?.throwIfAborted(),s instanceof Uint8Array?await e.push(s,a):await e.push(s.subarray(),a)},unwrap:()=>{if(o.byteLength>0){let s=r.source;r.source=async function*(){t?.yieldBytes===!1?yield o:yield*o,yield*s}()}return r}}}var Vt=Math.pow(2,7),Bt=Math.pow(2,14),kt=Math.pow(2,21),xe=Math.pow(2,28),Le=Math.pow(2,35),Ee=Math.pow(2,42),Ae=Math.pow(2,49),l=128,E=127;function F(r){if(r<Vt)return 1;if(r<Bt)return 2;if(r<kt)return 3;if(r<xe)return 4;if(r<Le)return 5;if(r<Ee)return 6;if(r<Ae)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function zt(r,t,e=0){switch(F(r)){case 8:t[e++]=r&255|l,r/=128;case 7:t[e++]=r&255|l,r/=128;case 6:t[e++]=r&255|l,r/=128;case 5:t[e++]=r&255|l,r/=128;case 4:t[e++]=r&255|l,r>>>=7;case 3:t[e++]=r&255|l,r>>>=7;case 2:t[e++]=r&255|l,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Gt(r,t,e=0){switch(F(r)){case 8:t.set(e++,r&255|l),r/=128;case 7:t.set(e++,r&255|l),r/=128;case 6:t.set(e++,r&255|l),r/=128;case 5:t.set(e++,r&255|l),r/=128;case 4:t.set(e++,r&255|l),r>>>=7;case 3:t.set(e++,r&255|l),r>>>=7;case 2:t.set(e++,r&255|l),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function $t(r,t){let e=r[t],n=0;if(n+=e&E,e<l||(e=r[t+1],n+=(e&E)<<7,e<l)||(e=r[t+2],n+=(e&E)<<14,e<l)||(e=r[t+3],n+=(e&E)<<21,e<l)||(e=r[t+4],n+=(e&E)*xe,e<l)||(e=r[t+5],n+=(e&E)*Le,e<l)||(e=r[t+6],n+=(e&E)*Ee,e<l)||(e=r[t+7],n+=(e&E)*Ae,e<l))return n;throw new RangeError("Could not decode varint")}function jt(r,t){let e=r.get(t),n=0;if(n+=e&E,e<l||(e=r.get(t+1),n+=(e&E)<<7,e<l)||(e=r.get(t+2),n+=(e&E)<<14,e<l)||(e=r.get(t+3),n+=(e&E)<<21,e<l)||(e=r.get(t+4),n+=(e&E)*xe,e<l)||(e=r.get(t+5),n+=(e&E)*Le,e<l)||(e=r.get(t+6),n+=(e&E)*Ee,e<l)||(e=r.get(t+7),n+=(e&E)*Ae,e<l))return n;throw new RangeError("Could not decode varint")}function j(r,t,e=0){return t==null&&(t=N(F(r))),t instanceof Uint8Array?zt(r,t,e):Gt(r,t,e)}function ce(r,t=0){return r instanceof Uint8Array?$t(r,t):jt(r,t)}var he=class extends Error{code;constructor(t,e){super(t),this.code=e}};function K(r,t={}){let e=et(r,t);t.maxDataLength!=null&&t.maxLengthLength==null&&(t.maxLengthLength=F(t.maxDataLength));let n=t?.lengthDecoder??ce,o=t?.lengthEncoder??j;return{read:async s=>{let a=-1,c=new L;for(;;){c.append(await e.read(1,s));try{a=n(c)}catch(f){if(f instanceof RangeError)continue;throw f}if(t?.maxLengthLength!=null&&c.byteLength>t.maxLengthLength)throw new he("message length length too long","ERR_MSG_LENGTH_TOO_LONG");if(a>-1)break}if(t?.maxDataLength!=null&&a>t.maxDataLength)throw new he("message length too long","ERR_MSG_DATA_TOO_LONG");return e.read(a,s)},write:async(s,a)=>{await e.write(new L(o(s.byteLength),s),a)},writeV:async(s,a)=>{let c=new L(...s.flatMap(f=>[o(f.byteLength),f]));await e.write(c,a)},unwrap:()=>e.unwrap()}}var De={};U(De,{base10:()=>Yt});var _n=new Uint8Array(0);function tt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function P(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function rt(r){return new TextEncoder().encode(r)}function nt(r){return new TextDecoder().decode(r)}function Ht(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=o}var a=r.length,c=r.charAt(0),f=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function h(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";for(var w=0,C=0,S=0,p=u.length;S!==p&&u[S]===0;)S++,w++;for(var y=(p-S)*d+1>>>0,m=new Uint8Array(y);S!==p;){for(var v=u[S],D=0,R=y-1;(v!==0||D<C)&&R!==-1;R--,D++)v+=256*m[R]>>>0,m[R]=v%a>>>0,v=v/a>>>0;if(v!==0)throw new Error("Non-zero carry");C=D,S++}for(var I=y-C;I!==y&&m[I]===0;)I++;for(var re=c.repeat(w);I<y;++I)re+=r.charAt(m[I]);return re}function b(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;var w=0;if(u[w]!==" "){for(var C=0,S=0;u[w]===c;)C++,w++;for(var p=(u.length-w)*f+1>>>0,y=new Uint8Array(p);u[w];){var m=e[u.charCodeAt(w)];if(m===255)return;for(var v=0,D=p-1;(m!==0||v<S)&&D!==-1;D--,v++)m+=a*y[D]>>>0,y[D]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");S=v,w++}if(u[w]!==" "){for(var R=p-S;R!==p&&y[R]===0;)R++;for(var I=new Uint8Array(C+(p-R)),re=C;R!==p;)I[re++]=y[R++];return I}}}function M(u){var w=b(u);if(w)return w;throw new Error(`Non-${t} character`)}return{encode:h,decodeUnsafe:b,decode:M}}var Xt=Ht,qt=Xt,it=qt;var ve=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Se=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return st(this,t)}},Re=class{decoders;constructor(t){this.decoders=t}or(t){return st(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function st(r,t){return new Re({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var Ue=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new ve(t,e,n),this.decoder=new Se(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function H({name:r,prefix:t,encode:e,decode:n}){return new Ue(r,t,e,n)}function V({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=it(e,r);return H({prefix:t,name:r,encode:n,decode:i=>P(o(i))})}function Jt(r,t,e,n){let o={};for(let d=0;d<t.length;++d)o[t[d]]=d;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*e/8|0),a=0,c=0,f=0;for(let d=0;d<i;++d){let h=o[r[d]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|h,a+=e,a>=8&&(a-=8,s[f++]=255&c>>a)}if(a>=e||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s}function Wt(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,i="",s=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],s+=8;s>e;)s-=e,i+=t[o&a>>s];if(s!==0&&(i+=t[o&a<<e-s]),n)for(;i.length*e&7;)i+="=";return i}function g({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return H({prefix:t,name:r,encode(o){return Wt(o,n,e)},decode(o){return Jt(o,n,e,r)}})}var Yt=V({prefix:"9",name:"base10",alphabet:"0123456789"});var Ne={};U(Ne,{base16:()=>Kt,base16upper:()=>Qt});var Kt=g({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Qt=g({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Oe={};U(Oe,{base2:()=>Zt});var Zt=g({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Te={};U(Te,{base256emoji:()=>or});var at=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}"),er=at.reduce((r,t,e)=>(r[e]=t,r),[]),tr=at.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function rr(r){return r.reduce((t,e)=>(t+=er[e],t),"")}function nr(r){let t=[];for(let e of r){let n=tr[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var or=H({prefix:"\u{1F680}",name:"base256emoji",encode:rr,decode:nr});var Ce={};U(Ce,{base32:()=>X,base32hex:()=>cr,base32hexpad:()=>hr,base32hexpadupper:()=>ur,base32hexupper:()=>fr,base32pad:()=>sr,base32padupper:()=>ar,base32upper:()=>ir,base32z:()=>lr});var X=g({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ir=g({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sr=g({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ar=g({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cr=g({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fr=g({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),hr=g({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ur=g({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lr=g({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ie={};U(Ie,{base36:()=>dr,base36upper:()=>pr});var dr=V({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pr=V({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var _e={};U(_e,{base58btc:()=>T,base58flickr:()=>mr});var T=V({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mr=V({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Fe={};U(Fe,{base64:()=>gr,base64pad:()=>wr,base64url:()=>br,base64urlpad:()=>yr});var gr=g({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wr=g({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),br=g({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yr=g({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Pe={};U(Pe,{base8:()=>xr});var xr=g({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Me={};U(Me,{identity:()=>Lr});var Lr=H({prefix:"\0",name:"identity",encode:r=>nt(r),decode:r=>rt(r)});var Yn=new TextEncoder,Kn=new TextDecoder;var Be={};U(Be,{identity:()=>jr});var vr=ht,ct=128,Sr=127,Rr=~Sr,Ur=Math.pow(2,31);function ht(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Ur;)t[e++]=r&255|ct,r/=128;for(;r&Rr;)t[e++]=r&255|ct,r>>>=7;return t[e]=r|0,ht.bytes=e-n+1,t}var Dr=Ve,Nr=128,ft=127;function Ve(r,n){var e=0,n=n||0,o=0,i=n,s,a=r.length;do{if(i>=a)throw Ve.bytes=0,new RangeError("Could not decode varint");s=r[i++],e+=o<28?(s&ft)<<o:(s&ft)*Math.pow(2,o),o+=7}while(s>=Nr);return Ve.bytes=i-n,e}var Or=Math.pow(2,7),Tr=Math.pow(2,14),Cr=Math.pow(2,21),Ir=Math.pow(2,28),_r=Math.pow(2,35),Fr=Math.pow(2,42),Pr=Math.pow(2,49),Mr=Math.pow(2,56),Vr=Math.pow(2,63),Br=function(r){return r<Or?1:r<Tr?2:r<Cr?3:r<Ir?4:r<_r?5:r<Fr?6:r<Pr?7:r<Mr?8:r<Vr?9:10},kr={encode:vr,decode:Dr,encodingLength:Br},zr=kr,Q=zr;function Z(r,t=0){return[Q.decode(r,t),Q.decode.bytes]}function q(r,t,e=0){return Q.encode(r,t,e),t}function J(r){return Q.encodingLength(r)}function z(r,t){let e=t.byteLength,n=J(r),o=n+J(e),i=new Uint8Array(o+e);return q(r,i,0),q(e,i,n),i.set(t,o),new W(r,e,t,i)}function ut(r){let t=P(r),[e,n]=Z(t),[o,i]=Z(t.subarray(n)),s=t.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new W(e,o,s,t)}function lt(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&tt(r.bytes,e.bytes)}}var W=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var dt=0,Gr="identity",pt=P;function $r(r){return z(dt,pt(r))}var jr={code:dt,name:Gr,encode:pt,digest:$r};var Ge={};U(Ge,{sha256:()=>Hr,sha512:()=>Xr});function ze({name:r,code:t,encode:e}){return new ke(r,t,e)}var ke=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?z(this.code,e):e.then(n=>z(this.code,n))}else throw Error("Unknown type, must be binary type")}};function gt(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var Hr=ze({name:"sha2-256",code:18,encode:gt("SHA-256")}),Xr=ze({name:"sha2-512",code:19,encode:gt("SHA-512")});function wt(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return Jr(e,$e(r),t??T.encoder);default:return Wr(e,$e(r),t??X.encoder)}}var bt=new WeakMap;function $e(r){let t=bt.get(r);if(t==null){let e=new Map;return bt.set(r,e),e}return t}var le=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==te)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Yr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=z(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&lt(t.multihash,n.multihash)}toString(t){return wt(this,t)}toJSON(){return{"/":wt(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:i,bytes:s}=e;return new r(n,o,i,s??yt(n,o,i.bytes))}else if(e[Kr]===!0){let{version:n,multihash:o,code:i}=e,s=ut(o);return r.create(n,i,s)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==te)throw new Error(`Version 0 CID must use dag-pb (code: ${te}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=yt(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,te,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=P(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=o.subarray(e.multihashSize-e.digestSize),s=new W(e.multihashCode,e.digestSize,i,o);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[h,b]=Z(t.subarray(e));return e+=b,h},o=n(),i=te;if(o===18?(o=0,e=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=e,a=n(),c=n(),f=e+c,d=f-s;return{version:o,codec:i,multihashCode:a,digestSize:c,multihashSize:d,size:f}}static parse(t,e){let[n,o]=qr(t,e),i=r.decode(o);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return $e(i).set(n,t),i}};function qr(r,t){switch(r[0]){case"Q":{let e=t??T;return[T.prefix,e.decode(`${T.prefix}${r}`)]}case T.prefix:{let e=t??T;return[T.prefix,e.decode(r)]}case X.prefix:{let e=t??X;return[X.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function Jr(r,t,e){let{prefix:n}=e;if(n!==T.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let i=e.encode(r).slice(1);return t.set(n,i),i}else return o}function Wr(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let i=e.encode(r);return t.set(n,i),i}else return o}var te=112,Yr=18;function yt(r,t,e){let n=J(r),o=n+J(t),i=new Uint8Array(o+e.byteLength);return q(r,i,0),q(t,i,n),i.set(e,o),i}var Kr=Symbol.for("@ipld/js-cid/CID");var je={...Me,...Oe,...Pe,...De,...Ne,...Ce,...Ie,..._e,...Fe,...Te},yo={...Ge,...Be};function Lt(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var xt=Lt("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),He=Lt("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=N(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Qr={utf8:xt,"utf-8":xt,hex:je.base16,latin1:He,ascii:He,binary:He,...je},de=Qr;function A(r,t="utf8"){let e=de[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function Et(r,t="utf8"){let e=de[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.encoder.encode(r).substring(1)}var Zr=A(`
2
+ "use strict";var Libp2PMultistreamSelect=(()=>{var Ot=Object.create;var ne=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty;var Ft=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),U=(r,t)=>{for(var e in t)ne(r,e,{get:t[e],enumerable:!0})},We=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ct(t))!_t.call(r,o)&&o!==e&&ne(r,o,{get:()=>t[o],enumerable:!(n=Tt(t,o))||n.enumerable});return r};var Pt=(r,t,e)=>(e=r!=null?Ot(It(r)):{},We(t||!r||!r.__esModule?ne(e,"default",{value:r,enumerable:!0}):e,r)),Mt=r=>We(ne({},"__esModule",{value:!0}),r);var Dt=Ft((jo,Ut)=>{"use strict";function Rt(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function rn(r,t,e){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return Rt(r,e)}catch{e.message=r.message,e.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),Rt(new o,e)}}Ut.exports=rn});var sn={};U(sn,{PROTOCOL_ID:()=>x,handle:()=>Nt,select:()=>St});var x="/multistream/1.0.0";var k=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};function O(){let r={};return r.promise=new Promise((t,e)=>{r.resolve=t,r.reject=e}),r}var oe=class extends Error{type;code;constructor(t,e){super(t??"The operation was aborted"),this.type="aborted",this.name="AbortError",this.code=e??"ABORT_ERR"}};async function ie(r,t,e){if(t==null)return r;if(t.aborted)return Promise.reject(new oe(e?.errorMessage,e?.errorCode));let n,o=new oe(e?.errorMessage,e?.errorCode);try{return await Promise.race([r,new Promise((i,s)=>{n=()=>{s(o)},t.addEventListener("abort",n)})])}finally{n!=null&&t.removeEventListener("abort",n)}}var we=class{readNext;haveNext;ended;nextResult;constructor(){this.ended=!1,this.readNext=O(),this.haveNext=O()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");let t=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=O(),t}async throw(t){return this.ended=!0,t!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(t)),{done:!0,value:void 0}}async return(){let t={done:!0,value:void 0};return await this._push(void 0),t}async push(t,e){await this._push(t,e)}async end(t,e){t!=null?await this.throw(t):await this._push(void 0,e)}async _push(t,e){if(t!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;t!=null?this.nextResult={done:!1,value:t}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=O(),await ie(this.readNext.promise,e?.signal,e)}};function Ye(){return new we}function _(r=0){return new Uint8Array(r)}function N(r=0){return new Uint8Array(r)}function be(r,t){t==null&&(t=r.reduce((o,i)=>o+i.length,0));let e=N(t),n=0;for(let o of r)e.set(o,n),n+=o.length;return e}function Ke(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var Ze=Symbol.for("@achingbrain/uint8arraylist");function Qe(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let o=e+n.byteLength;if(t<o)return{buf:n,index:t-e};e=o}throw new RangeError("index is out of bounds")}function se(r){return!!r?.[Ze]}var L=class r{bufs;length;[Ze]=!0;constructor(...t){this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(let n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(se(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(let n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(se(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){let e=Qe(this.bufs,t);return e.buf[e.index]}set(t,e){let n=Qe(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(se(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){let{bufs:n,length:o}=this._subList(t,e);return be(n,o)}subarray(t,e){let{bufs:n,length:o}=this._subList(t,e);return n.length===1?n[0]:be(n,o)}sublist(t,e){let{bufs:n,length:o}=this._subList(t,e),i=new r;return i.length=o,i.bufs=[...n],i}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let i=0;i<this.bufs.length;i++){let s=this.bufs[i],a=o,c=a+s.byteLength;if(o=c,t>=c)continue;let f=t>=a&&t<c,d=e>a&&e<=c;if(f&&d){if(t===a&&e===c){n.push(s);break}let h=t-a;n.push(s.subarray(h,h+(e-t)));break}if(f){if(t===0){n.push(s);continue}n.push(s.subarray(t-a));continue}if(d){if(e===c){n.push(s);break}n.push(s.subarray(0,e-a));break}n.push(s)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!se(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let i=256,s=new Int32Array(i);for(let h=0;h<i;h++)s[h]=-1;for(let h=0;h<o;h++)s[n[h]]=h;let a=s,c=this.byteLength-n.byteLength,f=n.byteLength-1,d;for(let h=e;h<=c;h+=d){d=0;for(let b=f;b>=0;b--){let M=this.get(h+b);if(n[b]!==M){d=Math.max(1,b-a[M]);break}}if(d===0)return h}return-1}getInt8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){let n=N(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){let o=_(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,e,n),this.write(o,t)}getInt32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){let o=_(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,e,n),this.write(o,t)}getBigInt64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){let o=_(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,e,n),this.write(o,t)}getUint8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){let n=N(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){let o=_(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,e,n),this.write(o,t)}getUint32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){let o=_(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,e,n),this.write(o,t)}getBigUint64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){let o=_(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,e,n),this.write(o,t)}getFloat32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){let o=_(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,e,n),this.write(o,t)}getFloat64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){let o=_(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,e,n),this.write(o,t)}equals(t){if(t==null||!(t instanceof r)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!Ke(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){let n=new r;return n.bufs=t,e==null&&(e=t.reduce((o,i)=>o+i.byteLength,0)),n.length=e,n}};var ae=class extends Error{code;constructor(t,e){super(t),this.code=e}},ye=class extends ae{type;constructor(t){super(t,"ABORT_ERR"),this.type="aborted"}};function et(r,t){let e=Ye();r.sink(e).catch(async s=>{await e.end(s)}),r.sink=async s=>{for await(let a of s)await e.push(a);await e.end()};let n=r.source;r.source[Symbol.iterator]!=null?n=r.source[Symbol.iterator]():r.source[Symbol.asyncIterator]!=null&&(n=r.source[Symbol.asyncIterator]());let o=new L;return{read:async(s,a)=>{a?.signal?.throwIfAborted();let c,f=new Promise((d,h)=>{c=()=>{h(new ye("Read aborted"))},a?.signal?.addEventListener("abort",c)});try{if(s==null){let{done:h,value:b}=await Promise.race([n.next(),f]);return h===!0?new L:b}for(;o.byteLength<s;){let{value:h,done:b}=await Promise.race([n.next(),f]);if(b===!0)throw new ae("unexpected end of input","ERR_UNEXPECTED_EOF");o.append(h)}let d=o.sublist(0,s);return o.consume(s),d}finally{c!=null&&a?.signal?.removeEventListener("abort",c)}},write:async(s,a)=>{a?.signal?.throwIfAborted(),s instanceof Uint8Array?await e.push(s,a):await e.push(s.subarray(),a)},unwrap:()=>{if(o.byteLength>0){let s=r.source;r.source=async function*(){t?.yieldBytes===!1?yield o:yield*o,yield*s}()}return r}}}var Vt=Math.pow(2,7),Bt=Math.pow(2,14),kt=Math.pow(2,21),xe=Math.pow(2,28),Le=Math.pow(2,35),Ee=Math.pow(2,42),Ae=Math.pow(2,49),l=128,E=127;function F(r){if(r<Vt)return 1;if(r<Bt)return 2;if(r<kt)return 3;if(r<xe)return 4;if(r<Le)return 5;if(r<Ee)return 6;if(r<Ae)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function zt(r,t,e=0){switch(F(r)){case 8:t[e++]=r&255|l,r/=128;case 7:t[e++]=r&255|l,r/=128;case 6:t[e++]=r&255|l,r/=128;case 5:t[e++]=r&255|l,r/=128;case 4:t[e++]=r&255|l,r>>>=7;case 3:t[e++]=r&255|l,r>>>=7;case 2:t[e++]=r&255|l,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Gt(r,t,e=0){switch(F(r)){case 8:t.set(e++,r&255|l),r/=128;case 7:t.set(e++,r&255|l),r/=128;case 6:t.set(e++,r&255|l),r/=128;case 5:t.set(e++,r&255|l),r/=128;case 4:t.set(e++,r&255|l),r>>>=7;case 3:t.set(e++,r&255|l),r>>>=7;case 2:t.set(e++,r&255|l),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function $t(r,t){let e=r[t],n=0;if(n+=e&E,e<l||(e=r[t+1],n+=(e&E)<<7,e<l)||(e=r[t+2],n+=(e&E)<<14,e<l)||(e=r[t+3],n+=(e&E)<<21,e<l)||(e=r[t+4],n+=(e&E)*xe,e<l)||(e=r[t+5],n+=(e&E)*Le,e<l)||(e=r[t+6],n+=(e&E)*Ee,e<l)||(e=r[t+7],n+=(e&E)*Ae,e<l))return n;throw new RangeError("Could not decode varint")}function jt(r,t){let e=r.get(t),n=0;if(n+=e&E,e<l||(e=r.get(t+1),n+=(e&E)<<7,e<l)||(e=r.get(t+2),n+=(e&E)<<14,e<l)||(e=r.get(t+3),n+=(e&E)<<21,e<l)||(e=r.get(t+4),n+=(e&E)*xe,e<l)||(e=r.get(t+5),n+=(e&E)*Le,e<l)||(e=r.get(t+6),n+=(e&E)*Ee,e<l)||(e=r.get(t+7),n+=(e&E)*Ae,e<l))return n;throw new RangeError("Could not decode varint")}function j(r,t,e=0){return t==null&&(t=N(F(r))),t instanceof Uint8Array?zt(r,t,e):Gt(r,t,e)}function ce(r,t=0){return r instanceof Uint8Array?$t(r,t):jt(r,t)}var he=class extends Error{code;constructor(t,e){super(t),this.code=e}};function K(r,t={}){let e=et(r,t);t.maxDataLength!=null&&t.maxLengthLength==null&&(t.maxLengthLength=F(t.maxDataLength));let n=t?.lengthDecoder??ce,o=t?.lengthEncoder??j;return{read:async s=>{let a=-1,c=new L;for(;;){c.append(await e.read(1,s));try{a=n(c)}catch(f){if(f instanceof RangeError)continue;throw f}if(t?.maxLengthLength!=null&&c.byteLength>t.maxLengthLength)throw new he("message length length too long","ERR_MSG_LENGTH_TOO_LONG");if(a>-1)break}if(t?.maxDataLength!=null&&a>t.maxDataLength)throw new he("message length too long","ERR_MSG_DATA_TOO_LONG");return e.read(a,s)},write:async(s,a)=>{await e.write(new L(o(s.byteLength),s),a)},writeV:async(s,a)=>{let c=new L(...s.flatMap(f=>[o(f.byteLength),f]));await e.write(c,a)},unwrap:()=>e.unwrap()}}var De={};U(De,{base10:()=>Yt});var In=new Uint8Array(0);function tt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function P(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function rt(r){return new TextEncoder().encode(r)}function nt(r){return new TextDecoder().decode(r)}function Ht(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=o}var a=r.length,c=r.charAt(0),f=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function h(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";for(var w=0,C=0,S=0,p=u.length;S!==p&&u[S]===0;)S++,w++;for(var y=(p-S)*d+1>>>0,g=new Uint8Array(y);S!==p;){for(var v=u[S],D=0,R=y-1;(v!==0||D<C)&&R!==-1;R--,D++)v+=256*g[R]>>>0,g[R]=v%a>>>0,v=v/a>>>0;if(v!==0)throw new Error("Non-zero carry");C=D,S++}for(var I=y-C;I!==y&&g[I]===0;)I++;for(var re=c.repeat(w);I<y;++I)re+=r.charAt(g[I]);return re}function b(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;var w=0;if(u[w]!==" "){for(var C=0,S=0;u[w]===c;)C++,w++;for(var p=(u.length-w)*f+1>>>0,y=new Uint8Array(p);u[w];){var g=e[u.charCodeAt(w)];if(g===255)return;for(var v=0,D=p-1;(g!==0||v<S)&&D!==-1;D--,v++)g+=a*y[D]>>>0,y[D]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");S=v,w++}if(u[w]!==" "){for(var R=p-S;R!==p&&y[R]===0;)R++;for(var I=new Uint8Array(C+(p-R)),re=C;R!==p;)I[re++]=y[R++];return I}}}function M(u){var w=b(u);if(w)return w;throw new Error(`Non-${t} character`)}return{encode:h,decodeUnsafe:b,decode:M}}var Xt=Ht,qt=Xt,it=qt;var ve=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Se=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return st(this,t)}},Re=class{decoders;constructor(t){this.decoders=t}or(t){return st(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function st(r,t){return new Re({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var Ue=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new ve(t,e,n),this.decoder=new Se(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function H({name:r,prefix:t,encode:e,decode:n}){return new Ue(r,t,e,n)}function V({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=it(e,r);return H({prefix:t,name:r,encode:n,decode:i=>P(o(i))})}function Jt(r,t,e,n){let o={};for(let d=0;d<t.length;++d)o[t[d]]=d;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*e/8|0),a=0,c=0,f=0;for(let d=0;d<i;++d){let h=o[r[d]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|h,a+=e,a>=8&&(a-=8,s[f++]=255&c>>a)}if(a>=e||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s}function Wt(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,i="",s=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],s+=8;s>e;)s-=e,i+=t[o&a>>s];if(s!==0&&(i+=t[o&a<<e-s]),n)for(;i.length*e&7;)i+="=";return i}function m({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return H({prefix:t,name:r,encode(o){return Wt(o,n,e)},decode(o){return Jt(o,n,e,r)}})}var Yt=V({prefix:"9",name:"base10",alphabet:"0123456789"});var Ne={};U(Ne,{base16:()=>Kt,base16upper:()=>Qt});var Kt=m({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Qt=m({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Oe={};U(Oe,{base2:()=>Zt});var Zt=m({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Te={};U(Te,{base256emoji:()=>or});var at=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}"),er=at.reduce((r,t,e)=>(r[e]=t,r),[]),tr=at.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function rr(r){return r.reduce((t,e)=>(t+=er[e],t),"")}function nr(r){let t=[];for(let e of r){let n=tr[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var or=H({prefix:"\u{1F680}",name:"base256emoji",encode:rr,decode:nr});var Ce={};U(Ce,{base32:()=>X,base32hex:()=>cr,base32hexpad:()=>hr,base32hexpadupper:()=>ur,base32hexupper:()=>fr,base32pad:()=>sr,base32padupper:()=>ar,base32upper:()=>ir,base32z:()=>lr});var X=m({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ir=m({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sr=m({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ar=m({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cr=m({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fr=m({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),hr=m({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ur=m({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lr=m({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ie={};U(Ie,{base36:()=>dr,base36upper:()=>pr});var dr=V({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pr=V({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var _e={};U(_e,{base58btc:()=>T,base58flickr:()=>gr});var T=V({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),gr=V({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Fe={};U(Fe,{base64:()=>mr,base64pad:()=>wr,base64url:()=>br,base64urlpad:()=>yr});var mr=m({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wr=m({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),br=m({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yr=m({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Pe={};U(Pe,{base8:()=>xr});var xr=m({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Me={};U(Me,{identity:()=>Lr});var Lr=H({prefix:"\0",name:"identity",encode:r=>nt(r),decode:r=>rt(r)});var Wn=new TextEncoder,Yn=new TextDecoder;var Be={};U(Be,{identity:()=>jr});var vr=ht,ct=128,Sr=127,Rr=~Sr,Ur=Math.pow(2,31);function ht(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Ur;)t[e++]=r&255|ct,r/=128;for(;r&Rr;)t[e++]=r&255|ct,r>>>=7;return t[e]=r|0,ht.bytes=e-n+1,t}var Dr=Ve,Nr=128,ft=127;function Ve(r,n){var e=0,n=n||0,o=0,i=n,s,a=r.length;do{if(i>=a)throw Ve.bytes=0,new RangeError("Could not decode varint");s=r[i++],e+=o<28?(s&ft)<<o:(s&ft)*Math.pow(2,o),o+=7}while(s>=Nr);return Ve.bytes=i-n,e}var Or=Math.pow(2,7),Tr=Math.pow(2,14),Cr=Math.pow(2,21),Ir=Math.pow(2,28),_r=Math.pow(2,35),Fr=Math.pow(2,42),Pr=Math.pow(2,49),Mr=Math.pow(2,56),Vr=Math.pow(2,63),Br=function(r){return r<Or?1:r<Tr?2:r<Cr?3:r<Ir?4:r<_r?5:r<Fr?6:r<Pr?7:r<Mr?8:r<Vr?9:10},kr={encode:vr,decode:Dr,encodingLength:Br},zr=kr,Q=zr;function Z(r,t=0){return[Q.decode(r,t),Q.decode.bytes]}function q(r,t,e=0){return Q.encode(r,t,e),t}function J(r){return Q.encodingLength(r)}function z(r,t){let e=t.byteLength,n=J(r),o=n+J(e),i=new Uint8Array(o+e);return q(r,i,0),q(e,i,n),i.set(t,o),new W(r,e,t,i)}function ut(r){let t=P(r),[e,n]=Z(t),[o,i]=Z(t.subarray(n)),s=t.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new W(e,o,s,t)}function lt(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&tt(r.bytes,e.bytes)}}var W=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var dt=0,Gr="identity",pt=P;function $r(r){return z(dt,pt(r))}var jr={code:dt,name:Gr,encode:pt,digest:$r};var Ge={};U(Ge,{sha256:()=>Hr,sha512:()=>Xr});function ze({name:r,code:t,encode:e}){return new ke(r,t,e)}var ke=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?z(this.code,e):e.then(n=>z(this.code,n))}else throw Error("Unknown type, must be binary type")}};function mt(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var Hr=ze({name:"sha2-256",code:18,encode:mt("SHA-256")}),Xr=ze({name:"sha2-512",code:19,encode:mt("SHA-512")});function wt(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return Jr(e,$e(r),t??T.encoder);default:return Wr(e,$e(r),t??X.encoder)}}var bt=new WeakMap;function $e(r){let t=bt.get(r);if(t==null){let e=new Map;return bt.set(r,e),e}return t}var le=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==te)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Yr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=z(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&lt(t.multihash,n.multihash)}toString(t){return wt(this,t)}toJSON(){return{"/":wt(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:i,bytes:s}=e;return new r(n,o,i,s??yt(n,o,i.bytes))}else if(e[Kr]===!0){let{version:n,multihash:o,code:i}=e,s=ut(o);return r.create(n,i,s)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==te)throw new Error(`Version 0 CID must use dag-pb (code: ${te}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=yt(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,te,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=P(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=o.subarray(e.multihashSize-e.digestSize),s=new W(e.multihashCode,e.digestSize,i,o);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[h,b]=Z(t.subarray(e));return e+=b,h},o=n(),i=te;if(o===18?(o=0,e=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=e,a=n(),c=n(),f=e+c,d=f-s;return{version:o,codec:i,multihashCode:a,digestSize:c,multihashSize:d,size:f}}static parse(t,e){let[n,o]=qr(t,e),i=r.decode(o);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return $e(i).set(n,t),i}};function qr(r,t){switch(r[0]){case"Q":{let e=t??T;return[T.prefix,e.decode(`${T.prefix}${r}`)]}case T.prefix:{let e=t??T;return[T.prefix,e.decode(r)]}case X.prefix:{let e=t??X;return[X.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function Jr(r,t,e){let{prefix:n}=e;if(n!==T.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let i=e.encode(r).slice(1);return t.set(n,i),i}else return o}function Wr(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let i=e.encode(r);return t.set(n,i),i}else return o}var te=112,Yr=18;function yt(r,t,e){let n=J(r),o=n+J(t),i=new Uint8Array(o+e.byteLength);return q(r,i,0),q(t,i,n),i.set(e,o),i}var Kr=Symbol.for("@ipld/js-cid/CID");var je={...Me,...Oe,...Pe,...De,...Ne,...Ce,...Ie,..._e,...Fe,...Te},bo={...Ge,...Be};function Lt(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var xt=Lt("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),He=Lt("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=N(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Qr={utf8:xt,"utf-8":xt,hex:je.base16,latin1:He,ascii:He,binary:He,...je},de=Qr;function A(r,t="utf8"){let e=de[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function Et(r,t="utf8"){let e=de[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.encoder.encode(r).substring(1)}var Zr=A(`
3
3
  `);async function G(r,t,e){await r.write(t,e)}async function At(r,t,e){await r.writeV(t,e)}async function en(r,t){let e=await r.read(t);if(e.byteLength===0||e.get(e.byteLength-1)!==Zr[0])throw t.log.error("Invalid mss message - missing newline",e),new k("missing newline","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return e.sublist(0,-1)}async function B(r,t){let e=await en(r,t);return Et(e.subarray())}async function St(r,t,e){if(t=Array.isArray(t)?[...t]:[t],t.length===1&&e.negotiateFully===!1)return tn(r,t[0],e);let n=K(r,{...e,maxDataLength:1024}),o=t.shift();if(o==null)throw new Error("At least one protocol must be specified");e.log.trace('select: write ["%s", "%s"]',x,o);let i=A(`${x}
4
4
  `),s=A(`${o}
5
5
  `);await At(n,[i,s],e),e.log.trace("select: reading multistream-select header");let a=await B(n,e);if(e.log.trace('select: read "%s"',a),a===x&&(e.log.trace("select: reading protocol response"),a=await B(n,e),e.log.trace('select: read "%s"',a)),a===o)return{stream:n.unwrap(),protocol:o};for(let c of t){e.log.trace('select: write "%s"',c),await G(n,A(`${c}
6
- `),e),e.log.trace("select: reading protocol response");let f=await B(n,e);if(e.log.trace('select: read "%s" for "%s"',f,c),f===c)return{stream:n.unwrap(),protocol:c}}throw new k("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}function tn(r,t,e){let n=r.sink.bind(r),o=r.source,i=!1,s=!1,a=O(),c=!1,f=!1,d=O(),h=!1,b=!1,M=O(),u=K({sink:n,source:o},{...e,maxDataLength:1024});r.sink=async p=>{let{sink:y}=u.unwrap();await y(async function*(){let m=!1;for await(let v of p){if(f&&await d.promise,c)yield v;else{f=!0,e.log.trace('optimistic: write ["%s", "%s", data(%d)] in sink',x,t,v.byteLength);let D=`${t}
6
+ `),e),e.log.trace("select: reading protocol response");let f=await B(n,e);if(e.log.trace('select: read "%s" for "%s"',f,c),f===c)return{stream:n.unwrap(),protocol:c}}throw new k("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}function tn(r,t,e){let n=r.sink.bind(r),o=r.source,i=!1,s=!1,a=O(),c=!1,f=!1,d=O(),h=!1,b=!1,M=O(),u=K({sink:n,source:o},{...e,maxDataLength:1024});r.sink=async p=>{let{sink:y}=u.unwrap();await y(async function*(){let g=!1;for await(let v of p){if(f&&await d.promise,c)yield v;else{f=!0,e.log.trace('optimistic: write ["%s", "%s", data(%d)] in sink',x,t,v.byteLength);let D=`${t}
7
7
  `;yield new L(Uint8Array.from([19]),A(`${x}
8
- `),j(D.length),A(D),v).subarray(),e.log.trace('optimistic: wrote ["%s", "%s", data(%d)] in sink',x,t,v.byteLength),c=!0,f=!1,d.resolve(),w().catch(R=>{e.log.error("could not finish optimistic protocol negotiation of %s",t,R)})}m=!0}m||await w()}())};async function w(){if(s){e.log.trace("optimistic: already negotiating %s stream",t),await a.promise;return}s=!0;try{c||(e.log.trace("optimistic: doing send protocol for %s stream",t),await C()),h||(e.log.trace("optimistic: doing read protocol for %s stream",t),await S())}finally{s=!1,i=!0,a.resolve()}}async function C(){if(f){await d.promise;return}f=!0;try{e.log.trace('optimistic: write ["%s", "%s", data] in source',x,t),await u.writeV([A(`${x}
8
+ `),j(D.length),A(D),v).subarray(),e.log.trace('optimistic: wrote ["%s", "%s", data(%d)] in sink',x,t,v.byteLength),c=!0,f=!1,d.resolve(),w().catch(R=>{e.log.error("could not finish optimistic protocol negotiation of %s",t,R)})}g=!0}g||await w()}())};async function w(){if(s){e.log.trace("optimistic: already negotiating %s stream",t),await a.promise;return}s=!0;try{c||(e.log.trace("optimistic: doing send protocol for %s stream",t),await C()),h||(e.log.trace("optimistic: doing read protocol for %s stream",t),await S())}finally{s=!1,i=!0,a.resolve()}}async function C(){if(f){await d.promise;return}f=!0;try{e.log.trace('optimistic: write ["%s", "%s", data] in source',x,t),await u.writeV([A(`${x}
9
9
  `),A(`${t}
10
- `)]),e.log.trace('optimistic: wrote ["%s", "%s", data] in source',x,t)}finally{c=!0,f=!1,d.resolve()}}async function S(){if(b){await M.promise;return}b=!0;try{e.log.trace("optimistic: reading multistream select header");let p=await B(u,e);if(e.log.trace('optimistic: read multistream select header "%s"',p),p===x&&(p=await B(u,e)),e.log.trace('optimistic: read protocol "%s", expecting "%s"',p,t),p!==t)throw new k("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}finally{h=!0,b=!1,M.resolve()}}if(r.source=async function*(){await w(),e.log.trace('optimistic: reading data from "%s" stream',t),yield*u.unwrap().source}(),r.closeRead!=null){let p=r.closeRead.bind(r);r.closeRead=async y=>{i||await w().catch(m=>{e.log.error("could not negotiate protocol before close read",m)}),await p(y)}}if(r.closeWrite!=null){let p=r.closeWrite.bind(r);r.closeWrite=async y=>{i||await w().catch(m=>{e.log.error("could not negotiate protocol before close write",m)}),await p(y)}}if(r.close!=null){let p=r.close.bind(r);r.close=async y=>{let m=[];f&&m.push(d.promise),b&&m.push(M.promise),m.length>0?await se(Promise.all(m),y?.signal):(i=!0,s=!1,a.resolve()),await p(y)}}return{stream:r,protocol:t}}function pe(r){return r[Symbol.asyncIterator]!=null}var me=r=>{let t=F(r),e=N(t);return j(r,e),me.bytes=t,e};me.bytes=0;function ge(r,t){t=t??{};let e=t.lengthEncoder??me;function*n(o){let i=e(o.byteLength);i instanceof Uint8Array?yield i:yield*i,o instanceof Uint8Array?yield o:yield*o}return pe(r)?async function*(){for await(let o of r)yield*n(o)}():function*(){for(let o of r)yield*n(o)}()}ge.single=(r,t)=>{t=t??{};let e=t.lengthEncoder??me;return new L(e(r.byteLength),r)};var Y=Pt(Dt(),1);var nn=8,on=1024*1024*4,$;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})($||($={}));var Je=r=>{let t=ce(r);return Je.bytes=F(t),t};Je.bytes=0;function qe(r,t){let e=new L,n=$.LENGTH,o=-1,i=t?.lengthDecoder??Je,s=t?.maxLengthLength??nn,a=t?.maxDataLength??on;function*c(){for(;e.byteLength>0;){if(n===$.LENGTH)try{if(o=i(e),o<0)throw(0,Y.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(o>a)throw(0,Y.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let f=i.bytes;e.consume(f),t?.onLength!=null&&t.onLength(o),n=$.DATA}catch(f){if(f instanceof RangeError){if(e.byteLength>s)throw(0,Y.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw f}if(n===$.DATA){if(e.byteLength<o)break;let f=e.sublist(0,o);e.consume(o),t?.onData!=null&&t.onData(f),yield f,n=$.LENGTH}}}return pe(r)?async function*(){for await(let f of r)e.append(f),yield*c();if(e.byteLength>0)throw(0,Y.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let f of r)e.append(f),yield*c();if(e.byteLength>0)throw(0,Y.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}qe.fromReader=(r,t)=>{let e=1,n=async function*(){for(;;)try{let{done:i,value:s}=await r.next(e);if(i===!0)return;s!=null&&(yield s)}catch(i){if(i.code==="ERR_UNDER_READ")return{done:!0,value:null};throw i}finally{e=1}}();return qe(n,{...t??{},onLength:i=>{e=i}})};async function Nt(r,t,e){t=Array.isArray(t)?t:[t],e.log.trace("handle: available protocols %s",t);let n=K(r,{...e,maxDataLength:1024,maxLengthLength:2});for(;;){e.log.trace("handle: reading incoming string");let o=await B(n,e);if(e.log.trace('handle: read "%s"',o),o===x){e.log.trace('handle: respond with "%s" for "%s"',x,o),await G(n,A(`${x}
10
+ `)]),e.log.trace('optimistic: wrote ["%s", "%s", data] in source',x,t)}finally{c=!0,f=!1,d.resolve()}}async function S(){if(b){await M.promise;return}b=!0;try{e.log.trace("optimistic: reading multistream select header");let p=await B(u,e);if(e.log.trace('optimistic: read multistream select header "%s"',p),p===x&&(p=await B(u,e)),e.log.trace('optimistic: read protocol "%s", expecting "%s"',p,t),p!==t)throw new k("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}finally{h=!0,b=!1,M.resolve()}}if(r.source=async function*(){await w(),e.log.trace('optimistic: reading data from "%s" stream',t),yield*u.unwrap().source}(),r.closeRead!=null){let p=r.closeRead.bind(r);r.closeRead=async y=>{i||await w().catch(g=>{e.log.error("could not negotiate protocol before close read",g)}),await p(y)}}if(r.closeWrite!=null){let p=r.closeWrite.bind(r);r.closeWrite=async y=>{i||await w().catch(g=>{e.log.error("could not negotiate protocol before close write",g)}),await p(y)}}if(r.close!=null){let p=r.close.bind(r);r.close=async y=>{let g=[];f&&g.push(d.promise),b&&g.push(M.promise),g.length>0?await ie(Promise.all(g),y?.signal):(i=!0,s=!1,a.resolve()),await p(y)}}return{stream:r,protocol:t}}function pe(r){return r[Symbol.asyncIterator]!=null}var ge=r=>{let t=F(r),e=N(t);return j(r,e),ge.bytes=t,e};ge.bytes=0;function me(r,t){t=t??{};let e=t.lengthEncoder??ge;function*n(o){let i=e(o.byteLength);i instanceof Uint8Array?yield i:yield*i,o instanceof Uint8Array?yield o:yield*o}return pe(r)?async function*(){for await(let o of r)yield*n(o)}():function*(){for(let o of r)yield*n(o)}()}me.single=(r,t)=>{t=t??{};let e=t.lengthEncoder??ge;return new L(e(r.byteLength),r)};var Y=Pt(Dt(),1);var nn=8,on=1024*1024*4,$;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})($||($={}));var Je=r=>{let t=ce(r);return Je.bytes=F(t),t};Je.bytes=0;function qe(r,t){let e=new L,n=$.LENGTH,o=-1,i=t?.lengthDecoder??Je,s=t?.maxLengthLength??nn,a=t?.maxDataLength??on;function*c(){for(;e.byteLength>0;){if(n===$.LENGTH)try{if(o=i(e),o<0)throw(0,Y.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(o>a)throw(0,Y.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let f=i.bytes;e.consume(f),t?.onLength!=null&&t.onLength(o),n=$.DATA}catch(f){if(f instanceof RangeError){if(e.byteLength>s)throw(0,Y.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw f}if(n===$.DATA){if(e.byteLength<o)break;let f=e.sublist(0,o);e.consume(o),t?.onData!=null&&t.onData(f),yield f,n=$.LENGTH}}}return pe(r)?async function*(){for await(let f of r)e.append(f),yield*c();if(e.byteLength>0)throw(0,Y.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let f of r)e.append(f),yield*c();if(e.byteLength>0)throw(0,Y.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}qe.fromReader=(r,t)=>{let e=1,n=async function*(){for(;;)try{let{done:i,value:s}=await r.next(e);if(i===!0)return;s!=null&&(yield s)}catch(i){if(i.code==="ERR_UNDER_READ")return{done:!0,value:null};throw i}finally{e=1}}();return qe(n,{...t??{},onLength:i=>{e=i}})};async function Nt(r,t,e){t=Array.isArray(t)?t:[t],e.log.trace("handle: available protocols %s",t);let n=K(r,{...e,maxDataLength:1024,maxLengthLength:2});for(;;){e.log.trace("handle: reading incoming string");let o=await B(n,e);if(e.log.trace('handle: read "%s"',o),o===x){e.log.trace('handle: respond with "%s" for "%s"',x,o),await G(n,A(`${x}
11
11
  `),e),e.log.trace('handle: responded with "%s" for "%s"',x,o);continue}if(t.includes(o))return e.log.trace('handle: respond with "%s" for "%s"',o,o),await G(n,A(`${o}
12
- `),e),e.log.trace('handle: responded with "%s" for "%s"',o,o),{stream:n.unwrap(),protocol:o};if(o==="ls"){let i=new L(...t.map(s=>ge.single(A(`${s}
12
+ `),e),e.log.trace('handle: responded with "%s" for "%s"',o,o),{stream:n.unwrap(),protocol:o};if(o==="ls"){let i=new L(...t.map(s=>me.single(A(`${s}
13
13
  `))),A(`
14
14
  `));e.log.trace('handle: respond with "%s" for %s',t,o),await G(n,i,e),e.log.trace('handle: responded with "%s" for %s',t,o);continue}e.log('handle: respond with "na" for "%s"',o),await G(n,A(`na
15
15
  `),e),e.log('handle: responded with "na" for "%s"',o)}}return Mt(sn);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/multistream-select",
3
- "version": "5.1.10-7aec7bd45",
3
+ "version": "5.1.10-90d10b565",
4
4
  "description": "JavaScript implementation of multistream-select",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/multistream-select#readme",
@@ -58,7 +58,7 @@
58
58
  "test:electron-main": "aegir test -t electron-main"
59
59
  },
60
60
  "dependencies": {
61
- "@libp2p/interface": "1.4.0-7aec7bd45",
61
+ "@libp2p/interface": "1.4.0-90d10b565",
62
62
  "it-length-prefixed": "^9.0.4",
63
63
  "it-length-prefixed-stream": "^1.1.7",
64
64
  "it-stream-types": "^2.0.1",
@@ -69,8 +69,8 @@
69
69
  "uint8arrays": "^5.1.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@libp2p/logger": "4.0.13-7aec7bd45",
73
- "aegir": "^42.2.11",
72
+ "@libp2p/logger": "4.0.13-90d10b565",
73
+ "aegir": "^43.0.1",
74
74
  "iso-random-stream": "^2.0.2",
75
75
  "it-all": "^3.0.6",
76
76
  "it-drain": "^3.0.7",