@helia/dnslink 2.0.0-3d869e9d → 2.0.0-cee53d7d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,15 +1,4 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.HeliaDnslink = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var HeliaDnslink=(()=>{var Bi=Object.create;var tr=Object.defineProperty;var Ii=Object.getOwnPropertyDescriptor;var Ti=Object.getOwnPropertyNames;var _i=Object.getPrototypeOf,Di=Object.prototype.hasOwnProperty;var Li=(r,t)=>()=>{try{return t||r((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},ct=(r,t)=>{for(var e in t)tr(r,e,{get:t[e],enumerable:!0})},go=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ti(t))!Di.call(r,o)&&o!==e&&tr(r,o,{get:()=>t[o],enumerable:!(n=Ii(t,o))||n.enumerable});return r};var Ri=(r,t,e)=>(e=r!=null?Bi(_i(r)):{},go(t||!r||!r.__esModule?tr(e,"default",{value:r,enumerable:!0}):e,r)),Ci=r=>go(tr({},"__esModule",{value:!0}),r);var qo=Li((Bu,Ho)=>{Ho.exports=function(r){if(!r)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,e=Object.create(null),n=Object.create(null);function o(s,i){e[s]=i,t++,t>=r&&(t=0,n=e,e=Object.create(null))}return{has:function(s){return e[s]!==void 0||n[s]!==void 0},remove:function(s){e[s]!==void 0&&(e[s]=void 0),n[s]!==void 0&&(n[s]=void 0)},get:function(s){var i=e[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return o(s,i),i},set:function(s,i){e[s]!==void 0?e[s]=i:o(s,i)},clear:function(){e=Object.create(null),n=Object.create(null)}}}});var mf={};ct(mf,{dnsLink:()=>pf});var Gr={};ct(Gr,{base10:()=>Mi});var Ef=new Uint8Array(0);function wo(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function lt(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return Zt(r);if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return Zt(new Uint8Array(r.buffer,r.byteOffset,r.byteLength));throw new Error("Unknown type, must be binary type")}function Eo(r){let t=new Uint8Array(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}var xo=4096;function So(r){let t=r.length;if(t<=xo)return String.fromCharCode.apply(String,r);let e="",n=0;for(;n<t;)e+=String.fromCharCode.apply(String,r.subarray(n,n+=xo));return e}function Oi(r){return r?.buffer instanceof ArrayBuffer}function Zt(r){return Oi(r)?r:r.slice()}function Fi(r,t,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),o=0;o<n.length;o++)n[o]=255;for(var s=0;s<r.length;s++){var i=r.charAt(s),c=i.charCodeAt(0);if(n[c]!==255)throw new TypeError(i+" is ambiguous");if(n[c]=s,e){var f=i.toLowerCase().charCodeAt(0),a=i.toUpperCase().charCodeAt(0);f!==c&&(n[f]=s),a!==c&&(n[a]=s)}}var u=r.length,h=r.charAt(0),x=Math.log(u)/Math.log(256),d=Math.log(256)/Math.log(u);function A(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var w=0,v=0,C=0,D=p.length;C!==D&&p[C]===0;)C++,w++;for(var U=(D-C)*d+1>>>0,R=new Uint8Array(U);C!==D;){for(var B=p[C],N=0,K=U-1;(B!==0||N<v)&&K!==-1;K--,N++)B+=256*R[K]>>>0,R[K]=B%u>>>0,B=B/u>>>0;if(B!==0)throw new Error("Non-zero carry");v=N,C++}for(var F=U-v;F!==U&&R[F]===0;)F++;for(var l=h.repeat(w);F<U;++F)l+=r.charAt(R[F]);return l}function T(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var w=0;if(p[w]!==" "){for(var v=0,C=0;p[w]===h;)v++,w++;for(var D=(p.length-w)*x+1>>>0,U=new Uint8Array(D);p[w];){var R=n[p.charCodeAt(w)];if(R===255)return;for(var B=0,N=D-1;(R!==0||B<C)&&N!==-1;N--,B++)R+=u*U[N]>>>0,U[N]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");C=B,w++}if(p[w]!==" "){for(var K=D-C;K!==D&&U[K]===0;)K++;for(var F=new Uint8Array(v+(D-K)),l=v;K!==D;)F[l++]=U[K++];return F}}}function m(p){var w=T(p);if(w)return w;throw new Error(`Non-${t} character`)}return{encode:A,decodeUnsafe:T,decode:m}}var Ui=Fi,Ni=Ui,vo=Ni;var jr=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Zr=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){this.name=t,this.prefix=e;let o=e.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Bo(this,t)}},$r=class{decoders;constructor(t){this.decoders=t}or(t){return Bo(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Bo(r,t){return new $r({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var Yr=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new jr(t,e,n),this.decoder=new Zr(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function ne({name:r,prefix:t,encode:e,decode:n}){return new Yr(r,t,e,n)}function Ct({name:r,prefix:t,alphabet:e,caseInsensitive:n=!1}){let{encode:o,decode:s}=vo(e,r,n);return ne({prefix:t,name:r,encode:o,decode:i=>lt(s(i))})}function Ki(r,t,e,n){let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*e/8|0),i=0,c=0,f=0;for(let a=0;a<o;++a){let u=t[r[a]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|u,i+=e,i>=8&&(i-=8,s[f++]=255&c>>i)}if(i>=e||(255&c<<8-i)!==0)throw new SyntaxError("Unexpected end of data");return s}function ki(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,s="",i=0,c=0;for(let f=0;f<r.length;++f)for(c=c<<8|r[f],i+=8;i>e;)i-=e,s+=t[o&c>>i];if(i!==0&&(s+=t[o&c<<e-i]),n)for(;(s.length*e&7)!==0;)s+="=";return s}function Pi(r,t){let e={};for(let n=0;n<r.length;++n)if(e[r[n]]=n,t){let o=r[n].toLowerCase(),s=r[n].toUpperCase();o!==r[n]&&(e[o]=n),s!==r[n]&&(e[s]=n)}return e}function V({name:r,prefix:t,bitsPerChar:e,alphabet:n,caseInsensitive:o=!1}){let s=Pi(n,o);return ne({prefix:t,name:r,encode(i){return ki(i,n,e)},decode(i){return Ki(i,s,e,r)}})}var Mi=Ct({prefix:"9",name:"base10",alphabet:"0123456789"});var Xr={};ct(Xr,{base16:()=>Hi,base16upper:()=>qi});var Hi=V({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4,caseInsensitive:!0}),qi=V({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4,caseInsensitive:!0});var Wr={};ct(Wr,{base2:()=>Vi});var Vi=V({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Qr={};ct(Qr,{base256emoji:()=>Yi});var Io=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}"),zi=Io.reduce((r,t,e)=>(r[e]=t,r),[]),ji=Io.reduce((r,t,e)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return r[n]=e,r},[]);function Zi(r){return r.reduce((t,e)=>(t+=zi[e],t),"")}function $i(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let o=ji[n];if(o==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(o)}return new Uint8Array(t)}var Yi=ne({prefix:"\u{1F680}",name:"base256emoji",encode:Zi,decode:$i});var Jr={};ct(Jr,{base32:()=>oe,base32hex:()=>Qi,base32hexpad:()=>tc,base32hexpadupper:()=>ec,base32hexupper:()=>Ji,base32pad:()=>Xi,base32padupper:()=>Wi,base32upper:()=>Gi,base32z:()=>rc});var oe=V({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5,caseInsensitive:!0}),Gi=V({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5,caseInsensitive:!0}),Xi=V({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5,caseInsensitive:!0}),Wi=V({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5,caseInsensitive:!0}),Qi=V({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5,caseInsensitive:!0}),Ji=V({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5,caseInsensitive:!0}),tc=V({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5,caseInsensitive:!0}),ec=V({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5,caseInsensitive:!0}),rc=V({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var tn={};ct(tn,{base36:()=>Be,base36upper:()=>nc});var Be=Ct({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz",caseInsensitive:!0}),nc=Ct({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",caseInsensitive:!0});var en={};ct(en,{base58btc:()=>$,base58flickr:()=>oc});var $=Ct({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),oc=Ct({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var rn={};ct(rn,{base64:()=>sc,base64pad:()=>ic,base64url:()=>cc,base64urlpad:()=>ac});var sc=V({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ic=V({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cc=V({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ac=V({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var nn={};ct(nn,{base8:()=>fc});var fc=V({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var on={};ct(on,{identity:()=>uc});var uc=ne({prefix:"\0",name:"identity",encode:r=>So(lt(r)),decode:r=>lt(Eo(r))});var Kf=new TextEncoder,kf=new TextDecoder;var cn={};ct(cn,{identity:()=>dt});var dc=Do,To=128,pc=127,mc=~pc,yc=Math.pow(2,31);function Do(r,t,e){t=t||[],e=e||0;for(var n=e;r>=yc;)t[e++]=r&255|To,r/=128;for(;r&mc;)t[e++]=r&255|To,r>>>=7;return t[e]=r|0,Do.bytes=e-n+1,t}var bc=sn,gc=128,_o=127;function sn(r,n){var e=0,n=n||0,o=0,s=n,i,c=r.length;do{if(s>=c)throw sn.bytes=0,new RangeError("Could not decode varint");i=r[s++],e+=o<28?(i&_o)<<o:(i&_o)*Math.pow(2,o),o+=7}while(i>=gc);return sn.bytes=s-n,e}var xc=Math.pow(2,7),wc=Math.pow(2,14),Ec=Math.pow(2,21),Sc=Math.pow(2,28),Ac=Math.pow(2,35),vc=Math.pow(2,42),Bc=Math.pow(2,49),Ic=Math.pow(2,56),Tc=Math.pow(2,63),_c=function(r){return r<xc?1:r<wc?2:r<Ec?3:r<Sc?4:r<Ac?5:r<vc?6:r<Bc?7:r<Ic?8:r<Tc?9:10},Dc={encode:dc,decode:bc,encodingLength:_c},Lc=Dc,Ie=Lc;function Te(r,t=0){return[Ie.decode(r,t),Ie.decode.bytes]}function se(r,t,e=0){return Ie.encode(r,t,e),t}function ie(r){return Ie.encodingLength(r)}function ae(r,t){let e=t.byteLength,n=ie(r),o=n+ie(e),s=new Uint8Array(o+e);return se(r,s,0),se(e,s,n),s.set(t,o),new ce(r,e,t,s)}function _e(r){let t=lt(r),[e,n]=Te(t),[o,s]=Te(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ce(e,o,i,t)}function Lo(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&wo(r.bytes,e.bytes)}}var ce=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=Zt(n),this.bytes=Zt(o)}};var Ro=0,Rc="identity",Co=lt;function Cc(r,t){if(t?.truncate!=null&&t.truncate!==r.byteLength){if(t.truncate<0||t.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t.truncate)}return ae(Ro,Co(r))}var dt={code:Ro,name:Rc,encode:Co,digest:Cc};var un={};ct(un,{sha256:()=>De,sha512:()=>Fc});var Oc=20;function fn({name:r,code:t,encode:e,minDigestLength:n,maxDigestLength:o}){return new an(r,t,e,n,o)}var an=class{name;code;encode;minDigestLength;maxDigestLength;constructor(t,e,n,o,s){this.name=t,this.code=e,this.encode=n,this.minDigestLength=o??Oc,this.maxDigestLength=s}digest(t,e){if(e?.truncate!=null){if(e.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&e.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(t instanceof Uint8Array){let n=this.encode(t);return n instanceof Uint8Array?Oo(n,this.code,e?.truncate):n.then(o=>Oo(o,this.code,e?.truncate))}else throw Error("Unknown type, must be binary type")}};function Oo(r,t,e){if(e!=null&&e!==r.byteLength){if(e>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e)}return ae(t,r)}function Uo(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var De=fn({name:"sha2-256",code:18,encode:Uo("SHA-256")}),Fc=fn({name:"sha2-512",code:19,encode:Uo("SHA-512")});function No(r,t){let{bytes:e,version:n}=r;return n===0?Nc(e,hn(r),t??$.encoder):Kc(e,hn(r),t??oe.encoder)}var Ko=new WeakMap;function hn(r){let t=Ko.get(r);if(t==null){let e=new Map;return Ko.set(r,e),e}return t}var J=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=Zt(o),this["/"]=this.bytes}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:t,multihash:e}=this;if(t!==Le)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==kc)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}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:t,digest:e}=this.multihash,n=ae(t,e);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(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&Lo(t.multihash,n.multihash)}toString(t){return No(this,t)}toJSON(){return{"/":No(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:s,bytes:i}=e;return new r(n,o,s,i??ko(n,o,s.bytes))}else if(e[Pc]===!0){let{version:n,multihash:o,code:s}=e,i=_e(o);return r.create(n,s,i)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Le)throw new Error(`Version 0 CID must use dag-pb (code: ${Le}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=ko(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Le,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=lt(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=o.subarray(e.multihashSize-e.digestSize),i=new ce(e.multihashCode,e.digestSize,s,o);return[e.version===0?r.createV0(i):r.createV1(e.codec,i),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[h,x]=Te(t.subarray(e));return e+=x,h},o=n(),s=Le;if(o===18?(o=0,e=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=e,c=n(),f=n(),a=e+f,u=a-i;return{version:o,codec:s,multihashCode:c,digestSize:f,multihashSize:u,size:a}}static parse(t,e){let[n,o]=Uc(t,e),s=r.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return hn(s).set(n,t),s}};function Uc(r,t){switch(r[0]){case"Q":{let e=t??$;return[$.prefix,e.decode(`${$.prefix}${r}`)]}case $.prefix:{let e=t??$;return[$.prefix,e.decode(r)]}case oe.prefix:{let e=t??oe;return[oe.prefix,e.decode(r)]}case Be.prefix:{let e=t??Be;return[Be.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function Nc(r,t,e){let{prefix:n}=e;if(n!==$.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return o}function Kc(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let s=e.encode(r);return t.set(n,s),s}else return o}var Le=112,kc=18;function ko(r,t,e){let n=ie(r),o=n+ie(t),s=new Uint8Array(o+e.byteLength);return se(r,s,0),se(t,s,n),s.set(e,o),s}var Pc=Symbol.for("@ipld/js-cid/CID");var ln={...on,...Wr,...nn,...Gr,...Xr,...Jr,...tn,...en,...rn,...Qr},iu={...un,...cn};function It(r=0){return new Uint8Array(r)}function at(r=0){return new Uint8Array(r)}function Mo(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Po=Mo("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),dn=Mo("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=at(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Mc={utf8:Po,"utf-8":Po,hex:ln.base16,latin1:dn,ascii:dn,binary:dn,...ln},rr=Mc;function it(r,t="utf8"){let e=rr[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.encoder.encode(r).substring(1)}var zc=Ri(qo(),1);var Bt;(function(r){r[r.A=1]="A",r[r.CNAME=5]="CNAME",r[r.TXT=16]="TXT",r[r.AAAA=28]="AAAA"})(Bt||(Bt={}));var Vo=32;var ue=class extends Map{#r=0;#t=new Map;#e=new Map;#o;#i;#s;constructor(t={}){if(super(),!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof t.maxAge=="number"&&t.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.#o=t.maxSize,this.#i=t.maxAge||Number.POSITIVE_INFINITY,this.#s=t.onEviction}get __oldCache(){return this.#e}#c(t){if(typeof this.#s=="function")for(let[e,n]of t)this.#s(e,n.value)}#n(t,e){return typeof e.expiry=="number"&&e.expiry<=Date.now()?(typeof this.#s=="function"&&this.#s(t,e.value),this.delete(t)):!1}#l(t,e){if(this.#n(t,e)===!1)return e.value}#f(t,e){return e.expiry?this.#l(t,e):e.value}#u(t,e){let n=e.get(t);return this.#f(t,n)}#h(t,e){this.#t.set(t,e),this.#r++,this.#r>=this.#o&&(this.#r=0,this.#c(this.#e),this.#e=this.#t,this.#t=new Map)}#d(t,e){this.#e.delete(t),this.#h(t,e)}*#a(){for(let t of this.#e){let[e,n]=t;this.#t.has(e)||this.#n(e,n)===!1&&(yield t)}for(let t of this.#t){let[e,n]=t;this.#n(e,n)===!1&&(yield t)}}get(t){if(this.#t.has(t)){let e=this.#t.get(t);return this.#f(t,e)}if(this.#e.has(t)){let e=this.#e.get(t);if(this.#n(t,e)===!1)return this.#d(t,e),e.value}}set(t,e,{maxAge:n=this.#i}={}){let o=typeof n=="number"&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.#t.has(t)?this.#t.set(t,{value:e,expiry:o}):this.#h(t,{value:e,expiry:o}),this}has(t){return this.#t.has(t)?!this.#n(t,this.#t.get(t)):this.#e.has(t)?!this.#n(t,this.#e.get(t)):!1}peek(t){if(this.#t.has(t))return this.#u(t,this.#t);if(this.#e.has(t))return this.#u(t,this.#e)}expiresIn(t){let e=this.#t.get(t)??this.#e.get(t);if(e)return e.expiry?e.expiry-Date.now():Number.POSITIVE_INFINITY}delete(t){let e=this.#t.delete(t);return e&&this.#r--,this.#e.delete(t)||e}clear(){this.#t.clear(),this.#e.clear(),this.#r=0}resize(t){if(!(t&&t>0))throw new TypeError("`maxSize` must be a number greater than 0");let e=[...this.#a()],n=e.length-t;n<0?(this.#t=new Map(e),this.#e=new Map,this.#r=e.length):(n>0&&this.#c(e.slice(0,n)),this.#e=new Map(e.slice(n)),this.#t=new Map,this.#r=0),this.#o=t}evict(t=1){let e=Number(t);if(!e||e<=0)return;let n=[...this.#a()],o=Math.trunc(Math.min(e,Math.max(n.length-1,0)));o<=0||(this.#c(n.slice(0,o)),this.#e=new Map(n.slice(o)),this.#t=new Map,this.#r=0)}*keys(){for(let[t]of this)yield t}*values(){for(let[,t]of this)yield t}*[Symbol.iterator](){for(let t of this.#t){let[e,n]=t;this.#n(e,n)===!1&&(yield[e,n.value])}for(let t of this.#e){let[e,n]=t;this.#t.has(e)||this.#n(e,n)===!1&&(yield[e,n.value])}}*entriesDescending(){let t=[...this.#t];for(let e=t.length-1;e>=0;--e){let n=t[e],[o,s]=n;this.#n(o,s)===!1&&(yield[o,s.value])}t=[...this.#e];for(let e=t.length-1;e>=0;--e){let n=t[e],[o,s]=n;this.#t.has(o)||this.#n(o,s)===!1&&(yield[o,s.value])}}*entriesAscending(){for(let[t,e]of this.#a())yield[t,e.value]}get size(){if(!this.#r)return this.#e.size;let t=0;for(let e of this.#e.keys())this.#t.has(e)||t++;return Math.min(this.#r+t,this.#o)}get maxSize(){return this.#o}get maxAge(){return this.#i}entries(){return this.entriesAscending()}forEach(t,e=this){for(let[n,o]of this.entriesAscending())t.call(e,o,n,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};var nr=class extends Error{static name="DNSLinkNotFoundError";constructor(t="DNSLink not found"){super(t),this.name="DNSLinkNotFoundError"}},he=class extends Error{static name="InvalidNamespaceError";constructor(t="Invalid namespace"){super(t),this.name="InvalidNamespaceError"}};var zo=(r,t)=>{let[,e,n,...o]=r.split("/");if(e!=="ipfs")throw new he(`Namespace ${e} was not "ipfs"`);return{namespace:"ipfs",cid:J.parse(n),path:o.length>0?`/${o.join("/")}`:"",answer:t}};var Et=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},or=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}};var sr=class extends Error{static name="InvalidCIDError";constructor(t="Invalid CID"){super(t),this.name="InvalidCIDError"}},ir=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}};var Re=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var pn=Symbol.for("@libp2p/peer-id");function pt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function jc(r){return r.buffer instanceof ArrayBuffer}function Ot(r){return jc(r)?r:r.slice()}async function jo(r,t,e,n){let o=await crypto.subtle.importKey("jwk",r,{name:"ECDSA",namedCurve:r.crv??"P-256"},!1,["verify"]);n?.signal?.throwIfAborted();let s=await crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-256"}},o,Ot(t),Ot(e.subarray()));return n?.signal?.throwIfAborted(),s}function Zc(r){return r?.buffer instanceof ArrayBuffer}function Zo(r){if(Zc(r))return r;let t=r.slice();return new Uint8Array(t.buffer,0,t.byteLength)}function cr(r,t){t==null&&(t=r.reduce((o,s)=>o+s.length,0));let e=at(t),n=0;for(let o of r)e.set(o,n),n+=o.length;return Zo(e)}var Yo=Symbol.for("@achingbrain/uint8arraylist");function $o(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let o=e+n.byteLength;if(t<o)return{buf:n,index:t-e};e=o}throw new RangeError("index is out of bounds")}function ar(r){return!!r?.[Yo]}var ft=class r{bufs;length;[Yo]=!0;constructor(...t){this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(let n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(ar(n)){e+=n.byteLength;for(let o of n.bufs)this.bufs.push(o)}else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(let n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(ar(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){let e=$o(this.bufs,t);return e.buf[e.index]}set(t,e){let n=$o(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(ar(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){let{bufs:n,length:o}=this._subList(t,e);return cr(n,o)}subarray(t,e){let{bufs:n,length:o}=this._subList(t,e);return n.length===1?n[0]:cr(n,o)}sublist(t,e){let{bufs:n,length:o}=this._subList(t,e),s=new r;return s.length=o,s.bufs=n,s}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:[...this.bufs],length:this.length};let n=[],o=0;for(let s=0;s<this.bufs.length;s++){let i=this.bufs[s],c=o,f=c+i.byteLength;if(o=f,t>=f)continue;let a=t>=c&&t<f,u=e>c&&e<=f;if(a&&u){if(t===c&&e===f){n.push(i);break}let h=t-c;n.push(i.subarray(h,h+(e-t)));break}if(a){if(t===0){n.push(i);continue}n.push(i.subarray(t-c));continue}if(u){if(e===f){n.push(i);break}n.push(i.subarray(0,e-c));break}n.push(i)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!ar(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let s=256,i=new Int32Array(s);for(let h=0;h<s;h++)i[h]=-1;for(let h=0;h<o;h++)i[n[h]]=h;let c=i,f=this.byteLength-n.byteLength,a=n.byteLength-1,u;for(let h=e;h<=f;h+=u){u=0;for(let x=a;x>=0;x--){let d=this.get(h+x);if(n[x]!==d){u=Math.max(1,x-c[d]);break}}if(u===0)return h}return-1}getInt8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){let n=at(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){let o=It(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,e,n),this.write(o,t)}getInt32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){let o=It(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,e,n),this.write(o,t)}getBigInt64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){let o=It(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,e,n),this.write(o,t)}getUint8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){let n=at(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){let o=It(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,e,n),this.write(o,t)}getUint32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){let o=It(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,e,n),this.write(o,t)}getBigUint64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){let o=It(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,e,n),this.write(o,t)}getFloat32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){let o=It(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,e,n),this.write(o,t)}getFloat64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){let o=It(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,e,n),this.write(o,t)}equals(t){if(t==null||!(t instanceof r)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!pt(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){let n=new r;return n.bufs=t,e==null&&(e=t.reduce((o,s)=>o+s.byteLength,0)),n.length=e,n}};function Ft(r,t="utf8"){let e=rr[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}var $c=parseInt("11111",2),mn=parseInt("10000000",2),Yc=parseInt("01111111",2),Go={0:Ce,1:Ce,2:Gc,3:Qc,4:Jc,5:Wc,6:Xc,16:Ce,22:Ce,48:Ce};function yn(r,t={offset:0}){let e=r[t.offset]&$c;if(t.offset++,Go[e]!=null)return Go[e](r,t);throw new Error("No decoder for tag "+e)}function Oe(r,t){let e=0;if((r[t.offset]&mn)===mn){let n=r[t.offset]&Yc,o="0x";t.offset++;for(let s=0;s<n;s++,t.offset++)o+=r[t.offset].toString(16).padStart(2,"0");e=parseInt(o,16)}else e=r[t.offset],t.offset++;return e}function Ce(r,t){Oe(r,t);let e=[];for(;!(t.offset>=r.byteLength);){let n=yn(r,t);if(n===null)break;e.push(n)}return e}function Gc(r,t){let e=Oe(r,t),n=t.offset,o=t.offset+e,s=[];for(let i=n;i<o;i++)i===n&&r[i]===0||s.push(r[i]);return t.offset+=e,Uint8Array.from(s)}function Xc(r,t){let e=Oe(r,t),n=t.offset+e,o=r[t.offset];t.offset++;let s=0,i=0;o<40?(s=0,i=o):o<80?(s=1,i=o-40):(s=2,i=o-80);let c=`${s}.${i}`,f=[];for(;t.offset<n;){let a=r[t.offset];if(t.offset++,f.push(a&127),a<128){f.reverse();let u=0;for(let h=0;h<f.length;h++)u+=f[h]<<h*7;c+=`.${u}`,f=[]}}return c}function Wc(r,t){return t.offset++,null}function Qc(r,t){let e=Oe(r,t),n=r[t.offset];t.offset++;let o=r.subarray(t.offset,t.offset+e-1);if(t.offset+=e,n!==0)throw new Error("Unused bits in bit string is unimplemented");return o}function Jc(r,t){let e=Oe(r,t),n=r.subarray(t.offset,t.offset+e);return t.offset+=e,n}function ta(r){let t=r.toString(16);t.length%2===1&&(t="0"+t);let e=new ft;for(let n=0;n<t.length;n+=2)e.append(Uint8Array.from([parseInt(`${t[n]}${t[n+1]}`,16)]));return e}function bn(r){if(r.byteLength<128)return Uint8Array.from([r.byteLength]);let t=ta(r.byteLength);return new ft(Uint8Array.from([t.byteLength|mn]),t)}function Xo(r){let t=new ft,e=128;return(r.subarray()[0]&e)===e&&t.append(Uint8Array.from([0])),t.append(r),new ft(Uint8Array.from([2]),bn(t),t)}function Wo(r){let t=Uint8Array.from([0]),e=new ft(t,r);return new ft(Uint8Array.from([3]),bn(e),e)}function fr(r,t=48){let e=new ft;for(let n of r)e.append(n);return new ft(Uint8Array.from([t]),bn(e),e)}var ea=Uint8Array.from([6,8,42,134,72,206,61,3,1,7]),ra=Uint8Array.from([6,5,43,129,4,0,34]),na=Uint8Array.from([6,5,43,129,4,0,35]),oa={ext:!0,kty:"EC",crv:"P-256"},sa={ext:!0,kty:"EC",crv:"P-384"},ia={ext:!0,kty:"EC",crv:"P-521"},gn=32,xn=48,wn=66;function Qo(r){let t=yn(r);return Jo(t)}function Jo(r){let t=r[1][1][0],e=1,n,o;if(t.byteLength===gn*2+1)return n=it(t.subarray(e,e+gn),"base64url"),o=it(t.subarray(e+gn),"base64url"),new le({...oa,key_ops:["verify"],x:n,y:o});if(t.byteLength===xn*2+1)return n=it(t.subarray(e,e+xn),"base64url"),o=it(t.subarray(e+xn),"base64url"),new le({...sa,key_ops:["verify"],x:n,y:o});if(t.byteLength===wn*2+1)return n=it(t.subarray(e,e+wn),"base64url"),o=it(t.subarray(e+wn),"base64url"),new le({...ia,key_ops:["verify"],x:n,y:o});throw new Et(`coordinates were wrong length, got ${t.byteLength}, expected 65, 97 or 133`)}function ts(r){return fr([Xo(Uint8Array.from([1])),fr([ca(r.crv)],160),fr([Wo(new ft(Uint8Array.from([4]),Ft(r.x??"","base64url"),Ft(r.y??"","base64url")))],161)]).subarray()}function ca(r){if(r==="P-256")return ea;if(r==="P-384")return ra;if(r==="P-521")return na;throw new Et(`Invalid curve ${r}`)}var le=class{type="ECDSA";jwk;_raw;constructor(t){this.jwk=t}get raw(){return this._raw==null&&(this._raw=ts(this.jwk)),this._raw}toMultihash(){return dt.digest(de(this))}toCID(){return J.createV1(114,this.toMultihash())}toString(){return $.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:pt(this.raw,t.raw)}async verify(t,e,n){return jo(this.jwk,e,t,n)}};function En(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in r&&r.BYTES_PER_ELEMENT===1}function Ut(r,t=""){if(typeof r!="number"){let e=t&&`"${t}" `;throw new TypeError(`${e}expected number, got ${typeof r}`)}if(!Number.isSafeInteger(r)||r<0){let e=t&&`"${t}" `;throw new RangeError(`${e}expected integer >= 0, got ${r}`)}}function ut(r,t,e=""){let n=En(r),o=r?.length,s=t!==void 0;if(!n||s&&o!==t){let i=e&&`"${e}" `,c=s?` of length ${t}`:"",f=n?`length=${o}`:`type=${typeof r}`,a=i+"expected Uint8Array"+c+", got "+f;throw n?new RangeError(a):new TypeError(a)}return r}function ur(r){if(typeof r!="function"||typeof r.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Ut(r.outputLen),Ut(r.blockLen),r.outputLen<1)throw new Error('"outputLen" must be >= 1');if(r.blockLen<1)throw new Error('"blockLen" must be >= 1')}function pe(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function hr(r,t){ut(r,void 0,"digestInto() output");let e=t.outputLen;if(r.length<e)throw new RangeError('"digestInto() output" expected to be of length >='+e)}function _t(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function lr(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function mt(r,t){return r<<32-t|r>>>t}var rs=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",aa=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function dr(r){if(ut(r),rs)return r.toHex();let t="";for(let e=0;e<r.length;e++)t+=aa[r[e]];return t}var Tt={_0:48,_9:57,A:65,F:70,a:97,f:102};function es(r){if(r>=Tt._0&&r<=Tt._9)return r-Tt._0;if(r>=Tt.A&&r<=Tt.F)return r-(Tt.A-10);if(r>=Tt.a&&r<=Tt.f)return r-(Tt.a-10)}function Fe(r){if(typeof r!="string")throw new TypeError("hex string expected, got "+typeof r);if(rs)try{return Uint8Array.fromHex(r)}catch(o){throw o instanceof SyntaxError?new RangeError(o.message):o}let t=r.length,e=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=es(r.charCodeAt(s)),c=es(r.charCodeAt(s+1));if(i===void 0||c===void 0){let f=r[s]+r[s+1];throw new RangeError('hex string expected, got non-hex character "'+f+'" at index '+s)}n[o]=i*16+c}return n}function Sn(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];ut(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}function An(r,t={}){let e=(o,s)=>r(s).update(o).digest(),n=r(void 0);return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.canXOF=n.canXOF,e.create=o=>r(o),Object.assign(e,t),Object.freeze(e)}function ns(r=32){Ut(r,"bytesLength");let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(r>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${r}`);return t.getRandomValues(new Uint8Array(r))}var vn=r=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,r])});function os(r,t,e){return r&t^~r&e}function ss(r,t,e){return r&t^r&e^t&e}var Ue=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,n,o){this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(t),this.view=lr(this.buffer)}update(t){pe(this),ut(t);let{view:e,buffer:n,blockLen:o}=this,s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let f=lr(t);for(;o<=s-i;i+=o)this.process(f,i);continue}n.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){pe(this),hr(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,_t(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(n,0),i=0);for(let h=i;h<o;h++)e[h]=0;n.setBigUint64(o-8,BigInt(this.length*8),s),this.process(n,0);let c=lr(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let a=f/4,u=this.get();if(a>u.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<a;h++)c.setUint32(4*h,u[h],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%e&&t.buffer.set(n),t}clone(){return this._cloneInto()}},Dt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var tt=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var pr=BigInt(4294967295),is=BigInt(32);function fa(r,t=!1){return t?{h:Number(r&pr),l:Number(r>>is&pr)}:{h:Number(r>>is&pr)|0,l:Number(r&pr)|0}}function cs(r,t=!1){let e=r.length,n=new Uint32Array(e),o=new Uint32Array(e);for(let s=0;s<e;s++){let{h:i,l:c}=fa(r[s],t);[n[s],o[s]]=[i,c]}return[n,o]}var Bn=(r,t,e)=>r>>>e,In=(r,t,e)=>r<<32-e|t>>>e,$t=(r,t,e)=>r>>>e|t<<32-e,Yt=(r,t,e)=>r<<32-e|t>>>e,Ne=(r,t,e)=>r<<64-e|t>>>e-32,Ke=(r,t,e)=>r>>>e-32|t<<64-e;function St(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var as=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),fs=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,us=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),hs=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,ls=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),ds=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var ha=Uint32Array.from([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]),Nt=new Uint32Array(64),Tn=class extends Ue{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:e,C:n,D:o,E:s,F:i,G:c,H:f}=this;return[t,e,n,o,s,i,c,f]}set(t,e,n,o,s,i,c,f){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=f|0}process(t,e){for(let h=0;h<16;h++,e+=4)Nt[h]=t.getUint32(e,!1);for(let h=16;h<64;h++){let x=Nt[h-15],d=Nt[h-2],A=mt(x,7)^mt(x,18)^x>>>3,T=mt(d,17)^mt(d,19)^d>>>10;Nt[h]=T+Nt[h-7]+A+Nt[h-16]|0}let{A:n,B:o,C:s,D:i,E:c,F:f,G:a,H:u}=this;for(let h=0;h<64;h++){let x=mt(c,6)^mt(c,11)^mt(c,25),d=u+x+os(c,f,a)+ha[h]+Nt[h]|0,T=(mt(n,2)^mt(n,13)^mt(n,22))+ss(n,o,s)|0;u=a,a=f,f=c,c=i+d|0,i=s,s=o,o=n,n=d+T|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,f=f+this.F|0,a=a+this.G|0,u=u+this.H|0,this.set(n,o,s,i,c,f,a,u)}roundClean(){_t(Nt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),_t(this.buffer)}},_n=class extends Tn{A=Dt[0]|0;B=Dt[1]|0;C=Dt[2]|0;D=Dt[3]|0;E=Dt[4]|0;F=Dt[5]|0;G=Dt[6]|0;H=Dt[7]|0;constructor(){super(32)}};var ps=cs(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),la=ps[0],da=ps[1],Kt=new Uint32Array(80),kt=new Uint32Array(80),Dn=class extends Ue{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:i,Dh:c,Dl:f,Eh:a,El:u,Fh:h,Fl:x,Gh:d,Gl:A,Hh:T,Hl:m}=this;return[t,e,n,o,s,i,c,f,a,u,h,x,d,A,T,m]}set(t,e,n,o,s,i,c,f,a,u,h,x,d,A,T,m){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=f|0,this.Eh=a|0,this.El=u|0,this.Fh=h|0,this.Fl=x|0,this.Gh=d|0,this.Gl=A|0,this.Hh=T|0,this.Hl=m|0}process(t,e){for(let v=0;v<16;v++,e+=4)Kt[v]=t.getUint32(e),kt[v]=t.getUint32(e+=4);for(let v=16;v<80;v++){let C=Kt[v-15]|0,D=kt[v-15]|0,U=$t(C,D,1)^$t(C,D,8)^Bn(C,D,7),R=Yt(C,D,1)^Yt(C,D,8)^In(C,D,7),B=Kt[v-2]|0,N=kt[v-2]|0,K=$t(B,N,19)^Ne(B,N,61)^Bn(B,N,6),F=Yt(B,N,19)^Ke(B,N,61)^In(B,N,6),l=us(R,F,kt[v-7],kt[v-16]),y=hs(l,U,K,Kt[v-7],Kt[v-16]);Kt[v]=y|0,kt[v]=l|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:c,Cl:f,Dh:a,Dl:u,Eh:h,El:x,Fh:d,Fl:A,Gh:T,Gl:m,Hh:p,Hl:w}=this;for(let v=0;v<80;v++){let C=$t(h,x,14)^$t(h,x,18)^Ne(h,x,41),D=Yt(h,x,14)^Yt(h,x,18)^Ke(h,x,41),U=h&d^~h&T,R=x&A^~x&m,B=ls(w,D,R,da[v],kt[v]),N=ds(B,p,C,U,la[v],Kt[v]),K=B|0,F=$t(n,o,28)^Ne(n,o,34)^Ne(n,o,39),l=Yt(n,o,28)^Ke(n,o,34)^Ke(n,o,39),y=n&s^n&c^s&c,E=o&i^o&f^i&f;p=T|0,w=m|0,T=d|0,m=A|0,d=h|0,A=x|0,{h,l:x}=St(a|0,u|0,N|0,K|0),a=c|0,u=f|0,c=s|0,f=i|0,s=n|0,i=o|0;let g=as(K,l,E);n=fs(g,N,F,y),o=g|0}({h:n,l:o}=St(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=St(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:f}=St(this.Ch|0,this.Cl|0,c|0,f|0),{h:a,l:u}=St(this.Dh|0,this.Dl|0,a|0,u|0),{h,l:x}=St(this.Eh|0,this.El|0,h|0,x|0),{h:d,l:A}=St(this.Fh|0,this.Fl|0,d|0,A|0),{h:T,l:m}=St(this.Gh|0,this.Gl|0,T|0,m|0),{h:p,l:w}=St(this.Hh|0,this.Hl|0,p|0,w|0),this.set(n,o,s,i,c,f,a,u,h,x,d,A,T,m,p,w)}roundClean(){_t(Kt,kt)}destroy(){this.destroyed=!0,_t(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Ln=class extends Dn{Ah=tt[0]|0;Al=tt[1]|0;Bh=tt[2]|0;Bl=tt[3]|0;Ch=tt[4]|0;Cl=tt[5]|0;Dh=tt[6]|0;Dl=tt[7]|0;Eh=tt[8]|0;El=tt[9]|0;Fh=tt[10]|0;Fl=tt[11]|0;Gh=tt[12]|0;Gl=tt[13]|0;Hh=tt[14]|0;Hl=tt[15]|0;constructor(){super(64)}};var ms=An(()=>new _n,vn(1));var mr=An(()=>new Ln,vn(3));var M=(r,t,e)=>ut(r,t,e),Cn=Ut,me=dr,G=(...r)=>Sn(...r),ye=r=>Fe(r),Gt=En,ke=r=>ns(r),br=BigInt(0),Rn=BigInt(1);function yt(r,t=""){if(typeof r!="boolean"){let e=t&&`"${t}" `;throw new TypeError(e+"expected boolean, got type="+typeof r)}return r}function gr(r){if(typeof r=="bigint"){if(!yr(r))throw new RangeError("positive bigint expected, got "+r)}else Cn(r);return r}function bt(r,t=""){if(typeof r!="number"){let e=t&&`"${t}" `;throw new TypeError(e+"expected number, got type="+typeof r)}if(!Number.isSafeInteger(r)){let e=t&&`"${t}" `;throw new RangeError(e+"expected safe integer, got "+r)}}function Pe(r){let t=gr(r).toString(16);return t.length&1?"0"+t:t}function ys(r){if(typeof r!="string")throw new TypeError("hex string expected, got "+typeof r);return r===""?br:BigInt("0x"+r)}function Xt(r){return ys(dr(r))}function At(r){return ys(dr(Me(ut(r)).reverse()))}function xr(r,t){if(Ut(t),t===0)throw new RangeError("zero length");r=gr(r);let e=r.toString(16);if(e.length>t*2)throw new RangeError("number too large");return Fe(e.padStart(t*2,"0"))}function On(r,t){return xr(r,t).reverse()}function bs(r,t){if(r=M(r),t=M(t),r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}function Me(r){return Uint8Array.from(M(r))}function wr(r){if(typeof r!="string")throw new TypeError("ascii string expected, got "+typeof r);return Uint8Array.from(r,(t,e)=>{let n=t.charCodeAt(0);if(t.length!==1||n>127)throw new RangeError(`string contains non-ASCII character "${r[e]}" with code ${n} at position ${e}`);return n})}var yr=r=>typeof r=="bigint"&&br<=r;function pa(r,t,e){return yr(r)&&yr(t)&&yr(e)&&t<=r&&r<e}function be(r,t,e,n){if(!pa(t,e,n))throw new RangeError("expected valid "+r+": "+e+" <= n < "+n+", got "+t)}function ge(r){if(r<br)throw new Error("expected non-negative bigint, got "+r);let t;for(t=0;r>br;r>>=Rn,t+=1);return t}var He=r=>(Rn<<BigInt(r))-Rn;function gs(r,t,e){if(Ut(r,"hashLen"),Ut(t,"qByteLen"),typeof e!="function")throw new TypeError("hmacFn must be a function");let n=m=>new Uint8Array(m),o=Uint8Array.of(),s=Uint8Array.of(0),i=Uint8Array.of(1),c=1e3,f=n(r),a=n(r),u=0,h=()=>{f.fill(1),a.fill(0),u=0},x=(...m)=>e(a,G(f,...m)),d=(m=o)=>{a=x(s,m),f=x(),m.length!==0&&(a=x(i,m),f=x())},A=()=>{if(u++>=c)throw new Error("drbg: tried max amount of iterations");let m=0,p=[];for(;m<t;){f=x();let w=f.slice();p.push(w),m+=f.length}return G(...p)};return(m,p)=>{h(),d(m);let w;for(;(w=p(A()))===void 0;)d();return h(),w}}function gt(r,t={},e={}){if(Object.prototype.toString.call(r)!=="[object Object]")throw new TypeError("expected valid options object");function n(s,i,c){if(!c&&i!=="function"&&!Object.hasOwn(r,s))throw new TypeError(`param "${s}" is invalid: expected own property`);let f=r[s];if(c&&f===void 0)return;let a=typeof f;if(a!==i||f===null)throw new TypeError(`param "${s}" is invalid: expected ${i}, got ${a}`)}let o=(s,i)=>Object.entries(s).forEach(([c,f])=>n(c,f,i));o(t,!1),o(e,!0)}var Fn=()=>{throw new Error("not implemented")};var et=BigInt(0),z=BigInt(1),Wt=BigInt(2),Ss=BigInt(3),As=BigInt(4),vs=BigInt(5),ma=BigInt(7),Bs=BigInt(8),ya=BigInt(9),Is=BigInt(16);function Z(r,t){if(t<=et)throw new Error("mod: expected positive modulus, got "+t);let e=r%t;return e>=et?e:t+e}function q(r,t,e){if(t<et)throw new Error("pow2: expected non-negative exponent, got "+t);let n=r;for(;t-- >et;)n*=n,n%=e;return n}function xs(r,t){if(r===et)throw new Error("invert: expected non-zero number");if(t<=et)throw new Error("invert: expected positive modulus, got "+t);let e=Z(r,t),n=t,o=et,s=z,i=z,c=et;for(;e!==et;){let a=n/e,u=n-e*a,h=o-i*a,x=s-c*a;n=e,e=u,o=i,s=c,i=h,c=x}if(n!==z)throw new Error("invert: does not exist");return Z(o,t)}function Un(r,t,e){let n=r;if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function Ts(r,t){let e=r,n=(e.ORDER+z)/As,o=e.pow(t,n);return Un(e,o,t),o}function ba(r,t){let e=r,n=(e.ORDER-vs)/Bs,o=e.mul(t,Wt),s=e.pow(o,n),i=e.mul(t,s),c=e.mul(e.mul(i,Wt),s),f=e.mul(i,e.sub(c,e.ONE));return Un(e,f,t),f}function ga(r){let t=xe(r),e=_s(r),n=e(t,t.neg(t.ONE)),o=e(t,n),s=e(t,t.neg(n)),i=(r+ma)/Is;return((c,f)=>{let a=c,u=a.pow(f,i),h=a.mul(u,n),x=a.mul(u,o),d=a.mul(u,s),A=a.eql(a.sqr(h),f),T=a.eql(a.sqr(x),f);u=a.cmov(u,h,A),h=a.cmov(d,x,T);let m=a.eql(a.sqr(h),f),p=a.cmov(u,h,m);return Un(a,p,f),p})}function _s(r){if(r<Ss)throw new Error("sqrt is not defined for small field");let t=r-z,e=0;for(;t%Wt===et;)t/=Wt,e++;let n=Wt,o=xe(r);for(;ws(o,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return Ts;let s=o.pow(n,t),i=(t+z)/Wt;return function(f,a){let u=f;if(u.is0(a))return a;if(ws(u,a)!==1)throw new Error("Cannot find square root");let h=e,x=u.mul(u.ONE,s),d=u.pow(a,t),A=u.pow(a,i);for(;!u.eql(d,u.ONE);){if(u.is0(d))return u.ZERO;let T=1,m=u.sqr(d);for(;!u.eql(m,u.ONE);)if(T++,m=u.sqr(m),T===h)throw new Error("Cannot find square root");let p=z<<BigInt(h-T-1),w=u.pow(x,p);h=T,x=u.sqr(w),d=u.mul(d,x),A=u.mul(A,w)}return A}}function xa(r){return r%As===Ss?Ts:r%Bs===vs?ba:r%Is===ya?ga(r):_s(r)}var Lt=(r,t)=>(Z(r,t)&z)===z,wa=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Nn(r){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=wa.reduce((n,o)=>(n[o]="function",n),t);if(gt(r,e),bt(r.BYTES,"BYTES"),bt(r.BITS,"BITS"),r.BYTES<1||r.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(r.ORDER<=z)throw new Error("invalid field: expected ORDER > 1, got "+r.ORDER);return r}function Ea(r,t,e){let n=r;if(e<et)throw new Error("invalid exponent, negatives unsupported");if(e===et)return n.ONE;if(e===z)return t;let o=n.ONE,s=t;for(;e>et;)e&z&&(o=n.mul(o,s)),s=n.sqr(s),e>>=z;return o}function qe(r,t,e=!1){let n=r,o=new Array(t.length).fill(e?n.ZERO:void 0),s=t.reduce((c,f,a)=>n.is0(f)?c:(o[a]=c,n.mul(c,f)),n.ONE),i=n.inv(s);return t.reduceRight((c,f,a)=>n.is0(f)?c:(o[a]=n.mul(c,o[a]),n.mul(c,f)),i),o}function ws(r,t){let e=r,n=(e.ORDER-z)/Wt,o=e.pow(t,n),s=e.eql(o,e.ONE),i=e.eql(o,e.ZERO),c=e.eql(o,e.neg(e.ONE));if(!s&&!i&&!c)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function Sa(r,t){if(t!==void 0&&Cn(t),r<=et)throw new Error("invalid n length: expected positive n, got "+r);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);let e=ge(r);if(t!==void 0&&t<e)throw new Error(`invalid n length: expected bit length (${e}) >= n.length (${t})`);let n=t!==void 0?t:e,o=Math.ceil(n/8);return{nBitLength:n,nByteLength:o}}var Es=new WeakMap,Er=class{ORDER;BITS;BYTES;isLE;ZERO=et;ONE=z;_lengths;_mod;constructor(t,e={}){if(t<=z)throw new Error("invalid field: expected ORDER > 1, got "+t);let n;this.isLE=!1,e!=null&&typeof e=="object"&&(typeof e.BITS=="number"&&(n=e.BITS),typeof e.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:e.sqrt,enumerable:!0}),typeof e.isLE=="boolean"&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=Object.freeze(e.allowedLengths.slice())),typeof e.modFromBytes=="boolean"&&(this._mod=e.modFromBytes));let{nBitLength:o,nByteLength:s}=Sa(t,n);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=o,this.BYTES=s,Object.freeze(this)}create(t){return Z(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return et<=t&&t<this.ORDER}is0(t){return t===et}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&z)===z}neg(t){return Z(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return Z(t*t,this.ORDER)}add(t,e){return Z(t+e,this.ORDER)}sub(t,e){return Z(t-e,this.ORDER)}mul(t,e){return Z(t*e,this.ORDER)}pow(t,e){return Ea(this,t,e)}div(t,e){return Z(t*xs(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return xs(t,this.ORDER)}sqrt(t){let e=Es.get(this);return e||Es.set(this,e=xa(this.ORDER)),e(this,t)}toBytes(t){return this.isLE?On(t,this.BYTES):xr(t,this.BYTES)}fromBytes(t,e=!1){M(t);let{_lengths:n,BYTES:o,isLE:s,ORDER:i,_mod:c}=this;if(n){if(t.length<1||!n.includes(t.length)||t.length>o)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let a=new Uint8Array(o);a.set(t,s?0:a.length-t.length),t=a}if(t.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+t.length);let f=s?At(t):Xt(t);if(c&&(f=Z(f,i)),!e&&!this.isValid(f))throw new Error("invalid field element: outside of range 0..ORDER");return f}invertBatch(t){return qe(this,t)}cmov(t,e,n){return yt(n,"condition"),n?e:t}};Object.freeze(Er.prototype);function xe(r,t={}){return new Er(r,t)}function Ds(r){if(typeof r!="bigint")throw new Error("field order must be bigint");if(r<=z)throw new Error("field order must be greater than 1");let t=ge(r-z);return Math.ceil(t/8)}function Kn(r){let t=Ds(r);return t+Math.ceil(t/2)}function kn(r,t,e=!1){M(r);let n=r.length,o=Ds(t),s=Math.max(Kn(t),16);if(n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=e?At(r):Xt(r),c=Z(i,t-z)+z;return e?On(c,o):xr(c,o)}var we=BigInt(0),Qt=BigInt(1);function Ve(r,t){let e=t.negate();return r?e:t}function Jt(r,t){let e=qe(r.Fp,t.map(n=>n.Z));return t.map((n,o)=>r.fromAffine(n.toAffine(e[o])))}function Os(r,t){if(!Number.isSafeInteger(r)||r<=0||r>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+r)}function Pn(r,t){Os(r,t);let e=Math.ceil(t/r)+1,n=2**(r-1),o=2**r,s=He(r),i=BigInt(r);return{windows:e,windowSize:n,mask:s,maxNumber:o,shiftBy:i}}function Ls(r,t,e){let{windowSize:n,mask:o,maxNumber:s,shiftBy:i}=e,c=Number(r&o),f=r>>i;c>n&&(c-=s,f+=Qt);let a=t*n,u=a+Math.abs(c)-1,h=c===0,x=c<0,d=t%2!==0;return{nextN:f,offset:u,isZero:h,isNeg:x,isNegF:d,offsetF:a}}var Mn=new WeakMap,Fs=new WeakMap;function Hn(r){return Fs.get(r)||1}function Rs(r){if(r!==we)throw new Error("invalid wNAF")}var Ee=class{BASE;ZERO;Fn;bits;constructor(t,e){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,n=this.ZERO){let o=t;for(;e>we;)e&Qt&&(n=n.add(o)),o=o.double(),e>>=Qt;return n}precomputeWindow(t,e){let{windows:n,windowSize:o}=Pn(e,this.bits),s=[],i=t,c=i;for(let f=0;f<n;f++){c=i,s.push(c);for(let a=1;a<o;a++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,e,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE,i=Pn(t,this.bits);for(let c=0;c<i.windows;c++){let{nextN:f,offset:a,isZero:u,isNeg:h,isNegF:x,offsetF:d}=Ls(n,c,i);n=f,u?s=s.add(Ve(x,e[d])):o=o.add(Ve(h,e[a]))}return Rs(n),{p:o,f:s}}wNAFUnsafe(t,e,n,o=this.ZERO){let s=Pn(t,this.bits);for(let i=0;i<s.windows&&n!==we;i++){let{nextN:c,offset:f,isZero:a,isNeg:u}=Ls(n,i,s);if(n=c,!a){let h=e[f];o=o.add(u?h.negate():h)}}return Rs(n),o}getPrecomputes(t,e,n){let o=Mn.get(e);return o||(o=this.precomputeWindow(e,t),t!==1&&(typeof n=="function"&&(o=n(o)),Mn.set(e,o))),o}cached(t,e,n){let o=Hn(t);return this.wNAF(o,this.getPrecomputes(o,t,n),e)}unsafe(t,e,n,o){let s=Hn(t);return s===1?this._unsafeLadder(t,e,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,n),e,o)}createCache(t,e){Os(e,this.bits),Fs.set(t,e),Mn.delete(t)}hasCache(t){return Hn(t)!==1}};function Us(r,t,e,n){let o=t,s=r.ZERO,i=r.ZERO;for(;e>we||n>we;)e&Qt&&(s=s.add(o)),n&Qt&&(i=i.add(o)),o=o.double(),e>>=Qt,n>>=Qt;return{p1:s,p2:i}}function Cs(r,t,e){if(t){if(t.ORDER!==r)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Nn(t),t}else return xe(r,{isLE:e})}function Sr(r,t,e={},n){if(n===void 0&&(n=r==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${r} CURVE object`);for(let f of["p","n","h"]){let a=t[f];if(!(typeof a=="bigint"&&a>we))throw new Error(`CURVE.${f} must be positive bigint`)}let o=Cs(t.p,e.Fp,n),s=Cs(t.n,e.Fn,n),c=["Gx","Gy","a",r==="weierstrass"?"b":"d"];for(let f of c)if(!o.isValid(t[f]))throw new Error(`CURVE.${f} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}function Ar(r,t){return function(n){let o=r(n);return{secretKey:o,publicKey:t(o)}}}var Pt=BigInt(0),Q=BigInt(1),qn=BigInt(2),Aa=BigInt(8);function va(r,t,e,n){let o=r.sqr(e),s=r.sqr(n),i=r.add(r.mul(t.a,o),s),c=r.add(r.ONE,r.mul(t.d,r.mul(o,s)));return r.eql(i,c)}function Ns(r,t={}){let e=t,n=Sr("edwards",r,e,e.FpFnLE),{Fp:o,Fn:s}=n,i=n.CURVE,{h:c}=i;gt(e,{},{uvRatio:"function"});let f=qn<<BigInt(s.BYTES*8)-Q,a=T=>o.create(T),u=e.uvRatio===void 0?(T,m)=>{try{return{isValid:!0,value:o.sqrt(o.div(T,m))}}catch{return{isValid:!1,value:Pt}}}:e.uvRatio;if(!va(o,i,i.Gx,i.Gy))throw new Error("bad curve params: generator point");function h(T,m,p=!1){let w=p?Q:Pt;return be("coordinate "+T,m,w,f),m}function x(T){if(!(T instanceof d))throw new Error("EdwardsPoint expected")}class d{static BASE=new d(i.Gx,i.Gy,Q,a(i.Gx*i.Gy));static ZERO=new d(Pt,Q,Q,Pt);static Fp=o;static Fn=s;X;Y;Z;T;constructor(m,p,w,v){this.X=h("x",m),this.Y=h("y",p),this.Z=h("z",w,!0),this.T=h("t",v),Object.freeze(this)}static CURVE(){return i}static fromAffine(m){if(m instanceof d)throw new Error("extended point not allowed");let{x:p,y:w}=m||{};return h("x",p),h("y",w),new d(p,w,Q,a(p*w))}static fromBytes(m,p=!1){let w=o.BYTES,{a:v,d:C}=i;m=Me(M(m,w,"point")),yt(p,"zip215");let D=Me(m),U=m[w-1];D[w-1]=U&-129;let R=At(D),B=p?f:o.ORDER;be("point.y",R,Pt,B);let N=a(R*R),K=a(N-Q),F=a(C*N-v),{isValid:l,value:y}=u(K,F);if(!l)throw new Error("bad point: invalid y coordinate");let E=(y&Q)===Q,g=(U&128)!==0;if(!p&&y===Pt&&g)throw new Error("bad point: x=0 and x_0=1");return g!==E&&(y=a(-y)),d.fromAffine({x:y,y:R})}static fromHex(m,p=!1){return d.fromBytes(ye(m),p)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(m=8,p=!0){return A.createCache(this,m),p||this.multiply(qn),this}assertValidity(){let m=this,{a:p,d:w}=i;if(m.is0())throw new Error("bad point: ZERO");let{X:v,Y:C,Z:D,T:U}=m,R=a(v*v),B=a(C*C),N=a(D*D),K=a(N*N),F=a(R*p),l=a(N*a(F+B)),y=a(K+a(w*a(R*B)));if(l!==y)throw new Error("bad point: equation left != right (1)");let E=a(v*C),g=a(D*U);if(E!==g)throw new Error("bad point: equation left != right (2)")}equals(m){x(m);let{X:p,Y:w,Z:v}=this,{X:C,Y:D,Z:U}=m,R=a(p*U),B=a(C*v),N=a(w*U),K=a(D*v);return R===B&&N===K}is0(){return this.equals(d.ZERO)}negate(){return new d(a(-this.X),this.Y,this.Z,a(-this.T))}double(){let{a:m}=i,{X:p,Y:w,Z:v}=this,C=a(p*p),D=a(w*w),U=a(qn*a(v*v)),R=a(m*C),B=p+w,N=a(a(B*B)-C-D),K=R+D,F=K-U,l=R-D,y=a(N*F),E=a(K*l),g=a(N*l),b=a(F*K);return new d(y,E,b,g)}add(m){x(m);let{a:p,d:w}=i,{X:v,Y:C,Z:D,T:U}=this,{X:R,Y:B,Z:N,T:K}=m,F=a(v*R),l=a(C*B),y=a(U*w*K),E=a(D*N),g=a((v+C)*(R+B)-F-l),b=E-y,S=E+y,_=a(l-p*F),I=a(g*b),L=a(S*_),O=a(g*_),P=a(b*S);return new d(I,L,P,O)}subtract(m){return x(m),this.add(m.negate())}multiply(m){if(!s.isValidNot0(m))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p,f:w}=A.cached(this,m,v=>Jt(d,v));return Jt(d,[p,w])[0]}multiplyUnsafe(m){if(!s.isValid(m))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return m===Pt?d.ZERO:this.is0()||m===Q?this:A.unsafe(this,m,p=>Jt(d,p))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return A.unsafe(this,i.n).is0()}toAffine(m){let p=this,w=m,{X:v,Y:C,Z:D}=p,U=p.is0();w==null&&(w=U?Aa:o.inv(D));let R=a(v*w),B=a(C*w),N=o.mul(D,w);if(U)return{x:Pt,y:Q};if(N!==Q)throw new Error("invZ was invalid");return{x:R,y:B}}clearCofactor(){return c===Q?this:this.multiplyUnsafe(c)}toBytes(){let{x:m,y:p}=this.toAffine(),w=o.toBytes(p);return w[w.length-1]|=m&Q?128:0,w}toHex(){return me(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let A=new Ee(d,s.BITS);return s.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}var vr=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(t){this.ep=t}static fromBytes(t){Fn()}static fromHex(t){Fn()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(t){return this.ep.toAffine(t)}toHex(){return me(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(t){return this.assertSame(t),this.init(this.ep.add(t.ep))}subtract(t){return this.assertSame(t),this.init(this.ep.subtract(t.ep))}multiply(t){return this.init(this.ep.multiply(t))}multiplyUnsafe(t){return this.init(this.ep.multiplyUnsafe(t))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(t,e){return this.ep.precompute(t,e),this}};function Ks(r,t,e={}){if(typeof t!="function")throw new Error('"hash" function param is required');let n=t,o=e;gt(o,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",zip215:"boolean",mapToCurve:"function"});let{prehash:s}=o,{BASE:i,Fp:c,Fn:f}=r,a=n.outputLen,u=2*c.BYTES;if(a!==void 0&&(bt(a,"hash.outputLen"),a!==u))throw new Error(`hash.outputLen must be ${u}, got ${a}`);let h=o.randomBytes===void 0?ke:o.randomBytes,x=o.adjustScalarBytes===void 0?l=>l:o.adjustScalarBytes,d=o.domain===void 0?(l,y,E)=>{if(yt(E,"phflag"),y.length||E)throw new Error("Contexts/pre-hash are not supported");return l}:o.domain;function A(l){return f.create(At(l))}function T(l){let y=R.secretKey;M(l,R.secretKey,"secretKey");let E=M(n(l),2*y,"hashedSecretKey"),g=x(E.slice(0,y)),b=E.slice(y,2*y),S=A(g);return{head:g,prefix:b,scalar:S}}function m(l){let{head:y,prefix:E,scalar:g}=T(l),b=i.multiply(g),S=b.toBytes();return{head:y,prefix:E,scalar:g,point:b,pointBytes:S}}function p(l){return m(l).pointBytes}function w(l=Uint8Array.of(),...y){let E=G(...y);return A(n(d(E,M(l,void 0,"context"),!!s)))}function v(l,y,E={}){l=M(l,void 0,"message"),s&&(l=s(l));let{prefix:g,scalar:b,pointBytes:S}=m(y),_=w(E.context,g,l),I=i.multiply(_).toBytes(),L=w(E.context,I,S,l),O=f.create(_+L*b);if(!f.isValid(O))throw new Error("sign failed: invalid s");let P=G(I,f.toBytes(O));return M(P,R.signature,"result")}let C={zip215:o.zip215};function D(l,y,E,g=C){let{context:b}=g,S=g.zip215===void 0?!!C.zip215:g.zip215,_=R.signature;l=M(l,_,"signature"),y=M(y,void 0,"message"),E=M(E,R.publicKey,"publicKey"),S!==void 0&&yt(S,"zip215"),s&&(y=s(y));let I=_/2,L=l.subarray(0,I),O=At(l.subarray(I,_)),P,H,k;try{P=r.fromBytes(E,S),H=r.fromBytes(L,S),k=i.multiplyUnsafe(O)}catch{return!1}if(!S&&P.isSmallOrder())return!1;let Y=w(b,L,E,y);return H.add(P.multiplyUnsafe(Y)).subtract(k).clearCofactor().is0()}let U=c.BYTES,R={secretKey:U,publicKey:U,signature:2*U,seed:U};function B(l){return l=l===void 0?h(R.seed):l,M(l,R.seed,"seed")}function N(l){return Gt(l)&&l.length===R.secretKey}function K(l,y){try{return!!r.fromBytes(l,y===void 0?C.zip215:y)}catch{return!1}}let F={getExtendedPublicKey:m,randomSecretKey:B,isValidSecretKey:N,isValidPublicKey:K,toMontgomery(l){let{y}=r.fromBytes(l),E=R.publicKey,g=E===32;if(!g&&E!==57)throw new Error("only defined for 25519 and 448");let b=g?c.div(Q+y,Q-y):c.div(y-Q,y+Q);return c.toBytes(b)},toMontgomerySecret(l){let y=R.secretKey;M(l,y);let E=n(l.subarray(0,y));return x(E).subarray(0,y)}};return Object.freeze(R),Object.freeze(F),Object.freeze({keygen:Ar(B,p),getPublicKey:p,sign:v,verify:D,utils:F,Point:r,lengths:R})}function ze(r,t){if(bt(r),bt(t),t<0||t>4)throw new Error("invalid I2OSP length: "+t);if(r<0||r>2**(8*t)-1)throw new Error("invalid I2OSP input: "+r);let e=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)e[n]=r&255,r>>>=8;return new Uint8Array(e)}function Ba(r,t){let e=new Uint8Array(r.length);for(let n=0;n<r.length;n++)e[n]=r[n]^t[n];return e}function Ia(r){if(!Gt(r)&&typeof r!="string")throw new Error("DST must be Uint8Array or ascii string");let t=typeof r=="string"?wr(r):r;if(t.length===0)throw new Error("DST must be non-empty");return t}function Vn(r,t,e,n){M(r),bt(e),t=Ia(t),t.length>255&&(t=n(G(wr("H2C-OVERSIZE-DST-"),t)));let{outputLen:o,blockLen:s}=n,i=Math.ceil(e/o);if(e>65535||i>255)throw new Error("expand_message_xmd: invalid lenInBytes");let c=G(t,ze(t.length,1)),f=new Uint8Array(s),a=ze(e,2),u=new Array(i),h=n(G(f,r,a,ze(0,1),c));u[0]=n(G(h,ze(1,1),c));for(let d=1;d<i;d++){let A=[Ba(h,u[d-1]),ze(d+1,1),c];u[d]=n(G(...A))}return G(...u).slice(0,e)}var ks="HashToScalar-";var Ta=BigInt(0),Rt=BigInt(1),Ps=BigInt(2);var _a=BigInt(5),Da=BigInt(8),Se=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),$n={p:Se,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Da,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function La(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),s=Se,c=r*r%s*r%s,f=q(c,Ps,s)*c%s,a=q(f,Rt,s)*r%s,u=q(a,_a,s)*a%s,h=q(u,t,s)*u%s,x=q(h,e,s)*h%s,d=q(x,n,s)*x%s,A=q(d,o,s)*d%s,T=q(A,o,s)*d%s,m=q(T,t,s)*u%s;return{pow_p_5_8:q(m,Ps,s)*r%s,b2:c}}function Ra(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}var zn=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Yn(r,t){let e=Se,n=Z(t*t*t,e),o=Z(n*n*t,e),s=La(r*o).pow_p_5_8,i=Z(r*n*s,e),c=Z(t*i*i,e),f=i,a=Z(i*zn,e),u=c===r,h=c===Z(-r,e),x=c===Z(-r*zn,e);return u&&(i=f),(h||x)&&(i=a),Lt(i,e)&&(i=Z(-i,e)),{isValid:u||h,value:i}}var Ht=Ns($n,{uvRatio:Yn}),Mt=Ht.Fp,qs=Ht.Fn;function Ca(r){return Ks(Ht,mr,Object.assign({adjustScalarBytes:Ra,zip215:!0},r))}var Vs=Ca({});var jn=zn,Oa=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Fa=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Ua=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Na=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),Ms=r=>Yn(Rt,r),Ka=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Zn=r=>Mt.create(At(r)&Ka);function Hs(r){let{d:t}=$n,e=Se,n=p=>Mt.create(p),o=n(jn*r*r),s=n((o+Rt)*Ua),i=BigInt(-1),c=n((i-t*o)*n(o+t)),{isValid:f,value:a}=Yn(s,c),u=n(a*r);Lt(u,e)||(u=n(-u)),f||(a=u),f||(i=o);let h=n(i*(o-Rt)*Na-c),x=a*a,d=n((a+a)*c),A=n(h*Oa),T=n(Rt-x),m=n(Rt+x);return new Ht(n(d*m),n(T*A),n(A*m),n(d*T))}var qt=class r extends vr{static BASE=new r(Ht.BASE);static ZERO=new r(Ht.ZERO);static Fp=Mt;static Fn=qs;constructor(t){super(t)}static fromAffine(t){return new r(Ht.fromAffine(t))}assertSame(t){if(!(t instanceof r))throw new Error("RistrettoPoint expected")}init(t){return new r(t)}static fromBytes(t){ut(t,32);let{a:e,d:n}=$n,o=Se,s=C=>Mt.create(C),i=Zn(t);if(!bs(Mt.toBytes(i),t)||Lt(i,o))throw new Error("invalid ristretto255 encoding 1");let c=s(i*i),f=s(Rt+e*c),a=s(Rt-e*c),u=s(f*f),h=s(a*a),x=s(e*n*u-h),{isValid:d,value:A}=Ms(s(x*h)),T=s(A*a),m=s(A*T*x),p=s((i+i)*T);Lt(p,o)&&(p=s(-p));let w=s(f*m),v=s(p*w);if(!d||Lt(v,o)||w===Ta)throw new Error("invalid ristretto255 encoding 2");return new r(new Ht(p,w,Rt,v))}static fromHex(t){return r.fromBytes(Fe(t))}toBytes(){let{X:t,Y:e,Z:n,T:o}=this.ep,s=Se,i=m=>Mt.create(m),c=i(i(n+e)*i(n-e)),f=i(t*e),a=i(f*f),{value:u}=Ms(i(c*a)),h=i(u*c),x=i(u*f),d=i(h*x*o),A;if(Lt(o*d,s)){let m=i(e*jn),p=i(t*jn);t=m,e=p,A=i(h*Fa)}else A=x;Lt(t*d,s)&&(e=i(-e));let T=i((n-e)*A);return Lt(T,s)&&(T=i(-T)),Mt.toBytes(T)}equals(t){this.assertSame(t);let{X:e,Y:n}=this.ep,{X:o,Y:s}=t.ep,i=a=>Mt.create(a),c=i(e*s)===i(n*o),f=i(n*s)===i(e*o);return c||f}is0(){return this.equals(r.ZERO)}};Object.freeze(qt.BASE);Object.freeze(qt.ZERO);Object.freeze(qt.prototype);Object.freeze(qt);var ka=Object.freeze({Point:qt,hashToCurve(r,t){let e=t?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":t.DST,n=Vn(r,e,64,mr);return ka.deriveToCurve(n)},hashToScalar(r,t={DST:ks}){let e=Vn(r,t.DST,64,mr);return qs.create(At(e))},deriveToCurve(r){ut(r,64);let t=Zn(r.subarray(0,32)),e=Hs(t),n=Zn(r.subarray(32,64)),o=Hs(n);return new qt(e.add(o))}});var je=class extends Error{constructor(t="An error occurred while verifying a message"){super(t),this.name="VerificationError"}},Br=class extends Error{constructor(t="Missing Web Crypto API"){super(t),this.name="WebCryptoMissingError"}};var Ir={get(r=globalThis){let t=r.crypto;if(t?.subtle==null)throw new Br("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api");return t}};var Tr=32;var Gn,Pa=(async()=>{try{return await Ir.get().subtle.generateKey({name:"Ed25519"},!0,["sign","verify"]),!0}catch{return!1}})();async function Ma(r,t,e){if(r.buffer instanceof ArrayBuffer){let n=await Ir.get().subtle.importKey("raw",r.buffer,{name:"Ed25519"},!1,["verify"]);return await Ir.get().subtle.verify({name:"Ed25519"},n,Ot(t),Ot(e instanceof Uint8Array?e:e.subarray()))}throw new TypeError("WebCrypto does not support SharedArrayBuffer for Ed25519 keys")}function Ha(r,t,e){return Vs.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}async function zs(r,t,e){return Gn==null&&(Gn=await Pa),Gn?Ma(r,t,e):Ha(r,t,e)}function _r(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}var Dr=class{type="Ed25519";raw;constructor(t){this.raw=Xn(t,Tr)}toMultihash(){return dt.digest(de(this))}toCID(){return J.createV1(114,this.toMultihash())}toString(){return $.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:pt(this.raw,t.raw)}verify(t,e,n){n?.signal?.throwIfAborted();let o=zs(this.raw,e,t);return _r(o)?o.then(s=>(n?.signal?.throwIfAborted(),s)):o}};function Zs(r){return r=Xn(r,Tr),new Dr(r)}function Xn(r,t){if(r=Uint8Array.from(r??[]),r.length!==t)throw new Et(`Key must be a Uint8Array of length ${t}, got ${r.length}`);return r}var Va=Math.pow(2,7),za=Math.pow(2,14),ja=Math.pow(2,21),$s=Math.pow(2,28),Ys=Math.pow(2,35),Gs=Math.pow(2,42),Xs=Math.pow(2,49),nt=128,Vt=127;function Ze(r){if(r<Va)return 1;if(r<za)return 2;if(r<ja)return 3;if(r<$s)return 4;if(r<Ys)return 5;if(r<Gs)return 6;if(r<Xs)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Ws(r,t,e=0){switch(Ze(r)){case 8:t[e++]=r&255|nt,r/=128;case 7:t[e++]=r&255|nt,r/=128;case 6:t[e++]=r&255|nt,r/=128;case 5:t[e++]=r&255|nt,r/=128;case 4:t[e++]=r&255|nt,r>>>=7;case 3:t[e++]=r&255|nt,r>>>=7;case 2:t[e++]=r&255|nt,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Qs(r,t){let e=r[t],n=0;if(n+=e&Vt,e<nt||(e=r[t+1],n+=(e&Vt)<<7,e<nt)||(e=r[t+2],n+=(e&Vt)<<14,e<nt)||(e=r[t+3],n+=(e&Vt)<<21,e<nt)||(e=r[t+4],n+=(e&Vt)*$s,e<nt)||(e=r[t+5],n+=(e&Vt)*Ys,e<nt)||(e=r[t+6],n+=(e&Vt)*Gs,e<nt)||(e=r[t+7],n+=(e&Vt)*Xs,e<nt))return n;throw new RangeError("Could not decode varint")}var Wn=new Float32Array([-0]),zt=new Uint8Array(Wn.buffer);function Js(r,t,e){Wn[0]=r,t[e]=zt[0],t[e+1]=zt[1],t[e+2]=zt[2],t[e+3]=zt[3]}function ti(r,t){return zt[0]=r[t],zt[1]=r[t+1],zt[2]=r[t+2],zt[3]=r[t+3],Wn[0]}var Qn=new Float64Array([-0]),rt=new Uint8Array(Qn.buffer);function ei(r,t,e){Qn[0]=r,t[e]=rt[0],t[e+1]=rt[1],t[e+2]=rt[2],t[e+3]=rt[3],t[e+4]=rt[4],t[e+5]=rt[5],t[e+6]=rt[6],t[e+7]=rt[7]}function ri(r,t){return rt[0]=r[t],rt[1]=r[t+1],rt[2]=r[t+2],rt[3]=r[t+3],rt[4]=r[t+4],rt[5]=r[t+5],rt[6]=r[t+6],rt[7]=r[t+7],Qn[0]}var Za=BigInt(Number.MAX_SAFE_INTEGER),$a=BigInt(Number.MIN_SAFE_INTEGER),ht=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return te;if(t<Za&&t>$a)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>ni&&(o=0n,++n>ni&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return te;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):te}},te=new ht(0,0);te.toBigInt=function(){return 0n};te.zzEncode=te.zzDecode=function(){return this};te.length=function(){return 1};var ni=4294967296n;function oi(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function si(r,t,e){if(e-t<1)return"";let o,s=[],i=0,c;for(;t<e;)c=r[t++],c<128?s[i++]=c:c>191&&c<224?s[i++]=(c&31)<<6|r[t++]&63:c>239&&c<365?(c=((c&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,s[i++]=55296+(c>>10),s[i++]=56320+(c&1023)):s[i++]=(c&15)<<12|(r[t++]&63)<<6|r[t++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function Jn(r,t,e){let n=e,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function xt(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function Lr(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var to=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=Ot(t),this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,xt(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw xt(this,4);return Lr(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw xt(this,4);return Lr(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw xt(this,4);let t=ti(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw xt(this,4);let t=ri(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw xt(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return si(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw xt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw xt(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new ht(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw xt(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw xt(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw xt(this,8);let t=Lr(this.buf,this.pos+=4),e=Lr(this.buf,this.pos+=4);return new ht(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=Qs(this.buf,this.pos);return this.pos+=Ze(t),t}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 $e(r){return new to(r instanceof Uint8Array?r:r.subarray())}function Rr(r,t,e){let n=$e(r);return t.decode(n,void 0,e)}function eo(r){let t=r??8192,e=t>>>1,n,o=t;return function(i){if(i<1||i>e)return at(i);o+i>t&&(n=at(t),o=0);let c=n.subarray(o,o+=i);return(o&7)!==0&&(o=(o|7)+1),c}}var ee=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function ro(){}var oo=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Ya=eo();function Ga(r){return globalThis.Buffer!=null?at(r):Ya(r)}var Ge=class{len;head;tail;states;constructor(){this.len=0,this.head=new ee(ro,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new ee(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new so((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(Cr,10,ht.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=ht.fromBigInt(t);return this._push(Cr,e.length(),e)}uint64Number(t){return this._push(Ws,Ze(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=ht.fromBigInt(t).zzEncode();return this._push(Cr,e.length(),e)}sint64Number(t){let e=ht.fromNumber(t).zzEncode();return this._push(Cr,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(no,1,t?1:0)}fixed32(t){return this._push(Ye,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=ht.fromBigInt(t);return this._push(Ye,4,e.lo)._push(Ye,4,e.hi)}fixed64Number(t){let e=ht.fromNumber(t);return this._push(Ye,4,e.lo)._push(Ye,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(Js,4,t)}double(t){return this._push(ei,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(no,1,0):this.uint32(e)._push(Wa,e,t)}string(t){let e=oi(t);return e!==0?this.uint32(e)._push(Jn,e,t):this._push(no,1,0)}fork(){return this.states=new oo(this),this.head=this.tail=new ee(ro,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 ee(ro,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=Ga(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function no(r,t,e){t[e]=r&255}function Xa(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var so=class extends ee{next;constructor(t,e){super(Xa,t,e),this.next=void 0}};function Cr(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function Ye(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function Wa(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Ge.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(Qa,t,r),this},Ge.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(Ja,t,r),this});function Qa(r,t,e){t.set(r,e)}function Ja(r,t,e){r.length<40?Jn(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Ft(r),e)}function io(){return new Ge}function Or(r,t){let e=io();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}function*Fr(r,t,e){let n=$e(r);yield*t.stream(n,void 0,"$",e)}var Ur={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5};function Nr(r,t,e,n,o){return{name:r,type:t,encode:e,decode:n,stream:o}}function co(r){function t(s){if(r[s.toString()]==null)throw new Error("Invalid enum value");return r[s]}let e=function(i,c){let f=t(i);c.int32(f)},n=function(i){let c=i.int32();return t(c)},o=function*(i){let c=i.int32();yield t(c)};return Nr("enum",Ur.VARINT,e,n,o)}function Kr(r,t,e){return Nr("message",Ur.LENGTH_DELIMITED,r,t,e)}var ot;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1",r.ECDSA="ECDSA"})(ot||(ot={}));var ao;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1",r[r.ECDSA=3]="ECDSA"})(ao||(ao={}));(function(r){r.codec=()=>co(ao)})(ot||(ot={}));var Xe;(function(r){let t;r.codec=()=>(t==null&&(t=Kr((s,i,c={})=>{c.lengthDelimited!==!1&&i.fork(),s.Type!=null&&(i.uint32(8),ot.codec().encode(s.Type,i)),s.Data!=null&&(i.uint32(18),i.bytes(s.Data)),c.lengthDelimited!==!1&&i.ldelim()},(s,i,c={})=>{let f={},a=i==null?s.len:s.pos+i;for(;s.pos<a;){let u=s.uint32();switch(u>>>3){case 1:{f.Type=ot.codec().decode(s);break}case 2:{f.Data=s.bytes();break}default:{s.skipType(u&7);break}}}return f},function*(s,i,c,f={}){let a=i==null?s.len:s.pos+i;for(;s.pos<a;){let u=s.uint32();switch(u>>>3){case 1:{yield{field:`${c}.Type`,value:ot.codec().decode(s)};break}case 2:{yield{field:`${c}.Data`,value:s.bytes()};break}default:{s.skipType(u&7);break}}}})),t);function e(s){return Or(s,r.codec())}r.encode=e;function n(s,i){return Rr(s,r.codec(),i)}r.decode=n;function o(s,i){return Fr(s,r.codec(),i)}r.stream=o})(Xe||(Xe={}));var fo;(function(r){let t;r.codec=()=>(t==null&&(t=Kr((s,i,c={})=>{c.lengthDelimited!==!1&&i.fork(),s.Type!=null&&(i.uint32(8),ot.codec().encode(s.Type,i)),s.Data!=null&&(i.uint32(18),i.bytes(s.Data)),c.lengthDelimited!==!1&&i.ldelim()},(s,i,c={})=>{let f={},a=i==null?s.len:s.pos+i;for(;s.pos<a;){let u=s.uint32();switch(u>>>3){case 1:{f.Type=ot.codec().decode(s);break}case 2:{f.Data=s.bytes();break}default:{s.skipType(u&7);break}}}return f},function*(s,i,c,f={}){let a=i==null?s.len:s.pos+i;for(;s.pos<a;){let u=s.uint32();switch(u>>>3){case 1:{yield{field:`${c}.Type`,value:ot.codec().decode(s)};break}case 2:{yield{field:`${c}.Data`,value:s.bytes()};break}default:{s.skipType(u&7);break}}}})),t);function e(s){return Or(s,r.codec())}r.encode=e;function n(s,i){return Rr(s,r.codec(),i)}r.decode=n;function o(s,i){return Fr(s,r.codec(),i)}r.stream=o})(fo||(fo={}));var kr=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,e){if(ur(t),ut(e,void 0,"key"),this.iHash=t.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 n=this.blockLen,o=new Uint8Array(n);o.set(e.length>n?t.create().update(e).digest():e);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=t.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),_t(o)}update(t){return pe(this),this.iHash.update(t),this}digestInto(t){pe(this),hr(t,this),this.finished=!0;let e=t.subarray(0,this.outputLen);this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:e,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},ci=(()=>{let r=((t,e,n)=>new kr(t,e).update(n).digest());return r.create=(t,e)=>new kr(t,e),r})();var ai=(r,t)=>(r+(r>=0?t:-t)/fi)/t;function ef(r,t,e){be("scalar",r,vt,e);let[[n,o],[s,i]]=t,c=ai(i*r,e),f=ai(-o*r,e),a=r-c*n-f*s,u=-c*o-f*i,h=a<vt,x=u<vt;h&&(a=-a),x&&(u=-u);let d=He(Math.ceil(ge(e)/2))+jt;if(a<vt||a>=d||u<vt||u>=d)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:h,k1:a,k2neg:x,k2:u}}function ho(r){if(!["compact","recovered","der"].includes(r))throw new Error('Signature format must be "compact", "recovered", or "der"');return r}function uo(r,t){gt(r);let e={};for(let n of Object.keys(t))e[n]=r[n]===void 0?t[n]:r[n];return yt(e.lowS,"lowS"),yt(e.prehash,"prehash"),e.format!==void 0&&ho(e.format),e}var lo=class extends Error{constructor(t=""){super(t)}},wt={Err:lo,_tlv:{encode:(r,t)=>{let{Err:e}=wt;if(bt(r,"tag"),r<0||r>255)throw new e("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new e("tlv.encode: unpadded data");let n=t.length/2,o=Pe(n);if(o.length/2&128)throw new e("tlv.encode: long form length too big");let s=n>127?Pe(o.length/2|128):"";return Pe(r)+s+o+t},decode(r,t){let{Err:e}=wt;t=M(t,void 0,"DER data");let n=0;if(r<0||r>255)throw new e("tlv.encode: wrong tag");if(t.length<2||t[n++]!==r)throw new e("tlv.decode: wrong tlv");let o=t[n++],s=!!(o&128),i=0;if(!s)i=o;else{let f=o&127;if(!f)throw new e("tlv.decode(long): indefinite length not supported");if(f>4)throw new e("tlv.decode(long): byte length is too big");let a=t.subarray(n,n+f);if(a.length!==f)throw new e("tlv.decode: length bytes not complete");if(a[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(let u of a)i=i<<8|u;if(n+=f,i<128)throw new e("tlv.decode(long): not minimal encoding")}let c=t.subarray(n,n+i);if(c.length!==i)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(n+i)}}},_int:{encode(r){let{Err:t}=wt;if(gr(r),r<vt)throw new t("integer: negative integers are not allowed");let e=Pe(r);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(r){let{Err:t}=wt;if(r.length<1)throw new t("invalid signature integer: empty");if(r[0]&128)throw new t("invalid signature integer: negative");if(r.length>1&&r[0]===0&&!(r[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Xt(r)}},toSig(r){let{Err:t,_int:e,_tlv:n}=wt,o=M(r,void 0,"signature"),{v:s,l:i}=n.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");let{v:c,l:f}=n.decode(2,s),{v:a,l:u}=n.decode(2,f);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(c),s:e.decode(a)}},hexFromSig(r){let{_tlv:t,_int:e}=wt,n=t.encode(2,e.encode(r.r)),o=t.encode(2,e.encode(r.s)),s=n+o;return t.encode(48,s)}};Object.freeze(wt._tlv);Object.freeze(wt._int);Object.freeze(wt);var vt=BigInt(0),jt=BigInt(1),fi=BigInt(2),Pr=BigInt(3),rf=BigInt(4);function ui(r,t={}){let e=Sr("weierstrass",r,t),n=e.Fp,o=e.Fn,s=e.CURVE,{h:i,n:c}=s;gt(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:f,allowInfinityPoint:a}=t;if(f&&(!n.is0(s.a)||typeof f.beta!="bigint"||!Array.isArray(f.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let u=li(n,o);function h(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function x(F,l,y){if(a&&l.is0())return Uint8Array.of(0);let{x:E,y:g}=l.toAffine(),b=n.toBytes(E);if(yt(y,"isCompressed"),y){h();let S=!n.isOdd(g);return G(hi(S),b)}else return G(Uint8Array.of(4),b,n.toBytes(g))}function d(F){M(F,void 0,"Point");let{publicKey:l,publicKeyUncompressed:y}=u,E=F.length,g=F[0],b=F.subarray(1);if(a&&E===1&&g===0)return{x:n.ZERO,y:n.ZERO};if(E===l&&(g===2||g===3)){let S=n.fromBytes(b);if(!n.isValid(S))throw new Error("bad point: is not on curve, wrong x");let _=m(S),I;try{I=n.sqrt(_)}catch(P){let H=P instanceof Error?": "+P.message:"";throw new Error("bad point: is not on curve, sqrt error"+H)}h();let L=n.isOdd(I);return(g&1)===1!==L&&(I=n.neg(I)),{x:S,y:I}}else if(E===y&&g===4){let S=n.BYTES,_=n.fromBytes(b.subarray(0,S)),I=n.fromBytes(b.subarray(S,S*2));if(!p(_,I))throw new Error("bad point: is not on curve");return{x:_,y:I}}else throw new Error(`bad point: got length ${E}, expected compressed=${l} or uncompressed=${y}`)}let A=t.toBytes===void 0?x:t.toBytes,T=t.fromBytes===void 0?d:t.fromBytes;function m(F){let l=n.sqr(F),y=n.mul(l,F);return n.add(n.add(y,n.mul(F,s.a)),s.b)}function p(F,l){let y=n.sqr(l),E=m(F);return n.eql(y,E)}if(!p(s.Gx,s.Gy))throw new Error("bad curve params: generator point");let w=n.mul(n.pow(s.a,Pr),rf),v=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(w,v)))throw new Error("bad curve params: a or b");function C(F,l,y=!1){if(!n.isValid(l)||y&&n.is0(l))throw new Error(`bad point coordinate ${F}`);return l}function D(F){if(!(F instanceof B))throw new Error("Weierstrass Point expected")}function U(F){if(!f||!f.basises)throw new Error("no endo");return ef(F,f.basises,o.ORDER)}function R(F,l,y,E,g){return y=new B(n.mul(y.X,F),y.Y,y.Z),l=Ve(E,l),y=Ve(g,y),l.add(y)}class B{static BASE=new B(s.Gx,s.Gy,n.ONE);static ZERO=new B(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=o;X;Y;Z;constructor(l,y,E){this.X=C("x",l),this.Y=C("y",y,!0),this.Z=C("z",E),Object.freeze(this)}static CURVE(){return s}static fromAffine(l){let{x:y,y:E}=l||{};if(!l||!n.isValid(y)||!n.isValid(E))throw new Error("invalid affine point");if(l instanceof B)throw new Error("projective point not allowed");return n.is0(y)&&n.is0(E)?B.ZERO:new B(y,E,n.ONE)}static fromBytes(l){let y=B.fromAffine(T(M(l,void 0,"point")));return y.assertValidity(),y}static fromHex(l){return B.fromBytes(ye(l))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(l=8,y=!0){return K.createCache(this,l),y||this.multiply(Pr),this}assertValidity(){let l=this;if(l.is0()){if(t.allowInfinityPoint&&n.is0(l.X)&&n.eql(l.Y,n.ONE)&&n.is0(l.Z))return;throw new Error("bad point: ZERO")}let{x:y,y:E}=l.toAffine();if(!n.isValid(y)||!n.isValid(E))throw new Error("bad point: x or y not field elements");if(!p(y,E))throw new Error("bad point: equation left != right");if(!l.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:l}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(l)}equals(l){D(l);let{X:y,Y:E,Z:g}=this,{X:b,Y:S,Z:_}=l,I=n.eql(n.mul(y,_),n.mul(b,g)),L=n.eql(n.mul(E,_),n.mul(S,g));return I&&L}negate(){return new B(this.X,n.neg(this.Y),this.Z)}double(){let{a:l,b:y}=s,E=n.mul(y,Pr),{X:g,Y:b,Z:S}=this,_=n.ZERO,I=n.ZERO,L=n.ZERO,O=n.mul(g,g),P=n.mul(b,b),H=n.mul(S,S),k=n.mul(g,b);return k=n.add(k,k),L=n.mul(g,S),L=n.add(L,L),_=n.mul(l,L),I=n.mul(E,H),I=n.add(_,I),_=n.sub(P,I),I=n.add(P,I),I=n.mul(_,I),_=n.mul(k,_),L=n.mul(E,L),H=n.mul(l,H),k=n.sub(O,H),k=n.mul(l,k),k=n.add(k,L),L=n.add(O,O),O=n.add(L,O),O=n.add(O,H),O=n.mul(O,k),I=n.add(I,O),H=n.mul(b,S),H=n.add(H,H),O=n.mul(H,k),_=n.sub(_,O),L=n.mul(H,P),L=n.add(L,L),L=n.add(L,L),new B(_,I,L)}add(l){D(l);let{X:y,Y:E,Z:g}=this,{X:b,Y:S,Z:_}=l,I=n.ZERO,L=n.ZERO,O=n.ZERO,P=s.a,H=n.mul(s.b,Pr),k=n.mul(y,b),Y=n.mul(E,S),X=n.mul(g,_),W=n.add(y,E),j=n.add(b,S);W=n.mul(W,j),j=n.add(k,Y),W=n.sub(W,j),j=n.add(y,g);let st=n.add(b,_);return j=n.mul(j,st),st=n.add(k,X),j=n.sub(j,st),st=n.add(E,g),I=n.add(S,_),st=n.mul(st,I),I=n.add(Y,X),st=n.sub(st,I),O=n.mul(P,j),I=n.mul(H,X),O=n.add(I,O),I=n.sub(Y,O),O=n.add(Y,O),L=n.mul(I,O),Y=n.add(k,k),Y=n.add(Y,k),X=n.mul(P,X),j=n.mul(H,j),Y=n.add(Y,X),X=n.sub(k,X),X=n.mul(P,X),j=n.add(j,X),k=n.mul(Y,j),L=n.add(L,k),k=n.mul(st,j),I=n.mul(W,I),I=n.sub(I,k),k=n.mul(W,Y),O=n.mul(st,O),O=n.add(O,k),new B(I,L,O)}subtract(l){return D(l),this.add(l.negate())}is0(){return this.equals(B.ZERO)}multiply(l){let{endo:y}=t;if(!o.isValidNot0(l))throw new RangeError("invalid scalar: out of range");let E,g,b=S=>K.cached(this,S,_=>Jt(B,_));if(y){let{k1neg:S,k1:_,k2neg:I,k2:L}=U(l),{p:O,f:P}=b(_),{p:H,f:k}=b(L);g=P.add(k),E=R(y.beta,O,H,S,I)}else{let{p:S,f:_}=b(l);E=S,g=_}return Jt(B,[E,g])[0]}multiplyUnsafe(l){let{endo:y}=t,E=this,g=l;if(!o.isValid(g))throw new RangeError("invalid scalar: out of range");if(g===vt||E.is0())return B.ZERO;if(g===jt)return E;if(K.hasCache(this))return this.multiply(g);if(y){let{k1neg:b,k1:S,k2neg:_,k2:I}=U(g),{p1:L,p2:O}=Us(B,E,S,I);return R(y.beta,L,O,b,_)}else return K.unsafe(E,g)}toAffine(l){let y=this,E=l,{X:g,Y:b,Z:S}=y;if(n.eql(S,n.ONE))return{x:g,y:b};let _=y.is0();E==null&&(E=_?n.ONE:n.inv(S));let I=n.mul(g,E),L=n.mul(b,E),O=n.mul(S,E);if(_)return{x:n.ZERO,y:n.ZERO};if(!n.eql(O,n.ONE))throw new Error("invZ was invalid");return{x:I,y:L}}isTorsionFree(){let{isTorsionFree:l}=t;return i===jt?!0:l?l(B,this):K.unsafe(this,c).is0()}clearCofactor(){let{clearCofactor:l}=t;return i===jt?this:l?l(B,this):this.multiplyUnsafe(i)}isSmallOrder(){return i===jt?this.is0():this.clearCofactor().is0()}toBytes(l=!0){return yt(l,"isCompressed"),this.assertValidity(),A(B,this,l)}toHex(l=!0){return me(this.toBytes(l))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let N=o.BITS,K=new Ee(B,t.endo?Math.ceil(N/2):N);return N>=8&&B.BASE.precompute(8),Object.freeze(B.prototype),Object.freeze(B),B}function hi(r){return Uint8Array.of(r?2:3)}function li(r,t){return{secretKey:t.BYTES,publicKey:1+r.BYTES,publicKeyUncompressed:1+2*r.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function nf(r,t={}){let{Fn:e}=r,n=t.randomBytes===void 0?ke:t.randomBytes,o=Object.assign(li(r.Fp,e),{seed:Math.max(Kn(e.ORDER),16)});function s(d){try{let A=e.fromBytes(d);return e.isValidNot0(A)}catch{return!1}}function i(d,A){let{publicKey:T,publicKeyUncompressed:m}=o;try{let p=d.length;return A===!0&&p!==T||A===!1&&p!==m?!1:!!r.fromBytes(d)}catch{return!1}}function c(d){return d=d===void 0?n(o.seed):d,kn(M(d,o.seed,"seed"),e.ORDER)}function f(d,A=!0){return r.BASE.multiply(e.fromBytes(d)).toBytes(A)}function a(d){let{secretKey:A,publicKey:T,publicKeyUncompressed:m}=o,p=e._lengths;if(!Gt(d))return;let w=M(d,void 0,"key").length,v=w===T||w===m,C=w===A||!!p?.includes(w);if(!(v&&C))return v}function u(d,A,T=!0){if(a(d)===!0)throw new Error("first arg must be private key");if(a(A)===!1)throw new Error("second arg must be public key");let m=e.fromBytes(d);return r.fromBytes(A).multiply(m).toBytes(T)}let h={isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c},x=Ar(c,f);return Object.freeze(h),Object.freeze(o),Object.freeze({getPublicKey:f,getSharedSecret:u,keygen:x,Point:r,utils:h,lengths:o})}function di(r,t,e={}){let n=t;ur(n),gt(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),e=Object.assign({},e);let o=e.randomBytes===void 0?ke:e.randomBytes,s=e.hmac===void 0?(g,b)=>ci(n,g,b):e.hmac,{Fp:i,Fn:c}=r,{ORDER:f,BITS:a}=c,{keygen:u,getPublicKey:h,getSharedSecret:x,utils:d,lengths:A}=nf(r,e),T={prehash:!0,lowS:typeof e.lowS=="boolean"?e.lowS:!0,format:"compact",extraEntropy:!1},m=f*fi+jt<i.ORDER;function p(g){let b=f>>jt;return g>b}function w(g,b){if(!c.isValidNot0(b))throw new Error(`invalid signature ${g}: out of range 1..Point.Fn.ORDER`);return b}function v(){if(m)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function C(g,b){ho(b);let S=A.signature,_=b==="compact"?S:b==="recovered"?S+1:void 0;return M(g,_)}class D{r;s;recovery;constructor(b,S,_){if(this.r=w("r",b),this.s=w("s",S),_!=null){if(v(),![0,1,2,3].includes(_))throw new Error("invalid recovery id");this.recovery=_}Object.freeze(this)}static fromBytes(b,S=T.format){C(b,S);let _;if(S==="der"){let{r:P,s:H}=wt.toSig(M(b));return new D(P,H)}S==="recovered"&&(_=b[0],S="compact",b=b.subarray(1));let I=A.signature/2,L=b.subarray(0,I),O=b.subarray(I,I*2);return new D(c.fromBytes(L),c.fromBytes(O),_)}static fromHex(b,S){return this.fromBytes(ye(b),S)}assertRecovery(){let{recovery:b}=this;if(b==null)throw new Error("invalid recovery id: must be present");return b}addRecoveryBit(b){return new D(this.r,this.s,b)}recoverPublicKey(b){let{r:S,s:_}=this,I=this.assertRecovery(),L=I===2||I===3?S+f:S;if(!i.isValid(L))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let O=i.toBytes(L),P=r.fromBytes(G(hi((I&1)===0),O)),H=c.inv(L),k=R(M(b,void 0,"msgHash")),Y=c.create(-k*H),X=c.create(_*H),W=r.BASE.multiplyUnsafe(Y).add(P.multiplyUnsafe(X));if(W.is0())throw new Error("invalid recovery: point at infinify");return W.assertValidity(),W}hasHighS(){return p(this.s)}toBytes(b=T.format){if(ho(b),b==="der")return ye(wt.hexFromSig(this));let{r:S,s:_}=this,I=c.toBytes(S),L=c.toBytes(_);return b==="recovered"?(v(),G(Uint8Array.of(this.assertRecovery()),I,L)):G(I,L)}toHex(b){return me(this.toBytes(b))}}Object.freeze(D.prototype),Object.freeze(D);let U=e.bits2int===void 0?function(b){if(b.length>8192)throw new Error("input is too large");let S=Xt(b),_=b.length*8-a;return _>0?S>>BigInt(_):S}:e.bits2int,R=e.bits2int_modN===void 0?function(b){return c.create(U(b))}:e.bits2int_modN,B=He(a);function N(g){return be("num < 2^"+a,g,vt,B),c.toBytes(g)}function K(g,b){return M(g,void 0,"message"),b?M(n(g),void 0,"prehashed message"):g}function F(g,b,S){let{lowS:_,prehash:I,extraEntropy:L}=uo(S,T);g=K(g,I);let O=R(g),P=c.fromBytes(b);if(!c.isValidNot0(P))throw new Error("invalid private key");let H=[N(P),N(O)];if(L!=null&&L!==!1){let W=L===!0?o(A.secretKey):L;H.push(M(W,void 0,"extraEntropy"))}let k=G(...H),Y=O;function X(W){let j=U(W);if(!c.isValidNot0(j))return;let st=c.inv(j),re=r.BASE.multiply(j).toAffine(),ve=c.create(re.x);if(ve===vt)return;let Je=c.create(st*c.create(Y+ve*P));if(Je===vt)return;let yo=(re.x===ve?0:2)|Number(re.y&jt),bo=Je;return _&&p(Je)&&(bo=c.neg(Je),yo^=1),new D(ve,bo,m?void 0:yo)}return{seed:k,k2sig:X}}function l(g,b,S={}){let{seed:_,k2sig:I}=F(g,b,S);return gs(n.outputLen,c.BYTES,s)(_,I).toBytes(S.format)}function y(g,b,S,_={}){let{lowS:I,prehash:L,format:O}=uo(_,T);if(S=M(S,void 0,"publicKey"),b=K(b,L),!Gt(g)){let P=g instanceof D?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+P)}C(g,O);try{let P=D.fromBytes(g,O),H=r.fromBytes(S);if(I&&P.hasHighS())return!1;let{r:k,s:Y}=P,X=R(b),W=c.inv(Y),j=c.create(X*W),st=c.create(k*W),re=r.BASE.multiplyUnsafe(j).add(H.multiplyUnsafe(st));return re.is0()?!1:c.create(re.x)===k}catch{return!1}}function E(g,b,S={}){let{prehash:_}=uo(S,T);return b=K(b,_),D.fromBytes(g,"recovered").recoverPublicKey(b).toBytes()}return Object.freeze({keygen:u,getPublicKey:h,getSharedSecret:x,utils:d,lengths:A,Point:r,sign:l,verify:y,recoverPublicKey:E,Signature:D,hash:n})}var mo={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},of={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var pi=BigInt(2);function sf(r){let t=mo.p,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),f=BigInt(88),a=r*r*r%t,u=a*a*r%t,h=q(u,e,t)*u%t,x=q(h,e,t)*u%t,d=q(x,pi,t)*a%t,A=q(d,o,t)*d%t,T=q(A,s,t)*A%t,m=q(T,c,t)*T%t,p=q(m,f,t)*m%t,w=q(p,c,t)*T%t,v=q(w,e,t)*u%t,C=q(v,i,t)*A%t,D=q(C,n,t)*a%t,U=q(D,pi,t);if(!po.eql(po.sqr(U),r))throw new Error("Cannot find square root");return U}var po=xe(mo.p,{sqrt:sf}),cf=ui(mo,{Fp:po,endo:of}),Ae=di(cf,ms);function mi(r,t,e,n){let o=De.digest(e instanceof Uint8Array?e:e.subarray());if(_r(o))return o.then(({digest:s})=>(n?.signal?.throwIfAborted(),Ae.verify(t,s,r,{prehash:!1,format:"der"}))).catch(s=>{throw s.name==="AbortError"?s:new je(String(s))});try{return n?.signal?.throwIfAborted(),Ae.verify(t,o.digest,r,{prehash:!1,format:"der"})}catch(s){throw new je(String(s))}}var Mr=class{type="secp256k1";raw;_key;constructor(t){this._key=bi(t),this.raw=yi(this._key)}toMultihash(){return dt.digest(de(this))}toCID(){return J.createV1(114,this.toMultihash())}toString(){return $.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:pt(this.raw,t.raw)}verify(t,e,n){return mi(this._key,e,t,n)}};function gi(r){return new Mr(r)}function yi(r){return Ae.Point.fromBytes(r).toBytes()}function bi(r){try{return Ae.Point.fromBytes(r),r}catch(t){throw new or(String(t))}}function xi(r){let{Type:t,Data:e}=Xe.decode(r.digest),n=e??new Uint8Array;switch(t){case ot.Ed25519:return Zs(n);case ot.secp256k1:return gi(n);case ot.ECDSA:return Qo(n);default:throw new Re}}function de(r){return Xe.encode({Type:ot[r.type],Data:r.raw})}var wi=Symbol.for("nodejs.util.inspect.custom"),af=114,We=class{type;multihash;publicKey;string;constructor(t){this.type=t.type,this.multihash=t.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[pn]=!0;toString(){return this.string==null&&(this.string=$.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return J.createV1(af,this.multihash)}toJSON(){return this.toString()}equals(t){if(t==null)return!1;if(t instanceof Uint8Array)return pt(this.multihash.bytes,t);if(typeof t=="string")return this.toString()===t;if(t?.toMultihash()?.bytes!=null)return pt(this.multihash.bytes,t.toMultihash().bytes);throw new Error("not valid Id")}[wi](){return`PeerId(${this.toString()})`}},Hr=class extends We{type="RSA";publicKey;constructor(t){super({...t,type:"RSA"}),this.publicKey=t.publicKey}},qr=class extends We{type="Ed25519";publicKey;constructor(t){super({...t,type:"Ed25519"}),this.publicKey=t.publicKey}},Vr=class extends We{type="secp256k1";publicKey;constructor(t){super({...t,type:"secp256k1"}),this.publicKey=t.publicKey}},ff=2336,Qe=class{type="url";multihash;publicKey;url;constructor(t){this.url=t.toString(),this.multihash=dt.digest(Ft(this.url))}[wi](){return`PeerId(${this.url})`}[pn]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return J.createV1(ff,this.toMultihash())}toJSON(){return this.toString()}equals(t){return t==null?!1:(t instanceof Uint8Array&&(t=it(t)),t.toString()===this.toString())}};var uf=114,Ei=2336;function Si(r,t){let e;if(r.charAt(0)==="1"||r.charAt(0)==="Q")e=_e($.decode(`z${r}`));else{if(r.startsWith("k51qzi5uqu5")||r.startsWith("kzwfwjn5ji4")||r.startsWith("k2k4r8")||r.startsWith("bafz"))return hf(J.parse(r));if(t==null)throw new Et('Please pass a multibase decoder for strings that do not start with "1" or "Q"');e=_e(t.decode(r))}return Ai(e)}function Ai(r){if(df(r))return new Hr({multihash:r});if(lf(r))try{let t=xi(r);if(t.type==="Ed25519")return new qr({multihash:r,publicKey:t});if(t.type==="secp256k1")return new Vr({multihash:r,publicKey:t})}catch{let e=it(r.digest);return new Qe(new URL(e))}throw new ir("Supplied PeerID Multihash is invalid")}function hf(r){if(r?.multihash==null||r.version==null||r.version===1&&r.code!==uf&&r.code!==Ei)throw new sr("Supplied PeerID CID is invalid");if(r.code===Ei){let t=it(r.multihash.digest);return new Qe(new URL(t))}return Ai(r.multihash)}function lf(r){return r.code===dt.code}function df(r){return r.code===De.code}var vi=(r,t)=>{let[,e,n,...o]=r.split("/");if(e!=="ipns")throw new he(`Namespace ${e} was not "ipns"`);try{return{namespace:"ipns",peerId:Si(n),path:o.length>0?`/${o.join("/")}`:"",answer:t}}catch{return{namespace:"dnslink",value:n,path:o.length>0?`/${o.join("/")}`:"",answer:t}}};var zr=class{dns;log;namespaces;cache;cacheMaxAnswers;constructor(t,e={}){this.dns=t.dns,this.log=t.logger.forComponent("helia:dnslink"),this.namespaces={ipfs:zo,ipns:vi,...e.namespaces},this.cache=new ue({maxSize:e.cacheSize??1e3,maxAge:e.cacheMaxAge??3e4}),this.cacheMaxAnswers=e.cacheMaxAnswers??10}async resolve(t,e={}){if(e.nocache!==!0){let i=this.cache.get(t);if(i!=null){let c=[...i.values()];if(c.length>0)return c}}let n=await this.recursiveResolveDomain(t,e.maxRecursiveDepth??Vo,e),o=new ue({maxSize:this.cacheMaxAnswers});n.forEach((i,c)=>{o.set(c,i,{maxAge:i.answer.TTL*1e3})});let s=n.reduce((i,c)=>{let f=c.answer.TTL*1e3;return f>i?f:i},0);return this.cache.maxAge<s&&(s=this.cache.maxAge),this.cache.set(t,o,{maxAge:s}),n}async recursiveResolveDomain(t,e,n={}){if(e===0)throw new Error("recursion limit exceeded");t.startsWith("_dnslink.")||(t=`_dnslink.${t}`);try{return await this.recursiveResolveDnslink(t,e,n)}catch(o){if(o.code!=="ENOTFOUND"&&o.code!=="ENODATA"&&o.name!=="DNSLinkNotFoundError"&&o.name!=="NotFoundError")throw o;return t.startsWith("_dnslink.")?t=t.replace("_dnslink.",""):t=`_dnslink.${t}`,this.recursiveResolveDnslink(t,e,n)}}async recursiveResolveDnslink(t,e,n={}){if(e===0)throw new Error("recursion limit exceeded");this.log("query %s for TXT and CNAME records",t);let s=((await this.dns.query(t,{...n,types:[Bt.TXT]}))?.Answer??[]).sort((a,u)=>a.data.localeCompare(u.data));this.log("found %d TXT records for %s",s.length,t);let i=[];for(let a of s)try{let u=a.data;if(u.startsWith('"')&&u.endsWith('"')&&(u=u.substring(1,u.length-1)),!u.startsWith("dnslink="))continue;this.log("%s TXT %s",a.name,u),u=u.replace("dnslink=","");let[,h,x]=u.split("/");if(h==="dnslink"){i.push(...await this.recursiveResolveDomain(x,e-1,n));continue}let d=this.namespaces[h];if(d==null){this.log('unknown protocol "%s" in DNSLink record for domain: %s',h,t);continue}let A=d(u,a);if(A.namespace==="dnslink"){i.push(...await this.recursiveResolveDomain(A.value,e-1,n));continue}i.push(d(u,a))}catch(u){this.log.error("could not parse DNS link record for domain %s, %s - %e",t,a.data,u)}if(i.length>0)return i;this.log("no DNSLink records found for %s, falling back to CNAME",t);let f=((await this.dns.query(t,{...n,types:[Bt.CNAME]}))?.Answer??[]).sort((a,u)=>a.data.localeCompare(u.data));this.log("found %d CNAME records for %s",f.length,t);for(let a of f)try{return await this.recursiveResolveDomain(a.data,e-1,n)}catch(u){this.log.error("domain %s cname %s had no DNSLink records - %e",t,a.data,u)}throw new nr(`No DNSLink records found for domain: ${t}`)}};function pf(r,t={}){return new zr(r,t)}return Ci(mf);})();
3
- /*! Bundled license information:
4
-
5
- @noble/curves/utils.js:
6
- @noble/curves/abstract/modular.js:
7
- @noble/curves/abstract/curve.js:
8
- @noble/curves/abstract/edwards.js:
9
- @noble/curves/ed25519.js:
10
- @noble/curves/abstract/weierstrass.js:
11
- @noble/curves/secp256k1.js:
12
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
13
- */
2
+ "use strict";var HeliaDnslink=(()=>{var Ke=Object.create;var j=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var et=Object.getOwnPropertyNames;var tt=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var nt=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},p=(r,e)=>{for(var t in e)j(r,t,{get:e[t],enumerable:!0})},ve=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of et(e))!rt.call(r,s)&&s!==t&&j(r,s,{get:()=>e[s],enumerable:!(n=Ze(e,s))||n.enumerable});return r};var st=(r,e,t)=>(t=r!=null?Ke(tt(r)):{},ve(e||!r||!r.__esModule?j(t,"default",{value:r,enumerable:!0}):t,r)),ot=r=>ve(j({},"__esModule",{value:!0}),r);var Je=nt((zn,He)=>{He.exports=function(r){if(!r)throw Error("hashlru must have a max value, of type number, greater than 0");var e=0,t=Object.create(null),n=Object.create(null);function s(o,i){t[o]=i,e++,e>=r&&(e=0,n=t,t=Object.create(null))}return{has:function(o){return t[o]!==void 0||n[o]!==void 0},remove:function(o){t[o]!==void 0&&(t[o]=void 0),n[o]!==void 0&&(n[o]=void 0)},get:function(o){var i=t[o];if(i!==void 0)return i;if((i=n[o])!==void 0)return s(o,i),i},set:function(o,i){t[o]!==void 0?t[o]=i:s(o,i)},clear:function(){t=Object.create(null),n=Object.create(null)}}}});var yr={};p(yr,{dnsLink:()=>br});var re={};p(re,{base10:()=>lt});var Dr=new Uint8Array(0);function Ee(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 g(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return L(r);if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return L(new Uint8Array(r.buffer,r.byteOffset,r.byteLength));throw new Error("Unknown type, must be binary type")}function Ce(r){let e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}var Ae=4096;function Se(r){let e=r.length;if(e<=Ae)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.subarray(n,n+=Ae));return t}function it(r){return r?.buffer instanceof ArrayBuffer}function L(r){return it(r)?r:r.slice()}function at(r,e,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),s=0;s<n.length;s++)n[s]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),c=i.charCodeAt(0);if(n[c]!==255)throw new TypeError(i+" is ambiguous");if(n[c]=o,t){var d=i.toLowerCase().charCodeAt(0),f=i.toUpperCase().charCodeAt(0);d!==c&&(n[d]=o),f!==c&&(n[f]=o)}}var a=r.length,S=r.charAt(0),B=Math.log(a)/Math.log(256),F=Math.log(256)/Math.log(a);function H(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 l=0,I=0,x=0,b=h.length;x!==b&&h[x]===0;)x++,l++;for(var y=(b-x)*F+1>>>0,m=new Uint8Array(y);x!==b;){for(var v=h[x],D=0,w=y-1;(v!==0||D<I)&&w!==-1;w--,D++)v+=256*m[w]>>>0,m[w]=v%a>>>0,v=v/a>>>0;if(v!==0)throw new Error("Non-zero carry");I=D,x++}for(var E=y-I;E!==y&&m[E]===0;)E++;for(var J=S.repeat(l);E<y;++E)J+=r.charAt(m[E]);return J}function ye(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var l=0;if(h[l]!==" "){for(var I=0,x=0;h[l]===S;)I++,l++;for(var b=(h.length-l)*B+1>>>0,y=new Uint8Array(b);h[l];){var m=n[h.charCodeAt(l)];if(m===255)return;for(var v=0,D=b-1;(m!==0||v<x)&&D!==-1;D--,v++)m+=a*y[D]>>>0,y[D]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");x=v,l++}if(h[l]!==" "){for(var w=b-x;w!==b&&y[w]===0;)w++;for(var E=new Uint8Array(I+(b-w)),J=I;w!==b;)E[J++]=y[w++];return E}}}function Ye(h){var l=ye(h);if(l)return l;throw new Error(`Non-${e} character`)}return{encode:H,decodeUnsafe:ye,decode:Ye}}var ct=at,ht=ct,Te=ht;var K=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")}},Z=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let s=t.codePointAt(0);if(s===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=s,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 Ne(this,e)}},ee=class{decoders;constructor(e){this.decoders=e}or(e){return Ne(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 Ne(r,e){return new ee({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var te=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new K(e,t,n),this.decoder=new Z(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function U({name:r,prefix:e,encode:t,decode:n}){return new te(r,e,t,n)}function T({name:r,prefix:e,alphabet:t,caseInsensitive:n=!1}){let{encode:s,decode:o}=Te(t,r,n);return U({prefix:e,name:r,encode:s,decode:i=>g(o(i))})}function ft(r,e,t,n){let s=r.length;for(;r[s-1]==="=";)--s;let o=new Uint8Array(s*t/8|0),i=0,c=0,d=0;for(let f=0;f<s;++f){let a=e[r[f]];if(a===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|a,i+=t,i>=8&&(i-=8,o[d++]=255&c>>i)}if(i>=t||(255&c<<8-i)!==0)throw new SyntaxError("Unexpected end of data");return o}function ut(r,e,t){let n=e[e.length-1]==="=",s=(1<<t)-1,o="",i=0,c=0;for(let d=0;d<r.length;++d)for(c=c<<8|r[d],i+=8;i>t;)i-=t,o+=e[s&c>>i];if(i!==0&&(o+=e[s&c<<t-i]),n)for(;(o.length*t&7)!==0;)o+="=";return o}function dt(r,e){let t={};for(let n=0;n<r.length;++n)if(t[r[n]]=n,e){let s=r[n].toLowerCase(),o=r[n].toUpperCase();s!==r[n]&&(t[s]=n),o!==r[n]&&(t[o]=n)}return t}function u({name:r,prefix:e,bitsPerChar:t,alphabet:n,caseInsensitive:s=!1}){let o=dt(n,s);return U({prefix:e,name:r,encode(i){return ut(i,n,t)},decode(i){return ft(i,o,t,r)}})}var lt=T({prefix:"9",name:"base10",alphabet:"0123456789"});var ne={};p(ne,{base16:()=>pt,base16upper:()=>mt});var pt=u({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4,caseInsensitive:!0}),mt=u({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4,caseInsensitive:!0});var se={};p(se,{base2:()=>gt});var gt=u({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var oe={};p(oe,{base256emoji:()=>vt});var Ie=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}"),xt=Ie.reduce((r,e,t)=>(r[t]=e,r),[]),wt=Ie.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);function bt(r){return r.reduce((e,t)=>(e+=xt[t],e),"")}function yt(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let s=wt[n];if(s==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(s)}return new Uint8Array(e)}var vt=U({prefix:"\u{1F680}",name:"base256emoji",encode:bt,decode:yt});var ie={};p(ie,{base32:()=>M,base32hex:()=>St,base32hexpad:()=>Tt,base32hexpadupper:()=>Nt,base32hexupper:()=>Dt,base32pad:()=>Et,base32padupper:()=>Ct,base32upper:()=>At,base32z:()=>It});var M=u({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5,caseInsensitive:!0}),At=u({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5,caseInsensitive:!0}),Et=u({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5,caseInsensitive:!0}),Ct=u({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5,caseInsensitive:!0}),St=u({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5,caseInsensitive:!0}),Dt=u({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5,caseInsensitive:!0}),Tt=u({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5,caseInsensitive:!0}),Nt=u({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5,caseInsensitive:!0}),It=u({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ae={};p(ae,{base36:()=>_,base36upper:()=>Lt});var _=T({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz",caseInsensitive:!0}),Lt=T({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",caseInsensitive:!0});var ce={};p(ce,{base58btc:()=>A,base58flickr:()=>Ut});var A=T({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ut=T({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var he={};p(he,{base64:()=>Mt,base64pad:()=>Rt,base64url:()=>zt,base64urlpad:()=>$t});var Mt=u({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Rt=u({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),zt=u({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$t=u({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var fe={};p(fe,{base8:()=>Ot});var Ot=u({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ue={};p(ue,{identity:()=>kt});var kt=U({prefix:"\0",name:"identity",encode:r=>Se(g(r)),decode:r=>g(Ce(r))});var Vr=new TextEncoder,qr=new TextDecoder;var le={};p(le,{identity:()=>ir});var Ft=Me,Le=128,_t=127,Vt=~_t,qt=Math.pow(2,31);function Me(r,e,t){e=e||[],t=t||0;for(var n=t;r>=qt;)e[t++]=r&255|Le,r/=128;for(;r&Vt;)e[t++]=r&255|Le,r>>>=7;return e[t]=r|0,Me.bytes=t-n+1,e}var Xt=de,Qt=128,Ue=127;function de(r,n){var t=0,n=n||0,s=0,o=n,i,c=r.length;do{if(o>=c)throw de.bytes=0,new RangeError("Could not decode varint");i=r[o++],t+=s<28?(i&Ue)<<s:(i&Ue)*Math.pow(2,s),s+=7}while(i>=Qt);return de.bytes=o-n,t}var Ht=Math.pow(2,7),Jt=Math.pow(2,14),jt=Math.pow(2,21),Gt=Math.pow(2,28),Wt=Math.pow(2,35),Yt=Math.pow(2,42),Kt=Math.pow(2,49),Zt=Math.pow(2,56),er=Math.pow(2,63),tr=function(r){return r<Ht?1:r<Jt?2:r<jt?3:r<Gt?4:r<Wt?5:r<Yt?6:r<Kt?7:r<Zt?8:r<er?9:10},rr={encode:Ft,decode:Xt,encodingLength:tr},nr=rr,V=nr;function q(r,e=0){return[V.decode(r,e),V.decode.bytes]}function R(r,e,t=0){return V.encode(r,e,t),e}function z(r){return V.encodingLength(r)}function O(r,e){let t=e.byteLength,n=z(r),s=n+z(t),o=new Uint8Array(s+t);return R(r,o,0),R(t,o,n),o.set(e,s),new $(r,t,e,o)}function Re(r){let e=g(r),[t,n]=q(e),[s,o]=q(e.subarray(n)),i=e.subarray(n+o);if(i.byteLength!==s)throw new Error("Incorrect length");return new $(t,s,i,e)}function ze(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Ee(r.bytes,t.bytes)}}var $=class{code;size;digest;bytes;constructor(e,t,n,s){this.code=e,this.size=t,this.digest=L(n),this.bytes=L(s)}};var $e=0,sr="identity",Oe=g;function or(r,e){if(e?.truncate!=null&&e.truncate!==r.byteLength){if(e.truncate<0||e.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e.truncate)}return O($e,Oe(r))}var ir={code:$e,name:sr,encode:Oe,digest:or};var ge={};p(ge,{sha256:()=>cr,sha512:()=>hr});var ar=20;function me({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:s}){return new pe(r,e,t,n,s)}var pe=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,s,o){this.name=e,this.code=t,this.encode=n,this.minDigestLength=s??ar,this.maxDigestLength=o}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?ke(n,this.code,t?.truncate):n.then(s=>ke(s,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function ke(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return O(e,r)}function Be(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var cr=me({name:"sha2-256",code:18,encode:Be("SHA-256")}),hr=me({name:"sha2-512",code:19,encode:Be("SHA-512")});function Fe(r,e){let{bytes:t,version:n}=r;return n===0?ur(t,xe(r),e??A.encoder):dr(t,xe(r),e??M.encoder)}var _e=new WeakMap;function xe(r){let e=_e.get(r);if(e==null){let t=new Map;return _e.set(r,t),t}return e}var N=class r{code;version;multihash;bytes;"/";constructor(e,t,n,s){this.code=t,this.version=e,this.multihash=n,this.bytes=L(s),this["/"]=this.bytes}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!==Q)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==lr)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=O(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&&ze(e.multihash,n.multihash)}toString(e){return Fe(this,e)}toJSON(){return{"/":Fe(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:s,multihash:o,bytes:i}=t;return new r(n,s,o,i??Ve(n,s,o.bytes))}else if(t[pr]===!0){let{version:n,multihash:s,code:o}=t,i=Re(s);return r.create(n,o,i)}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!==Q)throw new Error(`Version 0 CID must use dag-pb (code: ${Q}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let s=Ve(e,t,n.bytes);return new r(e,t,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Q,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,s=g(e.subarray(n,n+t.multihashSize));if(s.byteLength!==t.multihashSize)throw new Error("Incorrect length");let o=s.subarray(t.multihashSize-t.digestSize),i=new $(t.multihashCode,t.digestSize,o,s);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[S,B]=q(e.subarray(t));return t+=B,S},s=n(),o=Q;if(s===18?(s=0,t=0):o=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let i=t,c=n(),d=n(),f=t+d,a=f-i;return{version:s,codec:o,multihashCode:c,digestSize:d,multihashSize:a,size:f}}static parse(e,t){let[n,s]=fr(e,t),o=r.decode(s);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return xe(o).set(n,e),o}};function fr(r,e){switch(r[0]){case"Q":{let t=e??A;return[A.prefix,t.decode(`${A.prefix}${r}`)]}case A.prefix:{let t=e??A;return[A.prefix,t.decode(r)]}case M.prefix:{let t=e??M;return[M.prefix,t.decode(r)]}case _.prefix:{let t=e??_;return[_.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function ur(r,e,t){let{prefix:n}=t;if(n!==A.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let s=e.get(n);if(s==null){let o=t.encode(r).slice(1);return e.set(n,o),o}else return s}function dr(r,e,t){let{prefix:n}=t,s=e.get(n);if(s==null){let o=t.encode(r);return e.set(n,o),o}else return s}var Q=112,lr=18;function Ve(r,e,t){let n=z(r),s=n+z(e),o=new Uint8Array(s+t.byteLength);return R(r,o,0),R(e,o,n),o.set(t,s),o}var pr=Symbol.for("@ipld/js-cid/CID");var we={...ue,...se,...fe,...re,...ne,...ie,...ae,...ce,...he,...oe},dn={...ge,...le};function qe(r=0){return new Uint8Array(r)}function Qe(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Xe=Qe("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),be=Qe("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=qe(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),xn={utf8:Xe,"utf-8":Xe,hex:we.base16,latin1:be,ascii:be,binary:be,...we};var wr=st(Je(),1);var C;(function(r){r[r.A=1]="A",r[r.CNAME=5]="CNAME",r[r.TXT=16]="TXT",r[r.AAAA=28]="AAAA"})(C||(C={}));var je=32;var k=class extends Map{#r=0;#e=new Map;#t=new Map;#s;#i;#o;constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge=="number"&&e.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.#s=e.maxSize,this.#i=e.maxAge||Number.POSITIVE_INFINITY,this.#o=e.onEviction}get __oldCache(){return this.#t}#a(e){if(typeof this.#o=="function")for(let[t,n]of e)this.#o(t,n.value)}#n(e,t){return typeof t.expiry=="number"&&t.expiry<=Date.now()?(typeof this.#o=="function"&&this.#o(e,t.value),this.delete(e)):!1}#d(e,t){if(this.#n(e,t)===!1)return t.value}#h(e,t){return t.expiry?this.#d(e,t):t.value}#f(e,t){let n=t.get(e);return this.#h(e,n)}#u(e,t){this.#e.set(e,t),this.#r++,this.#r>=this.#s&&(this.#r=0,this.#a(this.#t),this.#t=this.#e,this.#e=new Map)}#l(e,t){this.#t.delete(e),this.#u(e,t)}*#c(){for(let e of this.#t){let[t,n]=e;this.#e.has(t)||this.#n(t,n)===!1&&(yield e)}for(let e of this.#e){let[t,n]=e;this.#n(t,n)===!1&&(yield e)}}get(e){if(this.#e.has(e)){let t=this.#e.get(e);return this.#h(e,t)}if(this.#t.has(e)){let t=this.#t.get(e);if(this.#n(e,t)===!1)return this.#l(e,t),t.value}}set(e,t,{maxAge:n=this.#i}={}){let s=typeof n=="number"&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.#e.has(e)?this.#e.set(e,{value:t,expiry:s}):this.#u(e,{value:t,expiry:s}),this}has(e){return this.#e.has(e)?!this.#n(e,this.#e.get(e)):this.#t.has(e)?!this.#n(e,this.#t.get(e)):!1}peek(e){if(this.#e.has(e))return this.#f(e,this.#e);if(this.#t.has(e))return this.#f(e,this.#t)}expiresIn(e){let t=this.#e.get(e)??this.#t.get(e);if(t)return t.expiry?t.expiry-Date.now():Number.POSITIVE_INFINITY}delete(e){let t=this.#e.delete(e);return t&&this.#r--,this.#t.delete(e)||t}clear(){this.#e.clear(),this.#t.clear(),this.#r=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");let t=[...this.#c()],n=t.length-e;n<0?(this.#e=new Map(t),this.#t=new Map,this.#r=t.length):(n>0&&this.#a(t.slice(0,n)),this.#t=new Map(t.slice(n)),this.#e=new Map,this.#r=0),this.#s=e}evict(e=1){let t=Number(e);if(!t||t<=0)return;let n=[...this.#c()],s=Math.trunc(Math.min(t,Math.max(n.length-1,0)));s<=0||(this.#a(n.slice(0,s)),this.#t=new Map(n.slice(s)),this.#e=new Map,this.#r=0)}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.#e){let[t,n]=e;this.#n(t,n)===!1&&(yield[t,n.value])}for(let e of this.#t){let[t,n]=e;this.#e.has(t)||this.#n(t,n)===!1&&(yield[t,n.value])}}*entriesDescending(){let e=[...this.#e];for(let t=e.length-1;t>=0;--t){let n=e[t],[s,o]=n;this.#n(s,o)===!1&&(yield[s,o.value])}e=[...this.#t];for(let t=e.length-1;t>=0;--t){let n=e[t],[s,o]=n;this.#e.has(s)||this.#n(s,o)===!1&&(yield[s,o.value])}}*entriesAscending(){for(let[e,t]of this.#c())yield[e,t.value]}get size(){if(!this.#r)return this.#t.size;let e=0;for(let t of this.#t.keys())this.#e.has(t)||e++;return Math.min(this.#r+e,this.#s)}get maxSize(){return this.#s}get maxAge(){return this.#i}entries(){return this.entriesAscending()}forEach(e,t=this){for(let[n,s]of this.entriesAscending())e.call(t,s,n,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};var W=class extends Error{static name="DNSLinkNotFoundError";constructor(e="DNSLink not found"){super(e),this.name="DNSLinkNotFoundError"}},P=class extends Error{static name="InvalidNamespaceError";constructor(e="Invalid namespace"){super(e),this.name="InvalidNamespaceError"}};var Ge=(r,e)=>{let[,t,n,...s]=r.split("/");if(t!=="ipfs")throw new P(`Namespace ${t} was not "ipfs"`);return{namespace:"ipfs",cid:N.parse(n),path:s.length>0?`/${s.join("/")}`:"",answer:e}};var We=(r,e)=>{let[,t,n,...s]=r.split("/");if(t!=="ipns")throw new P(`Namespace ${t} was not "ipns"`);try{return{namespace:"ipns",value:N.parse(n).multihash,path:s.length>0?`/${s.join("/")}`:"",answer:e}}catch{return{namespace:"dnslink",value:n,path:s.length>0?`/${s.join("/")}`:"",answer:e}}};var Y=class{dns;log;namespaces;cache;cacheMaxAnswers;constructor(e,t={}){this.dns=e.dns,this.log=e.logger.forComponent("helia:dnslink"),this.namespaces={ipfs:Ge,ipns:We,...t.namespaces},this.cache=new k({maxSize:t.cacheSize??1e3,maxAge:t.cacheMaxAge??3e4}),this.cacheMaxAnswers=t.cacheMaxAnswers??10}async resolve(e,t={}){if(t.nocache!==!0){let i=this.cache.get(e);if(i!=null){let c=[...i.values()];if(c.length>0)return c}}let n=await this.recursiveResolveDomain(e,t.maxRecursiveDepth??je,t),s=new k({maxSize:this.cacheMaxAnswers});n.forEach((i,c)=>{s.set(c,i,{maxAge:i.answer.TTL*1e3})});let o=n.reduce((i,c)=>{let d=c.answer.TTL*1e3;return d>i?d:i},0);return this.cache.maxAge<o&&(o=this.cache.maxAge),this.cache.set(e,s,{maxAge:o}),n}async recursiveResolveDomain(e,t,n={}){if(t===0)throw new Error("recursion limit exceeded");e.startsWith("_dnslink.")||(e=`_dnslink.${e}`);try{return await this.recursiveResolveDnslink(e,t,n)}catch(s){if(s.code!=="ENOTFOUND"&&s.code!=="ENODATA"&&s.name!=="DNSLinkNotFoundError"&&s.name!=="NotFoundError")throw s;return e.startsWith("_dnslink.")?e=e.replace("_dnslink.",""):e=`_dnslink.${e}`,this.recursiveResolveDnslink(e,t,n)}}async recursiveResolveDnslink(e,t,n={}){if(t===0)throw new Error("recursion limit exceeded");this.log("query %s for TXT and CNAME records",e);let o=((await this.dns.query(e,{...n,types:[C.TXT]}))?.Answer??[]).sort((f,a)=>f.data.localeCompare(a.data));this.log("found %d TXT records for %s",o.length,e);let i=[];for(let f of o)try{let a=f.data;if(a.startsWith('"')&&a.endsWith('"')&&(a=a.substring(1,a.length-1)),!a.startsWith("dnslink="))continue;this.log("%s TXT %s",f.name,a),a=a.replace("dnslink=","");let[,S,B]=a.split("/");if(S==="dnslink"){i.push(...await this.recursiveResolveDomain(B,t-1,n));continue}let F=this.namespaces[S];if(F==null){this.log('unknown protocol "%s" in DNSLink record for domain: %s',S,e);continue}let H=F(a,f);if(H.namespace==="dnslink"){i.push(...await this.recursiveResolveDomain(H.value,t-1,n));continue}i.push(F(a,f))}catch(a){this.log.error("could not parse DNS link record for domain %s, %s - %e",e,f.data,a)}if(i.length>0)return i;this.log("no DNSLink records found for %s, falling back to CNAME",e);let d=((await this.dns.query(e,{...n,types:[C.CNAME]}))?.Answer??[]).sort((f,a)=>f.data.localeCompare(a.data));this.log("found %d CNAME records for %s",d.length,e);for(let f of d)try{return await this.recursiveResolveDomain(f.data,t-1,n)}catch(a){this.log.error("domain %s cname %s had no DNSLink records - %e",e,f.data,a)}throw new W(`No DNSLink records found for domain: ${e}`)}};function br(r,e={}){return new Y(r,e)}return ot(yr);})();
14
3
  return HeliaDnslink}));
15
4
  //# sourceMappingURL=index.min.js.map