@libp2p/mdns 8.0.0-f427cfc9 → 9.0.0-58421e11

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