From c77da84db353482f2eabbd1785ca6f5de1170fde Mon Sep 17 00:00:00 2001 From: Liam Rella Date: Mon, 24 Feb 2025 20:10:52 +1030 Subject: [PATCH] chore: reset cli files --- packages/knip-config/bin/cli.js | 136 +------------------------- packages/remark-config/bin/cli.js | 136 +------------------------- packages/typescript-config/bin/cli.js | 132 +------------------------ 3 files changed, 3 insertions(+), 401 deletions(-) diff --git a/packages/knip-config/bin/cli.js b/packages/knip-config/bin/cli.js index 05d2062..07ff484 100755 --- a/packages/knip-config/bin/cli.js +++ b/packages/knip-config/bin/cli.js @@ -1,136 +1,2 @@ #!/usr/bin/env node -var ms=Object.create;var Fn=Object.defineProperty;var gs=Object.getOwnPropertyDescriptor;var bs=Object.getOwnPropertyNames;var ys=Object.getPrototypeOf,Os=Object.prototype.hasOwnProperty;var Ee=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var ws=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Cs=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of bs(e))!Os.call(i,s)&&s!==t&&Fn(i,s,{get:()=>e[s],enumerable:!(n=gs(e,s))||n.enumerable});return i};var xs=(i,e,t)=>(t=i!=null?ms(ys(i)):{},Cs(e||!i||!i.__esModule?Fn(t,"default",{value:i,enumerable:!0}):t,i));var ns=ws((Uc,ts)=>{"use strict";var Tr=function(e){return Dr(e)&&!Wr(e)};function Dr(i){return!!i&&typeof i=="object"}function Wr(i){var e=Object.prototype.toString.call(i);return e==="[object RegExp]"||e==="[object Date]"||Br(i)}var Lr=typeof Symbol=="function"&&Symbol.for,Ur=Lr?Symbol.for("react.element"):60103;function Br(i){return i.$$typeof===Ur}function zr(i){return Array.isArray(i)?[]:{}}function wt(i,e){return e.clone!==!1&&e.isMergeableObject(i)?ut(zr(i),i,e):i}function Yr(i,e,t){return i.concat(e).map(function(n){return wt(n,t)})}function Gr(i,e){if(!e.customMerge)return ut;var t=e.customMerge(i);return typeof t=="function"?t:ut}function kr(i){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(i).filter(function(e){return Object.propertyIsEnumerable.call(i,e)}):[]}function Xi(i){return Object.keys(i).concat(kr(i))}function es(i,e){try{return e in i}catch{return!1}}function Hr(i,e){return es(i,e)&&!(Object.hasOwnProperty.call(i,e)&&Object.propertyIsEnumerable.call(i,e))}function Vr(i,e,t){var n={};return t.isMergeableObject(i)&&Xi(i).forEach(function(s){n[s]=wt(i[s],t)}),Xi(e).forEach(function(s){Hr(i,s)||(es(i,s)&&t.isMergeableObject(e[s])?n[s]=Gr(s,t)(i[s],e[s],t):n[s]=wt(e[s],t))}),n}function ut(i,e,t){t=t||{},t.arrayMerge=t.arrayMerge||Yr,t.isMergeableObject=t.isMergeableObject||Tr,t.cloneUnlessOtherwiseSpecified=wt;var n=Array.isArray(e),s=Array.isArray(i),r=n===s;return r?n?t.arrayMerge(i,e,t):Vr(i,e,t):wt(e,t)}ut.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(n,s){return ut(n,s,t)},{})};var Kr=ut;ts.exports=Kr});var Nn=(i=0)=>e=>`\x1B[${e+i}m`,Rn=(i=0)=>e=>`\x1B[${38+i};5;${e}m`,Tn=(i=0)=>(e,t,n)=>`\x1B[${38+i};2;${e};${t};${n}m`,q={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},go=Object.keys(q.modifier),_s=Object.keys(q.color),As=Object.keys(q.bgColor),bo=[..._s,...As];function Es(){let i=new Map;for(let[e,t]of Object.entries(q)){for(let[n,s]of Object.entries(t))q[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[n]=q[n],i.set(s[0],s[1]);Object.defineProperty(q,e,{value:t,enumerable:!1})}return Object.defineProperty(q,"codes",{value:i,enumerable:!1}),q.color.close="\x1B[39m",q.bgColor.close="\x1B[49m",q.color.ansi=Nn(),q.color.ansi256=Rn(),q.color.ansi16m=Tn(),q.bgColor.ansi=Nn(10),q.bgColor.ansi256=Rn(10),q.bgColor.ansi16m=Tn(10),Object.defineProperties(q,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(r=>r+r).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>q.rgbToAnsi256(...q.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,s;if(e>=232)t=((e-232)*10+8)/255,n=t,s=t;else{e-=16;let c=e%36;t=Math.floor(e/36)/5,n=Math.floor(c/6)/5,s=c%6/5}let r=Math.max(t,n,s)*2;if(r===0)return 30;let o=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(t));return r===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>q.ansi256ToAnsi(q.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>q.ansi256ToAnsi(q.hexToAnsi256(e)),enumerable:!1}}),q}var js=Es(),_e=js;import qt from"node:process";import Ss from"node:os";import Dn from"node:tty";function de(i,e=globalThis.Deno?globalThis.Deno.args:qt.argv){let t=i.startsWith("-")?"":i.length===1?"-":"--",n=e.indexOf(t+i),s=e.indexOf("--");return n!==-1&&(s===-1||n=2,has16m:i>=3}}function Is(i,{streamIsTTY:e,sniffFlags:t=!0}={}){let n=Ps();n!==void 0&&(_t=n);let s=t?_t:n;if(s===0)return 0;if(t){if(de("color=16m")||de("color=full")||de("color=truecolor"))return 3;if(de("color=256"))return 2}if("TF_BUILD"in X&&"AGENT_NAME"in X)return 1;if(i&&!e&&s===void 0)return 0;let r=s||0;if(X.TERM==="dumb")return r;if(qt.platform==="win32"){let o=Ss.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in X)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in X)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in X)||X.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in X)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(X.TEAMCITY_VERSION)?1:0;if(X.COLORTERM==="truecolor"||X.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in X){let o=Number.parseInt((X.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(X.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(X.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(X.TERM)||"COLORTERM"in X?1:r}function Wn(i,e={}){let t=Is(i,{streamIsTTY:i&&i.isTTY,...e});return Ms(t)}var vs={stdout:Wn({isTTY:Dn.isatty(1)}),stderr:Wn({isTTY:Dn.isatty(2)})},Ln=vs;function Un(i,e,t){let n=i.indexOf(e);if(n===-1)return i;let s=e.length,r=0,o="";do o+=i.slice(r,n)+e+t,r=n+s,n=i.indexOf(e,r);while(n!==-1);return o+=i.slice(r),o}function Bn(i,e,t,n){let s=0,r="";do{let o=i[n-1]==="\r";r+=i.slice(s,o?n-1:n)+e+(o?`\r -`:` -`)+t,s=n+1,n=i.indexOf(` -`,s)}while(n!==-1);return r+=i.slice(s),r}var{stdout:zn,stderr:Yn}=Ln,Jt=Symbol("GENERATOR"),st=Symbol("STYLER"),ht=Symbol("IS_EMPTY"),Gn=["ansi","ansi","ansi256","ansi16m"],rt=Object.create(null),$s=(i,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=zn?zn.level:0;i.level=e.level===void 0?t:e.level};var Fs=i=>{let e=(...t)=>t.join(" ");return $s(e,i),Object.setPrototypeOf(e,dt.prototype),e};function dt(i){return Fs(i)}Object.setPrototypeOf(dt.prototype,Function.prototype);for(let[i,e]of Object.entries(_e))rt[i]={get(){let t=At(this,Zt(e.open,e.close,this[st]),this[ht]);return Object.defineProperty(this,i,{value:t}),t}};rt.visible={get(){let i=At(this,this[st],!0);return Object.defineProperty(this,"visible",{value:i}),i}};var Qt=(i,e,t,...n)=>i==="rgb"?e==="ansi16m"?_e[t].ansi16m(...n):e==="ansi256"?_e[t].ansi256(_e.rgbToAnsi256(...n)):_e[t].ansi(_e.rgbToAnsi(...n)):i==="hex"?Qt("rgb",e,t,..._e.hexToRgb(...n)):_e[t][i](...n),Ns=["rgb","hex","ansi256"];for(let i of Ns){rt[i]={get(){let{level:t}=this;return function(...n){let s=Zt(Qt(i,Gn[t],"color",...n),_e.color.close,this[st]);return At(this,s,this[ht])}}};let e="bg"+i[0].toUpperCase()+i.slice(1);rt[e]={get(){let{level:t}=this;return function(...n){let s=Zt(Qt(i,Gn[t],"bgColor",...n),_e.bgColor.close,this[st]);return At(this,s,this[ht])}}}}var Rs=Object.defineProperties(()=>{},{...rt,level:{enumerable:!0,get(){return this[Jt].level},set(i){this[Jt].level=i}}}),Zt=(i,e,t)=>{let n,s;return t===void 0?(n=i,s=e):(n=t.openAll+i,s=e+t.closeAll),{open:i,close:e,openAll:n,closeAll:s,parent:t}},At=(i,e,t)=>{let n=(...s)=>Ts(n,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(n,Rs),n[Jt]=i,n[st]=e,n[ht]=t,n},Ts=(i,e)=>{if(i.level<=0||!e)return i[ht]?"":e;let t=i[st];if(t===void 0)return e;let{openAll:n,closeAll:s}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=Un(e,t.close,t.open),t=t.parent;let r=e.indexOf(` -`);return r!==-1&&(e=Bn(e,s,n,r)),n+e+s};Object.defineProperties(dt.prototype,rt);var Ds=dt(),So=dt({level:Yn?Yn.level:0});var Fe=Ds;import{cosmiconfig as no}from"cosmiconfig";import{execa as io}from"execa";import ve from"fs-extra";import ls from"node:fs";import Ht from"node:path";import{PassThrough as so}from"node:stream";import{fileURLToPath as ro}from"node:url";import Kn from"node:process";import kn from"node:process";import Ws from"node:fs/promises";import{fileURLToPath as Ls}from"node:url";import Us from"node:fs";import pe from"node:path";var Et=i=>i instanceof URL?Ls(i):i;async function Hn(i,{cwd:e=kn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(Et(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,Et(n??r));s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let c=await Ws.stat(o);if(t==="file"&&c.isFile()||t==="directory"&&c.isDirectory())return o}catch{}s=pe.dirname(s)}}function Vn(i,{cwd:e=kn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(Et(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,Et(n)??r);s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let c=Us.statSync(o,{throwIfNoEntry:!1});if(t==="file"&&c?.isFile()||t==="directory"&&c?.isDirectory())return o}catch{}s=pe.dirname(s)}}async function Xt({cwd:i=Kn.cwd()}={}){return Hn("package.json",{cwd:i})}function qn({cwd:i=Kn.cwd()}={}){return Vn("package.json",{cwd:i})}import{notStrictEqual as ur,strictEqual as hr}from"assert";var Bs={right:Hs,center:Vs},zs=0,jt=1,Ys=2,St=3,en=class{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){let t=this.div(...e);t.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let t=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(t),t}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let t=e.split(` -`).map(s=>s.split(" ")),n=0;return t.forEach(s=>{s.length>1&&le.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),le.stringWidth(s[0])))}),t.forEach(s=>{this.div(...s.map((r,o)=>({text:r.trim(),padding:this.measurePadding(r),width:o===0&&s.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let t=le.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(t=>{this.rowToString(t,e)}),e.filter(t=>!t.hidden).map(t=>t.text).join(` -`)}rowToString(e,t){return this.rasterize(e).forEach((n,s)=>{let r="";n.forEach((o,c)=>{let{width:b}=e[c],y=this.negatePadding(e[c]),m=o;if(y>le.stringWidth(o)&&(m+=" ".repeat(y-le.stringWidth(o))),e[c].align&&e[c].align!=="left"&&this.wrap){let u=Bs[e[c].align];m=u(m,y),le.stringWidth(m)0&&(r=this.renderInline(r,t[t.length-1]))}),t.push({text:r.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){let n=e.match(/^ */),s=n?n[0].length:0,r=t.text,o=le.stringWidth(r.trimRight());return t.span?this.wrap?s{r.width=n[o],this.wrap?s=le.wrap(r.text,this.negatePadding(r),{hard:!0}).split(` -`):s=r.text.split(` -`),r.border&&(s.unshift("."+"-".repeat(this.negatePadding(r)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(r)+2)+"'")),r.padding&&(s.unshift(...new Array(r.padding[zs]||0).fill("")),s.push(...new Array(r.padding[Ys]||0).fill(""))),s.forEach((c,b)=>{t[b]||t.push([]);let y=t[b];for(let m=0;mo.width||le.stringWidth(o.text));let t=e.length,n=this.width,s=e.map(o=>{if(o.width)return t--,n-=o.width,o.width}),r=t?Math.floor(n/t):0;return s.map((o,c)=>o===void 0?Math.max(r,Gs(e[c])):o)}};function Jn(i,e,t){return i.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function Gs(i){let e=i.padding||[],t=1+(e[St]||0)+(e[jt]||0);return i.border?t+4:t}function ks(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Hs(i,e){i=i.trim();let t=le.stringWidth(i);return t=e?i:" ".repeat(e-t>>1)+i}var le;function Qn(i,e){return le=e,new en({width:i?.width||ks(),wrap:i?.wrap})}var Zn=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function tn(i){return i.replace(Zn,"")}function Xn(i,e){let[t,n]=i.match(Zn)||["",""];i=tn(i);let s="";for(let r=0;r[...e].length,stripAnsi:tn,wrap:Xn})}import{dirname as ei,resolve as ti}from"path";import{readdirSync as Ks,statSync as qs}from"fs";function ni(i,e){let t=ti(".",i),n;for(qs(t).isDirectory()||(t=ei(t));;){if(n=e(t,Ks(t)),n)return ti(t,n);if(t=ei(n=t),n===t)break}}import{inspect as dr}from"util";import{readFileSync as pr}from"fs";import{fileURLToPath as mr}from"url";import{format as Zs}from"util";import{normalize as Xs,resolve as er}from"path";function Ye(i){if(i!==i.toLowerCase()&&i!==i.toUpperCase()||(i=i.toLowerCase()),i.indexOf("-")===-1&&i.indexOf("_")===-1)return i;{let t="",n=!1,s=i.match(/^-+/);for(let r=s?s[0].length:0;r0?n+=`${e}${t.charAt(s)}`:n+=o}return n}function Mt(i){return i==null?!1:typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^0[^.]/.test(i)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function ii(i){if(Array.isArray(i))return i.map(o=>typeof o!="string"?o+"":o);i=i.trim();let e=0,t=null,n=null,s=null,r=[];for(let o=0;o{typeof d=="number"&&(p.nargs[l]=d,p.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,d])=>{typeof d=="function"&&(p.coercions[l]=d,p.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){p.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,d])=>{(typeof d=="boolean"||typeof d=="function")&&(p.configs[l]=d)})),ze(n.key,o,n.default,p.arrays),Object.keys(b).forEach(function(l){(p.aliases[l]||[]).forEach(function(d){b[d]=b[l]})});let B=null;xt();let L=[],G=Object.assign(Object.create(null),{_:[]}),$e={};for(let l=0;l=3&&(F(A[1],p.arrays)?l=Ue(l,A[1],s,A[2]):F(A[1],p.nargs)!==!1?l=it(l,A[1],s,A[2]):k(A[1],A[2],!0));else if(d.match(W)&&c["boolean-negation"])A=d.match(W),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],k(h,F(h,p.arrays)?[!1]:!1));else if(d.match(/^--.+/)||!c["short-option-groups"]&&d.match(/^-[^-]+/))A=d.match(/^--?(.+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],F(h,p.arrays)?l=Ue(l,h,s):F(h,p.nargs)!==!1?l=it(l,h,s):(v=s[l+1],v!==void 0&&(!v.match(/^-/)||v.match(R))&&!F(h,p.bools)&&!F(h,p.counts)||/^(true|false)$/.test(v)?(k(h,v),l++):k(h,Z(h))));else if(d.match(/^-.\..+=/))A=d.match(/^-([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=3&&k(A[1],A[2]);else if(d.match(/^-.\..+/)&&!d.match(R))v=s[l+1],A=d.match(/^-(.\..+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],v!==void 0&&!v.match(/^-/)&&!F(h,p.bools)&&!F(h,p.counts)?(k(h,v),l++):k(h,Z(h)));else if(d.match(/^-[^-]+/)&&!d.match(R)){P=d.slice(1,-1).split(""),O=!1;for(let ae=0;ael!=="--"&&l.includes("-")).forEach(l=>{delete G[l]}),c["strip-aliased"]&&[].concat(...Object.keys(o).map(l=>o[l])).forEach(l=>{c["camel-case-expansion"]&&l.includes("-")&&delete G[l.split(".").map(d=>Ye(d)).join(".")],delete G[l]});function we(l){let d=S("_",l);(typeof d=="string"||typeof d=="number")&&G._.push(d)}function it(l,d,x,O){let h,P=F(d,p.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return xe(O)||(B=Error(w("Argument unexpected for: %s",d))),k(d,Z(d)),l;let A=xe(O)?0:1;if(c["nargs-eats-options"])x.length-(l+1)+A0&&(k(d,O),v--),h=l+1;h0||A&&typeof A=="number"&&h.length>=A||(P=x[v],/^-/.test(P)&&!R.test(P)&&!Q(P)));v++)l=v,h.push(_(d,P,r))}return typeof A=="number"&&(A&&h.length1&&c["dot-notation"]&&(p.aliases[h[0]]||[]).forEach(function(P){let A=P.split("."),v=[].concat(h);v.shift(),A=A.concat(v),(p.aliases[l]||[]).includes(A.join("."))||Me(G,A,O)}),F(l,p.normalize)&&!F(l,p.arrays)&&[l].concat(p.aliases[l]||[]).forEach(function(A){Object.defineProperty($e,A,{enumerable:!0,get(){return d},set(v){d=typeof v=="string"?Ie.normalize(v):v}})})}function M(l,d){p.aliases[l]&&p.aliases[l].length||(p.aliases[l]=[d],g[d]=!0),p.aliases[d]&&p.aliases[d].length||M(d,l)}function _(l,d,x){x&&(d=Qs(d)),(F(l,p.bools)||F(l,p.counts))&&typeof d=="string"&&(d=d==="true");let O=Array.isArray(d)?d.map(function(h){return S(l,h)}):S(l,d);return F(l,p.counts)&&(xe(O)||typeof O=="boolean")&&(O=sn()),F(l,p.normalize)&&F(l,p.arrays)&&(Array.isArray(d)?O=d.map(h=>Ie.normalize(h)):O=Ie.normalize(d)),O}function S(l,d){return!c["parse-positional-numbers"]&&l==="_"||!F(l,p.strings)&&!F(l,p.bools)&&!Array.isArray(d)&&(Mt(d)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${d}`)))||!xe(d)&&F(l,p.numbers))&&(d=Number(d)),d}function D(l){let d=Object.create(null);J(d,p.aliases,b),Object.keys(p.configs).forEach(function(x){let O=l[x]||d[x];if(O)try{let h=null,P=Ie.resolve(Ie.cwd(),O),A=p.configs[x];if(typeof A=="function"){try{h=A(P)}catch(v){h=v}if(h instanceof Error){B=h;return}}else h=Ie.require(P);Y(h)}catch(h){h.name==="PermissionDenied"?B=h:l[x]&&(B=Error(w("Invalid JSON config file: %s",O)))}})}function Y(l,d){Object.keys(l).forEach(function(x){let O=l[x],h=d?d+"."+x:x;typeof O=="object"&&O!==null&&!Array.isArray(O)&&c["dot-notation"]?Y(O,h):(!Pe(G,h.split("."))||F(h,p.arrays)&&c["combine-arrays"])&&k(h,O)})}function ie(){typeof y<"u"&&y.forEach(function(l){Y(l)})}function z(l,d){if(typeof m>"u")return;let x=typeof m=="string"?m:"",O=Ie.env();Object.keys(O).forEach(function(h){if(x===""||h.lastIndexOf(x,0)===0){let P=h.split("__").map(function(A,v){return v===0&&(A=A.substring(x.length)),Ye(A)});(d&&p.configs[P.join(".")]||!d)&&!Pe(l,P)&&k(P.join("."),O[h])}})}function se(l){let d,x=new Set;Object.keys(l).forEach(function(O){if(!x.has(O)&&(d=F(O,p.coercions),typeof d=="function"))try{let h=S(O,d(l[O]));[].concat(p.aliases[O]||[],O).forEach(P=>{x.add(P),l[P]=h})}catch(h){B=h}})}function Be(l){return p.keys.forEach(d=>{~d.indexOf(".")||typeof l[d]>"u"&&(l[d]=void 0)}),l}function J(l,d,x,O=!1){Object.keys(x).forEach(function(h){Pe(l,h.split("."))||(Me(l,h.split("."),x[h]),O&&(C[h]=!0),(d[h]||[]).forEach(function(P){Pe(l,P.split("."))||Me(l,P.split("."),x[h])}))})}function Pe(l,d){let x=l;c["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(h){x=x[h]||{}});let O=d[d.length-1];return typeof x!="object"?!1:O in x}function Me(l,d,x){let O=l;c["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(re){re=si(re),typeof O=="object"&&O[re]===void 0&&(O[re]={}),typeof O[re]!="object"||Array.isArray(O[re])?(Array.isArray(O[re])?O[re].push({}):O[re]=[O[re],{}],O=O[re][O[re].length-1]):O=O[re]});let h=si(d[d.length-1]),P=F(d.join("."),p.arrays),A=Array.isArray(x),v=c["duplicate-arguments-array"];!v&&F(h,p.nargs)&&(v=!0,(!xe(O[h])&&p.nargs[h]===1||Array.isArray(O[h])&&O[h].length===p.nargs[h])&&(O[h]=void 0)),x===sn()?O[h]=sn(O[h]):Array.isArray(O[h])?v&&P&&A?O[h]=c["flatten-duplicate-arrays"]?O[h].concat(x):(Array.isArray(O[h][0])?O[h]:[O[h]]).concat([x]):!v&&!!P==!!A?O[h]=x:O[h]=O[h].concat([x]):O[h]===void 0&&P?O[h]=A?x:[x]:v&&!(O[h]===void 0||F(h,p.counts)||F(h,p.bools))?O[h]=[O[h],x]:O[h]=x}function ze(...l){l.forEach(function(d){Object.keys(d||{}).forEach(function(x){p.aliases[x]||(p.aliases[x]=[].concat(o[x]||[]),p.aliases[x].concat(x).forEach(function(O){if(/-/.test(O)&&c["camel-case-expansion"]){let h=Ye(O);h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),g[h]=!0)}}),p.aliases[x].concat(x).forEach(function(O){if(O.length>1&&/[A-Z]/.test(O)&&c["camel-case-expansion"]){let h=Pt(O,"-");h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),g[h]=!0)}}),p.aliases[x].forEach(function(O){p.aliases[O]=[x].concat(p.aliases[x].filter(function(h){return O!==h}))}))})})}function F(l,d){let x=[].concat(p.aliases[l]||[],l),O=Object.keys(d),h=x.find(P=>O.includes(P));return h?d[h]:!1}function Kt(l){let d=Object.keys(p);return[].concat(d.map(O=>p[O])).some(function(O){return Array.isArray(O)?O.includes(l):O[l]})}function $(l,...d){return[].concat(...d).some(function(O){let h=l.match(O);return h&&Kt(h[1])})}function K(l){if(l.match(R)||!l.match(/^-[^-]+/))return!1;let d=!0,x,O=l.slice(1).split("");for(let h=0;hF(l,p.arrays)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):F(l,p.nargs)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},p.aliases),argv:Object.assign($e,G),configuration:c,defaulted:Object.assign({},C),error:B,newAliases:Object.assign({},g)}}};function Js(i){let e=[],t=Object.create(null),n=!0;for(Object.keys(i).forEach(function(s){e.push([].concat(i[s],s))});n;){n=!1;for(let s=0;snr,format:Zs,normalize:Xs,resolve:er,require:i=>{if(typeof Ee<"u")return Ee(i);if(i.match(/\.json$/))return JSON.parse(tr(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),pt=function(e,t){return ai.parse(e.slice(),t).argv};pt.detailed=function(i,e){return ai.parse(i.slice(),e)};pt.camelCase=Ye;pt.decamelize=Pt;pt.looksLikeNumber=Mt;var cn=pt;import{basename as gr,dirname as br,extname as yr,relative as Or,resolve as di}from"path";function ci(){return ir()?0:1}function ir(){return sr()&&!process.defaultApp}function sr(){return!!process.versions.electron}function ln(i){return i.slice(ci()+1)}function li(){return process.argv[ci()]}var H=class i extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,i)}};import{readFileSync as rr,statSync as or,writeFile as ar}from"fs";import{format as cr}from"util";import{resolve as lr}from"path";var fi={fs:{readFileSync:rr,writeFile:ar},format:cr,resolve:lr,exists:i=>{try{return or(i).isFile()}catch{return!1}}};var Ae,fn=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let t=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ae.format.apply(Ae.format,[this.cache[this.locale][t]||t].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),s=e.shift(),r=function(){};typeof e[e.length-1]=="function"&&(r=e.pop()),this.cache[this.locale]||this._readLocaleFile();let o=s===1?t:n;this.cache[this.locale][t]&&(o=this.cache[this.locale][t][s===1?"one":"other"]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r();let c=[o];return~o.indexOf("%d")&&c.push(s),Ae.format.apply(Ae.format,c.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.cache[this.locale][t]=e[t])}_taggedLiteral(e,...t){let n="";return e.forEach(function(s,r){let o=t[r+1];n+=s,typeof o<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,t=this.writeQueue[0],n=t.directory,s=t.locale,r=t.cb,o=this._resolveLocaleFile(n,s),c=JSON.stringify(this.cache[s],null,2);Ae.fs.writeFile(o,c,"utf-8",function(b){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),r(b)})}_readLocaleFile(){let e={},t=this._resolveLocaleFile(this.directory,this.locale);try{Ae.fs.readFileSync&&(e=JSON.parse(Ae.fs.readFileSync(t,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+t),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=Ae.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){let s=Ae.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(e){return Ae.exists(e)}};function ui(i,e){Ae=e;let t=new fn(i);return{__:t.__.bind(t),__n:t.__n.bind(t),setLocale:t.setLocale.bind(t),getLocale:t.getLocale.bind(t),updateLocale:t.updateLocale.bind(t),locale:t.locale}}var fr=i=>ui(i,fi),hi=fr;var wr="require is not supported by ESM",pi="loading a directory of commands is not supported yet for ESM",mt;try{mt=mr(import.meta.url)}catch{mt=process.cwd()}var Cr=mt.substring(0,mt.lastIndexOf("node_modules")),un={assert:{notStrictEqual:ur,strictEqual:hr},cliui:nn,findUp:ni,getEnv:i=>process.env[i],inspect:dr,getCallerFile:()=>{throw new H(pi)},getProcessArgvBin:li,mainFilename:Cr||process.cwd(),Parser:cn,path:{basename:gr,dirname:br,extname:yr,relative:Or,resolve:di},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(i,e)=>process.emitWarning(i,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:pr,require:()=>{throw new H(wr)},requireDirectory:()=>{throw new H(pi)},stringWidth:i=>[...i].length,y18n:hi({directory:di(mt,"../../../locales"),updateFiles:!1})};function ce(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function hn(i,e){e.assert.strictEqual(typeof i,"string")}function ot(i){return Object.keys(i)}function V(i){return!!i&&!!i.then&&typeof i.then=="function"}function Ne(i){let t=i.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=t.shift();if(!s)throw new Error(`No command found in: ${i}`);let r={cmd:s.replace(n,""),demanded:[],optional:[]};return t.forEach((o,c)=>{let b=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&c===t.length-1&&(b=!0),/^\[/.test(o)?r.optional.push({cmd:o.replace(n,"").split("|"),variadic:b}):r.demanded.push({cmd:o.replace(n,"").split("|"),variadic:b})}),r}var xr=["first","second","third","fourth","fifth","sixth"];function E(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[Ne(`cmd ${i}`),e,t]}try{let s=0,[r,o,c]=n(),b=[].slice.call(o);for(;b.length&&b[b.length-1]===void 0;)b.pop();let y=c||b.length;if(ym)throw new H(`Too many arguments provided. Expected max ${m} but received ${y}.`);r.demanded.forEach(f=>{let u=b.shift(),g=mi(u);f.cmd.filter(w=>w===g||w==="*").length===0&&gi(g,f.cmd,s),s+=1}),r.optional.forEach(f=>{if(b.length===0)return;let u=b.shift(),g=mi(u);f.cmd.filter(w=>w===g||w==="*").length===0&&gi(g,f.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function mi(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function gi(i,e,t){throw new H(`Invalid ${xr[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}var vt=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,s=!1){if(E(" [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let r=0;r{let r=[...n[t]||[],t];return s.option?!r.includes(s.option):!0}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function bi(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Ge(i,e,t,n){return t.reduce((s,r)=>{if(r.applyBeforeValidation!==n)return s;if(r.mutates){if(r.applied)return s;r.applied=!0}if(V(s))return s.then(o=>Promise.all([o,r(o,e)])).then(([o,c])=>Object.assign(o,c));{let o=r(s,e);return V(o)?o.then(c=>Object.assign(s,c)):Object.assign(s,o)}},i)}function ke(i,e,t=n=>{throw n}){try{let n=_r(i)?i():i;return V(n)?n.then(s=>e(s)):e(n)}catch(n){return t(n)}}function _r(i){return typeof i=="function"}function dn(i){if(typeof Ee>"u")return null;for(let e=0,t=Object.keys(Ee.cache),n;eo;s.visit=(o,c,b)=>{let y=r(o,c,b);if(y){if(this.requireCache.has(c))return y;this.requireCache.add(c),this.addHandler(y)}return y},this.shim.requireDirectory({require:t,filename:n},e,s)}addHandler(e,t,n,s,r,o){let c=[],b=bi(r);if(s=s||(()=>{}),Array.isArray(e))if(Ar(e))[e,...c]=e;else for(let y of e)this.addHandler(y);else if(jr(e)){let y=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(y=[].concat(y).concat(e.aliases)),this.addHandler(y,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(yi(n)){this.addHandler([e].concat(c),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let y=Ne(e);c=c.map(u=>Ne(u).cmd);let m=!1,f=[y.cmd].concat(c).filter(u=>at.test(u)?(m=!0,!1):!0);f.length===0&&m&&f.push("$0"),m&&(y.cmd=f[0],c=f.slice(1),e=e.replace(at,y.cmd)),c.forEach(u=>{this.aliasMap[u]=y.cmd}),t!==!1&&this.usage.command(e,t,m,c,o),this.handlers[y.cmd]={original:e,description:t,handler:s,builder:n||{},middlewares:b,deprecated:o,demanded:y.demanded,optional:y.optional},m&&(this.defaultCommand=this.handlers[y.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,s,r,o){let c=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,b=t.getInternalMethods().getContext(),y=b.commands.slice(),m=!e;e&&(b.commands.push(e),b.fullCommands.push(c.original));let f=this.applyBuilderUpdateUsageAndParse(m,c,t,n.aliases,y,s,r,o);return V(f)?f.then(u=>this.applyMiddlewareAndGetResult(m,c,u.innerArgv,b,r,u.aliases,t)):this.applyMiddlewareAndGetResult(m,c,f.innerArgv,b,r,f.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,s,r,o,c,b){let y=t.builder,m=n;if($t(y)){n.getInternalMethods().getUsageInstance().freeze();let f=y(n.getInternalMethods().reset(s),b);if(V(f))return f.then(u=>(m=wi(u)?u:n,this.parseAndUpdateUsage(e,t,m,r,o,c)))}else Er(y)&&(n.getInternalMethods().getUsageInstance().freeze(),m=n.getInternalMethods().reset(s),Object.keys(t.builder).forEach(f=>{m.option(f,y[f])}));return this.parseAndUpdateUsage(e,t,m,r,o,c)}parseAndUpdateUsage(e,t,n,s,r,o){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,t),t.description);let c=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,r,o);return V(c)?c.then(b=>({aliases:n.parsed.aliases,innerArgv:b})):{aliases:n.parsed.aliases,innerArgv:c}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){let n=at.test(t.original)?t.original.replace(at,"").trim():t.original,s=e.filter(r=>!at.test(r));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(e,t,n,s,r,o,c,b){if(!o.getInternalMethods().getHasOutput()){let y=o.getInternalMethods().runValidation(r,b,o.parsed.error,e);n=ke(n,m=>(y(m),m))}if(t.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let y=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,y,!1,!1),n=Ge(n,o,c,!1),n=ke(n,m=>{let f=t.handler(m);return V(f)?f.then(()=>m):m}),e||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),V(n)&&!o.getInternalMethods().hasParseCallback()&&n.catch(m=>{try{o.getInternalMethods().getUsageInstance().fail(null,m)}catch{}})}return e||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,s,r,o,c){let b={};if(r)return n;c.getInternalMethods().getHasOutput()||(b=this.populatePositionals(t,n,s,c));let y=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),m=Ge(n,c,y,!0);return V(m)?m.then(f=>this.handleValidationAndGetResult(e,t,f,s,o,c,y,b)):this.handleValidationAndGetResult(e,t,m,s,o,c,y,b)}populatePositionals(e,t,n,s){t._=t._.slice(n.commands.length);let r=e.demanded.slice(0),o=e.optional.slice(0),c={};for(this.validation.positionalCount(r.length,t._.length);r.length;){let b=r.shift();this.populatePositional(b,t,c)}for(;o.length;){let b=o.shift();this.populatePositional(b,t,c)}return t._=n.commands.concat(t._.map(b=>""+b)),this.postProcessPositionals(t,c,this.cmdToParseOptions(e.original),s),c}populatePositional(e,t,n){let s=e.cmd[0];e.variadic?n[s]=t._.splice(0).map(String):t._.length&&(n[s]=[String(t._.shift())])}cmdToParseOptions(e){let t={array:[],default:{},alias:{},demand:{}},n=Ne(e);return n.demanded.forEach(s=>{let[r,...o]=s.cmd;s.variadic&&(t.array.push(r),t.default[r]=[]),t.alias[r]=o,t.demand[r]=!0}),n.optional.forEach(s=>{let[r,...o]=s.cmd;s.variadic&&(t.array.push(r),t.default[r]=[]),t.alias[r]=o}),t}postProcessPositionals(e,t,n,s){let r=Object.assign({},s.getOptions());r.default=Object.assign(n.default,r.default);for(let y of Object.keys(n.alias))r.alias[y]=(r.alias[y]||[]).concat(n.alias[y]);r.array=r.array.concat(n.array),r.config={};let o=[];if(Object.keys(t).forEach(y=>{t[y].map(m=>{r.configuration["unknown-options-as-args"]&&(r.key[y]=!0),o.push(`--${y}`),o.push(m)})}),!o.length)return;let c=Object.assign({},r.configuration,{"populate--":!1}),b=this.shim.Parser.detailed(o,Object.assign({},r,{configuration:c}));if(b.error)s.getInternalMethods().getUsageInstance().fail(b.error.message,b.error);else{let y=Object.keys(t);Object.keys(t).forEach(m=>{y.push(...b.aliases[m])}),Object.keys(b.argv).forEach(m=>{y.includes(m)&&(t[m]||(t[m]=b.argv[m]),!this.isInConfigs(s,m)&&!this.isDefaulted(s,m)&&Object.prototype.hasOwnProperty.call(e,m)&&Object.prototype.hasOwnProperty.call(b.argv,m)&&(Array.isArray(e[m])||Array.isArray(b.argv[m]))?e[m]=[].concat(e[m],b.argv[m]):e[m]=b.argv[m])})}}isDefaulted(e,t){let{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){let{configObjects:n}=e.getOptions();return n.some(s=>Object.prototype.hasOwnProperty.call(s,t))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=at.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let t=this.defaultCommand.builder;if($t(t))return t(e,!0);yi(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){let t=dn(e);if(!t)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(t.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:t,desc:n}){for(let s of[e,t,n]){if(typeof s=="string"||s===!1)return s;ce(s,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();ce(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function Oi(i,e,t,n){return new pn(i,e,t,n)}function yi(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function Ar(i){return i.every(e=>typeof e=="string")}function $t(i){return typeof i=="function"}function Er(i){return typeof i=="object"}function jr(i){return typeof i=="object"&&!Array.isArray(i)}function Re(i={},e=()=>!0){let t={};return ot(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function Te(i){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(i)})}function Sr(i){return typeof i=="boolean"}function xi(i,e){let t=e.y18n.__,n={},s=[];n.failFn=function(_){s.push(_)};let r=null,o=null,c=!0;n.showHelpOnFail=function(_=!0,S){let[D,Y]=typeof _=="string"?[!0,_]:[_,S];return i.getInternalMethods().isGlobalContext()&&(o=Y),r=Y,c=D,n};let b=!1;n.fail=function(_,S){let D=i.getInternalMethods().getLoggerInstance();if(s.length)for(let Y=s.length-1;Y>=0;--Y){let ie=s[Y];if(Sr(ie)){if(S)throw S;if(_)throw Error(_)}else ie(_,S,n)}else{if(i.getExitProcess()&&Te(!0),!b){b=!0,c&&(i.showHelp("error"),D.error()),(_||S)&&D.error(_||S);let Y=r||o;Y&&((_||S)&&D.error(""),D.error(Y))}if(S=S||new H(_),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,S);throw S}};let y=[],m=!1;n.usage=(M,_)=>M===null?(m=!0,y=[],n):(m=!1,y.push([M,_||""]),n),n.getUsage=()=>y,n.getUsageDisabled=()=>m,n.getPositionalGroupName=()=>t("Positionals:");let f=[];n.example=(M,_)=>{f.push([M,_||""])};let u=[];n.command=function(_,S,D,Y,ie=!1){D&&(u=u.map(z=>(z[2]=!1,z))),u.push([_,S||"",D,Y,ie])},n.getCommands=()=>u;let g={};n.describe=function(_,S){Array.isArray(_)?_.forEach(D=>{n.describe(D,S)}):typeof _=="object"?Object.keys(_).forEach(D=>{n.describe(D,_[D])}):g[_]=S},n.getDescriptions=()=>g;let C=[];n.epilog=M=>{C.push(M)};let w=!1,p;n.wrap=M=>{w=!0,p=M},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(w||(p=it(),w=!0),p);let R="__yargsString__:";n.deferY18nLookup=M=>R+M,n.help=function(){if(L)return L;B();let _=i.customScriptName?i.$0:e.path.basename(i.$0),S=i.getDemandedOptions(),D=i.getDemandedCommands(),Y=i.getDeprecatedOptions(),ie=i.getGroups(),z=i.getOptions(),se=[];se=se.concat(Object.keys(g)),se=se.concat(Object.keys(S)),se=se.concat(Object.keys(D)),se=se.concat(Object.keys(z.default)),se=se.filter($e),se=Object.keys(se.reduce(($,K)=>(K!=="_"&&($[K]=!0),$),{}));let Be=n.getWrap(),J=e.cliui({width:Be,wrap:!!Be});if(!m){if(y.length)y.forEach($=>{J.div({text:`${$[0].replace(/\$0/g,_)}`}),$[1]&&J.div({text:`${$[1]}`,padding:[1,0,0,0]})}),J.div();else if(u.length){let $=null;D._?$=`${_} <${t("command")}> -`:$=`${_} [${t("command")}] -`,J.div(`${$}`)}}if(u.length>1||u.length===1&&!u[0][2]){J.div(t("Commands:"));let $=i.getInternalMethods().getContext(),K=$.commands.length?`${$.commands.join(" ")} `:"";i.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(u=u.sort((U,Z)=>U[0].localeCompare(Z[0])));let Q=_?`${_} `:"";u.forEach(U=>{let Z=`${Q}${K}${U[0].replace(/^\$0 ?/,"")}`;J.span({text:Z,padding:[0,2,0,2],width:W(u,Be,`${_}${K}`)+4},{text:U[1]});let te=[];U[2]&&te.push(`[${t("default")}]`),U[3]&&U[3].length&&te.push(`[${t("aliases:")} ${U[3].join(", ")}]`),U[4]&&(typeof U[4]=="string"?te.push(`[${t("deprecated: %s",U[4])}]`):te.push(`[${t("deprecated")}]`)),te.length?J.div({text:te.join(" "),padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}let Pe=(Object.keys(z.alias)||[]).concat(Object.keys(i.parsed.newAliases)||[]);se=se.filter($=>!i.parsed.newAliases[$]&&Pe.every(K=>(z.alias[K]||[]).indexOf($)===-1));let Me=t("Options:");ie[Me]||(ie[Me]=[]),G(se,z.alias,ie,Me);let ze=$=>/^--/.test(Ft($)),F=Object.keys(ie).filter($=>ie[$].length>0).map($=>{let K=ie[$].filter($e).map(Q=>{if(Pe.includes(Q))return Q;for(let U=0,Z;(Z=Pe[U])!==void 0;U++)if((z.alias[Z]||[]).includes(Q))return Z;return Q});return{groupName:$,normalizedKeys:K}}).filter(({normalizedKeys:$})=>$.length>0).map(({groupName:$,normalizedKeys:K})=>{let Q=K.reduce((U,Z)=>(U[Z]=[Z].concat(z.alias[Z]||[]).map(te=>$===n.getPositionalGroupName()?te:(/^[0-9]$/.test(te)?z.boolean.includes(Z)?"-":"--":te.length>1?"--":"-")+te).sort((te,Ce)=>ze(te)===ze(Ce)?0:ze(te)?1:-1).join(", "),U),{});return{groupName:$,normalizedKeys:K,switches:Q}});if(F.filter(({groupName:$})=>$!==n.getPositionalGroupName()).some(({normalizedKeys:$,switches:K})=>!$.every(Q=>ze(K[Q])))&&F.filter(({groupName:$})=>$!==n.getPositionalGroupName()).forEach(({normalizedKeys:$,switches:K})=>{$.forEach(Q=>{ze(K[Q])&&(K[Q]=Pr(K[Q],4))})}),F.forEach(({groupName:$,normalizedKeys:K,switches:Q})=>{J.div($),K.forEach(U=>{let Z=Q[U],te=g[U]||"",Ce=null;te.includes(R)&&(te=t(te.substring(R.length))),z.boolean.includes(U)&&(Ce=`[${t("boolean")}]`),z.count.includes(U)&&(Ce=`[${t("count")}]`),z.string.includes(U)&&(Ce=`[${t("string")}]`),z.normalize.includes(U)&&(Ce=`[${t("string")}]`),z.array.includes(U)&&(Ce=`[${t("array")}]`),z.number.includes(U)&&(Ce=`[${t("number")}]`);let xe=d=>typeof d=="string"?`[${t("deprecated: %s",d)}]`:`[${t("deprecated")}]`,xt=[U in Y?xe(Y[U]):null,Ce,U in S?`[${t("required")}]`:null,z.choices&&z.choices[U]?`[${t("choices:")} ${n.stringifiedValues(z.choices[U])}]`:null,we(z.default[U],z.defaultDescription[U])].filter(Boolean).join(" ");J.span({text:Ft(Z),padding:[0,2,0,2+Ci(Z)],width:W(Q,Be)+4},te);let l=i.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;xt&&!l?J.div({text:xt,padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}),f.length&&(J.div(t("Examples:")),f.forEach($=>{$[0]=$[0].replace(/\$0/g,_)}),f.forEach($=>{$[1]===""?J.div({text:$[0],padding:[0,2,0,2]}):J.div({text:$[0],padding:[0,2,0,2],width:W(f,Be)+4},{text:$[1]})}),J.div()),C.length>0){let $=C.map(K=>K.replace(/\$0/g,_)).join(` -`);J.div(`${$} -`)}return J.toString().replace(/\s*$/,"")};function W(M,_,S){let D=0;return Array.isArray(M)||(M=Object.values(M).map(Y=>[Y])),M.forEach(Y=>{D=Math.max(e.stringWidth(S?`${S} ${Ft(Y[0])}`:Ft(Y[0]))+Ci(Y[0]),D)}),_&&(D=Math.min(D,parseInt((_*.5).toString(),10))),D}function B(){let M=i.getDemandedOptions(),_=i.getOptions();(Object.keys(_.alias)||[]).forEach(S=>{_.alias[S].forEach(D=>{g[D]&&n.describe(S,g[D]),D in M&&i.demandOption(S,M[D]),_.boolean.includes(D)&&i.boolean(S),_.count.includes(D)&&i.count(S),_.string.includes(D)&&i.string(S),_.normalize.includes(D)&&i.normalize(S),_.array.includes(D)&&i.array(S),_.number.includes(D)&&i.number(S)})})}let L;n.cacheHelpMessage=function(){L=this.help()},n.clearCachedHelpMessage=function(){L=void 0},n.hasCachedHelpMessage=function(){return!!L};function G(M,_,S,D){let Y=[],ie=null;return Object.keys(S).forEach(z=>{Y=Y.concat(S[z])}),M.forEach(z=>{ie=[z].concat(_[z]),ie.some(se=>Y.indexOf(se)!==-1)||S[D].push(z)}),Y}function $e(M){return i.getOptions().hiddenOptions.indexOf(M)<0||i.parsed.argv[i.getOptions().showHiddenOpt]}n.showHelp=M=>{let _=i.getInternalMethods().getLoggerInstance();M||(M="error"),(typeof M=="function"?M:_[M])(n.help())},n.functionDescription=M=>["(",M.name?e.Parser.decamelize(M.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(_,S){let D="",Y=S||", ",ie=[].concat(_);return!_||!ie.length||ie.forEach(z=>{D.length&&(D+=Y),D+=JSON.stringify(z)}),D};function we(M,_){let S=`[${t("default:")} `;if(M===void 0&&!_)return null;if(_)S+=_;else switch(typeof M){case"string":S+=`"${M}"`;break;case"object":S+=JSON.stringify(M);break;default:S+=M}return`${S}]`}function it(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let Ue=null;n.version=M=>{Ue=M},n.showVersion=M=>{let _=i.getInternalMethods().getLoggerInstance();M||(M="error"),(typeof M=="function"?M:_[M])(Ue)},n.reset=function(_){return r=null,b=!1,y=[],m=!1,C=[],f=[],u=[],g=Re(g,S=>!_[S]),n};let k=[];return n.freeze=function(){k.push({failMessage:r,failureOutput:b,usages:y,usageDisabled:m,epilogs:C,examples:f,commands:u,descriptions:g})},n.unfreeze=function(_=!1){let S=k.pop();S&&(_?(g={...S.descriptions,...g},u=[...S.commands,...u],y=[...S.usages,...y],f=[...S.examples,...f],C=[...S.epilogs,...C]):{failMessage:r,failureOutput:b,usages:y,usageDisabled:m,epilogs:C,examples:f,commands:u,descriptions:g}=S)},n}function mn(i){return typeof i=="object"}function Pr(i,e){return mn(i)?{text:i.text,indentation:i.indentation+e}:{text:i,indentation:e}}function Ci(i){return mn(i)?i.indentation:0}function Ft(i){return mn(i)?i.text:i}var _i=`###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc -# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local cur_word args type_list - - cur_word="\${COMP_WORDS[COMP_CWORD]}" - args=("\${COMP_WORDS[@]}") - - # ask yargs to generate completions. - type_list=$({{app_path}} --get-yargs-completions "\${args[@]}") - - COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) ) - - # if no match was found, fall back to filename completion - if [ \${#COMPREPLY[@]} -eq 0 ]; then - COMPREPLY=() - fi - - return 0 -} -complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`,Ai=`#compdef {{app_name}} -###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc -# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local reply - local si=$IFS - IFS=$' -' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}")) - IFS=$si - _describe 'values' reply -} -compdef _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`;var gn=class{constructor(e,t,n,s){var r,o,c;this.yargs=e,this.usage=t,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(c=((r=this.shim.getEnv("SHELL"))===null||r===void 0?void 0:r.includes("zsh"))||((o=this.shim.getEnv("ZSH_NAME"))===null||o===void 0?void 0:o.includes("zsh")))!==null&&c!==void 0?c:!1}defaultCompletion(e,t,n,s){let r=this.command.getCommandHandlers();for(let c=0,b=e.length;c{let o=Ne(r[0]).cmd;if(t.indexOf(o)===-1)if(!this.zshShell)e.push(o);else{let c=r[1]||"";e.push(o.replace(/:/g,"\\:")+":"+c)}})}optionCompletions(e,t,n,s){if((s.match(/^-/)||s===""&&e.length===0)&&!this.previousArgHasChoices(t)){let r=this.yargs.getOptions(),o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(r.key).forEach(c=>{let b=!!r.configuration["boolean-negation"]&&r.boolean.includes(c);!o.includes(c)&&!r.hiddenOptions.includes(c)&&!this.argsContainKey(t,c,b)&&this.completeOptionKey(c,e,s,b&&!!r.default[c])})}}choicesFromOptionsCompletions(e,t,n,s){if(this.previousArgHasChoices(t)){let r=this.getPreviousArgChoices(t);r&&r.length>0&&e.push(...r.map(o=>o.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,s){if(s===""&&e.length>0&&this.previousArgHasChoices(t))return;let r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],o=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),c=r[n._.length-o-1];if(!c)return;let b=this.yargs.getOptions().choices[c]||[];for(let y of b)y.startsWith(s)&&e.push(y.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n="";if(!t.startsWith("-")&&e.length>1&&(n=t,t=e[e.length-2]),!t.startsWith("-"))return;let s=t.replace(/^-+/,""),r=this.yargs.getOptions(),o=[s,...this.yargs.getAliases()[s]||[]],c;for(let b of o)if(Object.prototype.hasOwnProperty.call(r.key,b)&&Array.isArray(r.choices[b])){c=r.choices[b];break}if(c)return c.filter(b=>!n||b.startsWith(n))}previousArgHasChoices(e){let t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){let s=r=>e.indexOf((/^[^0-9]$/.test(r)?"-":"--")+r)!==-1;if(s(t)||n&&s(`no-${t}`))return!0;if(this.aliases){for(let r of this.aliases[t])if(s(r))return!0}return!1}completeOptionKey(e,t,n,s){var r,o,c,b;let y=e;if(this.zshShell){let g=this.usage.getDescriptions(),C=(o=(r=this===null||this===void 0?void 0:this.aliases)===null||r===void 0?void 0:r[e])===null||o===void 0?void 0:o.find(R=>{let W=g[R];return typeof W=="string"&&W.length>0}),w=C?g[C]:void 0,p=(b=(c=g[e])!==null&&c!==void 0?c:w)!==null&&b!==void 0?b:"";y=`${e.replace(/:/g,"\\:")}:${p.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let m=g=>/^--/.test(g),f=g=>/^[^0-9]$/.test(g),u=!m(n)&&f(e)?"-":"--";t.push(u+y),s&&t.push(u+"no-"+y)}customCompletion(e,t,n,s){if(ce(this.customCompletionFunction,null,this.shim),Ir(this.customCompletionFunction)){let r=this.customCompletionFunction(n,t);return V(r)?r.then(o=>{this.shim.process.nextTick(()=>{s(null,o)})}).catch(o=>{this.shim.process.nextTick(()=>{s(o,void 0)})}):s(null,r)}else return vr(this.customCompletionFunction)?this.customCompletionFunction(n,t,(r=s)=>this.defaultCompletion(e,t,n,r),r=>{s(null,r)}):this.customCompletionFunction(n,t,r=>{s(null,r)})}getCompletion(e,t){let n=e.length?e[e.length-1]:"",s=this.yargs.parse(e,!0),r=this.customCompletionFunction?o=>this.customCompletion(e,o,n,t):o=>this.defaultCompletion(e,o,n,t);return V(s)?s.then(r):r(s)}generateCompletionScript(e,t){let n=this.zshShell?Ai:_i,s=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,s),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function Ei(i,e,t,n){return new gn(i,e,t,n)}function Ir(i){return i.length<3}function vr(i){return i.length>3}function ji(i,e){if(i.length===0)return e.length;if(e.length===0)return i.length;let t=[],n;for(n=0;n<=e.length;n++)t[n]=[n];let s;for(s=0;s<=i.length;s++)t[0][s]=s;for(n=1;n<=e.length;n++)for(s=1;s<=i.length;s++)e.charAt(n-1)===i.charAt(s-1)?t[n][s]=t[n-1][s-1]:n>1&&s>1&&e.charAt(n-2)===i.charAt(s-1)&&e.charAt(n-1)===i.charAt(s-2)?t[n][s]=t[n-2][s-2]+1:t[n][s]=Math.min(t[n-1][s-1]+1,Math.min(t[n][s-1]+1,t[n-1][s]+1));return t[e.length][i.length]}var Si=["$0","--","_"];function Pi(i,e,t){let n=t.y18n.__,s=t.y18n.__n,r={};r.nonOptionCount=function(f){let u=i.getDemandedCommands(),C=f._.length+(f["--"]?f["--"].length:0)-i.getInternalMethods().getContext().commands.length;u._&&(Cu._.max)&&(Cu._.max&&(u._.maxMsg!==void 0?e.fail(u._.maxMsg?u._.maxMsg.replace(/\$0/g,C.toString()).replace(/\$1/,u._.max.toString()):null):e.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",C,C.toString(),u._.max.toString()))))},r.positionalCount=function(f,u){u"u")&&(g=g||{},g[C]=u[C]);if(g){let C=[];for(let p of Object.keys(g)){let R=g[p];R&&C.indexOf(R)<0&&C.push(R)}let w=C.length?` -${C.join(` -`)}`:"";e.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(g).length,Object.keys(g).join(", ")+w))}},r.unknownArguments=function(f,u,g,C,w=!0){var p;let R=i.getInternalMethods().getCommandInstance().getCommands(),W=[],B=i.getInternalMethods().getContext();if(Object.keys(f).forEach(L=>{!Si.includes(L)&&!Object.prototype.hasOwnProperty.call(g,L)&&!Object.prototype.hasOwnProperty.call(i.getInternalMethods().getParseContext(),L)&&!r.isValidAndSomeAliasIsNotNew(L,u)&&W.push(L)}),w&&(B.commands.length>0||R.length>0||C)&&f._.slice(B.commands.length).forEach(L=>{R.includes(""+L)||W.push(""+L)}),w){let G=((p=i.getDemandedCommands()._)===null||p===void 0?void 0:p.max)||0,$e=B.commands.length+G;$e{we=String(we),!B.commands.includes(we)&&!W.includes(we)&&W.push(we)})}W.length&&e.fail(s("Unknown argument: %s","Unknown arguments: %s",W.length,W.map(L=>L.trim()?L:`"${L}"`).join(", ")))},r.unknownCommands=function(f){let u=i.getInternalMethods().getCommandInstance().getCommands(),g=[],C=i.getInternalMethods().getContext();return(C.commands.length>0||u.length>0)&&f._.slice(C.commands.length).forEach(w=>{u.includes(""+w)||g.push(""+w)}),g.length>0?(e.fail(s("Unknown command: %s","Unknown commands: %s",g.length,g.join(", "))),!0):!1},r.isValidAndSomeAliasIsNotNew=function(f,u){if(!Object.prototype.hasOwnProperty.call(u,f))return!1;let g=i.parsed.newAliases;return[f,...u[f]].some(C=>!Object.prototype.hasOwnProperty.call(g,C)||!g[f])},r.limitedChoices=function(f){let u=i.getOptions(),g={};if(!Object.keys(u.choices).length)return;Object.keys(f).forEach(p=>{Si.indexOf(p)===-1&&Object.prototype.hasOwnProperty.call(u.choices,p)&&[].concat(f[p]).forEach(R=>{u.choices[p].indexOf(R)===-1&&R!==void 0&&(g[p]=(g[p]||[]).concat(R))})});let C=Object.keys(g);if(!C.length)return;let w=n("Invalid values:");C.forEach(p=>{w+=` - ${n("Argument: %s, Given: %s, Choices: %s",p,e.stringifiedValues(g[p]),e.stringifiedValues(u.choices[p]))}`}),e.fail(w)};let o={};r.implies=function(f,u){E(" [array|number|string]",[f,u],arguments.length),typeof f=="object"?Object.keys(f).forEach(g=>{r.implies(g,f[g])}):(i.global(f),o[f]||(o[f]=[]),Array.isArray(u)?u.forEach(g=>r.implies(f,g)):(ce(u,void 0,t),o[f].push(u)))},r.getImplied=function(){return o};function c(m,f){let u=Number(f);return f=isNaN(u)?f:u,typeof f=="number"?f=m._.length>=f:f.match(/^--no-.+/)?(f=f.match(/^--no-(.+)/)[1],f=!Object.prototype.hasOwnProperty.call(m,f)):f=Object.prototype.hasOwnProperty.call(m,f),f}r.implications=function(f){let u=[];if(Object.keys(o).forEach(g=>{let C=g;(o[g]||[]).forEach(w=>{let p=C,R=w;p=c(f,p),w=c(f,w),p&&!w&&u.push(` ${C} -> ${R}`)})}),u.length){let g=`${n("Implications failed:")} -`;u.forEach(C=>{g+=C}),e.fail(g)}};let b={};r.conflicts=function(f,u){E(" [array|string]",[f,u],arguments.length),typeof f=="object"?Object.keys(f).forEach(g=>{r.conflicts(g,f[g])}):(i.global(f),b[f]||(b[f]=[]),Array.isArray(u)?u.forEach(g=>r.conflicts(f,g)):b[f].push(u))},r.getConflicting=()=>b,r.conflicting=function(f){Object.keys(f).forEach(u=>{b[u]&&b[u].forEach(g=>{g&&f[u]!==void 0&&f[g]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",u,g))})}),i.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(b).forEach(u=>{b[u].forEach(g=>{g&&f[t.Parser.camelCase(u)]!==void 0&&f[t.Parser.camelCase(g)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",u,g))})})},r.recommendCommands=function(f,u){u=u.sort((p,R)=>R.length-p.length);let C=null,w=1/0;for(let p=0,R;(R=u[p])!==void 0;p++){let W=ji(f,R);W<=3&&W!f[u]),b=Re(b,u=>!f[u]),r};let y=[];return r.freeze=function(){y.push({implied:o,conflicting:b})},r.unfreeze=function(){let f=y.pop();ce(f,void 0,t),{implied:o,conflicting:b}=f},r}var bn=[],gt;function bt(i,e,t,n){gt=n;let s={};if(Object.prototype.hasOwnProperty.call(i,"extends")){if(typeof i.extends!="string")return s;let r=/\.json|\..*rc$/.test(i.extends),o=null;if(r)o=Fr(e,i.extends);else try{o=Ee.resolve(i.extends)}catch{return i}$r(o),bn.push(o),s=r?JSON.parse(gt.readFileSync(o,"utf8")):Ee(i.extends),delete i.extends,s=bt(s,gt.path.dirname(o),t,gt)}return bn=[],t?Mi(s,i):Object.assign({},s,i)}function $r(i){if(bn.indexOf(i)>-1)throw new H(`Circular extended configurations: '${i}'.`)}function Fr(i,e){return gt.path.resolve(i,e)}function Mi(i,e){let t={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(t,i);for(let s of Object.keys(e))n(e[s])&&n(t[s])?t[s]=Mi(i[s],e[s]):t[s]=e[s];return t}var j=function(i,e,t,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!s:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(i,t):s?s.value=t:e.set(i,t),t},a=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},ne,He,yt,ge,fe,Nt,De,Ve,Rt,be,Tt,ye,je,ue,Oe,Dt,ct,oe,I,Wt,Lt,he,Ke,lt,qe,We,Ut,N,Je,Qe,Ze,T,Bt,Se,ee;function qi(i){return(e=[],t=i.process.cwd(),n)=>{let s=new Pn(e,t,n,i);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}var Ii=Symbol("copyDoubleDash"),vi=Symbol("copyDoubleDash"),yn=Symbol("deleteFromParserHintObject"),$i=Symbol("emitWarning"),Fi=Symbol("freeze"),Ni=Symbol("getDollarZero"),Xe=Symbol("getParserConfiguration"),Ri=Symbol("getUsageConfiguration"),On=Symbol("guessLocale"),Ti=Symbol("guessVersion"),Di=Symbol("parsePositionalNumbers"),wn=Symbol("pkgUp"),Le=Symbol("populateParserHintArray"),ft=Symbol("populateParserHintSingleValueDictionary"),Cn=Symbol("populateParserHintArrayDictionary"),xn=Symbol("populateParserHintDictionary"),_n=Symbol("sanitizeKey"),An=Symbol("setKey"),En=Symbol("unfreeze"),Wi=Symbol("validateAsync"),Li=Symbol("getCommandInstance"),Ui=Symbol("getContext"),Bi=Symbol("getHasOutput"),zi=Symbol("getLoggerInstance"),Yi=Symbol("getParseContext"),Gi=Symbol("getUsageInstance"),ki=Symbol("getValidationInstance"),zt=Symbol("hasParseCallback"),Hi=Symbol("isGlobalContext"),et=Symbol("postProcess"),Vi=Symbol("rebase"),jn=Symbol("reset"),Ot=Symbol("runYargsParserAndExecuteCommands"),Sn=Symbol("runValidation"),Ki=Symbol("setHasOutput"),tt=Symbol("kTrackManuallySetKeys"),Pn=class{constructor(e=[],t,n,s){this.customScriptName=!1,this.parsed=!1,ne.set(this,void 0),He.set(this,void 0),yt.set(this,{commands:[],fullCommands:[]}),ge.set(this,null),fe.set(this,null),Nt.set(this,"show-hidden"),De.set(this,null),Ve.set(this,!0),Rt.set(this,{}),be.set(this,!0),Tt.set(this,[]),ye.set(this,void 0),je.set(this,{}),ue.set(this,!1),Oe.set(this,null),Dt.set(this,!0),ct.set(this,void 0),oe.set(this,""),I.set(this,void 0),Wt.set(this,void 0),Lt.set(this,{}),he.set(this,null),Ke.set(this,null),lt.set(this,{}),qe.set(this,{}),We.set(this,void 0),Ut.set(this,!1),N.set(this,void 0),Je.set(this,!1),Qe.set(this,!1),Ze.set(this,!1),T.set(this,void 0),Bt.set(this,{}),Se.set(this,null),ee.set(this,void 0),j(this,N,s,"f"),j(this,We,e,"f"),j(this,He,t,"f"),j(this,Wt,n,"f"),j(this,ye,new vt(this),"f"),this.$0=this[Ni](),this[jn](),j(this,ne,a(this,ne,"f"),"f"),j(this,T,a(this,T,"f"),"f"),j(this,ee,a(this,ee,"f"),"f"),j(this,I,a(this,I,"f"),"f"),a(this,I,"f").showHiddenOpt=a(this,Nt,"f"),j(this,ct,this[vi](),"f")}addHelpOpt(e,t){let n="help";return E("[string|boolean] [string]",[e,t],arguments.length),a(this,Oe,"f")&&(this[yn](a(this,Oe,"f")),j(this,Oe,null,"f")),e===!1&&t===void 0?this:(j(this,Oe,typeof e=="string"?e:n,"f"),this.boolean(a(this,Oe,"f")),this.describe(a(this,Oe,"f"),t||a(this,T,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(E("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;let n=typeof e=="string"?e:a(this,Nt,"f");return this.boolean(n),this.describe(n,t||a(this,T,"f").deferY18nLookup("Show hidden options")),a(this,I,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return E(" [string|array]",[e,t],arguments.length),this[Cn](this.alias.bind(this),"alias",e,t),this}array(e){return E("",[e],arguments.length),this[Le]("array",e),this[tt](e),this}boolean(e){return E("",[e],arguments.length),this[Le]("boolean",e),this[tt](e),this}check(e,t){return E(" [boolean]",[e,t],arguments.length),this.middleware((n,s)=>ke(()=>e(n,s.getOptions()),r=>(r?(typeof r=="string"||r instanceof Error)&&a(this,T,"f").fail(r.toString(),r):a(this,T,"f").fail(a(this,N,"f").y18n.__("Argument check failed: %s",e.toString())),n),r=>(a(this,T,"f").fail(r.message?r.message:r.toString(),r),n)),!1,t),this}choices(e,t){return E(" [string|array]",[e,t],arguments.length),this[Cn](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(E(" [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new H("coerce callback must be provided");for(let n of e)this.coerce(n,t);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!t)throw new H("coerce callback must be provided");return a(this,I,"f").key[e]=!0,a(this,ye,"f").addCoerceMiddleware((n,s)=>{let r;return Object.prototype.hasOwnProperty.call(n,e)?ke(()=>(r=s.getAliases(),t(n[e])),c=>{n[e]=c;let b=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[e]&&b!==!0)for(let y of r[e])n[y]=c;return n},c=>{throw new H(c.message)}):n},e),this}conflicts(e,t){return E(" [string|array]",[e,t],arguments.length),a(this,ee,"f").conflicts(e,t),this}config(e="config",t,n){return E("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=bt(e,a(this,He,"f"),this[Xe]()["deep-merge-config"]||!1,a(this,N,"f")),a(this,I,"f").configObjects=(a(this,I,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||a(this,T,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(s=>{a(this,I,"f").config[s]=n||!0}),this)}completion(e,t,n){return E("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),j(this,fe,e||a(this,fe,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(a(this,fe,"f"),t),n&&a(this,ge,"f").registerFunction(n),this}command(e,t,n,s,r,o){return E(" [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,s,r,o],arguments.length),a(this,ne,"f").addHandler(e,t,n,s,r,o),this}commands(e,t,n,s,r,o){return this.command(e,t,n,s,r,o)}commandDir(e,t){E(" [object]",[e,t],arguments.length);let n=a(this,Wt,"f")||a(this,N,"f").require;return a(this,ne,"f").addDirectory(e,n,a(this,N,"f").getCallerFile(),t),this}count(e){return E("",[e],arguments.length),this[Le]("count",e),this[tt](e),this}default(e,t,n){return E(" [*] [string]",[e,t,n],arguments.length),n&&(hn(e,a(this,N,"f")),a(this,I,"f").defaultDescription[e]=n),typeof t=="function"&&(hn(e,a(this,N,"f")),a(this,I,"f").defaultDescription[e]||(a(this,I,"f").defaultDescription[e]=a(this,T,"f").functionDescription(t)),t=t.call()),this[ft](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,s){return E("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,s],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),a(this,I,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:s},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(s=>{ce(n,!0,a(this,N,"f")),this.demandOption(s,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(ce(n,!0,a(this,N,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(s=>{ce(n,!0,a(this,N,"f")),this.demandOption(s,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return E(" [string]",[e,t],arguments.length),this[ft](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return E(" [string|boolean]",[e,t],arguments.length),a(this,I,"f").deprecatedOptions[e]=t,this}describe(e,t){return E(" [string]",[e,t],arguments.length),this[An](e,!0),a(this,T,"f").describe(e,t),this}detectLocale(e){return E("",[e],arguments.length),j(this,Ve,e,"f"),this}env(e){return E("[string|boolean]",[e],arguments.length),e===!1?delete a(this,I,"f").envPrefix:a(this,I,"f").envPrefix=e||"",this}epilogue(e){return E("",[e],arguments.length),a(this,T,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return E(" [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):a(this,T,"f").example(e,t),this}exit(e,t){j(this,ue,!0,"f"),j(this,De,t,"f"),a(this,be,"f")&&a(this,N,"f").process.exit(e)}exitProcess(e=!0){return E("[boolean]",[e],arguments.length),j(this,be,e,"f"),this}fail(e){if(E("",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new H("Invalid first argument. Expected function or boolean 'false'");return a(this,T,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return E(" [function]",[e,t],arguments.length),t?a(this,ge,"f").getCompletion(e,t):new Promise((n,s)=>{a(this,ge,"f").getCompletion(e,(r,o)=>{r?s(r):n(o)})})}getDemandedOptions(){return E([],0),a(this,I,"f").demandedOptions}getDemandedCommands(){return E([],0),a(this,I,"f").demandedCommands}getDeprecatedOptions(){return E([],0),a(this,I,"f").deprecatedOptions}getDetectLocale(){return a(this,Ve,"f")}getExitProcess(){return a(this,be,"f")}getGroups(){return Object.assign({},a(this,je,"f"),a(this,qe,"f"))}getHelp(){if(j(this,ue,!0,"f"),!a(this,T,"f").hasCachedHelpMessage()){if(!this.parsed){let t=this[Ot](a(this,We,"f"),void 0,void 0,0,!0);if(V(t))return t.then(()=>a(this,T,"f").help())}let e=a(this,ne,"f").runDefaultBuilderOn(this);if(V(e))return e.then(()=>a(this,T,"f").help())}return Promise.resolve(a(this,T,"f").help())}getOptions(){return a(this,I,"f")}getStrict(){return a(this,Je,"f")}getStrictCommands(){return a(this,Qe,"f")}getStrictOptions(){return a(this,Ze,"f")}global(e,t){return E(" [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?a(this,I,"f").local=a(this,I,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{a(this,I,"f").local.includes(n)||a(this,I,"f").local.push(n)}),this}group(e,t){E(" ",[e,t],arguments.length);let n=a(this,qe,"f")[t]||a(this,je,"f")[t];a(this,qe,"f")[t]&&delete a(this,qe,"f")[t];let s={};return a(this,je,"f")[t]=(n||[]).concat(e).filter(r=>s[r]?!1:s[r]=!0),this}hide(e){return E("",[e],arguments.length),a(this,I,"f").hiddenOptions.push(e),this}implies(e,t){return E(" [number|string|array]",[e,t],arguments.length),a(this,ee,"f").implies(e,t),this}locale(e){return E("[string]",[e],arguments.length),e===void 0?(this[On](),a(this,N,"f").y18n.getLocale()):(j(this,Ve,!1,"f"),a(this,N,"f").y18n.setLocale(e),this)}middleware(e,t,n){return a(this,ye,"f").addMiddleware(e,!!t,n)}nargs(e,t){return E(" [number]",[e,t],arguments.length),this[ft](this.nargs.bind(this),"narg",e,t),this}normalize(e){return E("",[e],arguments.length),this[Le]("normalize",e),this}number(e){return E("",[e],arguments.length),this[Le]("number",e),this[tt](e),this}option(e,t){if(E(" [object]",[e,t],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof t!="object"&&(t={}),this[tt](e),a(this,Se,"f")&&(e==="version"||t?.alias==="version")&&this[$i](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(` -`),void 0,"versionWarning"),a(this,I,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);let n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);let s=t.demand||t.required||t.require;s&&this.demand(e,s),t.demandOption&&this.demandOption(e,typeof t.demandOption=="string"?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),"default"in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type==="boolean")&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type==="array")&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type==="number")&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type==="string")&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type==="count")&&this.count(e),typeof t.global=="boolean"&&this.global(e,t.global),t.defaultDescription&&(a(this,I,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);let r=t.describe||t.description||t.desc,o=a(this,T,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(o,e)||typeof r=="string")&&this.describe(e,r),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){E("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[Fi](),typeof e>"u"&&(e=a(this,We,"f")),typeof t=="object"&&(j(this,Ke,t,"f"),t=n),typeof t=="function"&&(j(this,he,t,"f"),t=!1),t||j(this,We,e,"f"),a(this,he,"f")&&j(this,be,!1,"f");let s=this[Ot](e,!!t),r=this.parsed;return a(this,ge,"f").setParsed(this.parsed),V(s)?s.then(o=>(a(this,he,"f")&&a(this,he,"f").call(this,a(this,De,"f"),o,a(this,oe,"f")),o)).catch(o=>{throw a(this,he,"f")&&a(this,he,"f")(o,this.parsed.argv,a(this,oe,"f")),o}).finally(()=>{this[En](),this.parsed=r}):(a(this,he,"f")&&a(this,he,"f").call(this,a(this,De,"f"),s,a(this,oe,"f")),this[En](),this.parsed=r,s)}parseAsync(e,t,n){let s=this.parse(e,t,n);return V(s)?s:Promise.resolve(s)}parseSync(e,t,n){let s=this.parse(e,t,n);if(V(s))throw new H(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(e){return E("",[e],arguments.length),j(this,Lt,e,"f"),this}pkgConf(e,t){E(" [string]",[e,t],arguments.length);let n=null,s=this[wn](t||a(this,He,"f"));return s[e]&&typeof s[e]=="object"&&(n=bt(s[e],t||a(this,He,"f"),this[Xe]()["deep-merge-config"]||!1,a(this,N,"f")),a(this,I,"f").configObjects=(a(this,I,"f").configObjects||[]).concat(n)),this}positional(e,t){E(" ",[e,t],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=Re(t,(o,c)=>o==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(o));let s=a(this,yt,"f").fullCommands[a(this,yt,"f").fullCommands.length-1],r=s?a(this,ne,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return ot(r).forEach(o=>{let c=r[o];Array.isArray(c)?c.indexOf(e)!==-1&&(t[o]=!0):c[e]&&!(o in t)&&(t[o]=c[e])}),this.group(e,a(this,T,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return E("[boolean]",[e],arguments.length),j(this,Ut,e,"f"),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){return E(" [number]",[e],arguments.length),typeof e=="string"&&a(this,I,"f").narg[e]?this:(this[ft](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return E("[string] [string]",[e,t],arguments.length),e=e||this.$0,a(this,ct,"f").log(a(this,ge,"f").generateCompletionScript(e,t||a(this,fe,"f")||"completion")),this}showHelp(e){if(E("[string|function]",[e],arguments.length),j(this,ue,!0,"f"),!a(this,T,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Ot](a(this,We,"f"),void 0,void 0,0,!0);if(V(n))return n.then(()=>{a(this,T,"f").showHelp(e)}),this}let t=a(this,ne,"f").runDefaultBuilderOn(this);if(V(t))return t.then(()=>{a(this,T,"f").showHelp(e)}),this}return a(this,T,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return E("[boolean|string] [string]",[e,t],arguments.length),a(this,T,"f").showHelpOnFail(e,t),this}showVersion(e){return E("[string|function]",[e],arguments.length),a(this,T,"f").showVersion(e),this}skipValidation(e){return E("",[e],arguments.length),this[Le]("skipValidation",e),this}strict(e){return E("[boolean]",[e],arguments.length),j(this,Je,e!==!1,"f"),this}strictCommands(e){return E("[boolean]",[e],arguments.length),j(this,Qe,e!==!1,"f"),this}strictOptions(e){return E("[boolean]",[e],arguments.length),j(this,Ze,e!==!1,"f"),this}string(e){return E("",[e],arguments.length),this[Le]("string",e),this[tt](e),this}terminalWidth(){return E([],0),a(this,N,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return E("",[e],arguments.length),j(this,Ve,!1,"f"),a(this,N,"f").y18n.updateLocale(e),this}usage(e,t,n,s){if(E(" [string|boolean] [function|object] [function]",[e,t,n,s],arguments.length),t!==void 0){if(ce(e,null,a(this,N,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,s);throw new H(".usage() description must start with $0 if being used as alias for .command()")}else return a(this,T,"f").usage(e),this}usageConfiguration(e){return E("",[e],arguments.length),j(this,Bt,e,"f"),this}version(e,t,n){let s="version";if(E("[boolean|string] [string] [string]",[e,t,n],arguments.length),a(this,Se,"f")&&(this[yn](a(this,Se,"f")),a(this,T,"f").version(void 0),j(this,Se,null,"f")),arguments.length===0)n=this[Ti](),e=s;else if(arguments.length===1){if(e===!1)return this;n=e,e=s}else arguments.length===2&&(n=t,t=void 0);return j(this,Se,typeof e=="string"?e:s,"f"),t=t||a(this,T,"f").deferY18nLookup("Show version number"),a(this,T,"f").version(n||void 0),this.boolean(a(this,Se,"f")),this.describe(a(this,Se,"f"),t),this}wrap(e){return E("",[e],arguments.length),a(this,T,"f").wrap(e),this}[(ne=new WeakMap,He=new WeakMap,yt=new WeakMap,ge=new WeakMap,fe=new WeakMap,Nt=new WeakMap,De=new WeakMap,Ve=new WeakMap,Rt=new WeakMap,be=new WeakMap,Tt=new WeakMap,ye=new WeakMap,je=new WeakMap,ue=new WeakMap,Oe=new WeakMap,Dt=new WeakMap,ct=new WeakMap,oe=new WeakMap,I=new WeakMap,Wt=new WeakMap,Lt=new WeakMap,he=new WeakMap,Ke=new WeakMap,lt=new WeakMap,qe=new WeakMap,We=new WeakMap,Ut=new WeakMap,N=new WeakMap,Je=new WeakMap,Qe=new WeakMap,Ze=new WeakMap,T=new WeakMap,Bt=new WeakMap,Se=new WeakMap,ee=new WeakMap,Ii)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[vi](){return{log:(...e)=>{this[zt]()||console.log(...e),j(this,ue,!0,"f"),a(this,oe,"f").length&&j(this,oe,a(this,oe,"f")+` -`,"f"),j(this,oe,a(this,oe,"f")+e.join(" "),"f")},error:(...e)=>{this[zt]()||console.error(...e),j(this,ue,!0,"f"),a(this,oe,"f").length&&j(this,oe,a(this,oe,"f")+` -`,"f"),j(this,oe,a(this,oe,"f")+e.join(" "),"f")}}}[yn](e){ot(a(this,I,"f")).forEach(t=>{if((s=>s==="configObjects")(t))return;let n=a(this,I,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete a(this,T,"f").getDescriptions()[e]}[$i](e,t,n){a(this,Rt,"f")[n]||(a(this,N,"f").process.emitWarning(e,t),a(this,Rt,"f")[n]=!0)}[Fi](){a(this,Tt,"f").push({options:a(this,I,"f"),configObjects:a(this,I,"f").configObjects.slice(0),exitProcess:a(this,be,"f"),groups:a(this,je,"f"),strict:a(this,Je,"f"),strictCommands:a(this,Qe,"f"),strictOptions:a(this,Ze,"f"),completionCommand:a(this,fe,"f"),output:a(this,oe,"f"),exitError:a(this,De,"f"),hasOutput:a(this,ue,"f"),parsed:this.parsed,parseFn:a(this,he,"f"),parseContext:a(this,Ke,"f")}),a(this,T,"f").freeze(),a(this,ee,"f").freeze(),a(this,ne,"f").freeze(),a(this,ye,"f").freeze()}[Ni](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,N,"f").process.argv()[0])?t=a(this,N,"f").process.argv().slice(1,2):t=a(this,N,"f").process.argv().slice(0,1),e=t.map(n=>{let s=this[Vi](a(this,He,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length{if(c.includes("package.json"))return"package.json"});ce(r,void 0,a(this,N,"f")),n=JSON.parse(a(this,N,"f").readFileSync(r,"utf8"))}catch{}return a(this,lt,"f")[t]=n||{},a(this,lt,"f")[t]}[Le](e,t){t=[].concat(t),t.forEach(n=>{n=this[_n](n),a(this,I,"f")[e].push(n)})}[ft](e,t,n,s){this[xn](e,t,n,s,(r,o,c)=>{a(this,I,"f")[r][o]=c})}[Cn](e,t,n,s){this[xn](e,t,n,s,(r,o,c)=>{a(this,I,"f")[r][o]=(a(this,I,"f")[r][o]||[]).concat(c)})}[xn](e,t,n,s,r){if(Array.isArray(n))n.forEach(o=>{e(o,s)});else if((o=>typeof o=="object")(n))for(let o of ot(n))e(o,n[o]);else r(t,this[_n](n),s)}[_n](e){return e==="__proto__"?"___proto___":e}[An](e,t){return this[ft](this[An].bind(this),"key",e,t),this}[En](){var e,t,n,s,r,o,c,b,y,m,f,u;let g=a(this,Tt,"f").pop();ce(g,void 0,a(this,N,"f"));let C;e=this,t=this,n=this,s=this,r=this,o=this,c=this,b=this,y=this,m=this,f=this,u=this,{options:{set value(w){j(e,I,w,"f")}}.value,configObjects:C,exitProcess:{set value(w){j(t,be,w,"f")}}.value,groups:{set value(w){j(n,je,w,"f")}}.value,output:{set value(w){j(s,oe,w,"f")}}.value,exitError:{set value(w){j(r,De,w,"f")}}.value,hasOutput:{set value(w){j(o,ue,w,"f")}}.value,parsed:this.parsed,strict:{set value(w){j(c,Je,w,"f")}}.value,strictCommands:{set value(w){j(b,Qe,w,"f")}}.value,strictOptions:{set value(w){j(y,Ze,w,"f")}}.value,completionCommand:{set value(w){j(m,fe,w,"f")}}.value,parseFn:{set value(w){j(f,he,w,"f")}}.value,parseContext:{set value(w){j(u,Ke,w,"f")}}.value}=g,a(this,I,"f").configObjects=C,a(this,T,"f").unfreeze(),a(this,ee,"f").unfreeze(),a(this,ne,"f").unfreeze(),a(this,ye,"f").unfreeze()}[Wi](e,t){return ke(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[Li].bind(this),getContext:this[Ui].bind(this),getHasOutput:this[Bi].bind(this),getLoggerInstance:this[zi].bind(this),getParseContext:this[Yi].bind(this),getParserConfiguration:this[Xe].bind(this),getUsageConfiguration:this[Ri].bind(this),getUsageInstance:this[Gi].bind(this),getValidationInstance:this[ki].bind(this),hasParseCallback:this[zt].bind(this),isGlobalContext:this[Hi].bind(this),postProcess:this[et].bind(this),reset:this[jn].bind(this),runValidation:this[Sn].bind(this),runYargsParserAndExecuteCommands:this[Ot].bind(this),setHasOutput:this[Ki].bind(this)}}[Li](){return a(this,ne,"f")}[Ui](){return a(this,yt,"f")}[Bi](){return a(this,ue,"f")}[zi](){return a(this,ct,"f")}[Yi](){return a(this,Ke,"f")||{}}[Gi](){return a(this,T,"f")}[ki](){return a(this,ee,"f")}[zt](){return!!a(this,he,"f")}[Hi](){return a(this,Dt,"f")}[et](e,t,n,s){return n||V(e)||(t||(e=this[Ii](e)),(this[Xe]()["parse-positional-numbers"]||this[Xe]()["parse-positional-numbers"]===void 0)&&(e=this[Di](e)),s&&(e=Ge(e,this,a(this,ye,"f").getMiddleware(),!1))),e}[jn](e={}){j(this,I,a(this,I,"f")||{},"f");let t={};t.local=a(this,I,"f").local||[],t.configObjects=a(this,I,"f").configObjects||[];let n={};t.local.forEach(o=>{n[o]=!0,(e[o]||[]).forEach(c=>{n[c]=!0})}),Object.assign(a(this,qe,"f"),Object.keys(a(this,je,"f")).reduce((o,c)=>{let b=a(this,je,"f")[c].filter(y=>!(y in n));return b.length>0&&(o[c]=b),o},{})),j(this,je,{},"f");let s=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],r=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return s.forEach(o=>{t[o]=(a(this,I,"f")[o]||[]).filter(c=>!n[c])}),r.forEach(o=>{t[o]=Re(a(this,I,"f")[o],c=>!n[c])}),t.envPrefix=a(this,I,"f").envPrefix,j(this,I,t,"f"),j(this,T,a(this,T,"f")?a(this,T,"f").reset(n):xi(this,a(this,N,"f")),"f"),j(this,ee,a(this,ee,"f")?a(this,ee,"f").reset(n):Pi(this,a(this,T,"f"),a(this,N,"f")),"f"),j(this,ne,a(this,ne,"f")?a(this,ne,"f").reset():Oi(a(this,T,"f"),a(this,ee,"f"),a(this,ye,"f"),a(this,N,"f")),"f"),a(this,ge,"f")||j(this,ge,Ei(this,a(this,T,"f"),a(this,ne,"f"),a(this,N,"f")),"f"),a(this,ye,"f").reset(),j(this,fe,null,"f"),j(this,oe,"","f"),j(this,De,null,"f"),j(this,ue,!1,"f"),this.parsed=!1,this}[Vi](e,t){return a(this,N,"f").path.relative(e,t)}[Ot](e,t,n,s=0,r=!1){let o=!!n||r;e=e||a(this,We,"f"),a(this,I,"f").__=a(this,N,"f").y18n.__,a(this,I,"f").configuration=this[Xe]();let c=!!a(this,I,"f").configuration["populate--"],b=Object.assign({},a(this,I,"f").configuration,{"populate--":!0}),y=a(this,N,"f").Parser.detailed(e,Object.assign({},a(this,I,"f"),{configuration:{"parse-positional-numbers":!1,...b}})),m=Object.assign(y.argv,a(this,Ke,"f")),f,u=y.aliases,g=!1,C=!1;Object.keys(m).forEach(w=>{w===a(this,Oe,"f")&&m[w]?g=!0:w===a(this,Se,"f")&&m[w]&&(C=!0)}),m.$0=this.$0,this.parsed=y,s===0&&a(this,T,"f").clearCachedHelpMessage();try{if(this[On](),t)return this[et](m,c,!!n,!1);a(this,Oe,"f")&&[a(this,Oe,"f")].concat(u[a(this,Oe,"f")]||[]).filter(B=>B.length>1).includes(""+m._[m._.length-1])&&(m._.pop(),g=!0),j(this,Dt,!1,"f");let w=a(this,ne,"f").getCommands(),p=a(this,ge,"f").completionKey in m,R=g||p||r;if(m._.length){if(w.length){let W;for(let B=s||0,L;m._[B]!==void 0;B++)if(L=String(m._[B]),w.includes(L)&&L!==a(this,fe,"f")){let G=a(this,ne,"f").runCommand(L,this,y,B+1,r,g||C||r);return this[et](G,c,!!n,!1)}else if(!W&&L!==a(this,fe,"f")){W=L;break}!a(this,ne,"f").hasDefaultCommand()&&a(this,Ut,"f")&&W&&!R&&a(this,ee,"f").recommendCommands(W,w)}a(this,fe,"f")&&m._.includes(a(this,fe,"f"))&&!p&&(a(this,be,"f")&&Te(!0),this.showCompletionScript(),this.exit(0))}if(a(this,ne,"f").hasDefaultCommand()&&!R){let W=a(this,ne,"f").runCommand(null,this,y,0,r,g||C||r);return this[et](W,c,!!n,!1)}if(p){a(this,be,"f")&&Te(!0),e=[].concat(e);let W=e.slice(e.indexOf(`--${a(this,ge,"f").completionKey}`)+1);return a(this,ge,"f").getCompletion(W,(B,L)=>{if(B)throw new H(B.message);(L||[]).forEach(G=>{a(this,ct,"f").log(G)}),this.exit(0)}),this[et](m,!c,!!n,!1)}if(a(this,ue,"f")||(g?(a(this,be,"f")&&Te(!0),o=!0,this.showHelp("log"),this.exit(0)):C&&(a(this,be,"f")&&Te(!0),o=!0,a(this,T,"f").showVersion("log"),this.exit(0))),!o&&a(this,I,"f").skipValidation.length>0&&(o=Object.keys(m).some(W=>a(this,I,"f").skipValidation.indexOf(W)>=0&&m[W]===!0)),!o){if(y.error)throw new H(y.error.message);if(!p){let W=this[Sn](u,{},y.error);n||(f=Ge(m,this,a(this,ye,"f").getMiddleware(),!0)),f=this[Wi](W,f??m),V(f)&&!n&&(f=f.then(()=>Ge(m,this,a(this,ye,"f").getMiddleware(),!1)))}}}catch(w){if(w instanceof H)a(this,T,"f").fail(w.message,w);else throw w}return this[et](f??m,c,!!n,!0)}[Sn](e,t,n,s){let r={...this.getDemandedOptions()};return o=>{if(n)throw new H(n.message);a(this,ee,"f").nonOptionCount(o),a(this,ee,"f").requiredArguments(o,r);let c=!1;a(this,Qe,"f")&&(c=a(this,ee,"f").unknownCommands(o)),a(this,Je,"f")&&!c?a(this,ee,"f").unknownArguments(o,e,t,!!s):a(this,Ze,"f")&&a(this,ee,"f").unknownArguments(o,e,{},!1,!1),a(this,ee,"f").limitedChoices(o),a(this,ee,"f").implications(o),a(this,ee,"f").conflicting(o)}}[Ki](){j(this,ue,!0,"f")}[tt](e){if(typeof e=="string")a(this,I,"f").key[e]=!0;else for(let t of e)a(this,I,"f").key[t]=!0}};function wi(i){return!!i&&typeof i.getInternalMethods=="function"}var Nr=qi(un),Ji=Nr;var Qi="8.2.0";function Zi(i){return i instanceof Error&&"exitCode"in i&&typeof i.exitCode=="number"}var is=xs(ns(),1);import Jr from"@pinojs/json-colorizer";var qr=/("(?:[^\\"]|\\.)*")|[:,]/g;function Mn(i,e={}){let t=JSON.stringify([1],void 0,e.indent===void 0?2:e.indent).slice(2,-3),n=t===""?1/0:e.maxLength===void 0?80:e.maxLength,{replacer:s}=e;return function r(o,c,b){o&&typeof o.toJSON=="function"&&(o=o.toJSON());let y=JSON.stringify(o,s);if(y===void 0)return y;let m=n-c.length-b;if(y.length<=m){let f=y.replace(qr,(u,g)=>g||`${u} `);if(f.length<=m)return f}if(s!=null&&(o=JSON.parse(y),s=void 0),typeof o=="object"&&o!==null){let f=c+t,u=[],g=0,C,w;if(Array.isArray(o)){C="[",w="]";let{length:p}=o;for(;g0)return[C,t+u.join(`, -${f}`),w].join(` -${c}`)}return y}(i,"",0)}function In(i){return Jr(Mn(i,{indent:2,replacer(e,t){return typeof t=="function"?t.name:t}}),{colors:{BRACKET:"gray"}})}var Qr=(i,e,t)=>{let n=[...i];for(let[s,r]of e.entries())n[s]===void 0?n[s]=t.cloneUnlessOtherwiseSpecified(r,t):t.isMergeableObject(r)?n[s]=Yt(i[s],r,t):i.includes(r)||n.push(r);return n};function Yt(i,e,t={arrayMerge:Qr}){return(0,is.default)(i,e,t)}import{findWorkspaces as Hc,findWorkspacesRoot as ss}from"find-workspaces";import Zr from"fs-extra";import Xr from"node:path";function Gt(){let i=qn();if(i===void 0)throw new Error("No package.json found.");return Xr.dirname(i)}function rs(){return ss()!==null}function vn(){let i=ss();return i!==null?i.location:Gt()}function os(i){if(i==="workspace-root")return vn();if(i==="package-dir")return Gt();if(typeof i=="string"){if(!Zr.pathExistsSync(i))throw new Error(`Custom cwd directory does not exist: ${i}`);return i}return process.cwd()}import as from"node:fs/promises";async function eo(i,e){try{let{default:t}=await import("prettier"),n=await t.resolveConfig(i),s=await t.format(e,{filepath:i,...n});await as.writeFile(i,s,"utf8")}catch{console.warn(`Skipped formatting ${i} since Prettier is not installed.`)}}async function Ct(i){try{let e=await as.readFile(i,"utf8");await eo(i,e)}catch{}}import{Transform as to}from"node:stream";function kt(i,e){return new to({transform(t,n,s){let o=t.toString().split(/\r?\n/).filter(c=>c.trim().length>0).map(c=>`${i?e===void 0?i:Fe[e](i):""} ${c} -`).join("");this.push(o),s()}})}async function cs(i){let e=[];return new Promise((t,n)=>{i.on("data",s=>e.push(s)),i.on("error",s=>{n(s)}),i.on("end",()=>{t(Buffer.concat(e).toString("utf8"))})})}function $n(i,e){return e===1?i:i+"s"}async function oo(i,e,t,n,s){let r=1,o;if(n.logPrefix===void 0)o=i;else{let c=kt(n.logPrefix,n.logColor);c.pipe(i),o=c}s&&o.write(Fe.bold(`Running: "${n.name}() with Positional arguments: ${String(e)} and Option flags: ${String(t)}"`));try{r=await n.execute(o,e,t)}catch(c){console.error(String(c)),r=1}return r}async function ao(i,e,t,n,s){let r=1,o;if(n.logPrefix===void 0)o=i;else{let g=kt(n.logPrefix,n.logColor);g.pipe(i),o=g}let c=n.subcommands??[],b=[...n.receivePositionalArguments?e:[],...n.positionalArguments??[]],y=[...n.receiveOptionFlags?t:[],...n.optionFlags??[]],m=[...c,...y,...b],f=os(n.cwdOverride);s&&o.write(`Running: "${n.name} ${m.join(" ")}"`);let u=n.prettyJsonOutput?new so:o;try{let g=io(n.name,m,{cwd:f,env:{...process.env.NO_COLOR===void 0?{FORCE_COLOR:"true"}:{},NODE_OPTIONS:"--experimental-strip-types --disable-warning=ExperimentalWarning"},preferLocal:!0,reject:!1,stdin:"inherit"});if(g.stdout.pipe(u,{end:!1}),g.stderr.pipe(u,{end:!1}),await g,n.prettyJsonOutput){u.end();let C=await cs(u),w=In(JSON.parse(C)).split(` -`);for(let p of w)o.write(`${p} -`)}r=g.exitCode??1}catch(g){console.error(`${n.name} failed with error:`),console.error(g),Zi(g)&&(r=typeof g.exitCode=="number"?g.exitCode:1)}return r}function co(i){return"execute"in i}async function Vt(i,e,t,n,s,r){let o=[];for(let c of n){let b=await(co(c)?oo(i,e,t,c,s):ao(i,e,t,c,s));o.push({exitCode:b,name:c.name})}if(r){let c=o.filter(({exitCode:m})=>m===0).map(({name:m})=>m),b=o.filter(({exitCode:m})=>m!==0).map(({name:m})=>m),y=o.length;c.length>0&&i.write(`\u2705 ${Fe.green.bold(`${c.length} / ${y} ${$n("Command",c.length)} Succeeded: `)} ${Fe.green(c.join(", "))} -`),b.length>0&&i.write(`\u274C ${Fe.red.bold(`${b.length} / ${y} ${$n("Command",b.length)} Failed: `)} ${Fe.red(b.join(", "))} -`)}return o.every(({exitCode:c})=>c===0)?0:1}async function lo(i,e,t,n){let s=await Xt();if(s===void 0)throw new Error("The `init` command must be used in a directory with a package.json file");let r=await Xt({cwd:ro(import.meta.url)});if(r===void 0)return i.write(`Error: The script being called was not in a package, weird. -`),1;let o=Ht.join(Ht.dirname(r),"init"),c=Ht.dirname(s),b=(e==="file"||e==="package")&&t!==void 0&&n!==void 0;try{if(b){let f=Object.keys(n)[0];if(e==="package"){let u=ve.readJSONSync(s);i.write(`Merging: -Package config key "${f} \u2192 "${c}" (Because --location is set to "package") -`);let g=Yt(u,n);ve.writeJSONSync(s,g,{spaces:2}),await Ct(s)}}if(!await ve.pathExists(o))return 0;if((await ve.readdir(o)).length===0)return i.write(`Source directory "${o}" is empty. -`),0;i.write(`Adding initial configuration files from: -"${o}" \u2192 "${c}" -`),await ve.copy(o,c,{async filter(f,u){let g=ls.statSync(f).isFile(),C=ls.existsSync(u);if(g){if(b&&e==="package"&&f.includes(t))return C?(i.write(`Deleting: -"${f}" \u2192 "${u}" (Because --location is set to "package") -`),ve.removeSync(u)):i.write(`Skipping: -"${f}" \u2192 "${u}" (Because --location is set to "package") -`),!1;if(C&&(u.includes(".vscode/")||u.includes("package.json"))&&Ht.extname(u)===".json"){i.write(`Merging: -"${f}" \u2192 "${u}" -`);let w=ve.readJSONSync(f),p=ve.readJSONSync(u),R=Yt(p,w);return ve.writeJSONSync(u,R,{spaces:2}),await Ct(u),!1}return C?(i.write(`Overwriting: -"${f}" \u2192 "${u}" -`),await Ct(u),!0):(i.write(`Copying: -"${f}" \u2192 "${u}" -`),await Ct(u),!0)}return!0},overwrite:!0})}catch(y){return console.error(String(y)),1}return 0}async function fs(i){let{commands:{fix:e,init:t,lint:n,printConfig:s},description:r,logColor:o,logPrefix:c,name:b,showSummary:y,verbose:m}=i,f=kt(c,o);f.pipe(process.stdout);let u=Ji(ln(process.argv)).scriptName(b).usage("$0 ",r);t!==void 0&&u.command({builder(g){return t.locationOptionFlag?g.option("location",{choices:["file","package"],default:"file",description:"TK",type:"string"}):g},command:"init",describe:t.description??`Initialize by copying starter config files to your project root${t.locationOptionFlag?" or to your package.json file.":"."}`,async handler(g){let C=t.locationOptionFlag?g.location:void 0,p=await Vt(f,[],C===void 0?[]:["--location",C],[{async execute(R,W,B){return lo(R,B.at(1),t.configFile,t.configPackageJson)},name:"copyAndMergeInitFiles"},...t.commands??[]]);process.exit(p)}}),n!==void 0&&u.command({builder(g){return n.positionalArgumentMode==="none"?g:g.positional("files",{array:!0,...n.positionalArgumentDefault===void 0?{}:{default:n.positionalArgumentDefault},describe:"Files or glob pattern to lint.",type:"string"})},command:n.positionalArgumentMode==="none"?"lint [files..]":"lint ",describe:n.description,async handler(g){let C=g.files??[],w=await Vt(f,C,[],n.commands,m,y);process.exit(w)}}),e!==void 0&&u.command({builder(g){return e.positionalArgumentMode==="none"?g:g.positional("files",{array:!0,...e.positionalArgumentDefault===void 0?{}:{default:e.positionalArgumentDefault},describe:"Files or glob pattern to fix.",type:"string"})},command:e.positionalArgumentMode==="none"?"fix [files..]":"fix ",describe:e.description,async handler(g){let C=g.files??[],w=await Vt(f,C,[],e.commands,m,y);process.exit(w)}}),s!==void 0&&u.command({builder(g){return s.positionalArgumentMode==="none"?g:g.positional("file",{...s.positionalArgumentDefault===void 0?{}:{default:s.positionalArgumentDefault},describe:"File or glob pattern to TK",type:"string"})},command:s.positionalArgumentMode==="none"?"print-config":s.positionalArgumentMode==="optional"?"print-config [file]":"print-config ",describe:s.description,async handler(g){let C=g.file??void 0,p=await Vt(f,C===void 0?[]:[C],[],s.commands,m,y);process.exit(p)}}),u.alias("h","help"),u.version(Qi),u.alias("v","version"),u.help(),u.wrap(process.stdout.isTTY?Math.min(120,u.terminalWidth()):0),await u.parseAsync()}function us(i){return{async execute(e){let t=await fo(i);if(t===void 0)return 1;let{config:n,filepath:s,isEmpty:r}=t;if(e.write(`Found ${i} configuration at "${s}" -`),r)return e.write(`Configuration is empty. -`),0;let o=In(n).split(` -`);for(let c of o)e.write(`${c} -`);return 0},name:`Cosmicconfig ${i}`}}async function fo(i){let e=no(i,{searchStrategy:"project"});try{if(await e.search()===null){console.error(`No ${i} configuration found.`);return}}catch(t){console.error(`Error while searching for ${i} configuration:`,t);return}}var nt={fileRun:"Matches files below the current working directory by default.",monorepoRun:"In a monorepo, it will also run in all packages below the current working directory.",monorepoSearch:"Searches up to the root of a monorepo if necessary.",multiArgumentCaveat:"Will use file arguments / globs where possible if provided, but some of the invoked tools only operate at the package-scope.",multiOptionCaveat:"Will use option flags where possible if provided, but some of the invoked tools will ignore them.",optionalFileRun:"Package-scoped by default, file-scoped if a file argument is provided.",packageRun:"Package-scoped",packageSearch:"Package-scoped"};import ho from"node:path";var uo={entry:["{index,cli,main}.{js,mjs,cjs,ts,mts,cts}!","src/{index,cli,main}.{js,mjs,cjs,ts,mts,cts}!","src/{bin,lib,cli}/{index,cli,main}.{js,mjs,cjs,ts,mts,cts}!","scripts/**/*.ts",".remarkrc.js","cspell.config.js","eslint.config.ts","mdat.config.ts","prettier.config.js","stylelint.config.js"],ignoreDependencies:["@envsa/cspell-config","@envsa/eslint-config","@envsa/knip-config","@envsa/mdat-config","@envsa/prettier-config","@envsa/remark-config","@envsa/stylelint-config"]};var hs=uo;function ds(){if(rs()){let i=Gt(),e=vn();if(i!==e)return["--workspace",ho.relative(e,i)]}return[]}function po(){return{knip:hs}}var ps={commands:{fix:{commands:[{cwdOverride:"workspace-root",name:"knip",optionFlags:["--fix","--allow-remove-files","--no-config-hints",...ds()]}],description:`Automatically remove unused code and dependencies. ${nt.packageRun} ${nt.monorepoRun}`,positionalArgumentMode:"none"},init:{configFile:"knip.config.ts",configPackageJson:po(),locationOptionFlag:!0},lint:{commands:[{cwdOverride:"workspace-root",name:"knip",optionFlags:["--no-progress","--no-config-hints",...ds()]}],description:`Check for unused code and dependencies. ${nt.packageRun} ${nt.monorepoRun}`,positionalArgumentMode:"none"},printConfig:{commands:[us("knip")],description:`Print the effective Knip configuration. ${nt.packageSearch} ${nt.monorepoSearch}`,positionalArgumentMode:"none"}},description:"Envsa's Knip shared configuration tools.",logColor:"cyan",logPrefix:"[Knip]",name:"envsa-knip",order:7};await fs(ps); -/*! Bundled license information: - -yargs-parser/build/lib/string-utils.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/tokenize-arg-string.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/yargs-parser-types.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/yargs-parser.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/index.js: - (** - * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js - * CJS and ESM environments. - * - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) -*/ +// Placeholder, will be replaced by the actual CLI script during the build process diff --git a/packages/remark-config/bin/cli.js b/packages/remark-config/bin/cli.js index d3cb9bb..07ff484 100755 --- a/packages/remark-config/bin/cli.js +++ b/packages/remark-config/bin/cli.js @@ -1,136 +1,2 @@ #!/usr/bin/env node -var fs=Object.create;var vn=Object.defineProperty;var us=Object.getOwnPropertyDescriptor;var hs=Object.getOwnPropertyNames;var ds=Object.getPrototypeOf,ps=Object.prototype.hasOwnProperty;var Ee=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var ms=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var gs=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of hs(e))!ps.call(i,s)&&s!==t&&vn(i,s,{get:()=>e[s],enumerable:!(n=us(e,s))||n.enumerable});return i};var bs=(i,e,t)=>(t=i!=null?fs(ds(i)):{},gs(e||!i||!i.__esModule?vn(t,"default",{value:i,enumerable:!0}):t,i));var es=ms((Nl,Xi)=>{"use strict";var vr=function(e){return $r(e)&&!Fr(e)};function $r(i){return!!i&&typeof i=="object"}function Fr(i){var e=Object.prototype.toString.call(i);return e==="[object RegExp]"||e==="[object Date]"||Tr(i)}var Nr=typeof Symbol=="function"&&Symbol.for,Rr=Nr?Symbol.for("react.element"):60103;function Tr(i){return i.$$typeof===Rr}function Dr(i){return Array.isArray(i)?[]:{}}function Ot(i,e){return e.clone!==!1&&e.isMergeableObject(i)?ft(Dr(i),i,e):i}function Wr(i,e,t){return i.concat(e).map(function(n){return Ot(n,t)})}function Lr(i,e){if(!e.customMerge)return ft;var t=e.customMerge(i);return typeof t=="function"?t:ft}function Ur(i){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(i).filter(function(e){return Object.propertyIsEnumerable.call(i,e)}):[]}function Qi(i){return Object.keys(i).concat(Ur(i))}function Zi(i,e){try{return e in i}catch{return!1}}function Br(i,e){return Zi(i,e)&&!(Object.hasOwnProperty.call(i,e)&&Object.propertyIsEnumerable.call(i,e))}function zr(i,e,t){var n={};return t.isMergeableObject(i)&&Qi(i).forEach(function(s){n[s]=Ot(i[s],t)}),Qi(e).forEach(function(s){Br(i,s)||(Zi(i,s)&&t.isMergeableObject(e[s])?n[s]=Lr(s,t)(i[s],e[s],t):n[s]=Ot(e[s],t))}),n}function ft(i,e,t){t=t||{},t.arrayMerge=t.arrayMerge||Wr,t.isMergeableObject=t.isMergeableObject||vr,t.cloneUnlessOtherwiseSpecified=Ot;var n=Array.isArray(e),s=Array.isArray(i),r=n===s;return r?n?t.arrayMerge(i,e,t):zr(i,e,t):Ot(e,t)}ft.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(n,s){return ft(n,s,t)},{})};var Yr=ft;Xi.exports=Yr});var $n=(i=0)=>e=>`\x1B[${e+i}m`,Fn=(i=0)=>e=>`\x1B[${38+i};5;${e}m`,Nn=(i=0)=>(e,t,n)=>`\x1B[${38+i};2;${e};${t};${n}m`,K={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},co=Object.keys(K.modifier),ys=Object.keys(K.color),Os=Object.keys(K.bgColor),fo=[...ys,...Os];function ws(){let i=new Map;for(let[e,t]of Object.entries(K)){for(let[n,s]of Object.entries(t))K[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[n]=K[n],i.set(s[0],s[1]);Object.defineProperty(K,e,{value:t,enumerable:!1})}return Object.defineProperty(K,"codes",{value:i,enumerable:!1}),K.color.close="\x1B[39m",K.bgColor.close="\x1B[49m",K.color.ansi=$n(),K.color.ansi256=Fn(),K.color.ansi16m=Nn(),K.bgColor.ansi=$n(10),K.bgColor.ansi256=Fn(10),K.bgColor.ansi16m=Nn(10),Object.defineProperties(K,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(r=>r+r).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>K.rgbToAnsi256(...K.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,s;if(e>=232)t=((e-232)*10+8)/255,n=t,s=t;else{e-=16;let l=e%36;t=Math.floor(e/36)/5,n=Math.floor(l/6)/5,s=l%6/5}let r=Math.max(t,n,s)*2;if(r===0)return 30;let o=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(t));return r===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>K.ansi256ToAnsi(K.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>K.ansi256ToAnsi(K.hexToAnsi256(e)),enumerable:!1}}),K}var Cs=ws(),_e=Cs;import kt from"node:process";import xs from"node:os";import Rn from"node:tty";function de(i,e=globalThis.Deno?globalThis.Deno.args:kt.argv){let t=i.startsWith("-")?"":i.length===1?"-":"--",n=e.indexOf(t+i),s=e.indexOf("--");return n!==-1&&(s===-1||n=2,has16m:i>=3}}function Es(i,{streamIsTTY:e,sniffFlags:t=!0}={}){let n=_s();n!==void 0&&(xt=n);let s=t?xt:n;if(s===0)return 0;if(t){if(de("color=16m")||de("color=full")||de("color=truecolor"))return 3;if(de("color=256"))return 2}if("TF_BUILD"in X&&"AGENT_NAME"in X)return 1;if(i&&!e&&s===void 0)return 0;let r=s||0;if(X.TERM==="dumb")return r;if(kt.platform==="win32"){let o=xs.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in X)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in X)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in X)||X.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in X)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(X.TEAMCITY_VERSION)?1:0;if(X.COLORTERM==="truecolor"||X.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in X){let o=Number.parseInt((X.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(X.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(X.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(X.TERM)||"COLORTERM"in X?1:r}function Tn(i,e={}){let t=Es(i,{streamIsTTY:i&&i.isTTY,...e});return As(t)}var js={stdout:Tn({isTTY:Rn.isatty(1)}),stderr:Tn({isTTY:Rn.isatty(2)})},Dn=js;function Wn(i,e,t){let n=i.indexOf(e);if(n===-1)return i;let s=e.length,r=0,o="";do o+=i.slice(r,n)+e+t,r=n+s,n=i.indexOf(e,r);while(n!==-1);return o+=i.slice(r),o}function Ln(i,e,t,n){let s=0,r="";do{let o=i[n-1]==="\r";r+=i.slice(s,o?n-1:n)+e+(o?`\r -`:` -`)+t,s=n+1,n=i.indexOf(` -`,s)}while(n!==-1);return r+=i.slice(s),r}var{stdout:Un,stderr:Bn}=Dn,qt=Symbol("GENERATOR"),it=Symbol("STYLER"),ut=Symbol("IS_EMPTY"),zn=["ansi","ansi","ansi256","ansi16m"],st=Object.create(null),Ss=(i,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=Un?Un.level:0;i.level=e.level===void 0?t:e.level};var Ps=i=>{let e=(...t)=>t.join(" ");return Ss(e,i),Object.setPrototypeOf(e,ht.prototype),e};function ht(i){return Ps(i)}Object.setPrototypeOf(ht.prototype,Function.prototype);for(let[i,e]of Object.entries(_e))st[i]={get(){let t=_t(this,Jt(e.open,e.close,this[it]),this[ut]);return Object.defineProperty(this,i,{value:t}),t}};st.visible={get(){let i=_t(this,this[it],!0);return Object.defineProperty(this,"visible",{value:i}),i}};var Kt=(i,e,t,...n)=>i==="rgb"?e==="ansi16m"?_e[t].ansi16m(...n):e==="ansi256"?_e[t].ansi256(_e.rgbToAnsi256(...n)):_e[t].ansi(_e.rgbToAnsi(...n)):i==="hex"?Kt("rgb",e,t,..._e.hexToRgb(...n)):_e[t][i](...n),Ms=["rgb","hex","ansi256"];for(let i of Ms){st[i]={get(){let{level:t}=this;return function(...n){let s=Jt(Kt(i,zn[t],"color",...n),_e.color.close,this[it]);return _t(this,s,this[ut])}}};let e="bg"+i[0].toUpperCase()+i.slice(1);st[e]={get(){let{level:t}=this;return function(...n){let s=Jt(Kt(i,zn[t],"bgColor",...n),_e.bgColor.close,this[it]);return _t(this,s,this[ut])}}}}var Is=Object.defineProperties(()=>{},{...st,level:{enumerable:!0,get(){return this[qt].level},set(i){this[qt].level=i}}}),Jt=(i,e,t)=>{let n,s;return t===void 0?(n=i,s=e):(n=t.openAll+i,s=e+t.closeAll),{open:i,close:e,openAll:n,closeAll:s,parent:t}},_t=(i,e,t)=>{let n=(...s)=>vs(n,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(n,Is),n[qt]=i,n[it]=e,n[ut]=t,n},vs=(i,e)=>{if(i.level<=0||!e)return i[ut]?"":e;let t=i[it];if(t===void 0)return e;let{openAll:n,closeAll:s}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=Wn(e,t.close,t.open),t=t.parent;let r=e.indexOf(` -`);return r!==-1&&(e=Ln(e,s,n,r)),n+e+s};Object.defineProperties(ht.prototype,st);var $s=ht(),Co=ht({level:Bn?Bn.level:0});var Fe=$s;import{cosmiconfig as Xr}from"cosmiconfig";import{execa as eo}from"execa";import ve from"fs-extra";import os from"node:fs";import Gt from"node:path";import{PassThrough as to}from"node:stream";import{fileURLToPath as no}from"node:url";import Vn from"node:process";import Yn from"node:process";import Fs from"node:fs/promises";import{fileURLToPath as Ns}from"node:url";import Rs from"node:fs";import pe from"node:path";var At=i=>i instanceof URL?Ns(i):i;async function Gn(i,{cwd:e=Yn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(At(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,At(n??r));s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let l=await Fs.stat(o);if(t==="file"&&l.isFile()||t==="directory"&&l.isDirectory())return o}catch{}s=pe.dirname(s)}}function Hn(i,{cwd:e=Yn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(At(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,At(n)??r);s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let l=Rs.statSync(o,{throwIfNoEntry:!1});if(t==="file"&&l?.isFile()||t==="directory"&&l?.isDirectory())return o}catch{}s=pe.dirname(s)}}async function Qt({cwd:i=Vn.cwd()}={}){return Gn("package.json",{cwd:i})}function kn({cwd:i=Vn.cwd()}={}){return Hn("package.json",{cwd:i})}import{notStrictEqual as or,strictEqual as ar}from"assert";var Ts={right:Bs,center:zs},Ds=0,Et=1,Ws=2,jt=3,Zt=class{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){let t=this.div(...e);t.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let t=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(t),t}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let t=e.split(` -`).map(s=>s.split(" ")),n=0;return t.forEach(s=>{s.length>1&&ce.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),ce.stringWidth(s[0])))}),t.forEach(s=>{this.div(...s.map((r,o)=>({text:r.trim(),padding:this.measurePadding(r),width:o===0&&s.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let t=ce.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(t=>{this.rowToString(t,e)}),e.filter(t=>!t.hidden).map(t=>t.text).join(` -`)}rowToString(e,t){return this.rasterize(e).forEach((n,s)=>{let r="";n.forEach((o,l)=>{let{width:b}=e[l],y=this.negatePadding(e[l]),m=o;if(y>ce.stringWidth(o)&&(m+=" ".repeat(y-ce.stringWidth(o))),e[l].align&&e[l].align!=="left"&&this.wrap){let u=Ts[e[l].align];m=u(m,y),ce.stringWidth(m)0&&(r=this.renderInline(r,t[t.length-1]))}),t.push({text:r.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){let n=e.match(/^ */),s=n?n[0].length:0,r=t.text,o=ce.stringWidth(r.trimRight());return t.span?this.wrap?s{r.width=n[o],this.wrap?s=ce.wrap(r.text,this.negatePadding(r),{hard:!0}).split(` -`):s=r.text.split(` -`),r.border&&(s.unshift("."+"-".repeat(this.negatePadding(r)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(r)+2)+"'")),r.padding&&(s.unshift(...new Array(r.padding[Ds]||0).fill("")),s.push(...new Array(r.padding[Ws]||0).fill(""))),s.forEach((l,b)=>{t[b]||t.push([]);let y=t[b];for(let m=0;mo.width||ce.stringWidth(o.text));let t=e.length,n=this.width,s=e.map(o=>{if(o.width)return t--,n-=o.width,o.width}),r=t?Math.floor(n/t):0;return s.map((o,l)=>o===void 0?Math.max(r,Ls(e[l])):o)}};function qn(i,e,t){return i.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function Ls(i){let e=i.padding||[],t=1+(e[jt]||0)+(e[Et]||0);return i.border?t+4:t}function Us(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Bs(i,e){i=i.trim();let t=ce.stringWidth(i);return t=e?i:" ".repeat(e-t>>1)+i}var ce;function Kn(i,e){return ce=e,new Zt({width:i?.width||Us(),wrap:i?.wrap})}var Jn=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Xt(i){return i.replace(Jn,"")}function Qn(i,e){let[t,n]=i.match(Jn)||["",""];i=Xt(i);let s="";for(let r=0;r[...e].length,stripAnsi:Xt,wrap:Qn})}import{dirname as Zn,resolve as Xn}from"path";import{readdirSync as Ys,statSync as Gs}from"fs";function ei(i,e){let t=Xn(".",i),n;for(Gs(t).isDirectory()||(t=Zn(t));;){if(n=e(t,Ys(t)),n)return Xn(t,n);if(t=Zn(n=t),n===t)break}}import{inspect as lr}from"util";import{readFileSync as cr}from"fs";import{fileURLToPath as fr}from"url";import{format as ks}from"util";import{normalize as qs,resolve as Ks}from"path";function Ye(i){if(i!==i.toLowerCase()&&i!==i.toUpperCase()||(i=i.toLowerCase()),i.indexOf("-")===-1&&i.indexOf("_")===-1)return i;{let t="",n=!1,s=i.match(/^-+/);for(let r=s?s[0].length:0;r0?n+=`${e}${t.charAt(s)}`:n+=o}return n}function Pt(i){return i==null?!1:typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^0[^.]/.test(i)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function ti(i){if(Array.isArray(i))return i.map(o=>typeof o!="string"?o+"":o);i=i.trim();let e=0,t=null,n=null,s=null,r=[];for(let o=0;o{typeof d=="number"&&(p.nargs[c]=d,p.keys.push(c))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([c,d])=>{typeof d=="function"&&(p.coercions[c]=d,p.keys.push(c))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(c){p.configs[c]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([c,d])=>{(typeof d=="boolean"||typeof d=="function")&&(p.configs[c]=d)})),ze(n.key,o,n.default,p.arrays),Object.keys(b).forEach(function(c){(p.aliases[c]||[]).forEach(function(d){b[d]=b[c]})});let B=null;Ct();let L=[],G=Object.assign(Object.create(null),{_:[]}),$e={};for(let c=0;c=3&&(F(A[1],p.arrays)?c=Ue(c,A[1],s,A[2]):F(A[1],p.nargs)!==!1?c=nt(c,A[1],s,A[2]):H(A[1],A[2],!0));else if(d.match(W)&&l["boolean-negation"])A=d.match(W),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],H(h,F(h,p.arrays)?[!1]:!1));else if(d.match(/^--.+/)||!l["short-option-groups"]&&d.match(/^-[^-]+/))A=d.match(/^--?(.+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],F(h,p.arrays)?c=Ue(c,h,s):F(h,p.nargs)!==!1?c=nt(c,h,s):(v=s[c+1],v!==void 0&&(!v.match(/^-/)||v.match(R))&&!F(h,p.bools)&&!F(h,p.counts)||/^(true|false)$/.test(v)?(H(h,v),c++):H(h,Z(h))));else if(d.match(/^-.\..+=/))A=d.match(/^-([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=3&&H(A[1],A[2]);else if(d.match(/^-.\..+/)&&!d.match(R))v=s[c+1],A=d.match(/^-(.\..+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],v!==void 0&&!v.match(/^-/)&&!F(h,p.bools)&&!F(h,p.counts)?(H(h,v),c++):H(h,Z(h)));else if(d.match(/^-[^-]+/)&&!d.match(R)){P=d.slice(1,-1).split(""),O=!1;for(let ae=0;aec!=="--"&&c.includes("-")).forEach(c=>{delete G[c]}),l["strip-aliased"]&&[].concat(...Object.keys(o).map(c=>o[c])).forEach(c=>{l["camel-case-expansion"]&&c.includes("-")&&delete G[c.split(".").map(d=>Ye(d)).join(".")],delete G[c]});function we(c){let d=S("_",c);(typeof d=="string"||typeof d=="number")&&G._.push(d)}function nt(c,d,x,O){let h,P=F(d,p.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return xe(O)||(B=Error(w("Argument unexpected for: %s",d))),H(d,Z(d)),c;let A=xe(O)?0:1;if(l["nargs-eats-options"])x.length-(c+1)+A0&&(H(d,O),v--),h=c+1;h0||A&&typeof A=="number"&&h.length>=A||(P=x[v],/^-/.test(P)&&!R.test(P)&&!Q(P)));v++)c=v,h.push(_(d,P,r))}return typeof A=="number"&&(A&&h.length1&&l["dot-notation"]&&(p.aliases[h[0]]||[]).forEach(function(P){let A=P.split("."),v=[].concat(h);v.shift(),A=A.concat(v),(p.aliases[c]||[]).includes(A.join("."))||Me(G,A,O)}),F(c,p.normalize)&&!F(c,p.arrays)&&[c].concat(p.aliases[c]||[]).forEach(function(A){Object.defineProperty($e,A,{enumerable:!0,get(){return d},set(v){d=typeof v=="string"?Ie.normalize(v):v}})})}function M(c,d){p.aliases[c]&&p.aliases[c].length||(p.aliases[c]=[d],g[d]=!0),p.aliases[d]&&p.aliases[d].length||M(d,c)}function _(c,d,x){x&&(d=Vs(d)),(F(c,p.bools)||F(c,p.counts))&&typeof d=="string"&&(d=d==="true");let O=Array.isArray(d)?d.map(function(h){return S(c,h)}):S(c,d);return F(c,p.counts)&&(xe(O)||typeof O=="boolean")&&(O=tn()),F(c,p.normalize)&&F(c,p.arrays)&&(Array.isArray(d)?O=d.map(h=>Ie.normalize(h)):O=Ie.normalize(d)),O}function S(c,d){return!l["parse-positional-numbers"]&&c==="_"||!F(c,p.strings)&&!F(c,p.bools)&&!Array.isArray(d)&&(Pt(d)&&l["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${d}`)))||!xe(d)&&F(c,p.numbers))&&(d=Number(d)),d}function D(c){let d=Object.create(null);J(d,p.aliases,b),Object.keys(p.configs).forEach(function(x){let O=c[x]||d[x];if(O)try{let h=null,P=Ie.resolve(Ie.cwd(),O),A=p.configs[x];if(typeof A=="function"){try{h=A(P)}catch(v){h=v}if(h instanceof Error){B=h;return}}else h=Ie.require(P);Y(h)}catch(h){h.name==="PermissionDenied"?B=h:c[x]&&(B=Error(w("Invalid JSON config file: %s",O)))}})}function Y(c,d){Object.keys(c).forEach(function(x){let O=c[x],h=d?d+"."+x:x;typeof O=="object"&&O!==null&&!Array.isArray(O)&&l["dot-notation"]?Y(O,h):(!Pe(G,h.split("."))||F(h,p.arrays)&&l["combine-arrays"])&&H(h,O)})}function ie(){typeof y<"u"&&y.forEach(function(c){Y(c)})}function z(c,d){if(typeof m>"u")return;let x=typeof m=="string"?m:"",O=Ie.env();Object.keys(O).forEach(function(h){if(x===""||h.lastIndexOf(x,0)===0){let P=h.split("__").map(function(A,v){return v===0&&(A=A.substring(x.length)),Ye(A)});(d&&p.configs[P.join(".")]||!d)&&!Pe(c,P)&&H(P.join("."),O[h])}})}function se(c){let d,x=new Set;Object.keys(c).forEach(function(O){if(!x.has(O)&&(d=F(O,p.coercions),typeof d=="function"))try{let h=S(O,d(c[O]));[].concat(p.aliases[O]||[],O).forEach(P=>{x.add(P),c[P]=h})}catch(h){B=h}})}function Be(c){return p.keys.forEach(d=>{~d.indexOf(".")||typeof c[d]>"u"&&(c[d]=void 0)}),c}function J(c,d,x,O=!1){Object.keys(x).forEach(function(h){Pe(c,h.split("."))||(Me(c,h.split("."),x[h]),O&&(C[h]=!0),(d[h]||[]).forEach(function(P){Pe(c,P.split("."))||Me(c,P.split("."),x[h])}))})}function Pe(c,d){let x=c;l["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(h){x=x[h]||{}});let O=d[d.length-1];return typeof x!="object"?!1:O in x}function Me(c,d,x){let O=c;l["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(re){re=ni(re),typeof O=="object"&&O[re]===void 0&&(O[re]={}),typeof O[re]!="object"||Array.isArray(O[re])?(Array.isArray(O[re])?O[re].push({}):O[re]=[O[re],{}],O=O[re][O[re].length-1]):O=O[re]});let h=ni(d[d.length-1]),P=F(d.join("."),p.arrays),A=Array.isArray(x),v=l["duplicate-arguments-array"];!v&&F(h,p.nargs)&&(v=!0,(!xe(O[h])&&p.nargs[h]===1||Array.isArray(O[h])&&O[h].length===p.nargs[h])&&(O[h]=void 0)),x===tn()?O[h]=tn(O[h]):Array.isArray(O[h])?v&&P&&A?O[h]=l["flatten-duplicate-arrays"]?O[h].concat(x):(Array.isArray(O[h][0])?O[h]:[O[h]]).concat([x]):!v&&!!P==!!A?O[h]=x:O[h]=O[h].concat([x]):O[h]===void 0&&P?O[h]=A?x:[x]:v&&!(O[h]===void 0||F(h,p.counts)||F(h,p.bools))?O[h]=[O[h],x]:O[h]=x}function ze(...c){c.forEach(function(d){Object.keys(d||{}).forEach(function(x){p.aliases[x]||(p.aliases[x]=[].concat(o[x]||[]),p.aliases[x].concat(x).forEach(function(O){if(/-/.test(O)&&l["camel-case-expansion"]){let h=Ye(O);h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),g[h]=!0)}}),p.aliases[x].concat(x).forEach(function(O){if(O.length>1&&/[A-Z]/.test(O)&&l["camel-case-expansion"]){let h=St(O,"-");h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),g[h]=!0)}}),p.aliases[x].forEach(function(O){p.aliases[O]=[x].concat(p.aliases[x].filter(function(h){return O!==h}))}))})})}function F(c,d){let x=[].concat(p.aliases[c]||[],c),O=Object.keys(d),h=x.find(P=>O.includes(P));return h?d[h]:!1}function Vt(c){let d=Object.keys(p);return[].concat(d.map(O=>p[O])).some(function(O){return Array.isArray(O)?O.includes(c):O[c]})}function $(c,...d){return[].concat(...d).some(function(O){let h=c.match(O);return h&&Vt(h[1])})}function q(c){if(c.match(R)||!c.match(/^-[^-]+/))return!1;let d=!0,x,O=c.slice(1).split("");for(let h=0;hF(c,p.arrays)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",c)),!0):F(c,p.nargs)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",c)),!0):!1)}return{aliases:Object.assign({},p.aliases),argv:Object.assign($e,G),configuration:l,defaulted:Object.assign({},C),error:B,newAliases:Object.assign({},g)}}};function Hs(i){let e=[],t=Object.create(null),n=!0;for(Object.keys(i).forEach(function(s){e.push([].concat(i[s],s))});n;){n=!1;for(let s=0;sQs,format:ks,normalize:qs,resolve:Ks,require:i=>{if(typeof Ee<"u")return Ee(i);if(i.match(/\.json$/))return JSON.parse(Js(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),dt=function(e,t){return ri.parse(e.slice(),t).argv};dt.detailed=function(i,e){return ri.parse(i.slice(),e)};dt.camelCase=Ye;dt.decamelize=St;dt.looksLikeNumber=Pt;var on=dt;import{basename as ur,dirname as hr,extname as dr,relative as pr,resolve as ui}from"path";function oi(){return Zs()?0:1}function Zs(){return Xs()&&!process.defaultApp}function Xs(){return!!process.versions.electron}function an(i){return i.slice(oi()+1)}function ai(){return process.argv[oi()]}var V=class i extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,i)}};import{readFileSync as er,statSync as tr,writeFile as nr}from"fs";import{format as ir}from"util";import{resolve as sr}from"path";var li={fs:{readFileSync:er,writeFile:nr},format:ir,resolve:sr,exists:i=>{try{return tr(i).isFile()}catch{return!1}}};var Ae,ln=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let t=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ae.format.apply(Ae.format,[this.cache[this.locale][t]||t].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),s=e.shift(),r=function(){};typeof e[e.length-1]=="function"&&(r=e.pop()),this.cache[this.locale]||this._readLocaleFile();let o=s===1?t:n;this.cache[this.locale][t]&&(o=this.cache[this.locale][t][s===1?"one":"other"]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r();let l=[o];return~o.indexOf("%d")&&l.push(s),Ae.format.apply(Ae.format,l.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.cache[this.locale][t]=e[t])}_taggedLiteral(e,...t){let n="";return e.forEach(function(s,r){let o=t[r+1];n+=s,typeof o<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,t=this.writeQueue[0],n=t.directory,s=t.locale,r=t.cb,o=this._resolveLocaleFile(n,s),l=JSON.stringify(this.cache[s],null,2);Ae.fs.writeFile(o,l,"utf-8",function(b){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),r(b)})}_readLocaleFile(){let e={},t=this._resolveLocaleFile(this.directory,this.locale);try{Ae.fs.readFileSync&&(e=JSON.parse(Ae.fs.readFileSync(t,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+t),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=Ae.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){let s=Ae.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(e){return Ae.exists(e)}};function ci(i,e){Ae=e;let t=new ln(i);return{__:t.__.bind(t),__n:t.__n.bind(t),setLocale:t.setLocale.bind(t),getLocale:t.getLocale.bind(t),updateLocale:t.updateLocale.bind(t),locale:t.locale}}var rr=i=>ci(i,li),fi=rr;var mr="require is not supported by ESM",hi="loading a directory of commands is not supported yet for ESM",pt;try{pt=fr(import.meta.url)}catch{pt=process.cwd()}var gr=pt.substring(0,pt.lastIndexOf("node_modules")),cn={assert:{notStrictEqual:or,strictEqual:ar},cliui:en,findUp:ei,getEnv:i=>process.env[i],inspect:lr,getCallerFile:()=>{throw new V(hi)},getProcessArgvBin:ai,mainFilename:gr||process.cwd(),Parser:on,path:{basename:ur,dirname:hr,extname:dr,relative:pr,resolve:ui},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(i,e)=>process.emitWarning(i,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:cr,require:()=>{throw new V(mr)},requireDirectory:()=>{throw new V(hi)},stringWidth:i=>[...i].length,y18n:fi({directory:ui(pt,"../../../locales"),updateFiles:!1})};function le(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function fn(i,e){e.assert.strictEqual(typeof i,"string")}function rt(i){return Object.keys(i)}function k(i){return!!i&&!!i.then&&typeof i.then=="function"}function Ne(i){let t=i.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=t.shift();if(!s)throw new Error(`No command found in: ${i}`);let r={cmd:s.replace(n,""),demanded:[],optional:[]};return t.forEach((o,l)=>{let b=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&l===t.length-1&&(b=!0),/^\[/.test(o)?r.optional.push({cmd:o.replace(n,"").split("|"),variadic:b}):r.demanded.push({cmd:o.replace(n,"").split("|"),variadic:b})}),r}var br=["first","second","third","fourth","fifth","sixth"];function E(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[Ne(`cmd ${i}`),e,t]}try{let s=0,[r,o,l]=n(),b=[].slice.call(o);for(;b.length&&b[b.length-1]===void 0;)b.pop();let y=l||b.length;if(ym)throw new V(`Too many arguments provided. Expected max ${m} but received ${y}.`);r.demanded.forEach(f=>{let u=b.shift(),g=di(u);f.cmd.filter(w=>w===g||w==="*").length===0&&pi(g,f.cmd,s),s+=1}),r.optional.forEach(f=>{if(b.length===0)return;let u=b.shift(),g=di(u);f.cmd.filter(w=>w===g||w==="*").length===0&&pi(g,f.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function di(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function pi(i,e,t){throw new V(`Invalid ${br[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}var It=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,s=!1){if(E(" [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let r=0;r{let r=[...n[t]||[],t];return s.option?!r.includes(s.option):!0}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function mi(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Ge(i,e,t,n){return t.reduce((s,r)=>{if(r.applyBeforeValidation!==n)return s;if(r.mutates){if(r.applied)return s;r.applied=!0}if(k(s))return s.then(o=>Promise.all([o,r(o,e)])).then(([o,l])=>Object.assign(o,l));{let o=r(s,e);return k(o)?o.then(l=>Object.assign(s,l)):Object.assign(s,o)}},i)}function He(i,e,t=n=>{throw n}){try{let n=yr(i)?i():i;return k(n)?n.then(s=>e(s)):e(n)}catch(n){return t(n)}}function yr(i){return typeof i=="function"}function un(i){if(typeof Ee>"u")return null;for(let e=0,t=Object.keys(Ee.cache),n;eo;s.visit=(o,l,b)=>{let y=r(o,l,b);if(y){if(this.requireCache.has(l))return y;this.requireCache.add(l),this.addHandler(y)}return y},this.shim.requireDirectory({require:t,filename:n},e,s)}addHandler(e,t,n,s,r,o){let l=[],b=mi(r);if(s=s||(()=>{}),Array.isArray(e))if(Or(e))[e,...l]=e;else for(let y of e)this.addHandler(y);else if(Cr(e)){let y=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(y=[].concat(y).concat(e.aliases)),this.addHandler(y,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(gi(n)){this.addHandler([e].concat(l),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let y=Ne(e);l=l.map(u=>Ne(u).cmd);let m=!1,f=[y.cmd].concat(l).filter(u=>ot.test(u)?(m=!0,!1):!0);f.length===0&&m&&f.push("$0"),m&&(y.cmd=f[0],l=f.slice(1),e=e.replace(ot,y.cmd)),l.forEach(u=>{this.aliasMap[u]=y.cmd}),t!==!1&&this.usage.command(e,t,m,l,o),this.handlers[y.cmd]={original:e,description:t,handler:s,builder:n||{},middlewares:b,deprecated:o,demanded:y.demanded,optional:y.optional},m&&(this.defaultCommand=this.handlers[y.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,s,r,o){let l=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,b=t.getInternalMethods().getContext(),y=b.commands.slice(),m=!e;e&&(b.commands.push(e),b.fullCommands.push(l.original));let f=this.applyBuilderUpdateUsageAndParse(m,l,t,n.aliases,y,s,r,o);return k(f)?f.then(u=>this.applyMiddlewareAndGetResult(m,l,u.innerArgv,b,r,u.aliases,t)):this.applyMiddlewareAndGetResult(m,l,f.innerArgv,b,r,f.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,s,r,o,l,b){let y=t.builder,m=n;if(vt(y)){n.getInternalMethods().getUsageInstance().freeze();let f=y(n.getInternalMethods().reset(s),b);if(k(f))return f.then(u=>(m=yi(u)?u:n,this.parseAndUpdateUsage(e,t,m,r,o,l)))}else wr(y)&&(n.getInternalMethods().getUsageInstance().freeze(),m=n.getInternalMethods().reset(s),Object.keys(t.builder).forEach(f=>{m.option(f,y[f])}));return this.parseAndUpdateUsage(e,t,m,r,o,l)}parseAndUpdateUsage(e,t,n,s,r,o){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,t),t.description);let l=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,r,o);return k(l)?l.then(b=>({aliases:n.parsed.aliases,innerArgv:b})):{aliases:n.parsed.aliases,innerArgv:l}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){let n=ot.test(t.original)?t.original.replace(ot,"").trim():t.original,s=e.filter(r=>!ot.test(r));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(e,t,n,s,r,o,l,b){if(!o.getInternalMethods().getHasOutput()){let y=o.getInternalMethods().runValidation(r,b,o.parsed.error,e);n=He(n,m=>(y(m),m))}if(t.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let y=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,y,!1,!1),n=Ge(n,o,l,!1),n=He(n,m=>{let f=t.handler(m);return k(f)?f.then(()=>m):m}),e||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),k(n)&&!o.getInternalMethods().hasParseCallback()&&n.catch(m=>{try{o.getInternalMethods().getUsageInstance().fail(null,m)}catch{}})}return e||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,s,r,o,l){let b={};if(r)return n;l.getInternalMethods().getHasOutput()||(b=this.populatePositionals(t,n,s,l));let y=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),m=Ge(n,l,y,!0);return k(m)?m.then(f=>this.handleValidationAndGetResult(e,t,f,s,o,l,y,b)):this.handleValidationAndGetResult(e,t,m,s,o,l,y,b)}populatePositionals(e,t,n,s){t._=t._.slice(n.commands.length);let r=e.demanded.slice(0),o=e.optional.slice(0),l={};for(this.validation.positionalCount(r.length,t._.length);r.length;){let b=r.shift();this.populatePositional(b,t,l)}for(;o.length;){let b=o.shift();this.populatePositional(b,t,l)}return t._=n.commands.concat(t._.map(b=>""+b)),this.postProcessPositionals(t,l,this.cmdToParseOptions(e.original),s),l}populatePositional(e,t,n){let s=e.cmd[0];e.variadic?n[s]=t._.splice(0).map(String):t._.length&&(n[s]=[String(t._.shift())])}cmdToParseOptions(e){let t={array:[],default:{},alias:{},demand:{}},n=Ne(e);return n.demanded.forEach(s=>{let[r,...o]=s.cmd;s.variadic&&(t.array.push(r),t.default[r]=[]),t.alias[r]=o,t.demand[r]=!0}),n.optional.forEach(s=>{let[r,...o]=s.cmd;s.variadic&&(t.array.push(r),t.default[r]=[]),t.alias[r]=o}),t}postProcessPositionals(e,t,n,s){let r=Object.assign({},s.getOptions());r.default=Object.assign(n.default,r.default);for(let y of Object.keys(n.alias))r.alias[y]=(r.alias[y]||[]).concat(n.alias[y]);r.array=r.array.concat(n.array),r.config={};let o=[];if(Object.keys(t).forEach(y=>{t[y].map(m=>{r.configuration["unknown-options-as-args"]&&(r.key[y]=!0),o.push(`--${y}`),o.push(m)})}),!o.length)return;let l=Object.assign({},r.configuration,{"populate--":!1}),b=this.shim.Parser.detailed(o,Object.assign({},r,{configuration:l}));if(b.error)s.getInternalMethods().getUsageInstance().fail(b.error.message,b.error);else{let y=Object.keys(t);Object.keys(t).forEach(m=>{y.push(...b.aliases[m])}),Object.keys(b.argv).forEach(m=>{y.includes(m)&&(t[m]||(t[m]=b.argv[m]),!this.isInConfigs(s,m)&&!this.isDefaulted(s,m)&&Object.prototype.hasOwnProperty.call(e,m)&&Object.prototype.hasOwnProperty.call(b.argv,m)&&(Array.isArray(e[m])||Array.isArray(b.argv[m]))?e[m]=[].concat(e[m],b.argv[m]):e[m]=b.argv[m])})}}isDefaulted(e,t){let{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){let{configObjects:n}=e.getOptions();return n.some(s=>Object.prototype.hasOwnProperty.call(s,t))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=ot.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let t=this.defaultCommand.builder;if(vt(t))return t(e,!0);gi(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){let t=un(e);if(!t)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(t.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:t,desc:n}){for(let s of[e,t,n]){if(typeof s=="string"||s===!1)return s;le(s,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();le(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function bi(i,e,t,n){return new hn(i,e,t,n)}function gi(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function Or(i){return i.every(e=>typeof e=="string")}function vt(i){return typeof i=="function"}function wr(i){return typeof i=="object"}function Cr(i){return typeof i=="object"&&!Array.isArray(i)}function Re(i={},e=()=>!0){let t={};return rt(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function Te(i){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(i)})}function xr(i){return typeof i=="boolean"}function wi(i,e){let t=e.y18n.__,n={},s=[];n.failFn=function(_){s.push(_)};let r=null,o=null,l=!0;n.showHelpOnFail=function(_=!0,S){let[D,Y]=typeof _=="string"?[!0,_]:[_,S];return i.getInternalMethods().isGlobalContext()&&(o=Y),r=Y,l=D,n};let b=!1;n.fail=function(_,S){let D=i.getInternalMethods().getLoggerInstance();if(s.length)for(let Y=s.length-1;Y>=0;--Y){let ie=s[Y];if(xr(ie)){if(S)throw S;if(_)throw Error(_)}else ie(_,S,n)}else{if(i.getExitProcess()&&Te(!0),!b){b=!0,l&&(i.showHelp("error"),D.error()),(_||S)&&D.error(_||S);let Y=r||o;Y&&((_||S)&&D.error(""),D.error(Y))}if(S=S||new V(_),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,S);throw S}};let y=[],m=!1;n.usage=(M,_)=>M===null?(m=!0,y=[],n):(m=!1,y.push([M,_||""]),n),n.getUsage=()=>y,n.getUsageDisabled=()=>m,n.getPositionalGroupName=()=>t("Positionals:");let f=[];n.example=(M,_)=>{f.push([M,_||""])};let u=[];n.command=function(_,S,D,Y,ie=!1){D&&(u=u.map(z=>(z[2]=!1,z))),u.push([_,S||"",D,Y,ie])},n.getCommands=()=>u;let g={};n.describe=function(_,S){Array.isArray(_)?_.forEach(D=>{n.describe(D,S)}):typeof _=="object"?Object.keys(_).forEach(D=>{n.describe(D,_[D])}):g[_]=S},n.getDescriptions=()=>g;let C=[];n.epilog=M=>{C.push(M)};let w=!1,p;n.wrap=M=>{w=!0,p=M},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(w||(p=nt(),w=!0),p);let R="__yargsString__:";n.deferY18nLookup=M=>R+M,n.help=function(){if(L)return L;B();let _=i.customScriptName?i.$0:e.path.basename(i.$0),S=i.getDemandedOptions(),D=i.getDemandedCommands(),Y=i.getDeprecatedOptions(),ie=i.getGroups(),z=i.getOptions(),se=[];se=se.concat(Object.keys(g)),se=se.concat(Object.keys(S)),se=se.concat(Object.keys(D)),se=se.concat(Object.keys(z.default)),se=se.filter($e),se=Object.keys(se.reduce(($,q)=>(q!=="_"&&($[q]=!0),$),{}));let Be=n.getWrap(),J=e.cliui({width:Be,wrap:!!Be});if(!m){if(y.length)y.forEach($=>{J.div({text:`${$[0].replace(/\$0/g,_)}`}),$[1]&&J.div({text:`${$[1]}`,padding:[1,0,0,0]})}),J.div();else if(u.length){let $=null;D._?$=`${_} <${t("command")}> -`:$=`${_} [${t("command")}] -`,J.div(`${$}`)}}if(u.length>1||u.length===1&&!u[0][2]){J.div(t("Commands:"));let $=i.getInternalMethods().getContext(),q=$.commands.length?`${$.commands.join(" ")} `:"";i.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(u=u.sort((U,Z)=>U[0].localeCompare(Z[0])));let Q=_?`${_} `:"";u.forEach(U=>{let Z=`${Q}${q}${U[0].replace(/^\$0 ?/,"")}`;J.span({text:Z,padding:[0,2,0,2],width:W(u,Be,`${_}${q}`)+4},{text:U[1]});let te=[];U[2]&&te.push(`[${t("default")}]`),U[3]&&U[3].length&&te.push(`[${t("aliases:")} ${U[3].join(", ")}]`),U[4]&&(typeof U[4]=="string"?te.push(`[${t("deprecated: %s",U[4])}]`):te.push(`[${t("deprecated")}]`)),te.length?J.div({text:te.join(" "),padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}let Pe=(Object.keys(z.alias)||[]).concat(Object.keys(i.parsed.newAliases)||[]);se=se.filter($=>!i.parsed.newAliases[$]&&Pe.every(q=>(z.alias[q]||[]).indexOf($)===-1));let Me=t("Options:");ie[Me]||(ie[Me]=[]),G(se,z.alias,ie,Me);let ze=$=>/^--/.test($t($)),F=Object.keys(ie).filter($=>ie[$].length>0).map($=>{let q=ie[$].filter($e).map(Q=>{if(Pe.includes(Q))return Q;for(let U=0,Z;(Z=Pe[U])!==void 0;U++)if((z.alias[Z]||[]).includes(Q))return Z;return Q});return{groupName:$,normalizedKeys:q}}).filter(({normalizedKeys:$})=>$.length>0).map(({groupName:$,normalizedKeys:q})=>{let Q=q.reduce((U,Z)=>(U[Z]=[Z].concat(z.alias[Z]||[]).map(te=>$===n.getPositionalGroupName()?te:(/^[0-9]$/.test(te)?z.boolean.includes(Z)?"-":"--":te.length>1?"--":"-")+te).sort((te,Ce)=>ze(te)===ze(Ce)?0:ze(te)?1:-1).join(", "),U),{});return{groupName:$,normalizedKeys:q,switches:Q}});if(F.filter(({groupName:$})=>$!==n.getPositionalGroupName()).some(({normalizedKeys:$,switches:q})=>!$.every(Q=>ze(q[Q])))&&F.filter(({groupName:$})=>$!==n.getPositionalGroupName()).forEach(({normalizedKeys:$,switches:q})=>{$.forEach(Q=>{ze(q[Q])&&(q[Q]=_r(q[Q],4))})}),F.forEach(({groupName:$,normalizedKeys:q,switches:Q})=>{J.div($),q.forEach(U=>{let Z=Q[U],te=g[U]||"",Ce=null;te.includes(R)&&(te=t(te.substring(R.length))),z.boolean.includes(U)&&(Ce=`[${t("boolean")}]`),z.count.includes(U)&&(Ce=`[${t("count")}]`),z.string.includes(U)&&(Ce=`[${t("string")}]`),z.normalize.includes(U)&&(Ce=`[${t("string")}]`),z.array.includes(U)&&(Ce=`[${t("array")}]`),z.number.includes(U)&&(Ce=`[${t("number")}]`);let xe=d=>typeof d=="string"?`[${t("deprecated: %s",d)}]`:`[${t("deprecated")}]`,Ct=[U in Y?xe(Y[U]):null,Ce,U in S?`[${t("required")}]`:null,z.choices&&z.choices[U]?`[${t("choices:")} ${n.stringifiedValues(z.choices[U])}]`:null,we(z.default[U],z.defaultDescription[U])].filter(Boolean).join(" ");J.span({text:$t(Z),padding:[0,2,0,2+Oi(Z)],width:W(Q,Be)+4},te);let c=i.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Ct&&!c?J.div({text:Ct,padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}),f.length&&(J.div(t("Examples:")),f.forEach($=>{$[0]=$[0].replace(/\$0/g,_)}),f.forEach($=>{$[1]===""?J.div({text:$[0],padding:[0,2,0,2]}):J.div({text:$[0],padding:[0,2,0,2],width:W(f,Be)+4},{text:$[1]})}),J.div()),C.length>0){let $=C.map(q=>q.replace(/\$0/g,_)).join(` -`);J.div(`${$} -`)}return J.toString().replace(/\s*$/,"")};function W(M,_,S){let D=0;return Array.isArray(M)||(M=Object.values(M).map(Y=>[Y])),M.forEach(Y=>{D=Math.max(e.stringWidth(S?`${S} ${$t(Y[0])}`:$t(Y[0]))+Oi(Y[0]),D)}),_&&(D=Math.min(D,parseInt((_*.5).toString(),10))),D}function B(){let M=i.getDemandedOptions(),_=i.getOptions();(Object.keys(_.alias)||[]).forEach(S=>{_.alias[S].forEach(D=>{g[D]&&n.describe(S,g[D]),D in M&&i.demandOption(S,M[D]),_.boolean.includes(D)&&i.boolean(S),_.count.includes(D)&&i.count(S),_.string.includes(D)&&i.string(S),_.normalize.includes(D)&&i.normalize(S),_.array.includes(D)&&i.array(S),_.number.includes(D)&&i.number(S)})})}let L;n.cacheHelpMessage=function(){L=this.help()},n.clearCachedHelpMessage=function(){L=void 0},n.hasCachedHelpMessage=function(){return!!L};function G(M,_,S,D){let Y=[],ie=null;return Object.keys(S).forEach(z=>{Y=Y.concat(S[z])}),M.forEach(z=>{ie=[z].concat(_[z]),ie.some(se=>Y.indexOf(se)!==-1)||S[D].push(z)}),Y}function $e(M){return i.getOptions().hiddenOptions.indexOf(M)<0||i.parsed.argv[i.getOptions().showHiddenOpt]}n.showHelp=M=>{let _=i.getInternalMethods().getLoggerInstance();M||(M="error"),(typeof M=="function"?M:_[M])(n.help())},n.functionDescription=M=>["(",M.name?e.Parser.decamelize(M.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(_,S){let D="",Y=S||", ",ie=[].concat(_);return!_||!ie.length||ie.forEach(z=>{D.length&&(D+=Y),D+=JSON.stringify(z)}),D};function we(M,_){let S=`[${t("default:")} `;if(M===void 0&&!_)return null;if(_)S+=_;else switch(typeof M){case"string":S+=`"${M}"`;break;case"object":S+=JSON.stringify(M);break;default:S+=M}return`${S}]`}function nt(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let Ue=null;n.version=M=>{Ue=M},n.showVersion=M=>{let _=i.getInternalMethods().getLoggerInstance();M||(M="error"),(typeof M=="function"?M:_[M])(Ue)},n.reset=function(_){return r=null,b=!1,y=[],m=!1,C=[],f=[],u=[],g=Re(g,S=>!_[S]),n};let H=[];return n.freeze=function(){H.push({failMessage:r,failureOutput:b,usages:y,usageDisabled:m,epilogs:C,examples:f,commands:u,descriptions:g})},n.unfreeze=function(_=!1){let S=H.pop();S&&(_?(g={...S.descriptions,...g},u=[...S.commands,...u],y=[...S.usages,...y],f=[...S.examples,...f],C=[...S.epilogs,...C]):{failMessage:r,failureOutput:b,usages:y,usageDisabled:m,epilogs:C,examples:f,commands:u,descriptions:g}=S)},n}function dn(i){return typeof i=="object"}function _r(i,e){return dn(i)?{text:i.text,indentation:i.indentation+e}:{text:i,indentation:e}}function Oi(i){return dn(i)?i.indentation:0}function $t(i){return dn(i)?i.text:i}var Ci=`###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc -# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local cur_word args type_list - - cur_word="\${COMP_WORDS[COMP_CWORD]}" - args=("\${COMP_WORDS[@]}") - - # ask yargs to generate completions. - type_list=$({{app_path}} --get-yargs-completions "\${args[@]}") - - COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) ) - - # if no match was found, fall back to filename completion - if [ \${#COMPREPLY[@]} -eq 0 ]; then - COMPREPLY=() - fi - - return 0 -} -complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`,xi=`#compdef {{app_name}} -###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc -# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local reply - local si=$IFS - IFS=$' -' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}")) - IFS=$si - _describe 'values' reply -} -compdef _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`;var pn=class{constructor(e,t,n,s){var r,o,l;this.yargs=e,this.usage=t,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(l=((r=this.shim.getEnv("SHELL"))===null||r===void 0?void 0:r.includes("zsh"))||((o=this.shim.getEnv("ZSH_NAME"))===null||o===void 0?void 0:o.includes("zsh")))!==null&&l!==void 0?l:!1}defaultCompletion(e,t,n,s){let r=this.command.getCommandHandlers();for(let l=0,b=e.length;l{let o=Ne(r[0]).cmd;if(t.indexOf(o)===-1)if(!this.zshShell)e.push(o);else{let l=r[1]||"";e.push(o.replace(/:/g,"\\:")+":"+l)}})}optionCompletions(e,t,n,s){if((s.match(/^-/)||s===""&&e.length===0)&&!this.previousArgHasChoices(t)){let r=this.yargs.getOptions(),o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(r.key).forEach(l=>{let b=!!r.configuration["boolean-negation"]&&r.boolean.includes(l);!o.includes(l)&&!r.hiddenOptions.includes(l)&&!this.argsContainKey(t,l,b)&&this.completeOptionKey(l,e,s,b&&!!r.default[l])})}}choicesFromOptionsCompletions(e,t,n,s){if(this.previousArgHasChoices(t)){let r=this.getPreviousArgChoices(t);r&&r.length>0&&e.push(...r.map(o=>o.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,s){if(s===""&&e.length>0&&this.previousArgHasChoices(t))return;let r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],o=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),l=r[n._.length-o-1];if(!l)return;let b=this.yargs.getOptions().choices[l]||[];for(let y of b)y.startsWith(s)&&e.push(y.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n="";if(!t.startsWith("-")&&e.length>1&&(n=t,t=e[e.length-2]),!t.startsWith("-"))return;let s=t.replace(/^-+/,""),r=this.yargs.getOptions(),o=[s,...this.yargs.getAliases()[s]||[]],l;for(let b of o)if(Object.prototype.hasOwnProperty.call(r.key,b)&&Array.isArray(r.choices[b])){l=r.choices[b];break}if(l)return l.filter(b=>!n||b.startsWith(n))}previousArgHasChoices(e){let t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){let s=r=>e.indexOf((/^[^0-9]$/.test(r)?"-":"--")+r)!==-1;if(s(t)||n&&s(`no-${t}`))return!0;if(this.aliases){for(let r of this.aliases[t])if(s(r))return!0}return!1}completeOptionKey(e,t,n,s){var r,o,l,b;let y=e;if(this.zshShell){let g=this.usage.getDescriptions(),C=(o=(r=this===null||this===void 0?void 0:this.aliases)===null||r===void 0?void 0:r[e])===null||o===void 0?void 0:o.find(R=>{let W=g[R];return typeof W=="string"&&W.length>0}),w=C?g[C]:void 0,p=(b=(l=g[e])!==null&&l!==void 0?l:w)!==null&&b!==void 0?b:"";y=`${e.replace(/:/g,"\\:")}:${p.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let m=g=>/^--/.test(g),f=g=>/^[^0-9]$/.test(g),u=!m(n)&&f(e)?"-":"--";t.push(u+y),s&&t.push(u+"no-"+y)}customCompletion(e,t,n,s){if(le(this.customCompletionFunction,null,this.shim),Er(this.customCompletionFunction)){let r=this.customCompletionFunction(n,t);return k(r)?r.then(o=>{this.shim.process.nextTick(()=>{s(null,o)})}).catch(o=>{this.shim.process.nextTick(()=>{s(o,void 0)})}):s(null,r)}else return jr(this.customCompletionFunction)?this.customCompletionFunction(n,t,(r=s)=>this.defaultCompletion(e,t,n,r),r=>{s(null,r)}):this.customCompletionFunction(n,t,r=>{s(null,r)})}getCompletion(e,t){let n=e.length?e[e.length-1]:"",s=this.yargs.parse(e,!0),r=this.customCompletionFunction?o=>this.customCompletion(e,o,n,t):o=>this.defaultCompletion(e,o,n,t);return k(s)?s.then(r):r(s)}generateCompletionScript(e,t){let n=this.zshShell?xi:Ci,s=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,s),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function _i(i,e,t,n){return new pn(i,e,t,n)}function Er(i){return i.length<3}function jr(i){return i.length>3}function Ai(i,e){if(i.length===0)return e.length;if(e.length===0)return i.length;let t=[],n;for(n=0;n<=e.length;n++)t[n]=[n];let s;for(s=0;s<=i.length;s++)t[0][s]=s;for(n=1;n<=e.length;n++)for(s=1;s<=i.length;s++)e.charAt(n-1)===i.charAt(s-1)?t[n][s]=t[n-1][s-1]:n>1&&s>1&&e.charAt(n-2)===i.charAt(s-1)&&e.charAt(n-1)===i.charAt(s-2)?t[n][s]=t[n-2][s-2]+1:t[n][s]=Math.min(t[n-1][s-1]+1,Math.min(t[n][s-1]+1,t[n-1][s]+1));return t[e.length][i.length]}var Ei=["$0","--","_"];function ji(i,e,t){let n=t.y18n.__,s=t.y18n.__n,r={};r.nonOptionCount=function(f){let u=i.getDemandedCommands(),C=f._.length+(f["--"]?f["--"].length:0)-i.getInternalMethods().getContext().commands.length;u._&&(Cu._.max)&&(Cu._.max&&(u._.maxMsg!==void 0?e.fail(u._.maxMsg?u._.maxMsg.replace(/\$0/g,C.toString()).replace(/\$1/,u._.max.toString()):null):e.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",C,C.toString(),u._.max.toString()))))},r.positionalCount=function(f,u){u"u")&&(g=g||{},g[C]=u[C]);if(g){let C=[];for(let p of Object.keys(g)){let R=g[p];R&&C.indexOf(R)<0&&C.push(R)}let w=C.length?` -${C.join(` -`)}`:"";e.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(g).length,Object.keys(g).join(", ")+w))}},r.unknownArguments=function(f,u,g,C,w=!0){var p;let R=i.getInternalMethods().getCommandInstance().getCommands(),W=[],B=i.getInternalMethods().getContext();if(Object.keys(f).forEach(L=>{!Ei.includes(L)&&!Object.prototype.hasOwnProperty.call(g,L)&&!Object.prototype.hasOwnProperty.call(i.getInternalMethods().getParseContext(),L)&&!r.isValidAndSomeAliasIsNotNew(L,u)&&W.push(L)}),w&&(B.commands.length>0||R.length>0||C)&&f._.slice(B.commands.length).forEach(L=>{R.includes(""+L)||W.push(""+L)}),w){let G=((p=i.getDemandedCommands()._)===null||p===void 0?void 0:p.max)||0,$e=B.commands.length+G;$e{we=String(we),!B.commands.includes(we)&&!W.includes(we)&&W.push(we)})}W.length&&e.fail(s("Unknown argument: %s","Unknown arguments: %s",W.length,W.map(L=>L.trim()?L:`"${L}"`).join(", ")))},r.unknownCommands=function(f){let u=i.getInternalMethods().getCommandInstance().getCommands(),g=[],C=i.getInternalMethods().getContext();return(C.commands.length>0||u.length>0)&&f._.slice(C.commands.length).forEach(w=>{u.includes(""+w)||g.push(""+w)}),g.length>0?(e.fail(s("Unknown command: %s","Unknown commands: %s",g.length,g.join(", "))),!0):!1},r.isValidAndSomeAliasIsNotNew=function(f,u){if(!Object.prototype.hasOwnProperty.call(u,f))return!1;let g=i.parsed.newAliases;return[f,...u[f]].some(C=>!Object.prototype.hasOwnProperty.call(g,C)||!g[f])},r.limitedChoices=function(f){let u=i.getOptions(),g={};if(!Object.keys(u.choices).length)return;Object.keys(f).forEach(p=>{Ei.indexOf(p)===-1&&Object.prototype.hasOwnProperty.call(u.choices,p)&&[].concat(f[p]).forEach(R=>{u.choices[p].indexOf(R)===-1&&R!==void 0&&(g[p]=(g[p]||[]).concat(R))})});let C=Object.keys(g);if(!C.length)return;let w=n("Invalid values:");C.forEach(p=>{w+=` - ${n("Argument: %s, Given: %s, Choices: %s",p,e.stringifiedValues(g[p]),e.stringifiedValues(u.choices[p]))}`}),e.fail(w)};let o={};r.implies=function(f,u){E(" [array|number|string]",[f,u],arguments.length),typeof f=="object"?Object.keys(f).forEach(g=>{r.implies(g,f[g])}):(i.global(f),o[f]||(o[f]=[]),Array.isArray(u)?u.forEach(g=>r.implies(f,g)):(le(u,void 0,t),o[f].push(u)))},r.getImplied=function(){return o};function l(m,f){let u=Number(f);return f=isNaN(u)?f:u,typeof f=="number"?f=m._.length>=f:f.match(/^--no-.+/)?(f=f.match(/^--no-(.+)/)[1],f=!Object.prototype.hasOwnProperty.call(m,f)):f=Object.prototype.hasOwnProperty.call(m,f),f}r.implications=function(f){let u=[];if(Object.keys(o).forEach(g=>{let C=g;(o[g]||[]).forEach(w=>{let p=C,R=w;p=l(f,p),w=l(f,w),p&&!w&&u.push(` ${C} -> ${R}`)})}),u.length){let g=`${n("Implications failed:")} -`;u.forEach(C=>{g+=C}),e.fail(g)}};let b={};r.conflicts=function(f,u){E(" [array|string]",[f,u],arguments.length),typeof f=="object"?Object.keys(f).forEach(g=>{r.conflicts(g,f[g])}):(i.global(f),b[f]||(b[f]=[]),Array.isArray(u)?u.forEach(g=>r.conflicts(f,g)):b[f].push(u))},r.getConflicting=()=>b,r.conflicting=function(f){Object.keys(f).forEach(u=>{b[u]&&b[u].forEach(g=>{g&&f[u]!==void 0&&f[g]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",u,g))})}),i.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(b).forEach(u=>{b[u].forEach(g=>{g&&f[t.Parser.camelCase(u)]!==void 0&&f[t.Parser.camelCase(g)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",u,g))})})},r.recommendCommands=function(f,u){u=u.sort((p,R)=>R.length-p.length);let C=null,w=1/0;for(let p=0,R;(R=u[p])!==void 0;p++){let W=Ai(f,R);W<=3&&W!f[u]),b=Re(b,u=>!f[u]),r};let y=[];return r.freeze=function(){y.push({implied:o,conflicting:b})},r.unfreeze=function(){let f=y.pop();le(f,void 0,t),{implied:o,conflicting:b}=f},r}var mn=[],mt;function gt(i,e,t,n){mt=n;let s={};if(Object.prototype.hasOwnProperty.call(i,"extends")){if(typeof i.extends!="string")return s;let r=/\.json|\..*rc$/.test(i.extends),o=null;if(r)o=Pr(e,i.extends);else try{o=Ee.resolve(i.extends)}catch{return i}Sr(o),mn.push(o),s=r?JSON.parse(mt.readFileSync(o,"utf8")):Ee(i.extends),delete i.extends,s=gt(s,mt.path.dirname(o),t,mt)}return mn=[],t?Si(s,i):Object.assign({},s,i)}function Sr(i){if(mn.indexOf(i)>-1)throw new V(`Circular extended configurations: '${i}'.`)}function Pr(i,e){return mt.path.resolve(i,e)}function Si(i,e){let t={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(t,i);for(let s of Object.keys(e))n(e[s])&&n(t[s])?t[s]=Si(i[s],e[s]):t[s]=e[s];return t}var j=function(i,e,t,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!s:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(i,t):s?s.value=t:e.set(i,t),t},a=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},ne,Ve,bt,ge,fe,Ft,De,ke,Nt,be,Rt,ye,je,ue,Oe,Tt,at,oe,I,Dt,Wt,he,qe,lt,Ke,We,Lt,N,Je,Qe,Ze,T,Ut,Se,ee;function ki(i){return(e=[],t=i.process.cwd(),n)=>{let s=new jn(e,t,n,i);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}var Pi=Symbol("copyDoubleDash"),Mi=Symbol("copyDoubleDash"),gn=Symbol("deleteFromParserHintObject"),Ii=Symbol("emitWarning"),vi=Symbol("freeze"),$i=Symbol("getDollarZero"),Xe=Symbol("getParserConfiguration"),Fi=Symbol("getUsageConfiguration"),bn=Symbol("guessLocale"),Ni=Symbol("guessVersion"),Ri=Symbol("parsePositionalNumbers"),yn=Symbol("pkgUp"),Le=Symbol("populateParserHintArray"),ct=Symbol("populateParserHintSingleValueDictionary"),On=Symbol("populateParserHintArrayDictionary"),wn=Symbol("populateParserHintDictionary"),Cn=Symbol("sanitizeKey"),xn=Symbol("setKey"),_n=Symbol("unfreeze"),Ti=Symbol("validateAsync"),Di=Symbol("getCommandInstance"),Wi=Symbol("getContext"),Li=Symbol("getHasOutput"),Ui=Symbol("getLoggerInstance"),Bi=Symbol("getParseContext"),zi=Symbol("getUsageInstance"),Yi=Symbol("getValidationInstance"),Bt=Symbol("hasParseCallback"),Gi=Symbol("isGlobalContext"),et=Symbol("postProcess"),Hi=Symbol("rebase"),An=Symbol("reset"),yt=Symbol("runYargsParserAndExecuteCommands"),En=Symbol("runValidation"),Vi=Symbol("setHasOutput"),tt=Symbol("kTrackManuallySetKeys"),jn=class{constructor(e=[],t,n,s){this.customScriptName=!1,this.parsed=!1,ne.set(this,void 0),Ve.set(this,void 0),bt.set(this,{commands:[],fullCommands:[]}),ge.set(this,null),fe.set(this,null),Ft.set(this,"show-hidden"),De.set(this,null),ke.set(this,!0),Nt.set(this,{}),be.set(this,!0),Rt.set(this,[]),ye.set(this,void 0),je.set(this,{}),ue.set(this,!1),Oe.set(this,null),Tt.set(this,!0),at.set(this,void 0),oe.set(this,""),I.set(this,void 0),Dt.set(this,void 0),Wt.set(this,{}),he.set(this,null),qe.set(this,null),lt.set(this,{}),Ke.set(this,{}),We.set(this,void 0),Lt.set(this,!1),N.set(this,void 0),Je.set(this,!1),Qe.set(this,!1),Ze.set(this,!1),T.set(this,void 0),Ut.set(this,{}),Se.set(this,null),ee.set(this,void 0),j(this,N,s,"f"),j(this,We,e,"f"),j(this,Ve,t,"f"),j(this,Dt,n,"f"),j(this,ye,new It(this),"f"),this.$0=this[$i](),this[An](),j(this,ne,a(this,ne,"f"),"f"),j(this,T,a(this,T,"f"),"f"),j(this,ee,a(this,ee,"f"),"f"),j(this,I,a(this,I,"f"),"f"),a(this,I,"f").showHiddenOpt=a(this,Ft,"f"),j(this,at,this[Mi](),"f")}addHelpOpt(e,t){let n="help";return E("[string|boolean] [string]",[e,t],arguments.length),a(this,Oe,"f")&&(this[gn](a(this,Oe,"f")),j(this,Oe,null,"f")),e===!1&&t===void 0?this:(j(this,Oe,typeof e=="string"?e:n,"f"),this.boolean(a(this,Oe,"f")),this.describe(a(this,Oe,"f"),t||a(this,T,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(E("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;let n=typeof e=="string"?e:a(this,Ft,"f");return this.boolean(n),this.describe(n,t||a(this,T,"f").deferY18nLookup("Show hidden options")),a(this,I,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return E(" [string|array]",[e,t],arguments.length),this[On](this.alias.bind(this),"alias",e,t),this}array(e){return E("",[e],arguments.length),this[Le]("array",e),this[tt](e),this}boolean(e){return E("",[e],arguments.length),this[Le]("boolean",e),this[tt](e),this}check(e,t){return E(" [boolean]",[e,t],arguments.length),this.middleware((n,s)=>He(()=>e(n,s.getOptions()),r=>(r?(typeof r=="string"||r instanceof Error)&&a(this,T,"f").fail(r.toString(),r):a(this,T,"f").fail(a(this,N,"f").y18n.__("Argument check failed: %s",e.toString())),n),r=>(a(this,T,"f").fail(r.message?r.message:r.toString(),r),n)),!1,t),this}choices(e,t){return E(" [string|array]",[e,t],arguments.length),this[On](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(E(" [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new V("coerce callback must be provided");for(let n of e)this.coerce(n,t);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!t)throw new V("coerce callback must be provided");return a(this,I,"f").key[e]=!0,a(this,ye,"f").addCoerceMiddleware((n,s)=>{let r;return Object.prototype.hasOwnProperty.call(n,e)?He(()=>(r=s.getAliases(),t(n[e])),l=>{n[e]=l;let b=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[e]&&b!==!0)for(let y of r[e])n[y]=l;return n},l=>{throw new V(l.message)}):n},e),this}conflicts(e,t){return E(" [string|array]",[e,t],arguments.length),a(this,ee,"f").conflicts(e,t),this}config(e="config",t,n){return E("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=gt(e,a(this,Ve,"f"),this[Xe]()["deep-merge-config"]||!1,a(this,N,"f")),a(this,I,"f").configObjects=(a(this,I,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||a(this,T,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(s=>{a(this,I,"f").config[s]=n||!0}),this)}completion(e,t,n){return E("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),j(this,fe,e||a(this,fe,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(a(this,fe,"f"),t),n&&a(this,ge,"f").registerFunction(n),this}command(e,t,n,s,r,o){return E(" [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,s,r,o],arguments.length),a(this,ne,"f").addHandler(e,t,n,s,r,o),this}commands(e,t,n,s,r,o){return this.command(e,t,n,s,r,o)}commandDir(e,t){E(" [object]",[e,t],arguments.length);let n=a(this,Dt,"f")||a(this,N,"f").require;return a(this,ne,"f").addDirectory(e,n,a(this,N,"f").getCallerFile(),t),this}count(e){return E("",[e],arguments.length),this[Le]("count",e),this[tt](e),this}default(e,t,n){return E(" [*] [string]",[e,t,n],arguments.length),n&&(fn(e,a(this,N,"f")),a(this,I,"f").defaultDescription[e]=n),typeof t=="function"&&(fn(e,a(this,N,"f")),a(this,I,"f").defaultDescription[e]||(a(this,I,"f").defaultDescription[e]=a(this,T,"f").functionDescription(t)),t=t.call()),this[ct](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,s){return E("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,s],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),a(this,I,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:s},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(s=>{le(n,!0,a(this,N,"f")),this.demandOption(s,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(le(n,!0,a(this,N,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(s=>{le(n,!0,a(this,N,"f")),this.demandOption(s,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return E(" [string]",[e,t],arguments.length),this[ct](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return E(" [string|boolean]",[e,t],arguments.length),a(this,I,"f").deprecatedOptions[e]=t,this}describe(e,t){return E(" [string]",[e,t],arguments.length),this[xn](e,!0),a(this,T,"f").describe(e,t),this}detectLocale(e){return E("",[e],arguments.length),j(this,ke,e,"f"),this}env(e){return E("[string|boolean]",[e],arguments.length),e===!1?delete a(this,I,"f").envPrefix:a(this,I,"f").envPrefix=e||"",this}epilogue(e){return E("",[e],arguments.length),a(this,T,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return E(" [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):a(this,T,"f").example(e,t),this}exit(e,t){j(this,ue,!0,"f"),j(this,De,t,"f"),a(this,be,"f")&&a(this,N,"f").process.exit(e)}exitProcess(e=!0){return E("[boolean]",[e],arguments.length),j(this,be,e,"f"),this}fail(e){if(E("",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new V("Invalid first argument. Expected function or boolean 'false'");return a(this,T,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return E(" [function]",[e,t],arguments.length),t?a(this,ge,"f").getCompletion(e,t):new Promise((n,s)=>{a(this,ge,"f").getCompletion(e,(r,o)=>{r?s(r):n(o)})})}getDemandedOptions(){return E([],0),a(this,I,"f").demandedOptions}getDemandedCommands(){return E([],0),a(this,I,"f").demandedCommands}getDeprecatedOptions(){return E([],0),a(this,I,"f").deprecatedOptions}getDetectLocale(){return a(this,ke,"f")}getExitProcess(){return a(this,be,"f")}getGroups(){return Object.assign({},a(this,je,"f"),a(this,Ke,"f"))}getHelp(){if(j(this,ue,!0,"f"),!a(this,T,"f").hasCachedHelpMessage()){if(!this.parsed){let t=this[yt](a(this,We,"f"),void 0,void 0,0,!0);if(k(t))return t.then(()=>a(this,T,"f").help())}let e=a(this,ne,"f").runDefaultBuilderOn(this);if(k(e))return e.then(()=>a(this,T,"f").help())}return Promise.resolve(a(this,T,"f").help())}getOptions(){return a(this,I,"f")}getStrict(){return a(this,Je,"f")}getStrictCommands(){return a(this,Qe,"f")}getStrictOptions(){return a(this,Ze,"f")}global(e,t){return E(" [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?a(this,I,"f").local=a(this,I,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{a(this,I,"f").local.includes(n)||a(this,I,"f").local.push(n)}),this}group(e,t){E(" ",[e,t],arguments.length);let n=a(this,Ke,"f")[t]||a(this,je,"f")[t];a(this,Ke,"f")[t]&&delete a(this,Ke,"f")[t];let s={};return a(this,je,"f")[t]=(n||[]).concat(e).filter(r=>s[r]?!1:s[r]=!0),this}hide(e){return E("",[e],arguments.length),a(this,I,"f").hiddenOptions.push(e),this}implies(e,t){return E(" [number|string|array]",[e,t],arguments.length),a(this,ee,"f").implies(e,t),this}locale(e){return E("[string]",[e],arguments.length),e===void 0?(this[bn](),a(this,N,"f").y18n.getLocale()):(j(this,ke,!1,"f"),a(this,N,"f").y18n.setLocale(e),this)}middleware(e,t,n){return a(this,ye,"f").addMiddleware(e,!!t,n)}nargs(e,t){return E(" [number]",[e,t],arguments.length),this[ct](this.nargs.bind(this),"narg",e,t),this}normalize(e){return E("",[e],arguments.length),this[Le]("normalize",e),this}number(e){return E("",[e],arguments.length),this[Le]("number",e),this[tt](e),this}option(e,t){if(E(" [object]",[e,t],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof t!="object"&&(t={}),this[tt](e),a(this,Se,"f")&&(e==="version"||t?.alias==="version")&&this[Ii](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(` -`),void 0,"versionWarning"),a(this,I,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);let n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);let s=t.demand||t.required||t.require;s&&this.demand(e,s),t.demandOption&&this.demandOption(e,typeof t.demandOption=="string"?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),"default"in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type==="boolean")&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type==="array")&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type==="number")&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type==="string")&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type==="count")&&this.count(e),typeof t.global=="boolean"&&this.global(e,t.global),t.defaultDescription&&(a(this,I,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);let r=t.describe||t.description||t.desc,o=a(this,T,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(o,e)||typeof r=="string")&&this.describe(e,r),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){E("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[vi](),typeof e>"u"&&(e=a(this,We,"f")),typeof t=="object"&&(j(this,qe,t,"f"),t=n),typeof t=="function"&&(j(this,he,t,"f"),t=!1),t||j(this,We,e,"f"),a(this,he,"f")&&j(this,be,!1,"f");let s=this[yt](e,!!t),r=this.parsed;return a(this,ge,"f").setParsed(this.parsed),k(s)?s.then(o=>(a(this,he,"f")&&a(this,he,"f").call(this,a(this,De,"f"),o,a(this,oe,"f")),o)).catch(o=>{throw a(this,he,"f")&&a(this,he,"f")(o,this.parsed.argv,a(this,oe,"f")),o}).finally(()=>{this[_n](),this.parsed=r}):(a(this,he,"f")&&a(this,he,"f").call(this,a(this,De,"f"),s,a(this,oe,"f")),this[_n](),this.parsed=r,s)}parseAsync(e,t,n){let s=this.parse(e,t,n);return k(s)?s:Promise.resolve(s)}parseSync(e,t,n){let s=this.parse(e,t,n);if(k(s))throw new V(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(e){return E("",[e],arguments.length),j(this,Wt,e,"f"),this}pkgConf(e,t){E(" [string]",[e,t],arguments.length);let n=null,s=this[yn](t||a(this,Ve,"f"));return s[e]&&typeof s[e]=="object"&&(n=gt(s[e],t||a(this,Ve,"f"),this[Xe]()["deep-merge-config"]||!1,a(this,N,"f")),a(this,I,"f").configObjects=(a(this,I,"f").configObjects||[]).concat(n)),this}positional(e,t){E(" ",[e,t],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=Re(t,(o,l)=>o==="type"&&!["string","number","boolean"].includes(l)?!1:n.includes(o));let s=a(this,bt,"f").fullCommands[a(this,bt,"f").fullCommands.length-1],r=s?a(this,ne,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return rt(r).forEach(o=>{let l=r[o];Array.isArray(l)?l.indexOf(e)!==-1&&(t[o]=!0):l[e]&&!(o in t)&&(t[o]=l[e])}),this.group(e,a(this,T,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return E("[boolean]",[e],arguments.length),j(this,Lt,e,"f"),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){return E(" [number]",[e],arguments.length),typeof e=="string"&&a(this,I,"f").narg[e]?this:(this[ct](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return E("[string] [string]",[e,t],arguments.length),e=e||this.$0,a(this,at,"f").log(a(this,ge,"f").generateCompletionScript(e,t||a(this,fe,"f")||"completion")),this}showHelp(e){if(E("[string|function]",[e],arguments.length),j(this,ue,!0,"f"),!a(this,T,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[yt](a(this,We,"f"),void 0,void 0,0,!0);if(k(n))return n.then(()=>{a(this,T,"f").showHelp(e)}),this}let t=a(this,ne,"f").runDefaultBuilderOn(this);if(k(t))return t.then(()=>{a(this,T,"f").showHelp(e)}),this}return a(this,T,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return E("[boolean|string] [string]",[e,t],arguments.length),a(this,T,"f").showHelpOnFail(e,t),this}showVersion(e){return E("[string|function]",[e],arguments.length),a(this,T,"f").showVersion(e),this}skipValidation(e){return E("",[e],arguments.length),this[Le]("skipValidation",e),this}strict(e){return E("[boolean]",[e],arguments.length),j(this,Je,e!==!1,"f"),this}strictCommands(e){return E("[boolean]",[e],arguments.length),j(this,Qe,e!==!1,"f"),this}strictOptions(e){return E("[boolean]",[e],arguments.length),j(this,Ze,e!==!1,"f"),this}string(e){return E("",[e],arguments.length),this[Le]("string",e),this[tt](e),this}terminalWidth(){return E([],0),a(this,N,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return E("",[e],arguments.length),j(this,ke,!1,"f"),a(this,N,"f").y18n.updateLocale(e),this}usage(e,t,n,s){if(E(" [string|boolean] [function|object] [function]",[e,t,n,s],arguments.length),t!==void 0){if(le(e,null,a(this,N,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,s);throw new V(".usage() description must start with $0 if being used as alias for .command()")}else return a(this,T,"f").usage(e),this}usageConfiguration(e){return E("",[e],arguments.length),j(this,Ut,e,"f"),this}version(e,t,n){let s="version";if(E("[boolean|string] [string] [string]",[e,t,n],arguments.length),a(this,Se,"f")&&(this[gn](a(this,Se,"f")),a(this,T,"f").version(void 0),j(this,Se,null,"f")),arguments.length===0)n=this[Ni](),e=s;else if(arguments.length===1){if(e===!1)return this;n=e,e=s}else arguments.length===2&&(n=t,t=void 0);return j(this,Se,typeof e=="string"?e:s,"f"),t=t||a(this,T,"f").deferY18nLookup("Show version number"),a(this,T,"f").version(n||void 0),this.boolean(a(this,Se,"f")),this.describe(a(this,Se,"f"),t),this}wrap(e){return E("",[e],arguments.length),a(this,T,"f").wrap(e),this}[(ne=new WeakMap,Ve=new WeakMap,bt=new WeakMap,ge=new WeakMap,fe=new WeakMap,Ft=new WeakMap,De=new WeakMap,ke=new WeakMap,Nt=new WeakMap,be=new WeakMap,Rt=new WeakMap,ye=new WeakMap,je=new WeakMap,ue=new WeakMap,Oe=new WeakMap,Tt=new WeakMap,at=new WeakMap,oe=new WeakMap,I=new WeakMap,Dt=new WeakMap,Wt=new WeakMap,he=new WeakMap,qe=new WeakMap,lt=new WeakMap,Ke=new WeakMap,We=new WeakMap,Lt=new WeakMap,N=new WeakMap,Je=new WeakMap,Qe=new WeakMap,Ze=new WeakMap,T=new WeakMap,Ut=new WeakMap,Se=new WeakMap,ee=new WeakMap,Pi)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[Mi](){return{log:(...e)=>{this[Bt]()||console.log(...e),j(this,ue,!0,"f"),a(this,oe,"f").length&&j(this,oe,a(this,oe,"f")+` -`,"f"),j(this,oe,a(this,oe,"f")+e.join(" "),"f")},error:(...e)=>{this[Bt]()||console.error(...e),j(this,ue,!0,"f"),a(this,oe,"f").length&&j(this,oe,a(this,oe,"f")+` -`,"f"),j(this,oe,a(this,oe,"f")+e.join(" "),"f")}}}[gn](e){rt(a(this,I,"f")).forEach(t=>{if((s=>s==="configObjects")(t))return;let n=a(this,I,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete a(this,T,"f").getDescriptions()[e]}[Ii](e,t,n){a(this,Nt,"f")[n]||(a(this,N,"f").process.emitWarning(e,t),a(this,Nt,"f")[n]=!0)}[vi](){a(this,Rt,"f").push({options:a(this,I,"f"),configObjects:a(this,I,"f").configObjects.slice(0),exitProcess:a(this,be,"f"),groups:a(this,je,"f"),strict:a(this,Je,"f"),strictCommands:a(this,Qe,"f"),strictOptions:a(this,Ze,"f"),completionCommand:a(this,fe,"f"),output:a(this,oe,"f"),exitError:a(this,De,"f"),hasOutput:a(this,ue,"f"),parsed:this.parsed,parseFn:a(this,he,"f"),parseContext:a(this,qe,"f")}),a(this,T,"f").freeze(),a(this,ee,"f").freeze(),a(this,ne,"f").freeze(),a(this,ye,"f").freeze()}[$i](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,N,"f").process.argv()[0])?t=a(this,N,"f").process.argv().slice(1,2):t=a(this,N,"f").process.argv().slice(0,1),e=t.map(n=>{let s=this[Hi](a(this,Ve,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length{if(l.includes("package.json"))return"package.json"});le(r,void 0,a(this,N,"f")),n=JSON.parse(a(this,N,"f").readFileSync(r,"utf8"))}catch{}return a(this,lt,"f")[t]=n||{},a(this,lt,"f")[t]}[Le](e,t){t=[].concat(t),t.forEach(n=>{n=this[Cn](n),a(this,I,"f")[e].push(n)})}[ct](e,t,n,s){this[wn](e,t,n,s,(r,o,l)=>{a(this,I,"f")[r][o]=l})}[On](e,t,n,s){this[wn](e,t,n,s,(r,o,l)=>{a(this,I,"f")[r][o]=(a(this,I,"f")[r][o]||[]).concat(l)})}[wn](e,t,n,s,r){if(Array.isArray(n))n.forEach(o=>{e(o,s)});else if((o=>typeof o=="object")(n))for(let o of rt(n))e(o,n[o]);else r(t,this[Cn](n),s)}[Cn](e){return e==="__proto__"?"___proto___":e}[xn](e,t){return this[ct](this[xn].bind(this),"key",e,t),this}[_n](){var e,t,n,s,r,o,l,b,y,m,f,u;let g=a(this,Rt,"f").pop();le(g,void 0,a(this,N,"f"));let C;e=this,t=this,n=this,s=this,r=this,o=this,l=this,b=this,y=this,m=this,f=this,u=this,{options:{set value(w){j(e,I,w,"f")}}.value,configObjects:C,exitProcess:{set value(w){j(t,be,w,"f")}}.value,groups:{set value(w){j(n,je,w,"f")}}.value,output:{set value(w){j(s,oe,w,"f")}}.value,exitError:{set value(w){j(r,De,w,"f")}}.value,hasOutput:{set value(w){j(o,ue,w,"f")}}.value,parsed:this.parsed,strict:{set value(w){j(l,Je,w,"f")}}.value,strictCommands:{set value(w){j(b,Qe,w,"f")}}.value,strictOptions:{set value(w){j(y,Ze,w,"f")}}.value,completionCommand:{set value(w){j(m,fe,w,"f")}}.value,parseFn:{set value(w){j(f,he,w,"f")}}.value,parseContext:{set value(w){j(u,qe,w,"f")}}.value}=g,a(this,I,"f").configObjects=C,a(this,T,"f").unfreeze(),a(this,ee,"f").unfreeze(),a(this,ne,"f").unfreeze(),a(this,ye,"f").unfreeze()}[Ti](e,t){return He(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[Di].bind(this),getContext:this[Wi].bind(this),getHasOutput:this[Li].bind(this),getLoggerInstance:this[Ui].bind(this),getParseContext:this[Bi].bind(this),getParserConfiguration:this[Xe].bind(this),getUsageConfiguration:this[Fi].bind(this),getUsageInstance:this[zi].bind(this),getValidationInstance:this[Yi].bind(this),hasParseCallback:this[Bt].bind(this),isGlobalContext:this[Gi].bind(this),postProcess:this[et].bind(this),reset:this[An].bind(this),runValidation:this[En].bind(this),runYargsParserAndExecuteCommands:this[yt].bind(this),setHasOutput:this[Vi].bind(this)}}[Di](){return a(this,ne,"f")}[Wi](){return a(this,bt,"f")}[Li](){return a(this,ue,"f")}[Ui](){return a(this,at,"f")}[Bi](){return a(this,qe,"f")||{}}[zi](){return a(this,T,"f")}[Yi](){return a(this,ee,"f")}[Bt](){return!!a(this,he,"f")}[Gi](){return a(this,Tt,"f")}[et](e,t,n,s){return n||k(e)||(t||(e=this[Pi](e)),(this[Xe]()["parse-positional-numbers"]||this[Xe]()["parse-positional-numbers"]===void 0)&&(e=this[Ri](e)),s&&(e=Ge(e,this,a(this,ye,"f").getMiddleware(),!1))),e}[An](e={}){j(this,I,a(this,I,"f")||{},"f");let t={};t.local=a(this,I,"f").local||[],t.configObjects=a(this,I,"f").configObjects||[];let n={};t.local.forEach(o=>{n[o]=!0,(e[o]||[]).forEach(l=>{n[l]=!0})}),Object.assign(a(this,Ke,"f"),Object.keys(a(this,je,"f")).reduce((o,l)=>{let b=a(this,je,"f")[l].filter(y=>!(y in n));return b.length>0&&(o[l]=b),o},{})),j(this,je,{},"f");let s=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],r=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return s.forEach(o=>{t[o]=(a(this,I,"f")[o]||[]).filter(l=>!n[l])}),r.forEach(o=>{t[o]=Re(a(this,I,"f")[o],l=>!n[l])}),t.envPrefix=a(this,I,"f").envPrefix,j(this,I,t,"f"),j(this,T,a(this,T,"f")?a(this,T,"f").reset(n):wi(this,a(this,N,"f")),"f"),j(this,ee,a(this,ee,"f")?a(this,ee,"f").reset(n):ji(this,a(this,T,"f"),a(this,N,"f")),"f"),j(this,ne,a(this,ne,"f")?a(this,ne,"f").reset():bi(a(this,T,"f"),a(this,ee,"f"),a(this,ye,"f"),a(this,N,"f")),"f"),a(this,ge,"f")||j(this,ge,_i(this,a(this,T,"f"),a(this,ne,"f"),a(this,N,"f")),"f"),a(this,ye,"f").reset(),j(this,fe,null,"f"),j(this,oe,"","f"),j(this,De,null,"f"),j(this,ue,!1,"f"),this.parsed=!1,this}[Hi](e,t){return a(this,N,"f").path.relative(e,t)}[yt](e,t,n,s=0,r=!1){let o=!!n||r;e=e||a(this,We,"f"),a(this,I,"f").__=a(this,N,"f").y18n.__,a(this,I,"f").configuration=this[Xe]();let l=!!a(this,I,"f").configuration["populate--"],b=Object.assign({},a(this,I,"f").configuration,{"populate--":!0}),y=a(this,N,"f").Parser.detailed(e,Object.assign({},a(this,I,"f"),{configuration:{"parse-positional-numbers":!1,...b}})),m=Object.assign(y.argv,a(this,qe,"f")),f,u=y.aliases,g=!1,C=!1;Object.keys(m).forEach(w=>{w===a(this,Oe,"f")&&m[w]?g=!0:w===a(this,Se,"f")&&m[w]&&(C=!0)}),m.$0=this.$0,this.parsed=y,s===0&&a(this,T,"f").clearCachedHelpMessage();try{if(this[bn](),t)return this[et](m,l,!!n,!1);a(this,Oe,"f")&&[a(this,Oe,"f")].concat(u[a(this,Oe,"f")]||[]).filter(B=>B.length>1).includes(""+m._[m._.length-1])&&(m._.pop(),g=!0),j(this,Tt,!1,"f");let w=a(this,ne,"f").getCommands(),p=a(this,ge,"f").completionKey in m,R=g||p||r;if(m._.length){if(w.length){let W;for(let B=s||0,L;m._[B]!==void 0;B++)if(L=String(m._[B]),w.includes(L)&&L!==a(this,fe,"f")){let G=a(this,ne,"f").runCommand(L,this,y,B+1,r,g||C||r);return this[et](G,l,!!n,!1)}else if(!W&&L!==a(this,fe,"f")){W=L;break}!a(this,ne,"f").hasDefaultCommand()&&a(this,Lt,"f")&&W&&!R&&a(this,ee,"f").recommendCommands(W,w)}a(this,fe,"f")&&m._.includes(a(this,fe,"f"))&&!p&&(a(this,be,"f")&&Te(!0),this.showCompletionScript(),this.exit(0))}if(a(this,ne,"f").hasDefaultCommand()&&!R){let W=a(this,ne,"f").runCommand(null,this,y,0,r,g||C||r);return this[et](W,l,!!n,!1)}if(p){a(this,be,"f")&&Te(!0),e=[].concat(e);let W=e.slice(e.indexOf(`--${a(this,ge,"f").completionKey}`)+1);return a(this,ge,"f").getCompletion(W,(B,L)=>{if(B)throw new V(B.message);(L||[]).forEach(G=>{a(this,at,"f").log(G)}),this.exit(0)}),this[et](m,!l,!!n,!1)}if(a(this,ue,"f")||(g?(a(this,be,"f")&&Te(!0),o=!0,this.showHelp("log"),this.exit(0)):C&&(a(this,be,"f")&&Te(!0),o=!0,a(this,T,"f").showVersion("log"),this.exit(0))),!o&&a(this,I,"f").skipValidation.length>0&&(o=Object.keys(m).some(W=>a(this,I,"f").skipValidation.indexOf(W)>=0&&m[W]===!0)),!o){if(y.error)throw new V(y.error.message);if(!p){let W=this[En](u,{},y.error);n||(f=Ge(m,this,a(this,ye,"f").getMiddleware(),!0)),f=this[Ti](W,f??m),k(f)&&!n&&(f=f.then(()=>Ge(m,this,a(this,ye,"f").getMiddleware(),!1)))}}}catch(w){if(w instanceof V)a(this,T,"f").fail(w.message,w);else throw w}return this[et](f??m,l,!!n,!0)}[En](e,t,n,s){let r={...this.getDemandedOptions()};return o=>{if(n)throw new V(n.message);a(this,ee,"f").nonOptionCount(o),a(this,ee,"f").requiredArguments(o,r);let l=!1;a(this,Qe,"f")&&(l=a(this,ee,"f").unknownCommands(o)),a(this,Je,"f")&&!l?a(this,ee,"f").unknownArguments(o,e,t,!!s):a(this,Ze,"f")&&a(this,ee,"f").unknownArguments(o,e,{},!1,!1),a(this,ee,"f").limitedChoices(o),a(this,ee,"f").implications(o),a(this,ee,"f").conflicting(o)}}[Vi](){j(this,ue,!0,"f")}[tt](e){if(typeof e=="string")a(this,I,"f").key[e]=!0;else for(let t of e)a(this,I,"f").key[t]=!0}};function yi(i){return!!i&&typeof i.getInternalMethods=="function"}var Mr=ki(cn),qi=Mr;var Ki="8.2.0";function Ji(i){return i instanceof Error&&"exitCode"in i&&typeof i.exitCode=="number"}var ts=bs(es(),1);import Hr from"@pinojs/json-colorizer";var Gr=/("(?:[^\\"]|\\.)*")|[:,]/g;function Sn(i,e={}){let t=JSON.stringify([1],void 0,e.indent===void 0?2:e.indent).slice(2,-3),n=t===""?1/0:e.maxLength===void 0?80:e.maxLength,{replacer:s}=e;return function r(o,l,b){o&&typeof o.toJSON=="function"&&(o=o.toJSON());let y=JSON.stringify(o,s);if(y===void 0)return y;let m=n-l.length-b;if(y.length<=m){let f=y.replace(Gr,(u,g)=>g||`${u} `);if(f.length<=m)return f}if(s!=null&&(o=JSON.parse(y),s=void 0),typeof o=="object"&&o!==null){let f=l+t,u=[],g=0,C,w;if(Array.isArray(o)){C="[",w="]";let{length:p}=o;for(;g0)return[C,t+u.join(`, -${f}`),w].join(` -${l}`)}return y}(i,"",0)}function Pn(i){return Hr(Sn(i,{indent:2,replacer(e,t){return typeof t=="function"?t.name:t}}),{colors:{BRACKET:"gray"}})}var Vr=(i,e,t)=>{let n=[...i];for(let[s,r]of e.entries())n[s]===void 0?n[s]=t.cloneUnlessOtherwiseSpecified(r,t):t.isMergeableObject(r)?n[s]=zt(i[s],r,t):i.includes(r)||n.push(r);return n};function zt(i,e,t={arrayMerge:Vr}){return(0,ts.default)(i,e,t)}import{findWorkspaces as Ul,findWorkspacesRoot as kr}from"find-workspaces";import qr from"fs-extra";import Kr from"node:path";function ns(){let i=kn();if(i===void 0)throw new Error("No package.json found.");return Kr.dirname(i)}function Jr(){let i=kr();return i!==null?i.location:ns()}function is(i){if(i==="workspace-root")return Jr();if(i==="package-dir")return ns();if(typeof i=="string"){if(!qr.pathExistsSync(i))throw new Error(`Custom cwd directory does not exist: ${i}`);return i}return process.cwd()}import ss from"node:fs/promises";async function Qr(i,e){try{let{default:t}=await import("prettier"),n=await t.resolveConfig(i),s=await t.format(e,{filepath:i,...n});await ss.writeFile(i,s,"utf8")}catch{console.warn(`Skipped formatting ${i} since Prettier is not installed.`)}}async function wt(i){try{let e=await ss.readFile(i,"utf8");await Qr(i,e)}catch{}}import{Transform as Zr}from"node:stream";function Yt(i,e){return new Zr({transform(t,n,s){let o=t.toString().split(/\r?\n/).filter(l=>l.trim().length>0).map(l=>`${i?e===void 0?i:Fe[e](i):""} ${l} -`).join("");this.push(o),s()}})}async function rs(i){let e=[];return new Promise((t,n)=>{i.on("data",s=>e.push(s)),i.on("error",s=>{n(s)}),i.on("end",()=>{t(Buffer.concat(e).toString("utf8"))})})}function Mn(i,e){return e===1?i:i+"s"}async function io(i,e,t,n,s){let r=1,o;if(n.logPrefix===void 0)o=i;else{let l=Yt(n.logPrefix,n.logColor);l.pipe(i),o=l}s&&o.write(Fe.bold(`Running: "${n.name}() with Positional arguments: ${String(e)} and Option flags: ${String(t)}"`));try{r=await n.execute(o,e,t)}catch(l){console.error(String(l)),r=1}return r}async function so(i,e,t,n,s){let r=1,o;if(n.logPrefix===void 0)o=i;else{let g=Yt(n.logPrefix,n.logColor);g.pipe(i),o=g}let l=n.subcommands??[],b=[...n.receivePositionalArguments?e:[],...n.positionalArguments??[]],y=[...n.receiveOptionFlags?t:[],...n.optionFlags??[]],m=[...l,...y,...b],f=is(n.cwdOverride);s&&o.write(`Running: "${n.name} ${m.join(" ")}"`);let u=n.prettyJsonOutput?new to:o;try{let g=eo(n.name,m,{cwd:f,env:{...process.env.NO_COLOR===void 0?{FORCE_COLOR:"true"}:{},NODE_OPTIONS:"--experimental-strip-types --disable-warning=ExperimentalWarning"},preferLocal:!0,reject:!1,stdin:"inherit"});if(g.stdout.pipe(u,{end:!1}),g.stderr.pipe(u,{end:!1}),await g,n.prettyJsonOutput){u.end();let C=await rs(u),w=Pn(JSON.parse(C)).split(` -`);for(let p of w)o.write(`${p} -`)}r=g.exitCode??1}catch(g){console.error(`${n.name} failed with error:`),console.error(g),Ji(g)&&(r=typeof g.exitCode=="number"?g.exitCode:1)}return r}function ro(i){return"execute"in i}async function Ht(i,e,t,n,s,r){let o=[];for(let l of n){let b=await(ro(l)?io(i,e,t,l,s):so(i,e,t,l,s));o.push({exitCode:b,name:l.name})}if(r){let l=o.filter(({exitCode:m})=>m===0).map(({name:m})=>m),b=o.filter(({exitCode:m})=>m!==0).map(({name:m})=>m),y=o.length;l.length>0&&i.write(`\u2705 ${Fe.green.bold(`${l.length} / ${y} ${Mn("Command",l.length)} Succeeded: `)} ${Fe.green(l.join(", "))} -`),b.length>0&&i.write(`\u274C ${Fe.red.bold(`${b.length} / ${y} ${Mn("Command",b.length)} Failed: `)} ${Fe.red(b.join(", "))} -`)}return o.every(({exitCode:l})=>l===0)?0:1}async function oo(i,e,t,n){let s=await Qt();if(s===void 0)throw new Error("The `init` command must be used in a directory with a package.json file");let r=await Qt({cwd:no(import.meta.url)});if(r===void 0)return i.write(`Error: The script being called was not in a package, weird. -`),1;let o=Gt.join(Gt.dirname(r),"init"),l=Gt.dirname(s),b=(e==="file"||e==="package")&&t!==void 0&&n!==void 0;try{if(b){let f=Object.keys(n)[0];if(e==="package"){let u=ve.readJSONSync(s);i.write(`Merging: -Package config key "${f} \u2192 "${l}" (Because --location is set to "package") -`);let g=zt(u,n);ve.writeJSONSync(s,g,{spaces:2}),await wt(s)}}if(!await ve.pathExists(o))return 0;if((await ve.readdir(o)).length===0)return i.write(`Source directory "${o}" is empty. -`),0;i.write(`Adding initial configuration files from: -"${o}" \u2192 "${l}" -`),await ve.copy(o,l,{async filter(f,u){let g=os.statSync(f).isFile(),C=os.existsSync(u);if(g){if(b&&e==="package"&&f.includes(t))return C?(i.write(`Deleting: -"${f}" \u2192 "${u}" (Because --location is set to "package") -`),ve.removeSync(u)):i.write(`Skipping: -"${f}" \u2192 "${u}" (Because --location is set to "package") -`),!1;if(C&&(u.includes(".vscode/")||u.includes("package.json"))&&Gt.extname(u)===".json"){i.write(`Merging: -"${f}" \u2192 "${u}" -`);let w=ve.readJSONSync(f),p=ve.readJSONSync(u),R=zt(p,w);return ve.writeJSONSync(u,R,{spaces:2}),await wt(u),!1}return C?(i.write(`Overwriting: -"${f}" \u2192 "${u}" -`),await wt(u),!0):(i.write(`Copying: -"${f}" \u2192 "${u}" -`),await wt(u),!0)}return!0},overwrite:!0})}catch(y){return console.error(String(y)),1}return 0}async function as(i){let{commands:{fix:e,init:t,lint:n,printConfig:s},description:r,logColor:o,logPrefix:l,name:b,showSummary:y,verbose:m}=i,f=Yt(l,o);f.pipe(process.stdout);let u=qi(an(process.argv)).scriptName(b).usage("$0 ",r);t!==void 0&&u.command({builder(g){return t.locationOptionFlag?g.option("location",{choices:["file","package"],default:"file",description:"TK",type:"string"}):g},command:"init",describe:t.description??`Initialize by copying starter config files to your project root${t.locationOptionFlag?" or to your package.json file.":"."}`,async handler(g){let C=t.locationOptionFlag?g.location:void 0,p=await Ht(f,[],C===void 0?[]:["--location",C],[{async execute(R,W,B){return oo(R,B.at(1),t.configFile,t.configPackageJson)},name:"copyAndMergeInitFiles"},...t.commands??[]]);process.exit(p)}}),n!==void 0&&u.command({builder(g){return n.positionalArgumentMode==="none"?g:g.positional("files",{array:!0,...n.positionalArgumentDefault===void 0?{}:{default:n.positionalArgumentDefault},describe:"Files or glob pattern to lint.",type:"string"})},command:n.positionalArgumentMode==="none"?"lint [files..]":"lint ",describe:n.description,async handler(g){let C=g.files??[],w=await Ht(f,C,[],n.commands,m,y);process.exit(w)}}),e!==void 0&&u.command({builder(g){return e.positionalArgumentMode==="none"?g:g.positional("files",{array:!0,...e.positionalArgumentDefault===void 0?{}:{default:e.positionalArgumentDefault},describe:"Files or glob pattern to fix.",type:"string"})},command:e.positionalArgumentMode==="none"?"fix [files..]":"fix ",describe:e.description,async handler(g){let C=g.files??[],w=await Ht(f,C,[],e.commands,m,y);process.exit(w)}}),s!==void 0&&u.command({builder(g){return s.positionalArgumentMode==="none"?g:g.positional("file",{...s.positionalArgumentDefault===void 0?{}:{default:s.positionalArgumentDefault},describe:"File or glob pattern to TK",type:"string"})},command:s.positionalArgumentMode==="none"?"print-config":s.positionalArgumentMode==="optional"?"print-config [file]":"print-config ",describe:s.description,async handler(g){let C=g.file??void 0,p=await Ht(f,C===void 0?[]:[C],[],s.commands,m,y);process.exit(p)}}),u.alias("h","help"),u.version(Ki),u.alias("v","version"),u.help(),u.wrap(process.stdout.isTTY?Math.min(120,u.terminalWidth()):0),await u.parseAsync()}function ls(i){return{async execute(e){let t=await ao(i);if(t===void 0)return 1;let{config:n,filepath:s,isEmpty:r}=t;if(e.write(`Found ${i} configuration at "${s}" -`),r)return e.write(`Configuration is empty. -`),0;let o=Pn(n).split(` -`);for(let l of o)e.write(`${l} -`);return 0},name:`Cosmicconfig ${i}`}}async function ao(i){let e=Xr(i,{searchStrategy:"project"});try{if(await e.search()===null){console.error(`No ${i} configuration found.`);return}}catch(t){console.error(`Error while searching for ${i} configuration:`,t);return}}var In={fileRun:"Matches files below the current working directory by default.",monorepoRun:"In a monorepo, it will also run in all packages below the current working directory.",monorepoSearch:"Searches up to the root of a monorepo if necessary.",multiArgumentCaveat:"Will use file arguments / globs where possible if provided, but some of the invoked tools only operate at the package-scope.",multiOptionCaveat:"Will use option flags where possible if provided, but some of the invoked tools will ignore them.",optionalFileRun:"Package-scoped by default, file-scoped if a file argument is provided.",packageRun:"Package-scoped",packageSearch:"Package-scoped"};var cs={commands:{init:{configFile:".remarkrc.js",configPackageJson:{remarkConfig:{plugins:["@envsa/remark-config"]}},locationOptionFlag:!0},printConfig:{commands:[ls("remark")],description:`Print the effective Remark configuration. ${In.packageSearch} ${In.monorepoSearch}`,positionalArgumentMode:"none"}},description:"Envsa's Remark and Remark Lint shared configuration tools. (Actual linting and fixing is managed through @envsa/eslint-config.)",logColor:"blue",logPrefix:"[remarklint]",name:"envsa-remark",order:8};await as(cs); -/*! Bundled license information: - -yargs-parser/build/lib/string-utils.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/tokenize-arg-string.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/yargs-parser-types.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/yargs-parser.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/index.js: - (** - * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js - * CJS and ESM environments. - * - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) -*/ +// Placeholder, will be replaced by the actual CLI script during the build process diff --git a/packages/typescript-config/bin/cli.js b/packages/typescript-config/bin/cli.js index bcdff63..07ff484 100755 --- a/packages/typescript-config/bin/cli.js +++ b/packages/typescript-config/bin/cli.js @@ -1,132 +1,2 @@ #!/usr/bin/env node -var cs=Object.create;var In=Object.defineProperty;var fs=Object.getOwnPropertyDescriptor;var us=Object.getOwnPropertyNames;var hs=Object.getPrototypeOf,ds=Object.prototype.hasOwnProperty;var Ee=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var ps=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var ms=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of us(e))!ds.call(i,s)&&s!==t&&In(i,s,{get:()=>e[s],enumerable:!(n=fs(e,s))||n.enumerable});return i};var gs=(i,e,t)=>(t=i!=null?cs(hs(i)):{},ms(e||!i||!i.__esModule?In(t,"default",{value:i,enumerable:!0}):t,i));var Xi=ps(($l,Zi)=>{"use strict";var Ir=function(e){return $r(e)&&!vr(e)};function $r(i){return!!i&&typeof i=="object"}function vr(i){var e=Object.prototype.toString.call(i);return e==="[object RegExp]"||e==="[object Date]"||Rr(i)}var Fr=typeof Symbol=="function"&&Symbol.for,Nr=Fr?Symbol.for("react.element"):60103;function Rr(i){return i.$$typeof===Nr}function Tr(i){return Array.isArray(i)?[]:{}}function Ot(i,e){return e.clone!==!1&&e.isMergeableObject(i)?ft(Tr(i),i,e):i}function Wr(i,e,t){return i.concat(e).map(function(n){return Ot(n,t)})}function Dr(i,e){if(!e.customMerge)return ft;var t=e.customMerge(i);return typeof t=="function"?t:ft}function Lr(i){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(i).filter(function(e){return Object.propertyIsEnumerable.call(i,e)}):[]}function Ji(i){return Object.keys(i).concat(Lr(i))}function Qi(i,e){try{return e in i}catch{return!1}}function Ur(i,e){return Qi(i,e)&&!(Object.hasOwnProperty.call(i,e)&&Object.propertyIsEnumerable.call(i,e))}function Br(i,e,t){var n={};return t.isMergeableObject(i)&&Ji(i).forEach(function(s){n[s]=Ot(i[s],t)}),Ji(e).forEach(function(s){Ur(i,s)||(Qi(i,s)&&t.isMergeableObject(e[s])?n[s]=Dr(s,t)(i[s],e[s],t):n[s]=Ot(e[s],t))}),n}function ft(i,e,t){t=t||{},t.arrayMerge=t.arrayMerge||Wr,t.isMergeableObject=t.isMergeableObject||Ir,t.cloneUnlessOtherwiseSpecified=Ot;var n=Array.isArray(e),s=Array.isArray(i),r=n===s;return r?n?t.arrayMerge(i,e,t):Br(i,e,t):Ot(e,t)}ft.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(n,s){return ft(n,s,t)},{})};var zr=ft;Zi.exports=zr});var $n=(i=0)=>e=>`\x1B[${e+i}m`,vn=(i=0)=>e=>`\x1B[${38+i};5;${e}m`,Fn=(i=0)=>(e,t,n)=>`\x1B[${38+i};2;${e};${t};${n}m`,k={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},oo=Object.keys(k.modifier),bs=Object.keys(k.color),ys=Object.keys(k.bgColor),ao=[...bs,...ys];function Os(){let i=new Map;for(let[e,t]of Object.entries(k)){for(let[n,s]of Object.entries(t))k[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[n]=k[n],i.set(s[0],s[1]);Object.defineProperty(k,e,{value:t,enumerable:!1})}return Object.defineProperty(k,"codes",{value:i,enumerable:!1}),k.color.close="\x1B[39m",k.bgColor.close="\x1B[49m",k.color.ansi=$n(),k.color.ansi256=vn(),k.color.ansi16m=Fn(),k.bgColor.ansi=$n(10),k.bgColor.ansi256=vn(10),k.bgColor.ansi16m=Fn(10),Object.defineProperties(k,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(r=>r+r).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>k.rgbToAnsi256(...k.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,s;if(e>=232)t=((e-232)*10+8)/255,n=t,s=t;else{e-=16;let l=e%36;t=Math.floor(e/36)/5,n=Math.floor(l/6)/5,s=l%6/5}let r=Math.max(t,n,s)*2;if(r===0)return 30;let o=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(t));return r===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>k.ansi256ToAnsi(k.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>k.ansi256ToAnsi(k.hexToAnsi256(e)),enumerable:!1}}),k}var ws=Os(),_e=ws;import Kt from"node:process";import Cs from"node:os";import Nn from"node:tty";function de(i,e=globalThis.Deno?globalThis.Deno.args:Kt.argv){let t=i.startsWith("-")?"":i.length===1?"-":"--",n=e.indexOf(t+i),s=e.indexOf("--");return n!==-1&&(s===-1||n=2,has16m:i>=3}}function As(i,{streamIsTTY:e,sniffFlags:t=!0}={}){let n=xs();n!==void 0&&(_t=n);let s=t?_t:n;if(s===0)return 0;if(t){if(de("color=16m")||de("color=full")||de("color=truecolor"))return 3;if(de("color=256"))return 2}if("TF_BUILD"in X&&"AGENT_NAME"in X)return 1;if(i&&!e&&s===void 0)return 0;let r=s||0;if(X.TERM==="dumb")return r;if(Kt.platform==="win32"){let o=Cs.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in X)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in X)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in X)||X.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in X)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(X.TEAMCITY_VERSION)?1:0;if(X.COLORTERM==="truecolor"||X.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in X){let o=Number.parseInt((X.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(X.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(X.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(X.TERM)||"COLORTERM"in X?1:r}function Rn(i,e={}){let t=As(i,{streamIsTTY:i&&i.isTTY,...e});return _s(t)}var Es={stdout:Rn({isTTY:Nn.isatty(1)}),stderr:Rn({isTTY:Nn.isatty(2)})},Tn=Es;function Wn(i,e,t){let n=i.indexOf(e);if(n===-1)return i;let s=e.length,r=0,o="";do o+=i.slice(r,n)+e+t,r=n+s,n=i.indexOf(e,r);while(n!==-1);return o+=i.slice(r),o}function Dn(i,e,t,n){let s=0,r="";do{let o=i[n-1]==="\r";r+=i.slice(s,o?n-1:n)+e+(o?`\r -`:` -`)+t,s=n+1,n=i.indexOf(` -`,s)}while(n!==-1);return r+=i.slice(s),r}var{stdout:Ln,stderr:Un}=Tn,kt=Symbol("GENERATOR"),it=Symbol("STYLER"),ut=Symbol("IS_EMPTY"),Bn=["ansi","ansi","ansi256","ansi16m"],st=Object.create(null),js=(i,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=Ln?Ln.level:0;i.level=e.level===void 0?t:e.level};var Ss=i=>{let e=(...t)=>t.join(" ");return js(e,i),Object.setPrototypeOf(e,ht.prototype),e};function ht(i){return Ss(i)}Object.setPrototypeOf(ht.prototype,Function.prototype);for(let[i,e]of Object.entries(_e))st[i]={get(){let t=At(this,Qt(e.open,e.close,this[it]),this[ut]);return Object.defineProperty(this,i,{value:t}),t}};st.visible={get(){let i=At(this,this[it],!0);return Object.defineProperty(this,"visible",{value:i}),i}};var Jt=(i,e,t,...n)=>i==="rgb"?e==="ansi16m"?_e[t].ansi16m(...n):e==="ansi256"?_e[t].ansi256(_e.rgbToAnsi256(...n)):_e[t].ansi(_e.rgbToAnsi(...n)):i==="hex"?Jt("rgb",e,t,..._e.hexToRgb(...n)):_e[t][i](...n),Ps=["rgb","hex","ansi256"];for(let i of Ps){st[i]={get(){let{level:t}=this;return function(...n){let s=Qt(Jt(i,Bn[t],"color",...n),_e.color.close,this[it]);return At(this,s,this[ut])}}};let e="bg"+i[0].toUpperCase()+i.slice(1);st[e]={get(){let{level:t}=this;return function(...n){let s=Qt(Jt(i,Bn[t],"bgColor",...n),_e.bgColor.close,this[it]);return At(this,s,this[ut])}}}}var Ms=Object.defineProperties(()=>{},{...st,level:{enumerable:!0,get(){return this[kt].level},set(i){this[kt].level=i}}}),Qt=(i,e,t)=>{let n,s;return t===void 0?(n=i,s=e):(n=t.openAll+i,s=e+t.closeAll),{open:i,close:e,openAll:n,closeAll:s,parent:t}},At=(i,e,t)=>{let n=(...s)=>Is(n,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(n,Ms),n[kt]=i,n[it]=e,n[ut]=t,n},Is=(i,e)=>{if(i.level<=0||!e)return i[ut]?"":e;let t=i[it];if(t===void 0)return e;let{openAll:n,closeAll:s}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=Wn(e,t.close,t.open),t=t.parent;let r=e.indexOf(` -`);return r!==-1&&(e=Dn(e,s,n,r)),n+e+s};Object.defineProperties(ht.prototype,st);var $s=ht(),yo=ht({level:Un?Un.level:0});var Fe=$s;import{cosmiconfig as Jl}from"cosmiconfig";import{execa as Zr}from"execa";import $e from"fs-extra";import os from"node:fs";import Ht from"node:path";import{PassThrough as Xr}from"node:stream";import{fileURLToPath as eo}from"node:url";import Hn from"node:process";import zn from"node:process";import vs from"node:fs/promises";import{fileURLToPath as Fs}from"node:url";import Ns from"node:fs";import pe from"node:path";var Et=i=>i instanceof URL?Fs(i):i;async function Yn(i,{cwd:e=zn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(Et(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,Et(n??r));s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let l=await vs.stat(o);if(t==="file"&&l.isFile()||t==="directory"&&l.isDirectory())return o}catch{}s=pe.dirname(s)}}function Gn(i,{cwd:e=zn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(Et(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,Et(n)??r);s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let l=Ns.statSync(o,{throwIfNoEntry:!1});if(t==="file"&&l?.isFile()||t==="directory"&&l?.isDirectory())return o}catch{}s=pe.dirname(s)}}async function Zt({cwd:i=Hn.cwd()}={}){return Yn("package.json",{cwd:i})}function Vn({cwd:i=Hn.cwd()}={}){return Gn("package.json",{cwd:i})}import{notStrictEqual as rr,strictEqual as or}from"assert";var Rs={right:Us,center:Bs},Ts=0,jt=1,Ws=2,St=3,Xt=class{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){let t=this.div(...e);t.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let t=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(t),t}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let t=e.split(` -`).map(s=>s.split(" ")),n=0;return t.forEach(s=>{s.length>1&&ce.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),ce.stringWidth(s[0])))}),t.forEach(s=>{this.div(...s.map((r,o)=>({text:r.trim(),padding:this.measurePadding(r),width:o===0&&s.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let t=ce.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(t=>{this.rowToString(t,e)}),e.filter(t=>!t.hidden).map(t=>t.text).join(` -`)}rowToString(e,t){return this.rasterize(e).forEach((n,s)=>{let r="";n.forEach((o,l)=>{let{width:b}=e[l],y=this.negatePadding(e[l]),m=o;if(y>ce.stringWidth(o)&&(m+=" ".repeat(y-ce.stringWidth(o))),e[l].align&&e[l].align!=="left"&&this.wrap){let u=Rs[e[l].align];m=u(m,y),ce.stringWidth(m)0&&(r=this.renderInline(r,t[t.length-1]))}),t.push({text:r.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){let n=e.match(/^ */),s=n?n[0].length:0,r=t.text,o=ce.stringWidth(r.trimRight());return t.span?this.wrap?s{r.width=n[o],this.wrap?s=ce.wrap(r.text,this.negatePadding(r),{hard:!0}).split(` -`):s=r.text.split(` -`),r.border&&(s.unshift("."+"-".repeat(this.negatePadding(r)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(r)+2)+"'")),r.padding&&(s.unshift(...new Array(r.padding[Ts]||0).fill("")),s.push(...new Array(r.padding[Ws]||0).fill(""))),s.forEach((l,b)=>{t[b]||t.push([]);let y=t[b];for(let m=0;mo.width||ce.stringWidth(o.text));let t=e.length,n=this.width,s=e.map(o=>{if(o.width)return t--,n-=o.width,o.width}),r=t?Math.floor(n/t):0;return s.map((o,l)=>o===void 0?Math.max(r,Ds(e[l])):o)}};function qn(i,e,t){return i.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function Ds(i){let e=i.padding||[],t=1+(e[St]||0)+(e[jt]||0);return i.border?t+4:t}function Ls(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Us(i,e){i=i.trim();let t=ce.stringWidth(i);return t=e?i:" ".repeat(e-t>>1)+i}var ce;function Kn(i,e){return ce=e,new Xt({width:i?.width||Ls(),wrap:i?.wrap})}var kn=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function en(i){return i.replace(kn,"")}function Jn(i,e){let[t,n]=i.match(kn)||["",""];i=en(i);let s="";for(let r=0;r[...e].length,stripAnsi:en,wrap:Jn})}import{dirname as Qn,resolve as Zn}from"path";import{readdirSync as zs,statSync as Ys}from"fs";function Xn(i,e){let t=Zn(".",i),n;for(Ys(t).isDirectory()||(t=Qn(t));;){if(n=e(t,zs(t)),n)return Zn(t,n);if(t=Qn(n=t),n===t)break}}import{inspect as ar}from"util";import{readFileSync as lr}from"fs";import{fileURLToPath as cr}from"url";import{format as Vs}from"util";import{normalize as qs,resolve as Ks}from"path";function Ye(i){if(i!==i.toLowerCase()&&i!==i.toUpperCase()||(i=i.toLowerCase()),i.indexOf("-")===-1&&i.indexOf("_")===-1)return i;{let t="",n=!1,s=i.match(/^-+/);for(let r=s?s[0].length:0;r0?n+=`${e}${t.charAt(s)}`:n+=o}return n}function Mt(i){return i==null?!1:typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^0[^.]/.test(i)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function ei(i){if(Array.isArray(i))return i.map(o=>typeof o!="string"?o+"":o);i=i.trim();let e=0,t=null,n=null,s=null,r=[];for(let o=0;o{typeof d=="number"&&(p.nargs[c]=d,p.keys.push(c))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([c,d])=>{typeof d=="function"&&(p.coercions[c]=d,p.keys.push(c))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(c){p.configs[c]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([c,d])=>{(typeof d=="boolean"||typeof d=="function")&&(p.configs[c]=d)})),ze(n.key,o,n.default,p.arrays),Object.keys(b).forEach(function(c){(p.aliases[c]||[]).forEach(function(d){b[d]=b[c]})});let B=null;xt();let L=[],G=Object.assign(Object.create(null),{_:[]}),ve={};for(let c=0;c=3&&(F(A[1],p.arrays)?c=Ue(c,A[1],s,A[2]):F(A[1],p.nargs)!==!1?c=nt(c,A[1],s,A[2]):H(A[1],A[2],!0));else if(d.match(D)&&l["boolean-negation"])A=d.match(D),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],H(h,F(h,p.arrays)?[!1]:!1));else if(d.match(/^--.+/)||!l["short-option-groups"]&&d.match(/^-[^-]+/))A=d.match(/^--?(.+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],F(h,p.arrays)?c=Ue(c,h,s):F(h,p.nargs)!==!1?c=nt(c,h,s):($=s[c+1],$!==void 0&&(!$.match(/^-/)||$.match(R))&&!F(h,p.bools)&&!F(h,p.counts)||/^(true|false)$/.test($)?(H(h,$),c++):H(h,Z(h))));else if(d.match(/^-.\..+=/))A=d.match(/^-([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=3&&H(A[1],A[2]);else if(d.match(/^-.\..+/)&&!d.match(R))$=s[c+1],A=d.match(/^-(.\..+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(h=A[1],$!==void 0&&!$.match(/^-/)&&!F(h,p.bools)&&!F(h,p.counts)?(H(h,$),c++):H(h,Z(h)));else if(d.match(/^-[^-]+/)&&!d.match(R)){P=d.slice(1,-1).split(""),O=!1;for(let ae=0;aec!=="--"&&c.includes("-")).forEach(c=>{delete G[c]}),l["strip-aliased"]&&[].concat(...Object.keys(o).map(c=>o[c])).forEach(c=>{l["camel-case-expansion"]&&c.includes("-")&&delete G[c.split(".").map(d=>Ye(d)).join(".")],delete G[c]});function we(c){let d=S("_",c);(typeof d=="string"||typeof d=="number")&&G._.push(d)}function nt(c,d,x,O){let h,P=F(d,p.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return xe(O)||(B=Error(w("Argument unexpected for: %s",d))),H(d,Z(d)),c;let A=xe(O)?0:1;if(l["nargs-eats-options"])x.length-(c+1)+A0&&(H(d,O),$--),h=c+1;h<$+c+1;h++)H(d,x[h]);return c+$}function Ue(c,d,x,O){let h=[],P=O||x[c+1],A=F(d,p.nargs);if(F(d,p.bools)&&!/^(true|false)$/.test(P))h.push(!0);else if(xe(P)||xe(O)&&/^-/.test(P)&&!R.test(P)&&!Q(P)){if(b[d]!==void 0){let $=b[d];h=Array.isArray($)?$:[$]}}else{xe(O)||h.push(_(d,O,!0));for(let $=c+1;$0||A&&typeof A=="number"&&h.length>=A||(P=x[$],/^-/.test(P)&&!R.test(P)&&!Q(P)));$++)c=$,h.push(_(d,P,r))}return typeof A=="number"&&(A&&h.length1&&l["dot-notation"]&&(p.aliases[h[0]]||[]).forEach(function(P){let A=P.split("."),$=[].concat(h);$.shift(),A=A.concat($),(p.aliases[c]||[]).includes(A.join("."))||Me(G,A,O)}),F(c,p.normalize)&&!F(c,p.arrays)&&[c].concat(p.aliases[c]||[]).forEach(function(A){Object.defineProperty(ve,A,{enumerable:!0,get(){return d},set($){d=typeof $=="string"?Ie.normalize($):$}})})}function M(c,d){p.aliases[c]&&p.aliases[c].length||(p.aliases[c]=[d],g[d]=!0),p.aliases[d]&&p.aliases[d].length||M(d,c)}function _(c,d,x){x&&(d=Hs(d)),(F(c,p.bools)||F(c,p.counts))&&typeof d=="string"&&(d=d==="true");let O=Array.isArray(d)?d.map(function(h){return S(c,h)}):S(c,d);return F(c,p.counts)&&(xe(O)||typeof O=="boolean")&&(O=nn()),F(c,p.normalize)&&F(c,p.arrays)&&(Array.isArray(d)?O=d.map(h=>Ie.normalize(h)):O=Ie.normalize(d)),O}function S(c,d){return!l["parse-positional-numbers"]&&c==="_"||!F(c,p.strings)&&!F(c,p.bools)&&!Array.isArray(d)&&(Mt(d)&&l["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${d}`)))||!xe(d)&&F(c,p.numbers))&&(d=Number(d)),d}function W(c){let d=Object.create(null);J(d,p.aliases,b),Object.keys(p.configs).forEach(function(x){let O=c[x]||d[x];if(O)try{let h=null,P=Ie.resolve(Ie.cwd(),O),A=p.configs[x];if(typeof A=="function"){try{h=A(P)}catch($){h=$}if(h instanceof Error){B=h;return}}else h=Ie.require(P);Y(h)}catch(h){h.name==="PermissionDenied"?B=h:c[x]&&(B=Error(w("Invalid JSON config file: %s",O)))}})}function Y(c,d){Object.keys(c).forEach(function(x){let O=c[x],h=d?d+"."+x:x;typeof O=="object"&&O!==null&&!Array.isArray(O)&&l["dot-notation"]?Y(O,h):(!Pe(G,h.split("."))||F(h,p.arrays)&&l["combine-arrays"])&&H(h,O)})}function ie(){typeof y<"u"&&y.forEach(function(c){Y(c)})}function z(c,d){if(typeof m>"u")return;let x=typeof m=="string"?m:"",O=Ie.env();Object.keys(O).forEach(function(h){if(x===""||h.lastIndexOf(x,0)===0){let P=h.split("__").map(function(A,$){return $===0&&(A=A.substring(x.length)),Ye(A)});(d&&p.configs[P.join(".")]||!d)&&!Pe(c,P)&&H(P.join("."),O[h])}})}function se(c){let d,x=new Set;Object.keys(c).forEach(function(O){if(!x.has(O)&&(d=F(O,p.coercions),typeof d=="function"))try{let h=S(O,d(c[O]));[].concat(p.aliases[O]||[],O).forEach(P=>{x.add(P),c[P]=h})}catch(h){B=h}})}function Be(c){return p.keys.forEach(d=>{~d.indexOf(".")||typeof c[d]>"u"&&(c[d]=void 0)}),c}function J(c,d,x,O=!1){Object.keys(x).forEach(function(h){Pe(c,h.split("."))||(Me(c,h.split("."),x[h]),O&&(C[h]=!0),(d[h]||[]).forEach(function(P){Pe(c,P.split("."))||Me(c,P.split("."),x[h])}))})}function Pe(c,d){let x=c;l["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(h){x=x[h]||{}});let O=d[d.length-1];return typeof x!="object"?!1:O in x}function Me(c,d,x){let O=c;l["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(re){re=ti(re),typeof O=="object"&&O[re]===void 0&&(O[re]={}),typeof O[re]!="object"||Array.isArray(O[re])?(Array.isArray(O[re])?O[re].push({}):O[re]=[O[re],{}],O=O[re][O[re].length-1]):O=O[re]});let h=ti(d[d.length-1]),P=F(d.join("."),p.arrays),A=Array.isArray(x),$=l["duplicate-arguments-array"];!$&&F(h,p.nargs)&&($=!0,(!xe(O[h])&&p.nargs[h]===1||Array.isArray(O[h])&&O[h].length===p.nargs[h])&&(O[h]=void 0)),x===nn()?O[h]=nn(O[h]):Array.isArray(O[h])?$&&P&&A?O[h]=l["flatten-duplicate-arrays"]?O[h].concat(x):(Array.isArray(O[h][0])?O[h]:[O[h]]).concat([x]):!$&&!!P==!!A?O[h]=x:O[h]=O[h].concat([x]):O[h]===void 0&&P?O[h]=A?x:[x]:$&&!(O[h]===void 0||F(h,p.counts)||F(h,p.bools))?O[h]=[O[h],x]:O[h]=x}function ze(...c){c.forEach(function(d){Object.keys(d||{}).forEach(function(x){p.aliases[x]||(p.aliases[x]=[].concat(o[x]||[]),p.aliases[x].concat(x).forEach(function(O){if(/-/.test(O)&&l["camel-case-expansion"]){let h=Ye(O);h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),g[h]=!0)}}),p.aliases[x].concat(x).forEach(function(O){if(O.length>1&&/[A-Z]/.test(O)&&l["camel-case-expansion"]){let h=Pt(O,"-");h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),g[h]=!0)}}),p.aliases[x].forEach(function(O){p.aliases[O]=[x].concat(p.aliases[x].filter(function(h){return O!==h}))}))})})}function F(c,d){let x=[].concat(p.aliases[c]||[],c),O=Object.keys(d),h=x.find(P=>O.includes(P));return h?d[h]:!1}function qt(c){let d=Object.keys(p);return[].concat(d.map(O=>p[O])).some(function(O){return Array.isArray(O)?O.includes(c):O[c]})}function v(c,...d){return[].concat(...d).some(function(O){let h=c.match(O);return h&&qt(h[1])})}function K(c){if(c.match(R)||!c.match(/^-[^-]+/))return!1;let d=!0,x,O=c.slice(1).split("");for(let h=0;hF(c,p.arrays)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",c)),!0):F(c,p.nargs)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",c)),!0):!1)}return{aliases:Object.assign({},p.aliases),argv:Object.assign(ve,G),configuration:l,defaulted:Object.assign({},C),error:B,newAliases:Object.assign({},g)}}};function Gs(i){let e=[],t=Object.create(null),n=!0;for(Object.keys(i).forEach(function(s){e.push([].concat(i[s],s))});n;){n=!1;for(let s=0;sJs,format:Vs,normalize:qs,resolve:Ks,require:i=>{if(typeof Ee<"u")return Ee(i);if(i.match(/\.json$/))return JSON.parse(ks(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),dt=function(e,t){return si.parse(e.slice(),t).argv};dt.detailed=function(i,e){return si.parse(i.slice(),e)};dt.camelCase=Ye;dt.decamelize=Pt;dt.looksLikeNumber=Mt;var an=dt;import{basename as fr,dirname as ur,extname as hr,relative as dr,resolve as fi}from"path";function ri(){return Qs()?0:1}function Qs(){return Zs()&&!process.defaultApp}function Zs(){return!!process.versions.electron}function ln(i){return i.slice(ri()+1)}function oi(){return process.argv[ri()]}var V=class i extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,i)}};import{readFileSync as Xs,statSync as er,writeFile as tr}from"fs";import{format as nr}from"util";import{resolve as ir}from"path";var ai={fs:{readFileSync:Xs,writeFile:tr},format:nr,resolve:ir,exists:i=>{try{return er(i).isFile()}catch{return!1}}};var Ae,cn=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let t=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ae.format.apply(Ae.format,[this.cache[this.locale][t]||t].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),s=e.shift(),r=function(){};typeof e[e.length-1]=="function"&&(r=e.pop()),this.cache[this.locale]||this._readLocaleFile();let o=s===1?t:n;this.cache[this.locale][t]&&(o=this.cache[this.locale][t][s===1?"one":"other"]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r();let l=[o];return~o.indexOf("%d")&&l.push(s),Ae.format.apply(Ae.format,l.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.cache[this.locale][t]=e[t])}_taggedLiteral(e,...t){let n="";return e.forEach(function(s,r){let o=t[r+1];n+=s,typeof o<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,t=this.writeQueue[0],n=t.directory,s=t.locale,r=t.cb,o=this._resolveLocaleFile(n,s),l=JSON.stringify(this.cache[s],null,2);Ae.fs.writeFile(o,l,"utf-8",function(b){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),r(b)})}_readLocaleFile(){let e={},t=this._resolveLocaleFile(this.directory,this.locale);try{Ae.fs.readFileSync&&(e=JSON.parse(Ae.fs.readFileSync(t,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+t),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=Ae.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){let s=Ae.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(e){return Ae.exists(e)}};function li(i,e){Ae=e;let t=new cn(i);return{__:t.__.bind(t),__n:t.__n.bind(t),setLocale:t.setLocale.bind(t),getLocale:t.getLocale.bind(t),updateLocale:t.updateLocale.bind(t),locale:t.locale}}var sr=i=>li(i,ai),ci=sr;var pr="require is not supported by ESM",ui="loading a directory of commands is not supported yet for ESM",pt;try{pt=cr(import.meta.url)}catch{pt=process.cwd()}var mr=pt.substring(0,pt.lastIndexOf("node_modules")),fn={assert:{notStrictEqual:rr,strictEqual:or},cliui:tn,findUp:Xn,getEnv:i=>process.env[i],inspect:ar,getCallerFile:()=>{throw new V(ui)},getProcessArgvBin:oi,mainFilename:mr||process.cwd(),Parser:an,path:{basename:fr,dirname:ur,extname:hr,relative:dr,resolve:fi},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(i,e)=>process.emitWarning(i,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:lr,require:()=>{throw new V(pr)},requireDirectory:()=>{throw new V(ui)},stringWidth:i=>[...i].length,y18n:ci({directory:fi(pt,"../../../locales"),updateFiles:!1})};function le(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function un(i,e){e.assert.strictEqual(typeof i,"string")}function rt(i){return Object.keys(i)}function q(i){return!!i&&!!i.then&&typeof i.then=="function"}function Ne(i){let t=i.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=t.shift();if(!s)throw new Error(`No command found in: ${i}`);let r={cmd:s.replace(n,""),demanded:[],optional:[]};return t.forEach((o,l)=>{let b=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&l===t.length-1&&(b=!0),/^\[/.test(o)?r.optional.push({cmd:o.replace(n,"").split("|"),variadic:b}):r.demanded.push({cmd:o.replace(n,"").split("|"),variadic:b})}),r}var gr=["first","second","third","fourth","fifth","sixth"];function E(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[Ne(`cmd ${i}`),e,t]}try{let s=0,[r,o,l]=n(),b=[].slice.call(o);for(;b.length&&b[b.length-1]===void 0;)b.pop();let y=l||b.length;if(ym)throw new V(`Too many arguments provided. Expected max ${m} but received ${y}.`);r.demanded.forEach(f=>{let u=b.shift(),g=hi(u);f.cmd.filter(w=>w===g||w==="*").length===0&&di(g,f.cmd,s),s+=1}),r.optional.forEach(f=>{if(b.length===0)return;let u=b.shift(),g=hi(u);f.cmd.filter(w=>w===g||w==="*").length===0&&di(g,f.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function hi(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function di(i,e,t){throw new V(`Invalid ${gr[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}var $t=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,s=!1){if(E(" [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let r=0;r{let r=[...n[t]||[],t];return s.option?!r.includes(s.option):!0}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function pi(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Ge(i,e,t,n){return t.reduce((s,r)=>{if(r.applyBeforeValidation!==n)return s;if(r.mutates){if(r.applied)return s;r.applied=!0}if(q(s))return s.then(o=>Promise.all([o,r(o,e)])).then(([o,l])=>Object.assign(o,l));{let o=r(s,e);return q(o)?o.then(l=>Object.assign(s,l)):Object.assign(s,o)}},i)}function He(i,e,t=n=>{throw n}){try{let n=br(i)?i():i;return q(n)?n.then(s=>e(s)):e(n)}catch(n){return t(n)}}function br(i){return typeof i=="function"}function hn(i){if(typeof Ee>"u")return null;for(let e=0,t=Object.keys(Ee.cache),n;eo;s.visit=(o,l,b)=>{let y=r(o,l,b);if(y){if(this.requireCache.has(l))return y;this.requireCache.add(l),this.addHandler(y)}return y},this.shim.requireDirectory({require:t,filename:n},e,s)}addHandler(e,t,n,s,r,o){let l=[],b=pi(r);if(s=s||(()=>{}),Array.isArray(e))if(yr(e))[e,...l]=e;else for(let y of e)this.addHandler(y);else if(wr(e)){let y=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(y=[].concat(y).concat(e.aliases)),this.addHandler(y,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(mi(n)){this.addHandler([e].concat(l),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let y=Ne(e);l=l.map(u=>Ne(u).cmd);let m=!1,f=[y.cmd].concat(l).filter(u=>ot.test(u)?(m=!0,!1):!0);f.length===0&&m&&f.push("$0"),m&&(y.cmd=f[0],l=f.slice(1),e=e.replace(ot,y.cmd)),l.forEach(u=>{this.aliasMap[u]=y.cmd}),t!==!1&&this.usage.command(e,t,m,l,o),this.handlers[y.cmd]={original:e,description:t,handler:s,builder:n||{},middlewares:b,deprecated:o,demanded:y.demanded,optional:y.optional},m&&(this.defaultCommand=this.handlers[y.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,s,r,o){let l=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,b=t.getInternalMethods().getContext(),y=b.commands.slice(),m=!e;e&&(b.commands.push(e),b.fullCommands.push(l.original));let f=this.applyBuilderUpdateUsageAndParse(m,l,t,n.aliases,y,s,r,o);return q(f)?f.then(u=>this.applyMiddlewareAndGetResult(m,l,u.innerArgv,b,r,u.aliases,t)):this.applyMiddlewareAndGetResult(m,l,f.innerArgv,b,r,f.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,s,r,o,l,b){let y=t.builder,m=n;if(vt(y)){n.getInternalMethods().getUsageInstance().freeze();let f=y(n.getInternalMethods().reset(s),b);if(q(f))return f.then(u=>(m=bi(u)?u:n,this.parseAndUpdateUsage(e,t,m,r,o,l)))}else Or(y)&&(n.getInternalMethods().getUsageInstance().freeze(),m=n.getInternalMethods().reset(s),Object.keys(t.builder).forEach(f=>{m.option(f,y[f])}));return this.parseAndUpdateUsage(e,t,m,r,o,l)}parseAndUpdateUsage(e,t,n,s,r,o){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,t),t.description);let l=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,r,o);return q(l)?l.then(b=>({aliases:n.parsed.aliases,innerArgv:b})):{aliases:n.parsed.aliases,innerArgv:l}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){let n=ot.test(t.original)?t.original.replace(ot,"").trim():t.original,s=e.filter(r=>!ot.test(r));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(e,t,n,s,r,o,l,b){if(!o.getInternalMethods().getHasOutput()){let y=o.getInternalMethods().runValidation(r,b,o.parsed.error,e);n=He(n,m=>(y(m),m))}if(t.handler&&!o.getInternalMethods().getHasOutput()){o.getInternalMethods().setHasOutput();let y=!!o.getOptions().configuration["populate--"];o.getInternalMethods().postProcess(n,y,!1,!1),n=Ge(n,o,l,!1),n=He(n,m=>{let f=t.handler(m);return q(f)?f.then(()=>m):m}),e||o.getInternalMethods().getUsageInstance().cacheHelpMessage(),q(n)&&!o.getInternalMethods().hasParseCallback()&&n.catch(m=>{try{o.getInternalMethods().getUsageInstance().fail(null,m)}catch{}})}return e||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,s,r,o,l){let b={};if(r)return n;l.getInternalMethods().getHasOutput()||(b=this.populatePositionals(t,n,s,l));let y=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),m=Ge(n,l,y,!0);return q(m)?m.then(f=>this.handleValidationAndGetResult(e,t,f,s,o,l,y,b)):this.handleValidationAndGetResult(e,t,m,s,o,l,y,b)}populatePositionals(e,t,n,s){t._=t._.slice(n.commands.length);let r=e.demanded.slice(0),o=e.optional.slice(0),l={};for(this.validation.positionalCount(r.length,t._.length);r.length;){let b=r.shift();this.populatePositional(b,t,l)}for(;o.length;){let b=o.shift();this.populatePositional(b,t,l)}return t._=n.commands.concat(t._.map(b=>""+b)),this.postProcessPositionals(t,l,this.cmdToParseOptions(e.original),s),l}populatePositional(e,t,n){let s=e.cmd[0];e.variadic?n[s]=t._.splice(0).map(String):t._.length&&(n[s]=[String(t._.shift())])}cmdToParseOptions(e){let t={array:[],default:{},alias:{},demand:{}},n=Ne(e);return n.demanded.forEach(s=>{let[r,...o]=s.cmd;s.variadic&&(t.array.push(r),t.default[r]=[]),t.alias[r]=o,t.demand[r]=!0}),n.optional.forEach(s=>{let[r,...o]=s.cmd;s.variadic&&(t.array.push(r),t.default[r]=[]),t.alias[r]=o}),t}postProcessPositionals(e,t,n,s){let r=Object.assign({},s.getOptions());r.default=Object.assign(n.default,r.default);for(let y of Object.keys(n.alias))r.alias[y]=(r.alias[y]||[]).concat(n.alias[y]);r.array=r.array.concat(n.array),r.config={};let o=[];if(Object.keys(t).forEach(y=>{t[y].map(m=>{r.configuration["unknown-options-as-args"]&&(r.key[y]=!0),o.push(`--${y}`),o.push(m)})}),!o.length)return;let l=Object.assign({},r.configuration,{"populate--":!1}),b=this.shim.Parser.detailed(o,Object.assign({},r,{configuration:l}));if(b.error)s.getInternalMethods().getUsageInstance().fail(b.error.message,b.error);else{let y=Object.keys(t);Object.keys(t).forEach(m=>{y.push(...b.aliases[m])}),Object.keys(b.argv).forEach(m=>{y.includes(m)&&(t[m]||(t[m]=b.argv[m]),!this.isInConfigs(s,m)&&!this.isDefaulted(s,m)&&Object.prototype.hasOwnProperty.call(e,m)&&Object.prototype.hasOwnProperty.call(b.argv,m)&&(Array.isArray(e[m])||Array.isArray(b.argv[m]))?e[m]=[].concat(e[m],b.argv[m]):e[m]=b.argv[m])})}}isDefaulted(e,t){let{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){let{configObjects:n}=e.getOptions();return n.some(s=>Object.prototype.hasOwnProperty.call(s,t))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=ot.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let t=this.defaultCommand.builder;if(vt(t))return t(e,!0);mi(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){let t=hn(e);if(!t)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(t.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:t,desc:n}){for(let s of[e,t,n]){if(typeof s=="string"||s===!1)return s;le(s,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();le(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function gi(i,e,t,n){return new dn(i,e,t,n)}function mi(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function yr(i){return i.every(e=>typeof e=="string")}function vt(i){return typeof i=="function"}function Or(i){return typeof i=="object"}function wr(i){return typeof i=="object"&&!Array.isArray(i)}function Re(i={},e=()=>!0){let t={};return rt(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function Te(i){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(i)})}function Cr(i){return typeof i=="boolean"}function Oi(i,e){let t=e.y18n.__,n={},s=[];n.failFn=function(_){s.push(_)};let r=null,o=null,l=!0;n.showHelpOnFail=function(_=!0,S){let[W,Y]=typeof _=="string"?[!0,_]:[_,S];return i.getInternalMethods().isGlobalContext()&&(o=Y),r=Y,l=W,n};let b=!1;n.fail=function(_,S){let W=i.getInternalMethods().getLoggerInstance();if(s.length)for(let Y=s.length-1;Y>=0;--Y){let ie=s[Y];if(Cr(ie)){if(S)throw S;if(_)throw Error(_)}else ie(_,S,n)}else{if(i.getExitProcess()&&Te(!0),!b){b=!0,l&&(i.showHelp("error"),W.error()),(_||S)&&W.error(_||S);let Y=r||o;Y&&((_||S)&&W.error(""),W.error(Y))}if(S=S||new V(_),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,S);throw S}};let y=[],m=!1;n.usage=(M,_)=>M===null?(m=!0,y=[],n):(m=!1,y.push([M,_||""]),n),n.getUsage=()=>y,n.getUsageDisabled=()=>m,n.getPositionalGroupName=()=>t("Positionals:");let f=[];n.example=(M,_)=>{f.push([M,_||""])};let u=[];n.command=function(_,S,W,Y,ie=!1){W&&(u=u.map(z=>(z[2]=!1,z))),u.push([_,S||"",W,Y,ie])},n.getCommands=()=>u;let g={};n.describe=function(_,S){Array.isArray(_)?_.forEach(W=>{n.describe(W,S)}):typeof _=="object"?Object.keys(_).forEach(W=>{n.describe(W,_[W])}):g[_]=S},n.getDescriptions=()=>g;let C=[];n.epilog=M=>{C.push(M)};let w=!1,p;n.wrap=M=>{w=!0,p=M},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(w||(p=nt(),w=!0),p);let R="__yargsString__:";n.deferY18nLookup=M=>R+M,n.help=function(){if(L)return L;B();let _=i.customScriptName?i.$0:e.path.basename(i.$0),S=i.getDemandedOptions(),W=i.getDemandedCommands(),Y=i.getDeprecatedOptions(),ie=i.getGroups(),z=i.getOptions(),se=[];se=se.concat(Object.keys(g)),se=se.concat(Object.keys(S)),se=se.concat(Object.keys(W)),se=se.concat(Object.keys(z.default)),se=se.filter(ve),se=Object.keys(se.reduce((v,K)=>(K!=="_"&&(v[K]=!0),v),{}));let Be=n.getWrap(),J=e.cliui({width:Be,wrap:!!Be});if(!m){if(y.length)y.forEach(v=>{J.div({text:`${v[0].replace(/\$0/g,_)}`}),v[1]&&J.div({text:`${v[1]}`,padding:[1,0,0,0]})}),J.div();else if(u.length){let v=null;W._?v=`${_} <${t("command")}> -`:v=`${_} [${t("command")}] -`,J.div(`${v}`)}}if(u.length>1||u.length===1&&!u[0][2]){J.div(t("Commands:"));let v=i.getInternalMethods().getContext(),K=v.commands.length?`${v.commands.join(" ")} `:"";i.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(u=u.sort((U,Z)=>U[0].localeCompare(Z[0])));let Q=_?`${_} `:"";u.forEach(U=>{let Z=`${Q}${K}${U[0].replace(/^\$0 ?/,"")}`;J.span({text:Z,padding:[0,2,0,2],width:D(u,Be,`${_}${K}`)+4},{text:U[1]});let te=[];U[2]&&te.push(`[${t("default")}]`),U[3]&&U[3].length&&te.push(`[${t("aliases:")} ${U[3].join(", ")}]`),U[4]&&(typeof U[4]=="string"?te.push(`[${t("deprecated: %s",U[4])}]`):te.push(`[${t("deprecated")}]`)),te.length?J.div({text:te.join(" "),padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}let Pe=(Object.keys(z.alias)||[]).concat(Object.keys(i.parsed.newAliases)||[]);se=se.filter(v=>!i.parsed.newAliases[v]&&Pe.every(K=>(z.alias[K]||[]).indexOf(v)===-1));let Me=t("Options:");ie[Me]||(ie[Me]=[]),G(se,z.alias,ie,Me);let ze=v=>/^--/.test(Ft(v)),F=Object.keys(ie).filter(v=>ie[v].length>0).map(v=>{let K=ie[v].filter(ve).map(Q=>{if(Pe.includes(Q))return Q;for(let U=0,Z;(Z=Pe[U])!==void 0;U++)if((z.alias[Z]||[]).includes(Q))return Z;return Q});return{groupName:v,normalizedKeys:K}}).filter(({normalizedKeys:v})=>v.length>0).map(({groupName:v,normalizedKeys:K})=>{let Q=K.reduce((U,Z)=>(U[Z]=[Z].concat(z.alias[Z]||[]).map(te=>v===n.getPositionalGroupName()?te:(/^[0-9]$/.test(te)?z.boolean.includes(Z)?"-":"--":te.length>1?"--":"-")+te).sort((te,Ce)=>ze(te)===ze(Ce)?0:ze(te)?1:-1).join(", "),U),{});return{groupName:v,normalizedKeys:K,switches:Q}});if(F.filter(({groupName:v})=>v!==n.getPositionalGroupName()).some(({normalizedKeys:v,switches:K})=>!v.every(Q=>ze(K[Q])))&&F.filter(({groupName:v})=>v!==n.getPositionalGroupName()).forEach(({normalizedKeys:v,switches:K})=>{v.forEach(Q=>{ze(K[Q])&&(K[Q]=xr(K[Q],4))})}),F.forEach(({groupName:v,normalizedKeys:K,switches:Q})=>{J.div(v),K.forEach(U=>{let Z=Q[U],te=g[U]||"",Ce=null;te.includes(R)&&(te=t(te.substring(R.length))),z.boolean.includes(U)&&(Ce=`[${t("boolean")}]`),z.count.includes(U)&&(Ce=`[${t("count")}]`),z.string.includes(U)&&(Ce=`[${t("string")}]`),z.normalize.includes(U)&&(Ce=`[${t("string")}]`),z.array.includes(U)&&(Ce=`[${t("array")}]`),z.number.includes(U)&&(Ce=`[${t("number")}]`);let xe=d=>typeof d=="string"?`[${t("deprecated: %s",d)}]`:`[${t("deprecated")}]`,xt=[U in Y?xe(Y[U]):null,Ce,U in S?`[${t("required")}]`:null,z.choices&&z.choices[U]?`[${t("choices:")} ${n.stringifiedValues(z.choices[U])}]`:null,we(z.default[U],z.defaultDescription[U])].filter(Boolean).join(" ");J.span({text:Ft(Z),padding:[0,2,0,2+yi(Z)],width:D(Q,Be)+4},te);let c=i.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;xt&&!c?J.div({text:xt,padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}),f.length&&(J.div(t("Examples:")),f.forEach(v=>{v[0]=v[0].replace(/\$0/g,_)}),f.forEach(v=>{v[1]===""?J.div({text:v[0],padding:[0,2,0,2]}):J.div({text:v[0],padding:[0,2,0,2],width:D(f,Be)+4},{text:v[1]})}),J.div()),C.length>0){let v=C.map(K=>K.replace(/\$0/g,_)).join(` -`);J.div(`${v} -`)}return J.toString().replace(/\s*$/,"")};function D(M,_,S){let W=0;return Array.isArray(M)||(M=Object.values(M).map(Y=>[Y])),M.forEach(Y=>{W=Math.max(e.stringWidth(S?`${S} ${Ft(Y[0])}`:Ft(Y[0]))+yi(Y[0]),W)}),_&&(W=Math.min(W,parseInt((_*.5).toString(),10))),W}function B(){let M=i.getDemandedOptions(),_=i.getOptions();(Object.keys(_.alias)||[]).forEach(S=>{_.alias[S].forEach(W=>{g[W]&&n.describe(S,g[W]),W in M&&i.demandOption(S,M[W]),_.boolean.includes(W)&&i.boolean(S),_.count.includes(W)&&i.count(S),_.string.includes(W)&&i.string(S),_.normalize.includes(W)&&i.normalize(S),_.array.includes(W)&&i.array(S),_.number.includes(W)&&i.number(S)})})}let L;n.cacheHelpMessage=function(){L=this.help()},n.clearCachedHelpMessage=function(){L=void 0},n.hasCachedHelpMessage=function(){return!!L};function G(M,_,S,W){let Y=[],ie=null;return Object.keys(S).forEach(z=>{Y=Y.concat(S[z])}),M.forEach(z=>{ie=[z].concat(_[z]),ie.some(se=>Y.indexOf(se)!==-1)||S[W].push(z)}),Y}function ve(M){return i.getOptions().hiddenOptions.indexOf(M)<0||i.parsed.argv[i.getOptions().showHiddenOpt]}n.showHelp=M=>{let _=i.getInternalMethods().getLoggerInstance();M||(M="error"),(typeof M=="function"?M:_[M])(n.help())},n.functionDescription=M=>["(",M.name?e.Parser.decamelize(M.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(_,S){let W="",Y=S||", ",ie=[].concat(_);return!_||!ie.length||ie.forEach(z=>{W.length&&(W+=Y),W+=JSON.stringify(z)}),W};function we(M,_){let S=`[${t("default:")} `;if(M===void 0&&!_)return null;if(_)S+=_;else switch(typeof M){case"string":S+=`"${M}"`;break;case"object":S+=JSON.stringify(M);break;default:S+=M}return`${S}]`}function nt(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let Ue=null;n.version=M=>{Ue=M},n.showVersion=M=>{let _=i.getInternalMethods().getLoggerInstance();M||(M="error"),(typeof M=="function"?M:_[M])(Ue)},n.reset=function(_){return r=null,b=!1,y=[],m=!1,C=[],f=[],u=[],g=Re(g,S=>!_[S]),n};let H=[];return n.freeze=function(){H.push({failMessage:r,failureOutput:b,usages:y,usageDisabled:m,epilogs:C,examples:f,commands:u,descriptions:g})},n.unfreeze=function(_=!1){let S=H.pop();S&&(_?(g={...S.descriptions,...g},u=[...S.commands,...u],y=[...S.usages,...y],f=[...S.examples,...f],C=[...S.epilogs,...C]):{failMessage:r,failureOutput:b,usages:y,usageDisabled:m,epilogs:C,examples:f,commands:u,descriptions:g}=S)},n}function pn(i){return typeof i=="object"}function xr(i,e){return pn(i)?{text:i.text,indentation:i.indentation+e}:{text:i,indentation:e}}function yi(i){return pn(i)?i.indentation:0}function Ft(i){return pn(i)?i.text:i}var wi=`###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc -# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local cur_word args type_list - - cur_word="\${COMP_WORDS[COMP_CWORD]}" - args=("\${COMP_WORDS[@]}") - - # ask yargs to generate completions. - type_list=$({{app_path}} --get-yargs-completions "\${args[@]}") - - COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) ) - - # if no match was found, fall back to filename completion - if [ \${#COMPREPLY[@]} -eq 0 ]; then - COMPREPLY=() - fi - - return 0 -} -complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`,Ci=`#compdef {{app_name}} -###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc -# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local reply - local si=$IFS - IFS=$' -' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}")) - IFS=$si - _describe 'values' reply -} -compdef _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`;var mn=class{constructor(e,t,n,s){var r,o,l;this.yargs=e,this.usage=t,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(l=((r=this.shim.getEnv("SHELL"))===null||r===void 0?void 0:r.includes("zsh"))||((o=this.shim.getEnv("ZSH_NAME"))===null||o===void 0?void 0:o.includes("zsh")))!==null&&l!==void 0?l:!1}defaultCompletion(e,t,n,s){let r=this.command.getCommandHandlers();for(let l=0,b=e.length;l{let o=Ne(r[0]).cmd;if(t.indexOf(o)===-1)if(!this.zshShell)e.push(o);else{let l=r[1]||"";e.push(o.replace(/:/g,"\\:")+":"+l)}})}optionCompletions(e,t,n,s){if((s.match(/^-/)||s===""&&e.length===0)&&!this.previousArgHasChoices(t)){let r=this.yargs.getOptions(),o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(r.key).forEach(l=>{let b=!!r.configuration["boolean-negation"]&&r.boolean.includes(l);!o.includes(l)&&!r.hiddenOptions.includes(l)&&!this.argsContainKey(t,l,b)&&this.completeOptionKey(l,e,s,b&&!!r.default[l])})}}choicesFromOptionsCompletions(e,t,n,s){if(this.previousArgHasChoices(t)){let r=this.getPreviousArgChoices(t);r&&r.length>0&&e.push(...r.map(o=>o.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,s){if(s===""&&e.length>0&&this.previousArgHasChoices(t))return;let r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],o=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),l=r[n._.length-o-1];if(!l)return;let b=this.yargs.getOptions().choices[l]||[];for(let y of b)y.startsWith(s)&&e.push(y.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n="";if(!t.startsWith("-")&&e.length>1&&(n=t,t=e[e.length-2]),!t.startsWith("-"))return;let s=t.replace(/^-+/,""),r=this.yargs.getOptions(),o=[s,...this.yargs.getAliases()[s]||[]],l;for(let b of o)if(Object.prototype.hasOwnProperty.call(r.key,b)&&Array.isArray(r.choices[b])){l=r.choices[b];break}if(l)return l.filter(b=>!n||b.startsWith(n))}previousArgHasChoices(e){let t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){let s=r=>e.indexOf((/^[^0-9]$/.test(r)?"-":"--")+r)!==-1;if(s(t)||n&&s(`no-${t}`))return!0;if(this.aliases){for(let r of this.aliases[t])if(s(r))return!0}return!1}completeOptionKey(e,t,n,s){var r,o,l,b;let y=e;if(this.zshShell){let g=this.usage.getDescriptions(),C=(o=(r=this===null||this===void 0?void 0:this.aliases)===null||r===void 0?void 0:r[e])===null||o===void 0?void 0:o.find(R=>{let D=g[R];return typeof D=="string"&&D.length>0}),w=C?g[C]:void 0,p=(b=(l=g[e])!==null&&l!==void 0?l:w)!==null&&b!==void 0?b:"";y=`${e.replace(/:/g,"\\:")}:${p.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let m=g=>/^--/.test(g),f=g=>/^[^0-9]$/.test(g),u=!m(n)&&f(e)?"-":"--";t.push(u+y),s&&t.push(u+"no-"+y)}customCompletion(e,t,n,s){if(le(this.customCompletionFunction,null,this.shim),Ar(this.customCompletionFunction)){let r=this.customCompletionFunction(n,t);return q(r)?r.then(o=>{this.shim.process.nextTick(()=>{s(null,o)})}).catch(o=>{this.shim.process.nextTick(()=>{s(o,void 0)})}):s(null,r)}else return Er(this.customCompletionFunction)?this.customCompletionFunction(n,t,(r=s)=>this.defaultCompletion(e,t,n,r),r=>{s(null,r)}):this.customCompletionFunction(n,t,r=>{s(null,r)})}getCompletion(e,t){let n=e.length?e[e.length-1]:"",s=this.yargs.parse(e,!0),r=this.customCompletionFunction?o=>this.customCompletion(e,o,n,t):o=>this.defaultCompletion(e,o,n,t);return q(s)?s.then(r):r(s)}generateCompletionScript(e,t){let n=this.zshShell?Ci:wi,s=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,s),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function xi(i,e,t,n){return new mn(i,e,t,n)}function Ar(i){return i.length<3}function Er(i){return i.length>3}function _i(i,e){if(i.length===0)return e.length;if(e.length===0)return i.length;let t=[],n;for(n=0;n<=e.length;n++)t[n]=[n];let s;for(s=0;s<=i.length;s++)t[0][s]=s;for(n=1;n<=e.length;n++)for(s=1;s<=i.length;s++)e.charAt(n-1)===i.charAt(s-1)?t[n][s]=t[n-1][s-1]:n>1&&s>1&&e.charAt(n-2)===i.charAt(s-1)&&e.charAt(n-1)===i.charAt(s-2)?t[n][s]=t[n-2][s-2]+1:t[n][s]=Math.min(t[n-1][s-1]+1,Math.min(t[n][s-1]+1,t[n-1][s]+1));return t[e.length][i.length]}var Ai=["$0","--","_"];function Ei(i,e,t){let n=t.y18n.__,s=t.y18n.__n,r={};r.nonOptionCount=function(f){let u=i.getDemandedCommands(),C=f._.length+(f["--"]?f["--"].length:0)-i.getInternalMethods().getContext().commands.length;u._&&(Cu._.max)&&(Cu._.max&&(u._.maxMsg!==void 0?e.fail(u._.maxMsg?u._.maxMsg.replace(/\$0/g,C.toString()).replace(/\$1/,u._.max.toString()):null):e.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",C,C.toString(),u._.max.toString()))))},r.positionalCount=function(f,u){u"u")&&(g=g||{},g[C]=u[C]);if(g){let C=[];for(let p of Object.keys(g)){let R=g[p];R&&C.indexOf(R)<0&&C.push(R)}let w=C.length?` -${C.join(` -`)}`:"";e.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(g).length,Object.keys(g).join(", ")+w))}},r.unknownArguments=function(f,u,g,C,w=!0){var p;let R=i.getInternalMethods().getCommandInstance().getCommands(),D=[],B=i.getInternalMethods().getContext();if(Object.keys(f).forEach(L=>{!Ai.includes(L)&&!Object.prototype.hasOwnProperty.call(g,L)&&!Object.prototype.hasOwnProperty.call(i.getInternalMethods().getParseContext(),L)&&!r.isValidAndSomeAliasIsNotNew(L,u)&&D.push(L)}),w&&(B.commands.length>0||R.length>0||C)&&f._.slice(B.commands.length).forEach(L=>{R.includes(""+L)||D.push(""+L)}),w){let G=((p=i.getDemandedCommands()._)===null||p===void 0?void 0:p.max)||0,ve=B.commands.length+G;ve{we=String(we),!B.commands.includes(we)&&!D.includes(we)&&D.push(we)})}D.length&&e.fail(s("Unknown argument: %s","Unknown arguments: %s",D.length,D.map(L=>L.trim()?L:`"${L}"`).join(", ")))},r.unknownCommands=function(f){let u=i.getInternalMethods().getCommandInstance().getCommands(),g=[],C=i.getInternalMethods().getContext();return(C.commands.length>0||u.length>0)&&f._.slice(C.commands.length).forEach(w=>{u.includes(""+w)||g.push(""+w)}),g.length>0?(e.fail(s("Unknown command: %s","Unknown commands: %s",g.length,g.join(", "))),!0):!1},r.isValidAndSomeAliasIsNotNew=function(f,u){if(!Object.prototype.hasOwnProperty.call(u,f))return!1;let g=i.parsed.newAliases;return[f,...u[f]].some(C=>!Object.prototype.hasOwnProperty.call(g,C)||!g[f])},r.limitedChoices=function(f){let u=i.getOptions(),g={};if(!Object.keys(u.choices).length)return;Object.keys(f).forEach(p=>{Ai.indexOf(p)===-1&&Object.prototype.hasOwnProperty.call(u.choices,p)&&[].concat(f[p]).forEach(R=>{u.choices[p].indexOf(R)===-1&&R!==void 0&&(g[p]=(g[p]||[]).concat(R))})});let C=Object.keys(g);if(!C.length)return;let w=n("Invalid values:");C.forEach(p=>{w+=` - ${n("Argument: %s, Given: %s, Choices: %s",p,e.stringifiedValues(g[p]),e.stringifiedValues(u.choices[p]))}`}),e.fail(w)};let o={};r.implies=function(f,u){E(" [array|number|string]",[f,u],arguments.length),typeof f=="object"?Object.keys(f).forEach(g=>{r.implies(g,f[g])}):(i.global(f),o[f]||(o[f]=[]),Array.isArray(u)?u.forEach(g=>r.implies(f,g)):(le(u,void 0,t),o[f].push(u)))},r.getImplied=function(){return o};function l(m,f){let u=Number(f);return f=isNaN(u)?f:u,typeof f=="number"?f=m._.length>=f:f.match(/^--no-.+/)?(f=f.match(/^--no-(.+)/)[1],f=!Object.prototype.hasOwnProperty.call(m,f)):f=Object.prototype.hasOwnProperty.call(m,f),f}r.implications=function(f){let u=[];if(Object.keys(o).forEach(g=>{let C=g;(o[g]||[]).forEach(w=>{let p=C,R=w;p=l(f,p),w=l(f,w),p&&!w&&u.push(` ${C} -> ${R}`)})}),u.length){let g=`${n("Implications failed:")} -`;u.forEach(C=>{g+=C}),e.fail(g)}};let b={};r.conflicts=function(f,u){E(" [array|string]",[f,u],arguments.length),typeof f=="object"?Object.keys(f).forEach(g=>{r.conflicts(g,f[g])}):(i.global(f),b[f]||(b[f]=[]),Array.isArray(u)?u.forEach(g=>r.conflicts(f,g)):b[f].push(u))},r.getConflicting=()=>b,r.conflicting=function(f){Object.keys(f).forEach(u=>{b[u]&&b[u].forEach(g=>{g&&f[u]!==void 0&&f[g]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",u,g))})}),i.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(b).forEach(u=>{b[u].forEach(g=>{g&&f[t.Parser.camelCase(u)]!==void 0&&f[t.Parser.camelCase(g)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",u,g))})})},r.recommendCommands=function(f,u){u=u.sort((p,R)=>R.length-p.length);let C=null,w=1/0;for(let p=0,R;(R=u[p])!==void 0;p++){let D=_i(f,R);D<=3&&D!f[u]),b=Re(b,u=>!f[u]),r};let y=[];return r.freeze=function(){y.push({implied:o,conflicting:b})},r.unfreeze=function(){let f=y.pop();le(f,void 0,t),{implied:o,conflicting:b}=f},r}var gn=[],mt;function gt(i,e,t,n){mt=n;let s={};if(Object.prototype.hasOwnProperty.call(i,"extends")){if(typeof i.extends!="string")return s;let r=/\.json|\..*rc$/.test(i.extends),o=null;if(r)o=Sr(e,i.extends);else try{o=Ee.resolve(i.extends)}catch{return i}jr(o),gn.push(o),s=r?JSON.parse(mt.readFileSync(o,"utf8")):Ee(i.extends),delete i.extends,s=gt(s,mt.path.dirname(o),t,mt)}return gn=[],t?ji(s,i):Object.assign({},s,i)}function jr(i){if(gn.indexOf(i)>-1)throw new V(`Circular extended configurations: '${i}'.`)}function Sr(i,e){return mt.path.resolve(i,e)}function ji(i,e){let t={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(t,i);for(let s of Object.keys(e))n(e[s])&&n(t[s])?t[s]=ji(i[s],e[s]):t[s]=e[s];return t}var j=function(i,e,t,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!s:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(i,t):s?s.value=t:e.set(i,t),t},a=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},ne,Ve,bt,ge,fe,Nt,We,qe,Rt,be,Tt,ye,je,ue,Oe,Wt,at,oe,I,Dt,Lt,he,Ke,lt,ke,De,Ut,N,Je,Qe,Ze,T,Bt,Se,ee;function Vi(i){return(e=[],t=i.process.cwd(),n)=>{let s=new Sn(e,t,n,i);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}var Si=Symbol("copyDoubleDash"),Pi=Symbol("copyDoubleDash"),bn=Symbol("deleteFromParserHintObject"),Mi=Symbol("emitWarning"),Ii=Symbol("freeze"),$i=Symbol("getDollarZero"),Xe=Symbol("getParserConfiguration"),vi=Symbol("getUsageConfiguration"),yn=Symbol("guessLocale"),Fi=Symbol("guessVersion"),Ni=Symbol("parsePositionalNumbers"),On=Symbol("pkgUp"),Le=Symbol("populateParserHintArray"),ct=Symbol("populateParserHintSingleValueDictionary"),wn=Symbol("populateParserHintArrayDictionary"),Cn=Symbol("populateParserHintDictionary"),xn=Symbol("sanitizeKey"),_n=Symbol("setKey"),An=Symbol("unfreeze"),Ri=Symbol("validateAsync"),Ti=Symbol("getCommandInstance"),Wi=Symbol("getContext"),Di=Symbol("getHasOutput"),Li=Symbol("getLoggerInstance"),Ui=Symbol("getParseContext"),Bi=Symbol("getUsageInstance"),zi=Symbol("getValidationInstance"),zt=Symbol("hasParseCallback"),Yi=Symbol("isGlobalContext"),et=Symbol("postProcess"),Gi=Symbol("rebase"),En=Symbol("reset"),yt=Symbol("runYargsParserAndExecuteCommands"),jn=Symbol("runValidation"),Hi=Symbol("setHasOutput"),tt=Symbol("kTrackManuallySetKeys"),Sn=class{constructor(e=[],t,n,s){this.customScriptName=!1,this.parsed=!1,ne.set(this,void 0),Ve.set(this,void 0),bt.set(this,{commands:[],fullCommands:[]}),ge.set(this,null),fe.set(this,null),Nt.set(this,"show-hidden"),We.set(this,null),qe.set(this,!0),Rt.set(this,{}),be.set(this,!0),Tt.set(this,[]),ye.set(this,void 0),je.set(this,{}),ue.set(this,!1),Oe.set(this,null),Wt.set(this,!0),at.set(this,void 0),oe.set(this,""),I.set(this,void 0),Dt.set(this,void 0),Lt.set(this,{}),he.set(this,null),Ke.set(this,null),lt.set(this,{}),ke.set(this,{}),De.set(this,void 0),Ut.set(this,!1),N.set(this,void 0),Je.set(this,!1),Qe.set(this,!1),Ze.set(this,!1),T.set(this,void 0),Bt.set(this,{}),Se.set(this,null),ee.set(this,void 0),j(this,N,s,"f"),j(this,De,e,"f"),j(this,Ve,t,"f"),j(this,Dt,n,"f"),j(this,ye,new $t(this),"f"),this.$0=this[$i](),this[En](),j(this,ne,a(this,ne,"f"),"f"),j(this,T,a(this,T,"f"),"f"),j(this,ee,a(this,ee,"f"),"f"),j(this,I,a(this,I,"f"),"f"),a(this,I,"f").showHiddenOpt=a(this,Nt,"f"),j(this,at,this[Pi](),"f")}addHelpOpt(e,t){let n="help";return E("[string|boolean] [string]",[e,t],arguments.length),a(this,Oe,"f")&&(this[bn](a(this,Oe,"f")),j(this,Oe,null,"f")),e===!1&&t===void 0?this:(j(this,Oe,typeof e=="string"?e:n,"f"),this.boolean(a(this,Oe,"f")),this.describe(a(this,Oe,"f"),t||a(this,T,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(E("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;let n=typeof e=="string"?e:a(this,Nt,"f");return this.boolean(n),this.describe(n,t||a(this,T,"f").deferY18nLookup("Show hidden options")),a(this,I,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return E(" [string|array]",[e,t],arguments.length),this[wn](this.alias.bind(this),"alias",e,t),this}array(e){return E("",[e],arguments.length),this[Le]("array",e),this[tt](e),this}boolean(e){return E("",[e],arguments.length),this[Le]("boolean",e),this[tt](e),this}check(e,t){return E(" [boolean]",[e,t],arguments.length),this.middleware((n,s)=>He(()=>e(n,s.getOptions()),r=>(r?(typeof r=="string"||r instanceof Error)&&a(this,T,"f").fail(r.toString(),r):a(this,T,"f").fail(a(this,N,"f").y18n.__("Argument check failed: %s",e.toString())),n),r=>(a(this,T,"f").fail(r.message?r.message:r.toString(),r),n)),!1,t),this}choices(e,t){return E(" [string|array]",[e,t],arguments.length),this[wn](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(E(" [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new V("coerce callback must be provided");for(let n of e)this.coerce(n,t);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!t)throw new V("coerce callback must be provided");return a(this,I,"f").key[e]=!0,a(this,ye,"f").addCoerceMiddleware((n,s)=>{let r;return Object.prototype.hasOwnProperty.call(n,e)?He(()=>(r=s.getAliases(),t(n[e])),l=>{n[e]=l;let b=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[e]&&b!==!0)for(let y of r[e])n[y]=l;return n},l=>{throw new V(l.message)}):n},e),this}conflicts(e,t){return E(" [string|array]",[e,t],arguments.length),a(this,ee,"f").conflicts(e,t),this}config(e="config",t,n){return E("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=gt(e,a(this,Ve,"f"),this[Xe]()["deep-merge-config"]||!1,a(this,N,"f")),a(this,I,"f").configObjects=(a(this,I,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||a(this,T,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(s=>{a(this,I,"f").config[s]=n||!0}),this)}completion(e,t,n){return E("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),j(this,fe,e||a(this,fe,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(a(this,fe,"f"),t),n&&a(this,ge,"f").registerFunction(n),this}command(e,t,n,s,r,o){return E(" [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,s,r,o],arguments.length),a(this,ne,"f").addHandler(e,t,n,s,r,o),this}commands(e,t,n,s,r,o){return this.command(e,t,n,s,r,o)}commandDir(e,t){E(" [object]",[e,t],arguments.length);let n=a(this,Dt,"f")||a(this,N,"f").require;return a(this,ne,"f").addDirectory(e,n,a(this,N,"f").getCallerFile(),t),this}count(e){return E("",[e],arguments.length),this[Le]("count",e),this[tt](e),this}default(e,t,n){return E(" [*] [string]",[e,t,n],arguments.length),n&&(un(e,a(this,N,"f")),a(this,I,"f").defaultDescription[e]=n),typeof t=="function"&&(un(e,a(this,N,"f")),a(this,I,"f").defaultDescription[e]||(a(this,I,"f").defaultDescription[e]=a(this,T,"f").functionDescription(t)),t=t.call()),this[ct](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,s){return E("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,s],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),a(this,I,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:s},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(s=>{le(n,!0,a(this,N,"f")),this.demandOption(s,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(le(n,!0,a(this,N,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(s=>{le(n,!0,a(this,N,"f")),this.demandOption(s,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return E(" [string]",[e,t],arguments.length),this[ct](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return E(" [string|boolean]",[e,t],arguments.length),a(this,I,"f").deprecatedOptions[e]=t,this}describe(e,t){return E(" [string]",[e,t],arguments.length),this[_n](e,!0),a(this,T,"f").describe(e,t),this}detectLocale(e){return E("",[e],arguments.length),j(this,qe,e,"f"),this}env(e){return E("[string|boolean]",[e],arguments.length),e===!1?delete a(this,I,"f").envPrefix:a(this,I,"f").envPrefix=e||"",this}epilogue(e){return E("",[e],arguments.length),a(this,T,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return E(" [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):a(this,T,"f").example(e,t),this}exit(e,t){j(this,ue,!0,"f"),j(this,We,t,"f"),a(this,be,"f")&&a(this,N,"f").process.exit(e)}exitProcess(e=!0){return E("[boolean]",[e],arguments.length),j(this,be,e,"f"),this}fail(e){if(E("",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new V("Invalid first argument. Expected function or boolean 'false'");return a(this,T,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return E(" [function]",[e,t],arguments.length),t?a(this,ge,"f").getCompletion(e,t):new Promise((n,s)=>{a(this,ge,"f").getCompletion(e,(r,o)=>{r?s(r):n(o)})})}getDemandedOptions(){return E([],0),a(this,I,"f").demandedOptions}getDemandedCommands(){return E([],0),a(this,I,"f").demandedCommands}getDeprecatedOptions(){return E([],0),a(this,I,"f").deprecatedOptions}getDetectLocale(){return a(this,qe,"f")}getExitProcess(){return a(this,be,"f")}getGroups(){return Object.assign({},a(this,je,"f"),a(this,ke,"f"))}getHelp(){if(j(this,ue,!0,"f"),!a(this,T,"f").hasCachedHelpMessage()){if(!this.parsed){let t=this[yt](a(this,De,"f"),void 0,void 0,0,!0);if(q(t))return t.then(()=>a(this,T,"f").help())}let e=a(this,ne,"f").runDefaultBuilderOn(this);if(q(e))return e.then(()=>a(this,T,"f").help())}return Promise.resolve(a(this,T,"f").help())}getOptions(){return a(this,I,"f")}getStrict(){return a(this,Je,"f")}getStrictCommands(){return a(this,Qe,"f")}getStrictOptions(){return a(this,Ze,"f")}global(e,t){return E(" [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?a(this,I,"f").local=a(this,I,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{a(this,I,"f").local.includes(n)||a(this,I,"f").local.push(n)}),this}group(e,t){E(" ",[e,t],arguments.length);let n=a(this,ke,"f")[t]||a(this,je,"f")[t];a(this,ke,"f")[t]&&delete a(this,ke,"f")[t];let s={};return a(this,je,"f")[t]=(n||[]).concat(e).filter(r=>s[r]?!1:s[r]=!0),this}hide(e){return E("",[e],arguments.length),a(this,I,"f").hiddenOptions.push(e),this}implies(e,t){return E(" [number|string|array]",[e,t],arguments.length),a(this,ee,"f").implies(e,t),this}locale(e){return E("[string]",[e],arguments.length),e===void 0?(this[yn](),a(this,N,"f").y18n.getLocale()):(j(this,qe,!1,"f"),a(this,N,"f").y18n.setLocale(e),this)}middleware(e,t,n){return a(this,ye,"f").addMiddleware(e,!!t,n)}nargs(e,t){return E(" [number]",[e,t],arguments.length),this[ct](this.nargs.bind(this),"narg",e,t),this}normalize(e){return E("",[e],arguments.length),this[Le]("normalize",e),this}number(e){return E("",[e],arguments.length),this[Le]("number",e),this[tt](e),this}option(e,t){if(E(" [object]",[e,t],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof t!="object"&&(t={}),this[tt](e),a(this,Se,"f")&&(e==="version"||t?.alias==="version")&&this[Mi](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(` -`),void 0,"versionWarning"),a(this,I,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);let n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);let s=t.demand||t.required||t.require;s&&this.demand(e,s),t.demandOption&&this.demandOption(e,typeof t.demandOption=="string"?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),"default"in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type==="boolean")&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type==="array")&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type==="number")&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type==="string")&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type==="count")&&this.count(e),typeof t.global=="boolean"&&this.global(e,t.global),t.defaultDescription&&(a(this,I,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);let r=t.describe||t.description||t.desc,o=a(this,T,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(o,e)||typeof r=="string")&&this.describe(e,r),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){E("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[Ii](),typeof e>"u"&&(e=a(this,De,"f")),typeof t=="object"&&(j(this,Ke,t,"f"),t=n),typeof t=="function"&&(j(this,he,t,"f"),t=!1),t||j(this,De,e,"f"),a(this,he,"f")&&j(this,be,!1,"f");let s=this[yt](e,!!t),r=this.parsed;return a(this,ge,"f").setParsed(this.parsed),q(s)?s.then(o=>(a(this,he,"f")&&a(this,he,"f").call(this,a(this,We,"f"),o,a(this,oe,"f")),o)).catch(o=>{throw a(this,he,"f")&&a(this,he,"f")(o,this.parsed.argv,a(this,oe,"f")),o}).finally(()=>{this[An](),this.parsed=r}):(a(this,he,"f")&&a(this,he,"f").call(this,a(this,We,"f"),s,a(this,oe,"f")),this[An](),this.parsed=r,s)}parseAsync(e,t,n){let s=this.parse(e,t,n);return q(s)?s:Promise.resolve(s)}parseSync(e,t,n){let s=this.parse(e,t,n);if(q(s))throw new V(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(e){return E("",[e],arguments.length),j(this,Lt,e,"f"),this}pkgConf(e,t){E(" [string]",[e,t],arguments.length);let n=null,s=this[On](t||a(this,Ve,"f"));return s[e]&&typeof s[e]=="object"&&(n=gt(s[e],t||a(this,Ve,"f"),this[Xe]()["deep-merge-config"]||!1,a(this,N,"f")),a(this,I,"f").configObjects=(a(this,I,"f").configObjects||[]).concat(n)),this}positional(e,t){E(" ",[e,t],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=Re(t,(o,l)=>o==="type"&&!["string","number","boolean"].includes(l)?!1:n.includes(o));let s=a(this,bt,"f").fullCommands[a(this,bt,"f").fullCommands.length-1],r=s?a(this,ne,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return rt(r).forEach(o=>{let l=r[o];Array.isArray(l)?l.indexOf(e)!==-1&&(t[o]=!0):l[e]&&!(o in t)&&(t[o]=l[e])}),this.group(e,a(this,T,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return E("[boolean]",[e],arguments.length),j(this,Ut,e,"f"),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){return E(" [number]",[e],arguments.length),typeof e=="string"&&a(this,I,"f").narg[e]?this:(this[ct](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return E("[string] [string]",[e,t],arguments.length),e=e||this.$0,a(this,at,"f").log(a(this,ge,"f").generateCompletionScript(e,t||a(this,fe,"f")||"completion")),this}showHelp(e){if(E("[string|function]",[e],arguments.length),j(this,ue,!0,"f"),!a(this,T,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[yt](a(this,De,"f"),void 0,void 0,0,!0);if(q(n))return n.then(()=>{a(this,T,"f").showHelp(e)}),this}let t=a(this,ne,"f").runDefaultBuilderOn(this);if(q(t))return t.then(()=>{a(this,T,"f").showHelp(e)}),this}return a(this,T,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return E("[boolean|string] [string]",[e,t],arguments.length),a(this,T,"f").showHelpOnFail(e,t),this}showVersion(e){return E("[string|function]",[e],arguments.length),a(this,T,"f").showVersion(e),this}skipValidation(e){return E("",[e],arguments.length),this[Le]("skipValidation",e),this}strict(e){return E("[boolean]",[e],arguments.length),j(this,Je,e!==!1,"f"),this}strictCommands(e){return E("[boolean]",[e],arguments.length),j(this,Qe,e!==!1,"f"),this}strictOptions(e){return E("[boolean]",[e],arguments.length),j(this,Ze,e!==!1,"f"),this}string(e){return E("",[e],arguments.length),this[Le]("string",e),this[tt](e),this}terminalWidth(){return E([],0),a(this,N,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return E("",[e],arguments.length),j(this,qe,!1,"f"),a(this,N,"f").y18n.updateLocale(e),this}usage(e,t,n,s){if(E(" [string|boolean] [function|object] [function]",[e,t,n,s],arguments.length),t!==void 0){if(le(e,null,a(this,N,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,s);throw new V(".usage() description must start with $0 if being used as alias for .command()")}else return a(this,T,"f").usage(e),this}usageConfiguration(e){return E("",[e],arguments.length),j(this,Bt,e,"f"),this}version(e,t,n){let s="version";if(E("[boolean|string] [string] [string]",[e,t,n],arguments.length),a(this,Se,"f")&&(this[bn](a(this,Se,"f")),a(this,T,"f").version(void 0),j(this,Se,null,"f")),arguments.length===0)n=this[Fi](),e=s;else if(arguments.length===1){if(e===!1)return this;n=e,e=s}else arguments.length===2&&(n=t,t=void 0);return j(this,Se,typeof e=="string"?e:s,"f"),t=t||a(this,T,"f").deferY18nLookup("Show version number"),a(this,T,"f").version(n||void 0),this.boolean(a(this,Se,"f")),this.describe(a(this,Se,"f"),t),this}wrap(e){return E("",[e],arguments.length),a(this,T,"f").wrap(e),this}[(ne=new WeakMap,Ve=new WeakMap,bt=new WeakMap,ge=new WeakMap,fe=new WeakMap,Nt=new WeakMap,We=new WeakMap,qe=new WeakMap,Rt=new WeakMap,be=new WeakMap,Tt=new WeakMap,ye=new WeakMap,je=new WeakMap,ue=new WeakMap,Oe=new WeakMap,Wt=new WeakMap,at=new WeakMap,oe=new WeakMap,I=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,he=new WeakMap,Ke=new WeakMap,lt=new WeakMap,ke=new WeakMap,De=new WeakMap,Ut=new WeakMap,N=new WeakMap,Je=new WeakMap,Qe=new WeakMap,Ze=new WeakMap,T=new WeakMap,Bt=new WeakMap,Se=new WeakMap,ee=new WeakMap,Si)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[Pi](){return{log:(...e)=>{this[zt]()||console.log(...e),j(this,ue,!0,"f"),a(this,oe,"f").length&&j(this,oe,a(this,oe,"f")+` -`,"f"),j(this,oe,a(this,oe,"f")+e.join(" "),"f")},error:(...e)=>{this[zt]()||console.error(...e),j(this,ue,!0,"f"),a(this,oe,"f").length&&j(this,oe,a(this,oe,"f")+` -`,"f"),j(this,oe,a(this,oe,"f")+e.join(" "),"f")}}}[bn](e){rt(a(this,I,"f")).forEach(t=>{if((s=>s==="configObjects")(t))return;let n=a(this,I,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete a(this,T,"f").getDescriptions()[e]}[Mi](e,t,n){a(this,Rt,"f")[n]||(a(this,N,"f").process.emitWarning(e,t),a(this,Rt,"f")[n]=!0)}[Ii](){a(this,Tt,"f").push({options:a(this,I,"f"),configObjects:a(this,I,"f").configObjects.slice(0),exitProcess:a(this,be,"f"),groups:a(this,je,"f"),strict:a(this,Je,"f"),strictCommands:a(this,Qe,"f"),strictOptions:a(this,Ze,"f"),completionCommand:a(this,fe,"f"),output:a(this,oe,"f"),exitError:a(this,We,"f"),hasOutput:a(this,ue,"f"),parsed:this.parsed,parseFn:a(this,he,"f"),parseContext:a(this,Ke,"f")}),a(this,T,"f").freeze(),a(this,ee,"f").freeze(),a(this,ne,"f").freeze(),a(this,ye,"f").freeze()}[$i](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,N,"f").process.argv()[0])?t=a(this,N,"f").process.argv().slice(1,2):t=a(this,N,"f").process.argv().slice(0,1),e=t.map(n=>{let s=this[Gi](a(this,Ve,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length{if(l.includes("package.json"))return"package.json"});le(r,void 0,a(this,N,"f")),n=JSON.parse(a(this,N,"f").readFileSync(r,"utf8"))}catch{}return a(this,lt,"f")[t]=n||{},a(this,lt,"f")[t]}[Le](e,t){t=[].concat(t),t.forEach(n=>{n=this[xn](n),a(this,I,"f")[e].push(n)})}[ct](e,t,n,s){this[Cn](e,t,n,s,(r,o,l)=>{a(this,I,"f")[r][o]=l})}[wn](e,t,n,s){this[Cn](e,t,n,s,(r,o,l)=>{a(this,I,"f")[r][o]=(a(this,I,"f")[r][o]||[]).concat(l)})}[Cn](e,t,n,s,r){if(Array.isArray(n))n.forEach(o=>{e(o,s)});else if((o=>typeof o=="object")(n))for(let o of rt(n))e(o,n[o]);else r(t,this[xn](n),s)}[xn](e){return e==="__proto__"?"___proto___":e}[_n](e,t){return this[ct](this[_n].bind(this),"key",e,t),this}[An](){var e,t,n,s,r,o,l,b,y,m,f,u;let g=a(this,Tt,"f").pop();le(g,void 0,a(this,N,"f"));let C;e=this,t=this,n=this,s=this,r=this,o=this,l=this,b=this,y=this,m=this,f=this,u=this,{options:{set value(w){j(e,I,w,"f")}}.value,configObjects:C,exitProcess:{set value(w){j(t,be,w,"f")}}.value,groups:{set value(w){j(n,je,w,"f")}}.value,output:{set value(w){j(s,oe,w,"f")}}.value,exitError:{set value(w){j(r,We,w,"f")}}.value,hasOutput:{set value(w){j(o,ue,w,"f")}}.value,parsed:this.parsed,strict:{set value(w){j(l,Je,w,"f")}}.value,strictCommands:{set value(w){j(b,Qe,w,"f")}}.value,strictOptions:{set value(w){j(y,Ze,w,"f")}}.value,completionCommand:{set value(w){j(m,fe,w,"f")}}.value,parseFn:{set value(w){j(f,he,w,"f")}}.value,parseContext:{set value(w){j(u,Ke,w,"f")}}.value}=g,a(this,I,"f").configObjects=C,a(this,T,"f").unfreeze(),a(this,ee,"f").unfreeze(),a(this,ne,"f").unfreeze(),a(this,ye,"f").unfreeze()}[Ri](e,t){return He(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[Ti].bind(this),getContext:this[Wi].bind(this),getHasOutput:this[Di].bind(this),getLoggerInstance:this[Li].bind(this),getParseContext:this[Ui].bind(this),getParserConfiguration:this[Xe].bind(this),getUsageConfiguration:this[vi].bind(this),getUsageInstance:this[Bi].bind(this),getValidationInstance:this[zi].bind(this),hasParseCallback:this[zt].bind(this),isGlobalContext:this[Yi].bind(this),postProcess:this[et].bind(this),reset:this[En].bind(this),runValidation:this[jn].bind(this),runYargsParserAndExecuteCommands:this[yt].bind(this),setHasOutput:this[Hi].bind(this)}}[Ti](){return a(this,ne,"f")}[Wi](){return a(this,bt,"f")}[Di](){return a(this,ue,"f")}[Li](){return a(this,at,"f")}[Ui](){return a(this,Ke,"f")||{}}[Bi](){return a(this,T,"f")}[zi](){return a(this,ee,"f")}[zt](){return!!a(this,he,"f")}[Yi](){return a(this,Wt,"f")}[et](e,t,n,s){return n||q(e)||(t||(e=this[Si](e)),(this[Xe]()["parse-positional-numbers"]||this[Xe]()["parse-positional-numbers"]===void 0)&&(e=this[Ni](e)),s&&(e=Ge(e,this,a(this,ye,"f").getMiddleware(),!1))),e}[En](e={}){j(this,I,a(this,I,"f")||{},"f");let t={};t.local=a(this,I,"f").local||[],t.configObjects=a(this,I,"f").configObjects||[];let n={};t.local.forEach(o=>{n[o]=!0,(e[o]||[]).forEach(l=>{n[l]=!0})}),Object.assign(a(this,ke,"f"),Object.keys(a(this,je,"f")).reduce((o,l)=>{let b=a(this,je,"f")[l].filter(y=>!(y in n));return b.length>0&&(o[l]=b),o},{})),j(this,je,{},"f");let s=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],r=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return s.forEach(o=>{t[o]=(a(this,I,"f")[o]||[]).filter(l=>!n[l])}),r.forEach(o=>{t[o]=Re(a(this,I,"f")[o],l=>!n[l])}),t.envPrefix=a(this,I,"f").envPrefix,j(this,I,t,"f"),j(this,T,a(this,T,"f")?a(this,T,"f").reset(n):Oi(this,a(this,N,"f")),"f"),j(this,ee,a(this,ee,"f")?a(this,ee,"f").reset(n):Ei(this,a(this,T,"f"),a(this,N,"f")),"f"),j(this,ne,a(this,ne,"f")?a(this,ne,"f").reset():gi(a(this,T,"f"),a(this,ee,"f"),a(this,ye,"f"),a(this,N,"f")),"f"),a(this,ge,"f")||j(this,ge,xi(this,a(this,T,"f"),a(this,ne,"f"),a(this,N,"f")),"f"),a(this,ye,"f").reset(),j(this,fe,null,"f"),j(this,oe,"","f"),j(this,We,null,"f"),j(this,ue,!1,"f"),this.parsed=!1,this}[Gi](e,t){return a(this,N,"f").path.relative(e,t)}[yt](e,t,n,s=0,r=!1){let o=!!n||r;e=e||a(this,De,"f"),a(this,I,"f").__=a(this,N,"f").y18n.__,a(this,I,"f").configuration=this[Xe]();let l=!!a(this,I,"f").configuration["populate--"],b=Object.assign({},a(this,I,"f").configuration,{"populate--":!0}),y=a(this,N,"f").Parser.detailed(e,Object.assign({},a(this,I,"f"),{configuration:{"parse-positional-numbers":!1,...b}})),m=Object.assign(y.argv,a(this,Ke,"f")),f,u=y.aliases,g=!1,C=!1;Object.keys(m).forEach(w=>{w===a(this,Oe,"f")&&m[w]?g=!0:w===a(this,Se,"f")&&m[w]&&(C=!0)}),m.$0=this.$0,this.parsed=y,s===0&&a(this,T,"f").clearCachedHelpMessage();try{if(this[yn](),t)return this[et](m,l,!!n,!1);a(this,Oe,"f")&&[a(this,Oe,"f")].concat(u[a(this,Oe,"f")]||[]).filter(B=>B.length>1).includes(""+m._[m._.length-1])&&(m._.pop(),g=!0),j(this,Wt,!1,"f");let w=a(this,ne,"f").getCommands(),p=a(this,ge,"f").completionKey in m,R=g||p||r;if(m._.length){if(w.length){let D;for(let B=s||0,L;m._[B]!==void 0;B++)if(L=String(m._[B]),w.includes(L)&&L!==a(this,fe,"f")){let G=a(this,ne,"f").runCommand(L,this,y,B+1,r,g||C||r);return this[et](G,l,!!n,!1)}else if(!D&&L!==a(this,fe,"f")){D=L;break}!a(this,ne,"f").hasDefaultCommand()&&a(this,Ut,"f")&&D&&!R&&a(this,ee,"f").recommendCommands(D,w)}a(this,fe,"f")&&m._.includes(a(this,fe,"f"))&&!p&&(a(this,be,"f")&&Te(!0),this.showCompletionScript(),this.exit(0))}if(a(this,ne,"f").hasDefaultCommand()&&!R){let D=a(this,ne,"f").runCommand(null,this,y,0,r,g||C||r);return this[et](D,l,!!n,!1)}if(p){a(this,be,"f")&&Te(!0),e=[].concat(e);let D=e.slice(e.indexOf(`--${a(this,ge,"f").completionKey}`)+1);return a(this,ge,"f").getCompletion(D,(B,L)=>{if(B)throw new V(B.message);(L||[]).forEach(G=>{a(this,at,"f").log(G)}),this.exit(0)}),this[et](m,!l,!!n,!1)}if(a(this,ue,"f")||(g?(a(this,be,"f")&&Te(!0),o=!0,this.showHelp("log"),this.exit(0)):C&&(a(this,be,"f")&&Te(!0),o=!0,a(this,T,"f").showVersion("log"),this.exit(0))),!o&&a(this,I,"f").skipValidation.length>0&&(o=Object.keys(m).some(D=>a(this,I,"f").skipValidation.indexOf(D)>=0&&m[D]===!0)),!o){if(y.error)throw new V(y.error.message);if(!p){let D=this[jn](u,{},y.error);n||(f=Ge(m,this,a(this,ye,"f").getMiddleware(),!0)),f=this[Ri](D,f??m),q(f)&&!n&&(f=f.then(()=>Ge(m,this,a(this,ye,"f").getMiddleware(),!1)))}}}catch(w){if(w instanceof V)a(this,T,"f").fail(w.message,w);else throw w}return this[et](f??m,l,!!n,!0)}[jn](e,t,n,s){let r={...this.getDemandedOptions()};return o=>{if(n)throw new V(n.message);a(this,ee,"f").nonOptionCount(o),a(this,ee,"f").requiredArguments(o,r);let l=!1;a(this,Qe,"f")&&(l=a(this,ee,"f").unknownCommands(o)),a(this,Je,"f")&&!l?a(this,ee,"f").unknownArguments(o,e,t,!!s):a(this,Ze,"f")&&a(this,ee,"f").unknownArguments(o,e,{},!1,!1),a(this,ee,"f").limitedChoices(o),a(this,ee,"f").implications(o),a(this,ee,"f").conflicting(o)}}[Hi](){j(this,ue,!0,"f")}[tt](e){if(typeof e=="string")a(this,I,"f").key[e]=!0;else for(let t of e)a(this,I,"f").key[t]=!0}};function bi(i){return!!i&&typeof i.getInternalMethods=="function"}var Pr=Vi(fn),qi=Pr;var Ki="8.2.0";function ki(i){return i instanceof Error&&"exitCode"in i&&typeof i.exitCode=="number"}var es=gs(Xi(),1);import Gr from"@pinojs/json-colorizer";var Yr=/("(?:[^\\"]|\\.)*")|[:,]/g;function Pn(i,e={}){let t=JSON.stringify([1],void 0,e.indent===void 0?2:e.indent).slice(2,-3),n=t===""?1/0:e.maxLength===void 0?80:e.maxLength,{replacer:s}=e;return function r(o,l,b){o&&typeof o.toJSON=="function"&&(o=o.toJSON());let y=JSON.stringify(o,s);if(y===void 0)return y;let m=n-l.length-b;if(y.length<=m){let f=y.replace(Yr,(u,g)=>g||`${u} `);if(f.length<=m)return f}if(s!=null&&(o=JSON.parse(y),s=void 0),typeof o=="object"&&o!==null){let f=l+t,u=[],g=0,C,w;if(Array.isArray(o)){C="[",w="]";let{length:p}=o;for(;g0)return[C,t+u.join(`, -${f}`),w].join(` -${l}`)}return y}(i,"",0)}function ts(i){return Gr(Pn(i,{indent:2,replacer(e,t){return typeof t=="function"?t.name:t}}),{colors:{BRACKET:"gray"}})}var Hr=(i,e,t)=>{let n=[...i];for(let[s,r]of e.entries())n[s]===void 0?n[s]=t.cloneUnlessOtherwiseSpecified(r,t):t.isMergeableObject(r)?n[s]=Yt(i[s],r,t):i.includes(r)||n.push(r);return n};function Yt(i,e,t={arrayMerge:Hr}){return(0,es.default)(i,e,t)}import{findWorkspaces as Wl,findWorkspacesRoot as Vr}from"find-workspaces";import qr from"fs-extra";import Kr from"node:path";function ns(){let i=Vn();if(i===void 0)throw new Error("No package.json found.");return Kr.dirname(i)}function kr(){let i=Vr();return i!==null?i.location:ns()}function is(i){if(i==="workspace-root")return kr();if(i==="package-dir")return ns();if(typeof i=="string"){if(!qr.pathExistsSync(i))throw new Error(`Custom cwd directory does not exist: ${i}`);return i}return process.cwd()}import ss from"node:fs/promises";async function Jr(i,e){try{let{default:t}=await import("prettier"),n=await t.resolveConfig(i),s=await t.format(e,{filepath:i,...n});await ss.writeFile(i,s,"utf8")}catch{console.warn(`Skipped formatting ${i} since Prettier is not installed.`)}}async function wt(i){try{let e=await ss.readFile(i,"utf8");await Jr(i,e)}catch{}}import{Transform as Qr}from"node:stream";function Gt(i,e){return new Qr({transform(t,n,s){let o=t.toString().split(/\r?\n/).filter(l=>l.trim().length>0).map(l=>`${i?e===void 0?i:Fe[e](i):""} ${l} -`).join("");this.push(o),s()}})}async function rs(i){let e=[];return new Promise((t,n)=>{i.on("data",s=>e.push(s)),i.on("error",s=>{n(s)}),i.on("end",()=>{t(Buffer.concat(e).toString("utf8"))})})}function Mn(i,e){return e===1?i:i+"s"}async function to(i,e,t,n,s){let r=1,o;if(n.logPrefix===void 0)o=i;else{let l=Gt(n.logPrefix,n.logColor);l.pipe(i),o=l}s&&o.write(Fe.bold(`Running: "${n.name}() with Positional arguments: ${String(e)} and Option flags: ${String(t)}"`));try{r=await n.execute(o,e,t)}catch(l){console.error(String(l)),r=1}return r}async function no(i,e,t,n,s){let r=1,o;if(n.logPrefix===void 0)o=i;else{let g=Gt(n.logPrefix,n.logColor);g.pipe(i),o=g}let l=n.subcommands??[],b=[...n.receivePositionalArguments?e:[],...n.positionalArguments??[]],y=[...n.receiveOptionFlags?t:[],...n.optionFlags??[]],m=[...l,...y,...b],f=is(n.cwdOverride);s&&o.write(`Running: "${n.name} ${m.join(" ")}"`);let u=n.prettyJsonOutput?new Xr:o;try{let g=Zr(n.name,m,{cwd:f,env:{...process.env.NO_COLOR===void 0?{FORCE_COLOR:"true"}:{},NODE_OPTIONS:"--experimental-strip-types --disable-warning=ExperimentalWarning"},preferLocal:!0,reject:!1,stdin:"inherit"});if(g.stdout.pipe(u,{end:!1}),g.stderr.pipe(u,{end:!1}),await g,n.prettyJsonOutput){u.end();let C=await rs(u),w=ts(JSON.parse(C)).split(` -`);for(let p of w)o.write(`${p} -`)}r=g.exitCode??1}catch(g){console.error(`${n.name} failed with error:`),console.error(g),ki(g)&&(r=typeof g.exitCode=="number"?g.exitCode:1)}return r}function io(i){return"execute"in i}async function Vt(i,e,t,n,s,r){let o=[];for(let l of n){let b=await(io(l)?to(i,e,t,l,s):no(i,e,t,l,s));o.push({exitCode:b,name:l.name})}if(r){let l=o.filter(({exitCode:m})=>m===0).map(({name:m})=>m),b=o.filter(({exitCode:m})=>m!==0).map(({name:m})=>m),y=o.length;l.length>0&&i.write(`\u2705 ${Fe.green.bold(`${l.length} / ${y} ${Mn("Command",l.length)} Succeeded: `)} ${Fe.green(l.join(", "))} -`),b.length>0&&i.write(`\u274C ${Fe.red.bold(`${b.length} / ${y} ${Mn("Command",b.length)} Failed: `)} ${Fe.red(b.join(", "))} -`)}return o.every(({exitCode:l})=>l===0)?0:1}async function so(i,e,t,n){let s=await Zt();if(s===void 0)throw new Error("The `init` command must be used in a directory with a package.json file");let r=await Zt({cwd:eo(import.meta.url)});if(r===void 0)return i.write(`Error: The script being called was not in a package, weird. -`),1;let o=Ht.join(Ht.dirname(r),"init"),l=Ht.dirname(s),b=(e==="file"||e==="package")&&t!==void 0&&n!==void 0;try{if(b){let f=Object.keys(n)[0];if(e==="package"){let u=$e.readJSONSync(s);i.write(`Merging: -Package config key "${f} \u2192 "${l}" (Because --location is set to "package") -`);let g=Yt(u,n);$e.writeJSONSync(s,g,{spaces:2}),await wt(s)}}if(!await $e.pathExists(o))return 0;if((await $e.readdir(o)).length===0)return i.write(`Source directory "${o}" is empty. -`),0;i.write(`Adding initial configuration files from: -"${o}" \u2192 "${l}" -`),await $e.copy(o,l,{async filter(f,u){let g=os.statSync(f).isFile(),C=os.existsSync(u);if(g){if(b&&e==="package"&&f.includes(t))return C?(i.write(`Deleting: -"${f}" \u2192 "${u}" (Because --location is set to "package") -`),$e.removeSync(u)):i.write(`Skipping: -"${f}" \u2192 "${u}" (Because --location is set to "package") -`),!1;if(C&&(u.includes(".vscode/")||u.includes("package.json"))&&Ht.extname(u)===".json"){i.write(`Merging: -"${f}" \u2192 "${u}" -`);let w=$e.readJSONSync(f),p=$e.readJSONSync(u),R=Yt(p,w);return $e.writeJSONSync(u,R,{spaces:2}),await wt(u),!1}return C?(i.write(`Overwriting: -"${f}" \u2192 "${u}" -`),await wt(u),!0):(i.write(`Copying: -"${f}" \u2192 "${u}" -`),await wt(u),!0)}return!0},overwrite:!0})}catch(y){return console.error(String(y)),1}return 0}async function as(i){let{commands:{fix:e,init:t,lint:n,printConfig:s},description:r,logColor:o,logPrefix:l,name:b,showSummary:y,verbose:m}=i,f=Gt(l,o);f.pipe(process.stdout);let u=qi(ln(process.argv)).scriptName(b).usage("$0 ",r);t!==void 0&&u.command({builder(g){return t.locationOptionFlag?g.option("location",{choices:["file","package"],default:"file",description:"TK",type:"string"}):g},command:"init",describe:t.description??`Initialize by copying starter config files to your project root${t.locationOptionFlag?" or to your package.json file.":"."}`,async handler(g){let C=t.locationOptionFlag?g.location:void 0,p=await Vt(f,[],C===void 0?[]:["--location",C],[{async execute(R,D,B){return so(R,B.at(1),t.configFile,t.configPackageJson)},name:"copyAndMergeInitFiles"},...t.commands??[]]);process.exit(p)}}),n!==void 0&&u.command({builder(g){return n.positionalArgumentMode==="none"?g:g.positional("files",{array:!0,...n.positionalArgumentDefault===void 0?{}:{default:n.positionalArgumentDefault},describe:"Files or glob pattern to lint.",type:"string"})},command:n.positionalArgumentMode==="none"?"lint [files..]":"lint ",describe:n.description,async handler(g){let C=g.files??[],w=await Vt(f,C,[],n.commands,m,y);process.exit(w)}}),e!==void 0&&u.command({builder(g){return e.positionalArgumentMode==="none"?g:g.positional("files",{array:!0,...e.positionalArgumentDefault===void 0?{}:{default:e.positionalArgumentDefault},describe:"Files or glob pattern to fix.",type:"string"})},command:e.positionalArgumentMode==="none"?"fix [files..]":"fix ",describe:e.description,async handler(g){let C=g.files??[],w=await Vt(f,C,[],e.commands,m,y);process.exit(w)}}),s!==void 0&&u.command({builder(g){return s.positionalArgumentMode==="none"?g:g.positional("file",{...s.positionalArgumentDefault===void 0?{}:{default:s.positionalArgumentDefault},describe:"File or glob pattern to TK",type:"string"})},command:s.positionalArgumentMode==="none"?"print-config":s.positionalArgumentMode==="optional"?"print-config [file]":"print-config ",describe:s.description,async handler(g){let C=g.file??void 0,p=await Vt(f,C===void 0?[]:[C],[],s.commands,m,y);process.exit(p)}}),u.alias("h","help"),u.version(Ki),u.alias("v","version"),u.help(),u.wrap(process.stdout.isTTY?Math.min(120,u.terminalWidth()):0),await u.parseAsync()}var Ct={fileRun:"Matches files below the current working directory by default.",monorepoRun:"In a monorepo, it will also run in all packages below the current working directory.",monorepoSearch:"Searches up to the root of a monorepo if necessary.",multiArgumentCaveat:"Will use file arguments / globs where possible if provided, but some of the invoked tools only operate at the package-scope.",multiOptionCaveat:"Will use option flags where possible if provided, but some of the invoked tools will ignore them.",optionalFileRun:"Package-scoped by default, file-scoped if a file argument is provided.",packageRun:"Package-scoped",packageSearch:"Package-scoped"};var ls={commands:{init:{locationOptionFlag:!1},lint:{commands:[{cwdOverride:"package-dir",name:"tsc",optionFlags:["--noEmit"]}],description:`Run type checking on your project. ${Ct.packageRun} ${Ct.monorepoRun}`,positionalArgumentMode:"none"},printConfig:{commands:[{name:"tsc",optionFlags:["--showConfig"],prettyJsonOutput:!0}],description:`Print the TypeScript configuration for the project. ${Ct.packageSearch} ${Ct.monorepoSearch}`,positionalArgumentMode:"none"}},description:"Envsa's TypeScript shared configuration tools.",logColor:"blueBright",logPrefix:"[TypeScript Config]",name:"Envsa-typescript",order:3};await as(ls); -/*! Bundled license information: - -yargs-parser/build/lib/string-utils.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/tokenize-arg-string.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/yargs-parser-types.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/yargs-parser.js: - (** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) - -yargs-parser/build/lib/index.js: - (** - * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js - * CJS and ESM environments. - * - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - *) -*/ +// Placeholder, will be replaced by the actual CLI script during the build process