@libp2p/mdns 10.1.5 → 11.0.0-18dd3cb26
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 +24 -1
- package/dist/src/mdns.d.ts.map +1 -1
- package/dist/src/mdns.js +1 -1
- package/dist/src/mdns.js.map +1 -1
- package/package.json +8 -8
- package/src/mdns.ts +1 -1
- package/dist/typedoc-urls.json +0 -4
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
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 On=Object.create;var Ye=Object.defineProperty;var Tn=Object.getOwnPropertyDescriptor;var Nn=Object.getOwnPropertyNames;var Pn=Object.getPrototypeOf,Dn=Object.prototype.hasOwnProperty;var j=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var W=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),k=(r,e)=>{for(var t in e)Ye(r,t,{get:e[t],enumerable:!0})},dt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Nn(e))!Dn.call(r,i)&&i!==t&&Ye(r,i,{get:()=>e[i],enumerable:!(n=Tn(e,i))||n.enumerable});return r};var cr=(r,e,t)=>(t=r!=null?On(Pn(r)):{},dt(e||!r||!r.__esModule?Ye(t,"default",{value:r,enumerable:!0}):t,r)),Bn=r=>dt(Ye({},"__esModule",{value:!0}),r);var gt=W(dr=>{"use strict";dr.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};dr.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 mt=W(lr=>{"use strict";lr.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};lr.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 yt=W(ur=>{"use strict";ur.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};ur.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 wt=W(hr=>{"use strict";hr.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};hr.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 Et=W(pr=>{"use strict";pr.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}`};pr.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 vt=W((xt,gr)=>{var It=function(r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=l,r.encode=m,r.familyOf=d,r.name=void 0,r.sizeOf=a,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,i=16,o={name:"v4",size:t,isFormat:u=>e.test(u),encode(u,p,s){s=~~s,p=p||new Uint8Array(s+t);let y=u.length,v=0;for(let S=0;S<y;){let L=u.charCodeAt(S++);L===46?(p[s++]=v,v=0):v=v*10+(L-48)}return p[s]=v,p},decode(u,p){return p=~~p,`${u[p++]}.${u[p++]}.${u[p++]}.${u[p]}`}};r.v4=o;let c={name:"v6",size:i,isFormat:u=>u.length>0&&n.test(u),encode(u,p,s){s=~~s;let y=s+i,v=-1,S=0,L=0,B=!0,T=!1;p=p||new Uint8Array(s+i);for(let b=0;b<u.length;b++){let C=u.charCodeAt(b);C===58?(B?v!==-1?(s<y&&(p[s]=0),s<y-1&&(p[s+1]=0),s+=2):s<y&&(v=s):(T===!0?(s<y&&(p[s]=L),s++):(s<y&&(p[s]=S>>8),s<y-1&&(p[s+1]=S&255),s+=2),S=0,L=0),B=!0,T=!1):C===46?(s<y&&(p[s]=L),s++,L=0,S=0,B=!1,T=!0):(B=!1,C>=97?C-=87:C>=65?C-=55:(C-=48,L=L*10+C),S=(S<<4)+C)}if(B===!1)T===!0?(s<y&&(p[s]=L),s++):(s<y&&(p[s]=S>>8),s<y-1&&(p[s+1]=S&255),s+=2);else if(v===0)s<y&&(p[s]=0),s<y-1&&(p[s+1]=0),s+=2;else if(v!==-1){s+=2;for(let b=Math.min(s-1,y-1);b>=v+2;b--)p[b]=p[b-2];p[v]=0,p[v+1]=0,v=s}if(v!==s&&v!==-1)for(s>y-2&&(s=y-2);y>v;)p[--y]=s<y&&s>v?p[--s]:0;else for(;s<y;)p[s++]=0;return p},decode(u,p){p=~~p;let s="";for(let y=0;y<i;y+=2)y!==0&&(s+=":"),s+=(u[p+y]<<8|u[p+y+1]).toString(16);return s.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};r.v6=c;let h="ip";r.name=h;function a(u){if(o.isFormat(u))return o.size;if(c.isFormat(u))return c.size;throw Error(`Invalid ip address: ${u}`)}function d(u){return a(u)===o.size?1:2}function m(u,p,s){s=~~s;let y=a(u);return typeof p=="function"&&(p=p(s+y)),y===o.size?o.encode(u,p,s):c.encode(u,p,s)}function l(u,p,s){if(p=~~p,s=s||u.length-p,s===o.size)return o.decode(u,p,s);if(s===c.size)return c.decode(u,p,s);throw Error(`Invalid buffer size needs to be ${o.size} for v4 or ${c.size} for v6.`)}return"default"in r?r.default:r}({});typeof define=="function"&&define.amd?define([],function(){return It}):typeof gr=="object"&&typeof xt=="object"&&(gr.exports=It)});var Ut=W(w=>{"use strict";var E=j("buffer").Buffer,ge=gt(),Fn=mt(),Rn=yt(),Je=wt(),mr=Et(),ve=vt(),_n=0,At=32768,yr=32768,kn=~yr,St=32768,Mn=~St,g=w.name={};g.encode=function(r,e,t,{mail:n=!1}={}){e||(e=E.alloc(g.encodingLength(r))),t||(t=0);let i=t,o=r.replace(/^\.|\.$/gm,"");if(o.length){let c=[];if(n){let h="";o.split(".").forEach(a=>{a.endsWith("\\")?h+=(h.length?".":"")+a.slice(0,-1):c.length===0&&h.length?c.push(h+"."+a):c.push(a)})}else c=o.split(".");for(let h=0;h<c.length;h++){let a=e.write(c[h],t+1);e[t]=a,t+=a+1}}return e[t++]=0,g.encode.bytes=t-i,e};g.encode.bytes=0;g.decode=function(r,e,{mail:t=!1}={}){e||(e=0);let n=[],i=e,o=0,c=0,h=!1;for(;;){if(e>=r.length)throw new Error("Cannot decode name (buffer overflow)");let a=r[e++];if(c+=h?0:1,a===0)break;if(a&192)if((a&192)===192){if(e+1>r.length)throw new Error("Cannot decode name (buffer overflow)");let d=r.readUInt16BE(e-1)-49152;if(d>=i)throw new Error("Cannot decode name (bad pointer)");e=d,i=d,c+=h?0:1,h=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+a>r.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=a+1,o>254)throw new Error("Cannot decode name (name too long)");let d=r.toString("utf-8",e,e+a);t&&(d=d.replace(/\./g,"\\.")),n.push(d),e+=a,c+=h?0:a}}return g.decode.bytes=c,n.length===0?".":n.join(".")};g.decode.bytes=0;g.encodingLength=function(r){return r==="."||r===".."?1:E.byteLength(r.replace(/^\.|\.$/gm,""))+2};var I={};I.encode=function(r,e,t){e||(e=E.alloc(I.encodingLength(r))),t||(t=0);let n=e.write(r,t+1);return e[t]=n,I.encode.bytes=n+1,e};I.encode.bytes=0;I.decode=function(r,e){e||(e=0);let t=r[e],n=r.toString("utf-8",e+1,e+1+t);return I.decode.bytes=t+1,n};I.decode.bytes=0;I.encodingLength=function(r){return E.byteLength(r)+1};var G={};G.encode=function(r,e,t){e||(e=G.encodingLength(r)),t||(t=0);let n=(r.flags||0)&32767,i=r.type==="response"?At:_n;return e.writeUInt16BE(r.id||0,t),e.writeUInt16BE(n|i,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};G.encode.bytes=12;G.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&At?"response":"query",flags:t&32767,flag_qr:(t>>15&1)===1,opcode:Rn.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:Fn.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))}};G.decode.bytes=12;G.encodingLength=function(){return 12};var oe=w.unknown={};oe.encode=function(r,e,t){return e||(e=E.alloc(oe.encodingLength(r))),t||(t=0),e.writeUInt16BE(r.length,t),r.copy(e,t+2),oe.encode.bytes=r.length+2,e};oe.encode.bytes=0;oe.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=r.slice(e+2,e+2+t);return oe.decode.bytes=t+2,n};oe.decode.bytes=0;oe.encodingLength=function(r){return r.length+2};var ce=w.ns={};ce.encode=function(r,e,t){return e||(e=E.alloc(ce.encodingLength(r))),t||(t=0),g.encode(r,e,t+2),e.writeUInt16BE(g.encode.bytes,t),ce.encode.bytes=g.encode.bytes+2,e};ce.encode.bytes=0;ce.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=g.decode(r,e+2);return ce.decode.bytes=t+2,n};ce.decode.bytes=0;ce.encodingLength=function(r){return g.encodingLength(r)+2};var se=w.soa={};se.encode=function(r,e,t){e||(e=E.alloc(se.encodingLength(r))),t||(t=0);let n=t;return t+=2,g.encode(r.mname,e,t),t+=g.encode.bytes,g.encode(r.rname,e,t,{mail:!0}),t+=g.encode.bytes,e.writeUInt32BE(r.serial||0,t),t+=4,e.writeUInt32BE(r.refresh||0,t),t+=4,e.writeUInt32BE(r.retry||0,t),t+=4,e.writeUInt32BE(r.expire||0,t),t+=4,e.writeUInt32BE(r.minimum||0,t),t+=4,e.writeUInt16BE(t-n-2,n),se.encode.bytes=t-n,e};se.encode.bytes=0;se.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.mname=g.decode(r,e),e+=g.decode.bytes,n.rname=g.decode(r,e,{mail:!0}),e+=g.decode.bytes,n.serial=r.readUInt32BE(e),e+=4,n.refresh=r.readUInt32BE(e),e+=4,n.retry=r.readUInt32BE(e),e+=4,n.expire=r.readUInt32BE(e),e+=4,n.minimum=r.readUInt32BE(e),e+=4,se.decode.bytes=e-t,n};se.decode.bytes=0;se.encodingLength=function(r){return 22+g.encodingLength(r.mname)+g.encodingLength(r.rname)};var ae=w.txt={};ae.encode=function(r,e,t){Array.isArray(r)||(r=[r]);for(let i=0;i<r.length;i++)if(typeof r[i]=="string"&&(r[i]=E.from(r[i])),!E.isBuffer(r[i]))throw new Error("Must be a Buffer");e||(e=E.alloc(ae.encodingLength(r))),t||(t=0);let n=t;return t+=2,r.forEach(function(i){e[t++]=i.length,i.copy(e,t,0,i.length),t+=i.length}),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=r.readUInt16BE(e);e+=2;let i=[];for(;n>0;){let o=r[e++];if(--n,n<o)throw new Error("Buffer overflow");i.push(r.slice(e,e+o)),e+=o,n-=o}return ae.decode.bytes=e-t,i};ae.decode.bytes=0;ae.encodingLength=function(r){Array.isArray(r)||(r=[r]);let e=2;return r.forEach(function(t){typeof t=="string"?e+=E.byteLength(t)+1:e+=t.length+1}),e};var de=w.null={};de.encode=function(r,e,t){e||(e=E.alloc(de.encodingLength(r))),t||(t=0),typeof r=="string"&&(r=E.from(r)),r||(r=E.alloc(0));let n=t;t+=2;let i=r.length;return r.copy(e,t,0,i),t+=i,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 i=r.slice(e,e+n);return e+=n,de.decode.bytes=e-t,i};de.decode.bytes=0;de.encodingLength=function(r){return r?(E.isBuffer(r)?r.length:E.byteLength(r))+2:2};var le=w.hinfo={};le.encode=function(r,e,t){e||(e=E.alloc(le.encodingLength(r))),t||(t=0);let n=t;return t+=2,I.encode(r.cpu,e,t),t+=I.encode.bytes,I.encode(r.os,e,t),t+=I.encode.bytes,e.writeUInt16BE(t-n-2,n),le.encode.bytes=t-n,e};le.encode.bytes=0;le.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.cpu=I.decode(r,e),e+=I.decode.bytes,n.os=I.decode(r,e),e+=I.decode.bytes,le.decode.bytes=e-t,n};le.decode.bytes=0;le.encodingLength=function(r){return I.encodingLength(r.cpu)+I.encodingLength(r.os)+2};var X=w.ptr={},zn=w.cname=X,$n=w.dname=X;X.encode=function(r,e,t){return e||(e=E.alloc(X.encodingLength(r))),t||(t=0),g.encode(r,e,t+2),e.writeUInt16BE(g.encode.bytes,t),X.encode.bytes=g.encode.bytes+2,e};X.encode.bytes=0;X.decode=function(r,e){e||(e=0);let t=g.decode(r,e+2);return X.decode.bytes=g.decode.bytes+2,t};X.decode.bytes=0;X.encodingLength=function(r){return g.encodingLength(r)+2};var ue=w.srv={};ue.encode=function(r,e,t){e||(e=E.alloc(ue.encodingLength(r))),t||(t=0),e.writeUInt16BE(r.priority||0,t+2),e.writeUInt16BE(r.weight||0,t+4),e.writeUInt16BE(r.port||0,t+6),g.encode(r.target,e,t+8);let n=g.encode.bytes+6;return e.writeUInt16BE(n,t),ue.encode.bytes=n+2,e};ue.encode.bytes=0;ue.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n={};return n.priority=r.readUInt16BE(e+2),n.weight=r.readUInt16BE(e+4),n.port=r.readUInt16BE(e+6),n.target=g.decode(r,e+8),ue.decode.bytes=t+2,n};ue.decode.bytes=0;ue.encodingLength=function(r){return 8+g.encodingLength(r.target)};var M=w.caa={};M.ISSUER_CRITICAL=128;M.encode=function(r,e,t){let n=M.encodingLength(r);return e||(e=E.alloc(M.encodingLength(r))),t||(t=0),r.issuerCritical&&(r.flags=M.ISSUER_CRITICAL),e.writeUInt16BE(n-2,t),t+=2,e.writeUInt8(r.flags||0,t),t+=1,I.encode(r.tag,e,t),t+=I.encode.bytes,e.write(r.value,t),t+=E.byteLength(r.value),M.encode.bytes=n,e};M.encode.bytes=0;M.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e);e+=2;let n=e,i={};return i.flags=r.readUInt8(e),e+=1,i.tag=I.decode(r,e),e+=I.decode.bytes,i.value=r.toString("utf-8",e,n+t),i.issuerCritical=!!(i.flags&M.ISSUER_CRITICAL),M.decode.bytes=t+2,i};M.decode.bytes=0;M.encodingLength=function(r){return I.encodingLength(r.tag)+I.encodingLength(r.value)+2};var we=w.mx={};we.encode=function(r,e,t){e||(e=E.alloc(we.encodingLength(r))),t||(t=0);let n=t;return t+=2,e.writeUInt16BE(r.preference||0,t),t+=2,g.encode(r.exchange,e,t),t+=g.encode.bytes,e.writeUInt16BE(t-n-2,n),we.encode.bytes=t-n,e};we.encode.bytes=0;we.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.preference=r.readUInt16BE(e),e+=2,n.exchange=g.decode(r,e),e+=g.decode.bytes,we.decode.bytes=e-t,n};we.encodingLength=function(r){return 4+g.encodingLength(r.exchange)};var he=w.a={};he.encode=function(r,e,t){return e||(e=E.alloc(he.encodingLength(r))),t||(t=0),e.writeUInt16BE(4,t),t+=2,ve.v4.encode(r,e,t),he.encode.bytes=6,e};he.encode.bytes=0;he.decode=function(r,e){e||(e=0),e+=2;let t=ve.v4.decode(r,e);return he.decode.bytes=6,t};he.decode.bytes=0;he.encodingLength=function(){return 6};var pe=w.aaaa={};pe.encode=function(r,e,t){return e||(e=E.alloc(pe.encodingLength(r))),t||(t=0),e.writeUInt16BE(16,t),t+=2,ve.v6.encode(r,e,t),pe.encode.bytes=18,e};pe.encode.bytes=0;pe.decode=function(r,e){e||(e=0),e+=2;let t=ve.v6.decode(r,e);return pe.decode.bytes=18,t};pe.decode.bytes=0;pe.encodingLength=function(){return 18};var _=w.option={};_.encode=function(r,e,t){e||(e=E.alloc(_.encodingLength(r))),t||(t=0);let n=t,i=mr.toCode(r.code);if(e.writeUInt16BE(i,t),t+=2,r.data)e.writeUInt16BE(r.data.length,t),t+=2,r.data.copy(e,t),t+=r.data.length;else switch(i){case 8:let o=r.sourcePrefixLength||0,c=r.family||ve.familyOf(r.ip),h=ve.encode(r.ip,E.alloc),a=Math.ceil(o/8);e.writeUInt16BE(a+4,t),t+=2,e.writeUInt16BE(c,t),t+=2,e.writeUInt8(o,t++),e.writeUInt8(r.scopePrefixLength||0,t++),h.copy(e,t,0,a),t+=a;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 d=r.length||0;e.writeUInt16BE(d,t),t+=2,e.fill(0,t,t+d),t+=d;break;case 14:let m=r.tags.length*2;e.writeUInt16BE(m,t),t+=2;for(let l of r.tags)e.writeUInt16BE(l,t),t+=2;break;default:throw new Error(`Unknown roption code: ${r.code}`)}return _.encode.bytes=t-n,e};_.encode.bytes=0;_.decode=function(r,e){e||(e=0);let t={};t.code=r.readUInt16BE(e),t.type=mr.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 i=E.alloc(t.family===1?4:16);r.copy(i,0,e,e+n-4),t.ip=ve.decode(i);break;case 11:n>0&&(t.timeout=r.readUInt16BE(e),e+=2);break;case 14:t.tags=[];for(let o=0;o<n;o+=2)t.tags.push(r.readUInt16BE(e)),e+=2}return _.decode.bytes=n+4,t};_.decode.bytes=0;_.encodingLength=function(r){if(r.data)return r.data.length+4;switch(mr.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 $=w.opt={};$.encode=function(r,e,t){e||(e=E.alloc($.encodingLength(r))),t||(t=0);let n=t,i=Le(r,_);return e.writeUInt16BE(i,t),t=Be(r,_,e,t+2),$.encode.bytes=t-n,e};$.encode.bytes=0;$.decode=function(r,e){e||(e=0);let t=e,n=[],i=r.readUInt16BE(e);e+=2;let o=0;for(;i>0;)n[o++]=_.decode(r,e),e+=_.decode.bytes,i-=_.decode.bytes;return $.decode.bytes=e-t,n};$.decode.bytes=0;$.encodingLength=function(r){return 2+Le(r||[],_)};var R=w.dnskey={};R.PROTOCOL_DNSSEC=3;R.ZONE_KEY=128;R.SECURE_ENTRYPOINT=32768;R.encode=function(r,e,t){e||(e=E.alloc(R.encodingLength(r))),t||(t=0);let n=t,i=r.key;if(!E.isBuffer(i))throw new Error("Key must be a Buffer");return t+=2,e.writeUInt16BE(r.flags,t),t+=2,e.writeUInt8(R.PROTOCOL_DNSSEC,t),t+=1,e.writeUInt8(r.algorithm,t),t+=1,i.copy(e,t,0,i.length),t+=i.length,R.encode.bytes=t-n,e.writeUInt16BE(R.encode.bytes-2,n),e};R.encode.bytes=0;R.decode=function(r,e){e||(e=0);let t=e;var n={},i=r.readUInt16BE(e);if(e+=2,n.flags=r.readUInt16BE(e),e+=2,r.readUInt8(e)!==R.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+i+2),e+=n.key.length,R.decode.bytes=e-t,n};R.decode.bytes=0;R.encodingLength=function(r){return 6+E.byteLength(r.key)};var Q=w.rrsig={};Q.encode=function(r,e,t){e||(e=E.alloc(Q.encodingLength(r))),t||(t=0);let n=t,i=r.signature;if(!E.isBuffer(i))throw new Error("Signature must be a Buffer");return t+=2,e.writeUInt16BE(ge.toType(r.typeCovered),t),t+=2,e.writeUInt8(r.algorithm,t),t+=1,e.writeUInt8(r.labels,t),t+=1,e.writeUInt32BE(r.originalTTL,t),t+=4,e.writeUInt32BE(r.expiration,t),t+=4,e.writeUInt32BE(r.inception,t),t+=4,e.writeUInt16BE(r.keyTag,t),t+=2,g.encode(r.signersName,e,t),t+=g.encode.bytes,i.copy(e,t,0,i.length),t+=i.length,Q.encode.bytes=t-n,e.writeUInt16BE(Q.encode.bytes-2,n),e};Q.encode.bytes=0;Q.decode=function(r,e){e||(e=0);let t=e;var n={},i=r.readUInt16BE(e);return e+=2,n.typeCovered=ge.toString(r.readUInt16BE(e)),e+=2,n.algorithm=r.readUInt8(e),e+=1,n.labels=r.readUInt8(e),e+=1,n.originalTTL=r.readUInt32BE(e),e+=4,n.expiration=r.readUInt32BE(e),e+=4,n.inception=r.readUInt32BE(e),e+=4,n.keyTag=r.readUInt16BE(e),e+=2,n.signersName=g.decode(r,e),e+=g.decode.bytes,n.signature=r.slice(e,t+i+2),e+=n.signature.length,Q.decode.bytes=e-t,n};Q.decode.bytes=0;Q.encodingLength=function(r){return 20+g.encodingLength(r.signersName)+E.byteLength(r.signature)};var J=w.rp={};J.encode=function(r,e,t){e||(e=E.alloc(J.encodingLength(r))),t||(t=0);let n=t;return t+=2,g.encode(r.mbox||".",e,t,{mail:!0}),t+=g.encode.bytes,g.encode(r.txt||".",e,t),t+=g.encode.bytes,J.encode.bytes=t-n,e.writeUInt16BE(J.encode.bytes-2,n),e};J.encode.bytes=0;J.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.mbox=g.decode(r,e,{mail:!0})||".",e+=g.decode.bytes,n.txt=g.decode(r,e)||".",e+=g.decode.bytes,J.decode.bytes=e-t,n};J.decode.bytes=0;J.encodingLength=function(r){return 2+g.encodingLength(r.mbox||".")+g.encodingLength(r.txt||".")};var O={};O.encode=function(r,e,t){e||(e=E.alloc(O.encodingLength(r))),t||(t=0);let n=t;for(var i=[],o=0;o<r.length;o++){var c=ge.toType(r[o]);i[c>>8]===void 0&&(i[c>>8]=[]),i[c>>8][c>>3&31]|=1<<7-(c&7)}for(o=0;o<i.length;o++)if(i[o]!==void 0){var h=E.from(i[o]);e.writeUInt8(o,t),t+=1,e.writeUInt8(h.length,t),t+=1,h.copy(e,t),t+=h.length}return O.encode.bytes=t-n,e};O.encode.bytes=0;O.decode=function(r,e,t){e||(e=0);let n=e;for(var i=[];e-n<t;){var o=r.readUInt8(e);e+=1;var c=r.readUInt8(e);e+=1;for(var h=0;h<c;h++)for(var a=r.readUInt8(e+h),d=0;d<8;d++)if(a&1<<7-d){var m=ge.toString(o<<8|h<<3|d);i.push(m)}e+=c}return O.decode.bytes=e-n,i};O.decode.bytes=0;O.encodingLength=function(r){for(var e=[],t=0;t<r.length;t++){var n=ge.toType(r[t]);e[n>>8]=Math.max(e[n>>8]||0,n&255)}var i=0;for(t=0;t<e.length;t++)e[t]!==void 0&&(i+=2+Math.ceil((e[t]+1)/8));return i};var Z=w.nsec={};Z.encode=function(r,e,t){e||(e=E.alloc(Z.encodingLength(r))),t||(t=0);let n=t;return t+=2,g.encode(r.nextDomain,e,t),t+=g.encode.bytes,O.encode(r.rrtypes,e,t),t+=O.encode.bytes,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={},i=r.readUInt16BE(e);return e+=2,n.nextDomain=g.decode(r,e),e+=g.decode.bytes,n.rrtypes=O.decode(r,e,i-(e-t)),e+=O.decode.bytes,Z.decode.bytes=e-t,n};Z.decode.bytes=0;Z.encodingLength=function(r){return 2+g.encodingLength(r.nextDomain)+O.encodingLength(r.rrtypes)};var f=w.nsec3={};f.encode=function(r,e,t){e||(e=E.alloc(f.encodingLength(r))),t||(t=0);let n=t,i=r.salt;if(!E.isBuffer(i))throw new Error("salt must be a Buffer");let o=r.nextDomain;if(!E.isBuffer(o))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(i.length,t),t+=1,i.copy(e,t,0,i.length),t+=i.length,e.writeUInt8(o.length,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,O.encode(r.rrtypes,e,t),t+=O.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;var n={},i=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 o=r.readUInt8(e);e+=1,n.salt=r.slice(e,e+o),e+=o;let c=r.readUInt8(e);return e+=1,n.nextDomain=r.slice(e,e+c),e+=c,n.rrtypes=O.decode(r,e,i-(e-t)),e+=O.decode.bytes,f.decode.bytes=e-t,n};f.decode.bytes=0;f.encodingLength=function(r){return 8+r.salt.length+r.nextDomain.length+O.encodingLength(r.rrtypes)};var ee=w.ds={};ee.encode=function(r,e,t){e||(e=E.alloc(ee.encodingLength(r))),t||(t=0);let n=t,i=r.digest;if(!E.isBuffer(i))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,i.copy(e,t,0,i.length),t+=i.length,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={},i=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+i+2),e+=n.digest.length,ee.decode.bytes=e-t,n};ee.decode.bytes=0;ee.encodingLength=function(r){return 6+E.byteLength(r.digest)};var z=w.sshfp={};z.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};z.encode=function(e,t,n){t||(t=E.alloc(z.encodingLength(e))),n||(n=0);let i=n;n+=2,t[n]=e.algorithm,n+=1,t[n]=e.hash,n+=1;let o=E.from(e.fingerprint.toUpperCase(),"hex");if(o.length!==z.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return o.copy(t,n),n+=o.byteLength,z.encode.bytes=n-i,t.writeUInt16BE(z.encode.bytes-2,i),t};z.encode.bytes=0;z.decode=function(e,t){t||(t=0);let n=t,i={};t+=2,i.algorithm=e[t],t+=1,i.hash=e[t],t+=1;let o=z.getFingerprintLengthForHashType(i.hash);return i.fingerprint=e.slice(t,t+o).toString("hex").toUpperCase(),t+=o,z.decode.bytes=t-n,i};z.decode.bytes=0;z.encodingLength=function(r){return 4+E.from(r.fingerprint,"hex").byteLength};var re=w.naptr={};re.encode=function(r,e,t){e||(e=E.alloc(re.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,I.encode(r.flags,e,t),t+=I.encode.bytes,I.encode(r.services,e,t),t+=I.encode.bytes,I.encode(r.regexp,e,t),t+=I.encode.bytes,g.encode(r.replacement,e,t),t+=g.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,n={};return e+=2,n.order=r.readUInt16BE(e),e+=2,n.preference=r.readUInt16BE(e),e+=2,n.flags=I.decode(r,e),e+=I.decode.bytes,n.services=I.decode(r,e),e+=I.decode.bytes,n.regexp=I.decode(r,e),e+=I.decode.bytes,n.replacement=g.decode(r,e),e+=g.decode.bytes,re.decode.bytes=e-t,n};re.decode.bytes=0;re.encodingLength=function(r){return I.encodingLength(r.flags)+I.encodingLength(r.services)+I.encodingLength(r.regexp)+g.encodingLength(r.replacement)+6};var te=w.tlsa={};te.encode=function(r,e,t){e||(e=E.alloc(te.encodingLength(r))),t||(t=0);let n=t,i=r.certificate;if(!E.isBuffer(i))throw new Error("Certificate must be a Buffer");return t+=2,e.writeUInt8(r.usage,t),t+=1,e.writeUInt8(r.selector,t),t+=1,e.writeUInt8(r.matchingType,t),t+=1,i.copy(e,t,0,i.length),t+=i.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,n={},i=r.readUInt16BE(e);return e+=2,n.usage=r.readUInt8(e),e+=1,n.selector=r.readUInt8(e),e+=1,n.matchingType=r.readUInt8(e),e+=1,n.certificate=r.slice(e,t+i+2),e+=n.certificate.length,te.decode.bytes=e-t,n};te.decode.bytes=0;te.encodingLength=function(r){return 5+E.byteLength(r.certificate)};var wr=w.record=function(r){switch(r.toUpperCase()){case"A":return he;case"PTR":return X;case"CNAME":return zn;case"DNAME":return $n;case"TXT":return ae;case"NULL":return de;case"AAAA":return pe;case"SRV":return ue;case"HINFO":return le;case"CAA":return M;case"NS":return ce;case"SOA":return se;case"MX":return we;case"OPT":return $;case"DNSKEY":return R;case"RRSIG":return Q;case"RP":return J;case"NSEC":return Z;case"NSEC3":return f;case"SSHFP":return z;case"DS":return ee;case"NAPTR":return re;case"TLSA":return te}return oe},N=w.answer={};N.encode=function(r,e,t){e||(e=E.alloc(N.encodingLength(r))),t||(t=0);let n=t;if(g.encode(r.name,e,t),t+=g.encode.bytes,e.writeUInt16BE(ge.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,$.encode(r.options||[],e,t),t+=$.encode.bytes}else{let i=Je.toClass(r.class===void 0?"IN":r.class);r.flush&&(i|=yr),e.writeUInt16BE(i,t+2),e.writeUInt32BE(r.ttl||0,t+4),t+=8;let o=wr(r.type);o.encode(r.data,e,t),t+=o.encode.bytes}return N.encode.bytes=t-n,e};N.encode.bytes=0;N.decode=function(r,e){e||(e=0);let t={},n=e;if(t.name=g.decode(r,e),e+=g.decode.bytes,t.type=ge.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=$.decode(r,e+8),e+=8+$.decode.bytes;else{let i=r.readUInt16BE(e+2);t.ttl=r.readUInt32BE(e+4),t.class=Je.toString(i&kn),t.flush=!!(i&yr);let o=wr(t.type);t.data=o.decode(r,e+8),e+=8+o.decode.bytes}return N.decode.bytes=e-n,t};N.decode.bytes=0;N.encodingLength=function(r){let e=r.data!==null&&r.data!==void 0?r.data:r.options;return g.encodingLength(r.name)+8+wr(r.type).encodingLength(e)};var Y=w.question={};Y.encode=function(r,e,t){e||(e=E.alloc(Y.encodingLength(r))),t||(t=0);let n=t;return g.encode(r.name,e,t),t+=g.encode.bytes,e.writeUInt16BE(ge.toType(r.type),t),t+=2,e.writeUInt16BE(Je.toClass(r.class===void 0?"IN":r.class),t),t+=2,Y.encode.bytes=t-n,r};Y.encode.bytes=0;Y.decode=function(r,e){e||(e=0);let t=e,n={};return n.name=g.decode(r,e),e+=g.decode.bytes,n.type=ge.toString(r.readUInt16BE(e)),e+=2,n.class=Je.toString(r.readUInt16BE(e)),e+=2,!!(n.class&St)&&(n.class&=Mn),Y.decode.bytes=e-t,n};Y.decode.bytes=0;Y.encodingLength=function(r){return g.encodingLength(r.name)+4};w.AUTHORITATIVE_ANSWER=1024;w.TRUNCATED_RESPONSE=512;w.RECURSION_DESIRED=256;w.RECURSION_AVAILABLE=128;w.AUTHENTIC_DATA=32;w.CHECKING_DISABLED=16;w.DNSSEC_OK=32768;w.encode=function(r,e,t){let n=!e;n&&(e=E.alloc(w.encodingLength(r))),t||(t=0);let i=t;return r.questions||(r.questions=[]),r.answers||(r.answers=[]),r.authorities||(r.authorities=[]),r.additionals||(r.additionals=[]),G.encode(r,e,t),t+=G.encode.bytes,t=Be(r.questions,Y,e,t),t=Be(r.answers,N,e,t),t=Be(r.authorities,N,e,t),t=Be(r.additionals,N,e,t),w.encode.bytes=t-i,n&&w.encode.bytes!==e.length?e.slice(0,w.encode.bytes):e};w.encode.bytes=0;w.decode=function(r,e){e||(e=0);let t=e,n=G.decode(r,e);return e+=G.decode.bytes,e=Qe(n.questions,Y,r,e),e=Qe(n.answers,N,r,e),e=Qe(n.authorities,N,r,e),e=Qe(n.additionals,N,r,e),w.decode.bytes=e-t,n};w.decode.bytes=0;w.encodingLength=function(r){return G.encodingLength(r)+Le(r.questions||[],Y)+Le(r.answers||[],N)+Le(r.authorities||[],N)+Le(r.additionals||[],N)};w.streamEncode=function(r){let e=w.encode(r),t=E.alloc(2);t.writeUInt16BE(e.byteLength);let n=E.concat([t,e]);return w.streamEncode.bytes=n.byteLength,n};w.streamEncode.bytes=0;w.streamDecode=function(r){let e=r.readUInt16BE(0);if(r.byteLength<e+2)return null;let t=w.decode(r.slice(2));return w.streamDecode.bytes=w.decode.bytes,t};w.streamDecode.bytes=0;function Le(r,e){let t=0;for(let n=0;n<r.length;n++)t+=e.encodingLength(r[n]);return t}function Be(r,e,t,n){for(let i=0;i<r.length;i++)e.encode(r[i],t,n),n+=e.encode.bytes;return n}function Qe(r,e,t,n){for(let i=0;i<r.length;i++)r[i]=e.decode(t,n),n+=e.decode.bytes;return n}});var Ct=W((Oc,bt)=>{"use strict";var Lt=Xn;process.nextTick(jn,42);bt.exports=qn;function qn(r){var e=n;return t;function t(i){e(i||Kn)}function n(i){var o=[i];e=c,r(h);function c(a){o.push(a)}function h(a){var d=arguments;for(e=Vn(a)?n:m;o.length;)m(o.shift());function m(l){Lt(Hn,l,d)}}}}function Vn(r){return Object.prototype.toString.call(r)==="[object Error]"}function Kn(){}function Hn(r,e){r.apply(null,e)}function jn(r){r===42&&(Lt=process.nextTick)}function Xn(r,e,t){process.nextTick(function(){r(e,t)})}});var Nt=W((Tc,Tt)=>{var Er=Ut(),Yn=j("dgram"),Gn=Ct(),Wn=j("events"),xr=j("os"),Ir=function(){};Tt.exports=function(r){r||(r={});var e=new Wn.EventEmitter,t=typeof r.port=="number"?r.port:5353,n=r.type||"udp4",i=r.ip||r.host||(n==="udp4"?"224.0.0.251":null),o={address:i,port:t},c={},h=!1,a=null;if(n==="udp6"&&(!i||!r.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var d=r.socket||Yn.createSocket({type:n,reuseAddr:r.reuseAddr!==!1,toString:function(){return n}});d.on("error",function(l){l.code==="EACCES"||l.code==="EADDRINUSE"?e.emit("error",l):e.emit("warning",l)}),d.on("message",function(l,u){try{l=Er.decode(l)}catch(p){e.emit("warning",p);return}e.emit("packet",l,u),l.type==="query"&&e.emit("query",l,u),l.type==="response"&&e.emit("response",l,u)}),d.on("listening",function(){t||(t=o.port=d.address().port),r.multicast!==!1&&(e.update(),a=setInterval(e.update,5e3),d.setMulticastTTL(r.ttl||255),d.setMulticastLoopback(r.loopback!==!1))});var m=Gn(function(l){if(!t||r.bind===!1)return l(null);d.once("error",l),d.bind(t,r.bind||r.interface,function(){d.removeListener("error",l),l(null)})});return m(function(l){if(l)return e.emit("error",l);e.emit("ready")}),e.send=function(l,u,p){if(typeof u=="function")return e.send(l,null,u);p||(p=Ir),u?!u.host&&!u.address&&(u.address=o.address):u=o,m(s);function s(y){if(h)return p();if(y)return p(y);var v=Er.encode(l);d.send(v,0,v.length,u.port,u.address||u.host,p)}},e.response=e.respond=function(l,u,p){Array.isArray(l)&&(l={answers:l}),l.type="response",l.flags=(l.flags||0)|Er.AUTHORITATIVE_ANSWER,e.send(l,u,p)},e.query=function(l,u,p,s){if(typeof u=="function")return e.query(l,null,null,u);if(typeof u=="object"&&u&&u.port)return e.query(l,null,u,p);if(typeof p=="function")return e.query(l,u,null,p);s||(s=Ir),typeof l=="string"&&(l=[{name:l,type:u||"ANY"}]),Array.isArray(l)&&(l={type:"query",questions:l}),l.type="query",e.send(l,p,s)},e.destroy=function(l){if(l||(l=Ir),h)return process.nextTick(l);h=!0,clearInterval(a);for(var u in c)try{d.dropMembership(i,u)}catch{}c={},d.close(l)},e.update=function(){for(var l=r.interface?[].concat(r.interface):Jn(),u=!1,p=0;p<l.length;p++){var s=l[p];if(!c[s])try{d.addMembership(i,s),c[s]=!0,u=!0}catch(y){e.emit("warning",y)}}if(u){if(d.setMulticastInterface)try{d.setMulticastInterface(r.interface||Qn())}catch(y){e.emit("warning",y)}e.emit("networkInterface")}},e};function Qn(){for(var r=xr.networkInterfaces(),e=Object.keys(r),t=0;t<e.length;t++)for(var n=r[e[t]],i=0;i<n.length;i++){var o=n[i];if(Ot(o.family)&&!o.internal)return xr.platform()==="darwin"&&e[t]==="en0"?o.address:"0.0.0.0"}return"127.0.0.1"}function Jn(){for(var r=xr.networkInterfaces(),e=Object.keys(r),t=[],n=0;n<e.length;n++)for(var i=r[e[n]],o=0;o<i.length;o++){var c=i[o];if(Ot(c.family)){t.push(c.address);break}}return t}function Ot(r){return r===4||r==="IPv4"}});var on=W(He=>{(function(){var r,e,t,n,i,o,c,h;h=function(a){var d,m,l,u;return d=(a&255<<24)>>>24,m=(a&255<<16)>>>16,l=(a&65280)>>>8,u=a&255,[d,m,l,u].join(".")},c=function(a){var d,m,l,u,p,s;for(d=[],l=u=0;u<=3&&a.length!==0;l=++u){if(l>0){if(a[0]!==".")throw new Error("Invalid IP");a=a.substring(1)}s=e(a),p=s[0],m=s[1],a=a.substring(m),d.push(p)}if(a.length!==0)throw new Error("Invalid IP");switch(d.length){case 1:if(d[0]>4294967295)throw new Error("Invalid IP");return d[0]>>>0;case 2:if(d[0]>255||d[1]>16777215)throw new Error("Invalid IP");return(d[0]<<24|d[1])>>>0;case 3:if(d[0]>255||d[1]>255||d[2]>65535)throw new Error("Invalid IP");return(d[0]<<24|d[1]<<16|d[2])>>>0;case 4:if(d[0]>255||d[1]>255||d[2]>255||d[3]>255)throw new Error("Invalid IP");return(d[0]<<24|d[1]<<16|d[2]<<8|d[3])>>>0;default:throw new Error("Invalid IP")}},t=function(a){return a.charCodeAt(0)},n=t("0"),o=t("a"),i=t("A"),e=function(a){var d,m,l,u,p;for(u=0,d=10,m="9",l=0,a.length>1&&a[l]==="0"&&(a[l+1]==="x"||a[l+1]==="X"?(l+=2,d=16):"0"<=a[l+1]&&a[l+1]<="9"&&(l++,d=8,m="7")),p=l;l<a.length;){if("0"<=a[l]&&a[l]<=m)u=u*d+(t(a[l])-n)>>>0;else if(d===16)if("a"<=a[l]&&a[l]<="f")u=u*d+(10+t(a[l])-o)>>>0;else if("A"<=a[l]&&a[l]<="F")u=u*d+(10+t(a[l])-i)>>>0;else break;else break;if(u>4294967295)throw new Error("too large");l++}if(l===p)throw new Error("empty octet");return[u,l]},r=function(){function a(d,m){var l,u,p,s;if(typeof d!="string")throw new Error("Missing `net' parameter");if(m||(s=d.split("/",2),d=s[0],m=s[1]),m||(m=32),typeof m=="string"&&m.indexOf(".")>-1){try{this.maskLong=c(m)}catch(y){throw l=y,new Error("Invalid mask: "+m)}for(u=p=32;p>=0;u=--p)if(this.maskLong===4294967295<<32-u>>>0){this.bitmask=u;break}}else if(m||m===0)this.bitmask=parseInt(m,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(c(d)&this.maskLong)>>>0}catch(y){throw l=y,new Error("Invalid net address: "+d)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+m);this.size=Math.pow(2,32-this.bitmask),this.base=h(this.netLong),this.mask=h(this.maskLong),this.hostmask=h(~this.maskLong),this.first=this.bitmask<=30?h(this.netLong+1):this.base,this.last=this.bitmask<=30?h(this.netLong+this.size-2):h(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?h(this.netLong+this.size-1):void 0}return a.prototype.contains=function(d){return typeof d=="string"&&(d.indexOf("/")>0||d.split(".").length!==4)&&(d=new a(d)),d instanceof a?this.contains(d.base)&&this.contains(d.broadcast||d.last):(c(d)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},a.prototype.next=function(d){return d==null&&(d=1),new a(h(this.netLong+this.size*d),this.mask)},a.prototype.forEach=function(d){var m,l,u;for(u=c(this.first),l=c(this.last),m=0;u<=l;)d(h(u),u,m),m++,u++},a.prototype.toString=function(){return this.base+"/"+this.bitmask},a}(),He.ip2long=c,He.long2ip=h,He.Netmask=r}).call(He)});var Ho={};k(Ho,{mdns:()=>Ko});var lt=Symbol.for("@libp2p/peer-discovery");var sr=Symbol.for("@libp2p/peer-id");var Ge=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var ut=j("events"),ht=(r,...e)=>{try{(0,ut.setMaxListeners)(r,...e)}catch{}};var We=class extends EventTarget{#e=new Map;constructor(){super(),ht(1/0,this)}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let i=this.#e.get(e);i==null&&(i=[],this.#e.set(e,i)),i.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let i=this.#e.get(e);i!=null&&(i=i.filter(({callback:o})=>o!==t),this.#e.set(e,i))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:i})=>!i),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new ar(e,t))}},ar=globalThis.CustomEvent;var pt=Symbol.for("@libp2p/service-capabilities"),Zo=Symbol.for("@libp2p/service-dependencies");var Cn=cr(Nt(),1);var Lr={};k(Lr,{base58btc:()=>P,base58flickr:()=>ni});var Nc=new Uint8Array(0);function Pt(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}function q(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")}function Dt(r){return new TextEncoder().encode(r)}function Bt(r){return new TextDecoder().decode(r)}function Zn(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 i=0;i<r.length;i++){var o=r.charAt(i),c=o.charCodeAt(0);if(t[c]!==255)throw new TypeError(o+" is ambiguous");t[c]=i}var h=r.length,a=r.charAt(0),d=Math.log(h)/Math.log(256),m=Math.log(256)/Math.log(h);function l(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 y=0,v=0,S=0,L=s.length;S!==L&&s[S]===0;)S++,y++;for(var B=(L-S)*m+1>>>0,T=new Uint8Array(B);S!==L;){for(var b=s[S],C=0,H=B-1;(b!==0||C<v)&&H!==-1;H--,C++)b+=256*T[H]>>>0,T[H]=b%h>>>0,b=b/h>>>0;if(b!==0)throw new Error("Non-zero carry");v=C,S++}for(var ie=B-v;ie!==B&&T[ie]===0;)ie++;for(var Xe=a.repeat(y);ie<B;++ie)Xe+=r.charAt(T[ie]);return Xe}function u(s){if(typeof s!="string")throw new TypeError("Expected String");if(s.length===0)return new Uint8Array;var y=0;if(s[y]!==" "){for(var v=0,S=0;s[y]===a;)v++,y++;for(var L=(s.length-y)*d+1>>>0,B=new Uint8Array(L);s[y];){var T=t[s.charCodeAt(y)];if(T===255)return;for(var b=0,C=L-1;(T!==0||b<S)&&C!==-1;C--,b++)T+=h*B[C]>>>0,B[C]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");S=b,y++}if(s[y]!==" "){for(var H=L-S;H!==L&&B[H]===0;)H++;for(var ie=new Uint8Array(v+(L-H)),Xe=v;H!==L;)ie[Xe++]=B[H++];return ie}}}function p(s){var y=u(s);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:u,decode:p}}var fn=Zn,ei=fn,Rt=ei;var vr=class{name;prefix;baseEncode;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")}},Ar=class{name;prefix;baseDecode;prefixCodePoint;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 _t(this,e)}},Sr=class{decoders;constructor(e){this.decoders=e}or(e){return _t(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function _t(r,e){return new Sr({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Ur=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new vr(e,t,n),this.decoder=new Ar(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function be({name:r,prefix:e,encode:t,decode:n}){return new Ur(r,e,t,n)}function Ee({name:r,prefix:e,alphabet:t}){let{encode:n,decode:i}=Rt(t,r);return be({prefix:e,name:r,encode:n,decode:o=>q(i(o))})}function ri(r,e,t,n){let i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let o=r.length;for(;r[o-1]==="=";)--o;let c=new Uint8Array(o*t/8|0),h=0,a=0,d=0;for(let m=0;m<o;++m){let l=i[r[m]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|l,h+=t,h>=8&&(h-=8,c[d++]=255&a>>h)}if(h>=t||255&a<<8-h)throw new SyntaxError("Unexpected end of data");return c}function ti(r,e,t){let n=e[e.length-1]==="=",i=(1<<t)-1,o="",c=0,h=0;for(let a=0;a<r.length;++a)for(h=h<<8|r[a],c+=8;c>t;)c-=t,o+=e[i&h>>c];if(c!==0&&(o+=e[i&h<<t-c]),n)for(;o.length*t&7;)o+="=";return o}function U({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return be({prefix:e,name:r,encode(i){return ti(i,n,t)},decode(i){return ri(i,n,t,r)}})}var P=Ee({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ni=Ee({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var br={};k(br,{base10:()=>ii});var ii=Ee({prefix:"9",name:"base10",alphabet:"0123456789"});var Cr={};k(Cr,{base16:()=>oi,base16upper:()=>ci});var oi=U({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ci=U({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Or={};k(Or,{base2:()=>si});var si=U({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Tr={};k(Tr,{base256emoji:()=>hi});var kt=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}"),ai=kt.reduce((r,e,t)=>(r[t]=e,r),[]),di=kt.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function li(r){return r.reduce((e,t)=>(e+=ai[t],e),"")}function ui(r){let e=[];for(let t of r){let n=di[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var hi=be({prefix:"\u{1F680}",name:"base256emoji",encode:li,decode:ui});var Nr={};k(Nr,{base32:()=>me,base32hex:()=>yi,base32hexpad:()=>Ei,base32hexpadupper:()=>Ii,base32hexupper:()=>wi,base32pad:()=>gi,base32padupper:()=>mi,base32upper:()=>pi,base32z:()=>xi});var me=U({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pi=U({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gi=U({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),mi=U({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yi=U({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wi=U({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ei=U({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ii=U({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),xi=U({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Pr={};k(Pr,{base36:()=>vi,base36upper:()=>Ai});var vi=Ee({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ai=Ee({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Dr={};k(Dr,{base64:()=>Si,base64pad:()=>Ui,base64url:()=>Li,base64urlpad:()=>bi});var Si=U({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ui=U({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Li=U({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),bi=U({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Br={};k(Br,{base8:()=>Ci});var Ci=U({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Fr={};k(Fr,{identity:()=>Oi});var Oi=be({prefix:"\0",name:"identity",encode:r=>Bt(r),decode:r=>Dt(r)});var Xc=new TextEncoder,Yc=new TextDecoder;var _r={};k(_r,{identity:()=>_e});var Pi=$t,Mt=128,Di=127,Bi=~Di,Fi=Math.pow(2,31);function $t(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Fi;)e[t++]=r&255|Mt,r/=128;for(;r&Bi;)e[t++]=r&255|Mt,r>>>=7;return e[t]=r|0,$t.bytes=t-n+1,e}var Ri=Rr,_i=128,zt=127;function Rr(r,n){var t=0,n=n||0,i=0,o=n,c,h=r.length;do{if(o>=h)throw Rr.bytes=0,new RangeError("Could not decode varint");c=r[o++],t+=i<28?(c&zt)<<i:(c&zt)*Math.pow(2,i),i+=7}while(c>=_i);return Rr.bytes=o-n,t}var ki=Math.pow(2,7),Mi=Math.pow(2,14),zi=Math.pow(2,21),$i=Math.pow(2,28),qi=Math.pow(2,35),Vi=Math.pow(2,42),Ki=Math.pow(2,49),Hi=Math.pow(2,56),ji=Math.pow(2,63),Xi=function(r){return r<ki?1:r<Mi?2:r<zi?3:r<$i?4:r<qi?5:r<Vi?6:r<Ki?7:r<Hi?8:r<ji?9:10},Yi={encode:Pi,decode:Ri,encodingLength:Xi},Gi=Yi,Fe=Gi;function Re(r,e=0){return[Fe.decode(r,e),Fe.decode.bytes]}function Ce(r,e,t=0){return Fe.encode(r,e,t),e}function Oe(r){return Fe.encodingLength(r)}function Ie(r,e){let t=e.byteLength,n=Oe(r),i=n+Oe(t),o=new Uint8Array(i+t);return Ce(r,o,0),Ce(t,o,n),o.set(e,i),new Te(r,t,e,o)}function Ae(r){let e=q(r),[t,n]=Re(e),[i,o]=Re(e.subarray(n)),c=e.subarray(n+o);if(c.byteLength!==i)throw new Error("Incorrect length");return new Te(t,i,c,e)}function qt(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Pt(r.bytes,t.bytes)}}var Te=class{code;size;digest;bytes;constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}};var Vt=0,Wi="identity",Kt=q;function Qi(r){return Ie(Vt,Kt(r))}var _e={code:Vt,name:Wi,encode:Kt,digest:Qi};var $r={};k($r,{sha256:()=>fe,sha512:()=>Ji});var zr=cr(j("crypto"),1);function Mr({name:r,code:e,encode:t}){return new kr(r,e,t)}var kr=class{name;code;encode;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 fe=Mr({name:"sha2-256",code:18,encode:r=>q(zr.default.createHash("sha256").update(r).digest())}),Ji=Mr({name:"sha2-512",code:19,encode:r=>q(zr.default.createHash("sha512").update(r).digest())});function jt(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return fi(t,qr(r),e??P.encoder);default:return eo(t,qr(r),e??me.encoder)}}var Xt=new WeakMap;function qr(r){let e=Xt.get(r);if(e==null){let t=new Map;return Xt.set(r,t),t}return e}var V=class r{code;version;multihash;bytes;"/";constructor(e,t,n,i){this.code=t,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==ke)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==ro)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=Ie(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&qt(e.multihash,n.multihash)}toString(e){return jt(this,e)}toJSON(){return{"/":jt(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:i,multihash:o,bytes:c}=t;return new r(n,i,o,c??Yt(n,i,o.bytes))}else if(t[to]===!0){let{version:n,multihash:i,code:o}=t,c=Ae(i);return r.create(n,o,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 r(e,t,n,n.bytes)}case 1:{let i=Yt(e,t,n.bytes);return new r(e,t,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,ke,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,i=q(e.subarray(n,n+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");let o=i.subarray(t.multihashSize-t.digestSize),c=new Te(t.multihashCode,t.digestSize,o,i);return[t.version===0?r.createV0(c):r.createV1(t.codec,c),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[l,u]=Re(e.subarray(t));return t+=u,l},i=n(),o=ke;if(i===18?(i=0,t=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let c=t,h=n(),a=n(),d=t+a,m=d-c;return{version:i,codec:o,multihashCode:h,digestSize:a,multihashSize:m,size:d}}static parse(e,t){let[n,i]=Zi(e,t),o=r.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return qr(o).set(n,e),o}};function Zi(r,e){switch(r[0]){case"Q":{let t=e??P;return[P.prefix,t.decode(`${P.prefix}${r}`)]}case P.prefix:{let t=e??P;return[P.prefix,t.decode(r)]}case me.prefix:{let t=e??me;return[me.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)]}}}function fi(r,e,t){let{prefix:n}=t;if(n!==P.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let i=e.get(n);if(i==null){let o=t.encode(r).slice(1);return e.set(n,o),o}else return i}function eo(r,e,t){let{prefix:n}=t,i=e.get(n);if(i==null){let o=t.encode(r);return e.set(n,o),o}else return i}var ke=112,ro=18;function Yt(r,e,t){let n=Oe(r),i=n+Oe(e),o=new Uint8Array(i+t.byteLength);return Ce(r,o,0),Ce(e,o,n),o.set(t,i),o}var to=Symbol.for("@ipld/js-cid/CID");var xe={...Fr,...Or,...Br,...br,...Cr,...Nr,...Pr,...Lr,...Dr,...Tr},ms={...$r,..._r};function Me(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 Jt=j("node:buffer");var Gt=j("node:buffer");function Ne(r){return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}function er(r=0){return Ne(Gt.Buffer.allocUnsafe(r))}function Qt(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Wt=Qt("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Vr=Qt("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}),no={utf8:Wt,"utf-8":Wt,hex:xe.base16,latin1:Vr,ascii:Vr,binary:Vr,...xe},rr=no;function ze(r,e="utf8"){let t=rr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return e==="utf8"||e==="utf-8"?Ne(Jt.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var Zt=j("node:buffer");function D(r,e="utf8"){let t=rr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return e==="utf8"||e==="utf-8"?Zt.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var en=Symbol.for("nodejs.util.inspect.custom"),ft=Object.values(xe).map(r=>r.decoder).reduce((r,e)=>r.or(e),xe.identity.decoder),rn=114,tn=36,nn=37,$e=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[sr]=!0;toString(){return this.string==null&&(this.string=P.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return V.createV1(rn,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return Me(this.multihash.bytes,e);if(typeof e=="string")return jr(e).equals(this);if(e?.multihash?.bytes!=null)return Me(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[en](){return`PeerId(${this.toString()})`}},qe=class extends $e{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Ve=class extends $e{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Ke=class extends $e{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}},Kr=2336,Hr=class{type="url";multihash;privateKey;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=_e.digest(ze(this.url))}[en](){return`PeerId(${this.url})`}[sr]=!0;toString(){return this.toCID().toString()}toCID(){return V.createV1(Kr,this.multihash)}toBytes(){return this.toCID().bytes}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=D(e)),e.toString()===this.toString())}};function jr(r,e){if(e=e??ft,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Ae(P.decode(`z${r}`));return r.startsWith("12D")?new Ve({multihash:t}):r.startsWith("16U")?new Ke({multihash:t}):new qe({multihash:t})}return io(ft.decode(r))}function io(r){try{let e=Ae(r);if(e.code===_e.code){if(e.digest.length===tn)return new Ve({multihash:e});if(e.digest.length===nn)return new Ke({multihash:e})}if(e.code===fe.code)return new qe({multihash:e})}catch{return oo(V.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function oo(r){if(r?.multihash==null||r.version==null||r.version===1&&r.code!==rn&&r.code!==Kr)throw new Error("Supplied PeerID CID is invalid");if(r.code===Kr){let t=D(r.multihash.digest);return new Hr(new URL(t))}let e=r.multihash;if(e.code===fe.code)return new qe({multihash:r.multihash});if(e.code===_e.code){if(e.digest.length===tn)return new Ve({multihash:r.multihash});if(e.digest.length===nn)return new Ke({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var K=j("node:net");function tr(r){return!!(0,K.isIP)(r)}var cn=cr(on(),1),co=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],so=co.map(r=>new cn.Netmask(r));function Xr(r){for(let e of so)if(e.contains(r))return!0;return!1}function ao(r){return/^::ffff:([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})$/.test(r)}function lo(r){let e=r.split(":");if(e.length<2)return!1;let t=e[e.length-1].padStart(4,"0"),n=e[e.length-2].padStart(4,"0"),i=`${parseInt(n.substring(0,2),16)}.${parseInt(n.substring(2),16)}.${parseInt(t.substring(0,2),16)}.${parseInt(t.substring(2),16)}`;return Xr(i)}function uo(r){return/^::ffff:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(r)}function ho(r){let e=r.split(":"),t=e[e.length-1];return Xr(t)}function po(r){return/^::$/.test(r)||/^::1$/.test(r)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(r)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(r)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(r)||/^ff([0-9a-fA-F]{2,2}):/i.test(r)}function sn(r){return(0,K.isIPv4)(r)?Xr(r):ao(r)?lo(r):uo(r)?ho(r):(0,K.isIPv6)(r)?po(r):void 0}function an(r){try{let{address:e}=r.nodeAddress();return!!sn(e)}catch{return!0}}var go=Math.pow(2,7),mo=Math.pow(2,14),yo=Math.pow(2,21),Yr=Math.pow(2,28),Gr=Math.pow(2,35),Wr=Math.pow(2,42),Qr=Math.pow(2,49),x=128,F=127;function ne(r){if(r<go)return 1;if(r<mo)return 2;if(r<yo)return 3;if(r<Yr)return 4;if(r<Gr)return 5;if(r<Wr)return 6;if(r<Qr)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function wo(r,e,t=0){switch(ne(r)){case 8:e[t++]=r&255|x,r/=128;case 7:e[t++]=r&255|x,r/=128;case 6:e[t++]=r&255|x,r/=128;case 5:e[t++]=r&255|x,r/=128;case 4:e[t++]=r&255|x,r>>>=7;case 3:e[t++]=r&255|x,r>>>=7;case 2:e[t++]=r&255|x,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Eo(r,e,t=0){switch(ne(r)){case 8:e.set(t++,r&255|x),r/=128;case 7:e.set(t++,r&255|x),r/=128;case 6:e.set(t++,r&255|x),r/=128;case 5:e.set(t++,r&255|x),r/=128;case 4:e.set(t++,r&255|x),r>>>=7;case 3:e.set(t++,r&255|x),r>>>=7;case 2:e.set(t++,r&255|x),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function Io(r,e){let t=r[e],n=0;if(n+=t&F,t<x||(t=r[e+1],n+=(t&F)<<7,t<x)||(t=r[e+2],n+=(t&F)<<14,t<x)||(t=r[e+3],n+=(t&F)<<21,t<x)||(t=r[e+4],n+=(t&F)*Yr,t<x)||(t=r[e+5],n+=(t&F)*Gr,t<x)||(t=r[e+6],n+=(t&F)*Wr,t<x)||(t=r[e+7],n+=(t&F)*Qr,t<x))return n;throw new RangeError("Could not decode varint")}function xo(r,e){let t=r.get(e),n=0;if(n+=t&F,t<x||(t=r.get(e+1),n+=(t&F)<<7,t<x)||(t=r.get(e+2),n+=(t&F)<<14,t<x)||(t=r.get(e+3),n+=(t&F)<<21,t<x)||(t=r.get(e+4),n+=(t&F)*Yr,t<x)||(t=r.get(e+5),n+=(t&F)*Gr,t<x)||(t=r.get(e+6),n+=(t&F)*Wr,t<x)||(t=r.get(e+7),n+=(t&F)*Qr,t<x))return n;throw new RangeError("Could not decode varint")}function Pe(r,e,t=0){return e==null&&(e=er(ne(r))),e instanceof Uint8Array?wo(r,e,t):Eo(r,e,t)}function Ue(r,e=0){return r instanceof Uint8Array?Io(r,e):xo(r,e)}var ln=j("node:buffer");function ye(r,e){return Ne(ln.Buffer.concat(r,e))}var nr=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,i){return this.readAtomically(()=>{let o=0,c=0,h=this.peekChar();if(h===void 0)return;let a=h==="0",d=2**(8*i)-1;for(;;){let m=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let u=Number.parseInt(l,e);if(!Number.isNaN(u))return u});if(m===void 0)break;if(o*=e,o+=m,o>d||(c+=1,t!==void 0&&c>t))return}if(c!==0)return!n&&a&&c>1?void 0:o})}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 i=n*2;if(n<t.length-3){let c=this.readSeparator(":",n,()=>this.readIPv4Addr());if(c!==void 0)return t[i]=c[0],t[i+1]=c[1],t[i+2]=c[2],t[i+3]=c[3],[i+4,!0]}let o=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];t[i]=o>>8,t[i+1]=o&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,i]=e(t);if(n===16)return t;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),c=16-(n+2),[h]=e(o.subarray(0,c));return t.set(o.subarray(0,h),16-h),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Qs=new nr;var ia=parseInt("0xFFFF",16),oa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var pn=K.isIPv4,bo=K.isIPv6,Jr=function(r){let e=0;if(r=r.toString().trim(),pn(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(bo(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let o=pn(t[n]),c;o&&(c=Jr(t[n]),t[n]=D(c.slice(0,2),"base16")),c!=null&&++n<8&&t.splice(n,0,D(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 o=[n,1];for(n=9-t.length;n>0;n--)o.push("0");t.splice.apply(t,o)}let i=new Uint8Array(e+16);for(n=0;n<t.length;n++){let o=parseInt(t[n],16);i[e++]=o>>8&255,i[e++]=o&255}return i}throw new Error("invalid ip address")},gn=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let i=[];for(let o=0;o<t;o++)i.push(r[e+o]);return i.join(".")}if(t===16){let i=[];for(let o=0;o<t;o+=2)i.push(n.getUint16(e+o).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var De={},Zr={},Oo=[[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"],[481,-1,"http-path"],[777,-1,"memory"]];Oo.forEach(r=>{let e=To(...r);Zr[e.code]=e,De[e.name]=e});function To(r,e,t,n,i){return{code:r,size:e,name:t,resolvable:!!n,path:!!i}}function A(r){if(typeof r=="number"){if(Zr[r]!=null)return Zr[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(De[r]!=null)return De[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Va=A("ip4"),Ka=A("ip6"),Ha=A("ipcidr");function tt(r,e){switch(A(r).code){case 4:case 41:return Po(e);case 42:return rt(e);case 6:case 273:case 33:case 132:return wn(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return rt(e);case 421:return Ro(e);case 444:return yn(e);case 445:return yn(e);case 466:return Fo(e);case 481:return globalThis.encodeURIComponent(rt(e));default:return D(e,"base16")}}function nt(r,e){switch(A(r).code){case 4:return mn(e);case 41:return mn(e);case 42:return et(e);case 6:case 273:case 33:case 132:return it(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return et(e);case 421:return Do(e);case 444:return _o(e);case 445:return ko(e);case 466:return Bo(e);case 481:return et(globalThis.decodeURIComponent(e));default:return ze(e,"base16")}}var fr=Object.values(xe).map(r=>r.decoder),No=function(){let r=fr[0].or(fr[1]);return fr.slice(2).forEach(e=>r=r.or(e)),r}();function mn(r){if(!tr(r))throw new Error("invalid ip address");return Jr(r)}function Po(r){let e=gn(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!tr(e))throw new Error("invalid ip address");return e}function it(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function wn(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function et(r){let e=ze(r),t=Uint8Array.from(Pe(e.length));return ye([t,e],t.length+e.length)}function rt(r){let e=Ue(r);if(r=r.slice(ne(e)),r.length!==e)throw new Error("inconsistent lengths");return D(r)}function Do(r){let e;r[0]==="Q"||r[0]==="1"?e=Ae(P.decode(`z${r}`)).bytes:e=V.parse(r).multihash.bytes;let t=Uint8Array.from(Pe(e.length));return ye([t,e],t.length+e.length)}function Bo(r){let e=No.decode(r),t=Uint8Array.from(Pe(e.length));return ye([t,e],t.length+e.length)}function Fo(r){let e=Ue(r),t=r.slice(ne(e));if(t.length!==e)throw new Error("inconsistent lengths");return"u"+D(t,"base64url")}function Ro(r){let e=Ue(r),t=r.slice(ne(e));if(t.length!==e)throw new Error("inconsistent lengths");return D(t,"base58btc")}function _o(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=me.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 i=it(n);return ye([t,i],t.length+i.length)}function ko(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=me.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 i=it(n);return ye([t,i],t.length+i.length)}function yn(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=D(e,"base32"),i=wn(t);return`${n}:${i}`}function En(r){r=ot(r);let e=[],t=[],n=null,i=r.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let o=0;o<i.length;o++){let c=i[o],h=A(c);if(h.size===0){e.push([h.code]),t.push([h.code]);continue}if(o++,o>=i.length)throw xn("invalid address: "+r);if(h.path===!0){n=ot(i.slice(o).join("/")),e.push([h.code,nt(h.code,n)]),t.push([h.code,n]);break}let a=nt(h.code,i[o]);e.push([h.code,a]),t.push([h.code,tt(h.code,a)])}return{string:In(t),bytes:st(e),tuples:e,stringTuples:t,path:n}}function ct(r){let e=[],t=[],n=null,i=0;for(;i<r.length;){let o=Ue(r,i),c=ne(o),h=A(o),a=Mo(h,r.slice(i+c));if(a===0){e.push([o]),t.push([o]),i+=c;continue}let d=r.slice(i+c,i+c+a);if(i+=a+c,i>r.length)throw xn("Invalid address Uint8Array: "+D(r,"base16"));e.push([o,d]);let m=tt(o,d);if(t.push([o,m]),h.path===!0){n=m;break}}return{bytes:Uint8Array.from(r),string:In(t),tuples:e,stringTuples:t,path:n}}function In(r){let e=[];return r.map(t=>{let n=A(t[0]);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),ot(e.join("/"))}function st(r){return ye(r.map(e=>{let t=A(e[0]),n=Uint8Array.from(Pe(t.code));return e.length>1&&e[1]!=null&&(n=ye([n,e[1]])),n}))}function Mo(r,e){if(r.size>0)return r.size/8;if(r.size===0)return 0;{let t=Ue(e instanceof Uint8Array?e:Uint8Array.from(e));return t+ne(t)}}function ot(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function xn(r){return new Error("Error parsing address: "+r)}var zo=Symbol.for("nodejs.util.inspect.custom"),at=Symbol.for("@multiformats/js-multiaddr/multiaddr"),$o=[A("dns").code,A("dns4").code,A("dns6").code,A("dnsaddr").code],ir=class r{bytes;#e;#r;#t;#n;[at]=!0;constructor(e){e==null&&(e="");let t;if(e instanceof Uint8Array)t=ct(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);t=En(e)}else if(An(e))t=ct(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.bytes,this.#e=t.string,this.#r=t.tuples,this.#t=t.stringTuples,this.#n=t.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,t,n,i,o="",c=A("tcp"),h=A("udp"),a=A("ip4"),d=A("ip6"),m=A("dns6"),l=A("ip6zone");for(let[p,s]of this.stringTuples())p===l.code&&(o=`%${s??""}`),$o.includes(p)&&(t=c.name,i=443,n=`${s??""}${o}`,e=p===m.code?6:4),(p===c.code||p===h.code)&&(t=A(p).name,i=parseInt(s??"")),(p===a.code||p===d.code)&&(t=A(p).name,n=`${s??""}${o}`,e=p===d.code?6:4);if(e==null||t==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:i}}protos(){return this.#r.map(([e])=>Object.assign({},A(e)))}protoCodes(){return this.#r.map(([e])=>e)}protoNames(){return this.#r.map(([e])=>A(e).name)}tuples(){return this.#r}stringTuples(){return this.#t}encapsulate(e){return e=new r(e),new r(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),i=n.lastIndexOf(t);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new r(n.slice(0,i))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new r(st(t.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,i])=>{n===De.p2p.code&&e.push([n,i]),n===De["p2p-circuit"].code&&(e=[])});let t=e.pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?D(P.decode(`z${n}`),"base58btc"):D(V.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return Me(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(o=>o.resolvable);if(t==null)return[this];let n=vn.get(t.name);if(n==null)throw new Ge(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(o=>je(o))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[zo](){return`Multiaddr(${this.#e})`}};var vn=new Map;function An(r){return!!r?.[at]}function je(r){return new ir(r)}function Sn(r,e,t,n){let i=()=>{n?.log.trace("query",e),r.query({questions:[{name:e,type:"PTR"}]})};return i(),setInterval(i,t)}function Un(r,e,t,n){if(r.answers==null)return;let i,o=[];if(r.answers.forEach(c=>{switch(c.type){case"PTR":i=c;break;case"TXT":o.push(c);break;default:break}}),r.additionals.forEach(c=>{switch(c.type){case"TXT":o.push(c);break;default:break}}),!(i==null||i?.name!==t||o.length===0||i.data.startsWith(e)))try{let c=o.flatMap(a=>a.data).filter(a=>a.toString().startsWith("dnsaddr=")).map(a=>je(a.toString().substring(8))),h=c[0].getPeerId();if(h==null)throw new Error("Multiaddr doesn't contain PeerId");return n?.log("peer found %p",h),{id:jr(h),multiaddrs:c.map(a=>a.decapsulateCode(A("p2p").code))}}catch(c){n?.log.error("failed to parse mdns response",c)}}function Ln(r,e,t,n,i,o,c){if(!o){c?.log("not responding to mDNS query as broadcast mode is false");return}if(n.length!==0&&r.questions[0]!=null&&r.questions[0].name===i){let h=[];h.push({name:i,type:"PTR",class:"IN",ttl:120,data:t+"."+i}),n.filter(qo).forEach(a=>{let d="dnsaddr="+a.toString();if(d.length>255){c?.log("multiaddr %a is too long to use in mDNS query response",a);return}if(a.getPeerId()==null){c?.log("multiaddr %a did not have a peer ID so cannot be used in mDNS query response",a);return}h.push({name:t+"."+i,type:"TXT",class:"IN",ttl:120,data:d})}),c?.log.trace("responding to query"),e.respond(h)}}function qo(r){return!!an(r)}function bn(r){let e="",t="abcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}var or=class extends We{mdns;log;broadcast;interval;serviceTag;peerName;port;ip;_queryInterval;components;constructor(e,t={}){if(super(),this.log=e.logger.forComponent("libp2p:mdns"),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??bn(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._onMdnsQuery=this._onMdnsQuery.bind(this),this._onMdnsResponse=this._onMdnsResponse.bind(this),this._onMdnsWarning=this._onMdnsWarning.bind(this),this._onMdnsError=this._onMdnsError.bind(this)}[lt]=this;[Symbol.toStringTag]="@libp2p/mdns";[pt]=["@libp2p/peer-discovery"];isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,Cn.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this.mdns.on("warning",this._onMdnsWarning),this.mdns.on("error",this._onMdnsError),this._queryInterval=Sn(this.mdns,this.serviceTag,this.interval,{log:this.log}))}_onMdnsQuery(e){this.mdns!=null&&(this.log.trace("received incoming mDNS query"),Ln(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast,{log:this.log}))}_onMdnsResponse(e){this.log.trace("received mDNS query response");try{let t=Un(e,this.peerName,this.serviceTag,{log:this.log});t!=null&&(this.log("discovered peer in mDNS query response %p",t.id),this.dispatchEvent(new ar("peer",{detail:t})))}catch(t){this.log.error("Error processing peer response",t)}}_onMdnsWarning(e){this.log.error("mdns warning",e)}_onMdnsError(e){this.log.error("mdns error",e)}async stop(){this.mdns!=null&&(this.mdns.removeListener("query",this._onMdnsQuery),this.mdns.removeListener("response",this._onMdnsResponse),this.mdns.removeListener("warning",this._onMdnsWarning),this.mdns.removeListener("error",this._onMdnsError),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 Ko(r={}){return e=>new or(e,r)}return Bn(Ho);})();
|
|
2
|
+
"use strict";var Libp2PMdns=(()=>{var Ps=Object.create;var cr=Object.defineProperty;var Rs=Object.getOwnPropertyDescriptor;var ks=Object.getOwnPropertyNames;var Ds=Object.getPrototypeOf,_s=Object.prototype.hasOwnProperty;var te=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var ve=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),re=(t,e)=>{for(var r in e)cr(t,r,{get:e[r],enumerable:!0})},No=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ks(e))!_s.call(t,o)&&o!==r&&cr(t,o,{get:()=>e[o],enumerable:!(n=Rs(e,o))||n.enumerable});return t};var Bt=(t,e,r)=>(r=t!=null?Ps(Ds(t)):{},No(e||!t||!t.__esModule?cr(r,"default",{value:t,enumerable:!0}):r,t)),Ms=t=>No(cr({},"__esModule",{value:!0}),t);var ko=ve(Hr=>{"use strict";Hr.toString=function(t){switch(t){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+t};Hr.toType=function(t){switch(t.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return t.toUpperCase().startsWith("UNKNOWN_")?parseInt(t.slice(8)):0}});var Do=ve(jr=>{"use strict";jr.toString=function(t){switch(t){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+t};jr.toRcode=function(t){switch(t.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var _o=ve(Gr=>{"use strict";Gr.toString=function(t){switch(t){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+t};Gr.toOpcode=function(t){switch(t.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var Mo=ve(Yr=>{"use strict";Yr.toString=function(t){switch(t){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+t};Yr.toClass=function(t){switch(t.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var Fo=ve(Xr=>{"use strict";Xr.toString=function(t){switch(t){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return t<0?null:`OPTION_${t}`};Xr.toCode=function(t){if(typeof t=="number")return t;if(!t)return-1;switch(t.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let e=t.match(/_(\d+)$/);return e?parseInt(e[1],10):-1}});var $o=ve((qo,Zr)=>{var Ko=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=u,t.encode=m,t.familyOf=d,t.name=void 0,t.sizeOf=c,t.v6=t.v4=void 0;let e=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=4,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,o=16,i={name:"v4",size:r,isFormat:l=>e.test(l),encode(l,p,h){h=~~h,p=p||new Uint8Array(h+r);let y=l.length,g=0;for(let f=0;f<y;){let x=l.charCodeAt(f++);x===46?(p[h++]=g,g=0):g=g*10+(x-48)}return p[h]=g,p},decode(l,p){return p=~~p,`${l[p++]}.${l[p++]}.${l[p++]}.${l[p]}`}};t.v4=i;let s={name:"v6",size:o,isFormat:l=>l.length>0&&n.test(l),encode(l,p,h){h=~~h;let y=h+o,g=-1,f=0,x=0,b=!0,I=!1;p=p||new Uint8Array(h+o);for(let N=0;N<l.length;N++){let v=l.charCodeAt(N);v===58?(b?g!==-1?(h<y&&(p[h]=0),h<y-1&&(p[h+1]=0),h+=2):h<y&&(g=h):(I===!0?(h<y&&(p[h]=x),h++):(h<y&&(p[h]=f>>8),h<y-1&&(p[h+1]=f&255),h+=2),f=0,x=0),b=!0,I=!1):v===46?(h<y&&(p[h]=x),h++,x=0,f=0,b=!1,I=!0):(b=!1,v>=97?v-=87:v>=65?v-=55:(v-=48,x=x*10+v),f=(f<<4)+v)}if(b===!1)I===!0?(h<y&&(p[h]=x),h++):(h<y&&(p[h]=f>>8),h<y-1&&(p[h+1]=f&255),h+=2);else if(g===0)h<y&&(p[h]=0),h<y-1&&(p[h+1]=0),h+=2;else if(g!==-1){h+=2;for(let N=Math.min(h-1,y-1);N>=g+2;N--)p[N]=p[N-2];p[g]=0,p[g+1]=0,g=h}if(g!==h&&g!==-1)for(h>y-2&&(h=y-2);y>g;)p[--y]=h<y&&h>g?p[--h]:0;else for(;h<y;)p[h++]=0;return p},decode(l,p){p=~~p;let h="";for(let y=0;y<o;y+=2)y!==0&&(h+=":"),h+=(l[p+y]<<8|l[p+y+1]).toString(16);return h.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};t.v6=s;let a="ip";t.name=a;function c(l){if(i.isFormat(l))return i.size;if(s.isFormat(l))return s.size;throw Error(`Invalid ip address: ${l}`)}function d(l){return c(l)===i.size?1:2}function m(l,p,h){h=~~h;let y=c(l);return typeof p=="function"&&(p=p(h+y)),y===i.size?i.encode(l,p,h):s.encode(l,p,h)}function u(l,p,h){if(p=~~p,h=h||l.length-p,h===i.size)return i.decode(l,p,h);if(h===s.size)return s.decode(l,p,h);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${s.size} for v6.`)}return"default"in t?t.default:t}({});typeof define=="function"&&define.amd?define([],function(){return Ko}):typeof Zr=="object"&&typeof qo=="object"&&(Zr.exports=Ko)});var Ho=ve(B=>{"use strict";var U=te("buffer").Buffer,qe=ko(),Fs=Do(),Ks=_o(),hr=Mo(),Wr=Fo(),lt=$o(),qs=0,zo=32768,Qr=32768,$s=~Qr,Vo=32768,zs=~Vo,w=B.name={};w.encode=function(t,e,r,{mail:n=!1}={}){e||(e=U.alloc(w.encodingLength(t))),r||(r=0);let o=r,i=t.replace(/^\.|\.$/gm,"");if(i.length){let s=[];if(n){let a="";i.split(".").forEach(c=>{c.endsWith("\\")?a+=(a.length?".":"")+c.slice(0,-1):s.length===0&&a.length?s.push(a+"."+c):s.push(c)})}else s=i.split(".");for(let a=0;a<s.length;a++){let c=e.write(s[a],r+1);e[r]=c,r+=c+1}}return e[r++]=0,w.encode.bytes=r-o,e};w.encode.bytes=0;w.decode=function(t,e,{mail:r=!1}={}){e||(e=0);let n=[],o=e,i=0,s=0,a=!1;for(;;){if(e>=t.length)throw new Error("Cannot decode name (buffer overflow)");let c=t[e++];if(s+=a?0:1,c===0)break;if(c&192)if((c&192)===192){if(e+1>t.length)throw new Error("Cannot decode name (buffer overflow)");let d=t.readUInt16BE(e-1)-49152;if(d>=o)throw new Error("Cannot decode name (bad pointer)");e=d,o=d,s+=a?0:1,a=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+c>t.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=c+1,i>254)throw new Error("Cannot decode name (name too long)");let d=t.toString("utf-8",e,e+c);r&&(d=d.replace(/\./g,"\\.")),n.push(d),e+=c,s+=a?0:c}}return w.decode.bytes=s,n.length===0?".":n.join(".")};w.decode.bytes=0;w.encodingLength=function(t){return t==="."||t===".."?1:U.byteLength(t.replace(/^\.|\.$/gm,""))+2};var C={};C.encode=function(t,e,r){e||(e=U.alloc(C.encodingLength(t))),r||(r=0);let n=e.write(t,r+1);return e[r]=n,C.encode.bytes=n+1,e};C.encode.bytes=0;C.decode=function(t,e){e||(e=0);let r=t[e],n=t.toString("utf-8",e+1,e+1+r);return C.decode.bytes=r+1,n};C.decode.bytes=0;C.encodingLength=function(t){return U.byteLength(t)+1};var xe={};xe.encode=function(t,e,r){e||(e=xe.encodingLength(t)),r||(r=0);let n=(t.flags||0)&32767,o=t.type==="response"?zo:qs;return e.writeUInt16BE(t.id||0,r),e.writeUInt16BE(n|o,r+2),e.writeUInt16BE(t.questions.length,r+4),e.writeUInt16BE(t.answers.length,r+6),e.writeUInt16BE(t.authorities.length,r+8),e.writeUInt16BE(t.additionals.length,r+10),e};xe.encode.bytes=12;xe.decode=function(t,e){if(e||(e=0),t.length<12)throw new Error("Header must be 12 bytes");let r=t.readUInt16BE(e+2);return{id:t.readUInt16BE(e),type:r&zo?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:Ks.toString(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:Fs.toString(r&15),questions:new Array(t.readUInt16BE(e+4)),answers:new Array(t.readUInt16BE(e+6)),authorities:new Array(t.readUInt16BE(e+8)),additionals:new Array(t.readUInt16BE(e+10))}};xe.decode.bytes=12;xe.encodingLength=function(){return 12};var Ce=B.unknown={};Ce.encode=function(t,e,r){return e||(e=U.alloc(Ce.encodingLength(t))),r||(r=0),e.writeUInt16BE(t.length,r),t.copy(e,r+2),Ce.encode.bytes=t.length+2,e};Ce.encode.bytes=0;Ce.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n=t.slice(e+2,e+2+r);return Ce.decode.bytes=r+2,n};Ce.decode.bytes=0;Ce.encodingLength=function(t){return t.length+2};var Pe=B.ns={};Pe.encode=function(t,e,r){return e||(e=U.alloc(Pe.encodingLength(t))),r||(r=0),w.encode(t,e,r+2),e.writeUInt16BE(w.encode.bytes,r),Pe.encode.bytes=w.encode.bytes+2,e};Pe.encode.bytes=0;Pe.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n=w.decode(t,e+2);return Pe.decode.bytes=r+2,n};Pe.decode.bytes=0;Pe.encodingLength=function(t){return w.encodingLength(t)+2};var Re=B.soa={};Re.encode=function(t,e,r){e||(e=U.alloc(Re.encodingLength(t))),r||(r=0);let n=r;return r+=2,w.encode(t.mname,e,r),r+=w.encode.bytes,w.encode(t.rname,e,r,{mail:!0}),r+=w.encode.bytes,e.writeUInt32BE(t.serial||0,r),r+=4,e.writeUInt32BE(t.refresh||0,r),r+=4,e.writeUInt32BE(t.retry||0,r),r+=4,e.writeUInt32BE(t.expire||0,r),r+=4,e.writeUInt32BE(t.minimum||0,r),r+=4,e.writeUInt16BE(r-n-2,n),Re.encode.bytes=r-n,e};Re.encode.bytes=0;Re.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.mname=w.decode(t,e),e+=w.decode.bytes,n.rname=w.decode(t,e,{mail:!0}),e+=w.decode.bytes,n.serial=t.readUInt32BE(e),e+=4,n.refresh=t.readUInt32BE(e),e+=4,n.retry=t.readUInt32BE(e),e+=4,n.expire=t.readUInt32BE(e),e+=4,n.minimum=t.readUInt32BE(e),e+=4,Re.decode.bytes=e-r,n};Re.decode.bytes=0;Re.encodingLength=function(t){return 22+w.encodingLength(t.mname)+w.encodingLength(t.rname)};var ke=B.txt={};ke.encode=function(t,e,r){Array.isArray(t)||(t=[t]);for(let o=0;o<t.length;o++)if(typeof t[o]=="string"&&(t[o]=U.from(t[o])),!U.isBuffer(t[o]))throw new Error("Must be a Buffer");e||(e=U.alloc(ke.encodingLength(t))),r||(r=0);let n=r;return r+=2,t.forEach(function(o){e[r++]=o.length,o.copy(e,r,0,o.length),r+=o.length}),e.writeUInt16BE(r-n-2,n),ke.encode.bytes=r-n,e};ke.encode.bytes=0;ke.decode=function(t,e){e||(e=0);let r=e,n=t.readUInt16BE(e);e+=2;let o=[];for(;n>0;){let i=t[e++];if(--n,n<i)throw new Error("Buffer overflow");o.push(t.slice(e,e+i)),e+=i,n-=i}return ke.decode.bytes=e-r,o};ke.decode.bytes=0;ke.encodingLength=function(t){Array.isArray(t)||(t=[t]);let e=2;return t.forEach(function(r){typeof r=="string"?e+=U.byteLength(r)+1:e+=r.length+1}),e};var De=B.null={};De.encode=function(t,e,r){e||(e=U.alloc(De.encodingLength(t))),r||(r=0),typeof t=="string"&&(t=U.from(t)),t||(t=U.alloc(0));let n=r;r+=2;let o=t.length;return t.copy(e,r,0,o),r+=o,e.writeUInt16BE(r-n-2,n),De.encode.bytes=r-n,e};De.encode.bytes=0;De.decode=function(t,e){e||(e=0);let r=e,n=t.readUInt16BE(e);e+=2;let o=t.slice(e,e+n);return e+=n,De.decode.bytes=e-r,o};De.decode.bytes=0;De.encodingLength=function(t){return t?(U.isBuffer(t)?t.length:U.byteLength(t))+2:2};var _e=B.hinfo={};_e.encode=function(t,e,r){e||(e=U.alloc(_e.encodingLength(t))),r||(r=0);let n=r;return r+=2,C.encode(t.cpu,e,r),r+=C.encode.bytes,C.encode(t.os,e,r),r+=C.encode.bytes,e.writeUInt16BE(r-n-2,n),_e.encode.bytes=r-n,e};_e.encode.bytes=0;_e.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.cpu=C.decode(t,e),e+=C.decode.bytes,n.os=C.decode(t,e),e+=C.decode.bytes,_e.decode.bytes=e-r,n};_e.decode.bytes=0;_e.encodingLength=function(t){return C.encodingLength(t.cpu)+C.encodingLength(t.os)+2};var fe=B.ptr={},Vs=B.cname=fe,Hs=B.dname=fe;fe.encode=function(t,e,r){return e||(e=U.alloc(fe.encodingLength(t))),r||(r=0),w.encode(t,e,r+2),e.writeUInt16BE(w.encode.bytes,r),fe.encode.bytes=w.encode.bytes+2,e};fe.encode.bytes=0;fe.decode=function(t,e){e||(e=0);let r=w.decode(t,e+2);return fe.decode.bytes=w.decode.bytes+2,r};fe.decode.bytes=0;fe.encodingLength=function(t){return w.encodingLength(t)+2};var Me=B.srv={};Me.encode=function(t,e,r){e||(e=U.alloc(Me.encodingLength(t))),r||(r=0),e.writeUInt16BE(t.priority||0,r+2),e.writeUInt16BE(t.weight||0,r+4),e.writeUInt16BE(t.port||0,r+6),w.encode(t.target,e,r+8);let n=w.encode.bytes+6;return e.writeUInt16BE(n,r),Me.encode.bytes=n+2,e};Me.encode.bytes=0;Me.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n={};return n.priority=t.readUInt16BE(e+2),n.weight=t.readUInt16BE(e+4),n.port=t.readUInt16BE(e+6),n.target=w.decode(t,e+8),Me.decode.bytes=r+2,n};Me.decode.bytes=0;Me.encodingLength=function(t){return 8+w.encodingLength(t.target)};var se=B.caa={};se.ISSUER_CRITICAL=128;se.encode=function(t,e,r){let n=se.encodingLength(t);return e||(e=U.alloc(se.encodingLength(t))),r||(r=0),t.issuerCritical&&(t.flags=se.ISSUER_CRITICAL),e.writeUInt16BE(n-2,r),r+=2,e.writeUInt8(t.flags||0,r),r+=1,C.encode(t.tag,e,r),r+=C.encode.bytes,e.write(t.value,r),r+=U.byteLength(t.value),se.encode.bytes=n,e};se.encode.bytes=0;se.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e);e+=2;let n=e,o={};return o.flags=t.readUInt8(e),e+=1,o.tag=C.decode(t,e),e+=C.decode.bytes,o.value=t.toString("utf-8",e,n+r),o.issuerCritical=!!(o.flags&se.ISSUER_CRITICAL),se.decode.bytes=r+2,o};se.decode.bytes=0;se.encodingLength=function(t){return C.encodingLength(t.tag)+C.encodingLength(t.value)+2};var et=B.mx={};et.encode=function(t,e,r){e||(e=U.alloc(et.encodingLength(t))),r||(r=0);let n=r;return r+=2,e.writeUInt16BE(t.preference||0,r),r+=2,w.encode(t.exchange,e,r),r+=w.encode.bytes,e.writeUInt16BE(r-n-2,n),et.encode.bytes=r-n,e};et.encode.bytes=0;et.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.preference=t.readUInt16BE(e),e+=2,n.exchange=w.decode(t,e),e+=w.decode.bytes,et.decode.bytes=e-r,n};et.encodingLength=function(t){return 4+w.encodingLength(t.exchange)};var Fe=B.a={};Fe.encode=function(t,e,r){return e||(e=U.alloc(Fe.encodingLength(t))),r||(r=0),e.writeUInt16BE(4,r),r+=2,lt.v4.encode(t,e,r),Fe.encode.bytes=6,e};Fe.encode.bytes=0;Fe.decode=function(t,e){e||(e=0),e+=2;let r=lt.v4.decode(t,e);return Fe.decode.bytes=6,r};Fe.decode.bytes=0;Fe.encodingLength=function(){return 6};var Ke=B.aaaa={};Ke.encode=function(t,e,r){return e||(e=U.alloc(Ke.encodingLength(t))),r||(r=0),e.writeUInt16BE(16,r),r+=2,lt.v6.encode(t,e,r),Ke.encode.bytes=18,e};Ke.encode.bytes=0;Ke.decode=function(t,e){e||(e=0),e+=2;let r=lt.v6.decode(t,e);return Ke.decode.bytes=18,r};Ke.decode.bytes=0;Ke.encodingLength=function(){return 18};var ne=B.option={};ne.encode=function(t,e,r){e||(e=U.alloc(ne.encodingLength(t))),r||(r=0);let n=r,o=Wr.toCode(t.code);if(e.writeUInt16BE(o,r),r+=2,t.data)e.writeUInt16BE(t.data.length,r),r+=2,t.data.copy(e,r),r+=t.data.length;else switch(o){case 8:let i=t.sourcePrefixLength||0,s=t.family||lt.familyOf(t.ip),a=lt.encode(t.ip,U.alloc),c=Math.ceil(i/8);e.writeUInt16BE(c+4,r),r+=2,e.writeUInt16BE(s,r),r+=2,e.writeUInt8(i,r++),e.writeUInt8(t.scopePrefixLength||0,r++),a.copy(e,r,0,c),r+=c;break;case 11:t.timeout?(e.writeUInt16BE(2,r),r+=2,e.writeUInt16BE(t.timeout,r),r+=2):(e.writeUInt16BE(0,r),r+=2);break;case 12:let d=t.length||0;e.writeUInt16BE(d,r),r+=2,e.fill(0,r,r+d),r+=d;break;case 14:let m=t.tags.length*2;e.writeUInt16BE(m,r),r+=2;for(let u of t.tags)e.writeUInt16BE(u,r),r+=2;break;default:throw new Error(`Unknown roption code: ${t.code}`)}return ne.encode.bytes=r-n,e};ne.encode.bytes=0;ne.decode=function(t,e){e||(e=0);let r={};r.code=t.readUInt16BE(e),r.type=Wr.toString(r.code),e+=2;let n=t.readUInt16BE(e);switch(e+=2,r.data=t.slice(e,e+n),r.code){case 8:r.family=t.readUInt16BE(e),e+=2,r.sourcePrefixLength=t.readUInt8(e++),r.scopePrefixLength=t.readUInt8(e++);let o=U.alloc(r.family===1?4:16);t.copy(o,0,e,e+n-4),r.ip=lt.decode(o);break;case 11:n>0&&(r.timeout=t.readUInt16BE(e),e+=2);break;case 14:r.tags=[];for(let i=0;i<n;i+=2)r.tags.push(t.readUInt16BE(e)),e+=2}return ne.decode.bytes=n+4,r};ne.decode.bytes=0;ne.encodingLength=function(t){if(t.data)return t.data.length+4;switch(Wr.toCode(t.code)){case 8:let r=t.sourcePrefixLength||0;return Math.ceil(r/8)+8;case 11:return typeof t.timeout=="number"?6:4;case 12:return t.length+4;case 14:return 4+t.tags.length*2}throw new Error(`Unknown roption code: ${t.code}`)};var ae=B.opt={};ae.encode=function(t,e,r){e||(e=U.alloc(ae.encodingLength(t))),r||(r=0);let n=r,o=Lt(t,ne);return e.writeUInt16BE(o,r),r=Ht(t,ne,e,r+2),ae.encode.bytes=r-n,e};ae.encode.bytes=0;ae.decode=function(t,e){e||(e=0);let r=e,n=[],o=t.readUInt16BE(e);e+=2;let i=0;for(;o>0;)n[i++]=ne.decode(t,e),e+=ne.decode.bytes,o-=ne.decode.bytes;return ae.decode.bytes=e-r,n};ae.decode.bytes=0;ae.encodingLength=function(t){return 2+Lt(t||[],ne)};var W=B.dnskey={};W.PROTOCOL_DNSSEC=3;W.ZONE_KEY=128;W.SECURE_ENTRYPOINT=32768;W.encode=function(t,e,r){e||(e=U.alloc(W.encodingLength(t))),r||(r=0);let n=r,o=t.key;if(!U.isBuffer(o))throw new Error("Key must be a Buffer");return r+=2,e.writeUInt16BE(t.flags,r),r+=2,e.writeUInt8(W.PROTOCOL_DNSSEC,r),r+=1,e.writeUInt8(t.algorithm,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,W.encode.bytes=r-n,e.writeUInt16BE(W.encode.bytes-2,n),e};W.encode.bytes=0;W.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);if(e+=2,n.flags=t.readUInt16BE(e),e+=2,t.readUInt8(e)!==W.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=t.readUInt8(e),e+=1,n.key=t.slice(e,r+o+2),e+=n.key.length,W.decode.bytes=e-r,n};W.decode.bytes=0;W.encodingLength=function(t){return 6+U.byteLength(t.key)};var Se=B.rrsig={};Se.encode=function(t,e,r){e||(e=U.alloc(Se.encodingLength(t))),r||(r=0);let n=r,o=t.signature;if(!U.isBuffer(o))throw new Error("Signature must be a Buffer");return r+=2,e.writeUInt16BE(qe.toType(t.typeCovered),r),r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.labels,r),r+=1,e.writeUInt32BE(t.originalTTL,r),r+=4,e.writeUInt32BE(t.expiration,r),r+=4,e.writeUInt32BE(t.inception,r),r+=4,e.writeUInt16BE(t.keyTag,r),r+=2,w.encode(t.signersName,e,r),r+=w.encode.bytes,o.copy(e,r,0,o.length),r+=o.length,Se.encode.bytes=r-n,e.writeUInt16BE(Se.encode.bytes-2,n),e};Se.encode.bytes=0;Se.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);return e+=2,n.typeCovered=qe.toString(t.readUInt16BE(e)),e+=2,n.algorithm=t.readUInt8(e),e+=1,n.labels=t.readUInt8(e),e+=1,n.originalTTL=t.readUInt32BE(e),e+=4,n.expiration=t.readUInt32BE(e),e+=4,n.inception=t.readUInt32BE(e),e+=4,n.keyTag=t.readUInt16BE(e),e+=2,n.signersName=w.decode(t,e),e+=w.decode.bytes,n.signature=t.slice(e,r+o+2),e+=n.signature.length,Se.decode.bytes=e-r,n};Se.decode.bytes=0;Se.encodingLength=function(t){return 20+w.encodingLength(t.signersName)+U.byteLength(t.signature)};var Ae=B.rp={};Ae.encode=function(t,e,r){e||(e=U.alloc(Ae.encodingLength(t))),r||(r=0);let n=r;return r+=2,w.encode(t.mbox||".",e,r,{mail:!0}),r+=w.encode.bytes,w.encode(t.txt||".",e,r),r+=w.encode.bytes,Ae.encode.bytes=r-n,e.writeUInt16BE(Ae.encode.bytes-2,n),e};Ae.encode.bytes=0;Ae.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.mbox=w.decode(t,e,{mail:!0})||".",e+=w.decode.bytes,n.txt=w.decode(t,e)||".",e+=w.decode.bytes,Ae.decode.bytes=e-r,n};Ae.decode.bytes=0;Ae.encodingLength=function(t){return 2+w.encodingLength(t.mbox||".")+w.encodingLength(t.txt||".")};var H={};H.encode=function(t,e,r){e||(e=U.alloc(H.encodingLength(t))),r||(r=0);let n=r;for(var o=[],i=0;i<t.length;i++){var s=qe.toType(t[i]);o[s>>8]===void 0&&(o[s>>8]=[]),o[s>>8][s>>3&31]|=1<<7-(s&7)}for(i=0;i<o.length;i++)if(o[i]!==void 0){var a=U.from(o[i]);e.writeUInt8(i,r),r+=1,e.writeUInt8(a.length,r),r+=1,a.copy(e,r),r+=a.length}return H.encode.bytes=r-n,e};H.encode.bytes=0;H.decode=function(t,e,r){e||(e=0);let n=e;for(var o=[];e-n<r;){var i=t.readUInt8(e);e+=1;var s=t.readUInt8(e);e+=1;for(var a=0;a<s;a++)for(var c=t.readUInt8(e+a),d=0;d<8;d++)if(c&1<<7-d){var m=qe.toString(i<<8|a<<3|d);o.push(m)}e+=s}return H.decode.bytes=e-n,o};H.decode.bytes=0;H.encodingLength=function(t){for(var e=[],r=0;r<t.length;r++){var n=qe.toType(t[r]);e[n>>8]=Math.max(e[n>>8]||0,n&255)}var o=0;for(r=0;r<e.length;r++)e[r]!==void 0&&(o+=2+Math.ceil((e[r]+1)/8));return o};var Be=B.nsec={};Be.encode=function(t,e,r){e||(e=U.alloc(Be.encodingLength(t))),r||(r=0);let n=r;return r+=2,w.encode(t.nextDomain,e,r),r+=w.encode.bytes,H.encode(t.rrtypes,e,r),r+=H.encode.bytes,Be.encode.bytes=r-n,e.writeUInt16BE(Be.encode.bytes-2,n),e};Be.encode.bytes=0;Be.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);return e+=2,n.nextDomain=w.decode(t,e),e+=w.decode.bytes,n.rrtypes=H.decode(t,e,o-(e-r)),e+=H.decode.bytes,Be.decode.bytes=e-r,n};Be.decode.bytes=0;Be.encodingLength=function(t){return 2+w.encodingLength(t.nextDomain)+H.encodingLength(t.rrtypes)};var Ue=B.nsec3={};Ue.encode=function(t,e,r){e||(e=U.alloc(Ue.encodingLength(t))),r||(r=0);let n=r,o=t.salt;if(!U.isBuffer(o))throw new Error("salt must be a Buffer");let i=t.nextDomain;if(!U.isBuffer(i))throw new Error("nextDomain must be a Buffer");return r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.flags,r),r+=1,e.writeUInt16BE(t.iterations,r),r+=2,e.writeUInt8(o.length,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,e.writeUInt8(i.length,r),r+=1,i.copy(e,r,0,i.length),r+=i.length,H.encode(t.rrtypes,e,r),r+=H.encode.bytes,Ue.encode.bytes=r-n,e.writeUInt16BE(Ue.encode.bytes-2,n),e};Ue.encode.bytes=0;Ue.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);e+=2,n.algorithm=t.readUInt8(e),e+=1,n.flags=t.readUInt8(e),e+=1,n.iterations=t.readUInt16BE(e),e+=2;let i=t.readUInt8(e);e+=1,n.salt=t.slice(e,e+i),e+=i;let s=t.readUInt8(e);return e+=1,n.nextDomain=t.slice(e,e+s),e+=s,n.rrtypes=H.decode(t,e,o-(e-r)),e+=H.decode.bytes,Ue.decode.bytes=e-r,n};Ue.decode.bytes=0;Ue.encodingLength=function(t){return 8+t.salt.length+t.nextDomain.length+H.encodingLength(t.rrtypes)};var Le=B.ds={};Le.encode=function(t,e,r){e||(e=U.alloc(Le.encodingLength(t))),r||(r=0);let n=r,o=t.digest;if(!U.isBuffer(o))throw new Error("Digest must be a Buffer");return r+=2,e.writeUInt16BE(t.keyTag,r),r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.digestType,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,Le.encode.bytes=r-n,e.writeUInt16BE(Le.encode.bytes-2,n),e};Le.encode.bytes=0;Le.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);return e+=2,n.keyTag=t.readUInt16BE(e),e+=2,n.algorithm=t.readUInt8(e),e+=1,n.digestType=t.readUInt8(e),e+=1,n.digest=t.slice(e,r+o+2),e+=n.digest.length,Le.decode.bytes=e-r,n};Le.decode.bytes=0;Le.encodingLength=function(t){return 6+U.byteLength(t.digest)};var ce=B.sshfp={};ce.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};ce.encode=function(e,r,n){r||(r=U.alloc(ce.encodingLength(e))),n||(n=0);let o=n;n+=2,r[n]=e.algorithm,n+=1,r[n]=e.hash,n+=1;let i=U.from(e.fingerprint.toUpperCase(),"hex");if(i.length!==ce.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return i.copy(r,n),n+=i.byteLength,ce.encode.bytes=n-o,r.writeUInt16BE(ce.encode.bytes-2,o),r};ce.encode.bytes=0;ce.decode=function(e,r){r||(r=0);let n=r,o={};r+=2,o.algorithm=e[r],r+=1,o.hash=e[r],r+=1;let i=ce.getFingerprintLengthForHashType(o.hash);return o.fingerprint=e.slice(r,r+i).toString("hex").toUpperCase(),r+=i,ce.decode.bytes=r-n,o};ce.decode.bytes=0;ce.encodingLength=function(t){return 4+U.from(t.fingerprint,"hex").byteLength};var Te=B.naptr={};Te.encode=function(t,e,r){e||(e=U.alloc(Te.encodingLength(t))),r||(r=0);let n=r;return r+=2,e.writeUInt16BE(t.order||0,r),r+=2,e.writeUInt16BE(t.preference||0,r),r+=2,C.encode(t.flags,e,r),r+=C.encode.bytes,C.encode(t.services,e,r),r+=C.encode.bytes,C.encode(t.regexp,e,r),r+=C.encode.bytes,w.encode(t.replacement,e,r),r+=w.encode.bytes,Te.encode.bytes=r-n,e.writeUInt16BE(Te.encode.bytes-2,n),e};Te.encode.bytes=0;Te.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.order=t.readUInt16BE(e),e+=2,n.preference=t.readUInt16BE(e),e+=2,n.flags=C.decode(t,e),e+=C.decode.bytes,n.services=C.decode(t,e),e+=C.decode.bytes,n.regexp=C.decode(t,e),e+=C.decode.bytes,n.replacement=w.decode(t,e),e+=w.decode.bytes,Te.decode.bytes=e-r,n};Te.decode.bytes=0;Te.encodingLength=function(t){return C.encodingLength(t.flags)+C.encodingLength(t.services)+C.encodingLength(t.regexp)+w.encodingLength(t.replacement)+6};var Ne=B.tlsa={};Ne.encode=function(t,e,r){e||(e=U.alloc(Ne.encodingLength(t))),r||(r=0);let n=r,o=t.certificate;if(!U.isBuffer(o))throw new Error("Certificate must be a Buffer");return r+=2,e.writeUInt8(t.usage,r),r+=1,e.writeUInt8(t.selector,r),r+=1,e.writeUInt8(t.matchingType,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,Ne.encode.bytes=r-n,e.writeUInt16BE(Ne.encode.bytes-2,n),e};Ne.encode.bytes=0;Ne.decode=function(t,e){e||(e=0);let r=e,n={},o=t.readUInt16BE(e);return e+=2,n.usage=t.readUInt8(e),e+=1,n.selector=t.readUInt8(e),e+=1,n.matchingType=t.readUInt8(e),e+=1,n.certificate=t.slice(e,r+o+2),e+=n.certificate.length,Ne.decode.bytes=e-r,n};Ne.decode.bytes=0;Ne.encodingLength=function(t){return 5+U.byteLength(t.certificate)};var Jr=B.record=function(t){switch(t.toUpperCase()){case"A":return Fe;case"PTR":return fe;case"CNAME":return Vs;case"DNAME":return Hs;case"TXT":return ke;case"NULL":return De;case"AAAA":return Ke;case"SRV":return Me;case"HINFO":return _e;case"CAA":return se;case"NS":return Pe;case"SOA":return Re;case"MX":return et;case"OPT":return ae;case"DNSKEY":return W;case"RRSIG":return Se;case"RP":return Ae;case"NSEC":return Be;case"NSEC3":return Ue;case"SSHFP":return ce;case"DS":return Le;case"NAPTR":return Te;case"TLSA":return Ne}return Ce},G=B.answer={};G.encode=function(t,e,r){e||(e=U.alloc(G.encodingLength(t))),r||(r=0);let n=r;if(w.encode(t.name,e,r),r+=w.encode.bytes,e.writeUInt16BE(qe.toType(t.type),r),t.type.toUpperCase()==="OPT"){if(t.name!==".")throw new Error("OPT name must be root.");e.writeUInt16BE(t.udpPayloadSize||4096,r+2),e.writeUInt8(t.extendedRcode||0,r+4),e.writeUInt8(t.ednsVersion||0,r+5),e.writeUInt16BE(t.flags||0,r+6),r+=8,ae.encode(t.options||[],e,r),r+=ae.encode.bytes}else{let o=hr.toClass(t.class===void 0?"IN":t.class);t.flush&&(o|=Qr),e.writeUInt16BE(o,r+2),e.writeUInt32BE(t.ttl||0,r+4),r+=8;let i=Jr(t.type);i.encode(t.data,e,r),r+=i.encode.bytes}return G.encode.bytes=r-n,e};G.encode.bytes=0;G.decode=function(t,e){e||(e=0);let r={},n=e;if(r.name=w.decode(t,e),e+=w.decode.bytes,r.type=qe.toString(t.readUInt16BE(e)),r.type==="OPT")r.udpPayloadSize=t.readUInt16BE(e+2),r.extendedRcode=t.readUInt8(e+4),r.ednsVersion=t.readUInt8(e+5),r.flags=t.readUInt16BE(e+6),r.flag_do=(r.flags>>15&1)===1,r.options=ae.decode(t,e+8),e+=8+ae.decode.bytes;else{let o=t.readUInt16BE(e+2);r.ttl=t.readUInt32BE(e+4),r.class=hr.toString(o&$s),r.flush=!!(o&Qr);let i=Jr(r.type);r.data=i.decode(t,e+8),e+=8+i.decode.bytes}return G.decode.bytes=e-n,r};G.decode.bytes=0;G.encodingLength=function(t){let e=t.data!==null&&t.data!==void 0?t.data:t.options;return w.encodingLength(t.name)+8+Jr(t.type).encodingLength(e)};var we=B.question={};we.encode=function(t,e,r){e||(e=U.alloc(we.encodingLength(t))),r||(r=0);let n=r;return w.encode(t.name,e,r),r+=w.encode.bytes,e.writeUInt16BE(qe.toType(t.type),r),r+=2,e.writeUInt16BE(hr.toClass(t.class===void 0?"IN":t.class),r),r+=2,we.encode.bytes=r-n,t};we.encode.bytes=0;we.decode=function(t,e){e||(e=0);let r=e,n={};return n.name=w.decode(t,e),e+=w.decode.bytes,n.type=qe.toString(t.readUInt16BE(e)),e+=2,n.class=hr.toString(t.readUInt16BE(e)),e+=2,!!(n.class&Vo)&&(n.class&=zs),we.decode.bytes=e-r,n};we.decode.bytes=0;we.encodingLength=function(t){return w.encodingLength(t.name)+4};B.AUTHORITATIVE_ANSWER=1024;B.TRUNCATED_RESPONSE=512;B.RECURSION_DESIRED=256;B.RECURSION_AVAILABLE=128;B.AUTHENTIC_DATA=32;B.CHECKING_DISABLED=16;B.DNSSEC_OK=32768;B.encode=function(t,e,r){let n=!e;n&&(e=U.alloc(B.encodingLength(t))),r||(r=0);let o=r;return t.questions||(t.questions=[]),t.answers||(t.answers=[]),t.authorities||(t.authorities=[]),t.additionals||(t.additionals=[]),xe.encode(t,e,r),r+=xe.encode.bytes,r=Ht(t.questions,we,e,r),r=Ht(t.answers,G,e,r),r=Ht(t.authorities,G,e,r),r=Ht(t.additionals,G,e,r),B.encode.bytes=r-o,n&&B.encode.bytes!==e.length?e.slice(0,B.encode.bytes):e};B.encode.bytes=0;B.decode=function(t,e){e||(e=0);let r=e,n=xe.decode(t,e);return e+=xe.decode.bytes,e=lr(n.questions,we,t,e),e=lr(n.answers,G,t,e),e=lr(n.authorities,G,t,e),e=lr(n.additionals,G,t,e),B.decode.bytes=e-r,n};B.decode.bytes=0;B.encodingLength=function(t){return xe.encodingLength(t)+Lt(t.questions||[],we)+Lt(t.answers||[],G)+Lt(t.authorities||[],G)+Lt(t.additionals||[],G)};B.streamEncode=function(t){let e=B.encode(t),r=U.alloc(2);r.writeUInt16BE(e.byteLength);let n=U.concat([r,e]);return B.streamEncode.bytes=n.byteLength,n};B.streamEncode.bytes=0;B.streamDecode=function(t){let e=t.readUInt16BE(0);if(t.byteLength<e+2)return null;let r=B.decode(t.slice(2));return B.streamDecode.bytes=B.decode.bytes,r};B.streamDecode.bytes=0;function Lt(t,e){let r=0;for(let n=0;n<t.length;n++)r+=e.encodingLength(t[n]);return r}function Ht(t,e,r,n){for(let o=0;o<t.length;o++)e.encode(t[o],r,n),n+=e.encode.bytes;return n}function lr(t,e,r,n){for(let o=0;o<t.length;o++)t[o]=e.decode(r,n),n+=e.decode.bytes;return n}});var Yo=ve((Iu,Go)=>{"use strict";var jo=Ws;process.nextTick(Zs,42);Go.exports=js;function js(t){var e=n;return r;function r(o){e(o||Ys)}function n(o){var i=[o];e=s,t(a);function s(c){i.push(c)}function a(c){var d=arguments;for(e=Gs(c)?n:m;i.length;)m(i.shift());function m(u){jo(Xs,u,d)}}}}function Gs(t){return Object.prototype.toString.call(t)==="[object Error]"}function Ys(){}function Xs(t,e){t.apply(null,e)}function Zs(t){t===42&&(jo=process.nextTick)}function Ws(t,e,r){process.nextTick(function(){t(e,r)})}});var Wo=ve((vu,Zo)=>{var en=Ho(),Qs=te("dgram"),Js=Yo(),ec=te("events"),rn=te("os"),tn=function(){};Zo.exports=function(t){t||(t={});var e=new ec.EventEmitter,r=typeof t.port=="number"?t.port:5353,n=t.type||"udp4",o=t.ip||t.host||(n==="udp4"?"224.0.0.251":null),i={address:o,port:r},s={},a=!1,c=null;if(n==="udp6"&&(!o||!t.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var d=t.socket||Qs.createSocket({type:n,reuseAddr:t.reuseAddr!==!1,toString:function(){return n}});d.on("error",function(u){u.code==="EACCES"||u.code==="EADDRINUSE"?e.emit("error",u):e.emit("warning",u)}),d.on("message",function(u,l){try{u=en.decode(u)}catch(p){e.emit("warning",p);return}e.emit("packet",u,l),u.type==="query"&&e.emit("query",u,l),u.type==="response"&&e.emit("response",u,l)}),d.on("listening",function(){r||(r=i.port=d.address().port),t.multicast!==!1&&(e.update(),c=setInterval(e.update,5e3),d.setMulticastTTL(t.ttl||255),d.setMulticastLoopback(t.loopback!==!1))});var m=Js(function(u){if(!r||t.bind===!1)return u(null);d.once("error",u),d.bind(r,t.bind||t.interface,function(){d.removeListener("error",u),u(null)})});return m(function(u){if(u)return e.emit("error",u);e.emit("ready")}),e.send=function(u,l,p){if(typeof l=="function")return e.send(u,null,l);p||(p=tn),l?!l.host&&!l.address&&(l.address=i.address):l=i,m(h);function h(y){if(a)return p();if(y)return p(y);var g=en.encode(u);d.send(g,0,g.length,l.port,l.address||l.host,p)}},e.response=e.respond=function(u,l,p){Array.isArray(u)&&(u={answers:u}),u.type="response",u.flags=(u.flags||0)|en.AUTHORITATIVE_ANSWER,e.send(u,l,p)},e.query=function(u,l,p,h){if(typeof l=="function")return e.query(u,null,null,l);if(typeof l=="object"&&l&&l.port)return e.query(u,null,l,p);if(typeof p=="function")return e.query(u,l,null,p);h||(h=tn),typeof u=="string"&&(u=[{name:u,type:l||"ANY"}]),Array.isArray(u)&&(u={type:"query",questions:u}),u.type="query",e.send(u,p,h)},e.destroy=function(u){if(u||(u=tn),a)return process.nextTick(u);a=!0,clearInterval(c);for(var l in s)try{d.dropMembership(o,l)}catch{}s={},d.close(u)},e.update=function(){for(var u=t.interface?[].concat(t.interface):rc(),l=!1,p=0;p<u.length;p++){var h=u[p];if(!s[h])try{d.addMembership(o,h),s[h]=!0,l=!0}catch(y){e.emit("warning",y)}}if(l){if(d.setMulticastInterface)try{d.setMulticastInterface(t.interface||tc())}catch(y){e.emit("warning",y)}e.emit("networkInterface")}},e};function tc(){for(var t=rn.networkInterfaces(),e=Object.keys(t),r=0;r<e.length;r++)for(var n=t[e[r]],o=0;o<n.length;o++){var i=n[o];if(Xo(i.family)&&!i.internal)return rn.platform()==="darwin"&&e[r]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function rc(){for(var t=rn.networkInterfaces(),e=Object.keys(t),r=[],n=0;n<e.length;n++)for(var o=t[e[n]],i=0;i<o.length;i++){var s=o[i];if(Xo(s.family)){r.push(s.address);break}}return r}function Xo(t){return t===4||t==="IPv4"}});var hs=ve(or=>{(function(){var t,e,r,n,o,i,s,a;a=function(c){var d,m,u,l;return d=(c&255<<24)>>>24,m=(c&255<<16)>>>16,u=(c&65280)>>>8,l=c&255,[d,m,u,l].join(".")},s=function(c){var d,m,u,l,p,h;for(d=[],u=l=0;l<=3&&c.length!==0;u=++l){if(u>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}h=e(c),p=h[0],m=h[1],c=c.substring(m),d.push(p)}if(c.length!==0)throw new Error("Invalid IP");switch(d.length){case 1:if(d[0]>4294967295)throw new Error("Invalid IP");return d[0]>>>0;case 2:if(d[0]>255||d[1]>16777215)throw new Error("Invalid IP");return(d[0]<<24|d[1])>>>0;case 3:if(d[0]>255||d[1]>255||d[2]>65535)throw new Error("Invalid IP");return(d[0]<<24|d[1]<<16|d[2])>>>0;case 4:if(d[0]>255||d[1]>255||d[2]>255||d[3]>255)throw new Error("Invalid IP");return(d[0]<<24|d[1]<<16|d[2]<<8|d[3])>>>0;default:throw new Error("Invalid IP")}},r=function(c){return c.charCodeAt(0)},n=r("0"),i=r("a"),o=r("A"),e=function(c){var d,m,u,l,p;for(l=0,d=10,m="9",u=0,c.length>1&&c[u]==="0"&&(c[u+1]==="x"||c[u+1]==="X"?(u+=2,d=16):"0"<=c[u+1]&&c[u+1]<="9"&&(u++,d=8,m="7")),p=u;u<c.length;){if("0"<=c[u]&&c[u]<=m)l=l*d+(r(c[u])-n)>>>0;else if(d===16)if("a"<=c[u]&&c[u]<="f")l=l*d+(10+r(c[u])-i)>>>0;else if("A"<=c[u]&&c[u]<="F")l=l*d+(10+r(c[u])-o)>>>0;else break;else break;if(l>4294967295)throw new Error("too large");u++}if(u===p)throw new Error("empty octet");return[l,u]},t=function(){function c(d,m){var u,l,p,h;if(typeof d!="string")throw new Error("Missing `net' parameter");if(m||(h=d.split("/",2),d=h[0],m=h[1]),m||(m=32),typeof m=="string"&&m.indexOf(".")>-1){try{this.maskLong=s(m)}catch(y){throw u=y,new Error("Invalid mask: "+m)}for(l=p=32;p>=0;l=--p)if(this.maskLong===4294967295<<32-l>>>0){this.bitmask=l;break}}else if(m||m===0)this.bitmask=parseInt(m,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(s(d)&this.maskLong)>>>0}catch(y){throw u=y,new Error("Invalid net address: "+d)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+m);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(d){return typeof d=="string"&&(d.indexOf("/")>0||d.split(".").length!==4)&&(d=new c(d)),d instanceof c?this.contains(d.base)&&this.contains(d.broadcast||d.last):(s(d)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(d){return d==null&&(d=1),new c(a(this.netLong+this.size*d),this.mask)},c.prototype.forEach=function(d){var m,u,l;for(l=s(this.first),u=s(this.last),m=0;l<=u;)d(a(l),l,m),m++,l++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),or.ip2long=s,or.long2ip=a,or.Netmask=t}).call(or)});var Md={};re(Md,{mdns:()=>_d});var Oo=Symbol.for("@libp2p/peer-discovery");var Vr=Symbol.for("@libp2p/peer-id");var Ut=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},ar=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}};var dr=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var Vt=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}};var Co=te("events"),Po=(t,...e)=>{try{(0,Co.setMaxListeners)(t,...e)}catch{}};var ur=class extends EventTarget{#e=new Map;constructor(){super(),Po(1/0,this)}listenerCount(e){let r=this.#e.get(e);return r==null?0:r.length}addEventListener(e,r,n){super.addEventListener(e,r,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:r,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,r,n){super.removeEventListener(e.toString(),r??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:i})=>i!==r),this.#e.set(e,o))}dispatchEvent(e){let r=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),r}safeDispatchEvent(e,r={}){return this.dispatchEvent(new CustomEvent(e,r))}};var Ro=Symbol.for("@libp2p/service-capabilities"),jd=Symbol.for("@libp2p/service-dependencies");var Cs=Bt(Wo(),1);var an={};re(an,{base58btc:()=>K,base58flickr:()=>ac});var Su=new Uint8Array(0);function Qo(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function pe(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function Jo(t){return new TextEncoder().encode(t)}function ei(t){return new TextDecoder().decode(t)}function nc(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var i=t.charAt(o),s=i.charCodeAt(0);if(r[s]!==255)throw new TypeError(i+" is ambiguous");r[s]=o}var a=t.length,c=t.charAt(0),d=Math.log(a)/Math.log(256),m=Math.log(256)/Math.log(a);function u(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var y=0,g=0,f=0,x=h.length;f!==x&&h[f]===0;)f++,y++;for(var b=(x-f)*m+1>>>0,I=new Uint8Array(b);f!==x;){for(var N=h[f],v=0,S=b-1;(N!==0||v<g)&&S!==-1;S--,v++)N+=256*I[S]>>>0,I[S]=N%a>>>0,N=N/a>>>0;if(N!==0)throw new Error("Non-zero carry");g=v,f++}for(var T=b-g;T!==b&&I[T]===0;)T++;for(var O=c.repeat(y);T<b;++T)O+=t.charAt(I[T]);return O}function l(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var y=0;if(h[y]!==" "){for(var g=0,f=0;h[y]===c;)g++,y++;for(var x=(h.length-y)*d+1>>>0,b=new Uint8Array(x);h[y];){var I=r[h.charCodeAt(y)];if(I===255)return;for(var N=0,v=x-1;(I!==0||N<f)&&v!==-1;v--,N++)I+=a*b[v]>>>0,b[v]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");f=N,y++}if(h[y]!==" "){for(var S=x-f;S!==x&&b[S]===0;)S++;for(var T=new Uint8Array(g+(x-S)),O=g;S!==x;)T[O++]=b[S++];return T}}}function p(h){var y=l(h);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:l,decode:p}}var oc=nc,ic=oc,ri=ic;var nn=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},on=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ni(this,e)}},sn=class{decoders;constructor(e){this.decoders=e}or(e){return ni(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ni(t,e){return new sn({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var cn=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new nn(e,r,n),this.decoder=new on(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Tt({name:t,prefix:e,encode:r,decode:n}){return new cn(t,e,r,n)}function tt({name:t,prefix:e,alphabet:r}){let{encode:n,decode:o}=ri(r,t);return Tt({prefix:e,name:t,encode:n,decode:i=>pe(o(i))})}function sc(t,e,r,n){let o={};for(let m=0;m<e.length;++m)o[e[m]]=m;let i=t.length;for(;t[i-1]==="=";)--i;let s=new Uint8Array(i*r/8|0),a=0,c=0,d=0;for(let m=0;m<i;++m){let u=o[t[m]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|u,a+=r,a>=8&&(a-=8,s[d++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s}function cc(t,e,r){let n=e[e.length-1]==="=",o=(1<<r)-1,i="",s=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],s+=8;s>r;)s-=r,i+=e[o&a>>s];if(s!==0&&(i+=e[o&a<<r-s]),n)for(;i.length*r&7;)i+="=";return i}function F({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return Tt({prefix:e,name:t,encode(o){return cc(o,n,r)},decode(o){return sc(o,n,r,t)}})}var K=tt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ac=tt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var dn={};re(dn,{base32:()=>$e,base32hex:()=>hc,base32hexpad:()=>gc,base32hexpadupper:()=>mc,base32hexupper:()=>pc,base32pad:()=>uc,base32padupper:()=>lc,base32upper:()=>dc,base32z:()=>yc});var $e=F({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),dc=F({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),uc=F({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),lc=F({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),hc=F({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),pc=F({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),gc=F({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),mc=F({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),yc=F({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var fc=si,oi=128,wc=127,xc=~wc,Ec=Math.pow(2,31);function si(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Ec;)e[r++]=t&255|oi,t/=128;for(;t&xc;)e[r++]=t&255|oi,t>>>=7;return e[r]=t|0,si.bytes=r-n+1,e}var bc=un,Ic=128,ii=127;function un(t,n){var r=0,n=n||0,o=0,i=n,s,a=t.length;do{if(i>=a)throw un.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=o<28?(s&ii)<<o:(s&ii)*Math.pow(2,o),o+=7}while(s>=Ic);return un.bytes=i-n,r}var vc=Math.pow(2,7),Sc=Math.pow(2,14),Ac=Math.pow(2,21),Bc=Math.pow(2,28),Uc=Math.pow(2,35),Lc=Math.pow(2,42),Tc=Math.pow(2,49),Nc=Math.pow(2,56),Oc=Math.pow(2,63),Cc=function(t){return t<vc?1:t<Sc?2:t<Ac?3:t<Bc?4:t<Uc?5:t<Lc?6:t<Tc?7:t<Nc?8:t<Oc?9:10},Pc={encode:fc,decode:bc,encodingLength:Cc},Rc=Pc,jt=Rc;function Gt(t,e=0){return[jt.decode(t,e),jt.decode.bytes]}function Nt(t,e,r=0){return jt.encode(t,e,r),e}function Ot(t){return jt.encodingLength(t)}function ht(t,e){let r=e.byteLength,n=Ot(t),o=n+Ot(r),i=new Uint8Array(o+r);return Nt(t,i,0),Nt(r,i,n),i.set(e,o),new Ct(t,r,e,i)}function pt(t){let e=pe(t),[r,n]=Gt(e),[o,i]=Gt(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Ct(r,o,s,e)}function ci(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Qo(t.bytes,r.bytes)}}var Ct=class{code;size;digest;bytes;constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};function ai(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return Dc(r,ln(t),e??K.encoder);default:return _c(r,ln(t),e??$e.encoder)}}var di=new WeakMap;function ln(t){let e=di.get(t);if(e==null){let r=new Map;return di.set(t,r),r}return e}var Q=class t{code;version;multihash;bytes;"/";constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==Yt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Mc)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ht(e,r);return t.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 t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&ci(e.multihash,n.multihash)}toString(e){return ai(this,e)}toJSON(){return{"/":ai(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:i,bytes:s}=r;return new t(n,o,i,s??ui(n,o,i.bytes))}else if(r[Fc]===!0){let{version:n,multihash:o,code:i}=r,s=pt(o);return t.create(n,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==Yt)throw new Error(`Version 0 CID must use dag-pb (code: ${Yt}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let o=ui(e,r,n.bytes);return new t(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Yt,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,o=pe(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let i=o.subarray(r.multihashSize-r.digestSize),s=new Ct(r.multihashCode,r.digestSize,i,o);return[r.version===0?t.createV0(s):t.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[u,l]=Gt(e.subarray(r));return r+=l,u},o=n(),i=Yt;if(o===18?(o=0,r=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=r,a=n(),c=n(),d=r+c,m=d-s;return{version:o,codec:i,multihashCode:a,digestSize:c,multihashSize:m,size:d}}static parse(e,r){let[n,o]=kc(e,r),i=t.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ln(i).set(n,e),i}};function kc(t,e){switch(t[0]){case"Q":{let r=e??K;return[K.prefix,r.decode(`${K.prefix}${t}`)]}case K.prefix:{let r=e??K;return[K.prefix,r.decode(t)]}case $e.prefix:{let r=e??$e;return[$e.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function Dc(t,e,r){let{prefix:n}=r;if(n!==K.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let i=r.encode(t).slice(1);return e.set(n,i),i}else return o}function _c(t,e,r){let{prefix:n}=r,o=e.get(n);if(o==null){let i=r.encode(t);return e.set(n,i),i}else return o}var Yt=112,Mc=18;function ui(t,e,r){let n=Ot(t),o=n+Ot(e),i=new Uint8Array(o+r.byteLength);return Nt(t,i,0),Nt(e,i,n),i.set(r,o),i}var Fc=Symbol.for("@ipld/js-cid/CID");var hn={};re(hn,{identity:()=>ze});var li=0,Kc="identity",hi=pe;function qc(t){return ht(li,hi(t))}var ze={code:li,name:Kc,encode:hi,digest:qc};function Ve(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var mr=Bt(te("crypto"),1);var pi=te("node:buffer");function Pt(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function Oe(t,e){return Pt(pi.Buffer.concat(t,e))}var xi=te("node:buffer");var pn={};re(pn,{base10:()=>$c});var $c=tt({prefix:"9",name:"base10",alphabet:"0123456789"});var gn={};re(gn,{base16:()=>zc,base16upper:()=>Vc});var zc=F({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Vc=F({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var mn={};re(mn,{base2:()=>Hc});var Hc=F({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var yn={};re(yn,{base256emoji:()=>Zc});var gi=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}"),jc=gi.reduce((t,e,r)=>(t[r]=e,t),[]),Gc=gi.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yc(t){return t.reduce((e,r)=>(e+=jc[r],e),"")}function Xc(t){let e=[];for(let r of t){let n=Gc[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Zc=Tt({prefix:"\u{1F680}",name:"base256emoji",encode:Yc,decode:Xc});var fn={};re(fn,{base36:()=>Wc,base36upper:()=>Qc});var Wc=tt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Qc=tt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var wn={};re(wn,{base64:()=>Jc,base64pad:()=>ea,base64url:()=>ta,base64urlpad:()=>ra});var Jc=F({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ea=F({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ta=F({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ra=F({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var xn={};re(xn,{base8:()=>na});var na=F({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var En={};re(En,{identity:()=>oa});var oa=Tt({prefix:"\0",name:"identity",encode:t=>ei(t),decode:t=>Jo(t)});var Ju=new TextEncoder,el=new TextDecoder;var An={};re(An,{sha256:()=>Sn,sha512:()=>ca});var vn=Bt(te("crypto"),1);function In({name:t,code:e,encode:r}){return new bn(t,e,r)}var bn=class{name;code;encode;constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ht(this.code,r):r.then(n=>ht(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Sn=In({name:"sha2-256",code:18,encode:t=>pe(vn.default.createHash("sha256").update(t).digest())}),ca=In({name:"sha2-512",code:19,encode:t=>pe(vn.default.createHash("sha512").update(t).digest())});var Xt={...En,...mn,...xn,...pn,...gn,...dn,...fn,...an,...wn,...yn},pl={...An,...hn};var yi=te("node:buffer");function He(t=0){return Pt(yi.Buffer.allocUnsafe(t))}function wi(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var fi=wi("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Bn=wi("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=He(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),aa={utf8:fi,"utf-8":fi,hex:Xt.base16,latin1:Bn,ascii:Bn,binary:Bn,...Xt},gr=aa;function rt(t,e="utf8"){let r=gr[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return e==="utf8"||e==="utf-8"?Pt(xi.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var Ei=te("node:buffer");function $(t,e="utf8"){let r=gr[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return e==="utf8"||e==="utf-8"?Ei.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var Ll=mr.default.generateKeyPairSync,Zt=32;var da=64;function bi(t,e,r){if(t.byteLength!==Zt)throw new TypeError('"key" must be 32 bytes in length.');if(!(t instanceof Uint8Array))throw new TypeError('"key" must be a node.js Buffer, or Uint8Array.');if(e.byteLength!==da)throw new TypeError('"sig" must be 64 bytes in length.');if(!(e instanceof Uint8Array))throw new TypeError('"sig" must be a node.js Buffer, or Uint8Array.');let n=mr.default.createPublicKey({format:"jwk",key:{crv:"Ed25519",x:$(t,"base64url"),kty:"OKP"}});return mr.default.verify(null,r instanceof Uint8Array?r:r.subarray(),n,e)}var yr=class{type="Ed25519";raw;constructor(e){this.raw=Un(e,Zt)}toMultihash(){return ze.digest(fr(this))}toCID(){return Q.createV1(114,this.toMultihash())}toString(){return K.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Ve(this.raw,e.raw)}verify(e,r){return bi(this.raw,r,e)}};function vi(t){return t=Un(t,Zt),new yr(t)}function Un(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new Ut(`Key must be a Uint8Array of length ${e}, got ${t.length}`);return t}var la=Math.pow(2,7),ha=Math.pow(2,14),pa=Math.pow(2,21),Ln=Math.pow(2,28),Tn=Math.pow(2,35),Nn=Math.pow(2,42),On=Math.pow(2,49),R=128,Y=127;function oe(t){if(t<la)return 1;if(t<ha)return 2;if(t<pa)return 3;if(t<Ln)return 4;if(t<Tn)return 5;if(t<Nn)return 6;if(t<On)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Cn(t,e,r=0){switch(oe(t)){case 8:e[r++]=t&255|R,t/=128;case 7:e[r++]=t&255|R,t/=128;case 6:e[r++]=t&255|R,t/=128;case 5:e[r++]=t&255|R,t/=128;case 4:e[r++]=t&255|R,t>>>=7;case 3:e[r++]=t&255|R,t>>>=7;case 2:e[r++]=t&255|R,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function ga(t,e,r=0){switch(oe(t)){case 8:e.set(r++,t&255|R),t/=128;case 7:e.set(r++,t&255|R),t/=128;case 6:e.set(r++,t&255|R),t/=128;case 5:e.set(r++,t&255|R),t/=128;case 4:e.set(r++,t&255|R),t>>>=7;case 3:e.set(r++,t&255|R),t>>>=7;case 2:e.set(r++,t&255|R),t>>>=7;case 1:{e.set(r++,t&255),t>>>=7;break}default:throw new Error("unreachable")}return e}function Pn(t,e){let r=t[e],n=0;if(n+=r&Y,r<R||(r=t[e+1],n+=(r&Y)<<7,r<R)||(r=t[e+2],n+=(r&Y)<<14,r<R)||(r=t[e+3],n+=(r&Y)<<21,r<R)||(r=t[e+4],n+=(r&Y)*Ln,r<R)||(r=t[e+5],n+=(r&Y)*Tn,r<R)||(r=t[e+6],n+=(r&Y)*Nn,r<R)||(r=t[e+7],n+=(r&Y)*On,r<R))return n;throw new RangeError("Could not decode varint")}function ma(t,e){let r=t.get(e),n=0;if(n+=r&Y,r<R||(r=t.get(e+1),n+=(r&Y)<<7,r<R)||(r=t.get(e+2),n+=(r&Y)<<14,r<R)||(r=t.get(e+3),n+=(r&Y)<<21,r<R)||(r=t.get(e+4),n+=(r&Y)*Ln,r<R)||(r=t.get(e+5),n+=(r&Y)*Tn,r<R)||(r=t.get(e+6),n+=(r&Y)*Nn,r<R)||(r=t.get(e+7),n+=(r&Y)*On,r<R))return n;throw new RangeError("Could not decode varint")}function Rt(t,e,r=0){return e==null&&(e=He(oe(t))),e instanceof Uint8Array?Cn(t,e,r):ga(t,e,r)}function mt(t,e=0){return t instanceof Uint8Array?Pn(t,e):ma(t,e)}var Rn=new Float32Array([-0]),nt=new Uint8Array(Rn.buffer);function Ai(t,e,r){Rn[0]=t,e[r]=nt[0],e[r+1]=nt[1],e[r+2]=nt[2],e[r+3]=nt[3]}function Bi(t,e){return nt[0]=t[e],nt[1]=t[e+1],nt[2]=t[e+2],nt[3]=t[e+3],Rn[0]}var kn=new Float64Array([-0]),X=new Uint8Array(kn.buffer);function Ui(t,e,r){kn[0]=t,e[r]=X[0],e[r+1]=X[1],e[r+2]=X[2],e[r+3]=X[3],e[r+4]=X[4],e[r+5]=X[5],e[r+6]=X[6],e[r+7]=X[7]}function Li(t,e){return X[0]=t[e],X[1]=t[e+1],X[2]=t[e+2],X[3]=t[e+3],X[4]=t[e+4],X[5]=t[e+5],X[6]=t[e+6],X[7]=t[e+7],kn[0]}var ya=BigInt(Number.MAX_SAFE_INTEGER),fa=BigInt(Number.MIN_SAFE_INTEGER),de=class t{lo;hi;constructor(e,r){this.lo=e|0,this.hi=r|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return yt;if(e<ya&&e>fa)return this.fromNumber(Number(e));let r=e<0n;r&&(e=-e);let n=e>>32n,o=e-(n<<32n);return r&&(n=~n|0n,o=~o|0n,++o>Ti&&(o=0n,++n>Ti&&(n=0n))),new t(Number(o),Number(n))}static fromNumber(e){if(e===0)return yt;let r=e<0;r&&(e=-e);let n=e>>>0,o=(e-n)/4294967296>>>0;return r&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new t(n,o)}static from(e){return typeof e=="number"?t.fromNumber(e):typeof e=="bigint"?t.fromBigInt(e):typeof e=="string"?t.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new t(e.low>>>0,e.high>>>0):yt}},yt=new de(0,0);yt.toBigInt=function(){return 0n};yt.zzEncode=yt.zzDecode=function(){return this};yt.length=function(){return 1};var Ti=4294967296n;function Ni(t){let e=0,r=0;for(let n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Oi(t,e,r){if(r-e<1)return"";let o,i=[],s=0,a;for(;e<r;)a=t[e++],a<128?i[s++]=a:a>191&&a<224?i[s++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,i[s++]=55296+(a>>10),i[s++]=56320+(a&1023)):i[s++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,i)),s=0);return o!=null?(s>0&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))}function Dn(t,e,r){let n=r,o,i;for(let s=0;s<t.length;++s)o=t.charCodeAt(s),o<128?e[r++]=o:o<2048?(e[r++]=o>>6|192,e[r++]=o&63|128):(o&64512)===55296&&((i=t.charCodeAt(s+1))&64512)===56320?(o=65536+((o&1023)<<10)+(i&1023),++s,e[r++]=o>>18|240,e[r++]=o>>12&63|128,e[r++]=o>>6&63|128,e[r++]=o&63|128):(e[r++]=o>>12|224,e[r++]=o>>6&63|128,e[r++]=o&63|128);return r-n}function Ee(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function wr(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var _n=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Ee(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Ee(this,4);return wr(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Ee(this,4);return wr(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Ee(this,4);let e=Bi(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Ee(this,4);let e=Li(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Ee(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return Oi(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ee(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ee(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new de(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw Ee(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,e}if(this.len-this.pos>4){for(;r<5;++r)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;r<5;++r){if(this.pos>=this.len)throw Ee(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Ee(this,8);let e=wr(this.buf,this.pos+=4),r=wr(this.buf,this.pos+=4);return new de(e,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=Pn(this.buf,this.pos);return this.pos+=oe(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function Mn(t){return new _n(t instanceof Uint8Array?t:t.subarray())}function xr(t,e,r){let n=Mn(t);return e.decode(n,void 0,r)}function Fn(t){let e=t??8192,r=e>>>1,n,o=e;return function(s){if(s<1||s>r)return He(s);o+s>e&&(n=He(e),o=0);let a=n.subarray(o,o+=s);return o&7&&(o=(o|7)+1),a}}var ft=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function Kn(){}var $n=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},wa=Fn();function xa(t){return globalThis.Buffer!=null?He(t):wa(t)}var Qt=class{len;head;tail;states;constructor(){this.len=0,this.head=new ft(Kn,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new ft(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new zn((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(Er,10,de.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=de.fromBigInt(e);return this._push(Er,r.length(),r)}uint64Number(e){return this._push(Cn,oe(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let r=de.fromBigInt(e).zzEncode();return this._push(Er,r.length(),r)}sint64Number(e){let r=de.fromNumber(e).zzEncode();return this._push(Er,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(qn,1,e?1:0)}fixed32(e){return this._push(Wt,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=de.fromBigInt(e);return this._push(Wt,4,r.lo)._push(Wt,4,r.hi)}fixed64Number(e){let r=de.fromNumber(e);return this._push(Wt,4,r.lo)._push(Wt,4,r.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Ai,4,e)}double(e){return this._push(Ui,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(qn,1,0):this.uint32(r)._push(ba,r,e)}string(e){let r=Ni(e);return r!==0?this.uint32(r)._push(Dn,r,e):this._push(qn,1,0)}fork(){return this.states=new $n(this),this.head=this.tail=new ft(Kn,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ft(Kn,0,0),this.len=0),this}ldelim(){let e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=r,this.len+=n),this}finish(){let e=this.head.next,r=xa(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function qn(t,e,r){e[r]=t&255}function Ea(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var zn=class extends ft{next;constructor(e,r){super(Ea,e,r),this.next=void 0}};function Er(t,e,r){for(;t.hi!==0;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}function Wt(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function ba(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(Qt.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(Ia,e,t),this},Qt.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(va,e,t),this});function Ia(t,e,r){e.set(t,r)}function va(t,e,r){t.length<40?Dn(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(rt(t),r)}function Vn(){return new Qt}function br(t,e){let r=Vn();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var kt;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(kt||(kt={}));function Ir(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function Hn(t){function e(o){if(t[o.toString()]==null)throw new Error("Invalid enum value");return t[o]}let r=function(i,s){let a=e(i);s.int32(a)},n=function(i){let s=i.int32();return e(s)};return Ir("enum",kt.VARINT,r,n)}function vr(t,e){return Ir("message",kt.LENGTH_DELIMITED,t,e)}var ge;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.secp256k1="secp256k1"})(ge||(ge={}));var jn;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.secp256k1=2]="secp256k1"})(jn||(jn={}));(function(t){t.codec=()=>Hn(jn)})(ge||(ge={}));var Jt;(function(t){let e;t.codec=()=>(e==null&&(e=vr((r,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),ge.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),o.lengthDelimited!==!1&&n.ldelim()},(r,n,o={})=>{let i={},s=n==null?r.len:r.pos+n;for(;r.pos<s;){let a=r.uint32();switch(a>>>3){case 1:{i.Type=ge.codec().decode(r);break}case 2:{i.Data=r.bytes();break}default:{r.skipType(a&7);break}}}return i})),e),t.encode=r=>br(r,t.codec()),t.decode=(r,n)=>xr(r,t.codec(),n)})(Jt||(Jt={}));var Gn;(function(t){let e;t.codec=()=>(e==null&&(e=vr((r,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),ge.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),o.lengthDelimited!==!1&&n.ldelim()},(r,n,o={})=>{let i={},s=n==null?r.len:r.pos+n;for(;r.pos<s;){let a=r.uint32();switch(a>>>3){case 1:{i.Type=ge.codec().decode(r);break}case 2:{i.Data=r.bytes();break}default:{r.skipType(a&7);break}}}return i})),e),t.encode=r=>br(r,t.codec()),t.decode=(r,n)=>xr(r,t.codec(),n)})(Gn||(Gn={}));function Pi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function Aa(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Dt(t,...e){if(!Aa(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function Ri(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Pi(t.outputLen),Pi(t.blockLen)}function _t(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ki(t,e){Dt(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var je=Bt(te("node:crypto"),1),wt=je&&typeof je=="object"&&"webcrypto"in je?je.webcrypto:je&&typeof je=="object"&&"randomBytes"in je?je:void 0;var Sr=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),be=(t,e)=>t<<32-e|t>>>e;var Uh=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ba(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function er(t){return typeof t=="string"&&(t=Ba(t)),Dt(t),t}function Di(...t){let e=0;for(let n=0;n<t.length;n++){let o=t[n];Dt(o),e+=o.length}let r=new Uint8Array(e);for(let n=0,o=0;n<t.length;n++){let i=t[n];r.set(i,o),o+=i.length}return r}var Mt=class{clone(){return this._cloneInto()}},Lh={}.toString;function _i(t){let e=n=>t().update(er(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Mi(t=32){if(wt&&typeof wt.getRandomValues=="function")return wt.getRandomValues(new Uint8Array(t));if(wt&&typeof wt.randomBytes=="function")return wt.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function Ua(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),a=Number(r&i),c=n?4:0,d=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+d,a,n)}var Fi=(t,e,r)=>t&e^~t&r,Ki=(t,e,r)=>t&e^t&r^e&r,Ar=class extends Mt{constructor(e,r,n,o){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Sr(this.buffer)}update(e){_t(this);let{view:r,buffer:n,blockLen:o}=this;e=er(e);let i=e.length;for(let s=0;s<i;){let a=Math.min(o-this.pos,i-s);if(a===o){let c=Sr(e);for(;o<=i-s;s+=o)this.process(c,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){_t(this),ki(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:i}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(n,0),s=0);for(let u=s;u<o;u++)r[u]=0;Ua(n,o-8,BigInt(this.length*8),i),this.process(n,0);let a=Sr(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=c/4,m=this.get();if(d>m.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<d;u++)a.setUint32(4*u,m[u],i)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:i,destroyed:s,pos:a}=this;return e.length=o,e.pos=a,e.finished=i,e.destroyed=s,o%r&&e.buffer.set(n),e}};var La=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ot=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),it=new Uint32Array(64),Yn=class extends Ar{constructor(){super(64,32,8,!1),this.A=ot[0]|0,this.B=ot[1]|0,this.C=ot[2]|0,this.D=ot[3]|0,this.E=ot[4]|0,this.F=ot[5]|0,this.G=ot[6]|0,this.H=ot[7]|0}get(){let{A:e,B:r,C:n,D:o,E:i,F:s,G:a,H:c}=this;return[e,r,n,o,i,s,a,c]}set(e,r,n,o,i,s,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=a|0,this.H=c|0}process(e,r){for(let u=0;u<16;u++,r+=4)it[u]=e.getUint32(r,!1);for(let u=16;u<64;u++){let l=it[u-15],p=it[u-2],h=be(l,7)^be(l,18)^l>>>3,y=be(p,17)^be(p,19)^p>>>10;it[u]=y+it[u-7]+h+it[u-16]|0}let{A:n,B:o,C:i,D:s,E:a,F:c,G:d,H:m}=this;for(let u=0;u<64;u++){let l=be(a,6)^be(a,11)^be(a,25),p=m+l+Fi(a,c,d)+La[u]+it[u]|0,y=(be(n,2)^be(n,13)^be(n,22))+Ki(n,o,i)|0;m=d,d=c,c=a,a=s+p|0,s=i,i=o,o=n,n=p+y|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,d=d+this.G|0,m=m+this.H|0,this.set(n,o,i,s,a,c,d,m)}roundClean(){it.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var qi=_i(()=>new Yn);var Br=class extends Mt{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Ri(e);let n=er(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?e.create().update(n).digest():n);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=e.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(e){return _t(this),this.iHash.update(e),this}digestInto(e){_t(this),Dt(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:o,destroyed:i,blockLen:s,outputLen:a}=this;return e=e,e.finished=o,e.destroyed=i,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Xn=(t,e,r)=>new Br(t,e).update(r).digest();Xn.create=(t,e)=>new Br(t,e);var ro={};re(ro,{aInRange:()=>at,abool:()=>xt,abytes:()=>Ft,bitGet:()=>Ra,bitLen:()=>eo,bitMask:()=>rr,bitSet:()=>ka,bytesToHex:()=>Et,bytesToNumberBE:()=>Ye,bytesToNumberLE:()=>Lr,concatBytes:()=>Kt,createHmacDrbg:()=>to,ensureBytes:()=>ue,equalBytes:()=>Ca,hexToBytes:()=>It,hexToNumber:()=>Jn,inRange:()=>tr,isBytes:()=>st,memoized:()=>Nr,notImplemented:()=>_a,numberToBytesBE:()=>ct,numberToBytesLE:()=>Tr,numberToHexUnpadded:()=>bt,numberToVarBytesBE:()=>Oa,utf8ToBytes:()=>Pa,validateObject:()=>dt});var Qn=BigInt(0),Ur=BigInt(1),Ta=BigInt(2);function st(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Ft(t){if(!st(t))throw new Error("Uint8Array expected")}function xt(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}var Na=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Et(t){Ft(t);let e="";for(let r=0;r<t.length;r++)e+=Na[t[r]];return e}function bt(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function Jn(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}var Ge={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function $i(t){if(t>=Ge._0&&t<=Ge._9)return t-Ge._0;if(t>=Ge._A&&t<=Ge._F)return t-(Ge._A-10);if(t>=Ge._a&&t<=Ge._f)return t-(Ge._a-10)}function It(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let o=0,i=0;o<r;o++,i+=2){let s=$i(t.charCodeAt(i)),a=$i(t.charCodeAt(i+1));if(s===void 0||a===void 0){let c=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[o]=s*16+a}return n}function Ye(t){return Jn(Et(t))}function Lr(t){return Ft(t),Jn(Et(Uint8Array.from(t).reverse()))}function ct(t,e){return It(t.toString(16).padStart(e*2,"0"))}function Tr(t,e){return ct(t,e).reverse()}function Oa(t){return It(bt(t))}function ue(t,e,r){let n;if(typeof e=="string")try{n=It(e)}catch(i){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${i}`)}else if(st(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);let o=n.length;if(typeof r=="number"&&o!==r)throw new Error(`${t} expected ${r} bytes, got ${o}`);return n}function Kt(...t){let e=0;for(let n=0;n<t.length;n++){let o=t[n];Ft(o),e+=o.length}let r=new Uint8Array(e);for(let n=0,o=0;n<t.length;n++){let i=t[n];r.set(i,o),o+=i.length}return r}function Ca(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function Pa(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}var Zn=t=>typeof t=="bigint"&&Qn<=t;function tr(t,e,r){return Zn(t)&&Zn(e)&&Zn(r)&&e<=t&&t<r}function at(t,e,r,n){if(!tr(e,r,n))throw new Error(`expected valid ${t}: ${r} <= n < ${n}, got ${typeof e} ${e}`)}function eo(t){let e;for(e=0;t>Qn;t>>=Ur,e+=1);return e}function Ra(t,e){return t>>BigInt(e)&Ur}function ka(t,e,r){return t|(r?Ur:Qn)<<BigInt(e)}var rr=t=>(Ta<<BigInt(t-1))-Ur,Wn=t=>new Uint8Array(t),zi=t=>Uint8Array.from(t);function to(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Wn(t),o=Wn(t),i=0,s=()=>{n.fill(1),o.fill(0),i=0},a=(...u)=>r(o,n,...u),c=(u=Wn())=>{o=a(zi([0]),u),n=a(),u.length!==0&&(o=a(zi([1]),u),n=a())},d=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let u=0,l=[];for(;u<e;){n=a();let p=n.slice();l.push(p),u+=n.length}return Kt(...l)};return(u,l)=>{s(),c(u);let p;for(;!(p=l(d()));)c();return s(),p}}var Da={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||st(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function dt(t,e,r={}){let n=(o,i,s)=>{let a=Da[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);let c=t[o];if(!(s&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(o)}=${c} (${typeof c}), expected ${i}`)};for(let[o,i]of Object.entries(e))n(o,i,!1);for(let[o,i]of Object.entries(r))n(o,i,!0);return t}var _a=()=>{throw new Error("not implemented")};function Nr(t){let e=new WeakMap;return(r,...n)=>{let o=e.get(r);if(o!==void 0)return o;let i=t(r,...n);return e.set(r,i),i}}var z=BigInt(0),q=BigInt(1),vt=BigInt(2),Ma=BigInt(3),no=BigInt(4),Vi=BigInt(5),Hi=BigInt(8),Fa=BigInt(9),Ka=BigInt(16);function Z(t,e){let r=t%e;return r>=z?r:e+r}function qa(t,e,r){if(r<=z||e<z)throw new Error("Expected power/modulo > 0");if(r===q)return z;let n=q;for(;e>z;)e&q&&(n=n*t%r),t=t*t%r,e>>=q;return n}function le(t,e,r){let n=t;for(;e-- >z;)n*=n,n%=r;return n}function Or(t,e){if(t===z||e<=z)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=Z(t,e),n=e,o=z,i=q,s=q,a=z;for(;r!==z;){let d=n/r,m=n%r,u=o-s*d,l=i-a*d;n=r,r=m,o=s,i=a,s=u,a=l}if(n!==q)throw new Error("invert: does not exist");return Z(o,e)}function $a(t){let e=(t-q)/vt,r,n,o;for(r=t-q,n=0;r%vt===z;r/=vt,n++);for(o=vt;o<t&&qa(o,e,t)!==t-q;o++);if(n===1){let s=(t+q)/no;return function(c,d){let m=c.pow(d,s);if(!c.eql(c.sqr(m),d))throw new Error("Cannot find square root");return m}}let i=(r+q)/vt;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let d=n,m=a.pow(a.mul(a.ONE,o),r),u=a.pow(c,i),l=a.pow(c,r);for(;!a.eql(l,a.ONE);){if(a.eql(l,a.ZERO))return a.ZERO;let p=1;for(let y=a.sqr(l);p<d&&!a.eql(y,a.ONE);p++)y=a.sqr(y);let h=a.pow(m,q<<BigInt(d-p-1));m=a.sqr(h),u=a.mul(u,h),l=a.mul(l,m),d=p}return u}}function za(t){if(t%no===Ma){let e=(t+q)/no;return function(n,o){let i=n.pow(o,e);if(!n.eql(n.sqr(i),o))throw new Error("Cannot find square root");return i}}if(t%Hi===Vi){let e=(t-Vi)/Hi;return function(n,o){let i=n.mul(o,vt),s=n.pow(i,e),a=n.mul(o,s),c=n.mul(n.mul(a,vt),s),d=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(d),o))throw new Error("Cannot find square root");return d}}return t%Ka,$a(t)}var Va=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function oo(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Va.reduce((n,o)=>(n[o]="function",n),e);return dt(t,r)}function Ha(t,e,r){if(r<z)throw new Error("Expected power > 0");if(r===z)return t.ONE;if(r===q)return e;let n=t.ONE,o=e;for(;r>z;)r&q&&(n=t.mul(n,o)),o=t.sqr(o),r>>=q;return n}function ja(t,e){let r=new Array(e.length),n=e.reduce((i,s,a)=>t.is0(s)?i:(r[a]=i,t.mul(i,s)),t.ONE),o=t.inv(n);return e.reduceRight((i,s,a)=>t.is0(s)?i:(r[a]=t.mul(i,r[a]),t.mul(i,s)),o),r}function io(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Cr(t,e,r=!1,n={}){if(t<=z)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:o,nByteLength:i}=io(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=za(t),a=Object.freeze({ORDER:t,BITS:o,BYTES:i,MASK:rr(o),ZERO:z,ONE:q,create:c=>Z(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return z<=c&&c<t},is0:c=>c===z,isOdd:c=>(c&q)===q,neg:c=>Z(-c,t),eql:(c,d)=>c===d,sqr:c=>Z(c*c,t),add:(c,d)=>Z(c+d,t),sub:(c,d)=>Z(c-d,t),mul:(c,d)=>Z(c*d,t),pow:(c,d)=>Ha(a,c,d),div:(c,d)=>Z(c*Or(d,t),t),sqrN:c=>c*c,addN:(c,d)=>c+d,subN:(c,d)=>c-d,mulN:(c,d)=>c*d,inv:c=>Or(c,t),sqrt:n.sqrt||(c=>s(a,c)),invertBatch:c=>ja(a,c),cmov:(c,d,m)=>m?d:c,toBytes:c=>r?Tr(c,i):ct(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return r?Lr(c):Ye(c)}});return Object.freeze(a)}function ji(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function so(t){let e=ji(t);return e+Math.ceil(e/2)}function Gi(t,e,r=!1){let n=t.length,o=ji(e),i=so(e);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);let s=r?Ye(t):Lr(t),a=Z(s,e-q)+q;return r?Tr(a,o):ct(a,o)}var Ya=BigInt(0),co=BigInt(1),ao=new WeakMap,Yi=new WeakMap;function Xi(t,e){let r=(i,s)=>{let a=s.negate();return i?a:s},n=i=>{if(!Number.isSafeInteger(i)||i<=0||i>e)throw new Error(`Wrong window size=${i}, should be [1..${e}]`)},o=i=>{n(i);let s=Math.ceil(e/i)+1,a=2**(i-1);return{windows:s,windowSize:a}};return{constTimeNegate:r,unsafeLadder(i,s){let a=t.ZERO,c=i;for(;s>Ya;)s&co&&(a=a.add(c)),c=c.double(),s>>=co;return a},precomputeWindow(i,s){let{windows:a,windowSize:c}=o(s),d=[],m=i,u=m;for(let l=0;l<a;l++){u=m,d.push(u);for(let p=1;p<c;p++)u=u.add(m),d.push(u);m=u.double()}return d},wNAF(i,s,a){let{windows:c,windowSize:d}=o(i),m=t.ZERO,u=t.BASE,l=BigInt(2**i-1),p=2**i,h=BigInt(i);for(let y=0;y<c;y++){let g=y*d,f=Number(a&l);a>>=h,f>d&&(f-=p,a+=co);let x=g,b=g+Math.abs(f)-1,I=y%2!==0,N=f<0;f===0?u=u.add(r(I,s[x])):m=m.add(r(N,s[b]))}return{p:m,f:u}},wNAFCached(i,s,a){let c=Yi.get(i)||1,d=ao.get(i);return d||(d=this.precomputeWindow(i,c),c!==1&&ao.set(i,a(d))),this.wNAF(c,d,s)},setWindowSize(i,s){n(s),Yi.set(i,s),ao.delete(i)}}}function Zi(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((m,u)=>{if(!e.isValid(m))throw new Error(`wrong scalar at index ${u}`)}),r.forEach((m,u)=>{if(!(m instanceof t))throw new Error(`wrong point at index ${u}`)});let o=eo(BigInt(r.length)),i=o>12?o-3:o>4?o-2:o?2:1,s=(1<<i)-1,a=new Array(s+1).fill(t.ZERO),c=Math.floor((e.BITS-1)/i)*i,d=t.ZERO;for(let m=c;m>=0;m-=i){a.fill(t.ZERO);for(let l=0;l<n.length;l++){let p=n[l],h=Number(p>>BigInt(m)&BigInt(s));a[h]=a[h].add(r[l])}let u=t.ZERO;for(let l=a.length-1,p=t.ZERO;l>0;l--)p=p.add(a[l]),u=u.add(p);if(d=d.add(u),m!==0)for(let l=0;l<i;l++)d=d.double()}return d}function uo(t){return oo(t.Fp),dt(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...io(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function Wi(t){t.lowS!==void 0&&xt("lowS",t.lowS),t.prehash!==void 0&&xt("prehash",t.prehash)}function Xa(t){let e=uo(t);dt(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:o}=e;if(r){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:Za,hexToBytes:Wa}=ro,Xe={Err:class extends Error{constructor(e=""){super(e)}},_tlv:{encode:(t,e)=>{let{Err:r}=Xe;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");let n=e.length/2,o=bt(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");let i=n>127?bt(o.length/2|128):"";return`${bt(t)}${i}${o}${e}`},decode(t,e){let{Err:r}=Xe,n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");let o=e[n++],i=!!(o&128),s=0;if(!i)s=o;else{let c=o&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");let d=e.subarray(n,n+c);if(d.length!==c)throw new r("tlv.decode: length bytes not complete");if(d[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let m of d)s=s<<8|m;if(n+=c,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=e.subarray(n,n+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+s)}}},_int:{encode(t){let{Err:e}=Xe;if(t<Ze)throw new e("integer: negative integers are not allowed");let r=bt(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected assertion");return r},decode(t){let{Err:e}=Xe;if(t[0]&128)throw new e("Invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return Za(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=Xe,o=typeof t=="string"?Wa(t):t;Ft(o);let{v:i,l:s}=n.decode(48,o);if(s.length)throw new e("Invalid signature: left bytes after parsing");let{v:a,l:c}=n.decode(2,i),{v:d,l:m}=n.decode(2,c);if(m.length)throw new e("Invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(d)}},hexFromSig(t){let{_tlv:e,_int:r}=Xe,n=`${e.encode(2,r.encode(t.r))}${e.encode(2,r.encode(t.s))}`;return e.encode(48,n)}},Ze=BigInt(0),j=BigInt(1),jh=BigInt(2),Qi=BigInt(3),Gh=BigInt(4);function Qa(t){let e=Xa(t),{Fp:r}=e,n=Cr(e.n,e.nBitLength),o=e.toBytes||((y,g,f)=>{let x=g.toAffine();return Kt(Uint8Array.from([4]),r.toBytes(x.x),r.toBytes(x.y))}),i=e.fromBytes||(y=>{let g=y.subarray(1),f=r.fromBytes(g.subarray(0,r.BYTES)),x=r.fromBytes(g.subarray(r.BYTES,2*r.BYTES));return{x:f,y:x}});function s(y){let{a:g,b:f}=e,x=r.sqr(y),b=r.mul(x,y);return r.add(r.add(b,r.mul(y,g)),f)}if(!r.eql(r.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function a(y){return tr(y,j,e.n)}function c(y){let{allowedPrivateKeyLengths:g,nByteLength:f,wrapPrivateKey:x,n:b}=e;if(g&&typeof y!="bigint"){if(st(y)&&(y=Et(y)),typeof y!="string"||!g.includes(y.length))throw new Error("Invalid key");y=y.padStart(f*2,"0")}let I;try{I=typeof y=="bigint"?y:Ye(ue("private key",y,f))}catch{throw new Error(`private key must be ${f} bytes, hex or bigint, not ${typeof y}`)}return x&&(I=Z(I,b)),at("private key",I,j,b),I}function d(y){if(!(y instanceof l))throw new Error("ProjectivePoint expected")}let m=Nr((y,g)=>{let{px:f,py:x,pz:b}=y;if(r.eql(b,r.ONE))return{x:f,y:x};let I=y.is0();g==null&&(g=I?r.ONE:r.inv(b));let N=r.mul(f,g),v=r.mul(x,g),S=r.mul(b,g);if(I)return{x:r.ZERO,y:r.ZERO};if(!r.eql(S,r.ONE))throw new Error("invZ was invalid");return{x:N,y:v}}),u=Nr(y=>{if(y.is0()){if(e.allowInfinityPoint&&!r.is0(y.py))return;throw new Error("bad point: ZERO")}let{x:g,y:f}=y.toAffine();if(!r.isValid(g)||!r.isValid(f))throw new Error("bad point: x or y not FE");let x=r.sqr(f),b=s(g);if(!r.eql(x,b))throw new Error("bad point: equation left != right");if(!y.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class l{constructor(g,f,x){if(this.px=g,this.py=f,this.pz=x,g==null||!r.isValid(g))throw new Error("x required");if(f==null||!r.isValid(f))throw new Error("y required");if(x==null||!r.isValid(x))throw new Error("z required");Object.freeze(this)}static fromAffine(g){let{x:f,y:x}=g||{};if(!g||!r.isValid(f)||!r.isValid(x))throw new Error("invalid affine point");if(g instanceof l)throw new Error("projective point not allowed");let b=I=>r.eql(I,r.ZERO);return b(f)&&b(x)?l.ZERO:new l(f,x,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(g){let f=r.invertBatch(g.map(x=>x.pz));return g.map((x,b)=>x.toAffine(f[b])).map(l.fromAffine)}static fromHex(g){let f=l.fromAffine(i(ue("pointHex",g)));return f.assertValidity(),f}static fromPrivateKey(g){return l.BASE.multiply(c(g))}static msm(g,f){return Zi(l,n,g,f)}_setWindowSize(g){h.setWindowSize(this,g)}assertValidity(){u(this)}hasEvenY(){let{y:g}=this.toAffine();if(r.isOdd)return!r.isOdd(g);throw new Error("Field doesn't support isOdd")}equals(g){d(g);let{px:f,py:x,pz:b}=this,{px:I,py:N,pz:v}=g,S=r.eql(r.mul(f,v),r.mul(I,b)),T=r.eql(r.mul(x,v),r.mul(N,b));return S&&T}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){let{a:g,b:f}=e,x=r.mul(f,Qi),{px:b,py:I,pz:N}=this,v=r.ZERO,S=r.ZERO,T=r.ZERO,O=r.mul(b,b),he=r.mul(I,I),M=r.mul(N,N),D=r.mul(b,I);return D=r.add(D,D),T=r.mul(b,N),T=r.add(T,T),v=r.mul(g,T),S=r.mul(x,M),S=r.add(v,S),v=r.sub(he,S),S=r.add(he,S),S=r.mul(v,S),v=r.mul(D,v),T=r.mul(x,T),M=r.mul(g,M),D=r.sub(O,M),D=r.mul(g,D),D=r.add(D,T),T=r.add(O,O),O=r.add(T,O),O=r.add(O,M),O=r.mul(O,D),S=r.add(S,O),M=r.mul(I,N),M=r.add(M,M),O=r.mul(M,D),v=r.sub(v,O),T=r.mul(M,he),T=r.add(T,T),T=r.add(T,T),new l(v,S,T)}add(g){d(g);let{px:f,py:x,pz:b}=this,{px:I,py:N,pz:v}=g,S=r.ZERO,T=r.ZERO,O=r.ZERO,he=e.a,M=r.mul(e.b,Qi),D=r.mul(f,I),ie=r.mul(x,N),E=r.mul(b,v),A=r.add(f,x),L=r.add(I,N);A=r.mul(A,L),L=r.add(D,ie),A=r.sub(A,L),L=r.add(f,b);let P=r.add(I,v);return L=r.mul(L,P),P=r.add(D,E),L=r.sub(L,P),P=r.add(x,b),S=r.add(N,v),P=r.mul(P,S),S=r.add(ie,E),P=r.sub(P,S),O=r.mul(he,L),S=r.mul(M,E),O=r.add(S,O),S=r.sub(ie,O),O=r.add(ie,O),T=r.mul(S,O),ie=r.add(D,D),ie=r.add(ie,D),E=r.mul(he,E),L=r.mul(M,L),ie=r.add(ie,E),E=r.sub(D,E),E=r.mul(he,E),L=r.add(L,E),D=r.mul(ie,L),T=r.add(T,D),D=r.mul(P,L),S=r.mul(A,S),S=r.sub(S,D),D=r.mul(A,ie),O=r.mul(P,O),O=r.add(O,D),new l(S,T,O)}subtract(g){return this.add(g.negate())}is0(){return this.equals(l.ZERO)}wNAF(g){return h.wNAFCached(this,g,l.normalizeZ)}multiplyUnsafe(g){at("scalar",g,Ze,e.n);let f=l.ZERO;if(g===Ze)return f;if(g===j)return this;let{endo:x}=e;if(!x)return h.unsafeLadder(this,g);let{k1neg:b,k1:I,k2neg:N,k2:v}=x.splitScalar(g),S=f,T=f,O=this;for(;I>Ze||v>Ze;)I&j&&(S=S.add(O)),v&j&&(T=T.add(O)),O=O.double(),I>>=j,v>>=j;return b&&(S=S.negate()),N&&(T=T.negate()),T=new l(r.mul(T.px,x.beta),T.py,T.pz),S.add(T)}multiply(g){let{endo:f,n:x}=e;at("scalar",g,j,x);let b,I;if(f){let{k1neg:N,k1:v,k2neg:S,k2:T}=f.splitScalar(g),{p:O,f:he}=this.wNAF(v),{p:M,f:D}=this.wNAF(T);O=h.constTimeNegate(N,O),M=h.constTimeNegate(S,M),M=new l(r.mul(M.px,f.beta),M.py,M.pz),b=O.add(M),I=he.add(D)}else{let{p:N,f:v}=this.wNAF(g);b=N,I=v}return l.normalizeZ([b,I])[0]}multiplyAndAddUnsafe(g,f,x){let b=l.BASE,I=(v,S)=>S===Ze||S===j||!v.equals(b)?v.multiplyUnsafe(S):v.multiply(S),N=I(this,f).add(I(g,x));return N.is0()?void 0:N}toAffine(g){return m(this,g)}isTorsionFree(){let{h:g,isTorsionFree:f}=e;if(g===j)return!0;if(f)return f(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:g,clearCofactor:f}=e;return g===j?this:f?f(l,this):this.multiplyUnsafe(e.h)}toRawBytes(g=!0){return xt("isCompressed",g),this.assertValidity(),o(l,this,g)}toHex(g=!0){return xt("isCompressed",g),Et(this.toRawBytes(g))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);let p=e.nBitLength,h=Xi(l,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:a}}function Ja(t){let e=uo(t);return dt(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Ji(t){let e=Ja(t),{Fp:r,n}=e,o=r.BYTES+1,i=2*r.BYTES+1;function s(E){return Z(E,n)}function a(E){return Or(E,n)}let{ProjectivePoint:c,normPrivateKeyToScalar:d,weierstrassEquation:m,isWithinCurveOrder:u}=Qa({...e,toBytes(E,A,L){let P=A.toAffine(),_=r.toBytes(P.x),V=Kt;return xt("isCompressed",L),L?V(Uint8Array.from([A.hasEvenY()?2:3]),_):V(Uint8Array.from([4]),_,r.toBytes(P.y))},fromBytes(E){let A=E.length,L=E[0],P=E.subarray(1);if(A===o&&(L===2||L===3)){let _=Ye(P);if(!tr(_,j,r.ORDER))throw new Error("Point is not on curve");let V=m(_),J;try{J=r.sqrt(V)}catch(ye){let Qe=ye instanceof Error?": "+ye.message:"";throw new Error("Point is not on curve"+Qe)}let ee=(J&j)===j;return(L&1)===1!==ee&&(J=r.neg(J)),{x:_,y:J}}else if(A===i&&L===4){let _=r.fromBytes(P.subarray(0,r.BYTES)),V=r.fromBytes(P.subarray(r.BYTES,2*r.BYTES));return{x:_,y:V}}else throw new Error(`Point of length ${A} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}}),l=E=>Et(ct(E,e.nByteLength));function p(E){let A=n>>j;return E>A}function h(E){return p(E)?s(-E):E}let y=(E,A,L)=>Ye(E.slice(A,L));class g{constructor(A,L,P){this.r=A,this.s=L,this.recovery=P,this.assertValidity()}static fromCompact(A){let L=e.nByteLength;return A=ue("compactSignature",A,L*2),new g(y(A,0,L),y(A,L,2*L))}static fromDER(A){let{r:L,s:P}=Xe.toSig(ue("DER",A));return new g(L,P)}assertValidity(){at("r",this.r,j,n),at("s",this.s,j,n)}addRecoveryBit(A){return new g(this.r,this.s,A)}recoverPublicKey(A){let{r:L,s:P,recovery:_}=this,V=v(ue("msgHash",A));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");let J=_===2||_===3?L+e.n:L;if(J>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let ee=_&1?"03":"02",We=c.fromHex(ee+l(J)),ye=a(J),Qe=s(-V*ye),zt=s(P*ye),Je=c.BASE.multiplyAndAddUnsafe(We,Qe,zt);if(!Je)throw new Error("point at infinify");return Je.assertValidity(),Je}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return It(this.toDERHex())}toDERHex(){return Xe.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return It(this.toCompactHex())}toCompactHex(){return l(this.r)+l(this.s)}}let f={isValidPrivateKey(E){try{return d(E),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{let E=so(e.n);return Gi(e.randomBytes(E),e.n)},precompute(E=8,A=c.BASE){return A._setWindowSize(E),A.multiply(BigInt(3)),A}};function x(E,A=!0){return c.fromPrivateKey(E).toRawBytes(A)}function b(E){let A=st(E),L=typeof E=="string",P=(A||L)&&E.length;return A?P===o||P===i:L?P===2*o||P===2*i:E instanceof c}function I(E,A,L=!0){if(b(E))throw new Error("first arg must be private key");if(!b(A))throw new Error("second arg must be public key");return c.fromHex(A).multiply(d(E)).toRawBytes(L)}let N=e.bits2int||function(E){let A=Ye(E),L=E.length*8-e.nBitLength;return L>0?A>>BigInt(L):A},v=e.bits2int_modN||function(E){return s(N(E))},S=rr(e.nBitLength);function T(E){return at(`num < 2^${e.nBitLength}`,E,Ze,S),ct(E,e.nByteLength)}function O(E,A,L=he){if(["recovered","canonical"].some(ut=>ut in L))throw new Error("sign() legacy options not supported");let{hash:P,randomBytes:_}=e,{lowS:V,prehash:J,extraEntropy:ee}=L;V==null&&(V=!0),E=ue("msgHash",E),Wi(L),J&&(E=ue("prehashed msgHash",P(E)));let We=v(E),ye=d(A),Qe=[T(ye),T(We)];if(ee!=null&&ee!==!1){let ut=ee===!0?_(r.BYTES):ee;Qe.push(ue("extraEntropy",ut))}let zt=Kt(...Qe),Je=We;function zr(ut){let St=N(ut);if(!u(St))return;let Uo=a(St),Ie=c.BASE.multiply(St).toAffine(),At=s(Ie.x);if(At===Ze)return;let sr=s(Uo*s(Je+At*ye));if(sr===Ze)return;let Lo=(Ie.x===At?0:2)|Number(Ie.y&j),To=sr;return V&&p(sr)&&(To=h(sr),Lo^=1),new g(At,To,Lo)}return{seed:zt,k2sig:zr}}let he={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};function D(E,A,L=he){let{seed:P,k2sig:_}=O(E,A,L),V=e;return to(V.hash.outputLen,V.nByteLength,V.hmac)(P,_)}c.BASE._setWindowSize(8);function ie(E,A,L,P=M){let _=E;if(A=ue("msgHash",A),L=ue("publicKey",L),"strict"in P)throw new Error("options.strict was renamed to lowS");Wi(P);let{lowS:V,prehash:J}=P,ee,We;try{if(typeof _=="string"||st(_))try{ee=g.fromDER(_)}catch(Ie){if(!(Ie instanceof Xe.Err))throw Ie;ee=g.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){let{r:Ie,s:At}=_;ee=new g(Ie,At)}else throw new Error("PARSE");We=c.fromHex(L)}catch(Ie){if(Ie.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(V&&ee.hasHighS())return!1;J&&(A=e.hash(A));let{r:ye,s:Qe}=ee,zt=v(A),Je=a(Qe),zr=s(zt*Je),ut=s(ye*Je),St=c.BASE.multiplyAndAddUnsafe(We,zr,ut)?.toAffine();return St?s(St.x)===ye:!1}return{CURVE:e,getPublicKey:x,getSharedSecret:I,sign:D,verify:ie,ProjectivePoint:c,Signature:g,utils:f}}function ed(t){return{hash:t,hmac:(e,...r)=>Xn(t,e,Di(...r)),randomBytes:Mi}}function es(t,e){let r=n=>Ji({...t,...ed(n)});return Object.freeze({...r(e),create:r})}var ns=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ts=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),td=BigInt(1),lo=BigInt(2),rs=(t,e)=>(t+e/lo)/e;function rd(t){let e=ns,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),d=t*t*t%e,m=d*d*t%e,u=le(m,r,e)*m%e,l=le(u,r,e)*m%e,p=le(l,lo,e)*d%e,h=le(p,o,e)*p%e,y=le(h,i,e)*h%e,g=le(y,a,e)*y%e,f=le(g,c,e)*g%e,x=le(f,a,e)*y%e,b=le(x,r,e)*m%e,I=le(b,s,e)*h%e,N=le(I,n,e)*d%e,v=le(N,lo,e);if(!ho.eql(ho.sqr(v),t))throw new Error("Cannot find square root");return v}var ho=Cr(ns,void 0,void 0,{sqrt:rd}),qt=es({a:BigInt(0),b:BigInt(7),Fp:ho,n:ts,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=ts,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-td*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),a=rs(i*t,e),c=rs(-n*t,e),d=Z(t-a*r-c*o,e),m=Z(-a*n-c*i,e),u=d>s,l=m>s;if(u&&(d=e-d),l&&(m=e-m),d>s||m>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:u,k1:d,k2neg:l,k2:m}}}},qi),rp=BigInt(0);var np=qt.ProjectivePoint;var os=Bt(te("node:crypto"),1);var Pr=class extends Error{constructor(e="An error occurred while verifying a message"){super(e),this.name="VerificationError"}};function is(t,e,r){let n=os.default.createHash("sha256");if(r instanceof Uint8Array)n.update(r);else for(let i of r)n.update(i);let o=n.digest();try{return qt.verify(e,o,t)}catch(i){throw new Pr(String(i))}}var Rr=class{type="secp256k1";raw;_key;constructor(e){this._key=cs(e),this.raw=ss(this._key)}toMultihash(){return ze.digest(fr(this))}toCID(){return Q.createV1(114,this.toMultihash())}toString(){return K.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Ve(this.raw,e.raw)}verify(e,r){return is(this._key,r,e)}};function as(t){return new Rr(t)}function ss(t){return qt.ProjectivePoint.fromHex(t).toRawBytes(!0)}function cs(t){try{return qt.ProjectivePoint.fromHex(t),t}catch(e){throw new ar(String(e))}}function ds(t){let{Type:e,Data:r}=Jt.decode(t.digest),n=r??new Uint8Array;switch(e){case ge.Ed25519:return vi(n);case ge.secp256k1:return as(n);default:throw new Vt}}function fr(t){return Jt.encode({Type:ge[t.type],Data:t.raw})}var us=Symbol.for("nodejs.util.inspect.custom"),nd=114,nr=class{type;multihash;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[Vr]=!0;toString(){return this.string==null&&(this.string=K.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return Q.createV1(nd,this.multihash)}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return Ve(this.multihash.bytes,e);if(typeof e=="string")return this.toString()===e;if(e?.toMultihash()?.bytes!=null)return Ve(this.multihash.bytes,e.toMultihash().bytes);throw new Error("not valid Id")}[us](){return`PeerId(${this.toString()})`}},kr=class extends nr{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Dr=class extends nr{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.publicKey}},_r=class extends nr{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.publicKey}},od=2336,Mr=class{type="url";multihash;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=ze.digest(rt(this.url))}[us](){return`PeerId(${this.url})`}[Vr]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return Q.createV1(od,this.toMultihash())}toJSON(){return this.toString()}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=$(e)),e.toString()===this.toString())}};function ls(t,e){let r;if(t.charAt(0)==="1"||t.charAt(0)==="Q")r=pt(K.decode(`z${t}`));else{if(e==null)throw new Ut('Please pass a multibase decoder for strings that do not start with "1" or "Q"');r=pt(e.decode(t))}return id(r)}function id(t){if(cd(t))return new kr({multihash:t});if(sd(t))try{let e=ds(t);if(e.type==="Ed25519")return new Dr({multihash:t,publicKey:e});if(e.type==="secp256k1")return new _r({multihash:t,publicKey:e})}catch{let r=$(t.digest);return new Mr(new URL(r))}throw new dr("Supplied PeerID Multihash is invalid")}function sd(t){return t.code===ze.code}function cd(t){return t.code===Sn.code}var me=te("node:net");function Fr(t){return!!(0,me.isIP)(t)}var ps=Bt(hs(),1),ad=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],dd=ad.map(t=>new ps.Netmask(t));function po(t){for(let e of dd)if(e.contains(t))return!0;return!1}function ud(t){return/^::ffff:([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})$/.test(t)}function ld(t){let e=t.split(":");if(e.length<2)return!1;let r=e[e.length-1].padStart(4,"0"),n=e[e.length-2].padStart(4,"0"),o=`${parseInt(n.substring(0,2),16)}.${parseInt(n.substring(2),16)}.${parseInt(r.substring(0,2),16)}.${parseInt(r.substring(2),16)}`;return po(o)}function hd(t){return/^::ffff:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)}function pd(t){let e=t.split(":"),r=e[e.length-1];return po(r)}function gd(t){return/^::$/.test(t)||/^::1$/.test(t)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(t)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(t)||/^ff([0-9a-fA-F]{2,2}):/i.test(t)}function gs(t){return(0,me.isIPv4)(t)?po(t):ud(t)?ld(t):hd(t)?pd(t):(0,me.isIPv6)(t)?gd(t):void 0}function ms(t){try{let{address:e}=t.nodeAddress();return!!gs(e)}catch{return!0}}var Kr=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,o){return this.readAtomically(()=>{let i=0,s=0,a=this.peekChar();if(a===void 0)return;let c=a==="0",d=2**(8*o)-1;for(;;){let m=this.readAtomically(()=>{let u=this.readChar();if(u===void 0)return;let l=Number.parseInt(u,e);if(!Number.isNaN(l))return l});if(m===void 0)break;if(i*=e,i+=m,i>d||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&c&&s>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let o=n*2;if(n<r.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return r[o]=s[0],r[o+1]=s[1],r[o+2]=s[2],r[o+3]=s[3],[o+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];r[o]=i>>8,r[o+1]=i&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,o]=e(r);if(n===16)return r;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),s=16-(n+2),[a]=e(i.subarray(0,s));return r.set(i.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var a0=new Kr;var y0=parseInt("0xFFFF",16),f0=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var ws=me.isIPv4,Ed=me.isIPv6,go=function(t){let e=0;if(t=t.toString().trim(),ws(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(Ed(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let i=ws(r[n]),s;i&&(s=go(r[n]),r[n]=$(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,$(s.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let i=[n,1];for(n=9-r.length;n>0;n--)i.push("0");r.splice.apply(r,i)}let o=new Uint8Array(e+16);for(n=0;n<r.length;n++){let i=parseInt(r[n],16);o[e++]=i>>8&255,o[e++]=i&255}return o}throw new Error("invalid ip address")},xs=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let o=[];for(let i=0;i<r;i++)o.push(t[e+i]);return o.join(".")}if(r===16){let o=[];for(let i=0;i<r;i+=2)o.push(n.getUint16(e+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var $t={},mo={},Id=[[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"],[481,-1,"http-path"],[777,-1,"memory"]];Id.forEach(t=>{let e=vd(...t);mo[e.code]=e,$t[e.name]=e});function vd(t,e,r,n,o){return{code:t,size:e,name:r,resolvable:!!n,path:!!o}}function k(t){if(typeof t=="number"){if(mo[t]!=null)return mo[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if($t[t]!=null)return $t[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var eg=k("ip4"),tg=k("ip6"),rg=k("ipcidr");function xo(t,e){switch(k(t).code){case 4:case 41:return Ad(e);case 42:return wo(e);case 6:case 273:case 33:case 132:return Is(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return wo(e);case 421:return Td(e);case 444:return bs(e);case 445:return bs(e);case 466:return Ld(e);case 481:return globalThis.encodeURIComponent(wo(e));default:return $(e,"base16")}}function Eo(t,e){switch(k(t).code){case 4:return Es(e);case 41:return Es(e);case 42:return fo(e);case 6:case 273:case 33:case 132:return bo(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return fo(e);case 421:return Bd(e);case 444:return Nd(e);case 445:return Od(e);case 466:return Ud(e);case 481:return fo(globalThis.decodeURIComponent(e));default:return rt(e,"base16")}}var yo=Object.values(Xt).map(t=>t.decoder),Sd=function(){let t=yo[0].or(yo[1]);return yo.slice(2).forEach(e=>t=t.or(e)),t}();function Es(t){if(!Fr(t))throw new Error("invalid ip address");return go(t)}function Ad(t){let e=xs(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Fr(e))throw new Error("invalid ip address");return e}function bo(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function Is(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function fo(t){let e=rt(t),r=Uint8Array.from(Rt(e.length));return Oe([r,e],r.length+e.length)}function wo(t){let e=mt(t);if(t=t.slice(oe(e)),t.length!==e)throw new Error("inconsistent lengths");return $(t)}function Bd(t){let e;t[0]==="Q"||t[0]==="1"?e=pt(K.decode(`z${t}`)).bytes:e=Q.parse(t).multihash.bytes;let r=Uint8Array.from(Rt(e.length));return Oe([r,e],r.length+e.length)}function Ud(t){let e=Sd.decode(t),r=Uint8Array.from(Rt(e.length));return Oe([r,e],r.length+e.length)}function Ld(t){let e=mt(t),r=t.slice(oe(e));if(r.length!==e)throw new Error("inconsistent lengths");return"u"+$(r,"base64url")}function Td(t){let e=mt(t),r=t.slice(oe(e));if(r.length!==e)throw new Error("inconsistent lengths");return $(r,"base58btc")}function Nd(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=$e.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=bo(n);return Oe([r,o],r.length+o.length)}function Od(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=$e.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=bo(n);return Oe([r,o],r.length+o.length)}function bs(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=$(e,"base32"),o=Is(r);return`${n}:${o}`}function vs(t){t=Io(t);let e=[],r=[],n=null,o=t.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let i=0;i<o.length;i++){let s=o[i],a=k(s);if(a.size===0){e.push([a.code]),r.push([a.code]);continue}if(i++,i>=o.length)throw As("invalid address: "+t);if(a.path===!0){n=Io(o.slice(i).join("/")),e.push([a.code,Eo(a.code,n)]),r.push([a.code,n]);break}let c=Eo(a.code,o[i]);e.push([a.code,c]),r.push([a.code,xo(a.code,c)])}return{string:Ss(r),bytes:So(e),tuples:e,stringTuples:r,path:n}}function vo(t){let e=[],r=[],n=null,o=0;for(;o<t.length;){let i=mt(t,o),s=oe(i),a=k(i),c=Cd(a,t.slice(o+s));if(c===0){e.push([i]),r.push([i]),o+=s;continue}let d=t.slice(o+s,o+s+c);if(o+=c+s,o>t.length)throw As("Invalid address Uint8Array: "+$(t,"base16"));e.push([i,d]);let m=xo(i,d);if(r.push([i,m]),a.path===!0){n=m;break}}return{bytes:Uint8Array.from(t),string:Ss(r),tuples:e,stringTuples:r,path:n}}function Ss(t){let e=[];return t.map(r=>{let n=k(r[0]);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),Io(e.join("/"))}function So(t){return Oe(t.map(e=>{let r=k(e[0]),n=Uint8Array.from(Rt(r.code));return e.length>1&&e[1]!=null&&(n=Oe([n,e[1]])),n}))}function Cd(t,e){if(t.size>0)return t.size/8;if(t.size===0)return 0;{let r=mt(e instanceof Uint8Array?e:Uint8Array.from(e));return r+oe(r)}}function Io(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function As(t){return new Error("Error parsing address: "+t)}var Pd=Symbol.for("nodejs.util.inspect.custom"),Bo=Symbol.for("@multiformats/js-multiaddr/multiaddr"),Rd=[k("dns").code,k("dns4").code,k("dns6").code,k("dnsaddr").code],Ao=class extends Error{constructor(e="No available resolver"){super(e),this.name="NoAvailableResolverError"}},qr=class t{bytes;#e;#t;#r;#n;[Bo]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=vo(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=vs(e)}else if(Us(e))r=vo(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=r.bytes,this.#e=r.string,this.#t=r.tuples,this.#r=r.stringTuples,this.#n=r.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,r,n,o,i="",s=k("tcp"),a=k("udp"),c=k("ip4"),d=k("ip6"),m=k("dns6"),u=k("ip6zone");for(let[p,h]of this.stringTuples())p===u.code&&(i=`%${h??""}`),Rd.includes(p)&&(r=s.name,o=443,n=`${h??""}${i}`,e=p===m.code?6:4),(p===s.code||p===a.code)&&(r=k(p).name,o=parseInt(h??"")),(p===c.code||p===d.code)&&(r=k(p).name,n=`${h??""}${i}`,e=p===d.code?6:4);if(e==null||r==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:o}}protos(){return this.#t.map(([e])=>Object.assign({},k(e)))}protoCodes(){return this.#t.map(([e])=>e)}protoNames(){return this.#t.map(([e])=>k(e).name)}tuples(){return this.#t}stringTuples(){return this.#r}encapsulate(e){return e=new t(e),new t(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),o=n.lastIndexOf(r);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new t(n.slice(0,o))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new t(So(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,o])=>{n===$t.p2p.code&&e.push([n,o]),n===$t["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?$(K.decode(`z${n}`),"base58btc"):$(Q.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return Ve(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(i=>i.resolvable);if(r==null)return[this];let n=Bs.get(r.name);if(n==null)throw new Ao(`no available resolver for ${r.name}`);return(await n(this,e)).map(i=>ir(i))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let r=(e??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[Pd](){return`Multiaddr(${this.#e})`}};var Bs=new Map;function Us(t){return!!t?.[Bo]}function ir(t){return new qr(t)}function Ls(t,e,r,n){let o=()=>{n?.log.trace("query",e),t.query({questions:[{name:e,type:"PTR"}]})};return o(),setInterval(o,r)}function Ts(t,e,r,n){if(t.answers==null)return;let o,i=[];if(t.answers.forEach(s=>{switch(s.type){case"PTR":o=s;break;case"TXT":i.push(s);break;default:break}}),t.additionals.forEach(s=>{switch(s.type){case"TXT":i.push(s);break;default:break}}),!(o==null||o?.name!==r||i.length===0||o.data.startsWith(e)))try{let s=i.flatMap(c=>c.data).filter(c=>c.toString().startsWith("dnsaddr=")).map(c=>ir(c.toString().substring(8))),a=s[0].getPeerId();if(a==null)throw new Error("Multiaddr doesn't contain PeerId");return n?.log("peer found %p",a),{id:ls(a),multiaddrs:s.map(c=>c.decapsulateCode(k("p2p").code))}}catch(s){n?.log.error("failed to parse mdns response",s)}}function Ns(t,e,r,n,o,i,s){if(!i){s?.log("not responding to mDNS query as broadcast mode is false");return}if(n.length!==0&&t.questions[0]!=null&&t.questions[0].name===o){let a=[];a.push({name:o,type:"PTR",class:"IN",ttl:120,data:r+"."+o}),n.filter(kd).forEach(c=>{let d="dnsaddr="+c.toString();if(d.length>255){s?.log("multiaddr %a is too long to use in mDNS query response",c);return}if(c.getPeerId()==null){s?.log("multiaddr %a did not have a peer ID so cannot be used in mDNS query response",c);return}a.push({name:r+"."+o,type:"TXT",class:"IN",ttl:120,data:d})}),s?.log.trace("responding to query"),e.respond(a)}}function kd(t){return!!ms(t)}function Os(t){let e="",r="abcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*r.length));return e}var $r=class extends ur{mdns;log;broadcast;interval;serviceTag;peerName;port;ip;_queryInterval;components;constructor(e,r={}){if(super(),this.log=e.logger.forComponent("libp2p:mdns"),this.broadcast=r.broadcast!==!1,this.interval=r.interval??1e3*10,this.serviceTag=r.serviceTag??"_p2p._udp.local",this.ip=r.ip??"224.0.0.251",this.peerName=r.peerName??Os(63),this.peerName.length>=64)throw new Error("Peer name should be less than 64 chars long");this.port=r.port??5353,this.components=e,this._queryInterval=null,this._onMdnsQuery=this._onMdnsQuery.bind(this),this._onMdnsResponse=this._onMdnsResponse.bind(this),this._onMdnsWarning=this._onMdnsWarning.bind(this),this._onMdnsError=this._onMdnsError.bind(this)}[Oo]=this;[Symbol.toStringTag]="@libp2p/mdns";[Ro]=["@libp2p/peer-discovery"];isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,Cs.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this.mdns.on("warning",this._onMdnsWarning),this.mdns.on("error",this._onMdnsError),this._queryInterval=Ls(this.mdns,this.serviceTag,this.interval,{log:this.log}))}_onMdnsQuery(e){this.mdns!=null&&(this.log.trace("received incoming mDNS query"),Ns(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast,{log:this.log}))}_onMdnsResponse(e){this.log.trace("received mDNS query response");try{let r=Ts(e,this.peerName,this.serviceTag,{log:this.log});r!=null&&(this.log("discovered peer in mDNS query response %p",r.id),this.dispatchEvent(new CustomEvent("peer",{detail:r})))}catch(r){this.log.error("Error processing peer response",r)}}_onMdnsWarning(e){this.log.error("mdns warning",e)}_onMdnsError(e){this.log.error("mdns error",e)}async stop(){this.mdns!=null&&(this.mdns.removeListener("query",this._onMdnsQuery),this.mdns.removeListener("response",this._onMdnsResponse),this.mdns.removeListener("warning",this._onMdnsWarning),this.mdns.removeListener("error",this._onMdnsError),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 _d(t={}){return e=>new $r(e,t)}return Ms(Md);})();
|
|
3
|
+
/*! Bundled license information:
|
|
4
|
+
|
|
5
|
+
@noble/hashes/esm/utils.js:
|
|
6
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
7
|
+
|
|
8
|
+
@noble/curves/esm/abstract/utils.js:
|
|
9
|
+
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
10
|
+
|
|
11
|
+
@noble/curves/esm/abstract/modular.js:
|
|
12
|
+
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
13
|
+
|
|
14
|
+
@noble/curves/esm/abstract/curve.js:
|
|
15
|
+
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
16
|
+
|
|
17
|
+
@noble/curves/esm/abstract/weierstrass.js:
|
|
18
|
+
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
19
|
+
|
|
20
|
+
@noble/curves/esm/_shortw_utils.js:
|
|
21
|
+
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
22
|
+
|
|
23
|
+
@noble/curves/esm/secp256k1.js:
|
|
24
|
+
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
25
|
+
*/
|
|
3
26
|
return Libp2PMdns}));
|
package/dist/src/mdns.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdns.d.ts","sourceRoot":"","sources":["../../src/mdns.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mdns.d.ts","sourceRoot":"","sources":["../../src/mdns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC/F,OAAO,YAAY,MAAM,eAAe,CAAA;AAGxC,OAAO,KAAK,EAAE,eAAe,EAAU,aAAa,EAAE,mBAAmB,EAAY,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACzH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,cAAc,CAAA;IAC9B,MAAM,EAAE,eAAe,CAAA;CACxB;AAED,qBAAa,YAAa,SAAQ,iBAAiB,CAAC,mBAAmB,CAAE,YAAW,aAAa,EAAE,SAAS;IACnG,IAAI,CAAC,EAAE,YAAY,CAAC,YAAY,CAAA;IAEvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAQ;IAC3B,OAAO,CAAC,cAAc,CAAuC;IAC7D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAwB;gBAEtC,UAAU,EAAE,sBAAsB,EAAE,IAAI,GAAE,gBAAqB;IAsB5E,QAAQ,CAAC,CAAC,mBAAmB,CAAC,OAAO;IAErC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAiB;IAE9C,QAAQ,CAAC,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAEvC;IAED,SAAS,IAAK,OAAO;IAIrB;;;;OAIG;IACG,KAAK,IAAK,OAAO,CAAC,IAAI,CAAC;IAgB7B,YAAY,CAAE,KAAK,EAAE,YAAY,CAAC,WAAW,GAAG,IAAI;IAkBpD,eAAe,CAAE,KAAK,EAAE,YAAY,CAAC,cAAc,GAAG,IAAI;IAoB1D,cAAc,CAAE,GAAG,EAAE,KAAK,GAAG,IAAI;IAIjC,YAAY,CAAE,GAAG,EAAE,KAAK,GAAG,IAAI;IAI/B;;;;OAIG;IACG,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;CAyB7B"}
|
package/dist/src/mdns.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypedEventEmitter, peerDiscoverySymbol, serviceCapabilities } from '@libp2p/interface';
|
|
2
2
|
import multicastDNS from 'multicast-dns';
|
|
3
3
|
import * as query from './query.js';
|
|
4
4
|
import { stringGen } from './utils.js';
|
package/dist/src/mdns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdns.js","sourceRoot":"","sources":["../../src/mdns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mdns.js","sourceRoot":"","sources":["../../src/mdns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC/F,OAAO,YAAY,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAkBtC,MAAM,OAAO,YAAa,SAAQ,iBAAsC;IAC/D,IAAI,CAA4B;IAEtB,GAAG,CAAQ;IACX,SAAS,CAAS;IAClB,QAAQ,CAAQ;IAChB,UAAU,CAAQ;IAClB,QAAQ,CAAQ;IAChB,IAAI,CAAQ;IACZ,EAAE,CAAQ;IACnB,cAAc,CAAuC;IAC5C,UAAU,CAAwB;IAEnD,YAAa,UAAkC,EAAE,OAAyB,EAAE;QAC1E,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,CAAA;QACxD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,KAAK,KAAK,CAAA;QACzC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAA;QAC3C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,iBAAiB,CAAA;QACtD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,aAAa,CAAA;QAClC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,SAAS,CAAC,EAAE,CAAC,CAAA;QAC9C,wBAAwB;QACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAChE,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAA;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;QAC1B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAChD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACtD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACpD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClD,CAAC;IAEQ,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAA;IAE5B,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;IAErC,CAAC,mBAAmB,CAAC,GAAa;QACzC,wBAAwB;KACzB,CAAA;IAED,SAAS;QACP,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QAC1D,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QACxC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAA;QAC9C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;QAC5C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QAExC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE;YAC9E,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC,CAAA;IACJ,CAAC;IAED,YAAY,CAAE,KAA+B;QAC3C,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;QAC9C,KAAK,CAAC,QAAQ,CACZ,KAAK,EACL,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,YAAY,EAAE,EAC7C,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,SAAS,EAAE;YACd,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CACF,CAAA;IACH,CAAC;IAED,eAAe,CAAE,KAAkC;QACjD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;QAE9C,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE;gBACzE,GAAG,EAAE,IAAI,CAAC,GAAG;aACd,CAAC,CAAA;YAEF,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;gBACtB,IAAI,CAAC,GAAG,CAAC,2CAA2C,EAAE,SAAS,CAAC,EAAE,CAAC,CAAA;gBAEnE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAW,MAAM,EAAE;oBACnD,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC,CAAA;YACL,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAA;QACvD,CAAC;IACH,CAAC;IAED,cAAc,CAAE,GAAU;QACxB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;IACrC,CAAC;IAED,YAAY,CAAE,GAAU;QACtB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAA;QAC1D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;QACxD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QAEpD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,EAAE,CAAC;YAChC,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YAClC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;QAC5B,CAAC;QAED,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAClC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;gBACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YAC5B,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAA;YACX,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,IAAI,GAAG,SAAS,CAAA;IACvB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/mdns",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-18dd3cb26",
|
|
4
4
|
"description": "Node.js libp2p mDNS discovery implementation for peer discovery",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/peer-discovery-mdns#readme",
|
|
@@ -50,19 +50,19 @@
|
|
|
50
50
|
"test:electron-main": "aegir test -t electron-main"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@libp2p/interface": "
|
|
54
|
-
"@libp2p/interface-internal": "
|
|
55
|
-
"@libp2p/peer-id": "
|
|
56
|
-
"@libp2p/utils": "
|
|
53
|
+
"@libp2p/interface": "2.0.0-18dd3cb26",
|
|
54
|
+
"@libp2p/interface-internal": "2.0.0-18dd3cb26",
|
|
55
|
+
"@libp2p/peer-id": "5.0.0-18dd3cb26",
|
|
56
|
+
"@libp2p/utils": "6.0.0-18dd3cb26",
|
|
57
57
|
"@multiformats/multiaddr": "^12.2.3",
|
|
58
58
|
"@types/multicast-dns": "^7.2.4",
|
|
59
59
|
"dns-packet": "^5.6.1",
|
|
60
60
|
"multicast-dns": "^7.2.5"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@libp2p/
|
|
64
|
-
"@libp2p/
|
|
65
|
-
"@libp2p/
|
|
63
|
+
"@libp2p/crypto": "5.0.0-18dd3cb26",
|
|
64
|
+
"@libp2p/interface-compliance-tests": "6.0.0-18dd3cb26",
|
|
65
|
+
"@libp2p/logger": "5.0.0-18dd3cb26",
|
|
66
66
|
"aegir": "^44.0.1",
|
|
67
67
|
"p-wait-for": "^5.0.2",
|
|
68
68
|
"sinon-ts": "^2.0.0"
|
package/src/mdns.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypedEventEmitter, peerDiscoverySymbol, serviceCapabilities } from '@libp2p/interface'
|
|
2
2
|
import multicastDNS from 'multicast-dns'
|
|
3
3
|
import * as query from './query.js'
|
|
4
4
|
import { stringGen } from './utils.js'
|
package/dist/typedoc-urls.json
DELETED