13 | `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),Or=new RegExp(`(?:^${A}$)|(?:^${ce}$)`),Vr=new RegExp(`^${A}$`),Lr=new RegExp(`^${ce}$`),Te=t=>t&&t.exact?Or:new RegExp(`(?:${D(t)}${A}${D(t)})|(?:${D(t)}${ce}${D(t)})`,"g");Te.v4=t=>t&&t.exact?Vr:new RegExp(`${D(t)}${A}${D(t)}`,"g");Te.v6=t=>t&&t.exact?Lr:new RegExp(`${D(t)}${ce}${D(t)}`,"g");ot.exports=Te});var ct=x((qs,at)=>{"use strict";var Ce=it(),R=t=>Ce({exact:!0}).test(t);R.v4=t=>Ce.v4({exact:!0}).test(t);R.v6=t=>Ce.v6({exact:!0}).test(t);R.version=t=>R(t)?R.v4(t)?4:6:void 0;at.exports=R});function Rr(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var s=0;s<t.length;s++){var o=t.charAt(s),i=o.charCodeAt(0);if(r[i]!==255)throw new TypeError(o+" is ambiguous");r[i]=s}var a=t.length,b=t.charAt(0),V=Math.log(a)/Math.log(256),g=Math.log(256)/Math.log(a);function L(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var m=0,O=0,E=0,$=d.length;E!==$&&d[E]===0;)E++,m++;for(var T=($-E)*g+1>>>0,y=new Uint8Array(T);E!==$;){for(var C=d[E],q=0,S=T-1;(C!==0||q<O)&&S!==-1;S--,q++)C+=256*y[S]>>>0,y[S]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");O=q,E++}for(var I=T-O;I!==T&&y[I]===0;)I++;for(var ae=b.repeat(m);I<T;++I)ae+=t.charAt(y[I]);return ae}function ie(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var m=0;if(d[m]!==" "){for(var O=0,E=0;d[m]===b;)O++,m++;for(var $=(d.length-m)*V+1>>>0,T=new Uint8Array($);d[m];){var y=r[d.charCodeAt(m)];if(y===255)return;for(var C=0,q=$-1;(y!==0||C<E)&&q!==-1;q--,C++)y+=a*T[q]>>>0,T[q]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");E=C,m++}if(d[m]!==" "){for(var S=$-E;S!==$&&T[S]===0;)S++;for(var I=new Uint8Array(O+($-S)),ae=O;S!==$;)I[ae++]=T[S++];return I}}}function Nr(d){var m=ie(d);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:L,decodeUnsafe:ie,decode:Nr}}var Pr,Fr,dt,pt=c(()=>{Pr=Rr,Fr=Pr,dt=Fr});var Ns,ht,B,ut,lt,N=c(()=>{Ns=new Uint8Array(0),ht=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},B=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},ut=t=>new TextEncoder().encode(t),lt=t=>new TextDecoder().decode(t)});var bt,mt,de,wt,pe,M,kr,Jr,p,z=c(()=>{pt();N();bt=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},mt=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseDecode=n}decode(e){if(typeof e=="string")switch(e[0]){case this.prefix:return this.baseDecode(e.slice(1));default:throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}else throw Error("Can only multibase decode strings")}or(e){let r={[this.prefix]:this,...e.decoders||{[e.prefix]:e}};return new de(r)}},de=class{constructor(e){this.decoders=e}or(e){let r=e.decoders||{[e.prefix]:e};return new de({...this.decoders,...r})}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},wt=class{constructor(e,r,n,s){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=s,this.encoder=new bt(e,r,n),this.decoder=new mt(e,r,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},pe=({name:t,prefix:e,encode:r,decode:n})=>new wt(t,e,r,n),M=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:s}=dt(r,e);return pe({prefix:t,name:e,encode:n,decode:o=>B(s(o))})},kr=(t,e,r,n)=>{let s={};for(let g=0;g<e.length;++g)s[e[g]]=g;let o=t.length;for(;t[o-1]==="=";)--o;let i=new Uint8Array(o*r/8|0),a=0,b=0,V=0;for(let g=0;g<o;++g){let L=s[t[g]];if(L===void 0)throw new SyntaxError(`Non-${n} character`);b=b<<r|L,a+=r,a>=8&&(a-=8,i[V++]=255&b>>a)}if(a>=r||255&b<<8-a)throw new SyntaxError("Unexpected end of data");return i},Jr=(t,e,r)=>{let n=e[e.length-1]==="=",s=(1<<r)-1,o="",i=0,a=0;for(let b=0;b<t.length;++b)for(a=a<<8|t[b],i+=8;i>r;)i-=r,o+=e[s&a>>i];if(i&&(o+=e[s&a<<r-i]),n)for(;o.length*r&7;)o+="=";return o},p=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>pe({prefix:e,name:t,encode(s){return Jr(s,n,r)},decode(s){return kr(s,n,r,t)}})});var ze={};l(ze,{identity:()=>Xr});var Xr,gt=c(()=>{z();N();Xr=pe({prefix:"\0",name:"identity",encode:t=>lt(t),decode:t=>ut(t)})});var Ue={};l(Ue,{base2:()=>Gr});var Gr,yt=c(()=>{z();Gr=p({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var Ie={};l(Ie,{base8:()=>Qr});var Qr,xt=c(()=>{z();Qr=p({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var Be={};l(Be,{base10:()=>Kr});var Kr,vt=c(()=>{z();Kr=M({prefix:"9",name:"base10",alphabet:"0123456789"})});var qe={};l(qe,{base16:()=>Wr,base16upper:()=>Hr});var Wr,Hr,Et=c(()=>{z();Wr=p({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Hr=p({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var he={};l(he,{base32:()=>P,base32hex:()=>en,base32hexpad:()=>rn,base32hexpadupper:()=>nn,base32hexupper:()=>tn,base32pad:()=>Yr,base32padupper:()=>_r,base32upper:()=>Zr,base32z:()=>sn});var P,Zr,Yr,_r,en,tn,rn,nn,sn,ue=c(()=>{z();P=p({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Zr=p({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Yr=p({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),_r=p({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),en=p({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),tn=p({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rn=p({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),nn=p({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),sn=p({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var De={};l(De,{base36:()=>on,base36upper:()=>an});var on,an,St=c(()=>{z();on=M({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),an=M({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var Q={};l(Q,{base58btc:()=>U,base58flickr:()=>cn});var U,cn,K=c(()=>{z();U=M({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),cn=M({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Ne={};l(Ne,{base64:()=>dn,base64pad:()=>pn,base64url:()=>hn,base64urlpad:()=>un});var dn,pn,hn,un,At=c(()=>{z();dn=p({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),pn=p({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),hn=p({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),un=p({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});function $t(t,e,r){e=e||[],r=r||0;for(var n=r;t>=mn;)e[r++]=t&255|jt,t/=128;for(;t&bn;)e[r++]=t&255|jt,t>>>=7;return e[r]=t|0,$t.bytes=r-n+1,e}function Me(t,e){var r=0,e=e||0,n=0,s=e,o,i=t.length;do{if(s>=i)throw Me.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=n<28?(o&Tt)<<n:(o&Tt)*Math.pow(2,n),n+=7}while(o>=gn);return Me.bytes=s-e,r}var ln,jt,fn,bn,mn,wn,gn,Tt,yn,xn,vn,En,Sn,An,jn,$n,Tn,Cn,zn,Un,W,Ct=c(()=>{ln=$t,jt=128,fn=127,bn=~fn,mn=Math.pow(2,31);wn=Me,gn=128,Tt=127;yn=Math.pow(2,7),xn=Math.pow(2,14),vn=Math.pow(2,21),En=Math.pow(2,28),Sn=Math.pow(2,35),An=Math.pow(2,42),jn=Math.pow(2,49),$n=Math.pow(2,56),Tn=Math.pow(2,63),Cn=function(t){return t<yn?1:t<xn?2:t<vn?3:t<En?4:t<Sn?5:t<An?6:t<jn?7:t<$n?8:t<Tn?9:10},zn={encode:ln,decode:wn,encodingLength:Cn},Un=zn,W=Un});var H,F,k,le=c(()=>{Ct();H=t=>[W.decode(t),W.decode.bytes],F=(t,e,r=0)=>(W.encode(t,e,r),e),k=t=>W.encodingLength(t)});var fe={};l(fe,{Digest:()=>J,create:()=>Z,decode:()=>Oe,equals:()=>Ve});var Z,Oe,Ve,J,Y=c(()=>{N();le();Z=(t,e)=>{let r=e.byteLength,n=k(t),s=n+k(r),o=new Uint8Array(s+r);return F(t,o,0),F(r,o,n),o.set(e,s),new J(t,r,e,o)},Oe=t=>{let e=B(t),[r,n]=H(e),[s,o]=H(e.subarray(n)),i=e.subarray(n+o);if(i.byteLength!==s)throw new Error("Incorrect length");return new J(r,s,i,e)},Ve=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&ht(t.bytes,e.bytes),J=class{constructor(e,r,n,s){this.code=e,this.size=r,this.digest=n,this.bytes=s}}});var _,Ut,be=c(()=>{Y();_=({name:t,code:e,encode:r})=>new Ut(t,e,r),Ut=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}async digest(e){if(e instanceof Uint8Array){let r=await this.encode(e);return Z(this.code,r)}else throw Error("Unknown type, must be binary type")}}});var Le={};l(Le,{sha256:()=>In,sha512:()=>Bn});var Bt,In,Bn,qt=c(()=>{be();Bt=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),In=_({name:"sha2-256",code:18,encode:Bt("SHA-256")}),Bn=_({name:"sha2-512",code:19,encode:Bt("SHA-512")})});var Re={};l(Re,{identity:()=>qn});var qn,Dt=c(()=>{be();N();qn=_({name:"identity",code:0,encode:t=>B(t)})});var Nt=c(()=>{N()});var Mt=c(()=>{});var Pe={};l(Pe,{CID:()=>u});var u,Mn,On,Vn,ee,Ln,Ot,Vt,me,we,Rn,Pn,Fn,ge=c(()=>{le();Y();K();ue();N();u=class{constructor(e,r,n,s){this.code=r,this.version=e,this.multihash=n,this.bytes=s,this.byteOffset=s.byteOffset,this.byteLength=s.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:we,byteLength:we,code:me,version:me,multihash:me,bytes:me,_baseCache:we,asCID:we})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==ee)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Ln)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return u.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Z(e,r);return u.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&Ve(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:s}=this;switch(n){case 0:return On(r,s,e||U.encoder);default:return Vn(r,s,e||P.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return Pn(/^0\.0/,Fn),!!(e&&(e[Vt]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof u)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:s,bytes:o}=e;return new u(r,n,s,o||Ot(r,n,s.bytes))}else if(e!=null&&e[Vt]===!0){let{version:r,multihash:n,code:s}=e,o=Oe(n);return u.create(r,s,o)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==ee)throw new Error(`Version 0 CID must use dag-pb (code: ${ee}) block encoding`);return new u(e,r,n,n.bytes)}case 1:{let s=Ot(e,r,n.bytes);return new u(e,r,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return u.create(0,ee,e)}static createV1(e,r){return u.create(1,e,r)}static decode(e){let[r,n]=u.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=u.inspectBytes(e),n=r.size-r.multihashSize,s=B(e.subarray(n,n+r.multihashSize));if(s.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=s.subarray(r.multihashSize-r.digestSize),i=new J(r.multihashCode,r.digestSize,o,s);return[r.version===0?u.createV0(i):u.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[L,ie]=H(e.subarray(r));return r+=ie,L},s=n(),o=ee;if(s===18?(s=0,r=0):s===1&&(o=n()),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let i=r,a=n(),b=n(),V=r+b,g=V-i;return{version:s,codec:o,multihashCode:a,digestSize:b,multihashSize:g,size:V}}static parse(e,r){let[n,s]=Mn(e,r),o=u.decode(s);return o._baseCache.set(n,e),o}},Mn=(t,e)=>{switch(t[0]){case"Q":{let r=e||U;return[U.prefix,r.decode(`${U.prefix}${t}`)]}case U.prefix:{let r=e||U;return[U.prefix,r.decode(t)]}case P.prefix:{let r=e||P;return[P.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},On=(t,e,r)=>{let{prefix:n}=r;if(n!==U.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let s=e.get(n);if(s==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return s},Vn=(t,e,r)=>{let{prefix:n}=r,s=e.get(n);if(s==null){let o=r.encode(t);return e.set(n,o),o}else return s},ee=112,Ln=18,Ot=(t,e,r)=>{let n=k(t),s=n+k(e),o=new Uint8Array(s+r.byteLength);return F(t,o,0),F(e,o,n),o.set(r,s),o},Vt=Symbol.for("@ipld/js-cid/CID"),me={writable:!1,configurable:!1,enumerable:!0},we={writable:!1,enumerable:!1,configurable:!1},Rn="0.0.0-dev",Pn=(t,e)=>{if(t.test(Rn))console.warn(e);else throw new Error(e)},Fn=`CID.isCID(v) is deprecated and will be removed in the next major release.
|
27 | `});var Lt=c(()=>{ge();le();N();be();Y()});var Fe,lo,Rt=c(()=>{gt();yt();xt();vt();Et();ue();St();K();At();qt();Dt();Nt();Mt();Lt();Fe={...ze,...Ue,...Ie,...Be,...qe,...he,...De,...Q,...Ne},lo={...Le,...Re}});function Pt(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Ft,ke,kn,ye,Je=c(()=>{Rt();Ft=Pt("utf8","u",t=>{let e=new TextDecoder("utf8");return"u"+e.decode(t)},t=>new TextEncoder().encode(t.substring(1))),ke=Pt("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),kn={utf8:Ft,"utf-8":Ft,hex:Fe.base16,latin1:ke,ascii:ke,binary:ke,...Fe},ye=kn});var te={};l(te,{toString:()=>Jn});function Jn(t,e="utf8"){let r=ye[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}var re=c(()=>{Je()});var Qt=x((go,Gt)=>{"use strict";var Xe=ct(),{toString:kt}=(re(),te),Xn=Xe,Ge=Xe.v4,Jt=Xe.v6,Xt=function(t,e,r){r=~~r;let n;if(Ge(t))n=e||new Uint8Array(r+4),t.split(/\./g).map(function(s){n[r++]=parseInt(s,10)&255});else if(Jt(t)){let s=t.split(":",8),o;for(o=0;o<s.length;o++){let i=Ge(s[o]),a;i&&(a=Xt(s[o]),s[o]=kt(a.slice(0,2),"base16")),a&&++o<8&&s.splice(o,0,kt(a.slice(2,4),"base16"))}if(s[0]==="")for(;s.length<8;)s.unshift("0");else if(s[s.length-1]==="")for(;s.length<8;)s.push("0");else if(s.length<8){for(o=0;o<s.length&&s[o]!=="";o++);let i=[o,"1"];for(o=9-s.length;o>0;o--)i.push("0");s.splice.apply(s,i)}for(n=e||new Uint8Array(r+16),o=0;o<s.length;o++){let i=parseInt(s[o],16);n[r++]=i>>8&255,n[r++]=i&255}}if(!n)throw Error("Invalid ip address: "+t);return n},Gn=function(t,e,r){e=~~e,r=r||t.length-e;let n=[],s,o=new DataView(t.buffer);if(r===4){for(let i=0;i<r;i++)n.push(t[e+i]);s=n.join(".")}else if(r===16){for(let i=0;i<r;i+=2)n.push(o.getUint16(e+i).toString(16));s=n.join(":"),s=s.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),s=s.replace(/:{3,4}/,"::")}return s};Gt.exports={isIP:Xn,isV4:Ge,isV6:Jt,toBytes:Xt,toString:Gn}});var xe=x((yo,Wt)=>{"use strict";function w(t){if(typeof t=="number"){if(w.codes[t])return w.codes[t];throw new Error("no protocol with code: "+t)}else if(typeof t=="string"){if(w.names[t])return w.names[t];throw new Error("no protocol with name: "+t)}throw new Error("invalid protocol id type: "+t)}var v=-1;w.lengthPrefixedVarSize=v;w.V=v;w.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,v,"ip6zone"],[53,v,"dns","resolvable"],[54,v,"dns4","resolvable"],[55,v,"dns6","resolvable"],[56,v,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,v,"unix",!1,"path"],[421,v,"ipfs"],[421,v,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,v,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,v,"memory"]];w.names={};w.codes={};w.table.map(t=>{let e=Kt.apply(null,t);return w.codes[e.code]=e,w.names[e.name]=e,null});w.object=Kt;function Kt(t,e,r,n,s){return{code:t,size:e,name:r,resolvable:Boolean(n),path:Boolean(s)}}Wt.exports=w});var Yt=x((xo,Zt)=>{Zt.exports=Qe;var Ht=128,Qn=127,Kn=~Qn,Wn=Math.pow(2,31);function Qe(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw Qe.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=Wn;)e[r++]=t&255|Ht,t/=128;for(;t&Kn;)e[r++]=t&255|Ht,t>>>=7;return e[r]=t|0,Qe.bytes=r-n+1,e}});var tr=x((vo,er)=>{er.exports=Ke;var Hn=128,_t=127;function Ke(t,e){var r=0,e=e||0,n=0,s=e,o,i=t.length;do{if(s>=i||n>49)throw Ke.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=n<28?(o&_t)<<n:(o&_t)*Math.pow(2,n),n+=7}while(o>=Hn);return Ke.bytes=s-e,r}});var nr=x((Eo,rr)=>{var Zn=Math.pow(2,7),Yn=Math.pow(2,14),_n=Math.pow(2,21),es=Math.pow(2,28),ts=Math.pow(2,35),rs=Math.pow(2,42),ns=Math.pow(2,49),ss=Math.pow(2,56),os=Math.pow(2,63);rr.exports=function(t){return t<Zn?1:t<Yn?2:t<_n?3:t<es?4:t<ts?5:t<rs?6:t<ns?7:t<ss?8:t<os?9:10}});var ve=x((So,sr)=>{sr.exports={encode:Yt(),decode:tr(),encodingLength:nr()}});var or={};l(or,{fromString:()=>is});function is(t,e="utf8"){let r=ye[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}var ir=c(()=>{Je()});var We={};l(We,{concat:()=>as});function as(t,e){e||(e=t.reduce((s,o)=>s+o.length,0));let r=new Uint8Array(e),n=0;for(let s of t)r.set(s,n),n+=s.length;return r}var He=c(()=>{});var fr=x((jo,lr)=>{"use strict";var Ee=Qt(),ar=xe(),{CID:cs}=(ge(),Pe),{base32:cr}=(ue(),he),{base58btc:ds}=(K(),Q),ps=(Y(),fe),X=ve(),{toString:Se}=(re(),te),{fromString:dr}=(ir(),or),{concat:Ae}=(He(),We);lr.exports=ne;function ne(t,e){return e instanceof Uint8Array?ne.toString(t,e):ne.toBytes(t,e)}ne.toString=function(e,r){switch(ar(e).code){case 4:case 41:return hs(r);case 6:case 273:case 33:case 132:return hr(r).toString();case 53:case 54:case 55:case 56:case 400:case 777:return ls(r);case 421:return bs(r);case 444:return ur(r);case 445:return ur(r);default:return Se(r,"base16")}};ne.toBytes=function(e,r){switch(ar(e).code){case 4:return pr(r);case 41:return pr(r);case 6:case 273:case 33:case 132:return Ze(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:case 777:return us(r);case 421:return fs(r);case 444:return ms(r);case 445:return ws(r);default:return dr(r,"base16")}};function pr(t){if(!Ee.isIP(t))throw new Error("invalid ip address");return Ee.toBytes(t)}function hs(t){let e=Ee.toString(t);if(!e||!Ee.isIP(e))throw new Error("invalid ip address");return e}function Ze(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function hr(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function us(t){let e=dr(t),r=Uint8Array.from(X.encode(e.length));return Ae([r,e],r.length+e.length)}function ls(t){let e=X.decode(t);if(t=t.slice(X.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return Se(t)}function fs(t){let e;t[0]==="Q"||t[0]==="1"?e=ps.decode(ds.decode(`z${t}`)).bytes:e=cs.parse(t).multihash.bytes;let r=Uint8Array.from(X.encode(e.length));return Ae([r,e],r.length+e.length)}function bs(t){let e=X.decode(t),r=t.slice(X.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return Se(r,"base58btc")}function ms(t){let e=t.split(":");if(e.length!==2)throw new Error("failed to parse onion addr: "+e+" does not contain a port number");if(e[0].length!==16)throw new Error("failed to parse onion addr: "+e[0]+" not a Tor onion address.");let r=cr.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let s=Ze(n);return Ae([r,s],r.length+s.length)}function ws(t){let e=t.split(":");if(e.length!==2)throw new Error("failed to parse onion addr: "+e+" does not contain a port number");if(e[0].length!==56)throw new Error("failed to parse onion addr: "+e[0]+" not a Tor onion3 address.");let r=cr.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let s=Ze(n);return Ae([r,s],r.length+s.length)}function ur(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=Se(e,"base32"),s=hr(r);return n+":"+s}});var $r=x(($o,jr)=>{"use strict";var br=fr(),Ye=xe(),se=ve(),{concat:mr}=(He(),We),{toString:gs}=(re(),te);jr.exports={stringToStringTuples:wr,stringTuplesToString:gr,tuplesToStringTuples:xr,stringTuplesToTuples:yr,bytesToTuples:_e,tuplesToBytes:vr,bytesToString:ys,stringToBytes:Sr,fromString:xs,fromBytes:Ar,validateBytes:et,isValidBytes:vs,cleanPath:je,ParseError:tt,protoFromTuple:oe,sizeForAddr:Er};function wr(t){let e=[],r=t.split("/").slice(1);if(r.length===1&&r[0]==="")return[];for(let n=0;n<r.length;n++){let s=r[n],o=Ye(s);if(o.size===0){e.push([s]);continue}if(n++,n>=r.length)throw tt("invalid address: "+t);if(o.path){e.push([s,je(r.slice(n).join("/"))]);break}e.push([s,r[n]])}return e}function gr(t){let e=[];return t.map(r=>{let n=oe(r);return e.push(n.name),r.length>1&&e.push(r[1]),null}),je(e.join("/"))}function yr(t){return t.map(e=>{Array.isArray(e)||(e=[e]);let r=oe(e);return e.length>1?[r.code,br.toBytes(r.code,e[1])]:[r.code]})}function xr(t){return t.map(e=>{let r=oe(e);return e[1]?[r.code,br.toString(r.code,e[1])]:[r.code]})}function vr(t){return Ar(mr(t.map(e=>{let r=oe(e),n=Uint8Array.from(se.encode(r.code));return e.length>1&&(n=mr([n,e[1]])),n})))}function Er(t,e){return t.size>0?t.size/8:t.size===0?0:se.decode(e)+se.decode.bytes}function _e(t){let e=[],r=0;for(;r<t.length;){let n=se.decode(t,r),s=se.decode.bytes,o=Ye(n),i=Er(o,t.slice(r+s));if(i===0){e.push([n]),r+=s;continue}let a=t.slice(r+s,r+s+i);if(r+=i+s,r>t.length)throw tt("Invalid address Uint8Array: "+gs(t,"base16"));e.push([n,a])}return e}function ys(t){let e=_e(t),r=xr(e);return gr(r)}function Sr(t){t=je(t);let e=wr(t),r=yr(e);return vr(r)}function xs(t){return Sr(t)}function Ar(t){let e=et(t);if(e)throw e;return Uint8Array.from(t)}function et(t){try{_e(t)}catch(e){return e}}function vs(t){return et(t)===void 0}function je(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function tt(t){return new Error("Error parsing address: "+t)}function oe(t){return Ye(t[0])}});var zr=x((To,Cr)=>{"use strict";function Tr(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Es(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Tr(t,r)}catch(n){r.message=t.message,r.stack=t.stack;let s=function(){};return s.prototype=Object.create(Object.getPrototypeOf(t)),Tr(new s,r)}}Cr.exports=Es});var Ur={};l(Ur,{equals:()=>Ss});function Ss(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var Ir=c(()=>{});var Us=x((Co,Dr)=>{"use strict";var j=$r(),G=xe(),Br=ve(),{CID:As}=(ge(),Pe),{base58btc:js}=(K(),Q),$s=zr(),Ts=Symbol.for("nodejs.util.inspect.custom"),{toString:$e}=(re(),te),{equals:Cs}=(Ir(),Ur),rt=new Map,qr=Symbol.for("@multiformats/js-multiaddr/multiaddr"),f=class{constructor(e){if(e==null&&(e=""),Object.defineProperty(this,qr,{value:!0}),e instanceof Uint8Array)this.bytes=j.fromBytes(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=j.fromString(e)}else if(f.isMultiaddr(e))this.bytes=j.fromBytes(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return j.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){let e={},r=this.toString().split("/");return e.family=r[1]==="ip4"?4:6,e.host=r[2],e.transport=r[3],e.port=parseInt(r[4]),e}protos(){return this.protoCodes().map(e=>Object.assign({},G(e)))}protoCodes(){let e=[],r=this.bytes,n=0;for(;n<r.length;){let s=Br.decode(r,n),o=Br.decode.bytes,i=G(s);n+=j.sizeForAddr(i,r.slice(n+o))+o,e.push(s)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return j.bytesToTuples(this.bytes)}stringTuples(){let e=j.bytesToTuples(this.bytes);return j.tuplesToStringTuples(e)}encapsulate(e){return e=new f(e),new f(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),s=n.lastIndexOf(r);if(s<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return new f(n.slice(0,s))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new f(j.tuplesToBytes(r.slice(0,n)));return this}getPeerId(){try{let r=this.stringTuples().filter(n=>n[0]===G.names.ipfs.code).pop();if(r&&r[1]){let n=r[1];return n[0]==="Q"||n[0]==="1"?$e(js.decode(`z${n}`),"base58btc"):$e(As.parse(n).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter(r=>!!G(r[0]).path)[0][1],e||(e=null)}catch(r){e=null}return e}equals(e){return Cs(this.bytes,e.bytes)}async resolve(){let e=this.protos().find(s=>s.resolvable);if(!e)return[this];let r=rt.get(e.name);if(!r)throw $s(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this)).map(s=>new f(s))}nodeAddress(){let e=this.protoCodes(),r=this.protoNames(),n=this.toString().split("/").slice(1);if(n.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(e[0]!==4&&e[0]!==41&&e[0]!==54&&e[0]!==55)throw new Error(`no protocol with name: "'${r[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if(n[2]!=="tcp"&&n[2]!=="udp")throw new Error(`no protocol with name: "'${r[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:e[0]===41||e[0]===55?6:4,address:n[1],port:parseInt(n[3])}}isThinWaistAddress(e){let r=(e||this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}static fromNodeAddress(e,r){if(!e)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");let n;switch(e.family){case 4:n="ip4";break;case 6:n="ip6";break;default:throw Error(`Invalid addr family. Got '${e.family}' instead of 4 or 6`)}return new f("/"+[n,e.address,r,e.port].join("/"))}static isName(e){return f.isMultiaddr(e)?e.protos().some(r=>r.resolvable):!1}static isMultiaddr(e){return e instanceof f||Boolean(e&&e[qr])}[Ts](){return"<Multiaddr "+$e(this.bytes,"base16")+" - "+j.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+$e(this.bytes,"base16")+" - "+j.bytesToString(this.bytes)+">"}};f.protocols=G;f.resolvers=rt;function zs(t){return new f(t)}Dr.exports={Multiaddr:f,multiaddr:zs,protocols:G,resolvers:rt}});return Us();})();
|