UNPKG

@envsa/repo-config

Version:

Repository configuration and GitHub workflows for @envsa/shared-config.

13 lines 107 kB
#!/usr/bin/env node var ys=Object.create;var Wn=Object.defineProperty;var ws=Object.getOwnPropertyDescriptor;var Os=Object.getOwnPropertyNames;var Cs=Object.getPrototypeOf,xs=Object.prototype.hasOwnProperty;var je=(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 _s=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var As=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Os(e))!xs.call(i,s)&&s!==t&&Wn(i,s,{get:()=>e[s],enumerable:!(n=ws(e,s))||n.enumerable});return i};var Es=(i,e,t)=>(t=i!=null?ys(Cs(i)):{},As(e||!i||!i.__esModule?Wn(t,"default",{value:i,enumerable:!0}):t,i));var os=_s((zl,rs)=>{"use strict";var Lr=function(e){return Ur(e)&&!Br(e)};function Ur(i){return!!i&&typeof i=="object"}function Br(i){var e=Object.prototype.toString.call(i);return e==="[object RegExp]"||e==="[object Date]"||Gr(i)}var zr=typeof Symbol=="function"&&Symbol.for,Yr=zr?Symbol.for("react.element"):60103;function Gr(i){return i.$$typeof===Yr}function Hr(i){return Array.isArray(i)?[]:{}}function Ct(i,e){return e.clone!==!1&&e.isMergeableObject(i)?ft(Hr(i),i,e):i}function Vr(i,e,t){return i.concat(e).map(function(n){return Ct(n,t)})}function kr(i,e){if(!e.customMerge)return ft;var t=e.customMerge(i);return typeof t=="function"?t:ft}function qr(i){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(i).filter(function(e){return Object.propertyIsEnumerable.call(i,e)}):[]}function is(i){return Object.keys(i).concat(qr(i))}function ss(i,e){try{return e in i}catch{return!1}}function Jr(i,e){return ss(i,e)&&!(Object.hasOwnProperty.call(i,e)&&Object.propertyIsEnumerable.call(i,e))}function Kr(i,e,t){var n={};return t.isMergeableObject(i)&&is(i).forEach(function(s){n[s]=Ct(i[s],t)}),is(e).forEach(function(s){Jr(i,s)||(ss(i,s)&&t.isMergeableObject(e[s])?n[s]=kr(s,t)(i[s],e[s],t):n[s]=Ct(e[s],t))}),n}function ft(i,e,t){t=t||{},t.arrayMerge=t.arrayMerge||Vr,t.isMergeableObject=t.isMergeableObject||Lr,t.cloneUnlessOtherwiseSpecified=Ct;var n=Array.isArray(e),s=Array.isArray(i),r=n===s;return r?n?t.arrayMerge(i,e,t):Kr(i,e,t):Ct(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 Qr=ft;rs.exports=Qr});var Dn=(i=0)=>e=>`\x1B[${e+i}m`,Ln=(i=0)=>e=>`\x1B[${38+i};5;${e}m`,Un=(i=0)=>(e,t,n)=>`\x1B[${38+i};2;${e};${t};${n}m`,J={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]}},bo=Object.keys(J.modifier),js=Object.keys(J.color),Ss=Object.keys(J.bgColor),yo=[...js,...Ss];function Ps(){let i=new Map;for(let[e,t]of Object.entries(J)){for(let[n,s]of Object.entries(t))J[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[n]=J[n],i.set(s[0],s[1]);Object.defineProperty(J,e,{value:t,enumerable:!1})}return Object.defineProperty(J,"codes",{value:i,enumerable:!1}),J.color.close="\x1B[39m",J.bgColor.close="\x1B[49m",J.color.ansi=Dn(),J.color.ansi256=Ln(),J.color.ansi16m=Un(),J.bgColor.ansi=Dn(10),J.bgColor.ansi256=Ln(10),J.bgColor.ansi16m=Un(10),Object.defineProperties(J,{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=>J.rgbToAnsi256(...J.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)=>J.ansi256ToAnsi(J.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>J.ansi256ToAnsi(J.hexToAnsi256(e)),enumerable:!1}}),J}var Ms=Ps(),_e=Ms;import Qt from"node:process";import Is from"node:os";import Bn 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<s)}var{env:X}=Qt,Et;de("no-color")||de("no-colors")||de("color=false")||de("color=never")?Et=0:(de("color")||de("colors")||de("color=true")||de("color=always"))&&(Et=1);function $s(){if("FORCE_COLOR"in X)return X.FORCE_COLOR==="true"?1:X.FORCE_COLOR==="false"?0:X.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(X.FORCE_COLOR,10),3)}function vs(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function Fs(i,{streamIsTTY:e,sniffFlags:t=!0}={}){let n=$s();n!==void 0&&(Et=n);let s=t?Et: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=Is.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 zn(i,e={}){let t=Fs(i,{streamIsTTY:i&&i.isTTY,...e});return vs(t)}var Ns={stdout:zn({isTTY:Bn.isatty(1)}),stderr:zn({isTTY:Bn.isatty(2)})},Yn=Ns;function Gn(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 Hn(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:Vn,stderr:kn}=Yn,Zt=Symbol("GENERATOR"),it=Symbol("STYLER"),dt=Symbol("IS_EMPTY"),qn=["ansi","ansi","ansi256","ansi16m"],st=Object.create(null),Rs=(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=Vn?Vn.level:0;i.level=e.level===void 0?t:e.level};var Ts=i=>{let e=(...t)=>t.join(" ");return Rs(e,i),Object.setPrototypeOf(e,pt.prototype),e};function pt(i){return Ts(i)}Object.setPrototypeOf(pt.prototype,Function.prototype);for(let[i,e]of Object.entries(_e))st[i]={get(){let t=jt(this,en(e.open,e.close,this[it]),this[dt]);return Object.defineProperty(this,i,{value:t}),t}};st.visible={get(){let i=jt(this,this[it],!0);return Object.defineProperty(this,"visible",{value:i}),i}};var Xt=(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"?Xt("rgb",e,t,..._e.hexToRgb(...n)):_e[t][i](...n),Ws=["rgb","hex","ansi256"];for(let i of Ws){st[i]={get(){let{level:t}=this;return function(...n){let s=en(Xt(i,qn[t],"color",...n),_e.color.close,this[it]);return jt(this,s,this[dt])}}};let e="bg"+i[0].toUpperCase()+i.slice(1);st[e]={get(){let{level:t}=this;return function(...n){let s=en(Xt(i,qn[t],"bgColor",...n),_e.bgColor.close,this[it]);return jt(this,s,this[dt])}}}}var Ds=Object.defineProperties(()=>{},{...st,level:{enumerable:!0,get(){return this[Zt].level},set(i){this[Zt].level=i}}}),en=(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}},jt=(i,e,t)=>{let n=(...s)=>Ls(n,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(n,Ds),n[Zt]=i,n[it]=e,n[dt]=t,n},Ls=(i,e)=>{if(i.level<=0||!e)return i[dt]?"":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=Gn(e,t.close,t.open),t=t.parent;let r=e.indexOf(` `);return r!==-1&&(e=Hn(e,s,n,r)),n+e+s};Object.defineProperties(pt.prototype,st);var Us=pt(),Po=pt({level:kn?kn.level:0});var Fe=Us;import{cosmiconfig as lc}from"cosmiconfig";import{execa as ao}from"execa";import Ee from"fs-extra";import hs from"node:fs";import qt from"node:path";import{PassThrough as lo}from"node:stream";import{fileURLToPath as co}from"node:url";import Zn from"node:process";import Jn from"node:process";import Bs from"node:fs/promises";import{fileURLToPath as zs}from"node:url";import Ys from"node:fs";import pe from"node:path";var St=i=>i instanceof URL?zs(i):i;async function Kn(i,{cwd:e=Jn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(St(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,St(n??r));s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let l=await Bs.stat(o);if(t==="file"&&l.isFile()||t==="directory"&&l.isDirectory())return o}catch{}s=pe.dirname(s)}}function Qn(i,{cwd:e=Jn.cwd(),type:t="file",stopAt:n}={}){let s=pe.resolve(St(e)??""),{root:r}=pe.parse(s);for(n=pe.resolve(s,St(n)??r);s&&s!==n&&s!==r;){let o=pe.isAbsolute(i)?i:pe.join(s,i);try{let l=Ys.statSync(o,{throwIfNoEntry:!1});if(t==="file"&&l?.isFile()||t==="directory"&&l?.isDirectory())return o}catch{}s=pe.dirname(s)}}async function tn({cwd:i=Zn.cwd()}={}){return Kn("package.json",{cwd:i})}function Xn({cwd:i=Zn.cwd()}={}){return Qn("package.json",{cwd:i})}import{notStrictEqual as pr,strictEqual as mr}from"assert";var Gs={right:Js,center:Ks},Hs=0,Pt=1,Vs=2,Mt=3,nn=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:g}=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=Gs[e[l].align];m=u(m,y),ce.stringWidth(m)<y&&(m+=" ".repeat((g||0)-ce.stringWidth(m)-1))}let f=e[l].padding||[0,0,0,0];f[Mt]&&(r+=" ".repeat(f[Mt])),r+=ei(e[l],m,"| "),r+=m,r+=ei(e[l],m," |"),f[Pt]&&(r+=" ".repeat(f[Pt])),s===0&&t.length>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<o?e:(t.hidden=!0,r.trimRight()+" ".repeat(s-o)+e.trimLeft()):(t.hidden=!0,r+e):e}rasterize(e){let t=[],n=this.columnWidths(e),s;return e.forEach((r,o)=>{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[Hs]||0).fill("")),s.push(...new Array(r.padding[Vs]||0).fill(""))),s.forEach((l,g)=>{t[g]||t.push([]);let y=t[g];for(let m=0;m<o;m++)y[m]===void 0&&y.push("");y.push(l)})}),t}negatePadding(e){let t=e.width||0;return e.padding&&(t-=(e.padding[Mt]||0)+(e.padding[Pt]||0)),e.border&&(t-=4),t}columnWidths(e){if(!this.wrap)return e.map(o=>o.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,ks(e[l])):o)}};function ei(i,e,t){return i.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function ks(i){let e=i.padding||[],t=1+(e[Mt]||0)+(e[Pt]||0);return i.border?t+4:t}function qs(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Js(i,e){i=i.trim();let t=ce.stringWidth(i);return t<e?" ".repeat(e-t)+i:i}function Ks(i,e){i=i.trim();let t=ce.stringWidth(i);return t>=e?i:" ".repeat(e-t>>1)+i}var ce;function ti(i,e){return ce=e,new nn({width:i?.width||qs(),wrap:i?.wrap})}var ni=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function sn(i){return i.replace(ni,"")}function ii(i,e){let[t,n]=i.match(ni)||["",""];i=sn(i);let s="";for(let r=0;r<i.length;r++)r!==0&&r%e===0&&(s+=` `),s+=i.charAt(r);return t&&n&&(s=`${t}${s}${n}`),s}function rn(i){return ti(i,{stringWidth:e=>[...e].length,stripAnsi:sn,wrap:ii})}import{dirname as si,resolve as ri}from"path";import{readdirSync as Qs,statSync as Zs}from"fs";function oi(i,e){let t=ri(".",i),n;for(Zs(t).isDirectory()||(t=si(t));;){if(n=e(t,Qs(t)),n)return ri(t,n);if(t=si(n=t),n===t)break}}import{inspect as gr}from"util";import{readFileSync as br}from"fs";import{fileURLToPath as yr}from"url";import{format as tr}from"util";import{normalize as nr,resolve as ir}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;r<i.length;r++){let o=i.charAt(r);n&&(n=!1,o=o.toUpperCase()),r!==0&&(o==="-"||o==="_")?n=!0:o!=="-"&&o!=="_"&&(t+=o)}return t}}function It(i,e){let t=i.toLowerCase();e=e||"-";let n="";for(let s=0;s<i.length;s++){let r=t.charAt(s),o=i.charAt(s);r!==o&&s>0?n+=`${e}${t.charAt(s)}`:n+=o}return n}function $t(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 ai(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<i.length;o++){if(t=n,n=i.charAt(o),n===" "&&!s){t!==" "&&e++;continue}n===s?s=null:(n==="'"||n==='"')&&!s&&(s=n),r[e]||(r[e]=""),r[e]+=n}return r}var me;(function(i){i.BOOLEAN="boolean",i.STRING="string",i.NUMBER="number",i.ARRAY="array"})(me||(me={}));var $e,vt=class{constructor(e){$e=e}parse(e,t){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),s=ai(e),r=typeof e=="string",o=Xs(Object.assign(Object.create(null),n.alias)),l=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),g=Object.assign(Object.create(null),n.default),y=n.configObjects||[],m=n.envPrefix,f=l["populate--"],u=f?"--":"_",b=Object.create(null),C=Object.create(null),O=n.__||$e.format,p={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},R=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,D=new RegExp("^--"+l["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(c){let d=typeof c=="object"?c.key:c,x=Object.keys(c).map(function(w){return{boolean:"bools",string:"strings",number:"numbers"}[w]}).filter(Boolean).pop();x&&(p[x][d]=!0),p.arrays[d]=!0,p.keys.push(d)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(c){p.bools[c]=!0,p.keys.push(c)}),[].concat(n.string||[]).filter(Boolean).forEach(function(c){p.strings[c]=!0,p.keys.push(c)}),[].concat(n.number||[]).filter(Boolean).forEach(function(c){p.numbers[c]=!0,p.keys.push(c)}),[].concat(n.count||[]).filter(Boolean).forEach(function(c){p.counts[c]=!0,p.keys.push(c)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(c){p.normalize[c]=!0,p.keys.push(c)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([c,d])=>{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(g).forEach(function(c){(p.aliases[c]||[]).forEach(function(d){g[d]=g[c]})});let B=null;At();let L=[],G=Object.assign(Object.create(null),{_:[]}),ve={};for(let c=0;c<s.length;c++){let d=s[c],x=d.replace(/^-{3,}/,"---"),w,h,P,A,$,re;if(d!=="--"&&/^-/.test(d)&&Q(d))Oe(d);else if(x.match(/^---+(=|$)/)){Oe(d);continue}else if(d.match(/^--.+=/)||!l["short-option-groups"]&&d.match(/^-.+=/))A=d.match(/^--?([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=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(""),w=!1;for(let ae=0;ae<P.length;ae++){if($=d.slice(ae+2),P[ae+1]&&P[ae+1]==="="){re=d.slice(ae+3),h=P[ae],F(h,p.arrays)?c=Ue(c,h,s,re):F(h,p.nargs)!==!1?c=nt(c,h,s,re):H(h,re),w=!0;break}if($==="-"){H(P[ae],$);continue}if(/[A-Za-z]/.test(P[ae])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test($)&&F($,p.bools)===!1){H(P[ae],$),w=!0;break}if(P[ae+1]&&P[ae+1].match(/\W/)){H(P[ae],$),w=!0;break}else H(P[ae],Z(P[ae]))}h=d.slice(-1)[0],!w&&h!=="-"&&(F(h,p.arrays)?c=Ue(c,h,s):F(h,p.nargs)!==!1?c=nt(c,h,s):($=s[c+1],$!==void 0&&(!/^(-|--)[^-]/.test($)||$.match(R))&&!F(h,p.bools)&&!F(h,p.counts)||/^(true|false)$/.test($)?(H(h,$),c++):H(h,Z(h))))}else if(d.match(/^-[0-9]$/)&&d.match(R)&&F(d.slice(1),p.bools))h=d.slice(1),H(h,Z(h));else if(d==="--"){L=s.slice(c+1);break}else if(l["halt-at-non-option"]){L=s.slice(c);break}else Oe(d)}z(G,!0),z(G,!1),W(G),ie(),K(G,p.aliases,g,!0),se(G),l["set-placeholder-key"]&&Be(G),Object.keys(p.counts).forEach(function(c){Me(G,c.split("."))||H(c,0)}),f&&L.length&&(G[u]=[]),L.forEach(function(c){G[u].push(c)}),l["camel-case-expansion"]&&l["strip-dashed"]&&Object.keys(G).filter(c=>c!=="--"&&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 Oe(c){let d=S("_",c);(typeof d=="string"||typeof d=="number")&&G._.push(d)}function nt(c,d,x,w){let h,P=F(d,p.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return xe(w)||(B=Error(O("Argument unexpected for: %s",d))),H(d,Z(d)),c;let A=xe(w)?0:1;if(l["nargs-eats-options"])x.length-(c+1)+A<P&&(B=Error(O("Not enough arguments following: %s",d))),A=P;else{for(h=c+1;h<x.length&&(!x[h].match(/^-[^0-9]/)||x[h].match(R)||Q(x[h]));h++)A++;A<P&&(B=Error(O("Not enough arguments following: %s",d)))}let $=Math.min(A,P);for(!xe(w)&&$>0&&(H(d,w),$--),h=c+1;h<$+c+1;h++)H(d,x[h]);return c+$}function Ue(c,d,x,w){let h=[],P=w||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(w)&&/^-/.test(P)&&!R.test(P)&&!Q(P)){if(g[d]!==void 0){let $=g[d];h=Array.isArray($)?$:[$]}}else{xe(w)||h.push(_(d,w,!0));for(let $=c+1;$<x.length&&!(!l["greedy-arrays"]&&h.length>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.length<A||isNaN(A)&&h.length===0)&&(B=Error(O("Not enough arguments following: %s",d))),H(d,h),c}function H(c,d,x=r){if(/-/.test(c)&&l["camel-case-expansion"]){let P=c.split(".").map(function(A){return Ye(A)}).join(".");M(c,P)}let w=_(c,d,x),h=c.split(".");Ie(G,h,w),p.aliases[c]&&p.aliases[c].forEach(function(P){let A=P.split(".");Ie(G,A,w)}),h.length>1&&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("."))||Ie(G,A,w)}),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"?$e.normalize($):$}})})}function M(c,d){p.aliases[c]&&p.aliases[c].length||(p.aliases[c]=[d],b[d]=!0),p.aliases[d]&&p.aliases[d].length||M(d,c)}function _(c,d,x){x&&(d=er(d)),(F(c,p.bools)||F(c,p.counts))&&typeof d=="string"&&(d=d==="true");let w=Array.isArray(d)?d.map(function(h){return S(c,h)}):S(c,d);return F(c,p.counts)&&(xe(w)||typeof w=="boolean")&&(w=on()),F(c,p.normalize)&&F(c,p.arrays)&&(Array.isArray(d)?w=d.map(h=>$e.normalize(h)):w=$e.normalize(d)),w}function S(c,d){return!l["parse-positional-numbers"]&&c==="_"||!F(c,p.strings)&&!F(c,p.bools)&&!Array.isArray(d)&&($t(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);K(d,p.aliases,g),Object.keys(p.configs).forEach(function(x){let w=c[x]||d[x];if(w)try{let h=null,P=$e.resolve($e.cwd(),w),A=p.configs[x];if(typeof A=="function"){try{h=A(P)}catch($){h=$}if(h instanceof Error){B=h;return}}else h=$e.require(P);Y(h)}catch(h){h.name==="PermissionDenied"?B=h:c[x]&&(B=Error(O("Invalid JSON config file: %s",w)))}})}function Y(c,d){Object.keys(c).forEach(function(x){let w=c[x],h=d?d+"."+x:x;typeof w=="object"&&w!==null&&!Array.isArray(w)&&l["dot-notation"]?Y(w,h):(!Me(G,h.split("."))||F(h,p.arrays)&&l["combine-arrays"])&&H(h,w)})}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:"",w=$e.env();Object.keys(w).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)&&!Me(c,P)&&H(P.join("."),w[h])}})}function se(c){let d,x=new Set;Object.keys(c).forEach(function(w){if(!x.has(w)&&(d=F(w,p.coercions),typeof d=="function"))try{let h=S(w,d(c[w]));[].concat(p.aliases[w]||[],w).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 K(c,d,x,w=!1){Object.keys(x).forEach(function(h){Me(c,h.split("."))||(Ie(c,h.split("."),x[h]),w&&(C[h]=!0),(d[h]||[]).forEach(function(P){Me(c,P.split("."))||Ie(c,P.split("."),x[h])}))})}function Me(c,d){let x=c;l["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(h){x=x[h]||{}});let w=d[d.length-1];return typeof x!="object"?!1:w in x}function Ie(c,d,x){let w=c;l["dot-notation"]||(d=[d.join(".")]),d.slice(0,-1).forEach(function(re){re=li(re),typeof w=="object"&&w[re]===void 0&&(w[re]={}),typeof w[re]!="object"||Array.isArray(w[re])?(Array.isArray(w[re])?w[re].push({}):w[re]=[w[re],{}],w=w[re][w[re].length-1]):w=w[re]});let h=li(d[d.length-1]),P=F(d.join("."),p.arrays),A=Array.isArray(x),$=l["duplicate-arguments-array"];!$&&F(h,p.nargs)&&($=!0,(!xe(w[h])&&p.nargs[h]===1||Array.isArray(w[h])&&w[h].length===p.nargs[h])&&(w[h]=void 0)),x===on()?w[h]=on(w[h]):Array.isArray(w[h])?$&&P&&A?w[h]=l["flatten-duplicate-arrays"]?w[h].concat(x):(Array.isArray(w[h][0])?w[h]:[w[h]]).concat([x]):!$&&!!P==!!A?w[h]=x:w[h]=w[h].concat([x]):w[h]===void 0&&P?w[h]=A?x:[x]:$&&!(w[h]===void 0||F(h,p.counts)||F(h,p.bools))?w[h]=[w[h],x]:w[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(w){if(/-/.test(w)&&l["camel-case-expansion"]){let h=Ye(w);h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),b[h]=!0)}}),p.aliases[x].concat(x).forEach(function(w){if(w.length>1&&/[A-Z]/.test(w)&&l["camel-case-expansion"]){let h=It(w,"-");h!==x&&p.aliases[x].indexOf(h)===-1&&(p.aliases[x].push(h),b[h]=!0)}}),p.aliases[x].forEach(function(w){p.aliases[w]=[x].concat(p.aliases[x].filter(function(h){return w!==h}))}))})})}function F(c,d){let x=[].concat(p.aliases[c]||[],c),w=Object.keys(d),h=x.find(P=>w.includes(P));return h?d[h]:!1}function Kt(c){let d=Object.keys(p);return[].concat(d.map(w=>p[w])).some(function(w){return Array.isArray(w)?w.includes(c):w[c]})}function v(c,...d){return[].concat(...d).some(function(w){let h=c.match(w);return h&&Kt(h[1])})}function q(c){if(c.match(R)||!c.match(/^-[^-]+/))return!1;let d=!0,x,w=c.slice(1).split("");for(let h=0;h<w.length;h++){if(x=c.slice(h+2),!Kt(w[h])){d=!1;break}if(w[h+1]&&w[h+1]==="="||x==="-"||/[A-Za-z]/.test(w[h])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(x)||w[h+1]&&w[h+1].match(/\W/))break}return d}function Q(c){return l["unknown-options-as-args"]&&U(c)}function U(c){return c=c.replace(/^-{3,}/,"--"),c.match(R)||q(c)?!1:!v(c,/^-+([^=]+?)=[\s\S]*$/,D,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function Z(c){return!F(c,p.bools)&&!F(c,p.counts)&&`${c}`in g?g[c]:te(Ce(c))}function te(c){return{[me.BOOLEAN]:!0,[me.STRING]:"",[me.NUMBER]:void 0,[me.ARRAY]:[]}[c]}function Ce(c){let d=me.BOOLEAN;return F(c,p.strings)?d=me.STRING:F(c,p.numbers)?d=me.NUMBER:F(c,p.bools)?d=me.BOOLEAN:F(c,p.arrays)&&(d=me.ARRAY),d}function xe(c){return c===void 0}function At(){Object.keys(p.counts).find(c=>F(c,p.arrays)?(B=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",c)),!0):F(c,p.nargs)?(B=Error(O("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({},b)}}};function Xs(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;s<e.length;s++)for(let r=s+1;r<e.length;r++)if(e[s].filter(function(l){return e[r].indexOf(l)!==-1}).length){e[s]=e[s].concat(e[r]),e.splice(r,1),n=!0;break}}return e.forEach(function(s){s=s.filter(function(o,l,g){return g.indexOf(o)===l});let r=s.pop();r!==void 0&&typeof r=="string"&&(t[r]=s)}),t}function on(i){return i!==void 0?i+1:1}function li(i){return i==="__proto__"?"___proto___":i}function er(i){return typeof i=="string"&&(i[0]==="'"||i[0]==='"')&&i[i.length-1]===i[0]?i.substring(1,i.length-1):i}import{readFileSync as sr}from"fs";var an,ln,cn,ci=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,fi=(ln=(an=process==null?void 0:process.versions)===null||an===void 0?void 0:an.node)!==null&&ln!==void 0?ln:(cn=process==null?void 0:process.version)===null||cn===void 0?void 0:cn.slice(1);if(fi&&Number(fi.match(/^([^.]+)/)[1])<ci)throw Error(`yargs parser supports a minimum Node.js version of ${ci}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var rr=process?process.env:{},ui=new vt({cwd:process.cwd,env:()=>rr,format:tr,normalize:nr,resolve:ir,require:i=>{if(typeof je<"u")return je(i);if(i.match(/\.json$/))return JSON.parse(sr(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),mt=function(e,t){return ui.parse(e.slice(),t).argv};mt.detailed=function(i,e){return ui.parse(i.slice(),e)};mt.camelCase=Ye;mt.decamelize=It;mt.looksLikeNumber=$t;var fn=mt;import{basename as wr,dirname as Or,extname as Cr,relative as xr,resolve as bi}from"path";function hi(){return or()?0:1}function or(){return ar()&&!process.defaultApp}function ar(){return!!process.versions.electron}function un(i){return i.slice(hi()+1)}function di(){return process.argv[hi()]}var V=class i extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,i)}};import{readFileSync as lr,statSync as cr,writeFile as fr}from"fs";import{format as ur}from"util";import{resolve as hr}from"path";var pi={fs:{readFileSync:lr,writeFile:fr},format:ur,resolve:hr,exists:i=>{try{return cr(i).isFile()}catch{return!1}}};var Ae,hn=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(g){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),r(g)})}_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 mi(i,e){Ae=e;let t=new hn(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 dr=i=>mi(i,pi),gi=dr;var _r="require is not supported by ESM",yi="loading a directory of commands is not supported yet for ESM",gt;try{gt=yr(import.meta.url)}catch{gt=process.cwd()}var Ar=gt.substring(0,gt.lastIndexOf("node_modules")),dn={assert:{notStrictEqual:pr,strictEqual:mr},cliui:rn,findUp:oi,getEnv:i=>process.env[i],inspect:gr,getCallerFile:()=>{throw new V(yi)},getProcessArgvBin:di,mainFilename:Ar||process.cwd(),Parser:fn,path:{basename:wr,dirname:Or,extname:Cr,relative:xr,resolve:bi},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:br,require:()=>{throw new V(_r)},requireDirectory:()=>{throw new V(yi)},stringWidth:i=>[...i].length,y18n:gi({directory:bi(gt,"../../../locales"),updateFiles:!1})};function le(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function pn(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 g=!1;o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&l===t.length-1&&(g=!0),/^\[/.test(o)?r.optional.push({cmd:o.replace(n,"").split("|"),variadic:g}):r.demanded.push({cmd:o.replace(n,"").split("|"),variadic:g})}),r}var Er=["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(),g=[].slice.call(o);for(;g.length&&g[g.length-1]===void 0;)g.pop();let y=l||g.length;if(y<r.demanded.length)throw new V(`Not enough arguments provided. Expected ${r.demanded.length} but received ${g.length}.`);let m=r.demanded.length+r.optional.length;if(y>m)throw new V(`Too many arguments provided. Expected max ${m} but received ${y}.`);r.demanded.forEach(f=>{let u=g.shift(),b=wi(u);f.cmd.filter(O=>O===b||O==="*").length===0&&Oi(b,f.cmd,s),s+=1}),r.optional.forEach(f=>{if(g.length===0)return;let u=g.shift(),b=wi(u);f.cmd.filter(O=>O===b||O==="*").length===0&&Oi(b,f.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function wi(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function Oi(i,e,t){throw new V(`Invalid ${Er[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}var Ft=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,s=!1){if(E("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let r=0;r<e.length;r++){if(typeof e[r]!="function")throw Error("middleware must be a function");let o=e[r];o.applyBeforeValidation=t,o.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let r=e;r.applyBeforeValidation=t,r.global=n,r.mutates=s,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(s=>{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 Ci(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=jr(i)?i():i;return k(n)?n.then(s=>e(s)):e(n)}catch(n){return t(n)}}function jr(i){return typeof i=="function"}function mn(i){if(typeof je>"u")return null;for(let e=0,t=Object.keys(je.cache),n;e<t.length;e++)if(n=je.cache[t[e]],n.exports===i)return n;return null}var ot=/(^\*)|(^\$0)/,gn=class{constructor(e,t,n,s){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=s,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,s){s=s||{},typeof s.recurse!="boolean"&&(s.recurse=!1),Array.isArray(s.extensions)||(s.extensions=["js"]);let r=typeof s.visit=="function"?s.visit:o=>o;s.visit=(o,l,g)=>{let y=r(o,l,g);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=[],g=Ci(r);if(s=s||(()=>{}),Array.isArray(e))if(Sr(e))[e,...l]=e;else for(let y of e)this.addHandler(y);else if(Mr(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(xi(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:g,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,g=t.getInternalMethods().getContext(),y=g.commands.slice(),m=!e;e&&(g.commands.push(e),g.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,g,r,u.aliases,t)):this.applyMiddlewareAndGetResult(m,l,f.innerArgv,g,r,f.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,s,r,o,l,g){let y=t.builder,m=n;if(Nt(y)){n.getInternalMethods().getUsageInstance().freeze();let f=y(n.getInternalMethods().reset(s),g);if(k(f))return f.then(u=>(m=Ai(u)?u:n,this.parseAndUpdateUsage(e,t,m,r,o,l)))}else Pr(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(g=>({aliases:n.parsed.aliases,innerArgv:g})):{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,g){if(!o.getInternalMethods().getHasOutput()){let y=o.getInternalMethods().runValidation(r,g,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 g={};if(r)return n;l.getInternalMethods().getHasOutput()||(g=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,g)):this.handleValidationAndGetResult(e,t,m,s,o,l,y,g)}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 g=r.shift();this.populatePositional(g,t,l)}for(;o.length;){let g=o.shift();this.populatePositional(g,t,l)}return t._=n.commands.concat(t._.map(g=>""+g)),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}),g=this.shim.Parser.detailed(o,Object.assign({},r,{configuration:l}));if(g.error)s.getInternalMethods().getUsageInstance().fail(g.error.message,g.error);else{let y=Object.keys(t);Object.keys(t).forEach(m=>{y.push(...g.aliases[m])}),Object.keys(g.argv).forEach(m=>{y.includes(m)&&(t[m]||(t[m]=g.argv[m]),!this.isInConfigs(s,m)&&!this.isDefaulted(s,m)&&Object.prototype.hasOwnProperty.call(e,m)&&Object.prototype.hasOwnProperty.call(g.argv,m)&&(Array.isArray(e[m])||Array.isArray(g.argv[m]))?e[m]=[].concat(e[m],g.argv[m]):e[m]=g.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(Nt(t))return t(e,!0);xi(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){let t=mn(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 _i(i,e,t,n){return new gn(i,e,t,n)}function xi(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function Sr(i){return i.every(e=>typeof e=="string")}function Nt(i){return typeof i=="function"}function Pr(i){return typeof i=="object"}function Mr(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 Ir(i){return typeof i=="boolean"}function ji(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 g=!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(Ir(ie)){if(S)throw S;if(_)throw Error(_)}else ie(_,S,n)}else{if(i.getExitProcess()&&Te(!0),!g){g=!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 b={};n.describe=function(_,S){Array.isArray(_)?_.forEach(W=>{n.describe(W,S)}):typeof _=="object"?Object.keys(_).forEach(W=>{n.describe(W,_[W])}):b[_]=S},n.getDescriptions=()=>b;let C=[];n.epilog=M=>{C.push(M)};let O=!1,p;n.wrap=M=>{O=!0,p=M},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(O||(p=nt(),O=!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(b)),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,q)=>(q!=="_"&&(v[q]=!0),v),{}));let Be=n.getWrap(),K=e.cliui({width:Be,wrap:!!Be});if(!m){if(y.length)y.forEach(v=>{K.div({text:`${v[0].replace(/\$0/g,_)}`}),v[1]&&K.div({text:`${v[1]}`,padding:[1,0,0,0]})}),K.div();else if(u.length){let v=null;W._?v=`${_} <${t("command")}> `:v=`${_} [${t("command")}] `,K.div(`${v}`)}}if(u.length>1||u.length===1&&!u[0][2]){K.div(t("Commands:"));let v=i.getInternalMethods().getContext(),q=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}${q}${U[0].replace(/^\$0 ?/,"")}`;K.span({text:Z,padding:[0,2,0,2],width:D(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?K.div({text:te.join(" "),padding:[0,0,0,2],align:"right"}):K.div()}),K.div()}let Me=(Object.keys(z.alias)||[]).concat(Object.keys(i.parsed.newAliases)||[]);se=se.filter(v=>!i.parsed.newAliases[v]&&Me.every(q=>(z.alias[q]||[]).indexOf(v)===-1));let Ie=t("Options:");ie[Ie]||(ie[Ie]=[]),G(se,z.alias,ie,Ie);let ze=v=>/^--/.test(Rt(v)),F=Object.keys(ie).filter(v=>ie[v].length>0).map(v=>{let q=ie[v].filter(ve).map(Q=>{if(Me.includes(Q))return Q;for(let U=0,Z;(Z=Me[U])!==void 0;U++)if((z.alias[Z]||[]).includes(Q))return Z;return Q});return{groupName:v,normalizedKeys:q}}).filter(({normalizedKeys:v})=>v.length>0).map(({groupName:v,normalizedKeys:q})=>{let Q=q.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:q,switches:Q}});if(F.filter(({groupName:v})=>v!==n.getPositionalGroupName()).some(({normalizedKeys:v,switches:q})=>!v.every(Q=>ze(q[Q])))&&F.filter(({groupName:v})=>v!==n.getPositionalGroupName()).forEach(({normalizedKeys:v,switches:q})=>{v.forEach(Q=>{ze(q[Q])&&(q[Q]=$r(q[Q],4))})}),F.forEach(({groupName:v,normalizedKeys:q,switches:Q})=>{K.div(v),q.forEach(U=>{let Z=Q[U],te=b[U]||"",Ce=null;t