@libp2p/mdns 8.0.0-05abd49f → 8.0.0-1f7e18b0
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 +4 -4
- package/package.json +9 -12
package/dist/index.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PMdns = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PMdns=(()=>{var
|
|
2
|
+
"use strict";var Libp2PMdns=(()=>{var Qo=Object.create;var hr=Object.defineProperty;var Jo=Object.getOwnPropertyDescriptor;var Wo=Object.getOwnPropertyNames;var Zo=Object.getPrototypeOf,ei=Object.prototype.hasOwnProperty;var te=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var P=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),T=(r,e)=>{for(var t in e)hr(r,t,{get:e[t],enumerable:!0})},nn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Wo(e))!ei.call(r,o)&&o!==t&&hr(r,o,{get:()=>e[o],enumerable:!(n=Jo(e,o))||n.enumerable});return r};var Pe=(r,e,t)=>(t=r!=null?Qo(Zo(r)):{},nn(e||!r||!r.__esModule?hr(t,"default",{value:r,enumerable:!0}):t,r)),ri=r=>nn(hr({},"__esModule",{value:!0}),r);var cn=P((Ga,sn)=>{var Re=1e3,fe=Re*60,Fe=fe*60,Le=Fe*24,ti=Le*7,ni=Le*365.25;sn.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return oi(r);if(t==="number"&&isFinite(r))return e.long?si(r):ii(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function oi(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*ni;case"weeks":case"week":case"w":return t*ti;case"days":case"day":case"d":return t*Le;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Fe;case"minutes":case"minute":case"mins":case"min":case"m":return t*fe;case"seconds":case"second":case"secs":case"sec":case"s":return t*Re;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function ii(r){var e=Math.abs(r);return e>=Le?Math.round(r/Le)+"d":e>=Fe?Math.round(r/Fe)+"h":e>=fe?Math.round(r/fe)+"m":e>=Re?Math.round(r/Re)+"s":r+"ms"}function si(r){var e=Math.abs(r);return e>=Le?mr(r,e,Le,"day"):e>=Fe?mr(r,e,Fe,"hour"):e>=fe?mr(r,e,fe,"minute"):e>=Re?mr(r,e,Re,"second"):r+" ms"}function mr(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var Rr=P((Ha,an)=>{function ci(r){t.debug=t,t.default=t,t.coerce=m,t.disable=i,t.enable=o,t.enabled=s,t.humanize=cn(),t.destroy=E,Object.keys(r).forEach(h=>{t[h]=r[h]}),t.names=[],t.skips=[],t.formatters={};function e(h){let d=0;for(let l=0;l<h.length;l++)d=(d<<5)-d+h.charCodeAt(l),d|=0;return t.colors[Math.abs(d)%t.colors.length]}t.selectColor=e;function t(h){let d,l=null,u,c;function p(...x){if(!p.enabled)return;let b=p,I=Number(new Date),U=I-(d||I);b.diff=U,b.prev=d,b.curr=I,d=I,x[0]=t.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let C=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(A,L)=>{if(A==="%%")return"%";C++;let D=t.formatters[L];if(typeof D=="function"){let Y=x[C];A=D.call(b,Y),x.splice(C,1),C--}return A}),t.formatArgs.call(b,x),(b.log||t.log).apply(b,x)}return p.namespace=h,p.useColors=t.useColors(),p.color=t.selectColor(h),p.extend=n,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(u!==t.namespaces&&(u=t.namespaces,c=t.enabled(h)),c),set:x=>{l=x}}),typeof t.init=="function"&&t.init(p),p}function n(h,d){let l=t(this.namespace+(typeof d>"u"?":":d)+h);return l.log=this.log,l}function o(h){t.save(h),t.namespaces=h,t.names=[],t.skips=[];let d,l=(typeof h=="string"?h:"").split(/[\s,]+/),u=l.length;for(d=0;d<u;d++)l[d]&&(h=l[d].replace(/\*/g,".*?"),h[0]==="-"?t.skips.push(new RegExp("^"+h.slice(1)+"$")):t.names.push(new RegExp("^"+h+"$")))}function i(){let h=[...t.names.map(a),...t.skips.map(a).map(d=>"-"+d)].join(",");return t.enable(""),h}function s(h){if(h[h.length-1]==="*")return!0;let d,l;for(d=0,l=t.skips.length;d<l;d++)if(t.skips[d].test(h))return!1;for(d=0,l=t.names.length;d<l;d++)if(t.names[d].test(h))return!0;return!1}function a(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}function m(h){return h instanceof Error?h.stack||h.message:h}function E(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}an.exports=ci});var dn=P((V,yr)=>{V.formatArgs=di;V.save=li;V.load=ui;V.useColors=ai;V.storage=hi();V.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();V.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ai(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function di(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+yr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}V.log=console.debug||console.log||(()=>{});function li(r){try{r?V.storage.setItem("debug",r):V.storage.removeItem("debug")}catch{}}function ui(){let r;try{r=V.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function hi(){try{return localStorage}catch{}}yr.exports=Rr()(V);var{formatters:pi}=yr.exports;pi.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var un=P((Xa,ln)=>{"use strict";ln.exports=(r,e)=>{e=e||process.argv;let t=r.startsWith("-")?"":r.length===1?"-":"--",n=e.indexOf(t+r),o=e.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var pn=P((Ya,hn)=>{"use strict";var gi=te("os"),Q=un(),k=process.env,Me;Q("no-color")||Q("no-colors")||Q("color=false")?Me=!1:(Q("color")||Q("colors")||Q("color=true")||Q("color=always"))&&(Me=!0);"FORCE_COLOR"in k&&(Me=k.FORCE_COLOR.length===0||parseInt(k.FORCE_COLOR,10)!==0);function mi(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function yi(r){if(Me===!1)return 0;if(Q("color=16m")||Q("color=full")||Q("color=truecolor"))return 3;if(Q("color=256"))return 2;if(r&&!r.isTTY&&Me!==!0)return 0;let e=Me?1:0;if(process.platform==="win32"){let t=gi.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in k)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in k)||k.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in k)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(k.TEAMCITY_VERSION)?1:0;if(k.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in k){let t=parseInt((k.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(k.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(k.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(k.TERM)||"COLORTERM"in k?1:(k.TERM==="dumb",e)}function fr(r){let e=yi(r);return mi(e)}hn.exports={supportsColor:fr,stdout:fr(process.stdout),stderr:fr(process.stderr)}});var mn=P((F,Er)=>{var wi=te("tty"),wr=te("util");F.init=Si;F.log=vi;F.formatArgs=xi;F.save=Ii;F.load=Ci;F.useColors=Ei;F.destroy=wr.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");F.colors=[6,2,3,4,5,1];try{let r=pn();r&&(r.stderr||r).level>=2&&(F.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}F.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[t]=n,r},{});function Ei(){return"colors"in F.inspectOpts?!!F.inspectOpts.colors:wi.isatty(process.stderr.fd)}function xi(r){let{namespace:e,useColors:t}=this;if(t){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;r[0]=i+r[0].split(`
|
|
3
3
|
`).join(`
|
|
4
|
-
`+i),
|
|
5
|
-
`)}function
|
|
6
|
-
`).map(e=>e.trim()).join(" ")};to.O=function(t){return this.inspectOpts.colors=this.useColors,Pr.inspect(t,this.inspectOpts)}});var oo=F((yu,nt)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?nt.exports=Qn():nt.exports=no()});var ho=F(ht=>{"use strict";ht.toString=function(t){switch(t){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+t};ht.toType=function(t){switch(t.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return t.toUpperCase().startsWith("UNKNOWN_")?parseInt(t.slice(8)):0}});var po=F(pt=>{"use strict";pt.toString=function(t){switch(t){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+t};pt.toRcode=function(t){switch(t.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var mo=F(mt=>{"use strict";mt.toString=function(t){switch(t){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+t};mt.toOpcode=function(t){switch(t.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var go=F(gt=>{"use strict";gt.toString=function(t){switch(t){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+t};gt.toClass=function(t){switch(t.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var yo=F(yt=>{"use strict";yt.toString=function(t){switch(t){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return t<0?null:`OPTION_${t}`};yt.toCode=function(t){if(typeof t=="number")return t;if(!t)return-1;switch(t.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let e=t.match(/_(\d+)$/);return e?parseInt(e[1],10):-1}});var xo=F((bo,wt)=>{var wo=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=d,t.encode=p,t.familyOf=w,t.name=void 0,t.sizeOf=g,t.v6=t.v4=void 0;let e=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=4,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,o=16,i={name:"v4",size:r,isFormat:l=>e.test(l),encode(l,u,c){c=~~c,u=u||new Uint8Array(c+r);let h=l.length,y=0;for(let E=0;E<h;){let v=l.charCodeAt(E++);v===46?(u[c++]=y,y=0):y=y*10+(v-48)}return u[c]=y,u},decode(l,u){return u=~~u,`${l[u++]}.${l[u++]}.${l[u++]}.${l[u]}`}};t.v4=i;let s={name:"v6",size:o,isFormat:l=>l.length>0&&n.test(l),encode(l,u,c){c=~~c;let h=c+o,y=-1,E=0,v=0,I=!0,f=!1;u=u||new Uint8Array(c+o);for(let C=0;C<l.length;C++){let S=l.charCodeAt(C);S===58?(I?y!==-1?(c<h&&(u[c]=0),c<h-1&&(u[c+1]=0),c+=2):c<h&&(y=c):(f===!0?(c<h&&(u[c]=v),c++):(c<h&&(u[c]=E>>8),c<h-1&&(u[c+1]=E&255),c+=2),E=0,v=0),I=!0,f=!1):S===46?(c<h&&(u[c]=v),c++,v=0,E=0,I=!1,f=!0):(I=!1,S>=97?S-=87:S>=65?S-=55:(S-=48,v=v*10+S),E=(E<<4)+S)}if(I===!1)f===!0?(c<h&&(u[c]=v),c++):(c<h&&(u[c]=E>>8),c<h-1&&(u[c+1]=E&255),c+=2);else if(y===0)c<h&&(u[c]=0),c<h-1&&(u[c+1]=0),c+=2;else if(y!==-1){c+=2;for(let C=Math.min(c-1,h-1);C>=y+2;C--)u[C]=u[C-2];u[y]=0,u[y+1]=0,y=c}if(y!==c&&y!==-1)for(c>h-2&&(c=h-2);h>y;)u[--h]=c<h&&c>y?u[--c]:0;else for(;c<h;)u[c++]=0;return u},decode(l,u){u=~~u;let c="";for(let h=0;h<o;h+=2)h!==0&&(c+=":"),c+=(l[u+h]<<8|l[u+h+1]).toString(16);return c.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};t.v6=s;let a="ip";t.name=a;function g(l){if(i.isFormat(l))return i.size;if(s.isFormat(l))return s.size;throw Error(`Invalid ip address: ${l}`)}function w(l){return g(l)===i.size?1:2}function p(l,u,c){c=~~c;let h=g(l);return typeof u=="function"&&(u=u(c+h)),h===i.size?i.encode(l,u,c):s.encode(l,u,c)}function d(l,u,c){if(u=~~u,c=c||l.length-u,c===i.size)return i.decode(l,u,c);if(c===s.size)return s.decode(l,u,c);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${s.size} for v6.`)}return"default"in t?t.default:t}({});typeof define=="function"&&define.amd?define([],function(){return wo}):typeof wt=="object"&&typeof bo=="object"&&(wt.exports=wo)});var fo=F(b=>{"use strict";var x=te("buffer").Buffer,Se=ho(),Js=po(),Qs=mo(),Mr=go(),bt=yo(),ke=xo(),Ws=0,Eo=32768,xt=32768,Zs=~xt,vo=32768,ec=~vo,m=b.name={};m.encode=function(t,e,r){e||(e=x.alloc(m.encodingLength(t))),r||(r=0);let n=r,o=t.replace(/^\.|\.$/gm,"");if(o.length){let i=o.split(".");for(let s=0;s<i.length;s++){let a=e.write(i[s],r+1);e[r]=a,r+=a+1}}return e[r++]=0,m.encode.bytes=r-n,e};m.encode.bytes=0;m.decode=function(t,e){e||(e=0);let r=[],n=e,o=0,i=0,s=!1;for(;;){if(e>=t.length)throw new Error("Cannot decode name (buffer overflow)");let a=t[e++];if(i+=s?0:1,a===0)break;if(a&192)if((a&192)===192){if(e+1>t.length)throw new Error("Cannot decode name (buffer overflow)");let g=t.readUInt16BE(e-1)-49152;if(g>=n)throw new Error("Cannot decode name (bad pointer)");e=g,n=g,i+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+a>t.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=a+1,o>254)throw new Error("Cannot decode name (name too long)");r.push(t.toString("utf-8",e,e+a)),e+=a,i+=s?0:a}}return m.decode.bytes=i,r.length===0?".":r.join(".")};m.decode.bytes=0;m.encodingLength=function(t){return t==="."||t===".."?1:x.byteLength(t.replace(/^\.|\.$/gm,""))+2};var A={};A.encode=function(t,e,r){e||(e=x.alloc(A.encodingLength(t))),r||(r=0);let n=e.write(t,r+1);return e[r]=n,A.encode.bytes=n+1,e};A.encode.bytes=0;A.decode=function(t,e){e||(e=0);let r=t[e],n=t.toString("utf-8",e+1,e+1+r);return A.decode.bytes=r+1,n};A.decode.bytes=0;A.encodingLength=function(t){return x.byteLength(t)+1};var se={};se.encode=function(t,e,r){e||(e=se.encodingLength(t)),r||(r=0);let n=(t.flags||0)&32767,o=t.type==="response"?Eo:Ws;return e.writeUInt16BE(t.id||0,r),e.writeUInt16BE(n|o,r+2),e.writeUInt16BE(t.questions.length,r+4),e.writeUInt16BE(t.answers.length,r+6),e.writeUInt16BE(t.authorities.length,r+8),e.writeUInt16BE(t.additionals.length,r+10),e};se.encode.bytes=12;se.decode=function(t,e){if(e||(e=0),t.length<12)throw new Error("Header must be 12 bytes");let r=t.readUInt16BE(e+2);return{id:t.readUInt16BE(e),type:r&Eo?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:Qs.toString(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:Js.toString(r&15),questions:new Array(t.readUInt16BE(e+4)),answers:new Array(t.readUInt16BE(e+6)),authorities:new Array(t.readUInt16BE(e+8)),additionals:new Array(t.readUInt16BE(e+10))}};se.decode.bytes=12;se.encodingLength=function(){return 12};var ye=b.unknown={};ye.encode=function(t,e,r){return e||(e=x.alloc(ye.encodingLength(t))),r||(r=0),e.writeUInt16BE(t.length,r),t.copy(e,r+2),ye.encode.bytes=t.length+2,e};ye.encode.bytes=0;ye.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n=t.slice(e+2,e+2+r);return ye.decode.bytes=r+2,n};ye.decode.bytes=0;ye.encodingLength=function(t){return t.length+2};var we=b.ns={};we.encode=function(t,e,r){return e||(e=x.alloc(we.encodingLength(t))),r||(r=0),m.encode(t,e,r+2),e.writeUInt16BE(m.encode.bytes,r),we.encode.bytes=m.encode.bytes+2,e};we.encode.bytes=0;we.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n=m.decode(t,e+2);return we.decode.bytes=r+2,n};we.decode.bytes=0;we.encodingLength=function(t){return m.encodingLength(t)+2};var be=b.soa={};be.encode=function(t,e,r){e||(e=x.alloc(be.encodingLength(t))),r||(r=0);let n=r;return r+=2,m.encode(t.mname,e,r),r+=m.encode.bytes,m.encode(t.rname,e,r),r+=m.encode.bytes,e.writeUInt32BE(t.serial||0,r),r+=4,e.writeUInt32BE(t.refresh||0,r),r+=4,e.writeUInt32BE(t.retry||0,r),r+=4,e.writeUInt32BE(t.expire||0,r),r+=4,e.writeUInt32BE(t.minimum||0,r),r+=4,e.writeUInt16BE(r-n-2,n),be.encode.bytes=r-n,e};be.encode.bytes=0;be.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.mname=m.decode(t,e),e+=m.decode.bytes,n.rname=m.decode(t,e),e+=m.decode.bytes,n.serial=t.readUInt32BE(e),e+=4,n.refresh=t.readUInt32BE(e),e+=4,n.retry=t.readUInt32BE(e),e+=4,n.expire=t.readUInt32BE(e),e+=4,n.minimum=t.readUInt32BE(e),e+=4,be.decode.bytes=e-r,n};be.decode.bytes=0;be.encodingLength=function(t){return 22+m.encodingLength(t.mname)+m.encodingLength(t.rname)};var xe=b.txt={};xe.encode=function(t,e,r){Array.isArray(t)||(t=[t]);for(let o=0;o<t.length;o++)if(typeof t[o]=="string"&&(t[o]=x.from(t[o])),!x.isBuffer(t[o]))throw new Error("Must be a Buffer");e||(e=x.alloc(xe.encodingLength(t))),r||(r=0);let n=r;return r+=2,t.forEach(function(o){e[r++]=o.length,o.copy(e,r,0,o.length),r+=o.length}),e.writeUInt16BE(r-n-2,n),xe.encode.bytes=r-n,e};xe.encode.bytes=0;xe.decode=function(t,e){e||(e=0);let r=e,n=t.readUInt16BE(e);e+=2;let o=[];for(;n>0;){let i=t[e++];if(--n,n<i)throw new Error("Buffer overflow");o.push(t.slice(e,e+i)),e+=i,n-=i}return xe.decode.bytes=e-r,o};xe.decode.bytes=0;xe.encodingLength=function(t){Array.isArray(t)||(t=[t]);let e=2;return t.forEach(function(r){typeof r=="string"?e+=x.byteLength(r)+1:e+=r.length+1}),e};var Ee=b.null={};Ee.encode=function(t,e,r){e||(e=x.alloc(Ee.encodingLength(t))),r||(r=0),typeof t=="string"&&(t=x.from(t)),t||(t=x.alloc(0));let n=r;r+=2;let o=t.length;return t.copy(e,r,0,o),r+=o,e.writeUInt16BE(r-n-2,n),Ee.encode.bytes=r-n,e};Ee.encode.bytes=0;Ee.decode=function(t,e){e||(e=0);let r=e,n=t.readUInt16BE(e);e+=2;let o=t.slice(e,e+n);return e+=n,Ee.decode.bytes=e-r,o};Ee.decode.bytes=0;Ee.encodingLength=function(t){return t?(x.isBuffer(t)?t.length:x.byteLength(t))+2:2};var ve=b.hinfo={};ve.encode=function(t,e,r){e||(e=x.alloc(ve.encodingLength(t))),r||(r=0);let n=r;return r+=2,A.encode(t.cpu,e,r),r+=A.encode.bytes,A.encode(t.os,e,r),r+=A.encode.bytes,e.writeUInt16BE(r-n-2,n),ve.encode.bytes=r-n,e};ve.encode.bytes=0;ve.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.cpu=A.decode(t,e),e+=A.decode.bytes,n.os=A.decode(t,e),e+=A.decode.bytes,ve.decode.bytes=e-r,n};ve.decode.bytes=0;ve.encodingLength=function(t){return A.encodingLength(t.cpu)+A.encodingLength(t.os)+2};var oe=b.ptr={},rc=b.cname=oe,tc=b.dname=oe;oe.encode=function(t,e,r){return e||(e=x.alloc(oe.encodingLength(t))),r||(r=0),m.encode(t,e,r+2),e.writeUInt16BE(m.encode.bytes,r),oe.encode.bytes=m.encode.bytes+2,e};oe.encode.bytes=0;oe.decode=function(t,e){e||(e=0);let r=m.decode(t,e+2);return oe.decode.bytes=m.decode.bytes+2,r};oe.decode.bytes=0;oe.encodingLength=function(t){return m.encodingLength(t)+2};var fe=b.srv={};fe.encode=function(t,e,r){e||(e=x.alloc(fe.encodingLength(t))),r||(r=0),e.writeUInt16BE(t.priority||0,r+2),e.writeUInt16BE(t.weight||0,r+4),e.writeUInt16BE(t.port||0,r+6),m.encode(t.target,e,r+8);let n=m.encode.bytes+6;return e.writeUInt16BE(n,r),fe.encode.bytes=n+2,e};fe.encode.bytes=0;fe.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n={};return n.priority=t.readUInt16BE(e+2),n.weight=t.readUInt16BE(e+4),n.port=t.readUInt16BE(e+6),n.target=m.decode(t,e+8),fe.decode.bytes=r+2,n};fe.decode.bytes=0;fe.encodingLength=function(t){return 8+m.encodingLength(t.target)};var J=b.caa={};J.ISSUER_CRITICAL=128;J.encode=function(t,e,r){let n=J.encodingLength(t);return e||(e=x.alloc(J.encodingLength(t))),r||(r=0),t.issuerCritical&&(t.flags=J.ISSUER_CRITICAL),e.writeUInt16BE(n-2,r),r+=2,e.writeUInt8(t.flags||0,r),r+=1,A.encode(t.tag,e,r),r+=A.encode.bytes,e.write(t.value,r),r+=x.byteLength(t.value),J.encode.bytes=n,e};J.encode.bytes=0;J.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e);e+=2;let n=e,o={};return o.flags=t.readUInt8(e),e+=1,o.tag=A.decode(t,e),e+=A.decode.bytes,o.value=t.toString("utf-8",e,n+r),o.issuerCritical=!!(o.flags&J.ISSUER_CRITICAL),J.decode.bytes=r+2,o};J.decode.bytes=0;J.encodingLength=function(t){return A.encodingLength(t.tag)+A.encodingLength(t.value)+2};var Ne=b.mx={};Ne.encode=function(t,e,r){e||(e=x.alloc(Ne.encodingLength(t))),r||(r=0);let n=r;return r+=2,e.writeUInt16BE(t.preference||0,r),r+=2,m.encode(t.exchange,e,r),r+=m.encode.bytes,e.writeUInt16BE(r-n-2,n),Ne.encode.bytes=r-n,e};Ne.encode.bytes=0;Ne.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.preference=t.readUInt16BE(e),e+=2,n.exchange=m.decode(t,e),e+=m.decode.bytes,Ne.decode.bytes=e-r,n};Ne.encodingLength=function(t){return 4+m.encodingLength(t.exchange)};var Ce=b.a={};Ce.encode=function(t,e,r){return e||(e=x.alloc(Ce.encodingLength(t))),r||(r=0),e.writeUInt16BE(4,r),r+=2,ke.v4.encode(t,e,r),Ce.encode.bytes=6,e};Ce.encode.bytes=0;Ce.decode=function(t,e){e||(e=0),e+=2;let r=ke.v4.decode(t,e);return Ce.decode.bytes=6,r};Ce.decode.bytes=0;Ce.encodingLength=function(){return 6};var Ie=b.aaaa={};Ie.encode=function(t,e,r){return e||(e=x.alloc(Ie.encodingLength(t))),r||(r=0),e.writeUInt16BE(16,r),r+=2,ke.v6.encode(t,e,r),Ie.encode.bytes=18,e};Ie.encode.bytes=0;Ie.decode=function(t,e){e||(e=0),e+=2;let r=ke.v6.decode(t,e);return Ie.decode.bytes=18,r};Ie.decode.bytes=0;Ie.encodingLength=function(){return 18};var K=b.option={};K.encode=function(t,e,r){e||(e=x.alloc(K.encodingLength(t))),r||(r=0);let n=r,o=bt.toCode(t.code);if(e.writeUInt16BE(o,r),r+=2,t.data)e.writeUInt16BE(t.data.length,r),r+=2,t.data.copy(e,r),r+=t.data.length;else switch(o){case 8:let i=t.sourcePrefixLength||0,s=t.family||ke.familyOf(t.ip),a=ke.encode(t.ip,x.alloc),g=Math.ceil(i/8);e.writeUInt16BE(g+4,r),r+=2,e.writeUInt16BE(s,r),r+=2,e.writeUInt8(i,r++),e.writeUInt8(t.scopePrefixLength||0,r++),a.copy(e,r,0,g),r+=g;break;case 11:t.timeout?(e.writeUInt16BE(2,r),r+=2,e.writeUInt16BE(t.timeout,r),r+=2):(e.writeUInt16BE(0,r),r+=2);break;case 12:let w=t.length||0;e.writeUInt16BE(w,r),r+=2,e.fill(0,r,r+w),r+=w;break;case 14:let p=t.tags.length*2;e.writeUInt16BE(p,r),r+=2;for(let d of t.tags)e.writeUInt16BE(d,r),r+=2;break;default:throw new Error(`Unknown roption code: ${t.code}`)}return K.encode.bytes=r-n,e};K.encode.bytes=0;K.decode=function(t,e){e||(e=0);let r={};r.code=t.readUInt16BE(e),r.type=bt.toString(r.code),e+=2;let n=t.readUInt16BE(e);switch(e+=2,r.data=t.slice(e,e+n),r.code){case 8:r.family=t.readUInt16BE(e),e+=2,r.sourcePrefixLength=t.readUInt8(e++),r.scopePrefixLength=t.readUInt8(e++);let o=x.alloc(r.family===1?4:16);t.copy(o,0,e,e+n-4),r.ip=ke.decode(o);break;case 11:n>0&&(r.timeout=t.readUInt16BE(e),e+=2);break;case 14:r.tags=[];for(let i=0;i<n;i+=2)r.tags.push(t.readUInt16BE(e)),e+=2}return K.decode.bytes=n+4,r};K.decode.bytes=0;K.encodingLength=function(t){if(t.data)return t.data.length+4;switch(bt.toCode(t.code)){case 8:let r=t.sourcePrefixLength||0;return Math.ceil(r/8)+8;case 11:return typeof t.timeout=="number"?6:4;case 12:return t.length+4;case 14:return 4+t.tags.length*2}throw new Error(`Unknown roption code: ${t.code}`)};var W=b.opt={};W.encode=function(t,e,r){e||(e=x.alloc(W.encodingLength(t))),r||(r=0);let n=r,o=Ge(t,K);return e.writeUInt16BE(o,r),r=dr(t,K,e,r+2),W.encode.bytes=r-n,e};W.encode.bytes=0;W.decode=function(t,e){e||(e=0);let r=e,n=[],o=t.readUInt16BE(e);e+=2;let i=0;for(;o>0;)n[i++]=K.decode(t,e),e+=K.decode.bytes,o-=K.decode.bytes;return W.decode.bytes=e-r,n};W.decode.bytes=0;W.encodingLength=function(t){return 2+Ge(t||[],K)};var j=b.dnskey={};j.PROTOCOL_DNSSEC=3;j.ZONE_KEY=128;j.SECURE_ENTRYPOINT=32768;j.encode=function(t,e,r){e||(e=x.alloc(j.encodingLength(t))),r||(r=0);let n=r,o=t.key;if(!x.isBuffer(o))throw new Error("Key must be a Buffer");return r+=2,e.writeUInt16BE(t.flags,r),r+=2,e.writeUInt8(j.PROTOCOL_DNSSEC,r),r+=1,e.writeUInt8(t.algorithm,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,j.encode.bytes=r-n,e.writeUInt16BE(j.encode.bytes-2,n),e};j.encode.bytes=0;j.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);if(e+=2,n.flags=t.readUInt16BE(e),e+=2,t.readUInt8(e)!==j.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=t.readUInt8(e),e+=1,n.key=t.slice(e,r+o+2),e+=n.key.length,j.decode.bytes=e-r,n};j.decode.bytes=0;j.encodingLength=function(t){return 6+x.byteLength(t.key)};var ce=b.rrsig={};ce.encode=function(t,e,r){e||(e=x.alloc(ce.encodingLength(t))),r||(r=0);let n=r,o=t.signature;if(!x.isBuffer(o))throw new Error("Signature must be a Buffer");return r+=2,e.writeUInt16BE(Se.toType(t.typeCovered),r),r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.labels,r),r+=1,e.writeUInt32BE(t.originalTTL,r),r+=4,e.writeUInt32BE(t.expiration,r),r+=4,e.writeUInt32BE(t.inception,r),r+=4,e.writeUInt16BE(t.keyTag,r),r+=2,m.encode(t.signersName,e,r),r+=m.encode.bytes,o.copy(e,r,0,o.length),r+=o.length,ce.encode.bytes=r-n,e.writeUInt16BE(ce.encode.bytes-2,n),e};ce.encode.bytes=0;ce.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);return e+=2,n.typeCovered=Se.toString(t.readUInt16BE(e)),e+=2,n.algorithm=t.readUInt8(e),e+=1,n.labels=t.readUInt8(e),e+=1,n.originalTTL=t.readUInt32BE(e),e+=4,n.expiration=t.readUInt32BE(e),e+=4,n.inception=t.readUInt32BE(e),e+=4,n.keyTag=t.readUInt16BE(e),e+=2,n.signersName=m.decode(t,e),e+=m.decode.bytes,n.signature=t.slice(e,r+o+2),e+=n.signature.length,ce.decode.bytes=e-r,n};ce.decode.bytes=0;ce.encodingLength=function(t){return 20+m.encodingLength(t.signersName)+x.byteLength(t.signature)};var ae=b.rp={};ae.encode=function(t,e,r){e||(e=x.alloc(ae.encodingLength(t))),r||(r=0);let n=r;return r+=2,m.encode(t.mbox||".",e,r),r+=m.encode.bytes,m.encode(t.txt||".",e,r),r+=m.encode.bytes,ae.encode.bytes=r-n,e.writeUInt16BE(ae.encode.bytes-2,n),e};ae.encode.bytes=0;ae.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.mbox=m.decode(t,e)||".",e+=m.decode.bytes,n.txt=m.decode(t,e)||".",e+=m.decode.bytes,ae.decode.bytes=e-r,n};ae.decode.bytes=0;ae.encodingLength=function(t){return 2+m.encodingLength(t.mbox||".")+m.encodingLength(t.txt||".")};var k={};k.encode=function(t,e,r){e||(e=x.alloc(k.encodingLength(t))),r||(r=0);let n=r;for(var o=[],i=0;i<t.length;i++){var s=Se.toType(t[i]);o[s>>8]===void 0&&(o[s>>8]=[]),o[s>>8][s>>3&31]|=1<<7-(s&7)}for(i=0;i<o.length;i++)if(o[i]!==void 0){var a=x.from(o[i]);e.writeUInt8(i,r),r+=1,e.writeUInt8(a.length,r),r+=1,a.copy(e,r),r+=a.length}return k.encode.bytes=r-n,e};k.encode.bytes=0;k.decode=function(t,e,r){e||(e=0);let n=e;for(var o=[];e-n<r;){var i=t.readUInt8(e);e+=1;var s=t.readUInt8(e);e+=1;for(var a=0;a<s;a++)for(var g=t.readUInt8(e+a),w=0;w<8;w++)if(g&1<<7-w){var p=Se.toString(i<<8|a<<3|w);o.push(p)}e+=s}return k.decode.bytes=e-n,o};k.decode.bytes=0;k.encodingLength=function(t){for(var e=[],r=0;r<t.length;r++){var n=Se.toType(t[r]);e[n>>8]=Math.max(e[n>>8]||0,n&255)}var o=0;for(r=0;r<e.length;r++)e[r]!==void 0&&(o+=2+Math.ceil((e[r]+1)/8));return o};var de=b.nsec={};de.encode=function(t,e,r){e||(e=x.alloc(de.encodingLength(t))),r||(r=0);let n=r;return r+=2,m.encode(t.nextDomain,e,r),r+=m.encode.bytes,k.encode(t.rrtypes,e,r),r+=k.encode.bytes,de.encode.bytes=r-n,e.writeUInt16BE(de.encode.bytes-2,n),e};de.encode.bytes=0;de.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);return e+=2,n.nextDomain=m.decode(t,e),e+=m.decode.bytes,n.rrtypes=k.decode(t,e,o-(e-r)),e+=k.decode.bytes,de.decode.bytes=e-r,n};de.decode.bytes=0;de.encodingLength=function(t){return 2+m.encodingLength(t.nextDomain)+k.encodingLength(t.rrtypes)};var le=b.nsec3={};le.encode=function(t,e,r){e||(e=x.alloc(le.encodingLength(t))),r||(r=0);let n=r,o=t.salt;if(!x.isBuffer(o))throw new Error("salt must be a Buffer");let i=t.nextDomain;if(!x.isBuffer(i))throw new Error("nextDomain must be a Buffer");return r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.flags,r),r+=1,e.writeUInt16BE(t.iterations,r),r+=2,e.writeUInt8(o.length,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,e.writeUInt8(i.length,r),r+=1,i.copy(e,r,0,i.length),r+=i.length,k.encode(t.rrtypes,e,r),r+=k.encode.bytes,le.encode.bytes=r-n,e.writeUInt16BE(le.encode.bytes-2,n),e};le.encode.bytes=0;le.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);e+=2,n.algorithm=t.readUInt8(e),e+=1,n.flags=t.readUInt8(e),e+=1,n.iterations=t.readUInt16BE(e),e+=2;let i=t.readUInt8(e);e+=1,n.salt=t.slice(e,e+i),e+=i;let s=t.readUInt8(e);return e+=1,n.nextDomain=t.slice(e,e+s),e+=s,n.rrtypes=k.decode(t,e,o-(e-r)),e+=k.decode.bytes,le.decode.bytes=e-r,n};le.decode.bytes=0;le.encodingLength=function(t){return 8+t.salt.length+t.nextDomain.length+k.encodingLength(t.rrtypes)};var ue=b.ds={};ue.encode=function(t,e,r){e||(e=x.alloc(ue.encodingLength(t))),r||(r=0);let n=r,o=t.digest;if(!x.isBuffer(o))throw new Error("Digest must be a Buffer");return r+=2,e.writeUInt16BE(t.keyTag,r),r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.digestType,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,ue.encode.bytes=r-n,e.writeUInt16BE(ue.encode.bytes-2,n),e};ue.encode.bytes=0;ue.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);return e+=2,n.keyTag=t.readUInt16BE(e),e+=2,n.algorithm=t.readUInt8(e),e+=1,n.digestType=t.readUInt8(e),e+=1,n.digest=t.slice(e,r+o+2),e+=n.digest.length,ue.decode.bytes=e-r,n};ue.decode.bytes=0;ue.encodingLength=function(t){return 6+x.byteLength(t.digest)};var Q=b.sshfp={};Q.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};Q.encode=function(e,r,n){r||(r=x.alloc(Q.encodingLength(e))),n||(n=0);let o=n;n+=2,r[n]=e.algorithm,n+=1,r[n]=e.hash,n+=1;let i=x.from(e.fingerprint.toUpperCase(),"hex");if(i.length!==Q.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return i.copy(r,n),n+=i.byteLength,Q.encode.bytes=n-o,r.writeUInt16BE(Q.encode.bytes-2,o),r};Q.encode.bytes=0;Q.decode=function(e,r){r||(r=0);let n=r,o={};r+=2,o.algorithm=e[r],r+=1,o.hash=e[r],r+=1;let i=Q.getFingerprintLengthForHashType(o.hash);return o.fingerprint=e.slice(r,r+i).toString("hex").toUpperCase(),r+=i,Q.decode.bytes=r-n,o};Q.decode.bytes=0;Q.encodingLength=function(t){return 4+x.from(t.fingerprint,"hex").byteLength};var he=b.naptr={};he.encode=function(t,e,r){e||(e=x.alloc(he.encodingLength(t))),r||(r=0);let n=r;return r+=2,e.writeUInt16BE(t.order||0,r),r+=2,e.writeUInt16BE(t.preference||0,r),r+=2,A.encode(t.flags,e,r),r+=A.encode.bytes,A.encode(t.services,e,r),r+=A.encode.bytes,A.encode(t.regexp,e,r),r+=A.encode.bytes,m.encode(t.replacement,e,r),r+=m.encode.bytes,he.encode.bytes=r-n,e.writeUInt16BE(he.encode.bytes-2,n),e};he.encode.bytes=0;he.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.order=t.readUInt16BE(e),e+=2,n.preference=t.readUInt16BE(e),e+=2,n.flags=A.decode(t,e),e+=A.decode.bytes,n.services=A.decode(t,e),e+=A.decode.bytes,n.regexp=A.decode(t,e),e+=A.decode.bytes,n.replacement=m.decode(t,e),e+=m.decode.bytes,he.decode.bytes=e-r,n};he.decode.bytes=0;he.encodingLength=function(t){return A.encodingLength(t.flags)+A.encodingLength(t.services)+A.encodingLength(t.regexp)+m.encodingLength(t.replacement)+6};var pe=b.tlsa={};pe.encode=function(t,e,r){e||(e=x.alloc(pe.encodingLength(t))),r||(r=0);let n=r,o=t.certificate;if(!x.isBuffer(o))throw new Error("Certificate must be a Buffer");return r+=2,e.writeUInt8(t.usage,r),r+=1,e.writeUInt8(t.selector,r),r+=1,e.writeUInt8(t.matchingType,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,pe.encode.bytes=r-n,e.writeUInt16BE(pe.encode.bytes-2,n),e};pe.encode.bytes=0;pe.decode=function(t,e){e||(e=0);let r=e,n={},o=t.readUInt16BE(e);return e+=2,n.usage=t.readUInt8(e),e+=1,n.selector=t.readUInt8(e),e+=1,n.matchingType=t.readUInt8(e),e+=1,n.certificate=t.slice(e,r+o+2),e+=n.certificate.length,pe.decode.bytes=e-r,n};pe.decode.bytes=0;pe.encodingLength=function(t){return 5+x.byteLength(t.certificate)};var Et=b.record=function(t){switch(t.toUpperCase()){case"A":return Ce;case"PTR":return oe;case"CNAME":return rc;case"DNAME":return tc;case"TXT":return xe;case"NULL":return Ee;case"AAAA":return Ie;case"SRV":return fe;case"HINFO":return ve;case"CAA":return J;case"NS":return we;case"SOA":return be;case"MX":return Ne;case"OPT":return W;case"DNSKEY":return j;case"RRSIG":return ce;case"RP":return ae;case"NSEC":return de;case"NSEC3":return le;case"SSHFP":return Q;case"DS":return ue;case"NAPTR":return he;case"TLSA":return pe}return ye},_=b.answer={};_.encode=function(t,e,r){e||(e=x.alloc(_.encodingLength(t))),r||(r=0);let n=r;if(m.encode(t.name,e,r),r+=m.encode.bytes,e.writeUInt16BE(Se.toType(t.type),r),t.type.toUpperCase()==="OPT"){if(t.name!==".")throw new Error("OPT name must be root.");e.writeUInt16BE(t.udpPayloadSize||4096,r+2),e.writeUInt8(t.extendedRcode||0,r+4),e.writeUInt8(t.ednsVersion||0,r+5),e.writeUInt16BE(t.flags||0,r+6),r+=8,W.encode(t.options||[],e,r),r+=W.encode.bytes}else{let o=Mr.toClass(t.class===void 0?"IN":t.class);t.flush&&(o|=xt),e.writeUInt16BE(o,r+2),e.writeUInt32BE(t.ttl||0,r+4),r+=8;let i=Et(t.type);i.encode(t.data,e,r),r+=i.encode.bytes}return _.encode.bytes=r-n,e};_.encode.bytes=0;_.decode=function(t,e){e||(e=0);let r={},n=e;if(r.name=m.decode(t,e),e+=m.decode.bytes,r.type=Se.toString(t.readUInt16BE(e)),r.type==="OPT")r.udpPayloadSize=t.readUInt16BE(e+2),r.extendedRcode=t.readUInt8(e+4),r.ednsVersion=t.readUInt8(e+5),r.flags=t.readUInt16BE(e+6),r.flag_do=(r.flags>>15&1)===1,r.options=W.decode(t,e+8),e+=8+W.decode.bytes;else{let o=t.readUInt16BE(e+2);r.ttl=t.readUInt32BE(e+4),r.class=Mr.toString(o&Zs),r.flush=!!(o&xt);let i=Et(r.type);r.data=i.decode(t,e+8),e+=8+i.decode.bytes}return _.decode.bytes=e-n,r};_.decode.bytes=0;_.encodingLength=function(t){let e=t.data!==null&&t.data!==void 0?t.data:t.options;return m.encodingLength(t.name)+8+Et(t.type).encodingLength(e)};var ie=b.question={};ie.encode=function(t,e,r){e||(e=x.alloc(ie.encodingLength(t))),r||(r=0);let n=r;return m.encode(t.name,e,r),r+=m.encode.bytes,e.writeUInt16BE(Se.toType(t.type),r),r+=2,e.writeUInt16BE(Mr.toClass(t.class===void 0?"IN":t.class),r),r+=2,ie.encode.bytes=r-n,t};ie.encode.bytes=0;ie.decode=function(t,e){e||(e=0);let r=e,n={};return n.name=m.decode(t,e),e+=m.decode.bytes,n.type=Se.toString(t.readUInt16BE(e)),e+=2,n.class=Mr.toString(t.readUInt16BE(e)),e+=2,!!(n.class&vo)&&(n.class&=ec),ie.decode.bytes=e-r,n};ie.decode.bytes=0;ie.encodingLength=function(t){return m.encodingLength(t.name)+4};b.AUTHORITATIVE_ANSWER=1024;b.TRUNCATED_RESPONSE=512;b.RECURSION_DESIRED=256;b.RECURSION_AVAILABLE=128;b.AUTHENTIC_DATA=32;b.CHECKING_DISABLED=16;b.DNSSEC_OK=32768;b.encode=function(t,e,r){let n=!e;n&&(e=x.alloc(b.encodingLength(t))),r||(r=0);let o=r;return t.questions||(t.questions=[]),t.answers||(t.answers=[]),t.authorities||(t.authorities=[]),t.additionals||(t.additionals=[]),se.encode(t,e,r),r+=se.encode.bytes,r=dr(t.questions,ie,e,r),r=dr(t.answers,_,e,r),r=dr(t.authorities,_,e,r),r=dr(t.additionals,_,e,r),b.encode.bytes=r-o,n&&b.encode.bytes!==e.length?e.slice(0,b.encode.bytes):e};b.encode.bytes=0;b.decode=function(t,e){e||(e=0);let r=e,n=se.decode(t,e);return e+=se.decode.bytes,e=Fr(n.questions,ie,t,e),e=Fr(n.answers,_,t,e),e=Fr(n.authorities,_,t,e),e=Fr(n.additionals,_,t,e),b.decode.bytes=e-r,n};b.decode.bytes=0;b.encodingLength=function(t){return se.encodingLength(t)+Ge(t.questions||[],ie)+Ge(t.answers||[],_)+Ge(t.authorities||[],_)+Ge(t.additionals||[],_)};b.streamEncode=function(t){let e=b.encode(t),r=x.alloc(2);r.writeUInt16BE(e.byteLength);let n=x.concat([r,e]);return b.streamEncode.bytes=n.byteLength,n};b.streamEncode.bytes=0;b.streamDecode=function(t){let e=t.readUInt16BE(0);if(t.byteLength<e+2)return null;let r=b.decode(t.slice(2));return b.streamDecode.bytes=b.decode.bytes,r};b.streamDecode.bytes=0;function Ge(t,e){let r=0;for(let n=0;n<t.length;n++)r+=e.encodingLength(t[n]);return r}function dr(t,e,r,n){for(let o=0;o<t.length;o++)e.encode(t[o],r,n),n+=e.encode.bytes;return n}function Fr(t,e,r,n){for(let o=0;o<t.length;o++)t[o]=e.decode(r,n),n+=e.decode.bytes;return n}});var So=F((Ru,Io)=>{"use strict";var Co=ac;process.nextTick(cc,42);Io.exports=nc;function nc(t){var e=n;return r;function r(o){e(o||ic)}function n(o){var i=[o];e=s,t(a);function s(g){i.push(g)}function a(g){var w=arguments;for(e=oc(g)?n:p;i.length;)p(i.shift());function p(d){Co(sc,d,w)}}}}function oc(t){return Object.prototype.toString.call(t)==="[object Error]"}function ic(){}function sc(t,e){t.apply(null,e)}function cc(t){t===42&&(Co=process.nextTick)}function ac(t,e,r){process.nextTick(function(){t(e,r)})}});var Oo=F((Fu,Uo)=>{var vt=fo(),dc=te("dgram"),lc=So(),uc=te("events"),Ct=te("os"),ft=function(){};Uo.exports=function(t){t||(t={});var e=new uc.EventEmitter,r=typeof t.port=="number"?t.port:5353,n=t.type||"udp4",o=t.ip||t.host||(n==="udp4"?"224.0.0.251":null),i={address:o,port:r},s={},a=!1,g=null;if(n==="udp6"&&(!o||!t.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var w=t.socket||dc.createSocket({type:n,reuseAddr:t.reuseAddr!==!1,toString:function(){return n}});w.on("error",function(d){d.code==="EACCES"||d.code==="EADDRINUSE"?e.emit("error",d):e.emit("warning",d)}),w.on("message",function(d,l){try{d=vt.decode(d)}catch(u){e.emit("warning",u);return}e.emit("packet",d,l),d.type==="query"&&e.emit("query",d,l),d.type==="response"&&e.emit("response",d,l)}),w.on("listening",function(){r||(r=i.port=w.address().port),t.multicast!==!1&&(e.update(),g=setInterval(e.update,5e3),w.setMulticastTTL(t.ttl||255),w.setMulticastLoopback(t.loopback!==!1))});var p=lc(function(d){if(!r||t.bind===!1)return d(null);w.once("error",d),w.bind(r,t.bind||t.interface,function(){w.removeListener("error",d),d(null)})});return p(function(d){if(d)return e.emit("error",d);e.emit("ready")}),e.send=function(d,l,u){if(typeof l=="function")return e.send(d,null,l);u||(u=ft),l?!l.host&&!l.address&&(l.address=i.address):l=i,p(c);function c(h){if(a)return u();if(h)return u(h);var y=vt.encode(d);w.send(y,0,y.length,l.port,l.address||l.host,u)}},e.response=e.respond=function(d,l,u){Array.isArray(d)&&(d={answers:d}),d.type="response",d.flags=(d.flags||0)|vt.AUTHORITATIVE_ANSWER,e.send(d,l,u)},e.query=function(d,l,u,c){if(typeof l=="function")return e.query(d,null,null,l);if(typeof l=="object"&&l&&l.port)return e.query(d,null,l,u);if(typeof u=="function")return e.query(d,l,null,u);c||(c=ft),typeof d=="string"&&(d=[{name:d,type:l||"ANY"}]),Array.isArray(d)&&(d={type:"query",questions:d}),d.type="query",e.send(d,u,c)},e.destroy=function(d){if(d||(d=ft),a)return process.nextTick(d);a=!0,clearInterval(g);for(var l in s)try{w.dropMembership(o,l)}catch{}s={},w.close(d)},e.update=function(){for(var d=t.interface?[].concat(t.interface):pc(),l=!1,u=0;u<d.length;u++){var c=d[u];if(!s[c])try{w.addMembership(o,c),s[c]=!0,l=!0}catch(h){e.emit("warning",h)}}if(l){if(w.setMulticastInterface)try{w.setMulticastInterface(t.interface||hc())}catch(h){e.emit("warning",h)}e.emit("networkInterface")}},e};function hc(){for(var t=Ct.networkInterfaces(),e=Object.keys(t),r=0;r<e.length;r++)for(var n=t[e[r]],o=0;o<n.length;o++){var i=n[o];if(Ao(i.family)&&!i.internal)return Ct.platform()==="darwin"&&e[r]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function pc(){for(var t=Ct.networkInterfaces(),e=Object.keys(t),r=[],n=0;n<e.length;n++)for(var o=t[e[n]],i=0;i<o.length;i++){var s=o[i];if(Ao(s.family)){r.push(s.address);break}}return r}function Ao(t){return t===4||t==="IPv4"}});var Ai=F((Np,Si)=>{Si.exports=bn;var Ii=128,Jd=127,Qd=~Jd,Wd=Math.pow(2,31);function bn(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw bn.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=Wd;)e[r++]=t&255|Ii,t/=128;for(;t&Qd;)e[r++]=t&255|Ii,t>>>=7;return e[r]=t|0,bn.bytes=r-n+1,e}});var Ti=F((Pp,Oi)=>{Oi.exports=xn;var Zd=128,Ui=127;function xn(t,n){var r=0,n=n||0,o=0,i=n,s,a=t.length;do{if(i>=a||o>49)throw xn.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=o<28?(s&Ui)<<o:(s&Ui)*Math.pow(2,o),o+=7}while(s>=Zd);return xn.bytes=i-n,r}});var Bi=F((Dp,Li)=>{var el=Math.pow(2,7),rl=Math.pow(2,14),tl=Math.pow(2,21),nl=Math.pow(2,28),ol=Math.pow(2,35),il=Math.pow(2,42),sl=Math.pow(2,49),cl=Math.pow(2,56),al=Math.pow(2,63);Li.exports=function(t){return t<el?1:t<rl?2:t<tl?3:t<nl?4:t<ol?5:t<il?6:t<sl?7:t<cl?8:t<al?9:10}});var Xr=F((Rp,Ni)=>{Ni.exports={encode:Ai(),decode:Ti(),encodingLength:Bi()}});var au={};O(au,{mdns:()=>cu});var Tr=class extends EventTarget{#e=new Map;listenerCount(e){let r=this.#e.get(e);return r==null?0:r.length}addEventListener(e,r,n){super.addEventListener(e,r,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:r,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,r,n){super.removeEventListener(e.toString(),r??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:i})=>i!==r),this.#e.set(e,o))}dispatchEvent(e){let r=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),r}safeDispatchEvent(e,r){return this.dispatchEvent(new Lr(e,r))}},et=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},Lr=globalThis.CustomEvent??et;var Xn=Symbol.for("@libp2p/peer-discovery");var Y=Te(oo(),1);var at={};O(at,{base32:()=>Be,base32hex:()=>_s,base32hexpad:()=>qs,base32hexpadupper:()=>$s,base32hexupper:()=>Vs,base32pad:()=>ks,base32padupper:()=>zs,base32upper:()=>Ms,base32z:()=>js});function Ns(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 o=0;o<t.length;o++){var i=t.charAt(o),s=i.charCodeAt(0);if(r[s]!==255)throw new TypeError(i+" is ambiguous");r[s]=o}var a=t.length,g=t.charAt(0),w=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function d(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var h=0,y=0,E=0,v=c.length;E!==v&&c[E]===0;)E++,h++;for(var I=(v-E)*p+1>>>0,f=new Uint8Array(I);E!==v;){for(var C=c[E],S=0,U=I-1;(C!==0||S<y)&&U!==-1;U--,S++)C+=256*f[U]>>>0,f[U]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");y=S,E++}for(var T=I-y;T!==I&&f[T]===0;)T++;for(var V=g.repeat(h);T<I;++T)V+=t.charAt(f[T]);return V}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var h=0;if(c[h]!==" "){for(var y=0,E=0;c[h]===g;)y++,h++;for(var v=(c.length-h)*w+1>>>0,I=new Uint8Array(v);c[h];){var f=r[c.charCodeAt(h)];if(f===255)return;for(var C=0,S=v-1;(f!==0||C<E)&&S!==-1;S--,C++)f+=a*I[S]>>>0,I[S]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");E=C,h++}if(c[h]!==" "){for(var U=v-E;U!==v&&I[U]===0;)U++;for(var T=new Uint8Array(y+(v-U)),V=y;U!==v;)T[V++]=I[U++];return T}}}function u(c){var h=l(c);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var Ps=Ns,Ds=Ps,io=Ds;var bu=new Uint8Array(0);var so=(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},Z=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")};var co=t=>new TextEncoder().encode(t),ao=t=>new TextDecoder().decode(t);var ot=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")}},it=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return uo(this,e)}},st=class{constructor(e){this.decoders=e}or(e){return uo(this,e)}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`)}},uo=(t,e)=>new st({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),ct=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new ot(e,r,n),this.decoder=new it(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ke=({name:t,prefix:e,encode:r,decode:n})=>new ct(t,e,r,n),Le=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=io(r,e);return Ke({prefix:t,name:e,encode:n,decode:i=>Z(o(i))})},Rs=(t,e,r,n)=>{let o={};for(let p=0;p<e.length;++p)o[e[p]]=p;let i=t.length;for(;t[i-1]==="=";)--i;let s=new Uint8Array(i*r/8|0),a=0,g=0,w=0;for(let p=0;p<i;++p){let d=o[t[p]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<r|d,a+=r,a>=8&&(a-=8,s[w++]=255&g>>a)}if(a>=r||255&g<<8-a)throw new SyntaxError("Unexpected end of data");return s},Fs=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,i="",s=0,a=0;for(let g=0;g<t.length;++g)for(a=a<<8|t[g],s+=8;s>r;)s-=r,i+=e[o&a>>s];if(s&&(i+=e[o&a<<r-s]),n)for(;i.length*r&7;)i+="=";return i},P=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Ke({prefix:e,name:t,encode(o){return Fs(o,n,r)},decode(o){return Rs(o,n,r,t)}});var Be=P({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ms=P({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ks=P({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zs=P({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),_s=P({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Vs=P({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),qs=P({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$s=P({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),js=P({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var dt={};O(dt,{base58btc:()=>$,base58flickr:()=>Ks});var $=Le({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ks=Le({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ut={};O(ut,{base64:()=>lt,base64pad:()=>Gs,base64url:()=>Xs,base64urlpad:()=>Hs});var lt=P({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gs=P({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Xs=P({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Hs=P({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});Y.default.formatters.b=t=>t==null?"undefined":$.baseEncode(t);Y.default.formatters.t=t=>t==null?"undefined":Be.baseEncode(t);Y.default.formatters.m=t=>t==null?"undefined":lt.baseEncode(t);Y.default.formatters.p=t=>t==null?"undefined":t.toString();Y.default.formatters.c=t=>t==null?"undefined":t.toString();Y.default.formatters.k=t=>t==null?"undefined":t.toString();Y.default.formatters.a=t=>t==null?"undefined":t.toString();function Ys(t){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=t,e.destroy=()=>!0,e.extend=()=>e,e}function Rr(t){let e=Ys(`${t}:trace`);return Y.default.enabled(`${t}:trace`)&&Y.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(e=(0,Y.default)(`${t}:trace`)),Object.assign((0,Y.default)(t),{error:(0,Y.default)(`${t}:error`),trace:e})}var ts=Te(Oo(),1);var To=Symbol.for("@libp2p/peer-id");var It={};O(It,{identity:()=>gc});var gc=Ke({prefix:"\0",name:"identity",encode:t=>ao(t),decode:t=>co(t)});var St={};O(St,{base2:()=>yc});var yc=P({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var At={};O(At,{base8:()=>wc});var wc=P({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ut={};O(Ut,{base10:()=>bc});var bc=Le({prefix:"9",name:"base10",alphabet:"0123456789"});var Ot={};O(Ot,{base16:()=>xc,base16upper:()=>Ec});var xc=P({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ec=P({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Tt={};O(Tt,{base36:()=>vc,base36upper:()=>fc});var vc=Le({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fc=Le({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Lt={};O(Lt,{base256emoji:()=>Uc});var Lo=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}"),Cc=Lo.reduce((t,e,r)=>(t[r]=e,t),[]),Ic=Lo.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Sc(t){return t.reduce((e,r)=>(e+=Cc[r],e),"")}function Ac(t){let e=[];for(let r of t){let n=Ic[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Uc=Ke({prefix:"\u{1F680}",name:"base256emoji",encode:Sc,decode:Ac});var Rt={};O(Rt,{sha256:()=>zr,sha512:()=>Gc});var Dt=Te(te("crypto"),1);var Oc=Po,Bo=128,Tc=127,Lc=~Tc,Bc=Math.pow(2,31);function Po(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Bc;)e[r++]=t&255|Bo,t/=128;for(;t&Lc;)e[r++]=t&255|Bo,t>>>=7;return e[r]=t|0,Po.bytes=r-n+1,e}var Nc=Bt,Pc=128,No=127;function Bt(t,n){var r=0,n=n||0,o=0,i=n,s,a=t.length;do{if(i>=a)throw Bt.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=o<28?(s&No)<<o:(s&No)*Math.pow(2,o),o+=7}while(s>=Pc);return Bt.bytes=i-n,r}var Dc=Math.pow(2,7),Rc=Math.pow(2,14),Fc=Math.pow(2,21),Mc=Math.pow(2,28),kc=Math.pow(2,35),zc=Math.pow(2,42),_c=Math.pow(2,49),Vc=Math.pow(2,56),qc=Math.pow(2,63),$c=function(t){return t<Dc?1:t<Rc?2:t<Fc?3:t<Mc?4:t<kc?5:t<zc?6:t<_c?7:t<Vc?8:t<qc?9:10},jc={encode:Oc,decode:Nc,encodingLength:$c},Kc=jc,lr=Kc;var ur=(t,e=0)=>[lr.decode(t,e),lr.decode.bytes],Xe=(t,e,r=0)=>(lr.encode(t,e,r),e),He=t=>lr.encodingLength(t);var Pe=(t,e)=>{let r=e.byteLength,n=He(t),o=n+He(r),i=new Uint8Array(o+r);return Xe(t,i,0),Xe(r,i,n),i.set(e,o),new Ye(t,r,e,i)},hr=t=>{let e=Z(t),[r,n]=ur(e),[o,i]=ur(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Ye(r,o,s,e)},Do=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&so(t.bytes,r.bytes)}},Ye=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var Pt=({name:t,code:e,encode:r})=>new Nt(t,e,r),Nt=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Pe(this.code,r):r.then(n=>Pe(this.code,n))}else throw Error("Unknown type, must be binary type")}};var zr=Pt({name:"sha2-256",code:18,encode:t=>Z(Dt.default.createHash("sha256").update(t).digest())}),Gc=Pt({name:"sha2-512",code:19,encode:t=>Z(Dt.default.createHash("sha512").update(t).digest())});var Ft={};O(Ft,{identity:()=>_r});var Fo=0,Xc="identity",Mo=Z,Hc=t=>Pe(Fo,Mo(t)),_r={code:Fo,name:Xc,encode:Mo,digest:Hc};var rh=new TextEncoder,th=new TextDecoder;var ko=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return Wc(r,Mt(t),e||$.encoder);default:return Zc(r,Mt(t),e||Be.encoder)}};var zo=new WeakMap,Mt=t=>{let e=zo.get(t);if(e==null){let r=new Map;return zo.set(t,r),r}return e},N=class{constructor(e,r,n,o){this.code=r,this.version=e,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:e,multihash:r}=this;if(e!==pr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==ea)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return N.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Pe(e,r);return N.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(e){return N.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&Do(e.multihash,n.multihash)}toString(e){return ko(this,e)}toJSON(){return{"/":ko(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof N)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:i,bytes:s}=r;return new N(n,o,i,s||_o(n,o,i.bytes))}else if(r[ra]===!0){let{version:n,multihash:o,code:i}=r,s=hr(o);return N.create(n,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==pr)throw new Error(`Version 0 CID must use dag-pb (code: ${pr}) block encoding`);return new N(e,r,n,n.bytes)}case 1:{let o=_o(e,r,n.bytes);return new N(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return N.create(0,pr,e)}static createV1(e,r){return N.create(1,e,r)}static decode(e){let[r,n]=N.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=N.inspectBytes(e),n=r.size-r.multihashSize,o=Z(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let i=o.subarray(r.multihashSize-r.digestSize),s=new Ye(r.multihashCode,r.digestSize,i,o);return[r.version===0?N.createV0(s):N.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,l]=ur(e.subarray(r));return r+=l,d},o=n(),i=pr;if(o===18?(o=0,r=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=r,a=n(),g=n(),w=r+g,p=w-s;return{version:o,codec:i,multihashCode:a,digestSize:g,multihashSize:p,size:w}}static parse(e,r){let[n,o]=Qc(e,r),i=N.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Mt(i).set(n,e),i}},Qc=(t,e)=>{switch(t[0]){case"Q":{let r=e||$;return[$.prefix,r.decode(`${$.prefix}${t}`)]}case $.prefix:{let r=e||$;return[$.prefix,r.decode(t)]}case Be.prefix:{let r=e||Be;return[Be.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)]}}},Wc=(t,e,r)=>{let{prefix:n}=r;if(n!==$.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let i=r.encode(t).slice(1);return e.set(n,i),i}else return o},Zc=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let i=r.encode(t);return e.set(n,i),i}else return o},pr=112,ea=18,_o=(t,e,r)=>{let n=He(t),o=n+He(e),i=new Uint8Array(o+r.byteLength);return Xe(t,i,0),Xe(e,i,n),i.set(r,o),i},ra=Symbol.for("@ipld/js-cid/CID");var kt={...It,...St,...At,...Ut,...Ot,...at,...Tt,...dt,...ut,...Lt},hh={...Rt,...Ft};function mr(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 ta=Symbol.for("nodejs.util.inspect.custom"),Vo=Object.values(kt).map(t=>t.decoder).reduce((t,e)=>t.or(e),kt.identity.decoder),qo=114,$o=36,jo=37,gr=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[To]=!0;toString(){return this.string==null&&(this.string=$.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return N.createV1(qo,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return mr(this.multihash.bytes,e);if(typeof e=="string")return zt(e).equals(this);if(e?.multihash?.bytes!=null)return mr(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[ta](){return`PeerId(${this.toString()})`}},yr=class extends gr{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},wr=class extends gr{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},br=class extends gr{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function zt(t,e){if(e=e??Vo,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=hr($.decode(`z${t}`));return t.startsWith("12D")?new wr({multihash:r}):t.startsWith("16U")?new br({multihash:r}):new yr({multihash:r})}return na(Vo.decode(t))}function na(t){try{let e=hr(t);if(e.code===_r.code){if(e.digest.length===$o)return new wr({multihash:e});if(e.digest.length===jo)return new br({multihash:e})}if(e.code===zr.code)return new yr({multihash:e})}catch{return oa(N.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function oa(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==qo)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===zr.code)return new yr({multihash:t.multihash});if(e.code===_r.code){if(e.digest.length===$o)return new wr({multihash:t.multihash});if(e.digest.length===jo)return new br({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Vr=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var jt={};O(jt,{base58btc:()=>G,base58flickr:()=>la});function ia(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 o=0;o<t.length;o++){var i=t.charAt(o),s=i.charCodeAt(0);if(r[s]!==255)throw new TypeError(i+" is ambiguous");r[s]=o}var a=t.length,g=t.charAt(0),w=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function d(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var h=0,y=0,E=0,v=c.length;E!==v&&c[E]===0;)E++,h++;for(var I=(v-E)*p+1>>>0,f=new Uint8Array(I);E!==v;){for(var C=c[E],S=0,U=I-1;(C!==0||S<y)&&U!==-1;U--,S++)C+=256*f[U]>>>0,f[U]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");y=S,E++}for(var T=I-y;T!==I&&f[T]===0;)T++;for(var V=g.repeat(h);T<I;++T)V+=t.charAt(f[T]);return V}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var h=0;if(c[h]!==" "){for(var y=0,E=0;c[h]===g;)y++,h++;for(var v=(c.length-h)*w+1>>>0,I=new Uint8Array(v);c[h];){var f=r[c.charCodeAt(h)];if(f===255)return;for(var C=0,S=v-1;(f!==0||C<E)&&S!==-1;S--,C++)f+=a*I[S]>>>0,I[S]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");E=C,h++}if(c[h]!==" "){for(var U=v-E;U!==v&&I[U]===0;)U++;for(var T=new Uint8Array(y+(v-U)),V=y;U!==v;)T[V++]=I[U++];return T}}}function u(c){var h=l(c);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var sa=ia,ca=sa,Ko=ca;var Oh=new Uint8Array(0);var Go=(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},ee=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")};var Xo=t=>new TextEncoder().encode(t),Ho=t=>new TextDecoder().decode(t);var _t=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")}},Vt=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Jo(this,e)}},qt=class{constructor(e){this.decoders=e}or(e){return Jo(this,e)}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`)}},Jo=(t,e)=>new qt({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),$t=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new _t(e,r,n),this.decoder=new Vt(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Qe=({name:t,prefix:e,encode:r,decode:n})=>new $t(t,e,r,n),De=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=Ko(r,e);return Qe({prefix:t,name:e,encode:n,decode:i=>ee(o(i))})},aa=(t,e,r,n)=>{let o={};for(let p=0;p<e.length;++p)o[e[p]]=p;let i=t.length;for(;t[i-1]==="=";)--i;let s=new Uint8Array(i*r/8|0),a=0,g=0,w=0;for(let p=0;p<i;++p){let d=o[t[p]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<r|d,a+=r,a>=8&&(a-=8,s[w++]=255&g>>a)}if(a>=r||255&g<<8-a)throw new SyntaxError("Unexpected end of data");return s},da=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,i="",s=0,a=0;for(let g=0;g<t.length;++g)for(a=a<<8|t[g],s+=8;s>r;)s-=r,i+=e[o&a>>s];if(s&&(i+=e[o&a<<r-s]),n)for(;i.length*r&7;)i+="=";return i},D=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Qe({prefix:e,name:t,encode(o){return da(o,n,r)},decode(o){return aa(o,n,r,t)}});var G=De({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),la=De({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ua=Zo,Qo=128,ha=127,pa=~ha,ma=Math.pow(2,31);function Zo(t,e,r){e=e||[],r=r||0;for(var n=r;t>=ma;)e[r++]=t&255|Qo,t/=128;for(;t&pa;)e[r++]=t&255|Qo,t>>>=7;return e[r]=t|0,Zo.bytes=r-n+1,e}var ga=Kt,ya=128,Wo=127;function Kt(t,n){var r=0,n=n||0,o=0,i=n,s,a=t.length;do{if(i>=a)throw Kt.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=o<28?(s&Wo)<<o:(s&Wo)*Math.pow(2,o),o+=7}while(s>=ya);return Kt.bytes=i-n,r}var wa=Math.pow(2,7),ba=Math.pow(2,14),xa=Math.pow(2,21),Ea=Math.pow(2,28),va=Math.pow(2,35),fa=Math.pow(2,42),Ca=Math.pow(2,49),Ia=Math.pow(2,56),Sa=Math.pow(2,63),Aa=function(t){return t<wa?1:t<ba?2:t<xa?3:t<Ea?4:t<va?5:t<fa?6:t<Ca?7:t<Ia?8:t<Sa?9:10},Ua={encode:ua,decode:ga,encodingLength:Aa},Oa=Ua,xr=Oa;var Er=(t,e=0)=>[xr.decode(t,e),xr.decode.bytes],We=(t,e,r=0)=>(xr.encode(t,e,r),e),Ze=t=>xr.encodingLength(t);var ze=(t,e)=>{let r=e.byteLength,n=Ze(t),o=n+Ze(r),i=new Uint8Array(o+r);return We(t,i,0),We(r,i,n),i.set(e,o),new er(t,r,e,i)},$r=t=>{let e=ee(t),[r,n]=Er(e),[o,i]=Er(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new er(r,o,s,e)},ei=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Go(t.bytes,r.bytes)}},er=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var Gt={};O(Gt,{base32:()=>Ae,base32hex:()=>Na,base32hexpad:()=>Da,base32hexpadupper:()=>Ra,base32hexupper:()=>Pa,base32pad:()=>La,base32padupper:()=>Ba,base32upper:()=>Ta,base32z:()=>Fa});var Ae=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ta=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),La=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ba=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Na=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Pa=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Da=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ra=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Fa=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ri=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return ka(r,Xt(t),e||G.encoder);default:return za(r,Xt(t),e||Ae.encoder)}};var ti=new WeakMap,Xt=t=>{let e=ti.get(t);if(e==null){let r=new Map;return ti.set(t,r),r}return e},B=class{constructor(e,r,n,o){this.code=r,this.version=e,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:e,multihash:r}=this;if(e!==vr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==_a)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return B.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ze(e,r);return B.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(e){return B.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&ei(e.multihash,n.multihash)}toString(e){return ri(this,e)}toJSON(){return{"/":ri(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof B)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:i,bytes:s}=r;return new B(n,o,i,s||ni(n,o,i.bytes))}else if(r[Va]===!0){let{version:n,multihash:o,code:i}=r,s=$r(o);return B.create(n,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==vr)throw new Error(`Version 0 CID must use dag-pb (code: ${vr}) block encoding`);return new B(e,r,n,n.bytes)}case 1:{let o=ni(e,r,n.bytes);return new B(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return B.create(0,vr,e)}static createV1(e,r){return B.create(1,e,r)}static decode(e){let[r,n]=B.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=B.inspectBytes(e),n=r.size-r.multihashSize,o=ee(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let i=o.subarray(r.multihashSize-r.digestSize),s=new er(r.multihashCode,r.digestSize,i,o);return[r.version===0?B.createV0(s):B.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,l]=Er(e.subarray(r));return r+=l,d},o=n(),i=vr;if(o===18?(o=0,r=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=r,a=n(),g=n(),w=r+g,p=w-s;return{version:o,codec:i,multihashCode:a,digestSize:g,multihashSize:p,size:w}}static parse(e,r){let[n,o]=Ma(e,r),i=B.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Xt(i).set(n,e),i}},Ma=(t,e)=>{switch(t[0]){case"Q":{let r=e||G;return[G.prefix,r.decode(`${G.prefix}${t}`)]}case G.prefix:{let r=e||G;return[G.prefix,r.decode(t)]}case Ae.prefix:{let r=e||Ae;return[Ae.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)]}}},ka=(t,e,r)=>{let{prefix:n}=r;if(n!==G.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let i=r.encode(t).slice(1);return e.set(n,i),i}else return o},za=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let i=r.encode(t);return e.set(n,i),i}else return o},vr=112,_a=18,ni=(t,e,r)=>{let n=Ze(t),o=n+Ze(e),i=new Uint8Array(o+r.byteLength);return We(t,i,0),We(e,i,n),i.set(r,o),i},Va=Symbol.for("@ipld/js-cid/CID");var Wt={};O(Wt,{identity:()=>Xa});function qa(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 o=0;o<t.length;o++){var i=t.charAt(o),s=i.charCodeAt(0);if(r[s]!==255)throw new TypeError(i+" is ambiguous");r[s]=o}var a=t.length,g=t.charAt(0),w=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function d(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var h=0,y=0,E=0,v=c.length;E!==v&&c[E]===0;)E++,h++;for(var I=(v-E)*p+1>>>0,f=new Uint8Array(I);E!==v;){for(var C=c[E],S=0,U=I-1;(C!==0||S<y)&&U!==-1;U--,S++)C+=256*f[U]>>>0,f[U]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");y=S,E++}for(var T=I-y;T!==I&&f[T]===0;)T++;for(var V=g.repeat(h);T<I;++T)V+=t.charAt(f[T]);return V}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var h=0;if(c[h]!==" "){for(var y=0,E=0;c[h]===g;)y++,h++;for(var v=(c.length-h)*w+1>>>0,I=new Uint8Array(v);c[h];){var f=r[c.charCodeAt(h)];if(f===255)return;for(var C=0,S=v-1;(f!==0||C<E)&&S!==-1;S--,C++)f+=a*I[S]>>>0,I[S]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");E=C,h++}if(c[h]!==" "){for(var U=v-E;U!==v&&I[U]===0;)U++;for(var T=new Uint8Array(y+(v-U)),V=y;U!==v;)T[V++]=I[U++];return T}}}function u(c){var h=l(c);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var $a=qa,ja=$a,oi=ja;var $h=new Uint8Array(0);var ii=(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},re=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")};var si=t=>new TextEncoder().encode(t),ci=t=>new TextDecoder().decode(t);var Ht=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")}},Yt=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return di(this,e)}},Jt=class{constructor(e){this.decoders=e}or(e){return di(this,e)}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`)}},di=(t,e)=>new Jt({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Qt=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new Ht(e,r,n),this.decoder=new Yt(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},tr=({name:t,prefix:e,encode:r,decode:n})=>new Qt(t,e,r,n),Re=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=oi(r,e);return tr({prefix:t,name:e,encode:n,decode:i=>re(o(i))})},Ka=(t,e,r,n)=>{let o={};for(let p=0;p<e.length;++p)o[e[p]]=p;let i=t.length;for(;t[i-1]==="=";)--i;let s=new Uint8Array(i*r/8|0),a=0,g=0,w=0;for(let p=0;p<i;++p){let d=o[t[p]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<r|d,a+=r,a>=8&&(a-=8,s[w++]=255&g>>a)}if(a>=r||255&g<<8-a)throw new SyntaxError("Unexpected end of data");return s},Ga=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,i="",s=0,a=0;for(let g=0;g<t.length;++g)for(a=a<<8|t[g],s+=8;s>r;)s-=r,i+=e[o&a>>s];if(s&&(i+=e[o&a<<r-s]),n)for(;i.length*r&7;)i+="=";return i},R=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>tr({prefix:e,name:t,encode(o){return Ga(o,n,r)},decode(o){return Ka(o,n,r,t)}});var Xa=tr({prefix:"\0",name:"identity",encode:t=>ci(t),decode:t=>si(t)});var Zt={};O(Zt,{base2:()=>Ha});var Ha=R({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var en={};O(en,{base8:()=>Ya});var Ya=R({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var rn={};O(rn,{base10:()=>Ja});var Ja=Re({prefix:"9",name:"base10",alphabet:"0123456789"});var tn={};O(tn,{base16:()=>Qa,base16upper:()=>Wa});var Qa=R({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Wa=R({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var nn={};O(nn,{base32:()=>nr,base32hex:()=>td,base32hexpad:()=>od,base32hexpadupper:()=>id,base32hexupper:()=>nd,base32pad:()=>ed,base32padupper:()=>rd,base32upper:()=>Za,base32z:()=>sd});var nr=R({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Za=R({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ed=R({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rd=R({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),td=R({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nd=R({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),od=R({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),id=R({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),sd=R({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var on={};O(on,{base36:()=>cd,base36upper:()=>ad});var cd=Re({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ad=Re({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var sn={};O(sn,{base58btc:()=>me,base58flickr:()=>dd});var me=Re({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dd=Re({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var cn={};O(cn,{base64:()=>ld,base64pad:()=>ud,base64url:()=>hd,base64urlpad:()=>pd});var ld=R({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ud=R({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),hd=R({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),pd=R({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var an={};O(an,{base256emoji:()=>bd});var li=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}"),md=li.reduce((t,e,r)=>(t[r]=e,t),[]),gd=li.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function yd(t){return t.reduce((e,r)=>(e+=md[r],e),"")}function wd(t){let e=[];for(let r of t){let n=gd[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var bd=tr({prefix:"\u{1F680}",name:"base256emoji",encode:yd,decode:wd});var pn={};O(pn,{sha256:()=>Md,sha512:()=>kd});var hn=Te(te("crypto"),1);var xd=pi,ui=128,Ed=127,vd=~Ed,fd=Math.pow(2,31);function pi(t,e,r){e=e||[],r=r||0;for(var n=r;t>=fd;)e[r++]=t&255|ui,t/=128;for(;t&vd;)e[r++]=t&255|ui,t>>>=7;return e[r]=t|0,pi.bytes=r-n+1,e}var Cd=dn,Id=128,hi=127;function dn(t,n){var r=0,n=n||0,o=0,i=n,s,a=t.length;do{if(i>=a)throw dn.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=o<28?(s&hi)<<o:(s&hi)*Math.pow(2,o),o+=7}while(s>=Id);return dn.bytes=i-n,r}var Sd=Math.pow(2,7),Ad=Math.pow(2,14),Ud=Math.pow(2,21),Od=Math.pow(2,28),Td=Math.pow(2,35),Ld=Math.pow(2,42),Bd=Math.pow(2,49),Nd=Math.pow(2,56),Pd=Math.pow(2,63),Dd=function(t){return t<Sd?1:t<Ad?2:t<Ud?3:t<Od?4:t<Td?5:t<Ld?6:t<Bd?7:t<Nd?8:t<Pd?9:10},Rd={encode:xd,decode:Cd,encodingLength:Dd},Fd=Rd,fr=Fd;var Cr=(t,e=0)=>[fr.decode(t,e),fr.decode.bytes],or=(t,e,r=0)=>(fr.encode(t,e,r),e),ir=t=>fr.encodingLength(t);var _e=(t,e)=>{let r=e.byteLength,n=ir(t),o=n+ir(r),i=new Uint8Array(o+r);return or(t,i,0),or(r,i,n),i.set(e,o),new sr(t,r,e,i)},mi=t=>{let e=re(t),[r,n]=Cr(e),[o,i]=Cr(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new sr(r,o,s,e)},gi=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&ii(t.bytes,r.bytes)}},sr=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var un=({name:t,code:e,encode:r})=>new ln(t,e,r),ln=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?_e(this.code,r):r.then(n=>_e(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Md=un({name:"sha2-256",code:18,encode:t=>re(hn.default.createHash("sha256").update(t).digest())}),kd=un({name:"sha2-512",code:19,encode:t=>re(hn.default.createHash("sha512").update(t).digest())});var mn={};O(mn,{identity:()=>Vd});var wi=0,zd="identity",bi=re,_d=t=>_e(wi,bi(t)),Vd={code:wi,name:zd,encode:bi,digest:_d};var up=new TextEncoder,hp=new TextDecoder;var xi=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return Kd(r,gn(t),e||me.encoder);default:return Gd(r,gn(t),e||nr.encoder)}};var Ei=new WeakMap,gn=t=>{let e=Ei.get(t);if(e==null){let r=new Map;return Ei.set(t,r),r}return e},M=class{constructor(e,r,n,o){this.code=r,this.version=e,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:e,multihash:r}=this;if(e!==Sr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Xd)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return M.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=_e(e,r);return M.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(e){return M.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&gi(e.multihash,n.multihash)}toString(e){return xi(this,e)}toJSON(){return{"/":xi(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof M)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:i,bytes:s}=r;return new M(n,o,i,s||vi(n,o,i.bytes))}else if(r[Hd]===!0){let{version:n,multihash:o,code:i}=r,s=mi(o);return M.create(n,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==Sr)throw new Error(`Version 0 CID must use dag-pb (code: ${Sr}) block encoding`);return new M(e,r,n,n.bytes)}case 1:{let o=vi(e,r,n.bytes);return new M(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return M.create(0,Sr,e)}static createV1(e,r){return M.create(1,e,r)}static decode(e){let[r,n]=M.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=M.inspectBytes(e),n=r.size-r.multihashSize,o=re(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let i=o.subarray(r.multihashSize-r.digestSize),s=new sr(r.multihashCode,r.digestSize,i,o);return[r.version===0?M.createV0(s):M.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,l]=Cr(e.subarray(r));return r+=l,d},o=n(),i=Sr;if(o===18?(o=0,r=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=r,a=n(),g=n(),w=r+g,p=w-s;return{version:o,codec:i,multihashCode:a,digestSize:g,multihashSize:p,size:w}}static parse(e,r){let[n,o]=jd(e,r),i=M.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return gn(i).set(n,e),i}},jd=(t,e)=>{switch(t[0]){case"Q":{let r=e||me;return[me.prefix,r.decode(`${me.prefix}${t}`)]}case me.prefix:{let r=e||me;return[me.prefix,r.decode(t)]}case nr.prefix:{let r=e||nr;return[nr.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)]}}},Kd=(t,e,r)=>{let{prefix:n}=r;if(n!==me.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let i=r.encode(t).slice(1);return e.set(n,i),i}else return o},Gd=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let i=r.encode(t);return e.set(n,i),i}else return o},Sr=112,Xd=18,vi=(t,e,r)=>{let n=ir(t),o=n+ir(e),i=new Uint8Array(o+r.byteLength);return or(t,i,0),or(e,i,n),i.set(r,o),i},Hd=Symbol.for("@ipld/js-cid/CID");var yn={...Wt,...Zt,...en,...rn,...tn,...nn,...on,...sn,...cn,...an},fp={...pn,...mn};function cr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Kr(t=0){return globalThis.Buffer?.allocUnsafe!=null?cr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Ci(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var fi=Ci("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),wn=Ci("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=Kr(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Yd={utf8:fi,"utf-8":fi,hex:yn.base16,latin1:wn,ascii:wn,binary:wn,...yn},Gr=Yd;function X(t,e="utf8"){let r=Gr[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var jn=Te(Xr(),1);function Ue(t,e){e==null&&(e=t.reduce((o,i)=>o+i.length,0));let r=Kr(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return cr(r)}var ar=Te(Xr(),1);var Hr=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,o){return this.readAtomically(()=>{let i=0,s=0,a=this.peekChar();if(a===void 0)return;let g=a==="0",w=2**(8*o)-1;for(;;){let p=this.readAtomically(()=>{let d=this.readChar();if(d===void 0)return;let l=Number.parseInt(d,e);if(!Number.isNaN(l))return l});if(p===void 0)break;if(i*=e,i+=p,i>w||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&g&&s>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let o=n*2;if(n<r.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return r[o]=s[0],r[o+1]=s[1],r[o+2]=s[2],r[o+3]=s[3],[o+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];r[o]=i>>8,r[o+1]=i&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,o]=e(r);if(n===16)return r;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),s=16-(n+2),[a]=e(i.subarray(0,s));return r.set(i.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Vp=new Hr;var Yp=parseInt("0xFFFF",16),Jp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var En={};O(En,{identity:()=>ml});var ml=Qe({prefix:"\0",name:"identity",encode:t=>Ho(t),decode:t=>Xo(t)});var vn={};O(vn,{base2:()=>gl});var gl=D({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var fn={};O(fn,{base8:()=>yl});var yl=D({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Cn={};O(Cn,{base10:()=>wl});var wl=De({prefix:"9",name:"base10",alphabet:"0123456789"});var In={};O(In,{base16:()=>bl,base16upper:()=>xl});var bl=D({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),xl=D({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Sn={};O(Sn,{base36:()=>El,base36upper:()=>vl});var El=De({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vl=De({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var An={};O(An,{base64:()=>fl,base64pad:()=>Cl,base64url:()=>Il,base64urlpad:()=>Sl});var fl=D({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Cl=D({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Il=D({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Sl=D({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Un={};O(Un,{base256emoji:()=>Ll});var Ri=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}"),Al=Ri.reduce((t,e,r)=>(t[r]=e,t),[]),Ul=Ri.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Ol(t){return t.reduce((e,r)=>(e+=Al[r],e),"")}function Tl(t){let e=[];for(let r of t){let n=Ul[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Ll=Qe({prefix:"\u{1F680}",name:"base256emoji",encode:Ol,decode:Tl});var Bn={};O(Bn,{sha256:()=>Bl,sha512:()=>Nl});var Ln=Te(te("crypto"),1);var Tn=({name:t,code:e,encode:r})=>new On(t,e,r),On=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ze(this.code,r):r.then(n=>ze(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Bl=Tn({name:"sha2-256",code:18,encode:t=>ee(Ln.default.createHash("sha256").update(t).digest())}),Nl=Tn({name:"sha2-512",code:19,encode:t=>ee(Ln.default.createHash("sha512").update(t).digest())});var Nn={};O(Nn,{identity:()=>Rl});var Mi=0,Pl="identity",ki=ee,Dl=t=>ze(Mi,ki(t)),Rl={code:Mi,name:Pl,encode:ki,digest:Dl};var Pm=new TextEncoder,Dm=new TextDecoder;var zi={...En,...vn,...fn,...Cn,...In,...Gt,...Sn,...jt,...An,...Un},zm={...Bn,...Nn};function Pn(t,e="utf8"){let r=Gr[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?cr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var ge=Te(Xr(),1);var Fe=te("node:net");function Yr(t){return!!(0,Fe.isIP)(t)}var _i=Fe.isIPv4,kl=Fe.isIPv6,Dn=function(t){let e=0;if(t=t.toString().trim(),_i(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(kl(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let i=_i(r[n]),s;i&&(s=Dn(r[n]),r[n]=X(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,X(s.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let i=[n,1];for(n=9-r.length;n>0;n--)i.push("0");r.splice.apply(r,i)}let o=new Uint8Array(e+16);for(n=0;n<r.length;n++){let i=parseInt(r[n],16);o[e++]=i>>8&255,o[e++]=i&255}return o}throw new Error("invalid ip address")},Vi=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let o=[];for(let i=0;i<r;i++)o.push(t[e+i]);return o.join(".")}if(r===16){let o=[];for(let i=0;i<r;i+=2)o.push(n.getUint16(e+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ar={},Rn={},_l=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];_l.forEach(t=>{let e=Vl(...t);Rn[e.code]=e,Ar[e.name]=e});function Vl(t,e,r,n,o){return{code:t,size:e,name:r,resolvable:!!n,path:!!o}}function L(t){if(typeof t=="number"){if(Rn[t]!=null)return Rn[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(Ar[t]!=null)return Ar[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var og=L("ip4"),ig=L("ip6"),sg=L("ipcidr");function Gi(t,e){switch(L(t).code){case 4:case 41:return $l(e);case 42:return ji(e);case 6:case 273:case 33:case 132:return Hi(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ji(e);case 421:return Xl(e);case 444:return Ki(e);case 445:return Ki(e);case 466:return Gl(e);default:return X(e,"base16")}}function Xi(t,e){switch(L(t).code){case 4:return qi(e);case 41:return qi(e);case 42:return $i(e);case 6:case 273:case 33:case 132:return Mn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return $i(e);case 421:return jl(e);case 444:return Hl(e);case 445:return Yl(e);case 466:return Kl(e);default:return Pn(e,"base16")}}var Fn=Object.values(zi).map(t=>t.decoder),ql=function(){let t=Fn[0].or(Fn[1]);return Fn.slice(2).forEach(e=>t=t.or(e)),t}();function qi(t){if(!Yr(t))throw new Error("invalid ip address");return Dn(t)}function $l(t){let e=Vi(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Yr(e))throw new Error("invalid ip address");return e}function Mn(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function Hi(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function $i(t){let e=Pn(t),r=Uint8Array.from(ge.default.encode(e.length));return Ue([r,e],r.length+e.length)}function ji(t){let e=ge.default.decode(t);if(t=t.slice(ge.default.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return X(t)}function jl(t){let e;t[0]==="Q"||t[0]==="1"?e=$r(G.decode(`z${t}`)).bytes:e=B.parse(t).multihash.bytes;let r=Uint8Array.from(ge.default.encode(e.length));return Ue([r,e],r.length+e.length)}function Kl(t){let e=ql.decode(t),r=Uint8Array.from(ge.default.encode(e.length));return Ue([r,e],r.length+e.length)}function Gl(t){let e=ge.default.decode(t),r=t.slice(ge.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return"u"+X(r,"base64url")}function Xl(t){let e=ge.default.decode(t),r=t.slice(ge.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return X(r,"base58btc")}function Hl(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' 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=Ae.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 o=Mn(n);return Ue([r,o],r.length+o.length)}function Yl(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' 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=Ae.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 o=Mn(n);return Ue([r,o],r.length+o.length)}function Ki(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=X(e,"base32"),o=Hi(r);return`${n}:${o}`}function Jl(t){let e=[],r=t.split("/").slice(1);if(r.length===1&&r[0]==="")return[];for(let n=0;n<r.length;n++){let o=r[n],i=L(o);if(i.size===0){e.push([o]);continue}if(n++,n>=r.length)throw Ji("invalid address: "+t);if(i.path===!0){e.push([o,qn(r.slice(n).join("/"))]);break}e.push([o,r[n]])}return e}function Ql(t){let e=[];return t.map(r=>{let n=Wr(r);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),qn(e.join("/"))}function Wl(t){return t.map(e=>{Array.isArray(e)||(e=[e]);let r=Wr(e);return e.length>1?[r.code,Xi(r.code,e[1])]:[r.code]})}function kn(t){return t.map(e=>{let r=Wr(e);return e[1]!=null?[r.code,Gi(r.code,e[1])]:[r.code]})}function zn(t){return Qr(Ue(t.map(e=>{let r=Wr(e),n=Uint8Array.from(ar.default.encode(r.code));return e.length>1&&e[1]!=null&&(n=Ue([n,e[1]])),n})))}function _n(t,e){return t.size>0?t.size/8:t.size===0?0:ar.default.decode(e)+(ar.default.decode.bytes??0)}function Jr(t){let e=[],r=0;for(;r<t.length;){let n=ar.default.decode(t,r),o=ar.default.decode.bytes??0,i=L(n),s=_n(i,t.slice(r+o));if(s===0){e.push([n]),r+=o;continue}let a=t.slice(r+o,r+o+s);if(r+=s+o,r>t.length)throw Ji("Invalid address Uint8Array: "+X(t,"base16"));e.push([n,a])}return e}function Vn(t){let e=Jr(t),r=kn(e);return Ql(r)}function Zl(t){t=qn(t);let e=Jl(t),r=Wl(e);return zn(r)}function Yi(t){return Zl(t)}function Qr(t){let e=eu(t);if(e!=null)throw e;return Uint8Array.from(t)}function eu(t){try{Jr(t)}catch(e){return e}}function qn(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function Ji(t){return new Error("Error parsing address: "+t)}function Wr(t){return L(t[0])}var tu=Symbol.for("nodejs.util.inspect.custom"),nu=[L("dns").code,L("dns4").code,L("dns6").code,L("dnsaddr").code],ou=new Map,Qi=Symbol.for("@multiformats/js-multiaddr/multiaddr");function iu(t){return!!t?.[Qi]}var Oe=class{bytes;#e;#t;#n;#r;[Qi]=!0;constructor(e){if(e==null&&(e=""),e instanceof Uint8Array)this.bytes=Qr(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Yi(e)}else if(iu(e))this.bytes=Qr(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return this.#e==null&&(this.#e=Vn(this.bytes)),this.#e}toJSON(){return this.toString()}toOptions(){let e,r,n,o,i="",s=L("tcp"),a=L("udp"),g=L("ip4"),w=L("ip6"),p=L("dns6"),d=L("ip6zone");for(let[u,c]of this.stringTuples())u===d.code&&(i=`%${c??""}`),nu.includes(u)&&(r=s.name,o=443,n=`${c??""}${i}`,e=u===p.code?6:4),(u===s.code||u===a.code)&&(r=L(u).name,o=parseInt(c??"")),(u===g.code||u===w.code)&&(r=L(u).name,n=`${c??""}${i}`,e=u===w.code?6:4);if(e==null||r==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},L(e)))}protoCodes(){let e=[],r=this.bytes,n=0;for(;n<r.length;){let o=jn.default.decode(r,n),i=jn.default.decode.bytes??0,s=L(o),a=_n(s,r.slice(n+i));n+=a+i,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return this.#t==null&&(this.#t=Jr(this.bytes)),this.#t}stringTuples(){return this.#n==null&&(this.#n=kn(this.tuples())),this.#n}encapsulate(e){return e=new Oe(e),new Oe(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),o=n.lastIndexOf(r);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new Oe(n.slice(0,o))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new Oe(zn(r.slice(0,n)));return this}getPeerId(){try{let r=this.stringTuples().filter(n=>n[0]===Ar.ipfs.code).pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?X(G.decode(`z${n}`),"base58btc"):X(B.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(this.#r===void 0)try{this.#r=this.stringTuples().filter(e=>L(e[0]).path===!0)[0][1],this.#r==null&&(this.#r=null)}catch{this.#r=null}return this.#r}equals(e){return mr(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(i=>i.resolvable);if(r==null)return[this];let n=ou.get(r.name);if(n==null)throw new Vr(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(i=>new Oe(i))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}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)}[tu](){return`Multiaddr(${Vn(this.bytes)})`}};function $n(t){return new Oe(t)}var Ur=Rr("libp2p:mdns:query");function Wi(t,e,r){let n=()=>{Ur("query",e),t.query({questions:[{name:e,type:"PTR"}]})};return n(),setInterval(n,r)}function Zi(t,e,r){if(t.answers==null)return;let n,o=[];if(t.answers.forEach(i=>{switch(i.type){case"PTR":n=i;break;case"TXT":o.push(i);break;default:break}}),!(n==null||n?.name!==r||o.length===0||n.data.startsWith(e)))try{let i=o.flatMap(a=>a.data).filter(a=>a.toString().startsWith("dnsaddr=")).map(a=>$n(a.toString().substring(8))),s=i[0].getPeerId();if(s==null)throw new Error("Multiaddr doesn't contain PeerId");return Ur("peer found %p",s),{id:zt(s),multiaddrs:i,protocols:[]}}catch(i){Ur.error("failed to parse mdns response",i)}}function es(t,e,r,n,o,i){if(!i){Ur("not responding to mDNS query as broadcast mode is false");return}if(n.length!==0&&t.questions[0]!=null&&t.questions[0].name===o){let s=[];s.push({name:o,type:"PTR",class:"IN",ttl:120,data:r+"."+o}),n.forEach(a=>{a.getPeerId()!=null&&s.push({name:r+"."+o,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+a.toString()})}),Ur("responding to query"),e.respond(s)}}function rs(t){let e="",r="abcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*r.length));return e}var Zr=Rr("libp2p:mdns"),Kn=class extends Tr{mdns;broadcast;interval;serviceTag;peerName;port;ip;_queryInterval;components;constructor(e,r={}){if(super(),this.broadcast=r.broadcast!==!1,this.interval=r.interval??1e3*10,this.serviceTag=r.serviceTag??"_p2p._udp.local",this.ip=r.ip??"224.0.0.251",this.peerName=r.peerName??rs(63),this.peerName.length>=64)throw new Error("Peer name should be less than 64 chars long");this.port=r.port??5353,this.components=e,this._queryInterval=null,this._onPeer=this._onPeer.bind(this),this._onMdnsQuery=this._onMdnsQuery.bind(this),this._onMdnsResponse=this._onMdnsResponse.bind(this)}[Xn]=this;[Symbol.toStringTag]="@libp2p/mdns";isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,ts.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=Wi(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){this.mdns!=null&&(Zr.trace("received incoming mDNS query"),es(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast))}_onMdnsResponse(e){Zr.trace("received mDNS query response");try{let r=Zi(e,this.peerName,this.serviceTag);r!=null&&(Zr("discovered peer in mDNS query response %p",r.id),this.dispatchEvent(new Lr("peer",{detail:r})))}catch(r){Zr.error("Error processing peer response",r)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new Lr("peer",{detail:e.detail}))}async stop(){this.mdns!=null&&(this.mdns.removeListener("query",this._onMdnsQuery),this.mdns.removeListener("response",this._onMdnsResponse),this._queryInterval!=null&&(clearInterval(this._queryInterval),this._queryInterval=null),await new Promise(e=>{this.mdns!=null?this.mdns.destroy(e):e()}),this.mdns=void 0)}};function cu(t={}){return e=>new Kn(e,t)}return as(au);})();
|
|
4
|
+
`+i),r.push(o+"m+"+Er.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=bi()+e+" "+r[0]}function bi(){return F.inspectOpts.hideDate?"":new Date().toISOString()+" "}function vi(...r){return process.stderr.write(wr.format(...r)+`
|
|
5
|
+
`)}function Ii(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function Ci(){return process.env.DEBUG}function Si(r){r.inspectOpts={};let e=Object.keys(F.inspectOpts);for(let t=0;t<e.length;t++)r.inspectOpts[e[t]]=F.inspectOpts[e[t]]}Er.exports=Rr()(F);var{formatters:gn}=Er.exports;gn.o=function(r){return this.inspectOpts.colors=this.useColors,wr.inspect(r,this.inspectOpts).split(`
|
|
6
|
+
`).map(e=>e.trim()).join(" ")};gn.O=function(r){return this.inspectOpts.colors=this.useColors,wr.inspect(r,this.inspectOpts)}});var yn=P((Qa,Fr)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Fr.exports=dn():Fr.exports=mn()});var Cn=P(Kr=>{"use strict";Kr.toString=function(r){switch(r){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+r};Kr.toType=function(r){switch(r.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return r.toUpperCase().startsWith("UNKNOWN_")?parseInt(r.slice(8)):0}});var Sn=P(Gr=>{"use strict";Gr.toString=function(r){switch(r){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+r};Gr.toRcode=function(r){switch(r.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var An=P(Hr=>{"use strict";Hr.toString=function(r){switch(r){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+r};Hr.toOpcode=function(r){switch(r.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var Un=P(Xr=>{"use strict";Xr.toString=function(r){switch(r){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+r};Xr.toClass=function(r){switch(r.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var On=P(Yr=>{"use strict";Yr.toString=function(r){switch(r){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return r<0?null:`OPTION_${r}`};Yr.toCode=function(r){if(typeof r=="number")return r;if(!r)return-1;switch(r.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let e=r.match(/_(\d+)$/);return e?parseInt(e[1],10):-1}});var Dn=P((Tn,Qr)=>{var Ln=function(r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=d,r.encode=h,r.familyOf=E,r.name=void 0,r.sizeOf=m,r.v6=r.v4=void 0;let e=/^(\d{1,3}\.){3,3}\d{1,3}$/,t=4,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,o=16,i={name:"v4",size:t,isFormat:l=>e.test(l),encode(l,u,c){c=~~c,u=u||new Uint8Array(c+t);let p=l.length,x=0;for(let b=0;b<p;){let I=l.charCodeAt(b++);I===46?(u[c++]=x,x=0):x=x*10+(I-48)}return u[c]=x,u},decode(l,u){return u=~~u,`${l[u++]}.${l[u++]}.${l[u++]}.${l[u]}`}};r.v4=i;let s={name:"v6",size:o,isFormat:l=>l.length>0&&n.test(l),encode(l,u,c){c=~~c;let p=c+o,x=-1,b=0,I=0,U=!0,C=!1;u=u||new Uint8Array(c+o);for(let S=0;S<l.length;S++){let A=l.charCodeAt(S);A===58?(U?x!==-1?(c<p&&(u[c]=0),c<p-1&&(u[c+1]=0),c+=2):c<p&&(x=c):(C===!0?(c<p&&(u[c]=I),c++):(c<p&&(u[c]=b>>8),c<p-1&&(u[c+1]=b&255),c+=2),b=0,I=0),U=!0,C=!1):A===46?(c<p&&(u[c]=I),c++,I=0,b=0,U=!1,C=!0):(U=!1,A>=97?A-=87:A>=65?A-=55:(A-=48,I=I*10+A),b=(b<<4)+A)}if(U===!1)C===!0?(c<p&&(u[c]=I),c++):(c<p&&(u[c]=b>>8),c<p-1&&(u[c+1]=b&255),c+=2);else if(x===0)c<p&&(u[c]=0),c<p-1&&(u[c+1]=0),c+=2;else if(x!==-1){c+=2;for(let S=Math.min(c-1,p-1);S>=x+2;S--)u[S]=u[S-2];u[x]=0,u[x+1]=0,x=c}if(x!==c&&x!==-1)for(c>p-2&&(c=p-2);p>x;)u[--p]=c<p&&c>x?u[--c]:0;else for(;c<p;)u[c++]=0;return u},decode(l,u){u=~~u;let c="";for(let p=0;p<o;p+=2)p!==0&&(c+=":"),c+=(l[u+p]<<8|l[u+p+1]).toString(16);return c.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};r.v6=s;let a="ip";r.name=a;function m(l){if(i.isFormat(l))return i.size;if(s.isFormat(l))return s.size;throw Error(`Invalid ip address: ${l}`)}function E(l){return m(l)===i.size?1:2}function h(l,u,c){c=~~c;let p=m(l);return typeof u=="function"&&(u=u(c+p)),p===i.size?i.encode(l,u,c):s.encode(l,u,c)}function d(l,u,c){if(u=~~u,c=c||l.length-u,c===i.size)return i.decode(l,u,c);if(c===s.size)return s.decode(l,u,c);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${s.size} for v6.`)}return"default"in r?r.default:r}({});typeof define=="function"&&define.amd?define([],function(){return Ln}):typeof Qr=="object"&&typeof Tn=="object"&&(Qr.exports=Ln)});var Pn=P(y=>{"use strict";var w=te("buffer").Buffer,ve=Cn(),$i=Sn(),ji=An(),vr=Un(),Jr=On(),Te=Dn(),Ki=0,Bn=32768,Wr=32768,Gi=~Wr,Nn=32768,Hi=~Nn,g=y.name={};g.encode=function(r,e,t){e||(e=w.alloc(g.encodingLength(r))),t||(t=0);let n=t,o=r.replace(/^\.|\.$/gm,"");if(o.length){let i=o.split(".");for(let s=0;s<i.length;s++){let a=e.write(i[s],t+1);e[t]=a,t+=a+1}}return e[t++]=0,g.encode.bytes=t-n,e};g.encode.bytes=0;g.decode=function(r,e){e||(e=0);let t=[],n=e,o=0,i=0,s=!1;for(;;){if(e>=r.length)throw new Error("Cannot decode name (buffer overflow)");let a=r[e++];if(i+=s?0:1,a===0)break;if(a&192)if((a&192)===192){if(e+1>r.length)throw new Error("Cannot decode name (buffer overflow)");let m=r.readUInt16BE(e-1)-49152;if(m>=n)throw new Error("Cannot decode name (bad pointer)");e=m,n=m,i+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+a>r.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=a+1,o>254)throw new Error("Cannot decode name (name too long)");t.push(r.toString("utf-8",e,e+a)),e+=a,i+=s?0:a}}return g.decode.bytes=i,t.length===0?".":t.join(".")};g.decode.bytes=0;g.encodingLength=function(r){return r==="."||r===".."?1:w.byteLength(r.replace(/^\.|\.$/gm,""))+2};var v={};v.encode=function(r,e,t){e||(e=w.alloc(v.encodingLength(r))),t||(t=0);let n=e.write(r,t+1);return e[t]=n,v.encode.bytes=n+1,e};v.encode.bytes=0;v.decode=function(r,e){e||(e=0);let t=r[e],n=r.toString("utf-8",e+1,e+1+t);return v.decode.bytes=t+1,n};v.decode.bytes=0;v.encodingLength=function(r){return w.byteLength(r)+1};var ee={};ee.encode=function(r,e,t){e||(e=ee.encodingLength(r)),t||(t=0);let n=(r.flags||0)&32767,o=r.type==="response"?Bn:Ki;return e.writeUInt16BE(r.id||0,t),e.writeUInt16BE(n|o,t+2),e.writeUInt16BE(r.questions.length,t+4),e.writeUInt16BE(r.answers.length,t+6),e.writeUInt16BE(r.authorities.length,t+8),e.writeUInt16BE(r.additionals.length,t+10),e};ee.encode.bytes=12;ee.decode=function(r,e){if(e||(e=0),r.length<12)throw new Error("Header must be 12 bytes");let t=r.readUInt16BE(e+2);return{id:r.readUInt16BE(e),type:t&Bn?"response":"query",flags:t&32767,flag_qr:(t>>15&1)===1,opcode:ji.toString(t>>11&15),flag_aa:(t>>10&1)===1,flag_tc:(t>>9&1)===1,flag_rd:(t>>8&1)===1,flag_ra:(t>>7&1)===1,flag_z:(t>>6&1)===1,flag_ad:(t>>5&1)===1,flag_cd:(t>>4&1)===1,rcode:$i.toString(t&15),questions:new Array(r.readUInt16BE(e+4)),answers:new Array(r.readUInt16BE(e+6)),authorities:new Array(r.readUInt16BE(e+8)),additionals:new Array(r.readUInt16BE(e+10))}};ee.decode.bytes=12;ee.encodingLength=function(){return 12};var he=y.unknown={};he.encode=function(r,e,t){return e||(e=w.alloc(he.encodingLength(r))),t||(t=0),e.writeUInt16BE(r.length,t),r.copy(e,t+2),he.encode.bytes=r.length+2,e};he.encode.bytes=0;he.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=r.slice(e+2,e+2+t);return he.decode.bytes=t+2,n};he.decode.bytes=0;he.encodingLength=function(r){return r.length+2};var pe=y.ns={};pe.encode=function(r,e,t){return e||(e=w.alloc(pe.encodingLength(r))),t||(t=0),g.encode(r,e,t+2),e.writeUInt16BE(g.encode.bytes,t),pe.encode.bytes=g.encode.bytes+2,e};pe.encode.bytes=0;pe.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=g.decode(r,e+2);return pe.decode.bytes=t+2,n};pe.decode.bytes=0;pe.encodingLength=function(r){return g.encodingLength(r)+2};var ge=y.soa={};ge.encode=function(r,e,t){e||(e=w.alloc(ge.encodingLength(r))),t||(t=0);let n=t;return t+=2,g.encode(r.mname,e,t),t+=g.encode.bytes,g.encode(r.rname,e,t),t+=g.encode.bytes,e.writeUInt32BE(r.serial||0,t),t+=4,e.writeUInt32BE(r.refresh||0,t),t+=4,e.writeUInt32BE(r.retry||0,t),t+=4,e.writeUInt32BE(r.expire||0,t),t+=4,e.writeUInt32BE(r.minimum||0,t),t+=4,e.writeUInt16BE(t-n-2,n),ge.encode.bytes=t-n,e};ge.encode.bytes=0;ge.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.mname=g.decode(r,e),e+=g.decode.bytes,n.rname=g.decode(r,e),e+=g.decode.bytes,n.serial=r.readUInt32BE(e),e+=4,n.refresh=r.readUInt32BE(e),e+=4,n.retry=r.readUInt32BE(e),e+=4,n.expire=r.readUInt32BE(e),e+=4,n.minimum=r.readUInt32BE(e),e+=4,ge.decode.bytes=e-t,n};ge.decode.bytes=0;ge.encodingLength=function(r){return 22+g.encodingLength(r.mname)+g.encodingLength(r.rname)};var me=y.txt={};me.encode=function(r,e,t){Array.isArray(r)||(r=[r]);for(let o=0;o<r.length;o++)if(typeof r[o]=="string"&&(r[o]=w.from(r[o])),!w.isBuffer(r[o]))throw new Error("Must be a Buffer");e||(e=w.alloc(me.encodingLength(r))),t||(t=0);let n=t;return t+=2,r.forEach(function(o){e[t++]=o.length,o.copy(e,t,0,o.length),t+=o.length}),e.writeUInt16BE(t-n-2,n),me.encode.bytes=t-n,e};me.encode.bytes=0;me.decode=function(r,e){e||(e=0);let t=e,n=r.readUInt16BE(e);e+=2;let o=[];for(;n>0;){let i=r[e++];if(--n,n<i)throw new Error("Buffer overflow");o.push(r.slice(e,e+i)),e+=i,n-=i}return me.decode.bytes=e-t,o};me.decode.bytes=0;me.encodingLength=function(r){Array.isArray(r)||(r=[r]);let e=2;return r.forEach(function(t){typeof t=="string"?e+=w.byteLength(t)+1:e+=t.length+1}),e};var ye=y.null={};ye.encode=function(r,e,t){e||(e=w.alloc(ye.encodingLength(r))),t||(t=0),typeof r=="string"&&(r=w.from(r)),r||(r=w.alloc(0));let n=t;t+=2;let o=r.length;return r.copy(e,t,0,o),t+=o,e.writeUInt16BE(t-n-2,n),ye.encode.bytes=t-n,e};ye.encode.bytes=0;ye.decode=function(r,e){e||(e=0);let t=e,n=r.readUInt16BE(e);e+=2;let o=r.slice(e,e+n);return e+=n,ye.decode.bytes=e-t,o};ye.decode.bytes=0;ye.encodingLength=function(r){return r?(w.isBuffer(r)?r.length:w.byteLength(r))+2:2};var we=y.hinfo={};we.encode=function(r,e,t){e||(e=w.alloc(we.encodingLength(r))),t||(t=0);let n=t;return t+=2,v.encode(r.cpu,e,t),t+=v.encode.bytes,v.encode(r.os,e,t),t+=v.encode.bytes,e.writeUInt16BE(t-n-2,n),we.encode.bytes=t-n,e};we.encode.bytes=0;we.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.cpu=v.decode(r,e),e+=v.decode.bytes,n.os=v.decode(r,e),e+=v.decode.bytes,we.decode.bytes=e-t,n};we.decode.bytes=0;we.encodingLength=function(r){return v.encodingLength(r.cpu)+v.encodingLength(r.os)+2};var W=y.ptr={},Xi=y.cname=W,Yi=y.dname=W;W.encode=function(r,e,t){return e||(e=w.alloc(W.encodingLength(r))),t||(t=0),g.encode(r,e,t+2),e.writeUInt16BE(g.encode.bytes,t),W.encode.bytes=g.encode.bytes+2,e};W.encode.bytes=0;W.decode=function(r,e){e||(e=0);let t=g.decode(r,e+2);return W.decode.bytes=g.decode.bytes+2,t};W.decode.bytes=0;W.encodingLength=function(r){return g.encodingLength(r)+2};var Ee=y.srv={};Ee.encode=function(r,e,t){e||(e=w.alloc(Ee.encodingLength(r))),t||(t=0),e.writeUInt16BE(r.priority||0,t+2),e.writeUInt16BE(r.weight||0,t+4),e.writeUInt16BE(r.port||0,t+6),g.encode(r.target,e,t+8);let n=g.encode.bytes+6;return e.writeUInt16BE(n,t),Ee.encode.bytes=n+2,e};Ee.encode.bytes=0;Ee.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n={};return n.priority=r.readUInt16BE(e+2),n.weight=r.readUInt16BE(e+4),n.port=r.readUInt16BE(e+6),n.target=g.decode(r,e+8),Ee.decode.bytes=t+2,n};Ee.decode.bytes=0;Ee.encodingLength=function(r){return 8+g.encodingLength(r.target)};var j=y.caa={};j.ISSUER_CRITICAL=128;j.encode=function(r,e,t){let n=j.encodingLength(r);return e||(e=w.alloc(j.encodingLength(r))),t||(t=0),r.issuerCritical&&(r.flags=j.ISSUER_CRITICAL),e.writeUInt16BE(n-2,t),t+=2,e.writeUInt8(r.flags||0,t),t+=1,v.encode(r.tag,e,t),t+=v.encode.bytes,e.write(r.value,t),t+=w.byteLength(r.value),j.encode.bytes=n,e};j.encode.bytes=0;j.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e);e+=2;let n=e,o={};return o.flags=r.readUInt8(e),e+=1,o.tag=v.decode(r,e),e+=v.decode.bytes,o.value=r.toString("utf-8",e,n+t),o.issuerCritical=!!(o.flags&j.ISSUER_CRITICAL),j.decode.bytes=t+2,o};j.decode.bytes=0;j.encodingLength=function(r){return v.encodingLength(r.tag)+v.encodingLength(r.value)+2};var Se=y.mx={};Se.encode=function(r,e,t){e||(e=w.alloc(Se.encodingLength(r))),t||(t=0);let n=t;return t+=2,e.writeUInt16BE(r.preference||0,t),t+=2,g.encode(r.exchange,e,t),t+=g.encode.bytes,e.writeUInt16BE(t-n-2,n),Se.encode.bytes=t-n,e};Se.encode.bytes=0;Se.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.preference=r.readUInt16BE(e),e+=2,n.exchange=g.decode(r,e),e+=g.decode.bytes,Se.decode.bytes=e-t,n};Se.encodingLength=function(r){return 4+g.encodingLength(r.exchange)};var xe=y.a={};xe.encode=function(r,e,t){return e||(e=w.alloc(xe.encodingLength(r))),t||(t=0),e.writeUInt16BE(4,t),t+=2,Te.v4.encode(r,e,t),xe.encode.bytes=6,e};xe.encode.bytes=0;xe.decode=function(r,e){e||(e=0),e+=2;let t=Te.v4.decode(r,e);return xe.decode.bytes=6,t};xe.decode.bytes=0;xe.encodingLength=function(){return 6};var be=y.aaaa={};be.encode=function(r,e,t){return e||(e=w.alloc(be.encodingLength(r))),t||(t=0),e.writeUInt16BE(16,t),t+=2,Te.v6.encode(r,e,t),be.encode.bytes=18,e};be.encode.bytes=0;be.decode=function(r,e){e||(e=0),e+=2;let t=Te.v6.decode(r,e);return be.decode.bytes=18,t};be.decode.bytes=0;be.encodingLength=function(){return 18};var z=y.option={};z.encode=function(r,e,t){e||(e=w.alloc(z.encodingLength(r))),t||(t=0);let n=t,o=Jr.toCode(r.code);if(e.writeUInt16BE(o,t),t+=2,r.data)e.writeUInt16BE(r.data.length,t),t+=2,r.data.copy(e,t),t+=r.data.length;else switch(o){case 8:let i=r.sourcePrefixLength||0,s=r.family||Te.familyOf(r.ip),a=Te.encode(r.ip,w.alloc),m=Math.ceil(i/8);e.writeUInt16BE(m+4,t),t+=2,e.writeUInt16BE(s,t),t+=2,e.writeUInt8(i,t++),e.writeUInt8(r.scopePrefixLength||0,t++),a.copy(e,t,0,m),t+=m;break;case 11:r.timeout?(e.writeUInt16BE(2,t),t+=2,e.writeUInt16BE(r.timeout,t),t+=2):(e.writeUInt16BE(0,t),t+=2);break;case 12:let E=r.length||0;e.writeUInt16BE(E,t),t+=2,e.fill(0,t,t+E),t+=E;break;case 14:let h=r.tags.length*2;e.writeUInt16BE(h,t),t+=2;for(let d of r.tags)e.writeUInt16BE(d,t),t+=2;break;default:throw new Error(`Unknown roption code: ${r.code}`)}return z.encode.bytes=t-n,e};z.encode.bytes=0;z.decode=function(r,e){e||(e=0);let t={};t.code=r.readUInt16BE(e),t.type=Jr.toString(t.code),e+=2;let n=r.readUInt16BE(e);switch(e+=2,t.data=r.slice(e,e+n),t.code){case 8:t.family=r.readUInt16BE(e),e+=2,t.sourcePrefixLength=r.readUInt8(e++),t.scopePrefixLength=r.readUInt8(e++);let o=w.alloc(t.family===1?4:16);r.copy(o,0,e,e+n-4),t.ip=Te.decode(o);break;case 11:n>0&&(t.timeout=r.readUInt16BE(e),e+=2);break;case 14:t.tags=[];for(let i=0;i<n;i+=2)t.tags.push(r.readUInt16BE(e)),e+=2}return z.decode.bytes=n+4,t};z.decode.bytes=0;z.encodingLength=function(r){if(r.data)return r.data.length+4;switch(Jr.toCode(r.code)){case 8:let t=r.sourcePrefixLength||0;return Math.ceil(t/8)+8;case 11:return typeof r.timeout=="number"?6:4;case 12:return r.length+4;case 14:return 4+r.tags.length*2}throw new Error(`Unknown roption code: ${r.code}`)};var G=y.opt={};G.encode=function(r,e,t){e||(e=w.alloc(G.encodingLength(r))),t||(t=0);let n=t,o=_e(r,z);return e.writeUInt16BE(o,t),t=Je(r,z,e,t+2),G.encode.bytes=t-n,e};G.encode.bytes=0;G.decode=function(r,e){e||(e=0);let t=e,n=[],o=r.readUInt16BE(e);e+=2;let i=0;for(;o>0;)n[i++]=z.decode(r,e),e+=z.decode.bytes,o-=z.decode.bytes;return G.decode.bytes=e-t,n};G.decode.bytes=0;G.encodingLength=function(r){return 2+_e(r||[],z)};var _=y.dnskey={};_.PROTOCOL_DNSSEC=3;_.ZONE_KEY=128;_.SECURE_ENTRYPOINT=32768;_.encode=function(r,e,t){e||(e=w.alloc(_.encodingLength(r))),t||(t=0);let n=t,o=r.key;if(!w.isBuffer(o))throw new Error("Key must be a Buffer");return t+=2,e.writeUInt16BE(r.flags,t),t+=2,e.writeUInt8(_.PROTOCOL_DNSSEC,t),t+=1,e.writeUInt8(r.algorithm,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,_.encode.bytes=t-n,e.writeUInt16BE(_.encode.bytes-2,n),e};_.encode.bytes=0;_.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);if(e+=2,n.flags=r.readUInt16BE(e),e+=2,r.readUInt8(e)!==_.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=r.readUInt8(e),e+=1,n.key=r.slice(e,t+o+2),e+=n.key.length,_.decode.bytes=e-t,n};_.decode.bytes=0;_.encodingLength=function(r){return 6+w.byteLength(r.key)};var ne=y.rrsig={};ne.encode=function(r,e,t){e||(e=w.alloc(ne.encodingLength(r))),t||(t=0);let n=t,o=r.signature;if(!w.isBuffer(o))throw new Error("Signature must be a Buffer");return t+=2,e.writeUInt16BE(ve.toType(r.typeCovered),t),t+=2,e.writeUInt8(r.algorithm,t),t+=1,e.writeUInt8(r.labels,t),t+=1,e.writeUInt32BE(r.originalTTL,t),t+=4,e.writeUInt32BE(r.expiration,t),t+=4,e.writeUInt32BE(r.inception,t),t+=4,e.writeUInt16BE(r.keyTag,t),t+=2,g.encode(r.signersName,e,t),t+=g.encode.bytes,o.copy(e,t,0,o.length),t+=o.length,ne.encode.bytes=t-n,e.writeUInt16BE(ne.encode.bytes-2,n),e};ne.encode.bytes=0;ne.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);return e+=2,n.typeCovered=ve.toString(r.readUInt16BE(e)),e+=2,n.algorithm=r.readUInt8(e),e+=1,n.labels=r.readUInt8(e),e+=1,n.originalTTL=r.readUInt32BE(e),e+=4,n.expiration=r.readUInt32BE(e),e+=4,n.inception=r.readUInt32BE(e),e+=4,n.keyTag=r.readUInt16BE(e),e+=2,n.signersName=g.decode(r,e),e+=g.decode.bytes,n.signature=r.slice(e,t+o+2),e+=n.signature.length,ne.decode.bytes=e-t,n};ne.decode.bytes=0;ne.encodingLength=function(r){return 20+g.encodingLength(r.signersName)+w.byteLength(r.signature)};var oe=y.rp={};oe.encode=function(r,e,t){e||(e=w.alloc(oe.encodingLength(r))),t||(t=0);let n=t;return t+=2,g.encode(r.mbox||".",e,t),t+=g.encode.bytes,g.encode(r.txt||".",e,t),t+=g.encode.bytes,oe.encode.bytes=t-n,e.writeUInt16BE(oe.encode.bytes-2,n),e};oe.encode.bytes=0;oe.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.mbox=g.decode(r,e)||".",e+=g.decode.bytes,n.txt=g.decode(r,e)||".",e+=g.decode.bytes,oe.decode.bytes=e-t,n};oe.decode.bytes=0;oe.encodingLength=function(r){return 2+g.encodingLength(r.mbox||".")+g.encodingLength(r.txt||".")};var f={};f.encode=function(r,e,t){e||(e=w.alloc(f.encodingLength(r))),t||(t=0);let n=t;for(var o=[],i=0;i<r.length;i++){var s=ve.toType(r[i]);o[s>>8]===void 0&&(o[s>>8]=[]),o[s>>8][s>>3&31]|=1<<7-(s&7)}for(i=0;i<o.length;i++)if(o[i]!==void 0){var a=w.from(o[i]);e.writeUInt8(i,t),t+=1,e.writeUInt8(a.length,t),t+=1,a.copy(e,t),t+=a.length}return f.encode.bytes=t-n,e};f.encode.bytes=0;f.decode=function(r,e,t){e||(e=0);let n=e;for(var o=[];e-n<t;){var i=r.readUInt8(e);e+=1;var s=r.readUInt8(e);e+=1;for(var a=0;a<s;a++)for(var m=r.readUInt8(e+a),E=0;E<8;E++)if(m&1<<7-E){var h=ve.toString(i<<8|a<<3|E);o.push(h)}e+=s}return f.decode.bytes=e-n,o};f.decode.bytes=0;f.encodingLength=function(r){for(var e=[],t=0;t<r.length;t++){var n=ve.toType(r[t]);e[n>>8]=Math.max(e[n>>8]||0,n&255)}var o=0;for(t=0;t<e.length;t++)e[t]!==void 0&&(o+=2+Math.ceil((e[t]+1)/8));return o};var ie=y.nsec={};ie.encode=function(r,e,t){e||(e=w.alloc(ie.encodingLength(r))),t||(t=0);let n=t;return t+=2,g.encode(r.nextDomain,e,t),t+=g.encode.bytes,f.encode(r.rrtypes,e,t),t+=f.encode.bytes,ie.encode.bytes=t-n,e.writeUInt16BE(ie.encode.bytes-2,n),e};ie.encode.bytes=0;ie.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);return e+=2,n.nextDomain=g.decode(r,e),e+=g.decode.bytes,n.rrtypes=f.decode(r,e,o-(e-t)),e+=f.decode.bytes,ie.decode.bytes=e-t,n};ie.decode.bytes=0;ie.encodingLength=function(r){return 2+g.encodingLength(r.nextDomain)+f.encodingLength(r.rrtypes)};var se=y.nsec3={};se.encode=function(r,e,t){e||(e=w.alloc(se.encodingLength(r))),t||(t=0);let n=t,o=r.salt;if(!w.isBuffer(o))throw new Error("salt must be a Buffer");let i=r.nextDomain;if(!w.isBuffer(i))throw new Error("nextDomain must be a Buffer");return t+=2,e.writeUInt8(r.algorithm,t),t+=1,e.writeUInt8(r.flags,t),t+=1,e.writeUInt16BE(r.iterations,t),t+=2,e.writeUInt8(o.length,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,e.writeUInt8(i.length,t),t+=1,i.copy(e,t,0,i.length),t+=i.length,f.encode(r.rrtypes,e,t),t+=f.encode.bytes,se.encode.bytes=t-n,e.writeUInt16BE(se.encode.bytes-2,n),e};se.encode.bytes=0;se.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);e+=2,n.algorithm=r.readUInt8(e),e+=1,n.flags=r.readUInt8(e),e+=1,n.iterations=r.readUInt16BE(e),e+=2;let i=r.readUInt8(e);e+=1,n.salt=r.slice(e,e+i),e+=i;let s=r.readUInt8(e);return e+=1,n.nextDomain=r.slice(e,e+s),e+=s,n.rrtypes=f.decode(r,e,o-(e-t)),e+=f.decode.bytes,se.decode.bytes=e-t,n};se.decode.bytes=0;se.encodingLength=function(r){return 8+r.salt.length+r.nextDomain.length+f.encodingLength(r.rrtypes)};var ce=y.ds={};ce.encode=function(r,e,t){e||(e=w.alloc(ce.encodingLength(r))),t||(t=0);let n=t,o=r.digest;if(!w.isBuffer(o))throw new Error("Digest must be a Buffer");return t+=2,e.writeUInt16BE(r.keyTag,t),t+=2,e.writeUInt8(r.algorithm,t),t+=1,e.writeUInt8(r.digestType,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,ce.encode.bytes=t-n,e.writeUInt16BE(ce.encode.bytes-2,n),e};ce.encode.bytes=0;ce.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);return e+=2,n.keyTag=r.readUInt16BE(e),e+=2,n.algorithm=r.readUInt8(e),e+=1,n.digestType=r.readUInt8(e),e+=1,n.digest=r.slice(e,t+o+2),e+=n.digest.length,ce.decode.bytes=e-t,n};ce.decode.bytes=0;ce.encodingLength=function(r){return 6+w.byteLength(r.digest)};var K=y.sshfp={};K.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};K.encode=function(e,t,n){t||(t=w.alloc(K.encodingLength(e))),n||(n=0);let o=n;n+=2,t[n]=e.algorithm,n+=1,t[n]=e.hash,n+=1;let i=w.from(e.fingerprint.toUpperCase(),"hex");if(i.length!==K.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return i.copy(t,n),n+=i.byteLength,K.encode.bytes=n-o,t.writeUInt16BE(K.encode.bytes-2,o),t};K.encode.bytes=0;K.decode=function(e,t){t||(t=0);let n=t,o={};t+=2,o.algorithm=e[t],t+=1,o.hash=e[t],t+=1;let i=K.getFingerprintLengthForHashType(o.hash);return o.fingerprint=e.slice(t,t+i).toString("hex").toUpperCase(),t+=i,K.decode.bytes=t-n,o};K.decode.bytes=0;K.encodingLength=function(r){return 4+w.from(r.fingerprint,"hex").byteLength};var ae=y.naptr={};ae.encode=function(r,e,t){e||(e=w.alloc(ae.encodingLength(r))),t||(t=0);let n=t;return t+=2,e.writeUInt16BE(r.order||0,t),t+=2,e.writeUInt16BE(r.preference||0,t),t+=2,v.encode(r.flags,e,t),t+=v.encode.bytes,v.encode(r.services,e,t),t+=v.encode.bytes,v.encode(r.regexp,e,t),t+=v.encode.bytes,g.encode(r.replacement,e,t),t+=g.encode.bytes,ae.encode.bytes=t-n,e.writeUInt16BE(ae.encode.bytes-2,n),e};ae.encode.bytes=0;ae.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.order=r.readUInt16BE(e),e+=2,n.preference=r.readUInt16BE(e),e+=2,n.flags=v.decode(r,e),e+=v.decode.bytes,n.services=v.decode(r,e),e+=v.decode.bytes,n.regexp=v.decode(r,e),e+=v.decode.bytes,n.replacement=g.decode(r,e),e+=g.decode.bytes,ae.decode.bytes=e-t,n};ae.decode.bytes=0;ae.encodingLength=function(r){return v.encodingLength(r.flags)+v.encodingLength(r.services)+v.encodingLength(r.regexp)+g.encodingLength(r.replacement)+6};var de=y.tlsa={};de.encode=function(r,e,t){e||(e=w.alloc(de.encodingLength(r))),t||(t=0);let n=t,o=r.certificate;if(!w.isBuffer(o))throw new Error("Certificate must be a Buffer");return t+=2,e.writeUInt8(r.usage,t),t+=1,e.writeUInt8(r.selector,t),t+=1,e.writeUInt8(r.matchingType,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,de.encode.bytes=t-n,e.writeUInt16BE(de.encode.bytes-2,n),e};de.encode.bytes=0;de.decode=function(r,e){e||(e=0);let t=e,n={},o=r.readUInt16BE(e);return e+=2,n.usage=r.readUInt8(e),e+=1,n.selector=r.readUInt8(e),e+=1,n.matchingType=r.readUInt8(e),e+=1,n.certificate=r.slice(e,t+o+2),e+=n.certificate.length,de.decode.bytes=e-t,n};de.decode.bytes=0;de.encodingLength=function(r){return 5+w.byteLength(r.certificate)};var Zr=y.record=function(r){switch(r.toUpperCase()){case"A":return xe;case"PTR":return W;case"CNAME":return Xi;case"DNAME":return Yi;case"TXT":return me;case"NULL":return ye;case"AAAA":return be;case"SRV":return Ee;case"HINFO":return we;case"CAA":return j;case"NS":return pe;case"SOA":return ge;case"MX":return Se;case"OPT":return G;case"DNSKEY":return _;case"RRSIG":return ne;case"RP":return oe;case"NSEC":return ie;case"NSEC3":return se;case"SSHFP":return K;case"DS":return ce;case"NAPTR":return ae;case"TLSA":return de}return he},M=y.answer={};M.encode=function(r,e,t){e||(e=w.alloc(M.encodingLength(r))),t||(t=0);let n=t;if(g.encode(r.name,e,t),t+=g.encode.bytes,e.writeUInt16BE(ve.toType(r.type),t),r.type.toUpperCase()==="OPT"){if(r.name!==".")throw new Error("OPT name must be root.");e.writeUInt16BE(r.udpPayloadSize||4096,t+2),e.writeUInt8(r.extendedRcode||0,t+4),e.writeUInt8(r.ednsVersion||0,t+5),e.writeUInt16BE(r.flags||0,t+6),t+=8,G.encode(r.options||[],e,t),t+=G.encode.bytes}else{let o=vr.toClass(r.class===void 0?"IN":r.class);r.flush&&(o|=Wr),e.writeUInt16BE(o,t+2),e.writeUInt32BE(r.ttl||0,t+4),t+=8;let i=Zr(r.type);i.encode(r.data,e,t),t+=i.encode.bytes}return M.encode.bytes=t-n,e};M.encode.bytes=0;M.decode=function(r,e){e||(e=0);let t={},n=e;if(t.name=g.decode(r,e),e+=g.decode.bytes,t.type=ve.toString(r.readUInt16BE(e)),t.type==="OPT")t.udpPayloadSize=r.readUInt16BE(e+2),t.extendedRcode=r.readUInt8(e+4),t.ednsVersion=r.readUInt8(e+5),t.flags=r.readUInt16BE(e+6),t.flag_do=(t.flags>>15&1)===1,t.options=G.decode(r,e+8),e+=8+G.decode.bytes;else{let o=r.readUInt16BE(e+2);t.ttl=r.readUInt32BE(e+4),t.class=vr.toString(o&Gi),t.flush=!!(o&Wr);let i=Zr(t.type);t.data=i.decode(r,e+8),e+=8+i.decode.bytes}return M.decode.bytes=e-n,t};M.decode.bytes=0;M.encodingLength=function(r){let e=r.data!==null&&r.data!==void 0?r.data:r.options;return g.encodingLength(r.name)+8+Zr(r.type).encodingLength(e)};var Z=y.question={};Z.encode=function(r,e,t){e||(e=w.alloc(Z.encodingLength(r))),t||(t=0);let n=t;return g.encode(r.name,e,t),t+=g.encode.bytes,e.writeUInt16BE(ve.toType(r.type),t),t+=2,e.writeUInt16BE(vr.toClass(r.class===void 0?"IN":r.class),t),t+=2,Z.encode.bytes=t-n,r};Z.encode.bytes=0;Z.decode=function(r,e){e||(e=0);let t=e,n={};return n.name=g.decode(r,e),e+=g.decode.bytes,n.type=ve.toString(r.readUInt16BE(e)),e+=2,n.class=vr.toString(r.readUInt16BE(e)),e+=2,!!(n.class&Nn)&&(n.class&=Hi),Z.decode.bytes=e-t,n};Z.decode.bytes=0;Z.encodingLength=function(r){return g.encodingLength(r.name)+4};y.AUTHORITATIVE_ANSWER=1024;y.TRUNCATED_RESPONSE=512;y.RECURSION_DESIRED=256;y.RECURSION_AVAILABLE=128;y.AUTHENTIC_DATA=32;y.CHECKING_DISABLED=16;y.DNSSEC_OK=32768;y.encode=function(r,e,t){let n=!e;n&&(e=w.alloc(y.encodingLength(r))),t||(t=0);let o=t;return r.questions||(r.questions=[]),r.answers||(r.answers=[]),r.authorities||(r.authorities=[]),r.additionals||(r.additionals=[]),ee.encode(r,e,t),t+=ee.encode.bytes,t=Je(r.questions,Z,e,t),t=Je(r.answers,M,e,t),t=Je(r.authorities,M,e,t),t=Je(r.additionals,M,e,t),y.encode.bytes=t-o,n&&y.encode.bytes!==e.length?e.slice(0,y.encode.bytes):e};y.encode.bytes=0;y.decode=function(r,e){e||(e=0);let t=e,n=ee.decode(r,e);return e+=ee.decode.bytes,e=br(n.questions,Z,r,e),e=br(n.answers,M,r,e),e=br(n.authorities,M,r,e),e=br(n.additionals,M,r,e),y.decode.bytes=e-t,n};y.decode.bytes=0;y.encodingLength=function(r){return ee.encodingLength(r)+_e(r.questions||[],Z)+_e(r.answers||[],M)+_e(r.authorities||[],M)+_e(r.additionals||[],M)};y.streamEncode=function(r){let e=y.encode(r),t=w.alloc(2);t.writeUInt16BE(e.byteLength);let n=w.concat([t,e]);return y.streamEncode.bytes=n.byteLength,n};y.streamEncode.bytes=0;y.streamDecode=function(r){let e=r.readUInt16BE(0);if(r.byteLength<e+2)return null;let t=y.decode(r.slice(2));return y.streamDecode.bytes=y.decode.bytes,t};y.streamDecode.bytes=0;function _e(r,e){let t=0;for(let n=0;n<r.length;n++)t+=e.encodingLength(r[n]);return t}function Je(r,e,t,n){for(let o=0;o<r.length;o++)e.encode(r[o],t,n),n+=e.encode.bytes;return n}function br(r,e,t,n){for(let o=0;o<r.length;o++)r[o]=e.decode(t,n),n+=e.decode.bytes;return n}});var Fn=P((md,fn)=>{"use strict";var Rn=rs;process.nextTick(es,42);fn.exports=Qi;function Qi(r){var e=n;return t;function t(o){e(o||Wi)}function n(o){var i=[o];e=s,r(a);function s(m){i.push(m)}function a(m){var E=arguments;for(e=Ji(m)?n:h;i.length;)h(i.shift());function h(d){Rn(Zi,d,E)}}}}function Ji(r){return Object.prototype.toString.call(r)==="[object Error]"}function Wi(){}function Zi(r,e){r.apply(null,e)}function es(r){r===42&&(Rn=process.nextTick)}function rs(r,e,t){process.nextTick(function(){r(e,t)})}});var _n=P((yd,kn)=>{var et=Pn(),ts=te("dgram"),ns=Fn(),os=te("events"),tt=te("os"),rt=function(){};kn.exports=function(r){r||(r={});var e=new os.EventEmitter,t=typeof r.port=="number"?r.port:5353,n=r.type||"udp4",o=r.ip||r.host||(n==="udp4"?"224.0.0.251":null),i={address:o,port:t},s={},a=!1,m=null;if(n==="udp6"&&(!o||!r.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var E=r.socket||ts.createSocket({type:n,reuseAddr:r.reuseAddr!==!1,toString:function(){return n}});E.on("error",function(d){d.code==="EACCES"||d.code==="EADDRINUSE"?e.emit("error",d):e.emit("warning",d)}),E.on("message",function(d,l){try{d=et.decode(d)}catch(u){e.emit("warning",u);return}e.emit("packet",d,l),d.type==="query"&&e.emit("query",d,l),d.type==="response"&&e.emit("response",d,l)}),E.on("listening",function(){t||(t=i.port=E.address().port),r.multicast!==!1&&(e.update(),m=setInterval(e.update,5e3),E.setMulticastTTL(r.ttl||255),E.setMulticastLoopback(r.loopback!==!1))});var h=ns(function(d){if(!t||r.bind===!1)return d(null);E.once("error",d),E.bind(t,r.bind||r.interface,function(){E.removeListener("error",d),d(null)})});return h(function(d){if(d)return e.emit("error",d);e.emit("ready")}),e.send=function(d,l,u){if(typeof l=="function")return e.send(d,null,l);u||(u=rt),l?!l.host&&!l.address&&(l.address=i.address):l=i,h(c);function c(p){if(a)return u();if(p)return u(p);var x=et.encode(d);E.send(x,0,x.length,l.port,l.address||l.host,u)}},e.response=e.respond=function(d,l,u){Array.isArray(d)&&(d={answers:d}),d.type="response",d.flags=(d.flags||0)|et.AUTHORITATIVE_ANSWER,e.send(d,l,u)},e.query=function(d,l,u,c){if(typeof l=="function")return e.query(d,null,null,l);if(typeof l=="object"&&l&&l.port)return e.query(d,null,l,u);if(typeof u=="function")return e.query(d,l,null,u);c||(c=rt),typeof d=="string"&&(d=[{name:d,type:l||"ANY"}]),Array.isArray(d)&&(d={type:"query",questions:d}),d.type="query",e.send(d,u,c)},e.destroy=function(d){if(d||(d=rt),a)return process.nextTick(d);a=!0,clearInterval(m);for(var l in s)try{E.dropMembership(o,l)}catch{}s={},E.close(d)},e.update=function(){for(var d=r.interface?[].concat(r.interface):ss(),l=!1,u=0;u<d.length;u++){var c=d[u];if(!s[c])try{E.addMembership(o,c),s[c]=!0,l=!0}catch(p){e.emit("warning",p)}}if(l){if(E.setMulticastInterface)try{E.setMulticastInterface(r.interface||is())}catch(p){e.emit("warning",p)}e.emit("networkInterface")}},e};function is(){for(var r=tt.networkInterfaces(),e=Object.keys(r),t=0;t<e.length;t++)for(var n=r[e[t]],o=0;o<n.length;o++){var i=n[o];if(Mn(i.family)&&!i.internal)return tt.platform()==="darwin"&&e[t]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function ss(){for(var r=tt.networkInterfaces(),e=Object.keys(r),t=[],n=0;n<e.length;n++)for(var o=r[e[n]],i=0;i<o.length;i++){var s=o[i];if(Mn(s.family)){t.push(s.address);break}}return t}function Mn(r){return r===4||r==="IPv4"}});var Ao=P((Wl,So)=>{So.exports=qt;var Co=128,ia=127,sa=~ia,ca=Math.pow(2,31);function qt(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw qt.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=ca;)e[t++]=r&255|Co,r/=128;for(;r&sa;)e[t++]=r&255|Co,r>>>=7;return e[t]=r|0,qt.bytes=t-n+1,e}});var Lo=P((Zl,Oo)=>{Oo.exports=Vt;var aa=128,Uo=127;function Vt(r,n){var t=0,n=n||0,o=0,i=n,s,a=r.length;do{if(i>=a||o>49)throw Vt.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&Uo)<<o:(s&Uo)*Math.pow(2,o),o+=7}while(s>=aa);return Vt.bytes=i-n,t}});var Do=P((eu,To)=>{var da=Math.pow(2,7),la=Math.pow(2,14),ua=Math.pow(2,21),ha=Math.pow(2,28),pa=Math.pow(2,35),ga=Math.pow(2,42),ma=Math.pow(2,49),ya=Math.pow(2,56),wa=Math.pow(2,63);To.exports=function(r){return r<da?1:r<la?2:r<ua?3:r<ha?4:r<pa?5:r<ga?6:r<ma?7:r<ya?8:r<wa?9:10}});var $t=P((ru,Bo)=>{Bo.exports={encode:Ao(),decode:Lo(),encodingLength:Do()}});var Va={};T(Va,{mdns:()=>qa});var pr=class extends EventTarget{#e=new Map;listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:i})=>i!==t),this.#e.set(e,o))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t){return this.dispatchEvent(new gr(e,t))}},Pr=class extends Event{detail;constructor(e,t){super(e,t),this.detail=t?.detail}},gr=globalThis.CustomEvent??Pr;var on=Symbol.for("@libp2p/peer-discovery");var $=Pe(yn(),1);var qr={};T(qr,{base32:()=>J,base32hex:()=>Pi,base32hexpad:()=>fi,base32hexpadupper:()=>Fi,base32hexupper:()=>Ri,base32pad:()=>Bi,base32padupper:()=>Ni,base32upper:()=>Di,base32z:()=>Mi});function Ai(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=o}var a=r.length,m=r.charAt(0),E=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function d(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var p=0,x=0,b=0,I=c.length;b!==I&&c[b]===0;)b++,p++;for(var U=(I-b)*h+1>>>0,C=new Uint8Array(U);b!==I;){for(var S=c[b],A=0,L=U-1;(S!==0||A<x)&&L!==-1;L--,A++)S+=256*C[L]>>>0,C[L]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");x=A,b++}for(var D=U-x;D!==U&&C[D]===0;)D++;for(var Y=m.repeat(p);D<U;++D)Y+=r.charAt(C[D]);return Y}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var p=0;if(c[p]!==" "){for(var x=0,b=0;c[p]===m;)x++,p++;for(var I=(c.length-p)*E+1>>>0,U=new Uint8Array(I);c[p];){var C=t[c.charCodeAt(p)];if(C===255)return;for(var S=0,A=I-1;(C!==0||S<b)&&A!==-1;A--,S++)C+=a*U[A]>>>0,U[A]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");b=S,p++}if(c[p]!==" "){for(var L=I-b;L!==I&&U[L]===0;)L++;for(var D=new Uint8Array(x+(I-L)),Y=x;L!==I;)D[Y++]=U[L++];return D}}}function u(c){var p=l(c);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var Ui=Ai,Oi=Ui,wn=Oi;var Wa=new Uint8Array(0);var En=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},H=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")};var xn=r=>new TextEncoder().encode(r),bn=r=>new TextDecoder().decode(r);var Mr=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},kr=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return In(this,e)}},_r=class{constructor(e){this.decoders=e}or(e){return In(this,e)}decode(e){let t=e[0],n=this.decoders[t];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`)}},In=(r,e)=>new _r({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),zr=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Mr(e,t,n),this.decoder=new kr(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ke=({name:r,prefix:e,encode:t,decode:n})=>new zr(r,e,t,n),Ce=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=wn(t,e);return ke({prefix:r,name:e,encode:n,decode:i=>H(o(i))})},Li=(r,e,t,n)=>{let o={};for(let h=0;h<e.length;++h)o[e[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),a=0,m=0,E=0;for(let h=0;h<i;++h){let d=o[r[h]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);m=m<<t|d,a+=t,a>=8&&(a-=8,s[E++]=255&m>>a)}if(a>=t||255&m<<8-a)throw new SyntaxError("Unexpected end of data");return s},Ti=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,a=0;for(let m=0;m<r.length;++m)for(a=a<<8|r[m],s+=8;s>t;)s-=t,i+=e[o&a>>s];if(s&&(i+=e[o&a<<t-s]),n)for(;i.length*t&7;)i+="=";return i},B=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>ke({prefix:e,name:r,encode(o){return Ti(o,n,t)},decode(o){return Li(o,n,t,r)}});var J=B({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Di=B({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Bi=B({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ni=B({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Pi=B({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ri=B({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fi=B({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Fi=B({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Mi=B({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Vr={};T(Vr,{base58btc:()=>R,base58flickr:()=>ki});var R=Ce({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ki=Ce({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var jr={};T(jr,{base64:()=>$r,base64pad:()=>_i,base64url:()=>zi,base64urlpad:()=>qi});var $r=B({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_i=B({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),zi=B({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),qi=B({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});$.default.formatters.b=r=>r==null?"undefined":R.baseEncode(r);$.default.formatters.t=r=>r==null?"undefined":J.baseEncode(r);$.default.formatters.m=r=>r==null?"undefined":$r.baseEncode(r);$.default.formatters.p=r=>r==null?"undefined":r.toString();$.default.formatters.c=r=>r==null?"undefined":r.toString();$.default.formatters.k=r=>r==null?"undefined":r.toString();$.default.formatters.a=r=>r==null?"undefined":r.toString();function Vi(r){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=r,e.destroy=()=>!0,e.extend=()=>e,e}function xr(r){let e=Vi(`${r}:trace`);return $.default.enabled(`${r}:trace`)&&$.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(e=(0,$.default)(`${r}:trace`)),Object.assign((0,$.default)(r),{error:(0,$.default)(`${r}:error`),trace:e})}var Yo=Pe(_n(),1);var zn=Symbol.for("@libp2p/peer-id");var nt={};T(nt,{identity:()=>cs});var cs=ke({prefix:"\0",name:"identity",encode:r=>bn(r),decode:r=>xn(r)});var ot={};T(ot,{base2:()=>as});var as=B({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var it={};T(it,{base8:()=>ds});var ds=B({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var st={};T(st,{base10:()=>ls});var ls=Ce({prefix:"9",name:"base10",alphabet:"0123456789"});var ct={};T(ct,{base16:()=>us,base16upper:()=>hs});var us=B({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),hs=B({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var at={};T(at,{base36:()=>ps,base36upper:()=>gs});var ps=Ce({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gs=Ce({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var dt={};T(dt,{base256emoji:()=>xs});var qn=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}"),ms=qn.reduce((r,e,t)=>(r[t]=e,r),[]),ys=qn.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function ws(r){return r.reduce((e,t)=>(e+=ms[t],e),"")}function Es(r){let e=[];for(let t of r){let n=ys[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var xs=ke({prefix:"\u{1F680}",name:"base256emoji",encode:ws,decode:Es});var gt={};T(gt,{sha256:()=>Cr,sha512:()=>ks});var pt=Pe(te("crypto"),1);var bs=jn,Vn=128,vs=127,Is=~vs,Cs=Math.pow(2,31);function jn(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Cs;)e[t++]=r&255|Vn,r/=128;for(;r&Is;)e[t++]=r&255|Vn,r>>>=7;return e[t]=r|0,jn.bytes=t-n+1,e}var Ss=lt,As=128,$n=127;function lt(r,n){var t=0,n=n||0,o=0,i=n,s,a=r.length;do{if(i>=a)throw lt.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&$n)<<o:(s&$n)*Math.pow(2,o),o+=7}while(s>=As);return lt.bytes=i-n,t}var Us=Math.pow(2,7),Os=Math.pow(2,14),Ls=Math.pow(2,21),Ts=Math.pow(2,28),Ds=Math.pow(2,35),Bs=Math.pow(2,42),Ns=Math.pow(2,49),Ps=Math.pow(2,56),Rs=Math.pow(2,63),fs=function(r){return r<Us?1:r<Os?2:r<Ls?3:r<Ts?4:r<Ds?5:r<Bs?6:r<Ns?7:r<Ps?8:r<Rs?9:10},Fs={encode:bs,decode:Ss,encodingLength:fs},Ms=Fs,We=Ms;var Ze=(r,e=0)=>[We.decode(r,e),We.decode.bytes],ze=(r,e,t=0)=>(We.encode(r,e,t),e),qe=r=>We.encodingLength(r);var Ae=(r,e)=>{let t=e.byteLength,n=qe(r),o=n+qe(t),i=new Uint8Array(o+t);return ze(r,i,0),ze(t,i,n),i.set(e,o),new Ve(r,t,e,i)},De=r=>{let e=H(r),[t,n]=Ze(e),[o,i]=Ze(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Ve(t,o,s,e)},Kn=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&En(r.bytes,t.bytes)}},Ve=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var ht=({name:r,code:e,encode:t})=>new ut(r,e,t),ut=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Ae(this.code,t):t.then(n=>Ae(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Cr=ht({name:"sha2-256",code:18,encode:r=>H(pt.default.createHash("sha256").update(r).digest())}),ks=ht({name:"sha2-512",code:19,encode:r=>H(pt.default.createHash("sha512").update(r).digest())});var mt={};T(mt,{identity:()=>Sr});var Hn=0,_s="identity",Xn=H,zs=r=>Ae(Hn,Xn(r)),Sr={code:Hn,name:_s,encode:Xn,digest:zs};var Rd=new TextEncoder,fd=new TextDecoder;var Yn=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return js(t,yt(r),e||R.encoder);default:return Ks(t,yt(r),e||J.encoder)}};var Qn=new WeakMap,yt=r=>{let e=Qn.get(r);if(e==null){let t=new Map;return Qn.set(r,t),t}return e},re=class r{constructor(e,t,n,o){this.code=t,this.version=e,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:e,multihash:t}=this;if(e!==er)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Gs)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=Ae(e,t);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(e){return r.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&Kn(e.multihash,n.multihash)}toString(e){return Yn(this,e)}toJSON(){return{"/":Yn(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:i,bytes:s}=t;return new r(n,o,i,s||Jn(n,o,i.bytes))}else if(t[Hs]===!0){let{version:n,multihash:o,code:i}=t,s=De(o);return r.create(n,i,s)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==er)throw new Error(`Version 0 CID must use dag-pb (code: ${er}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Jn(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,er,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=H(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=o.subarray(t.multihashSize-t.digestSize),s=new Ve(t.multihashCode,t.digestSize,i,o);return[t.version===0?r.createV0(s):r.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[d,l]=Ze(e.subarray(t));return t+=l,d},o=n(),i=er;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,a=n(),m=n(),E=t+m,h=E-s;return{version:o,codec:i,multihashCode:a,digestSize:m,multihashSize:h,size:E}}static parse(e,t){let[n,o]=$s(e,t),i=r.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return yt(i).set(n,e),i}},$s=(r,e)=>{switch(r[0]){case"Q":{let t=e||R;return[R.prefix,t.decode(`${R.prefix}${r}`)]}case R.prefix:{let t=e||R;return[R.prefix,t.decode(r)]}case J.prefix:{let t=e||J;return[J.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},js=(r,e,t)=>{let{prefix:n}=t;if(n!==R.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return o},Ks=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let i=t.encode(r);return e.set(n,i),i}else return o},er=112,Gs=18,Jn=(r,e,t)=>{let n=qe(r),o=n+qe(e),i=new Uint8Array(o+t.byteLength);return ze(r,i,0),ze(e,i,n),i.set(t,o),i},Hs=Symbol.for("@ipld/js-cid/CID");var rr={...nt,...ot,...it,...st,...ct,...qr,...at,...Vr,...jr,...dt},Kd={...gt,...mt};function tr(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Xs=Symbol.for("nodejs.util.inspect.custom"),Wn=Object.values(rr).map(r=>r.decoder).reduce((r,e)=>r.or(e),rr.identity.decoder),Zn=114,eo=36,ro=37,nr=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[zn]=!0;toString(){return this.string==null&&(this.string=R.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return re.createV1(Zn,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return tr(this.multihash.bytes,e);if(typeof e=="string")return wt(e).equals(this);if(e?.multihash?.bytes!=null)return tr(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Xs](){return`PeerId(${this.toString()})`}},or=class extends nr{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},ir=class extends nr{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},sr=class extends nr{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function wt(r,e){if(e=e??Wn,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=De(R.decode(`z${r}`));return r.startsWith("12D")?new ir({multihash:t}):r.startsWith("16U")?new sr({multihash:t}):new or({multihash:t})}return Ys(Wn.decode(r))}function Ys(r){try{let e=De(r);if(e.code===Sr.code){if(e.digest.length===eo)return new ir({multihash:e});if(e.digest.length===ro)return new sr({multihash:e})}if(e.code===Cr.code)return new or({multihash:e})}catch{return Qs(re.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Qs(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==Zn)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===Cr.code)return new or({multihash:r.multihash});if(e.code===Sr.code){if(e.digest.length===eo)return new ir({multihash:r.multihash});if(e.digest.length===ro)return new sr({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Ar=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var It={};T(It,{identity:()=>tc});function Js(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=o}var a=r.length,m=r.charAt(0),E=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function d(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var p=0,x=0,b=0,I=c.length;b!==I&&c[b]===0;)b++,p++;for(var U=(I-b)*h+1>>>0,C=new Uint8Array(U);b!==I;){for(var S=c[b],A=0,L=U-1;(S!==0||A<x)&&L!==-1;L--,A++)S+=256*C[L]>>>0,C[L]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");x=A,b++}for(var D=U-x;D!==U&&C[D]===0;)D++;for(var Y=m.repeat(p);D<U;++D)Y+=r.charAt(C[D]);return Y}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var p=0;if(c[p]!==" "){for(var x=0,b=0;c[p]===m;)x++,p++;for(var I=(c.length-p)*E+1>>>0,U=new Uint8Array(I);c[p];){var C=t[c.charCodeAt(p)];if(C===255)return;for(var S=0,A=I-1;(C!==0||S<b)&&A!==-1;A--,S++)C+=a*U[A]>>>0,U[A]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");b=S,p++}if(c[p]!==" "){for(var L=I-b;L!==I&&U[L]===0;)L++;for(var D=new Uint8Array(x+(I-L)),Y=x;L!==I;)D[Y++]=U[L++];return D}}}function u(c){var p=l(c);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var Ws=Js,Zs=Ws,to=Zs;var sl=new Uint8Array(0);var no=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},X=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")};var oo=r=>new TextEncoder().encode(r),io=r=>new TextDecoder().decode(r);var Et=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},xt=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return co(this,e)}},bt=class{constructor(e){this.decoders=e}or(e){return co(this,e)}decode(e){let t=e[0],n=this.decoders[t];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`)}},co=(r,e)=>new bt({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),vt=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Et(e,t,n),this.decoder=new xt(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},$e=({name:r,prefix:e,encode:t,decode:n})=>new vt(r,e,t,n),Ue=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=to(t,e);return $e({prefix:r,name:e,encode:n,decode:i=>X(o(i))})},ec=(r,e,t,n)=>{let o={};for(let h=0;h<e.length;++h)o[e[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),a=0,m=0,E=0;for(let h=0;h<i;++h){let d=o[r[h]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);m=m<<t|d,a+=t,a>=8&&(a-=8,s[E++]=255&m>>a)}if(a>=t||255&m<<8-a)throw new SyntaxError("Unexpected end of data");return s},rc=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,a=0;for(let m=0;m<r.length;++m)for(a=a<<8|r[m],s+=8;s>t;)s-=t,i+=e[o&a>>s];if(s&&(i+=e[o&a<<t-s]),n)for(;i.length*t&7;)i+="=";return i},N=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>$e({prefix:e,name:r,encode(o){return rc(o,n,t)},decode(o){return ec(o,n,t,r)}});var tc=$e({prefix:"\0",name:"identity",encode:r=>io(r),decode:r=>oo(r)});var Ct={};T(Ct,{base2:()=>nc});var nc=N({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var St={};T(St,{base8:()=>oc});var oc=N({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var At={};T(At,{base10:()=>ic});var ic=Ue({prefix:"9",name:"base10",alphabet:"0123456789"});var Ut={};T(Ut,{base16:()=>sc,base16upper:()=>cc});var sc=N({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),cc=N({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ot={};T(Ot,{base32:()=>je,base32hex:()=>uc,base32hexpad:()=>pc,base32hexpadupper:()=>gc,base32hexupper:()=>hc,base32pad:()=>dc,base32padupper:()=>lc,base32upper:()=>ac,base32z:()=>mc});var je=N({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ac=N({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dc=N({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),lc=N({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),uc=N({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hc=N({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pc=N({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gc=N({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mc=N({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lt={};T(Lt,{base36:()=>yc,base36upper:()=>wc});var yc=Ue({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wc=Ue({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Tt={};T(Tt,{base58btc:()=>le,base58flickr:()=>Ec});var le=Ue({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ec=Ue({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Dt={};T(Dt,{base64:()=>xc,base64pad:()=>bc,base64url:()=>vc,base64urlpad:()=>Ic});var xc=N({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bc=N({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vc=N({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ic=N({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Bt={};T(Bt,{base256emoji:()=>Oc});var ao=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}"),Cc=ao.reduce((r,e,t)=>(r[t]=e,r),[]),Sc=ao.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Ac(r){return r.reduce((e,t)=>(e+=Cc[t],e),"")}function Uc(r){let e=[];for(let t of r){let n=Sc[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Oc=$e({prefix:"\u{1F680}",name:"base256emoji",encode:Ac,decode:Uc});var Ft={};T(Ft,{sha256:()=>Gc,sha512:()=>Hc});var ft=Pe(te("crypto"),1);var Lc=ho,lo=128,Tc=127,Dc=~Tc,Bc=Math.pow(2,31);function ho(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Bc;)e[t++]=r&255|lo,r/=128;for(;r&Dc;)e[t++]=r&255|lo,r>>>=7;return e[t]=r|0,ho.bytes=t-n+1,e}var Nc=Nt,Pc=128,uo=127;function Nt(r,n){var t=0,n=n||0,o=0,i=n,s,a=r.length;do{if(i>=a)throw Nt.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&uo)<<o:(s&uo)*Math.pow(2,o),o+=7}while(s>=Pc);return Nt.bytes=i-n,t}var Rc=Math.pow(2,7),fc=Math.pow(2,14),Fc=Math.pow(2,21),Mc=Math.pow(2,28),kc=Math.pow(2,35),_c=Math.pow(2,42),zc=Math.pow(2,49),qc=Math.pow(2,56),Vc=Math.pow(2,63),$c=function(r){return r<Rc?1:r<fc?2:r<Fc?3:r<Mc?4:r<kc?5:r<_c?6:r<zc?7:r<qc?8:r<Vc?9:10},jc={encode:Lc,decode:Nc,encodingLength:$c},Kc=jc,cr=Kc;var ar=(r,e=0)=>[cr.decode(r,e),cr.decode.bytes],Ke=(r,e,t=0)=>(cr.encode(r,e,t),e),Ge=r=>cr.encodingLength(r);var Ne=(r,e)=>{let t=e.byteLength,n=Ge(r),o=n+Ge(t),i=new Uint8Array(o+t);return Ke(r,i,0),Ke(t,i,n),i.set(e,o),new He(r,t,e,i)},po=r=>{let e=X(r),[t,n]=ar(e),[o,i]=ar(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new He(t,o,s,e)},go=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&no(r.bytes,t.bytes)}},He=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Rt=({name:r,code:e,encode:t})=>new Pt(r,e,t),Pt=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Ne(this.code,t):t.then(n=>Ne(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Gc=Rt({name:"sha2-256",code:18,encode:r=>X(ft.default.createHash("sha256").update(r).digest())}),Hc=Rt({name:"sha2-512",code:19,encode:r=>X(ft.default.createHash("sha512").update(r).digest())});var Mt={};T(Mt,{identity:()=>Qc});var yo=0,Xc="identity",wo=X,Yc=r=>Ne(yo,wo(r)),Qc={code:yo,name:Xc,encode:wo,digest:Yc};var Ll=new TextEncoder,Tl=new TextDecoder;var Eo=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return ea(t,kt(r),e||le.encoder);default:return ra(t,kt(r),e||je.encoder)}};var xo=new WeakMap,kt=r=>{let e=xo.get(r);if(e==null){let t=new Map;return xo.set(r,t),t}return e},Or=class r{constructor(e,t,n,o){this.code=t,this.version=e,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:e,multihash:t}=this;if(e!==lr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==ta)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=Ne(e,t);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(e){return r.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&go(e.multihash,n.multihash)}toString(e){return Eo(this,e)}toJSON(){return{"/":Eo(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:i,bytes:s}=t;return new r(n,o,i,s||bo(n,o,i.bytes))}else if(t[na]===!0){let{version:n,multihash:o,code:i}=t,s=po(o);return r.create(n,i,s)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==lr)throw new Error(`Version 0 CID must use dag-pb (code: ${lr}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=bo(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,lr,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=X(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=o.subarray(t.multihashSize-t.digestSize),s=new He(t.multihashCode,t.digestSize,i,o);return[t.version===0?r.createV0(s):r.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[d,l]=ar(e.subarray(t));return t+=l,d},o=n(),i=lr;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,a=n(),m=n(),E=t+m,h=E-s;return{version:o,codec:i,multihashCode:a,digestSize:m,multihashSize:h,size:E}}static parse(e,t){let[n,o]=Zc(e,t),i=r.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return kt(i).set(n,e),i}},Zc=(r,e)=>{switch(r[0]){case"Q":{let t=e||le;return[le.prefix,t.decode(`${le.prefix}${r}`)]}case le.prefix:{let t=e||le;return[le.prefix,t.decode(r)]}case je.prefix:{let t=e||je;return[je.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},ea=(r,e,t)=>{let{prefix:n}=t;if(n!==le.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return o},ra=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let i=t.encode(r);return e.set(n,i),i}else return o},lr=112,ta=18,bo=(r,e,t)=>{let n=Ge(r),o=n+Ge(e),i=new Uint8Array(o+t.byteLength);return Ke(r,i,0),Ke(e,i,n),i.set(t,o),i},na=Symbol.for("@ipld/js-cid/CID");var _t={...It,...Ct,...St,...At,...Ut,...Ot,...Lt,...Tt,...Dt,...Bt},_l={...Ft,...Mt};function Xe(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Lr(r=0){return globalThis.Buffer?.allocUnsafe!=null?Xe(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Io(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var vo=Io("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),zt=Io("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Lr(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),oa={utf8:vo,"utf-8":vo,hex:_t.base16,latin1:zt,ascii:zt,binary:zt,..._t},Tr=oa;function q(r,e="utf8"){let t=Tr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function Ie(r,e){e==null&&(e=r.reduce((o,i)=>o+i.length,0));let t=Lr(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return Xe(t)}var Qe=Pe($t(),1);var Dr=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let i=0,s=0,a=this.peekChar();if(a===void 0)return;let m=a==="0",E=2**(8*o)-1;for(;;){let h=this.readAtomically(()=>{let d=this.readChar();if(d===void 0)return;let l=Number.parseInt(d,e);if(!Number.isNaN(l))return l});if(h===void 0)break;if(i*=e,i+=h,i>E||(s+=1,t!==void 0&&s>t))return}if(s!==0)return!n&&m&&s>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return t[o]=s[0],t[o+1]=s[1],t[o+2]=s[2],t[o+3]=s[3],[o+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];t[o]=i>>8,t[o+1]=i&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),s=16-(n+2),[a]=e(i.subarray(0,s));return t.set(i.subarray(0,a),16-a),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var ou=new Dr;var hu=parseInt("0xFFFF",16),pu=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function jt(r,e="utf8"){let t=Tr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Xe(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var ue=Pe($t(),1);var Oe=te("node:net");function Br(r){return!!(0,Oe.isIP)(r)}var Ro=Oe.isIPv4,Ca=Oe.isIPv6,Kt=function(r){let e=0;if(r=r.toString().trim(),Ro(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(Ca(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let i=Ro(t[n]),s;i&&(s=Kt(t[n]),t[n]=q(s.slice(0,2),"base16")),s!=null&&++n<8&&t.splice(n,0,q(s.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let i=[n,1];for(n=9-t.length;n>0;n--)i.push("0");t.splice.apply(t,i)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){let i=parseInt(t[n],16);o[e++]=i>>8&255,o[e++]=i&255}return o}throw new Error("invalid ip address")},fo=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let o=[];for(let i=0;i<t;i++)o.push(r[e+i]);return o.join(".")}if(t===16){let o=[];for(let i=0;i<t;i+=2)o.push(n.getUint16(e+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ye={},Gt={},Aa=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];Aa.forEach(r=>{let e=Ua(...r);Gt[e.code]=e,Ye[e.name]=e});function Ua(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function O(r){if(typeof r=="number"){if(Gt[r]!=null)return Gt[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ye[r]!=null)return Ye[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var eh=O("ip4"),rh=O("ip6"),th=O("ipcidr");function Xt(r,e){switch(O(r).code){case 4:case 41:return La(e);case 42:return ko(e);case 6:case 273:case 33:case 132:return zo(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ko(e);case 421:return Na(e);case 444:return _o(e);case 445:return _o(e);case 466:return Ba(e);default:return q(e,"base16")}}function Yt(r,e){switch(O(r).code){case 4:return Fo(e);case 41:return Fo(e);case 42:return Mo(e);case 6:case 273:case 33:case 132:return Qt(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Mo(e);case 421:return Ta(e);case 444:return Pa(e);case 445:return Ra(e);case 466:return Da(e);default:return jt(e,"base16")}}var Ht=Object.values(rr).map(r=>r.decoder),Oa=function(){let r=Ht[0].or(Ht[1]);return Ht.slice(2).forEach(e=>r=r.or(e)),r}();function Fo(r){if(!Br(r))throw new Error("invalid ip address");return Kt(r)}function La(r){let e=fo(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!Br(e))throw new Error("invalid ip address");return e}function Qt(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function zo(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Mo(r){let e=jt(r),t=Uint8Array.from(ue.default.encode(e.length));return Ie([t,e],t.length+e.length)}function ko(r){let e=ue.default.decode(r);if(r=r.slice(ue.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return q(r)}function Ta(r){let e;r[0]==="Q"||r[0]==="1"?e=De(R.decode(`z${r}`)).bytes:e=re.parse(r).multihash.bytes;let t=Uint8Array.from(ue.default.encode(e.length));return Ie([t,e],t.length+e.length)}function Da(r){let e=Oa.decode(r),t=Uint8Array.from(ue.default.encode(e.length));return Ie([t,e],t.length+e.length)}function Ba(r){let e=ue.default.decode(r),t=r.slice(ue.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+q(t,"base64url")}function Na(r){let e=ue.default.decode(r),t=r.slice(ue.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return q(t,"base58btc")}function Pa(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' 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 t=J.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 o=Qt(n);return Ie([t,o],t.length+o.length)}function Ra(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' 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 t=J.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 o=Qt(n);return Ie([t,o],t.length+o.length)}function _o(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=q(e,"base32"),o=zo(t);return`${n}:${o}`}function qo(r){r=Jt(r);let e=[],t=[],n=null,o=r.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let i=0;i<o.length;i++){let s=o[i],a=O(s);if(a.size===0){e.push([a.code]),t.push([a.code]);continue}if(i++,i>=o.length)throw $o("invalid address: "+r);if(a.path===!0){n=Jt(o.slice(i).join("/")),e.push([a.code,Yt(a.code,n)]),t.push([a.code,n]);break}let m=Yt(a.code,o[i]);e.push([a.code,m]),t.push([a.code,Xt(a.code,m)])}return{string:Vo(t),bytes:Zt(e),tuples:e,stringTuples:t,path:n}}function Wt(r){let e=[],t=[],n=null,o=0;for(;o<r.length;){let i=Qe.default.decode(r,o),s=Qe.default.decode.bytes??0,a=O(i),m=fa(a,r.slice(o+s));if(m===0){e.push([i]),t.push([i]),o+=s;continue}let E=r.slice(o+s,o+s+m);if(o+=m+s,o>r.length)throw $o("Invalid address Uint8Array: "+q(r,"base16"));e.push([i,E]);let h=Xt(i,E);if(t.push([i,h]),a.path===!0){n=h;break}}return{bytes:Uint8Array.from(r),string:Vo(t),tuples:e,stringTuples:t,path:n}}function Vo(r){let e=[];return r.map(t=>{let n=O(t[0]);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),Jt(e.join("/"))}function Zt(r){return Ie(r.map(e=>{let t=O(e[0]),n=Uint8Array.from(Qe.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=Ie([n,e[1]])),n}))}function fa(r,e){return r.size>0?r.size/8:r.size===0?0:Qe.default.decode(e)+(Qe.default.decode.bytes??0)}function Jt(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function $o(r){return new Error("Error parsing address: "+r)}var Fa=Symbol.for("nodejs.util.inspect.custom"),Ma=[O("dns").code,O("dns4").code,O("dns6").code,O("dnsaddr").code],ka=new Map,jo=Symbol.for("@multiformats/js-multiaddr/multiaddr");function _a(r){return!!r?.[jo]}var rn=class r{bytes;#e;#r;#t;#n;[jo]=!0;constructor(e){e==null&&(e="");let t;if(e instanceof Uint8Array)t=Wt(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);t=qo(e)}else if(_a(e))t=Wt(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.bytes,this.#e=t.string,this.#r=t.tuples,this.#t=t.stringTuples,this.#n=t.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,t,n,o,i="",s=O("tcp"),a=O("udp"),m=O("ip4"),E=O("ip6"),h=O("dns6"),d=O("ip6zone");for(let[u,c]of this.stringTuples())u===d.code&&(i=`%${c??""}`),Ma.includes(u)&&(t=s.name,o=443,n=`${c??""}${i}`,e=u===h.code?6:4),(u===s.code||u===a.code)&&(t=O(u).name,o=parseInt(c??"")),(u===m.code||u===E.code)&&(t=O(u).name,n=`${c??""}${i}`,e=u===E.code?6:4);if(e==null||t==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:o}}protos(){return this.#r.map(([e])=>Object.assign({},O(e)))}protoCodes(){return this.#r.map(([e])=>e)}protoNames(){return this.#r.map(([e])=>O(e).name)}tuples(){return this.#r}stringTuples(){return this.#t}encapsulate(e){return e=new r(e),new r(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new r(n.slice(0,o))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new r(Zt(t.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,o])=>{n===Ye.p2p.code&&e.push([n,o]),n===Ye["p2p-circuit"].code&&(e=[])});let t=e.pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?q(R.decode(`z${n}`),"base58btc"):q(re.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return tr(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let n=ka.get(t.name);if(n==null)throw new Ar(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(i=>new r(i))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[Fa](){return`Multiaddr(${this.#e})`}};function en(r){return new rn(r)}var ur=xr("libp2p:mdns:query");function Ko(r,e,t){let n=()=>{ur("query",e),r.query({questions:[{name:e,type:"PTR"}]})};return n(),setInterval(n,t)}function Go(r,e,t){if(r.answers==null)return;let n,o=[];if(r.answers.forEach(i=>{switch(i.type){case"PTR":n=i;break;case"TXT":o.push(i);break;default:break}}),!(n==null||n?.name!==t||o.length===0||n.data.startsWith(e)))try{let i=o.flatMap(a=>a.data).filter(a=>a.toString().startsWith("dnsaddr=")).map(a=>en(a.toString().substring(8))),s=i[0].getPeerId();if(s==null)throw new Error("Multiaddr doesn't contain PeerId");return ur("peer found %p",s),{id:wt(s),multiaddrs:i,protocols:[]}}catch(i){ur.error("failed to parse mdns response",i)}}function Ho(r,e,t,n,o,i){if(!i){ur("not responding to mDNS query as broadcast mode is false");return}if(n.length!==0&&r.questions[0]!=null&&r.questions[0].name===o){let s=[];s.push({name:o,type:"PTR",class:"IN",ttl:120,data:t+"."+o}),n.forEach(a=>{a.getPeerId()!=null&&s.push({name:t+"."+o,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+a.toString()})}),ur("responding to query"),e.respond(s)}}function Xo(r){let e="",t="abcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}var Nr=xr("libp2p:mdns"),tn=class extends pr{mdns;broadcast;interval;serviceTag;peerName;port;ip;_queryInterval;components;constructor(e,t={}){if(super(),this.broadcast=t.broadcast!==!1,this.interval=t.interval??1e3*10,this.serviceTag=t.serviceTag??"_p2p._udp.local",this.ip=t.ip??"224.0.0.251",this.peerName=t.peerName??Xo(63),this.peerName.length>=64)throw new Error("Peer name should be less than 64 chars long");this.port=t.port??5353,this.components=e,this._queryInterval=null,this._onPeer=this._onPeer.bind(this),this._onMdnsQuery=this._onMdnsQuery.bind(this),this._onMdnsResponse=this._onMdnsResponse.bind(this)}[on]=this;[Symbol.toStringTag]="@libp2p/mdns";isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,Yo.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=Ko(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){this.mdns!=null&&(Nr.trace("received incoming mDNS query"),Ho(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast))}_onMdnsResponse(e){Nr.trace("received mDNS query response");try{let t=Go(e,this.peerName,this.serviceTag);t!=null&&(Nr("discovered peer in mDNS query response %p",t.id),this.dispatchEvent(new gr("peer",{detail:t})))}catch(t){Nr.error("Error processing peer response",t)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new gr("peer",{detail:e.detail}))}async stop(){this.mdns!=null&&(this.mdns.removeListener("query",this._onMdnsQuery),this.mdns.removeListener("response",this._onMdnsResponse),this._queryInterval!=null&&(clearInterval(this._queryInterval),this._queryInterval=null),await new Promise(e=>{this.mdns!=null?this.mdns.destroy(e):e()}),this.mdns=void 0)}};function qa(r={}){return e=>new tn(e,r)}return ri(Va);})();
|
|
7
7
|
return Libp2PMdns}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/mdns",
|
|
3
|
-
"version": "8.0.0-
|
|
3
|
+
"version": "8.0.0-1f7e18b0",
|
|
4
4
|
"description": "Node.js libp2p mDNS discovery implementation for peer discovery",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/peer-discovery-mdns#readme",
|
|
@@ -44,23 +44,20 @@
|
|
|
44
44
|
"test:electron-main": "aegir test -t electron-main"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@libp2p/interface": "0.0.1-
|
|
48
|
-
"@libp2p/logger": "2.1.1-
|
|
49
|
-
"@libp2p/peer-id": "2.0.3-
|
|
47
|
+
"@libp2p/interface": "0.0.1-1f7e18b0",
|
|
48
|
+
"@libp2p/logger": "2.1.1-1f7e18b0",
|
|
49
|
+
"@libp2p/peer-id": "2.0.3-1f7e18b0",
|
|
50
50
|
"@multiformats/multiaddr": "^12.1.3",
|
|
51
51
|
"@types/multicast-dns": "^7.2.1",
|
|
52
52
|
"dns-packet": "^5.4.0",
|
|
53
53
|
"multicast-dns": "^7.2.5"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@libp2p/interface-compliance-tests": "3.0.7-
|
|
57
|
-
"@libp2p/interface-internal": "0.0.1-
|
|
58
|
-
"@libp2p/peer-id-factory": "2.0.3-
|
|
59
|
-
"aegir": "^
|
|
60
|
-
"p-wait-for": "^5.0.
|
|
56
|
+
"@libp2p/interface-compliance-tests": "3.0.7-1f7e18b0",
|
|
57
|
+
"@libp2p/interface-internal": "0.0.1-1f7e18b0",
|
|
58
|
+
"@libp2p/peer-id-factory": "2.0.3-1f7e18b0",
|
|
59
|
+
"aegir": "^40.0.1",
|
|
60
|
+
"p-wait-for": "^5.0.2",
|
|
61
61
|
"ts-sinon": "^2.0.2"
|
|
62
|
-
},
|
|
63
|
-
"typedoc": {
|
|
64
|
-
"entryPoint": "./src/index.ts"
|
|
65
62
|
}
|
|
66
63
|
}
|