wrangler 0.0.21 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/bin/wrangler.js +10 -1
  3. package/miniflare-dist/index.mjs +79 -0
  4. package/miniflare-dist/index.mjs.map +7 -0
  5. package/package.json +3 -4
  6. package/src/__tests__/configuration.test.ts +522 -300
  7. package/src/__tests__/dev.test.tsx +99 -3
  8. package/src/__tests__/guess-worker-format.test.ts +10 -0
  9. package/src/__tests__/index.test.ts +3 -11
  10. package/src/__tests__/kv.test.ts +16 -18
  11. package/src/__tests__/pages.test.ts +48 -10
  12. package/src/__tests__/publish.test.ts +1319 -421
  13. package/src/__tests__/r2.test.ts +4 -4
  14. package/src/__tests__/tail.test.ts +29 -4
  15. package/src/bundle.ts +15 -2
  16. package/src/config/README.md +6 -6
  17. package/src/config/config.ts +16 -77
  18. package/src/config/environment.ts +67 -1
  19. package/src/config/index.ts +13 -3
  20. package/src/config/validation-helpers.ts +105 -19
  21. package/src/config/validation.ts +272 -97
  22. package/src/dev/dev.tsx +72 -42
  23. package/src/dev/local.tsx +103 -118
  24. package/src/dev/use-esbuild.ts +4 -0
  25. package/src/entry.ts +84 -3
  26. package/src/index.tsx +137 -113
  27. package/src/intl-polyfill.d.ts +139 -0
  28. package/src/kv.ts +7 -27
  29. package/src/miniflare-cli/README.md +30 -0
  30. package/src/miniflare-cli/enum-keys.ts +17 -0
  31. package/src/miniflare-cli/index.ts +37 -0
  32. package/src/module-collection.ts +58 -53
  33. package/src/pages.tsx +26 -10
  34. package/src/publish.ts +17 -21
  35. package/src/sites.tsx +59 -52
  36. package/src/tail/printing.ts +2 -2
  37. package/src/user.tsx +12 -3
  38. package/wrangler-dist/cli.js +836 -649
  39. package/wrangler-dist/cli.js.map +2 -2
  40. package/src/__tests__/dev2.test.tsx +0 -154
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## 🤠 wrangler
1
+ ## ⛅️ wrangler
2
2
 
3
3
  `wrangler` is a command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/).
4
4
 
package/bin/wrangler.js CHANGED
@@ -5,6 +5,8 @@ const semiver = require("semiver");
5
5
 
6
6
  const MIN_NODE_VERSION = "16.7.0";
7
7
 
8
+ let wranglerProcess;
9
+
8
10
  async function main() {
9
11
  if (semiver(process.versions.node, MIN_NODE_VERSION) < 0) {
10
12
  // Note Volta and nvm are also recommended in the official docs:
@@ -18,7 +20,7 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
18
20
  return;
19
21
  }
20
22
 
21
- spawn(
23
+ wranglerProcess = spawn(
22
24
  process.execPath,
23
25
  [
24
26
  "--no-warnings",
@@ -33,4 +35,11 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
33
35
  );
34
36
  }
35
37
 
38
+ process.on("SIGINT", () => {
39
+ wranglerProcess.kill();
40
+ });
41
+ process.on("SIGTERM", () => {
42
+ wranglerProcess.kill();
43
+ });
44
+
36
45
  void main();
@@ -0,0 +1,79 @@
1
+ var wt=(s=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(s,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):s)(function(s){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});import{Log as qi,LogLevel as Be,Miniflare as Vi}from"miniflare";import{notStrictEqual as wi,strictEqual as yi}from"assert";var Qn={right:ei,center:ni},Zn=0,ae=1,Xn=2,le=3,Ve=class{constructor(t){var e;this.width=t.width,this.wrap=(e=t.wrap)!==null&&e!==void 0?e:!0,this.rows=[]}span(...t){let e=this.div(...t);e.span=!0}resetOutput(){this.rows=[]}div(...t){if(t.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]=="string")return this.applyLayoutDSL(t[0]);let e=t.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(e),e}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]=="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){let e=t.split(`
2
+ `).map(i=>i.split(" ")),n=0;return e.forEach(i=>{i.length>1&&at.stringWidth(i[0])>n&&(n=Math.min(Math.floor(this.width*.5),at.stringWidth(i[0])))}),e.forEach(i=>{this.div(...i.map((o,a)=>({text:o.trim(),padding:this.measurePadding(o),width:a===0&&i.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let e=at.stripAnsi(t);return[0,e.match(/\s*$/)[0].length,0,e.match(/^\s*/)[0].length]}toString(){let t=[];return this.rows.forEach(e=>{this.rowToString(e,t)}),t.filter(e=>!e.hidden).map(e=>e.text).join(`
3
+ `)}rowToString(t,e){return this.rasterize(t).forEach((n,i)=>{let o="";n.forEach((a,f)=>{let{width:g}=t[f],O=this.negatePadding(t[f]),b=a;O>at.stringWidth(a)&&(b+=" ".repeat(O-at.stringWidth(a))),t[f].align&&t[f].align!=="left"&&this.wrap&&(b=Qn[t[f].align](b,O),at.stringWidth(b)<O&&(b+=" ".repeat((g||0)-at.stringWidth(b)-1)));let c=t[f].padding||[0,0,0,0];c[le]&&(o+=" ".repeat(c[le])),o+=qe(t[f],b,"| "),o+=b,o+=qe(t[f],b," |"),c[ae]&&(o+=" ".repeat(c[ae])),i===0&&e.length>0&&(o=this.renderInline(o,e[e.length-1]))}),e.push({text:o.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){let n=t.match(/^ */),i=n?n[0].length:0,o=e.text,a=at.stringWidth(o.trimRight());return e.span?this.wrap?i<a?t:(e.hidden=!0,o.trimRight()+" ".repeat(i-a)+t.trimLeft()):(e.hidden=!0,o+t):t}rasterize(t){let e=[],n=this.columnWidths(t),i;return t.forEach((o,a)=>{o.width=n[a],this.wrap?i=at.wrap(o.text,this.negatePadding(o),{hard:!0}).split(`
4
+ `):i=o.text.split(`
5
+ `),o.border&&(i.unshift("."+"-".repeat(this.negatePadding(o)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(o)+2)+"'")),o.padding&&(i.unshift(...new Array(o.padding[Zn]||0).fill("")),i.push(...new Array(o.padding[Xn]||0).fill(""))),i.forEach((f,g)=>{e[g]||e.push([]);let O=e[g];for(let b=0;b<a;b++)O[b]===void 0&&O.push("");O.push(f)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[le]||0)+(t.padding[ae]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(a=>a.width||at.stringWidth(a.text));let e=t.length,n=this.width,i=t.map(a=>{if(a.width)return e--,n-=a.width,a.width}),o=e?Math.floor(n/e):0;return i.map((a,f)=>a===void 0?Math.max(o,kn(t[f])):a)}};function qe(s,t,e){return s.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function kn(s){let t=s.padding||[],e=1+(t[le]||0)+(t[ae]||0);return s.border?e+4:e}function ti(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function ei(s,t){s=s.trim();let e=at.stringWidth(s);return e<t?" ".repeat(t-e)+s:s}function ni(s,t){s=s.trim();let e=at.stringWidth(s);return e>=t?s:" ".repeat(t-e>>1)+s}var at;function Ge(s,t){return at=t,new Ve({width:(s==null?void 0:s.width)||ti(),wrap:s==null?void 0:s.wrap})}var Ke=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Ce(s){return s.replace(Ke,"")}function Je(s,t){let[e,n]=s.match(Ke)||["",""];s=Ce(s);let i="";for(let o=0;o<s.length;o++)o!==0&&o%t===0&&(i+=`
6
+ `),i+=s.charAt(o);return e&&n&&(i=`${e}${i}${n}`),i}function Ee(s){return Ge(s,{stringWidth:t=>[...t].length,stripAnsi:Ce,wrap:Je})}import{dirname as Qe,resolve as Ze}from"path";import{readdirSync as ii,statSync as si}from"fs";function Xe(s,t){let e=Ze(".",s),n;for(si(e).isDirectory()||(e=Qe(e));;){if(n=t(e,ii(e)),n)return Ze(e,n);if(e=Qe(n=e),n===e)break}}import{inspect as Ci}from"util";import{readFileSync as Ei}from"fs";import{fileURLToPath as ji}from"url";import{format as ai}from"util";import{normalize as li,resolve as fi}from"path";function zt(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let e="",n=!1,i=s.match(/^-+/);for(let o=i?i[0].length:0;o<s.length;o++){let a=s.charAt(o);n&&(n=!1,a=a.toUpperCase()),o!==0&&(a==="-"||a==="_")?n=!0:a!=="-"&&a!=="_"&&(e+=a)}return e}}function fe(s,t){let e=s.toLowerCase();t=t||"-";let n="";for(let i=0;i<s.length;i++){let o=e.charAt(i),a=s.charAt(i);o!==a&&i>0?n+=`${t}${e.charAt(i)}`:n+=a}return n}function ce(s){return s==null?!1:typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^0[^.]/.test(s)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function ke(s){if(Array.isArray(s))return s.map(a=>typeof a!="string"?a+"":a);s=s.trim();let t=0,e=null,n=null,i=null,o=[];for(let a=0;a<s.length;a++){if(e=n,n=s.charAt(a),n===" "&&!i){e!==" "&&t++;continue}n===i?i=null:(n==="'"||n==='"')&&!i&&(i=n),o[t]||(o[t]=""),o[t]+=n}return o}var ht;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(ht||(ht={}));var xt,xe=class{constructor(t){xt=t}parse(t,e){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},e),i=ke(t),o=typeof t=="string",a=ri(Object.assign(Object.create(null),n.alias)),f=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),O=n.configObjects||[],b=n.envPrefix,c=f["populate--"],m=c?"--":"_",w=Object.create(null),M=Object.create(null),y=n.__||xt.format,d={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:[]},D=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,R=new RegExp("^--"+f["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let u=typeof l=="object"?l.key:l,_=Object.keys(l).map(function(p){return{boolean:"bools",string:"strings",number:"numbers"}[p]}).filter(Boolean).pop();_&&(d[_][u]=!0),d.arrays[u]=!0,d.keys.push(u)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){d.bools[l]=!0,d.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){d.strings[l]=!0,d.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){d.numbers[l]=!0,d.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){d.counts[l]=!0,d.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){d.normalize[l]=!0,d.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,u])=>{typeof u=="number"&&(d.nargs[l]=u,d.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,u])=>{typeof u=="function"&&(d.coercions[l]=u,d.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){d.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,u])=>{(typeof u=="boolean"||typeof u=="function")&&(d.configs[l]=u)})),Lt(n.key,a,n.default,d.arrays),Object.keys(g).forEach(function(l){(d.aliases[l]||[]).forEach(function(u){g[u]=g[l]})});let Y=null;oe();let H=[],T=Object.assign(Object.create(null),{_:[]}),At={};for(let l=0;l<i.length;l++){let u=i[l],_=u.replace(/^-{3,}/,"---"),p,h,A,E,I,it;if(u!=="--"&&Q(u))gt(u);else if(_.match(/---+(=|$)/)){gt(u);continue}else if(u.match(/^--.+=/)||!f["short-option-groups"]&&u.match(/^-.+=/))E=u.match(/^--?([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&(F(E[1],d.arrays)?l=Ft(l,E[1],i,E[2]):F(E[1],d.nargs)!==!1?l=Jt(l,E[1],i,E[2]):B(E[1],E[2],!0));else if(u.match(R)&&f["boolean-negation"])E=u.match(R),E!==null&&Array.isArray(E)&&E.length>=2&&(h=E[1],B(h,F(h,d.arrays)?[!1]:!1));else if(u.match(/^--.+/)||!f["short-option-groups"]&&u.match(/^-[^-]+/))E=u.match(/^--?(.+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(h=E[1],F(h,d.arrays)?l=Ft(l,h,i):F(h,d.nargs)!==!1?l=Jt(l,h,i):(I=i[l+1],I!==void 0&&(!I.match(/^-/)||I.match(D))&&!F(h,d.bools)&&!F(h,d.counts)||/^(true|false)$/.test(I)?(B(h,I),l++):B(h,Z(h))));else if(u.match(/^-.\..+=/))E=u.match(/^-([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&B(E[1],E[2]);else if(u.match(/^-.\..+/)&&!u.match(D))I=i[l+1],E=u.match(/^-(.\..+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(h=E[1],I!==void 0&&!I.match(/^-/)&&!F(h,d.bools)&&!F(h,d.counts)?(B(h,I),l++):B(h,Z(h)));else if(u.match(/^-[^-]+/)&&!u.match(D)){A=u.slice(1,-1).split(""),p=!1;for(let rt=0;rt<A.length;rt++){if(I=u.slice(rt+2),A[rt+1]&&A[rt+1]==="="){it=u.slice(rt+3),h=A[rt],F(h,d.arrays)?l=Ft(l,h,i,it):F(h,d.nargs)!==!1?l=Jt(l,h,i,it):B(h,it),p=!0;break}if(I==="-"){B(A[rt],I);continue}if(/[A-Za-z]/.test(A[rt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(I)&&F(I,d.bools)===!1){B(A[rt],I),p=!0;break}if(A[rt+1]&&A[rt+1].match(/\W/)){B(A[rt],I),p=!0;break}else B(A[rt],Z(A[rt]))}h=u.slice(-1)[0],!p&&h!=="-"&&(F(h,d.arrays)?l=Ft(l,h,i):F(h,d.nargs)!==!1?l=Jt(l,h,i):(I=i[l+1],I!==void 0&&(!/^(-|--)[^-]/.test(I)||I.match(D))&&!F(h,d.bools)&&!F(h,d.counts)||/^(true|false)$/.test(I)?(B(h,I),l++):B(h,Z(h))))}else if(u.match(/^-[0-9]$/)&&u.match(D)&&F(u.slice(1),d.bools))h=u.slice(1),B(h,Z(h));else if(u==="--"){H=i.slice(l+1);break}else if(f["halt-at-non-option"]){H=i.slice(l);break}else gt(u)}U(T,!0),U(T,!1),L(T),k(),J(T,d.aliases,g,!0),nt(T),f["set-placeholder-key"]&&Wt(T),Object.keys(d.counts).forEach(function(l){Et(T,l.split("."))||B(l,0)}),c&&H.length&&(T[m]=[]),H.forEach(function(l){T[m].push(l)}),f["camel-case-expansion"]&&f["strip-dashed"]&&Object.keys(T).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete T[l]}),f["strip-aliased"]&&[].concat(...Object.keys(a).map(l=>a[l])).forEach(l=>{f["camel-case-expansion"]&&l.includes("-")&&delete T[l.split(".").map(u=>zt(u)).join(".")],delete T[l]});function gt(l){let u=$("_",l);(typeof u=="string"||typeof u=="number")&&T._.push(u)}function Jt(l,u,_,p){let h,A=F(u,d.nargs);if(A=typeof A!="number"||isNaN(A)?1:A,A===0)return Ot(p)||(Y=Error(y("Argument unexpected for: %s",u))),B(u,Z(u)),l;let E=Ot(p)?0:1;if(f["nargs-eats-options"])_.length-(l+1)+E<A&&(Y=Error(y("Not enough arguments following: %s",u))),E=A;else{for(h=l+1;h<_.length&&(!_[h].match(/^-[^0-9]/)||_[h].match(D)||Q(_[h]));h++)E++;E<A&&(Y=Error(y("Not enough arguments following: %s",u)))}let I=Math.min(E,A);for(!Ot(p)&&I>0&&(B(u,p),I--),h=l+1;h<I+l+1;h++)B(u,_[h]);return l+I}function Ft(l,u,_,p){let h=[],A=p||_[l+1],E=F(u,d.nargs);if(F(u,d.bools)&&!/^(true|false)$/.test(A))h.push(!0);else if(Ot(A)||Ot(p)&&/^-/.test(A)&&!D.test(A)&&!Q(A)){if(g[u]!==void 0){let I=g[u];h=Array.isArray(I)?I:[I]}}else{Ot(p)||h.push(C(u,p,!0));for(let I=l+1;I<_.length&&!(!f["greedy-arrays"]&&h.length>0||E&&typeof E=="number"&&h.length>=E||(A=_[I],/^-/.test(A)&&!D.test(A)&&!Q(A)));I++)l=I,h.push(C(u,A,o))}return typeof E=="number"&&(E&&h.length<E||isNaN(E)&&h.length===0)&&(Y=Error(y("Not enough arguments following: %s",u))),B(u,h),l}function B(l,u,_=o){if(/-/.test(l)&&f["camel-case-expansion"]){let A=l.split(".").map(function(E){return zt(E)}).join(".");S(l,A)}let p=C(l,u,_),h=l.split(".");jt(T,h,p),d.aliases[l]&&d.aliases[l].forEach(function(A){let E=A.split(".");jt(T,E,p)}),h.length>1&&f["dot-notation"]&&(d.aliases[h[0]]||[]).forEach(function(A){let E=A.split("."),I=[].concat(h);I.shift(),E=E.concat(I),(d.aliases[l]||[]).includes(E.join("."))||jt(T,E,p)}),F(l,d.normalize)&&!F(l,d.arrays)&&[l].concat(d.aliases[l]||[]).forEach(function(E){Object.defineProperty(At,E,{enumerable:!0,get(){return u},set(I){u=typeof I=="string"?xt.normalize(I):I}})})}function S(l,u){d.aliases[l]&&d.aliases[l].length||(d.aliases[l]=[u],w[u]=!0),d.aliases[u]&&d.aliases[u].length||S(u,l)}function C(l,u,_){_&&(u=oi(u)),(F(l,d.bools)||F(l,d.counts))&&typeof u=="string"&&(u=u==="true");let p=Array.isArray(u)?u.map(function(h){return $(l,h)}):$(l,u);return F(l,d.counts)&&(Ot(p)||typeof p=="boolean")&&(p=je()),F(l,d.normalize)&&F(l,d.arrays)&&(Array.isArray(u)?p=u.map(h=>xt.normalize(h)):p=xt.normalize(u)),p}function $(l,u){return!f["parse-positional-numbers"]&&l==="_"||!F(l,d.strings)&&!F(l,d.bools)&&!Array.isArray(u)&&(ce(u)&&f["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${u}`)))||!Ot(u)&&F(l,d.numbers))&&(u=Number(u)),u}function L(l){let u=Object.create(null);J(u,d.aliases,g),Object.keys(d.configs).forEach(function(_){let p=l[_]||u[_];if(p)try{let h=null,A=xt.resolve(xt.cwd(),p),E=d.configs[_];if(typeof E=="function"){try{h=E(A)}catch(I){h=I}if(h instanceof Error){Y=h;return}}else h=xt.require(A);q(h)}catch(h){h.name==="PermissionDenied"?Y=h:l[_]&&(Y=Error(y("Invalid JSON config file: %s",p)))}})}function q(l,u){Object.keys(l).forEach(function(_){let p=l[_],h=u?u+"."+_:_;typeof p=="object"&&p!==null&&!Array.isArray(p)&&f["dot-notation"]?q(p,h):(!Et(T,h.split("."))||F(h,d.arrays)&&f["combine-arrays"])&&B(h,p)})}function k(){typeof O<"u"&&O.forEach(function(l){q(l)})}function U(l,u){if(typeof b>"u")return;let _=typeof b=="string"?b:"",p=xt.env();Object.keys(p).forEach(function(h){if(_===""||h.lastIndexOf(_,0)===0){let A=h.split("__").map(function(E,I){return I===0&&(E=E.substring(_.length)),zt(E)});(u&&d.configs[A.join(".")]||!u)&&!Et(l,A)&&B(A.join("."),p[h])}})}function nt(l){let u,_=new Set;Object.keys(l).forEach(function(p){if(!_.has(p)&&(u=F(p,d.coercions),typeof u=="function"))try{let h=$(p,u(l[p]));[].concat(d.aliases[p]||[],p).forEach(A=>{_.add(A),l[A]=h})}catch(h){Y=h}})}function Wt(l){return d.keys.forEach(u=>{~u.indexOf(".")||typeof l[u]>"u"&&(l[u]=void 0)}),l}function J(l,u,_,p=!1){Object.keys(_).forEach(function(h){Et(l,h.split("."))||(jt(l,h.split("."),_[h]),p&&(M[h]=!0),(u[h]||[]).forEach(function(A){Et(l,A.split("."))||jt(l,A.split("."),_[h])}))})}function Et(l,u){let _=l;f["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(h){_=_[h]||{}});let p=u[u.length-1];return typeof _!="object"?!1:p in _}function jt(l,u,_){let p=l;f["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(it){it=tn(it),typeof p=="object"&&p[it]===void 0&&(p[it]={}),typeof p[it]!="object"||Array.isArray(p[it])?(Array.isArray(p[it])?p[it].push({}):p[it]=[p[it],{}],p=p[it][p[it].length-1]):p=p[it]});let h=tn(u[u.length-1]),A=F(u.join("."),d.arrays),E=Array.isArray(_),I=f["duplicate-arguments-array"];!I&&F(h,d.nargs)&&(I=!0,(!Ot(p[h])&&d.nargs[h]===1||Array.isArray(p[h])&&p[h].length===d.nargs[h])&&(p[h]=void 0)),_===je()?p[h]=je(p[h]):Array.isArray(p[h])?I&&A&&E?p[h]=f["flatten-duplicate-arrays"]?p[h].concat(_):(Array.isArray(p[h][0])?p[h]:[p[h]]).concat([_]):!I&&Boolean(A)===Boolean(E)?p[h]=_:p[h]=p[h].concat([_]):p[h]===void 0&&A?p[h]=E?_:[_]:I&&!(p[h]===void 0||F(h,d.counts)||F(h,d.bools))?p[h]=[p[h],_]:p[h]=_}function Lt(...l){l.forEach(function(u){Object.keys(u||{}).forEach(function(_){d.aliases[_]||(d.aliases[_]=[].concat(a[_]||[]),d.aliases[_].concat(_).forEach(function(p){if(/-/.test(p)&&f["camel-case-expansion"]){let h=zt(p);h!==_&&d.aliases[_].indexOf(h)===-1&&(d.aliases[_].push(h),w[h]=!0)}}),d.aliases[_].concat(_).forEach(function(p){if(p.length>1&&/[A-Z]/.test(p)&&f["camel-case-expansion"]){let h=fe(p,"-");h!==_&&d.aliases[_].indexOf(h)===-1&&(d.aliases[_].push(h),w[h]=!0)}}),d.aliases[_].forEach(function(p){d.aliases[p]=[_].concat(d.aliases[_].filter(function(h){return p!==h}))}))})})}function F(l,u){let _=[].concat(d.aliases[l]||[],l),p=Object.keys(u),h=_.find(A=>p.includes(A));return h?u[h]:!1}function ye(l){let u=Object.keys(d);return[].concat(u.map(p=>d[p])).some(function(p){return Array.isArray(p)?p.includes(l):p[l]})}function N(l,...u){return[].concat(...u).some(function(p){let h=l.match(p);return h&&ye(h[1])})}function G(l){if(l.match(D)||!l.match(/^-[^-]+/))return!1;let u=!0,_,p=l.slice(1).split("");for(let h=0;h<p.length;h++){if(_=l.slice(h+2),!ye(p[h])){u=!1;break}if(p[h+1]&&p[h+1]==="="||_==="-"||/[A-Za-z]/.test(p[h])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(_)||p[h+1]&&p[h+1].match(/\W/))break}return u}function Q(l){return f["unknown-options-as-args"]&&v(l)}function v(l){return l=l.replace(/^-{3,}/,"--"),l.match(D)||G(l)?!1:!N(l,/^-+([^=]+?)=[\s\S]*$/,R,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function Z(l){return!F(l,d.bools)&&!F(l,d.counts)&&`${l}`in g?g[l]:tt(bt(l))}function tt(l){return{[ht.BOOLEAN]:!0,[ht.STRING]:"",[ht.NUMBER]:void 0,[ht.ARRAY]:[]}[l]}function bt(l){let u=ht.BOOLEAN;return F(l,d.strings)?u=ht.STRING:F(l,d.numbers)?u=ht.NUMBER:F(l,d.bools)?u=ht.BOOLEAN:F(l,d.arrays)&&(u=ht.ARRAY),u}function Ot(l){return l===void 0}function oe(){Object.keys(d.counts).find(l=>F(l,d.arrays)?(Y=Error(y("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):F(l,d.nargs)?(Y=Error(y("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},d.aliases),argv:Object.assign(At,T),configuration:f,defaulted:Object.assign({},M),error:Y,newAliases:Object.assign({},w)}}};function ri(s){let t=[],e=Object.create(null),n=!0;for(Object.keys(s).forEach(function(i){t.push([].concat(s[i],i))});n;){n=!1;for(let i=0;i<t.length;i++)for(let o=i+1;o<t.length;o++)if(t[i].filter(function(f){return t[o].indexOf(f)!==-1}).length){t[i]=t[i].concat(t[o]),t.splice(o,1),n=!0;break}}return t.forEach(function(i){i=i.filter(function(a,f,g){return g.indexOf(a)===f});let o=i.pop();o!==void 0&&typeof o=="string"&&(e[o]=i)}),e}function je(s){return s!==void 0?s+1:1}function tn(s){return s==="__proto__"?"___proto___":s}function oi(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}import{readFileSync as ci}from"fs";var en=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<en)throw Error(`yargs parser supports a minimum Node.js version of ${en}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var hi=process?process.env:{},nn=new xe({cwd:process.cwd,env:()=>hi,format:ai,normalize:li,resolve:fi,require:s=>{if(typeof wt<"u")return wt(s);if(s.match(/\.json$/))return JSON.parse(ci(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),ee=function(t,e){return nn.parse(t.slice(),e).argv};ee.detailed=function(s,t){return nn.parse(s.slice(),t)};ee.camelCase=zt;ee.decamelize=fe;ee.looksLikeNumber=ce;var Ae=ee;import{basename as xi,dirname as Ai,extname as Si,relative as Pi,resolve as cn}from"path";function sn(){return ui()?0:1}function ui(){return di()&&!process.defaultApp}function di(){return!!process.versions.electron}function Se(s){return s.slice(sn()+1)}function rn(){return process.argv[sn()]}var V=class extends Error{constructor(t){super(t||"yargs error");this.name="YError",Error.captureStackTrace(this,V)}};import{readFileSync as pi,statSync as mi,writeFile as gi}from"fs";import{format as bi}from"util";import{resolve as Oi}from"path";var on={fs:{readFileSync:pi,writeFile:gi},format:bi,resolve:Oi,exists:s=>{try{return mi(s).isFile()}catch{return!1}}};var _t,an=class{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let e=t.shift(),n=function(){};return typeof t[t.length-1]=="function"&&(n=t.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),_t.format.apply(_t.format,[this.cache[this.locale][e]||e].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),i=t.shift(),o=function(){};typeof t[t.length-1]=="function"&&(o=t.pop()),this.cache[this.locale]||this._readLocaleFile();let a=i===1?e:n;this.cache[this.locale][e]&&(a=this.cache[this.locale][e][i===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:o})):o();let f=[a];return~a.indexOf("%d")&&f.push(i),_t.format.apply(_t.format,f.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(i,o){let a=e[o+1];n+=i,typeof a<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,e=this.writeQueue[0],n=e.directory,i=e.locale,o=e.cb,a=this._resolveLocaleFile(n,i),f=JSON.stringify(this.cache[i],null,2);_t.fs.writeFile(a,f,"utf-8",function(g){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),o(g)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{_t.fs.readFileSync&&(t=JSON.parse(_t.fs.readFileSync(e,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+e),n.code==="ENOENT")t={};else throw n}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let n=_t.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let i=_t.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(i)&&(n=i)}return n}_fileExistsSync(t){return _t.exists(t)}};function ln(s,t){_t=t;let e=new an(s);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}var _i=s=>ln(s,on),fn=_i;var Mi="require is not supported by ESM",hn="loading a directory of commands is not supported yet for ESM",he;try{he=ji(import.meta.url)}catch{he=process.cwd()}var Ii=he.split("node_modules")[0],Pe={assert:{notStrictEqual:wi,strictEqual:yi},cliui:Ee,findUp:Xe,getEnv:s=>process.env[s],inspect:Ci,getCallerFile:()=>{throw new V(hn)},getProcessArgvBin:rn,mainFilename:Ii||process.cwd(),Parser:Ae,path:{basename:xi,dirname:Ai,extname:Si,relative:Pi,resolve:cn},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(s,t)=>process.emitWarning(s,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Ei,require:()=>{throw new V(Mi)},requireDirectory:()=>{throw new V(hn)},stringWidth:s=>[...s].length,y18n:fn({directory:cn(he,"../../../locales"),updateFiles:!1})};function ot(s,t,e,n){e.assert.notStrictEqual(s,t,n)}function Me(s,t){t.assert.strictEqual(typeof s,"string")}function Qt(s){return Object.keys(s)}function K(s){return!!s&&!!s.then&&typeof s.then=="function"}function St(s){let e=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${s}`);let o={cmd:i.replace(n,""),demanded:[],optional:[]};return e.forEach((a,f)=>{let g=!1;a=a.replace(/\s/g,""),/\.+[\]>]/.test(a)&&f===e.length-1&&(g=!0),/^\[/.test(a)?o.optional.push({cmd:a.replace(n,"").split("|"),variadic:g}):o.demanded.push({cmd:a.replace(n,"").split("|"),variadic:g})}),o}var $i=["first","second","third","fourth","fifth","sixth"];function j(s,t,e){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,t]:[St(`cmd ${s}`),t,e]}try{let i=0,[o,a,f]=n(),g=[].slice.call(a);for(;g.length&&g[g.length-1]===void 0;)g.pop();let O=f||g.length;if(O<o.demanded.length)throw new V(`Not enough arguments provided. Expected ${o.demanded.length} but received ${g.length}.`);let b=o.demanded.length+o.optional.length;if(O>b)throw new V(`Too many arguments provided. Expected max ${b} but received ${O}.`);o.demanded.forEach(c=>{let m=g.shift(),w=un(m);c.cmd.filter(y=>y===w||y==="*").length===0&&dn(w,c.cmd,i),i+=1}),o.optional.forEach(c=>{if(g.length===0)return;let m=g.shift(),w=un(m);c.cmd.filter(y=>y===w||y==="*").length===0&&dn(w,c.cmd,i),i+=1})}catch(i){console.warn(i.stack)}}function un(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function dn(s,t,e){throw new V(`Invalid ${$i[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${s}.`)}var Ie=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,i=!1){if(j("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let o=0;o<t.length;o++){if(typeof t[o]!="function")throw Error("middleware must be a function");let a=t[o];a.applyBeforeValidation=e,a.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let o=t;o.applyBeforeValidation=e,o.global=n,o.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(i=>{let o=[...n[e]||[],e];return i.option?!o.includes(i.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}};function pn(s){return s?s.map(t=>(t.applyBeforeValidation=!1,t)):[]}function Dt(s,t,e,n){return e.reduce((i,o)=>{if(o.applyBeforeValidation!==n)return i;if(o.mutates){if(o.applied)return i;o.applied=!0}if(K(i))return i.then(a=>Promise.all([a,o(a,t)])).then(([a,f])=>Object.assign(a,f));{let a=o(i,t);return K(a)?a.then(f=>Object.assign(i,f)):Object.assign(i,a)}},s)}function vt(s,t,e=n=>{throw n}){try{let n=Ni(s)?s():s;return K(n)?n.then(i=>t(i)):t(n)}catch(n){return e(n)}}function Ni(s){return typeof s=="function"}function $e(s){if(typeof wt>"u")return null;for(let t=0,e=Object.keys(wt.cache),n;t<e.length;t++)if(n=wt.cache[e[t]],n.exports===s)return n;return null}var Zt=/(^\*)|(^\$0)/,gn=class{constructor(t,e,n,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,i){i=i||{},typeof i.recurse!="boolean"&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);let o=typeof i.visit=="function"?i.visit:a=>a;i.visit=(a,f,g)=>{let O=o(a,f,g);if(O){if(this.requireCache.has(f))return O;this.requireCache.add(f),this.addHandler(O)}return O},this.shim.requireDirectory({require:e,filename:n},t,i)}addHandler(t,e,n,i,o,a){let f=[],g=pn(o);if(i=i||(()=>{}),Array.isArray(t))if(Fi(t))[t,...f]=t;else for(let O of t)this.addHandler(O);else if(Li(t)){let O=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(O=[].concat(O).concat(t.aliases)),this.addHandler(O,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(mn(n)){this.addHandler([t].concat(f),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let O=St(t);f=f.map(m=>St(m).cmd);let b=!1,c=[O.cmd].concat(f).filter(m=>Zt.test(m)?(b=!0,!1):!0);c.length===0&&b&&c.push("$0"),b&&(O.cmd=c[0],f=c.slice(1),t=t.replace(Zt,O.cmd)),f.forEach(m=>{this.aliasMap[m]=O.cmd}),e!==!1&&this.usage.command(t,e,b,f,a),this.handlers[O.cmd]={original:t,description:e,handler:i,builder:n||{},middlewares:g,deprecated:a,demanded:O.demanded,optional:O.optional},b&&(this.defaultCommand=this.handlers[O.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,i,o,a){let f=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,g=e.getInternalMethods().getContext(),O=g.commands.slice(),b=!t;t&&(g.commands.push(t),g.fullCommands.push(f.original));let c=this.applyBuilderUpdateUsageAndParse(b,f,e,n.aliases,O,i,o,a);return K(c)?c.then(m=>this.applyMiddlewareAndGetResult(b,f,m.innerArgv,g,o,m.aliases,e)):this.applyMiddlewareAndGetResult(b,f,c.innerArgv,g,o,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,i,o,a,f,g){let O=e.builder,b=n;if(ue(O)){let c=O(n.getInternalMethods().reset(i),g);if(K(c))return c.then(m=>(b=On(m)?m:n,this.parseAndUpdateUsage(t,e,b,o,a,f)))}else Wi(O)&&(b=n.getInternalMethods().reset(i),Object.keys(e.builder).forEach(c=>{b.option(c,O[c])}));return this.parseAndUpdateUsage(t,e,b,o,a,f)}parseAndUpdateUsage(t,e,n,i,o,a){t&&n.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);let f=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,o,a);return K(f)?f.then(g=>({aliases:n.parsed.aliases,innerArgv:g})):{aliases:n.parsed.aliases,innerArgv:f}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){let n=Zt.test(e.original)?e.original.replace(Zt,"").trim():e.original,i=t.filter(o=>!Zt.test(o));return i.push(n),`$0 ${i.join(" ")}`}applyMiddlewareAndGetResult(t,e,n,i,o,a,f){let g={};if(o)return n;f.getInternalMethods().getHasOutput()||(g=this.populatePositionals(e,n,i,f));let O=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares);if(n=Dt(n,f,O,!0),!f.getInternalMethods().getHasOutput()){let b=f.getInternalMethods().runValidation(a,g,f.parsed.error,t);n=vt(n,c=>(b(c),c))}if(e.handler&&!f.getInternalMethods().getHasOutput()){f.getInternalMethods().setHasOutput();let b=!!f.getOptions().configuration["populate--"];f.getInternalMethods().postProcess(n,b,!1,!1),n=Dt(n,f,O,!1),n=vt(n,c=>{let m=e.handler(c);return K(m)?m.then(()=>c):c}),t||f.getInternalMethods().getUsageInstance().cacheHelpMessage(),K(n)&&!f.getInternalMethods().hasParseCallback()&&n.catch(c=>{try{f.getInternalMethods().getUsageInstance().fail(null,c)}catch{}})}return t||(i.commands.pop(),i.fullCommands.pop()),n}populatePositionals(t,e,n,i){e._=e._.slice(n.commands.length);let o=t.demanded.slice(0),a=t.optional.slice(0),f={};for(this.validation.positionalCount(o.length,e._.length);o.length;){let g=o.shift();this.populatePositional(g,e,f)}for(;a.length;){let g=a.shift();this.populatePositional(g,e,f)}return e._=n.commands.concat(e._.map(g=>""+g)),this.postProcessPositionals(e,f,this.cmdToParseOptions(t.original),i),f}populatePositional(t,e,n){let i=t.cmd[0];t.variadic?n[i]=e._.splice(0).map(String):e._.length&&(n[i]=[String(e._.shift())])}cmdToParseOptions(t){let e={array:[],default:{},alias:{},demand:{}},n=St(t);return n.demanded.forEach(i=>{let[o,...a]=i.cmd;i.variadic&&(e.array.push(o),e.default[o]=[]),e.alias[o]=a,e.demand[o]=!0}),n.optional.forEach(i=>{let[o,...a]=i.cmd;i.variadic&&(e.array.push(o),e.default[o]=[]),e.alias[o]=a}),e}postProcessPositionals(t,e,n,i){let o=Object.assign({},i.getOptions());o.default=Object.assign(n.default,o.default);for(let O of Object.keys(n.alias))o.alias[O]=(o.alias[O]||[]).concat(n.alias[O]);o.array=o.array.concat(n.array),o.config={};let a=[];if(Object.keys(e).forEach(O=>{e[O].map(b=>{o.configuration["unknown-options-as-args"]&&(o.key[O]=!0),a.push(`--${O}`),a.push(b)})}),!a.length)return;let f=Object.assign({},o.configuration,{"populate--":!1}),g=this.shim.Parser.detailed(a,Object.assign({},o,{configuration:f}));if(g.error)i.getInternalMethods().getUsageInstance().fail(g.error.message,g.error);else{let O=Object.keys(e);Object.keys(e).forEach(c=>{O.push(...g.aliases[c])});let b=i.getOptions().default;Object.keys(g.argv).forEach(c=>{O.includes(c)&&(e[c]||(e[c]=g.argv[c]),!Object.prototype.hasOwnProperty.call(b,c)&&Object.prototype.hasOwnProperty.call(t,c)&&Object.prototype.hasOwnProperty.call(g.argv,c)&&(Array.isArray(t[c])||Array.isArray(g.argv[c]))?t[c]=[].concat(t[c],g.argv[c]):t[c]=g.argv[c])})}}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let n=Zt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let e=this.defaultCommand.builder;if(ue(e))return e(t,!0);mn(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=$e(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(let i of[t,e,n]){if(typeof i=="string"||i===!1)return i;ot(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let t=this.frozens.pop();ot(t,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function bn(s,t,e,n){return new gn(s,t,e,n)}function mn(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function Fi(s){return s.every(t=>typeof t=="string")}function ue(s){return typeof s=="function"}function Wi(s){return typeof s=="object"}function Li(s){return typeof s=="object"&&!Array.isArray(s)}function Pt(s={},t=()=>!0){let e={};return Qt(s).forEach(n=>{t(n,s[n])&&(e[n]=s[n])}),e}function Mt(s){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{let e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(s)})}function zi(s){return typeof s=="boolean"}function wn(s,t){let e=t.y18n.__,n={},i=[];n.failFn=function(C){i.push(C)};let o=null,a=!0;n.showHelpOnFail=function(C=!0,$){function L(){return typeof C=="string"?[!0,C]:[C,$]}let[q,k]=L();return o=k,a=q,n};let f=!1;n.fail=function(C,$){let L=s.getInternalMethods().getLoggerInstance();if(i.length)for(let q=i.length-1;q>=0;--q){let k=i[q];if(zi(k)){if($)throw $;if(C)throw Error(C)}else k(C,$,n)}else{if(s.getExitProcess()&&Mt(!0),f||(f=!0,a&&(s.showHelp("error"),L.error()),(C||$)&&L.error(C||$),o&&((C||$)&&L.error(""),L.error(o))),$=$||new V(C),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,$);throw $}};let g=[],O=!1;n.usage=(S,C)=>S===null?(O=!0,g=[],n):(O=!1,g.push([S,C||""]),n),n.getUsage=()=>g,n.getUsageDisabled=()=>O,n.getPositionalGroupName=()=>e("Positionals:");let b=[];n.example=(S,C)=>{b.push([S,C||""])};let c=[];n.command=function(C,$,L,q,k=!1){L&&(c=c.map(U=>(U[2]=!1,U))),c.push([C,$||"",L,q,k])},n.getCommands=()=>c;let m={};n.describe=function(C,$){Array.isArray(C)?C.forEach(L=>{n.describe(L,$)}):typeof C=="object"?Object.keys(C).forEach(L=>{n.describe(L,C[L])}):m[C]=$},n.getDescriptions=()=>m;let w=[];n.epilog=S=>{w.push(S)};let M=!1,y;n.wrap=S=>{M=!0,y=S};function d(){return M||(y=Jt(),M=!0),y}let D="__yargsString__:";n.deferY18nLookup=S=>D+S,n.help=function(){if(H)return H;Y();let C=s.customScriptName?s.$0:t.path.basename(s.$0),$=s.getDemandedOptions(),L=s.getDemandedCommands(),q=s.getDeprecatedOptions(),k=s.getGroups(),U=s.getOptions(),nt=[];nt=nt.concat(Object.keys(m)),nt=nt.concat(Object.keys($)),nt=nt.concat(Object.keys(L)),nt=nt.concat(Object.keys(U.default)),nt=nt.filter(At),nt=Object.keys(nt.reduce((N,G)=>(G!=="_"&&(N[G]=!0),N),{}));let Wt=d(),J=t.cliui({width:Wt,wrap:!!Wt});if(!O){if(g.length)g.forEach(N=>{J.div({text:`${N[0].replace(/\$0/g,C)}`}),N[1]&&J.div({text:`${N[1]}`,padding:[1,0,0,0]})}),J.div();else if(c.length){let N=null;L._?N=`${C} <${e("command")}>
7
+ `:N=`${C} [${e("command")}]
8
+ `,J.div(`${N}`)}}if(c.length>1||c.length===1&&!c[0][2]){J.div(e("Commands:"));let N=s.getInternalMethods().getContext(),G=N.commands.length?`${N.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(c=c.sort((v,Z)=>v[0].localeCompare(Z[0])));let Q=C?`${C} `:"";c.forEach(v=>{let Z=`${Q}${G}${v[0].replace(/^\$0 ?/,"")}`;J.span({text:Z,padding:[0,2,0,2],width:R(c,Wt,`${C}${G}`)+4},{text:v[1]});let tt=[];v[2]&&tt.push(`[${e("default")}]`),v[3]&&v[3].length&&tt.push(`[${e("aliases:")} ${v[3].join(", ")}]`),v[4]&&(typeof v[4]=="string"?tt.push(`[${e("deprecated: %s",v[4])}]`):tt.push(`[${e("deprecated")}]`)),tt.length?J.div({text:tt.join(" "),padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}let Et=(Object.keys(U.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);nt=nt.filter(N=>!s.parsed.newAliases[N]&&Et.every(G=>(U.alias[G]||[]).indexOf(N)===-1));let jt=e("Options:");k[jt]||(k[jt]=[]),T(nt,U.alias,k,jt);let Lt=N=>/^--/.test(de(N)),F=Object.keys(k).filter(N=>k[N].length>0).map(N=>{let G=k[N].filter(At).map(Q=>{if(Et.includes(Q))return Q;for(let v=0,Z;(Z=Et[v])!==void 0;v++)if((U.alias[Z]||[]).includes(Q))return Z;return Q});return{groupName:N,normalizedKeys:G}}).filter(({normalizedKeys:N})=>N.length>0).map(({groupName:N,normalizedKeys:G})=>{let Q=G.reduce((v,Z)=>(v[Z]=[Z].concat(U.alias[Z]||[]).map(tt=>N===n.getPositionalGroupName()?tt:(/^[0-9]$/.test(tt)?U.boolean.includes(Z)?"-":"--":tt.length>1?"--":"-")+tt).sort((tt,bt)=>Lt(tt)===Lt(bt)?0:Lt(tt)?1:-1).join(", "),v),{});return{groupName:N,normalizedKeys:G,switches:Q}});if(F.filter(({groupName:N})=>N!==n.getPositionalGroupName()).some(({normalizedKeys:N,switches:G})=>!N.every(Q=>Lt(G[Q])))&&F.filter(({groupName:N})=>N!==n.getPositionalGroupName()).forEach(({normalizedKeys:N,switches:G})=>{N.forEach(Q=>{Lt(G[Q])&&(G[Q]=Di(G[Q],4))})}),F.forEach(({groupName:N,normalizedKeys:G,switches:Q})=>{J.div(N),G.forEach(v=>{let Z=Q[v],tt=m[v]||"",bt=null;tt.includes(D)&&(tt=e(tt.substring(D.length))),U.boolean.includes(v)&&(bt=`[${e("boolean")}]`),U.count.includes(v)&&(bt=`[${e("count")}]`),U.string.includes(v)&&(bt=`[${e("string")}]`),U.normalize.includes(v)&&(bt=`[${e("string")}]`),U.array.includes(v)&&(bt=`[${e("array")}]`),U.number.includes(v)&&(bt=`[${e("number")}]`);let Ot=l=>typeof l=="string"?`[${e("deprecated: %s",l)}]`:`[${e("deprecated")}]`,oe=[v in q?Ot(q[v]):null,bt,v in $?`[${e("required")}]`:null,U.choices&&U.choices[v]?`[${e("choices:")} ${n.stringifiedValues(U.choices[v])}]`:null,gt(U.default[v],U.defaultDescription[v])].filter(Boolean).join(" ");J.span({text:de(Z),padding:[0,2,0,2+_n(Z)],width:R(Q,Wt)+4},tt),oe?J.div({text:oe,padding:[0,0,0,2],align:"right"}):J.div()}),J.div()}),b.length&&(J.div(e("Examples:")),b.forEach(N=>{N[0]=N[0].replace(/\$0/g,C)}),b.forEach(N=>{N[1]===""?J.div({text:N[0],padding:[0,2,0,2]}):J.div({text:N[0],padding:[0,2,0,2],width:R(b,Wt)+4},{text:N[1]})}),J.div()),w.length>0){let N=w.map(G=>G.replace(/\$0/g,C)).join(`
9
+ `);J.div(`${N}
10
+ `)}return J.toString().replace(/\s*$/,"")};function R(S,C,$){let L=0;return Array.isArray(S)||(S=Object.values(S).map(q=>[q])),S.forEach(q=>{L=Math.max(t.stringWidth($?`${$} ${de(q[0])}`:de(q[0]))+_n(q[0]),L)}),C&&(L=Math.min(L,parseInt((C*.5).toString(),10))),L}function Y(){let S=s.getDemandedOptions(),C=s.getOptions();(Object.keys(C.alias)||[]).forEach($=>{C.alias[$].forEach(L=>{m[L]&&n.describe($,m[L]),L in S&&s.demandOption($,S[L]),C.boolean.includes(L)&&s.boolean($),C.count.includes(L)&&s.count($),C.string.includes(L)&&s.string($),C.normalize.includes(L)&&s.normalize($),C.array.includes(L)&&s.array($),C.number.includes(L)&&s.number($)})})}let H;n.cacheHelpMessage=function(){H=this.help()},n.clearCachedHelpMessage=function(){H=void 0},n.hasCachedHelpMessage=function(){return!!H};function T(S,C,$,L){let q=[],k=null;return Object.keys($).forEach(U=>{q=q.concat($[U])}),S.forEach(U=>{k=[U].concat(C[U]),k.some(nt=>q.indexOf(nt)!==-1)||$[L].push(U)}),q}function At(S){return s.getOptions().hiddenOptions.indexOf(S)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=S=>{let C=s.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:C[S])(n.help())},n.functionDescription=S=>{let C=S.name?t.Parser.decamelize(S.name,"-"):e("generated-value");return["(",C,")"].join("")},n.stringifiedValues=function(C,$){let L="",q=$||", ",k=[].concat(C);return!C||!k.length||k.forEach(U=>{L.length&&(L+=q),L+=JSON.stringify(U)}),L};function gt(S,C){let $=`[${e("default:")} `;if(S===void 0&&!C)return null;if(C)$+=C;else switch(typeof S){case"string":$+=`"${S}"`;break;case"object":$+=JSON.stringify(S);break;default:$+=S}return`${$}]`}function Jt(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let Ft=null;n.version=S=>{Ft=S},n.showVersion=S=>{let C=s.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:C[S])(Ft)},n.reset=function(C){return o=null,f=!1,g=[],O=!1,w=[],b=[],c=[],m=Pt(m,$=>!C[$]),n};let B=[];return n.freeze=function(){B.push({failMessage:o,failureOutput:f,usages:g,usageDisabled:O,epilogs:w,examples:b,commands:c,descriptions:m})},n.unfreeze=function(){let C=B.pop();!C||({failMessage:o,failureOutput:f,usages:g,usageDisabled:O,epilogs:w,examples:b,commands:c,descriptions:m}=C)},n}function Ne(s){return typeof s=="object"}function Di(s,t){return Ne(s)?{text:s.text,indentation:s.indentation+t}:{text:s,indentation:t}}function _n(s){return Ne(s)?s.indentation:0}function de(s){return Ne(s)?s.text:s}var yn=`###-begin-{{app_name}}-completions-###
11
+ #
12
+ # yargs command completion script
13
+ #
14
+ # Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
15
+ # or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
16
+ #
17
+ _{{app_name}}_yargs_completions()
18
+ {
19
+ local cur_word args type_list
20
+
21
+ cur_word="\${COMP_WORDS[COMP_CWORD]}"
22
+ args=("\${COMP_WORDS[@]}")
23
+
24
+ # ask yargs to generate completions.
25
+ type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
26
+
27
+ COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
28
+
29
+ # if no match was found, fall back to filename completion
30
+ if [ \${#COMPREPLY[@]} -eq 0 ]; then
31
+ COMPREPLY=()
32
+ fi
33
+
34
+ return 0
35
+ }
36
+ complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
37
+ ###-end-{{app_name}}-completions-###
38
+ `,Cn=`#compdef {{app_name}}
39
+ ###-begin-{{app_name}}-completions-###
40
+ #
41
+ # yargs command completion script
42
+ #
43
+ # Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
44
+ # or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.
45
+ #
46
+ _{{app_name}}_yargs_completions()
47
+ {
48
+ local reply
49
+ local si=$IFS
50
+ IFS=$'
51
+ ' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
52
+ IFS=$si
53
+ _describe 'values' reply
54
+ }
55
+ compdef _{{app_name}}_yargs_completions {{app_name}}
56
+ ###-end-{{app_name}}-completions-###
57
+ `;var En=class{constructor(t,e,n,i){var o,a,f;this.yargs=t,this.usage=e,this.command=n,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.zshShell=(f=((o=this.shim.getEnv("SHELL"))===null||o===void 0?void 0:o.includes("zsh"))||((a=this.shim.getEnv("ZSH_NAME"))===null||a===void 0?void 0:a.includes("zsh")))!==null&&f!==void 0?f:!1}defaultCompletion(t,e,n,i){let o=this.command.getCommandHandlers();for(let f=0,g=t.length;f<g;++f)if(o[t[f]]&&o[t[f]].builder){let O=o[t[f]].builder;if(ue(O)){let b=this.yargs.getInternalMethods().reset();return O(b,!0),b.argv}}let a=[];this.commandCompletions(a,t,n),this.optionCompletions(a,t,e,n),this.choicesCompletions(a,t,e,n),i(null,a)}commandCompletions(t,e,n){let i=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&i[i.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(o=>{let a=St(o[0]).cmd;if(e.indexOf(a)===-1)if(!this.zshShell)t.push(a);else{let f=o[1]||"";t.push(a.replace(/:/g,"\\:")+":"+f)}})}optionCompletions(t,e,n,i){if((i.match(/^-/)||i===""&&t.length===0)&&!this.previousArgHasChoices(e)){let o=this.yargs.getOptions(),a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(o.key).forEach(f=>{let g=!!o.configuration["boolean-negation"]&&o.boolean.includes(f);!a.includes(f)&&!this.argsContainKey(e,n,f,g)&&(this.completeOptionKey(f,t,i),g&&!!o.default[f]&&this.completeOptionKey(`no-${f}`,t,i))})}}choicesCompletions(t,e,n,i){if(this.previousArgHasChoices(e)){let o=this.getPreviousArgChoices(e);o&&o.length>0&&t.push(...o)}}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("--")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("--"))return;let i=e.replace(/-/g,""),o=this.yargs.getOptions();if(Object.keys(o.key).some(a=>a===i)&&Array.isArray(o.choices[i]))return o.choices[i].filter(a=>!n||a.startsWith(n))}previousArgHasChoices(t){let e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n,i){if(t.indexOf(`--${n}`)!==-1||i&&t.indexOf(`--no-${n}`)!==-1)return!0;if(this.aliases){for(let o of this.aliases[n])if(e[o]!==void 0)return!0}return!1}completeOptionKey(t,e,n){let i=this.usage.getDescriptions(),o=g=>/^--/.test(g),a=g=>/^[^0-9]$/.test(g),f=!o(n)&&a(t)?"-":"--";if(!this.zshShell)e.push(f+t);else{let g=i[t]||"";e.push(f+`${t.replace(/:/g,"\\:")}:${g.replace("__yargsString__:","")}`)}}customCompletion(t,e,n,i){if(ot(this.customCompletionFunction,null,this.shim),Ri(this.customCompletionFunction)){let o=this.customCompletionFunction(n,e);return K(o)?o.then(a=>{this.shim.process.nextTick(()=>{i(null,a)})}).catch(a=>{this.shim.process.nextTick(()=>{i(a,void 0)})}):i(null,o)}else return Ui(this.customCompletionFunction)?this.customCompletionFunction(n,e,(o=i)=>this.defaultCompletion(t,e,n,o),o=>{i(null,o)}):this.customCompletionFunction(n,e,o=>{i(null,o)})}getCompletion(t,e){let n=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),o=this.customCompletionFunction?a=>this.customCompletion(t,a,n,e):a=>this.defaultCompletion(t,a,n,e);return K(i)?i.then(o):o(i)}generateCompletionScript(t,e){let n=this.zshShell?Cn:yn,i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,i),n=n.replace(/{{completion_command}}/g,e),n.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}};function jn(s,t,e,n){return new En(s,t,e,n)}function Ri(s){return s.length<3}function Ui(s){return s.length>3}function xn(s,t){if(s.length===0)return t.length;if(t.length===0)return s.length;let e=[],n;for(n=0;n<=t.length;n++)e[n]=[n];let i;for(i=0;i<=s.length;i++)e[0][i]=i;for(n=1;n<=t.length;n++)for(i=1;i<=s.length;i++)t.charAt(n-1)===s.charAt(i-1)?e[n][i]=e[n-1][i-1]:n>1&&i>1&&t.charAt(n-2)===s.charAt(i-1)&&t.charAt(n-1)===s.charAt(i-2)?e[n][i]=e[n-2][i-2]+1:e[n][i]=Math.min(e[n-1][i-1]+1,Math.min(e[n][i-1]+1,e[n-1][i]+1));return e[t.length][s.length]}var An=["$0","--","_"];function Sn(s,t,e){let n=e.y18n.__,i=e.y18n.__n,o={};o.nonOptionCount=function(c){let m=s.getDemandedCommands(),M=c._.length+(c["--"]?c["--"].length:0)-s.getInternalMethods().getContext().commands.length;m._&&(M<m._.min||M>m._.max)&&(M<m._.min?m._.minMsg!==void 0?t.fail(m._.minMsg?m._.minMsg.replace(/\$0/g,M.toString()).replace(/\$1/,m._.min.toString()):null):t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",M,M.toString(),m._.min.toString())):M>m._.max&&(m._.maxMsg!==void 0?t.fail(m._.maxMsg?m._.maxMsg.replace(/\$0/g,M.toString()).replace(/\$1/,m._.max.toString()):null):t.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",M,M.toString(),m._.max.toString()))))},o.positionalCount=function(c,m){m<c&&t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",m,m+"",c+""))},o.requiredArguments=function(c,m){let w=null;for(let M of Object.keys(m))(!Object.prototype.hasOwnProperty.call(c,M)||typeof c[M]>"u")&&(w=w||{},w[M]=m[M]);if(w){let M=[];for(let d of Object.keys(w)){let D=w[d];D&&M.indexOf(D)<0&&M.push(D)}let y=M.length?`
58
+ ${M.join(`
59
+ `)}`:"";t.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(w).length,Object.keys(w).join(", ")+y))}},o.unknownArguments=function(c,m,w,M,y=!0){var d;let D=s.getInternalMethods().getCommandInstance().getCommands(),R=[],Y=s.getInternalMethods().getContext();if(Object.keys(c).forEach(H=>{!An.includes(H)&&!Object.prototype.hasOwnProperty.call(w,H)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),H)&&!o.isValidAndSomeAliasIsNotNew(H,m)&&R.push(H)}),y&&(Y.commands.length>0||D.length>0||M)&&c._.slice(Y.commands.length).forEach(H=>{D.includes(""+H)||R.push(""+H)}),y){let T=((d=s.getDemandedCommands()._)===null||d===void 0?void 0:d.max)||0,At=Y.commands.length+T;At<c._.length&&c._.slice(At).forEach(gt=>{gt=String(gt),!Y.commands.includes(gt)&&!R.includes(gt)&&R.push(gt)})}R.length&&t.fail(i("Unknown argument: %s","Unknown arguments: %s",R.length,R.join(", ")))},o.unknownCommands=function(c){let m=s.getInternalMethods().getCommandInstance().getCommands(),w=[],M=s.getInternalMethods().getContext();return(M.commands.length>0||m.length>0)&&c._.slice(M.commands.length).forEach(y=>{m.includes(""+y)||w.push(""+y)}),w.length>0?(t.fail(i("Unknown command: %s","Unknown commands: %s",w.length,w.join(", "))),!0):!1},o.isValidAndSomeAliasIsNotNew=function(c,m){if(!Object.prototype.hasOwnProperty.call(m,c))return!1;let w=s.parsed.newAliases;return[c,...m[c]].some(M=>!Object.prototype.hasOwnProperty.call(w,M)||!w[c])},o.limitedChoices=function(c){let m=s.getOptions(),w={};if(!Object.keys(m.choices).length)return;Object.keys(c).forEach(d=>{An.indexOf(d)===-1&&Object.prototype.hasOwnProperty.call(m.choices,d)&&[].concat(c[d]).forEach(D=>{m.choices[d].indexOf(D)===-1&&D!==void 0&&(w[d]=(w[d]||[]).concat(D))})});let M=Object.keys(w);if(!M.length)return;let y=n("Invalid values:");M.forEach(d=>{y+=`
60
+ ${n("Argument: %s, Given: %s, Choices: %s",d,t.stringifiedValues(w[d]),t.stringifiedValues(m.choices[d]))}`}),t.fail(y)};let a={};o.implies=function(c,m){j("<string|object> [array|number|string]",[c,m],arguments.length),typeof c=="object"?Object.keys(c).forEach(w=>{o.implies(w,c[w])}):(s.global(c),a[c]||(a[c]=[]),Array.isArray(m)?m.forEach(w=>o.implies(c,w)):(ot(m,void 0,e),a[c].push(m)))},o.getImplied=function(){return a};function f(b,c){let m=Number(c);return c=isNaN(m)?c:m,typeof c=="number"?c=b._.length>=c:c.match(/^--no-.+/)?(c=c.match(/^--no-(.+)/)[1],c=!Object.prototype.hasOwnProperty.call(b,c)):c=Object.prototype.hasOwnProperty.call(b,c),c}o.implications=function(c){let m=[];if(Object.keys(a).forEach(w=>{let M=w;(a[w]||[]).forEach(y=>{let d=M,D=y;d=f(c,d),y=f(c,y),d&&!y&&m.push(` ${M} -> ${D}`)})}),m.length){let w=`${n("Implications failed:")}
61
+ `;m.forEach(M=>{w+=M}),t.fail(w)}};let g={};o.conflicts=function(c,m){j("<string|object> [array|string]",[c,m],arguments.length),typeof c=="object"?Object.keys(c).forEach(w=>{o.conflicts(w,c[w])}):(s.global(c),g[c]||(g[c]=[]),Array.isArray(m)?m.forEach(w=>o.conflicts(c,w)):g[c].push(m))},o.getConflicting=()=>g,o.conflicting=function(c){Object.keys(c).forEach(m=>{g[m]&&g[m].forEach(w=>{w&&c[m]!==void 0&&c[w]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",m,w))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(g).forEach(m=>{g[m].forEach(w=>{w&&c[e.Parser.camelCase(m)]!==void 0&&c[e.Parser.camelCase(w)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",m,w))})})},o.recommendCommands=function(c,m){m=m.sort((d,D)=>D.length-d.length);let M=null,y=1/0;for(let d=0,D;(D=m[d])!==void 0;d++){let R=xn(c,D);R<=3&&R<y&&(y=R,M=D)}M&&t.fail(n("Did you mean %s?",M))},o.reset=function(c){return a=Pt(a,m=>!c[m]),g=Pt(g,m=>!c[m]),o};let O=[];return o.freeze=function(){O.push({implied:a,conflicting:g})},o.unfreeze=function(){let c=O.pop();ot(c,void 0,e),{implied:a,conflicting:g}=c},o}var Fe=[],ne;function ie(s,t,e,n){ne=n;let i={};if(Object.prototype.hasOwnProperty.call(s,"extends")){if(typeof s.extends!="string")return i;let o=/\.json|\..*rc$/.test(s.extends),a=null;if(o)a=Yi(t,s.extends);else try{a=wt.resolve(s.extends)}catch{return s}Hi(a),Fe.push(a),i=o?JSON.parse(ne.readFileSync(a,"utf8")):wt(s.extends),delete s.extends,i=ie(i,ne.path.dirname(a),e,ne)}return Fe=[],e?Pn(i,s):Object.assign({},i,s)}function Hi(s){if(Fe.indexOf(s)>-1)throw new V(`Circular extended configurations: '${s}'.`)}function Yi(s,t){return ne.path.resolve(s,t)}function Pn(s,t){let e={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}Object.assign(e,s);for(let i of Object.keys(t))n(t[i])&&n(e[i])?e[i]=Pn(s[i],t[i]):e[i]=t[i];return e}var x=function(s,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!i:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(s,e):i?i.value=e:t.set(s,e),e},r=function(s,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!n:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(s):n?n.value:t.get(s)},et,Rt,se,ut,lt,pe,It,Ut,me,dt,ge,pt,yt,ft,mt,Xt,st,P,be,Oe,ct,Ht,kt,Yt,$t,_e,W,Tt,Bt,qt,z,Ct,X;function Vn(s){return(t=[],e=s.process.cwd(),n)=>{let i=new Gn(t,e,n,s);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}var Mn=Symbol("copyDoubleDash"),In=Symbol("copyDoubleDash"),We=Symbol("deleteFromParserHintObject"),$n=Symbol("emitWarning"),Nn=Symbol("freeze"),Fn=Symbol("getDollarZero"),Vt=Symbol("getParserConfiguration"),Le=Symbol("guessLocale"),Wn=Symbol("guessVersion"),Ln=Symbol("parsePositionalNumbers"),ze=Symbol("pkgUp"),Nt=Symbol("populateParserHintArray"),te=Symbol("populateParserHintSingleValueDictionary"),De=Symbol("populateParserHintArrayDictionary"),ve=Symbol("populateParserHintDictionary"),Re=Symbol("sanitizeKey"),Ue=Symbol("setKey"),He=Symbol("unfreeze"),zn=Symbol("validateAsync"),Dn=Symbol("getCommandInstance"),vn=Symbol("getContext"),Rn=Symbol("getHasOutput"),Un=Symbol("getLoggerInstance"),Hn=Symbol("getParseContext"),Yn=Symbol("getUsageInstance"),Tn=Symbol("getValidationInstance"),we=Symbol("hasParseCallback"),Gt=Symbol("postProcess"),Bn=Symbol("rebase"),Ye=Symbol("reset"),re=Symbol("runYargsParserAndExecuteCommands"),Te=Symbol("runValidation"),qn=Symbol("setHasOutput"),Kt=Symbol("kTrackManuallySetKeys"),Gn=class{constructor(t=[],e,n,i){this.customScriptName=!1,this.parsed=!1,et.set(this,void 0),Rt.set(this,void 0),se.set(this,{commands:[],fullCommands:[]}),ut.set(this,null),lt.set(this,null),pe.set(this,"show-hidden"),It.set(this,null),Ut.set(this,!0),me.set(this,{}),dt.set(this,!0),ge.set(this,[]),pt.set(this,void 0),yt.set(this,{}),ft.set(this,!1),mt.set(this,null),Xt.set(this,void 0),st.set(this,""),P.set(this,void 0),be.set(this,void 0),Oe.set(this,{}),ct.set(this,null),Ht.set(this,null),kt.set(this,{}),Yt.set(this,{}),$t.set(this,void 0),_e.set(this,!1),W.set(this,void 0),Tt.set(this,!1),Bt.set(this,!1),qt.set(this,!1),z.set(this,void 0),Ct.set(this,null),X.set(this,void 0),x(this,W,i,"f"),x(this,$t,t,"f"),x(this,Rt,e,"f"),x(this,be,n,"f"),x(this,pt,new Ie(this),"f"),this.$0=this[Fn](),this[Ye](),x(this,et,r(this,et,"f"),"f"),x(this,z,r(this,z,"f"),"f"),x(this,X,r(this,X,"f"),"f"),x(this,P,r(this,P,"f"),"f"),r(this,P,"f").showHiddenOpt=r(this,pe,"f"),x(this,Xt,this[In](),"f")}addHelpOpt(t,e){let n="help";return j("[string|boolean] [string]",[t,e],arguments.length),r(this,mt,"f")&&(this[We](r(this,mt,"f")),x(this,mt,null,"f")),t===!1&&e===void 0?this:(x(this,mt,typeof t=="string"?t:n,"f"),this.boolean(r(this,mt,"f")),this.describe(r(this,mt,"f"),e||r(this,z,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(j("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;let n=typeof t=="string"?t:r(this,pe,"f");return this.boolean(n),this.describe(n,e||r(this,z,"f").deferY18nLookup("Show hidden options")),r(this,P,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[De](this.alias.bind(this),"alias",t,e),this}array(t){return j("<array|string>",[t],arguments.length),this[Nt]("array",t),this[Kt](t),this}boolean(t){return j("<array|string>",[t],arguments.length),this[Nt]("boolean",t),this[Kt](t),this}check(t,e){return j("<function> [boolean]",[t,e],arguments.length),this.middleware((n,i)=>vt(()=>t(n,i.getOptions()),o=>(o?(typeof o=="string"||o instanceof Error)&&r(this,z,"f").fail(o.toString(),o):r(this,z,"f").fail(r(this,W,"f").y18n.__("Argument check failed: %s",t.toString())),n),o=>(r(this,z,"f").fail(o.message?o.message:o.toString(),o),n)),!1,e),this}choices(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[De](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(j("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new V("coerce callback must be provided");for(let n of t)this.coerce(n,e);return this}else if(typeof t=="object"){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!e)throw new V("coerce callback must be provided");return r(this,P,"f").key[t]=!0,r(this,pt,"f").addCoerceMiddleware((n,i)=>{let o;return vt(()=>(o=i.getAliases(),e(n[t])),a=>{if(n[t]=a,o[t])for(let f of o[t])n[f]=a;return n},a=>{throw new V(a.message)})},t),this}conflicts(t,e){return j("<string|object> [string|array]",[t,e],arguments.length),r(this,X,"f").conflicts(t,e),this}config(t="config",e,n){return j("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=ie(t,r(this,Rt,"f"),this[Vt]()["deep-merge-config"]||!1,r(this,W,"f")),r(this,P,"f").configObjects=(r(this,P,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||r(this,z,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{r(this,P,"f").config[i]=n||!0}),this)}completion(t,e,n){return j("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),x(this,lt,t||r(this,lt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(r(this,lt,"f"),e),n&&r(this,ut,"f").registerFunction(n),this}command(t,e,n,i,o,a){return j("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,i,o,a],arguments.length),r(this,et,"f").addHandler(t,e,n,i,o,a),this}commands(t,e,n,i,o,a){return this.command(t,e,n,i,o,a)}commandDir(t,e){j("<string> [object]",[t,e],arguments.length);let n=r(this,be,"f")||r(this,W,"f").require;return r(this,et,"f").addDirectory(t,n,r(this,W,"f").getCallerFile(),e),this}count(t){return j("<array|string>",[t],arguments.length),this[Nt]("count",t),this[Kt](t),this}default(t,e,n){return j("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(Me(t,r(this,W,"f")),r(this,P,"f").defaultDescription[t]=n),typeof e=="function"&&(Me(t,r(this,W,"f")),r(this,P,"f").defaultDescription[t]||(r(this,P,"f").defaultDescription[t]=r(this,z,"f").functionDescription(e)),e=e.call()),this[te](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,i){return j("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,i],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),r(this,P,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:i},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(i=>{ot(n,!0,r(this,W,"f")),this.demandOption(i,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(ot(n,!0,r(this,W,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(i=>{ot(n,!0,r(this,W,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[te](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return j("<string> [string|boolean]",[t,e],arguments.length),r(this,P,"f").deprecatedOptions[t]=e,this}describe(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[Ue](t,!0),r(this,z,"f").describe(t,e),this}detectLocale(t){return j("<boolean>",[t],arguments.length),x(this,Ut,t,"f"),this}env(t){return j("[string|boolean]",[t],arguments.length),t===!1?delete r(this,P,"f").envPrefix:r(this,P,"f").envPrefix=t||"",this}epilogue(t){return j("<string>",[t],arguments.length),r(this,z,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return j("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):r(this,z,"f").example(t,e),this}exit(t,e){x(this,ft,!0,"f"),x(this,It,e,"f"),r(this,dt,"f")&&r(this,W,"f").process.exit(t)}exitProcess(t=!0){return j("[boolean]",[t],arguments.length),x(this,dt,t,"f"),this}fail(t){if(j("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new V("Invalid first argument. Expected function or boolean 'false'");return r(this,z,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return j("<array> [function]",[t,e],arguments.length),e?r(this,ut,"f").getCompletion(t,e):new Promise((n,i)=>{r(this,ut,"f").getCompletion(t,(o,a)=>{o?i(o):n(a)})})}getDemandedOptions(){return j([],0),r(this,P,"f").demandedOptions}getDemandedCommands(){return j([],0),r(this,P,"f").demandedCommands}getDeprecatedOptions(){return j([],0),r(this,P,"f").deprecatedOptions}getDetectLocale(){return r(this,Ut,"f")}getExitProcess(){return r(this,dt,"f")}getGroups(){return Object.assign({},r(this,yt,"f"),r(this,Yt,"f"))}getHelp(){if(x(this,ft,!0,"f"),!r(this,z,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[re](r(this,$t,"f"),void 0,void 0,0,!0);if(K(e))return e.then(()=>r(this,z,"f").help())}let t=r(this,et,"f").runDefaultBuilderOn(this);if(K(t))return t.then(()=>r(this,z,"f").help())}return Promise.resolve(r(this,z,"f").help())}getOptions(){return r(this,P,"f")}getStrict(){return r(this,Tt,"f")}getStrictCommands(){return r(this,Bt,"f")}getStrictOptions(){return r(this,qt,"f")}global(t,e){return j("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?r(this,P,"f").local=r(this,P,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{r(this,P,"f").local.includes(n)||r(this,P,"f").local.push(n)}),this}group(t,e){j("<string|array> <string>",[t,e],arguments.length);let n=r(this,Yt,"f")[e]||r(this,yt,"f")[e];r(this,Yt,"f")[e]&&delete r(this,Yt,"f")[e];let i={};return r(this,yt,"f")[e]=(n||[]).concat(t).filter(o=>i[o]?!1:i[o]=!0),this}hide(t){return j("<string>",[t],arguments.length),r(this,P,"f").hiddenOptions.push(t),this}implies(t,e){return j("<string|object> [number|string|array]",[t,e],arguments.length),r(this,X,"f").implies(t,e),this}locale(t){return j("[string]",[t],arguments.length),t?(x(this,Ut,!1,"f"),r(this,W,"f").y18n.setLocale(t),this):(this[Le](),r(this,W,"f").y18n.getLocale())}middleware(t,e,n){return r(this,pt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return j("<string|object|array> [number]",[t,e],arguments.length),this[te](this.nargs.bind(this),"narg",t,e),this}normalize(t){return j("<array|string>",[t],arguments.length),this[Nt]("normalize",t),this}number(t){return j("<array|string>",[t],arguments.length),this[Nt]("number",t),this[Kt](t),this}option(t,e){if(j("<string|object> [object]",[t,e],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof e!="object"&&(e={}),this[Kt](t),r(this,Ct,"f")&&(t==="version"||(e==null?void 0:e.alias)==="version")&&this[$n](['"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(`
62
+ `),void 0,"versionWarning"),r(this,P,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);let n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);let i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,typeof e.demandOption=="string"?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),e.implies!==void 0&&this.implies(t,e.implies),e.nargs!==void 0&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||e.type==="boolean")&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||e.type==="array")&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||e.type==="number")&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||e.type==="string")&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||e.type==="count")&&this.count(t),typeof e.global=="boolean"&&this.global(t,e.global),e.defaultDescription&&(r(this,P,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let o=e.describe||e.description||e.desc;this.describe(t,o),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){j("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[Nn](),typeof t>"u"&&(t=r(this,$t,"f")),typeof e=="object"&&(x(this,Ht,e,"f"),e=n),typeof e=="function"&&(x(this,ct,e,"f"),e=!1),e||x(this,$t,t,"f"),r(this,ct,"f")&&x(this,dt,!1,"f");let i=this[re](t,!!e),o=this.parsed;return r(this,ut,"f").setParsed(this.parsed),K(i)?i.then(a=>(r(this,ct,"f")&&r(this,ct,"f").call(this,r(this,It,"f"),a,r(this,st,"f")),a)).catch(a=>{throw r(this,ct,"f")&&r(this,ct,"f")(a,this.parsed.argv,r(this,st,"f")),a}).finally(()=>{this[He](),this.parsed=o}):(r(this,ct,"f")&&r(this,ct,"f").call(this,r(this,It,"f"),i,r(this,st,"f")),this[He](),this.parsed=o,i)}parseAsync(t,e,n){let i=this.parse(t,e,n);return K(i)?i:Promise.resolve(i)}parseSync(t,e,n){let i=this.parse(t,e,n);if(K(i))throw new V(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return j("<object>",[t],arguments.length),x(this,Oe,t,"f"),this}pkgConf(t,e){j("<string> [string]",[t,e],arguments.length);let n=null,i=this[ze](e||r(this,Rt,"f"));return i[t]&&typeof i[t]=="object"&&(n=ie(i[t],e||r(this,Rt,"f"),this[Vt]()["deep-merge-config"]||!1,r(this,W,"f")),r(this,P,"f").configObjects=(r(this,P,"f").configObjects||[]).concat(n)),this}positional(t,e){j("<string> <object>",[t,e],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=Pt(e,(a,f)=>a==="type"&&!["string","number","boolean"].includes(f)?!1:n.includes(a));let i=r(this,se,"f").fullCommands[r(this,se,"f").fullCommands.length-1],o=i?r(this,et,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return Qt(o).forEach(a=>{let f=o[a];Array.isArray(f)?f.indexOf(t)!==-1&&(e[a]=!0):f[t]&&!(a in e)&&(e[a]=f[t])}),this.group(t,r(this,z,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return j("[boolean]",[t],arguments.length),x(this,_e,t,"f"),this}required(t,e,n){return this.demand(t,e,n)}require(t,e,n){return this.demand(t,e,n)}requiresArg(t){return j("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&r(this,P,"f").narg[t]?this:(this[te](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return j("[string] [string]",[t,e],arguments.length),t=t||this.$0,r(this,Xt,"f").log(r(this,ut,"f").generateCompletionScript(t,e||r(this,lt,"f")||"completion")),this}showHelp(t){if(j("[string|function]",[t],arguments.length),x(this,ft,!0,"f"),!r(this,z,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[re](r(this,$t,"f"),void 0,void 0,0,!0);if(K(n))return n.then(()=>{r(this,z,"f").showHelp(t)}),this}let e=r(this,et,"f").runDefaultBuilderOn(this);if(K(e))return e.then(()=>{r(this,z,"f").showHelp(t)}),this}return r(this,z,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return j("[boolean|string] [string]",[t,e],arguments.length),r(this,z,"f").showHelpOnFail(t,e),this}showVersion(t){return j("[string|function]",[t],arguments.length),r(this,z,"f").showVersion(t),this}skipValidation(t){return j("<array|string>",[t],arguments.length),this[Nt]("skipValidation",t),this}strict(t){return j("[boolean]",[t],arguments.length),x(this,Tt,t!==!1,"f"),this}strictCommands(t){return j("[boolean]",[t],arguments.length),x(this,Bt,t!==!1,"f"),this}strictOptions(t){return j("[boolean]",[t],arguments.length),x(this,qt,t!==!1,"f"),this}string(t){return j("<array|string>",[t],arguments.length),this[Nt]("string",t),this[Kt](t),this}terminalWidth(){return j([],0),r(this,W,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return j("<object>",[t],arguments.length),x(this,Ut,!1,"f"),r(this,W,"f").y18n.updateLocale(t),this}usage(t,e,n,i){if(j("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,i],arguments.length),e!==void 0){if(ot(t,null,r(this,W,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,i);throw new V(".usage() description must start with $0 if being used as alias for .command()")}else return r(this,z,"f").usage(t),this}version(t,e,n){let i="version";if(j("[boolean|string] [string] [string]",[t,e,n],arguments.length),r(this,Ct,"f")&&(this[We](r(this,Ct,"f")),r(this,z,"f").version(void 0),x(this,Ct,null,"f")),arguments.length===0)n=this[Wn](),t=i;else if(arguments.length===1){if(t===!1)return this;n=t,t=i}else arguments.length===2&&(n=e,e=void 0);return x(this,Ct,typeof t=="string"?t:i,"f"),e=e||r(this,z,"f").deferY18nLookup("Show version number"),r(this,z,"f").version(n||void 0),this.boolean(r(this,Ct,"f")),this.describe(r(this,Ct,"f"),e),this}wrap(t){return j("<number|null|undefined>",[t],arguments.length),r(this,z,"f").wrap(t),this}[(et=new WeakMap,Rt=new WeakMap,se=new WeakMap,ut=new WeakMap,lt=new WeakMap,pe=new WeakMap,It=new WeakMap,Ut=new WeakMap,me=new WeakMap,dt=new WeakMap,ge=new WeakMap,pt=new WeakMap,yt=new WeakMap,ft=new WeakMap,mt=new WeakMap,Xt=new WeakMap,st=new WeakMap,P=new WeakMap,be=new WeakMap,Oe=new WeakMap,ct=new WeakMap,Ht=new WeakMap,kt=new WeakMap,Yt=new WeakMap,$t=new WeakMap,_e=new WeakMap,W=new WeakMap,Tt=new WeakMap,Bt=new WeakMap,qt=new WeakMap,z=new WeakMap,Ct=new WeakMap,X=new WeakMap,Mn)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[In](){return{log:(...t)=>{this[we]()||console.log(...t),x(this,ft,!0,"f"),r(this,st,"f").length&&x(this,st,r(this,st,"f")+`
63
+ `,"f"),x(this,st,r(this,st,"f")+t.join(" "),"f")},error:(...t)=>{this[we]()||console.error(...t),x(this,ft,!0,"f"),r(this,st,"f").length&&x(this,st,r(this,st,"f")+`
64
+ `,"f"),x(this,st,r(this,st,"f")+t.join(" "),"f")}}}[We](t){Qt(r(this,P,"f")).forEach(e=>{if((i=>i==="configObjects")(e))return;let n=r(this,P,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete r(this,z,"f").getDescriptions()[t]}[$n](t,e,n){r(this,me,"f")[n]||(r(this,W,"f").process.emitWarning(t,e),r(this,me,"f")[n]=!0)}[Nn](){r(this,ge,"f").push({options:r(this,P,"f"),configObjects:r(this,P,"f").configObjects.slice(0),exitProcess:r(this,dt,"f"),groups:r(this,yt,"f"),strict:r(this,Tt,"f"),strictCommands:r(this,Bt,"f"),strictOptions:r(this,qt,"f"),completionCommand:r(this,lt,"f"),output:r(this,st,"f"),exitError:r(this,It,"f"),hasOutput:r(this,ft,"f"),parsed:this.parsed,parseFn:r(this,ct,"f"),parseContext:r(this,Ht,"f")}),r(this,z,"f").freeze(),r(this,X,"f").freeze(),r(this,et,"f").freeze(),r(this,pt,"f").freeze()}[Fn](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(r(this,W,"f").process.argv()[0])?e=r(this,W,"f").process.argv().slice(1,2):e=r(this,W,"f").process.argv().slice(0,1),t=e.map(n=>{let i=this[Bn](r(this,Rt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),r(this,W,"f").getEnv("_")&&r(this,W,"f").getProcessArgvBin()===r(this,W,"f").getEnv("_")&&(t=r(this,W,"f").getEnv("_").replace(`${r(this,W,"f").path.dirname(r(this,W,"f").process.execPath())}/`,"")),t}[Vt](){return r(this,Oe,"f")}[Le](){if(!r(this,Ut,"f"))return;let t=r(this,W,"f").getEnv("LC_ALL")||r(this,W,"f").getEnv("LC_MESSAGES")||r(this,W,"f").getEnv("LANG")||r(this,W,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Wn](){return this[ze]().version||"unknown"}[Ln](t){let e=t["--"]?t["--"]:t._;for(let n=0,i;(i=e[n])!==void 0;n++)r(this,W,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(e[n]=Number(i));return t}[ze](t){let e=t||"*";if(r(this,kt,"f")[e])return r(this,kt,"f")[e];let n={};try{let i=t||r(this,W,"f").mainFilename;!t&&r(this,W,"f").path.extname(i)&&(i=r(this,W,"f").path.dirname(i));let o=r(this,W,"f").findUp(i,(a,f)=>{if(f.includes("package.json"))return"package.json"});ot(o,void 0,r(this,W,"f")),n=JSON.parse(r(this,W,"f").readFileSync(o,"utf8"))}catch{}return r(this,kt,"f")[e]=n||{},r(this,kt,"f")[e]}[Nt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Re](n),r(this,P,"f")[t].push(n)})}[te](t,e,n,i){this[ve](t,e,n,i,(o,a,f)=>{r(this,P,"f")[o][a]=f})}[De](t,e,n,i){this[ve](t,e,n,i,(o,a,f)=>{r(this,P,"f")[o][a]=(r(this,P,"f")[o][a]||[]).concat(f)})}[ve](t,e,n,i,o){if(Array.isArray(n))n.forEach(a=>{t(a,i)});else if((a=>typeof a=="object")(n))for(let a of Qt(n))t(a,n[a]);else o(e,this[Re](n),i)}[Re](t){return t==="__proto__"?"___proto___":t}[Ue](t,e){return this[te](this[Ue].bind(this),"key",t,e),this}[He](){var t,e,n,i,o,a,f,g,O,b,c,m;let w=r(this,ge,"f").pop();ot(w,void 0,r(this,W,"f"));let M;t=this,e=this,n=this,i=this,o=this,a=this,f=this,g=this,O=this,b=this,c=this,m=this,{options:{set value(y){x(t,P,y,"f")}}.value,configObjects:M,exitProcess:{set value(y){x(e,dt,y,"f")}}.value,groups:{set value(y){x(n,yt,y,"f")}}.value,output:{set value(y){x(i,st,y,"f")}}.value,exitError:{set value(y){x(o,It,y,"f")}}.value,hasOutput:{set value(y){x(a,ft,y,"f")}}.value,parsed:this.parsed,strict:{set value(y){x(f,Tt,y,"f")}}.value,strictCommands:{set value(y){x(g,Bt,y,"f")}}.value,strictOptions:{set value(y){x(O,qt,y,"f")}}.value,completionCommand:{set value(y){x(b,lt,y,"f")}}.value,parseFn:{set value(y){x(c,ct,y,"f")}}.value,parseContext:{set value(y){x(m,Ht,y,"f")}}.value}=w,r(this,P,"f").configObjects=M,r(this,z,"f").unfreeze(),r(this,X,"f").unfreeze(),r(this,et,"f").unfreeze(),r(this,pt,"f").unfreeze()}[zn](t,e){return vt(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Dn].bind(this),getContext:this[vn].bind(this),getHasOutput:this[Rn].bind(this),getLoggerInstance:this[Un].bind(this),getParseContext:this[Hn].bind(this),getParserConfiguration:this[Vt].bind(this),getUsageInstance:this[Yn].bind(this),getValidationInstance:this[Tn].bind(this),hasParseCallback:this[we].bind(this),postProcess:this[Gt].bind(this),reset:this[Ye].bind(this),runValidation:this[Te].bind(this),runYargsParserAndExecuteCommands:this[re].bind(this),setHasOutput:this[qn].bind(this)}}[Dn](){return r(this,et,"f")}[vn](){return r(this,se,"f")}[Rn](){return r(this,ft,"f")}[Un](){return r(this,Xt,"f")}[Hn](){return r(this,Ht,"f")||{}}[Yn](){return r(this,z,"f")}[Tn](){return r(this,X,"f")}[we](){return!!r(this,ct,"f")}[Gt](t,e,n,i){return n||K(t)||(e||(t=this[Mn](t)),(this[Vt]()["parse-positional-numbers"]||this[Vt]()["parse-positional-numbers"]===void 0)&&(t=this[Ln](t)),i&&(t=Dt(t,this,r(this,pt,"f").getMiddleware(),!1))),t}[Ye](t={}){x(this,P,r(this,P,"f")||{},"f");let e={};e.local=r(this,P,"f").local||[],e.configObjects=r(this,P,"f").configObjects||[];let n={};e.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(f=>{n[f]=!0})}),Object.assign(r(this,Yt,"f"),Object.keys(r(this,yt,"f")).reduce((a,f)=>{let g=r(this,yt,"f")[f].filter(O=>!(O in n));return g.length>0&&(a[f]=g),a},{})),x(this,yt,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],o=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(a=>{e[a]=(r(this,P,"f")[a]||[]).filter(f=>!n[f])}),o.forEach(a=>{e[a]=Pt(r(this,P,"f")[a],f=>!n[f])}),e.envPrefix=r(this,P,"f").envPrefix,x(this,P,e,"f"),x(this,z,r(this,z,"f")?r(this,z,"f").reset(n):wn(this,r(this,W,"f")),"f"),x(this,X,r(this,X,"f")?r(this,X,"f").reset(n):Sn(this,r(this,z,"f"),r(this,W,"f")),"f"),x(this,et,r(this,et,"f")?r(this,et,"f").reset():bn(r(this,z,"f"),r(this,X,"f"),r(this,pt,"f"),r(this,W,"f")),"f"),r(this,ut,"f")||x(this,ut,jn(this,r(this,z,"f"),r(this,et,"f"),r(this,W,"f")),"f"),r(this,pt,"f").reset(),x(this,lt,null,"f"),x(this,st,"","f"),x(this,It,null,"f"),x(this,ft,!1,"f"),this.parsed=!1,this}[Bn](t,e){return r(this,W,"f").path.relative(t,e)}[re](t,e,n,i=0,o=!1){let a=!!n||o;t=t||r(this,$t,"f"),r(this,P,"f").__=r(this,W,"f").y18n.__,r(this,P,"f").configuration=this[Vt]();let f=!!r(this,P,"f").configuration["populate--"],g=Object.assign({},r(this,P,"f").configuration,{"populate--":!0}),O=r(this,W,"f").Parser.detailed(t,Object.assign({},r(this,P,"f"),{configuration:{"parse-positional-numbers":!1,...g}})),b=Object.assign(O.argv,r(this,Ht,"f")),c,m=O.aliases,w=!1,M=!1;Object.keys(b).forEach(y=>{y===r(this,mt,"f")&&b[y]?w=!0:y===r(this,Ct,"f")&&b[y]&&(M=!0)}),b.$0=this.$0,this.parsed=O,i===0&&r(this,z,"f").clearCachedHelpMessage();try{if(this[Le](),e)return this[Gt](b,f,!!n,!1);r(this,mt,"f")&&[r(this,mt,"f")].concat(m[r(this,mt,"f")]||[]).filter(Y=>Y.length>1).includes(""+b._[b._.length-1])&&(b._.pop(),w=!0);let y=r(this,et,"f").getCommands(),d=r(this,ut,"f").completionKey in b,D=w||d||o;if(b._.length){if(y.length){let R;for(let Y=i||0,H;b._[Y]!==void 0;Y++)if(H=String(b._[Y]),y.includes(H)&&H!==r(this,lt,"f")){let T=r(this,et,"f").runCommand(H,this,O,Y+1,o,w||M||o);return this[Gt](T,f,!!n,!1)}else if(!R&&H!==r(this,lt,"f")){R=H;break}!r(this,et,"f").hasDefaultCommand()&&r(this,_e,"f")&&R&&!D&&r(this,X,"f").recommendCommands(R,y)}r(this,lt,"f")&&b._.includes(r(this,lt,"f"))&&!d&&(r(this,dt,"f")&&Mt(!0),this.showCompletionScript(),this.exit(0))}if(r(this,et,"f").hasDefaultCommand()&&!D){let R=r(this,et,"f").runCommand(null,this,O,0,o,w||M||o);return this[Gt](R,f,!!n,!1)}if(d){r(this,dt,"f")&&Mt(!0),t=[].concat(t);let R=t.slice(t.indexOf(`--${r(this,ut,"f").completionKey}`)+1);return r(this,ut,"f").getCompletion(R,(Y,H)=>{if(Y)throw new V(Y.message);(H||[]).forEach(T=>{r(this,Xt,"f").log(T)}),this.exit(0)}),this[Gt](b,!f,!!n,!1)}if(r(this,ft,"f")||(w?(r(this,dt,"f")&&Mt(!0),a=!0,this.showHelp("log"),this.exit(0)):M&&(r(this,dt,"f")&&Mt(!0),a=!0,r(this,z,"f").showVersion("log"),this.exit(0))),!a&&r(this,P,"f").skipValidation.length>0&&(a=Object.keys(b).some(R=>r(this,P,"f").skipValidation.indexOf(R)>=0&&b[R]===!0)),!a){if(O.error)throw new V(O.error.message);if(!d){let R=this[Te](m,{},O.error);n||(c=Dt(b,this,r(this,pt,"f").getMiddleware(),!0)),c=this[zn](R,c??b),K(c)&&!n&&(c=c.then(()=>Dt(b,this,r(this,pt,"f").getMiddleware(),!1)))}}}catch(y){if(y instanceof V)r(this,z,"f").fail(y.message,y);else throw y}return this[Gt](c??b,f,!!n,!0)}[Te](t,e,n,i){let o={...this.getDemandedOptions()};return a=>{if(n)throw new V(n.message);r(this,X,"f").nonOptionCount(a),r(this,X,"f").requiredArguments(a,o);let f=!1;r(this,Bt,"f")&&(f=r(this,X,"f").unknownCommands(a)),r(this,Tt,"f")&&!f?r(this,X,"f").unknownArguments(a,t,e,!!i):r(this,qt,"f")&&r(this,X,"f").unknownArguments(a,t,{},!1,!1),r(this,X,"f").limitedChoices(a),r(this,X,"f").implications(a),r(this,X,"f").conflicting(a)}}[qn](){x(this,ft,!0,"f")}[Kt](t){if(typeof t=="string")r(this,P,"f").key[t]=!0;else for(let e of t)r(this,P,"f").key[e]=!0}};function On(s){return!!s&&typeof s.getInternalMethods=="function"}var Ti=Vn(Pe),Kn=Ti;var Bi=s=>{let t={...s};return Object.values(s).forEach(e=>typeof e=="number"&&delete t[e]),t},Jn=s=>Object.keys(Bi(s));async function Gi(){let s=await Kn(Se(process.argv)).help(!1).version(!1).option("log",{choices:Jn(Be)}).argv,t=Be[s.log??"INFO"],e={...JSON.parse(s._[0]??"{}"),log:new qi(t)};t>Be.INFO&&console.log(`OPTIONS:
65
+ `,JSON.stringify(e,null,2));let n=new Vi(e);try{await n.startServer()}catch(i){n.log.error(i),process.exitCode=1,await n.dispose()}}await Gi();
66
+ /**
67
+ * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
68
+ * CJS and ESM environments.
69
+ *
70
+ * @license
71
+ * Copyright (c) 2016, Contributors
72
+ * SPDX-License-Identifier: ISC
73
+ */
74
+ /**
75
+ * @license
76
+ * Copyright (c) 2016, Contributors
77
+ * SPDX-License-Identifier: ISC
78
+ */
79
+ //# sourceMappingURL=index.mjs.map