pages/ludwig/assets/semver.83ff78cf.js

1 line
14 KiB
JavaScript

import{l as z}from"./lru-cache.9a21e90b.js";const M=["includePrerelease","loose","rtl"],Z=r=>r?typeof r!="object"?{loose:!0}:M.filter(e=>r[e]).reduce((e,t)=>(e[t]=!0,e),{}):{};var G=Z,A={exports:{}};const K="2.0.0",J=256,Q=Number.MAX_SAFE_INTEGER||9007199254740991,W=16;var V={SEMVER_SPEC_VERSION:K,MAX_LENGTH:J,MAX_SAFE_INTEGER:Q,MAX_SAFE_COMPONENT_LENGTH:W};const ee=typeof process=="object"&&process.env&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};var P=ee;(function(r,e){const{MAX_SAFE_COMPONENT_LENGTH:t}=V,n=P;e=r.exports={};const E=e.re=[],s=e.src=[],i=e.t={};let o=0;const a=(l,$,h)=>{const N=o++;n(l,N,$),i[l]=N,s[N]=$,E[N]=new RegExp($,h?"g":void 0)};a("NUMERICIDENTIFIER","0|[1-9]\\d*"),a("NUMERICIDENTIFIERLOOSE","[0-9]+"),a("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),a("MAINVERSION",`(${s[i.NUMERICIDENTIFIER]})\\.(${s[i.NUMERICIDENTIFIER]})\\.(${s[i.NUMERICIDENTIFIER]})`),a("MAINVERSIONLOOSE",`(${s[i.NUMERICIDENTIFIERLOOSE]})\\.(${s[i.NUMERICIDENTIFIERLOOSE]})\\.(${s[i.NUMERICIDENTIFIERLOOSE]})`),a("PRERELEASEIDENTIFIER",`(?:${s[i.NUMERICIDENTIFIER]}|${s[i.NONNUMERICIDENTIFIER]})`),a("PRERELEASEIDENTIFIERLOOSE",`(?:${s[i.NUMERICIDENTIFIERLOOSE]}|${s[i.NONNUMERICIDENTIFIER]})`),a("PRERELEASE",`(?:-(${s[i.PRERELEASEIDENTIFIER]}(?:\\.${s[i.PRERELEASEIDENTIFIER]})*))`),a("PRERELEASELOOSE",`(?:-?(${s[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[i.PRERELEASEIDENTIFIERLOOSE]})*))`),a("BUILDIDENTIFIER","[0-9A-Za-z-]+"),a("BUILD",`(?:\\+(${s[i.BUILDIDENTIFIER]}(?:\\.${s[i.BUILDIDENTIFIER]})*))`),a("FULLPLAIN",`v?${s[i.MAINVERSION]}${s[i.PRERELEASE]}?${s[i.BUILD]}?`),a("FULL",`^${s[i.FULLPLAIN]}$`),a("LOOSEPLAIN",`[v=\\s]*${s[i.MAINVERSIONLOOSE]}${s[i.PRERELEASELOOSE]}?${s[i.BUILD]}?`),a("LOOSE",`^${s[i.LOOSEPLAIN]}$`),a("GTLT","((?:<|>)?=?)"),a("XRANGEIDENTIFIERLOOSE",`${s[i.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),a("XRANGEIDENTIFIER",`${s[i.NUMERICIDENTIFIER]}|x|X|\\*`),a("XRANGEPLAIN",`[v=\\s]*(${s[i.XRANGEIDENTIFIER]})(?:\\.(${s[i.XRANGEIDENTIFIER]})(?:\\.(${s[i.XRANGEIDENTIFIER]})(?:${s[i.PRERELEASE]})?${s[i.BUILD]}?)?)?`),a("XRANGEPLAINLOOSE",`[v=\\s]*(${s[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[i.XRANGEIDENTIFIERLOOSE]})(?:${s[i.PRERELEASELOOSE]})?${s[i.BUILD]}?)?)?`),a("XRANGE",`^${s[i.GTLT]}\\s*${s[i.XRANGEPLAIN]}$`),a("XRANGELOOSE",`^${s[i.GTLT]}\\s*${s[i.XRANGEPLAINLOOSE]}$`),a("COERCE",`(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?(?:$|[^\\d])`),a("COERCERTL",s[i.COERCE],!0),a("LONETILDE","(?:~>?)"),a("TILDETRIM",`(\\s*)${s[i.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",a("TILDE",`^${s[i.LONETILDE]}${s[i.XRANGEPLAIN]}$`),a("TILDELOOSE",`^${s[i.LONETILDE]}${s[i.XRANGEPLAINLOOSE]}$`),a("LONECARET","(?:\\^)"),a("CARETTRIM",`(\\s*)${s[i.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",a("CARET",`^${s[i.LONECARET]}${s[i.XRANGEPLAIN]}$`),a("CARETLOOSE",`^${s[i.LONECARET]}${s[i.XRANGEPLAINLOOSE]}$`),a("COMPARATORLOOSE",`^${s[i.GTLT]}\\s*(${s[i.LOOSEPLAIN]})$|^$`),a("COMPARATOR",`^${s[i.GTLT]}\\s*(${s[i.FULLPLAIN]})$|^$`),a("COMPARATORTRIM",`(\\s*)${s[i.GTLT]}\\s*(${s[i.LOOSEPLAIN]}|${s[i.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",a("HYPHENRANGE",`^\\s*(${s[i.XRANGEPLAIN]})\\s+-\\s+(${s[i.XRANGEPLAIN]})\\s*$`),a("HYPHENRANGELOOSE",`^\\s*(${s[i.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[i.XRANGEPLAINLOOSE]})\\s*$`),a("STAR","(<|>)?=?\\s*\\*"),a("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),a("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(A,A.exports);const F=/^[0-9]+$/,q=(r,e)=>{const t=F.test(r),n=F.test(e);return t&&n&&(r=+r,e=+e),r===e?0:t&&!n?-1:n&&!t?1:r<e?-1:1},te=(r,e)=>q(e,r);var se={compareIdentifiers:q,rcompareIdentifiers:te};const S=P,{MAX_LENGTH:X,MAX_SAFE_INTEGER:d}=V,{re:y,t:g}=A.exports,re=G,{compareIdentifiers:p}=se;class f{constructor(e,t){if(t=re(t),e instanceof f){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>X)throw new TypeError(`version is longer than ${X} characters`);S("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?y[g.LOOSE]:y[g.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>d||this.major<0)throw new TypeError("Invalid major version");if(this.minor>d||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>d||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(E=>{if(/^[0-9]+$/.test(E)){const s=+E;if(s>=0&&s<d)return s}return E}):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(S("SemVer.compare",this.version,this.options,e),!(e instanceof f)){if(typeof e=="string"&&e===this.version)return 0;e=new f(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof f||(e=new f(e,this.options)),p(this.major,e.major)||p(this.minor,e.minor)||p(this.patch,e.patch)}comparePre(e){if(e instanceof f||(e=new f(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 t=0;do{const n=this.prerelease[t],E=e.prerelease[t];if(S("prerelease compare",t,n,E),n===void 0&&E===void 0)return 0;if(E===void 0)return 1;if(n===void 0)return-1;if(n===E)continue;return p(n,E)}while(++t)}compareBuild(e){e instanceof f||(e=new f(e,this.options));let t=0;do{const n=this.build[t],E=e.build[t];if(S("prerelease compare",t,n,E),n===void 0&&E===void 0)return 0;if(E===void 0)return 1;if(n===void 0)return-1;if(n===E)continue;return p(n,E)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t),this.inc("pre",t);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":if(this.prerelease.length===0)this.prerelease=[0];else{let n=this.prerelease.length;for(;--n>=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);n===-1&&this.prerelease.push(0)}t&&(p(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}}var C=f;const U=C,ie=(r,e,t)=>new U(r,t).compare(new U(e,t));var O=ie;const ne=O,ae=(r,e,t)=>ne(r,e,t)===0;var Ee=ae;const oe=O,le=(r,e,t)=>oe(r,e,t)!==0;var ce=le;const he=O,$e=(r,e,t)=>he(r,e,t)>0;var Ie=$e;const ue=O,Re=(r,e,t)=>ue(r,e,t)>=0;var fe=Re;const Ne=O,pe=(r,e,t)=>Ne(r,e,t)<0;var Oe=pe;const Le=O,Te=(r,e,t)=>Le(r,e,t)<=0;var Ae=Te;const Se=Ee,de=ce,ve=Ie,Pe=fe,De=Oe,me=Ae,we=(r,e,t,n)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return Se(r,t,n);case"!=":return de(r,t,n);case">":return ve(r,t,n);case">=":return Pe(r,t,n);case"<":return De(r,t,n);case"<=":return me(r,t,n);default:throw new TypeError(`Invalid operator: ${e}`)}};var Ge=we;const L=Symbol("SemVer ANY");class v{static get ANY(){return L}constructor(e,t){if(t=Fe(t),e instanceof v){if(e.loose===!!t.loose)return e;e=e.value}m("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===L?this.value="":this.value=this.operator+this.semver.version,m("comp",this)}parse(e){const t=this.options.loose?j[b.COMPARATORLOOSE]:j[b.COMPARATOR],n=e.match(t);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 _(n[2],this.options.loose):this.semver=L}toString(){return this.value}test(e){if(m("Comparator.test",e,this.options.loose),this.semver===L||e===L)return!0;if(typeof e=="string")try{e=new _(e,this.options)}catch{return!1}return D(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof v))throw new TypeError("a Comparator is required");if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""?!0:new x(e.value,t).test(this.value);if(e.operator==="")return e.value===""?!0:new x(this.value,t).test(e.semver);const n=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">"),E=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<"),s=this.semver.version===e.semver.version,i=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<="),o=D(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),a=D(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return n||E||s&&i||o||a}}var Ce=v;const Fe=G,{re:j,t:b}=A.exports,D=Ge,m=P,_=C,x=Y;class T{constructor(e,t){if(t=ye(t),e instanceof T)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new T(e.raw,t);if(e instanceof w)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){const n=this.set[0];if(this.set=this.set.filter(E=>!k(E[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(const E of this.set)if(E.length===1&&_e(E[0])){this.set=[E];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const n=`parseRange:${Object.keys(this.options).join(",")}:${e}`,E=H.get(n);if(E)return E;const s=this.options.loose,i=s?R[I.HYPHENRANGELOOSE]:R[I.HYPHENRANGE];e=e.replace(i,Ze(this.options.includePrerelease)),c("hyphen replace",e),e=e.replace(R[I.COMPARATORTRIM],Ue),c("comparator trim",e),e=e.replace(R[I.TILDETRIM],je),e=e.replace(R[I.CARETTRIM],be),e=e.split(/\s+/).join(" ");let o=e.split(" ").map(h=>xe(h,this.options)).join(" ").split(/\s+/).map(h=>Me(h,this.options));s&&(o=o.filter(h=>(c("loose invalid filter",h,this.options),!!h.match(R[I.COMPARATORLOOSE])))),c("range list",o);const a=new Map,l=o.map(h=>new w(h,this.options));for(const h of l){if(k(h))return[h];a.set(h.value,h)}a.size>1&&a.has("")&&a.delete("");const $=[...a.values()];return H.set(n,$),$}intersects(e,t){if(!(e instanceof T))throw new TypeError("a Range is required");return this.set.some(n=>B(n,t)&&e.set.some(E=>B(E,t)&&n.every(s=>E.every(i=>s.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new ge(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(Ke(this.set[t],e,this.options))return!0;return!1}}var Y=T;const Xe=z,H=new Xe({max:1e3}),ye=G,w=Ce,c=P,ge=C,{re:R,t:I,comparatorTrimReplace:Ue,tildeTrimReplace:je,caretTrimReplace:be}=A.exports,k=r=>r.value==="<0.0.0-0",_e=r=>r.value==="",B=(r,e)=>{let t=!0;const n=r.slice();let E=n.pop();for(;t&&n.length;)t=n.every(s=>E.intersects(s,e)),E=n.pop();return t},xe=(r,e)=>(c("comp",r,e),r=Be(r,e),c("caret",r),r=He(r,e),c("tildes",r),r=qe(r,e),c("xrange",r),r=ze(r,e),c("stars",r),r),u=r=>!r||r.toLowerCase()==="x"||r==="*",He=(r,e)=>r.trim().split(/\s+/).map(t=>ke(t,e)).join(" "),ke=(r,e)=>{const t=e.loose?R[I.TILDELOOSE]:R[I.TILDE];return r.replace(t,(n,E,s,i,o)=>{c("tilde",r,n,E,s,i,o);let a;return u(E)?a="":u(s)?a=`>=${E}.0.0 <${+E+1}.0.0-0`:u(i)?a=`>=${E}.${s}.0 <${E}.${+s+1}.0-0`:o?(c("replaceTilde pr",o),a=`>=${E}.${s}.${i}-${o} <${E}.${+s+1}.0-0`):a=`>=${E}.${s}.${i} <${E}.${+s+1}.0-0`,c("tilde return",a),a})},Be=(r,e)=>r.trim().split(/\s+/).map(t=>Ve(t,e)).join(" "),Ve=(r,e)=>{c("caret",r,e);const t=e.loose?R[I.CARETLOOSE]:R[I.CARET],n=e.includePrerelease?"-0":"";return r.replace(t,(E,s,i,o,a)=>{c("caret",r,E,s,i,o,a);let l;return u(s)?l="":u(i)?l=`>=${s}.0.0${n} <${+s+1}.0.0-0`:u(o)?s==="0"?l=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${n} <${+s+1}.0.0-0`:a?(c("replaceCaret pr",a),s==="0"?i==="0"?l=`>=${s}.${i}.${o}-${a} <${s}.${i}.${+o+1}-0`:l=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${o}-${a} <${+s+1}.0.0-0`):(c("no pr"),s==="0"?i==="0"?l=`>=${s}.${i}.${o}${n} <${s}.${i}.${+o+1}-0`:l=`>=${s}.${i}.${o}${n} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${o} <${+s+1}.0.0-0`),c("caret return",l),l})},qe=(r,e)=>(c("replaceXRanges",r,e),r.split(/\s+/).map(t=>Ye(t,e)).join(" ")),Ye=(r,e)=>{r=r.trim();const t=e.loose?R[I.XRANGELOOSE]:R[I.XRANGE];return r.replace(t,(n,E,s,i,o,a)=>{c("xRange",r,n,E,s,i,o,a);const l=u(s),$=l||u(i),h=$||u(o),N=h;return E==="="&&N&&(E=""),a=e.includePrerelease?"-0":"",l?E===">"||E==="<"?n="<0.0.0-0":n="*":E&&N?($&&(i=0),o=0,E===">"?(E=">=",$?(s=+s+1,i=0,o=0):(i=+i+1,o=0)):E==="<="&&(E="<",$?s=+s+1:i=+i+1),E==="<"&&(a="-0"),n=`${E+s}.${i}.${o}${a}`):$?n=`>=${s}.0.0${a} <${+s+1}.0.0-0`:h&&(n=`>=${s}.${i}.0${a} <${s}.${+i+1}.0-0`),c("xRange return",n),n})},ze=(r,e)=>(c("replaceStars",r,e),r.trim().replace(R[I.STAR],"")),Me=(r,e)=>(c("replaceGTE0",r,e),r.trim().replace(R[e.includePrerelease?I.GTE0PRE:I.GTE0],"")),Ze=r=>(e,t,n,E,s,i,o,a,l,$,h,N,We)=>(u(n)?t="":u(E)?t=`>=${n}.0.0${r?"-0":""}`:u(s)?t=`>=${n}.${E}.0${r?"-0":""}`:i?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,u(l)?a="":u($)?a=`<${+l+1}.0.0-0`:u(h)?a=`<${l}.${+$+1}.0-0`:N?a=`<=${l}.${$}.${h}-${N}`:r?a=`<${l}.${$}.${+h+1}-0`:a=`<=${a}`,`${t} ${a}`.trim()),Ke=(r,e,t)=>{for(let n=0;n<r.length;n++)if(!r[n].test(e))return!1;if(e.prerelease.length&&!t.includePrerelease){for(let n=0;n<r.length;n++)if(c(r[n].semver),r[n].semver!==w.ANY&&r[n].semver.prerelease.length>0){const E=r[n].semver;if(E.major===e.major&&E.minor===e.minor&&E.patch===e.patch)return!0}return!1}return!0},Je=Y,Qe=(r,e,t)=>{try{e=new Je(e,t)}catch{return!1}return e.test(r)};var tt=Qe;export{tt as s};