@libp2p/mdns 9.0.4-f3fd7b62 → 9.0.5
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 +2 -2
- package/dist/typedoc-urls.json +5 -0
- package/package.json +7 -7
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 jt=Object.create;var nr=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty;var de=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var F=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),$=(r,e)=>{for(var n in e)nr(r,n,{get:e[n],enumerable:!0})},An=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ht(e))!Gt.call(r,i)&&i!==n&&nr(r,i,{get:()=>e[i],enumerable:!(t=Kt(e,i))||t.enumerable});return r};var Ir=(r,e,n)=>(n=r!=null?jt(Yt(r)):{},An(e||!r||!r.__esModule?nr(n,"default",{value:r,enumerable:!0}):n,r)),Xt=r=>An(nr({},"__esModule",{value:!0}),r);var On=F((Oc,bn)=>{var Pe=1e3,De=Pe*60,Fe=De*60,be=Fe*24,Qt=be*7,Wt=be*365.25;bn.exports=function(r,e){e=e||{};var n=typeof r;if(n==="string"&&r.length>0)return Jt(r);if(n==="number"&&isFinite(r))return e.long?ft(r):Zt(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Jt(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 n=parseFloat(e[1]),t=(e[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"yrs":case"yr":case"y":return n*Wt;case"weeks":case"week":case"w":return n*Qt;case"days":case"day":case"d":return n*be;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Fe;case"minutes":case"minute":case"mins":case"min":case"m":return n*De;case"seconds":case"second":case"secs":case"sec":case"s":return n*Pe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Zt(r){var e=Math.abs(r);return e>=be?Math.round(r/be)+"d":e>=Fe?Math.round(r/Fe)+"h":e>=De?Math.round(r/De)+"m":e>=Pe?Math.round(r/Pe)+"s":r+"ms"}function ft(r){var e=Math.abs(r);return e>=be?or(r,e,be,"day"):e>=Fe?or(r,e,Fe,"hour"):e>=De?or(r,e,De,"minute"):e>=Pe?or(r,e,Pe,"second"):r+" ms"}function or(r,e,n,t){var i=e>=n*1.5;return Math.round(r/n)+" "+t+(i?"s":"")}});var Cr=F((Lc,Ln)=>{function ei(r){n.debug=n,n.default=n,n.coerce=
|
|
2
|
+
"use strict";var Libp2PMdns=(()=>{var jt=Object.create;var nr=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty;var de=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var F=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),$=(r,e)=>{for(var n in e)nr(r,n,{get:e[n],enumerable:!0})},An=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ht(e))!Gt.call(r,i)&&i!==n&&nr(r,i,{get:()=>e[i],enumerable:!(t=Kt(e,i))||t.enumerable});return r};var Ir=(r,e,n)=>(n=r!=null?jt(Yt(r)):{},An(e||!r||!r.__esModule?nr(n,"default",{value:r,enumerable:!0}):n,r)),Xt=r=>An(nr({},"__esModule",{value:!0}),r);var On=F((Oc,bn)=>{var Pe=1e3,De=Pe*60,Fe=De*60,be=Fe*24,Qt=be*7,Wt=be*365.25;bn.exports=function(r,e){e=e||{};var n=typeof r;if(n==="string"&&r.length>0)return Jt(r);if(n==="number"&&isFinite(r))return e.long?ft(r):Zt(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Jt(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 n=parseFloat(e[1]),t=(e[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"yrs":case"yr":case"y":return n*Wt;case"weeks":case"week":case"w":return n*Qt;case"days":case"day":case"d":return n*be;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Fe;case"minutes":case"minute":case"mins":case"min":case"m":return n*De;case"seconds":case"second":case"secs":case"sec":case"s":return n*Pe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Zt(r){var e=Math.abs(r);return e>=be?Math.round(r/be)+"d":e>=Fe?Math.round(r/Fe)+"h":e>=De?Math.round(r/De)+"m":e>=Pe?Math.round(r/Pe)+"s":r+"ms"}function ft(r){var e=Math.abs(r);return e>=be?or(r,e,be,"day"):e>=Fe?or(r,e,Fe,"hour"):e>=De?or(r,e,De,"minute"):e>=Pe?or(r,e,Pe,"second"):r+" ms"}function or(r,e,n,t){var i=e>=n*1.5;return Math.round(r/n)+" "+t+(i?"s":"")}});var Cr=F((Lc,Ln)=>{function ei(r){n.debug=n,n.default=n,n.coerce=m,n.disable=o,n.enable=i,n.enabled=s,n.humanize=On(),n.destroy=E,Object.keys(r).forEach(p=>{n[p]=r[p]}),n.names=[],n.skips=[],n.formatters={};function e(p){let a=0;for(let d=0;d<p.length;d++)a=(a<<5)-a+p.charCodeAt(d),a|=0;return n.colors[Math.abs(a)%n.colors.length]}n.selectColor=e;function n(p){let a,d=null,u,c;function g(...I){if(!g.enabled)return;let C=g,U=Number(new Date),B=U-(a||U);C.diff=B,C.prev=a,C.curr=U,a=U,I[0]=n.coerce(I[0]),typeof I[0]!="string"&&I.unshift("%O");let S=0;I[0]=I[0].replace(/%([a-zA-Z%])/g,(b,z)=>{if(b==="%%")return"%";S++;let G=n.formatters[z];if(typeof G=="function"){let Ne=I[S];b=G.call(C,Ne),I.splice(S,1),S--}return b}),n.formatArgs.call(C,I),(C.log||n.log).apply(C,I)}return g.namespace=p,g.useColors=n.useColors(),g.color=n.selectColor(p),g.extend=t,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(u!==n.namespaces&&(u=n.namespaces,c=n.enabled(p)),c),set:I=>{d=I}}),typeof n.init=="function"&&n.init(g),g}function t(p,a){let d=n(this.namespace+(typeof a>"u"?":":a)+p);return d.log=this.log,d}function i(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let a,d=(typeof p=="string"?p:"").split(/[\s,]+/),u=d.length;for(a=0;a<u;a++)d[a]&&(p=d[a].replace(/\*/g,".*?"),p[0]==="-"?n.skips.push(new RegExp("^"+p.slice(1)+"$")):n.names.push(new RegExp("^"+p+"$")))}function o(){let p=[...n.names.map(l),...n.skips.map(l).map(a=>"-"+a)].join(",");return n.enable(""),p}function s(p){if(p[p.length-1]==="*")return!0;let a,d;for(a=0,d=n.skips.length;a<d;a++)if(n.skips[a].test(p))return!1;for(a=0,d=n.names.length;a<d;a++)if(n.names[a].test(p))return!0;return!1}function l(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}function m(p){return p instanceof Error?p.stack||p.message:p}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 n.enable(n.load()),n}Ln.exports=ei});var Tn=F((V,cr)=>{V.formatArgs=ni;V.save=ti;V.load=ii;V.useColors=ri;V.storage=oi();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 ri(){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 ni(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+cr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let n=0,t=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(n++,i==="%c"&&(t=n))}),r.splice(t,0,e)}V.log=console.debug||console.log||(()=>{});function ti(r){try{r?V.storage.setItem("debug",r):V.storage.removeItem("debug")}catch{}}function ii(){let r;try{r=V.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function oi(){try{return localStorage}catch{}}cr.exports=Cr()(V);var{formatters:ci}=cr.exports;ci.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Nn=F((Tc,Bn)=>{"use strict";Bn.exports=(r,e)=>{e=e||process.argv;let n=r.startsWith("-")?"":r.length===1?"-":"--",t=e.indexOf(n+r),i=e.indexOf("--");return t!==-1&&(i===-1?!0:t<i)}});var Dn=F((Bc,Pn)=>{"use strict";var si=de("os"),Q=Nn(),R=process.env,Re;Q("no-color")||Q("no-colors")||Q("color=false")?Re=!1:(Q("color")||Q("colors")||Q("color=true")||Q("color=always"))&&(Re=!0);"FORCE_COLOR"in R&&(Re=R.FORCE_COLOR.length===0||parseInt(R.FORCE_COLOR,10)!==0);function ai(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function di(r){if(Re===!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&&Re!==!0)return 0;let e=Re?1:0;if(process.platform==="win32"){let n=si.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in R)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(n=>n in R)||R.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in R)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(R.TEAMCITY_VERSION)?1:0;if(R.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in R){let n=parseInt((R.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(R.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(R.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(R.TERM)||"COLORTERM"in R?1:(R.TERM==="dumb",e)}function vr(r){let e=di(r);return ai(e)}Pn.exports={supportsColor:vr,stdout:vr(process.stdout),stderr:vr(process.stderr)}});var Rn=F((P,ar)=>{var li=de("tty"),sr=de("util");P.init=wi;P.log=gi;P.formatArgs=hi;P.save=mi;P.load=yi;P.useColors=ui;P.destroy=sr.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");P.colors=[6,2,3,4,5,1];try{let r=Dn();r&&(r.stderr||r).level>=2&&(P.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{}P.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),t=process.env[e];return/^(yes|on|true|enabled)$/i.test(t)?t=!0:/^(no|off|false|disabled)$/i.test(t)?t=!1:t==="null"?t=null:t=Number(t),r[n]=t,r},{});function ui(){return"colors"in P.inspectOpts?!!P.inspectOpts.colors:li.isatty(process.stderr.fd)}function hi(r){let{namespace:e,useColors:n}=this;if(n){let t=this.color,i="\x1B[3"+(t<8?t:"8;5;"+t),o=` ${i};1m${e} \x1B[0m`;r[0]=o+r[0].split(`
|
|
3
3
|
`).join(`
|
|
4
4
|
`+o),r.push(i+"m+"+ar.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=pi()+e+" "+r[0]}function pi(){return P.inspectOpts.hideDate?"":new Date().toISOString()+" "}function gi(...r){return process.stderr.write(sr.format(...r)+`
|
|
5
5
|
`)}function mi(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function yi(){return process.env.DEBUG}function wi(r){r.inspectOpts={};let e=Object.keys(P.inspectOpts);for(let n=0;n<e.length;n++)r.inspectOpts[e[n]]=P.inspectOpts[e[n]]}ar.exports=Cr()(P);var{formatters:Fn}=ar.exports;Fn.o=function(r){return this.inspectOpts.colors=this.useColors,sr.inspect(r,this.inspectOpts).split(`
|
|
6
|
-
`).map(e=>e.trim()).join(" ")};Fn.O=function(r){return this.inspectOpts.colors=this.useColors,sr.inspect(r,this.inspectOpts)}});var _n=F((Nc,Ur)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ur.exports=Tn():Ur.exports=Rn()});var jn=F(Pr=>{"use strict";Pr.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};Pr.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 Kn=F(Dr=>{"use strict";Dr.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};Dr.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 Hn=F(Fr=>{"use strict";Fr.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};Fr.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 Yn=F(Rr=>{"use strict";Rr.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};Rr.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 Gn=F(_r=>{"use strict";_r.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}`};_r.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 Wn=F((Qn,Mr)=>{var Xn=function(r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=a,r.encode=p,r.familyOf=E,r.name=void 0,r.sizeOf=w,r.v6=r.v4=void 0;let e=/^(\d{1,3}\.){3,3}\d{1,3}$/,n=4,t=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i=16,o={name:"v4",size:n,isFormat:d=>e.test(d),encode(d,l,c){c=~~c,l=l||new Uint8Array(c+n);let g=d.length,I=0;for(let C=0;C<g;){let U=d.charCodeAt(C++);U===46?(l[c++]=I,I=0):I=I*10+(U-48)}return l[c]=I,l},decode(d,l){return l=~~l,`${d[l++]}.${d[l++]}.${d[l++]}.${d[l]}`}};r.v4=o;let s={name:"v6",size:i,isFormat:d=>d.length>0&&t.test(d),encode(d,l,c){c=~~c;let g=c+i,I=-1,C=0,U=0,B=!0,S=!1;l=l||new Uint8Array(c+i);for(let L=0;L<d.length;L++){let b=d.charCodeAt(L);b===58?(B?I!==-1?(c<g&&(l[c]=0),c<g-1&&(l[c+1]=0),c+=2):c<g&&(I=c):(S===!0?(c<g&&(l[c]=U),c++):(c<g&&(l[c]=C>>8),c<g-1&&(l[c+1]=C&255),c+=2),C=0,U=0),B=!0,S=!1):b===46?(c<g&&(l[c]=U),c++,U=0,C=0,B=!1,S=!0):(B=!1,b>=97?b-=87:b>=65?b-=55:(b-=48,U=U*10+b),C=(C<<4)+b)}if(B===!1)S===!0?(c<g&&(l[c]=U),c++):(c<g&&(l[c]=C>>8),c<g-1&&(l[c+1]=C&255),c+=2);else if(I===0)c<g&&(l[c]=0),c<g-1&&(l[c+1]=0),c+=2;else if(I!==-1){c+=2;for(let L=Math.min(c-1,g-1);L>=I+2;L--)l[L]=l[L-2];l[I]=0,l[I+1]=0,I=c}if(I!==c&&I!==-1)for(c>g-2&&(c=g-2);g>I;)l[--g]=c<g&&c>I?l[--c]:0;else for(;c<g;)l[c++]=0;return l},decode(d,l){l=~~l;let c="";for(let g=0;g<i;g+=2)g!==0&&(c+=":"),c+=(d[l+g]<<8|d[l+g+1]).toString(16);return c.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};r.v6=s;let u="ip";r.name=u;function w(d){if(o.isFormat(d))return o.size;if(s.isFormat(d))return s.size;throw Error(`Invalid ip address: ${d}`)}function E(d){return w(d)===o.size?1:2}function p(d,l,c){c=~~c;let g=w(d);return typeof l=="function"&&(l=l(c+g)),g===o.size?o.encode(d,l,c):s.encode(d,l,c)}function a(d,l,c){if(l=~~l,c=c||d.length-l,c===o.size)return o.decode(d,l,c);if(c===s.size)return s.decode(d,l,c);throw Error(`Invalid buffer size needs to be ${o.size} for v4 or ${s.size} for v6.`)}return"default"in r?r.default:r}({});typeof define=="function"&&define.amd?define([],function(){return Xn}):typeof Mr=="object"&&typeof Qn=="object"&&(Mr.exports=Xn)});var fn=F(m=>{"use strict";var y=de("buffer").Buffer,Ie=jn(),_i=Kn(),Mi=Hn(),ur=Yn(),kr=Gn(),Oe=Wn(),ki=0,Jn=32768,qr=32768,qi=~qr,Zn=32768,zi=~Zn,h=m.name={};h.encode=function(r,e,n){e||(e=y.alloc(h.encodingLength(r))),n||(n=0);let t=n,i=r.replace(/^\.|\.$/gm,"");if(i.length){let o=i.split(".");for(let s=0;s<o.length;s++){let u=e.write(o[s],n+1);e[n]=u,n+=u+1}}return e[n++]=0,h.encode.bytes=n-t,e};h.encode.bytes=0;h.decode=function(r,e){e||(e=0);let n=[],t=e,i=0,o=0,s=!1;for(;;){if(e>=r.length)throw new Error("Cannot decode name (buffer overflow)");let u=r[e++];if(o+=s?0:1,u===0)break;if(u&192)if((u&192)===192){if(e+1>r.length)throw new Error("Cannot decode name (buffer overflow)");let w=r.readUInt16BE(e-1)-49152;if(w>=t)throw new Error("Cannot decode name (bad pointer)");e=w,t=w,o+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+u>r.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=u+1,i>254)throw new Error("Cannot decode name (name too long)");n.push(r.toString("utf-8",e,e+u)),e+=u,o+=s?0:u}}return h.decode.bytes=o,n.length===0?".":n.join(".")};h.decode.bytes=0;h.encodingLength=function(r){return r==="."||r===".."?1:y.byteLength(r.replace(/^\.|\.$/gm,""))+2};var x={};x.encode=function(r,e,n){e||(e=y.alloc(x.encodingLength(r))),n||(n=0);let t=e.write(r,n+1);return e[n]=t,x.encode.bytes=t+1,e};x.encode.bytes=0;x.decode=function(r,e){e||(e=0);let n=r[e],t=r.toString("utf-8",e+1,e+1+n);return x.decode.bytes=n+1,t};x.decode.bytes=0;x.encodingLength=function(r){return y.byteLength(r)+1};var f={};f.encode=function(r,e,n){e||(e=f.encodingLength(r)),n||(n=0);let t=(r.flags||0)&32767,i=r.type==="response"?Jn:ki;return e.writeUInt16BE(r.id||0,n),e.writeUInt16BE(t|i,n+2),e.writeUInt16BE(r.questions.length,n+4),e.writeUInt16BE(r.answers.length,n+6),e.writeUInt16BE(r.authorities.length,n+8),e.writeUInt16BE(r.additionals.length,n+10),e};f.encode.bytes=12;f.decode=function(r,e){if(e||(e=0),r.length<12)throw new Error("Header must be 12 bytes");let n=r.readUInt16BE(e+2);return{id:r.readUInt16BE(e),type:n&Jn?"response":"query",flags:n&32767,flag_qr:(n>>15&1)===1,opcode:Mi.toString(n>>11&15),flag_aa:(n>>10&1)===1,flag_tc:(n>>9&1)===1,flag_rd:(n>>8&1)===1,flag_ra:(n>>7&1)===1,flag_z:(n>>6&1)===1,flag_ad:(n>>5&1)===1,flag_cd:(n>>4&1)===1,rcode:_i.toString(n&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))}};f.decode.bytes=12;f.encodingLength=function(){return 12};var le=m.unknown={};le.encode=function(r,e,n){return e||(e=y.alloc(le.encodingLength(r))),n||(n=0),e.writeUInt16BE(r.length,n),r.copy(e,n+2),le.encode.bytes=r.length+2,e};le.encode.bytes=0;le.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e),t=r.slice(e+2,e+2+n);return le.decode.bytes=n+2,t};le.decode.bytes=0;le.encodingLength=function(r){return r.length+2};var ue=m.ns={};ue.encode=function(r,e,n){return e||(e=y.alloc(ue.encodingLength(r))),n||(n=0),h.encode(r,e,n+2),e.writeUInt16BE(h.encode.bytes,n),ue.encode.bytes=h.encode.bytes+2,e};ue.encode.bytes=0;ue.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e),t=h.decode(r,e+2);return ue.decode.bytes=n+2,t};ue.decode.bytes=0;ue.encodingLength=function(r){return h.encodingLength(r)+2};var he=m.soa={};he.encode=function(r,e,n){e||(e=y.alloc(he.encodingLength(r))),n||(n=0);let t=n;return n+=2,h.encode(r.mname,e,n),n+=h.encode.bytes,h.encode(r.rname,e,n),n+=h.encode.bytes,e.writeUInt32BE(r.serial||0,n),n+=4,e.writeUInt32BE(r.refresh||0,n),n+=4,e.writeUInt32BE(r.retry||0,n),n+=4,e.writeUInt32BE(r.expire||0,n),n+=4,e.writeUInt32BE(r.minimum||0,n),n+=4,e.writeUInt16BE(n-t-2,t),he.encode.bytes=n-t,e};he.encode.bytes=0;he.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.mname=h.decode(r,e),e+=h.decode.bytes,t.rname=h.decode(r,e),e+=h.decode.bytes,t.serial=r.readUInt32BE(e),e+=4,t.refresh=r.readUInt32BE(e),e+=4,t.retry=r.readUInt32BE(e),e+=4,t.expire=r.readUInt32BE(e),e+=4,t.minimum=r.readUInt32BE(e),e+=4,he.decode.bytes=e-n,t};he.decode.bytes=0;he.encodingLength=function(r){return 22+h.encodingLength(r.mname)+h.encodingLength(r.rname)};var pe=m.txt={};pe.encode=function(r,e,n){Array.isArray(r)||(r=[r]);for(let i=0;i<r.length;i++)if(typeof r[i]=="string"&&(r[i]=y.from(r[i])),!y.isBuffer(r[i]))throw new Error("Must be a Buffer");e||(e=y.alloc(pe.encodingLength(r))),n||(n=0);let t=n;return n+=2,r.forEach(function(i){e[n++]=i.length,i.copy(e,n,0,i.length),n+=i.length}),e.writeUInt16BE(n-t-2,t),pe.encode.bytes=n-t,e};pe.encode.bytes=0;pe.decode=function(r,e){e||(e=0);let n=e,t=r.readUInt16BE(e);e+=2;let i=[];for(;t>0;){let o=r[e++];if(--t,t<o)throw new Error("Buffer overflow");i.push(r.slice(e,e+o)),e+=o,t-=o}return pe.decode.bytes=e-n,i};pe.decode.bytes=0;pe.encodingLength=function(r){Array.isArray(r)||(r=[r]);let e=2;return r.forEach(function(n){typeof n=="string"?e+=y.byteLength(n)+1:e+=n.length+1}),e};var ge=m.null={};ge.encode=function(r,e,n){e||(e=y.alloc(ge.encodingLength(r))),n||(n=0),typeof r=="string"&&(r=y.from(r)),r||(r=y.alloc(0));let t=n;n+=2;let i=r.length;return r.copy(e,n,0,i),n+=i,e.writeUInt16BE(n-t-2,t),ge.encode.bytes=n-t,e};ge.encode.bytes=0;ge.decode=function(r,e){e||(e=0);let n=e,t=r.readUInt16BE(e);e+=2;let i=r.slice(e,e+t);return e+=t,ge.decode.bytes=e-n,i};ge.decode.bytes=0;ge.encodingLength=function(r){return r?(y.isBuffer(r)?r.length:y.byteLength(r))+2:2};var me=m.hinfo={};me.encode=function(r,e,n){e||(e=y.alloc(me.encodingLength(r))),n||(n=0);let t=n;return n+=2,x.encode(r.cpu,e,n),n+=x.encode.bytes,x.encode(r.os,e,n),n+=x.encode.bytes,e.writeUInt16BE(n-t-2,t),me.encode.bytes=n-t,e};me.encode.bytes=0;me.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.cpu=x.decode(r,e),e+=x.decode.bytes,t.os=x.decode(r,e),e+=x.decode.bytes,me.decode.bytes=e-n,t};me.decode.bytes=0;me.encodingLength=function(r){return x.encodingLength(r.cpu)+x.encodingLength(r.os)+2};var J=m.ptr={},$i=m.cname=J,Vi=m.dname=J;J.encode=function(r,e,n){return e||(e=y.alloc(J.encodingLength(r))),n||(n=0),h.encode(r,e,n+2),e.writeUInt16BE(h.encode.bytes,n),J.encode.bytes=h.encode.bytes+2,e};J.encode.bytes=0;J.decode=function(r,e){e||(e=0);let n=h.decode(r,e+2);return J.decode.bytes=h.decode.bytes+2,n};J.decode.bytes=0;J.encodingLength=function(r){return h.encodingLength(r)+2};var ye=m.srv={};ye.encode=function(r,e,n){e||(e=y.alloc(ye.encodingLength(r))),n||(n=0),e.writeUInt16BE(r.priority||0,n+2),e.writeUInt16BE(r.weight||0,n+4),e.writeUInt16BE(r.port||0,n+6),h.encode(r.target,e,n+8);let t=h.encode.bytes+6;return e.writeUInt16BE(t,n),ye.encode.bytes=t+2,e};ye.encode.bytes=0;ye.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e),t={};return t.priority=r.readUInt16BE(e+2),t.weight=r.readUInt16BE(e+4),t.port=r.readUInt16BE(e+6),t.target=h.decode(r,e+8),ye.decode.bytes=n+2,t};ye.decode.bytes=0;ye.encodingLength=function(r){return 8+h.encodingLength(r.target)};var K=m.caa={};K.ISSUER_CRITICAL=128;K.encode=function(r,e,n){let t=K.encodingLength(r);return e||(e=y.alloc(K.encodingLength(r))),n||(n=0),r.issuerCritical&&(r.flags=K.ISSUER_CRITICAL),e.writeUInt16BE(t-2,n),n+=2,e.writeUInt8(r.flags||0,n),n+=1,x.encode(r.tag,e,n),n+=x.encode.bytes,e.write(r.value,n),n+=y.byteLength(r.value),K.encode.bytes=t,e};K.encode.bytes=0;K.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e);e+=2;let t=e,i={};return i.flags=r.readUInt8(e),e+=1,i.tag=x.decode(r,e),e+=x.decode.bytes,i.value=r.toString("utf-8",e,t+n),i.issuerCritical=!!(i.flags&K.ISSUER_CRITICAL),K.decode.bytes=n+2,i};K.decode.bytes=0;K.encodingLength=function(r){return x.encodingLength(r.tag)+x.encodingLength(r.value)+2};var ve=m.mx={};ve.encode=function(r,e,n){e||(e=y.alloc(ve.encodingLength(r))),n||(n=0);let t=n;return n+=2,e.writeUInt16BE(r.preference||0,n),n+=2,h.encode(r.exchange,e,n),n+=h.encode.bytes,e.writeUInt16BE(n-t-2,t),ve.encode.bytes=n-t,e};ve.encode.bytes=0;ve.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.preference=r.readUInt16BE(e),e+=2,t.exchange=h.decode(r,e),e+=h.decode.bytes,ve.decode.bytes=e-n,t};ve.encodingLength=function(r){return 4+h.encodingLength(r.exchange)};var we=m.a={};we.encode=function(r,e,n){return e||(e=y.alloc(we.encodingLength(r))),n||(n=0),e.writeUInt16BE(4,n),n+=2,Oe.v4.encode(r,e,n),we.encode.bytes=6,e};we.encode.bytes=0;we.decode=function(r,e){e||(e=0),e+=2;let n=Oe.v4.decode(r,e);return we.decode.bytes=6,n};we.decode.bytes=0;we.encodingLength=function(){return 6};var Ee=m.aaaa={};Ee.encode=function(r,e,n){return e||(e=y.alloc(Ee.encodingLength(r))),n||(n=0),e.writeUInt16BE(16,n),n+=2,Oe.v6.encode(r,e,n),Ee.encode.bytes=18,e};Ee.encode.bytes=0;Ee.decode=function(r,e){e||(e=0),e+=2;let n=Oe.v6.decode(r,e);return Ee.decode.bytes=18,n};Ee.decode.bytes=0;Ee.encodingLength=function(){return 18};var k=m.option={};k.encode=function(r,e,n){e||(e=y.alloc(k.encodingLength(r))),n||(n=0);let t=n,i=kr.toCode(r.code);if(e.writeUInt16BE(i,n),n+=2,r.data)e.writeUInt16BE(r.data.length,n),n+=2,r.data.copy(e,n),n+=r.data.length;else switch(i){case 8:let o=r.sourcePrefixLength||0,s=r.family||Oe.familyOf(r.ip),u=Oe.encode(r.ip,y.alloc),w=Math.ceil(o/8);e.writeUInt16BE(w+4,n),n+=2,e.writeUInt16BE(s,n),n+=2,e.writeUInt8(o,n++),e.writeUInt8(r.scopePrefixLength||0,n++),u.copy(e,n,0,w),n+=w;break;case 11:r.timeout?(e.writeUInt16BE(2,n),n+=2,e.writeUInt16BE(r.timeout,n),n+=2):(e.writeUInt16BE(0,n),n+=2);break;case 12:let E=r.length||0;e.writeUInt16BE(E,n),n+=2,e.fill(0,n,n+E),n+=E;break;case 14:let p=r.tags.length*2;e.writeUInt16BE(p,n),n+=2;for(let a of r.tags)e.writeUInt16BE(a,n),n+=2;break;default:throw new Error(`Unknown roption code: ${r.code}`)}return k.encode.bytes=n-t,e};k.encode.bytes=0;k.decode=function(r,e){e||(e=0);let n={};n.code=r.readUInt16BE(e),n.type=kr.toString(n.code),e+=2;let t=r.readUInt16BE(e);switch(e+=2,n.data=r.slice(e,e+t),n.code){case 8:n.family=r.readUInt16BE(e),e+=2,n.sourcePrefixLength=r.readUInt8(e++),n.scopePrefixLength=r.readUInt8(e++);let i=y.alloc(n.family===1?4:16);r.copy(i,0,e,e+t-4),n.ip=Oe.decode(i);break;case 11:t>0&&(n.timeout=r.readUInt16BE(e),e+=2);break;case 14:n.tags=[];for(let o=0;o<t;o+=2)n.tags.push(r.readUInt16BE(e)),e+=2}return k.decode.bytes=t+4,n};k.decode.bytes=0;k.encodingLength=function(r){if(r.data)return r.data.length+4;switch(kr.toCode(r.code)){case 8:let n=r.sourcePrefixLength||0;return Math.ceil(n/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 Y=m.opt={};Y.encode=function(r,e,n){e||(e=y.alloc(Y.encodingLength(r))),n||(n=0);let t=n,i=Me(r,k);return e.writeUInt16BE(i,n),n=He(r,k,e,n+2),Y.encode.bytes=n-t,e};Y.encode.bytes=0;Y.decode=function(r,e){e||(e=0);let n=e,t=[],i=r.readUInt16BE(e);e+=2;let o=0;for(;i>0;)t[o++]=k.decode(r,e),e+=k.decode.bytes,i-=k.decode.bytes;return Y.decode.bytes=e-n,t};Y.decode.bytes=0;Y.encodingLength=function(r){return 2+Me(r||[],k)};var M=m.dnskey={};M.PROTOCOL_DNSSEC=3;M.ZONE_KEY=128;M.SECURE_ENTRYPOINT=32768;M.encode=function(r,e,n){e||(e=y.alloc(M.encodingLength(r))),n||(n=0);let t=n,i=r.key;if(!y.isBuffer(i))throw new Error("Key must be a Buffer");return n+=2,e.writeUInt16BE(r.flags,n),n+=2,e.writeUInt8(M.PROTOCOL_DNSSEC,n),n+=1,e.writeUInt8(r.algorithm,n),n+=1,i.copy(e,n,0,i.length),n+=i.length,M.encode.bytes=n-t,e.writeUInt16BE(M.encode.bytes-2,t),e};M.encode.bytes=0;M.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);if(e+=2,t.flags=r.readUInt16BE(e),e+=2,r.readUInt8(e)!==M.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,t.algorithm=r.readUInt8(e),e+=1,t.key=r.slice(e,n+i+2),e+=t.key.length,M.decode.bytes=e-n,t};M.decode.bytes=0;M.encodingLength=function(r){return 6+y.byteLength(r.key)};var re=m.rrsig={};re.encode=function(r,e,n){e||(e=y.alloc(re.encodingLength(r))),n||(n=0);let t=n,i=r.signature;if(!y.isBuffer(i))throw new Error("Signature must be a Buffer");return n+=2,e.writeUInt16BE(Ie.toType(r.typeCovered),n),n+=2,e.writeUInt8(r.algorithm,n),n+=1,e.writeUInt8(r.labels,n),n+=1,e.writeUInt32BE(r.originalTTL,n),n+=4,e.writeUInt32BE(r.expiration,n),n+=4,e.writeUInt32BE(r.inception,n),n+=4,e.writeUInt16BE(r.keyTag,n),n+=2,h.encode(r.signersName,e,n),n+=h.encode.bytes,i.copy(e,n,0,i.length),n+=i.length,re.encode.bytes=n-t,e.writeUInt16BE(re.encode.bytes-2,t),e};re.encode.bytes=0;re.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);return e+=2,t.typeCovered=Ie.toString(r.readUInt16BE(e)),e+=2,t.algorithm=r.readUInt8(e),e+=1,t.labels=r.readUInt8(e),e+=1,t.originalTTL=r.readUInt32BE(e),e+=4,t.expiration=r.readUInt32BE(e),e+=4,t.inception=r.readUInt32BE(e),e+=4,t.keyTag=r.readUInt16BE(e),e+=2,t.signersName=h.decode(r,e),e+=h.decode.bytes,t.signature=r.slice(e,n+i+2),e+=t.signature.length,re.decode.bytes=e-n,t};re.decode.bytes=0;re.encodingLength=function(r){return 20+h.encodingLength(r.signersName)+y.byteLength(r.signature)};var ne=m.rp={};ne.encode=function(r,e,n){e||(e=y.alloc(ne.encodingLength(r))),n||(n=0);let t=n;return n+=2,h.encode(r.mbox||".",e,n),n+=h.encode.bytes,h.encode(r.txt||".",e,n),n+=h.encode.bytes,ne.encode.bytes=n-t,e.writeUInt16BE(ne.encode.bytes-2,t),e};ne.encode.bytes=0;ne.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.mbox=h.decode(r,e)||".",e+=h.decode.bytes,t.txt=h.decode(r,e)||".",e+=h.decode.bytes,ne.decode.bytes=e-n,t};ne.decode.bytes=0;ne.encodingLength=function(r){return 2+h.encodingLength(r.mbox||".")+h.encodingLength(r.txt||".")};var N={};N.encode=function(r,e,n){e||(e=y.alloc(N.encodingLength(r))),n||(n=0);let t=n;for(var i=[],o=0;o<r.length;o++){var s=Ie.toType(r[o]);i[s>>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(o=0;o<i.length;o++)if(i[o]!==void 0){var u=y.from(i[o]);e.writeUInt8(o,n),n+=1,e.writeUInt8(u.length,n),n+=1,u.copy(e,n),n+=u.length}return N.encode.bytes=n-t,e};N.encode.bytes=0;N.decode=function(r,e,n){e||(e=0);let t=e;for(var i=[];e-t<n;){var o=r.readUInt8(e);e+=1;var s=r.readUInt8(e);e+=1;for(var u=0;u<s;u++)for(var w=r.readUInt8(e+u),E=0;E<8;E++)if(w&1<<7-E){var p=Ie.toString(o<<8|u<<3|E);i.push(p)}e+=s}return N.decode.bytes=e-t,i};N.decode.bytes=0;N.encodingLength=function(r){for(var e=[],n=0;n<r.length;n++){var t=Ie.toType(r[n]);e[t>>8]=Math.max(e[t>>8]||0,t&255)}var i=0;for(n=0;n<e.length;n++)e[n]!==void 0&&(i+=2+Math.ceil((e[n]+1)/8));return i};var te=m.nsec={};te.encode=function(r,e,n){e||(e=y.alloc(te.encodingLength(r))),n||(n=0);let t=n;return n+=2,h.encode(r.nextDomain,e,n),n+=h.encode.bytes,N.encode(r.rrtypes,e,n),n+=N.encode.bytes,te.encode.bytes=n-t,e.writeUInt16BE(te.encode.bytes-2,t),e};te.encode.bytes=0;te.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);return e+=2,t.nextDomain=h.decode(r,e),e+=h.decode.bytes,t.rrtypes=N.decode(r,e,i-(e-n)),e+=N.decode.bytes,te.decode.bytes=e-n,t};te.decode.bytes=0;te.encodingLength=function(r){return 2+h.encodingLength(r.nextDomain)+N.encodingLength(r.rrtypes)};var ie=m.nsec3={};ie.encode=function(r,e,n){e||(e=y.alloc(ie.encodingLength(r))),n||(n=0);let t=n,i=r.salt;if(!y.isBuffer(i))throw new Error("salt must be a Buffer");let o=r.nextDomain;if(!y.isBuffer(o))throw new Error("nextDomain must be a Buffer");return n+=2,e.writeUInt8(r.algorithm,n),n+=1,e.writeUInt8(r.flags,n),n+=1,e.writeUInt16BE(r.iterations,n),n+=2,e.writeUInt8(i.length,n),n+=1,i.copy(e,n,0,i.length),n+=i.length,e.writeUInt8(o.length,n),n+=1,o.copy(e,n,0,o.length),n+=o.length,N.encode(r.rrtypes,e,n),n+=N.encode.bytes,ie.encode.bytes=n-t,e.writeUInt16BE(ie.encode.bytes-2,t),e};ie.encode.bytes=0;ie.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);e+=2,t.algorithm=r.readUInt8(e),e+=1,t.flags=r.readUInt8(e),e+=1,t.iterations=r.readUInt16BE(e),e+=2;let o=r.readUInt8(e);e+=1,t.salt=r.slice(e,e+o),e+=o;let s=r.readUInt8(e);return e+=1,t.nextDomain=r.slice(e,e+s),e+=s,t.rrtypes=N.decode(r,e,i-(e-n)),e+=N.decode.bytes,ie.decode.bytes=e-n,t};ie.decode.bytes=0;ie.encodingLength=function(r){return 8+r.salt.length+r.nextDomain.length+N.encodingLength(r.rrtypes)};var oe=m.ds={};oe.encode=function(r,e,n){e||(e=y.alloc(oe.encodingLength(r))),n||(n=0);let t=n,i=r.digest;if(!y.isBuffer(i))throw new Error("Digest must be a Buffer");return n+=2,e.writeUInt16BE(r.keyTag,n),n+=2,e.writeUInt8(r.algorithm,n),n+=1,e.writeUInt8(r.digestType,n),n+=1,i.copy(e,n,0,i.length),n+=i.length,oe.encode.bytes=n-t,e.writeUInt16BE(oe.encode.bytes-2,t),e};oe.encode.bytes=0;oe.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);return e+=2,t.keyTag=r.readUInt16BE(e),e+=2,t.algorithm=r.readUInt8(e),e+=1,t.digestType=r.readUInt8(e),e+=1,t.digest=r.slice(e,n+i+2),e+=t.digest.length,oe.decode.bytes=e-n,t};oe.decode.bytes=0;oe.encodingLength=function(r){return 6+y.byteLength(r.digest)};var H=m.sshfp={};H.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};H.encode=function(e,n,t){n||(n=y.alloc(H.encodingLength(e))),t||(t=0);let i=t;t+=2,n[t]=e.algorithm,t+=1,n[t]=e.hash,t+=1;let o=y.from(e.fingerprint.toUpperCase(),"hex");if(o.length!==H.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return o.copy(n,t),t+=o.byteLength,H.encode.bytes=t-i,n.writeUInt16BE(H.encode.bytes-2,i),n};H.encode.bytes=0;H.decode=function(e,n){n||(n=0);let t=n,i={};n+=2,i.algorithm=e[n],n+=1,i.hash=e[n],n+=1;let o=H.getFingerprintLengthForHashType(i.hash);return i.fingerprint=e.slice(n,n+o).toString("hex").toUpperCase(),n+=o,H.decode.bytes=n-t,i};H.decode.bytes=0;H.encodingLength=function(r){return 4+y.from(r.fingerprint,"hex").byteLength};var ce=m.naptr={};ce.encode=function(r,e,n){e||(e=y.alloc(ce.encodingLength(r))),n||(n=0);let t=n;return n+=2,e.writeUInt16BE(r.order||0,n),n+=2,e.writeUInt16BE(r.preference||0,n),n+=2,x.encode(r.flags,e,n),n+=x.encode.bytes,x.encode(r.services,e,n),n+=x.encode.bytes,x.encode(r.regexp,e,n),n+=x.encode.bytes,h.encode(r.replacement,e,n),n+=h.encode.bytes,ce.encode.bytes=n-t,e.writeUInt16BE(ce.encode.bytes-2,t),e};ce.encode.bytes=0;ce.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.order=r.readUInt16BE(e),e+=2,t.preference=r.readUInt16BE(e),e+=2,t.flags=x.decode(r,e),e+=x.decode.bytes,t.services=x.decode(r,e),e+=x.decode.bytes,t.regexp=x.decode(r,e),e+=x.decode.bytes,t.replacement=h.decode(r,e),e+=h.decode.bytes,ce.decode.bytes=e-n,t};ce.decode.bytes=0;ce.encodingLength=function(r){return x.encodingLength(r.flags)+x.encodingLength(r.services)+x.encodingLength(r.regexp)+h.encodingLength(r.replacement)+6};var se=m.tlsa={};se.encode=function(r,e,n){e||(e=y.alloc(se.encodingLength(r))),n||(n=0);let t=n,i=r.certificate;if(!y.isBuffer(i))throw new Error("Certificate must be a Buffer");return n+=2,e.writeUInt8(r.usage,n),n+=1,e.writeUInt8(r.selector,n),n+=1,e.writeUInt8(r.matchingType,n),n+=1,i.copy(e,n,0,i.length),n+=i.length,se.encode.bytes=n-t,e.writeUInt16BE(se.encode.bytes-2,t),e};se.encode.bytes=0;se.decode=function(r,e){e||(e=0);let n=e,t={},i=r.readUInt16BE(e);return e+=2,t.usage=r.readUInt8(e),e+=1,t.selector=r.readUInt8(e),e+=1,t.matchingType=r.readUInt8(e),e+=1,t.certificate=r.slice(e,n+i+2),e+=t.certificate.length,se.decode.bytes=e-n,t};se.decode.bytes=0;se.encodingLength=function(r){return 5+y.byteLength(r.certificate)};var zr=m.record=function(r){switch(r.toUpperCase()){case"A":return we;case"PTR":return J;case"CNAME":return $i;case"DNAME":return Vi;case"TXT":return pe;case"NULL":return ge;case"AAAA":return Ee;case"SRV":return ye;case"HINFO":return me;case"CAA":return K;case"NS":return ue;case"SOA":return he;case"MX":return ve;case"OPT":return Y;case"DNSKEY":return M;case"RRSIG":return re;case"RP":return ne;case"NSEC":return te;case"NSEC3":return ie;case"SSHFP":return H;case"DS":return oe;case"NAPTR":return ce;case"TLSA":return se}return le},D=m.answer={};D.encode=function(r,e,n){e||(e=y.alloc(D.encodingLength(r))),n||(n=0);let t=n;if(h.encode(r.name,e,n),n+=h.encode.bytes,e.writeUInt16BE(Ie.toType(r.type),n),r.type.toUpperCase()==="OPT"){if(r.name!==".")throw new Error("OPT name must be root.");e.writeUInt16BE(r.udpPayloadSize||4096,n+2),e.writeUInt8(r.extendedRcode||0,n+4),e.writeUInt8(r.ednsVersion||0,n+5),e.writeUInt16BE(r.flags||0,n+6),n+=8,Y.encode(r.options||[],e,n),n+=Y.encode.bytes}else{let i=ur.toClass(r.class===void 0?"IN":r.class);r.flush&&(i|=qr),e.writeUInt16BE(i,n+2),e.writeUInt32BE(r.ttl||0,n+4),n+=8;let o=zr(r.type);o.encode(r.data,e,n),n+=o.encode.bytes}return D.encode.bytes=n-t,e};D.encode.bytes=0;D.decode=function(r,e){e||(e=0);let n={},t=e;if(n.name=h.decode(r,e),e+=h.decode.bytes,n.type=Ie.toString(r.readUInt16BE(e)),n.type==="OPT")n.udpPayloadSize=r.readUInt16BE(e+2),n.extendedRcode=r.readUInt8(e+4),n.ednsVersion=r.readUInt8(e+5),n.flags=r.readUInt16BE(e+6),n.flag_do=(n.flags>>15&1)===1,n.options=Y.decode(r,e+8),e+=8+Y.decode.bytes;else{let i=r.readUInt16BE(e+2);n.ttl=r.readUInt32BE(e+4),n.class=ur.toString(i&qi),n.flush=!!(i&qr);let o=zr(n.type);n.data=o.decode(r,e+8),e+=8+o.decode.bytes}return D.decode.bytes=e-t,n};D.decode.bytes=0;D.encodingLength=function(r){let e=r.data!==null&&r.data!==void 0?r.data:r.options;return h.encodingLength(r.name)+8+zr(r.type).encodingLength(e)};var Z=m.question={};Z.encode=function(r,e,n){e||(e=y.alloc(Z.encodingLength(r))),n||(n=0);let t=n;return h.encode(r.name,e,n),n+=h.encode.bytes,e.writeUInt16BE(Ie.toType(r.type),n),n+=2,e.writeUInt16BE(ur.toClass(r.class===void 0?"IN":r.class),n),n+=2,Z.encode.bytes=n-t,r};Z.encode.bytes=0;Z.decode=function(r,e){e||(e=0);let n=e,t={};return t.name=h.decode(r,e),e+=h.decode.bytes,t.type=Ie.toString(r.readUInt16BE(e)),e+=2,t.class=ur.toString(r.readUInt16BE(e)),e+=2,!!(t.class&Zn)&&(t.class&=zi),Z.decode.bytes=e-n,t};Z.decode.bytes=0;Z.encodingLength=function(r){return h.encodingLength(r.name)+4};m.AUTHORITATIVE_ANSWER=1024;m.TRUNCATED_RESPONSE=512;m.RECURSION_DESIRED=256;m.RECURSION_AVAILABLE=128;m.AUTHENTIC_DATA=32;m.CHECKING_DISABLED=16;m.DNSSEC_OK=32768;m.encode=function(r,e,n){let t=!e;t&&(e=y.alloc(m.encodingLength(r))),n||(n=0);let i=n;return r.questions||(r.questions=[]),r.answers||(r.answers=[]),r.authorities||(r.authorities=[]),r.additionals||(r.additionals=[]),f.encode(r,e,n),n+=f.encode.bytes,n=He(r.questions,Z,e,n),n=He(r.answers,D,e,n),n=He(r.authorities,D,e,n),n=He(r.additionals,D,e,n),m.encode.bytes=n-i,t&&m.encode.bytes!==e.length?e.slice(0,m.encode.bytes):e};m.encode.bytes=0;m.decode=function(r,e){e||(e=0);let n=e,t=f.decode(r,e);return e+=f.decode.bytes,e=lr(t.questions,Z,r,e),e=lr(t.answers,D,r,e),e=lr(t.authorities,D,r,e),e=lr(t.additionals,D,r,e),m.decode.bytes=e-n,t};m.decode.bytes=0;m.encodingLength=function(r){return f.encodingLength(r)+Me(r.questions||[],Z)+Me(r.answers||[],D)+Me(r.authorities||[],D)+Me(r.additionals||[],D)};m.streamEncode=function(r){let e=m.encode(r),n=y.alloc(2);n.writeUInt16BE(e.byteLength);let t=y.concat([n,e]);return m.streamEncode.bytes=t.byteLength,t};m.streamEncode.bytes=0;m.streamDecode=function(r){let e=r.readUInt16BE(0);if(r.byteLength<e+2)return null;let n=m.decode(r.slice(2));return m.streamDecode.bytes=m.decode.bytes,n};m.streamDecode.bytes=0;function Me(r,e){let n=0;for(let t=0;t<r.length;t++)n+=e.encodingLength(r[t]);return n}function He(r,e,n,t){for(let i=0;i<r.length;i++)e.encode(r[i],n,t),t+=e.encode.bytes;return t}function lr(r,e,n,t){for(let i=0;i<r.length;i++)r[i]=e.decode(n,t),t+=e.decode.bytes;return t}});var nt=F((Wc,rt)=>{"use strict";var et=Xi;process.nextTick(Gi,42);rt.exports=ji;function ji(r){var e=t;return n;function n(i){e(i||Hi)}function t(i){var o=[i];e=s,r(u);function s(w){o.push(w)}function u(w){var E=arguments;for(e=Ki(w)?t:p;o.length;)p(o.shift());function p(a){et(Yi,a,E)}}}}function Ki(r){return Object.prototype.toString.call(r)==="[object Error]"}function Hi(){}function Yi(r,e){r.apply(null,e)}function Gi(r){r===42&&(et=process.nextTick)}function Xi(r,e,n){process.nextTick(function(){r(e,n)})}});var ot=F((Jc,it)=>{var $r=fn(),Qi=de("dgram"),Wi=nt(),Ji=de("events"),jr=de("os"),Vr=function(){};it.exports=function(r){r||(r={});var e=new Ji.EventEmitter,n=typeof r.port=="number"?r.port:5353,t=r.type||"udp4",i=r.ip||r.host||(t==="udp4"?"224.0.0.251":null),o={address:i,port:n},s={},u=!1,w=null;if(t==="udp6"&&(!i||!r.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var E=r.socket||Qi.createSocket({type:t,reuseAddr:r.reuseAddr!==!1,toString:function(){return t}});E.on("error",function(a){a.code==="EACCES"||a.code==="EADDRINUSE"?e.emit("error",a):e.emit("warning",a)}),E.on("message",function(a,d){try{a=$r.decode(a)}catch(l){e.emit("warning",l);return}e.emit("packet",a,d),a.type==="query"&&e.emit("query",a,d),a.type==="response"&&e.emit("response",a,d)}),E.on("listening",function(){n||(n=o.port=E.address().port),r.multicast!==!1&&(e.update(),w=setInterval(e.update,5e3),E.setMulticastTTL(r.ttl||255),E.setMulticastLoopback(r.loopback!==!1))});var p=Wi(function(a){if(!n||r.bind===!1)return a(null);E.once("error",a),E.bind(n,r.bind||r.interface,function(){E.removeListener("error",a),a(null)})});return p(function(a){if(a)return e.emit("error",a);e.emit("ready")}),e.send=function(a,d,l){if(typeof d=="function")return e.send(a,null,d);l||(l=Vr),d?!d.host&&!d.address&&(d.address=o.address):d=o,p(c);function c(g){if(u)return l();if(g)return l(g);var I=$r.encode(a);E.send(I,0,I.length,d.port,d.address||d.host,l)}},e.response=e.respond=function(a,d,l){Array.isArray(a)&&(a={answers:a}),a.type="response",a.flags=(a.flags||0)|$r.AUTHORITATIVE_ANSWER,e.send(a,d,l)},e.query=function(a,d,l,c){if(typeof d=="function")return e.query(a,null,null,d);if(typeof d=="object"&&d&&d.port)return e.query(a,null,d,l);if(typeof l=="function")return e.query(a,d,null,l);c||(c=Vr),typeof a=="string"&&(a=[{name:a,type:d||"ANY"}]),Array.isArray(a)&&(a={type:"query",questions:a}),a.type="query",e.send(a,l,c)},e.destroy=function(a){if(a||(a=Vr),u)return process.nextTick(a);u=!0,clearInterval(w);for(var d in s)try{E.dropMembership(i,d)}catch{}s={},E.close(a)},e.update=function(){for(var a=r.interface?[].concat(r.interface):fi(),d=!1,l=0;l<a.length;l++){var c=a[l];if(!s[c])try{E.addMembership(i,c),s[c]=!0,d=!0}catch(g){e.emit("warning",g)}}if(d){if(E.setMulticastInterface)try{E.setMulticastInterface(r.interface||Zi())}catch(g){e.emit("warning",g)}e.emit("networkInterface")}},e};function Zi(){for(var r=jr.networkInterfaces(),e=Object.keys(r),n=0;n<e.length;n++)for(var t=r[e[n]],i=0;i<t.length;i++){var o=t[i];if(tt(o.family)&&!o.internal)return jr.platform()==="darwin"&&e[n]==="en0"?o.address:"0.0.0.0"}return"127.0.0.1"}function fi(){for(var r=jr.networkInterfaces(),e=Object.keys(r),n=[],t=0;t<e.length;t++)for(var i=r[e[t]],o=0;o<i.length;o++){var s=i[o];if(tt(s.family)){n.push(s.address);break}}return n}function tt(r){return r===4||r==="IPv4"}});var Uc={};$(Uc,{mdns:()=>vc});var tr=class extends EventTarget{#e=new Map;listenerCount(e){let n=this.#e.get(e);return n==null?0:n.length}addEventListener(e,n,t){super.addEventListener(e,n,t);let i=this.#e.get(e);i==null&&(i=[],this.#e.set(e,i)),i.push({callback:n,once:(t!==!0&&t!==!1&&t?.once)??!1})}removeEventListener(e,n,t){super.removeEventListener(e.toString(),n??null,t);let i=this.#e.get(e);i!=null&&(i=i.filter(({callback:o})=>o!==n),this.#e.set(e,i))}dispatchEvent(e){let n=super.dispatchEvent(e),t=this.#e.get(e.type);return t==null||(t=t.filter(({once:i})=>!i),this.#e.set(e.type,t)),n}safeDispatchEvent(e,n){return this.dispatchEvent(new ir(e,n))}},xr=class extends Event{detail;constructor(e,n){super(e,n),this.detail=n?.detail}},ir=globalThis.CustomEvent??xr;var Sn=Symbol.for("@libp2p/peer-discovery");var j=Ir(_n(),1);var Lr={};$(Lr,{base32:()=>W,base32hex:()=>bi,base32hexpad:()=>Li,base32hexpadupper:()=>Ti,base32hexupper:()=>Oi,base32pad:()=>Ai,base32padupper:()=>Si,base32upper:()=>Ui,base32z:()=>Bi});function Ei(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),t=0;t<n.length;t++)n[t]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),s=o.charCodeAt(0);if(n[s]!==255)throw new TypeError(o+" is ambiguous");n[s]=i}var u=r.length,w=r.charAt(0),E=Math.log(u)/Math.log(256),p=Math.log(256)/Math.log(u);function a(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 g=0,I=0,C=0,U=c.length;C!==U&&c[C]===0;)C++,g++;for(var B=(U-C)*p+1>>>0,S=new Uint8Array(B);C!==U;){for(var L=c[C],b=0,z=B-1;(L!==0||b<I)&&z!==-1;z--,b++)L+=256*S[z]>>>0,S[z]=L%u>>>0,L=L/u>>>0;if(L!==0)throw new Error("Non-zero carry");I=b,C++}for(var G=B-I;G!==B&&S[G]===0;)G++;for(var Ne=w.repeat(g);G<B;++G)Ne+=r.charAt(S[G]);return Ne}function d(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var g=0;if(c[g]!==" "){for(var I=0,C=0;c[g]===w;)I++,g++;for(var U=(c.length-g)*E+1>>>0,B=new Uint8Array(U);c[g];){var S=n[c.charCodeAt(g)];if(S===255)return;for(var L=0,b=U-1;(S!==0||L<C)&&b!==-1;b--,L++)S+=u*B[b]>>>0,B[b]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");C=L,g++}if(c[g]!==" "){for(var z=U-C;z!==U&&B[z]===0;)z++;for(var G=new Uint8Array(I+(U-z)),Ne=I;z!==U;)G[Ne++]=B[z++];return G}}}function l(c){var g=d(c);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:a,decodeUnsafe:d,decode:l}}var Ii=Ei,xi=Ii,Mn=xi;var Dc=new Uint8Array(0);var kn=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let n=0;n<r.byteLength;n++)if(r[n]!==e[n])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 qn=r=>new TextEncoder().encode(r),zn=r=>new TextDecoder().decode(r);var Ar=class{constructor(e,n,t){this.name=e,this.prefix=n,this.baseEncode=t}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Sr=class{constructor(e,n,t){if(this.name=e,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=t}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 Vn(this,e)}},br=class{constructor(e){this.decoders=e}or(e){return Vn(this,e)}decode(e){let n=e[0],t=this.decoders[n];if(t)return t.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Vn=(r,e)=>new br({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Or=class{constructor(e,n,t,i){this.name=e,this.prefix=n,this.baseEncode=t,this.baseDecode=i,this.encoder=new Ar(e,n,t),this.decoder=new Sr(e,n,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},_e=({name:r,prefix:e,encode:n,decode:t})=>new Or(r,e,n,t),Ce=({prefix:r,name:e,alphabet:n})=>{let{encode:t,decode:i}=Mn(n,e);return _e({prefix:r,name:e,encode:t,decode:o=>X(i(o))})},Ci=(r,e,n,t)=>{let i={};for(let p=0;p<e.length;++p)i[e[p]]=p;let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*n/8|0),u=0,w=0,E=0;for(let p=0;p<o;++p){let a=i[r[p]];if(a===void 0)throw new SyntaxError(`Non-${t} character`);w=w<<n|a,u+=n,u>=8&&(u-=8,s[E++]=255&w>>u)}if(u>=n||255&w<<8-u)throw new SyntaxError("Unexpected end of data");return s},vi=(r,e,n)=>{let t=e[e.length-1]==="=",i=(1<<n)-1,o="",s=0,u=0;for(let w=0;w<r.length;++w)for(u=u<<8|r[w],s+=8;s>n;)s-=n,o+=e[i&u>>s];if(s&&(o+=e[i&u<<n-s]),t)for(;o.length*n&7;)o+="=";return o},O=({name:r,prefix:e,bitsPerChar:n,alphabet:t})=>_e({prefix:e,name:r,encode(i){return vi(i,t,n)},decode(i){return Ci(i,t,n,r)}});var W=O({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ui=O({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ai=O({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Si=O({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),bi=O({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Oi=O({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Li=O({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ti=O({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Bi=O({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Tr={};$(Tr,{base58btc:()=>T,base58flickr:()=>Ni});var T=Ce({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ni=Ce({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Nr={};$(Nr,{base64:()=>Br,base64pad:()=>Pi,base64url:()=>Di,base64urlpad:()=>Fi});var Br=O({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Pi=O({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Di=O({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Fi=O({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});j.default.formatters.b=r=>r==null?"undefined":T.baseEncode(r);j.default.formatters.t=r=>r==null?"undefined":W.baseEncode(r);j.default.formatters.m=r=>r==null?"undefined":Br.baseEncode(r);j.default.formatters.p=r=>r==null?"undefined":r.toString();j.default.formatters.c=r=>r==null?"undefined":r.toString();j.default.formatters.k=r=>r==null?"undefined":r.toString();j.default.formatters.a=r=>r==null?"undefined":r.toString();function Ri(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 dr(r){let e=Ri(`${r}:trace`);return j.default.enabled(`${r}:trace`)&&j.default.names.map(n=>n.toString()).find(n=>n.includes(":trace"))!=null&&(e=(0,j.default)(`${r}:trace`)),Object.assign((0,j.default)(r),{error:(0,j.default)(`${r}:error`),trace:e})}var Vt=Ir(ot(),1);var Ye=class extends Error{code;props;constructor(e,n,t){super(e),this.code=n,this.name=t?.name??"CodeError",this.props=t??{}}};var ct=Symbol.for("@libp2p/peer-id");var Kr={};$(Kr,{identity:()=>eo});var eo=_e({prefix:"\0",name:"identity",encode:r=>zn(r),decode:r=>qn(r)});var Hr={};$(Hr,{base2:()=>ro});var ro=O({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Yr={};$(Yr,{base8:()=>no});var no=O({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Gr={};$(Gr,{base10:()=>to});var to=Ce({prefix:"9",name:"base10",alphabet:"0123456789"});var Xr={};$(Xr,{base16:()=>io,base16upper:()=>oo});var io=O({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),oo=O({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Qr={};$(Qr,{base36:()=>co,base36upper:()=>so});var co=Ce({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),so=Ce({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Wr={};$(Wr,{base256emoji:()=>po});var st=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}"),ao=st.reduce((r,e,n)=>(r[n]=e,r),[]),lo=st.reduce((r,e,n)=>(r[e.codePointAt(0)]=n,r),[]);function uo(r){return r.reduce((e,n)=>(e+=ao[n],e),"")}function ho(r){let e=[];for(let n of r){let t=lo[n.codePointAt(0)];if(t===void 0)throw new Error(`Non-base256emoji character: ${n}`);e.push(t)}return new Uint8Array(e)}var po=_e({prefix:"\u{1F680}",name:"base256emoji",encode:uo,decode:ho});var rn={};$(rn,{sha256:()=>pr,sha512:()=>Po});var en=Ir(de("crypto"),1);var go=lt,at=128,mo=127,yo=~mo,wo=Math.pow(2,31);function lt(r,e,n){e=e||[],n=n||0;for(var t=n;r>=wo;)e[n++]=r&255|at,r/=128;for(;r&yo;)e[n++]=r&255|at,r>>>=7;return e[n]=r|0,lt.bytes=n-t+1,e}var Eo=Jr,Io=128,dt=127;function Jr(r,t){var n=0,t=t||0,i=0,o=t,s,u=r.length;do{if(o>=u)throw Jr.bytes=0,new RangeError("Could not decode varint");s=r[o++],n+=i<28?(s&dt)<<i:(s&dt)*Math.pow(2,i),i+=7}while(s>=Io);return Jr.bytes=o-t,n}var xo=Math.pow(2,7),Co=Math.pow(2,14),vo=Math.pow(2,21),Uo=Math.pow(2,28),Ao=Math.pow(2,35),So=Math.pow(2,42),bo=Math.pow(2,49),Oo=Math.pow(2,56),Lo=Math.pow(2,63),To=function(r){return r<xo?1:r<Co?2:r<vo?3:r<Uo?4:r<Ao?5:r<So?6:r<bo?7:r<Oo?8:r<Lo?9:10},Bo={encode:go,decode:Eo,encodingLength:To},No=Bo,Ge=No;var Xe=(r,e=0)=>[Ge.decode(r,e),Ge.decode.bytes],ke=(r,e,n=0)=>(Ge.encode(r,e,n),e),qe=r=>Ge.encodingLength(r);var Ue=(r,e)=>{let n=e.byteLength,t=qe(r),i=t+qe(n),o=new Uint8Array(i+n);return ke(r,o,0),ke(n,o,t),o.set(e,i),new ze(r,n,e,o)},Le=r=>{let e=X(r),[n,t]=Xe(e),[i,o]=Xe(e.subarray(t)),s=e.subarray(t+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new ze(n,i,s,e)},ut=(r,e)=>{if(r===e)return!0;{let n=e;return r.code===n.code&&r.size===n.size&&n.bytes instanceof Uint8Array&&kn(r.bytes,n.bytes)}},ze=class{constructor(e,n,t,i){this.code=e,this.size=n,this.digest=t,this.bytes=i}};var fr=({name:r,code:e,encode:n})=>new Zr(r,e,n),Zr=class{constructor(e,n,t){this.name=e,this.code=n,this.encode=t}digest(e){if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?Ue(this.code,n):n.then(t=>Ue(this.code,t))}else throw Error("Unknown type, must be binary type")}};var pr=fr({name:"sha2-256",code:18,encode:r=>X(en.default.createHash("sha256").update(r).digest())}),Po=fr({name:"sha2-512",code:19,encode:r=>X(en.default.createHash("sha512").update(r).digest())});var nn={};$(nn,{identity:()=>gr});var pt=0,Do="identity",gt=X,Fo=r=>Ue(pt,gt(r)),gr={code:pt,name:Do,encode:gt,digest:Fo};var ms=new TextEncoder,ys=new TextDecoder;var mt=(r,e)=>{let{bytes:n,version:t}=r;switch(t){case 0:return ko(n,tn(r),e||T.encoder);default:return qo(n,tn(r),e||W.encoder)}};var yt=new WeakMap,tn=r=>{let e=yt.get(r);if(e==null){let n=new Map;return yt.set(r,n),n}return e},ee=class r{constructor(e,n,t,i){this.code=n,this.version=e,this.multihash=t,this.bytes=i,this["/"]=i}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:n}=this;if(e!==Qe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==zo)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(n)}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:n}=this.multihash,t=Ue(e,n);return r.createV1(this.code,t)}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,n){let t=n;return t&&e.code===t.code&&e.version===t.version&&ut(e.multihash,t.multihash)}toString(e){return mt(this,e)}toJSON(){return{"/":mt(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 n=e;if(n instanceof r)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){let{version:t,code:i,multihash:o,bytes:s}=n;return new r(t,i,o,s||wt(t,i,o.bytes))}else if(n[$o]===!0){let{version:t,multihash:i,code:o}=n,s=Le(i);return r.create(t,o,s)}else return null}static create(e,n,t){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(t.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(n!==Qe)throw new Error(`Version 0 CID must use dag-pb (code: ${Qe}) block encoding`);return new r(e,n,t,t.bytes)}case 1:{let i=wt(e,n,t.bytes);return new r(e,n,t,i)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Qe,e)}static createV1(e,n){return r.create(1,e,n)}static decode(e){let[n,t]=r.decodeFirst(e);if(t.length)throw new Error("Incorrect length");return n}static decodeFirst(e){let n=r.inspectBytes(e),t=n.size-n.multihashSize,i=X(e.subarray(t,t+n.multihashSize));if(i.byteLength!==n.multihashSize)throw new Error("Incorrect length");let o=i.subarray(n.multihashSize-n.digestSize),s=new ze(n.multihashCode,n.digestSize,o,i);return[n.version===0?r.createV0(s):r.createV1(n.codec,s),e.subarray(n.size)]}static inspectBytes(e){let n=0,t=()=>{let[a,d]=Xe(e.subarray(n));return n+=d,a},i=t(),o=Qe;if(i===18?(i=0,n=0):o=t(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=n,u=t(),w=t(),E=n+w,p=E-s;return{version:i,codec:o,multihashCode:u,digestSize:w,multihashSize:p,size:E}}static parse(e,n){let[t,i]=Mo(e,n),o=r.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return tn(o).set(t,e),o}},Mo=(r,e)=>{switch(r[0]){case"Q":{let n=e||T;return[T.prefix,n.decode(`${T.prefix}${r}`)]}case T.prefix:{let n=e||T;return[T.prefix,n.decode(r)]}case W.prefix:{let n=e||W;return[W.prefix,n.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)]}}},ko=(r,e,n)=>{let{prefix:t}=n;if(t!==T.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);let i=e.get(t);if(i==null){let o=n.encode(r).slice(1);return e.set(t,o),o}else return i},qo=(r,e,n)=>{let{prefix:t}=n,i=e.get(t);if(i==null){let o=n.encode(r);return e.set(t,o),o}else return i},Qe=112,zo=18,wt=(r,e,n)=>{let t=qe(r),i=t+qe(e),o=new Uint8Array(i+n.byteLength);return ke(r,o,0),ke(e,o,t),o.set(n,i),o},$o=Symbol.for("@ipld/js-cid/CID");var Ae={...Kr,...Hr,...Yr,...Gr,...Xr,...Lr,...Qr,...Tr,...Nr,...Wr},bs={...rn,...nn};function We(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let n=0;n<r.byteLength;n++)if(r[n]!==e[n])return!1;return!0}var Vo=Symbol.for("nodejs.util.inspect.custom"),Et=Object.values(Ae).map(r=>r.decoder).reduce((r,e)=>r.or(e),Ae.identity.decoder),It=114,xt=36,Ct=37,Je=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()})`}[ct]=!0;toString(){return this.string==null&&(this.string=T.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return ee.createV1(It,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return We(this.multihash.bytes,e);if(typeof e=="string")return on(e).equals(this);if(e?.multihash?.bytes!=null)return We(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Vo](){return`PeerId(${this.toString()})`}},Ze=class extends Je{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},fe=class extends Je{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},er=class extends Je{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function on(r,e){if(e=e??Et,r.charAt(0)==="1"||r.charAt(0)==="Q"){let n=Le(T.decode(`z${r}`));return r.startsWith("12D")?new fe({multihash:n}):r.startsWith("16U")?new er({multihash:n}):new Ze({multihash:n})}return jo(Et.decode(r))}function jo(r){try{let e=Le(r);if(e.code===gr.code){if(e.digest.length===xt)return new fe({multihash:e});if(e.digest.length===Ct)return new er({multihash:e})}if(e.code===pr.code)return new Ze({multihash:e})}catch{return Ko(ee.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Ko(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==It)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===pr.code)return new Ze({multihash:r.multihash});if(e.code===gr.code){if(e.digest.length===xt)return new fe({multihash:r.multihash});if(e.digest.length===Ct)return new er({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}function $e(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Ve(r=0){return globalThis.Buffer?.allocUnsafe!=null?$e(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ut(r,e,n,t){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:n},decoder:{decode:t}}}var vt=Ut("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),cn=Ut("ascii","a",r=>{let e="a";for(let n=0;n<r.length;n++)e+=String.fromCharCode(r[n]);return e},r=>{r=r.substring(1);let e=Ve(r.length);for(let n=0;n<r.length;n++)e[n]=r.charCodeAt(n);return e}),Ho={utf8:vt,"utf-8":vt,hex:Ae.base16,latin1:cn,ascii:cn,binary:cn,...Ae},mr=Ho;function q(r,e="utf8"){let n=mr[e];if(n==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"):n.encoder.encode(r).substring(1)}var Yo=Math.pow(2,7),Go=Math.pow(2,14),Xo=Math.pow(2,21),sn=Math.pow(2,28),an=Math.pow(2,35),dn=Math.pow(2,42),ln=Math.pow(2,49),v=128,_=127;function ae(r){if(r<Yo)return 1;if(r<Go)return 2;if(r<Xo)return 3;if(r<sn)return 4;if(r<an)return 5;if(r<dn)return 6;if(r<ln)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Qo(r,e,n=0){switch(ae(r)){case 8:e[n++]=r&255|v,r/=128;case 7:e[n++]=r&255|v,r/=128;case 6:e[n++]=r&255|v,r/=128;case 5:e[n++]=r&255|v,r/=128;case 4:e[n++]=r&255|v,r>>>=7;case 3:e[n++]=r&255|v,r>>>=7;case 2:e[n++]=r&255|v,r>>>=7;case 1:{e[n++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Wo(r,e,n=0){switch(ae(r)){case 8:e.set(n++,r&255|v),r/=128;case 7:e.set(n++,r&255|v),r/=128;case 6:e.set(n++,r&255|v),r/=128;case 5:e.set(n++,r&255|v),r/=128;case 4:e.set(n++,r&255|v),r>>>=7;case 3:e.set(n++,r&255|v),r>>>=7;case 2:e.set(n++,r&255|v),r>>>=7;case 1:{e.set(n++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function Jo(r,e){let n=r[e],t=0;if(t+=n&_,n<v||(n=r[e+1],t+=(n&_)<<7,n<v)||(n=r[e+2],t+=(n&_)<<14,n<v)||(n=r[e+3],t+=(n&_)<<21,n<v)||(n=r[e+4],t+=(n&_)*sn,n<v)||(n=r[e+5],t+=(n&_)*an,n<v)||(n=r[e+6],t+=(n&_)*dn,n<v)||(n=r[e+7],t+=(n&_)*ln,n<v))return t;throw new RangeError("Could not decode varint")}function Zo(r,e){let n=r.get(e),t=0;if(t+=n&_,n<v||(n=r.get(e+1),t+=(n&_)<<7,n<v)||(n=r.get(e+2),t+=(n&_)<<14,n<v)||(n=r.get(e+3),t+=(n&_)<<21,n<v)||(n=r.get(e+4),t+=(n&_)*sn,n<v)||(n=r.get(e+5),t+=(n&_)*an,n<v)||(n=r.get(e+6),t+=(n&_)*dn,n<v)||(n=r.get(e+7),t+=(n&_)*ln,n<v))return t;throw new RangeError("Could not decode varint")}function je(r,e,n=0){return e==null&&(e=Ve(ae(r))),e instanceof Uint8Array?Qo(r,e,n):Wo(r,e,n)}function Be(r,e=0){return r instanceof Uint8Array?Jo(r,e):Zo(r,e)}function xe(r,e){e==null&&(e=r.reduce((i,o)=>i+o.length,0));let n=Ve(e),t=0;for(let i of r)n.set(i,t),t+=i.length;return $e(n)}var yr=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let n=this.index,t=e();return t===void 0&&(this.index=n),t}parseWith(e){let n=e();if(this.index===this.input.length)return n}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 n=this.readChar();if(n===e)return n})}readSeparator(e,n,t){return this.readAtomically(()=>{if(!(n>0&&this.readGivenChar(e)===void 0))return t()})}readNumber(e,n,t,i){return this.readAtomically(()=>{let o=0,s=0,u=this.peekChar();if(u===void 0)return;let w=u==="0",E=2**(8*i)-1;for(;;){let p=this.readAtomically(()=>{let a=this.readChar();if(a===void 0)return;let d=Number.parseInt(a,e);if(!Number.isNaN(d))return d});if(p===void 0)break;if(o*=e,o+=p,o>E||(s+=1,n!==void 0&&s>n))return}if(s!==0)return!t&&w&&s>1?void 0:o})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let n=0;n<e.length;n++){let t=this.readSeparator(".",n,()=>this.readNumber(10,3,!1,1));if(t===void 0)return;e[n]=t}return e})}readIPv6Addr(){let e=n=>{for(let t=0;t<n.length/2;t++){let i=t*2;if(t<n.length-3){let s=this.readSeparator(":",t,()=>this.readIPv4Addr());if(s!==void 0)return n[i]=s[0],n[i+1]=s[1],n[i+2]=s[2],n[i+3]=s[3],[i+4,!0]}let o=this.readSeparator(":",t,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];n[i]=o>>8,n[i+1]=o&255}return[n.length,!1]};return this.readAtomically(()=>{let n=new Uint8Array(16),[t,i]=e(n);if(t===16)return n;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),s=16-(t+2),[u]=e(o.subarray(0,s));return n.set(o.subarray(0,u),16-u),n})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Zs=new yr;var ca=parseInt("0xFFFF",16),sa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function un(r,e="utf8"){let n=mr[e];if(n==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?$e(globalThis.Buffer.from(r,"utf-8")):n.decoder.decode(`${n.prefix}${r}`)}var Se=de("node:net");function wr(r){return!!(0,Se.isIP)(r)}var Ot=Se.isIPv4,ic=Se.isIPv6,hn=function(r){let e=0;if(r=r.toString().trim(),Ot(r)){let n=new Uint8Array(e+4);return r.split(/\./g).forEach(t=>{n[e++]=parseInt(t,10)&255}),n}if(ic(r)){let n=r.split(":",8),t;for(t=0;t<n.length;t++){let o=Ot(n[t]),s;o&&(s=hn(n[t]),n[t]=q(s.slice(0,2),"base16")),s!=null&&++t<8&&n.splice(t,0,q(s.slice(2,4),"base16"))}if(n[0]==="")for(;n.length<8;)n.unshift("0");else if(n[n.length-1]==="")for(;n.length<8;)n.push("0");else if(n.length<8){for(t=0;t<n.length&&n[t]!=="";t++);let o=[t,1];for(t=9-n.length;t>0;t--)o.push("0");n.splice.apply(n,o)}let i=new Uint8Array(e+16);for(t=0;t<n.length;t++){let o=parseInt(n[t],16);i[e++]=o>>8&255,i[e++]=o&255}return i}throw new Error("invalid ip address")},Lt=function(r,e=0,n){e=~~e,n=n??r.length-e;let t=new DataView(r.buffer);if(n===4){let i=[];for(let o=0;o<n;o++)i.push(r[e+o]);return i.join(".")}if(n===16){let i=[];for(let o=0;o<n;o+=2)i.push(t.getUint16(e+o).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ke={},pn={},cc=[[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"]];cc.forEach(r=>{let e=sc(...r);pn[e.code]=e,Ke[e.name]=e});function sc(r,e,n,t,i){return{code:r,size:e,name:n,resolvable:!!t,path:!!i}}function A(r){if(typeof r=="number"){if(pn[r]!=null)return pn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ke[r]!=null)return Ke[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Xa=A("ip4"),Qa=A("ip6"),Wa=A("ipcidr");function mn(r,e){switch(A(r).code){case 4:case 41:return dc(e);case 42:return Nt(e);case 6:case 273:case 33:case 132:return Dt(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Nt(e);case 421:return pc(e);case 444:return Pt(e);case 445:return Pt(e);case 466:return hc(e);default:return q(e,"base16")}}function yn(r,e){switch(A(r).code){case 4:return Tt(e);case 41:return Tt(e);case 42:return Bt(e);case 6:case 273:case 33:case 132:return wn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Bt(e);case 421:return lc(e);case 444:return gc(e);case 445:return mc(e);case 466:return uc(e);default:return un(e,"base16")}}var gn=Object.values(Ae).map(r=>r.decoder),ac=function(){let r=gn[0].or(gn[1]);return gn.slice(2).forEach(e=>r=r.or(e)),r}();function Tt(r){if(!wr(r))throw new Error("invalid ip address");return hn(r)}function dc(r){let e=Lt(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!wr(e))throw new Error("invalid ip address");return e}function wn(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Dt(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Bt(r){let e=un(r),n=Uint8Array.from(je(e.length));return xe([n,e],n.length+e.length)}function Nt(r){let e=Be(r);if(r=r.slice(ae(e)),r.length!==e)throw new Error("inconsistent lengths");return q(r)}function lc(r){let e;r[0]==="Q"||r[0]==="1"?e=Le(T.decode(`z${r}`)).bytes:e=ee.parse(r).multihash.bytes;let n=Uint8Array.from(je(e.length));return xe([n,e],n.length+e.length)}function uc(r){let e=ac.decode(r),n=Uint8Array.from(je(e.length));return xe([n,e],n.length+e.length)}function hc(r){let e=Be(r),n=r.slice(ae(e));if(n.length!==e)throw new Error("inconsistent lengths");return"u"+q(n,"base64url")}function pc(r){let e=Be(r),n=r.slice(ae(e));if(n.length!==e)throw new Error("inconsistent lengths");return q(n,"base58btc")}function gc(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 n=W.decode("b"+e[0]),t=parseInt(e[1],10);if(t<1||t>65536)throw new Error("Port number is not in range(1, 65536)");let i=wn(t);return xe([n,i],n.length+i.length)}function mc(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 n=W.decode(`b${e[0]}`),t=parseInt(e[1],10);if(t<1||t>65536)throw new Error("Port number is not in range(1, 65536)");let i=wn(t);return xe([n,i],n.length+i.length)}function Pt(r){let e=r.slice(0,r.length-2),n=r.slice(r.length-2),t=q(e,"base32"),i=Dt(n);return`${t}:${i}`}function Ft(r){r=En(r);let e=[],n=[],t=null,i=r.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let o=0;o<i.length;o++){let s=i[o],u=A(s);if(u.size===0){e.push([u.code]),n.push([u.code]);continue}if(o++,o>=i.length)throw _t("invalid address: "+r);if(u.path===!0){t=En(i.slice(o).join("/")),e.push([u.code,yn(u.code,t)]),n.push([u.code,t]);break}let w=yn(u.code,i[o]);e.push([u.code,w]),n.push([u.code,mn(u.code,w)])}return{string:Rt(n),bytes:xn(e),tuples:e,stringTuples:n,path:t}}function In(r){let e=[],n=[],t=null,i=0;for(;i<r.length;){let o=Be(r,i),s=ae(o),u=A(o),w=yc(u,r.slice(i+s));if(w===0){e.push([o]),n.push([o]),i+=s;continue}let E=r.slice(i+s,i+s+w);if(i+=w+s,i>r.length)throw _t("Invalid address Uint8Array: "+q(r,"base16"));e.push([o,E]);let p=mn(o,E);if(n.push([o,p]),u.path===!0){t=p;break}}return{bytes:Uint8Array.from(r),string:Rt(n),tuples:e,stringTuples:n,path:t}}function Rt(r){let e=[];return r.map(n=>{let t=A(n[0]);return e.push(t.name),n.length>1&&n[1]!=null&&e.push(n[1]),null}),En(e.join("/"))}function xn(r){return xe(r.map(e=>{let n=A(e[0]),t=Uint8Array.from(je(n.code));return e.length>1&&e[1]!=null&&(t=xe([t,e[1]])),t}))}function yc(r,e){if(r.size>0)return r.size/8;if(r.size===0)return 0;{let n=Be(e instanceof Uint8Array?e:Uint8Array.from(e));return n+ae(n)}}function En(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function _t(r){return new Error("Error parsing address: "+r)}var wc=Symbol.for("nodejs.util.inspect.custom"),Ec=[A("dns").code,A("dns4").code,A("dns6").code,A("dnsaddr").code],Ic=new Map,Mt=Symbol.for("@multiformats/js-multiaddr/multiaddr");function xc(r){return!!r?.[Mt]}var vn=class r{bytes;#e;#r;#n;#t;[Mt]=!0;constructor(e){e==null&&(e="");let n;if(e instanceof Uint8Array)n=In(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);n=Ft(e)}else if(xc(e))n=In(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=n.bytes,this.#e=n.string,this.#r=n.tuples,this.#n=n.stringTuples,this.#t=n.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,n,t,i,o="",s=A("tcp"),u=A("udp"),w=A("ip4"),E=A("ip6"),p=A("dns6"),a=A("ip6zone");for(let[l,c]of this.stringTuples())l===a.code&&(o=`%${c??""}`),Ec.includes(l)&&(n=s.name,i=443,t=`${c??""}${o}`,e=l===p.code?6:4),(l===s.code||l===u.code)&&(n=A(l).name,i=parseInt(c??"")),(l===w.code||l===E.code)&&(n=A(l).name,t=`${c??""}${o}`,e=l===E.code?6:4);if(e==null||n==null||t==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:t,transport:n,port:i}}protos(){return this.#r.map(([e])=>Object.assign({},A(e)))}protoCodes(){return this.#r.map(([e])=>e)}protoNames(){return this.#r.map(([e])=>A(e).name)}tuples(){return this.#r}stringTuples(){return this.#n}encapsulate(e){return e=new r(e),new r(this.toString()+e.toString())}decapsulate(e){let n=e.toString(),t=this.toString(),i=t.lastIndexOf(n);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new r(t.slice(0,i))}decapsulateCode(e){let n=this.tuples();for(let t=n.length-1;t>=0;t--)if(n[t][0]===e)return new r(xn(n.slice(0,t)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([t,i])=>{t===Ke.p2p.code&&e.push([t,i]),t===Ke["p2p-circuit"].code&&(e=[])});let n=e.pop();if(n?.[1]!=null){let t=n[1];return t[0]==="Q"||t[0]==="1"?q(T.decode(`z${t}`),"base58btc"):q(ee.parse(t).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#t}equals(e){return We(this.bytes,e.bytes)}async resolve(e){let n=this.protos().find(o=>o.resolvable);if(n==null)return[this];let t=Ic.get(n.name);if(t==null)throw new Ye(`no available resolver for ${n.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await t(this,e)).map(o=>new r(o))}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 n=(e??this).protos();return!(n.length!==2||n[0].code!==4&&n[0].code!==41||n[1].code!==6&&n[1].code!==273)}[wc](){return`Multiaddr(${this.#e})`}};function Cn(r){return new vn(r)}var rr=dr("libp2p:mdns:query");function kt(r,e,n){let t=()=>{rr("query",e),r.query({questions:[{name:e,type:"PTR"}]})};return t(),setInterval(t,n)}function qt(r,e,n){if(r.answers==null)return;let t,i=[];if(r.answers.forEach(o=>{switch(o.type){case"PTR":t=o;break;case"TXT":i.push(o);break;default:break}}),!(t==null||t?.name!==n||i.length===0||t.data.startsWith(e)))try{let o=i.flatMap(u=>u.data).filter(u=>u.toString().startsWith("dnsaddr=")).map(u=>Cn(u.toString().substring(8))),s=o[0].getPeerId();if(s==null)throw new Error("Multiaddr doesn't contain PeerId");return rr("peer found %p",s),{id:on(s),multiaddrs:o,protocols:[]}}catch(o){rr.error("failed to parse mdns response",o)}}function zt(r,e,n,t,i,o){if(!o){rr("not responding to mDNS query as broadcast mode is false");return}if(t.length!==0&&r.questions[0]!=null&&r.questions[0].name===i){let s=[];s.push({name:i,type:"PTR",class:"IN",ttl:120,data:n+"."+i}),t.forEach(u=>{u.getPeerId()!=null&&s.push({name:n+"."+i,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+u.toString()})}),rr("responding to query"),e.respond(s)}}function $t(r){let e="",n="abcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<r;t++)e+=n.charAt(Math.floor(Math.random()*n.length));return e}var Er=dr("libp2p:mdns"),Un=class extends tr{mdns;broadcast;interval;serviceTag;peerName;port;ip;_queryInterval;components;constructor(e,n={}){if(super(),this.broadcast=n.broadcast!==!1,this.interval=n.interval??1e3*10,this.serviceTag=n.serviceTag??"_p2p._udp.local",this.ip=n.ip??"224.0.0.251",this.peerName=n.peerName??$t(63),this.peerName.length>=64)throw new Error("Peer name should be less than 64 chars long");this.port=n.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)}[Sn]=this;[Symbol.toStringTag]="@libp2p/mdns";isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,Vt.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=kt(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){this.mdns!=null&&(Er.trace("received incoming mDNS query"),zt(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast))}_onMdnsResponse(e){Er.trace("received mDNS query response");try{let n=qt(e,this.peerName,this.serviceTag);n!=null&&(Er("discovered peer in mDNS query response %p",n.id),this.dispatchEvent(new ir("peer",{detail:n})))}catch(n){Er.error("Error processing peer response",n)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new ir("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 vc(r={}){return e=>new Un(e,r)}return Xt(Uc);})();
|
|
6
|
+
`).map(e=>e.trim()).join(" ")};Fn.O=function(r){return this.inspectOpts.colors=this.useColors,sr.inspect(r,this.inspectOpts)}});var _n=F((Nc,Ur)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ur.exports=Tn():Ur.exports=Rn()});var jn=F(Pr=>{"use strict";Pr.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};Pr.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 Kn=F(Dr=>{"use strict";Dr.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};Dr.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 Hn=F(Fr=>{"use strict";Fr.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};Fr.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 Yn=F(Rr=>{"use strict";Rr.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};Rr.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 Gn=F(_r=>{"use strict";_r.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}`};_r.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 Wn=F((Qn,Mr)=>{var Xn=function(r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=a,r.encode=p,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}$/,n=4,t=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i=16,o={name:"v4",size:n,isFormat:d=>e.test(d),encode(d,u,c){c=~~c,u=u||new Uint8Array(c+n);let g=d.length,I=0;for(let C=0;C<g;){let U=d.charCodeAt(C++);U===46?(u[c++]=I,I=0):I=I*10+(U-48)}return u[c]=I,u},decode(d,u){return u=~~u,`${d[u++]}.${d[u++]}.${d[u++]}.${d[u]}`}};r.v4=o;let s={name:"v6",size:i,isFormat:d=>d.length>0&&t.test(d),encode(d,u,c){c=~~c;let g=c+i,I=-1,C=0,U=0,B=!0,S=!1;u=u||new Uint8Array(c+i);for(let L=0;L<d.length;L++){let b=d.charCodeAt(L);b===58?(B?I!==-1?(c<g&&(u[c]=0),c<g-1&&(u[c+1]=0),c+=2):c<g&&(I=c):(S===!0?(c<g&&(u[c]=U),c++):(c<g&&(u[c]=C>>8),c<g-1&&(u[c+1]=C&255),c+=2),C=0,U=0),B=!0,S=!1):b===46?(c<g&&(u[c]=U),c++,U=0,C=0,B=!1,S=!0):(B=!1,b>=97?b-=87:b>=65?b-=55:(b-=48,U=U*10+b),C=(C<<4)+b)}if(B===!1)S===!0?(c<g&&(u[c]=U),c++):(c<g&&(u[c]=C>>8),c<g-1&&(u[c+1]=C&255),c+=2);else if(I===0)c<g&&(u[c]=0),c<g-1&&(u[c+1]=0),c+=2;else if(I!==-1){c+=2;for(let L=Math.min(c-1,g-1);L>=I+2;L--)u[L]=u[L-2];u[I]=0,u[I+1]=0,I=c}if(I!==c&&I!==-1)for(c>g-2&&(c=g-2);g>I;)u[--g]=c<g&&c>I?u[--c]:0;else for(;c<g;)u[c++]=0;return u},decode(d,u){u=~~u;let c="";for(let g=0;g<i;g+=2)g!==0&&(c+=":"),c+=(d[u+g]<<8|d[u+g+1]).toString(16);return c.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};r.v6=s;let l="ip";r.name=l;function m(d){if(o.isFormat(d))return o.size;if(s.isFormat(d))return s.size;throw Error(`Invalid ip address: ${d}`)}function E(d){return m(d)===o.size?1:2}function p(d,u,c){c=~~c;let g=m(d);return typeof u=="function"&&(u=u(c+g)),g===o.size?o.encode(d,u,c):s.encode(d,u,c)}function a(d,u,c){if(u=~~u,c=c||d.length-u,c===o.size)return o.decode(d,u,c);if(c===s.size)return s.decode(d,u,c);throw Error(`Invalid buffer size needs to be ${o.size} for v4 or ${s.size} for v6.`)}return"default"in r?r.default:r}({});typeof define=="function"&&define.amd?define([],function(){return Xn}):typeof Mr=="object"&&typeof Qn=="object"&&(Mr.exports=Xn)});var fn=F(y=>{"use strict";var w=de("buffer").Buffer,Ie=jn(),_i=Kn(),Mi=Hn(),ur=Yn(),kr=Gn(),Oe=Wn(),ki=0,Jn=32768,qr=32768,qi=~qr,Zn=32768,zi=~Zn,h=y.name={};h.encode=function(r,e,n,{mail:t=!1}={}){e||(e=w.alloc(h.encodingLength(r))),n||(n=0);let i=n,o=r.replace(/^\.|\.$/gm,"");if(o.length){let s=[];if(t){let l="";o.split(".").forEach(m=>{m.endsWith("\\")?l+=(l.length?".":"")+m.slice(0,-1):s.length===0&&l.length?s.push(l+"."+m):s.push(m)})}else s=o.split(".");for(let l=0;l<s.length;l++){let m=e.write(s[l],n+1);e[n]=m,n+=m+1}}return e[n++]=0,h.encode.bytes=n-i,e};h.encode.bytes=0;h.decode=function(r,e,{mail:n=!1}={}){e||(e=0);let t=[],i=e,o=0,s=0,l=!1;for(;;){if(e>=r.length)throw new Error("Cannot decode name (buffer overflow)");let m=r[e++];if(s+=l?0:1,m===0)break;if(m&192)if((m&192)===192){if(e+1>r.length)throw new Error("Cannot decode name (buffer overflow)");let E=r.readUInt16BE(e-1)-49152;if(E>=i)throw new Error("Cannot decode name (bad pointer)");e=E,i=E,s+=l?0:1,l=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+m>r.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=m+1,o>254)throw new Error("Cannot decode name (name too long)");let E=r.toString("utf-8",e,e+m);n&&(E=E.replace(/\./g,"\\.")),t.push(E),e+=m,s+=l?0:m}}return h.decode.bytes=s,t.length===0?".":t.join(".")};h.decode.bytes=0;h.encodingLength=function(r){return r==="."||r===".."?1:w.byteLength(r.replace(/^\.|\.$/gm,""))+2};var x={};x.encode=function(r,e,n){e||(e=w.alloc(x.encodingLength(r))),n||(n=0);let t=e.write(r,n+1);return e[n]=t,x.encode.bytes=t+1,e};x.encode.bytes=0;x.decode=function(r,e){e||(e=0);let n=r[e],t=r.toString("utf-8",e+1,e+1+n);return x.decode.bytes=n+1,t};x.decode.bytes=0;x.encodingLength=function(r){return w.byteLength(r)+1};var f={};f.encode=function(r,e,n){e||(e=f.encodingLength(r)),n||(n=0);let t=(r.flags||0)&32767,i=r.type==="response"?Jn:ki;return e.writeUInt16BE(r.id||0,n),e.writeUInt16BE(t|i,n+2),e.writeUInt16BE(r.questions.length,n+4),e.writeUInt16BE(r.answers.length,n+6),e.writeUInt16BE(r.authorities.length,n+8),e.writeUInt16BE(r.additionals.length,n+10),e};f.encode.bytes=12;f.decode=function(r,e){if(e||(e=0),r.length<12)throw new Error("Header must be 12 bytes");let n=r.readUInt16BE(e+2);return{id:r.readUInt16BE(e),type:n&Jn?"response":"query",flags:n&32767,flag_qr:(n>>15&1)===1,opcode:Mi.toString(n>>11&15),flag_aa:(n>>10&1)===1,flag_tc:(n>>9&1)===1,flag_rd:(n>>8&1)===1,flag_ra:(n>>7&1)===1,flag_z:(n>>6&1)===1,flag_ad:(n>>5&1)===1,flag_cd:(n>>4&1)===1,rcode:_i.toString(n&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))}};f.decode.bytes=12;f.encodingLength=function(){return 12};var le=y.unknown={};le.encode=function(r,e,n){return e||(e=w.alloc(le.encodingLength(r))),n||(n=0),e.writeUInt16BE(r.length,n),r.copy(e,n+2),le.encode.bytes=r.length+2,e};le.encode.bytes=0;le.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e),t=r.slice(e+2,e+2+n);return le.decode.bytes=n+2,t};le.decode.bytes=0;le.encodingLength=function(r){return r.length+2};var ue=y.ns={};ue.encode=function(r,e,n){return e||(e=w.alloc(ue.encodingLength(r))),n||(n=0),h.encode(r,e,n+2),e.writeUInt16BE(h.encode.bytes,n),ue.encode.bytes=h.encode.bytes+2,e};ue.encode.bytes=0;ue.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e),t=h.decode(r,e+2);return ue.decode.bytes=n+2,t};ue.decode.bytes=0;ue.encodingLength=function(r){return h.encodingLength(r)+2};var he=y.soa={};he.encode=function(r,e,n){e||(e=w.alloc(he.encodingLength(r))),n||(n=0);let t=n;return n+=2,h.encode(r.mname,e,n),n+=h.encode.bytes,h.encode(r.rname,e,n,{mail:!0}),n+=h.encode.bytes,e.writeUInt32BE(r.serial||0,n),n+=4,e.writeUInt32BE(r.refresh||0,n),n+=4,e.writeUInt32BE(r.retry||0,n),n+=4,e.writeUInt32BE(r.expire||0,n),n+=4,e.writeUInt32BE(r.minimum||0,n),n+=4,e.writeUInt16BE(n-t-2,t),he.encode.bytes=n-t,e};he.encode.bytes=0;he.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.mname=h.decode(r,e),e+=h.decode.bytes,t.rname=h.decode(r,e,{mail:!0}),e+=h.decode.bytes,t.serial=r.readUInt32BE(e),e+=4,t.refresh=r.readUInt32BE(e),e+=4,t.retry=r.readUInt32BE(e),e+=4,t.expire=r.readUInt32BE(e),e+=4,t.minimum=r.readUInt32BE(e),e+=4,he.decode.bytes=e-n,t};he.decode.bytes=0;he.encodingLength=function(r){return 22+h.encodingLength(r.mname)+h.encodingLength(r.rname)};var pe=y.txt={};pe.encode=function(r,e,n){Array.isArray(r)||(r=[r]);for(let i=0;i<r.length;i++)if(typeof r[i]=="string"&&(r[i]=w.from(r[i])),!w.isBuffer(r[i]))throw new Error("Must be a Buffer");e||(e=w.alloc(pe.encodingLength(r))),n||(n=0);let t=n;return n+=2,r.forEach(function(i){e[n++]=i.length,i.copy(e,n,0,i.length),n+=i.length}),e.writeUInt16BE(n-t-2,t),pe.encode.bytes=n-t,e};pe.encode.bytes=0;pe.decode=function(r,e){e||(e=0);let n=e,t=r.readUInt16BE(e);e+=2;let i=[];for(;t>0;){let o=r[e++];if(--t,t<o)throw new Error("Buffer overflow");i.push(r.slice(e,e+o)),e+=o,t-=o}return pe.decode.bytes=e-n,i};pe.decode.bytes=0;pe.encodingLength=function(r){Array.isArray(r)||(r=[r]);let e=2;return r.forEach(function(n){typeof n=="string"?e+=w.byteLength(n)+1:e+=n.length+1}),e};var ge=y.null={};ge.encode=function(r,e,n){e||(e=w.alloc(ge.encodingLength(r))),n||(n=0),typeof r=="string"&&(r=w.from(r)),r||(r=w.alloc(0));let t=n;n+=2;let i=r.length;return r.copy(e,n,0,i),n+=i,e.writeUInt16BE(n-t-2,t),ge.encode.bytes=n-t,e};ge.encode.bytes=0;ge.decode=function(r,e){e||(e=0);let n=e,t=r.readUInt16BE(e);e+=2;let i=r.slice(e,e+t);return e+=t,ge.decode.bytes=e-n,i};ge.decode.bytes=0;ge.encodingLength=function(r){return r?(w.isBuffer(r)?r.length:w.byteLength(r))+2:2};var me=y.hinfo={};me.encode=function(r,e,n){e||(e=w.alloc(me.encodingLength(r))),n||(n=0);let t=n;return n+=2,x.encode(r.cpu,e,n),n+=x.encode.bytes,x.encode(r.os,e,n),n+=x.encode.bytes,e.writeUInt16BE(n-t-2,t),me.encode.bytes=n-t,e};me.encode.bytes=0;me.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.cpu=x.decode(r,e),e+=x.decode.bytes,t.os=x.decode(r,e),e+=x.decode.bytes,me.decode.bytes=e-n,t};me.decode.bytes=0;me.encodingLength=function(r){return x.encodingLength(r.cpu)+x.encodingLength(r.os)+2};var J=y.ptr={},$i=y.cname=J,Vi=y.dname=J;J.encode=function(r,e,n){return e||(e=w.alloc(J.encodingLength(r))),n||(n=0),h.encode(r,e,n+2),e.writeUInt16BE(h.encode.bytes,n),J.encode.bytes=h.encode.bytes+2,e};J.encode.bytes=0;J.decode=function(r,e){e||(e=0);let n=h.decode(r,e+2);return J.decode.bytes=h.decode.bytes+2,n};J.decode.bytes=0;J.encodingLength=function(r){return h.encodingLength(r)+2};var ye=y.srv={};ye.encode=function(r,e,n){e||(e=w.alloc(ye.encodingLength(r))),n||(n=0),e.writeUInt16BE(r.priority||0,n+2),e.writeUInt16BE(r.weight||0,n+4),e.writeUInt16BE(r.port||0,n+6),h.encode(r.target,e,n+8);let t=h.encode.bytes+6;return e.writeUInt16BE(t,n),ye.encode.bytes=t+2,e};ye.encode.bytes=0;ye.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e),t={};return t.priority=r.readUInt16BE(e+2),t.weight=r.readUInt16BE(e+4),t.port=r.readUInt16BE(e+6),t.target=h.decode(r,e+8),ye.decode.bytes=n+2,t};ye.decode.bytes=0;ye.encodingLength=function(r){return 8+h.encodingLength(r.target)};var K=y.caa={};K.ISSUER_CRITICAL=128;K.encode=function(r,e,n){let t=K.encodingLength(r);return e||(e=w.alloc(K.encodingLength(r))),n||(n=0),r.issuerCritical&&(r.flags=K.ISSUER_CRITICAL),e.writeUInt16BE(t-2,n),n+=2,e.writeUInt8(r.flags||0,n),n+=1,x.encode(r.tag,e,n),n+=x.encode.bytes,e.write(r.value,n),n+=w.byteLength(r.value),K.encode.bytes=t,e};K.encode.bytes=0;K.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e);e+=2;let t=e,i={};return i.flags=r.readUInt8(e),e+=1,i.tag=x.decode(r,e),e+=x.decode.bytes,i.value=r.toString("utf-8",e,t+n),i.issuerCritical=!!(i.flags&K.ISSUER_CRITICAL),K.decode.bytes=n+2,i};K.decode.bytes=0;K.encodingLength=function(r){return x.encodingLength(r.tag)+x.encodingLength(r.value)+2};var ve=y.mx={};ve.encode=function(r,e,n){e||(e=w.alloc(ve.encodingLength(r))),n||(n=0);let t=n;return n+=2,e.writeUInt16BE(r.preference||0,n),n+=2,h.encode(r.exchange,e,n),n+=h.encode.bytes,e.writeUInt16BE(n-t-2,t),ve.encode.bytes=n-t,e};ve.encode.bytes=0;ve.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.preference=r.readUInt16BE(e),e+=2,t.exchange=h.decode(r,e),e+=h.decode.bytes,ve.decode.bytes=e-n,t};ve.encodingLength=function(r){return 4+h.encodingLength(r.exchange)};var we=y.a={};we.encode=function(r,e,n){return e||(e=w.alloc(we.encodingLength(r))),n||(n=0),e.writeUInt16BE(4,n),n+=2,Oe.v4.encode(r,e,n),we.encode.bytes=6,e};we.encode.bytes=0;we.decode=function(r,e){e||(e=0),e+=2;let n=Oe.v4.decode(r,e);return we.decode.bytes=6,n};we.decode.bytes=0;we.encodingLength=function(){return 6};var Ee=y.aaaa={};Ee.encode=function(r,e,n){return e||(e=w.alloc(Ee.encodingLength(r))),n||(n=0),e.writeUInt16BE(16,n),n+=2,Oe.v6.encode(r,e,n),Ee.encode.bytes=18,e};Ee.encode.bytes=0;Ee.decode=function(r,e){e||(e=0),e+=2;let n=Oe.v6.decode(r,e);return Ee.decode.bytes=18,n};Ee.decode.bytes=0;Ee.encodingLength=function(){return 18};var k=y.option={};k.encode=function(r,e,n){e||(e=w.alloc(k.encodingLength(r))),n||(n=0);let t=n,i=kr.toCode(r.code);if(e.writeUInt16BE(i,n),n+=2,r.data)e.writeUInt16BE(r.data.length,n),n+=2,r.data.copy(e,n),n+=r.data.length;else switch(i){case 8:let o=r.sourcePrefixLength||0,s=r.family||Oe.familyOf(r.ip),l=Oe.encode(r.ip,w.alloc),m=Math.ceil(o/8);e.writeUInt16BE(m+4,n),n+=2,e.writeUInt16BE(s,n),n+=2,e.writeUInt8(o,n++),e.writeUInt8(r.scopePrefixLength||0,n++),l.copy(e,n,0,m),n+=m;break;case 11:r.timeout?(e.writeUInt16BE(2,n),n+=2,e.writeUInt16BE(r.timeout,n),n+=2):(e.writeUInt16BE(0,n),n+=2);break;case 12:let E=r.length||0;e.writeUInt16BE(E,n),n+=2,e.fill(0,n,n+E),n+=E;break;case 14:let p=r.tags.length*2;e.writeUInt16BE(p,n),n+=2;for(let a of r.tags)e.writeUInt16BE(a,n),n+=2;break;default:throw new Error(`Unknown roption code: ${r.code}`)}return k.encode.bytes=n-t,e};k.encode.bytes=0;k.decode=function(r,e){e||(e=0);let n={};n.code=r.readUInt16BE(e),n.type=kr.toString(n.code),e+=2;let t=r.readUInt16BE(e);switch(e+=2,n.data=r.slice(e,e+t),n.code){case 8:n.family=r.readUInt16BE(e),e+=2,n.sourcePrefixLength=r.readUInt8(e++),n.scopePrefixLength=r.readUInt8(e++);let i=w.alloc(n.family===1?4:16);r.copy(i,0,e,e+t-4),n.ip=Oe.decode(i);break;case 11:t>0&&(n.timeout=r.readUInt16BE(e),e+=2);break;case 14:n.tags=[];for(let o=0;o<t;o+=2)n.tags.push(r.readUInt16BE(e)),e+=2}return k.decode.bytes=t+4,n};k.decode.bytes=0;k.encodingLength=function(r){if(r.data)return r.data.length+4;switch(kr.toCode(r.code)){case 8:let n=r.sourcePrefixLength||0;return Math.ceil(n/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 Y=y.opt={};Y.encode=function(r,e,n){e||(e=w.alloc(Y.encodingLength(r))),n||(n=0);let t=n,i=Me(r,k);return e.writeUInt16BE(i,n),n=He(r,k,e,n+2),Y.encode.bytes=n-t,e};Y.encode.bytes=0;Y.decode=function(r,e){e||(e=0);let n=e,t=[],i=r.readUInt16BE(e);e+=2;let o=0;for(;i>0;)t[o++]=k.decode(r,e),e+=k.decode.bytes,i-=k.decode.bytes;return Y.decode.bytes=e-n,t};Y.decode.bytes=0;Y.encodingLength=function(r){return 2+Me(r||[],k)};var M=y.dnskey={};M.PROTOCOL_DNSSEC=3;M.ZONE_KEY=128;M.SECURE_ENTRYPOINT=32768;M.encode=function(r,e,n){e||(e=w.alloc(M.encodingLength(r))),n||(n=0);let t=n,i=r.key;if(!w.isBuffer(i))throw new Error("Key must be a Buffer");return n+=2,e.writeUInt16BE(r.flags,n),n+=2,e.writeUInt8(M.PROTOCOL_DNSSEC,n),n+=1,e.writeUInt8(r.algorithm,n),n+=1,i.copy(e,n,0,i.length),n+=i.length,M.encode.bytes=n-t,e.writeUInt16BE(M.encode.bytes-2,t),e};M.encode.bytes=0;M.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);if(e+=2,t.flags=r.readUInt16BE(e),e+=2,r.readUInt8(e)!==M.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,t.algorithm=r.readUInt8(e),e+=1,t.key=r.slice(e,n+i+2),e+=t.key.length,M.decode.bytes=e-n,t};M.decode.bytes=0;M.encodingLength=function(r){return 6+w.byteLength(r.key)};var re=y.rrsig={};re.encode=function(r,e,n){e||(e=w.alloc(re.encodingLength(r))),n||(n=0);let t=n,i=r.signature;if(!w.isBuffer(i))throw new Error("Signature must be a Buffer");return n+=2,e.writeUInt16BE(Ie.toType(r.typeCovered),n),n+=2,e.writeUInt8(r.algorithm,n),n+=1,e.writeUInt8(r.labels,n),n+=1,e.writeUInt32BE(r.originalTTL,n),n+=4,e.writeUInt32BE(r.expiration,n),n+=4,e.writeUInt32BE(r.inception,n),n+=4,e.writeUInt16BE(r.keyTag,n),n+=2,h.encode(r.signersName,e,n),n+=h.encode.bytes,i.copy(e,n,0,i.length),n+=i.length,re.encode.bytes=n-t,e.writeUInt16BE(re.encode.bytes-2,t),e};re.encode.bytes=0;re.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);return e+=2,t.typeCovered=Ie.toString(r.readUInt16BE(e)),e+=2,t.algorithm=r.readUInt8(e),e+=1,t.labels=r.readUInt8(e),e+=1,t.originalTTL=r.readUInt32BE(e),e+=4,t.expiration=r.readUInt32BE(e),e+=4,t.inception=r.readUInt32BE(e),e+=4,t.keyTag=r.readUInt16BE(e),e+=2,t.signersName=h.decode(r,e),e+=h.decode.bytes,t.signature=r.slice(e,n+i+2),e+=t.signature.length,re.decode.bytes=e-n,t};re.decode.bytes=0;re.encodingLength=function(r){return 20+h.encodingLength(r.signersName)+w.byteLength(r.signature)};var ne=y.rp={};ne.encode=function(r,e,n){e||(e=w.alloc(ne.encodingLength(r))),n||(n=0);let t=n;return n+=2,h.encode(r.mbox||".",e,n,{mail:!0}),n+=h.encode.bytes,h.encode(r.txt||".",e,n),n+=h.encode.bytes,ne.encode.bytes=n-t,e.writeUInt16BE(ne.encode.bytes-2,t),e};ne.encode.bytes=0;ne.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.mbox=h.decode(r,e,{mail:!0})||".",e+=h.decode.bytes,t.txt=h.decode(r,e)||".",e+=h.decode.bytes,ne.decode.bytes=e-n,t};ne.decode.bytes=0;ne.encodingLength=function(r){return 2+h.encodingLength(r.mbox||".")+h.encodingLength(r.txt||".")};var N={};N.encode=function(r,e,n){e||(e=w.alloc(N.encodingLength(r))),n||(n=0);let t=n;for(var i=[],o=0;o<r.length;o++){var s=Ie.toType(r[o]);i[s>>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(o=0;o<i.length;o++)if(i[o]!==void 0){var l=w.from(i[o]);e.writeUInt8(o,n),n+=1,e.writeUInt8(l.length,n),n+=1,l.copy(e,n),n+=l.length}return N.encode.bytes=n-t,e};N.encode.bytes=0;N.decode=function(r,e,n){e||(e=0);let t=e;for(var i=[];e-t<n;){var o=r.readUInt8(e);e+=1;var s=r.readUInt8(e);e+=1;for(var l=0;l<s;l++)for(var m=r.readUInt8(e+l),E=0;E<8;E++)if(m&1<<7-E){var p=Ie.toString(o<<8|l<<3|E);i.push(p)}e+=s}return N.decode.bytes=e-t,i};N.decode.bytes=0;N.encodingLength=function(r){for(var e=[],n=0;n<r.length;n++){var t=Ie.toType(r[n]);e[t>>8]=Math.max(e[t>>8]||0,t&255)}var i=0;for(n=0;n<e.length;n++)e[n]!==void 0&&(i+=2+Math.ceil((e[n]+1)/8));return i};var te=y.nsec={};te.encode=function(r,e,n){e||(e=w.alloc(te.encodingLength(r))),n||(n=0);let t=n;return n+=2,h.encode(r.nextDomain,e,n),n+=h.encode.bytes,N.encode(r.rrtypes,e,n),n+=N.encode.bytes,te.encode.bytes=n-t,e.writeUInt16BE(te.encode.bytes-2,t),e};te.encode.bytes=0;te.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);return e+=2,t.nextDomain=h.decode(r,e),e+=h.decode.bytes,t.rrtypes=N.decode(r,e,i-(e-n)),e+=N.decode.bytes,te.decode.bytes=e-n,t};te.decode.bytes=0;te.encodingLength=function(r){return 2+h.encodingLength(r.nextDomain)+N.encodingLength(r.rrtypes)};var ie=y.nsec3={};ie.encode=function(r,e,n){e||(e=w.alloc(ie.encodingLength(r))),n||(n=0);let t=n,i=r.salt;if(!w.isBuffer(i))throw new Error("salt must be a Buffer");let o=r.nextDomain;if(!w.isBuffer(o))throw new Error("nextDomain must be a Buffer");return n+=2,e.writeUInt8(r.algorithm,n),n+=1,e.writeUInt8(r.flags,n),n+=1,e.writeUInt16BE(r.iterations,n),n+=2,e.writeUInt8(i.length,n),n+=1,i.copy(e,n,0,i.length),n+=i.length,e.writeUInt8(o.length,n),n+=1,o.copy(e,n,0,o.length),n+=o.length,N.encode(r.rrtypes,e,n),n+=N.encode.bytes,ie.encode.bytes=n-t,e.writeUInt16BE(ie.encode.bytes-2,t),e};ie.encode.bytes=0;ie.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);e+=2,t.algorithm=r.readUInt8(e),e+=1,t.flags=r.readUInt8(e),e+=1,t.iterations=r.readUInt16BE(e),e+=2;let o=r.readUInt8(e);e+=1,t.salt=r.slice(e,e+o),e+=o;let s=r.readUInt8(e);return e+=1,t.nextDomain=r.slice(e,e+s),e+=s,t.rrtypes=N.decode(r,e,i-(e-n)),e+=N.decode.bytes,ie.decode.bytes=e-n,t};ie.decode.bytes=0;ie.encodingLength=function(r){return 8+r.salt.length+r.nextDomain.length+N.encodingLength(r.rrtypes)};var oe=y.ds={};oe.encode=function(r,e,n){e||(e=w.alloc(oe.encodingLength(r))),n||(n=0);let t=n,i=r.digest;if(!w.isBuffer(i))throw new Error("Digest must be a Buffer");return n+=2,e.writeUInt16BE(r.keyTag,n),n+=2,e.writeUInt8(r.algorithm,n),n+=1,e.writeUInt8(r.digestType,n),n+=1,i.copy(e,n,0,i.length),n+=i.length,oe.encode.bytes=n-t,e.writeUInt16BE(oe.encode.bytes-2,t),e};oe.encode.bytes=0;oe.decode=function(r,e){e||(e=0);let n=e;var t={},i=r.readUInt16BE(e);return e+=2,t.keyTag=r.readUInt16BE(e),e+=2,t.algorithm=r.readUInt8(e),e+=1,t.digestType=r.readUInt8(e),e+=1,t.digest=r.slice(e,n+i+2),e+=t.digest.length,oe.decode.bytes=e-n,t};oe.decode.bytes=0;oe.encodingLength=function(r){return 6+w.byteLength(r.digest)};var H=y.sshfp={};H.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};H.encode=function(e,n,t){n||(n=w.alloc(H.encodingLength(e))),t||(t=0);let i=t;t+=2,n[t]=e.algorithm,t+=1,n[t]=e.hash,t+=1;let o=w.from(e.fingerprint.toUpperCase(),"hex");if(o.length!==H.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return o.copy(n,t),t+=o.byteLength,H.encode.bytes=t-i,n.writeUInt16BE(H.encode.bytes-2,i),n};H.encode.bytes=0;H.decode=function(e,n){n||(n=0);let t=n,i={};n+=2,i.algorithm=e[n],n+=1,i.hash=e[n],n+=1;let o=H.getFingerprintLengthForHashType(i.hash);return i.fingerprint=e.slice(n,n+o).toString("hex").toUpperCase(),n+=o,H.decode.bytes=n-t,i};H.decode.bytes=0;H.encodingLength=function(r){return 4+w.from(r.fingerprint,"hex").byteLength};var ce=y.naptr={};ce.encode=function(r,e,n){e||(e=w.alloc(ce.encodingLength(r))),n||(n=0);let t=n;return n+=2,e.writeUInt16BE(r.order||0,n),n+=2,e.writeUInt16BE(r.preference||0,n),n+=2,x.encode(r.flags,e,n),n+=x.encode.bytes,x.encode(r.services,e,n),n+=x.encode.bytes,x.encode(r.regexp,e,n),n+=x.encode.bytes,h.encode(r.replacement,e,n),n+=h.encode.bytes,ce.encode.bytes=n-t,e.writeUInt16BE(ce.encode.bytes-2,t),e};ce.encode.bytes=0;ce.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.order=r.readUInt16BE(e),e+=2,t.preference=r.readUInt16BE(e),e+=2,t.flags=x.decode(r,e),e+=x.decode.bytes,t.services=x.decode(r,e),e+=x.decode.bytes,t.regexp=x.decode(r,e),e+=x.decode.bytes,t.replacement=h.decode(r,e),e+=h.decode.bytes,ce.decode.bytes=e-n,t};ce.decode.bytes=0;ce.encodingLength=function(r){return x.encodingLength(r.flags)+x.encodingLength(r.services)+x.encodingLength(r.regexp)+h.encodingLength(r.replacement)+6};var se=y.tlsa={};se.encode=function(r,e,n){e||(e=w.alloc(se.encodingLength(r))),n||(n=0);let t=n,i=r.certificate;if(!w.isBuffer(i))throw new Error("Certificate must be a Buffer");return n+=2,e.writeUInt8(r.usage,n),n+=1,e.writeUInt8(r.selector,n),n+=1,e.writeUInt8(r.matchingType,n),n+=1,i.copy(e,n,0,i.length),n+=i.length,se.encode.bytes=n-t,e.writeUInt16BE(se.encode.bytes-2,t),e};se.encode.bytes=0;se.decode=function(r,e){e||(e=0);let n=e,t={},i=r.readUInt16BE(e);return e+=2,t.usage=r.readUInt8(e),e+=1,t.selector=r.readUInt8(e),e+=1,t.matchingType=r.readUInt8(e),e+=1,t.certificate=r.slice(e,n+i+2),e+=t.certificate.length,se.decode.bytes=e-n,t};se.decode.bytes=0;se.encodingLength=function(r){return 5+w.byteLength(r.certificate)};var zr=y.record=function(r){switch(r.toUpperCase()){case"A":return we;case"PTR":return J;case"CNAME":return $i;case"DNAME":return Vi;case"TXT":return pe;case"NULL":return ge;case"AAAA":return Ee;case"SRV":return ye;case"HINFO":return me;case"CAA":return K;case"NS":return ue;case"SOA":return he;case"MX":return ve;case"OPT":return Y;case"DNSKEY":return M;case"RRSIG":return re;case"RP":return ne;case"NSEC":return te;case"NSEC3":return ie;case"SSHFP":return H;case"DS":return oe;case"NAPTR":return ce;case"TLSA":return se}return le},D=y.answer={};D.encode=function(r,e,n){e||(e=w.alloc(D.encodingLength(r))),n||(n=0);let t=n;if(h.encode(r.name,e,n),n+=h.encode.bytes,e.writeUInt16BE(Ie.toType(r.type),n),r.type.toUpperCase()==="OPT"){if(r.name!==".")throw new Error("OPT name must be root.");e.writeUInt16BE(r.udpPayloadSize||4096,n+2),e.writeUInt8(r.extendedRcode||0,n+4),e.writeUInt8(r.ednsVersion||0,n+5),e.writeUInt16BE(r.flags||0,n+6),n+=8,Y.encode(r.options||[],e,n),n+=Y.encode.bytes}else{let i=ur.toClass(r.class===void 0?"IN":r.class);r.flush&&(i|=qr),e.writeUInt16BE(i,n+2),e.writeUInt32BE(r.ttl||0,n+4),n+=8;let o=zr(r.type);o.encode(r.data,e,n),n+=o.encode.bytes}return D.encode.bytes=n-t,e};D.encode.bytes=0;D.decode=function(r,e){e||(e=0);let n={},t=e;if(n.name=h.decode(r,e),e+=h.decode.bytes,n.type=Ie.toString(r.readUInt16BE(e)),n.type==="OPT")n.udpPayloadSize=r.readUInt16BE(e+2),n.extendedRcode=r.readUInt8(e+4),n.ednsVersion=r.readUInt8(e+5),n.flags=r.readUInt16BE(e+6),n.flag_do=(n.flags>>15&1)===1,n.options=Y.decode(r,e+8),e+=8+Y.decode.bytes;else{let i=r.readUInt16BE(e+2);n.ttl=r.readUInt32BE(e+4),n.class=ur.toString(i&qi),n.flush=!!(i&qr);let o=zr(n.type);n.data=o.decode(r,e+8),e+=8+o.decode.bytes}return D.decode.bytes=e-t,n};D.decode.bytes=0;D.encodingLength=function(r){let e=r.data!==null&&r.data!==void 0?r.data:r.options;return h.encodingLength(r.name)+8+zr(r.type).encodingLength(e)};var Z=y.question={};Z.encode=function(r,e,n){e||(e=w.alloc(Z.encodingLength(r))),n||(n=0);let t=n;return h.encode(r.name,e,n),n+=h.encode.bytes,e.writeUInt16BE(Ie.toType(r.type),n),n+=2,e.writeUInt16BE(ur.toClass(r.class===void 0?"IN":r.class),n),n+=2,Z.encode.bytes=n-t,r};Z.encode.bytes=0;Z.decode=function(r,e){e||(e=0);let n=e,t={};return t.name=h.decode(r,e),e+=h.decode.bytes,t.type=Ie.toString(r.readUInt16BE(e)),e+=2,t.class=ur.toString(r.readUInt16BE(e)),e+=2,!!(t.class&Zn)&&(t.class&=zi),Z.decode.bytes=e-n,t};Z.decode.bytes=0;Z.encodingLength=function(r){return h.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,n){let t=!e;t&&(e=w.alloc(y.encodingLength(r))),n||(n=0);let i=n;return r.questions||(r.questions=[]),r.answers||(r.answers=[]),r.authorities||(r.authorities=[]),r.additionals||(r.additionals=[]),f.encode(r,e,n),n+=f.encode.bytes,n=He(r.questions,Z,e,n),n=He(r.answers,D,e,n),n=He(r.authorities,D,e,n),n=He(r.additionals,D,e,n),y.encode.bytes=n-i,t&&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 n=e,t=f.decode(r,e);return e+=f.decode.bytes,e=lr(t.questions,Z,r,e),e=lr(t.answers,D,r,e),e=lr(t.authorities,D,r,e),e=lr(t.additionals,D,r,e),y.decode.bytes=e-n,t};y.decode.bytes=0;y.encodingLength=function(r){return f.encodingLength(r)+Me(r.questions||[],Z)+Me(r.answers||[],D)+Me(r.authorities||[],D)+Me(r.additionals||[],D)};y.streamEncode=function(r){let e=y.encode(r),n=w.alloc(2);n.writeUInt16BE(e.byteLength);let t=w.concat([n,e]);return y.streamEncode.bytes=t.byteLength,t};y.streamEncode.bytes=0;y.streamDecode=function(r){let e=r.readUInt16BE(0);if(r.byteLength<e+2)return null;let n=y.decode(r.slice(2));return y.streamDecode.bytes=y.decode.bytes,n};y.streamDecode.bytes=0;function Me(r,e){let n=0;for(let t=0;t<r.length;t++)n+=e.encodingLength(r[t]);return n}function He(r,e,n,t){for(let i=0;i<r.length;i++)e.encode(r[i],n,t),t+=e.encode.bytes;return t}function lr(r,e,n,t){for(let i=0;i<r.length;i++)r[i]=e.decode(n,t),t+=e.decode.bytes;return t}});var nt=F((Wc,rt)=>{"use strict";var et=Xi;process.nextTick(Gi,42);rt.exports=ji;function ji(r){var e=t;return n;function n(i){e(i||Hi)}function t(i){var o=[i];e=s,r(l);function s(m){o.push(m)}function l(m){var E=arguments;for(e=Ki(m)?t:p;o.length;)p(o.shift());function p(a){et(Yi,a,E)}}}}function Ki(r){return Object.prototype.toString.call(r)==="[object Error]"}function Hi(){}function Yi(r,e){r.apply(null,e)}function Gi(r){r===42&&(et=process.nextTick)}function Xi(r,e,n){process.nextTick(function(){r(e,n)})}});var ot=F((Jc,it)=>{var $r=fn(),Qi=de("dgram"),Wi=nt(),Ji=de("events"),jr=de("os"),Vr=function(){};it.exports=function(r){r||(r={});var e=new Ji.EventEmitter,n=typeof r.port=="number"?r.port:5353,t=r.type||"udp4",i=r.ip||r.host||(t==="udp4"?"224.0.0.251":null),o={address:i,port:n},s={},l=!1,m=null;if(t==="udp6"&&(!i||!r.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var E=r.socket||Qi.createSocket({type:t,reuseAddr:r.reuseAddr!==!1,toString:function(){return t}});E.on("error",function(a){a.code==="EACCES"||a.code==="EADDRINUSE"?e.emit("error",a):e.emit("warning",a)}),E.on("message",function(a,d){try{a=$r.decode(a)}catch(u){e.emit("warning",u);return}e.emit("packet",a,d),a.type==="query"&&e.emit("query",a,d),a.type==="response"&&e.emit("response",a,d)}),E.on("listening",function(){n||(n=o.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 p=Wi(function(a){if(!n||r.bind===!1)return a(null);E.once("error",a),E.bind(n,r.bind||r.interface,function(){E.removeListener("error",a),a(null)})});return p(function(a){if(a)return e.emit("error",a);e.emit("ready")}),e.send=function(a,d,u){if(typeof d=="function")return e.send(a,null,d);u||(u=Vr),d?!d.host&&!d.address&&(d.address=o.address):d=o,p(c);function c(g){if(l)return u();if(g)return u(g);var I=$r.encode(a);E.send(I,0,I.length,d.port,d.address||d.host,u)}},e.response=e.respond=function(a,d,u){Array.isArray(a)&&(a={answers:a}),a.type="response",a.flags=(a.flags||0)|$r.AUTHORITATIVE_ANSWER,e.send(a,d,u)},e.query=function(a,d,u,c){if(typeof d=="function")return e.query(a,null,null,d);if(typeof d=="object"&&d&&d.port)return e.query(a,null,d,u);if(typeof u=="function")return e.query(a,d,null,u);c||(c=Vr),typeof a=="string"&&(a=[{name:a,type:d||"ANY"}]),Array.isArray(a)&&(a={type:"query",questions:a}),a.type="query",e.send(a,u,c)},e.destroy=function(a){if(a||(a=Vr),l)return process.nextTick(a);l=!0,clearInterval(m);for(var d in s)try{E.dropMembership(i,d)}catch{}s={},E.close(a)},e.update=function(){for(var a=r.interface?[].concat(r.interface):fi(),d=!1,u=0;u<a.length;u++){var c=a[u];if(!s[c])try{E.addMembership(i,c),s[c]=!0,d=!0}catch(g){e.emit("warning",g)}}if(d){if(E.setMulticastInterface)try{E.setMulticastInterface(r.interface||Zi())}catch(g){e.emit("warning",g)}e.emit("networkInterface")}},e};function Zi(){for(var r=jr.networkInterfaces(),e=Object.keys(r),n=0;n<e.length;n++)for(var t=r[e[n]],i=0;i<t.length;i++){var o=t[i];if(tt(o.family)&&!o.internal)return jr.platform()==="darwin"&&e[n]==="en0"?o.address:"0.0.0.0"}return"127.0.0.1"}function fi(){for(var r=jr.networkInterfaces(),e=Object.keys(r),n=[],t=0;t<e.length;t++)for(var i=r[e[t]],o=0;o<i.length;o++){var s=i[o];if(tt(s.family)){n.push(s.address);break}}return n}function tt(r){return r===4||r==="IPv4"}});var Uc={};$(Uc,{mdns:()=>vc});var tr=class extends EventTarget{#e=new Map;listenerCount(e){let n=this.#e.get(e);return n==null?0:n.length}addEventListener(e,n,t){super.addEventListener(e,n,t);let i=this.#e.get(e);i==null&&(i=[],this.#e.set(e,i)),i.push({callback:n,once:(t!==!0&&t!==!1&&t?.once)??!1})}removeEventListener(e,n,t){super.removeEventListener(e.toString(),n??null,t);let i=this.#e.get(e);i!=null&&(i=i.filter(({callback:o})=>o!==n),this.#e.set(e,i))}dispatchEvent(e){let n=super.dispatchEvent(e),t=this.#e.get(e.type);return t==null||(t=t.filter(({once:i})=>!i),this.#e.set(e.type,t)),n}safeDispatchEvent(e,n){return this.dispatchEvent(new ir(e,n))}},xr=class extends Event{detail;constructor(e,n){super(e,n),this.detail=n?.detail}},ir=globalThis.CustomEvent??xr;var Sn=Symbol.for("@libp2p/peer-discovery");var j=Ir(_n(),1);var Lr={};$(Lr,{base32:()=>W,base32hex:()=>bi,base32hexpad:()=>Li,base32hexpadupper:()=>Ti,base32hexupper:()=>Oi,base32pad:()=>Ai,base32padupper:()=>Si,base32upper:()=>Ui,base32z:()=>Bi});function Ei(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),t=0;t<n.length;t++)n[t]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),s=o.charCodeAt(0);if(n[s]!==255)throw new TypeError(o+" is ambiguous");n[s]=i}var l=r.length,m=r.charAt(0),E=Math.log(l)/Math.log(256),p=Math.log(256)/Math.log(l);function a(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 g=0,I=0,C=0,U=c.length;C!==U&&c[C]===0;)C++,g++;for(var B=(U-C)*p+1>>>0,S=new Uint8Array(B);C!==U;){for(var L=c[C],b=0,z=B-1;(L!==0||b<I)&&z!==-1;z--,b++)L+=256*S[z]>>>0,S[z]=L%l>>>0,L=L/l>>>0;if(L!==0)throw new Error("Non-zero carry");I=b,C++}for(var G=B-I;G!==B&&S[G]===0;)G++;for(var Ne=m.repeat(g);G<B;++G)Ne+=r.charAt(S[G]);return Ne}function d(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var g=0;if(c[g]!==" "){for(var I=0,C=0;c[g]===m;)I++,g++;for(var U=(c.length-g)*E+1>>>0,B=new Uint8Array(U);c[g];){var S=n[c.charCodeAt(g)];if(S===255)return;for(var L=0,b=U-1;(S!==0||L<C)&&b!==-1;b--,L++)S+=l*B[b]>>>0,B[b]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");C=L,g++}if(c[g]!==" "){for(var z=U-C;z!==U&&B[z]===0;)z++;for(var G=new Uint8Array(I+(U-z)),Ne=I;z!==U;)G[Ne++]=B[z++];return G}}}function u(c){var g=d(c);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:a,decodeUnsafe:d,decode:u}}var Ii=Ei,xi=Ii,Mn=xi;var Dc=new Uint8Array(0);var kn=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let n=0;n<r.byteLength;n++)if(r[n]!==e[n])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 qn=r=>new TextEncoder().encode(r),zn=r=>new TextDecoder().decode(r);var Ar=class{constructor(e,n,t){this.name=e,this.prefix=n,this.baseEncode=t}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Sr=class{constructor(e,n,t){if(this.name=e,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=t}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 Vn(this,e)}},br=class{constructor(e){this.decoders=e}or(e){return Vn(this,e)}decode(e){let n=e[0],t=this.decoders[n];if(t)return t.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Vn=(r,e)=>new br({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Or=class{constructor(e,n,t,i){this.name=e,this.prefix=n,this.baseEncode=t,this.baseDecode=i,this.encoder=new Ar(e,n,t),this.decoder=new Sr(e,n,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},_e=({name:r,prefix:e,encode:n,decode:t})=>new Or(r,e,n,t),Ce=({prefix:r,name:e,alphabet:n})=>{let{encode:t,decode:i}=Mn(n,e);return _e({prefix:r,name:e,encode:t,decode:o=>X(i(o))})},Ci=(r,e,n,t)=>{let i={};for(let p=0;p<e.length;++p)i[e[p]]=p;let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*n/8|0),l=0,m=0,E=0;for(let p=0;p<o;++p){let a=i[r[p]];if(a===void 0)throw new SyntaxError(`Non-${t} character`);m=m<<n|a,l+=n,l>=8&&(l-=8,s[E++]=255&m>>l)}if(l>=n||255&m<<8-l)throw new SyntaxError("Unexpected end of data");return s},vi=(r,e,n)=>{let t=e[e.length-1]==="=",i=(1<<n)-1,o="",s=0,l=0;for(let m=0;m<r.length;++m)for(l=l<<8|r[m],s+=8;s>n;)s-=n,o+=e[i&l>>s];if(s&&(o+=e[i&l<<n-s]),t)for(;o.length*n&7;)o+="=";return o},O=({name:r,prefix:e,bitsPerChar:n,alphabet:t})=>_e({prefix:e,name:r,encode(i){return vi(i,t,n)},decode(i){return Ci(i,t,n,r)}});var W=O({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ui=O({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ai=O({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Si=O({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),bi=O({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Oi=O({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Li=O({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ti=O({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Bi=O({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Tr={};$(Tr,{base58btc:()=>T,base58flickr:()=>Ni});var T=Ce({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ni=Ce({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Nr={};$(Nr,{base64:()=>Br,base64pad:()=>Pi,base64url:()=>Di,base64urlpad:()=>Fi});var Br=O({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Pi=O({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Di=O({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Fi=O({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});j.default.formatters.b=r=>r==null?"undefined":T.baseEncode(r);j.default.formatters.t=r=>r==null?"undefined":W.baseEncode(r);j.default.formatters.m=r=>r==null?"undefined":Br.baseEncode(r);j.default.formatters.p=r=>r==null?"undefined":r.toString();j.default.formatters.c=r=>r==null?"undefined":r.toString();j.default.formatters.k=r=>r==null?"undefined":r.toString();j.default.formatters.a=r=>r==null?"undefined":r.toString();function Ri(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 dr(r){let e=Ri(`${r}:trace`);return j.default.enabled(`${r}:trace`)&&j.default.names.map(n=>n.toString()).find(n=>n.includes(":trace"))!=null&&(e=(0,j.default)(`${r}:trace`)),Object.assign((0,j.default)(r),{error:(0,j.default)(`${r}:error`),trace:e})}var Vt=Ir(ot(),1);var Ye=class extends Error{code;props;constructor(e,n,t){super(e),this.code=n,this.name=t?.name??"CodeError",this.props=t??{}}};var ct=Symbol.for("@libp2p/peer-id");var Kr={};$(Kr,{identity:()=>eo});var eo=_e({prefix:"\0",name:"identity",encode:r=>zn(r),decode:r=>qn(r)});var Hr={};$(Hr,{base2:()=>ro});var ro=O({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Yr={};$(Yr,{base8:()=>no});var no=O({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Gr={};$(Gr,{base10:()=>to});var to=Ce({prefix:"9",name:"base10",alphabet:"0123456789"});var Xr={};$(Xr,{base16:()=>io,base16upper:()=>oo});var io=O({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),oo=O({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Qr={};$(Qr,{base36:()=>co,base36upper:()=>so});var co=Ce({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),so=Ce({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Wr={};$(Wr,{base256emoji:()=>po});var st=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}"),ao=st.reduce((r,e,n)=>(r[n]=e,r),[]),lo=st.reduce((r,e,n)=>(r[e.codePointAt(0)]=n,r),[]);function uo(r){return r.reduce((e,n)=>(e+=ao[n],e),"")}function ho(r){let e=[];for(let n of r){let t=lo[n.codePointAt(0)];if(t===void 0)throw new Error(`Non-base256emoji character: ${n}`);e.push(t)}return new Uint8Array(e)}var po=_e({prefix:"\u{1F680}",name:"base256emoji",encode:uo,decode:ho});var rn={};$(rn,{sha256:()=>pr,sha512:()=>Po});var en=Ir(de("crypto"),1);var go=lt,at=128,mo=127,yo=~mo,wo=Math.pow(2,31);function lt(r,e,n){e=e||[],n=n||0;for(var t=n;r>=wo;)e[n++]=r&255|at,r/=128;for(;r&yo;)e[n++]=r&255|at,r>>>=7;return e[n]=r|0,lt.bytes=n-t+1,e}var Eo=Jr,Io=128,dt=127;function Jr(r,t){var n=0,t=t||0,i=0,o=t,s,l=r.length;do{if(o>=l)throw Jr.bytes=0,new RangeError("Could not decode varint");s=r[o++],n+=i<28?(s&dt)<<i:(s&dt)*Math.pow(2,i),i+=7}while(s>=Io);return Jr.bytes=o-t,n}var xo=Math.pow(2,7),Co=Math.pow(2,14),vo=Math.pow(2,21),Uo=Math.pow(2,28),Ao=Math.pow(2,35),So=Math.pow(2,42),bo=Math.pow(2,49),Oo=Math.pow(2,56),Lo=Math.pow(2,63),To=function(r){return r<xo?1:r<Co?2:r<vo?3:r<Uo?4:r<Ao?5:r<So?6:r<bo?7:r<Oo?8:r<Lo?9:10},Bo={encode:go,decode:Eo,encodingLength:To},No=Bo,Ge=No;var Xe=(r,e=0)=>[Ge.decode(r,e),Ge.decode.bytes],ke=(r,e,n=0)=>(Ge.encode(r,e,n),e),qe=r=>Ge.encodingLength(r);var Ue=(r,e)=>{let n=e.byteLength,t=qe(r),i=t+qe(n),o=new Uint8Array(i+n);return ke(r,o,0),ke(n,o,t),o.set(e,i),new ze(r,n,e,o)},Le=r=>{let e=X(r),[n,t]=Xe(e),[i,o]=Xe(e.subarray(t)),s=e.subarray(t+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new ze(n,i,s,e)},ut=(r,e)=>{if(r===e)return!0;{let n=e;return r.code===n.code&&r.size===n.size&&n.bytes instanceof Uint8Array&&kn(r.bytes,n.bytes)}},ze=class{constructor(e,n,t,i){this.code=e,this.size=n,this.digest=t,this.bytes=i}};var fr=({name:r,code:e,encode:n})=>new Zr(r,e,n),Zr=class{constructor(e,n,t){this.name=e,this.code=n,this.encode=t}digest(e){if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?Ue(this.code,n):n.then(t=>Ue(this.code,t))}else throw Error("Unknown type, must be binary type")}};var pr=fr({name:"sha2-256",code:18,encode:r=>X(en.default.createHash("sha256").update(r).digest())}),Po=fr({name:"sha2-512",code:19,encode:r=>X(en.default.createHash("sha512").update(r).digest())});var nn={};$(nn,{identity:()=>gr});var pt=0,Do="identity",gt=X,Fo=r=>Ue(pt,gt(r)),gr={code:pt,name:Do,encode:gt,digest:Fo};var ms=new TextEncoder,ys=new TextDecoder;var mt=(r,e)=>{let{bytes:n,version:t}=r;switch(t){case 0:return ko(n,tn(r),e||T.encoder);default:return qo(n,tn(r),e||W.encoder)}};var yt=new WeakMap,tn=r=>{let e=yt.get(r);if(e==null){let n=new Map;return yt.set(r,n),n}return e},ee=class r{constructor(e,n,t,i){this.code=n,this.version=e,this.multihash=t,this.bytes=i,this["/"]=i}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:n}=this;if(e!==Qe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==zo)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(n)}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:n}=this.multihash,t=Ue(e,n);return r.createV1(this.code,t)}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,n){let t=n;return t&&e.code===t.code&&e.version===t.version&&ut(e.multihash,t.multihash)}toString(e){return mt(this,e)}toJSON(){return{"/":mt(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 n=e;if(n instanceof r)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){let{version:t,code:i,multihash:o,bytes:s}=n;return new r(t,i,o,s||wt(t,i,o.bytes))}else if(n[$o]===!0){let{version:t,multihash:i,code:o}=n,s=Le(i);return r.create(t,o,s)}else return null}static create(e,n,t){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(t.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(n!==Qe)throw new Error(`Version 0 CID must use dag-pb (code: ${Qe}) block encoding`);return new r(e,n,t,t.bytes)}case 1:{let i=wt(e,n,t.bytes);return new r(e,n,t,i)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Qe,e)}static createV1(e,n){return r.create(1,e,n)}static decode(e){let[n,t]=r.decodeFirst(e);if(t.length)throw new Error("Incorrect length");return n}static decodeFirst(e){let n=r.inspectBytes(e),t=n.size-n.multihashSize,i=X(e.subarray(t,t+n.multihashSize));if(i.byteLength!==n.multihashSize)throw new Error("Incorrect length");let o=i.subarray(n.multihashSize-n.digestSize),s=new ze(n.multihashCode,n.digestSize,o,i);return[n.version===0?r.createV0(s):r.createV1(n.codec,s),e.subarray(n.size)]}static inspectBytes(e){let n=0,t=()=>{let[a,d]=Xe(e.subarray(n));return n+=d,a},i=t(),o=Qe;if(i===18?(i=0,n=0):o=t(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=n,l=t(),m=t(),E=n+m,p=E-s;return{version:i,codec:o,multihashCode:l,digestSize:m,multihashSize:p,size:E}}static parse(e,n){let[t,i]=Mo(e,n),o=r.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return tn(o).set(t,e),o}},Mo=(r,e)=>{switch(r[0]){case"Q":{let n=e||T;return[T.prefix,n.decode(`${T.prefix}${r}`)]}case T.prefix:{let n=e||T;return[T.prefix,n.decode(r)]}case W.prefix:{let n=e||W;return[W.prefix,n.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)]}}},ko=(r,e,n)=>{let{prefix:t}=n;if(t!==T.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);let i=e.get(t);if(i==null){let o=n.encode(r).slice(1);return e.set(t,o),o}else return i},qo=(r,e,n)=>{let{prefix:t}=n,i=e.get(t);if(i==null){let o=n.encode(r);return e.set(t,o),o}else return i},Qe=112,zo=18,wt=(r,e,n)=>{let t=qe(r),i=t+qe(e),o=new Uint8Array(i+n.byteLength);return ke(r,o,0),ke(e,o,t),o.set(n,i),o},$o=Symbol.for("@ipld/js-cid/CID");var Ae={...Kr,...Hr,...Yr,...Gr,...Xr,...Lr,...Qr,...Tr,...Nr,...Wr},bs={...rn,...nn};function We(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let n=0;n<r.byteLength;n++)if(r[n]!==e[n])return!1;return!0}var Vo=Symbol.for("nodejs.util.inspect.custom"),Et=Object.values(Ae).map(r=>r.decoder).reduce((r,e)=>r.or(e),Ae.identity.decoder),It=114,xt=36,Ct=37,Je=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()})`}[ct]=!0;toString(){return this.string==null&&(this.string=T.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return ee.createV1(It,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return We(this.multihash.bytes,e);if(typeof e=="string")return on(e).equals(this);if(e?.multihash?.bytes!=null)return We(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Vo](){return`PeerId(${this.toString()})`}},Ze=class extends Je{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},fe=class extends Je{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},er=class extends Je{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function on(r,e){if(e=e??Et,r.charAt(0)==="1"||r.charAt(0)==="Q"){let n=Le(T.decode(`z${r}`));return r.startsWith("12D")?new fe({multihash:n}):r.startsWith("16U")?new er({multihash:n}):new Ze({multihash:n})}return jo(Et.decode(r))}function jo(r){try{let e=Le(r);if(e.code===gr.code){if(e.digest.length===xt)return new fe({multihash:e});if(e.digest.length===Ct)return new er({multihash:e})}if(e.code===pr.code)return new Ze({multihash:e})}catch{return Ko(ee.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Ko(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==It)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===pr.code)return new Ze({multihash:r.multihash});if(e.code===gr.code){if(e.digest.length===xt)return new fe({multihash:r.multihash});if(e.digest.length===Ct)return new er({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}function $e(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Ve(r=0){return globalThis.Buffer?.allocUnsafe!=null?$e(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ut(r,e,n,t){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:n},decoder:{decode:t}}}var vt=Ut("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),cn=Ut("ascii","a",r=>{let e="a";for(let n=0;n<r.length;n++)e+=String.fromCharCode(r[n]);return e},r=>{r=r.substring(1);let e=Ve(r.length);for(let n=0;n<r.length;n++)e[n]=r.charCodeAt(n);return e}),Ho={utf8:vt,"utf-8":vt,hex:Ae.base16,latin1:cn,ascii:cn,binary:cn,...Ae},mr=Ho;function q(r,e="utf8"){let n=mr[e];if(n==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"):n.encoder.encode(r).substring(1)}var Yo=Math.pow(2,7),Go=Math.pow(2,14),Xo=Math.pow(2,21),sn=Math.pow(2,28),an=Math.pow(2,35),dn=Math.pow(2,42),ln=Math.pow(2,49),v=128,_=127;function ae(r){if(r<Yo)return 1;if(r<Go)return 2;if(r<Xo)return 3;if(r<sn)return 4;if(r<an)return 5;if(r<dn)return 6;if(r<ln)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Qo(r,e,n=0){switch(ae(r)){case 8:e[n++]=r&255|v,r/=128;case 7:e[n++]=r&255|v,r/=128;case 6:e[n++]=r&255|v,r/=128;case 5:e[n++]=r&255|v,r/=128;case 4:e[n++]=r&255|v,r>>>=7;case 3:e[n++]=r&255|v,r>>>=7;case 2:e[n++]=r&255|v,r>>>=7;case 1:{e[n++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Wo(r,e,n=0){switch(ae(r)){case 8:e.set(n++,r&255|v),r/=128;case 7:e.set(n++,r&255|v),r/=128;case 6:e.set(n++,r&255|v),r/=128;case 5:e.set(n++,r&255|v),r/=128;case 4:e.set(n++,r&255|v),r>>>=7;case 3:e.set(n++,r&255|v),r>>>=7;case 2:e.set(n++,r&255|v),r>>>=7;case 1:{e.set(n++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function Jo(r,e){let n=r[e],t=0;if(t+=n&_,n<v||(n=r[e+1],t+=(n&_)<<7,n<v)||(n=r[e+2],t+=(n&_)<<14,n<v)||(n=r[e+3],t+=(n&_)<<21,n<v)||(n=r[e+4],t+=(n&_)*sn,n<v)||(n=r[e+5],t+=(n&_)*an,n<v)||(n=r[e+6],t+=(n&_)*dn,n<v)||(n=r[e+7],t+=(n&_)*ln,n<v))return t;throw new RangeError("Could not decode varint")}function Zo(r,e){let n=r.get(e),t=0;if(t+=n&_,n<v||(n=r.get(e+1),t+=(n&_)<<7,n<v)||(n=r.get(e+2),t+=(n&_)<<14,n<v)||(n=r.get(e+3),t+=(n&_)<<21,n<v)||(n=r.get(e+4),t+=(n&_)*sn,n<v)||(n=r.get(e+5),t+=(n&_)*an,n<v)||(n=r.get(e+6),t+=(n&_)*dn,n<v)||(n=r.get(e+7),t+=(n&_)*ln,n<v))return t;throw new RangeError("Could not decode varint")}function je(r,e,n=0){return e==null&&(e=Ve(ae(r))),e instanceof Uint8Array?Qo(r,e,n):Wo(r,e,n)}function Be(r,e=0){return r instanceof Uint8Array?Jo(r,e):Zo(r,e)}function xe(r,e){e==null&&(e=r.reduce((i,o)=>i+o.length,0));let n=Ve(e),t=0;for(let i of r)n.set(i,t),t+=i.length;return $e(n)}var yr=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let n=this.index,t=e();return t===void 0&&(this.index=n),t}parseWith(e){let n=e();if(this.index===this.input.length)return n}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 n=this.readChar();if(n===e)return n})}readSeparator(e,n,t){return this.readAtomically(()=>{if(!(n>0&&this.readGivenChar(e)===void 0))return t()})}readNumber(e,n,t,i){return this.readAtomically(()=>{let o=0,s=0,l=this.peekChar();if(l===void 0)return;let m=l==="0",E=2**(8*i)-1;for(;;){let p=this.readAtomically(()=>{let a=this.readChar();if(a===void 0)return;let d=Number.parseInt(a,e);if(!Number.isNaN(d))return d});if(p===void 0)break;if(o*=e,o+=p,o>E||(s+=1,n!==void 0&&s>n))return}if(s!==0)return!t&&m&&s>1?void 0:o})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let n=0;n<e.length;n++){let t=this.readSeparator(".",n,()=>this.readNumber(10,3,!1,1));if(t===void 0)return;e[n]=t}return e})}readIPv6Addr(){let e=n=>{for(let t=0;t<n.length/2;t++){let i=t*2;if(t<n.length-3){let s=this.readSeparator(":",t,()=>this.readIPv4Addr());if(s!==void 0)return n[i]=s[0],n[i+1]=s[1],n[i+2]=s[2],n[i+3]=s[3],[i+4,!0]}let o=this.readSeparator(":",t,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];n[i]=o>>8,n[i+1]=o&255}return[n.length,!1]};return this.readAtomically(()=>{let n=new Uint8Array(16),[t,i]=e(n);if(t===16)return n;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),s=16-(t+2),[l]=e(o.subarray(0,s));return n.set(o.subarray(0,l),16-l),n})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Zs=new yr;var ca=parseInt("0xFFFF",16),sa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function un(r,e="utf8"){let n=mr[e];if(n==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?$e(globalThis.Buffer.from(r,"utf-8")):n.decoder.decode(`${n.prefix}${r}`)}var Se=de("node:net");function wr(r){return!!(0,Se.isIP)(r)}var Ot=Se.isIPv4,ic=Se.isIPv6,hn=function(r){let e=0;if(r=r.toString().trim(),Ot(r)){let n=new Uint8Array(e+4);return r.split(/\./g).forEach(t=>{n[e++]=parseInt(t,10)&255}),n}if(ic(r)){let n=r.split(":",8),t;for(t=0;t<n.length;t++){let o=Ot(n[t]),s;o&&(s=hn(n[t]),n[t]=q(s.slice(0,2),"base16")),s!=null&&++t<8&&n.splice(t,0,q(s.slice(2,4),"base16"))}if(n[0]==="")for(;n.length<8;)n.unshift("0");else if(n[n.length-1]==="")for(;n.length<8;)n.push("0");else if(n.length<8){for(t=0;t<n.length&&n[t]!=="";t++);let o=[t,1];for(t=9-n.length;t>0;t--)o.push("0");n.splice.apply(n,o)}let i=new Uint8Array(e+16);for(t=0;t<n.length;t++){let o=parseInt(n[t],16);i[e++]=o>>8&255,i[e++]=o&255}return i}throw new Error("invalid ip address")},Lt=function(r,e=0,n){e=~~e,n=n??r.length-e;let t=new DataView(r.buffer);if(n===4){let i=[];for(let o=0;o<n;o++)i.push(r[e+o]);return i.join(".")}if(n===16){let i=[];for(let o=0;o<n;o+=2)i.push(t.getUint16(e+o).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ke={},pn={},cc=[[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"]];cc.forEach(r=>{let e=sc(...r);pn[e.code]=e,Ke[e.name]=e});function sc(r,e,n,t,i){return{code:r,size:e,name:n,resolvable:!!t,path:!!i}}function A(r){if(typeof r=="number"){if(pn[r]!=null)return pn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ke[r]!=null)return Ke[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Xa=A("ip4"),Qa=A("ip6"),Wa=A("ipcidr");function mn(r,e){switch(A(r).code){case 4:case 41:return dc(e);case 42:return Nt(e);case 6:case 273:case 33:case 132:return Dt(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Nt(e);case 421:return pc(e);case 444:return Pt(e);case 445:return Pt(e);case 466:return hc(e);default:return q(e,"base16")}}function yn(r,e){switch(A(r).code){case 4:return Tt(e);case 41:return Tt(e);case 42:return Bt(e);case 6:case 273:case 33:case 132:return wn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Bt(e);case 421:return lc(e);case 444:return gc(e);case 445:return mc(e);case 466:return uc(e);default:return un(e,"base16")}}var gn=Object.values(Ae).map(r=>r.decoder),ac=function(){let r=gn[0].or(gn[1]);return gn.slice(2).forEach(e=>r=r.or(e)),r}();function Tt(r){if(!wr(r))throw new Error("invalid ip address");return hn(r)}function dc(r){let e=Lt(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!wr(e))throw new Error("invalid ip address");return e}function wn(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Dt(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Bt(r){let e=un(r),n=Uint8Array.from(je(e.length));return xe([n,e],n.length+e.length)}function Nt(r){let e=Be(r);if(r=r.slice(ae(e)),r.length!==e)throw new Error("inconsistent lengths");return q(r)}function lc(r){let e;r[0]==="Q"||r[0]==="1"?e=Le(T.decode(`z${r}`)).bytes:e=ee.parse(r).multihash.bytes;let n=Uint8Array.from(je(e.length));return xe([n,e],n.length+e.length)}function uc(r){let e=ac.decode(r),n=Uint8Array.from(je(e.length));return xe([n,e],n.length+e.length)}function hc(r){let e=Be(r),n=r.slice(ae(e));if(n.length!==e)throw new Error("inconsistent lengths");return"u"+q(n,"base64url")}function pc(r){let e=Be(r),n=r.slice(ae(e));if(n.length!==e)throw new Error("inconsistent lengths");return q(n,"base58btc")}function gc(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 n=W.decode("b"+e[0]),t=parseInt(e[1],10);if(t<1||t>65536)throw new Error("Port number is not in range(1, 65536)");let i=wn(t);return xe([n,i],n.length+i.length)}function mc(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 n=W.decode(`b${e[0]}`),t=parseInt(e[1],10);if(t<1||t>65536)throw new Error("Port number is not in range(1, 65536)");let i=wn(t);return xe([n,i],n.length+i.length)}function Pt(r){let e=r.slice(0,r.length-2),n=r.slice(r.length-2),t=q(e,"base32"),i=Dt(n);return`${t}:${i}`}function Ft(r){r=En(r);let e=[],n=[],t=null,i=r.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let o=0;o<i.length;o++){let s=i[o],l=A(s);if(l.size===0){e.push([l.code]),n.push([l.code]);continue}if(o++,o>=i.length)throw _t("invalid address: "+r);if(l.path===!0){t=En(i.slice(o).join("/")),e.push([l.code,yn(l.code,t)]),n.push([l.code,t]);break}let m=yn(l.code,i[o]);e.push([l.code,m]),n.push([l.code,mn(l.code,m)])}return{string:Rt(n),bytes:xn(e),tuples:e,stringTuples:n,path:t}}function In(r){let e=[],n=[],t=null,i=0;for(;i<r.length;){let o=Be(r,i),s=ae(o),l=A(o),m=yc(l,r.slice(i+s));if(m===0){e.push([o]),n.push([o]),i+=s;continue}let E=r.slice(i+s,i+s+m);if(i+=m+s,i>r.length)throw _t("Invalid address Uint8Array: "+q(r,"base16"));e.push([o,E]);let p=mn(o,E);if(n.push([o,p]),l.path===!0){t=p;break}}return{bytes:Uint8Array.from(r),string:Rt(n),tuples:e,stringTuples:n,path:t}}function Rt(r){let e=[];return r.map(n=>{let t=A(n[0]);return e.push(t.name),n.length>1&&n[1]!=null&&e.push(n[1]),null}),En(e.join("/"))}function xn(r){return xe(r.map(e=>{let n=A(e[0]),t=Uint8Array.from(je(n.code));return e.length>1&&e[1]!=null&&(t=xe([t,e[1]])),t}))}function yc(r,e){if(r.size>0)return r.size/8;if(r.size===0)return 0;{let n=Be(e instanceof Uint8Array?e:Uint8Array.from(e));return n+ae(n)}}function En(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function _t(r){return new Error("Error parsing address: "+r)}var wc=Symbol.for("nodejs.util.inspect.custom"),Ec=[A("dns").code,A("dns4").code,A("dns6").code,A("dnsaddr").code],Ic=new Map,Mt=Symbol.for("@multiformats/js-multiaddr/multiaddr");function xc(r){return!!r?.[Mt]}var vn=class r{bytes;#e;#r;#n;#t;[Mt]=!0;constructor(e){e==null&&(e="");let n;if(e instanceof Uint8Array)n=In(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);n=Ft(e)}else if(xc(e))n=In(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=n.bytes,this.#e=n.string,this.#r=n.tuples,this.#n=n.stringTuples,this.#t=n.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,n,t,i,o="",s=A("tcp"),l=A("udp"),m=A("ip4"),E=A("ip6"),p=A("dns6"),a=A("ip6zone");for(let[u,c]of this.stringTuples())u===a.code&&(o=`%${c??""}`),Ec.includes(u)&&(n=s.name,i=443,t=`${c??""}${o}`,e=u===p.code?6:4),(u===s.code||u===l.code)&&(n=A(u).name,i=parseInt(c??"")),(u===m.code||u===E.code)&&(n=A(u).name,t=`${c??""}${o}`,e=u===E.code?6:4);if(e==null||n==null||t==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:t,transport:n,port:i}}protos(){return this.#r.map(([e])=>Object.assign({},A(e)))}protoCodes(){return this.#r.map(([e])=>e)}protoNames(){return this.#r.map(([e])=>A(e).name)}tuples(){return this.#r}stringTuples(){return this.#n}encapsulate(e){return e=new r(e),new r(this.toString()+e.toString())}decapsulate(e){let n=e.toString(),t=this.toString(),i=t.lastIndexOf(n);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new r(t.slice(0,i))}decapsulateCode(e){let n=this.tuples();for(let t=n.length-1;t>=0;t--)if(n[t][0]===e)return new r(xn(n.slice(0,t)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([t,i])=>{t===Ke.p2p.code&&e.push([t,i]),t===Ke["p2p-circuit"].code&&(e=[])});let n=e.pop();if(n?.[1]!=null){let t=n[1];return t[0]==="Q"||t[0]==="1"?q(T.decode(`z${t}`),"base58btc"):q(ee.parse(t).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#t}equals(e){return We(this.bytes,e.bytes)}async resolve(e){let n=this.protos().find(o=>o.resolvable);if(n==null)return[this];let t=Ic.get(n.name);if(t==null)throw new Ye(`no available resolver for ${n.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await t(this,e)).map(o=>new r(o))}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 n=(e??this).protos();return!(n.length!==2||n[0].code!==4&&n[0].code!==41||n[1].code!==6&&n[1].code!==273)}[wc](){return`Multiaddr(${this.#e})`}};function Cn(r){return new vn(r)}var rr=dr("libp2p:mdns:query");function kt(r,e,n){let t=()=>{rr("query",e),r.query({questions:[{name:e,type:"PTR"}]})};return t(),setInterval(t,n)}function qt(r,e,n){if(r.answers==null)return;let t,i=[];if(r.answers.forEach(o=>{switch(o.type){case"PTR":t=o;break;case"TXT":i.push(o);break;default:break}}),!(t==null||t?.name!==n||i.length===0||t.data.startsWith(e)))try{let o=i.flatMap(l=>l.data).filter(l=>l.toString().startsWith("dnsaddr=")).map(l=>Cn(l.toString().substring(8))),s=o[0].getPeerId();if(s==null)throw new Error("Multiaddr doesn't contain PeerId");return rr("peer found %p",s),{id:on(s),multiaddrs:o,protocols:[]}}catch(o){rr.error("failed to parse mdns response",o)}}function zt(r,e,n,t,i,o){if(!o){rr("not responding to mDNS query as broadcast mode is false");return}if(t.length!==0&&r.questions[0]!=null&&r.questions[0].name===i){let s=[];s.push({name:i,type:"PTR",class:"IN",ttl:120,data:n+"."+i}),t.forEach(l=>{l.getPeerId()!=null&&s.push({name:n+"."+i,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+l.toString()})}),rr("responding to query"),e.respond(s)}}function $t(r){let e="",n="abcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<r;t++)e+=n.charAt(Math.floor(Math.random()*n.length));return e}var Er=dr("libp2p:mdns"),Un=class extends tr{mdns;broadcast;interval;serviceTag;peerName;port;ip;_queryInterval;components;constructor(e,n={}){if(super(),this.broadcast=n.broadcast!==!1,this.interval=n.interval??1e3*10,this.serviceTag=n.serviceTag??"_p2p._udp.local",this.ip=n.ip??"224.0.0.251",this.peerName=n.peerName??$t(63),this.peerName.length>=64)throw new Error("Peer name should be less than 64 chars long");this.port=n.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)}[Sn]=this;[Symbol.toStringTag]="@libp2p/mdns";isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,Vt.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=kt(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){this.mdns!=null&&(Er.trace("received incoming mDNS query"),zt(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast))}_onMdnsResponse(e){Er.trace("received mDNS query response");try{let n=qt(e,this.peerName,this.serviceTag);n!=null&&(Er("discovered peer in mDNS query response %p",n.id),this.dispatchEvent(new ir("peer",{detail:n})))}catch(n){Er.error("Error processing peer response",n)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new ir("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 vc(r={}){return e=>new Un(e,r)}return Xt(Uc);})();
|
|
7
7
|
return Libp2PMdns}));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"MulticastDNSComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_mdns.MulticastDNSComponents.html",
|
|
3
|
+
"MulticastDNSInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_mdns.MulticastDNSInit.html",
|
|
4
|
+
"mdns": "https://libp2p.github.io/js-libp2p/functions/_libp2p_mdns.mdns.html"
|
|
5
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/mdns",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.5",
|
|
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,18 +44,18 @@
|
|
|
44
44
|
"test:electron-main": "aegir test -t electron-main"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@libp2p/interface": "0.1.2
|
|
48
|
-
"@libp2p/logger": "3.0.2
|
|
49
|
-
"@libp2p/peer-id": "3.0.2
|
|
47
|
+
"@libp2p/interface": "^0.1.2",
|
|
48
|
+
"@libp2p/logger": "^3.0.2",
|
|
49
|
+
"@libp2p/peer-id": "^3.0.2",
|
|
50
50
|
"@multiformats/multiaddr": "^12.1.5",
|
|
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": "4.0.
|
|
57
|
-
"@libp2p/interface-internal": "0.1.4
|
|
58
|
-
"@libp2p/peer-id-factory": "3.0.3
|
|
56
|
+
"@libp2p/interface-compliance-tests": "^4.0.5",
|
|
57
|
+
"@libp2p/interface-internal": "^0.1.4",
|
|
58
|
+
"@libp2p/peer-id-factory": "^3.0.3",
|
|
59
59
|
"aegir": "^40.0.8",
|
|
60
60
|
"p-wait-for": "^5.0.2",
|
|
61
61
|
"ts-sinon": "^2.0.2"
|