@spectrl/cli 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +446 -281
- package/dist/cli.js +82 -20
- package/package.json +24 -15
- package/LICENSE +0 -21
package/dist/cli.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var ci=Object.create;var Jt=Object.defineProperty;var li=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var di=Object.getPrototypeOf,fi=Object.prototype.hasOwnProperty;var R=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),pi=(r,e)=>{for(var t in e)Jt(r,t,{get:e[t],enumerable:!0})},hi=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ui(e))!fi.call(r,n)&&n!==t&&Jt(r,n,{get:()=>e[n],enumerable:!(s=li(e,n))||s.enumerable});return r};var mi=(r,e,t)=>(t=r!=null?ci(di(r)):{},hi(e||!r||!r.__esModule?Jt(t,"default",{value:r,enumerable:!0}):t,r));var ot=R((_d,Gr)=>{"use strict";var Da="2.0.0",qa=Number.MAX_SAFE_INTEGER||9007199254740991,Ma=16,Va=250,Ua=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Gr.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Ma,MAX_SAFE_BUILD_LENGTH:Va,MAX_SAFE_INTEGER:qa,RELEASE_TYPES:Ua,SEMVER_SPEC_VERSION:Da,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var ct=R((Rd,Zr)=>{"use strict";var za=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Zr.exports=za});var Je=R((ce,Wr)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:rr,MAX_SAFE_BUILD_LENGTH:Ga,MAX_LENGTH:Za}=ot(),Wa=ct();ce=Wr.exports={};var Xa=ce.re=[],Ha=ce.safeRe=[],m=ce.src=[],Ba=ce.safeSrc=[],g=ce.t={},Ja=0,sr="[a-zA-Z0-9-]",Ya=[["\\s",1],["\\d",Za],[sr,Ga]],Ka=r=>{for(let[e,t]of Ya)r=r.split(`${e}*`).join(`${e}{0,${t}}`).split(`${e}+`).join(`${e}{1,${t}}`);return r},k=(r,e,t)=>{let s=Ka(e),n=Ja++;Wa(r,n,e),g[r]=n,m[n]=e,Ba[n]=s,Xa[n]=new RegExp(e,t?"g":void 0),Ha[n]=new RegExp(s,t?"g":void 0)};k("NUMERICIDENTIFIER","0|[1-9]\\d*");k("NUMERICIDENTIFIERLOOSE","\\d+");k("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${sr}*`);k("MAINVERSION",`(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})`);k("MAINVERSIONLOOSE",`(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})`);k("PRERELEASEIDENTIFIER",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIER]})`);k("PRERELEASEIDENTIFIERLOOSE",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIERLOOSE]})`);k("PRERELEASE",`(?:-(${m[g.PRERELEASEIDENTIFIER]}(?:\\.${m[g.PRERELEASEIDENTIFIER]})*))`);k("PRERELEASELOOSE",`(?:-?(${m[g.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${m[g.PRERELEASEIDENTIFIERLOOSE]})*))`);k("BUILDIDENTIFIER",`${sr}+`);k("BUILD",`(?:\\+(${m[g.BUILDIDENTIFIER]}(?:\\.${m[g.BUILDIDENTIFIER]})*))`);k("FULLPLAIN",`v?${m[g.MAINVERSION]}${m[g.PRERELEASE]}?${m[g.BUILD]}?`);k("FULL",`^${m[g.FULLPLAIN]}$`);k("LOOSEPLAIN",`[v=\\s]*${m[g.MAINVERSIONLOOSE]}${m[g.PRERELEASELOOSE]}?${m[g.BUILD]}?`);k("LOOSE",`^${m[g.LOOSEPLAIN]}$`);k("GTLT","((?:<|>)?=?)");k("XRANGEIDENTIFIERLOOSE",`${m[g.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);k("XRANGEIDENTIFIER",`${m[g.NUMERICIDENTIFIER]}|x|X|\\*`);k("XRANGEPLAIN",`[v=\\s]*(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:${m[g.PRERELEASE]})?${m[g.BUILD]}?)?)?`);k("XRANGEPLAINLOOSE",`[v=\\s]*(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:${m[g.PRERELEASELOOSE]})?${m[g.BUILD]}?)?)?`);k("XRANGE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAIN]}$`);k("XRANGELOOSE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAINLOOSE]}$`);k("COERCEPLAIN",`(^|[^\\d])(\\d{1,${rr}})(?:\\.(\\d{1,${rr}}))?(?:\\.(\\d{1,${rr}}))?`);k("COERCE",`${m[g.COERCEPLAIN]}(?:$|[^\\d])`);k("COERCEFULL",m[g.COERCEPLAIN]+`(?:${m[g.PRERELEASE]})?(?:${m[g.BUILD]})?(?:$|[^\\d])`);k("COERCERTL",m[g.COERCE],!0);k("COERCERTLFULL",m[g.COERCEFULL],!0);k("LONETILDE","(?:~>?)");k("TILDETRIM",`(\\s*)${m[g.LONETILDE]}\\s+`,!0);ce.tildeTrimReplace="$1~";k("TILDE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAIN]}$`);k("TILDELOOSE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAINLOOSE]}$`);k("LONECARET","(?:\\^)");k("CARETTRIM",`(\\s*)${m[g.LONECARET]}\\s+`,!0);ce.caretTrimReplace="$1^";k("CARET",`^${m[g.LONECARET]}${m[g.XRANGEPLAIN]}$`);k("CARETLOOSE",`^${m[g.LONECARET]}${m[g.XRANGEPLAINLOOSE]}$`);k("COMPARATORLOOSE",`^${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]})$|^$`);k("COMPARATOR",`^${m[g.GTLT]}\\s*(${m[g.FULLPLAIN]})$|^$`);k("COMPARATORTRIM",`(\\s*)${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]}|${m[g.XRANGEPLAIN]})`,!0);ce.comparatorTrimReplace="$1$2$3";k("HYPHENRANGE",`^\\s*(${m[g.XRANGEPLAIN]})\\s+-\\s+(${m[g.XRANGEPLAIN]})\\s*$`);k("HYPHENRANGELOOSE",`^\\s*(${m[g.XRANGEPLAINLOOSE]})\\s+-\\s+(${m[g.XRANGEPLAINLOOSE]})\\s*$`);k("STAR","(<|>)?=?\\s*\\*");k("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");k("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Tt=R((kd,Xr)=>{"use strict";var Qa=Object.freeze({loose:!0}),eo=Object.freeze({}),to=r=>r?typeof r!="object"?Qa:r:eo;Xr.exports=to});var nr=R((Id,Jr)=>{"use strict";var Hr=/^[0-9]+$/,Br=(r,e)=>{if(typeof r=="number"&&typeof e=="number")return r===e?0:r<e?-1:1;let t=Hr.test(r),s=Hr.test(e);return t&&s&&(r=+r,e=+e),r===e?0:t&&!s?-1:s&&!t?1:r<e?-1:1},ro=(r,e)=>Br(e,r);Jr.exports={compareIdentifiers:Br,rcompareIdentifiers:ro}});var U=R((Sd,Kr)=>{"use strict";var At=ct(),{MAX_LENGTH:Yr,MAX_SAFE_INTEGER:Ct}=ot(),{safeRe:Pt,t:Lt}=Je(),so=Tt(),{compareIdentifiers:ir}=nr(),ar=class r{constructor(e,t){if(t=so(t),e instanceof r){if(e.loose===!!t.loose&&e.includePrerelease===!!t.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>Yr)throw new TypeError(`version is longer than ${Yr} characters`);At("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let s=e.trim().match(t.loose?Pt[Lt.LOOSE]:Pt[Lt.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>Ct||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ct||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ct||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<Ct)return i}return n}):this.prerelease=[],this.build=s[5]?s[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(At("SemVer.compare",this.version,this.options,e),!(e instanceof r)){if(typeof e=="string"&&e===this.version)return 0;e=new r(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof r||(e=new r(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof r||(e=new r(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{let s=this.prerelease[t],n=e.prerelease[t];if(At("prerelease compare",t,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return ir(s,n)}while(++t)}compareBuild(e){e instanceof r||(e=new r(e,this.options));let t=0;do{let s=this.build[t],n=e.build[t];if(At("build compare",t,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return ir(s,n)}while(++t)}inc(e,t,s){if(e.startsWith("pre")){if(!t&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Pt[Lt.PRERELEASELOOSE]:Pt[Lt.PRERELEASE]);if(!n||n[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,s),this.inc("pre",t,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,s),this.inc("pre",t,s);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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 n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(t===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let i=[t,n];s===!1&&(i=[t]),ir(this.prerelease[0],t)===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}};Kr.exports=ar});var Ve=R(($d,es)=>{"use strict";var Qr=U(),no=(r,e,t=!1)=>{if(r instanceof Qr)return r;try{return new Qr(r,e)}catch(s){if(!t)return null;throw s}};es.exports=no});var rs=R((bd,ts)=>{"use strict";var io=Ve(),ao=(r,e)=>{let t=io(r,e);return t?t.version:null};ts.exports=ao});var ns=R((Od,ss)=>{"use strict";var oo=Ve(),co=(r,e)=>{let t=oo(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null};ss.exports=co});var os=R((Nd,as)=>{"use strict";var is=U(),lo=(r,e,t,s,n)=>{typeof t=="string"&&(n=s,s=t,t=void 0);try{return new is(r instanceof is?r.version:r,t).inc(e,s,n).version}catch{return null}};as.exports=lo});var us=R((Td,ls)=>{"use strict";var cs=Ve(),uo=(r,e)=>{let t=cs(r,null,!0),s=cs(e,null,!0),n=t.compare(s);if(n===0)return null;let i=n>0,a=i?t:s,o=i?s:t,c=!!a.prerelease.length;if(!!o.prerelease.length&&!c){if(!o.patch&&!o.minor)return"major";if(o.compareMain(a)===0)return o.minor&&!o.patch?"minor":"patch"}let u=c?"pre":"";return t.major!==s.major?u+"major":t.minor!==s.minor?u+"minor":t.patch!==s.patch?u+"patch":"prerelease"};ls.exports=uo});var fs=R((Ad,ds)=>{"use strict";var fo=U(),po=(r,e)=>new fo(r,e).major;ds.exports=po});var hs=R((Cd,ps)=>{"use strict";var ho=U(),mo=(r,e)=>new ho(r,e).minor;ps.exports=mo});var gs=R((Pd,ms)=>{"use strict";var go=U(),yo=(r,e)=>new go(r,e).patch;ms.exports=yo});var xs=R((Ld,ys)=>{"use strict";var xo=Ve(),vo=(r,e)=>{let t=xo(r,e);return t&&t.prerelease.length?t.prerelease:null};ys.exports=vo});var Q=R((jd,ws)=>{"use strict";var vs=U(),wo=(r,e,t)=>new vs(r,t).compare(new vs(e,t));ws.exports=wo});var _s=R((Fd,Es)=>{"use strict";var Eo=Q(),_o=(r,e,t)=>Eo(e,r,t);Es.exports=_o});var ks=R((Dd,Rs)=>{"use strict";var Ro=Q(),ko=(r,e)=>Ro(r,e,!0);Rs.exports=ko});var jt=R((qd,Ss)=>{"use strict";var Is=U(),Io=(r,e,t)=>{let s=new Is(r,t),n=new Is(e,t);return s.compare(n)||s.compareBuild(n)};Ss.exports=Io});var bs=R((Md,$s)=>{"use strict";var So=jt(),$o=(r,e)=>r.sort((t,s)=>So(t,s,e));$s.exports=$o});var Ns=R((Vd,Os)=>{"use strict";var bo=jt(),Oo=(r,e)=>r.sort((t,s)=>bo(s,t,e));Os.exports=Oo});var lt=R((Ud,Ts)=>{"use strict";var No=Q(),To=(r,e,t)=>No(r,e,t)>0;Ts.exports=To});var Ft=R((zd,As)=>{"use strict";var Ao=Q(),Co=(r,e,t)=>Ao(r,e,t)<0;As.exports=Co});var or=R((Gd,Cs)=>{"use strict";var Po=Q(),Lo=(r,e,t)=>Po(r,e,t)===0;Cs.exports=Lo});var cr=R((Zd,Ps)=>{"use strict";var jo=Q(),Fo=(r,e,t)=>jo(r,e,t)!==0;Ps.exports=Fo});var Dt=R((Wd,Ls)=>{"use strict";var Do=Q(),qo=(r,e,t)=>Do(r,e,t)>=0;Ls.exports=qo});var qt=R((Xd,js)=>{"use strict";var Mo=Q(),Vo=(r,e,t)=>Mo(r,e,t)<=0;js.exports=Vo});var lr=R((Hd,Fs)=>{"use strict";var Uo=or(),zo=cr(),Go=lt(),Zo=Dt(),Wo=Ft(),Xo=qt(),Ho=(r,e,t,s)=>{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 Uo(r,t,s);case"!=":return zo(r,t,s);case">":return Go(r,t,s);case">=":return Zo(r,t,s);case"<":return Wo(r,t,s);case"<=":return Xo(r,t,s);default:throw new TypeError(`Invalid operator: ${e}`)}};Fs.exports=Ho});var qs=R((Bd,Ds)=>{"use strict";var Bo=U(),Jo=Ve(),{safeRe:Mt,t:Vt}=Je(),Yo=(r,e)=>{if(r instanceof Bo)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;e=e||{};let t=null;if(!e.rtl)t=r.match(e.includePrerelease?Mt[Vt.COERCEFULL]:Mt[Vt.COERCE]);else{let c=e.includePrerelease?Mt[Vt.COERCERTLFULL]:Mt[Vt.COERCERTL],l;for(;(l=c.exec(r))&&(!t||t.index+t[0].length!==r.length);)(!t||l.index+l[0].length!==t.index+t[0].length)&&(t=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(t===null)return null;let s=t[2],n=t[3]||"0",i=t[4]||"0",a=e.includePrerelease&&t[5]?`-${t[5]}`:"",o=e.includePrerelease&&t[6]?`+${t[6]}`:"";return Jo(`${s}.${n}.${i}${a}${o}`,e)};Ds.exports=Yo});var Vs=R((Jd,Ms)=>{"use strict";var ur=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}};Ms.exports=ur});var ee=R((Yd,Zs)=>{"use strict";var Ko=/\s+/g,dr=class r{constructor(e,t){if(t=ec(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof fr)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(Ko," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!zs(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&oc(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let s=0;s<t.length;s++)s>0&&(this.formatted+=" "),this.formatted+=t[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let s=((this.options.includePrerelease&&ic)|(this.options.loose&&ac))+":"+e,n=Us.get(s);if(n)return n;let i=this.options.loose,a=i?G[z.HYPHENRANGELOOSE]:G[z.HYPHENRANGE];e=e.replace(a,yc(this.options.includePrerelease)),L("hyphen replace",e),e=e.replace(G[z.COMPARATORTRIM],rc),L("comparator trim",e),e=e.replace(G[z.TILDETRIM],sc),L("tilde trim",e),e=e.replace(G[z.CARETTRIM],nc),L("caret trim",e);let o=e.split(" ").map(y=>cc(y,this.options)).join(" ").split(/\s+/).map(y=>gc(y,this.options));i&&(o=o.filter(y=>(L("loose invalid filter",y,this.options),!!y.match(G[z.COMPARATORLOOSE])))),L("range list",o);let c=new Map,l=o.map(y=>new fr(y,this.options));for(let y of l){if(zs(y))return[y];c.set(y.value,y)}c.size>1&&c.has("")&&c.delete("");let u=[...c.values()];return Us.set(s,u),u}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some(s=>Gs(s,t)&&e.set.some(n=>Gs(n,t)&&s.every(i=>n.every(a=>i.intersects(a,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new tc(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(xc(this.set[t],e,this.options))return!0;return!1}};Zs.exports=dr;var Qo=Vs(),Us=new Qo,ec=Tt(),fr=ut(),L=ct(),tc=U(),{safeRe:G,t:z,comparatorTrimReplace:rc,tildeTrimReplace:sc,caretTrimReplace:nc}=Je(),{FLAG_INCLUDE_PRERELEASE:ic,FLAG_LOOSE:ac}=ot(),zs=r=>r.value==="<0.0.0-0",oc=r=>r.value==="",Gs=(r,e)=>{let t=!0,s=r.slice(),n=s.pop();for(;t&&s.length;)t=s.every(i=>n.intersects(i,e)),n=s.pop();return t},cc=(r,e)=>(r=r.replace(G[z.BUILD],""),L("comp",r,e),r=dc(r,e),L("caret",r),r=lc(r,e),L("tildes",r),r=pc(r,e),L("xrange",r),r=mc(r,e),L("stars",r),r),Z=r=>!r||r.toLowerCase()==="x"||r==="*",lc=(r,e)=>r.trim().split(/\s+/).map(t=>uc(t,e)).join(" "),uc=(r,e)=>{let t=e.loose?G[z.TILDELOOSE]:G[z.TILDE];return r.replace(t,(s,n,i,a,o)=>{L("tilde",r,s,n,i,a,o);let c;return Z(n)?c="":Z(i)?c=`>=${n}.0.0 <${+n+1}.0.0-0`:Z(a)?c=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:o?(L("replaceTilde pr",o),c=`>=${n}.${i}.${a}-${o} <${n}.${+i+1}.0-0`):c=`>=${n}.${i}.${a} <${n}.${+i+1}.0-0`,L("tilde return",c),c})},dc=(r,e)=>r.trim().split(/\s+/).map(t=>fc(t,e)).join(" "),fc=(r,e)=>{L("caret",r,e);let t=e.loose?G[z.CARETLOOSE]:G[z.CARET],s=e.includePrerelease?"-0":"";return r.replace(t,(n,i,a,o,c)=>{L("caret",r,n,i,a,o,c);let l;return Z(i)?l="":Z(a)?l=`>=${i}.0.0${s} <${+i+1}.0.0-0`:Z(o)?i==="0"?l=`>=${i}.${a}.0${s} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${s} <${+i+1}.0.0-0`:c?(L("replaceCaret pr",c),i==="0"?a==="0"?l=`>=${i}.${a}.${o}-${c} <${i}.${a}.${+o+1}-0`:l=`>=${i}.${a}.${o}-${c} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.${o}-${c} <${+i+1}.0.0-0`):(L("no pr"),i==="0"?a==="0"?l=`>=${i}.${a}.${o}${s} <${i}.${a}.${+o+1}-0`:l=`>=${i}.${a}.${o}${s} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.${o} <${+i+1}.0.0-0`),L("caret return",l),l})},pc=(r,e)=>(L("replaceXRanges",r,e),r.split(/\s+/).map(t=>hc(t,e)).join(" ")),hc=(r,e)=>{r=r.trim();let t=e.loose?G[z.XRANGELOOSE]:G[z.XRANGE];return r.replace(t,(s,n,i,a,o,c)=>{L("xRange",r,s,n,i,a,o,c);let l=Z(i),u=l||Z(a),y=u||Z(o),$=y;return n==="="&&$&&(n=""),c=e.includePrerelease?"-0":"",l?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&$?(u&&(a=0),o=0,n===">"?(n=">=",u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):n==="<="&&(n="<",u?i=+i+1:a=+a+1),n==="<"&&(c="-0"),s=`${n+i}.${a}.${o}${c}`):u?s=`>=${i}.0.0${c} <${+i+1}.0.0-0`:y&&(s=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),L("xRange return",s),s})},mc=(r,e)=>(L("replaceStars",r,e),r.trim().replace(G[z.STAR],"")),gc=(r,e)=>(L("replaceGTE0",r,e),r.trim().replace(G[e.includePrerelease?z.GTE0PRE:z.GTE0],"")),yc=r=>(e,t,s,n,i,a,o,c,l,u,y,$)=>(Z(s)?t="":Z(n)?t=`>=${s}.0.0${r?"-0":""}`:Z(i)?t=`>=${s}.${n}.0${r?"-0":""}`:a?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,Z(l)?c="":Z(u)?c=`<${+l+1}.0.0-0`:Z(y)?c=`<${l}.${+u+1}.0-0`:$?c=`<=${l}.${u}.${y}-${$}`:r?c=`<${l}.${u}.${+y+1}-0`:c=`<=${c}`,`${t} ${c}`.trim()),xc=(r,e,t)=>{for(let s=0;s<r.length;s++)if(!r[s].test(e))return!1;if(e.prerelease.length&&!t.includePrerelease){for(let s=0;s<r.length;s++)if(L(r[s].semver),r[s].semver!==fr.ANY&&r[s].semver.prerelease.length>0){let n=r[s].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var ut=R((Kd,Ys)=>{"use strict";var dt=Symbol("SemVer ANY"),mr=class r{static get ANY(){return dt}constructor(e,t){if(t=Ws(t),e instanceof r){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),hr("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===dt?this.value="":this.value=this.operator+this.semver.version,hr("comp",this)}parse(e){let t=this.options.loose?Xs[Hs.COMPARATORLOOSE]:Xs[Hs.COMPARATOR],s=e.match(t);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new Bs(s[2],this.options.loose):this.semver=dt}toString(){return this.value}test(e){if(hr("Comparator.test",e,this.options.loose),this.semver===dt||e===dt)return!0;if(typeof e=="string")try{e=new Bs(e,this.options)}catch{return!1}return pr(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Js(e.value,t).test(this.value):e.operator===""?e.value===""?!0:new Js(this.value,t).test(e.semver):(t=Ws(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!t.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("=")||pr(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||pr(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Ys.exports=mr;var Ws=Tt(),{safeRe:Xs,t:Hs}=Je(),pr=lr(),hr=ct(),Bs=U(),Js=ee()});var ft=R((Qd,Ks)=>{"use strict";var vc=ee(),wc=(r,e,t)=>{try{e=new vc(e,t)}catch{return!1}return e.test(r)};Ks.exports=wc});var en=R((ef,Qs)=>{"use strict";var Ec=ee(),_c=(r,e)=>new Ec(r,e).set.map(t=>t.map(s=>s.value).join(" ").trim().split(" "));Qs.exports=_c});var rn=R((tf,tn)=>{"use strict";var Rc=U(),kc=ee(),Ic=(r,e,t)=>{let s=null,n=null,i=null;try{i=new kc(e,t)}catch{return null}return r.forEach(a=>{i.test(a)&&(!s||n.compare(a)===-1)&&(s=a,n=new Rc(s,t))}),s};tn.exports=Ic});var nn=R((rf,sn)=>{"use strict";var Sc=U(),$c=ee(),bc=(r,e,t)=>{let s=null,n=null,i=null;try{i=new $c(e,t)}catch{return null}return r.forEach(a=>{i.test(a)&&(!s||n.compare(a)===1)&&(s=a,n=new Sc(s,t))}),s};sn.exports=bc});var cn=R((sf,on)=>{"use strict";var gr=U(),Oc=ee(),an=lt(),Nc=(r,e)=>{r=new Oc(r,e);let t=new gr("0.0.0");if(r.test(t)||(t=new gr("0.0.0-0"),r.test(t)))return t;t=null;for(let s=0;s<r.set.length;++s){let n=r.set[s],i=null;n.forEach(a=>{let o=new gr(a.semver.version);switch(a.operator){case">":o.prerelease.length===0?o.patch++:o.prerelease.push(0),o.raw=o.format();case"":case">=":(!i||an(o,i))&&(i=o);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!t||an(t,i))&&(t=i)}return t&&r.test(t)?t:null};on.exports=Nc});var un=R((nf,ln)=>{"use strict";var Tc=ee(),Ac=(r,e)=>{try{return new Tc(r,e).range||"*"}catch{return null}};ln.exports=Ac});var Ut=R((af,hn)=>{"use strict";var Cc=U(),pn=ut(),{ANY:Pc}=pn,Lc=ee(),jc=ft(),dn=lt(),fn=Ft(),Fc=qt(),Dc=Dt(),qc=(r,e,t,s)=>{r=new Cc(r,s),e=new Lc(e,s);let n,i,a,o,c;switch(t){case">":n=dn,i=Fc,a=fn,o=">",c=">=";break;case"<":n=fn,i=Dc,a=dn,o="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(jc(r,e,s))return!1;for(let l=0;l<e.set.length;++l){let u=e.set[l],y=null,$=null;if(u.forEach(f=>{f.semver===Pc&&(f=new pn(">=0.0.0")),y=y||f,$=$||f,n(f.semver,y.semver,s)?y=f:a(f.semver,$.semver,s)&&($=f)}),y.operator===o||y.operator===c||(!$.operator||$.operator===o)&&i(r,$.semver))return!1;if($.operator===c&&a(r,$.semver))return!1}return!0};hn.exports=qc});var gn=R((of,mn)=>{"use strict";var Mc=Ut(),Vc=(r,e,t)=>Mc(r,e,">",t);mn.exports=Vc});var xn=R((cf,yn)=>{"use strict";var Uc=Ut(),zc=(r,e,t)=>Uc(r,e,"<",t);yn.exports=zc});var En=R((lf,wn)=>{"use strict";var vn=ee(),Gc=(r,e,t)=>(r=new vn(r,t),e=new vn(e,t),r.intersects(e,t));wn.exports=Gc});var Rn=R((uf,_n)=>{"use strict";var Zc=ft(),Wc=Q();_n.exports=(r,e,t)=>{let s=[],n=null,i=null,a=r.sort((u,y)=>Wc(u,y,t));for(let u of a)Zc(u,e,t)?(i=u,n||(n=u)):(i&&s.push([n,i]),i=null,n=null);n&&s.push([n,null]);let o=[];for(let[u,y]of s)u===y?o.push(u):!y&&u===a[0]?o.push("*"):y?u===a[0]?o.push(`<=${y}`):o.push(`${u} - ${y}`):o.push(`>=${u}`);let c=o.join(" || "),l=typeof e.raw=="string"?e.raw:String(e);return c.length<l.length?c:e}});var On=R((df,bn)=>{"use strict";var kn=ee(),xr=ut(),{ANY:yr}=xr,pt=ft(),vr=Q(),Xc=(r,e,t={})=>{if(r===e)return!0;r=new kn(r,t),e=new kn(e,t);let s=!1;e:for(let n of r.set){for(let i of e.set){let a=Bc(n,i,t);if(s=s||a!==null,a)continue e}if(s)return!1}return!0},Hc=[new xr(">=0.0.0-0")],In=[new xr(">=0.0.0")],Bc=(r,e,t)=>{if(r===e)return!0;if(r.length===1&&r[0].semver===yr){if(e.length===1&&e[0].semver===yr)return!0;t.includePrerelease?r=Hc:r=In}if(e.length===1&&e[0].semver===yr){if(t.includePrerelease)return!0;e=In}let s=new Set,n,i;for(let f of r)f.operator===">"||f.operator===">="?n=Sn(n,f,t):f.operator==="<"||f.operator==="<="?i=$n(i,f,t):s.add(f.semver);if(s.size>1)return null;let a;if(n&&i){if(a=vr(n.semver,i.semver,t),a>0)return null;if(a===0&&(n.operator!==">="||i.operator!=="<="))return null}for(let f of s){if(n&&!pt(f,String(n),t)||i&&!pt(f,String(i),t))return null;for(let A of e)if(!pt(f,String(A),t))return!1;return!0}let o,c,l,u,y=i&&!t.includePrerelease&&i.semver.prerelease.length?i.semver:!1,$=n&&!t.includePrerelease&&n.semver.prerelease.length?n.semver:!1;y&&y.prerelease.length===1&&i.operator==="<"&&y.prerelease[0]===0&&(y=!1);for(let f of e){if(u=u||f.operator===">"||f.operator===">=",l=l||f.operator==="<"||f.operator==="<=",n){if($&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===$.major&&f.semver.minor===$.minor&&f.semver.patch===$.patch&&($=!1),f.operator===">"||f.operator===">="){if(o=Sn(n,f,t),o===f&&o!==n)return!1}else if(n.operator===">="&&!pt(n.semver,String(f),t))return!1}if(i){if(y&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===y.major&&f.semver.minor===y.minor&&f.semver.patch===y.patch&&(y=!1),f.operator==="<"||f.operator==="<="){if(c=$n(i,f,t),c===f&&c!==i)return!1}else if(i.operator==="<="&&!pt(i.semver,String(f),t))return!1}if(!f.operator&&(i||n)&&a!==0)return!1}return!(n&&l&&!i&&a!==0||i&&u&&!n&&a!==0||$||y)},Sn=(r,e,t)=>{if(!r)return e;let s=vr(r.semver,e.semver,t);return s>0?r:s<0||e.operator===">"&&r.operator===">="?e:r},$n=(r,e,t)=>{if(!r)return e;let s=vr(r.semver,e.semver,t);return s<0?r:s>0||e.operator==="<"&&r.operator==="<="?e:r};bn.exports=Xc});var Cn=R((ff,An)=>{"use strict";var wr=Je(),Nn=ot(),Jc=U(),Tn=nr(),Yc=Ve(),Kc=rs(),Qc=ns(),el=os(),tl=us(),rl=fs(),sl=hs(),nl=gs(),il=xs(),al=Q(),ol=_s(),cl=ks(),ll=jt(),ul=bs(),dl=Ns(),fl=lt(),pl=Ft(),hl=or(),ml=cr(),gl=Dt(),yl=qt(),xl=lr(),vl=qs(),wl=ut(),El=ee(),_l=ft(),Rl=en(),kl=rn(),Il=nn(),Sl=cn(),$l=un(),bl=Ut(),Ol=gn(),Nl=xn(),Tl=En(),Al=Rn(),Cl=On();An.exports={parse:Yc,valid:Kc,clean:Qc,inc:el,diff:tl,major:rl,minor:sl,patch:nl,prerelease:il,compare:al,rcompare:ol,compareLoose:cl,compareBuild:ll,sort:ul,rsort:dl,gt:fl,lt:pl,eq:hl,neq:ml,gte:gl,lte:yl,cmp:xl,coerce:vl,Comparator:wl,Range:El,satisfies:_l,toComparators:Rl,maxSatisfying:kl,minSatisfying:Il,minVersion:Sl,validRange:$l,outside:bl,gtr:Ol,ltr:Nl,intersects:Tl,simplifyRange:Al,subset:Cl,SemVer:Jc,re:wr.re,src:wr.src,tokens:wr.t,SEMVER_SPEC_VERSION:Nn.SEMVER_SPEC_VERSION,RELEASE_TYPES:Nn.RELEASE_TYPES,compareIdentifiers:Tn.compareIdentifiers,rcompareIdentifiers:Tn.rcompareIdentifiers}});import{command as Wt,subcommands as nu,run as iu,positional as oi,option as ii,string as Zt,optional as br,flag as ai}from"cmd-ts";import{writeFile as Ul,mkdir as zl,rm as Gl}from"node:fs/promises";import Zl from"ora";import{access as Pl,constants as Ll,readFile as Er}from"node:fs/promises";import{join as Ye}from"node:path";import{homedir as jl}from"node:os";import{select as Fl}from"@inquirer/prompts";import tt from"chalk";var w={SUCCESS:0,VALIDATION_ERROR:1,IO_ERROR:2,DEPENDENCY_ERROR:3,USER_CANCELLED:130},v=class r extends Error{constructor(t,s){super(t);this.exitCode=s;this.name="CLIError",Error.captureStackTrace(this,r)}};function Yt(r,e){let t=tt.red("Error:"),s=e?` ${tt.yellow(e)} failed:`:"";return`${t}${s} ${r.message}`}function rt(r){return`${tt.yellow("Warning:")} ${r}`}function re(r){return tt.dim(r)}function N(r){return tt.cyan(r)}function Or(r){return r instanceof v?r.exitCode:w.VALIDATION_ERROR}import{promises as ve}from"node:fs";import we from"node:path";import at from"fs-extra";var T={};pi(T,{BRAND:()=>Vi,DIRTY:()=>Re,EMPTY_PATH:()=>vi,INVALID:()=>E,NEVER:()=>Ia,OK:()=>V,ParseStatus:()=>D,Schema:()=>S,ZodAny:()=>ye,ZodArray:()=>pe,ZodBigInt:()=>Ie,ZodBoolean:()=>Se,ZodBranded:()=>nt,ZodCatch:()=>Fe,ZodDate:()=>$e,ZodDefault:()=>je,ZodDiscriminatedUnion:()=>_t,ZodEffects:()=>K,ZodEnum:()=>Pe,ZodError:()=>W,ZodFirstPartyTypeKind:()=>_,ZodFunction:()=>kt,ZodIntersection:()=>Te,ZodIssueCode:()=>d,ZodLazy:()=>Ae,ZodLiteral:()=>Ce,ZodMap:()=>Xe,ZodNaN:()=>Be,ZodNativeEnum:()=>Le,ZodNever:()=>se,ZodNull:()=>Oe,ZodNullable:()=>oe,ZodNumber:()=>ke,ZodObject:()=>X,ZodOptional:()=>J,ZodParsedType:()=>h,ZodPipeline:()=>it,ZodPromise:()=>xe,ZodReadonly:()=>De,ZodRecord:()=>Rt,ZodSchema:()=>S,ZodSet:()=>He,ZodString:()=>ge,ZodSymbol:()=>Ze,ZodTransformer:()=>K,ZodTuple:()=>ae,ZodType:()=>S,ZodUndefined:()=>be,ZodUnion:()=>Ne,ZodUnknown:()=>fe,ZodVoid:()=>We,addIssueToContext:()=>p,any:()=>Ji,array:()=>ea,bigint:()=>Zi,boolean:()=>Mr,coerce:()=>ka,custom:()=>Fr,date:()=>Wi,datetimeRegex:()=>Lr,defaultErrorMap:()=>ue,discriminatedUnion:()=>na,effect:()=>ga,enum:()=>pa,function:()=>ua,getErrorMap:()=>Ue,getParsedType:()=>ie,instanceof:()=>zi,intersection:()=>ia,isAborted:()=>wt,isAsync:()=>ze,isDirty:()=>Et,isValid:()=>me,late:()=>Ui,lazy:()=>da,literal:()=>fa,makeIssue:()=>st,map:()=>ca,nan:()=>Gi,nativeEnum:()=>ha,never:()=>Ki,null:()=>Bi,nullable:()=>xa,number:()=>qr,object:()=>ta,objectUtil:()=>Kt,oboolean:()=>Ra,onumber:()=>_a,optional:()=>ya,ostring:()=>Ea,pipeline:()=>wa,preprocess:()=>va,promise:()=>ma,quotelessJson:()=>gi,record:()=>oa,set:()=>la,setErrorMap:()=>xi,strictObject:()=>ra,string:()=>Dr,symbol:()=>Xi,transformer:()=>ga,tuple:()=>aa,undefined:()=>Hi,union:()=>sa,unknown:()=>Yi,util:()=>b,void:()=>Qi});var b;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let a of n)i[a]=a;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),a={};for(let o of i)a[o]=n[o];return r.objectValues(a)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},r.find=(n,i)=>{for(let a of n)if(i(a))return a},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}r.joinValues=s,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(b||(b={}));var Kt;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Kt||(Kt={}));var h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ie=r=>{switch(typeof r){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(r)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(r)?h.array:r===null?h.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?h.promise:typeof Map<"u"&&r instanceof Map?h.map:typeof Set<"u"&&r instanceof Set?h.set:typeof Date<"u"&&r instanceof Date?h.date:h.object;default:return h.unknown}};var d=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),gi=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),W=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},s={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else{let o=s,c=0;for(;c<a.path.length;){let l=a.path[c];c===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(a))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];t[i]=t[i]||[],t[i].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};W.create=r=>new W(r);var yi=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===h.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:b.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}},ue=yi;var Nr=ue;function xi(r){Nr=r}function Ue(){return Nr}var st=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,i=[...t,...n.path||[]],a={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let o="",c=s.filter(l=>!!l).slice().reverse();for(let l of c)o=l(a,{data:e,defaultError:o}).message;return{...n,path:i,message:o}},vi=[];function p(r,e){let t=Ue(),s=st({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===ue?void 0:ue].filter(n=>!!n)});r.common.issues.push(s)}var D=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return E;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let i=await n.key,a=await n.value;s.push({key:i,value:a})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:i,value:a}=n;if(i.status==="aborted"||a.status==="aborted")return E;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(s[i.value]=a.value)}return{status:e.value,value:s}}},E=Object.freeze({status:"aborted"}),Re=r=>({status:"dirty",value:r}),V=r=>({status:"valid",value:r}),wt=r=>r.status==="aborted",Et=r=>r.status==="dirty",me=r=>r.status==="valid",ze=r=>typeof Promise<"u"&&r instanceof Promise;var x;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(x||(x={}));var Y=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Tr=(r,e)=>{if(me(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new W(r.common.issues);return this._error=t,this._error}}};function I(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,o)=>{let{message:c}=r;return a.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:n}}var S=class{get description(){return this._def.description}_getType(e){return ie(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new D,ctx:{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ze(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Tr(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return me(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>me(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},n=this._parse({data:e,path:s.path,parent:s}),i=await(ze(n)?n:Promise.resolve(n));return Tr(s,i)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let a=e(n),o=()=>i.addIssue({code:d.custom,...s(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new K({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return J.create(this,this._def)}nullable(){return oe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pe.create(this)}promise(){return xe.create(this,this._def)}or(e){return Ne.create([this,e],this._def)}and(e){return Te.create(this,e,this._def)}transform(e){return new K({...I(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new je({...I(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new nt({typeName:_.ZodBranded,type:this,...I(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Fe({...I(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return it.create(this,e)}readonly(){return De.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},wi=/^c[^\s-]{8,}$/i,Ei=/^[0-9a-z]+$/,_i=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ri=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ki=/^[a-z0-9_-]{21}$/i,Ii=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Si=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,$i=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,bi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Qt,Oi=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ni=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ti=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ai=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ci=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Pi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Li=new RegExp(`^${Cr}$`);function Pr(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ji(r){return new RegExp(`^${Pr(r)}$`)}function Lr(r){let e=`${Cr}T${Pr(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Fi(r,e){return!!((e==="v4"||!e)&&Oi.test(r)||(e==="v6"||!e)&&Ti.test(r))}function Di(r,e){if(!Ii.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function qi(r,e){return!!((e==="v4"||!e)&&Ni.test(r)||(e==="v6"||!e)&&Ai.test(r))}var ge=class r extends S{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){let i=this._getOrReturnCtx(e);return p(i,{code:d.invalid_type,expected:h.string,received:i.parsedType}),E}let s=new D,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(n=this._getOrReturnCtx(e,n),a?p(n,{code:d.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&p(n,{code:d.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")$i.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"email",code:d.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")Qt||(Qt=new RegExp(bi,"u")),Qt.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"emoji",code:d.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")Ri.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"uuid",code:d.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")ki.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"nanoid",code:d.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")wi.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"cuid",code:d.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")Ei.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"cuid2",code:d.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")_i.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"ulid",code:d.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),p(n,{validation:"url",code:d.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"regex",code:d.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?Lr(i).test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?Li.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?ji(i).test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?Si.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"duration",code:d.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?Fi(e.data,i.version)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"ip",code:d.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?Di(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"jwt",code:d.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?qi(e.data,i.version)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"cidr",code:d.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?Ci.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"base64",code:d.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?Pi.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:"base64url",code:d.invalid_string,message:i.message}),s.dirty()):b.assertNever(i);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:d.invalid_string,...x.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...x.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...x.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...x.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};ge.create=r=>new ge({checks:[],typeName:_.ZodString,coerce:r?.coerce??!1,...I(r)});function Mi(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,i=Number.parseInt(r.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return i%a/10**n}var ke=class r extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){let i=this._getOrReturnCtx(e);return p(i,{code:d.invalid_type,expected:h.number,received:i.parsedType}),E}let s,n=new D;for(let i of this._def.checks)i.kind==="int"?b.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Mi(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.not_finite,message:i.message}),n.dirty()):b.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:x.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ke.create=r=>new ke({checks:[],typeName:_.ZodNumber,coerce:r?.coerce||!1,...I(r)});var Ie=class r extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let s,n=new D;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):b.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return p(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),E}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:x.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Ie.create=r=>new Ie({checks:[],typeName:_.ZodBigInt,coerce:r?.coerce??!1,...I(r)});var Se=class extends S{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){let s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_type,expected:h.boolean,received:s.parsedType}),E}return V(e.data)}};Se.create=r=>new Se({typeName:_.ZodBoolean,coerce:r?.coerce||!1,...I(r)});var $e=class r extends S{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){let i=this._getOrReturnCtx(e);return p(i,{code:d.invalid_type,expected:h.date,received:i.parsedType}),E}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return p(i,{code:d.invalid_date}),E}let s=new D,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):b.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};$e.create=r=>new $e({checks:[],coerce:r?.coerce||!1,typeName:_.ZodDate,...I(r)});var Ze=class extends S{_parse(e){if(this._getType(e)!==h.symbol){let s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_type,expected:h.symbol,received:s.parsedType}),E}return V(e.data)}};Ze.create=r=>new Ze({typeName:_.ZodSymbol,...I(r)});var be=class extends S{_parse(e){if(this._getType(e)!==h.undefined){let s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_type,expected:h.undefined,received:s.parsedType}),E}return V(e.data)}};be.create=r=>new be({typeName:_.ZodUndefined,...I(r)});var Oe=class extends S{_parse(e){if(this._getType(e)!==h.null){let s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_type,expected:h.null,received:s.parsedType}),E}return V(e.data)}};Oe.create=r=>new Oe({typeName:_.ZodNull,...I(r)});var ye=class extends S{constructor(){super(...arguments),this._any=!0}_parse(e){return V(e.data)}};ye.create=r=>new ye({typeName:_.ZodAny,...I(r)});var fe=class extends S{constructor(){super(...arguments),this._unknown=!0}_parse(e){return V(e.data)}};fe.create=r=>new fe({typeName:_.ZodUnknown,...I(r)});var se=class extends S{_parse(e){let t=this._getOrReturnCtx(e);return p(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),E}};se.create=r=>new se({typeName:_.ZodNever,...I(r)});var We=class extends S{_parse(e){if(this._getType(e)!==h.undefined){let s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_type,expected:h.void,received:s.parsedType}),E}return V(e.data)}};We.create=r=>new We({typeName:_.ZodVoid,...I(r)});var pe=class r extends S{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return p(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),E;if(n.exactLength!==null){let a=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(a||o)&&(p(t,{code:a?d.too_big:d.too_small,minimum:o?n.exactLength.value:void 0,maximum:a?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(p(t,{code:d.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(p(t,{code:d.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>n.type._parseAsync(new Y(t,a,t.path,o)))).then(a=>D.mergeArray(s,a));let i=[...t.data].map((a,o)=>n.type._parseSync(new Y(t,a,t.path,o)));return D.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:x.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:x.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:x.toString(t)}})}nonempty(e){return this.min(1,e)}};pe.create=(r,e)=>new pe({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...I(e)});function Ge(r){if(r instanceof X){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=J.create(Ge(s))}return new X({...r._def,shape:()=>e})}else return r instanceof pe?new pe({...r._def,type:Ge(r.element)}):r instanceof J?J.create(Ge(r.unwrap())):r instanceof oe?oe.create(Ge(r.unwrap())):r instanceof ae?ae.create(r.items.map(e=>Ge(e))):r}var X=class r extends S{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){let l=this._getOrReturnCtx(e);return p(l,{code:d.invalid_type,expected:h.object,received:l.parsedType}),E}let{status:s,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof se&&this._def.unknownKeys==="strip"))for(let l in n.data)a.includes(l)||o.push(l);let c=[];for(let l of a){let u=i[l],y=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Y(n,y,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof se){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(l==="strict")o.length>0&&(p(n,{code:d.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of o){let y=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Y(n,y,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let y=await u.key,$=await u.value;l.push({key:y,value:$,alwaysSet:u.alwaysSet})}return l}).then(l=>D.mergeObjectSync(s,l)):D.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:x.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of b.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of b.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return Ge(this)}partial(e){let t={};for(let s of b.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of b.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof J;)i=i._def.innerType;t[s]=i}return new r({...this._def,shape:()=>t})}keyof(){return jr(b.objectKeys(this.shape))}};X.create=(r,e)=>new X({shape:()=>r,unknownKeys:"strip",catchall:se.create(),typeName:_.ZodObject,...I(e)});X.strictCreate=(r,e)=>new X({shape:()=>r,unknownKeys:"strict",catchall:se.create(),typeName:_.ZodObject,...I(e)});X.lazycreate=(r,e)=>new X({shape:r,unknownKeys:"strip",catchall:se.create(),typeName:_.ZodObject,...I(e)});var Ne=class extends S{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(o=>new W(o.ctx.common.issues));return p(t,{code:d.invalid_union,unionErrors:a}),E}if(t.common.async)return Promise.all(s.map(async i=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let i,a=[];for(let c of s){let l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(c=>new W(c));return p(t,{code:d.invalid_union,unionErrors:o}),E}}get options(){return this._def.options}};Ne.create=(r,e)=>new Ne({options:r,typeName:_.ZodUnion,...I(e)});var de=r=>r instanceof Ae?de(r.schema):r instanceof K?de(r.innerType()):r instanceof Ce?[r.value]:r instanceof Pe?r.options:r instanceof Le?b.objectValues(r.enum):r instanceof je?de(r._def.innerType):r instanceof be?[void 0]:r instanceof Oe?[null]:r instanceof J?[void 0,...de(r.unwrap())]:r instanceof oe?[null,...de(r.unwrap())]:r instanceof nt||r instanceof De?de(r.unwrap()):r instanceof Fe?de(r._def.innerType):[],_t=class r extends S{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return p(t,{code:d.invalid_type,expected:h.object,received:t.parsedType}),E;let s=this.discriminator,n=t.data[s],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let i of t){let a=de(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,i)}}return new r({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...I(s)})}};function er(r,e){let t=ie(r),s=ie(e);if(r===e)return{valid:!0,data:r};if(t===h.object&&s===h.object){let n=b.objectKeys(e),i=b.objectKeys(r).filter(o=>n.indexOf(o)!==-1),a={...r,...e};for(let o of i){let c=er(r[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===h.array&&s===h.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<r.length;i++){let a=r[i],o=e[i],c=er(a,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===h.date&&s===h.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Te=class extends S{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(i,a)=>{if(wt(i)||wt(a))return E;let o=er(i.value,a.value);return o.valid?((Et(i)||Et(a))&&t.dirty(),{status:t.value,value:o.data}):(p(s,{code:d.invalid_intersection_types}),E)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};Te.create=(r,e,t)=>new Te({left:r,right:e,typeName:_.ZodIntersection,...I(t)});var ae=class r extends S{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return p(s,{code:d.invalid_type,expected:h.array,received:s.parsedType}),E;if(s.data.length<this._def.items.length)return p(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&s.data.length>this._def.items.length&&(p(s,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...s.data].map((a,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new Y(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(i).then(a=>D.mergeArray(t,a)):D.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};ae.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ae({items:r,typeName:_.ZodTuple,rest:null,...I(e)})};var Rt=class r extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.object)return p(s,{code:d.invalid_type,expected:h.object,received:s.parsedType}),E;let n=[],i=this._def.keyType,a=this._def.valueType;for(let o in s.data)n.push({key:i._parse(new Y(s,o,s.path,o)),value:a._parse(new Y(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?D.mergeObjectAsync(t,n):D.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof S?new r({keyType:e,valueType:t,typeName:_.ZodRecord,...I(s)}):new r({keyType:ge.create(),valueType:e,typeName:_.ZodRecord,...I(t)})}},Xe=class extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.map)return p(s,{code:d.invalid_type,expected:h.map,received:s.parsedType}),E;let n=this._def.keyType,i=this._def.valueType,a=[...s.data.entries()].map(([o,c],l)=>({key:n._parse(new Y(s,o,s.path,[l,"key"])),value:i._parse(new Y(s,c,s.path,[l,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return E;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of a){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return E;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}}}};Xe.create=(r,e,t)=>new Xe({valueType:e,keyType:r,typeName:_.ZodMap,...I(t)});var He=class r extends S{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return p(s,{code:d.invalid_type,expected:h.set,received:s.parsedType}),E;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(p(s,{code:d.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(p(s,{code:d.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(c){let l=new Set;for(let u of c){if(u.status==="aborted")return E;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}let o=[...s.data.values()].map((c,l)=>i._parse(new Y(s,c,s.path,l)));return s.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:x.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:x.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};He.create=(r,e)=>new He({valueType:r,minSize:null,maxSize:null,typeName:_.ZodSet,...I(e)});var kt=class r extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return p(t,{code:d.invalid_type,expected:h.function,received:t.parsedType}),E;function s(o,c){return st({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),ue].filter(l=>!!l),issueData:{code:d.invalid_arguments,argumentsError:c}})}function n(o,c){return st({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),ue].filter(l=>!!l),issueData:{code:d.invalid_return_type,returnTypeError:c}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof xe){let o=this;return V(async function(...c){let l=new W([]),u=await o._def.args.parseAsync(c,i).catch(f=>{throw l.addIssue(s(c,f)),l}),y=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(y,i).catch(f=>{throw l.addIssue(n(y,f)),l})})}else{let o=this;return V(function(...c){let l=o._def.args.safeParse(c,i);if(!l.success)throw new W([s(c,l.error)]);let u=Reflect.apply(a,this,l.data),y=o._def.returns.safeParse(u,i);if(!y.success)throw new W([n(u,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:ae.create(e).rest(fe.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||ae.create([]).rest(fe.create()),returns:t||fe.create(),typeName:_.ZodFunction,...I(s)})}},Ae=class extends S{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ae.create=(r,e)=>new Ae({getter:r,typeName:_.ZodLazy,...I(e)});var Ce=class extends S{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ce.create=(r,e)=>new Ce({value:r,typeName:_.ZodLiteral,...I(e)});function jr(r,e){return new Pe({values:r,typeName:_.ZodEnum,...I(e)})}var Pe=class r extends S{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return p(t,{expected:b.joinValues(s),received:t.parsedType,code:d.invalid_type}),E}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return p(t,{received:t.data,code:d.invalid_enum_value,options:s}),E}return V(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Pe.create=jr;var Le=class extends S{_parse(e){let t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){let n=b.objectValues(t);return p(s,{expected:b.joinValues(n),received:s.parsedType,code:d.invalid_type}),E}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=b.objectValues(t);return p(s,{received:s.data,code:d.invalid_enum_value,options:n}),E}return V(e.data)}get enum(){return this._def.values}};Le.create=(r,e)=>new Le({values:r,typeName:_.ZodNativeEnum,...I(e)});var xe=class extends S{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return p(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),E;let s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return V(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};xe.create=(r,e)=>new xe({type:r,typeName:_.ZodPromise,...I(e)});var K=class extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:a=>{p(s,a),a.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let a=n.transform(s.data,i);if(s.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return E;let c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?E:c.status==="dirty"?Re(c.value):t.value==="dirty"?Re(c.value):c});{if(t.value==="aborted")return E;let o=this._def.schema._parseSync({data:a,path:s.path,parent:s});return o.status==="aborted"?E:o.status==="dirty"?Re(o.value):t.value==="dirty"?Re(o.value):o}}if(n.type==="refinement"){let a=o=>{let c=n.refinement(o,i);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?E:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?E:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!me(a))return E;let o=n.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>me(a)?Promise.resolve(n.transform(a.value,i)).then(o=>({status:t.value,value:o})):E);b.assertNever(n)}};K.create=(r,e,t)=>new K({schema:r,typeName:_.ZodEffects,effect:e,...I(t)});K.createWithPreprocess=(r,e,t)=>new K({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...I(t)});var J=class extends S{_parse(e){return this._getType(e)===h.undefined?V(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};J.create=(r,e)=>new J({innerType:r,typeName:_.ZodOptional,...I(e)});var oe=class extends S{_parse(e){return this._getType(e)===h.null?V(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};oe.create=(r,e)=>new oe({innerType:r,typeName:_.ZodNullable,...I(e)});var je=class extends S{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};je.create=(r,e)=>new je({innerType:r,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...I(e)});var Fe=class extends S{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ze(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new W(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new W(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Fe.create=(r,e)=>new Fe({innerType:r,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...I(e)});var Be=class extends S{_parse(e){if(this._getType(e)!==h.nan){let s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_type,expected:h.nan,received:s.parsedType}),E}return{status:"valid",value:e.data}}};Be.create=r=>new Be({typeName:_.ZodNaN,...I(r)});var Vi=Symbol("zod_brand"),nt=class extends S{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},it=class r extends S{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?E:i.status==="dirty"?(t.dirty(),Re(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?E:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:_.ZodPipeline})}},De=class extends S{_parse(e){let t=this._def.innerType._parse(e),s=n=>(me(n)&&(n.value=Object.freeze(n.value)),n);return ze(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};De.create=(r,e)=>new De({innerType:r,typeName:_.ZodReadonly,...I(e)});function Ar(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Fr(r,e={},t){return r?ye.create().superRefine((s,n)=>{let i=r(s);if(i instanceof Promise)return i.then(a=>{if(!a){let o=Ar(e,s),c=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:c})}});if(!i){let a=Ar(e,s),o=a.fatal??t??!0;n.addIssue({code:"custom",...a,fatal:o})}}):ye.create()}var Ui={object:X.lazycreate},_;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(_||(_={}));var zi=(r,e={message:`Input not instance of ${r.name}`})=>Fr(t=>t instanceof r,e),Dr=ge.create,qr=ke.create,Gi=Be.create,Zi=Ie.create,Mr=Se.create,Wi=$e.create,Xi=Ze.create,Hi=be.create,Bi=Oe.create,Ji=ye.create,Yi=fe.create,Ki=se.create,Qi=We.create,ea=pe.create,ta=X.create,ra=X.strictCreate,sa=Ne.create,na=_t.create,ia=Te.create,aa=ae.create,oa=Rt.create,ca=Xe.create,la=He.create,ua=kt.create,da=Ae.create,fa=Ce.create,pa=Pe.create,ha=Le.create,ma=xe.create,ga=K.create,ya=J.create,xa=oe.create,va=K.createWithPreprocess,wa=it.create,Ea=()=>Dr().optional(),_a=()=>qr().optional(),Ra=()=>Mr().optional(),ka={string:(r=>ge.create({...r,coerce:!0})),number:(r=>ke.create({...r,coerce:!0})),boolean:(r=>Se.create({...r,coerce:!0})),bigint:(r=>Ie.create({...r,coerce:!0})),date:(r=>$e.create({...r,coerce:!0}))};var Ia=E;import{promises as Na}from"node:fs";import{join as Ta,isAbsolute as Aa,normalize as Ca}from"node:path";var It=T.object({name:T.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:T.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),deps:T.record(T.string().regex(/^[a-z0-9-]+$/,"Dependency name must be lowercase alphanumeric with hyphens"),T.string().regex(/^\d+\.\d+\.\d+$/,"Dependency version must be exact semver")).default({}),files:T.array(T.string()).min(1,"Files array cannot be empty"),hash:T.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>").optional()});var Sa=T.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Key must be name@version"),$a=T.string().refine(r=>r.length===0?!1:(r.startsWith("file:")||r.startsWith("/")||/^[a-zA-Z]:\\/.test(r)||r.startsWith("./")||r.startsWith("../"),!0),"Source must be a non-empty file URL or local path"),ba=T.object({source:$a,hash:T.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>")}),Vr=T.record(Sa,ba);var Oa=T.object({name:T.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:T.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),hash:T.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>"),source:T.string().url("Source must be a valid URL"),deps:T.array(T.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Dependency must be in format name@version"))}),ed=T.object({createdAt:T.string().datetime("createdAt must be ISO-8601 format"),entries:T.array(Oa)});function St(r){try{return It.parse(r)}catch(e){if(e instanceof T.ZodError){let t=e.errors.map(s=>`${s.path.length>0?`${s.path.join(".")}: `:""}${s.message}`);throw new Error(`Manifest validation failed:
|
|
3
|
-
${t.join(`
|
|
4
|
-
`)
|
|
5
|
-
|
|
2
|
+
var uc=Object.create;var as=Object.defineProperty;var cc=Object.getOwnPropertyDescriptor;var lc=Object.getOwnPropertyNames;var dc=Object.getPrototypeOf,fc=Object.prototype.hasOwnProperty;var bn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var F=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),pc=(t,e)=>{for(var r in e)as(t,r,{get:e[r],enumerable:!0})},hc=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of lc(e))!fc.call(t,n)&&n!==r&&as(t,n,{get:()=>e[n],enumerable:!(s=cc(e,n))||s.enumerable});return t};var Ft=(t,e,r)=>(r=t!=null?uc(dc(t)):{},hc(e||!t||!t.__esModule?as(r,"default",{value:t,enumerable:!0}):r,t));var ir=F((ly,Mn)=>{"use strict";var Ll="2.0.0",jl=Number.MAX_SAFE_INTEGER||9007199254740991,Ml=16,Bl=250,ql=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Mn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Ml,MAX_SAFE_BUILD_LENGTH:Bl,MAX_SAFE_INTEGER:jl,RELEASE_TYPES:ql,SEMVER_SPEC_VERSION:Ll,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var or=F((dy,Bn)=>{"use strict";var Wl=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Bn.exports=Wl});var Pt=F((Pe,qn)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:ps,MAX_SAFE_BUILD_LENGTH:Ul,MAX_LENGTH:zl}=ir(),Vl=or();Pe=qn.exports={};var Gl=Pe.re=[],Hl=Pe.safeRe=[],b=Pe.src=[],Yl=Pe.safeSrc=[],C=Pe.t={},Zl=0,hs="[a-zA-Z0-9-]",Xl=[["\\s",1],["\\d",zl],[hs,Ul]],Jl=t=>{for(let[e,r]of Xl)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},O=(t,e,r)=>{let s=Jl(e),n=Zl++;Vl(t,n,e),C[t]=n,b[n]=e,Yl[n]=s,Gl[n]=new RegExp(e,r?"g":void 0),Hl[n]=new RegExp(s,r?"g":void 0)};O("NUMERICIDENTIFIER","0|[1-9]\\d*");O("NUMERICIDENTIFIERLOOSE","\\d+");O("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${hs}*`);O("MAINVERSION",`(${b[C.NUMERICIDENTIFIER]})\\.(${b[C.NUMERICIDENTIFIER]})\\.(${b[C.NUMERICIDENTIFIER]})`);O("MAINVERSIONLOOSE",`(${b[C.NUMERICIDENTIFIERLOOSE]})\\.(${b[C.NUMERICIDENTIFIERLOOSE]})\\.(${b[C.NUMERICIDENTIFIERLOOSE]})`);O("PRERELEASEIDENTIFIER",`(?:${b[C.NONNUMERICIDENTIFIER]}|${b[C.NUMERICIDENTIFIER]})`);O("PRERELEASEIDENTIFIERLOOSE",`(?:${b[C.NONNUMERICIDENTIFIER]}|${b[C.NUMERICIDENTIFIERLOOSE]})`);O("PRERELEASE",`(?:-(${b[C.PRERELEASEIDENTIFIER]}(?:\\.${b[C.PRERELEASEIDENTIFIER]})*))`);O("PRERELEASELOOSE",`(?:-?(${b[C.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[C.PRERELEASEIDENTIFIERLOOSE]})*))`);O("BUILDIDENTIFIER",`${hs}+`);O("BUILD",`(?:\\+(${b[C.BUILDIDENTIFIER]}(?:\\.${b[C.BUILDIDENTIFIER]})*))`);O("FULLPLAIN",`v?${b[C.MAINVERSION]}${b[C.PRERELEASE]}?${b[C.BUILD]}?`);O("FULL",`^${b[C.FULLPLAIN]}$`);O("LOOSEPLAIN",`[v=\\s]*${b[C.MAINVERSIONLOOSE]}${b[C.PRERELEASELOOSE]}?${b[C.BUILD]}?`);O("LOOSE",`^${b[C.LOOSEPLAIN]}$`);O("GTLT","((?:<|>)?=?)");O("XRANGEIDENTIFIERLOOSE",`${b[C.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);O("XRANGEIDENTIFIER",`${b[C.NUMERICIDENTIFIER]}|x|X|\\*`);O("XRANGEPLAIN",`[v=\\s]*(${b[C.XRANGEIDENTIFIER]})(?:\\.(${b[C.XRANGEIDENTIFIER]})(?:\\.(${b[C.XRANGEIDENTIFIER]})(?:${b[C.PRERELEASE]})?${b[C.BUILD]}?)?)?`);O("XRANGEPLAINLOOSE",`[v=\\s]*(${b[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[C.XRANGEIDENTIFIERLOOSE]})(?:${b[C.PRERELEASELOOSE]})?${b[C.BUILD]}?)?)?`);O("XRANGE",`^${b[C.GTLT]}\\s*${b[C.XRANGEPLAIN]}$`);O("XRANGELOOSE",`^${b[C.GTLT]}\\s*${b[C.XRANGEPLAINLOOSE]}$`);O("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ps}})(?:\\.(\\d{1,${ps}}))?(?:\\.(\\d{1,${ps}}))?`);O("COERCE",`${b[C.COERCEPLAIN]}(?:$|[^\\d])`);O("COERCEFULL",b[C.COERCEPLAIN]+`(?:${b[C.PRERELEASE]})?(?:${b[C.BUILD]})?(?:$|[^\\d])`);O("COERCERTL",b[C.COERCE],!0);O("COERCERTLFULL",b[C.COERCEFULL],!0);O("LONETILDE","(?:~>?)");O("TILDETRIM",`(\\s*)${b[C.LONETILDE]}\\s+`,!0);Pe.tildeTrimReplace="$1~";O("TILDE",`^${b[C.LONETILDE]}${b[C.XRANGEPLAIN]}$`);O("TILDELOOSE",`^${b[C.LONETILDE]}${b[C.XRANGEPLAINLOOSE]}$`);O("LONECARET","(?:\\^)");O("CARETTRIM",`(\\s*)${b[C.LONECARET]}\\s+`,!0);Pe.caretTrimReplace="$1^";O("CARET",`^${b[C.LONECARET]}${b[C.XRANGEPLAIN]}$`);O("CARETLOOSE",`^${b[C.LONECARET]}${b[C.XRANGEPLAINLOOSE]}$`);O("COMPARATORLOOSE",`^${b[C.GTLT]}\\s*(${b[C.LOOSEPLAIN]})$|^$`);O("COMPARATOR",`^${b[C.GTLT]}\\s*(${b[C.FULLPLAIN]})$|^$`);O("COMPARATORTRIM",`(\\s*)${b[C.GTLT]}\\s*(${b[C.LOOSEPLAIN]}|${b[C.XRANGEPLAIN]})`,!0);Pe.comparatorTrimReplace="$1$2$3";O("HYPHENRANGE",`^\\s*(${b[C.XRANGEPLAIN]})\\s+-\\s+(${b[C.XRANGEPLAIN]})\\s*$`);O("HYPHENRANGELOOSE",`^\\s*(${b[C.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[C.XRANGEPLAINLOOSE]})\\s*$`);O("STAR","(<|>)?=?\\s*\\*");O("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");O("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var kr=F((fy,Wn)=>{"use strict";var Kl=Object.freeze({loose:!0}),Ql=Object.freeze({}),ed=t=>t?typeof t!="object"?Kl:t:Ql;Wn.exports=ed});var ms=F((py,Vn)=>{"use strict";var Un=/^[0-9]+$/,zn=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=Un.test(t),s=Un.test(e);return r&&s&&(t=+t,e=+e),t===e?0:r&&!s?-1:s&&!r?1:t<e?-1:1},td=(t,e)=>zn(e,t);Vn.exports={compareIdentifiers:zn,rcompareIdentifiers:td}});var te=F((hy,Hn)=>{"use strict";var Or=or(),{MAX_LENGTH:Gn,MAX_SAFE_INTEGER:Tr}=ir(),{safeRe:Pr,t:Nr}=Pt(),rd=kr(),{compareIdentifiers:Ds}=ms(),gs=class t{constructor(e,r){if(r=rd(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>Gn)throw new TypeError(`version is longer than ${Gn} characters`);Or("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=e.trim().match(r.loose?Pr[Nr.LOOSE]:Pr[Nr.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>Tr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Tr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Tr||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<Tr)return i}return n}):this.prerelease=[],this.build=s[5]?s[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(Or("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)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}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 s=this.prerelease[r],n=e.prerelease[r];if(Or("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return Ds(s,n)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let s=this.build[r],n=e.build[r];if(Or("build compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return Ds(s,n)}while(++r)}inc(e,r,s){if(e.startsWith("pre")){if(!r&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let n=`-${r}`.match(this.options.loose?Pr[Nr.PRERELEASELOOSE]:Pr[Nr.PRERELEASE]);if(!n||n[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,s),this.inc("pre",r,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,s),this.inc("pre",r,s);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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 n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];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(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let i=[r,n];s===!1&&(i=[r]),Ds(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}};Hn.exports=gs});var yt=F((my,Zn)=>{"use strict";var Yn=te(),sd=(t,e,r=!1)=>{if(t instanceof Yn)return t;try{return new Yn(t,e)}catch(s){if(!r)return null;throw s}};Zn.exports=sd});var Jn=F((Dy,Xn)=>{"use strict";var nd=yt(),id=(t,e)=>{let r=nd(t,e);return r?r.version:null};Xn.exports=id});var Qn=F((gy,Kn)=>{"use strict";var od=yt(),ad=(t,e)=>{let r=od(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Kn.exports=ad});var ri=F((yy,ti)=>{"use strict";var ei=te(),ud=(t,e,r,s,n)=>{typeof r=="string"&&(n=s,s=r,r=void 0);try{return new ei(t instanceof ei?t.version:t,r).inc(e,s,n).version}catch{return null}};ti.exports=ud});var ii=F((wy,ni)=>{"use strict";var si=yt(),cd=(t,e)=>{let r=si(t,null,!0),s=si(e,null,!0),n=r.compare(s);if(n===0)return null;let i=n>0,o=i?r:s,a=i?s:r,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==s.major?l+"major":r.minor!==s.minor?l+"minor":r.patch!==s.patch?l+"patch":"prerelease"};ni.exports=cd});var ai=F((Ey,oi)=>{"use strict";var ld=te(),dd=(t,e)=>new ld(t,e).major;oi.exports=dd});var ci=F((xy,ui)=>{"use strict";var fd=te(),pd=(t,e)=>new fd(t,e).minor;ui.exports=pd});var di=F((vy,li)=>{"use strict";var hd=te(),md=(t,e)=>new hd(t,e).patch;li.exports=md});var pi=F((by,fi)=>{"use strict";var Dd=yt(),gd=(t,e)=>{let r=Dd(t,e);return r&&r.prerelease.length?r.prerelease:null};fi.exports=gd});var xe=F((Cy,mi)=>{"use strict";var hi=te(),yd=(t,e,r)=>new hi(t,r).compare(new hi(e,r));mi.exports=yd});var gi=F((Fy,Di)=>{"use strict";var wd=xe(),Ed=(t,e,r)=>wd(e,t,r);Di.exports=Ed});var wi=F((Ry,yi)=>{"use strict";var xd=xe(),vd=(t,e)=>xd(t,e,!0);yi.exports=vd});var Lr=F((Sy,xi)=>{"use strict";var Ei=te(),bd=(t,e,r)=>{let s=new Ei(t,r),n=new Ei(e,r);return s.compare(n)||s.compareBuild(n)};xi.exports=bd});var bi=F((_y,vi)=>{"use strict";var Cd=Lr(),Fd=(t,e)=>t.sort((r,s)=>Cd(r,s,e));vi.exports=Fd});var Fi=F((Ay,Ci)=>{"use strict";var Rd=Lr(),Sd=(t,e)=>t.sort((r,s)=>Rd(s,r,e));Ci.exports=Sd});var ar=F((Iy,Ri)=>{"use strict";var _d=xe(),Ad=(t,e,r)=>_d(t,e,r)>0;Ri.exports=Ad});var jr=F(($y,Si)=>{"use strict";var Id=xe(),$d=(t,e,r)=>Id(t,e,r)<0;Si.exports=$d});var ys=F((ky,_i)=>{"use strict";var kd=xe(),Od=(t,e,r)=>kd(t,e,r)===0;_i.exports=Od});var ws=F((Oy,Ai)=>{"use strict";var Td=xe(),Pd=(t,e,r)=>Td(t,e,r)!==0;Ai.exports=Pd});var Mr=F((Ty,Ii)=>{"use strict";var Nd=xe(),Ld=(t,e,r)=>Nd(t,e,r)>=0;Ii.exports=Ld});var Br=F((Py,$i)=>{"use strict";var jd=xe(),Md=(t,e,r)=>jd(t,e,r)<=0;$i.exports=Md});var Es=F((Ny,ki)=>{"use strict";var Bd=ys(),qd=ws(),Wd=ar(),Ud=Mr(),zd=jr(),Vd=Br(),Gd=(t,e,r,s)=>{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 Bd(t,r,s);case"!=":return qd(t,r,s);case">":return Wd(t,r,s);case">=":return Ud(t,r,s);case"<":return zd(t,r,s);case"<=":return Vd(t,r,s);default:throw new TypeError(`Invalid operator: ${e}`)}};ki.exports=Gd});var Ti=F((Ly,Oi)=>{"use strict";var Hd=te(),Yd=yt(),{safeRe:qr,t:Wr}=Pt(),Zd=(t,e)=>{if(t instanceof Hd)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(e.includePrerelease?qr[Wr.COERCEFULL]:qr[Wr.COERCE]);else{let u=e.includePrerelease?qr[Wr.COERCERTLFULL]:qr[Wr.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let s=r[2],n=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Yd(`${s}.${n}.${i}${o}${a}`,e)};Oi.exports=Zd});var Ni=F((jy,Pi)=>{"use strict";var xs=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,r)}return this}};Pi.exports=xs});var ve=F((My,Bi)=>{"use strict";var Xd=/\s+/g,vs=class t{constructor(e,r){if(r=Kd(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof bs)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Xd," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!ji(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&of(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let s=((this.options.includePrerelease&&sf)|(this.options.loose&&nf))+":"+e,n=Li.get(s);if(n)return n;let i=this.options.loose,o=i?ne[re.HYPHENRANGELOOSE]:ne[re.HYPHENRANGE];e=e.replace(o,Df(this.options.includePrerelease)),q("hyphen replace",e),e=e.replace(ne[re.COMPARATORTRIM],ef),q("comparator trim",e),e=e.replace(ne[re.TILDETRIM],tf),q("tilde trim",e),e=e.replace(ne[re.CARETTRIM],rf),q("caret trim",e);let a=e.split(" ").map(p=>af(p,this.options)).join(" ").split(/\s+/).map(p=>mf(p,this.options));i&&(a=a.filter(p=>(q("loose invalid filter",p,this.options),!!p.match(ne[re.COMPARATORLOOSE])))),q("range list",a);let u=new Map,c=a.map(p=>new bs(p,this.options));for(let p of c){if(ji(p))return[p];u.set(p.value,p)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return Li.set(s,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(s=>Mi(s,r)&&e.set.some(n=>Mi(n,r)&&s.every(i=>n.every(o=>i.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Qd(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(gf(this.set[r],e,this.options))return!0;return!1}};Bi.exports=vs;var Jd=Ni(),Li=new Jd,Kd=kr(),bs=ur(),q=or(),Qd=te(),{safeRe:ne,t:re,comparatorTrimReplace:ef,tildeTrimReplace:tf,caretTrimReplace:rf}=Pt(),{FLAG_INCLUDE_PRERELEASE:sf,FLAG_LOOSE:nf}=ir(),ji=t=>t.value==="<0.0.0-0",of=t=>t.value==="",Mi=(t,e)=>{let r=!0,s=t.slice(),n=s.pop();for(;r&&s.length;)r=s.every(i=>n.intersects(i,e)),n=s.pop();return r},af=(t,e)=>(t=t.replace(ne[re.BUILD],""),q("comp",t,e),t=lf(t,e),q("caret",t),t=uf(t,e),q("tildes",t),t=ff(t,e),q("xrange",t),t=hf(t,e),q("stars",t),t),ie=t=>!t||t.toLowerCase()==="x"||t==="*",uf=(t,e)=>t.trim().split(/\s+/).map(r=>cf(r,e)).join(" "),cf=(t,e)=>{let r=e.loose?ne[re.TILDELOOSE]:ne[re.TILDE];return t.replace(r,(s,n,i,o,a)=>{q("tilde",t,s,n,i,o,a);let u;return ie(n)?u="":ie(i)?u=`>=${n}.0.0 <${+n+1}.0.0-0`:ie(o)?u=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(q("replaceTilde pr",a),u=`>=${n}.${i}.${o}-${a} <${n}.${+i+1}.0-0`):u=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,q("tilde return",u),u})},lf=(t,e)=>t.trim().split(/\s+/).map(r=>df(r,e)).join(" "),df=(t,e)=>{q("caret",t,e);let r=e.loose?ne[re.CARETLOOSE]:ne[re.CARET],s=e.includePrerelease?"-0":"";return t.replace(r,(n,i,o,a,u)=>{q("caret",t,n,i,o,a,u);let c;return ie(i)?c="":ie(o)?c=`>=${i}.0.0${s} <${+i+1}.0.0-0`:ie(a)?i==="0"?c=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:c=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:u?(q("replaceCaret pr",u),i==="0"?o==="0"?c=`>=${i}.${o}.${a}-${u} <${i}.${o}.${+a+1}-0`:c=`>=${i}.${o}.${a}-${u} <${i}.${+o+1}.0-0`:c=`>=${i}.${o}.${a}-${u} <${+i+1}.0.0-0`):(q("no pr"),i==="0"?o==="0"?c=`>=${i}.${o}.${a}${s} <${i}.${o}.${+a+1}-0`:c=`>=${i}.${o}.${a}${s} <${i}.${+o+1}.0-0`:c=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),q("caret return",c),c})},ff=(t,e)=>(q("replaceXRanges",t,e),t.split(/\s+/).map(r=>pf(r,e)).join(" ")),pf=(t,e)=>{t=t.trim();let r=e.loose?ne[re.XRANGELOOSE]:ne[re.XRANGE];return t.replace(r,(s,n,i,o,a,u)=>{q("xRange",t,s,n,i,o,a,u);let c=ie(i),l=c||ie(o),p=l||ie(a),y=p;return n==="="&&y&&(n=""),u=e.includePrerelease?"-0":"",c?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&y?(l&&(o=0),a=0,n===">"?(n=">=",l?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",l?i=+i+1:o=+o+1),n==="<"&&(u="-0"),s=`${n+i}.${o}.${a}${u}`):l?s=`>=${i}.0.0${u} <${+i+1}.0.0-0`:p&&(s=`>=${i}.${o}.0${u} <${i}.${+o+1}.0-0`),q("xRange return",s),s})},hf=(t,e)=>(q("replaceStars",t,e),t.trim().replace(ne[re.STAR],"")),mf=(t,e)=>(q("replaceGTE0",t,e),t.trim().replace(ne[e.includePrerelease?re.GTE0PRE:re.GTE0],"")),Df=t=>(e,r,s,n,i,o,a,u,c,l,p,y)=>(ie(s)?r="":ie(n)?r=`>=${s}.0.0${t?"-0":""}`:ie(i)?r=`>=${s}.${n}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,ie(c)?u="":ie(l)?u=`<${+c+1}.0.0-0`:ie(p)?u=`<${c}.${+l+1}.0-0`:y?u=`<=${c}.${l}.${p}-${y}`:t?u=`<${c}.${l}.${+p+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),gf=(t,e,r)=>{for(let s=0;s<t.length;s++)if(!t[s].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let s=0;s<t.length;s++)if(q(t[s].semver),t[s].semver!==bs.ANY&&t[s].semver.prerelease.length>0){let n=t[s].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var ur=F((By,Gi)=>{"use strict";var cr=Symbol("SemVer ANY"),Rs=class t{static get ANY(){return cr}constructor(e,r){if(r=qi(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Fs("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===cr?this.value="":this.value=this.operator+this.semver.version,Fs("comp",this)}parse(e){let r=this.options.loose?Wi[Ui.COMPARATORLOOSE]:Wi[Ui.COMPARATOR],s=e.match(r);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new zi(s[2],this.options.loose):this.semver=cr}toString(){return this.value}test(e){if(Fs("Comparator.test",e,this.options.loose),this.semver===cr||e===cr)return!0;if(typeof e=="string")try{e=new zi(e,this.options)}catch{return!1}return Cs(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 Vi(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Vi(this.value,r).test(e.semver):(r=qi(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("=")||Cs(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Cs(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Gi.exports=Rs;var qi=kr(),{safeRe:Wi,t:Ui}=Pt(),Cs=Es(),Fs=or(),zi=te(),Vi=ve()});var lr=F((qy,Hi)=>{"use strict";var yf=ve(),wf=(t,e,r)=>{try{e=new yf(e,r)}catch{return!1}return e.test(t)};Hi.exports=wf});var Zi=F((Wy,Yi)=>{"use strict";var Ef=ve(),xf=(t,e)=>new Ef(t,e).set.map(r=>r.map(s=>s.value).join(" ").trim().split(" "));Yi.exports=xf});var Ji=F((Uy,Xi)=>{"use strict";var vf=te(),bf=ve(),Cf=(t,e,r)=>{let s=null,n=null,i=null;try{i=new bf(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===-1)&&(s=o,n=new vf(s,r))}),s};Xi.exports=Cf});var Qi=F((zy,Ki)=>{"use strict";var Ff=te(),Rf=ve(),Sf=(t,e,r)=>{let s=null,n=null,i=null;try{i=new Rf(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===1)&&(s=o,n=new Ff(s,r))}),s};Ki.exports=Sf});var ro=F((Vy,to)=>{"use strict";var Ss=te(),_f=ve(),eo=ar(),Af=(t,e)=>{t=new _f(t,e);let r=new Ss("0.0.0");if(t.test(r)||(r=new Ss("0.0.0-0"),t.test(r)))return r;r=null;for(let s=0;s<t.set.length;++s){let n=t.set[s],i=null;n.forEach(o=>{let a=new Ss(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||eo(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||eo(r,i))&&(r=i)}return r&&t.test(r)?r:null};to.exports=Af});var no=F((Gy,so)=>{"use strict";var If=ve(),$f=(t,e)=>{try{return new If(t,e).range||"*"}catch{return null}};so.exports=$f});var Ur=F((Hy,uo)=>{"use strict";var kf=te(),ao=ur(),{ANY:Of}=ao,Tf=ve(),Pf=lr(),io=ar(),oo=jr(),Nf=Br(),Lf=Mr(),jf=(t,e,r,s)=>{t=new kf(t,s),e=new Tf(e,s);let n,i,o,a,u;switch(r){case">":n=io,i=Nf,o=oo,a=">",u=">=";break;case"<":n=oo,i=Lf,o=io,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Pf(t,e,s))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],p=null,y=null;if(l.forEach(d=>{d.semver===Of&&(d=new ao(">=0.0.0")),p=p||d,y=y||d,n(d.semver,p.semver,s)?p=d:o(d.semver,y.semver,s)&&(y=d)}),p.operator===a||p.operator===u||(!y.operator||y.operator===a)&&i(t,y.semver))return!1;if(y.operator===u&&o(t,y.semver))return!1}return!0};uo.exports=jf});var lo=F((Yy,co)=>{"use strict";var Mf=Ur(),Bf=(t,e,r)=>Mf(t,e,">",r);co.exports=Bf});var po=F((Zy,fo)=>{"use strict";var qf=Ur(),Wf=(t,e,r)=>qf(t,e,"<",r);fo.exports=Wf});var Do=F((Xy,mo)=>{"use strict";var ho=ve(),Uf=(t,e,r)=>(t=new ho(t,r),e=new ho(e,r),t.intersects(e,r));mo.exports=Uf});var yo=F((Jy,go)=>{"use strict";var zf=lr(),Vf=xe();go.exports=(t,e,r)=>{let s=[],n=null,i=null,o=t.sort((l,p)=>Vf(l,p,r));for(let l of o)zf(l,e,r)?(i=l,n||(n=l)):(i&&s.push([n,i]),i=null,n=null);n&&s.push([n,null]);let a=[];for(let[l,p]of s)l===p?a.push(l):!p&&l===o[0]?a.push("*"):p?l===o[0]?a.push(`<=${p}`):a.push(`${l} - ${p}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var Co=F((Ky,bo)=>{"use strict";var wo=ve(),As=ur(),{ANY:_s}=As,dr=lr(),Is=xe(),Gf=(t,e,r={})=>{if(t===e)return!0;t=new wo(t,r),e=new wo(e,r);let s=!1;e:for(let n of t.set){for(let i of e.set){let o=Yf(n,i,r);if(s=s||o!==null,o)continue e}if(s)return!1}return!0},Hf=[new As(">=0.0.0-0")],Eo=[new As(">=0.0.0")],Yf=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===_s){if(e.length===1&&e[0].semver===_s)return!0;r.includePrerelease?t=Hf:t=Eo}if(e.length===1&&e[0].semver===_s){if(r.includePrerelease)return!0;e=Eo}let s=new Set,n,i;for(let d of t)d.operator===">"||d.operator===">="?n=xo(n,d,r):d.operator==="<"||d.operator==="<="?i=vo(i,d,r):s.add(d.semver);if(s.size>1)return null;let o;if(n&&i){if(o=Is(n.semver,i.semver,r),o>0)return null;if(o===0&&(n.operator!==">="||i.operator!=="<="))return null}for(let d of s){if(n&&!dr(d,String(n),r)||i&&!dr(d,String(i),r))return null;for(let m of e)if(!dr(d,String(m),r))return!1;return!0}let a,u,c,l,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,y=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of e){if(l=l||d.operator===">"||d.operator===">=",c=c||d.operator==="<"||d.operator==="<=",n){if(y&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===y.major&&d.semver.minor===y.minor&&d.semver.patch===y.patch&&(y=!1),d.operator===">"||d.operator===">="){if(a=xo(n,d,r),a===d&&a!==n)return!1}else if(n.operator===">="&&!dr(n.semver,String(d),r))return!1}if(i){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(u=vo(i,d,r),u===d&&u!==i)return!1}else if(i.operator==="<="&&!dr(i.semver,String(d),r))return!1}if(!d.operator&&(i||n)&&o!==0)return!1}return!(n&&c&&!i&&o!==0||i&&l&&!n&&o!==0||y||p)},xo=(t,e,r)=>{if(!t)return e;let s=Is(t.semver,e.semver,r);return s>0?t:s<0||e.operator===">"&&t.operator===">="?e:t},vo=(t,e,r)=>{if(!t)return e;let s=Is(t.semver,e.semver,r);return s<0?t:s>0||e.operator==="<"&&t.operator==="<="?e:t};bo.exports=Gf});var ks=F((Qy,So)=>{"use strict";var $s=Pt(),Fo=ir(),Zf=te(),Ro=ms(),Xf=yt(),Jf=Jn(),Kf=Qn(),Qf=ri(),ep=ii(),tp=ai(),rp=ci(),sp=di(),np=pi(),ip=xe(),op=gi(),ap=wi(),up=Lr(),cp=bi(),lp=Fi(),dp=ar(),fp=jr(),pp=ys(),hp=ws(),mp=Mr(),Dp=Br(),gp=Es(),yp=Ti(),wp=ur(),Ep=ve(),xp=lr(),vp=Zi(),bp=Ji(),Cp=Qi(),Fp=ro(),Rp=no(),Sp=Ur(),_p=lo(),Ap=po(),Ip=Do(),$p=yo(),kp=Co();So.exports={parse:Xf,valid:Jf,clean:Kf,inc:Qf,diff:ep,major:tp,minor:rp,patch:sp,prerelease:np,compare:ip,rcompare:op,compareLoose:ap,compareBuild:up,sort:cp,rsort:lp,gt:dp,lt:fp,eq:pp,neq:hp,gte:mp,lte:Dp,cmp:gp,coerce:yp,Comparator:wp,Range:Ep,satisfies:xp,toComparators:vp,maxSatisfying:bp,minSatisfying:Cp,minVersion:Fp,validRange:Rp,outside:Sp,gtr:_p,ltr:Ap,intersects:Ip,simplifyRange:$p,subset:kp,SemVer:Zf,re:$s.re,src:$s.src,tokens:$s.t,SEMVER_SPEC_VERSION:Fo.SEMVER_SPEC_VERSION,RELEASE_TYPES:Fo.RELEASE_TYPES,compareIdentifiers:Ro.compareIdentifiers,rcompareIdentifiers:Ro.rcompareIdentifiers}});var es=F((a0,Ta)=>{var on=[],Oa=0,se=(t,e)=>{Oa>=e&&on.push(t)};se.WARN=1;se.INFO=2;se.DEBUG=3;se.reset=()=>{on=[]};se.setDebugLevel=t=>{Oa=t};se.warn=t=>se(t,se.WARN);se.info=t=>se(t,se.INFO);se.debug=t=>se(t,se.DEBUG);se.debugMessages=()=>on;Ta.exports=se});var Na=F((u0,Pa)=>{"use strict";Pa.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var ja=F((c0,La)=>{"use strict";var xm=Na();La.exports=t=>typeof t=="string"?t.replace(xm(),""):t});var Ba=F((l0,an)=>{"use strict";var Ma=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);an.exports=Ma;an.exports.default=Ma});var Wa=F((d0,qa)=>{"use strict";qa.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var za=F((f0,un)=>{"use strict";var vm=ja(),bm=Ba(),Cm=Wa(),Ua=t=>{if(typeof t!="string"||t.length===0||(t=vm(t),t.length===0))return 0;t=t.replace(Cm()," ");let e=0;for(let r=0;r<t.length;r++){let s=t.codePointAt(r);s<=31||s>=127&&s<=159||s>=768&&s<=879||(s>65535&&r++,e+=bm(s)?2:1)}return e};un.exports=Ua;un.exports.default=Ua});var cn=F((p0,Ya)=>{var Va=za();function ts(t){return t?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function Ne(t){let e=ts();return(""+t).replace(e,"").split(`
|
|
3
|
+
`).reduce(function(n,i){return Va(i)>n?Va(i):n},0)}function mr(t,e){return Array(e+1).join(t)}function Fm(t,e,r,s){let n=Ne(t);if(e+1>=n){let i=e-n;switch(s){case"right":{t=mr(r,i)+t;break}case"center":{let o=Math.ceil(i/2),a=i-o;t=mr(r,a)+t+mr(r,o);break}default:{t=t+mr(r,i);break}}}return t}var Vt={};function Dr(t,e,r){e="\x1B["+e+"m",r="\x1B["+r+"m",Vt[e]={set:t,to:!0},Vt[r]={set:t,to:!1},Vt[t]={on:e,off:r}}Dr("bold",1,22);Dr("italics",3,23);Dr("underline",4,24);Dr("inverse",7,27);Dr("strikethrough",9,29);function Ga(t,e){let r=e[1]?parseInt(e[1].split(";")[0]):0;if(r>=30&&r<=39||r>=90&&r<=97){t.lastForegroundAdded=e[0];return}if(r>=40&&r<=49||r>=100&&r<=107){t.lastBackgroundAdded=e[0];return}if(r===0){for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&delete t[n];return}let s=Vt[e[0]];s&&(t[s.set]=s.to)}function Rm(t){let e=ts(!0),r=e.exec(t),s={};for(;r!==null;)Ga(s,r),r=e.exec(t);return s}function Ha(t,e){let r=t.lastBackgroundAdded,s=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(n){t[n]&&(e+=Vt[n].off)}),r&&r!="\x1B[49m"&&(e+="\x1B[49m"),s&&s!="\x1B[39m"&&(e+="\x1B[39m"),e}function Sm(t,e){let r=t.lastBackgroundAdded,s=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(n){t[n]&&(e=Vt[n].on+e)}),r&&r!="\x1B[49m"&&(e=r+e),s&&s!="\x1B[39m"&&(e=s+e),e}function _m(t,e){if(t.length===Ne(t))return t.substr(0,e);for(;Ne(t)>e;)t=t.slice(0,-1);return t}function Am(t,e){let r=ts(!0),s=t.split(ts()),n=0,i=0,o="",a,u={};for(;i<e;){a=r.exec(t);let c=s[n];if(n++,i+Ne(c)>e&&(c=_m(c,e-i)),o+=c,i+=Ne(c),i<e){if(!a)break;o+=a[0],Ga(u,a)}}return Ha(u,o)}function Im(t,e,r){if(r=r||"\u2026",Ne(t)<=e)return t;e-=Ne(r);let n=Am(t,e);n+=r;let i="\x1B]8;;\x07";return t.includes(i)&&!n.includes(i)&&(n+=i),n}function $m(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function km(t,e){t=t||{},e=e||$m();let r=Object.assign({},e,t);return r.chars=Object.assign({},e.chars,t.chars),r.style=Object.assign({},e.style,t.style),r}function Om(t,e){let r=[],s=e.split(/(\s+)/g),n=[],i=0,o;for(let a=0;a<s.length;a+=2){let u=s[a],c=i+Ne(u);i>0&&o&&(c+=o.length),c>t?(i!==0&&r.push(n.join("")),n=[u],i=Ne(u)):(n.push(o||"",u),i=c),o=s[a+1]}return i&&r.push(n.join("")),r}function Tm(t,e){let r=[],s="";function n(o,a){for(s.length&&a&&(s+=a),s+=o;s.length>t;)r.push(s.slice(0,t)),s=s.slice(t)}let i=e.split(/(\s+)/g);for(let o=0;o<i.length;o+=2)n(i[o],o&&i[o-1]);return s.length&&r.push(s),r}function Pm(t,e,r=!0){let s=[];e=e.split(`
|
|
4
|
+
`);let n=r?Om:Tm;for(let i=0;i<e.length;i++)s.push.apply(s,n(t,e[i]));return s}function Nm(t){let e={},r=[];for(let s=0;s<t.length;s++){let n=Sm(e,t[s]);e=Rm(n);let i=Object.assign({},e);r.push(Ha(i,n))}return r}function Lm(t,e){return["\x1B]","8",";",";",t||e,"\x07",e,"\x1B]","8",";",";","\x07"].join("")}Ya.exports={strlen:Ne,repeat:mr,pad:Fm,truncate:Im,mergeOptions:km,wordWrap:Pm,colorizeLines:Nm,hyperlink:Lm}});var Ka=F((h0,Ja)=>{var Xa={};Ja.exports=Xa;var Za={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(Za).forEach(function(t){var e=Za[t],r=Xa[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var eu=F((m0,Qa)=>{"use strict";Qa.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),s=/^-{1,2}/.test(t)?"":"--",n=e.indexOf(s+t);return n!==-1&&(r===-1?!0:n<r)}});var ru=F((D0,tu)=>{"use strict";var jm=bn("os"),Ie=eu(),ae=process.env,Gt=void 0;Ie("no-color")||Ie("no-colors")||Ie("color=false")?Gt=!1:(Ie("color")||Ie("colors")||Ie("color=true")||Ie("color=always"))&&(Gt=!0);"FORCE_COLOR"in ae&&(Gt=ae.FORCE_COLOR.length===0||parseInt(ae.FORCE_COLOR,10)!==0);function Mm(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Bm(t){if(Gt===!1)return 0;if(Ie("color=16m")||Ie("color=full")||Ie("color=truecolor"))return 3;if(Ie("color=256"))return 2;if(t&&!t.isTTY&&Gt!==!0)return 0;var e=Gt?1:0;if(process.platform==="win32"){var r=jm.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in ae)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(n){return n in ae})||ae.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in ae)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ae.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in ae){var s=parseInt((ae.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ae.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ae.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(ae.TERM)||"COLORTERM"in ae?1:(ae.TERM==="dumb",e)}function ln(t){var e=Bm(t);return Mm(e)}tu.exports={supportsColor:ln,stdout:ln(process.stdout),stderr:ln(process.stderr)}});var nu=F((g0,su)=>{su.exports=function(e,r){var s="";e=e||"Run the trap, drop the bass",e=e.split("");var n={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(i){i=i.toLowerCase();var o=n[i]||[" "],a=Math.floor(Math.random()*o.length);typeof n[i]<"u"?s+=n[i][a]:s+=i}),s}});var ou=F((y0,iu)=>{iu.exports=function(e,r){e=e||" he is here ";var s={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},n=[].concat(s.up,s.down,s.mid);function i(u){var c=Math.floor(Math.random()*u);return c}function o(u){var c=!1;return n.filter(function(l){c=l===u}),c}function a(u,c){var l="",p,y;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(y in u)if(!o(y)){switch(l=l+u[y],p={up:0,down:0,mid:0},c.size){case"mini":p.up=i(8),p.mid=i(2),p.down=i(8);break;case"maxi":p.up=i(16)+3,p.mid=i(4)+1,p.down=i(64)+3;break;default:p.up=i(8)+1,p.mid=i(6)/2,p.down=i(8)+1;break}var d=["up","mid","down"];for(var m in d)for(var w=d[m],x=0;x<=p[w];x++)c[w]&&(l=l+s[w][i(s[w].length)])}return l}return a(e,r)}});var uu=F((w0,au)=>{au.exports=function(t){return function(e,r,s){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var lu=F((E0,cu)=>{cu.exports=function(t){return function(e,r,s){return r%2===0?e:t.inverse(e)}}});var fu=F((x0,du)=>{du.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,s,n){return r===" "?r:t[e[s++%e.length]](r)}}});var hu=F((v0,pu)=>{pu.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,s,n){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var Eu=F((C0,wu)=>{var L={};wu.exports=L;L.themes={};var qm=bn("util"),Ct=L.styles=Ka(),Du=Object.defineProperties,Wm=new RegExp(/[\r\n]+/g);L.supportsColor=ru().supportsColor;typeof L.enabled>"u"&&(L.enabled=L.supportsColor()!==!1);L.enable=function(){L.enabled=!0};L.disable=function(){L.enabled=!1};L.stripColors=L.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var b0=L.stylize=function(e,r){if(!L.enabled)return e+"";var s=Ct[r];return!s&&r in L?L[r](e):s.open+e+s.close},Um=/[|\\{}()[\]^$+*?.]/g,zm=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(Um,"\\$&")};function gu(t){var e=function r(){return Gm.apply(r,arguments)};return e._styles=t,e.__proto__=Vm,e}var yu=(function(){var t={};return Ct.grey=Ct.gray,Object.keys(Ct).forEach(function(e){Ct[e].closeRe=new RegExp(zm(Ct[e].close),"g"),t[e]={get:function(){return gu(this._styles.concat(e))}}}),t})(),Vm=Du(function(){},yu);function Gm(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:qm.inspect(o)}).join(" ");if(!L.enabled||!e)return e;for(var r=e.indexOf(`
|
|
5
|
+
`)!=-1,s=this._styles,n=s.length;n--;){var i=Ct[s[n]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(Wm,function(o){return i.close+o+i.open}))}return e}L.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){L[r]=function(s){if(typeof t[r]=="object"){var n=s;for(var i in t[r])n=L[t[r][i]](n);return n}return L[t[r]](s)}})(e)};function Hm(){var t={};return Object.keys(yu).forEach(function(e){t[e]={get:function(){return gu([e])}}}),t}var Ym=function(e,r){var s=r.split("");return s=s.map(e),s.join("")};L.trap=nu();L.zalgo=ou();L.maps={};L.maps.america=uu()(L);L.maps.zebra=lu()(L);L.maps.rainbow=fu()(L);L.maps.random=hu()(L);for(mu in L.maps)(function(t){L[t]=function(e){return Ym(L.maps[t],e)}})(mu);var mu;Du(L,Hm())});var vu=F((F0,xu)=>{var Zm=Eu();xu.exports=Zm});var Ru=F((R0,rs)=>{var{info:Xm,debug:Fu}=es(),De=cn(),fn=class t{constructor(e){this.setOptions(e),this.x=null,this.y=null}setOptions(e){["boolean","number","bigint","string"].indexOf(typeof e)!==-1&&(e={content:""+e}),e=e||{},this.options=e;let r=e.content;if(["boolean","number","bigint","string"].indexOf(typeof r)!==-1)this.content=String(r);else if(!r)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof r);this.colSpan=e.colSpan||1,this.rowSpan=e.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(e,r){this.cells=r;let s=this.options.chars||{},n=e.chars,i=this.chars={};Km.forEach(function(u){dn(s,n,u,i)}),this.truncate=this.options.truncate||e.truncate;let o=this.options.style=this.options.style||{},a=e.style;dn(o,a,"padding-left",this),dn(o,a,"padding-right",this),this.head=o.head||a.head,this.border=o.border||a.border,this.fixedWidth=e.colWidths[this.x],this.lines=this.computeLines(e),this.desiredWidth=De.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(e){let r=e.wordWrap||e.textWrap,{wordWrap:s=r}=this.options;if(this.fixedWidth&&s){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let o=1;for(;o<this.colSpan;)this.fixedWidth+=e.colWidths[this.x+o],o++}let{wrapOnWordBoundary:n=!0}=e,{wrapOnWordBoundary:i=n}=this.options;return this.wrapLines(De.wordWrap(this.fixedWidth,this.content,i))}return this.wrapLines(this.content.split(`
|
|
6
|
+
`))}wrapLines(e){let r=De.colorizeLines(e);return this.href?r.map(s=>De.hyperlink(this.href,s)):r}init(e){let r=this.x,s=this.y;this.widths=e.colWidths.slice(r,r+this.colSpan),this.heights=e.rowHeights.slice(s,s+this.rowSpan),this.width=this.widths.reduce(Cu,-1),this.height=this.heights.reduce(Cu,-1),this.hAlign=this.options.hAlign||e.colAligns[r],this.vAlign=this.options.vAlign||e.rowAligns[s],this.drawRight=r+this.colSpan==e.colWidths.length}draw(e,r){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let s=De.truncate(this.content,10,this.truncate);e||Xm(`${this.y}-${this.x}: ${this.rowSpan-e}x${this.colSpan} Cell ${s}`);let n=Math.max(this.height-this.lines.length,0),i;switch(this.vAlign){case"center":i=Math.ceil(n/2);break;case"bottom":i=n;break;default:i=0}if(e<i||e>=i+this.lines.length)return this.drawEmpty(this.drawRight,r);let o=this.lines.length>this.height&&e+1>=this.height;return this.drawLine(e-i,this.drawRight,o,r)}drawTop(e){let r=[];return this.cells?this.widths.forEach(function(s,n){r.push(this._topLeftChar(n)),r.push(De.repeat(this.chars[this.y==0?"top":"mid"],s))},this):(r.push(this._topLeftChar(0)),r.push(De.repeat(this.chars[this.y==0?"top":"mid"],this.width))),e&&r.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",r.join(""))}_topLeftChar(e){let r=this.x+e,s;if(this.y==0)s=r==0?"topLeft":e==0?"topMid":"top";else if(r==0)s="leftMid";else if(s=e==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][r]instanceof t.ColSpanCell&&(s=e==0?"topMid":"mid"),e==0)){let i=1;for(;this.cells[this.y][r-i]instanceof t.ColSpanCell;)i++;this.cells[this.y][r-i]instanceof t.RowSpanCell&&(s="leftMid")}return this.chars[s]}wrapWithStyleColors(e,r){if(this[e]&&this[e].length)try{let s=vu();for(let n=this[e].length-1;n>=0;n--)s=s[this[e][n]];return s(r)}catch{return r}else return r}drawLine(e,r,s,n){let i=this.chars[this.x==0?"left":"middle"];if(this.x&&n&&this.cells){let y=this.cells[this.y+n][this.x-1];for(;y instanceof gr;)y=this.cells[y.y][y.x-1];y instanceof yr||(i=this.chars.rightMid)}let o=De.repeat(" ",this.paddingLeft),a=r?this.chars.right:"",u=De.repeat(" ",this.paddingRight),c=this.lines[e],l=this.width-(this.paddingLeft+this.paddingRight);s&&(c+=this.truncate||"\u2026");let p=De.truncate(c,l,this.truncate);return p=De.pad(p,l," ",this.hAlign),p=o+p+u,this.stylizeLine(i,p,a)}stylizeLine(e,r,s){return e=this.wrapWithStyleColors("border",e),s=this.wrapWithStyleColors("border",s),this.y===0&&(r=this.wrapWithStyleColors("head",r)),e+r+s}drawBottom(e){let r=this.chars[this.x==0?"bottomLeft":"bottomMid"],s=De.repeat(this.chars.bottom,this.width),n=e?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",r+s+n)}drawEmpty(e,r){let s=this.chars[this.x==0?"left":"middle"];if(this.x&&r&&this.cells){let o=this.cells[this.y+r][this.x-1];for(;o instanceof gr;)o=this.cells[o.y][o.x-1];o instanceof yr||(s=this.chars.rightMid)}let n=e?this.chars.right:"",i=De.repeat(" ",this.width);return this.stylizeLine(s,i,n)}},gr=class{constructor(){}draw(e){return typeof e=="number"&&Fu(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}},yr=class{constructor(e){this.originalCell=e}init(e){let r=this.y,s=this.originalCell.y;this.cellOffset=r-s,this.offset=Jm(e.rowHeights,s,this.cellOffset)}draw(e){return e=="top"?this.originalCell.draw(this.offset,this.cellOffset):e=="bottom"?this.originalCell.draw("bottom"):(Fu(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+e))}mergeTableOptions(){}};function bu(...t){return t.filter(e=>e!=null).shift()}function dn(t,e,r,s){let n=r.split("-");n.length>1?(n[1]=n[1].charAt(0).toUpperCase()+n[1].substr(1),n=n.join(""),s[n]=bu(t[n],t[r],e[n],e[r])):s[r]=bu(t[r],e[r])}function Jm(t,e,r){let s=t[e];for(let n=1;n<r;n++)s+=1+t[e+n];return s}function Cu(t,e){return t+e+1}var Km=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];rs.exports=fn;rs.exports.ColSpanCell=gr;rs.exports.RowSpanCell=yr});var Au=F((S0,_u)=>{var{warn:Qm,debug:eD}=es(),pn=Ru(),{ColSpanCell:tD,RowSpanCell:rD}=pn;(function(){function t(d,m){return d[m]>0?t(d,m+1):m}function e(d){let m={};d.forEach(function(w,x){let S=0;w.forEach(function(I){I.y=x,I.x=x?t(m,S):S;let M=I.rowSpan||1,U=I.colSpan||1;if(M>1)for(let z=0;z<U;z++)m[I.x+z]=M;S=I.x+U}),Object.keys(m).forEach(I=>{m[I]--,m[I]<1&&delete m[I]})})}function r(d){let m=0;return d.forEach(function(w){w.forEach(function(x){m=Math.max(m,x.x+(x.colSpan||1))})}),m}function s(d){return d.length}function n(d,m){let w=d.y,x=d.y-1+(d.rowSpan||1),S=m.y,I=m.y-1+(m.rowSpan||1),M=!(w>I||S>x),U=d.x,z=d.x-1+(d.colSpan||1),Ue=m.x,de=m.x-1+(m.colSpan||1),j=!(U>de||Ue>z);return M&&j}function i(d,m,w){let x=Math.min(d.length-1,w),S={x:m,y:w};for(let I=0;I<=x;I++){let M=d[I];for(let U=0;U<M.length;U++)if(n(S,M[U]))return!0}return!1}function o(d,m,w,x){for(let S=w;S<x;S++)if(i(d,S,m))return!1;return!0}function a(d){d.forEach(function(m,w){m.forEach(function(x){for(let S=1;S<x.rowSpan;S++){let I=new rD(x);I.x=x.x,I.y=x.y+S,I.colSpan=x.colSpan,c(I,d[w+S])}})})}function u(d){for(let m=d.length-1;m>=0;m--){let w=d[m];for(let x=0;x<w.length;x++){let S=w[x];for(let I=1;I<S.colSpan;I++){let M=new tD;M.x=S.x+I,M.y=S.y,w.splice(x+1,0,M)}}}}function c(d,m){let w=0;for(;w<m.length&&m[w].x<d.x;)w++;m.splice(w,0,d)}function l(d){let m=s(d),w=r(d);eD(`Max rows: ${m}; Max cols: ${w}`);for(let x=0;x<m;x++)for(let S=0;S<w;S++)if(!i(d,S,x)){let I={x:S,y:x,colSpan:1,rowSpan:1};for(S++;S<w&&!i(d,S,x);)I.colSpan++,S++;let M=x+1;for(;M<m&&o(d,M,I.x,I.x+I.colSpan);)I.rowSpan++,M++;let U=new pn(I);U.x=I.x,U.y=I.y,Qm(`Missing cell at ${U.y}-${U.x}.`),c(U,d[x])}}function p(d){return d.map(function(m){if(!Array.isArray(m)){let w=Object.keys(m)[0];m=m[w],Array.isArray(m)?(m=m.slice(),m.unshift(w)):m=[w,m]}return m.map(function(w){return new pn(w)})})}function y(d){let m=p(d);return e(m),l(m),a(m),u(m),m}_u.exports={makeTableLayout:y,layoutTable:e,addRowSpanCells:a,maxWidth:r,fillInTable:l,computeWidths:Su("colSpan","desiredWidth","x",1),computeHeights:Su("rowSpan","desiredHeight","y",1)}})();function Su(t,e,r,s){return function(n,i){let o=[],a=[],u={};i.forEach(function(c){c.forEach(function(l){(l[t]||1)>1?a.push(l):o[l[r]]=Math.max(o[l[r]]||0,l[e]||0,s)})}),n.forEach(function(c,l){typeof c=="number"&&(o[l]=c)});for(let c=a.length-1;c>=0;c--){let l=a[c],p=l[t],y=l[r],d=o[y],m=typeof n[y]=="number"?0:1;if(typeof d=="number")for(let w=1;w<p;w++)d+=1+o[y+w],typeof n[y+w]!="number"&&m++;else d=e==="desiredWidth"?l.desiredWidth-1:1,(!u[y]||u[y]<d)&&(u[y]=d);if(l[e]>d){let w=0;for(;m>0&&l[e]>d;){if(typeof n[y+w]!="number"){let x=Math.round((l[e]-d)/m);d+=x,o[y+w]+=x,m--}w++}}}Object.assign(n,o,u);for(let c=0;c<n.length;c++)n[c]=Math.max(s,n[c]||0)}}});var $u=F((_0,Iu)=>{var We=es(),sD=cn(),hn=Au(),ss=class extends Array{constructor(e){super();let r=sD.mergeOptions(e);if(Object.defineProperty(this,"options",{value:r,enumerable:r.debug}),r.debug){switch(typeof r.debug){case"boolean":We.setDebugLevel(We.WARN);break;case"number":We.setDebugLevel(r.debug);break;case"string":We.setDebugLevel(parseInt(r.debug,10));break;default:We.setDebugLevel(We.WARN),We.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof r.debug}`)}Object.defineProperty(this,"messages",{get(){return We.debugMessages()}})}}toString(){let e=this,r=this.options.head&&this.options.head.length;r?(e=[this.options.head],this.length&&e.push.apply(e,this)):this.options.style.head=[];let s=hn.makeTableLayout(e);s.forEach(function(i){i.forEach(function(o){o.mergeTableOptions(this.options,s)},this)},this),hn.computeWidths(this.options.colWidths,s),hn.computeHeights(this.options.rowHeights,s),s.forEach(function(i){i.forEach(function(o){o.init(this.options)},this)},this);let n=[];for(let i=0;i<s.length;i++){let o=s[i],a=this.options.rowHeights[i];(i===0||!this.options.style.compact||i==1&&r)&&mn(o,"top",n);for(let u=0;u<a;u++)mn(o,u,n);i+1==s.length&&mn(o,"bottom",n)}return n.join(`
|
|
7
|
+
`)}get width(){return this.toString().split(`
|
|
8
|
+
`)[0].length}};ss.reset=()=>We.reset();function mn(t,e,r){let s=[];t.forEach(function(i){s.push(i.draw(e))});let n=s.join("");n.length&&r.push(n)}Iu.exports=ss});var wr=F((A0,ku)=>{ku.exports=$u()});import{command as Re,subcommands as MD,run as BD,positional as Kt,option as ac,string as Qe,optional as os,flag as vn}from"cmd-ts";import{writeFile as qp,mkdir as Wp,rm as Up}from"node:fs/promises";import zp from"ora";import{access as Op,constants as Tp,readFile as Os}from"node:fs/promises";import{join as wt}from"node:path";import{homedir as Pp}from"node:os";import{select as Np}from"@inquirer/prompts";import Rt from"chalk";var D={SUCCESS:0,VALIDATION_ERROR:1,IO_ERROR:2,DEPENDENCY_ERROR:3,AUTHENTICATION_ERROR:4,USER_CANCELLED:130},h=class t extends Error{constructor(r,s){super(r);this.exitCode=s;this.name="CLIError",Error.captureStackTrace(this,t)}};function us(t,e){let r=Rt.red("Error:"),s=e?` ${Rt.yellow(e)} failed:`:"";return`${r}${s} ${t.message}`}function er(t){return`${Rt.yellow("Warning:")} ${t}`}function J(t){return Rt.dim(t)}function R(t){return Rt.cyan(t)}function B(t){return Rt.cyan.bold(t)}function Cn(t){return t instanceof h?t.exitCode:D.VALIDATION_ERROR}import{promises as Ze}from"node:fs";import Xe from"node:path";import nr from"fs-extra";var f={};pc(f,{BRAND:()=>Bc,DIRTY:()=>et,EMPTY_PATH:()=>yc,INVALID:()=>$,NEVER:()=>Cl,OK:()=>ee,ParseStatus:()=>K,Schema:()=>P,ZodAny:()=>He,ZodArray:()=>Be,ZodBigInt:()=>rt,ZodBoolean:()=>st,ZodBranded:()=>rr,ZodCatch:()=>ht,ZodDate:()=>nt,ZodDefault:()=>pt,ZodDiscriminatedUnion:()=>br,ZodEffects:()=>Ee,ZodEnum:()=>dt,ZodError:()=>ue,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>Fr,ZodIntersection:()=>ut,ZodIssueCode:()=>g,ZodLazy:()=>ct,ZodLiteral:()=>lt,ZodMap:()=>kt,ZodNaN:()=>Tt,ZodNativeEnum:()=>ft,ZodNever:()=>Se,ZodNull:()=>ot,ZodNullable:()=>Te,ZodNumber:()=>tt,ZodObject:()=>ce,ZodOptional:()=>ye,ZodParsedType:()=>v,ZodPipeline:()=>sr,ZodPromise:()=>Ye,ZodReadonly:()=>mt,ZodRecord:()=>Cr,ZodSchema:()=>P,ZodSet:()=>Ot,ZodString:()=>Ge,ZodSymbol:()=>It,ZodTransformer:()=>Ee,ZodTuple:()=>Oe,ZodType:()=>P,ZodUndefined:()=>it,ZodUnion:()=>at,ZodUnknown:()=>Me,ZodVoid:()=>$t,addIssueToContext:()=>E,any:()=>Zc,array:()=>Qc,bigint:()=>zc,boolean:()=>Pn,coerce:()=>bl,custom:()=>kn,date:()=>Vc,datetimeRegex:()=>In,defaultErrorMap:()=>Le,discriminatedUnion:()=>sl,effect:()=>ml,enum:()=>fl,function:()=>cl,getErrorMap:()=>St,getParsedType:()=>ke,instanceof:()=>Wc,intersection:()=>nl,isAborted:()=>xr,isAsync:()=>_t,isDirty:()=>vr,isValid:()=>Ve,late:()=>qc,lazy:()=>ll,literal:()=>dl,makeIssue:()=>tr,map:()=>al,nan:()=>Uc,nativeEnum:()=>pl,never:()=>Jc,null:()=>Yc,nullable:()=>gl,number:()=>Tn,object:()=>el,objectUtil:()=>cs,oboolean:()=>vl,onumber:()=>xl,optional:()=>Dl,ostring:()=>El,pipeline:()=>wl,preprocess:()=>yl,promise:()=>hl,quotelessJson:()=>mc,record:()=>ol,set:()=>ul,setErrorMap:()=>gc,strictObject:()=>tl,string:()=>On,symbol:()=>Gc,transformer:()=>ml,tuple:()=>il,undefined:()=>Hc,union:()=>rl,unknown:()=>Xc,util:()=>N,void:()=>Kc});var N;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let i={};for(let o of n)i[o]=o;return i},t.getValidEnumValues=n=>{let i=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),o={};for(let a of i)o[a]=n[a];return t.objectValues(o)},t.objectValues=n=>t.objectKeys(n).map(function(i){return n[i]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push(o);return i},t.find=(n,i)=>{for(let o of n)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,i=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=s,t.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(N||(N={}));var cs;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(cs||(cs={}));var v=N.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ke=t=>{switch(typeof t){case"undefined":return v.undefined;case"string":return v.string;case"number":return Number.isNaN(t)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(t)?v.array:t===null?v.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?v.promise:typeof Map<"u"&&t instanceof Map?v.map:typeof Set<"u"&&t instanceof Set?v.set:typeof Date<"u"&&t instanceof Date?v.date:v.object;default:return v.unknown}};var g=N.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),mc=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ue=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},s={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(r(o));else{let a=s,u=0;for(;u<o.path.length;){let c=o.path[u];u===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(o))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return n(this),s}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},s=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}};ue.create=t=>new ue(t);var Dc=(t,e)=>{let r;switch(t.code){case g.invalid_type:t.received===v.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case g.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,N.jsonStringifyReplacer)}`;break;case g.unrecognized_keys:r=`Unrecognized key(s) in object: ${N.joinValues(t.keys,", ")}`;break;case g.invalid_union:r="Invalid input";break;case g.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${N.joinValues(t.options)}`;break;case g.invalid_enum_value:r=`Invalid enum value. Expected ${N.joinValues(t.options)}, received '${t.received}'`;break;case g.invalid_arguments:r="Invalid function arguments";break;case g.invalid_return_type:r="Invalid function return type";break;case g.invalid_date:r="Invalid date";break;case g.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:N.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case g.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case g.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case g.custom:r="Invalid input";break;case g.invalid_intersection_types:r="Intersection results could not be merged";break;case g.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case g.not_finite:r="Number must be finite";break;default:r=e.defaultError,N.assertNever(t)}return{message:r}},Le=Dc;var Fn=Le;function gc(t){Fn=t}function St(){return Fn}var tr=t=>{let{data:e,path:r,errorMaps:s,issueData:n}=t,i=[...r,...n.path||[]],o={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let a="",u=s.filter(c=>!!c).slice().reverse();for(let c of u)a=c(o,{data:e,defaultError:a}).message;return{...n,path:i,message:a}},yc=[];function E(t,e){let r=St(),s=tr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Le?void 0:Le].filter(n=>!!n)});t.common.issues.push(s)}var K=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let s=[];for(let n of r){if(n.status==="aborted")return $;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){let s=[];for(let n of r){let i=await n.key,o=await n.value;s.push({key:i,value:o})}return t.mergeObjectSync(e,s)}static mergeObjectSync(e,r){let s={};for(let n of r){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return $;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[i.value]=o.value)}return{status:e.value,value:s}}},$=Object.freeze({status:"aborted"}),et=t=>({status:"dirty",value:t}),ee=t=>({status:"valid",value:t}),xr=t=>t.status==="aborted",vr=t=>t.status==="dirty",Ve=t=>t.status==="valid",_t=t=>typeof Promise<"u"&&t instanceof Promise;var _;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(_||(_={}));var we=class{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Rn=(t,e)=>{if(Ve(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ue(t.common.issues);return this._error=r,this._error}}};function T(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,a)=>{let{message:u}=t;return o.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??s??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:u??r??a.defaultError}},description:n}}var P=class{get description(){return this._def.description}_getType(e){return ke(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ke(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new K,ctx:{common:e.parent.common,data:e.data,parsedType:ke(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(_t(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){let s={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ke(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Rn(s,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ke(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:r});return Ve(s)?{value:s.value}:{issues:r.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>Ve(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,r){let s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){let s={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ke(e)},n=this._parse({data:e,path:s.path,parent:s}),i=await(_t(n)?n:Promise.resolve(n));return Rn(s,i)}refine(e,r){let s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let o=e(n),a=()=>i.addIssue({code:g.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!1))}_refinement(e){return new Ee({schema:this,typeName:k.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ye.create(this,this._def)}nullable(){return Te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Be.create(this)}promise(){return Ye.create(this,this._def)}or(e){return at.create([this,e],this._def)}and(e){return ut.create(this,e,this._def)}transform(e){return new Ee({...T(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new pt({...T(this._def),innerType:this,defaultValue:r,typeName:k.ZodDefault})}brand(){return new rr({typeName:k.ZodBranded,type:this,...T(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ht({...T(this._def),innerType:this,catchValue:r,typeName:k.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return sr.create(this,e)}readonly(){return mt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},wc=/^c[^\s-]{8,}$/i,Ec=/^[0-9a-z]+$/,xc=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vc=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,bc=/^[a-z0-9_-]{21}$/i,Cc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Fc=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Sc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ls,_c=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ac=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ic=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$c=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Oc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_n="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Tc=new RegExp(`^${_n}$`);function An(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Pc(t){return new RegExp(`^${An(t)}$`)}function In(t){let e=`${_n}T${An(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Nc(t,e){return!!((e==="v4"||!e)&&_c.test(t)||(e==="v6"||!e)&&Ic.test(t))}function Lc(t,e){if(!Cc.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function jc(t,e){return!!((e==="v4"||!e)&&Ac.test(t)||(e==="v6"||!e)&&$c.test(t))}var Ge=class t extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==v.string){let i=this._getOrReturnCtx(e);return E(i,{code:g.invalid_type,expected:v.string,received:i.parsedType}),$}let s=new K,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:g.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:g.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(n=this._getOrReturnCtx(e,n),o?E(n,{code:g.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&E(n,{code:g.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")Rc.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"email",code:g.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")ls||(ls=new RegExp(Sc,"u")),ls.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"emoji",code:g.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")vc.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"uuid",code:g.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")bc.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"nanoid",code:g.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")wc.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"cuid",code:g.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")Ec.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"cuid2",code:g.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")xc.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"ulid",code:g.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),E(n,{validation:"url",code:g.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"regex",code:g.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),E(n,{code:g.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),E(n,{code:g.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),E(n,{code:g.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?In(i).test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:g.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?Tc.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:g.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?Pc(i).test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:g.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?Fc.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"duration",code:g.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?Nc(e.data,i.version)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"ip",code:g.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?Lc(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"jwt",code:g.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?jc(e.data,i.version)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"cidr",code:g.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?kc.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"base64",code:g.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?Oc.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"base64url",code:g.invalid_string,message:i.message}),s.dirty()):N.assertNever(i);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:g.invalid_string,..._.errToObj(s)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,..._.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,..._.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,..._.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._.errToObj(r)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Ge.create=t=>new Ge({checks:[],typeName:k.ZodString,coerce:t?.coerce??!1,...T(t)});function Mc(t,e){let r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,i=Number.parseInt(t.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return i%o/10**n}var tt=class t extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==v.number){let i=this._getOrReturnCtx(e);return E(i,{code:g.invalid_type,expected:v.number,received:i.parsedType}),$}let s,n=new K;for(let i of this._def.checks)i.kind==="int"?N.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{code:g.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:g.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:g.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Mc(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),E(s,{code:g.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{code:g.not_finite,message:i.message}),n.dirty()):N.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,_.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:_.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&N.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}};tt.create=t=>new tt({checks:[],typeName:k.ZodNumber,coerce:t?.coerce||!1,...T(t)});var rt=class t extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==v.bigint)return this._getInvalidInput(e);let s,n=new K;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:g.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:g.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),E(s,{code:g.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):N.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return E(r,{code:g.invalid_type,expected:v.bigint,received:r.parsedType}),$}gte(e,r){return this.setLimit("min",e,!0,_.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:_.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};rt.create=t=>new rt({checks:[],typeName:k.ZodBigInt,coerce:t?.coerce??!1,...T(t)});var st=class extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){let s=this._getOrReturnCtx(e);return E(s,{code:g.invalid_type,expected:v.boolean,received:s.parsedType}),$}return ee(e.data)}};st.create=t=>new st({typeName:k.ZodBoolean,coerce:t?.coerce||!1,...T(t)});var nt=class t extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==v.date){let i=this._getOrReturnCtx(e);return E(i,{code:g.invalid_type,expected:v.date,received:i.parsedType}),$}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return E(i,{code:g.invalid_date}),$}let s=new K,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:g.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:g.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):N.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};nt.create=t=>new nt({checks:[],coerce:t?.coerce||!1,typeName:k.ZodDate,...T(t)});var It=class extends P{_parse(e){if(this._getType(e)!==v.symbol){let s=this._getOrReturnCtx(e);return E(s,{code:g.invalid_type,expected:v.symbol,received:s.parsedType}),$}return ee(e.data)}};It.create=t=>new It({typeName:k.ZodSymbol,...T(t)});var it=class extends P{_parse(e){if(this._getType(e)!==v.undefined){let s=this._getOrReturnCtx(e);return E(s,{code:g.invalid_type,expected:v.undefined,received:s.parsedType}),$}return ee(e.data)}};it.create=t=>new it({typeName:k.ZodUndefined,...T(t)});var ot=class extends P{_parse(e){if(this._getType(e)!==v.null){let s=this._getOrReturnCtx(e);return E(s,{code:g.invalid_type,expected:v.null,received:s.parsedType}),$}return ee(e.data)}};ot.create=t=>new ot({typeName:k.ZodNull,...T(t)});var He=class extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};He.create=t=>new He({typeName:k.ZodAny,...T(t)});var Me=class extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};Me.create=t=>new Me({typeName:k.ZodUnknown,...T(t)});var Se=class extends P{_parse(e){let r=this._getOrReturnCtx(e);return E(r,{code:g.invalid_type,expected:v.never,received:r.parsedType}),$}};Se.create=t=>new Se({typeName:k.ZodNever,...T(t)});var $t=class extends P{_parse(e){if(this._getType(e)!==v.undefined){let s=this._getOrReturnCtx(e);return E(s,{code:g.invalid_type,expected:v.void,received:s.parsedType}),$}return ee(e.data)}};$t.create=t=>new $t({typeName:k.ZodVoid,...T(t)});var Be=class t extends P{_parse(e){let{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==v.array)return E(r,{code:g.invalid_type,expected:v.array,received:r.parsedType}),$;if(n.exactLength!==null){let o=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(o||a)&&(E(r,{code:o?g.too_big:g.too_small,minimum:a?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(E(r,{code:g.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(E(r,{code:g.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>n.type._parseAsync(new we(r,o,r.path,a)))).then(o=>K.mergeArray(s,o));let i=[...r.data].map((o,a)=>n.type._parseSync(new we(r,o,r.path,a)));return K.mergeArray(s,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:_.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:_.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:_.toString(r)}})}nonempty(e){return this.min(1,e)}};Be.create=(t,e)=>new Be({type:t,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...T(e)});function At(t){if(t instanceof ce){let e={};for(let r in t.shape){let s=t.shape[r];e[r]=ye.create(At(s))}return new ce({...t._def,shape:()=>e})}else return t instanceof Be?new Be({...t._def,type:At(t.element)}):t instanceof ye?ye.create(At(t.unwrap())):t instanceof Te?Te.create(At(t.unwrap())):t instanceof Oe?Oe.create(t.items.map(e=>At(e))):t}var ce=class t extends P{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=N.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==v.object){let c=this._getOrReturnCtx(e);return E(c,{code:g.invalid_type,expected:v.object,received:c.parsedType}),$}let{status:s,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Se&&this._def.unknownKeys==="strip"))for(let c in n.data)o.includes(c)||a.push(c);let u=[];for(let c of o){let l=i[c],p=n.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new we(n,p,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Se){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of a)u.push({key:{status:"valid",value:l},value:{status:"valid",value:n.data[l]}});else if(c==="strict")a.length>0&&(E(n,{code:g.unrecognized_keys,keys:a}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of a){let p=n.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new we(n,p,n.path,l)),alwaysSet:l in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let l of u){let p=await l.key,y=await l.value;c.push({key:p,value:y,alwaysSet:l.alwaysSet})}return c}).then(c=>K.mergeObjectSync(s,c)):K.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{let n=this._def.errorMap?.(r,s).message??s.defaultError;return r.code==="unrecognized_keys"?{message:_.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let s of N.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let s of N.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}deepPartial(){return At(this)}partial(e){let r={};for(let s of N.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let s of N.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof ye;)i=i._def.innerType;r[s]=i}return new t({...this._def,shape:()=>r})}keyof(){return $n(N.objectKeys(this.shape))}};ce.create=(t,e)=>new ce({shape:()=>t,unknownKeys:"strip",catchall:Se.create(),typeName:k.ZodObject,...T(e)});ce.strictCreate=(t,e)=>new ce({shape:()=>t,unknownKeys:"strict",catchall:Se.create(),typeName:k.ZodObject,...T(e)});ce.lazycreate=(t,e)=>new ce({shape:t,unknownKeys:"strip",catchall:Se.create(),typeName:k.ZodObject,...T(e)});var at=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new ue(a.ctx.common.issues));return E(r,{code:g.invalid_union,unionErrors:o}),$}if(r.common.async)return Promise.all(s.map(async i=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let u of s){let c={...r,common:{...r.common,issues:[]},parent:null},l=u._parseSync({data:r.data,path:r.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(u=>new ue(u));return E(r,{code:g.invalid_union,unionErrors:a}),$}}get options(){return this._def.options}};at.create=(t,e)=>new at({options:t,typeName:k.ZodUnion,...T(e)});var je=t=>t instanceof ct?je(t.schema):t instanceof Ee?je(t.innerType()):t instanceof lt?[t.value]:t instanceof dt?t.options:t instanceof ft?N.objectValues(t.enum):t instanceof pt?je(t._def.innerType):t instanceof it?[void 0]:t instanceof ot?[null]:t instanceof ye?[void 0,...je(t.unwrap())]:t instanceof Te?[null,...je(t.unwrap())]:t instanceof rr||t instanceof mt?je(t.unwrap()):t instanceof ht?je(t._def.innerType):[],br=class t extends P{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==v.object)return E(r,{code:g.invalid_type,expected:v.object,received:r.parsedType}),$;let s=this.discriminator,n=r.data[s],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(E(r,{code:g.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),$)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){let n=new Map;for(let i of r){let o=je(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,i)}}return new t({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...T(s)})}};function ds(t,e){let r=ke(t),s=ke(e);if(t===e)return{valid:!0,data:t};if(r===v.object&&s===v.object){let n=N.objectKeys(e),i=N.objectKeys(t).filter(a=>n.indexOf(a)!==-1),o={...t,...e};for(let a of i){let u=ds(t[a],e[a]);if(!u.valid)return{valid:!1};o[a]=u.data}return{valid:!0,data:o}}else if(r===v.array&&s===v.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let o=t[i],a=e[i],u=ds(o,a);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return r===v.date&&s===v.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ut=class extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=(i,o)=>{if(xr(i)||xr(o))return $;let a=ds(i.value,o.value);return a.valid?((vr(i)||vr(o))&&r.dirty(),{status:r.value,value:a.data}):(E(s,{code:g.invalid_intersection_types}),$)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ut.create=(t,e,r)=>new ut({left:t,right:e,typeName:k.ZodIntersection,...T(r)});var Oe=class t extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.array)return E(s,{code:g.invalid_type,expected:v.array,received:s.parsedType}),$;if(s.data.length<this._def.items.length)return E(s,{code:g.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$;!this._def.rest&&s.data.length>this._def.items.length&&(E(s,{code:g.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...s.data].map((o,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new we(s,o,s.path,a)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>K.mergeArray(r,o)):K.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Oe.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Oe({items:t,typeName:k.ZodTuple,rest:null,...T(e)})};var Cr=class t extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.object)return E(s,{code:g.invalid_type,expected:v.object,received:s.parsedType}),$;let n=[],i=this._def.keyType,o=this._def.valueType;for(let a in s.data)n.push({key:i._parse(new we(s,a,s.path,a)),value:o._parse(new we(s,s.data[a],s.path,a)),alwaysSet:a in s.data});return s.common.async?K.mergeObjectAsync(r,n):K.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof P?new t({keyType:e,valueType:r,typeName:k.ZodRecord,...T(s)}):new t({keyType:Ge.create(),valueType:e,typeName:k.ZodRecord,...T(r)})}},kt=class extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.map)return E(s,{code:g.invalid_type,expected:v.map,received:s.parsedType}),$;let n=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([a,u],c)=>({key:n._parse(new we(s,a,s.path,[c,"key"])),value:i._parse(new we(s,u,s.path,[c,"value"]))}));if(s.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of o){let c=await u.key,l=await u.value;if(c.status==="aborted"||l.status==="aborted")return $;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(c.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let u of o){let c=u.key,l=u.value;if(c.status==="aborted"||l.status==="aborted")return $;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(c.value,l.value)}return{status:r.value,value:a}}}};kt.create=(t,e,r)=>new kt({valueType:e,keyType:t,typeName:k.ZodMap,...T(r)});var Ot=class t extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.set)return E(s,{code:g.invalid_type,expected:v.set,received:s.parsedType}),$;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(E(s,{code:g.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(E(s,{code:g.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function o(u){let c=new Set;for(let l of u){if(l.status==="aborted")return $;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}let a=[...s.data.values()].map((u,c)=>i._parse(new we(s,u,s.path,c)));return s.common.async?Promise.all(a).then(u=>o(u)):o(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:_.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:_.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Ot.create=(t,e)=>new Ot({valueType:t,minSize:null,maxSize:null,typeName:k.ZodSet,...T(e)});var Fr=class t extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==v.function)return E(r,{code:g.invalid_type,expected:v.function,received:r.parsedType}),$;function s(a,u){return tr({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,St(),Le].filter(c=>!!c),issueData:{code:g.invalid_arguments,argumentsError:u}})}function n(a,u){return tr({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,St(),Le].filter(c=>!!c),issueData:{code:g.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Ye){let a=this;return ee(async function(...u){let c=new ue([]),l=await a._def.args.parseAsync(u,i).catch(d=>{throw c.addIssue(s(u,d)),c}),p=await Reflect.apply(o,this,l);return await a._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(n(p,d)),c})})}else{let a=this;return ee(function(...u){let c=a._def.args.safeParse(u,i);if(!c.success)throw new ue([s(u,c.error)]);let l=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(l,i);if(!p.success)throw new ue([n(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Oe.create(e).rest(Me.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,s){return new t({args:e||Oe.create([]).rest(Me.create()),returns:r||Me.create(),typeName:k.ZodFunction,...T(s)})}},ct=class extends P{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ct.create=(t,e)=>new ct({getter:t,typeName:k.ZodLazy,...T(e)});var lt=class extends P{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return E(r,{received:r.data,code:g.invalid_literal,expected:this._def.value}),$}return{status:"valid",value:e.data}}get value(){return this._def.value}};lt.create=(t,e)=>new lt({value:t,typeName:k.ZodLiteral,...T(e)});function $n(t,e){return new dt({values:t,typeName:k.ZodEnum,...T(e)})}var dt=class t extends P{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),s=this._def.values;return E(r,{expected:N.joinValues(s),received:r.parsedType,code:g.invalid_type}),$}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),s=this._def.values;return E(r,{received:r.data,code:g.invalid_enum_value,options:s}),$}return ee(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}};dt.create=$n;var ft=class extends P{_parse(e){let r=N.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==v.string&&s.parsedType!==v.number){let n=N.objectValues(r);return E(s,{expected:N.joinValues(n),received:s.parsedType,code:g.invalid_type}),$}if(this._cache||(this._cache=new Set(N.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=N.objectValues(r);return E(s,{received:s.data,code:g.invalid_enum_value,options:n}),$}return ee(e.data)}get enum(){return this._def.values}};ft.create=(t,e)=>new ft({values:t,typeName:k.ZodNativeEnum,...T(e)});var Ye=class extends P{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==v.promise&&r.common.async===!1)return E(r,{code:g.invalid_type,expected:v.promise,received:r.parsedType}),$;let s=r.parsedType===v.promise?r.data:Promise.resolve(r.data);return ee(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ye.create=(t,e)=>new Ye({type:t,typeName:k.ZodPromise,...T(e)});var Ee=class extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:o=>{E(s,o),o.fatal?r.abort():r.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return $;let u=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return u.status==="aborted"?$:u.status==="dirty"?et(u.value):r.value==="dirty"?et(u.value):u});{if(r.value==="aborted")return $;let a=this._def.schema._parseSync({data:o,path:s.path,parent:s});return a.status==="aborted"?$:a.status==="dirty"?et(a.value):r.value==="dirty"?et(a.value):a}}if(n.type==="refinement"){let o=a=>{let u=n.refinement(a,i);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?$:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?$:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Ve(o))return $;let a=n.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Ve(o)?Promise.resolve(n.transform(o.value,i)).then(a=>({status:r.value,value:a})):$);N.assertNever(n)}};Ee.create=(t,e,r)=>new Ee({schema:t,typeName:k.ZodEffects,effect:e,...T(r)});Ee.createWithPreprocess=(t,e,r)=>new Ee({schema:e,effect:{type:"preprocess",transform:t},typeName:k.ZodEffects,...T(r)});var ye=class extends P{_parse(e){return this._getType(e)===v.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ye.create=(t,e)=>new ye({innerType:t,typeName:k.ZodOptional,...T(e)});var Te=class extends P{_parse(e){return this._getType(e)===v.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Te.create=(t,e)=>new Te({innerType:t,typeName:k.ZodNullable,...T(e)});var pt=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return r.parsedType===v.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};pt.create=(t,e)=>new pt({innerType:t,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});var ht=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return _t(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ue(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ue(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};ht.create=(t,e)=>new ht({innerType:t,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});var Tt=class extends P{_parse(e){if(this._getType(e)!==v.nan){let s=this._getOrReturnCtx(e);return E(s,{code:g.invalid_type,expected:v.nan,received:s.parsedType}),$}return{status:"valid",value:e.data}}};Tt.create=t=>new Tt({typeName:k.ZodNaN,...T(t)});var Bc=Symbol("zod_brand"),rr=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}},sr=class t extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?$:i.status==="dirty"?(r.dirty(),et(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?$:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new t({in:e,out:r,typeName:k.ZodPipeline})}},mt=class extends P{_parse(e){let r=this._def.innerType._parse(e),s=n=>(Ve(n)&&(n.value=Object.freeze(n.value)),n);return _t(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}};mt.create=(t,e)=>new mt({innerType:t,typeName:k.ZodReadonly,...T(e)});function Sn(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function kn(t,e={},r){return t?He.create().superRefine((s,n)=>{let i=t(s);if(i instanceof Promise)return i.then(o=>{if(!o){let a=Sn(e,s),u=a.fatal??r??!0;n.addIssue({code:"custom",...a,fatal:u})}});if(!i){let o=Sn(e,s),a=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:a})}}):He.create()}var qc={object:ce.lazycreate},k;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(k||(k={}));var Wc=(t,e={message:`Input not instance of ${t.name}`})=>kn(r=>r instanceof t,e),On=Ge.create,Tn=tt.create,Uc=Tt.create,zc=rt.create,Pn=st.create,Vc=nt.create,Gc=It.create,Hc=it.create,Yc=ot.create,Zc=He.create,Xc=Me.create,Jc=Se.create,Kc=$t.create,Qc=Be.create,el=ce.create,tl=ce.strictCreate,rl=at.create,sl=br.create,nl=ut.create,il=Oe.create,ol=Cr.create,al=kt.create,ul=Ot.create,cl=Fr.create,ll=ct.create,dl=lt.create,fl=dt.create,pl=ft.create,hl=Ye.create,ml=Ee.create,Dl=ye.create,gl=Te.create,yl=Ee.createWithPreprocess,wl=sr.create,El=()=>On().optional(),xl=()=>Tn().optional(),vl=()=>Pn().optional(),bl={string:(t=>Ge.create({...t,coerce:!0})),number:(t=>tt.create({...t,coerce:!0})),boolean:(t=>st.create({...t,coerce:!0})),bigint:(t=>rt.create({...t,coerce:!0})),date:(t=>nt.create({...t,coerce:!0}))};var Cl=$;import{promises as Al}from"node:fs";import{join as Il,isAbsolute as $l,normalize as kl}from"node:path";var Rr=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),description:f.string().optional(),deps:f.record(f.string().regex(/^[a-z0-9-]+$/,"Dependency name must be lowercase alphanumeric with hyphens"),f.string().regex(/^\d+\.\d+\.\d+$/,"Dependency version must be exact semver")).default({}),files:f.array(f.string()).min(1,"Files array cannot be empty"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>").optional(),agent:f.object({purpose:f.string(),tags:f.array(f.string()).optional()}).optional()});var Fl=f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Key must be name@version"),Rl=f.string().refine(t=>t.length===0?!1:(t.startsWith("file:")||t.startsWith("/")||/^[a-zA-Z]:\\/.test(t)||t.startsWith("./")||t.startsWith("../"),!0),"Source must be a non-empty file URL or local path"),Sl=f.object({source:Rl,hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>")}),Nn=f.record(Fl,Sl);var _l=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>"),source:f.string().url("Source must be a valid URL"),deps:f.array(f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Dependency must be in format name@version"))}),Wg=f.object({createdAt:f.string().datetime("createdAt must be ISO-8601 format"),entries:f.array(_l)});function Sr(t){try{return Rr.parse(t)}catch(e){if(e instanceof f.ZodError){let r=e.errors.map(s=>`${s.path.length>0?`${s.path.join(".")}: `:""}${s.message}`);throw new Error(`Manifest validation failed:
|
|
9
|
+
${r.join(`
|
|
10
|
+
`)}`)}throw e}}function _r(t){let e=new Set;for(let r of t){if(r.includes(".."))throw new Error(`Path traversal not allowed: ${r}`);if($l(r)||/^[A-Za-z]:\\/.test(r))throw new Error(`Absolute paths not allowed: ${r}`);let s=kl(r).replace(/\\/g,"/");if(e.has(s))throw new Error(`Duplicate file path: ${r}`);e.add(s)}}async function Ln(t,e){let r=[];for(let s of t){let n=Il(e,s);try{await Al.access(n)}catch{r.push(s)}}if(r.length>0)throw new Error(`Files not found: ${r.join(", ")}`)}function Ol(t){if(t.includes(".."))throw new Error(`Path traversal not allowed: ${t}`);return t.replace(/\\/g,"/")}function Dt(t,e){let r=Xe.resolve(t).replace(/\\/g,"/"),s=Xe.resolve(e).replace(/\\/g,"/");if(!r.startsWith(s))throw new Error(`Path escapes registry boundaries: ${t}`)}var gt=class{paths;rootPath;constructor(e="~/.spectrl/registry"){this.rootPath=Ol(e),this.paths={root:this.rootPath,spec:(r,s)=>`${this.rootPath}/${r}/${s}`.replace(/\\/g,"/"),files:(r,s)=>`${this.rootPath}/${r}/${s}/files`.replace(/\\/g,"/"),manifest:(r,s)=>`${this.rootPath}/${r}/${s}/spectrl.json`.replace(/\\/g,"/")}}async exists(e,r){let s=this.paths.spec(e,r);Dt(s,this.rootPath);try{return(await Ze.stat(s)).isDirectory()}catch(n){if(n.code==="ENOENT")return!1;throw n}}async getManifest(e,r){let s=this.paths.manifest(e,r);Dt(s,this.rootPath);try{let n=await Ze.readFile(s,"utf-8"),i=JSON.parse(n);return Sr(i)}catch(n){throw n.code==="ENOENT"?new Error(`Manifest not found: ${e}@${r}`):n}}async list(){let e=[];try{await Ze.access(this.rootPath)}catch{return e}let r=await Ze.readdir(this.rootPath,{withFileTypes:!0});for(let s of r){if(!s.isDirectory())continue;let n=s.name,i=Xe.join(this.rootPath,n);try{let o=await Ze.readdir(i,{withFileTypes:!0});for(let a of o)a.isDirectory()&&e.push({name:n,version:a.name})}catch{}}return e}async listVersions(e){let r=Xe.join(this.rootPath,e);try{return(await Ze.readdir(r,{withFileTypes:!0})).filter(i=>i.isDirectory()).map(i=>i.name).filter(i=>/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(i))}catch(s){if(s.code==="ENOENT")return[];throw s}}async remove(e,r){if(!await this.exists(e,r))throw new Error(`Spec ${e}@${r} not found in registry`);let s=this.paths.spec(e,r);Dt(s,this.rootPath),await nr.remove(s);let n=Xe.join(this.rootPath,e);(await Ze.readdir(n)).length===0&&await nr.remove(n)}async publish(e,r){if(_r(e.files),await this.exists(e.name,e.version))throw new Error(`Spec ${e.name}@${e.version} already exists in registry. Bump version to publish changes.`);let s=this.paths.spec(e.name,e.version),n=this.paths.files(e.name,e.version);Dt(s,this.rootPath),Dt(n,this.rootPath),await nr.ensureDir(n);for(let a of e.files){let u=Xe.join(r,a),c=Xe.join(n,a);Dt(c,this.rootPath),await nr.ensureDir(Xe.dirname(c)),await nr.copy(u,c,{overwrite:!0,errorOnExist:!1,preserveTimestamps:!1})}let i=this.paths.manifest(e.name,e.version);Dt(i,this.rootPath);let o=`${JSON.stringify(e,null,2)}
|
|
11
|
+
`;await Ze.writeFile(i,o,"utf-8")}};import{promises as jn}from"node:fs";import Ar from"node:path";var he=class extends Error{exitCode;constructor(e,r){super(e),this.exitCode=r,this.name="ResolverError"}},Ir=class{async loadIndex(e){try{let r=await jn.readFile(e,"utf-8"),s=JSON.parse(r);return Nn.parse(s)}catch(r){throw this.isFileNotFoundError(r)?new he(`Index file not found: ${e}`,1):r}}isFileNotFoundError(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}async readManifestFromSource(e,r){let s;if(e.startsWith("file://")?s=e.slice(7):e.startsWith("file:")?s=e.slice(5):s=e,!Ar.isAbsolute(s)){let n=r||process.cwd();s=Ar.resolve(n,s)}try{let n=Ar.join(s,"spectrl.json"),i=await jn.readFile(n,"utf-8"),o=JSON.parse(i);return Rr.parse(o)}catch(n){throw this.isFileNotFoundError(n)?new he(`Missing source for ${e}`,1):new he(`Failed to read manifest from source: ${e}`,1)}}async resolveClosureFromIndex(e){let r=await this.loadIndex(e),s=Object.keys(r).sort(),n=/^([a-z0-9-]+)@(\d+\.\d+\.\d+)$/,i=new Map;for(let d of s){let m=d.match(n);if(!m)throw new he(`Invalid index key: ${d}`,1);let[,w,x]=m;i.set(d,{name:w,version:x})}let o=new Map,a=Ar.dirname(e);for(let d of s){let m=i.get(d);if(!m)throw new he(`Internal error: missing parsed key ${d}`,1);let{name:w,version:x}=m,S=r[d];if(!S||!S.source)throw new he(`Missing source for ${d}`,1);let I=await this.readManifestFromSource(S.source,a);if(I.name!==w||I.version!==x)throw new he(`Manifest mismatch for ${d}: found ${I.name}@${I.version}`,1);o.set(d,{manifest:I,source:S.source})}let u=new Map;for(let[d,{manifest:m}]of o){let w=Object.entries(m.deps).map(([x,S])=>`${x}@${S}`).sort();for(let x of w)if(!r[x])throw new he(`Missing dependency: ${x}. Add it to .spectrl/spectrl-index.json`,3);u.set(d,w)}let c=(d,m,w)=>{m.add(d),w.add(d);let x=u.get(d)||[];for(let S of x)if(m.has(S)){if(w.has(S))throw new he(`Cyclic dependency detected: ${d} \u2192 ${S}`,3)}else if(c(S,m,w))return!0;return w.delete(d),!1},l=new Set;for(let d of s)l.has(d)||c(d,l,new Set);let p=[];for(let[d,{manifest:m,source:w}]of o){let x=Object.entries(m.deps).map(([S,I])=>`${S}@${I}`).sort();p.push({name:m.name,version:m.version,source:w,deps:x})}let y=p.map(d=>({node:d,key:`${d.name}@${d.version}`}));return y.sort((d,m)=>d.key.localeCompare(m.key)),y.map(d=>d.node)}};import{createHash as Tl}from"node:crypto";function $r(t){let{manifest:e,fileContents:r}=t,s=Tl("sha256"),n=Nl(e);s.update(n,"utf8");let i=Object.keys(r).sort();for(let o of i){let a=r[o];s.update(o,"utf8");let u=Pl(a);s.update(u,"utf8")}return`sha256:${s.digest("hex")}`}function Pl(t){return t.replace(/\r\n/g,`
|
|
6
12
|
`).replace(/\r/g,`
|
|
7
|
-
`)}function
|
|
13
|
+
`)}function Nl(t){let{hash:e,...r}=t;return fs(r)}function fs(t){return t===null||typeof t!="object"?JSON.stringify(t):Array.isArray(t)?`[${t.map(fs).join(",")}]`:`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${fs(t[r])}`).join(",")}}`}var _o=Ft(ks(),1);function Ao(t,e){return _o.default.compare(t,e)}async function _e(t){try{return await Op(t,Tp.F_OK),!0}catch{return!1}}async function Io(t,e){if(await _e(t))throw new h(`File already exists: ${t}`,D.VALIDATION_ERROR)}function Lp(t){return wt(t,"spectrl.json")}function oe(t){return wt(t,".spectrl","spectrl-index.json")}function $o(t){return wt(t,".spectrl")}function fr(){return wt(Pp(),".spectrl","registry")}function Nt(t,e,r){return`${t}/${e}@${r}`}function zr(t,e,r){return`${t}-${e}@${r}`}function Vr(t,e,r,s){return wt(t,".spectrl","specs",zr(e,r,s))}function Ts(t){return typeof t=="object"&&t!==null&&"code"in t&&typeof t.code=="string"}function pr(t){return t instanceof Error}async function jp(t){try{let e=await Os(t,"utf-8");return JSON.parse(e)}catch(e){if(Ts(e)&&e.code==="ENOENT")throw new h(`File not found: ${t}`,D.IO_ERROR);if(e instanceof SyntaxError)throw new h(`Invalid JSON in ${t}: ${e.message}`,D.VALIDATION_ERROR);let r=pr(e)?e.message:"Unknown error";throw new h(`Failed to read ${t}: ${r}`,D.IO_ERROR)}}async function ko(t){let e=Lp(t),r=await jp(e);try{return Sr(r)}catch(s){let n=pr(s)?s.message:"Unknown validation error";throw new h(n,D.VALIDATION_ERROR)}}function Oo(t){try{_r(t)}catch(e){let r=pr(e)?e.message:"Invalid file paths";throw new h(r,D.VALIDATION_ERROR)}}async function To(t,e){try{await Ln(t,e)}catch(r){let s=pr(r)?r.message:"Files not found";throw new h(s,D.IO_ERROR)}}async function Ps(t,e=!0,r){try{let s=r?.yesLabel||"Yes",n=r?.noLabel||"No";return await Np({message:t,choices:[{name:s,value:!0},{name:n,value:!1}],default:e})}catch{return}}var A={log(t){console.log(t)},error(t){console.error(t)}},Mp=`
|
|
8
14
|
# Spectrl local registry
|
|
9
15
|
# Track index and lock files, but ignore downloaded specs (like node_modules)
|
|
10
16
|
.spectrl/specs/
|
|
11
|
-
`;async function
|
|
17
|
+
`;async function Bp(t){let e=wt(t,".gitignore");try{return(await Os(e,"utf-8")).includes(".spectrl/")}catch(r){return Ts(r)&&r.code==="ENOENT",!1}}async function Po(t){let e=wt(t,".gitignore");if(await Bp(t))return!1;try{let r="";try{r=await Os(e,"utf-8")}catch(i){if(!Ts(i)||i.code!=="ENOENT")throw i}let s=r;r.length>0&&!r.endsWith(`
|
|
12
18
|
`)&&(s+=`
|
|
13
|
-
`),s+=
|
|
19
|
+
`),s+=Mp;let{writeFile:n}=await import("node:fs/promises");return await n(e,s,"utf-8"),!0}catch(r){let s=pr(r)?r.message:"Failed to update .gitignore";throw new h(`Failed to configure .gitignore: ${s}`,D.IO_ERROR)}}import{readFile as Mo,writeFile as Bo}from"node:fs/promises";import{join as Ns}from"node:path";var Gr="<!-- Added by Spectrl -->",No=`# Instructions for AI Assistants
|
|
14
20
|
|
|
15
21
|
## What is Spectrl?
|
|
16
22
|
|
|
@@ -216,19 +222,75 @@ These are the authoritative source of truth for this project. Read them before p
|
|
|
216
222
|
- **Follow the chain** - Pursue spec dependencies to get complete context
|
|
217
223
|
- **Remember context** - Don't ask the same question twice in a conversation
|
|
218
224
|
- **Flag but follow** - If specs seem wrong or outdated, flag the concern but follow them anyway unless instructed otherwise
|
|
219
|
-
`;function
|
|
220
|
-
${
|
|
225
|
+
`;function Lo(){return`${Gr}
|
|
226
|
+
${No}`}function jo(){return`
|
|
221
227
|
|
|
222
228
|
---
|
|
223
229
|
|
|
224
|
-
${
|
|
225
|
-
${
|
|
226
|
-
`;await
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
`,"utf-8")}catch(
|
|
234
|
-
|
|
230
|
+
${Gr}
|
|
231
|
+
${No}`}async function Ls(t){let e=Ns(t,"AGENTS.md");if(!await _e(e))return{exists:!1};try{return{exists:!0,hasMarker:(await Mo(e,"utf-8")).includes(Gr)}}catch{return{exists:!1}}}async function js(t){let e=Ns(t,"AGENTS.md"),r=Lo();try{await Bo(e,r,"utf-8")}catch(s){let n=s instanceof Error?s.message:"Unknown error";throw new h(`Failed to create AGENTS.md: ${n}`,D.IO_ERROR)}}async function Ms(t){let e=Ns(t,"AGENTS.md");try{let r=await Mo(e,"utf-8");r=r.trimEnd();let s=r+jo();await Bo(e,s,"utf-8")}catch(r){let s=r instanceof Error?r.message:"Unknown error";throw new h(`Failed to append to AGENTS.md: ${s}`,D.IO_ERROR)}}async function qo(t,e={}){let r=zp({text:"Initializing project",spinner:"line"}).start(),s=$o(t),n=!1;try{if(e.skipAgents&&e.forceAgents)throw r.stop(),new h("Cannot use both --skip-agents and --force-agents",D.VALIDATION_ERROR);let i=oe(t);await Io(i),await Wp(s,{recursive:!0}),n=!0;let a=`${JSON.stringify({},null,2)}
|
|
232
|
+
`;await qp(i,a,"utf-8"),await Vp(t,e,r),r.text="Configuring .gitignore";let c=await Po(t)?" and configured .gitignore":" (.gitignore already configured)";r.succeed(`Initialized project index at ${R(".spectrl/spectrl-index.json")}${c}`)}catch(i){if(r.stop(),n&&i instanceof h&&i.exitCode===D.USER_CANCELLED)try{await Up(s,{recursive:!0,force:!0})}catch{}throw i}}async function Vp(t,e,r){if(e.skipAgents)return;if(e.forceAgents){let i=await Ls(t);if(i.exists)if(i.hasMarker)r.text="Initializing project",A.log(J("\u2713 AGENTS.md already contains Spectrl instructions"));else{r.text="Updating AGENTS.md";try{await Ms(t),r.text="Initializing project",A.log(J("\u2713 Added Spectrl instructions to AGENTS.md"))}catch{r.text="Initializing project",A.log(er("Failed to update AGENTS.md (non-critical)"))}}else{r.text="Creating AGENTS.md";try{await js(t),r.text="Initializing project",A.log(J("\u2713 Created AGENTS.md"))}catch{r.text="Initializing project",A.log(er("Failed to create AGENTS.md (non-critical)"))}}return}let s=await Ls(t);if(!s.exists){r.stop();let i=await Ps("Create AGENTS.md to configure AI assistants?",!0,{yesLabel:"Yes (recommended)",noLabel:"No"});if(i===void 0)throw new h("Initialization cancelled by user",D.USER_CANCELLED);if(r.start("Initializing project"),i){r.text="Creating AGENTS.md";try{await js(t),r.text="Initializing project",A.log(J("\u2713 Created AGENTS.md"))}catch{r.text="Initializing project",A.log(er("Failed to create AGENTS.md (non-critical)"))}}else A.log(J("\u2139 Skipped AGENTS.md creation")),A.log(J("AI assistants won't automatically consult specs. You can create AGENTS.md manually later."));return}if(s.hasMarker){r.text="Initializing project",A.log(J("\u2713 AGENTS.md already contains Spectrl instructions"));return}r.stop();let n=await Ps("AGENTS.md found. Append Spectrl instructions to the bottom?",!0,{yesLabel:"Yes (recommended)",noLabel:"No"});if(n===void 0)throw new h("Initialization cancelled by user",D.USER_CANCELLED);if(r.start("Initializing project"),n){r.text="Updating AGENTS.md";try{await Ms(t),r.text="Initializing project",A.log(J("\u2713 Added Spectrl instructions to AGENTS.md"))}catch{r.text="Initializing project",A.log(er("Failed to update AGENTS.md (non-critical)"))}}else A.log(J("\u2139 Skipped AGENTS.md update")),A.log(J("You can add Spectrl instructions manually if needed"))}import{readFile as Zo}from"node:fs/promises";import{join as Xo}from"node:path";import hh from"ora";import{select as mh}from"@inquirer/prompts";import Bs from"keytar";import Wo from"node-machine-id";import{createCipheriv as Gp,createDecipheriv as Hp,randomBytes as Uo,pbkdf2Sync as zo}from"node:crypto";import{existsSync as qs,mkdirSync as Yp,readFileSync as Zp,writeFileSync as Xp,unlinkSync as Jp,chmodSync as Kp}from"node:fs";import{homedir as Qp}from"node:os";import{join as Vo}from"node:path";var Ws="spectrl",Us="github-token",zs=Vo(Qp(),".spectrl"),Lt=Vo(zs,".auth"),eh=f.object({salt:f.string().length(64),iv:f.string().length(32),encrypted:f.string().min(1)}),be=class{async store(e){try{await Bs.setPassword(Ws,Us,e)}catch{this.storeEncrypted(e)}}async get(){try{return await Bs.getPassword(Ws,Us)}catch{return this.getEncrypted()}}async delete(){try{await Bs.deletePassword(Ws,Us)}catch{}this.deleteEncrypted()}storeEncrypted(e){try{qs(zs)||Yp(zs,{recursive:!0});let r=Uo(32),s=Uo(16),n=Wo.machineIdSync(),i=zo(n,r,1e5,32,"sha256"),o=Gp("aes-256-cbc",i,s),a=o.update(e,"utf8","hex");a+=o.final("hex");let u=JSON.stringify({salt:r.toString("hex"),iv:s.toString("hex"),encrypted:a});Xp(Lt,u,{encoding:"utf8"}),Kp(Lt,384)}catch(r){throw new Error(`Failed to store token: ${r instanceof Error?r.message:"Unknown error"}`)}}getEncrypted(){try{if(!qs(Lt))return null;let e=Zp(Lt,"utf8"),r=JSON.parse(e),s=eh.safeParse(r);if(!s.success)return null;let{salt:n,iv:i,encrypted:o}=s.data,a=Wo.machineIdSync(),u=zo(a,Buffer.from(n,"hex"),1e5,32,"sha256"),c=Hp("aes-256-cbc",u,Buffer.from(i,"hex")),l=c.update(o,"hex","utf8");return l+=c.final("utf8"),l}catch{return null}}deleteEncrypted(){try{qs(Lt)&&Jp(Lt)}catch{}}};import{config as th}from"dotenv";import{fileURLToPath as rh}from"node:url";import{dirname as sh,join as nh}from"node:path";var ih=rh(import.meta.url),oh=sh(ih);process.env.NODE_ENV!=="test"&&!process.env.VITEST&&th({path:nh(oh,"../../.env"),override:!1,quiet:!0});function Et(){let t=process.env.API_URL;if(t)return t;let e="https://bpleokxqv5.execute-api.eu-north-1.amazonaws.com/prod";if(e)return e;throw new Error("Registry API URL is not configured. Please contact support or reinstall the CLI.")}var Mw=f.object({device_code:f.string(),user_code:f.string(),verification_uri:f.string(),expires_in:f.number(),interval:f.number()}),Bw=f.object({token:f.string(),username:f.string()}),qw=f.object({status:f.string()}),Ww=f.object({error:f.string(),message:f.string().optional()}),ah=f.object({manifest:f.record(f.string(),f.unknown()),files:f.record(f.string(),f.string())}),uh=f.object({message:f.string(),url:f.string(),specId:f.string(),version:f.string()}),ch=f.object({specId:f.string(),description:f.string().optional(),tags:f.array(f.string()).optional(),version:f.string(),publishedAt:f.string()}),lh=f.object({results:f.array(ch),count:f.number()}),dh=f.object({version:f.string(),description:f.string().optional(),tags:f.array(f.string()).optional(),publishedAt:f.string(),s3Path:f.string(),hash:f.string(),downloads:f.number().optional()}),fh=f.object({specId:f.string(),username:f.string(),specName:f.string(),versions:f.array(dh)}),ph=f.object({message:f.string()}),Y=class extends Error{constructor(r,s,n){super(r);this.statusCode=s;this.response=n;this.name="ApiError"}};async function Hr(t,e={}){let{maxAttempts:r=3,initialDelayMs:s=1e3,maxDelayMs:n=1e4,backoffMultiplier:i=2}=e,o,a=s;for(let u=1;u<=r;u++)try{return await t()}catch(c){if(o=c instanceof Error?c:new Error(String(c)),c instanceof Y&&c.statusCode&&c.statusCode<500)throw c;if(u===r)throw o;await new Promise(l=>setTimeout(l,a)),a=Math.min(a*i,n)}throw o||new Error("Retry failed")}async function Go(t,e,r){return Hr(async()=>{let s={manifest:e,files:r},n=ah.safeParse(s);if(!n.success)throw new Y(`Invalid request data: ${n.error.message}`,void 0,s);let i=await fetch(`${Et()}/publish`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n.data)});if(!i.ok){let u=await i.text();throw new Y(`Failed to publish spec: ${u}`,i.status,u)}let o=await i.json(),a=uh.safeParse(o);if(!a.success)throw new Y("Invalid API response format after publishing.",i.status,o);return a.data})}async function Ho(t){return Hr(async()=>{let e=await fetch(`${Et()}/search?q=${encodeURIComponent(t)}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok){let n=await e.text();throw new Y(`Failed to search specs: ${n}`,e.status,n)}let r=await e.json(),s=lh.safeParse(r);if(!s.success)throw new Y("Invalid API response format. Expected search results but received unexpected data.",e.status,r);return s.data})}async function xt(t,e){return Hr(async()=>{let r=await fetch(`${Et()}/specs/${t}/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let i=await r.text();throw new Y(`Failed to get spec: ${i}`,r.status,i)}let s=await r.json(),n=fh.safeParse(s);if(!n.success)throw new Y("Invalid API response format when fetching spec metadata.",r.status,s);return n.data})}async function Yo(t,e,r,s){return Hr(async()=>{let n=await fetch(`${Et()}/specs/${e}/${r}/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!n.ok){let a=await n.text();throw new Y(`Failed to unpublish spec: ${a}`,n.status,a)}let i=await n.json(),o=ph.safeParse(i);if(!o.success)throw new Y("Invalid API response format after unpublishing.",n.status,i);return o.data})}async function Jo(t,e){let r=hh({text:"Publishing spec",spinner:"line"}).start();try{r.text="Validating manifest";let s=await ko(t);Oo(s.files),await To(s.files,t),r.stop();let n=await mh({message:"Where do you want to publish?",choices:[{name:"Local registry (~/.spectrl/registry/)",value:"local",description:"Publish to your local registry (private)"},{name:"Public registry (registry.spectrl.dev)",value:"public",description:"Publish to the public registry (requires authentication)"}],default:"local"});r.start(),n==="local"?await Dh(t,s,e,r):await gh(t,s,r)}catch(s){throw r.stop(),s instanceof h?s:s instanceof Error?new h(s.message,D.IO_ERROR):new h("Unknown error during publish",D.IO_ERROR)}}async function Dh(t,e,r,s){s.text="Reading tracked files";let n={};for(let u of e.files){let c=Xo(t,u);try{n[u]=await Zo(c,"utf-8")}catch{throw new h(`Failed to read file: ${u}`,D.IO_ERROR)}}s.text="Computing hash";let i=$r({manifest:e,fileContents:n}),o={...e,hash:i};s.text="Writing to registry",await new gt(r??fr()).publish(o,t),s.succeed(`Published ${R(e.name)}@${R(e.version)} to local registry with hash ${R(i.substring(0,12))}`)}async function gh(t,e,r){r.text="Checking authentication";let n=await new be().get();if(!n)throw r.stop(),new h(`You need to login first. Run: ${B("spectrl login")}`,D.AUTHENTICATION_ERROR);if(!e.description)throw r.stop(),new h('Manifest must include a "description" field for public registry publishing',D.VALIDATION_ERROR);let i={...e};i.agent||(r.text="Auto-populating agent field",i={...e,agent:{purpose:i.description||"",tags:[]}}),r.text="Reading tracked files";let o={};for(let a of e.files){let u=Xo(t,a);try{let c=await Zo(u,"utf-8");o[a]=c}catch{throw new h(`Failed to read file: ${a}`,D.IO_ERROR)}}r.text="Publishing to public registry";try{let a={...i},u=await Go(n,a,o);r.succeed(`Published ${R(u.specId)}@${R(u.version)} to public registry`),console.log(`
|
|
233
|
+
\u{1F517} ${u.url}
|
|
234
|
+
`)}catch(a){throw a instanceof Error?new h(`Failed to publish to public registry: ${a.message}`,D.IO_ERROR):a}}import{promises as V}from"node:fs";import{dirname as Mt,join as W,resolve as Ko}from"node:path";import Z from"fs-extra";import Yr from"ora";import{select as Ch}from"@inquirer/prompts";var jt=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),description:f.string().optional(),deps:f.record(f.string().regex(/^[a-z0-9-]+$/,"Dependency name must be lowercase alphanumeric with hyphens"),f.string().regex(/^\d+\.\d+\.\d+$/,"Dependency version must be exact semver")).default({}),files:f.array(f.string()).min(1,"Files array cannot be empty"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>").optional(),agent:f.object({purpose:f.string(),tags:f.array(f.string()).optional()}).optional()});var yh=f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Key must be name@version"),wh=f.string().refine(t=>t.length===0?!1:(t.startsWith("file:")||t.startsWith("/")||/^[a-zA-Z]:\\/.test(t)||t.startsWith("./")||t.startsWith("../"),!0),"Source must be a non-empty file URL or local path"),Eh=f.object({source:wh,hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>")}),sE=f.record(yh,Eh);var xh=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>"),source:f.string().url("Source must be a valid URL"),deps:f.array(f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Dependency must be in format name@version"))}),oE=f.object({createdAt:f.string().datetime("createdAt must be ISO-8601 format"),entries:f.array(xh)});var vt={username:/^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$/,name:/^[a-z0-9](?:[a-z0-9-]{0,98}[a-z0-9])?$/,version:/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/};function Ae(t){if(!t||typeof t!="string")throw new Error("Spec reference must be a non-empty string");let e=t.trim();if(e.length===0)throw new Error("Spec reference must be a non-empty string");return e.includes("/")?bh(e):vh(e)}function vh(t){let e=t.indexOf("@");if(e===-1){let n=t;if(!vt.name.test(n))throw new Error(`Invalid spec name: ${n}. Must be lowercase alphanumeric with hyphens, 1-100 characters`);return{name:n,isPublic:!1}}let r=t.slice(0,e),s=t.slice(e+1);if(!vt.name.test(r))throw new Error(`Invalid spec name: ${r}. Must be lowercase alphanumeric with hyphens, 1-100 characters`);if(!vt.version.test(s))throw new Error(`Invalid version: ${s}. Must be valid semver (e.g., 1.0.0) with no leading zeros`);return{name:r,version:s,isPublic:!1}}function bh(t){let e=t.indexOf("/");if(e===-1||e===0||e===t.length-1)throw new Error(`Invalid public spec reference: ${t}. Must be in format username/spec or username/spec@version`);let r=t.slice(0,e),s=t.slice(e+1);if(!vt.username.test(r))throw new Error(`Invalid username: ${r}. Must be lowercase alphanumeric with hyphens, 1-39 characters`);let n=s.indexOf("@");if(n===-1){let a=s;if(!vt.name.test(a))throw new Error(`Invalid spec name: ${a}. Must be lowercase alphanumeric with hyphens, 1-100 characters`);return{username:r,name:a,isPublic:!0}}let i=s.slice(0,n),o=s.slice(n+1);if(!vt.name.test(i))throw new Error(`Invalid spec name: ${i}. Must be lowercase alphanumeric with hyphens, 1-100 characters`);if(!vt.version.test(o))throw new Error(`Invalid version: ${o}. Must be valid semver (e.g., 1.0.0) with no leading zeros`);return{username:r,name:i,version:o,isPublic:!0}}function Qo(){return process.env.REGISTRY_URL||"https://d12j78i0x57g1k.cloudfront.net"}async function ta(t,e,r,s,n){try{let i=oe(n),o=await V.readFile(i,"utf-8"),a=JSON.parse(o);if(r){let u=`${t}@${e}`;if(a[u])return{hasCollision:!0,existingType:"local",existingPath:W(n,".spectrl","specs",u),existingKey:u}}else for(let u of Object.keys(a))if(u.includes("/")){let c=u.split("/");if(c.length===2&&c[1]===`${t}@${e}`){let l=c[0];return{hasCollision:!0,existingType:"public",existingPath:W(n,".spectrl","specs",`${l}-${t}@${e}`),existingKey:u}}}return{hasCollision:!1,existingType:null,existingPath:null,existingKey:null}}catch{return{hasCollision:!1,existingType:null,existingPath:null,existingKey:null}}}async function Fh(t,e,r,s){return await Ch({message:`Warning: A ${t} spec '${r}' already exists.
|
|
235
|
+
Installing ${e} spec '${s}' may cause confusion in dependency resolution.
|
|
236
|
+
|
|
237
|
+
What would you like to do?`,choices:[{name:`Replace ${t} spec with ${e} spec`,value:"replace",description:`Remove '${r}' and install '${s}'`},{name:"Cancel installation",value:"cancel",description:"Keep existing spec and abort"}],default:"cancel"})}async function ra(t,e,r,s){if(!t.hasCollision||!t.existingType||!t.existingKey||!t.existingPath)return;if(!process.stdin.isTTY)throw new h(["Spec name collision detected",` ${t.existingType==="local"?"Local":"Public"} spec '${t.existingKey}' already exists`,` Attempted to install ${r} spec '${e}'`,"","This collision will cause ambiguity in dependency resolution.","","To resolve:",` 1. Remove the ${t.existingType} spec: spectrl uninstall ${t.existingKey}`,` 2. Or remove the ${r} spec from your index`," 3. Then retry the installation"].join(`
|
|
238
|
+
`),D.VALIDATION_ERROR);if(await Fh(t.existingType,r,t.existingKey,e)==="cancel")throw new h("Installation cancelled by user",D.USER_CANCELLED);let i=Yr({text:`Removing existing ${t.existingType} spec '${t.existingKey}'`,spinner:"line"}).start();try{await Bt(t.existingPath);let o=oe(s),a=await V.readFile(o,"utf-8"),u=JSON.parse(a);if(t.existingKey in u){let c={...u};delete c[t.existingKey],await V.writeFile(o,`${JSON.stringify(c,null,2)}
|
|
239
|
+
`,"utf-8")}i.succeed(`Removed ${t.existingType} spec '${t.existingKey}'`)}catch(o){throw i.fail("Failed to remove existing spec"),new h(`Failed to remove existing spec: ${o instanceof Error?o.message:String(o)}`,D.IO_ERROR)}}function Rh(){return process.platform==="win32"?"junction":"dir"}async function sa(t,e){try{if(!(await Z.lstat(t)).isSymbolicLink())return{exists:!0,isSymlink:!1,isCorrect:!1};let n=await Z.readlink(t),i=Ko(Mt(t),n),o=Ko(e);return{exists:!0,isSymlink:!0,isCorrect:i===o}}catch(r){if(r.code==="ENOENT")return{exists:!1,isSymlink:!1,isCorrect:!1};throw r}}async function Bt(t){try{(await Z.lstat(t)).isSymbolicLink()?await Z.unlink(t):await Z.remove(t)}catch(e){let r=e;if(r.code!=="ENOENT")throw new h(`Failed to remove existing path ${t}: ${r.message}`,D.IO_ERROR)}}function Sh(){return process.env.SPECTRL_USE_COPY==="1"}async function ea(t,e,r){try{await Z.ensureDir(e);let s=W(Mt(t),"spectrl.json"),n=W(e,"spectrl.json");await Z.copy(s,n);let i=new Set;for(let o of r.files){let a=W(e,o);i.add(Mt(a))}for(let o of i)await Z.ensureDir(o);for(let o of r.files){let a=W(t,o),u=W(e,o);await Z.copy(a,u)}}catch(s){let n=s;throw new h(`Failed to copy files from registry: ${n.message}`,D.IO_ERROR)}}async function na(t,e,r,s){if(Sh())return s.info("Using file copy mode (SPECTRL_USE_COPY=1)"),await ea(t,e,r),"copy";if(!await Z.pathExists(t))throw new h(`Registry path not found: ${t}
|
|
240
|
+
|
|
241
|
+
Has this spec been published? Run: ${B("spectrl publish")}`,D.DEPENDENCY_ERROR);try{await Z.ensureDir(Mt(e))}catch(i){let o=i;throw new h(`Failed to create parent directory for symlink: ${o.message}`,D.IO_ERROR)}try{let i=Rh();return await Z.symlink(t,e,i),"symlink"}catch(i){let o=i;if(o.code==="EPERM"){s.warn("Permission denied creating symlink. Windows: Enable Developer Mode or run as Administrator. Falling back to file copy...");try{await Bt(e)}catch{}return await ea(t,e,r),"copy"}throw new h(`Failed to create symlink: ${o.message}`,D.IO_ERROR)}}function ia(t,e){let r;return t.startsWith("file://")?r=t.slice(7):t.startsWith("file:")?r=t.slice(5):r=t,r.startsWith("/")||(r=W(e,r)),r}async function _h(t,e){if(t.startsWith("https://")||t.startsWith("http://"))try{let s=await fetch(t);if(!s.ok)throw new Error(`HTTP ${s.status}`);let n=await s.json(),i=jt.safeParse(n);if(!i.success)throw new Error(`Invalid manifest format: ${i.error.issues[0].message}`);let o=i.data,a=new URL(t),u=`${a.protocol}//${a.host}`,c=a.pathname.split("/");c.pop();let l=c.join("/"),p={};for(let y of o.files){let d=`${u}${l}/files/${y}`,m=await fetch(d);if(!m.ok)throw new Error(`Failed to download ${y}: HTTP ${m.status}`);p[y]=await m.text()}return{manifest:o,fileContents:p}}catch(s){throw s instanceof Error?new h(`Failed to read files from ${t}: ${s.message}`,D.IO_ERROR):s}let r=ia(t,e);try{let s=W(r,"spectrl.json"),n=await V.readFile(s,"utf-8"),i=JSON.parse(n),o=jt.safeParse(i);if(!o.success)throw new Error(`Invalid manifest in ${r}: ${o.error.issues[0].message}`);let a=o.data,u=W(r,"files"),c=!1;try{c=(await V.stat(u)).isDirectory()}catch{c=!1}let l={};for(let p of a.files){let y=c?W(r,"files",p):W(r,p);l[p]=await V.readFile(y,"utf-8")}return{manifest:a,fileContents:l}}catch(s){throw s instanceof Error?new h(`Failed to read files from ${t}: ${s.message}`,D.IO_ERROR):s}}async function Ah(t,e){let r=await e.listVersions(t);if(r.length===0)throw new h(`Spec ${R(t)} not found in registry`,D.DEPENDENCY_ERROR);return r.sort((n,i)=>Ao(i,n))[0]}async function Vs(t,e){let{username:r,name:s,version:n}=t,{cwd:i}=e,o=Yr({text:`Resolving ${R(`${r}/${s}`)}`,spinner:"line"}).start();try{let a=oe(i);if(!await _e(a))throw new h(`Project not initialized. Run ${B("spectrl init")} to set up dependency management.
|
|
242
|
+
|
|
243
|
+
Note: ${B("spectrl new")} and ${B("spectrl publish")} work without initialization.`,D.VALIDATION_ERROR);o.text=`Fetching ${R(`${r}/${s}`)} from public registry`;let u;try{u=await xt(r,s)}catch(j){throw j instanceof Y&&j.statusCode===404?new h(`Spec ${R(`${r}/${s}`)} not found in public registry`,D.DEPENDENCY_ERROR):j}let c=n||u.versions[0]?.version;if(!c)throw new h(`No versions available for ${R(`${r}/${s}`)}`,D.DEPENDENCY_ERROR);let l=u.versions.find(j=>j.version===c);if(!l)throw new h(`Version ${R(c)} not found for ${R(`${r}/${s}`)}`,D.DEPENDENCY_ERROR);let p=Nt(r,s,c);o.text=`Found ${R(p)}`,o.stop();let y=await ta(s,c,!0,r,i);await ra(y,p,"public",i),o.start(`Installing ${R(p)}`);let d=Vr(i,r,s,c),m=W(d,"spectrl.json");try{let j=await V.readFile(m,"utf-8"),G=JSON.parse(j),Q=jt.safeParse(G);if(!Q.success)throw new Error("Invalid manifest");if(Q.data.hash===l.hash){o.succeed(`${R(p)} already installed at ${R(`.spectrl/specs/${zr(r,s,c)}`)}`);let fe=oe(i),H={};try{let Qt=await V.readFile(fe,"utf-8");H=JSON.parse(Qt)}catch(Qt){if(Qt.code!=="ENOENT")throw Qt}let ge=`${Qo()}/${l.s3Path}/spectrl.json`;H[p]={source:ge,hash:l.hash};let ze=JSON.stringify(H,null,2);await V.writeFile(fe,`${ze}
|
|
244
|
+
`,"utf-8");return}}catch(j){if(j.code!=="ENOENT")throw j}o.text=`Downloading ${R(p)} manifest`;let w=Qo(),x=`${w}/${l.s3Path}/spectrl.json`,S;try{S=await fetch(x)}catch(j){throw new h(`Failed to download manifest: ${j instanceof Error?j.message:String(j)}`,D.IO_ERROR)}if(!S.ok)throw new h(`Failed to download manifest: HTTP ${S.status}`,D.IO_ERROR);let I=await S.json(),M=jt.safeParse(I);if(!M.success)throw new h(`Downloaded manifest is invalid: ${M.error.issues[0].message}`,D.VALIDATION_ERROR);let U=M.data,z={...U,hash:l.hash};await Z.ensureDir(d),await V.writeFile(m,JSON.stringify(z,null,2),"utf-8"),o.text=`Downloading ${R(p)} files (${U.files.length} files)`;for(let j of U.files){let G=`${w}/${l.s3Path}/files/${j}`,Q;try{Q=await fetch(G)}catch(H){throw new h(`Failed to download file ${j}: ${H instanceof Error?H.message:String(H)}`,D.IO_ERROR)}if(!Q.ok)throw new h(`Failed to download file ${j}: HTTP ${Q.status}`,D.IO_ERROR);let $e=await Q.text(),fe=W(d,j);await Z.ensureDir(Mt(fe)),await V.writeFile(fe,$e,"utf-8")}o.text="Updating project index";let Ue=oe(i),de={};try{let j=await V.readFile(Ue,"utf-8");de=JSON.parse(j)}catch(j){if(j.code!=="ENOENT")throw new h(`Failed to read project index: ${j.message}`,D.IO_ERROR)}de[p]={source:x,hash:l.hash};try{let j=JSON.stringify(de,null,2);await V.writeFile(Ue,`${j}
|
|
245
|
+
`,"utf-8")}catch(j){o.warn("Failed to update index, rolling back installation...");try{await Z.remove(d)}catch{}throw new h(`Failed to update project index: ${j.message}`,D.IO_ERROR)}o.succeed(`Installed ${R(p)} from public registry at ${R(`.spectrl/specs/${zr(r,s,c)}`)}`)}catch(a){throw o.stop(),a instanceof h?a:a instanceof Y?new h(`API error: ${a.message}`,a.statusCode&&a.statusCode>=500?D.IO_ERROR:D.DEPENDENCY_ERROR):a instanceof Error?new h(a.message,D.IO_ERROR):new h("Unknown error during install",D.IO_ERROR)}}async function oa(t,e){try{let{cwd:r,registry:s}=e,n=oe(r);if(!await _e(n))throw new h(`Project not initialized. Run ${B("spectrl init")} to set up dependency management.
|
|
246
|
+
|
|
247
|
+
Note: ${B("spectrl new")} and ${B("spectrl publish")} work without initialization.`,D.VALIDATION_ERROR);let i;try{i=Ae(t)}catch(a){throw new h(`Invalid spec reference format: ${t}. ${a instanceof Error?a.message:String(a)}`,D.VALIDATION_ERROR)}if(i.isPublic&&i.username)return await Vs({username:i.username,name:i.name,version:i.version},{cwd:r});let o=Yr({text:`Installing ${R(t)}`,spinner:"line"}).start();try{let{name:a,version:u}=i,c=new gt(s??fr());u||(o.text=`Resolving ${R(a)}...`,u=await Ah(a,c),o.text=`Resolved ${R(a)} to version ${R(u)}`);let l=`${a}@${u}`;o.stop();let p=await ta(a,u,!1,void 0,r);if(await ra(p,l,"local",r),o.start(`Installing ${R(l)}`),o.text=`Looking up ${R(l)} in registry`,!await c.exists(a,u))throw new h(`Spec ${R(l)} not found in registry`,D.DEPENDENCY_ERROR);o.text=`Reading manifest for ${R(l)}`;let d=await c.getManifest(a,u);if(!d.hash)throw new h(`Manifest for ${l} is missing hash`,D.VALIDATION_ERROR);let m=c.paths.files(a,u),w=W(r,".spectrl","specs",l);o.text=`Checking ${R(l)}`;let x=await sa(w,m);if(x.exists&&x.isSymlink&&x.isCorrect){o.succeed(`${R(l)} already installed at ${R(`.spectrl/specs/${l}`)}`),o.text="Updating project index";let G=W(r,".spectrl","spectrl-index.json"),Q={};try{let H=await V.readFile(G,"utf-8");Q=JSON.parse(H)}catch(H){if(H.code!=="ENOENT")throw H}let $e=c.paths.spec(a,u);Q[l]={source:$e,hash:d.hash};let fe=JSON.stringify(Q,null,2);await V.writeFile(G,`${fe}
|
|
248
|
+
`,"utf-8");return}let S=!1;x.exists&&(x.isSymlink?o.text=`Updating symlink for ${R(l)}`:(o.text=`Upgrading ${R(l)} from copied files to symlink`,S=!0),await Bt(w)),o.text=`Installing ${R(l)}`;let I=await na(m,w,d,o);if(!await Z.pathExists(w))throw new h(`Installation verification failed: ${w} does not exist after installation`,D.IO_ERROR);o.text="Updating project index";let U=W(r,".spectrl","spectrl-index.json"),z={};try{let G=await V.readFile(U,"utf-8");z=JSON.parse(G)}catch(G){if(G.code!=="ENOENT")throw new h(`Failed to read project index: ${G.message}`,D.IO_ERROR)}let Ue=c.paths.spec(a,u);z[l]={source:Ue,hash:d.hash};try{let G=JSON.stringify(z,null,2);await V.writeFile(U,`${G}
|
|
249
|
+
`,"utf-8")}catch(G){o.warn("Failed to update index, rolling back installation...");try{await Bt(w)}catch{}throw new h(`Failed to update project index: ${G.message}`,D.IO_ERROR)}let de=I==="symlink"?"symlink":"copied files",j=S?"Upgraded":"Installed";o.succeed(`${j} ${R(l)} using ${de} at ${R(`.spectrl/specs/${l}`)}`)}catch(a){throw o.stop(),a instanceof h?a:a instanceof Error?new h(a.message,D.IO_ERROR):new h("Unknown error during install",D.IO_ERROR)}}catch(r){throw r instanceof h?r:r instanceof Error?new h(r.message,D.IO_ERROR):new h("Unknown error during install",D.IO_ERROR)}}async function aa(t){let e=Yr({text:"Installing specs",spinner:"line"}).start();try{let{cwd:r,registry:s}=t,n=oe(r);if(!await _e(n))throw new h(`Project not initialized. Run ${B("spectrl init")} to set up dependency management.
|
|
250
|
+
|
|
251
|
+
Note: ${B("spectrl new")} and ${B("spectrl publish")} work without initialization.`,D.VALIDATION_ERROR);e.text="Resolving dependencies";let i=W(r,".spectrl","spectrl-index.json"),a=await new Ir().resolveClosureFromIndex(i);if(a.length===0){e.info("No specs to install");return}let u={total:a.length,symlinked:0,copied:0,upgraded:0,skipped:0};e.text=`Resolving ${u.total} spec(s)`;let c=new gt(s??fr()),l=[],p=W(r,".spectrl"),y={};try{let x=await V.readFile(n,"utf-8");y=JSON.parse(x)}catch(x){if(x.code!=="ENOENT")throw x}for(let x of a){let{name:S,version:I,source:M,deps:U}=x,z=`${S}@${I}`;e.text=`Processing ${R(z)}`;let Ue=M.startsWith("https://")||M.startsWith("http://"),{manifest:de,fileContents:j}=await _h(M,p),G=$r({manifest:de,fileContents:j});if(Ue){let Q=z.split("/"),$e=Q.length>1?W(r,".spectrl","specs",`${Q[0]}-${Q[1]}`):W(r,".spectrl","specs",z),fe=W($e,"spectrl.json"),H=!1;try{let pe=await V.readFile(fe,"utf-8"),ge=JSON.parse(pe),ze=jt.safeParse(ge);ze.success&&ze.data.hash===G&&(H=!0,u.skipped++)}catch{}if(!H){await Z.ensureDir($e),await V.writeFile(fe,JSON.stringify(de,null,2),"utf-8");for(let pe of de.files){let ge=W($e,pe);await Z.ensureDir(Mt(ge)),await V.writeFile(ge,j[pe],"utf-8")}u.copied++}y[z]={source:M,hash:G}}else{if(await c.exists(S,I)){if((await c.getManifest(S,I)).hash!==G)throw new h(`Integrity breach: hash mismatch for ${z}`,D.IO_ERROR)}else{let ge={...de,hash:G},ze=ia(M,p);await c.publish(ge,ze)}let $e=c.paths.spec(S,I),fe=c.paths.files(S,I),H=W(r,".spectrl","specs",z);e.text=`Checking ${R(z)}`;let pe=await sa(H,fe);if(pe.exists&&pe.isSymlink&&pe.isCorrect)u.skipped++;else{let ge=!1;pe.exists&&!pe.isSymlink?(e.text=`Upgrading ${R(z)} from copied files to symlink`,await Bt(H),ge=!0):pe.exists&&!pe.isCorrect?(e.text=`Updating symlink for ${R(z)}`,await Bt(H)):e.text=`Creating symlink for ${R(z)}`;let ze=await na(fe,H,de,e);if(!await Z.pathExists(H))throw new h(`Installation verification failed: ${H} does not exist after installation`,D.IO_ERROR);ge?u.upgraded++:ze==="symlink"?u.symlinked++:u.copied++}y[z]={source:$e,hash:G}}l.push({name:S,version:I,hash:G,source:M,deps:U})}e.text="Updating project index";try{let x=JSON.stringify(y,null,2);await V.writeFile(n,`${x}
|
|
252
|
+
`,"utf-8")}catch(x){throw new h(`Failed to update project index: ${x.message}`,D.IO_ERROR)}e.text="Writing lock file",l.sort((x,S)=>{let I=`${x.name}@${x.version}`,M=`${S.name}@${S.version}`;return I.localeCompare(M)});let d={createdAt:new Date().toISOString(),entries:l},m=W(r,".spectrl","lock.json");try{await V.writeFile(m,`${JSON.stringify(d,null,2)}
|
|
253
|
+
`,"utf-8")}catch(x){throw new h(`Failed to write lock file: ${x.message}`,D.IO_ERROR)}let w=[];u.symlinked>0&&w.push(`${u.symlinked} symlinked`),u.copied>0&&w.push(`${u.copied} copied`),u.upgraded>0&&w.push(`${u.upgraded} upgraded`),u.skipped>0&&w.push(`${u.skipped} skipped`),e.succeed(`Processed ${u.total} spec(s) (${w.join(", ")}), lock file written`)}catch(r){if(e.stop(),r instanceof he){let s=r.exitCode===3?D.DEPENDENCY_ERROR:D.VALIDATION_ERROR;throw new h(r.message,s)}throw r instanceof h?r:r instanceof Error?new h(r.message,D.IO_ERROR):new h("Unknown error during install",D.IO_ERROR)}}import{writeFile as Ih,mkdir as $h}from"node:fs/promises";import{join as ua}from"node:path";import kh from"ora";async function ca(t,e,r="0.1.0",s){let n=kh({text:"Creating new spec",spinner:"line"}).start();try{if(!/^[a-z0-9-]+$/.test(t))throw new h("Spec name must be lowercase alphanumeric with hyphens",D.VALIDATION_ERROR);let i=ua(e,t);if(await _e(i))throw new h(`Directory already exists: ${t}`,D.VALIDATION_ERROR);n.text=`Creating directory ${t}`,await $h(i,{recursive:!0});let o={name:t,version:r,files:[],deps:{},...s&&{description:s}},a=ua(i,"spectrl.json"),u=`${JSON.stringify(o,null,2)}
|
|
254
|
+
`;await Ih(a,u,"utf-8"),n.succeed(`Created new spec ${R(t)} with manifest at ${R(`${t}/spectrl.json`)}`)}catch(i){throw n.stop(),i}}import Je from"chalk";import Ra from"node:process";import Sa from"node:path";import{fileURLToPath as lm}from"node:url";import dm from"node:child_process";import fm,{constants as pm}from"node:fs/promises";import{promisify as Uh}from"node:util";import zh from"node:child_process";import Xs,{constants as ma}from"node:fs/promises";import fa from"node:process";import Lh from"node:os";import jh from"node:fs";import Ph from"node:fs";import la from"node:fs";var Gs;function Oh(){try{return la.statSync("/.dockerenv"),!0}catch{return!1}}function Th(){try{return la.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Hs(){return Gs===void 0&&(Gs=Oh()||Th()),Gs}var Ys,Nh=()=>{try{return Ph.statSync("/run/.containerenv"),!0}catch{return!1}};function qt(){return Ys===void 0&&(Ys=Nh()||Hs()),Ys}var da=()=>{if(fa.platform!=="linux")return!1;if(Lh.release().toLowerCase().includes("microsoft"))return!qt();try{return jh.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!qt():!1}catch{return!1}},qe=fa.env.__IS_WSL_TEST__?da:da();import pa from"node:process";import{Buffer as Mh}from"node:buffer";import{promisify as Bh}from"node:util";import qh from"node:child_process";var Wh=Bh(qh.execFile),Zs=()=>`${pa.env.SYSTEMROOT||pa.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var me=async(t,e={})=>{let{powerShellPath:r,...s}=e,n=me.encodeCommand(t);return Wh(r??Zs(),[...me.argumentsPrefix,n],{encoding:"utf8",...s})};me.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];me.encodeCommand=t=>Mh.from(t,"utf16le").toString("base64");me.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`;var Vh=Uh(zh.execFile),Gh=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",s=!1;try{await Xs.access(r,ma.F_OK),s=!0}catch{}if(!s)return t;let n=await Xs.readFile(r,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return i?(e=i.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),Hh=async()=>`${await Gh()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Zr=qe?Hh:Zs,ha,Da=async()=>(ha??=(async()=>{try{let t=await Zr();return await Xs.access(t,ma.X_OK),!0}catch{return!1}})(),ha),ga=async()=>{let t=await Zr(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await me(e,{powerShellPath:t});return r.trim()},ya=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await Vh("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}};function bt(t,e,r){let s=n=>Object.defineProperty(t,e,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let n=r();return s(n),n},set(n){s(n)}}),t}import{promisify as im}from"node:util";import tn from"node:process";import{execFile as om}from"node:child_process";import{promisify as Yh}from"node:util";import Zh from"node:process";import{execFile as Xh}from"node:child_process";var Jh=Yh(Xh);async function Js(){if(Zh.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await Jh("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}import Kh from"node:process";import{promisify as Qh}from"node:util";import{execFile as em,execFileSync as ax}from"node:child_process";var tm=Qh(em);async function wa(t,{humanReadableOutput:e=!0,signal:r}={}){if(Kh.platform!=="darwin")throw new Error("macOS only");let s=e?[]:["-ss"],n={};r&&(n.signal=r);let{stdout:i}=await tm("osascript",["-e",t,s],n);return i.trim()}async function Ks(t){return wa(`tell application "Finder" to set app_path to application file id "${t}" as string
|
|
255
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as rm}from"node:util";import{execFile as sm}from"node:child_process";var nm=rm(sm),Ea={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Qs=new Map(Object.entries(Ea)),Xr=class extends Error{};async function en(t=nm){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new Xr(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:s}=r.groups,n=Ea[s];if(!n)throw new Xr(`Unknown browser ID: ${s}`);return n}var am=im(om),um=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function rn(){if(tn.platform==="darwin"){let t=await Js();return{name:await Ks(t),id:t}}if(tn.platform==="linux"){let{stdout:t}=await am("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:um(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(tn.platform==="win32")return en();throw new Error("Only macOS, Linux, and Windows are supported")}import sn from"node:process";var cm=!!(sn.env.SSH_CONNECTION||sn.env.SSH_CLIENT||sn.env.SSH_TTY),xa=cm;var Jr=Symbol("fallbackAttempt"),nn=import.meta.url?Sa.dirname(lm(import.meta.url)):"",va=Sa.join(nn,"xdg-open"),{platform:Wt,arch:ba}=Ra,Ca=async(t,e)=>{if(t.length===0)return;let r=[];for(let s of t)try{return await e(s)}catch(n){r.push(n)}throw new AggregateError(r,"Failed to open in all supported apps")},Kr=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Jr]===!0;if(delete t[Jr],Array.isArray(t.app))return Ca(t.app,c=>Kr({...t,app:c,[Jr]:!0}));let{name:r,arguments:s=[]}=t.app??{};if(s=[...s],Array.isArray(r))return Ca(r,c=>Kr({...t,app:{name:c,arguments:s},[Jr]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},p;if(qe){let y=await ga();p=Qs.get(y)??{}}else p=await rn();if(p.id in c){let y=c[p.id.toLowerCase()];if(r==="browserPrivate"){if(y==="safari")throw new Error("Safari doesn't support opening in private mode via command line");s.push(l[y])}return Kr({...t,app:{name:Ut[y],arguments:s}})}throw new Error(`${p.name} is not supported as a default browser`)}let n,i=[],o={},a=!1;if(qe&&!qt()&&!xa&&!r&&(a=await Da()),Wt==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),r&&i.push("-a",r);else if(Wt==="win32"||a){n=await Zr(),i.push(...me.argumentsPrefix),qe||(o.windowsVerbatimArguments=!0),qe&&t.target&&(t.target=await ya(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(me.escapeArgument(r)),t.target&&s.push(t.target)):t.target&&c.push(me.escapeArgument(t.target)),s.length>0&&(s=s.map(l=>me.escapeArgument(l)),c.push("-ArgumentList",s.join(","))),t.target=me.encodeCommand(c.join(" ")),t.wait||(o.stdio="ignore")}else{if(r)n=r;else{let c=!nn||nn==="/",l=!1;try{await fm.access(va,pm.X_OK),l=!0}catch{}n=Ra.versions.electron??(Wt==="android"||c||!l)?"xdg-open":va}s.length>0&&i.push(...s),t.wait||(o.stdio="ignore",o.detached=!0)}Wt==="darwin"&&s.length>0&&i.push("--args",...s),t.target&&i.push(t.target);let u=dm.spawn(n,i,o);return t.wait?new Promise((c,l)=>{u.once("error",l),u.once("close",p=>{if(!t.allowNonzeroExitCode&&p!==0){l(new Error(`Exited with code ${p}`));return}c(u)})}):e?new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.once("close",p=>{if(u.off("error",l),p!==0){l(new Error(`Exited with code ${p}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.off("error",l),c(u)})}))},hm=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Kr({...e,target:t})};function Fa(t){if(typeof t=="string"||Array.isArray(t))return t;let{[ba]:e}=t;if(!e)throw new Error(`${ba} is not supported`);return e}function hr({[Wt]:t},{wsl:e}={}){if(e&&qe)return Fa(e);if(!t)throw new Error(`${Wt} is not supported`);return Fa(t)}var Ut={browser:"browser",browserPrivate:"browserPrivate"};bt(Ut,"chrome",()=>hr({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));bt(Ut,"brave",()=>hr({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));bt(Ut,"firefox",()=>hr({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));bt(Ut,"edge",()=>hr({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));bt(Ut,"safari",()=>hr({darwin:"Safari"}));var _a=hm;var mm=f.object({device_code:f.string(),user_code:f.string(),verification_uri:f.string(),expires_in:f.number(),interval:f.number()}),Dm=f.object({token:f.string(),username:f.string()}),gm=f.object({error:f.string().optional(),message:f.string().optional(),status:f.string().optional()});async function Aa(){let t=new be;A.log(J(J(`Initiating GitHub authentication...
|
|
256
|
+
`)));try{let e=await fetch(`${Et()}/auth/device/init`,{method:"POST"});if(!e.ok)throw A.error("Failed to initiate authentication"),new Error("Device flow initialization failed");let r=await e.json(),s=mm.safeParse(r);if(!s.success)throw A.error("Invalid response from authentication server"),console.error(Je.dim("Validation error:"),s.error.message),new Error("Device flow initialization failed");let{device_code:n,user_code:i,verification_uri:o,expires_in:a,interval:u}=s.data;console.log(Je.bold(`Please visit: ${Je.cyan(o)}`)),console.log(Je.bold(`
|
|
257
|
+
Enter code: ${Je.green(i)}
|
|
258
|
+
`)),A.log(J(`Opening browser...
|
|
259
|
+
`)),await _a(o);let l=Date.now()+a*1e3;for(A.log(J("Waiting for authorization..."));Date.now()<l;){await new Promise(y=>setTimeout(y,u*1e3));let p=await fetch(`${Et()}/auth/device/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:n})});if(p.status===200){let y=await p.json(),d=Dm.safeParse(y);if(!d.success)throw A.error("Invalid response from server"),console.error(Je.dim("Validation error:"),d.error.message),new Error("Missing token or username in response");let{token:m,username:w}=d.data;await t.store(m),A.log(J(Je.green(`
|
|
260
|
+
\u2713 Logged in as ${Je.bold(w)}`)));return}if(p.status!==202&&p.status===400){let y=await p.json(),d=gm.safeParse(y),m=d.success&&(d.data.message||d.data.error)||"Unknown error";throw A.error(`Authentication failed: ${m}`),new Error("Authentication failed")}}throw A.error("Authentication timed out"),new Error("Authentication timed out")}catch(e){throw e instanceof Error?e:new Error("Authentication failed")}}import ym from"chalk";async function Ia(){await new be().delete(),A.log(ym.green("\u2713 Logged out"))}import zt from"chalk";var wm=f.object({login:f.string()});async function $a(){let e=await new be().get();if(!e){console.log(zt.dim("Not logged in")),console.log(`Run: ${B("spectrl login")}`);return}try{let r=await fetch("https://api.github.com/user",{headers:{Authorization:`Bearer ${e}`}});if(!r.ok){console.log(zt.yellow("Token invalid")),console.log(`Run: ${B("spectrl login")}`);return}let s=await r.json(),n=wm.safeParse(s);if(!n.success){console.log(zt.red("\u2717 Invalid response from GitHub API")),console.log(`Run: ${B("spectrl login")}`);return}let i=n.data;console.log(zt.green(`Logged in as ${zt.bold(i.login)}`))}catch{console.log(zt.red("\u2717 Failed to verify token")),console.log(`Run: ${B("spectrl login")}`)}}import Qr from"chalk";import{select as Em}from"@inquirer/prompts";async function ka(t){try{let e;try{e=Ae(t)}catch(c){throw new h(`Invalid spec reference: ${c instanceof Error?c.message:String(c)}`,D.VALIDATION_ERROR)}if(!e.isPublic||!e.username)throw new h("Unpublish only works with public specs. Use format: username/spec@version",D.VALIDATION_ERROR);if(!e.version)throw new h(["Version is required for unpublish","",`Usage: spectrl unpublish ${R(`${e.username}/${e.name}@<version>`)}`,"","Example: spectrl unpublish alice/api-spec@1.0.0"].join(`
|
|
261
|
+
`),D.VALIDATION_ERROR);let{username:r,name:s,version:n}=e,i=Nt(r,s,n),a=await new be().get();if(!a)throw new h(`You need to login first to unpublish specs
|
|
262
|
+
|
|
263
|
+
Run: ${B("spectrl login")}`,D.AUTHENTICATION_ERROR);if(A.log(""),A.log(Qr.yellow(`\u26A0\uFE0F This will permanently delete ${R(i)} from the public registry.`)),A.log(""),!await Em({message:"Are you sure you want to continue?",choices:[{name:"No, cancel",value:!1,description:"Keep the spec and abort"},{name:`Yes, delete ${i}`,value:!0,description:"Permanently remove this version from the registry"}],default:!1})){A.log(Qr.dim("Cancelled"));return}A.log(""),A.log(Qr.dim(`Unpublishing ${R(i)}...`));try{let c=await Yo(a,r,s,n);A.log(""),A.log(Qr.green(`\u2713 ${c.message}`)),A.log("")}catch(c){throw c instanceof Y?c.statusCode===401||c.statusCode===403?new h(["Authentication failed","","Your token may have expired or you may not have permission to unpublish this spec.","","Try logging in again: spectrl login"].join(`
|
|
264
|
+
`),D.AUTHENTICATION_ERROR):c.statusCode===404?new h(`Spec version ${R(i)} not found in the registry`,D.DEPENDENCY_ERROR):new h(`Failed to unpublish: ${c.message}`,D.IO_ERROR):c}}catch(e){throw e instanceof h?e:new h(`Unpublish failed: ${e instanceof Error?e.message:String(e)}`,D.IO_ERROR)}}var Ou=Ft(wr(),1),ns=Ft(ks(),1);import X from"chalk";import{promises as Tu}from"node:fs";import nD from"fs-extra";async function Dn(t){try{let e=oe(t),r=await Tu.readFile(e,"utf-8");return JSON.parse(r)}catch(e){throw e.code==="ENOENT"?new h(`Project not initialized
|
|
265
|
+
|
|
266
|
+
Run: ${B("spectrl init")}`,D.VALIDATION_ERROR):new h(`Failed to read project index: ${e instanceof Error?e.message:String(e)}`,D.IO_ERROR)}}async function iD(t){let e=await Dn(t),r=[],s=Object.entries(e).filter(([n,i])=>i.source.startsWith("https://")||i.source.startsWith("http://"));if(s.length===0)return[];for(let[n]of s)try{let i=Ae(n);if(!i.isPublic||!i.username||!i.version)continue;let{username:o,name:a,version:u}=i,c=await xt(o,a);if(c.versions.length===0)continue;let l=c.versions[0].version;ns.default.valid(u)&&ns.default.valid(l)&&ns.default.gt(l,u)&&r.push({specKey:n,username:o,name:a,currentVersion:u,latestVersion:l})}catch{}return r}async function gn(t,e,r,s){let n=await Dn(s),i=Object.keys(n).filter(o=>{let a=Ae(o);return a.isPublic&&a.username===t&&a.name===e});if(await Vs({username:t,name:e,version:r},{cwd:s}),i.length>0){let o=oe(s),a=await Dn(s);for(let u of i){if(u===Nt(t,e,r))continue;delete a[u];let c=Ae(u);if(c.version){let l=Vr(s,t,e,c.version);try{await nD.remove(l)}catch{}}}await Tu.writeFile(o,`${JSON.stringify(a,null,2)}
|
|
267
|
+
`,"utf-8")}}async function Pu(t,e={}){let r=e.cwd||process.cwd();try{if(t)return await oD(t,r);A.log(X.dim(`Checking for updates...
|
|
268
|
+
`));let s=await iD(r);if(s.length===0){A.log(X.green(`\u2713 All specs are up to date
|
|
269
|
+
`));return}A.log(X.bold(`Updates available:
|
|
270
|
+
`));let n=new Ou.default({head:[X.cyan("Spec"),X.cyan("Installed"),X.cyan("Latest")],colWidths:[30,15,15],style:{head:[],border:["dim"]}});for(let{username:i,name:o,currentVersion:a,latestVersion:u}of s)n.push([X.bold(`${i}/${o}`),X.yellow(a),X.green(u)]);if(A.log(n.toString()),A.log(""),A.log(X.dim("Run 'spectrl update <spec>' to update a specific spec")),A.log(X.dim(`Run 'spectrl update --all' to update all specs
|
|
271
|
+
`)),e.all){A.log(X.bold(`Updating all specs...
|
|
272
|
+
`));for(let{username:i,name:o,latestVersion:a}of s)A.log(X.dim(`Updating ${R(`${i}/${o}`)}...`)),await gn(i,o,a,r);A.log(""),A.log(X.green(`\u2713 Updated ${s.length} spec${s.length===1?"":"s"}
|
|
273
|
+
`))}}catch(s){throw s instanceof h?s:new h(`Update failed: ${s instanceof Error?s.message:String(s)}`,D.IO_ERROR)}}async function oD(t,e){try{let r=Ae(t);if(!r.isPublic||!r.username)throw new h("Update only works with public specs. Use format: username/spec or username/spec@version",D.VALIDATION_ERROR);let{username:s,name:n,version:i}=r;if(i){A.log(X.dim(`Updating to ${R(`${s}/${n}@${i}`)}...
|
|
274
|
+
`)),await gn(s,n,i,e),A.log(""),A.log(X.green(`\u2713 Updated to ${R(`${s}/${n}@${i}`)}
|
|
275
|
+
`));return}A.log(X.dim(`Fetching latest version of ${R(`${s}/${n}`)}...
|
|
276
|
+
`));try{let o=await xt(s,n);if(o.versions.length===0)throw new h(`No versions available for ${R(`${s}/${n}`)}`,D.DEPENDENCY_ERROR);let a=o.versions[0].version;A.log(X.dim(`Updating to ${R(`${s}/${n}@${a}`)}...
|
|
277
|
+
`)),await gn(s,n,a,e),A.log(""),A.log(X.green(`\u2713 Updated to ${R(`${s}/${n}@${a}`)}
|
|
278
|
+
`))}catch(o){throw o instanceof Y&&o.statusCode===404?new h(`Spec ${R(`${s}/${n}`)} not found in public registry`,D.DEPENDENCY_ERROR):o}}catch(r){throw r instanceof h?r:new h(`Update failed: ${r instanceof Error?r.message:String(r)}`,D.IO_ERROR)}}var Nu=Ft(wr(),1);import Ce from"chalk";async function Lu(t){if(!t||t.trim().length===0)throw new h("Search query cannot be empty",D.VALIDATION_ERROR);try{let e=await Ho(t.trim());if(e.results.length===0){console.log(Ce.yellow(`
|
|
279
|
+
No specs found`)),console.log(Ce.dim("Try a different search term or browse all specs")),console.log(`Example: ${B("spectrl search api")}
|
|
280
|
+
`);return}let r=e.results.length;console.log(Ce.bold(`
|
|
281
|
+
Found ${r} spec${r===1?"":"s"} matching "${t}":
|
|
282
|
+
`));let s=new Nu.default({head:[Ce.cyan("Spec"),Ce.cyan("Description"),Ce.cyan("Tags"),Ce.cyan("Version")],colWidths:[35,40,18,10],wordWrap:!0,style:{head:[],border:["dim"]}});for(let n of e.results){let i=n.specId||Ce.dim("unknown"),o=n.description||Ce.dim("No description"),a=n.tags&&n.tags.length>0?n.tags.join(", "):Ce.dim("none"),u=n.version||Ce.dim("unknown");s.push([Ce.bold(i),o,a,u])}console.log(s.toString()),console.log(`
|
|
283
|
+
Install with: ${B("spectrl install <spec>")}`),console.log(`Example: ${B("spectrl install alice/api-spec")}
|
|
284
|
+
`)}catch(e){throw e instanceof h?e:e instanceof Error?new h(`Search failed: ${e.message}`,D.IO_ERROR):new h("Unknown error during search",D.IO_ERROR)}}var sc=Ft(wr(),1);import Ke from"chalk";var aD=Math.pow(10,8)*24*60*60*1e3,z0=-aD;var Er=43200,yn=1440;var uD=3600;var ju=uD*24,V0=ju*7,cD=ju*365.2425,lD=cD/12,G0=lD*3,wn=Symbol.for("constructDateFrom");function Ht(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&wn in t?t[wn](e):t instanceof Date?new t.constructor(e):new Date(e)}function le(t,e){return Ht(e||t,t)}var dD={};function Mu(){return dD}function En(t){let e=le(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function Yt(t,...e){let r=Ht.bind(null,t||e.find(s=>typeof s=="object"));return e.map(r)}function Zt(t,e){let r=+le(t)-+le(e);return r<0?-1:r>0?1:r}function Bu(t){return Ht(t,Date.now())}function qu(t,e,r){let[s,n]=Yt(r?.in,t,e),i=s.getFullYear()-n.getFullYear(),o=s.getMonth()-n.getMonth();return i*12+o}function Wu(t){return e=>{let s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function Uu(t,e){return+le(t)-+le(e)}function zu(t,e){let r=le(t,e?.in);return r.setHours(23,59,59,999),r}function Vu(t,e){let r=le(t,e?.in),s=r.getMonth();return r.setFullYear(r.getFullYear(),s+1,0),r.setHours(23,59,59,999),r}function Gu(t,e){let r=le(t,e?.in);return+zu(r,e)==+Vu(r,e)}function Hu(t,e,r){let[s,n,i]=Yt(r?.in,t,t,e),o=Zt(n,i),a=Math.abs(qu(n,i));if(a<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-o*a);let u=Zt(n,i)===-o;Gu(s)&&a===1&&Zt(s,i)===1&&(u=!1);let c=o*(a-+u);return c===0?0:c}function Yu(t,e,r){let s=Uu(t,e)/1e3;return Wu(r?.roundingMethod)(s)}var fD={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Zu=(t,e,r)=>{let s,n=fD[t];return typeof n=="string"?s=n:e===1?s=n.one:s=n.other.replace("{{count}}",e.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function is(t){return(e={})=>{let r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}var pD={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},hD={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},mD={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xu={date:is({formats:pD,defaultWidth:"full"}),time:is({formats:hD,defaultWidth:"full"}),dateTime:is({formats:mD,defaultWidth:"full"})};var DD={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ju=(t,e,r,s)=>DD[t];function Xt(t){return(e,r)=>{let s=r?.context?String(r.context):"standalone",n;if(s==="formatting"&&t.formattingValues){let o=t.defaultFormattingWidth||t.defaultWidth,a=r?.width?String(r.width):o;n=t.formattingValues[a]||t.formattingValues[o]}else{let o=t.defaultWidth,a=r?.width?String(r.width):t.defaultWidth;n=t.values[a]||t.values[o]}let i=t.argumentCallback?t.argumentCallback(e):e;return n[i]}}var gD={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},yD={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wD={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ED={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},xD={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},vD={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},bD=(t,e)=>{let r=Number(t),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Ku={ordinalNumber:bD,era:Xt({values:gD,defaultWidth:"wide"}),quarter:Xt({values:yD,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Xt({values:wD,defaultWidth:"wide"}),day:Xt({values:ED,defaultWidth:"wide"}),dayPeriod:Xt({values:xD,defaultWidth:"wide",formattingValues:vD,defaultFormattingWidth:"wide"})};function Jt(t){return(e,r={})=>{let s=r.width,n=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],i=e.match(n);if(!i)return null;let o=i[0],a=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(a)?FD(a,p=>p.test(o)):CD(a,p=>p.test(o)),c;c=t.valueCallback?t.valueCallback(u):u,c=r.valueCallback?r.valueCallback(c):c;let l=e.slice(o.length);return{value:c,rest:l}}}function CD(t,e){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function FD(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function Qu(t){return(e,r={})=>{let s=e.match(t.matchPattern);if(!s)return null;let n=s[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;let a=e.slice(n.length);return{value:o,rest:a}}}var RD=/^(\d+)(th|st|nd|rd)?/i,SD=/\d+/i,_D={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},AD={any:[/^b/i,/^(a|c)/i]},ID={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},$D={any:[/1/i,/2/i,/3/i,/4/i]},kD={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},OD={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},TD={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},PD={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ND={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},LD={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ec={ordinalNumber:Qu({matchPattern:RD,parsePattern:SD,valueCallback:t=>parseInt(t,10)}),era:Jt({matchPatterns:_D,defaultMatchWidth:"wide",parsePatterns:AD,defaultParseWidth:"any"}),quarter:Jt({matchPatterns:ID,defaultMatchWidth:"wide",parsePatterns:$D,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Jt({matchPatterns:kD,defaultMatchWidth:"wide",parsePatterns:OD,defaultParseWidth:"any"}),day:Jt({matchPatterns:TD,defaultMatchWidth:"wide",parsePatterns:PD,defaultParseWidth:"any"}),dayPeriod:Jt({matchPatterns:ND,defaultMatchWidth:"any",parsePatterns:LD,defaultParseWidth:"any"})};var xn={code:"en-US",formatDistance:Zu,formatLong:Xu,formatRelative:Ju,localize:Ku,match:ec,options:{weekStartsOn:0,firstWeekContainsDate:1}};function tc(t,e,r){let s=Mu(),n=r?.locale??s.locale??xn,i=2520,o=Zt(t,e);if(isNaN(o))throw new RangeError("Invalid time value");let a=Object.assign({},r,{addSuffix:r?.addSuffix,comparison:o}),[u,c]=Yt(r?.in,...o>0?[e,t]:[t,e]),l=Yu(c,u),p=(En(c)-En(u))/1e3,y=Math.round((l-p)/60),d;if(y<2)return r?.includeSeconds?l<5?n.formatDistance("lessThanXSeconds",5,a):l<10?n.formatDistance("lessThanXSeconds",10,a):l<20?n.formatDistance("lessThanXSeconds",20,a):l<40?n.formatDistance("halfAMinute",0,a):l<60?n.formatDistance("lessThanXMinutes",1,a):n.formatDistance("xMinutes",1,a):y===0?n.formatDistance("lessThanXMinutes",1,a):n.formatDistance("xMinutes",y,a);if(y<45)return n.formatDistance("xMinutes",y,a);if(y<90)return n.formatDistance("aboutXHours",1,a);if(y<yn){let m=Math.round(y/60);return n.formatDistance("aboutXHours",m,a)}else{if(y<i)return n.formatDistance("xDays",1,a);if(y<Er){let m=Math.round(y/yn);return n.formatDistance("xDays",m,a)}else if(y<Er*2)return d=Math.round(y/Er),n.formatDistance("aboutXMonths",d,a)}if(d=Hu(c,u),d<12){let m=Math.round(y/Er);return n.formatDistance("xMonths",m,a)}else{let m=d%12,w=Math.trunc(d/12);return m<3?n.formatDistance("aboutXYears",w,a):m<9?n.formatDistance("overXYears",w,a):n.formatDistance("almostXYears",w+1,a)}}function rc(t,e){return tc(t,Bu(t),e)}async function nc(t){let e;try{e=Ae(t)}catch(r){throw r instanceof Error?new h(`Invalid spec reference: ${r.message}`,D.VALIDATION_ERROR):new h("Invalid spec reference format",D.VALIDATION_ERROR)}if(!e.isPublic||!e.username)throw new h("Info command requires a public spec reference (username/spec)",D.VALIDATION_ERROR);try{let r=await xt(e.username,e.name);if(console.log(Ke.bold.cyan(`
|
|
285
|
+
${r.specId}`)),r.versions.length>0&&r.versions[0].description&&console.log(r.versions[0].description),r.versions.length>0&&r.versions[0].tags&&r.versions[0].tags.length>0&&console.log(Ke.dim(`
|
|
286
|
+
Tags: ${r.versions[0].tags.join(", ")}`)),r.versions.length===0)console.log(Ke.yellow(`
|
|
287
|
+
No versions available`));else{console.log(Ke.bold(`
|
|
288
|
+
Versions:`));let s=new sc.default({head:[Ke.cyan("Version"),Ke.cyan("Published"),Ke.cyan("Downloads")],colWidths:[12,30,15],style:{head:[],border:["dim"]}});for(let n of r.versions){let i=new Date(n.publishedAt),o=rc(i,{addSuffix:!0}),a=`${i.toISOString().split("T")[0]} (${o})`,u=n.downloads?.toString()||"0";s.push([Ke.bold(n.version),a,u])}console.log(s.toString())}console.log(`
|
|
289
|
+
Install latest: ${B(`spectrl install ${r.specId}`)}`),console.log(`Install specific: ${B(`spectrl install ${r.specId}@<version>`)}
|
|
290
|
+
`)}catch(r){throw r instanceof h?r:r instanceof Y?r.statusCode===404?new h(`Spec not found: ${e.username}/${e.name}`,D.IO_ERROR):new h(`Failed to get spec info: ${r.message}`,D.IO_ERROR):r instanceof Error?new h(`Failed to get spec info: ${r.message}`,D.IO_ERROR):new h("Unknown error while fetching spec info",D.IO_ERROR)}}var ic=Ft(wr(),1);import Fe from"chalk";import{promises as jD}from"node:fs";async function oc(t={}){let e=t.cwd||process.cwd();try{let r=oe(e);if(!await _e(r))throw new h('Project not initialized. Run "spectrl init" to set up dependency management.',D.VALIDATION_ERROR);let s=await jD.readFile(r,"utf-8"),n=JSON.parse(s),i=Object.entries(n);if(i.length===0){console.log(Fe.yellow(`
|
|
291
|
+
No specs installed`)),console.log(Fe.dim("Install a spec with: spectrl install <spec>")),console.log(Fe.dim(`Example: spectrl install alice/api-spec
|
|
292
|
+
`));return}console.log(Fe.bold(`
|
|
293
|
+
Installed specs:
|
|
294
|
+
`));let o=new ic.default({head:[Fe.cyan("Spec"),Fe.cyan("Version"),Fe.cyan("Source")],colWidths:[35,12,12],style:{head:[],border:["dim"]}});for(let[u,c]of i){let p=c.source.startsWith("https://")||c.source.startsWith("http://")?Fe.blue("public"):Fe.green("local"),y=u.lastIndexOf("@"),d,m;y!==-1?(d=u.substring(0,y),m=u.substring(y+1)):(d=u,m=Fe.dim("unknown")),o.push([Fe.bold(d),m,p])}console.log(o.toString());let a=i.length;console.log(Fe.dim(`
|
|
295
|
+
${a} spec${a===1?"":"s"} installed
|
|
296
|
+
`))}catch(r){throw r instanceof h?r:r instanceof SyntaxError?new h('Project index is corrupted. Try running "spectrl init" to reinitialize.',D.VALIDATION_ERROR):r instanceof Error?new h(`Failed to read project index: ${r.message}`,D.IO_ERROR):new h("Unknown error while listing specs",D.IO_ERROR)}}import{readFileSync as qD}from"node:fs";import{fileURLToPath as WD}from"node:url";import{dirname as UD,join as zD}from"node:path";var VD=UD(WD(import.meta.url)),GD=JSON.parse(qD(zD(VD,"../package.json"),"utf-8")),HD=GD.version,YD=Re({name:"init",description:"Initialize a new project with a local spec index",args:{skipAgents:vn({long:"skip-agents",description:"Skip AGENTS.md creation/update entirely",defaultValue:()=>!1}),forceAgents:vn({long:"force-agents",description:"Force overwrite AGENTS.md with fresh template",defaultValue:()=>!1})},handler:async t=>{await qo(process.cwd(),{skipAgents:t.skipAgents,forceAgents:t.forceAgents})}}),ZD=Re({name:"publish",description:"Publish a spec to the local registry",args:{},handler:async()=>{await Jo(process.cwd())}}),XD=Re({name:"install",description:"Install specs using symlinks to the registry. Creates links from .spectrl/specs/{name}@{version}/ to the registry. On Windows, uses junction points (no admin required). Falls back to file copying if symlinks fail.",args:{specRef:Kt({type:os(Qe),displayName:"spec",description:"Optional spec reference (name@version) to install from registry"})},handler:async t=>{t.specRef?await oa(t.specRef,{cwd:process.cwd()}):await aa({cwd:process.cwd()})}}),JD=Re({name:"new",description:"Create a new spec with a manifest template",args:{name:Kt({type:Qe,displayName:"name",description:"Name of the spec (lowercase alphanumeric with hyphens)"}),version:ac({type:os(Qe),long:"version",description:"Initial version (default: 0.1.0)",defaultValue:()=>"0.1.0"}),description:ac({type:os(Qe),long:"description",description:"Description of the spec"})},handler:async t=>{await ca(t.name,process.cwd(),t.version,t.description)}}),KD=Re({name:"login",description:"Authenticate with GitHub to access the public registry",args:{},handler:async()=>{await Aa()}}),QD=Re({name:"logout",description:"Remove stored GitHub authentication token",args:{},handler:async()=>{await Ia()}}),eg=Re({name:"whoami",description:"Show current authenticated GitHub user",args:{},handler:async()=>{await $a()}}),tg=Re({name:"unpublish",description:"Remove a spec version from the public registry (requires authentication)",args:{specRef:Kt({type:Qe,displayName:"spec",description:"Spec reference in format username/spec@version"})},handler:async t=>{await ka(t.specRef)}}),rg=Re({name:"update",description:"Check for and install updates for public specs",args:{specRef:Kt({type:os(Qe),displayName:"spec",description:"Optional spec reference to update (username/spec or username/spec@version)"}),all:vn({long:"all",description:"Update all specs with available updates",defaultValue:()=>!1})},handler:async t=>{await Pu(t.specRef,{all:t.all,cwd:process.cwd()})}}),sg=Re({name:"search",description:"Search for specs in the public registry",args:{query:Kt({type:Qe,displayName:"query",description:"Search query (keywords, tags, or spec names)"})},handler:async t=>{await Lu(t.query)}}),ng=Re({name:"info",description:"Show detailed information about a spec from the public registry",args:{specRef:Kt({type:Qe,displayName:"spec",description:"Spec reference in format username/spec"})},handler:async t=>{await nc(t.specRef)}}),ig=Re({name:"list",description:"Show all installed specs (local and public)",args:{},handler:async()=>{await oc({cwd:process.cwd()})}}),og=MD({name:"spectrl",description:"Local-first spec registry",version:HD,cmds:{init:YD,new:JD,publish:ZD,install:XD,login:KD,logout:QD,whoami:eg,unpublish:tg,update:rg,search:sg,info:ng,list:ig}});async function ag(){try{await BD(og,process.argv.slice(2))}catch(t){t instanceof h&&(A.error(us(t)),process.exit(t.exitCode)),t instanceof Error&&(A.error(us(t)),process.exit(Cn(t))),A.error("Unknown error occurred"),process.exit(1)}}ag();
|