@rango-dev/provider-ledger 0.21.1-next.2 → 0.21.1-next.4

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.
@@ -1,2 +1,2 @@
1
- import{a as Ee,b as Ye}from"./chunk-5QSDSOWH.js";import{a as o,c as v,e as dn,g as We,h as Ke,i as ge,j as ke,k as b,l as Ie,n as ye}from"./chunk-CVKDPNYM.js";var W=v((Xo,ht)=>{var yn="2.0.0",Rn=Number.MAX_SAFE_INTEGER||9007199254740991,xn=16,Ln=250,Sn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ht.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:xn,MAX_SAFE_BUILD_LENGTH:Ln,MAX_SAFE_INTEGER:Rn,RELEASE_TYPES:Sn,SEMVER_SPEC_VERSION:yn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var K=v((Vo,ft)=>{var $n=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};ft.exports=$n});var B=v((P,pt)=>{var{MAX_SAFE_COMPONENT_LENGTH:Re,MAX_SAFE_BUILD_LENGTH:wn,MAX_LENGTH:Nn}=W(),Tn=K();P=pt.exports={};var On=P.re=[],An=P.safeRe=[],f=P.src=[],p=P.t={},bn=0,xe="[a-zA-Z0-9-]",qn=[["\\s",1],["\\d",Nn],[xe,wn]],Pn=o(t=>{for(let[e,r]of qn)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},"makeSafeRegex"),E=o((t,e,r)=>{let n=Pn(e),s=bn++;Tn(t,s,e),p[t]=s,f[s]=e,On[s]=new RegExp(e,r?"g":void 0),An[s]=new RegExp(n,r?"g":void 0)},"createToken");E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${xe}*`);E("MAINVERSION",`(${f[p.NUMERICIDENTIFIER]})\\.(${f[p.NUMERICIDENTIFIER]})\\.(${f[p.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${f[p.NUMERICIDENTIFIERLOOSE]})\\.(${f[p.NUMERICIDENTIFIERLOOSE]})\\.(${f[p.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${f[p.NUMERICIDENTIFIER]}|${f[p.NONNUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${f[p.NUMERICIDENTIFIERLOOSE]}|${f[p.NONNUMERICIDENTIFIER]})`);E("PRERELEASE",`(?:-(${f[p.PRERELEASEIDENTIFIER]}(?:\\.${f[p.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${f[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${f[p.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${xe}+`);E("BUILD",`(?:\\+(${f[p.BUILDIDENTIFIER]}(?:\\.${f[p.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${f[p.MAINVERSION]}${f[p.PRERELEASE]}?${f[p.BUILD]}?`);E("FULL",`^${f[p.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${f[p.MAINVERSIONLOOSE]}${f[p.PRERELEASELOOSE]}?${f[p.BUILD]}?`);E("LOOSE",`^${f[p.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${f[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${f[p.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${f[p.XRANGEIDENTIFIER]})(?:\\.(${f[p.XRANGEIDENTIFIER]})(?:\\.(${f[p.XRANGEIDENTIFIER]})(?:${f[p.PRERELEASE]})?${f[p.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${f[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${f[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${f[p.XRANGEIDENTIFIERLOOSE]})(?:${f[p.PRERELEASELOOSE]})?${f[p.BUILD]}?)?)?`);E("XRANGE",`^${f[p.GTLT]}\\s*${f[p.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${f[p.GTLT]}\\s*${f[p.XRANGEPLAINLOOSE]}$`);E("COERCE",`(^|[^\\d])(\\d{1,${Re}})(?:\\.(\\d{1,${Re}}))?(?:\\.(\\d{1,${Re}}))?(?:$|[^\\d])`);E("COERCERTL",f[p.COERCE],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${f[p.LONETILDE]}\\s+`,!0);P.tildeTrimReplace="$1~";E("TILDE",`^${f[p.LONETILDE]}${f[p.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${f[p.LONETILDE]}${f[p.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${f[p.LONECARET]}\\s+`,!0);P.caretTrimReplace="$1^";E("CARET",`^${f[p.LONECARET]}${f[p.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${f[p.LONECARET]}${f[p.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${f[p.GTLT]}\\s*(${f[p.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${f[p.GTLT]}\\s*(${f[p.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${f[p.GTLT]}\\s*(${f[p.LOOSEPLAIN]}|${f[p.XRANGEPLAIN]})`,!0);P.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${f[p.XRANGEPLAIN]})\\s+-\\s+(${f[p.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${f[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${f[p.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ie=v((zo,dt)=>{var Cn=Object.freeze({loose:!0}),_n=Object.freeze({}),Dn=o(t=>t?typeof t!="object"?Cn:t:_n,"parseOptions");dt.exports=Dn});var Le=v((Wo,Et)=>{var mt=/^[0-9]+$/,vt=o((t,e)=>{let r=mt.test(t),n=mt.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},"compareIdentifiers"),Un=o((t,e)=>vt(e,t),"rcompareIdentifiers");Et.exports={compareIdentifiers:vt,rcompareIdentifiers:Un}});var S=v((ko,Rt)=>{var oe=K(),{MAX_LENGTH:gt,MAX_SAFE_INTEGER:ue}=W(),{safeRe:It,t:yt}=B(),Gn=ie(),{compareIdentifiers:X}=Le(),Se=class t{static{o(this,"SemVer")}constructor(e,r){if(r=Gn(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>gt)throw new TypeError(`version is longer than ${gt} characters`);oe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?It[yt.LOOSE]:It[yt.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>ue||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ue||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ue||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&i<ue)return i}return s}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(oe("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),X(this.major,e.major)||X(this.minor,e.minor)||X(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=e.prerelease[r];if(oe("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return X(n,s)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],s=e.build[r];if(oe("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return X(n,s)}while(++r)}inc(e,r,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),X(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Rt.exports=Se});var U=v((Jo,Lt)=>{var xt=S(),jn=o((t,e,r=!1)=>{if(t instanceof xt)return t;try{return new xt(t,e)}catch(n){if(!r)return null;throw n}},"parse");Lt.exports=jn});var $t=v((eu,St)=>{var Fn=U(),Mn=o((t,e)=>{let r=Fn(t,e);return r?r.version:null},"valid");St.exports=Mn});var Nt=v((ru,wt)=>{var Bn=U(),Xn=o((t,e)=>{let r=Bn(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null},"clean");wt.exports=Xn});var At=v((su,Ot)=>{var Tt=S(),Vn=o((t,e,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Tt(t instanceof Tt?t.version:t,r).inc(e,n,s).version}catch{return null}},"inc");Ot.exports=Vn});var Pt=v((ou,qt)=>{var bt=U(),Hn=o((t,e)=>{let r=bt(t,null,!0),n=bt(e,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,u=i?r:n,a=i?n:r,c=!!u.prerelease.length;if(!!a.prerelease.length&&!c)return!a.patch&&!a.minor?"major":u.patch?"patch":u.minor?"minor":"major";let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"},"diff");qt.exports=Hn});var _t=v((au,Ct)=>{var zn=S(),Yn=o((t,e)=>new zn(t,e).major,"major");Ct.exports=Yn});var Ut=v((lu,Dt)=>{var Wn=S(),Kn=o((t,e)=>new Wn(t,e).minor,"minor");Dt.exports=Kn});var jt=v((fu,Gt)=>{var kn=S(),Zn=o((t,e)=>new kn(t,e).patch,"patch");Gt.exports=Zn});var Mt=v((du,Ft)=>{var Jn=U(),Qn=o((t,e)=>{let r=Jn(t,e);return r&&r.prerelease.length?r.prerelease:null},"prerelease");Ft.exports=Qn});var O=v((vu,Xt)=>{var Bt=S(),es=o((t,e,r)=>new Bt(t,r).compare(new Bt(e,r)),"compare");Xt.exports=es});var Ht=v((gu,Vt)=>{var ts=O(),rs=o((t,e,r)=>ts(e,t,r),"rcompare");Vt.exports=rs});var Yt=v((yu,zt)=>{var ns=O(),ss=o((t,e)=>ns(t,e,!0),"compareLoose");zt.exports=ss});var ae=v((xu,Kt)=>{var Wt=S(),is=o((t,e,r)=>{let n=new Wt(t,r),s=new Wt(e,r);return n.compare(s)||n.compareBuild(s)},"compareBuild");Kt.exports=is});var Zt=v((Su,kt)=>{var os=ae(),us=o((t,e)=>t.sort((r,n)=>os(r,n,e)),"sort");kt.exports=us});var Qt=v((wu,Jt)=>{var as=ae(),cs=o((t,e)=>t.sort((r,n)=>as(n,r,e)),"rsort");Jt.exports=cs});var k=v((Tu,er)=>{var ls=O(),hs=o((t,e,r)=>ls(t,e,r)>0,"gt");er.exports=hs});var ce=v((Au,tr)=>{var fs=O(),ps=o((t,e,r)=>fs(t,e,r)<0,"lt");tr.exports=ps});var $e=v((qu,rr)=>{var ds=O(),ms=o((t,e,r)=>ds(t,e,r)===0,"eq");rr.exports=ms});var we=v((Cu,nr)=>{var vs=O(),Es=o((t,e,r)=>vs(t,e,r)!==0,"neq");nr.exports=Es});var le=v((Du,sr)=>{var gs=O(),Is=o((t,e,r)=>gs(t,e,r)>=0,"gte");sr.exports=Is});var he=v((Gu,ir)=>{var ys=O(),Rs=o((t,e,r)=>ys(t,e,r)<=0,"lte");ir.exports=Rs});var Ne=v((Fu,or)=>{var xs=$e(),Ls=we(),Ss=k(),$s=le(),ws=ce(),Ns=he(),Ts=o((t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return xs(t,r,n);case"!=":return Ls(t,r,n);case">":return Ss(t,r,n);case">=":return $s(t,r,n);case"<":return ws(t,r,n);case"<=":return Ns(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}},"cmp");or.exports=Ts});var ar=v((Bu,ur)=>{var Os=S(),As=U(),{safeRe:fe,t:pe}=B(),bs=o((t,e)=>{if(t instanceof Os)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(fe[pe.COERCE]);else{let n;for(;(n=fe[pe.COERCERTL].exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||n.index+n[0].length!==r.index+r[0].length)&&(r=n),fe[pe.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;fe[pe.COERCERTL].lastIndex=-1}return r===null?null:As(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,e)},"coerce");ur.exports=bs});var lr=v((Vu,cr)=>{"use strict";cr.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var fr=v((Hu,hr)=>{"use strict";hr.exports=g;g.Node=G;g.create=g;function g(t){var e=this;if(e instanceof g||(e=new g),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(s){e.push(s)});else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)e.push(arguments[r]);return e}o(g,"Yallist");g.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e};g.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}};g.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}};g.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)Ps(this,arguments[t]);return this.length};g.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)Cs(this,arguments[t]);return this.length};g.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}};g.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}};g.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,n=0;r!==null;n++)t.call(e,r.value,n,this),r=r.next};g.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,n=this.length-1;r!==null;n--)t.call(e,r.value,n,this),r=r.prev};g.prototype.get=function(t){for(var e=0,r=this.head;r!==null&&e<t;e++)r=r.next;if(e===t&&r!==null)return r.value};g.prototype.getReverse=function(t){for(var e=0,r=this.tail;r!==null&&e<t;e++)r=r.prev;if(e===t&&r!==null)return r.value};g.prototype.map=function(t,e){e=e||this;for(var r=new g,n=this.head;n!==null;)r.push(t.call(e,n.value,this)),n=n.next;return r};g.prototype.mapReverse=function(t,e){e=e||this;for(var r=new g,n=this.tail;n!==null;)r.push(t.call(e,n.value,this)),n=n.prev;return r};g.prototype.reduce=function(t,e){var r,n=this.head;if(arguments.length>1)r=e;else if(this.head)n=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;n!==null;s++)r=t(r,n.value,s),n=n.next;return r};g.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else if(this.tail)n=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;n!==null;s--)r=t(r,n.value,s),n=n.prev;return r};g.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};g.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};g.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new g;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=0,s=this.head;s!==null&&n<t;n++)s=s.next;for(;s!==null&&n<e;n++,s=s.next)r.push(s.value);return r};g.prototype.sliceReverse=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new g;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=this.length,s=this.tail;s!==null&&n>e;n--)s=s.prev;for(;s!==null&&n>t;n--,s=s.prev)r.push(s.value);return r};g.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,s=this.head;s!==null&&n<t;n++)s=s.next;for(var i=[],n=0;s&&n<e;n++)i.push(s.value),s=this.removeNode(s);s===null&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(var n=0;n<r.length;n++)s=qs(this,s,r[n]);return i};g.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;r!==null;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=e,this.tail=t,this};function qs(t,e,r){var n=e===t.head?new G(r,null,e,t):new G(r,e,e.next,t);return n.next===null&&(t.tail=n),n.prev===null&&(t.head=n),t.length++,n}o(qs,"insert");function Ps(t,e){t.tail=new G(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}o(Ps,"push");function Cs(t,e){t.head=new G(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}o(Cs,"unshift");function G(t,e,r,n){if(!(this instanceof G))return new G(t,e,r,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}o(G,"Node");try{lr()(g)}catch{}});var Er=v((Yu,vr)=>{"use strict";var _s=fr(),j=Symbol("max"),_=Symbol("length"),V=Symbol("lengthCalculator"),J=Symbol("allowStale"),F=Symbol("maxAge"),C=Symbol("dispose"),pr=Symbol("noDisposeOnSet"),L=Symbol("lruList"),q=Symbol("cache"),mr=Symbol("updateAgeOnGet"),Te=o(()=>1,"naiveLength"),Ae=class{static{o(this,"LRUCache")}constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let r=this[j]=e.max||1/0,n=e.length||Te;if(this[V]=typeof n!="function"?Te:n,this[J]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[F]=e.maxAge||0,this[C]=e.dispose,this[pr]=e.noDisposeOnSet||!1,this[mr]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[j]=e||1/0,Z(this)}get max(){return this[j]}set allowStale(e){this[J]=!!e}get allowStale(){return this[J]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[F]=e,Z(this)}get maxAge(){return this[F]}set lengthCalculator(e){typeof e!="function"&&(e=Te),e!==this[V]&&(this[V]=e,this[_]=0,this[L].forEach(r=>{r.length=this[V](r.value,r.key),this[_]+=r.length})),Z(this)}get lengthCalculator(){return this[V]}get length(){return this[_]}get itemCount(){return this[L].length}rforEach(e,r){r=r||this;for(let n=this[L].tail;n!==null;){let s=n.prev;dr(this,e,n,r),n=s}}forEach(e,r){r=r||this;for(let n=this[L].head;n!==null;){let s=n.next;dr(this,e,n,r),n=s}}keys(){return this[L].toArray().map(e=>e.key)}values(){return this[L].toArray().map(e=>e.value)}reset(){this[C]&&this[L]&&this[L].length&&this[L].forEach(e=>this[C](e.key,e.value)),this[q]=new Map,this[L]=new _s,this[_]=0}dump(){return this[L].map(e=>de(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[L]}set(e,r,n){if(n=n||this[F],n&&typeof n!="number")throw new TypeError("maxAge must be a number");let s=n?Date.now():0,i=this[V](r,e);if(this[q].has(e)){if(i>this[j])return H(this,this[q].get(e)),!1;let c=this[q].get(e).value;return this[C]&&(this[pr]||this[C](e,c.value)),c.now=s,c.maxAge=n,c.value=r,this[_]+=i-c.length,c.length=i,this.get(e),Z(this),!0}let u=new be(e,r,i,s,n);return u.length>this[j]?(this[C]&&this[C](e,r),!1):(this[_]+=u.length,this[L].unshift(u),this[q].set(e,this[L].head),Z(this),!0)}has(e){if(!this[q].has(e))return!1;let r=this[q].get(e).value;return!de(this,r)}get(e){return Oe(this,e,!0)}peek(e){return Oe(this,e,!1)}pop(){let e=this[L].tail;return e?(H(this,e),e.value):null}del(e){H(this,this[q].get(e))}load(e){this.reset();let r=Date.now();for(let n=e.length-1;n>=0;n--){let s=e[n],i=s.e||0;if(i===0)this.set(s.k,s.v);else{let u=i-r;u>0&&this.set(s.k,s.v,u)}}}prune(){this[q].forEach((e,r)=>Oe(this,r,!1))}},Oe=o((t,e,r)=>{let n=t[q].get(e);if(n){let s=n.value;if(de(t,s)){if(H(t,n),!t[J])return}else r&&(t[mr]&&(n.value.now=Date.now()),t[L].unshiftNode(n));return s.value}},"get"),de=o((t,e)=>{if(!e||!e.maxAge&&!t[F])return!1;let r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[F]&&r>t[F]},"isStale"),Z=o(t=>{if(t[_]>t[j])for(let e=t[L].tail;t[_]>t[j]&&e!==null;){let r=e.prev;H(t,e),e=r}},"trim"),H=o((t,e)=>{if(e){let r=e.value;t[C]&&t[C](r.key,r.value),t[_]-=r.length,t[q].delete(r.key),t[L].removeNode(e)}},"del"),be=class{static{o(this,"Entry")}constructor(e,r,n,s,i){this.key=e,this.value=r,this.length=n,this.now=s,this.maxAge=i||0}},dr=o((t,e,r,n)=>{let s=r.value;de(t,s)&&(H(t,r),t[J]||(s=void 0)),s&&e.call(n,s.value,s.key,t)},"forEachStep");vr.exports=Ae});var A=v((Ku,Rr)=>{var qe=class t{static{o(this,"Range")}constructor(e,r){if(r=Us(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Pe)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!Ir(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Vs(s[0])){this.set=[s];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&Bs)|(this.options.loose&&Xs))+":"+e,s=gr.get(n);if(s)return s;let i=this.options.loose,u=i?T[w.HYPHENRANGELOOSE]:T[w.HYPHENRANGE];e=e.replace(u,ei(this.options.includePrerelease)),R("hyphen replace",e),e=e.replace(T[w.COMPARATORTRIM],js),R("comparator trim",e),e=e.replace(T[w.TILDETRIM],Fs),R("tilde trim",e),e=e.replace(T[w.CARETTRIM],Ms),R("caret trim",e);let a=e.split(" ").map(d=>Hs(d,this.options)).join(" ").split(/\s+/).map(d=>Qs(d,this.options));i&&(a=a.filter(d=>(R("loose invalid filter",d,this.options),!!d.match(T[w.COMPARATORLOOSE])))),R("range list",a);let c=new Map,h=a.map(d=>new Pe(d,this.options));for(let d of h){if(Ir(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return gr.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>yr(n,r)&&e.set.some(s=>yr(s,r)&&n.every(i=>s.every(u=>i.intersects(u,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Gs(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(ti(this.set[r],e,this.options))return!0;return!1}};Rr.exports=qe;var Ds=Er(),gr=new Ds({max:1e3}),Us=ie(),Pe=Q(),R=K(),Gs=S(),{safeRe:T,t:w,comparatorTrimReplace:js,tildeTrimReplace:Fs,caretTrimReplace:Ms}=B(),{FLAG_INCLUDE_PRERELEASE:Bs,FLAG_LOOSE:Xs}=W(),Ir=o(t=>t.value==="<0.0.0-0","isNullSet"),Vs=o(t=>t.value==="","isAny"),yr=o((t,e)=>{let r=!0,n=t.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,e)),s=n.pop();return r},"isSatisfiable"),Hs=o((t,e)=>(R("comp",t,e),t=Ws(t,e),R("caret",t),t=zs(t,e),R("tildes",t),t=ks(t,e),R("xrange",t),t=Js(t,e),R("stars",t),t),"parseComparator"),N=o(t=>!t||t.toLowerCase()==="x"||t==="*","isX"),zs=o((t,e)=>t.trim().split(/\s+/).map(r=>Ys(r,e)).join(" "),"replaceTildes"),Ys=o((t,e)=>{let r=e.loose?T[w.TILDELOOSE]:T[w.TILDE];return t.replace(r,(n,s,i,u,a)=>{R("tilde",t,n,s,i,u,a);let c;return N(s)?c="":N(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:N(u)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?(R("replaceTilde pr",a),c=`>=${s}.${i}.${u}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${u} <${s}.${+i+1}.0-0`,R("tilde return",c),c})},"replaceTilde"),Ws=o((t,e)=>t.trim().split(/\s+/).map(r=>Ks(r,e)).join(" "),"replaceCarets"),Ks=o((t,e)=>{R("caret",t,e);let r=e.loose?T[w.CARETLOOSE]:T[w.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(s,i,u,a,c)=>{R("caret",t,s,i,u,a,c);let h;return N(i)?h="":N(u)?h=`>=${i}.0.0${n} <${+i+1}.0.0-0`:N(a)?i==="0"?h=`>=${i}.${u}.0${n} <${i}.${+u+1}.0-0`:h=`>=${i}.${u}.0${n} <${+i+1}.0.0-0`:c?(R("replaceCaret pr",c),i==="0"?u==="0"?h=`>=${i}.${u}.${a}-${c} <${i}.${u}.${+a+1}-0`:h=`>=${i}.${u}.${a}-${c} <${i}.${+u+1}.0-0`:h=`>=${i}.${u}.${a}-${c} <${+i+1}.0.0-0`):(R("no pr"),i==="0"?u==="0"?h=`>=${i}.${u}.${a}${n} <${i}.${u}.${+a+1}-0`:h=`>=${i}.${u}.${a}${n} <${i}.${+u+1}.0-0`:h=`>=${i}.${u}.${a} <${+i+1}.0.0-0`),R("caret return",h),h})},"replaceCaret"),ks=o((t,e)=>(R("replaceXRanges",t,e),t.split(/\s+/).map(r=>Zs(r,e)).join(" ")),"replaceXRanges"),Zs=o((t,e)=>{t=t.trim();let r=e.loose?T[w.XRANGELOOSE]:T[w.XRANGE];return t.replace(r,(n,s,i,u,a,c)=>{R("xRange",t,n,s,i,u,a,c);let h=N(i),l=h||N(u),d=l||N(a),y=d;return s==="="&&y&&(s=""),c=e.includePrerelease?"-0":"",h?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&y?(l&&(u=0),a=0,s===">"?(s=">=",l?(i=+i+1,u=0,a=0):(u=+u+1,a=0)):s==="<="&&(s="<",l?i=+i+1:u=+u+1),s==="<"&&(c="-0"),n=`${s+i}.${u}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${u}.0${c} <${i}.${+u+1}.0-0`),R("xRange return",n),n})},"replaceXRange"),Js=o((t,e)=>(R("replaceStars",t,e),t.trim().replace(T[w.STAR],"")),"replaceStars"),Qs=o((t,e)=>(R("replaceGTE0",t,e),t.trim().replace(T[e.includePrerelease?w.GTE0PRE:w.GTE0],"")),"replaceGTE0"),ei=o(t=>(e,r,n,s,i,u,a,c,h,l,d,y,m)=>(N(n)?r="":N(s)?r=`>=${n}.0.0${t?"-0":""}`:N(i)?r=`>=${n}.${s}.0${t?"-0":""}`:u?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,N(h)?c="":N(l)?c=`<${+h+1}.0.0-0`:N(d)?c=`<${h}.${+l+1}.0-0`:y?c=`<=${h}.${l}.${d}-${y}`:t?c=`<${h}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),"hyphenReplace"),ti=o((t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(R(t[n].semver),t[n].semver!==Pe.ANY&&t[n].semver.prerelease.length>0){let s=t[n].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0},"testSet")});var Q=v((Zu,Nr)=>{var ee=Symbol("SemVer ANY"),De=class t{static{o(this,"Comparator")}static get ANY(){return ee}constructor(e,r){if(r=xr(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),_e("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===ee?this.value="":this.value=this.operator+this.semver.version,_e("comp",this)}parse(e){let r=this.options.loose?Lr[Sr.COMPARATORLOOSE]:Lr[Sr.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new $r(n[2],this.options.loose):this.semver=ee}toString(){return this.value}test(e){if(_e("Comparator.test",e,this.options.loose),this.semver===ee||e===ee)return!0;if(typeof e=="string")try{e=new $r(e,this.options)}catch{return!1}return Ce(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new wr(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new wr(this.value,r).test(e.semver):(r=xr(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Ce(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Ce(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Nr.exports=De;var xr=ie(),{safeRe:Lr,t:Sr}=B(),Ce=Ne(),_e=K(),$r=S(),wr=A()});var te=v((Qu,Tr)=>{var ri=A(),ni=o((t,e,r)=>{try{e=new ri(e,r)}catch{return!1}return e.test(t)},"satisfies");Tr.exports=ni});var Ar=v((ta,Or)=>{var si=A(),ii=o((t,e)=>new si(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" ")),"toComparators");Or.exports=ii});var qr=v((na,br)=>{var oi=S(),ui=A(),ai=o((t,e,r)=>{let n=null,s=null,i=null;try{i=new ui(e,r)}catch{return null}return t.forEach(u=>{i.test(u)&&(!n||s.compare(u)===-1)&&(n=u,s=new oi(n,r))}),n},"maxSatisfying");br.exports=ai});var Cr=v((ia,Pr)=>{var ci=S(),li=A(),hi=o((t,e,r)=>{let n=null,s=null,i=null;try{i=new li(e,r)}catch{return null}return t.forEach(u=>{i.test(u)&&(!n||s.compare(u)===1)&&(n=u,s=new ci(n,r))}),n},"minSatisfying");Pr.exports=hi});var Ur=v((ua,Dr)=>{var Ue=S(),fi=A(),_r=k(),pi=o((t,e)=>{t=new fi(t,e);let r=new Ue("0.0.0");if(t.test(r)||(r=new Ue("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let s=t.set[n],i=null;s.forEach(u=>{let a=new Ue(u.semver.version);switch(u.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||_r(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${u.operator}`)}}),i&&(!r||_r(r,i))&&(r=i)}return r&&t.test(r)?r:null},"minVersion");Dr.exports=pi});var jr=v((ca,Gr)=>{var di=A(),mi=o((t,e)=>{try{return new di(t,e).range||"*"}catch{return null}},"validRange");Gr.exports=mi});var me=v((ha,Xr)=>{var vi=S(),Br=Q(),{ANY:Ei}=Br,gi=A(),Ii=te(),Fr=k(),Mr=ce(),yi=he(),Ri=le(),xi=o((t,e,r,n)=>{t=new vi(t,n),e=new gi(e,n);let s,i,u,a,c;switch(r){case">":s=Fr,i=yi,u=Mr,a=">",c=">=";break;case"<":s=Mr,i=Ri,u=Fr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Ii(t,e,n))return!1;for(let h=0;h<e.set.length;++h){let l=e.set[h],d=null,y=null;if(l.forEach(m=>{m.semver===Ei&&(m=new Br(">=0.0.0")),d=d||m,y=y||m,s(m.semver,d.semver,n)?d=m:u(m.semver,y.semver,n)&&(y=m)}),d.operator===a||d.operator===c||(!y.operator||y.operator===a)&&i(t,y.semver))return!1;if(y.operator===c&&u(t,y.semver))return!1}return!0},"outside");Xr.exports=xi});var Hr=v((pa,Vr)=>{var Li=me(),Si=o((t,e,r)=>Li(t,e,">",r),"gtr");Vr.exports=Si});var Yr=v((ma,zr)=>{var $i=me(),wi=o((t,e,r)=>$i(t,e,"<",r),"ltr");zr.exports=wi});var kr=v((Ea,Kr)=>{var Wr=A(),Ni=o((t,e,r)=>(t=new Wr(t,r),e=new Wr(e,r),t.intersects(e,r)),"intersects");Kr.exports=Ni});var Jr=v((Ia,Zr)=>{var Ti=te(),Oi=O();Zr.exports=(t,e,r)=>{let n=[],s=null,i=null,u=t.sort((l,d)=>Oi(l,d,r));for(let l of u)Ti(l,e,r)?(i=l,s||(s=l)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===u[0]?a.push("*"):d?l===u[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),h=typeof e.raw=="string"?e.raw:String(e);return c.length<h.length?c:e}});var sn=v((ya,nn)=>{var Qr=A(),je=Q(),{ANY:Ge}=je,re=te(),Fe=O(),Ai=o((t,e,r={})=>{if(t===e)return!0;t=new Qr(t,r),e=new Qr(e,r);let n=!1;e:for(let s of t.set){for(let i of e.set){let u=qi(s,i,r);if(n=n||u!==null,u)continue e}if(n)return!1}return!0},"subset"),bi=[new je(">=0.0.0-0")],en=[new je(">=0.0.0")],qi=o((t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Ge){if(e.length===1&&e[0].semver===Ge)return!0;r.includePrerelease?t=bi:t=en}if(e.length===1&&e[0].semver===Ge){if(r.includePrerelease)return!0;e=en}let n=new Set,s,i;for(let m of t)m.operator===">"||m.operator===">="?s=tn(s,m,r):m.operator==="<"||m.operator==="<="?i=rn(i,m,r):n.add(m.semver);if(n.size>1)return null;let u;if(s&&i){if(u=Fe(s.semver,i.semver,r),u>0)return null;if(u===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let m of n){if(s&&!re(m,String(s),r)||i&&!re(m,String(i),r))return null;for(let pn of e)if(!re(m,String(pn),r))return!1;return!0}let a,c,h,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,y=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let m of e){if(l=l||m.operator===">"||m.operator===">=",h=h||m.operator==="<"||m.operator==="<=",s){if(y&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===y.major&&m.semver.minor===y.minor&&m.semver.patch===y.patch&&(y=!1),m.operator===">"||m.operator===">="){if(a=tn(s,m,r),a===m&&a!==s)return!1}else if(s.operator===">="&&!re(s.semver,String(m),r))return!1}if(i){if(d&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===d.major&&m.semver.minor===d.minor&&m.semver.patch===d.patch&&(d=!1),m.operator==="<"||m.operator==="<="){if(c=rn(i,m,r),c===m&&c!==i)return!1}else if(i.operator==="<="&&!re(i.semver,String(m),r))return!1}if(!m.operator&&(i||s)&&u!==0)return!1}return!(s&&h&&!i&&u!==0||i&&l&&!s&&u!==0||y||d)},"simpleSubset"),tn=o((t,e,r)=>{if(!t)return e;let n=Fe(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},"higherGT"),rn=o((t,e,r)=>{if(!t)return e;let n=Fe(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t},"lowerLT");nn.exports=Ai});var cn=v((xa,an)=>{var Me=B(),on=W(),Pi=S(),un=Le(),Ci=U(),_i=$t(),Di=Nt(),Ui=At(),Gi=Pt(),ji=_t(),Fi=Ut(),Mi=jt(),Bi=Mt(),Xi=O(),Vi=Ht(),Hi=Yt(),zi=ae(),Yi=Zt(),Wi=Qt(),Ki=k(),ki=ce(),Zi=$e(),Ji=we(),Qi=le(),eo=he(),to=Ne(),ro=ar(),no=Q(),so=A(),io=te(),oo=Ar(),uo=qr(),ao=Cr(),co=Ur(),lo=jr(),ho=me(),fo=Hr(),po=Yr(),mo=kr(),vo=Jr(),Eo=sn();an.exports={parse:Ci,valid:_i,clean:Di,inc:Ui,diff:Gi,major:ji,minor:Fi,patch:Mi,prerelease:Bi,compare:Xi,rcompare:Vi,compareLoose:Hi,compareBuild:zi,sort:Yi,rsort:Wi,gt:Ki,lt:ki,eq:Zi,neq:Ji,gte:Qi,lte:eo,cmp:to,coerce:ro,Comparator:no,Range:so,satisfies:io,toComparators:oo,maxSatisfying:uo,minSatisfying:ao,minVersion:co,validRange:lo,outside:ho,gtr:fo,ltr:po,intersects:mo,simplifyRange:vo,subset:Eo,SemVer:Pi,re:Me.re,src:Me.src,tokens:Me.t,SEMVER_SPEC_VERSION:on.SEMVER_SPEC_VERSION,RELEASE_TYPES:on.RELEASE_TYPES,compareIdentifiers:un.compareIdentifiers,rcompareIdentifiers:un.rcompareIdentifiers}});var st,it,M=typeof Reflect=="object"?Reflect:null,Ze=M&&typeof M.apply=="function"?M.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};it=M&&typeof M.ownKeys=="function"?M.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var Je=Number.isNaN||function(t){return t!=t};function I(){I.init.call(this)}o(I,"o");st=I,I.EventEmitter=I,I.prototype._events=void 0,I.prototype._eventsCount=0,I.prototype._maxListeners=void 0;var Qe=10;function ne(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}o(ne,"u");function ot(t){return t._maxListeners===void 0?I.defaultMaxListeners:t._maxListeners}o(ot,"f");function et(t,e,r,n){var s,i,u,a;if(ne(r),(i=t._events)===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),u=i[e]),u===void 0)u=i[e]=r,++t._eventsCount;else if(typeof u=="function"?u=i[e]=n?[r,u]:[u,r]:n?u.unshift(r):u.push(r),(s=ot(t))>0&&u.length>s&&!u.warned){u.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=u.length,a=c,console&&console.warn&&console.warn(a)}return t}o(et,"v");function mn(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}o(mn,"a");function tt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=mn.bind(n);return s.listener=r,n.wrapFn=s,s}o(tt,"l");function rt(t,e,r){var n=t._events;if(n===void 0)return[];var s=n[e];return s===void 0?[]:typeof s=="function"?r?[s.listener||s]:[s]:r?function(i){for(var u=new Array(i.length),a=0;a<u.length;++a)u[a]=i[a].listener||i[a];return u}(s):ut(s,s.length)}o(rt,"h");function nt(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}o(nt,"p");function ut(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}o(ut,"c");Object.defineProperty(I,"defaultMaxListeners",{enumerable:!0,get:function(){return Qe},set:function(t){if(typeof t!="number"||t<0||Je(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Qe=t}}),I.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},I.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Je(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},I.prototype.getMaxListeners=function(){return ot(this)},I.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n=t==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var u=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw u.context=i,u}var a=s[t];if(a===void 0)return!1;if(typeof a=="function")Ze(a,this,e);else{var c=a.length,h=ut(a,c);for(r=0;r<c;++r)Ze(h[r],this,e)}return!0},I.prototype.addListener=function(t,e){return et(this,t,e,!1)},I.prototype.on=I.prototype.addListener,I.prototype.prependListener=function(t,e){return et(this,t,e,!0)},I.prototype.once=function(t,e){return ne(e),this.on(t,tt(this,t,e)),this},I.prototype.prependOnceListener=function(t,e){return ne(e),this.prependListener(t,tt(this,t,e)),this},I.prototype.removeListener=function(t,e){var r,n,s,i,u;if(ne(e),(n=this._events)===void 0)return this;if((r=n[t])===void 0)return this;if(r===e||r.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if(typeof r!="function"){for(s=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){u=r[i].listener,s=i;break}if(s<0)return this;s===0?r.shift():function(a,c){for(;c+1<a.length;c++)a[c]=a[c+1];a.pop()}(r,s),r.length===1&&(n[t]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",t,u||e)}return this},I.prototype.off=I.prototype.removeListener,I.prototype.removeAllListeners=function(t){var e,r,n;if((r=this._events)===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var s,i=Object.keys(r);for(n=0;n<i.length;++n)(s=i[n])!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=r[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},I.prototype.listeners=function(t){return rt(this,t,!0)},I.prototype.rawListeners=function(t){return rt(this,t,!1)},I.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):nt.call(t,e)},I.prototype.listenerCount=nt,I.prototype.eventNames=function(){return this._eventsCount>0?it(this._events):[]};var $=st;$.EventEmitter;$.defaultMaxListeners;$.init;$.listenerCount;$.EventEmitter;$.defaultMaxListeners;$.init;$.listenerCount;$.once=function(t,e){return new Promise((r,n)=>{function s(...u){i!==void 0&&t.removeListener("error",i),r(u)}o(s,"eventListener");let i;e!=="error"&&(i=o(u=>{t.removeListener(name,s),n(u)},"errorListener"),t.once("error",i)),t.once(e,s)})};$.on=function(t,e){let r=[],n=[],s=null,i=!1,u={async next(){let h=r.shift();if(h)return createIterResult(h,!1);if(s){let l=Promise.reject(s);return s=null,l}return i?createIterResult(void 0,!0):new Promise((l,d)=>n.push({resolve:l,reject:d}))},async return(){t.removeListener(e,a),t.removeListener("error",c),i=!0;for(let h of n)h.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(h){s=h,t.removeListener(e,a),t.removeListener("error",c)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",c),u;function a(...h){let l=n.shift();l?l.resolve(createIterResult(h,!1)):r.push(h)}o(a,"eventHandler");function c(h){i=!0;let l=n.shift();l?l.reject(h):s=h,u.return()}o(c,"errorHandler")};var{EventEmitter:$o,defaultMaxListeners:wo,init:No,listenerCount:To,on:Oo,once:Ao}=$;var se=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(u){u(i)})}return o(s,"adopt"),new(r||(r=Promise))(function(i,u){function a(l){try{h(n.next(l))}catch(d){u(d)}}o(a,"fulfilled");function c(l){try{h(n.throw(l))}catch(d){u(d)}}o(c,"rejected");function h(l){l.done?i(l.value):s(l.value).then(a,c)}o(h,"step"),h((n=n.apply(t,e||[])).next())})};var vn="transport",Y=class{static{o(this,"Transport")}constructor({context:e,logType:r}={}){this.exchangeTimeout=3e4,this.unresponsiveTimeout=15e3,this.deviceModel=null,this._events=new $,this.send=(n,s,i,u,a=Buffer.alloc(0),c=[Ie.OK],{abortTimeoutMs:h}={})=>se(this,void 0,void 0,function*(){let l=this.tracer.withUpdatedContext({function:"send"});if(a.length>=256)throw l.trace("data.length exceeded 256 bytes limit",{dataLength:a.length}),new b("data.length exceed 256 bytes limit. Got: "+a.length,"DataLengthTooBig");l.trace("Starting an exchange",{abortTimeoutMs:h});let d=yield this.exchange(Buffer.concat([Buffer.from([n,s,i,u]),Buffer.from([a.length]),a]),{abortTimeoutMs:h});l.trace("Received response from exchange");let y=d.readUInt16BE(d.length-2);if(!c.some(m=>m===y))throw new ye(y);return d}),this._appAPIlock=null,this.tracer=new Ye(r??vn,e)}exchange(e,{abortTimeoutMs:r}={}){throw new Error("exchange not implemented")}exchangeBulk(e,r){let n=!1,s=o(()=>{n=!0},"unsubscribe");return o(()=>se(this,void 0,void 0,function*(){if(!n)for(let u of e){let a=yield this.exchange(u);if(n)return;let c=a.readUInt16BE(a.length-2);if(c!==Ie.OK)throw new ye(c);r.next(a)}}),"main")().then(()=>!n&&r.complete(),u=>!n&&r.error(u)),{unsubscribe:s}}setScrambleKey(e){}close(){return Promise.resolve()}on(e,r){this._events.on(e,r)}off(e,r){this._events.removeListener(e,r)}emit(e,...r){this._events.emit(e,...r)}setDebugMode(){console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.")}setExchangeTimeout(e){this.exchangeTimeout=e}setExchangeUnresponsiveTimeout(e){this.unresponsiveTimeout=e}static create(e=3e3,r){return new Promise((n,s)=>{let i=!1,u=this.listen({next:c=>{i=!0,u&&u.unsubscribe(),a&&clearTimeout(a),this.open(c.descriptor,e).then(n,s)},error:c=>{a&&clearTimeout(a),s(c)},complete:()=>{a&&clearTimeout(a),i||s(new b(this.ErrorMessage_NoDeviceFound,"NoDeviceFound"))}}),a=r?setTimeout(()=>{u.unsubscribe(),s(new b(this.ErrorMessage_ListenTimeout,"ListenTimeout"))},r):null})}exchangeAtomicImpl(e){return se(this,void 0,void 0,function*(){let r=this.tracer.withUpdatedContext({function:"exchangeAtomicImpl",unresponsiveTimeout:this.unresponsiveTimeout});if(this.exchangeBusyPromise)throw r.trace("Atomic exchange is already busy"),new ke("An action was already pending on the Ledger device. Please deny or reconnect.");let n,s=new Promise(a=>{n=a});this.exchangeBusyPromise=s;let i=!1,u=setTimeout(()=>{r.trace('Timeout reached, emitting Transport event "unresponsive"',{unresponsiveTimeout:this.unresponsiveTimeout}),i=!0,this.emit("unresponsive")},this.unresponsiveTimeout);try{let a=yield e();return i&&(r.trace("Device was unresponsive, emitting responsive"),this.emit("responsive")),a}finally{r.trace("Finalize, clearing busy guard"),clearTimeout(u),n&&n(),this.exchangeBusyPromise=null}})}decorateAppAPIMethods(e,r,n){for(let s of r)e[s]=this.decorateAppAPIMethod(s,e[s],e,n)}decorateAppAPIMethod(e,r,n,s){return(...i)=>se(this,void 0,void 0,function*(){let{_appAPIlock:u}=this;if(u)return Promise.reject(new b("Ledger Device is busy (lock "+u+")","TransportLocked"));try{return this._appAPIlock=e,this.setScrambleKey(s),yield r.apply(n,i)}finally{this._appAPIlock=null}})}setTraceContext(e){this.tracer=this.tracer.withContext(e)}updateTraceContext(e){this.tracer.updateContext(e)}getTraceContext(){return this.tracer.getContext()}};Y.ErrorMessage_ListenTimeout="No Ledger device found (timeout)";Y.ErrorMessage_NoDeviceFound="No Ledger device found";var at=Y;var ct=5;function En(t){let e=Buffer.alloc(2);return e.writeUInt16BE(t,0),e}o(En,"asUInt16BE");var gn={data:Buffer.alloc(0),dataLength:0,sequence:0},In=o((t,e)=>({makeBlocks(r){let n=Buffer.concat([En(r.length),r]),s=e-5,i=Math.ceil(n.length/s);n=Buffer.concat([n,Buffer.alloc(i*s-n.length+1).fill(0)]);let u=[];for(let a=0;a<i;a++){let c=Buffer.alloc(5);c.writeUInt16BE(t,0),c.writeUInt8(ct,2),c.writeUInt16BE(a,3);let h=n.slice(a*s,(a+1)*s);u.push(Buffer.concat([c,h]))}return u},reduceResponse(r,n){let{data:s,dataLength:i,sequence:u}=r||gn;if(n.readUInt16BE(0)!==t)throw new b("Invalid channel","InvalidChannel");if(n.readUInt8(2)!==ct)throw new b("Invalid tag","InvalidTag");if(n.readUInt16BE(3)!==u)throw new b("Invalid sequence","InvalidSequence");r||(i=n.readUInt16BE(5)),u++;let a=n.slice(r?5:7);return s=Buffer.concat([s,a]),s.length>i&&(s=s.slice(0,i)),{data:s,dataLength:i,sequence:u}},getReducedResult(r){if(r&&r.dataLength===r.data.length)return r.data}}),"createHIDframing"),lt=In;var Be=dn(cn());var x;(function(t){t.blue="blue",t.nanoS="nanoS",t.nanoSP="nanoSP",t.nanoX="nanoX",t.stax="stax",t.europa="europa"})(x||(x={}));var Xe={[x.blue]:{id:x.blue,productName:"Ledger\xA0Blue",productIdMM:0,legacyUsbProductId:0,usbOnly:!0,memorySize:480*1024,masks:[822083584,822149120],getBlockSize:t=>4*1024},[x.nanoS]:{id:x.nanoS,productName:"Ledger\xA0Nano\xA0S",productIdMM:16,legacyUsbProductId:1,usbOnly:!0,memorySize:320*1024,masks:[823132160],getBlockSize:t=>{var e;return Be.default.lt((e=Be.default.coerce(t))!==null&&e!==void 0?e:"","2.0.0")?4*1024:2*1024}},[x.nanoX]:{id:x.nanoX,productName:"Ledger\xA0Nano\xA0X",productIdMM:64,legacyUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,masks:[855638016],getBlockSize:t=>4*1024,bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]},[x.nanoSP]:{id:x.nanoSP,productName:"Ledger Nano S Plus",productIdMM:80,legacyUsbProductId:5,usbOnly:!0,memorySize:1533*1024,masks:[856686592],getBlockSize:t=>32},[x.stax]:{id:x.stax,productName:"Ledger\xA0Stax",productIdMM:96,legacyUsbProductId:6,usbOnly:!1,memorySize:1533*1024,masks:[857735168],getBlockSize:t=>32,bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]},[x.europa]:{id:x.europa,productName:"Ledger Europa",productIdMM:112,legacyUsbProductId:7,usbOnly:!1,memorySize:1533*1024,masks:[858783744],getBlockSize:t=>32,bluetoothSpec:[{serviceUuid:"13d63400-2c97-3004-0000-4c6564676572",notifyUuid:"13d63400-2c97-3004-0001-4c6564676572",writeUuid:"13d63400-2c97-3004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-3004-0003-4c6564676572"}]}},La={Blue:x.blue,"Nano S":x.nanoS,"Nano S Plus":x.nanoSP,"Nano X":x.nanoX,Stax:x.stax,Europa:x.europa},ln=Object.values(Xe),Ve=11415;var He=o(t=>{let e=ln.find(s=>s.legacyUsbProductId===t);if(e)return e;let r=t>>8;return ln.find(s=>s.productIdMM===r)},"identifyUSBProductId");var go=[],hn={};for(let t in Xe){let e=Xe[t],{bluetoothSpec:r}=e;if(r)for(let n=0;n<r.length;n++){let s=r[n];go.push(s.serviceUuid),hn[s.serviceUuid]=hn[s.serviceUuid.replace(/-/g,"")]=Object.assign({deviceModel:e},s)}}var D=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(u){u(i)})}return o(s,"adopt"),new(r||(r=Promise))(function(i,u){function a(l){try{h(n.next(l))}catch(d){u(d)}}o(a,"fulfilled");function c(l){try{h(n.throw(l))}catch(d){u(d)}}o(c,"rejected");function h(l){l.done?i(l.value):s(l.value).then(a,c)}o(h,"step"),h((n=n.apply(t,e||[])).next())})},Io=[{vendorId:Ve}],yo=o(()=>Promise.resolve(!!(window.navigator&&window.navigator.hid)),"isSupported"),ve=o(()=>{let{hid:t}=navigator;if(!t)throw new b("navigator.hid is not supported","HIDNotSupported");return t},"getHID");function fn(){return D(this,void 0,void 0,function*(){let t=yield ve().requestDevice({filters:Io});return Array.isArray(t)?t:[t]})}o(fn,"requestLedgerDevices");function ze(){return D(this,void 0,void 0,function*(){return(yield ve().getDevices()).filter(e=>e.vendorId===Ve)})}o(ze,"getLedgerDevices");function Ro(){return D(this,void 0,void 0,function*(){let t=yield ze();return t.length>0?t[0]:(yield fn())[0]})}o(Ro,"getFirstLedgerDevice");var z=class t extends at{static{o(this,"TransportWebHID")}constructor(e){super(),this.channel=Math.floor(Math.random()*65535),this.packetSize=64,this.inputs=[],this.read=()=>this.inputs.length?Promise.resolve(this.inputs.shift()):new Promise(r=>{this.inputCallback=r}),this.onInputReport=r=>{let n=Buffer.from(r.data.buffer);this.inputCallback?(this.inputCallback(n),this.inputCallback=null):this.inputs.push(n)},this._disconnectEmitted=!1,this._emitDisconnect=r=>{this._disconnectEmitted||(this._disconnectEmitted=!0,this.emit("disconnect",r))},this.exchange=r=>D(this,void 0,void 0,function*(){return yield this.exchangeAtomicImpl(()=>D(this,void 0,void 0,function*(){let{channel:s,packetSize:i}=this;Ee("apdu","=> "+r.toString("hex"));let u=lt(s,i),a=u.makeBlocks(r);for(let l=0;l<a.length;l++)yield this.device.sendReport(0,a[l]);let c,h;for(;!(c=u.getReducedResult(h));){let l=yield this.read();h=u.reduceResponse(h,l)}return Ee("apdu","<= "+c.toString("hex")),c})).catch(s=>{throw s&&s.message&&s.message.includes("write")?(this._emitDisconnect(s),new Ke(s.message)):s})}),this.device=e,this.deviceModel=typeof e.productId=="number"?He(e.productId):void 0,e.addEventListener("inputreport",this.onInputReport)}static request(){return D(this,void 0,void 0,function*(){let[e]=yield fn();return t.open(e)})}static openConnected(){return D(this,void 0,void 0,function*(){let e=yield ze();return e.length===0?null:t.open(e[0])})}static open(e){return D(this,void 0,void 0,function*(){yield e.open();let r=new t(e),n=o(s=>{e===s.device&&(ve().removeEventListener("disconnect",n),r._emitDisconnect(new We))},"onDisconnect");return ve().addEventListener("disconnect",n),r})}close(){return D(this,void 0,void 0,function*(){yield this.exchangeBusyPromise,this.device.removeEventListener("inputreport",this.onInputReport),yield this.device.close()})}setScrambleKey(){}};z.isSupported=yo;z.list=ze;z.listen=t=>{let e=!1;Ro().then(n=>{if(!n)t.error(new ge("Access denied to use Ledger device"));else if(!e){let s=typeof n.productId=="number"?He(n.productId):void 0;t.next({type:"add",descriptor:n,deviceModel:s}),t.complete()}},n=>{t.error(new ge(n.message))});function r(){e=!0}return o(r,"unsubscribe"),{unsubscribe:r}};var ba=z;export{ba as default};
2
- //# sourceMappingURL=TransportWebHID-HV53OYSS.js.map
1
+ import{a as ye,b as ke}from"./chunk-5QSDSOWH.js";import{a as o,c as v,e as dn,g as Ye,h as We,i as Ee,j as Ke,k as b,l as ge,n as Ie}from"./chunk-CVKDPNYM.js";var W=v((Xo,ht)=>{var yn="2.0.0",Rn=Number.MAX_SAFE_INTEGER||9007199254740991,xn=16,Ln=250,Sn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ht.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:xn,MAX_SAFE_BUILD_LENGTH:Ln,MAX_SAFE_INTEGER:Rn,RELEASE_TYPES:Sn,SEMVER_SPEC_VERSION:yn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var K=v((Vo,ft)=>{var $n=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};ft.exports=$n});var B=v((P,pt)=>{var{MAX_SAFE_COMPONENT_LENGTH:Re,MAX_SAFE_BUILD_LENGTH:wn,MAX_LENGTH:Nn}=W(),Tn=K();P=pt.exports={};var On=P.re=[],An=P.safeRe=[],f=P.src=[],p=P.t={},bn=0,xe="[a-zA-Z0-9-]",qn=[["\\s",1],["\\d",Nn],[xe,wn]],Pn=o(t=>{for(let[e,r]of qn)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},"makeSafeRegex"),E=o((t,e,r)=>{let n=Pn(e),s=bn++;Tn(t,s,e),p[t]=s,f[s]=e,On[s]=new RegExp(e,r?"g":void 0),An[s]=new RegExp(n,r?"g":void 0)},"createToken");E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${xe}*`);E("MAINVERSION",`(${f[p.NUMERICIDENTIFIER]})\\.(${f[p.NUMERICIDENTIFIER]})\\.(${f[p.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${f[p.NUMERICIDENTIFIERLOOSE]})\\.(${f[p.NUMERICIDENTIFIERLOOSE]})\\.(${f[p.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${f[p.NUMERICIDENTIFIER]}|${f[p.NONNUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${f[p.NUMERICIDENTIFIERLOOSE]}|${f[p.NONNUMERICIDENTIFIER]})`);E("PRERELEASE",`(?:-(${f[p.PRERELEASEIDENTIFIER]}(?:\\.${f[p.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${f[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${f[p.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${xe}+`);E("BUILD",`(?:\\+(${f[p.BUILDIDENTIFIER]}(?:\\.${f[p.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${f[p.MAINVERSION]}${f[p.PRERELEASE]}?${f[p.BUILD]}?`);E("FULL",`^${f[p.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${f[p.MAINVERSIONLOOSE]}${f[p.PRERELEASELOOSE]}?${f[p.BUILD]}?`);E("LOOSE",`^${f[p.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${f[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${f[p.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${f[p.XRANGEIDENTIFIER]})(?:\\.(${f[p.XRANGEIDENTIFIER]})(?:\\.(${f[p.XRANGEIDENTIFIER]})(?:${f[p.PRERELEASE]})?${f[p.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${f[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${f[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${f[p.XRANGEIDENTIFIERLOOSE]})(?:${f[p.PRERELEASELOOSE]})?${f[p.BUILD]}?)?)?`);E("XRANGE",`^${f[p.GTLT]}\\s*${f[p.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${f[p.GTLT]}\\s*${f[p.XRANGEPLAINLOOSE]}$`);E("COERCE",`(^|[^\\d])(\\d{1,${Re}})(?:\\.(\\d{1,${Re}}))?(?:\\.(\\d{1,${Re}}))?(?:$|[^\\d])`);E("COERCERTL",f[p.COERCE],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${f[p.LONETILDE]}\\s+`,!0);P.tildeTrimReplace="$1~";E("TILDE",`^${f[p.LONETILDE]}${f[p.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${f[p.LONETILDE]}${f[p.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${f[p.LONECARET]}\\s+`,!0);P.caretTrimReplace="$1^";E("CARET",`^${f[p.LONECARET]}${f[p.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${f[p.LONECARET]}${f[p.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${f[p.GTLT]}\\s*(${f[p.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${f[p.GTLT]}\\s*(${f[p.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${f[p.GTLT]}\\s*(${f[p.LOOSEPLAIN]}|${f[p.XRANGEPLAIN]})`,!0);P.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${f[p.XRANGEPLAIN]})\\s+-\\s+(${f[p.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${f[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${f[p.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ie=v((zo,dt)=>{var Cn=Object.freeze({loose:!0}),_n=Object.freeze({}),Dn=o(t=>t?typeof t!="object"?Cn:t:_n,"parseOptions");dt.exports=Dn});var Le=v((Wo,Et)=>{var mt=/^[0-9]+$/,vt=o((t,e)=>{let r=mt.test(t),n=mt.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},"compareIdentifiers"),Un=o((t,e)=>vt(e,t),"rcompareIdentifiers");Et.exports={compareIdentifiers:vt,rcompareIdentifiers:Un}});var S=v((ko,Rt)=>{var oe=K(),{MAX_LENGTH:gt,MAX_SAFE_INTEGER:ue}=W(),{safeRe:It,t:yt}=B(),Gn=ie(),{compareIdentifiers:X}=Le(),Se=class t{static{o(this,"SemVer")}constructor(e,r){if(r=Gn(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>gt)throw new TypeError(`version is longer than ${gt} characters`);oe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?It[yt.LOOSE]:It[yt.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>ue||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ue||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ue||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&i<ue)return i}return s}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(oe("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),X(this.major,e.major)||X(this.minor,e.minor)||X(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=e.prerelease[r];if(oe("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return X(n,s)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],s=e.build[r];if(oe("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return X(n,s)}while(++r)}inc(e,r,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),X(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Rt.exports=Se});var U=v((Jo,Lt)=>{var xt=S(),jn=o((t,e,r=!1)=>{if(t instanceof xt)return t;try{return new xt(t,e)}catch(n){if(!r)return null;throw n}},"parse");Lt.exports=jn});var $t=v((eu,St)=>{var Fn=U(),Mn=o((t,e)=>{let r=Fn(t,e);return r?r.version:null},"valid");St.exports=Mn});var Nt=v((ru,wt)=>{var Bn=U(),Xn=o((t,e)=>{let r=Bn(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null},"clean");wt.exports=Xn});var At=v((su,Ot)=>{var Tt=S(),Vn=o((t,e,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Tt(t instanceof Tt?t.version:t,r).inc(e,n,s).version}catch{return null}},"inc");Ot.exports=Vn});var Pt=v((ou,qt)=>{var bt=U(),Hn=o((t,e)=>{let r=bt(t,null,!0),n=bt(e,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,u=i?r:n,a=i?n:r,c=!!u.prerelease.length;if(!!a.prerelease.length&&!c)return!a.patch&&!a.minor?"major":u.patch?"patch":u.minor?"minor":"major";let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"},"diff");qt.exports=Hn});var _t=v((au,Ct)=>{var zn=S(),Yn=o((t,e)=>new zn(t,e).major,"major");Ct.exports=Yn});var Ut=v((lu,Dt)=>{var Wn=S(),Kn=o((t,e)=>new Wn(t,e).minor,"minor");Dt.exports=Kn});var jt=v((fu,Gt)=>{var kn=S(),Zn=o((t,e)=>new kn(t,e).patch,"patch");Gt.exports=Zn});var Mt=v((du,Ft)=>{var Jn=U(),Qn=o((t,e)=>{let r=Jn(t,e);return r&&r.prerelease.length?r.prerelease:null},"prerelease");Ft.exports=Qn});var O=v((vu,Xt)=>{var Bt=S(),es=o((t,e,r)=>new Bt(t,r).compare(new Bt(e,r)),"compare");Xt.exports=es});var Ht=v((gu,Vt)=>{var ts=O(),rs=o((t,e,r)=>ts(e,t,r),"rcompare");Vt.exports=rs});var Yt=v((yu,zt)=>{var ns=O(),ss=o((t,e)=>ns(t,e,!0),"compareLoose");zt.exports=ss});var ae=v((xu,Kt)=>{var Wt=S(),is=o((t,e,r)=>{let n=new Wt(t,r),s=new Wt(e,r);return n.compare(s)||n.compareBuild(s)},"compareBuild");Kt.exports=is});var Zt=v((Su,kt)=>{var os=ae(),us=o((t,e)=>t.sort((r,n)=>os(r,n,e)),"sort");kt.exports=us});var Qt=v((wu,Jt)=>{var as=ae(),cs=o((t,e)=>t.sort((r,n)=>as(n,r,e)),"rsort");Jt.exports=cs});var k=v((Tu,er)=>{var ls=O(),hs=o((t,e,r)=>ls(t,e,r)>0,"gt");er.exports=hs});var ce=v((Au,tr)=>{var fs=O(),ps=o((t,e,r)=>fs(t,e,r)<0,"lt");tr.exports=ps});var $e=v((qu,rr)=>{var ds=O(),ms=o((t,e,r)=>ds(t,e,r)===0,"eq");rr.exports=ms});var we=v((Cu,nr)=>{var vs=O(),Es=o((t,e,r)=>vs(t,e,r)!==0,"neq");nr.exports=Es});var le=v((Du,sr)=>{var gs=O(),Is=o((t,e,r)=>gs(t,e,r)>=0,"gte");sr.exports=Is});var he=v((Gu,ir)=>{var ys=O(),Rs=o((t,e,r)=>ys(t,e,r)<=0,"lte");ir.exports=Rs});var Ne=v((Fu,or)=>{var xs=$e(),Ls=we(),Ss=k(),$s=le(),ws=ce(),Ns=he(),Ts=o((t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return xs(t,r,n);case"!=":return Ls(t,r,n);case">":return Ss(t,r,n);case">=":return $s(t,r,n);case"<":return ws(t,r,n);case"<=":return Ns(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}},"cmp");or.exports=Ts});var ar=v((Bu,ur)=>{var Os=S(),As=U(),{safeRe:fe,t:pe}=B(),bs=o((t,e)=>{if(t instanceof Os)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(fe[pe.COERCE]);else{let n;for(;(n=fe[pe.COERCERTL].exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||n.index+n[0].length!==r.index+r[0].length)&&(r=n),fe[pe.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;fe[pe.COERCERTL].lastIndex=-1}return r===null?null:As(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,e)},"coerce");ur.exports=bs});var lr=v((Vu,cr)=>{"use strict";cr.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var fr=v((Hu,hr)=>{"use strict";hr.exports=g;g.Node=G;g.create=g;function g(t){var e=this;if(e instanceof g||(e=new g),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(s){e.push(s)});else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)e.push(arguments[r]);return e}o(g,"Yallist");g.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e};g.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}};g.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}};g.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)Ps(this,arguments[t]);return this.length};g.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)Cs(this,arguments[t]);return this.length};g.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}};g.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}};g.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,n=0;r!==null;n++)t.call(e,r.value,n,this),r=r.next};g.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,n=this.length-1;r!==null;n--)t.call(e,r.value,n,this),r=r.prev};g.prototype.get=function(t){for(var e=0,r=this.head;r!==null&&e<t;e++)r=r.next;if(e===t&&r!==null)return r.value};g.prototype.getReverse=function(t){for(var e=0,r=this.tail;r!==null&&e<t;e++)r=r.prev;if(e===t&&r!==null)return r.value};g.prototype.map=function(t,e){e=e||this;for(var r=new g,n=this.head;n!==null;)r.push(t.call(e,n.value,this)),n=n.next;return r};g.prototype.mapReverse=function(t,e){e=e||this;for(var r=new g,n=this.tail;n!==null;)r.push(t.call(e,n.value,this)),n=n.prev;return r};g.prototype.reduce=function(t,e){var r,n=this.head;if(arguments.length>1)r=e;else if(this.head)n=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;n!==null;s++)r=t(r,n.value,s),n=n.next;return r};g.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else if(this.tail)n=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;n!==null;s--)r=t(r,n.value,s),n=n.prev;return r};g.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};g.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};g.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new g;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=0,s=this.head;s!==null&&n<t;n++)s=s.next;for(;s!==null&&n<e;n++,s=s.next)r.push(s.value);return r};g.prototype.sliceReverse=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new g;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=this.length,s=this.tail;s!==null&&n>e;n--)s=s.prev;for(;s!==null&&n>t;n--,s=s.prev)r.push(s.value);return r};g.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,s=this.head;s!==null&&n<t;n++)s=s.next;for(var i=[],n=0;s&&n<e;n++)i.push(s.value),s=this.removeNode(s);s===null&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(var n=0;n<r.length;n++)s=qs(this,s,r[n]);return i};g.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;r!==null;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=e,this.tail=t,this};function qs(t,e,r){var n=e===t.head?new G(r,null,e,t):new G(r,e,e.next,t);return n.next===null&&(t.tail=n),n.prev===null&&(t.head=n),t.length++,n}o(qs,"insert");function Ps(t,e){t.tail=new G(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}o(Ps,"push");function Cs(t,e){t.head=new G(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}o(Cs,"unshift");function G(t,e,r,n){if(!(this instanceof G))return new G(t,e,r,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}o(G,"Node");try{lr()(g)}catch{}});var Er=v((Yu,vr)=>{"use strict";var _s=fr(),j=Symbol("max"),_=Symbol("length"),V=Symbol("lengthCalculator"),J=Symbol("allowStale"),F=Symbol("maxAge"),C=Symbol("dispose"),pr=Symbol("noDisposeOnSet"),L=Symbol("lruList"),q=Symbol("cache"),mr=Symbol("updateAgeOnGet"),Te=o(()=>1,"naiveLength"),Ae=class{static{o(this,"LRUCache")}constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let r=this[j]=e.max||1/0,n=e.length||Te;if(this[V]=typeof n!="function"?Te:n,this[J]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[F]=e.maxAge||0,this[C]=e.dispose,this[pr]=e.noDisposeOnSet||!1,this[mr]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[j]=e||1/0,Z(this)}get max(){return this[j]}set allowStale(e){this[J]=!!e}get allowStale(){return this[J]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[F]=e,Z(this)}get maxAge(){return this[F]}set lengthCalculator(e){typeof e!="function"&&(e=Te),e!==this[V]&&(this[V]=e,this[_]=0,this[L].forEach(r=>{r.length=this[V](r.value,r.key),this[_]+=r.length})),Z(this)}get lengthCalculator(){return this[V]}get length(){return this[_]}get itemCount(){return this[L].length}rforEach(e,r){r=r||this;for(let n=this[L].tail;n!==null;){let s=n.prev;dr(this,e,n,r),n=s}}forEach(e,r){r=r||this;for(let n=this[L].head;n!==null;){let s=n.next;dr(this,e,n,r),n=s}}keys(){return this[L].toArray().map(e=>e.key)}values(){return this[L].toArray().map(e=>e.value)}reset(){this[C]&&this[L]&&this[L].length&&this[L].forEach(e=>this[C](e.key,e.value)),this[q]=new Map,this[L]=new _s,this[_]=0}dump(){return this[L].map(e=>de(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[L]}set(e,r,n){if(n=n||this[F],n&&typeof n!="number")throw new TypeError("maxAge must be a number");let s=n?Date.now():0,i=this[V](r,e);if(this[q].has(e)){if(i>this[j])return H(this,this[q].get(e)),!1;let c=this[q].get(e).value;return this[C]&&(this[pr]||this[C](e,c.value)),c.now=s,c.maxAge=n,c.value=r,this[_]+=i-c.length,c.length=i,this.get(e),Z(this),!0}let u=new be(e,r,i,s,n);return u.length>this[j]?(this[C]&&this[C](e,r),!1):(this[_]+=u.length,this[L].unshift(u),this[q].set(e,this[L].head),Z(this),!0)}has(e){if(!this[q].has(e))return!1;let r=this[q].get(e).value;return!de(this,r)}get(e){return Oe(this,e,!0)}peek(e){return Oe(this,e,!1)}pop(){let e=this[L].tail;return e?(H(this,e),e.value):null}del(e){H(this,this[q].get(e))}load(e){this.reset();let r=Date.now();for(let n=e.length-1;n>=0;n--){let s=e[n],i=s.e||0;if(i===0)this.set(s.k,s.v);else{let u=i-r;u>0&&this.set(s.k,s.v,u)}}}prune(){this[q].forEach((e,r)=>Oe(this,r,!1))}},Oe=o((t,e,r)=>{let n=t[q].get(e);if(n){let s=n.value;if(de(t,s)){if(H(t,n),!t[J])return}else r&&(t[mr]&&(n.value.now=Date.now()),t[L].unshiftNode(n));return s.value}},"get"),de=o((t,e)=>{if(!e||!e.maxAge&&!t[F])return!1;let r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[F]&&r>t[F]},"isStale"),Z=o(t=>{if(t[_]>t[j])for(let e=t[L].tail;t[_]>t[j]&&e!==null;){let r=e.prev;H(t,e),e=r}},"trim"),H=o((t,e)=>{if(e){let r=e.value;t[C]&&t[C](r.key,r.value),t[_]-=r.length,t[q].delete(r.key),t[L].removeNode(e)}},"del"),be=class{static{o(this,"Entry")}constructor(e,r,n,s,i){this.key=e,this.value=r,this.length=n,this.now=s,this.maxAge=i||0}},dr=o((t,e,r,n)=>{let s=r.value;de(t,s)&&(H(t,r),t[J]||(s=void 0)),s&&e.call(n,s.value,s.key,t)},"forEachStep");vr.exports=Ae});var A=v((Ku,Rr)=>{var qe=class t{static{o(this,"Range")}constructor(e,r){if(r=Us(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Pe)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!Ir(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Vs(s[0])){this.set=[s];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&Bs)|(this.options.loose&&Xs))+":"+e,s=gr.get(n);if(s)return s;let i=this.options.loose,u=i?T[w.HYPHENRANGELOOSE]:T[w.HYPHENRANGE];e=e.replace(u,ei(this.options.includePrerelease)),R("hyphen replace",e),e=e.replace(T[w.COMPARATORTRIM],js),R("comparator trim",e),e=e.replace(T[w.TILDETRIM],Fs),R("tilde trim",e),e=e.replace(T[w.CARETTRIM],Ms),R("caret trim",e);let a=e.split(" ").map(d=>Hs(d,this.options)).join(" ").split(/\s+/).map(d=>Qs(d,this.options));i&&(a=a.filter(d=>(R("loose invalid filter",d,this.options),!!d.match(T[w.COMPARATORLOOSE])))),R("range list",a);let c=new Map,h=a.map(d=>new Pe(d,this.options));for(let d of h){if(Ir(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return gr.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>yr(n,r)&&e.set.some(s=>yr(s,r)&&n.every(i=>s.every(u=>i.intersects(u,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Gs(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(ti(this.set[r],e,this.options))return!0;return!1}};Rr.exports=qe;var Ds=Er(),gr=new Ds({max:1e3}),Us=ie(),Pe=Q(),R=K(),Gs=S(),{safeRe:T,t:w,comparatorTrimReplace:js,tildeTrimReplace:Fs,caretTrimReplace:Ms}=B(),{FLAG_INCLUDE_PRERELEASE:Bs,FLAG_LOOSE:Xs}=W(),Ir=o(t=>t.value==="<0.0.0-0","isNullSet"),Vs=o(t=>t.value==="","isAny"),yr=o((t,e)=>{let r=!0,n=t.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,e)),s=n.pop();return r},"isSatisfiable"),Hs=o((t,e)=>(R("comp",t,e),t=Ws(t,e),R("caret",t),t=zs(t,e),R("tildes",t),t=ks(t,e),R("xrange",t),t=Js(t,e),R("stars",t),t),"parseComparator"),N=o(t=>!t||t.toLowerCase()==="x"||t==="*","isX"),zs=o((t,e)=>t.trim().split(/\s+/).map(r=>Ys(r,e)).join(" "),"replaceTildes"),Ys=o((t,e)=>{let r=e.loose?T[w.TILDELOOSE]:T[w.TILDE];return t.replace(r,(n,s,i,u,a)=>{R("tilde",t,n,s,i,u,a);let c;return N(s)?c="":N(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:N(u)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?(R("replaceTilde pr",a),c=`>=${s}.${i}.${u}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${u} <${s}.${+i+1}.0-0`,R("tilde return",c),c})},"replaceTilde"),Ws=o((t,e)=>t.trim().split(/\s+/).map(r=>Ks(r,e)).join(" "),"replaceCarets"),Ks=o((t,e)=>{R("caret",t,e);let r=e.loose?T[w.CARETLOOSE]:T[w.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(s,i,u,a,c)=>{R("caret",t,s,i,u,a,c);let h;return N(i)?h="":N(u)?h=`>=${i}.0.0${n} <${+i+1}.0.0-0`:N(a)?i==="0"?h=`>=${i}.${u}.0${n} <${i}.${+u+1}.0-0`:h=`>=${i}.${u}.0${n} <${+i+1}.0.0-0`:c?(R("replaceCaret pr",c),i==="0"?u==="0"?h=`>=${i}.${u}.${a}-${c} <${i}.${u}.${+a+1}-0`:h=`>=${i}.${u}.${a}-${c} <${i}.${+u+1}.0-0`:h=`>=${i}.${u}.${a}-${c} <${+i+1}.0.0-0`):(R("no pr"),i==="0"?u==="0"?h=`>=${i}.${u}.${a}${n} <${i}.${u}.${+a+1}-0`:h=`>=${i}.${u}.${a}${n} <${i}.${+u+1}.0-0`:h=`>=${i}.${u}.${a} <${+i+1}.0.0-0`),R("caret return",h),h})},"replaceCaret"),ks=o((t,e)=>(R("replaceXRanges",t,e),t.split(/\s+/).map(r=>Zs(r,e)).join(" ")),"replaceXRanges"),Zs=o((t,e)=>{t=t.trim();let r=e.loose?T[w.XRANGELOOSE]:T[w.XRANGE];return t.replace(r,(n,s,i,u,a,c)=>{R("xRange",t,n,s,i,u,a,c);let h=N(i),l=h||N(u),d=l||N(a),y=d;return s==="="&&y&&(s=""),c=e.includePrerelease?"-0":"",h?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&y?(l&&(u=0),a=0,s===">"?(s=">=",l?(i=+i+1,u=0,a=0):(u=+u+1,a=0)):s==="<="&&(s="<",l?i=+i+1:u=+u+1),s==="<"&&(c="-0"),n=`${s+i}.${u}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${u}.0${c} <${i}.${+u+1}.0-0`),R("xRange return",n),n})},"replaceXRange"),Js=o((t,e)=>(R("replaceStars",t,e),t.trim().replace(T[w.STAR],"")),"replaceStars"),Qs=o((t,e)=>(R("replaceGTE0",t,e),t.trim().replace(T[e.includePrerelease?w.GTE0PRE:w.GTE0],"")),"replaceGTE0"),ei=o(t=>(e,r,n,s,i,u,a,c,h,l,d,y,m)=>(N(n)?r="":N(s)?r=`>=${n}.0.0${t?"-0":""}`:N(i)?r=`>=${n}.${s}.0${t?"-0":""}`:u?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,N(h)?c="":N(l)?c=`<${+h+1}.0.0-0`:N(d)?c=`<${h}.${+l+1}.0-0`:y?c=`<=${h}.${l}.${d}-${y}`:t?c=`<${h}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),"hyphenReplace"),ti=o((t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(R(t[n].semver),t[n].semver!==Pe.ANY&&t[n].semver.prerelease.length>0){let s=t[n].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0},"testSet")});var Q=v((Zu,Nr)=>{var ee=Symbol("SemVer ANY"),De=class t{static{o(this,"Comparator")}static get ANY(){return ee}constructor(e,r){if(r=xr(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),_e("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===ee?this.value="":this.value=this.operator+this.semver.version,_e("comp",this)}parse(e){let r=this.options.loose?Lr[Sr.COMPARATORLOOSE]:Lr[Sr.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new $r(n[2],this.options.loose):this.semver=ee}toString(){return this.value}test(e){if(_e("Comparator.test",e,this.options.loose),this.semver===ee||e===ee)return!0;if(typeof e=="string")try{e=new $r(e,this.options)}catch{return!1}return Ce(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new wr(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new wr(this.value,r).test(e.semver):(r=xr(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Ce(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Ce(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Nr.exports=De;var xr=ie(),{safeRe:Lr,t:Sr}=B(),Ce=Ne(),_e=K(),$r=S(),wr=A()});var te=v((Qu,Tr)=>{var ri=A(),ni=o((t,e,r)=>{try{e=new ri(e,r)}catch{return!1}return e.test(t)},"satisfies");Tr.exports=ni});var Ar=v((ta,Or)=>{var si=A(),ii=o((t,e)=>new si(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" ")),"toComparators");Or.exports=ii});var qr=v((na,br)=>{var oi=S(),ui=A(),ai=o((t,e,r)=>{let n=null,s=null,i=null;try{i=new ui(e,r)}catch{return null}return t.forEach(u=>{i.test(u)&&(!n||s.compare(u)===-1)&&(n=u,s=new oi(n,r))}),n},"maxSatisfying");br.exports=ai});var Cr=v((ia,Pr)=>{var ci=S(),li=A(),hi=o((t,e,r)=>{let n=null,s=null,i=null;try{i=new li(e,r)}catch{return null}return t.forEach(u=>{i.test(u)&&(!n||s.compare(u)===1)&&(n=u,s=new ci(n,r))}),n},"minSatisfying");Pr.exports=hi});var Ur=v((ua,Dr)=>{var Ue=S(),fi=A(),_r=k(),pi=o((t,e)=>{t=new fi(t,e);let r=new Ue("0.0.0");if(t.test(r)||(r=new Ue("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let s=t.set[n],i=null;s.forEach(u=>{let a=new Ue(u.semver.version);switch(u.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||_r(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${u.operator}`)}}),i&&(!r||_r(r,i))&&(r=i)}return r&&t.test(r)?r:null},"minVersion");Dr.exports=pi});var jr=v((ca,Gr)=>{var di=A(),mi=o((t,e)=>{try{return new di(t,e).range||"*"}catch{return null}},"validRange");Gr.exports=mi});var me=v((ha,Xr)=>{var vi=S(),Br=Q(),{ANY:Ei}=Br,gi=A(),Ii=te(),Fr=k(),Mr=ce(),yi=he(),Ri=le(),xi=o((t,e,r,n)=>{t=new vi(t,n),e=new gi(e,n);let s,i,u,a,c;switch(r){case">":s=Fr,i=yi,u=Mr,a=">",c=">=";break;case"<":s=Mr,i=Ri,u=Fr,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Ii(t,e,n))return!1;for(let h=0;h<e.set.length;++h){let l=e.set[h],d=null,y=null;if(l.forEach(m=>{m.semver===Ei&&(m=new Br(">=0.0.0")),d=d||m,y=y||m,s(m.semver,d.semver,n)?d=m:u(m.semver,y.semver,n)&&(y=m)}),d.operator===a||d.operator===c||(!y.operator||y.operator===a)&&i(t,y.semver))return!1;if(y.operator===c&&u(t,y.semver))return!1}return!0},"outside");Xr.exports=xi});var Hr=v((pa,Vr)=>{var Li=me(),Si=o((t,e,r)=>Li(t,e,">",r),"gtr");Vr.exports=Si});var Yr=v((ma,zr)=>{var $i=me(),wi=o((t,e,r)=>$i(t,e,"<",r),"ltr");zr.exports=wi});var kr=v((Ea,Kr)=>{var Wr=A(),Ni=o((t,e,r)=>(t=new Wr(t,r),e=new Wr(e,r),t.intersects(e,r)),"intersects");Kr.exports=Ni});var Jr=v((Ia,Zr)=>{var Ti=te(),Oi=O();Zr.exports=(t,e,r)=>{let n=[],s=null,i=null,u=t.sort((l,d)=>Oi(l,d,r));for(let l of u)Ti(l,e,r)?(i=l,s||(s=l)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===u[0]?a.push("*"):d?l===u[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),h=typeof e.raw=="string"?e.raw:String(e);return c.length<h.length?c:e}});var sn=v((ya,nn)=>{var Qr=A(),je=Q(),{ANY:Ge}=je,re=te(),Fe=O(),Ai=o((t,e,r={})=>{if(t===e)return!0;t=new Qr(t,r),e=new Qr(e,r);let n=!1;e:for(let s of t.set){for(let i of e.set){let u=qi(s,i,r);if(n=n||u!==null,u)continue e}if(n)return!1}return!0},"subset"),bi=[new je(">=0.0.0-0")],en=[new je(">=0.0.0")],qi=o((t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Ge){if(e.length===1&&e[0].semver===Ge)return!0;r.includePrerelease?t=bi:t=en}if(e.length===1&&e[0].semver===Ge){if(r.includePrerelease)return!0;e=en}let n=new Set,s,i;for(let m of t)m.operator===">"||m.operator===">="?s=tn(s,m,r):m.operator==="<"||m.operator==="<="?i=rn(i,m,r):n.add(m.semver);if(n.size>1)return null;let u;if(s&&i){if(u=Fe(s.semver,i.semver,r),u>0)return null;if(u===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let m of n){if(s&&!re(m,String(s),r)||i&&!re(m,String(i),r))return null;for(let pn of e)if(!re(m,String(pn),r))return!1;return!0}let a,c,h,l,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,y=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let m of e){if(l=l||m.operator===">"||m.operator===">=",h=h||m.operator==="<"||m.operator==="<=",s){if(y&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===y.major&&m.semver.minor===y.minor&&m.semver.patch===y.patch&&(y=!1),m.operator===">"||m.operator===">="){if(a=tn(s,m,r),a===m&&a!==s)return!1}else if(s.operator===">="&&!re(s.semver,String(m),r))return!1}if(i){if(d&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===d.major&&m.semver.minor===d.minor&&m.semver.patch===d.patch&&(d=!1),m.operator==="<"||m.operator==="<="){if(c=rn(i,m,r),c===m&&c!==i)return!1}else if(i.operator==="<="&&!re(i.semver,String(m),r))return!1}if(!m.operator&&(i||s)&&u!==0)return!1}return!(s&&h&&!i&&u!==0||i&&l&&!s&&u!==0||y||d)},"simpleSubset"),tn=o((t,e,r)=>{if(!t)return e;let n=Fe(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},"higherGT"),rn=o((t,e,r)=>{if(!t)return e;let n=Fe(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t},"lowerLT");nn.exports=Ai});var cn=v((xa,an)=>{var Me=B(),on=W(),Pi=S(),un=Le(),Ci=U(),_i=$t(),Di=Nt(),Ui=At(),Gi=Pt(),ji=_t(),Fi=Ut(),Mi=jt(),Bi=Mt(),Xi=O(),Vi=Ht(),Hi=Yt(),zi=ae(),Yi=Zt(),Wi=Qt(),Ki=k(),ki=ce(),Zi=$e(),Ji=we(),Qi=le(),eo=he(),to=Ne(),ro=ar(),no=Q(),so=A(),io=te(),oo=Ar(),uo=qr(),ao=Cr(),co=Ur(),lo=jr(),ho=me(),fo=Hr(),po=Yr(),mo=kr(),vo=Jr(),Eo=sn();an.exports={parse:Ci,valid:_i,clean:Di,inc:Ui,diff:Gi,major:ji,minor:Fi,patch:Mi,prerelease:Bi,compare:Xi,rcompare:Vi,compareLoose:Hi,compareBuild:zi,sort:Yi,rsort:Wi,gt:Ki,lt:ki,eq:Zi,neq:Ji,gte:Qi,lte:eo,cmp:to,coerce:ro,Comparator:no,Range:so,satisfies:io,toComparators:oo,maxSatisfying:uo,minSatisfying:ao,minVersion:co,validRange:lo,outside:ho,gtr:fo,ltr:po,intersects:mo,simplifyRange:vo,subset:Eo,SemVer:Pi,re:Me.re,src:Me.src,tokens:Me.t,SEMVER_SPEC_VERSION:on.SEMVER_SPEC_VERSION,RELEASE_TYPES:on.RELEASE_TYPES,compareIdentifiers:un.compareIdentifiers,rcompareIdentifiers:un.rcompareIdentifiers}});var st,it,M=typeof Reflect=="object"?Reflect:null,Ze=M&&typeof M.apply=="function"?M.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};it=M&&typeof M.ownKeys=="function"?M.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var Je=Number.isNaN||function(t){return t!=t};function I(){I.init.call(this)}o(I,"o");st=I,I.EventEmitter=I,I.prototype._events=void 0,I.prototype._eventsCount=0,I.prototype._maxListeners=void 0;var Qe=10;function ne(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}o(ne,"u");function ot(t){return t._maxListeners===void 0?I.defaultMaxListeners:t._maxListeners}o(ot,"f");function et(t,e,r,n){var s,i,u,a;if(ne(r),(i=t._events)===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),u=i[e]),u===void 0)u=i[e]=r,++t._eventsCount;else if(typeof u=="function"?u=i[e]=n?[r,u]:[u,r]:n?u.unshift(r):u.push(r),(s=ot(t))>0&&u.length>s&&!u.warned){u.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=u.length,a=c,console&&console.warn&&console.warn(a)}return t}o(et,"v");function mn(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}o(mn,"a");function tt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=mn.bind(n);return s.listener=r,n.wrapFn=s,s}o(tt,"l");function rt(t,e,r){var n=t._events;if(n===void 0)return[];var s=n[e];return s===void 0?[]:typeof s=="function"?r?[s.listener||s]:[s]:r?function(i){for(var u=new Array(i.length),a=0;a<u.length;++a)u[a]=i[a].listener||i[a];return u}(s):ut(s,s.length)}o(rt,"h");function nt(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}o(nt,"p");function ut(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}o(ut,"c");Object.defineProperty(I,"defaultMaxListeners",{enumerable:!0,get:function(){return Qe},set:function(t){if(typeof t!="number"||t<0||Je(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Qe=t}}),I.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},I.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Je(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},I.prototype.getMaxListeners=function(){return ot(this)},I.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n=t==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var u=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw u.context=i,u}var a=s[t];if(a===void 0)return!1;if(typeof a=="function")Ze(a,this,e);else{var c=a.length,h=ut(a,c);for(r=0;r<c;++r)Ze(h[r],this,e)}return!0},I.prototype.addListener=function(t,e){return et(this,t,e,!1)},I.prototype.on=I.prototype.addListener,I.prototype.prependListener=function(t,e){return et(this,t,e,!0)},I.prototype.once=function(t,e){return ne(e),this.on(t,tt(this,t,e)),this},I.prototype.prependOnceListener=function(t,e){return ne(e),this.prependListener(t,tt(this,t,e)),this},I.prototype.removeListener=function(t,e){var r,n,s,i,u;if(ne(e),(n=this._events)===void 0)return this;if((r=n[t])===void 0)return this;if(r===e||r.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if(typeof r!="function"){for(s=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){u=r[i].listener,s=i;break}if(s<0)return this;s===0?r.shift():function(a,c){for(;c+1<a.length;c++)a[c]=a[c+1];a.pop()}(r,s),r.length===1&&(n[t]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",t,u||e)}return this},I.prototype.off=I.prototype.removeListener,I.prototype.removeAllListeners=function(t){var e,r,n;if((r=this._events)===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var s,i=Object.keys(r);for(n=0;n<i.length;++n)(s=i[n])!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=r[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},I.prototype.listeners=function(t){return rt(this,t,!0)},I.prototype.rawListeners=function(t){return rt(this,t,!1)},I.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):nt.call(t,e)},I.prototype.listenerCount=nt,I.prototype.eventNames=function(){return this._eventsCount>0?it(this._events):[]};var $=st;$.EventEmitter;$.defaultMaxListeners;$.init;$.listenerCount;$.EventEmitter;$.defaultMaxListeners;$.init;$.listenerCount;$.once=function(t,e){return new Promise((r,n)=>{function s(...u){i!==void 0&&t.removeListener("error",i),r(u)}o(s,"eventListener");let i;e!=="error"&&(i=o(u=>{t.removeListener(name,s),n(u)},"errorListener"),t.once("error",i)),t.once(e,s)})};$.on=function(t,e){let r=[],n=[],s=null,i=!1,u={async next(){let h=r.shift();if(h)return createIterResult(h,!1);if(s){let l=Promise.reject(s);return s=null,l}return i?createIterResult(void 0,!0):new Promise((l,d)=>n.push({resolve:l,reject:d}))},async return(){t.removeListener(e,a),t.removeListener("error",c),i=!0;for(let h of n)h.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(h){s=h,t.removeListener(e,a),t.removeListener("error",c)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",c),u;function a(...h){let l=n.shift();l?l.resolve(createIterResult(h,!1)):r.push(h)}o(a,"eventHandler");function c(h){i=!0;let l=n.shift();l?l.reject(h):s=h,u.return()}o(c,"errorHandler")};var{EventEmitter:$o,defaultMaxListeners:wo,init:No,listenerCount:To,on:Oo,once:Ao}=$;var se=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(u){u(i)})}return o(s,"adopt"),new(r||(r=Promise))(function(i,u){function a(l){try{h(n.next(l))}catch(d){u(d)}}o(a,"fulfilled");function c(l){try{h(n.throw(l))}catch(d){u(d)}}o(c,"rejected");function h(l){l.done?i(l.value):s(l.value).then(a,c)}o(h,"step"),h((n=n.apply(t,e||[])).next())})};var vn="transport",Y=class{static{o(this,"Transport")}constructor({context:e,logType:r}={}){this.exchangeTimeout=3e4,this.unresponsiveTimeout=15e3,this.deviceModel=null,this._events=new $,this.send=(n,s,i,u,a=Buffer.alloc(0),c=[ge.OK],{abortTimeoutMs:h}={})=>se(this,void 0,void 0,function*(){let l=this.tracer.withUpdatedContext({function:"send"});if(a.length>=256)throw l.trace("data.length exceeded 256 bytes limit",{dataLength:a.length}),new b("data.length exceed 256 bytes limit. Got: "+a.length,"DataLengthTooBig");l.trace("Starting an exchange",{abortTimeoutMs:h});let d=yield this.exchange(Buffer.concat([Buffer.from([n,s,i,u]),Buffer.from([a.length]),a]),{abortTimeoutMs:h});l.trace("Received response from exchange");let y=d.readUInt16BE(d.length-2);if(!c.some(m=>m===y))throw new Ie(y);return d}),this._appAPIlock=null,this.tracer=new ke(r??vn,e)}exchange(e,{abortTimeoutMs:r}={}){throw new Error("exchange not implemented")}exchangeBulk(e,r){let n=!1,s=o(()=>{n=!0},"unsubscribe");return o(()=>se(this,void 0,void 0,function*(){if(!n)for(let u of e){let a=yield this.exchange(u);if(n)return;let c=a.readUInt16BE(a.length-2);if(c!==ge.OK)throw new Ie(c);r.next(a)}}),"main")().then(()=>!n&&r.complete(),u=>!n&&r.error(u)),{unsubscribe:s}}setScrambleKey(e){}close(){return Promise.resolve()}on(e,r){this._events.on(e,r)}off(e,r){this._events.removeListener(e,r)}emit(e,...r){this._events.emit(e,...r)}setDebugMode(){console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.")}setExchangeTimeout(e){this.exchangeTimeout=e}setExchangeUnresponsiveTimeout(e){this.unresponsiveTimeout=e}static create(e=3e3,r){return new Promise((n,s)=>{let i=!1,u=this.listen({next:c=>{i=!0,u&&u.unsubscribe(),a&&clearTimeout(a),this.open(c.descriptor,e).then(n,s)},error:c=>{a&&clearTimeout(a),s(c)},complete:()=>{a&&clearTimeout(a),i||s(new b(this.ErrorMessage_NoDeviceFound,"NoDeviceFound"))}}),a=r?setTimeout(()=>{u.unsubscribe(),s(new b(this.ErrorMessage_ListenTimeout,"ListenTimeout"))},r):null})}exchangeAtomicImpl(e){return se(this,void 0,void 0,function*(){let r=this.tracer.withUpdatedContext({function:"exchangeAtomicImpl",unresponsiveTimeout:this.unresponsiveTimeout});if(this.exchangeBusyPromise)throw r.trace("Atomic exchange is already busy"),new Ke("An action was already pending on the Ledger device. Please deny or reconnect.");let n,s=new Promise(a=>{n=a});this.exchangeBusyPromise=s;let i=!1,u=setTimeout(()=>{r.trace('Timeout reached, emitting Transport event "unresponsive"',{unresponsiveTimeout:this.unresponsiveTimeout}),i=!0,this.emit("unresponsive")},this.unresponsiveTimeout);try{let a=yield e();return i&&(r.trace("Device was unresponsive, emitting responsive"),this.emit("responsive")),a}finally{r.trace("Finalize, clearing busy guard"),clearTimeout(u),n&&n(),this.exchangeBusyPromise=null}})}decorateAppAPIMethods(e,r,n){for(let s of r)e[s]=this.decorateAppAPIMethod(s,e[s],e,n)}decorateAppAPIMethod(e,r,n,s){return(...i)=>se(this,void 0,void 0,function*(){let{_appAPIlock:u}=this;if(u)return Promise.reject(new b("Ledger Device is busy (lock "+u+")","TransportLocked"));try{return this._appAPIlock=e,this.setScrambleKey(s),yield r.apply(n,i)}finally{this._appAPIlock=null}})}setTraceContext(e){this.tracer=this.tracer.withContext(e)}updateTraceContext(e){this.tracer.updateContext(e)}getTraceContext(){return this.tracer.getContext()}};Y.ErrorMessage_ListenTimeout="No Ledger device found (timeout)";Y.ErrorMessage_NoDeviceFound="No Ledger device found";var at=Y;var ct=5;function En(t){let e=Buffer.alloc(2);return e.writeUInt16BE(t,0),e}o(En,"asUInt16BE");var gn={data:Buffer.alloc(0),dataLength:0,sequence:0},In=o((t,e)=>({makeBlocks(r){let n=Buffer.concat([En(r.length),r]),s=e-5,i=Math.ceil(n.length/s);n=Buffer.concat([n,Buffer.alloc(i*s-n.length+1).fill(0)]);let u=[];for(let a=0;a<i;a++){let c=Buffer.alloc(5);c.writeUInt16BE(t,0),c.writeUInt8(ct,2),c.writeUInt16BE(a,3);let h=n.slice(a*s,(a+1)*s);u.push(Buffer.concat([c,h]))}return u},reduceResponse(r,n){let{data:s,dataLength:i,sequence:u}=r||gn;if(n.readUInt16BE(0)!==t)throw new b("Invalid channel","InvalidChannel");if(n.readUInt8(2)!==ct)throw new b("Invalid tag","InvalidTag");if(n.readUInt16BE(3)!==u)throw new b("Invalid sequence","InvalidSequence");r||(i=n.readUInt16BE(5)),u++;let a=n.slice(r?5:7);return s=Buffer.concat([s,a]),s.length>i&&(s=s.slice(0,i)),{data:s,dataLength:i,sequence:u}},getReducedResult(r){if(r&&r.dataLength===r.data.length)return r.data}}),"createHIDframing"),lt=In;var Be=dn(cn());var x;(function(t){t.blue="blue",t.nanoS="nanoS",t.nanoSP="nanoSP",t.nanoX="nanoX",t.stax="stax",t.europa="europa"})(x||(x={}));var Xe={[x.blue]:{id:x.blue,productName:"Ledger\xA0Blue",productIdMM:0,legacyUsbProductId:0,usbOnly:!0,memorySize:480*1024,masks:[822083584,822149120],getBlockSize:t=>4*1024},[x.nanoS]:{id:x.nanoS,productName:"Ledger\xA0Nano\xA0S",productIdMM:16,legacyUsbProductId:1,usbOnly:!0,memorySize:320*1024,masks:[823132160],getBlockSize:t=>{var e;return Be.default.lt((e=Be.default.coerce(t))!==null&&e!==void 0?e:"","2.0.0")?4*1024:2*1024}},[x.nanoX]:{id:x.nanoX,productName:"Ledger\xA0Nano\xA0X",productIdMM:64,legacyUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,masks:[855638016],getBlockSize:t=>4*1024,bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]},[x.nanoSP]:{id:x.nanoSP,productName:"Ledger Nano S Plus",productIdMM:80,legacyUsbProductId:5,usbOnly:!0,memorySize:1533*1024,masks:[856686592],getBlockSize:t=>32},[x.stax]:{id:x.stax,productName:"Ledger\xA0Stax",productIdMM:96,legacyUsbProductId:6,usbOnly:!1,memorySize:1533*1024,masks:[857735168],getBlockSize:t=>32,bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]},[x.europa]:{id:x.europa,productName:"Ledger Europa",productIdMM:112,legacyUsbProductId:7,usbOnly:!1,memorySize:1533*1024,masks:[858783744],getBlockSize:t=>32,bluetoothSpec:[{serviceUuid:"13d63400-2c97-3004-0000-4c6564676572",notifyUuid:"13d63400-2c97-3004-0001-4c6564676572",writeUuid:"13d63400-2c97-3004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-3004-0003-4c6564676572"}]}},La={Blue:x.blue,"Nano S":x.nanoS,"Nano S Plus":x.nanoSP,"Nano X":x.nanoX,Stax:x.stax,Europa:x.europa},ln=Object.values(Xe),Ve=11415;var He=o(t=>{let e=ln.find(s=>s.legacyUsbProductId===t);if(e)return e;let r=t>>8;return ln.find(s=>s.productIdMM===r)},"identifyUSBProductId");var go=[],hn={};for(let t in Xe){let e=Xe[t],{bluetoothSpec:r}=e;if(r)for(let n=0;n<r.length;n++){let s=r[n];go.push(s.serviceUuid),hn[s.serviceUuid]=hn[s.serviceUuid.replace(/-/g,"")]=Object.assign({deviceModel:e},s)}}var D=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(u){u(i)})}return o(s,"adopt"),new(r||(r=Promise))(function(i,u){function a(l){try{h(n.next(l))}catch(d){u(d)}}o(a,"fulfilled");function c(l){try{h(n.throw(l))}catch(d){u(d)}}o(c,"rejected");function h(l){l.done?i(l.value):s(l.value).then(a,c)}o(h,"step"),h((n=n.apply(t,e||[])).next())})},Io=[{vendorId:Ve}],yo=o(()=>Promise.resolve(!!(window.navigator&&window.navigator.hid)),"isSupported"),ve=o(()=>{let{hid:t}=navigator;if(!t)throw new b("navigator.hid is not supported","HIDNotSupported");return t},"getHID");function fn(){return D(this,void 0,void 0,function*(){let t=yield ve().requestDevice({filters:Io});return Array.isArray(t)?t:[t]})}o(fn,"requestLedgerDevices");function ze(){return D(this,void 0,void 0,function*(){return(yield ve().getDevices()).filter(e=>e.vendorId===Ve)})}o(ze,"getLedgerDevices");function Ro(){return D(this,void 0,void 0,function*(){let t=yield ze();return t.length>0?t[0]:(yield fn())[0]})}o(Ro,"getFirstLedgerDevice");var z=class t extends at{static{o(this,"TransportWebHID")}constructor(e){super(),this.channel=Math.floor(Math.random()*65535),this.packetSize=64,this.inputs=[],this.read=()=>this.inputs.length?Promise.resolve(this.inputs.shift()):new Promise(r=>{this.inputCallback=r}),this.onInputReport=r=>{let n=Buffer.from(r.data.buffer);this.inputCallback?(this.inputCallback(n),this.inputCallback=null):this.inputs.push(n)},this._disconnectEmitted=!1,this._emitDisconnect=r=>{this._disconnectEmitted||(this._disconnectEmitted=!0,this.emit("disconnect",r))},this.exchange=r=>D(this,void 0,void 0,function*(){return yield this.exchangeAtomicImpl(()=>D(this,void 0,void 0,function*(){let{channel:s,packetSize:i}=this;ye("apdu","=> "+r.toString("hex"));let u=lt(s,i),a=u.makeBlocks(r);for(let l=0;l<a.length;l++)yield this.device.sendReport(0,a[l]);let c,h;for(;!(c=u.getReducedResult(h));){let l=yield this.read();h=u.reduceResponse(h,l)}return ye("apdu","<= "+c.toString("hex")),c})).catch(s=>{throw s&&s.message&&s.message.includes("write")?(this._emitDisconnect(s),new We(s.message)):s})}),this.device=e,this.deviceModel=typeof e.productId=="number"?He(e.productId):void 0,e.addEventListener("inputreport",this.onInputReport)}static request(){return D(this,void 0,void 0,function*(){let[e]=yield fn();return t.open(e)})}static openConnected(){return D(this,void 0,void 0,function*(){let e=yield ze();return e.length===0?null:t.open(e[0])})}static open(e){return D(this,void 0,void 0,function*(){yield e.open();let r=new t(e),n=o(s=>{e===s.device&&(ve().removeEventListener("disconnect",n),r._emitDisconnect(new Ye))},"onDisconnect");return ve().addEventListener("disconnect",n),r})}close(){return D(this,void 0,void 0,function*(){yield this.exchangeBusyPromise,this.device.removeEventListener("inputreport",this.onInputReport),yield this.device.close()})}setScrambleKey(){}};z.isSupported=yo;z.list=ze;z.listen=t=>{let e=!1;Ro().then(n=>{if(!n)t.error(new Ee("Access denied to use Ledger device"));else if(!e){let s=typeof n.productId=="number"?He(n.productId):void 0;t.next({type:"add",descriptor:n,deviceModel:s}),t.complete()}},n=>{t.error(new Ee(n.message))});function r(){e=!0}return o(r,"unsubscribe"),{unsubscribe:r}};var ba=z;export{ba as default};
2
+ //# sourceMappingURL=TransportWebHID-JLT4ETY3.js.map
package/dist/mod.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as u,b as f,c as d,e as U,f as Y,g as w,h as q,i as m,j as z,k as g,m as b,n as A,o as E,r as W}from"./chunk-I25CJMQS.js";import{a as r}from"./chunk-CVKDPNYM.js";var de=Object.defineProperty,y=r((e,t)=>de(e,"name",{value:t,configurable:!0}),"n");function he(e,t){return`${e}$$${t}`}r(he,"t");y(he,"generateStoreId");function me(e,t){if(!t)throw new Error("You should provide a valid semver, e.g 1.0.0.");let n=e.find(([a])=>a===t);if(!n)throw new Error(`You target version hasn't been found. Available versions: ${Object.keys(e).join(", ")}`);return n}r(me,"v");y(me,"pickVersion");function I(){let e=[],t={version:(n,a)=>(e.push([n,a]),t),build:()=>e};return t}r(I,"d");y(I,"defineVersions");function le(e){return I().version("0.0.0",e).build()}r(le,"p");y(le,"legacyProviderImportsToVersionsInterface");import{Networks as P,WalletTypes as fe}from"@rango-dev/wallets-shared";import"rango-types";var pe={type:fe.LEDGER},ve=g,we=r(async({namespaces:e})=>{let t=[],n=e?.find(o=>o.namespace==="Solana"),a=e?.find(o=>o.namespace==="EVM");if(n)if(n.derivationPath){d(n.derivationPath);let o=await E();t.push(o)}else throw new Error("Derivation Path can not be empty.");else if(a)if(a.derivationPath){d(a.derivationPath);let o=await A();t.push(o)}else throw new Error("Derivation Path can not be empty.");else throw new Error(`It appears that you have selected a namespace that is not yet supported by our system. Your namespaces: ${e?.map(o=>o.namespace)}`);return t},"connect");var ge=W,be=r(e=>{let t=[],n=e.find(o=>o.name===P.ETHEREUM);n&&t.push(n);let a=e.find(o=>o.name===P.SOLANA);return a&&t.push(a),{name:"Ledger",img:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/ledger/icon.svg",installLink:{DEFAULT:"https://support.ledger.com/hc/en-us/articles/4404389606417-Download-and-install-Ledger-Live?docs=true"},color:"black",supportedChains:t,showOnMobile:!1,needsDerivationPath:{data:[{id:"metamask",label:"Metamask (m/44'/60'/0'/0/index)",namespace:"EVM",generateDerivationPath:o=>`44'/60'/0'/0/${o}`},{id:"ledgerLive",label:"LedgerLive (m/44'/60'/index'/0/0)",namespace:"EVM",generateDerivationPath:o=>`44'/60'/${o}'/0/0`},{id:"legacy",label:"Legacy (m/44'/60'/0'/index)",namespace:"EVM",generateDerivationPath:o=>`44'/60'/0'/${o}`},{id:"(m/44'/501'/index')",label:"(m/44'/501'/index')",namespace:"Solana",generateDerivationPath:o=>`44'/501'/${o}'`},{id:"(m/44'/501'/0'/index)",label:"(m/44'/501'/0'/index)",namespace:"Solana",generateDerivationPath:o=>`44'/501'/0'/${o}`}]},needsNamespace:{selection:"single",data:[{label:"EVM",value:"EVM",id:"ETH",getSupportedChains:o=>o.filter(s=>s.name===P.ETHEREUM)},{label:"Solana",value:"Solana",id:"SOLANA",getSupportedChains:o=>o.filter(s=>s.name===P.SOLANA)}]}}},"getWalletInfo"),H=r(()=>({config:pe,getInstance:ve,connect:we,getSigners:ge,getWalletInfo:be}),"buildLegacyProvider");var G=Object.defineProperty,c=r((e,t)=>G(e,"name",{value:t,configurable:!0}),"r"),K=r((e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},"f"),Ae={};K(Ae,{disconnect:()=>S,recommended:()=>Ee});function S(e){let[,t]=e.state();t("network",null),t("accounts",null),t("connected",!1),t("connecting",!1)}r(S,"s");c(S,"disconnect");var Ee=[["disconnect",S]],p={};K(p,{disconnect:()=>Ie});var ye=class{static{r(this,"n")}static{c(this,"ActionBuilder")}name;#e=new Map;#t=new Map;#r=new Map;#n=new Map;#o;constructor(e){this.name=e}and(e){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(e),this}or(e){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(e),this}before(e){return this.#n.has(this.name)||this.#n.set(this.name,[]),this.#n.get(this.name)?.push(e),this}after(e){return this.#r.has(this.name)||this.#r.set(this.name,[]),this.#r.get(this.name)?.push(e),this}action(e){return this.#o=e,this}build(){if(!this.#o)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#o,before:this.#n,after:this.#r,and:this.#e,or:this.#t}}},Ie=c(()=>new ye("disconnect").action(S),"disconnect");function J(e){if(e instanceof Error)throw e;let t;typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?t=e.message:typeof e=="string"?t=e:t=String(e);let n=new Error(t);throw typeof e=="object"&&e!==null&&("code"in e&&(n.code=e.code),"data"in e&&(n.data=e.data)),n}r(J,"d");c(J,"parseErrorAndThrowStandardizeError");function Pe(e,t){J(t)}r(Pe,"E");c(Pe,"standardizeAndThrowError");function Se(e){let[,t]=e.state();t("connecting",!1)}r(Se,"g");c(Se,"intoConnectionFinished");function M(e){try{return u.parse(e),!0}catch{return!1}}r(M,"u");c(M,"isValidCaipAddress");function Ce(e,t){if(!t.every(M))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${t}`);let[,n]=e.state();return n("accounts",t),n("connected",!0),t}r(Ce,"T");c(Ce,"connectAndUpdateStateForSingleNetwork");function ke(e,t){if(!t.accounts.every(M))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${t.accounts}`);let[,n]=e.state();return n("accounts",t.accounts),n("network",t.network),n("connected",!0),t}r(ke,"I");c(ke,"connectAndUpdateStateForMultiNetworks");function Ne(e){let[,t]=e.state();t("connecting",!0)}r(Ne,"x");c(Ne,"intoConnecting");import{evmBlockchains as De}from"rango-types";var X=Object.defineProperty,i=r((e,t)=>X(e,"name",{value:t,configurable:!0}),"t"),h=r((e,t)=>{for(var n in t)X(e,n,{get:t[n],enumerable:!0})},"c"),Le={};h(Le,{canEagerConnect:()=>ne,canSwitchNetwork:()=>re,connect:()=>te,recommended:()=>Be});function Z(e){let[,t]=e.state();t("network",null),t("accounts",null),t("connected",!1),t("connecting",!1)}r(Z,"R");i(Z,"disconnect");var Me=[["disconnect",Z]],xe={};h(xe,{filterAndGetEvmBlockchainNames:()=>B,formatAccountsToCAIP:()=>_,getAccounts:()=>x,isUserRejectionError:()=>ee,suggestNetwork:()=>D,switchNetwork:()=>T,switchOrAddNetwork:()=>V});var C="eip155";var Te=16;async function x(e){let[t,n]=await Promise.all([e.request({method:"eth_requestAccounts"}),e.request({method:"eth_chainId"})]),a=n;return typeof a=="number"&&(a=`0x${Number(n).toString(Te)}`),{accounts:t,chainId:a}}r(x,"b");i(x,"getAccounts");async function D(e,t){return await e.request({method:"wallet_addEthereumChain",params:[t]})}r(D,"F");i(D,"suggestNetwork");async function T(e,t){return await e.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}r(T,"K");i(T,"switchNetwork");function B(e){return De(e).map(t=>t.name)}r(B,"A");i(B,"filterAndGetEvmBlockchainNames");async function V(e,t){try{let n=typeof t=="string"?t:t.chainId;await T(e,n)}catch(n){let a=n;if(typeof t!="string"&&(a.code===4902||!a.code)){await D(e,t);return}throw n}}r(V,"C");i(V,"switchOrAddNetwork");var Q=4001;function ee(e){if(typeof e=="object"&&e!==null){let t=e.code,n=e.cause?.code;return t===Q||n===Q}return!1}r(ee,"Q");i(ee,"isUserRejectionError");function _(e,t){return e.map(n=>u.format({address:n,chainId:{namespace:C,reference:t}}))}r(_,"P");i(_,"formatAccountsToCAIP");var Be=[...Me];function te(e,t){return async(n,a)=>{let o=e();if(!o)throw new Error("Do your wallet injected correctly and is evm compatible?");a&&(t?.switchOrAddNetwork?await t.switchOrAddNetwork(o,a):await V(o,a));let s=await x(o);return{accounts:_(s.accounts,s.chainId),network:s.chainId}}}r(te,"Z");i(te,"connect");function ne(e){return async()=>{let t=e();if(!t)throw new Error("Trying to eagerly connect to your EVM wallet, but seems its instance is not available.");try{return!!(await t.request({method:"eth_accounts"})).length}catch{return!1}}}r(ne,"ee");i(ne,"canEagerConnect");function re(){return(e,t)=>{let{network:n,supportedChains:a}=t;return B(a).includes(n)}}r(re,"te");i(re,"canSwitchNetwork");var Ve={};h(Ve,{changeAccountSubscriber:()=>oe,changeChainSubscriber:()=>ae});function oe(e){return k.changeAccountSubscriber(e).build()}r(oe,"re");i(oe,"changeAccountSubscriber");function ae(e){let t;return[n=>{let a=e();if(!a)throw new Error("Trying to subscribe to your EVM wallet, but seems its instance is not available.");let[,o]=n.state();t=i(async s=>{o("network",s)},"eventCallback"),a.on("chainChanged",t)},()=>{let n=e();t&&n&&n.removeListener("chainChanged",t)}]}r(ae,"oe");i(ae,"changeChainSubscriber");var _e={};h(_e,{recommended:()=>Re});function $(e){let[,t]=e.state();t("connecting",!1)}r($,"v");i($,"intoConnectionFinished");var $e=[["connect",$]],Re=[...$e],Oe={};h(Oe,{recommended:()=>Fe});var R=class{static{r(this,"i")}static{i(this,"ActionBuilder")}name;#e=new Map;#t=new Map;#r=new Map;#n=new Map;#o;constructor(e){this.name=e}and(e){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(e),this}or(e){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(e),this}before(e){return this.#n.has(this.name)||this.#n.set(this.name,[]),this.#n.get(this.name)?.push(e),this}after(e){return this.#r.has(this.name)||this.#r.set(this.name,[]),this.#r.get(this.name)?.push(e),this}action(e){return this.#o=e,this}build(){if(!this.#o)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#o,before:this.#n,after:this.#r,and:this.#e,or:this.#t}}};function ie(e){try{return u.parse(e),!0}catch{return!1}}r(ie,"H");i(ie,"isValidCaipAddress");function O(e,t){if(!t.accounts.every(ie))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${t.accounts}`);let[,n]=e.state();return n("accounts",t.accounts),n("network",t.network),n("connected",!0),t}r(O,"u");i(O,"connectAndUpdateStateForMultiNetworks");function j(e){let[,t]=e.state();t("connecting",!0)}r(j,"y");i(j,"intoConnecting");var je=[["connect",j]],Fe=[["connect",O]],Ue={};h(Ue,{recommended:()=>Ye});var Ye=[...je],k={};h(k,{canEagerConnect:()=>We,canSwitchNetwork:()=>He,changeAccountSubscriber:()=>Ge,connect:()=>ze});var qe=class{static{r(this,"g")}static{i(this,"ChangeAccountSubscriberBuilder")}#e=null;#t=null;#r=null;#n=null;#o=null;getInstance(e){return this.#e=e,this}format(e){return this.#t=e,this}validateEventPayload(e){return this.#r=e,this}addEventListener(e){return this.#n=e,this}removeEventListener(e){return this.#o=e,this}build(){if(this.#e===null)throw new Error(this.#a("getInstance"));if(this.#t===null)throw new Error(this.#a("format"));if(this.#n===null)throw new Error(this.#a("addEventListener"));if(this.#o===null)throw new Error(this.#a("removeEventListener"));let e=this.#e,t=this.#t,n=this.#n,a=this.#o,o=this.#r,s,v;return[async N=>{let[,L]=N.state(),l=e();if(!l)throw new Error("Trying to subscribe to your wallet, but seems its instance is not available.");s=i(async F=>{if(o&&!o(F)){N.action("disconnect");return}L("accounts",await t(l,F))},"subscriber"),v=n(l,s)},(N,L)=>{v&&typeof v=="function"&&v();let l=e();return a(l,s),L}]}#a(e){return`Required "${e}" operation has not been set for "changeAccountSubscriber"`}},ze=i(()=>new R("connect").and(O).before(j).after($),"connect"),We=i(()=>new R("canEagerConnect"),"canEagerConnect"),He=i(()=>new R("canSwitchNetwork"),"canSwitchNetwork"),Ge=i(e=>new qe().getInstance(e).validateEventPayload(t=>t&&t.length!==0).format(async(t,n)=>{let a=await t.request({method:"eth_chainId"});return n.map(o=>u.format({address:o,chainId:{namespace:C,reference:a}}))}).addEventListener((t,n)=>{t.on("accountsChanged",n)}).removeEventListener((t,n)=>{t.removeListener?.("accountsChanged",n)}),"changeAccountSubscriber");var Ke=k.connect().action(async function(e,t,n){if(!n?.derivationPath)throw new Error("Derivation Path can not be empty.");d(n.derivationPath);let a=await A();return{accounts:a.accounts.map(s=>f.AccountId.format({address:s,chainId:{namespace:C,reference:a.chainId}})),network:a.chainId}}).or(b).build(),Je=p.disconnect().build(),se=new w("EVM",m).action(Ke).action(Je).build();var Qe=Y.connect().action(async function(e,t){if(!t?.derivationPath)throw new Error("Derivation Path can not be empty.");d(t.derivationPath);let n=await E();return n.accounts.map(o=>f.AccountId.format({address:o,chainId:{namespace:U,reference:n.chainId}}))}).or(b).build(),Xe=p.disconnect().build(),ce=new w("Solana",m).action(Qe).action(Xe).build();var ue=r(()=>new q(m).init(function(e){let[,t]=e.state();g()&&t("installed",!0)}).config("metadata",z).add("solana",ce).add("evm",se).build(),"buildProvider");var Kt=r(()=>I().version("0.0.0",H()).version("1.0.0",ue()).build(),"versions");export{Kt as versions};
1
+ import{a,m as b}from"./chunk-CVKDPNYM.js";import{defineVersions as De}from"@rango-dev/wallets-core/utils";import{Networks as x,WalletTypes as ce}from"@rango-dev/wallets-shared";import"rango-types";import{DefaultSignerFactory as se,TransactionType as G}from"rango-types";import{DEFAULT_ETHEREUM_RPC_URL as Q,dynamicImportWithRefinedError as O}from"@rango-dev/wallets-shared";import{JsonRpcProvider as Z,Transaction as F}from"ethers";import{SignerError as ee,SignerErrorCode as te}from"rango-types";var k="";function d(e){k=e}a(d,"setDerivationPath");function s(){return k}a(s,"getDerivationPath");import{LegacyNetworks as M}from"@rango-dev/wallets-core/legacy";import{CAIP_SOLANA_CHAIN_ID as Y}from"@rango-dev/wallets-core/namespaces/solana";import{dynamicImportWithRefinedError as C,ETHEREUM_CHAIN_ID as H}from"@rango-dev/wallets-shared";import j from"bs58";import"@rango-dev/wallets-core";import{LegacyNetworks as D}from"@rango-dev/wallets-core/legacy";import{Networks as N}from"@rango-dev/wallets-shared";import"rango-types";var He=[D.ETHEREUM,D.POLYGON,D.BASE],_=16,u="ledger",B={name:"Ledger",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/ledger/icon.svg",extensions:{homepage:"https://support.ledger.com/hc/en-us/articles/4404389606417-Download-and-install-Ledger-Live?docs=true"},properties:[{name:"namespaces",value:{selection:"single",data:[{label:"Ethereum",value:"EVM",id:"ETH",getSupportedChains:e=>e.filter(n=>n.name===N.ETHEREUM)},{label:"Solana",value:"Solana",id:"SOLANA",getSupportedChains:e=>e.filter(n=>n.name===N.SOLANA)}]}},{name:"derivationPath",value:{data:[{id:"metamask",label:"Metamask (m/44'/60'/0'/0/index)",namespace:"EVM",generateDerivationPath:e=>`44'/60'/0'/0/${e}`},{id:"ledgerLive",label:"LedgerLive (m/44'/60'/index'/0/0)",namespace:"EVM",generateDerivationPath:e=>`44'/60'/${e}'/0/0`},{id:"legacy",label:"Legacy (m/44'/60'/0'/index)",namespace:"EVM",generateDerivationPath:e=>`44'/60'/0'/${e}`},{id:"(m/44'/501'/index')",label:"(m/44'/501'/index')",namespace:"Solana",generateDerivationPath:e=>`44'/501'/${e}'`},{id:"(m/44'/501'/0'/index)",label:"(m/44'/501'/0'/index)",namespace:"Solana",generateDerivationPath:e=>`44'/501'/0'/${e}`}]}},{name:"signers",value:{getSigners:async()=>h()}}]};function y(){let e=new Map;return e.set(M.ETHEREUM,{chainId:H}),e.set(M.SOLANA,{chainId:M.SOLANA}),e}a(y,"ledger");var V={21781:"The device is locked",25871:"Related application is not ready on your device",27013:"Action denied by user"};function J(e){return V[e]?V[e]:b(e)?b(e):`Ledger device unknown error 0x${e.toString(_)}`}a(J,"getLedgerErrorMessage");function l(e){return e?.statusCode?new Error(J(e.statusCode)):e?.code==="INSUFFICIENT_FUNDS"?new Error("Insufficient funds for transaction"):e}a(l,"getLedgerError");function E(e,n){throw l(n)}a(E,"standardizeAndThrowLedgerError");async function S(){try{let e=await m(),n=(await C(async()=>await import("./Eth-Y5JFGVQA.js"))).default,r=new n(e),o=s(),t=[],i=await r.getAddress(o,!1,!0);return t.push(i.address),{accounts:t,chainId:H,derivationPath:o}}catch(e){throw l(e)}finally{await p()}}a(S,"getEthereumAccounts");async function A(){try{let e=await m(),n=(await C(async()=>await import("./Solana-UB4SGWQ3.js"))).default,r=new n(e),o=s(),t=[],i=await r.getAddress(o);return t.push(j.encode(i.address)),{accounts:t,chainId:Y,derivationPath:o}}catch(e){throw l(e)}finally{await p()}}a(A,"getSolanaAccounts");var w=null;async function m(){return w=await(await C(async()=>await import("./TransportWebHID-JLT4ETY3.js"))).default.create(),w}a(m,"transportConnect");async function p(){w&&(await w.close(),w=null)}a(p,"transportDisconnect");var P=class{static{a(this,"EthereumSigner")}async signMessage(n){try{let r=await m(),o=(await O(async()=>await import("./Eth-Y5JFGVQA.js"))).default,i=await new o(r).signPersonalMessage(s(),Buffer.from(n).toString("hex")),c=(i.v-27).toString(16);return c.length<2&&(c="0"+c),"0x"+i.r+i.s+c}catch(r){throw new ee(te.SIGN_TX_ERROR,void 0,r)}}async signAndSendTx(n,r,o){try{let t=new Z(Q),i=await t.getTransactionCount(r),c={to:n.to,gasPrice:n.gasPrice,gasLimit:n.gasLimit,nonce:i,chainId:o,data:n.data,value:n.value,maxPriorityFeePerGas:n.maxPriorityFeePerGas,maxFeePerGas:n.maxFeePerGas},g=F.from(c).unsignedSerialized.substring(2),f=await m(),v=await O(async()=>await import("./Eth-Y5JFGVQA.js")),T=v.default,R=new T(f),q=await v.ledgerService.resolveTransaction(g,{},{}),I=await R.signTransaction(s(),g,q),K=F.from({...c,signature:{r:"0x"+I.r,s:"0x"+I.s,v:parseInt(I.v)}}).serialized;return{hash:(await t.broadcastTransaction(K)).hash}}catch(t){throw l(t)}finally{await p()}}};import{generalSolanaTransactionExecutor as ne}from"@rango-dev/signer-solana";import{dynamicImportWithRefinedError as U}from"@rango-dev/wallets-shared";import{PublicKey as re}from"@solana/web3.js";import{SignerError as ae,SignerErrorCode as oe}from"rango-types";function ie(e){return"version"in e}a(ie,"isVersionedTransaction");var L=class{static{a(this,"SolanaSigner")}async signMessage(n){try{let r=await m(),o=(await U(async()=>await import("./Solana-UB4SGWQ3.js"))).default;return(await new o(r).signOffchainMessage(s(),Buffer.from(n))).signature.toString()}catch(r){throw new ae(oe.SIGN_TX_ERROR,void 0,r)}}async signAndSendTx(n){try{return{hash:await ne(n,a(async t=>{let i=await m(),c=(await U(async()=>await import("./Solana-UB4SGWQ3.js"))).default,g=new c(i),f;ie(t)?f=await g.signTransaction(s(),t.message.serialize()):f=await g.signTransaction(s(),t.serialize());let v=await g.getAddress(s()),T=new re(v.address);return t.addSignature(T,Buffer.from(f.signature)),t.serialize()},"DefaultSolanaSigner"))}}catch(r){throw l(r)}finally{await p()}}};async function h(){let e=new se;return e.registerSigner(G.EVM,new P),e.registerSigner(G.SOLANA,new L),e}a(h,"getSigners");var me={type:ce.LEDGER},de=y,le=a(async({namespaces:e})=>{let n=[],r=e?.find(t=>t.namespace==="Solana"),o=e?.find(t=>t.namespace==="EVM");if(r)if(r.derivationPath){d(r.derivationPath);let t=await A();n.push(t)}else throw new Error("Derivation Path can not be empty.");else if(o)if(o.derivationPath){d(o.derivationPath);let t=await S();n.push(t)}else throw new Error("Derivation Path can not be empty.");else throw new Error(`It appears that you have selected a namespace that is not yet supported by our system. Your namespaces: ${e?.map(t=>t.namespace)}`);return n},"connect");var pe=h,ge=a(e=>{let n=[],r=e.find(t=>t.name===x.ETHEREUM);r&&n.push(r);let o=e.find(t=>t.name===x.SOLANA);return o&&n.push(o),{name:"Ledger",img:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/ledger/icon.svg",installLink:{DEFAULT:"https://support.ledger.com/hc/en-us/articles/4404389606417-Download-and-install-Ledger-Live?docs=true"},color:"black",supportedChains:n,showOnMobile:!1,needsDerivationPath:{data:[{id:"metamask",label:"Metamask (m/44'/60'/0'/0/index)",namespace:"EVM",generateDerivationPath:t=>`44'/60'/0'/0/${t}`},{id:"ledgerLive",label:"LedgerLive (m/44'/60'/index'/0/0)",namespace:"EVM",generateDerivationPath:t=>`44'/60'/${t}'/0/0`},{id:"legacy",label:"Legacy (m/44'/60'/0'/index)",namespace:"EVM",generateDerivationPath:t=>`44'/60'/0'/${t}`},{id:"(m/44'/501'/index')",label:"(m/44'/501'/index')",namespace:"Solana",generateDerivationPath:t=>`44'/501'/${t}'`},{id:"(m/44'/501'/0'/index)",label:"(m/44'/501'/0'/index)",namespace:"Solana",generateDerivationPath:t=>`44'/501'/0'/${t}`}]},needsNamespace:{selection:"single",data:[{label:"EVM",value:"EVM",id:"ETH",getSupportedChains:t=>t.filter(i=>i.name===x.ETHEREUM)},{label:"Solana",value:"Solana",id:"SOLANA",getSupportedChains:t=>t.filter(i=>i.name===x.SOLANA)}]}}},"getWalletInfo"),$=a(()=>({config:me,getInstance:de,connect:le,getSigners:pe,getWalletInfo:ge}),"buildLegacyProvider");import{ProviderBuilder as be}from"@rango-dev/wallets-core";import{NamespaceBuilder as ue}from"@rango-dev/wallets-core";import{builders as fe}from"@rango-dev/wallets-core/namespaces/common";import{builders as he,CAIP_NAMESPACE as we}from"@rango-dev/wallets-core/namespaces/evm";import{CAIP as ve}from"@rango-dev/wallets-core/utils";var ye=he.connect().action(async function(e,n,r){if(!r?.derivationPath)throw new Error("Derivation Path can not be empty.");d(r.derivationPath);let o=await S();return{accounts:o.accounts.map(i=>ve.AccountId.format({address:i,chainId:{namespace:we,reference:o.chainId}})),network:o.chainId}}).or(E).build(),Ee=fe.disconnect().build(),W=new ue("EVM",u).action(ye).action(Ee).build();import{NamespaceBuilder as Se}from"@rango-dev/wallets-core";import{builders as Ae}from"@rango-dev/wallets-core/namespaces/common";import{builders as Pe,CAIP_NAMESPACE as Le}from"@rango-dev/wallets-core/namespaces/solana";import{CAIP as xe}from"@rango-dev/wallets-core/utils";var Te=Pe.connect().action(async function(e,n){if(!n?.derivationPath)throw new Error("Derivation Path can not be empty.");d(n.derivationPath);let r=await A();return r.accounts.map(t=>xe.AccountId.format({address:t,chainId:{namespace:Le,reference:r.chainId}}))}).or(E).build(),Ie=Ae.disconnect().build(),z=new Se("Solana",u).action(Te).action(Ie).build();var X=a(()=>new be(u).init(function(e){let[,n]=e.state();y()&&n("installed",!0)}).config("metadata",B).add("solana",z).add("evm",W).build(),"buildProvider");var Kt=a(()=>De().version("0.0.0",$()).version("1.0.0",X()).build(),"versions");export{Kt as versions};
2
2
  //# sourceMappingURL=mod.js.map