@libp2p/mdns 7.0.0 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,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 oo=Object.create;var nr=Object.defineProperty;var io=Object.getOwnPropertyDescriptor;var so=Object.getOwnPropertyNames;var co=Object.getPrototypeOf,ao=Object.prototype.hasOwnProperty;var ie=(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 new Error('Dynamic require of "'+r+'" is not supported')});var T=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),z=(r,e)=>{for(var t in e)nr(r,t,{get:e[t],enumerable:!0})},Ut=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of so(e))!ao.call(r,o)&&o!==t&&nr(r,o,{get:()=>e[o],enumerable:!(n=io(e,o))||n.enumerable});return r};var Se=(r,e,t)=>(t=r!=null?oo(co(r)):{},Ut(e||!r||!r.__esModule?nr(t,"default",{value:r,enumerable:!0}):t,r)),lo=r=>Ut(nr({},"__esModule",{value:!0}),r);var Ot=T(Sr=>{"use strict";Sr.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};Sr.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 At=T(Ur=>{"use strict";Ur.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};Ur.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 Tt=T(Or=>{"use strict";Or.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};Or.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 Lt=T(Ar=>{"use strict";Ar.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};Ar.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 Bt=T(Tr=>{"use strict";Tr.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}`};Tr.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 Dt=T((Rt,Lr)=>{var Nt=function(r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=a,r.encode=g,r.familyOf=E,r.name=void 0,r.sizeOf=C,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,l,s){s=~~s,l=l||new Uint8Array(s+t);let p=d.length,w=0;for(let v=0;v<p;){let b=d.charCodeAt(v++);b===46?(l[s++]=w,w=0):w=w*10+(b-48)}return l[s]=w,l},decode(d,l){return l=~~l,`${d[l++]}.${d[l++]}.${d[l++]}.${d[l]}`}};r.v4=i;let c={name:"v6",size:o,isFormat:d=>d.length>0&&n.test(d),encode(d,l,s){s=~~s;let p=s+o,w=-1,v=0,b=0,N=!0,U=!1;l=l||new Uint8Array(s+o);for(let L=0;L<d.length;L++){let O=d.charCodeAt(L);O===58?(N?w!==-1?(s<p&&(l[s]=0),s<p-1&&(l[s+1]=0),s+=2):s<p&&(w=s):(U===!0?(s<p&&(l[s]=b),s++):(s<p&&(l[s]=v>>8),s<p-1&&(l[s+1]=v&255),s+=2),v=0,b=0),N=!0,U=!1):O===46?(s<p&&(l[s]=b),s++,b=0,v=0,N=!1,U=!0):(N=!1,O>=97?O-=87:O>=65?O-=55:(O-=48,b=b*10+O),v=(v<<4)+O)}if(N===!1)U===!0?(s<p&&(l[s]=b),s++):(s<p&&(l[s]=v>>8),s<p-1&&(l[s+1]=v&255),s+=2);else if(w===0)s<p&&(l[s]=0),s<p-1&&(l[s+1]=0),s+=2;else if(w!==-1){s+=2;for(let L=Math.min(s-1,p-1);L>=w+2;L--)l[L]=l[L-2];l[w]=0,l[w+1]=0,w=s}if(w!==s&&w!==-1)for(s>p-2&&(s=p-2);p>w;)l[--p]=s<p&&s>w?l[--s]:0;else for(;s<p;)l[s++]=0;return l},decode(d,l){l=~~l;let s="";for(let p=0;p<o;p+=2)p!==0&&(s+=":"),s+=(d[l+p]<<8|d[l+p+1]).toString(16);return s.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};r.v6=c;let u="ip";r.name=u;function C(d){if(i.isFormat(d))return i.size;if(c.isFormat(d))return c.size;throw Error(`Invalid ip address: ${d}`)}function E(d){return C(d)===i.size?1:2}function g(d,l,s){s=~~s;let p=C(d);return typeof l=="function"&&(l=l(s+p)),p===i.size?i.encode(d,l,s):c.encode(d,l,s)}function a(d,l,s){if(l=~~l,s=s||d.length-l,s===i.size)return i.decode(d,l,s);if(s===c.size)return c.decode(d,l,s);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${c.size} for v6.`)}return"default"in r?r.default:r}({});typeof define=="function"&&define.amd?define([],function(){return Nt}):typeof Lr=="object"&&typeof Rt=="object"&&(Lr.exports=Nt)});var _t=T(m=>{"use strict";var y=ie("buffer").Buffer,me=Ot(),uo=At(),ho=Tt(),ir=Lt(),Br=Bt(),Ue=Dt(),po=0,Pt=1<<15,Nr=1<<15,go=~Nr,Ft=1<<15,mo=~Ft,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 c=0;c<i.length;c++){let u=e.write(i[c],t+1);e[t]=u,t+=u+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,c=!1;for(;;){if(e>=r.length)throw new Error("Cannot decode name (buffer overflow)");let u=r[e++];if(i+=c?0:1,u===0)break;if(u&192)if((u&192)===192){if(e+1>r.length)throw new Error("Cannot decode name (buffer overflow)");let C=r.readUInt16BE(e-1)-49152;if(C>=n)throw new Error("Cannot decode name (bad pointer)");e=C,n=C,i+=c?0:1,c=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+u>r.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=u+1,o>254)throw new Error("Cannot decode name (name too long)");t.push(r.toString("utf-8",e,e+u)),e+=u,i+=c?0:u}}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 Q={};Q.encode=function(r,e,t){e||(e=Q.encodingLength(r)),t||(t=0);let n=(r.flags||0)&32767,o=r.type==="response"?Pt:po;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};Q.encode.bytes=12;Q.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&Pt?"response":"query",flags:t&32767,flag_qr:(t>>15&1)===1,opcode:ho.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:uo.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))}};Q.decode.bytes=12;Q.encodingLength=function(){return 12};var se=m.unknown={};se.encode=function(r,e,t){return e||(e=y.alloc(se.encodingLength(r))),t||(t=0),e.writeUInt16BE(r.length,t),r.copy(e,t+2),se.encode.bytes=r.length+2,e};se.encode.bytes=0;se.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=r.slice(e+2,e+2+t);return se.decode.bytes=t+2,n};se.decode.bytes=0;se.encodingLength=function(r){return r.length+2};var ce=m.ns={};ce.encode=function(r,e,t){return e||(e=y.alloc(ce.encodingLength(r))),t||(t=0),h.encode(r,e,t+2),e.writeUInt16BE(h.encode.bytes,t),ce.encode.bytes=h.encode.bytes+2,e};ce.encode.bytes=0;ce.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=h.decode(r,e+2);return ce.decode.bytes=t+2,n};ce.decode.bytes=0;ce.encodingLength=function(r){return h.encodingLength(r)+2};var ae=m.soa={};ae.encode=function(r,e,t){e||(e=y.alloc(ae.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),ae.encode.bytes=t-n,e};ae.encode.bytes=0;ae.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,ae.decode.bytes=e-t,n};ae.decode.bytes=0;ae.encodingLength=function(r){return 22+h.encodingLength(r.mname)+h.encodingLength(r.rname)};var de=m.txt={};de.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(de.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),de.encode.bytes=t-n,e};de.encode.bytes=0;de.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 de.decode.bytes=e-t,o};de.decode.bytes=0;de.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 le=m.null={};le.encode=function(r,e,t){e||(e=y.alloc(le.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),le.encode.bytes=t-n,e};le.encode.bytes=0;le.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,le.decode.bytes=e-t,o};le.decode.bytes=0;le.encodingLength=function(r){return r?(y.isBuffer(r)?r.length:y.byteLength(r))+2:2};var ue=m.hinfo={};ue.encode=function(r,e,t){e||(e=y.alloc(ue.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),ue.encode.bytes=t-n,e};ue.encode.bytes=0;ue.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,ue.decode.bytes=e-t,n};ue.decode.bytes=0;ue.encodingLength=function(r){return x.encodingLength(r.cpu)+x.encodingLength(r.os)+2};var G=m.ptr={},yo=m.cname=G,wo=m.dname=G;G.encode=function(r,e,t){return e||(e=y.alloc(G.encodingLength(r))),t||(t=0),h.encode(r,e,t+2),e.writeUInt16BE(h.encode.bytes,t),G.encode.bytes=h.encode.bytes+2,e};G.encode.bytes=0;G.decode=function(r,e){e||(e=0);let t=h.decode(r,e+2);return G.decode.bytes=h.decode.bytes+2,t};G.decode.bytes=0;G.encodingLength=function(r){return h.encodingLength(r)+2};var he=m.srv={};he.encode=function(r,e,t){e||(e=y.alloc(he.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),he.encode.bytes=n+2,e};he.encode.bytes=0;he.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),he.decode.bytes=t+2,n};he.decode.bytes=0;he.encodingLength=function(r){return 8+h.encodingLength(r.target)};var $=m.caa={};$.ISSUER_CRITICAL=1<<7;$.encode=function(r,e,t){let n=$.encodingLength(r);return e||(e=y.alloc($.encodingLength(r))),t||(t=0),r.issuerCritical&&(r.flags=$.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),$.encode.bytes=n,e};$.encode.bytes=0;$.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&$.ISSUER_CRITICAL),$.decode.bytes=t+2,o};$.decode.bytes=0;$.encodingLength=function(r){return x.encodingLength(r.tag)+x.encodingLength(r.value)+2};var Ce=m.mx={};Ce.encode=function(r,e,t){e||(e=y.alloc(Ce.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),Ce.encode.bytes=t-n,e};Ce.encode.bytes=0;Ce.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,Ce.decode.bytes=e-t,n};Ce.encodingLength=function(r){return 4+h.encodingLength(r.exchange)};var pe=m.a={};pe.encode=function(r,e,t){return e||(e=y.alloc(pe.encodingLength(r))),t||(t=0),e.writeUInt16BE(4,t),t+=2,Ue.v4.encode(r,e,t),pe.encode.bytes=6,e};pe.encode.bytes=0;pe.decode=function(r,e){e||(e=0),e+=2;let t=Ue.v4.decode(r,e);return pe.decode.bytes=6,t};pe.decode.bytes=0;pe.encodingLength=function(){return 6};var ge=m.aaaa={};ge.encode=function(r,e,t){return e||(e=y.alloc(ge.encodingLength(r))),t||(t=0),e.writeUInt16BE(16,t),t+=2,Ue.v6.encode(r,e,t),ge.encode.bytes=18,e};ge.encode.bytes=0;ge.decode=function(r,e){e||(e=0),e+=2;let t=Ue.v6.decode(r,e);return ge.decode.bytes=18,t};ge.decode.bytes=0;ge.encodingLength=function(){return 18};var M=m.option={};M.encode=function(r,e,t){e||(e=y.alloc(M.encodingLength(r))),t||(t=0);let n=t,o=Br.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,c=r.family||Ue.familyOf(r.ip),u=Ue.encode(r.ip,y.alloc),C=Math.ceil(i/8);e.writeUInt16BE(C+4,t),t+=2,e.writeUInt16BE(c,t),t+=2,e.writeUInt8(i,t++),e.writeUInt8(r.scopePrefixLength||0,t++),u.copy(e,t,0,C),t+=C;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 g=r.tags.length*2;e.writeUInt16BE(g,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 M.encode.bytes=t-n,e};M.encode.bytes=0;M.decode=function(r,e){e||(e=0);let t={};t.code=r.readUInt16BE(e),t.type=Br.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 M.decode.bytes=n+4,t};M.decode.bytes=0;M.encodingLength=function(r){if(r.data)return r.data.length+4;switch(Br.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 j=m.opt={};j.encode=function(r,e,t){e||(e=y.alloc(j.encodingLength(r))),t||(t=0);let n=t,o=Ne(r,M);return e.writeUInt16BE(o,t),t=je(r,M,e,t+2),j.encode.bytes=t-n,e};j.encode.bytes=0;j.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++]=M.decode(r,e),e+=M.decode.bytes,o-=M.decode.bytes;return j.decode.bytes=e-t,n};j.decode.bytes=0;j.encodingLength=function(r){return 2+Ne(r||[],M)};var _=m.dnskey={};_.PROTOCOL_DNSSEC=3;_.ZONE_KEY=128;_.SECURE_ENTRYPOINT=32768;_.encode=function(r,e,t){e||(e=y.alloc(_.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(_.PROTOCOL_DNSSEC,t),t+=1,e.writeUInt8(r.algorithm,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,_.encode.bytes=t-n,e.writeUInt16BE(_.encode.bytes-2,n),e};_.encode.bytes=0;_.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);if(e+=2,n.flags=r.readUInt16BE(e),e+=2,r.readUInt8(e)!==_.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=r.readUInt8(e),e+=1,n.key=r.slice(e,t+o+2),e+=n.key.length,_.decode.bytes=e-t,n};_.decode.bytes=0;_.encodingLength=function(r){return 6+y.byteLength(r.key)};var Z=m.rrsig={};Z.encode=function(r,e,t){e||(e=y.alloc(Z.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(me.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,Z.encode.bytes=t-n,e.writeUInt16BE(Z.encode.bytes-2,n),e};Z.encode.bytes=0;Z.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);return e+=2,n.typeCovered=me.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,Z.decode.bytes=e-t,n};Z.decode.bytes=0;Z.encodingLength=function(r){return 20+h.encodingLength(r.signersName)+y.byteLength(r.signature)};var f=m.rp={};f.encode=function(r,e,t){e||(e=y.alloc(f.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,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,n={};return e+=2,n.mbox=h.decode(r,e)||".",e+=h.decode.bytes,n.txt=h.decode(r,e)||".",e+=h.decode.bytes,f.decode.bytes=e-t,n};f.decode.bytes=0;f.encodingLength=function(r){return 2+h.encodingLength(r.mbox||".")+h.encodingLength(r.txt||".")};var R={};R.encode=function(r,e,t){e||(e=y.alloc(R.encodingLength(r))),t||(t=0);let n=t;for(var o=[],i=0;i<r.length;i++){var c=me.toType(r[i]);o[c>>8]===void 0&&(o[c>>8]=[]),o[c>>8][c>>3&31]|=1<<7-(c&7)}for(i=0;i<o.length;i++)if(o[i]!==void 0){var u=y.from(o[i]);e.writeUInt8(i,t),t+=1,e.writeUInt8(u.length,t),t+=1,u.copy(e,t),t+=u.length}return R.encode.bytes=t-n,e};R.encode.bytes=0;R.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 c=r.readUInt8(e);e+=1;for(var u=0;u<c;u++)for(var C=r.readUInt8(e+u),E=0;E<8;E++)if(C&1<<7-E){var g=me.toString(i<<8|u<<3|E);o.push(g)}e+=c}return R.decode.bytes=e-n,o};R.decode.bytes=0;R.encodingLength=function(r){for(var e=[],t=0;t<r.length;t++){var n=me.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 ee=m.nsec={};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.nextDomain,e,t),t+=h.encode.bytes,R.encode(r.rrtypes,e,t),t+=R.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;var n={},o=r.readUInt16BE(e);return e+=2,n.nextDomain=h.decode(r,e),e+=h.decode.bytes,n.rrtypes=R.decode(r,e,o-(e-t)),e+=R.decode.bytes,ee.decode.bytes=e-t,n};ee.decode.bytes=0;ee.encodingLength=function(r){return 2+h.encodingLength(r.nextDomain)+R.encodingLength(r.rrtypes)};var re=m.nsec3={};re.encode=function(r,e,t){e||(e=y.alloc(re.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,R.encode(r.rrtypes,e,t),t+=R.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);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 c=r.readUInt8(e);return e+=1,n.nextDomain=r.slice(e,e+c),e+=c,n.rrtypes=R.decode(r,e,o-(e-t)),e+=R.decode.bytes,re.decode.bytes=e-t,n};re.decode.bytes=0;re.encodingLength=function(r){return 8+r.salt.length+r.nextDomain.length+R.encodingLength(r.rrtypes)};var te=m.ds={};te.encode=function(r,e,t){e||(e=y.alloc(te.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,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);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,te.decode.bytes=e-t,n};te.decode.bytes=0;te.encodingLength=function(r){return 6+y.byteLength(r.digest)};var V=m.sshfp={};V.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};V.encode=function(e,t,n){t||(t=y.alloc(V.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!==V.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return i.copy(t,n),n+=i.byteLength,V.encode.bytes=n-o,t.writeUInt16BE(V.encode.bytes-2,o),t};V.encode.bytes=0;V.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=V.getFingerprintLengthForHashType(o.hash);return o.fingerprint=e.slice(t,t+i).toString("hex").toUpperCase(),t+=i,V.decode.bytes=t-n,o};V.decode.bytes=0;V.encodingLength=function(r){return 4+y.from(r.fingerprint,"hex").byteLength};var Rr=m.record=function(r){switch(r.toUpperCase()){case"A":return pe;case"PTR":return G;case"CNAME":return yo;case"DNAME":return wo;case"TXT":return de;case"NULL":return le;case"AAAA":return ge;case"SRV":return he;case"HINFO":return ue;case"CAA":return $;case"NS":return ce;case"SOA":return ae;case"MX":return Ce;case"OPT":return j;case"DNSKEY":return _;case"RRSIG":return Z;case"RP":return f;case"NSEC":return ee;case"NSEC3":return re;case"SSHFP":return V;case"DS":return te}return se},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(me.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,j.encode(r.options||[],e,t),t+=j.encode.bytes}else{let o=ir.toClass(r.class===void 0?"IN":r.class);r.flush&&(o|=Nr),e.writeUInt16BE(o,t+2),e.writeUInt32BE(r.ttl||0,t+4),t+=8;let i=Rr(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=me.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=j.decode(r,e+8),e+=8+j.decode.bytes;else{let o=r.readUInt16BE(e+2);t.ttl=r.readUInt32BE(e+4),t.class=ir.toString(o&go),t.flush=!!(o&Nr);let i=Rr(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+Rr(r.type).encodingLength(e)};var X=m.question={};X.encode=function(r,e,t){e||(e=y.alloc(X.encodingLength(r))),t||(t=0);let n=t;return h.encode(r.name,e,t),t+=h.encode.bytes,e.writeUInt16BE(me.toType(r.type),t),t+=2,e.writeUInt16BE(ir.toClass(r.class===void 0?"IN":r.class),t),t+=2,X.encode.bytes=t-n,r};X.encode.bytes=0;X.decode=function(r,e){e||(e=0);let t=e,n={};return n.name=h.decode(r,e),e+=h.decode.bytes,n.type=me.toString(r.readUInt16BE(e)),e+=2,n.class=ir.toString(r.readUInt16BE(e)),e+=2,!!(n.class&Ft)&&(n.class&=mo),X.decode.bytes=e-t,n};X.decode.bytes=0;X.encodingLength=function(r){return h.encodingLength(r.name)+4};m.AUTHORITATIVE_ANSWER=1<<10;m.TRUNCATED_RESPONSE=1<<9;m.RECURSION_DESIRED=1<<8;m.RECURSION_AVAILABLE=1<<7;m.AUTHENTIC_DATA=1<<5;m.CHECKING_DISABLED=1<<4;m.DNSSEC_OK=1<<15;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=[]),Q.encode(r,e,t),t+=Q.encode.bytes,t=je(r.questions,X,e,t),t=je(r.answers,D,e,t),t=je(r.authorities,D,e,t),t=je(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=Q.decode(r,e);return e+=Q.decode.bytes,e=or(n.questions,X,r,e),e=or(n.answers,D,r,e),e=or(n.authorities,D,r,e),e=or(n.additionals,D,r,e),m.decode.bytes=e-t,n};m.decode.bytes=0;m.encodingLength=function(r){return Q.encodingLength(r)+Ne(r.questions||[],X)+Ne(r.answers||[],D)+Ne(r.authorities||[],D)+Ne(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 Ne(r,e){let t=0;for(let n=0;n<r.length;n++)t+=e.encodingLength(r[n]);return t}function je(r,e,t,n){for(let o=0;o<r.length;o++)e.encode(r[o],t,n),n+=e.encode.bytes;return n}function or(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 qt=T((Zs,kt)=>{"use strict";var Mt=xo;process.nextTick(bo,42);kt.exports=Eo;function Eo(r){var e=n;return t;function t(o){e(o||vo)}function n(o){var i=[o];e=c,r(u);function c(C){i.push(C)}function u(C){var E=arguments;for(e=Co(C)?n:g;i.length;)g(i.shift());function g(a){Mt(Io,a,E)}}}}function Co(r){return Object.prototype.toString.call(r)==="[object Error]"}function vo(){}function Io(r,e){r.apply(null,e)}function bo(r){r===42&&(Mt=process.nextTick)}function xo(r,e,t){process.nextTick(function(){r(e,t)})}});var Vt=T((fs,$t)=>{var Dr=_t(),So=ie("dgram"),Uo=qt(),Oo=ie("events"),Fr=ie("os"),Pr=function(){};$t.exports=function(r){r||(r={});var e=new Oo.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},c={},u=!1,C=null;if(n==="udp6"&&(!o||!r.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var E=r.socket||So.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=Dr.decode(a)}catch(l){e.emit("warning",l);return}e.emit("packet",a,d),a.type==="query"&&e.emit("query",a,d),a.type==="response"&&e.emit("response",a,d)}),E.on("listening",function(){t||(t=i.port=E.address().port),r.multicast!==!1&&(e.update(),C=setInterval(e.update,5e3),E.setMulticastTTL(r.ttl||255),E.setMulticastLoopback(r.loopback!==!1))});var g=Uo(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 g(function(a){if(a)return e.emit("error",a);e.emit("ready")}),e.send=function(a,d,l){if(typeof d=="function")return e.send(a,null,d);l||(l=Pr),d?!d.host&&!d.address&&(d.address=i.address):d=i,g(s);function s(p){if(u)return l();if(p)return l(p);var w=Dr.encode(a);E.send(w,0,w.length,d.port,d.address||d.host,l)}},e.response=e.respond=function(a,d,l){Array.isArray(a)&&(a={answers:a}),a.type="response",a.flags=(a.flags||0)|Dr.AUTHORITATIVE_ANSWER,e.send(a,d,l)},e.query=function(a,d,l,s){if(typeof d=="function")return e.query(a,null,null,d);if(typeof d=="object"&&d&&d.port)return e.query(a,null,d,l);if(typeof l=="function")return e.query(a,d,null,l);s||(s=Pr),typeof a=="string"&&(a=[{name:a,type:d||"ANY"}]),Array.isArray(a)&&(a={type:"query",questions:a}),a.type="query",e.send(a,l,s)},e.destroy=function(a){if(a||(a=Pr),u)return process.nextTick(a);u=!0,clearInterval(C);for(var d in c)try{E.dropMembership(o,d)}catch{}c={},E.close(a)},e.update=function(){for(var a=r.interface?[].concat(r.interface):To(),d=!1,l=0;l<a.length;l++){var s=a[l];if(!c[s])try{E.addMembership(o,s),c[s]=!0,d=!0}catch(p){e.emit("warning",p)}}if(d){if(E.setMulticastInterface)try{E.setMulticastInterface(r.interface||Ao())}catch(p){e.emit("warning",p)}e.emit("networkInterface")}},e};function Ao(){for(var r=Fr.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 Fr.platform()==="darwin"&&e[t]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function To(){for(var r=Fr.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 c=o[i];if(zt(c.family)){t.push(c.address);break}}return t}function zt(r){return r===4||r==="IPv4"}});var Yt=T((rc,jt)=>{var Re=1e3,De=Re*60,Pe=De*60,Ae=Pe*24,Lo=Ae*7,Bo=Ae*365.25;jt.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return No(r);if(t==="number"&&isFinite(r))return e.long?Do(r):Ro(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function No(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*Bo;case"weeks":case"week":case"w":return t*Lo;case"days":case"day":case"d":return t*Ae;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Pe;case"minutes":case"minute":case"mins":case"min":case"m":return t*De;case"seconds":case"second":case"secs":case"sec":case"s":return t*Re;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Ro(r){var e=Math.abs(r);return e>=Ae?Math.round(r/Ae)+"d":e>=Pe?Math.round(r/Pe)+"h":e>=De?Math.round(r/De)+"m":e>=Re?Math.round(r/Re)+"s":r+"ms"}function Do(r){var e=Math.abs(r);return e>=Ae?ar(r,e,Ae,"day"):e>=Pe?ar(r,e,Pe,"hour"):e>=De?ar(r,e,De,"minute"):e>=Re?ar(r,e,Re,"second"):r+" ms"}function ar(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var Mr=T((tc,Kt)=>{function Po(r){t.debug=t,t.default=t,t.coerce=C,t.disable=i,t.enable=o,t.enabled=c,t.humanize=Yt(),t.destroy=E,Object.keys(r).forEach(g=>{t[g]=r[g]}),t.names=[],t.skips=[],t.formatters={};function e(g){let a=0;for(let d=0;d<g.length;d++)a=(a<<5)-a+g.charCodeAt(d),a|=0;return t.colors[Math.abs(a)%t.colors.length]}t.selectColor=e;function t(g){let a,d=null,l,s;function p(...w){if(!p.enabled)return;let v=p,b=Number(new Date),N=b-(a||b);v.diff=N,v.prev=a,v.curr=b,a=b,w[0]=t.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let U=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(O,q)=>{if(O==="%%")return"%";U++;let K=t.formatters[q];if(typeof K=="function"){let Be=w[U];O=K.call(v,Be),w.splice(U,1),U--}return O}),t.formatArgs.call(v,w),(v.log||t.log).apply(v,w)}return p.namespace=g,p.useColors=t.useColors(),p.color=t.selectColor(g),p.extend=n,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(l!==t.namespaces&&(l=t.namespaces,s=t.enabled(g)),s),set:w=>{d=w}}),typeof t.init=="function"&&t.init(p),p}function n(g,a){let d=t(this.namespace+(typeof a>"u"?":":a)+g);return d.log=this.log,d}function o(g){t.save(g),t.namespaces=g,t.names=[],t.skips=[];let a,d=(typeof g=="string"?g:"").split(/[\s,]+/),l=d.length;for(a=0;a<l;a++)d[a]&&(g=d[a].replace(/\*/g,".*?"),g[0]==="-"?t.skips.push(new RegExp("^"+g.slice(1)+"$")):t.names.push(new RegExp("^"+g+"$")))}function i(){let g=[...t.names.map(u),...t.skips.map(u).map(a=>"-"+a)].join(",");return t.enable(""),g}function c(g){if(g[g.length-1]==="*")return!0;let a,d;for(a=0,d=t.skips.length;a<d;a++)if(t.skips[a].test(g))return!1;for(a=0,d=t.names.length;a<d;a++)if(t.names[a].test(g))return!0;return!1}function u(g){return g.toString().substring(2,g.toString().length-2).replace(/\.\*\?$/,"*")}function C(g){return g instanceof Error?g.stack||g.message:g}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}Kt.exports=Po});var Ht=T((Y,dr)=>{Y.formatArgs=_o;Y.save=Mo;Y.load=ko;Y.useColors=Fo;Y.storage=qo();Y.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`."))}})();Y.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 Fo(){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 _o(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+dr.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)}Y.log=console.debug||console.log||(()=>{});function Mo(r){try{r?Y.storage.setItem("debug",r):Y.storage.removeItem("debug")}catch{}}function ko(){let r;try{r=Y.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function qo(){try{return localStorage}catch{}}dr.exports=Mr()(Y);var{formatters:zo}=dr.exports;zo.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Xt=T((nc,Gt)=>{"use strict";Gt.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 Wt=T((oc,Qt)=>{"use strict";var $o=ie("os"),W=Xt(),F=process.env,Fe;W("no-color")||W("no-colors")||W("color=false")?Fe=!1:(W("color")||W("colors")||W("color=true")||W("color=always"))&&(Fe=!0);"FORCE_COLOR"in F&&(Fe=F.FORCE_COLOR.length===0||parseInt(F.FORCE_COLOR,10)!==0);function Vo(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function jo(r){if(Fe===!1)return 0;if(W("color=16m")||W("color=full")||W("color=truecolor"))return 3;if(W("color=256"))return 2;if(r&&!r.isTTY&&Fe!==!0)return 0;let e=Fe?1:0;if(process.platform==="win32"){let t=$o.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 F)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in F)||F.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in F)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(F.TEAMCITY_VERSION)?1:0;if(F.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in F){let t=parseInt((F.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(F.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(F.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(F.TERM)||"COLORTERM"in F?1:(F.TERM==="dumb",e)}function kr(r){let e=jo(r);return Vo(e)}Qt.exports={supportsColor:kr,stdout:kr(process.stdout),stderr:kr(process.stderr)}});var Zt=T((P,ur)=>{var Yo=ie("tty"),lr=ie("util");P.init=Jo;P.log=Xo;P.formatArgs=Ho;P.save=Qo;P.load=Wo;P.useColors=Ko;P.destroy=lr.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=Wt();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 Ko(){return"colors"in P.inspectOpts?!!P.inspectOpts.colors:Yo.isatty(process.stderr.fd)}function Ho(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(`
2
+ "use strict";var Libp2PMdns=(()=>{var ao=Object.create;var or=Object.defineProperty;var lo=Object.getOwnPropertyDescriptor;var uo=Object.getOwnPropertyNames;var ho=Object.getPrototypeOf,po=Object.prototype.hasOwnProperty;var se=(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 new Error('Dynamic require of "'+r+'" is not supported')});var T=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),z=(r,e)=>{for(var t in e)or(r,t,{get:e[t],enumerable:!0})},Tt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of uo(e))!po.call(r,o)&&o!==t&&or(r,o,{get:()=>e[o],enumerable:!(n=lo(e,o))||n.enumerable});return r};var Ue=(r,e,t)=>(t=r!=null?ao(ho(r)):{},Tt(e||!r||!r.__esModule?or(t,"default",{value:r,enumerable:!0}):t,r)),go=r=>Tt(or({},"__esModule",{value:!0}),r);var Lt=T(Ar=>{"use strict";Ar.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};Ar.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 Bt=T(Or=>{"use strict";Or.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};Or.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 Pt=T(Tr=>{"use strict";Tr.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};Tr.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 Nt=T(Lr=>{"use strict";Lr.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};Lr.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 Rt=T(Br=>{"use strict";Br.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}`};Br.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 _t=T((Ft,Pr)=>{var Dt=function(r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=a,r.encode=p,r.familyOf=w,r.name=void 0,r.sizeOf=I,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,l,s){s=~~s,l=l||new Uint8Array(s+t);let g=d.length,E=0;for(let x=0;x<g;){let b=d.charCodeAt(x++);b===46?(l[s++]=E,E=0):E=E*10+(b-48)}return l[s]=E,l},decode(d,l){return l=~~l,`${d[l++]}.${d[l++]}.${d[l++]}.${d[l]}`}};r.v4=i;let c={name:"v6",size:o,isFormat:d=>d.length>0&&n.test(d),encode(d,l,s){s=~~s;let g=s+o,E=-1,x=0,b=0,P=!0,U=!1;l=l||new Uint8Array(s+o);for(let L=0;L<d.length;L++){let A=d.charCodeAt(L);A===58?(P?E!==-1?(s<g&&(l[s]=0),s<g-1&&(l[s+1]=0),s+=2):s<g&&(E=s):(U===!0?(s<g&&(l[s]=b),s++):(s<g&&(l[s]=x>>8),s<g-1&&(l[s+1]=x&255),s+=2),x=0,b=0),P=!0,U=!1):A===46?(s<g&&(l[s]=b),s++,b=0,x=0,P=!1,U=!0):(P=!1,A>=97?A-=87:A>=65?A-=55:(A-=48,b=b*10+A),x=(x<<4)+A)}if(P===!1)U===!0?(s<g&&(l[s]=b),s++):(s<g&&(l[s]=x>>8),s<g-1&&(l[s+1]=x&255),s+=2);else if(E===0)s<g&&(l[s]=0),s<g-1&&(l[s+1]=0),s+=2;else if(E!==-1){s+=2;for(let L=Math.min(s-1,g-1);L>=E+2;L--)l[L]=l[L-2];l[E]=0,l[E+1]=0,E=s}if(E!==s&&E!==-1)for(s>g-2&&(s=g-2);g>E;)l[--g]=s<g&&s>E?l[--s]:0;else for(;s<g;)l[s++]=0;return l},decode(d,l){l=~~l;let s="";for(let g=0;g<o;g+=2)g!==0&&(s+=":"),s+=(d[l+g]<<8|d[l+g+1]).toString(16);return s.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};r.v6=c;let u="ip";r.name=u;function I(d){if(i.isFormat(d))return i.size;if(c.isFormat(d))return c.size;throw Error(`Invalid ip address: ${d}`)}function w(d){return I(d)===i.size?1:2}function p(d,l,s){s=~~s;let g=I(d);return typeof l=="function"&&(l=l(s+g)),g===i.size?i.encode(d,l,s):c.encode(d,l,s)}function a(d,l,s){if(l=~~l,s=s||d.length-l,s===i.size)return i.decode(d,l,s);if(s===c.size)return c.decode(d,l,s);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${c.size} for v6.`)}return"default"in r?r.default:r}({});typeof define=="function"&&define.amd?define([],function(){return Dt}):typeof Pr=="object"&&typeof Ft=="object"&&(Pr.exports=Dt)});var qt=T(m=>{"use strict";var y=se("buffer").Buffer,ye=Lt(),mo=Bt(),yo=Pt(),sr=Nt(),Nr=Rt(),Ae=_t(),wo=0,Mt=1<<15,Rr=1<<15,Eo=~Rr,kt=1<<15,Io=~kt,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 c=0;c<i.length;c++){let u=e.write(i[c],t+1);e[t]=u,t+=u+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,c=!1;for(;;){if(e>=r.length)throw new Error("Cannot decode name (buffer overflow)");let u=r[e++];if(i+=c?0:1,u===0)break;if(u&192)if((u&192)===192){if(e+1>r.length)throw new Error("Cannot decode name (buffer overflow)");let I=r.readUInt16BE(e-1)-49152;if(I>=n)throw new Error("Cannot decode name (bad pointer)");e=I,n=I,i+=c?0:1,c=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+u>r.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=u+1,o>254)throw new Error("Cannot decode name (name too long)");t.push(r.toString("utf-8",e,e+u)),e+=u,i+=c?0:u}}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 v={};v.encode=function(r,e,t){e||(e=y.alloc(v.encodingLength(r))),t||(t=0);let n=e.write(r,t+1);return e[t]=n,v.encode.bytes=n+1,e};v.encode.bytes=0;v.decode=function(r,e){e||(e=0);let t=r[e],n=r.toString("utf-8",e+1,e+1+t);return v.decode.bytes=t+1,n};v.decode.bytes=0;v.encodingLength=function(r){return y.byteLength(r)+1};var Q={};Q.encode=function(r,e,t){e||(e=Q.encodingLength(r)),t||(t=0);let n=(r.flags||0)&32767,o=r.type==="response"?Mt:wo;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};Q.encode.bytes=12;Q.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&Mt?"response":"query",flags:t&32767,flag_qr:(t>>15&1)===1,opcode:yo.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:mo.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))}};Q.decode.bytes=12;Q.encodingLength=function(){return 12};var ce=m.unknown={};ce.encode=function(r,e,t){return e||(e=y.alloc(ce.encodingLength(r))),t||(t=0),e.writeUInt16BE(r.length,t),r.copy(e,t+2),ce.encode.bytes=r.length+2,e};ce.encode.bytes=0;ce.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=r.slice(e+2,e+2+t);return ce.decode.bytes=t+2,n};ce.decode.bytes=0;ce.encodingLength=function(r){return r.length+2};var ae=m.ns={};ae.encode=function(r,e,t){return e||(e=y.alloc(ae.encodingLength(r))),t||(t=0),h.encode(r,e,t+2),e.writeUInt16BE(h.encode.bytes,t),ae.encode.bytes=h.encode.bytes+2,e};ae.encode.bytes=0;ae.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=h.decode(r,e+2);return ae.decode.bytes=t+2,n};ae.decode.bytes=0;ae.encodingLength=function(r){return h.encodingLength(r)+2};var de=m.soa={};de.encode=function(r,e,t){e||(e=y.alloc(de.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),de.encode.bytes=t-n,e};de.encode.bytes=0;de.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,de.decode.bytes=e-t,n};de.decode.bytes=0;de.encodingLength=function(r){return 22+h.encodingLength(r.mname)+h.encodingLength(r.rname)};var le=m.txt={};le.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(le.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),le.encode.bytes=t-n,e};le.encode.bytes=0;le.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 le.decode.bytes=e-t,o};le.decode.bytes=0;le.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 ue=m.null={};ue.encode=function(r,e,t){e||(e=y.alloc(ue.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),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=r.slice(e,e+n);return e+=n,ue.decode.bytes=e-t,o};ue.decode.bytes=0;ue.encodingLength=function(r){return r?(y.isBuffer(r)?r.length:y.byteLength(r))+2:2};var he=m.hinfo={};he.encode=function(r,e,t){e||(e=y.alloc(he.encodingLength(r))),t||(t=0);let n=t;return t+=2,v.encode(r.cpu,e,t),t+=v.encode.bytes,v.encode(r.os,e,t),t+=v.encode.bytes,e.writeUInt16BE(t-n-2,n),he.encode.bytes=t-n,e};he.encode.bytes=0;he.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.cpu=v.decode(r,e),e+=v.decode.bytes,n.os=v.decode(r,e),e+=v.decode.bytes,he.decode.bytes=e-t,n};he.decode.bytes=0;he.encodingLength=function(r){return v.encodingLength(r.cpu)+v.encodingLength(r.os)+2};var X=m.ptr={},vo=m.cname=X,xo=m.dname=X;X.encode=function(r,e,t){return e||(e=y.alloc(X.encodingLength(r))),t||(t=0),h.encode(r,e,t+2),e.writeUInt16BE(h.encode.bytes,t),X.encode.bytes=h.encode.bytes+2,e};X.encode.bytes=0;X.decode=function(r,e){e||(e=0);let t=h.decode(r,e+2);return X.decode.bytes=h.decode.bytes+2,t};X.decode.bytes=0;X.encodingLength=function(r){return h.encodingLength(r)+2};var pe=m.srv={};pe.encode=function(r,e,t){e||(e=y.alloc(pe.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),pe.encode.bytes=n+2,e};pe.encode.bytes=0;pe.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),pe.decode.bytes=t+2,n};pe.decode.bytes=0;pe.encodingLength=function(r){return 8+h.encodingLength(r.target)};var $=m.caa={};$.ISSUER_CRITICAL=1<<7;$.encode=function(r,e,t){let n=$.encodingLength(r);return e||(e=y.alloc($.encodingLength(r))),t||(t=0),r.issuerCritical&&(r.flags=$.ISSUER_CRITICAL),e.writeUInt16BE(n-2,t),t+=2,e.writeUInt8(r.flags||0,t),t+=1,v.encode(r.tag,e,t),t+=v.encode.bytes,e.write(r.value,t),t+=y.byteLength(r.value),$.encode.bytes=n,e};$.encode.bytes=0;$.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e);e+=2;let n=e,o={};return o.flags=r.readUInt8(e),e+=1,o.tag=v.decode(r,e),e+=v.decode.bytes,o.value=r.toString("utf-8",e,n+t),o.issuerCritical=!!(o.flags&$.ISSUER_CRITICAL),$.decode.bytes=t+2,o};$.decode.bytes=0;$.encodingLength=function(r){return v.encodingLength(r.tag)+v.encodingLength(r.value)+2};var ve=m.mx={};ve.encode=function(r,e,t){e||(e=y.alloc(ve.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),ve.encode.bytes=t-n,e};ve.encode.bytes=0;ve.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,ve.decode.bytes=e-t,n};ve.encodingLength=function(r){return 4+h.encodingLength(r.exchange)};var ge=m.a={};ge.encode=function(r,e,t){return e||(e=y.alloc(ge.encodingLength(r))),t||(t=0),e.writeUInt16BE(4,t),t+=2,Ae.v4.encode(r,e,t),ge.encode.bytes=6,e};ge.encode.bytes=0;ge.decode=function(r,e){e||(e=0),e+=2;let t=Ae.v4.decode(r,e);return ge.decode.bytes=6,t};ge.decode.bytes=0;ge.encodingLength=function(){return 6};var me=m.aaaa={};me.encode=function(r,e,t){return e||(e=y.alloc(me.encodingLength(r))),t||(t=0),e.writeUInt16BE(16,t),t+=2,Ae.v6.encode(r,e,t),me.encode.bytes=18,e};me.encode.bytes=0;me.decode=function(r,e){e||(e=0),e+=2;let t=Ae.v6.decode(r,e);return me.decode.bytes=18,t};me.decode.bytes=0;me.encodingLength=function(){return 18};var M=m.option={};M.encode=function(r,e,t){e||(e=y.alloc(M.encodingLength(r))),t||(t=0);let n=t,o=Nr.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,c=r.family||Ae.familyOf(r.ip),u=Ae.encode(r.ip,y.alloc),I=Math.ceil(i/8);e.writeUInt16BE(I+4,t),t+=2,e.writeUInt16BE(c,t),t+=2,e.writeUInt8(i,t++),e.writeUInt8(r.scopePrefixLength||0,t++),u.copy(e,t,0,I),t+=I;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 w=r.length||0;e.writeUInt16BE(w,t),t+=2,e.fill(0,t,t+w),t+=w;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 M.encode.bytes=t-n,e};M.encode.bytes=0;M.decode=function(r,e){e||(e=0);let t={};t.code=r.readUInt16BE(e),t.type=Nr.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=Ae.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 M.decode.bytes=n+4,t};M.decode.bytes=0;M.encodingLength=function(r){if(r.data)return r.data.length+4;switch(Nr.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 j=m.opt={};j.encode=function(r,e,t){e||(e=y.alloc(j.encodingLength(r))),t||(t=0);let n=t,o=Ne(r,M);return e.writeUInt16BE(o,t),t=Ge(r,M,e,t+2),j.encode.bytes=t-n,e};j.encode.bytes=0;j.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++]=M.decode(r,e),e+=M.decode.bytes,o-=M.decode.bytes;return j.decode.bytes=e-t,n};j.decode.bytes=0;j.encodingLength=function(r){return 2+Ne(r||[],M)};var _=m.dnskey={};_.PROTOCOL_DNSSEC=3;_.ZONE_KEY=128;_.SECURE_ENTRYPOINT=32768;_.encode=function(r,e,t){e||(e=y.alloc(_.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(_.PROTOCOL_DNSSEC,t),t+=1,e.writeUInt8(r.algorithm,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,_.encode.bytes=t-n,e.writeUInt16BE(_.encode.bytes-2,n),e};_.encode.bytes=0;_.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);if(e+=2,n.flags=r.readUInt16BE(e),e+=2,r.readUInt8(e)!==_.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=r.readUInt8(e),e+=1,n.key=r.slice(e,t+o+2),e+=n.key.length,_.decode.bytes=e-t,n};_.decode.bytes=0;_.encodingLength=function(r){return 6+y.byteLength(r.key)};var Z=m.rrsig={};Z.encode=function(r,e,t){e||(e=y.alloc(Z.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(ye.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,Z.encode.bytes=t-n,e.writeUInt16BE(Z.encode.bytes-2,n),e};Z.encode.bytes=0;Z.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);return e+=2,n.typeCovered=ye.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,Z.decode.bytes=e-t,n};Z.decode.bytes=0;Z.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 c=ye.toType(r[i]);o[c>>8]===void 0&&(o[c>>8]=[]),o[c>>8][c>>3&31]|=1<<7-(c&7)}for(i=0;i<o.length;i++)if(o[i]!==void 0){var u=y.from(o[i]);e.writeUInt8(i,t),t+=1,e.writeUInt8(u.length,t),t+=1,u.copy(e,t),t+=u.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 c=r.readUInt8(e);e+=1;for(var u=0;u<c;u++)for(var I=r.readUInt8(e+u),w=0;w<8;w++)if(I&1<<7-w){var p=ye.toString(i<<8|u<<3|w);o.push(p)}e+=c}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=ye.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 c=r.readUInt8(e);return e+=1,n.nextDomain=r.slice(e,e+c),e+=c,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 V=m.sshfp={};V.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};V.encode=function(e,t,n){t||(t=y.alloc(V.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!==V.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return i.copy(t,n),n+=i.byteLength,V.encode.bytes=n-o,t.writeUInt16BE(V.encode.bytes-2,o),t};V.encode.bytes=0;V.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=V.getFingerprintLengthForHashType(o.hash);return o.fingerprint=e.slice(t,t+i).toString("hex").toUpperCase(),t+=i,V.decode.bytes=t-n,o};V.decode.bytes=0;V.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,v.encode(r.flags,e,t),t+=v.encode.bytes,v.encode(r.services,e,t),t+=v.encode.bytes,v.encode(r.regexp,e,t),t+=v.encode.bytes,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=v.decode(r,e),e+=v.decode.bytes,n.services=v.decode(r,e),e+=v.decode.bytes,n.regexp=v.decode(r,e),e+=v.decode.bytes,n.replacement=h.decode(r,e),e+=h.decode.bytes,oe.decode.bytes=e-t,n};oe.decode.bytes=0;oe.encodingLength=function(r){return v.encodingLength(r.flags)+v.encodingLength(r.services)+v.encodingLength(r.regexp)+h.encodingLength(r.replacement)+6};var Dr=m.record=function(r){switch(r.toUpperCase()){case"A":return ge;case"PTR":return X;case"CNAME":return vo;case"DNAME":return xo;case"TXT":return le;case"NULL":return ue;case"AAAA":return me;case"SRV":return pe;case"HINFO":return he;case"CAA":return $;case"NS":return ae;case"SOA":return de;case"MX":return ve;case"OPT":return j;case"DNSKEY":return _;case"RRSIG":return Z;case"RP":return ee;case"NSEC":return re;case"NSEC3":return te;case"SSHFP":return V;case"DS":return ne;case"NAPTR":return oe}return ce},R=m.answer={};R.encode=function(r,e,t){e||(e=y.alloc(R.encodingLength(r))),t||(t=0);let n=t;if(h.encode(r.name,e,t),t+=h.encode.bytes,e.writeUInt16BE(ye.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,j.encode(r.options||[],e,t),t+=j.encode.bytes}else{let o=sr.toClass(r.class===void 0?"IN":r.class);r.flush&&(o|=Rr),e.writeUInt16BE(o,t+2),e.writeUInt32BE(r.ttl||0,t+4),t+=8;let i=Dr(r.type);i.encode(r.data,e,t),t+=i.encode.bytes}return R.encode.bytes=t-n,e};R.encode.bytes=0;R.decode=function(r,e){e||(e=0);let t={},n=e;if(t.name=h.decode(r,e),e+=h.decode.bytes,t.type=ye.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=j.decode(r,e+8),e+=8+j.decode.bytes;else{let o=r.readUInt16BE(e+2);t.ttl=r.readUInt32BE(e+4),t.class=sr.toString(o&Eo),t.flush=!!(o&Rr);let i=Dr(t.type);t.data=i.decode(r,e+8),e+=8+i.decode.bytes}return R.decode.bytes=e-n,t};R.decode.bytes=0;R.encodingLength=function(r){let e=r.data!==null&&r.data!==void 0?r.data:r.options;return h.encodingLength(r.name)+8+Dr(r.type).encodingLength(e)};var f=m.question={};f.encode=function(r,e,t){e||(e=y.alloc(f.encodingLength(r))),t||(t=0);let n=t;return h.encode(r.name,e,t),t+=h.encode.bytes,e.writeUInt16BE(ye.toType(r.type),t),t+=2,e.writeUInt16BE(sr.toClass(r.class===void 0?"IN":r.class),t),t+=2,f.encode.bytes=t-n,r};f.encode.bytes=0;f.decode=function(r,e){e||(e=0);let t=e,n={};return n.name=h.decode(r,e),e+=h.decode.bytes,n.type=ye.toString(r.readUInt16BE(e)),e+=2,n.class=sr.toString(r.readUInt16BE(e)),e+=2,!!(n.class&kt)&&(n.class&=Io),f.decode.bytes=e-t,n};f.decode.bytes=0;f.encodingLength=function(r){return h.encodingLength(r.name)+4};m.AUTHORITATIVE_ANSWER=1<<10;m.TRUNCATED_RESPONSE=1<<9;m.RECURSION_DESIRED=1<<8;m.RECURSION_AVAILABLE=1<<7;m.AUTHENTIC_DATA=1<<5;m.CHECKING_DISABLED=1<<4;m.DNSSEC_OK=1<<15;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=[]),Q.encode(r,e,t),t+=Q.encode.bytes,t=Ge(r.questions,f,e,t),t=Ge(r.answers,R,e,t),t=Ge(r.authorities,R,e,t),t=Ge(r.additionals,R,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=Q.decode(r,e);return e+=Q.decode.bytes,e=ir(n.questions,f,r,e),e=ir(n.answers,R,r,e),e=ir(n.authorities,R,r,e),e=ir(n.additionals,R,r,e),m.decode.bytes=e-t,n};m.decode.bytes=0;m.encodingLength=function(r){return Q.encodingLength(r)+Ne(r.questions||[],f)+Ne(r.answers||[],R)+Ne(r.authorities||[],R)+Ne(r.additionals||[],R)};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 Ne(r,e){let t=0;for(let n=0;n<r.length;n++)t+=e.encodingLength(r[n]);return t}function Ge(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 ir(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 Vt=T((ac,$t)=>{"use strict";var zt=Oo;process.nextTick(Ao,42);$t.exports=Co;function Co(r){var e=n;return t;function t(o){e(o||So)}function n(o){var i=[o];e=c,r(u);function c(I){i.push(I)}function u(I){var w=arguments;for(e=bo(I)?n:p;i.length;)p(i.shift());function p(a){zt(Uo,a,w)}}}}function bo(r){return Object.prototype.toString.call(r)==="[object Error]"}function So(){}function Uo(r,e){r.apply(null,e)}function Ao(r){r===42&&(zt=process.nextTick)}function Oo(r,e,t){process.nextTick(function(){r(e,t)})}});var Ht=T((dc,Gt)=>{var Fr=qt(),To=se("dgram"),Lo=Vt(),Bo=se("events"),Mr=se("os"),_r=function(){};Gt.exports=function(r){r||(r={});var e=new Bo.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},c={},u=!1,I=null;if(n==="udp6"&&(!o||!r.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var w=r.socket||To.createSocket({type:n,reuseAddr:r.reuseAddr!==!1,toString:function(){return n}});w.on("error",function(a){a.code==="EACCES"||a.code==="EADDRINUSE"?e.emit("error",a):e.emit("warning",a)}),w.on("message",function(a,d){try{a=Fr.decode(a)}catch(l){e.emit("warning",l);return}e.emit("packet",a,d),a.type==="query"&&e.emit("query",a,d),a.type==="response"&&e.emit("response",a,d)}),w.on("listening",function(){t||(t=i.port=w.address().port),r.multicast!==!1&&(e.update(),I=setInterval(e.update,5e3),w.setMulticastTTL(r.ttl||255),w.setMulticastLoopback(r.loopback!==!1))});var p=Lo(function(a){if(!t||r.bind===!1)return a(null);w.once("error",a),w.bind(t,r.bind||r.interface,function(){w.removeListener("error",a),a(null)})});return p(function(a){if(a)return e.emit("error",a);e.emit("ready")}),e.send=function(a,d,l){if(typeof d=="function")return e.send(a,null,d);l||(l=_r),d?!d.host&&!d.address&&(d.address=i.address):d=i,p(s);function s(g){if(u)return l();if(g)return l(g);var E=Fr.encode(a);w.send(E,0,E.length,d.port,d.address||d.host,l)}},e.response=e.respond=function(a,d,l){Array.isArray(a)&&(a={answers:a}),a.type="response",a.flags=(a.flags||0)|Fr.AUTHORITATIVE_ANSWER,e.send(a,d,l)},e.query=function(a,d,l,s){if(typeof d=="function")return e.query(a,null,null,d);if(typeof d=="object"&&d&&d.port)return e.query(a,null,d,l);if(typeof l=="function")return e.query(a,d,null,l);s||(s=_r),typeof a=="string"&&(a=[{name:a,type:d||"ANY"}]),Array.isArray(a)&&(a={type:"query",questions:a}),a.type="query",e.send(a,l,s)},e.destroy=function(a){if(a||(a=_r),u)return process.nextTick(a);u=!0,clearInterval(I);for(var d in c)try{w.dropMembership(o,d)}catch{}c={},w.close(a)},e.update=function(){for(var a=r.interface?[].concat(r.interface):No(),d=!1,l=0;l<a.length;l++){var s=a[l];if(!c[s])try{w.addMembership(o,s),c[s]=!0,d=!0}catch(g){e.emit("warning",g)}}if(d){if(w.setMulticastInterface)try{w.setMulticastInterface(r.interface||Po())}catch(g){e.emit("warning",g)}e.emit("networkInterface")}},e};function Po(){for(var r=Mr.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(jt(i.family)&&!i.internal)return Mr.platform()==="darwin"&&e[t]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function No(){for(var r=Mr.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 c=o[i];if(jt(c.family)){t.push(c.address);break}}return t}function jt(r){return r===4||r==="IPv4"}});var Kt=T((uc,Yt)=>{var Re=1e3,De=Re*60,Fe=De*60,Te=Fe*24,Ro=Te*7,Do=Te*365.25;Yt.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return Fo(r);if(t==="number"&&isFinite(r))return e.long?Mo(r):_o(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Fo(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*Do;case"weeks":case"week":case"w":return t*Ro;case"days":case"day":case"d":return t*Te;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Fe;case"minutes":case"minute":case"mins":case"min":case"m":return t*De;case"seconds":case"second":case"secs":case"sec":case"s":return t*Re;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function _o(r){var e=Math.abs(r);return e>=Te?Math.round(r/Te)+"d":e>=Fe?Math.round(r/Fe)+"h":e>=De?Math.round(r/De)+"m":e>=Re?Math.round(r/Re)+"s":r+"ms"}function Mo(r){var e=Math.abs(r);return e>=Te?dr(r,e,Te,"day"):e>=Fe?dr(r,e,Fe,"hour"):e>=De?dr(r,e,De,"minute"):e>=Re?dr(r,e,Re,"second"):r+" ms"}function dr(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var qr=T((hc,Xt)=>{function ko(r){t.debug=t,t.default=t,t.coerce=I,t.disable=i,t.enable=o,t.enabled=c,t.humanize=Kt(),t.destroy=w,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,l,s;function g(...E){if(!g.enabled)return;let x=g,b=Number(new Date),P=b-(a||b);x.diff=P,x.prev=a,x.curr=b,a=b,E[0]=t.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let U=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(A,q)=>{if(A==="%%")return"%";U++;let H=t.formatters[q];if(typeof H=="function"){let Pe=E[U];A=H.call(x,Pe),E.splice(U,1),U--}return A}),t.formatArgs.call(x,E),(x.log||t.log).apply(x,E)}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:(l!==t.namespaces&&(l=t.namespaces,s=t.enabled(p)),s),set:E=>{d=E}}),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,]+/),l=d.length;for(a=0;a<l;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(u),...t.skips.map(u).map(a=>"-"+a)].join(",");return t.enable(""),p}function c(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 u(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}function I(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 t.enable(t.load()),t}Xt.exports=ko});var ft=T((G,lr)=>{G.formatArgs=zo;G.save=$o;G.load=Vo;G.useColors=qo;G.storage=jo();G.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`."))}})();G.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 qo(){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 zo(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+lr.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)}G.log=console.debug||console.log||(()=>{});function $o(r){try{r?G.storage.setItem("debug",r):G.storage.removeItem("debug")}catch{}}function Vo(){let r;try{r=G.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function jo(){try{return localStorage}catch{}}lr.exports=qr()(G);var{formatters:Go}=lr.exports;Go.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Wt=T((pc,Qt)=>{"use strict";Qt.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 Zt=T((gc,Jt)=>{"use strict";var Ho=se("os"),W=Wt(),F=process.env,_e;W("no-color")||W("no-colors")||W("color=false")?_e=!1:(W("color")||W("colors")||W("color=true")||W("color=always"))&&(_e=!0);"FORCE_COLOR"in F&&(_e=F.FORCE_COLOR.length===0||parseInt(F.FORCE_COLOR,10)!==0);function Yo(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function Ko(r){if(_e===!1)return 0;if(W("color=16m")||W("color=full")||W("color=truecolor"))return 3;if(W("color=256"))return 2;if(r&&!r.isTTY&&_e!==!0)return 0;let e=_e?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 F)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in F)||F.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in F)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(F.TEAMCITY_VERSION)?1:0;if(F.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in F){let t=parseInt((F.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(F.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(F.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(F.TERM)||"COLORTERM"in F?1:(F.TERM==="dumb",e)}function zr(r){let e=Ko(r);return Yo(e)}Jt.exports={supportsColor:zr,stdout:zr(process.stdout),stderr:zr(process.stderr)}});var rn=T((D,hr)=>{var Xo=se("tty"),ur=se("util");D.init=ri;D.log=Jo;D.formatArgs=Qo;D.save=Zo;D.load=ei;D.useColors=fo;D.destroy=ur.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");D.colors=[6,2,3,4,5,1];try{let r=Zt();r&&(r.stderr||r).level>=2&&(D.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{}D.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 fo(){return"colors"in D.inspectOpts?!!D.inspectOpts.colors:Xo.isatty(process.stderr.fd)}function Qo(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),r.push(o+"m+"+ur.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=Go()+e+" "+r[0]}function Go(){return P.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Xo(...r){return process.stderr.write(lr.format(...r)+`
5
- `)}function Qo(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function Wo(){return process.env.DEBUG}function Jo(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]]}ur.exports=Mr()(P);var{formatters:Jt}=ur.exports;Jt.o=function(r){return this.inspectOpts.colors=this.useColors,lr.inspect(r,this.inspectOpts).split(`
6
- `).map(e=>e.trim()).join(" ")};Jt.O=function(r){return this.inspectOpts.colors=this.useColors,lr.inspect(r,this.inspectOpts)}});var ft=T((ic,qr)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?qr.exports=Ht():qr.exports=Zt()});var Ln=T((Ea,Tn)=>{Tn.exports=ht;var An=128,ls=127,us=~ls,hs=Math.pow(2,31);function ht(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw ht.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=hs;)e[t++]=r&255|An,r/=128;for(;r&us;)e[t++]=r&255|An,r>>>=7;return e[t]=r|0,ht.bytes=t-n+1,e}});var Rn=T((Ca,Nn)=>{Nn.exports=pt;var ps=128,Bn=127;function pt(r,n){var t=0,n=n||0,o=0,i=n,c,u=r.length;do{if(i>=u||o>49)throw pt.bytes=0,new RangeError("Could not decode varint");c=r[i++],t+=o<28?(c&Bn)<<o:(c&Bn)*Math.pow(2,o),o+=7}while(c>=ps);return pt.bytes=i-n,t}});var Pn=T((va,Dn)=>{var gs=Math.pow(2,7),ms=Math.pow(2,14),ys=Math.pow(2,21),ws=Math.pow(2,28),Es=Math.pow(2,35),Cs=Math.pow(2,42),vs=Math.pow(2,49),Is=Math.pow(2,56),bs=Math.pow(2,63);Dn.exports=function(r){return r<gs?1:r<ms?2:r<ys?3:r<ws?4:r<Es?5:r<Cs?6:r<vs?7:r<Is?8:r<bs?9:10}});var Cr=T((Ia,Fn)=>{Fn.exports={encode:Ln(),decode:Rn(),encodingLength:Pn()}});var Gn=T(($a,Hn)=>{"use strict";function Kn(r,e){for(let t in e)Object.defineProperty(r,t,{value:e[t],enumerable:!0,configurable:!0});return r}function Ms(r,e,t){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");t||(t={}),typeof e=="object"&&(t=e,e=""),e&&(t.code=e);try{return Kn(r,t)}catch{t.message=r.message,t.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),Kn(new o,t)}}Hn.exports=Ms});var Ys={};z(Ys,{mdns:()=>js});var no=Se(Vt(),1);var Oe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ye,sr=class extends EventTarget{constructor(){super(...arguments),ye.set(this,new Map)}listenerCount(e){let t=Oe(this,ye,"f").get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let o=Oe(this,ye,"f").get(e);o==null&&(o=[],Oe(this,ye,"f").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=Oe(this,ye,"f").get(e);o!=null&&(o=o.filter(({callback:i})=>i!==t),Oe(this,ye,"f").set(e,o))}dispatchEvent(e){let t=super.dispatchEvent(e),n=Oe(this,ye,"f").get(e.type);return n==null||(n=n.filter(({once:o})=>!o),Oe(this,ye,"f").set(e.type,n)),t}safeDispatchEvent(e,t){return this.dispatchEvent(new cr(e,t))}};ye=new WeakMap;var _r=class extends Event{constructor(e,t){super(e,t),this.detail=t?.detail}},cr=globalThis.CustomEvent??_r;var ne=Se(ft(),1);var Yr={};z(Yr,{base58btc:()=>B,base58flickr:()=>ni});function Zo(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),c=i.charCodeAt(0);if(t[c]!==255)throw new TypeError(i+" is ambiguous");t[c]=o}var u=r.length,C=r.charAt(0),E=Math.log(u)/Math.log(256),g=Math.log(256)/Math.log(u);function a(s){if(s instanceof Uint8Array||(ArrayBuffer.isView(s)?s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength):Array.isArray(s)&&(s=Uint8Array.from(s))),!(s instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(s.length===0)return"";for(var p=0,w=0,v=0,b=s.length;v!==b&&s[v]===0;)v++,p++;for(var N=(b-v)*g+1>>>0,U=new Uint8Array(N);v!==b;){for(var L=s[v],O=0,q=N-1;(L!==0||O<w)&&q!==-1;q--,O++)L+=256*U[q]>>>0,U[q]=L%u>>>0,L=L/u>>>0;if(L!==0)throw new Error("Non-zero carry");w=O,v++}for(var K=N-w;K!==N&&U[K]===0;)K++;for(var Be=C.repeat(p);K<N;++K)Be+=r.charAt(U[K]);return Be}function d(s){if(typeof s!="string")throw new TypeError("Expected String");if(s.length===0)return new Uint8Array;var p=0;if(s[p]!==" "){for(var w=0,v=0;s[p]===C;)w++,p++;for(var b=(s.length-p)*E+1>>>0,N=new Uint8Array(b);s[p];){var U=t[s.charCodeAt(p)];if(U===255)return;for(var L=0,O=b-1;(U!==0||L<v)&&O!==-1;O--,L++)U+=u*N[O]>>>0,N[O]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");v=L,p++}if(s[p]!==" "){for(var q=b-v;q!==b&&N[q]===0;)q++;for(var K=new Uint8Array(w+(b-q)),Be=w;q!==b;)K[Be++]=N[q++];return K}}}function l(s){var p=d(s);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:a,decodeUnsafe:d,decode:l}}var fo=Zo,ei=fo,en=ei;var cc=new Uint8Array(0);var rn=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},H=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")};var tn=r=>new TextEncoder().encode(r),nn=r=>new TextDecoder().decode(r);var zr=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")}},$r=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 sn(this,e)}},Vr=class{constructor(e){this.decoders=e}or(e){return sn(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`)}},sn=(r,e)=>new Vr({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),jr=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new zr(e,t,n),this.decoder=new $r(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},_e=({name:r,prefix:e,encode:t,decode:n})=>new jr(r,e,t,n),ve=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=en(t,e);return _e({prefix:r,name:e,encode:n,decode:i=>H(o(i))})},ri=(r,e,t,n)=>{let o={};for(let g=0;g<e.length;++g)o[e[g]]=g;let i=r.length;for(;r[i-1]==="=";)--i;let c=new Uint8Array(i*t/8|0),u=0,C=0,E=0;for(let g=0;g<i;++g){let a=o[r[g]];if(a===void 0)throw new SyntaxError(`Non-${n} character`);C=C<<t|a,u+=t,u>=8&&(u-=8,c[E++]=255&C>>u)}if(u>=t||255&C<<8-u)throw new SyntaxError("Unexpected end of data");return c},ti=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,i="",c=0,u=0;for(let C=0;C<r.length;++C)for(u=u<<8|r[C],c+=8;c>t;)c-=t,i+=e[o&u>>c];if(c&&(i+=e[o&u<<t-c]),n)for(;i.length*t&7;)i+="=";return i},A=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>_e({prefix:e,name:r,encode(o){return ti(o,n,t)},decode(o){return ri(o,n,t,r)}});var B=ve({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ni=ve({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Kr={};z(Kr,{base32:()=>J,base32hex:()=>ci,base32hexpad:()=>di,base32hexpadupper:()=>li,base32hexupper:()=>ai,base32pad:()=>ii,base32padupper:()=>si,base32upper:()=>oi,base32z:()=>ui});var J=A({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),oi=A({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ii=A({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),si=A({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ci=A({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ai=A({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),di=A({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),li=A({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ui=A({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Gr={};z(Gr,{base64:()=>Hr,base64pad:()=>hi,base64url:()=>pi,base64urlpad:()=>gi});var Hr=A({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),hi=A({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pi=A({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),gi=A({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});ne.default.formatters.b=r=>r==null?"undefined":B.baseEncode(r);ne.default.formatters.t=r=>r==null?"undefined":J.baseEncode(r);ne.default.formatters.m=r=>r==null?"undefined":Hr.baseEncode(r);ne.default.formatters.p=r=>r==null?"undefined":r.toString();ne.default.formatters.c=r=>r==null?"undefined":r.toString();ne.default.formatters.k=r=>r==null?"undefined":r.toString();function hr(r){return Object.assign((0,ne.default)(r),{error:(0,ne.default)(`${r}:error`),trace:(0,ne.default)(`${r}:trace`)})}var mi=dn,cn=128,yi=127,wi=~yi,Ei=Math.pow(2,31);function dn(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ei;)e[t++]=r&255|cn,r/=128;for(;r&wi;)e[t++]=r&255|cn,r>>>=7;return e[t]=r|0,dn.bytes=t-n+1,e}var Ci=Xr,vi=128,an=127;function Xr(r,n){var t=0,n=n||0,o=0,i=n,c,u=r.length;do{if(i>=u)throw Xr.bytes=0,new RangeError("Could not decode varint");c=r[i++],t+=o<28?(c&an)<<o:(c&an)*Math.pow(2,o),o+=7}while(c>=vi);return Xr.bytes=i-n,t}var Ii=Math.pow(2,7),bi=Math.pow(2,14),xi=Math.pow(2,21),Si=Math.pow(2,28),Ui=Math.pow(2,35),Oi=Math.pow(2,42),Ai=Math.pow(2,49),Ti=Math.pow(2,56),Li=Math.pow(2,63),Bi=function(r){return r<Ii?1:r<bi?2:r<xi?3:r<Si?4:r<Ui?5:r<Oi?6:r<Ai?7:r<Ti?8:r<Li?9:10},Ni={encode:mi,decode:Ci,encodingLength:Bi},Ri=Ni,Ye=Ri;var Ke=(r,e=0)=>[Ye.decode(r,e),Ye.decode.bytes],Me=(r,e,t=0)=>(Ye.encode(r,e,t),e),ke=r=>Ye.encodingLength(r);var Ie=(r,e)=>{let t=e.byteLength,n=ke(r),o=n+ke(t),i=new Uint8Array(o+t);return Me(r,i,0),Me(t,i,n),i.set(e,o),new qe(r,t,e,i)},Te=r=>{let e=H(r),[t,n]=Ke(e),[o,i]=Ke(e.subarray(n)),c=e.subarray(n+i);if(c.byteLength!==o)throw new Error("Incorrect length");return new qe(t,o,c,e)},ln=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&rn(r.bytes,t.bytes)}},qe=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var un=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Pi(t,Qr(r),e||B.encoder);default:return Fi(t,Qr(r),e||J.encoder)}};var hn=new WeakMap,Qr=r=>{let e=hn.get(r);if(e==null){let t=new Map;return hn.set(r,t),t}return e},I=class{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!==_i)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return I.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=Ie(e,t);return I.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 I.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&ln(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 I)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:i,bytes:c}=t;return new I(n,o,i,c||pn(n,o,i.bytes))}else if(t[Mi]===!0){let{version:n,multihash:o,code:i}=t,c=Te(o);return I.create(n,i,c)}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 I(e,t,n,n.bytes)}case 1:{let o=pn(e,t,n.bytes);return new I(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return I.create(0,He,e)}static createV1(e,t){return I.create(1,e,t)}static decode(e){let[t,n]=I.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=I.inspectBytes(e),n=t.size-t.multihashSize,o=H(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=o.subarray(t.multihashSize-t.digestSize),c=new qe(t.multihashCode,t.digestSize,i,o);return[t.version===0?I.createV0(c):I.createV1(t.codec,c),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 c=t,u=n(),C=n(),E=t+C,g=E-c;return{version:o,codec:i,multihashCode:u,digestSize:C,multihashSize:g,size:E}}static parse(e,t){let[n,o]=Di(e,t),i=I.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Qr(i).set(n,e),i}},Di=(r,e)=>{switch(r[0]){case"Q":{let t=e||B;return[B.prefix,t.decode(`${B.prefix}${r}`)]}case B.prefix:{let t=e||B;return[B.prefix,t.decode(r)]}case J.prefix:{let t=e||J;return[J.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},Pi=(r,e,t)=>{let{prefix:n}=t;if(n!==B.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},Fi=(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,_i=18,pn=(r,e,t)=>{let n=ke(r),o=n+ke(e),i=new Uint8Array(o+t.byteLength);return Me(r,i,0),Me(e,i,n),i.set(t,o),i},Mi=Symbol.for("@ipld/js-cid/CID");var Wr={};z(Wr,{identity:()=>ki});var ki=_e({prefix:"\0",name:"identity",encode:r=>nn(r),decode:r=>tn(r)});var Jr={};z(Jr,{base2:()=>qi});var qi=A({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Zr={};z(Zr,{base8:()=>zi});var zi=A({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var fr={};z(fr,{base10:()=>$i});var $i=ve({prefix:"9",name:"base10",alphabet:"0123456789"});var et={};z(et,{base16:()=>Vi,base16upper:()=>ji});var Vi=A({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ji=A({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rt={};z(rt,{base36:()=>Yi,base36upper:()=>Ki});var Yi=ve({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ki=ve({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var tt={};z(tt,{base256emoji:()=>Wi});var gn=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}"),Hi=gn.reduce((r,e,t)=>(r[t]=e,r),[]),Gi=gn.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Xi(r){return r.reduce((e,t)=>(e+=Hi[t],e),"")}function Qi(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=_e({prefix:"\u{1F680}",name:"base256emoji",encode:Xi,decode:Qi});var st={};z(st,{sha256:()=>gr,sha512:()=>Ji});var it=Se(ie("crypto"),1);var ot=({name:r,code:e,encode:t})=>new nt(r,e,t),nt=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?Ie(this.code,t):t.then(n=>Ie(this.code,n))}else throw Error("Unknown type, must be binary type")}};var gr=ot({name:"sha2-256",code:18,encode:r=>H(it.default.createHash("sha256").update(r).digest())}),Ji=ot({name:"sha2-512",code:19,encode:r=>H(it.default.createHash("sha512").update(r).digest())});var ct={};z(ct,{identity:()=>mr});var yn=0,Zi="identity",wn=H,fi=r=>Ie(yn,wn(r)),mr={code:yn,name:Zi,encode:wn,digest:fi};var kc=new TextEncoder,qc=new TextDecoder;var be={...Wr,...Jr,...Zr,...fr,...et,...Kr,...rt,...Yr,...Gr,...tt},Yc={...st,...ct};function Ge(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 En=Symbol.for("@libp2p/peer-id");var ts=Symbol.for("nodejs.util.inspect.custom"),Cn=Object.values(be).map(r=>r.decoder).reduce((r,e)=>r.or(e),be.identity.decoder),vn=114,In=36,bn=37,Xe=class{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()})`}get[En](){return!0}toString(){return this.string==null&&(this.string=B.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return I.createV1(vn,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return Ge(this.multihash.bytes,e);if(typeof e=="string")return at(e).equals(this);if(e?.multihash?.bytes!=null)return Ge(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[ts](){return`PeerId(${this.toString()})`}},Qe=class extends Xe{constructor(e){super({...e,type:"RSA"}),this.type="RSA",this.publicKey=e.publicKey}},We=class extends Xe{constructor(e){super({...e,type:"Ed25519"}),this.type="Ed25519",this.publicKey=e.multihash.digest}},Je=class extends Xe{constructor(e){super({...e,type:"secp256k1"}),this.type="secp256k1",this.publicKey=e.multihash.digest}};function at(r,e){if(e=e??Cn,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Te(B.decode(`z${r}`));return r.startsWith("12D")?new We({multihash:t}):r.startsWith("16U")?new Je({multihash:t}):new Qe({multihash:t})}return ns(Cn.decode(r))}function ns(r){try{let e=Te(r);if(e.code===mr.code){if(e.digest.length===In)return new We({multihash:e});if(e.digest.length===bn)return new Je({multihash:e})}if(e.code===gr.code)return new Qe({multihash:e})}catch{return os(I.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function os(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==vn)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===gr.code)return new Qe({multihash:r.multihash});if(e.code===mr.code){if(e.digest.length===In)return new We({multihash:r.multihash});if(e.digest.length===bn)return new Je({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var xe=ie("node:net");function yr(r){return!!(0,xe.isIP)(r)}function ze(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function wr(r=0){return globalThis.Buffer?.allocUnsafe!=null?ze(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Sn(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var xn=Sn("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),dt=Sn("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=wr(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),is={utf8:xn,"utf-8":xn,hex:be.base16,latin1:dt,ascii:dt,binary:dt,...be},Er=is;function k(r,e="utf8"){let t=Er[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)}var Un=xe.isIPv4,ss=xe.isIPv6,lt=function(r){let e=0;if(r=r.toString().trim(),Un(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(ss(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let i=Un(t[n]),c;i&&(c=lt(t[n]),t[n]=k(c.slice(0,2),"base16")),c!=null&&++n<8&&t.splice(n,0,k(c.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")},On=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 Ze={},ut={},as=[[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"],[281,0,"webrtc-w3c"],[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"]];as.forEach(r=>{let e=ds(...r);ut[e.code]=e,Ze[e.name]=e});function ds(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function S(r){if(typeof r=="number"){if(ut[r]!=null)return ut[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ze[r]!=null)return Ze[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var oe=Se(Cr(),1);function gt(r,e="utf8"){let t=Er[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ze(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}function we(r,e){e==null&&(e=r.reduce((o,i)=>o+i.length,0));let t=wr(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return ze(t)}function zn(r,e){switch(S(r).code){case 4:case 41:return Ss(e);case 42:return kn(e);case 6:case 273:case 33:case 132:return Vn(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return kn(e);case 421:return Ts(e);case 444:return qn(e);case 445:return qn(e);case 466:return As(e);default:return k(e,"base16")}}function $n(r,e){switch(S(r).code){case 4:return _n(e);case 41:return _n(e);case 42:return Mn(e);case 6:case 273:case 33:case 132:return yt(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Mn(e);case 421:return Us(e);case 444:return Ls(e);case 445:return Bs(e);case 466:return Os(e);default:return gt(e,"base16")}}var mt=Object.values(be).map(r=>r.decoder),xs=function(){let r=mt[0].or(mt[1]);return mt.slice(2).forEach(e=>r=r.or(e)),r}();function _n(r){if(!yr(r))throw new Error("invalid ip address");return lt(r)}function Ss(r){let e=On(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!yr(e))throw new Error("invalid ip address");return e}function yt(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Vn(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Mn(r){let e=gt(r),t=Uint8Array.from(oe.default.encode(e.length));return we([t,e],t.length+e.length)}function kn(r){let e=oe.default.decode(r);if(r=r.slice(oe.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return k(r)}function Us(r){let e;r[0]==="Q"||r[0]==="1"?e=Te(B.decode(`z${r}`)).bytes:e=I.parse(r).multihash.bytes;let t=Uint8Array.from(oe.default.encode(e.length));return we([t,e],t.length+e.length)}function Os(r){let e=xs.decode(r),t=Uint8Array.from(oe.default.encode(e.length));return we([t,e],t.length+e.length)}function As(r){let e=oe.default.decode(r),t=r.slice(oe.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+k(t,"base64url")}function Ts(r){let e=oe.default.decode(r),t=r.slice(oe.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return k(t,"base58btc")}function Ls(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=J.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=yt(n);return we([t,o],t.length+o.length)}function Bs(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=J.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=yt(n);return we([t,o],t.length+o.length)}function qn(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=k(e,"base32"),o=Vn(t);return`${n}:${o}`}var $e=Se(Cr(),1);function Ns(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let n=0;n<t.length;n++){let o=t[n],i=S(o);if(i.size===0){e.push([o]);continue}if(n++,n>=t.length)throw Yn("invalid address: "+r);if(i.path===!0){e.push([o,It(t.slice(n).join("/"))]);break}e.push([o,t[n]])}return e}function Rs(r){let e=[];return r.map(t=>{let n=br(t);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),It(e.join("/"))}function Ds(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=br(e);return e.length>1?[t.code,$n(t.code,e[1])]:[t.code]})}function wt(r){return r.map(e=>{let t=br(e);return e[1]!=null?[t.code,zn(t.code,e[1])]:[t.code]})}function Et(r){return Ir(we(r.map(e=>{let t=br(e),n=Uint8Array.from($e.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=we([n,e[1]])),n})))}function Ct(r,e){return r.size>0?r.size/8:r.size===0?0:$e.default.decode(e)+($e.default.decode.bytes??0)}function vr(r){let e=[],t=0;for(;t<r.length;){let n=$e.default.decode(r,t),o=$e.default.decode.bytes??0,i=S(n),c=Ct(i,r.slice(t+o));if(c===0){e.push([n]),t+=o;continue}let u=r.slice(t+o,t+o+c);if(t+=c+o,t>r.length)throw Yn("Invalid address Uint8Array: "+k(r,"base16"));e.push([n,u])}return e}function vt(r){let e=vr(r),t=wt(e);return Rs(t)}function Ps(r){r=It(r);let e=Ns(r),t=Ds(e);return Et(t)}function jn(r){return Ps(r)}function Ir(r){let e=Fs(r);if(e!=null)throw e;return Uint8Array.from(r)}function Fs(r){try{vr(r)}catch(e){return e}}function It(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function Yn(r){return new Error("Error parsing address: "+r)}function br(r){return S(r[0])}var xt=Se(Cr(),1);var Qn=Se(Gn(),1);var Ve=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},bt=function(r,e,t,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,t):o?o.value=t:e.set(r,t),t},fe,er,rr,Xn,ks=Symbol.for("nodejs.util.inspect.custom"),qs=[S("dns").code,S("dns4").code,S("dns6").code,S("dnsaddr").code],zs=new Map,Wn=Symbol.for("@multiformats/js-multiaddr/multiaddr");function $s(r){return!!r?.[Wn]}var Ee=class{constructor(e){if(fe.set(this,void 0),er.set(this,void 0),rr.set(this,void 0),this[Xn]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=Ir(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=jn(e)}else if($s(e))this.bytes=Ir(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return Ve(this,fe,"f")==null&&bt(this,fe,vt(this.bytes),"f"),Ve(this,fe,"f")}toJSON(){return this.toString()}toOptions(){let e,t,n,o,i="",c=S("tcp"),u=S("udp"),C=S("ip4"),E=S("ip6"),g=S("dns6"),a=S("ip6zone");for(let[l,s]of this.stringTuples())l===a.code&&(i=`%${s??""}`),qs.includes(l)&&(t=c.name,o=443,n=`${s??""}${i}`,e=l===g.code?6:4),(l===c.code||l===u.code)&&(t=S(l).name,o=parseInt(s??"")),(l===C.code||l===E.code)&&(t=S(l).name,n=`${s??""}${i}`,e=l===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.protoCodes().map(e=>Object.assign({},S(e)))}protoCodes(){let e=[],t=this.bytes,n=0;for(;n<t.length;){let o=xt.default.decode(t,n),i=xt.default.decode.bytes??0,c=S(o),u=Ct(c,t.slice(n+i));n+=u+i,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return Ve(this,er,"f")==null&&bt(this,er,vr(this.bytes),"f"),Ve(this,er,"f")}stringTuples(){return Ve(this,rr,"f")==null&&bt(this,rr,wt(this.tuples()),"f"),Ve(this,rr,"f")}encapsulate(e){return e=new Ee(e),new Ee(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 Ee(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 Ee(Et(t.slice(0,n)));return this}getPeerId(){try{let t=this.stringTuples().filter(n=>n[0]===Ze.ipfs.code).pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?k(B.decode(`z${n}`),"base58btc"):k(I.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(t=>S(t[0]).path===!0)[0][1],e==null&&(e=null)}catch{e=null}return e}equals(e){return Ge(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let n=zs.get(t.name);if(n==null)throw(0,Qn.default)(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(i=>new Ee(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)}[(fe=new WeakMap,er=new WeakMap,rr=new WeakMap,Xn=Wn,ks)](){return`Multiaddr(${vt(this.bytes)})`}};function Jn(r){return new Ee(r)}var tr=hr("libp2p:mdns:query");function Zn(r,e,t){let n=()=>{tr("query",e),r.query({questions:[{name:e,type:"PTR"}]})};return n(),setInterval(n,t)}function fn(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(u=>u.data).filter(u=>u.toString().startsWith("dnsaddr=")).map(u=>Jn(u.toString().substring(8))),c=i[0].getPeerId();if(c==null)throw new Error("Multiaddr doesn't contain PeerId");return tr("peer found %p",c),{id:at(c),multiaddrs:i,protocols:[]}}catch(i){tr.error("failed to parse mdns response",i)}}function eo(r,e,t,n,o,i){if(!i){tr("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 c=[];c.push({name:o,type:"PTR",class:"IN",ttl:120,data:t+"."+o}),n.forEach(u=>{u.getPeerId()!=null&&c.push({name:t+"."+o,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+u.toString()})}),tr("responding to query"),e.respond(c)}}var ro=Symbol.for("@libp2p/peer-discovery");function to(r){let e="",t="abcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}var xr=hr("libp2p:mdns"),St=class extends sr{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??to(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)}get[ro](){return!0}get[Symbol.toStringTag](){return"@libp2p/mdns"}isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,no.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=Zn(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){if(this.mdns==null)return;xr.trace("received incoming mDNS query");let t=this.components.peerId;eo(e,this.mdns,this.peerName,this.components.addressManager.getAddresses().map(n=>n.encapsulate("/p2p/"+t.toString())),this.serviceTag,this.broadcast)}_onMdnsResponse(e){xr.trace("received mDNS query response");try{let t=fn(e,this.peerName,this.serviceTag);t!=null&&(xr("discovered peer in mDNS qeury response %p",t.id),this.dispatchEvent(new cr("peer",{detail:t})))}catch(t){xr.error("Error processing peer response",t)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new cr("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 js(r={}){return e=>new St(e,r)}return lo(Ys);})();
4
+ `+i),r.push(o+"m+"+hr.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=Wo()+e+" "+r[0]}function Wo(){return D.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Jo(...r){return process.stderr.write(ur.format(...r)+`
5
+ `)}function Zo(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function ei(){return process.env.DEBUG}function ri(r){r.inspectOpts={};let e=Object.keys(D.inspectOpts);for(let t=0;t<e.length;t++)r.inspectOpts[e[t]]=D.inspectOpts[e[t]]}hr.exports=qr()(D);var{formatters:en}=hr.exports;en.o=function(r){return this.inspectOpts.colors=this.useColors,ur.inspect(r,this.inspectOpts).split(`
6
+ `).map(e=>e.trim()).join(" ")};en.O=function(r){return this.inspectOpts.colors=this.useColors,ur.inspect(r,this.inspectOpts)}});var tn=T((mc,$r)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?$r.exports=ft():$r.exports=rn()});var Nn=T((Ta,Pn)=>{Pn.exports=gt;var Bn=128,ms=127,ys=~ms,ws=Math.pow(2,31);function gt(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw gt.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=ws;)e[t++]=r&255|Bn,r/=128;for(;r&ys;)e[t++]=r&255|Bn,r>>>=7;return e[t]=r|0,gt.bytes=t-n+1,e}});var Fn=T((La,Dn)=>{Dn.exports=mt;var Es=128,Rn=127;function mt(r,n){var t=0,n=n||0,o=0,i=n,c,u=r.length;do{if(i>=u||o>49)throw mt.bytes=0,new RangeError("Could not decode varint");c=r[i++],t+=o<28?(c&Rn)<<o:(c&Rn)*Math.pow(2,o),o+=7}while(c>=Es);return mt.bytes=i-n,t}});var Mn=T((Ba,_n)=>{var Is=Math.pow(2,7),vs=Math.pow(2,14),xs=Math.pow(2,21),Cs=Math.pow(2,28),bs=Math.pow(2,35),Ss=Math.pow(2,42),Us=Math.pow(2,49),As=Math.pow(2,56),Os=Math.pow(2,63);_n.exports=function(r){return r<Is?1:r<vs?2:r<xs?3:r<Cs?4:r<bs?5:r<Ss?6:r<Us?7:r<As?8:r<Os?9:10}});var vr=T((Pa,kn)=>{kn.exports={encode:Nn(),decode:Fn(),encodingLength:Mn()}});var Jn=T((_d,Wn)=>{"use strict";function Qn(r,e){for(let t in e)Object.defineProperty(r,t,{value:e[t],enumerable:!0,configurable:!0});return r}function Ks(r,e,t){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");t||(t={}),typeof e=="object"&&(t=e,e=""),e&&(t.code=e);try{return Qn(r,t)}catch{t.message=r.message,t.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),Qn(new o,t)}}Wn.exports=Ks});var ec={};z(ec,{mdns:()=>Zs});var co=Ue(Ht(),1);var Oe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},we,cr=class extends EventTarget{constructor(){super(...arguments),we.set(this,new Map)}listenerCount(e){let t=Oe(this,we,"f").get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let o=Oe(this,we,"f").get(e);o==null&&(o=[],Oe(this,we,"f").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=Oe(this,we,"f").get(e);o!=null&&(o=o.filter(({callback:i})=>i!==t),Oe(this,we,"f").set(e,o))}dispatchEvent(e){let t=super.dispatchEvent(e),n=Oe(this,we,"f").get(e.type);return n==null||(n=n.filter(({once:o})=>!o),Oe(this,we,"f").set(e.type,n)),t}safeDispatchEvent(e,t){return this.dispatchEvent(new ar(e,t))}};we=new WeakMap;var kr=class extends Event{constructor(e,t){super(e,t),this.detail=t?.detail}},ar=globalThis.CustomEvent??kr;var K=Ue(tn(),1);var Yr={};z(Yr,{base58btc:()=>B,base58flickr:()=>ci});function ti(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),c=i.charCodeAt(0);if(t[c]!==255)throw new TypeError(i+" is ambiguous");t[c]=o}var u=r.length,I=r.charAt(0),w=Math.log(u)/Math.log(256),p=Math.log(256)/Math.log(u);function a(s){if(s instanceof Uint8Array||(ArrayBuffer.isView(s)?s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength):Array.isArray(s)&&(s=Uint8Array.from(s))),!(s instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(s.length===0)return"";for(var g=0,E=0,x=0,b=s.length;x!==b&&s[x]===0;)x++,g++;for(var P=(b-x)*p+1>>>0,U=new Uint8Array(P);x!==b;){for(var L=s[x],A=0,q=P-1;(L!==0||A<E)&&q!==-1;q--,A++)L+=256*U[q]>>>0,U[q]=L%u>>>0,L=L/u>>>0;if(L!==0)throw new Error("Non-zero carry");E=A,x++}for(var H=P-E;H!==P&&U[H]===0;)H++;for(var Pe=I.repeat(g);H<P;++H)Pe+=r.charAt(U[H]);return Pe}function d(s){if(typeof s!="string")throw new TypeError("Expected String");if(s.length===0)return new Uint8Array;var g=0;if(s[g]!==" "){for(var E=0,x=0;s[g]===I;)E++,g++;for(var b=(s.length-g)*w+1>>>0,P=new Uint8Array(b);s[g];){var U=t[s.charCodeAt(g)];if(U===255)return;for(var L=0,A=b-1;(U!==0||L<x)&&A!==-1;A--,L++)U+=u*P[A]>>>0,P[A]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");x=L,g++}if(s[g]!==" "){for(var q=b-x;q!==b&&P[q]===0;)q++;for(var H=new Uint8Array(E+(b-q)),Pe=E;q!==b;)H[Pe++]=P[q++];return H}}}function l(s){var g=d(s);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:a,decodeUnsafe:d,decode:l}}var ni=ti,oi=ni,nn=oi;var wc=new Uint8Array(0);var on=(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 sn=r=>new TextEncoder().encode(r),cn=r=>new TextDecoder().decode(r);var Vr=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")}},jr=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 dn(this,e)}},Gr=class{constructor(e){this.decoders=e}or(e){return dn(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`)}},dn=(r,e)=>new Gr({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Hr=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Vr(e,t,n),this.decoder=new jr(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Me=({name:r,prefix:e,encode:t,decode:n})=>new Hr(r,e,t,n),xe=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=nn(t,e);return Me({prefix:r,name:e,encode:n,decode:i=>Y(o(i))})},ii=(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 c=new Uint8Array(i*t/8|0),u=0,I=0,w=0;for(let p=0;p<i;++p){let a=o[r[p]];if(a===void 0)throw new SyntaxError(`Non-${n} character`);I=I<<t|a,u+=t,u>=8&&(u-=8,c[w++]=255&I>>u)}if(u>=t||255&I<<8-u)throw new SyntaxError("Unexpected end of data");return c},si=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,i="",c=0,u=0;for(let I=0;I<r.length;++I)for(u=u<<8|r[I],c+=8;c>t;)c-=t,i+=e[o&u>>c];if(c&&(i+=e[o&u<<t-c]),n)for(;i.length*t&7;)i+="=";return i},O=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Me({prefix:e,name:r,encode(o){return si(o,n,t)},decode(o){return ii(o,n,t,r)}});var B=xe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ci=xe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Kr={};z(Kr,{base32:()=>J,base32hex:()=>ui,base32hexpad:()=>pi,base32hexpadupper:()=>gi,base32hexupper:()=>hi,base32pad:()=>di,base32padupper:()=>li,base32upper:()=>ai,base32z:()=>mi});var J=O({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ai=O({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),di=O({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),li=O({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ui=O({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hi=O({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pi=O({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gi=O({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mi=O({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var fr={};z(fr,{base64:()=>Xr,base64pad:()=>yi,base64url:()=>wi,base64urlpad:()=>Ei});var Xr=O({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),yi=O({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wi=O({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ei=O({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});K.default.formatters.b=r=>r==null?"undefined":B.baseEncode(r);K.default.formatters.t=r=>r==null?"undefined":J.baseEncode(r);K.default.formatters.m=r=>r==null?"undefined":Xr.baseEncode(r);K.default.formatters.p=r=>r==null?"undefined":r.toString();K.default.formatters.c=r=>r==null?"undefined":r.toString();K.default.formatters.k=r=>r==null?"undefined":r.toString();function Ii(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 pr(r){let e=Ii(`${r}:trace`);return K.default.enabled(`${r}:trace`)&&K.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(e=(0,K.default)(`${r}:trace`)),Object.assign((0,K.default)(r),{error:(0,K.default)(`${r}:error`),trace:e})}var vi=hn,ln=128,xi=127,Ci=~xi,bi=Math.pow(2,31);function hn(r,e,t){e=e||[],t=t||0;for(var n=t;r>=bi;)e[t++]=r&255|ln,r/=128;for(;r&Ci;)e[t++]=r&255|ln,r>>>=7;return e[t]=r|0,hn.bytes=t-n+1,e}var Si=Qr,Ui=128,un=127;function Qr(r,n){var t=0,n=n||0,o=0,i=n,c,u=r.length;do{if(i>=u)throw Qr.bytes=0,new RangeError("Could not decode varint");c=r[i++],t+=o<28?(c&un)<<o:(c&un)*Math.pow(2,o),o+=7}while(c>=Ui);return Qr.bytes=i-n,t}var Ai=Math.pow(2,7),Oi=Math.pow(2,14),Ti=Math.pow(2,21),Li=Math.pow(2,28),Bi=Math.pow(2,35),Pi=Math.pow(2,42),Ni=Math.pow(2,49),Ri=Math.pow(2,56),Di=Math.pow(2,63),Fi=function(r){return r<Ai?1:r<Oi?2:r<Ti?3:r<Li?4:r<Bi?5:r<Pi?6:r<Ni?7:r<Ri?8:r<Di?9:10},_i={encode:vi,decode:Si,encodingLength:Fi},Mi=_i,He=Mi;var Ye=(r,e=0)=>[He.decode(r,e),He.decode.bytes],ke=(r,e,t=0)=>(He.encode(r,e,t),e),qe=r=>He.encodingLength(r);var Ce=(r,e)=>{let t=e.byteLength,n=qe(r),o=n+qe(t),i=new Uint8Array(o+t);return ke(r,i,0),ke(t,i,n),i.set(e,o),new ze(r,t,e,i)},Le=r=>{let e=Y(r),[t,n]=Ye(e),[o,i]=Ye(e.subarray(n)),c=e.subarray(n+i);if(c.byteLength!==o)throw new Error("Incorrect length");return new ze(t,o,c,e)},pn=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&on(r.bytes,t.bytes)}},ze=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var gn=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return qi(t,Wr(r),e||B.encoder);default:return zi(t,Wr(r),e||J.encoder)}};var mn=new WeakMap,Wr=r=>{let e=mn.get(r);if(e==null){let t=new Map;return mn.set(r,t),t}return e},C=class{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!==Ke)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==$i)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return C.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 C.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 C.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&pn(e.multihash,n.multihash)}toString(e){return gn(this,e)}toJSON(){return{"/":gn(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 C)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:i,bytes:c}=t;return new C(n,o,i,c||yn(n,o,i.bytes))}else if(t[Vi]===!0){let{version:n,multihash:o,code:i}=t,c=Le(o);return C.create(n,i,c)}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!==Ke)throw new Error(`Version 0 CID must use dag-pb (code: ${Ke}) block encoding`);return new C(e,t,n,n.bytes)}case 1:{let o=yn(e,t,n.bytes);return new C(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return C.create(0,Ke,e)}static createV1(e,t){return C.create(1,e,t)}static decode(e){let[t,n]=C.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=C.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),c=new ze(t.multihashCode,t.digestSize,i,o);return[t.version===0?C.createV0(c):C.createV1(t.codec,c),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[a,d]=Ye(e.subarray(t));return t+=d,a},o=n(),i=Ke;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let c=t,u=n(),I=n(),w=t+I,p=w-c;return{version:o,codec:i,multihashCode:u,digestSize:I,multihashSize:p,size:w}}static parse(e,t){let[n,o]=ki(e,t),i=C.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Wr(i).set(n,e),i}},ki=(r,e)=>{switch(r[0]){case"Q":{let t=e||B;return[B.prefix,t.decode(`${B.prefix}${r}`)]}case B.prefix:{let t=e||B;return[B.prefix,t.decode(r)]}case J.prefix:{let t=e||J;return[J.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},qi=(r,e,t)=>{let{prefix:n}=t;if(n!==B.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},zi=(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},Ke=112,$i=18,yn=(r,e,t)=>{let n=qe(r),o=n+qe(e),i=new Uint8Array(o+t.byteLength);return ke(r,i,0),ke(e,i,n),i.set(t,o),i},Vi=Symbol.for("@ipld/js-cid/CID");var Jr={};z(Jr,{identity:()=>ji});var ji=Me({prefix:"\0",name:"identity",encode:r=>cn(r),decode:r=>sn(r)});var Zr={};z(Zr,{base2:()=>Gi});var Gi=O({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var et={};z(et,{base8:()=>Hi});var Hi=O({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var rt={};z(rt,{base10:()=>Yi});var Yi=xe({prefix:"9",name:"base10",alphabet:"0123456789"});var tt={};z(tt,{base16:()=>Ki,base16upper:()=>Xi});var Ki=O({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Xi=O({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var nt={};z(nt,{base36:()=>fi,base36upper:()=>Qi});var fi=xe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Qi=xe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ot={};z(ot,{base256emoji:()=>rs});var wn=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}"),Wi=wn.reduce((r,e,t)=>(r[t]=e,r),[]),Ji=wn.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Zi(r){return r.reduce((e,t)=>(e+=Wi[t],e),"")}function es(r){let e=[];for(let t of r){let n=Ji[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var rs=Me({prefix:"\u{1F680}",name:"base256emoji",encode:Zi,decode:es});var at={};z(at,{sha256:()=>mr,sha512:()=>ts});var ct=Ue(se("crypto"),1);var st=({name:r,code:e,encode:t})=>new it(r,e,t),it=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 mr=st({name:"sha2-256",code:18,encode:r=>Y(ct.default.createHash("sha256").update(r).digest())}),ts=st({name:"sha2-512",code:19,encode:r=>Y(ct.default.createHash("sha512").update(r).digest())});var dt={};z(dt,{identity:()=>yr});var In=0,ns="identity",vn=Y,os=r=>Ce(In,vn(r)),yr={code:In,name:ns,encode:vn,digest:os};var Xc=new TextEncoder,fc=new TextDecoder;var be={...Jr,...Zr,...et,...rt,...tt,...Kr,...nt,...Yr,...fr,...ot},ea={...at,...dt};function Xe(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 xn=Symbol.for("@libp2p/peer-id");var cs=Symbol.for("nodejs.util.inspect.custom"),Cn=Object.values(be).map(r=>r.decoder).reduce((r,e)=>r.or(e),be.identity.decoder),bn=114,Sn=36,Un=37,fe=class{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()})`}get[xn](){return!0}toString(){return this.string==null&&(this.string=B.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return C.createV1(bn,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return Xe(this.multihash.bytes,e);if(typeof e=="string")return lt(e).equals(this);if(e?.multihash?.bytes!=null)return Xe(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[cs](){return`PeerId(${this.toString()})`}},Qe=class extends fe{constructor(e){super({...e,type:"RSA"}),this.type="RSA",this.publicKey=e.publicKey}},We=class extends fe{constructor(e){super({...e,type:"Ed25519"}),this.type="Ed25519",this.publicKey=e.multihash.digest}},Je=class extends fe{constructor(e){super({...e,type:"secp256k1"}),this.type="secp256k1",this.publicKey=e.multihash.digest}};function lt(r,e){if(e=e??Cn,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Le(B.decode(`z${r}`));return r.startsWith("12D")?new We({multihash:t}):r.startsWith("16U")?new Je({multihash:t}):new Qe({multihash:t})}return as(Cn.decode(r))}function as(r){try{let e=Le(r);if(e.code===yr.code){if(e.digest.length===Sn)return new We({multihash:e});if(e.digest.length===Un)return new Je({multihash:e})}if(e.code===mr.code)return new Qe({multihash:e})}catch{return ds(C.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function ds(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==bn)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===mr.code)return new Qe({multihash:r.multihash});if(e.code===yr.code){if(e.digest.length===Sn)return new We({multihash:r.multihash});if(e.digest.length===Un)return new Je({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Se=se("node:net");function wr(r){return!!(0,Se.isIP)(r)}function $e(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Er(r=0){return globalThis.Buffer?.allocUnsafe!=null?$e(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function On(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var An=On("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),ut=On("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=Er(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),ls={utf8:An,"utf-8":An,hex:be.base16,latin1:ut,ascii:ut,binary:ut,...be},Ir=ls;function k(r,e="utf8"){let t=Ir[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)}var Tn=Se.isIPv4,us=Se.isIPv6,ht=function(r){let e=0;if(r=r.toString().trim(),Tn(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(us(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let i=Tn(t[n]),c;i&&(c=ht(t[n]),t[n]=k(c.slice(0,2),"base16")),c!=null&&++n<8&&t.splice(n,0,k(c.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")},Ln=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 Ze={},pt={},ps=[[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"]];ps.forEach(r=>{let e=gs(...r);pt[e.code]=e,Ze[e.name]=e});function gs(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function S(r){if(typeof r=="number"){if(pt[r]!=null)return pt[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ze[r]!=null)return Ze[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var ie=Ue(vr(),1);function yt(r,e="utf8"){let t=Ir[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?$e(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}function Ee(r,e){e==null&&(e=r.reduce((o,i)=>o+i.length,0));let t=Er(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return $e(t)}var xr=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,c=0,u=this.peekChar();if(u===void 0)return;let I=u==="0",w=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>w||(c+=1,t!==void 0&&c>t))return}if(c!==0)return!n&&I&&c>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 c=this.readSeparator(":",n,()=>this.readIPv4Addr());if(c!==void 0)return t[o]=c[0],t[o+1]=c[1],t[o+2]=c[2],t[o+3]=c[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),c=16-(n+2),[u]=e(i.subarray(0,c));return t.set(i.subarray(0,u),16-u),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var za=new xr;var Xa=parseInt("0xFFFF",16),fa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var Td=S("ip4"),Ld=S("ip6"),Bd=S("ipcidr");function Hn(r,e){switch(S(r).code){case 4:case 41:return Ds(e);case 42:return jn(e);case 6:case 273:case 33:case 132:return Kn(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return jn(e);case 421:return ks(e);case 444:return Gn(e);case 445:return Gn(e);case 466:return Ms(e);default:return k(e,"base16")}}function Yn(r,e){switch(S(r).code){case 4:return $n(e);case 41:return $n(e);case 42:return Vn(e);case 6:case 273:case 33:case 132:return Et(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Vn(e);case 421:return Fs(e);case 444:return qs(e);case 445:return zs(e);case 466:return _s(e);default:return yt(e,"base16")}}var wt=Object.values(be).map(r=>r.decoder),Rs=function(){let r=wt[0].or(wt[1]);return wt.slice(2).forEach(e=>r=r.or(e)),r}();function $n(r){if(!wr(r))throw new Error("invalid ip address");return ht(r)}function Ds(r){let e=Ln(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!wr(e))throw new Error("invalid ip address");return e}function Et(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Kn(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Vn(r){let e=yt(r),t=Uint8Array.from(ie.default.encode(e.length));return Ee([t,e],t.length+e.length)}function jn(r){let e=ie.default.decode(r);if(r=r.slice(ie.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return k(r)}function Fs(r){let e;r[0]==="Q"||r[0]==="1"?e=Le(B.decode(`z${r}`)).bytes:e=C.parse(r).multihash.bytes;let t=Uint8Array.from(ie.default.encode(e.length));return Ee([t,e],t.length+e.length)}function _s(r){let e=Rs.decode(r),t=Uint8Array.from(ie.default.encode(e.length));return Ee([t,e],t.length+e.length)}function Ms(r){let e=ie.default.decode(r),t=r.slice(ie.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+k(t,"base64url")}function ks(r){let e=ie.default.decode(r),t=r.slice(ie.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return k(t,"base58btc")}function qs(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=J.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Et(n);return Ee([t,o],t.length+o.length)}function zs(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=J.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Et(n);return Ee([t,o],t.length+o.length)}function Gn(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=k(e,"base32"),o=Kn(t);return`${n}:${o}`}var Ve=Ue(vr(),1);function $s(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let n=0;n<t.length;n++){let o=t[n],i=S(o);if(i.size===0){e.push([o]);continue}if(n++,n>=t.length)throw fn("invalid address: "+r);if(i.path===!0){e.push([o,bt(t.slice(n).join("/"))]);break}e.push([o,t[n]])}return e}function Vs(r){let e=[];return r.map(t=>{let n=Sr(t);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),bt(e.join("/"))}function js(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=Sr(e);return e.length>1?[t.code,Yn(t.code,e[1])]:[t.code]})}function It(r){return r.map(e=>{let t=Sr(e);return e[1]!=null?[t.code,Hn(t.code,e[1])]:[t.code]})}function vt(r){return br(Ee(r.map(e=>{let t=Sr(e),n=Uint8Array.from(Ve.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=Ee([n,e[1]])),n})))}function xt(r,e){return r.size>0?r.size/8:r.size===0?0:Ve.default.decode(e)+(Ve.default.decode.bytes??0)}function Cr(r){let e=[],t=0;for(;t<r.length;){let n=Ve.default.decode(r,t),o=Ve.default.decode.bytes??0,i=S(n),c=xt(i,r.slice(t+o));if(c===0){e.push([n]),t+=o;continue}let u=r.slice(t+o,t+o+c);if(t+=c+o,t>r.length)throw fn("Invalid address Uint8Array: "+k(r,"base16"));e.push([n,u])}return e}function Ct(r){let e=Cr(r),t=It(e);return Vs(t)}function Gs(r){r=bt(r);let e=$s(r),t=js(e);return vt(t)}function Xn(r){return Gs(r)}function br(r){let e=Hs(r);if(e!=null)throw e;return Uint8Array.from(r)}function Hs(r){try{Cr(r)}catch(e){return e}}function bt(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function fn(r){return new Error("Error parsing address: "+r)}function Sr(r){return S(r[0])}var At=Ue(vr(),1);var eo=Ue(Jn(),1);var je=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ut=function(r,e,t,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,t):o?o.value=t:e.set(r,t),t},er,rr,tr,Zn,Xs=Symbol.for("nodejs.util.inspect.custom"),fs=[S("dns").code,S("dns4").code,S("dns6").code,S("dnsaddr").code],Qs=new Map,ro=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Ws(r){return!!r?.[ro]}var Ie=class{constructor(e){if(er.set(this,void 0),rr.set(this,void 0),tr.set(this,void 0),this[Zn]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=br(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Xn(e)}else if(Ws(e))this.bytes=br(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return je(this,er,"f")==null&&Ut(this,er,Ct(this.bytes),"f"),je(this,er,"f")}toJSON(){return this.toString()}toOptions(){let e,t,n,o,i="",c=S("tcp"),u=S("udp"),I=S("ip4"),w=S("ip6"),p=S("dns6"),a=S("ip6zone");for(let[l,s]of this.stringTuples())l===a.code&&(i=`%${s??""}`),fs.includes(l)&&(t=c.name,o=443,n=`${s??""}${i}`,e=l===p.code?6:4),(l===c.code||l===u.code)&&(t=S(l).name,o=parseInt(s??"")),(l===I.code||l===w.code)&&(t=S(l).name,n=`${s??""}${i}`,e=l===w.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.protoCodes().map(e=>Object.assign({},S(e)))}protoCodes(){let e=[],t=this.bytes,n=0;for(;n<t.length;){let o=At.default.decode(t,n),i=At.default.decode.bytes??0,c=S(o),u=xt(c,t.slice(n+i));n+=u+i,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return je(this,rr,"f")==null&&Ut(this,rr,Cr(this.bytes),"f"),je(this,rr,"f")}stringTuples(){return je(this,tr,"f")==null&&Ut(this,tr,It(this.tuples()),"f"),je(this,tr,"f")}encapsulate(e){return e=new Ie(e),new Ie(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 Ie(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 Ie(vt(t.slice(0,n)));return this}getPeerId(){try{let t=this.stringTuples().filter(n=>n[0]===Ze.ipfs.code).pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?k(B.decode(`z${n}`),"base58btc"):k(C.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(t=>S(t[0]).path===!0)[0][1],e==null&&(e=null)}catch{e=null}return e}equals(e){return Xe(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let n=Qs.get(t.name);if(n==null)throw(0,eo.default)(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(i=>new Ie(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)}[(er=new WeakMap,rr=new WeakMap,tr=new WeakMap,Zn=ro,Xs)](){return`Multiaddr(${Ct(this.bytes)})`}};function St(r){return new Ie(r)}var nr=pr("libp2p:mdns:query");function to(r,e,t){let n=()=>{nr("query",e),r.query({questions:[{name:e,type:"PTR"}]})};return n(),setInterval(n,t)}function no(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(u=>u.data).filter(u=>u.toString().startsWith("dnsaddr=")).map(u=>St(u.toString().substring(8))),c=i[0].getPeerId();if(c==null)throw new Error("Multiaddr doesn't contain PeerId");return nr("peer found %p",c),{id:lt(c),multiaddrs:i,protocols:[]}}catch(i){nr.error("failed to parse mdns response",i)}}function oo(r,e,t,n,o,i){if(!i){nr("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 c=[];c.push({name:o,type:"PTR",class:"IN",ttl:120,data:t+"."+o}),n.forEach(u=>{u.getPeerId()!=null&&c.push({name:t+"."+o,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+u.toString()})}),nr("responding to query"),e.respond(c)}}var io=Symbol.for("@libp2p/peer-discovery");function so(r){let e="",t="abcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}var Ur=pr("libp2p:mdns"),Ot=class extends cr{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??so(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)}get[io](){return!0}get[Symbol.toStringTag](){return"@libp2p/mdns"}isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,co.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=to(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){if(this.mdns==null)return;Ur.trace("received incoming mDNS query");let t=this.components.peerId;oo(e,this.mdns,this.peerName,this.components.addressManager.getAddresses().map(n=>n.encapsulate("/p2p/"+t.toString())),this.serviceTag,this.broadcast)}_onMdnsResponse(e){Ur.trace("received mDNS query response");try{let t=no(e,this.peerName,this.serviceTag);t!=null&&(Ur("discovered peer in mDNS qeury response %p",t.id),this.dispatchEvent(new ar("peer",{detail:t})))}catch(t){Ur.error("Error processing peer response",t)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new ar("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 Zs(r={}){return e=>new Ot(e,r)}return go(ec);})();
7
7
  return Libp2PMdns}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/mdns",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
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-mdns#readme",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "exports": {
30
30
  ".": {
31
- "types": "./src/index.d.ts",
31
+ "types": "./dist/src/index.d.ts",
32
32
  "import": "./dist/src/index.js"
33
33
  }
34
34
  },
@@ -141,7 +141,7 @@
141
141
  "@libp2p/interfaces": "^3.3.1",
142
142
  "@libp2p/logger": "^2.0.5",
143
143
  "@libp2p/peer-id": "^2.0.1",
144
- "@multiformats/multiaddr": "^11.0.7",
144
+ "@multiformats/multiaddr": "^12.0.0",
145
145
  "@types/multicast-dns": "^7.2.1",
146
146
  "multicast-dns": "^7.2.5",
147
147
  "dns-packet": "^5.4.0"