@willbooster/wb 5.1.0 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -30,5 +30,5 @@ let T;!function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARR
|
|
|
30
30
|
* Copyright (c) 2016, Contributors
|
|
31
31
|
* SPDX-License-Identifier: ISC
|
|
32
32
|
*/
|
|
33
|
-
var H,q,Y;const J=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,G=null!==(q=null===(H=null===process||void 0===process?void 0:process.versions)||void 0===H?void 0:H.node)&&void 0!==q?q:null===(Y=null===process||void 0===process?void 0:process.version)||void 0===Y?void 0:Y.slice(1);if(G){if(Number(G.match(/^([^.]+)/)[1])<J)throw Error(`yargs parser supports a minimum Node.js version of ${J}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`)}const K=process?process.env:{},Q=new class{constructor(t){T=t}parse(t,e){const s=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),n=function(t){if(Array.isArray(t))return t.map((t=>"string"!=typeof t?t+"":t));t=t.trim();let e=0,s=null,n=null,i=null;const r=[];for(let o=0;o<t.length;o++)s=n,n=t.charAt(o)," "!==n||i?(n===i?i=null:"'"!==n&&'"'!==n||i||(i=n),r[e]||(r[e]=""),r[e]+=n):" "!==s&&e++;return r}(t),i="string"==typeof t,r=function(t){const e=[],s=Object.create(null);let n=!0;Object.keys(t).forEach((function(s){e.push([].concat(t[s],s))}));for(;n;){n=!1;for(let t=0;t<e.length;t++)for(let s=t+1;s<e.length;s++){if(e[t].filter((function(t){return-1!==e[s].indexOf(t)})).length){e[t]=e[t].concat(e[s]),e.splice(s,1),n=!0;break}}}return e.forEach((function(t){const e=(t=t.filter((function(t,e,s){return s.indexOf(t)===e}))).pop();void 0!==e&&"string"==typeof e&&(s[e]=t)})),s}(Object.assign(Object.create(null),s.alias)),o=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},s.configuration),a=Object.assign(Object.create(null),s.default),c=s.configObjects||[],l=s.envPrefix,h=o["populate--"],d=h?"--":"_",u=Object.create(null),f=Object.create(null),p=s.__||T.format,g={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:[]},m=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,y=new RegExp("^--"+o["negation-prefix"]+"(.+)");[].concat(s.array||[]).filter(Boolean).forEach((function(t){const e="object"==typeof t?t.key:t,s=Object.keys(t).map((function(t){return{boolean:"bools",string:"strings",number:"numbers"}[t]})).filter(Boolean).pop();s&&(g[s][e]=!0),g.arrays[e]=!0,g.keys.push(e)})),[].concat(s.boolean||[]).filter(Boolean).forEach((function(t){g.bools[t]=!0,g.keys.push(t)})),[].concat(s.string||[]).filter(Boolean).forEach((function(t){g.strings[t]=!0,g.keys.push(t)})),[].concat(s.number||[]).filter(Boolean).forEach((function(t){g.numbers[t]=!0,g.keys.push(t)})),[].concat(s.count||[]).filter(Boolean).forEach((function(t){g.counts[t]=!0,g.keys.push(t)})),[].concat(s.normalize||[]).filter(Boolean).forEach((function(t){g.normalize[t]=!0,g.keys.push(t)})),"object"==typeof s.narg&&Object.entries(s.narg).forEach((([t,e])=>{"number"==typeof e&&(g.nargs[t]=e,g.keys.push(t))})),"object"==typeof s.coerce&&Object.entries(s.coerce).forEach((([t,e])=>{"function"==typeof e&&(g.coercions[t]=e,g.keys.push(t))})),void 0!==s.config&&(Array.isArray(s.config)||"string"==typeof s.config?[].concat(s.config).filter(Boolean).forEach((function(t){g.configs[t]=!0})):"object"==typeof s.config&&Object.entries(s.config).forEach((([t,e])=>{"boolean"!=typeof e&&"function"!=typeof e||(g.configs[t]=e)}))),function(...t){t.forEach((function(t){Object.keys(t||{}).forEach((function(t){g.aliases[t]||(g.aliases[t]=[].concat(r[t]||[]),g.aliases[t].concat(t).forEach((function(e){if(/-/.test(e)&&o["camel-case-expansion"]){const s=z(e);s!==t&&-1===g.aliases[t].indexOf(s)&&(g.aliases[t].push(s),u[s]=!0)}})),g.aliases[t].concat(t).forEach((function(e){if(e.length>1&&/[A-Z]/.test(e)&&o["camel-case-expansion"]){const s=F(e,"-");s!==t&&-1===g.aliases[t].indexOf(s)&&(g.aliases[t].push(s),u[s]=!0)}})),g.aliases[t].forEach((function(e){g.aliases[e]=[t].concat(g.aliases[t].filter((function(t){return e!==t})))})))}))}))}(s.key,r,s.default,g.arrays),Object.keys(a).forEach((function(t){(g.aliases[t]||[]).forEach((function(e){a[e]=a[t]}))}));let b=null;Object.keys(g.counts).find((t=>D(t,g.arrays)?(b=Error(p("Invalid configuration: %s, opts.count excludes opts.array.",t)),!0):!!D(t,g.nargs)&&(b=Error(p("Invalid configuration: %s, opts.count excludes opts.narg.",t)),!0)));let w=[];const v=Object.assign(Object.create(null),{_:[]}),O={};for(let t=0;t<n.length;t++){const e=n[t],s=e.replace(/^-{3,}/,"---");let i,r,a,c,l,h;if("--"!==e&&/^-/.test(e)&&W(e))k(e);else{if(s.match(/^---+(=|$)/)){k(e);continue}if(e.match(/^--.+=/)||!o["short-option-groups"]&&e.match(/^-.+=/))c=e.match(/^--?([^=]+)=([\s\S]*)$/),null!==c&&Array.isArray(c)&&c.length>=3&&(D(c[1],g.arrays)?t=A(t,c[1],n,c[2]):!1!==D(c[1],g.nargs)?t=E(t,c[1],n,c[2]):_(c[1],c[2],!0));else if(e.match(y)&&o["boolean-negation"])c=e.match(y),null!==c&&Array.isArray(c)&&c.length>=2&&(r=c[1],_(r,!!D(r,g.arrays)&&[!1]));else if(e.match(/^--.+/)||!o["short-option-groups"]&&e.match(/^-[^-]+/))c=e.match(/^--?(.+)/),null!==c&&Array.isArray(c)&&c.length>=2&&(r=c[1],D(r,g.arrays)?t=A(t,r,n):!1!==D(r,g.nargs)?t=E(t,r,n):(l=n[t+1],void 0===l||l.match(/^-/)&&!l.match(m)||D(r,g.bools)||D(r,g.counts)?/^(true|false)$/.test(l)?(_(r,l),t++):_(r,R(r)):(_(r,l),t++)));else if(e.match(/^-.\..+=/))c=e.match(/^-([^=]+)=([\s\S]*)$/),null!==c&&Array.isArray(c)&&c.length>=3&&_(c[1],c[2]);else if(e.match(/^-.\..+/)&&!e.match(m))l=n[t+1],c=e.match(/^-(.\..+)/),null!==c&&Array.isArray(c)&&c.length>=2&&(r=c[1],void 0===l||l.match(/^-/)||D(r,g.bools)||D(r,g.counts)?_(r,R(r)):(_(r,l),t++));else if(e.match(/^-[^-]+/)&&!e.match(m)){a=e.slice(1,-1).split(""),i=!1;for(let s=0;s<a.length;s++){if(l=e.slice(s+2),a[s+1]&&"="===a[s+1]){h=e.slice(s+3),r=a[s],D(r,g.arrays)?t=A(t,r,n,h):!1!==D(r,g.nargs)?t=E(t,r,n,h):_(r,h),i=!0;break}if("-"!==l){if(/[A-Za-z]/.test(a[s])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(l)&&!1===D(l,g.bools)){_(a[s],l),i=!0;break}if(a[s+1]&&a[s+1].match(/\W/)){_(a[s],l),i=!0;break}_(a[s],R(a[s]))}else _(a[s],l)}r=e.slice(-1)[0],i||"-"===r||(D(r,g.arrays)?t=A(t,r,n):!1!==D(r,g.nargs)?t=E(t,r,n):(l=n[t+1],void 0===l||/^(-|--)[^-]/.test(l)&&!l.match(m)||D(r,g.bools)||D(r,g.counts)?/^(true|false)$/.test(l)?(_(r,l),t++):_(r,R(r)):(_(r,l),t++)))}else if(e.match(/^-[0-9]$/)&&e.match(m)&&D(e.slice(1),g.bools))r=e.slice(1),_(r,R(r));else{if("--"===e){w=n.slice(t+1);break}if(o["halt-at-non-option"]){w=n.slice(t);break}k(e)}}}function k(t){const e=x("_",t);"string"!=typeof e&&"number"!=typeof e||v._.push(e)}function E(t,e,s,n){let i,r=D(e,g.nargs);if(r="number"!=typeof r||isNaN(r)?1:r,0===r)return H(n)||(b=Error(p("Argument unexpected for: %s",e))),_(e,R(e)),t;let a=H(n)?0:1;if(o["nargs-eats-options"])s.length-(t+1)+a<r&&(b=Error(p("Not enough arguments following: %s",e))),a=r;else{for(i=t+1;i<s.length&&(!s[i].match(/^-[^0-9]/)||s[i].match(m)||W(s[i]));i++)a++;a<r&&(b=Error(p("Not enough arguments following: %s",e)))}let c=Math.min(a,r);for(!H(n)&&c>0&&(_(e,n),c--),i=t+1;i<c+t+1;i++)_(e,s[i]);return t+c}function A(t,e,s,n){let r=[],c=n||s[t+1];const l=D(e,g.nargs);if(D(e,g.bools)&&!/^(true|false)$/.test(c))r.push(!0);else if(H(c)||H(n)&&/^-/.test(c)&&!m.test(c)&&!W(c)){if(void 0!==a[e]){const t=a[e];r=Array.isArray(t)?t:[t]}}else{H(n)||r.push(j(e,n,!0));for(let n=t+1;n<s.length&&!(!o["greedy-arrays"]&&r.length>0||l&&"number"==typeof l&&r.length>=l)&&(c=s[n],!/^-/.test(c)||m.test(c)||W(c));n++)t=n,r.push(j(e,c,i))}return"number"==typeof l&&(l&&r.length<l||isNaN(l)&&0===r.length)&&(b=Error(p("Not enough arguments following: %s",e))),_(e,r),t}function _(t,e,s=i){if(/-/.test(t)&&o["camel-case-expansion"]){const e=t.split(".").map((function(t){return z(t)})).join(".");$(t,e)}const n=j(t,e,s),r=t.split(".");if(M(v,r,n),g.aliases[t]&&g.aliases[t].forEach((function(t){const e=t.split(".");M(v,e,n)})),r.length>1&&o["dot-notation"]&&(g.aliases[r[0]]||[]).forEach((function(e){let s=e.split(".");const i=[].concat(r);i.shift(),s=s.concat(i),(g.aliases[t]||[]).includes(s.join("."))||M(v,s,n)})),D(t,g.normalize)&&!D(t,g.arrays)){[t].concat(g.aliases[t]||[]).forEach((function(t){Object.defineProperty(O,t,{enumerable:!0,get:()=>e,set(t){e="string"==typeof t?T.normalize(t):t}})}))}}function $(t,e){g.aliases[t]&&g.aliases[t].length||(g.aliases[t]=[e],u[e]=!0),g.aliases[e]&&g.aliases[e].length||$(e,t)}function j(t,e,s){s&&(e=function(t){return"string"!=typeof t||"'"!==t[0]&&'"'!==t[0]||t[t.length-1]!==t[0]?t:t.substring(1,t.length-1)}(e)),(D(t,g.bools)||D(t,g.counts))&&"string"==typeof e&&(e="true"===e);let n=Array.isArray(e)?e.map((function(e){return x(t,e)})):x(t,e);return D(t,g.counts)&&(H(n)||"boolean"==typeof n)&&(n=V()),D(t,g.normalize)&&D(t,g.arrays)&&(n=Array.isArray(e)?e.map((t=>T.normalize(t))):T.normalize(e)),n}function x(t,e){if(!o["parse-positional-numbers"]&&"_"===t)return e;if(!D(t,g.strings)&&!D(t,g.bools)&&!Array.isArray(e)){(B(e)&&o["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${e}`)))||!H(e)&&D(t,g.numbers))&&(e=Number(e))}return e}function C(t,e){Object.keys(t).forEach((function(s){const n=t[s],i=e?e+"."+s:s;"object"==typeof n&&null!==n&&!Array.isArray(n)&&o["dot-notation"]?C(n,i):(!N(v,i.split("."))||D(i,g.arrays)&&o["combine-arrays"])&&_(i,n)}))}function P(t,e){if(void 0===l)return;const s="string"==typeof l?l:"",n=T.env();Object.keys(n).forEach((function(i){if(""===s||0===i.lastIndexOf(s,0)){const r=i.split("__").map((function(t,e){return 0===e&&(t=t.substring(s.length)),z(t)}));(e&&g.configs[r.join(".")]||!e)&&!N(t,r)&&_(r.join("."),n[i])}}))}function S(t,e,s,n=!1){Object.keys(s).forEach((function(i){N(t,i.split("."))||(M(t,i.split("."),s[i]),n&&(f[i]=!0),(e[i]||[]).forEach((function(e){N(t,e.split("."))||M(t,e.split("."),s[i])})))}))}function N(t,e){let s=t;o["dot-notation"]||(e=[e.join(".")]),e.slice(0,-1).forEach((function(t){s=s[t]||{}}));const n=e[e.length-1];return"object"==typeof s&&n in s}function M(t,e,s){let n=t;o["dot-notation"]||(e=[e.join(".")]),e.slice(0,-1).forEach((function(t){t=U(t),"object"==typeof n&&void 0===n[t]&&(n[t]={}),"object"!=typeof n[t]||Array.isArray(n[t])?(Array.isArray(n[t])?n[t].push({}):n[t]=[n[t],{}],n=n[t][n[t].length-1]):n=n[t]}));const i=U(e[e.length-1]),r=D(e.join("."),g.arrays),a=Array.isArray(s);let c=o["duplicate-arguments-array"];!c&&D(i,g.nargs)&&(c=!0,(!H(n[i])&&1===g.nargs[i]||Array.isArray(n[i])&&n[i].length===g.nargs[i])&&(n[i]=void 0)),s===V()?n[i]=V(n[i]):Array.isArray(n[i])?c&&r&&a?n[i]=o["flatten-duplicate-arrays"]?n[i].concat(s):(Array.isArray(n[i][0])?n[i]:[n[i]]).concat([s]):c||Boolean(r)!==Boolean(a)?n[i]=n[i].concat([s]):n[i]=s:void 0===n[i]&&r?n[i]=a?s:[s]:!c||void 0===n[i]||D(i,g.counts)||D(i,g.bools)?n[i]=s:n[i]=[n[i],s]}function D(t,e){const s=[].concat(g.aliases[t]||[],t),n=Object.keys(e),i=s.find((t=>n.includes(t)));return!!i&&e[i]}function I(t){const e=Object.keys(g);return[].concat(e.map((t=>g[t]))).some((function(e){return Array.isArray(e)?e.includes(t):e[t]}))}function W(t){return o["unknown-options-as-args"]&&function(t){if(t=t.replace(/^-{3,}/,"--"),t.match(m))return!1;if(function(t){if(t.match(m)||!t.match(/^-[^-]+/))return!1;let e,s=!0;const n=t.slice(1).split("");for(let i=0;i<n.length;i++){if(e=t.slice(i+2),!I(n[i])){s=!1;break}if(n[i+1]&&"="===n[i+1]||"-"===e||/[A-Za-z]/.test(n[i])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(e)||n[i+1]&&n[i+1].match(/\W/))break}return s}(t))return!1;return!function(t,...e){return[].concat(...e).some((function(e){const s=t.match(e);return s&&I(s[1])}))}(t,/^-+([^=]+?)=[\s\S]*$/,y,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}(t)}function R(t){return D(t,g.bools)||D(t,g.counts)||!(`${t}`in a)?(e=function(t){let e=L.BOOLEAN;return D(t,g.strings)?e=L.STRING:D(t,g.numbers)?e=L.NUMBER:D(t,g.bools)?e=L.BOOLEAN:D(t,g.arrays)&&(e=L.ARRAY),e}(t),{[L.BOOLEAN]:!0,[L.STRING]:"",[L.NUMBER]:void 0,[L.ARRAY]:[]}[e]):a[t];var e}function H(t){return void 0===t}return P(v,!0),P(v,!1),function(t){const e=Object.create(null);S(e,g.aliases,a),Object.keys(g.configs).forEach((function(s){const n=t[s]||e[s];if(n)try{let t=null;const e=T.resolve(T.cwd(),n),i=g.configs[s];if("function"==typeof i){try{t=i(e)}catch(e){t=e}if(t instanceof Error)return void(b=t)}else t=T.require(e);C(t)}catch(e){"PermissionDenied"===e.name?b=e:t[s]&&(b=Error(p("Invalid JSON config file: %s",n)))}}))}(v),void 0!==c&&c.forEach((function(t){C(t)})),S(v,g.aliases,a,!0),function(t){let e;const s=new Set;Object.keys(t).forEach((function(n){if(!s.has(n)&&(e=D(n,g.coercions),"function"==typeof e))try{const i=x(n,e(t[n]));[].concat(g.aliases[n]||[],n).forEach((e=>{s.add(e),t[e]=i}))}catch(t){b=t}}))}(v),o["set-placeholder-key"]&&function(t){g.keys.forEach((e=>{~e.indexOf(".")||void 0===t[e]&&(t[e]=void 0)}))}(v),Object.keys(g.counts).forEach((function(t){N(v,t.split("."))||_(t,0)})),h&&w.length&&(v[d]=[]),w.forEach((function(t){v[d].push(t)})),o["camel-case-expansion"]&&o["strip-dashed"]&&Object.keys(v).filter((t=>"--"!==t&&t.includes("-"))).forEach((t=>{delete v[t]})),o["strip-aliased"]&&[].concat(...Object.keys(r).map((t=>r[t]))).forEach((t=>{o["camel-case-expansion"]&&t.includes("-")&&delete v[t.split(".").map((t=>z(t))).join(".")],delete v[t]})),{aliases:Object.assign({},g.aliases),argv:Object.assign(O,v),configuration:o,defaulted:Object.assign({},f),error:b,newAliases:Object.assign({},u)}}}({cwd:process.cwd,env:()=>K,format:p,normalize:n,resolve:e,require:t=>{if("undefined"!=typeof require)return require(t);if(t.match(/\.json$/))return JSON.parse(u(t,"utf8"));throw Error("only .json config files are supported in ESM")}}),X=function(t,e){return Q.parse(t.slice(),e).argv};function Z(){return process.versions.electron&&!process.defaultApp?0:1}X.detailed=function(t,e){return Q.parse(t.slice(),e)},X.camelCase=z,X.decamelize=F,X.looksLikeNumber=B;class tt extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,tt)}}var et={fs:{readFileSync:u,writeFile:f},format:p,resolve:e,exists:t=>{try{return h(t).isFile()}catch(t){return!1}}};let st;class nt{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles="boolean"!=typeof t.updateFiles||t.updateFiles,this.locale=t.locale||"en",this.fallbackToLanguage="boolean"!=typeof t.fallbackToLanguage||t.fallbackToLanguage,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if("string"!=typeof arguments[0])return this._taggedLiteral(arguments[0],...arguments);const e=t.shift();let s=function(){};return"function"==typeof t[t.length-1]&&(s=t.pop()),s=s||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:s})):s(),st.format.apply(st.format,[this.cache[this.locale][e]||e].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),e=t.shift(),s=t.shift(),n=t.shift();let i=function(){};"function"==typeof t[t.length-1]&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let r=1===n?e:s;if(this.cache[this.locale][e]){r=this.cache[this.locale][e][1===n?"one":"other"]}!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:s},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const o=[r];return~r.indexOf("%d")&&o.push(n),st.format.apply(st.format,o.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let s="";return t.forEach((function(t,n){const i=e[n+1];s+=t,void 0!==i&&(s+="%s")})),this.__.apply(this,[s].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),1===this.writeQueue.length&&this._processWriteQueue()}_processWriteQueue(){const t=this,e=this.writeQueue[0],s=e.directory,n=e.locale,i=e.cb,r=this._resolveLocaleFile(s,n),o=JSON.stringify(this.cache[n],null,2);st.fs.writeFile(r,o,"utf-8",(function(e){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(e)}))}_readLocaleFile(){let t={};const e=this._resolveLocaleFile(this.directory,this.locale);try{st.fs.readFileSync&&(t=JSON.parse(st.fs.readFileSync(e,"utf-8")))}catch(s){if(s instanceof SyntaxError&&(s.message="syntax error in "+e),"ENOENT"!==s.code)throw s;t={}}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let s=st.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(s)&&~e.lastIndexOf("_")){const n=st.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(n)&&(s=n)}return s}_fileExistsSync(t){return st.exists(t)}}const it="loading a directory of commands is not supported yet for ESM";let rt;try{rt=m(import.meta.url)}catch(t){rt=process.cwd()}var ot,at={assert:{notStrictEqual:a,strictEqual:c},cliui:function(t){return function(t,e){return D=e,new N({width:(null==t?void 0:t.width)||("object"==typeof process&&process.stdout&&process.stdout.columns?process.stdout.columns:80),wrap:null==t?void 0:t.wrap})}(t,{stringWidth:t=>[...t].length,stripAnsi:W,wrap:R})},findUp:function(t,n){let i,r=e(".",t);for(h(r).isDirectory()||(r=s(r));;){if(i=n(r,d(r)),i)return e(r,i);if(r=s(i=r),i===r)break}},getEnv:t=>process.env[t],inspect:g,getCallerFile:()=>{throw new tt(it)},getProcessArgvBin:function(){return process.argv[Z()]},mainFilename:rt.substring(0,rt.lastIndexOf("node_modules"))||process.cwd(),Parser:X,path:{basename:i,dirname:s,extname:r,relative:o,resolve:e},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:u,require:()=>{throw new tt("require is not supported by ESM")},requireDirectory:()=>{throw new tt(it)},stringWidth:t=>[...t].length,y18n:(ot={directory:e(rt,"../../../locales"),updateFiles:!1},function(t,e){st=e;const s=new nt(t);return{__:s.__.bind(s),__n:s.__n.bind(s),setLocale:s.setLocale.bind(s),getLocale:s.getLocale.bind(s),updateLocale:s.updateLocale.bind(s),locale:s.locale}}(ot,et))};function ct(t,e,s,n){s.assert.notStrictEqual(t,e,n)}function lt(t,e){e.assert.strictEqual(typeof t,"string")}function ht(t){return Object.keys(t)}function dt(t){return!!t&&!!t.then&&"function"==typeof t.then}function ut(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,n=e.shift();if(!n)throw new Error(`No command found in: ${t}`);const i={cmd:n.replace(s,""),demanded:[],optional:[]};return e.forEach(((t,n)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&n===e.length-1&&(r=!0),/^\[/.test(t)?i.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):i.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})})),i}const ft=["first","second","third","fourth","fifth","sixth"];function pt(t,e,s){try{let n=0;const[i,r,o]="object"==typeof t?[{demanded:[],optional:[]},t,e]:[ut(`cmd ${t}`),e,s],a=[].slice.call(r);for(;a.length&&void 0===a[a.length-1];)a.pop();const c=o||a.length;if(c<i.demanded.length)throw new tt(`Not enough arguments provided. Expected ${i.demanded.length} but received ${a.length}.`);const l=i.demanded.length+i.optional.length;if(c>l)throw new tt(`Too many arguments provided. Expected max ${l} but received ${c}.`);i.demanded.forEach((t=>{const e=gt(a.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&mt(e,t.cmd,n),n+=1})),i.optional.forEach((t=>{if(0===a.length)return;const e=gt(a.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&mt(e,t.cmd,n),n+=1}))}catch(t){console.warn(t.stack)}}function gt(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function mt(t,e,s){throw new tt(`Invalid ${ft[s]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}class yt{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,n=!1){if(pt("<array|function> [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let n=0;n<t.length;n++){if("function"!=typeof t[n])throw Error("middleware must be a function");const i=t[n];i.applyBeforeValidation=e,i.global=s}Array.prototype.push.apply(this.globalMiddleware,t)}else if("function"==typeof t){const i=t;i.applyBeforeValidation=e,i.global=s,i.mutates=n,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const s=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((t=>{const n=[...s[e]||[],e];return!t.option||!n.includes(t.option)})),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter((t=>t.global))}}function bt(t,e,s,n){return s.reduce(((t,s)=>{if(s.applyBeforeValidation!==n)return t;if(s.mutates){if(s.applied)return t;s.applied=!0}if(dt(t))return t.then((t=>Promise.all([t,s(t,e)]))).then((([t,e])=>Object.assign(t,e)));{const n=s(t,e);return dt(n)?n.then((e=>Object.assign(t,e))):Object.assign(t,n)}}),t)}function wt(t,e,s=(t=>{throw t})){try{const s="function"==typeof t?t():t;return dt(s)?s.then((t=>e(t))):e(s)}catch(t){return s(t)}}const vt=/(^\*)|(^\$0)/;class Ot{constructor(t,e,s,n){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=n,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,n){"boolean"!=typeof(n=n||{}).recurse&&(n.recurse=!1),Array.isArray(n.extensions)||(n.extensions=["js"]);const i="function"==typeof n.visit?n.visit:t=>t;n.visit=(t,e,s)=>{const n=i(t,e,s);if(n){if(this.requireCache.has(e))return n;this.requireCache.add(e),this.addHandler(n)}return n},this.shim.requireDirectory({require:e,filename:s},t,n)}addHandler(t,e,s,n,i,r){let o=[];const a=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(i);if(n=n||(()=>{}),Array.isArray(t))if(function(t){return t.every((t=>"string"==typeof t))}(t))[t,...o]=t;else for(const e of t)this.addHandler(e);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let e=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(e=[].concat(e).concat(t.aliases)),void this.addHandler(e,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(kt(s))return void this.addHandler([t].concat(o),e,s.builder,s.handler,s.middlewares,s.deprecated)}if("string"==typeof t){const i=ut(t);o=o.map((t=>ut(t).cmd));let c=!1;const l=[i.cmd].concat(o).filter((t=>!vt.test(t)||(c=!0,!1)));0===l.length&&c&&l.push("$0"),c&&(i.cmd=l[0],o=l.slice(1),t=t.replace(vt,i.cmd)),o.forEach((t=>{this.aliasMap[t]=i.cmd})),!1!==e&&this.usage.command(t,e,c,o,r),this.handlers[i.cmd]={original:t,description:e,handler:n,builder:s||{},middlewares:a,deprecated:r,demanded:i.demanded,optional:i.optional},c&&(this.defaultCommand=this.handlers[i.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,n,i,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,a=e.getInternalMethods().getContext(),c=a.commands.slice(),l=!t;t&&(a.commands.push(t),a.fullCommands.push(o.original));const h=this.applyBuilderUpdateUsageAndParse(l,o,e,s.aliases,c,n,i,r);return dt(h)?h.then((t=>this.applyMiddlewareAndGetResult(l,o,t.innerArgv,a,i,t.aliases,e))):this.applyMiddlewareAndGetResult(l,o,h.innerArgv,a,i,h.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,n,i,r,o,a){const c=e.builder;let l=s;if(Et(c)){s.getInternalMethods().getUsageInstance().freeze();const h=c(s.getInternalMethods().reset(n),a);if(dt(h))return h.then((n=>{var a;return l=(a=n)&&"function"==typeof a.getInternalMethods?n:s,this.parseAndUpdateUsage(t,e,l,i,r,o)}))}else(function(t){return"object"==typeof t})(c)&&(s.getInternalMethods().getUsageInstance().freeze(),l=s.getInternalMethods().reset(n),Object.keys(e.builder).forEach((t=>{l.option(t,c[t])})));return this.parseAndUpdateUsage(t,e,l,i,r,o)}parseAndUpdateUsage(t,e,s,n,i,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(n,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,r);return dt(o)?o.then((t=>({aliases:s.parsed.aliases,innerArgv:t}))):{aliases:s.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,e){const s=vt.test(e.original)?e.original.replace(vt,"").trim():e.original,n=t.filter((t=>!vt.test(t)));return n.push(s),`$0 ${n.join(" ")}`}handleValidationAndGetResult(t,e,s,n,i,r,o,a){if(!r.getInternalMethods().getHasOutput()){const e=r.getInternalMethods().runValidation(i,a,r.parsed.error,t);s=wt(s,(t=>(e(t),t)))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const n=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(s,n,!1,!1),s=wt(s=bt(s,r,o,!1),(t=>{const s=e.handler(t);return dt(s)?s.then((()=>t)):t})),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),dt(s)&&!r.getInternalMethods().hasParseCallback()&&s.catch((t=>{try{r.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}}))}return t||(n.commands.pop(),n.fullCommands.pop()),s}applyMiddlewareAndGetResult(t,e,s,n,i,r,o){let a={};if(i)return s;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(e,s,n,o));const c=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),l=bt(s,o,c,!0);return dt(l)?l.then((s=>this.handleValidationAndGetResult(t,e,s,n,r,o,c,a))):this.handleValidationAndGetResult(t,e,l,n,r,o,c,a)}populatePositionals(t,e,s,n){e._=e._.slice(s.commands.length);const i=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(i.length,e._.length);i.length;){const t=i.shift();this.populatePositional(t,e,o)}for(;r.length;){const t=r.shift();this.populatePositional(t,e,o)}return e._=s.commands.concat(e._.map((t=>""+t))),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),n),o}populatePositional(t,e,s){const n=t.cmd[0];t.variadic?s[n]=e._.splice(0).map(String):e._.length&&(s[n]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=ut(t);return s.demanded.forEach((t=>{const[s,...n]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=n,e.demand[s]=!0})),s.optional.forEach((t=>{const[s,...n]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=n})),e}postProcessPositionals(t,e,s,n){const i=Object.assign({},n.getOptions());i.default=Object.assign(s.default,i.default);for(const t of Object.keys(s.alias))i.alias[t]=(i.alias[t]||[]).concat(s.alias[t]);i.array=i.array.concat(s.array),i.config={};const r=[];if(Object.keys(e).forEach((t=>{e[t].map((e=>{i.configuration["unknown-options-as-args"]&&(i.key[t]=!0),r.push(`--${t}`),r.push(e)}))})),!r.length)return;const o=Object.assign({},i.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},i,{configuration:o}));if(a.error)n.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const s=Object.keys(e);Object.keys(e).forEach((t=>{s.push(...a.aliases[t])})),Object.keys(a.argv).forEach((i=>{s.includes(i)&&(e[i]||(e[i]=a.argv[i]),!this.isInConfigs(n,i)&&!this.isDefaulted(n,i)&&Object.prototype.hasOwnProperty.call(t,i)&&Object.prototype.hasOwnProperty.call(a.argv,i)&&(Array.isArray(t[i])||Array.isArray(a.argv[i]))?t[i]=[].concat(t[i],a.argv[i]):t[i]=a.argv[i])}))}}isDefaulted(t,e){const{default:s}=t.getOptions();return Object.prototype.hasOwnProperty.call(s,e)||Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:s}=t.getOptions();return s.some((t=>Object.prototype.hasOwnProperty.call(t,e)))||s.some((t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(e))))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const e=vt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(e,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(Et(e))return e(t,!0);kt(e)||Object.keys(e).forEach((s=>{t.option(s,e[s])}))}moduleName(t){const e=function(t){if("undefined"==typeof require)return null;for(let e,s=0,n=Object.keys(require.cache);s<n.length;s++)if(e=require.cache[n[s]],e.exports===t)return e;return null}(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:s}){for(const n of[t,e,s]){if("string"==typeof n||!1===n)return n;ct(n,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();ct(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 kt(t){return"object"==typeof t&&!!t.builder&&"function"==typeof t.handler}function Et(t){return"function"==typeof t}function At(t={},e=(()=>!0)){const s={};return ht(t).forEach((n=>{e(n,t[n])&&(s[n]=t[n])})),s}function _t(t){"undefined"!=typeof process&&[process.stdout,process.stderr].forEach((e=>{const s=e;s._handle&&s.isTTY&&"function"==typeof s._handle.setBlocking&&s._handle.setBlocking(t)}))}function $t(t){return"boolean"==typeof t}function jt(t,e){const s=e.y18n.__,n={},i=[];n.failFn=function(t){i.push(t)};let r=null,o=null,a=!0;n.showHelpOnFail=function(e=!0,s){const[i,c]="string"==typeof e?[!0,e]:[e,s];return t.getInternalMethods().isGlobalContext()&&(o=c),r=c,a=i,n};let c=!1;n.fail=function(e,s){const l=t.getInternalMethods().getLoggerInstance();if(!i.length){if(t.getExitProcess()&&_t(!0),!c){c=!0,a&&(t.showHelp("error"),l.error()),(e||s)&&l.error(e||s);const n=r||o;n&&((e||s)&&l.error(""),l.error(n))}if(s=s||new tt(e),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,s);throw s}for(let t=i.length-1;t>=0;--t){const r=i[t];if($t(r)){if(s)throw s;if(e)throw Error(e)}else r(e,s,n)}};let l=[],h=!1;n.usage=(t,e)=>null===t?(h=!0,l=[],n):(h=!1,l.push([t,e||""]),n),n.getUsage=()=>l,n.getUsageDisabled=()=>h,n.getPositionalGroupName=()=>s("Positionals:");let d=[];n.example=(t,e)=>{d.push([t,e||""])};let u=[];n.command=function(t,e,s,n,i=!1){s&&(u=u.map((t=>(t[2]=!1,t)))),u.push([t,e||"",s,n,i])},n.getCommands=()=>u;let f={};n.describe=function(t,e){Array.isArray(t)?t.forEach((t=>{n.describe(t,e)})):"object"==typeof t?Object.keys(t).forEach((e=>{n.describe(e,t[e])})):f[t]=e},n.getDescriptions=()=>f;let p=[];n.epilog=t=>{p.push(t)};let g,m=!1;n.wrap=t=>{m=!0,g=t},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(m||(g=function(){const t=80;return e.process.stdColumns?Math.min(t,e.process.stdColumns):t}(),m=!0),g);const y="__yargsString__:";function b(t,s,n){let i=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{i=Math.max(e.stringWidth(n?`${n} ${Pt(t[0])}`:Pt(t[0]))+Ct(t[0]),i)})),s&&(i=Math.min(i,parseInt((.5*s).toString(),10))),i}let w;function v(e){return t.getOptions().hiddenOptions.indexOf(e)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function O(t,e){let n=`[${s("default:")} `;if(void 0===t&&!e)return null;if(e)n+=e;else switch(typeof t){case"string":n+=`"${t}"`;break;case"object":n+=JSON.stringify(t);break;default:n+=t}return`${n}]`}n.deferY18nLookup=t=>y+t,n.help=function(){if(w)return w;!function(){const e=t.getDemandedOptions(),s=t.getOptions();(Object.keys(s.alias)||[]).forEach((i=>{s.alias[i].forEach((r=>{f[r]&&n.describe(i,f[r]),r in e&&t.demandOption(i,e[r]),s.boolean.includes(r)&&t.boolean(i),s.count.includes(r)&&t.count(i),s.string.includes(r)&&t.string(i),s.normalize.includes(r)&&t.normalize(i),s.array.includes(r)&&t.array(i),s.number.includes(r)&&t.number(i)}))}))}();const i=t.customScriptName?t.$0:e.path.basename(t.$0),r=t.getDemandedOptions(),o=t.getDemandedCommands(),a=t.getDeprecatedOptions(),c=t.getGroups(),g=t.getOptions();let m=[];m=m.concat(Object.keys(f)),m=m.concat(Object.keys(r)),m=m.concat(Object.keys(o)),m=m.concat(Object.keys(g.default)),m=m.filter(v),m=Object.keys(m.reduce(((t,e)=>("_"!==e&&(t[e]=!0),t)),{}));const k=n.getWrap(),E=e.cliui({width:k,wrap:!!k});if(!h)if(l.length)l.forEach((t=>{E.div({text:`${t[0].replace(/\$0/g,i)}`}),t[1]&&E.div({text:`${t[1]}`,padding:[1,0,0,0]})})),E.div();else if(u.length){let t=null;t=o._?`${i} <${s("command")}>\n`:`${i} [${s("command")}]\n`,E.div(`${t}`)}if(u.length>1||1===u.length&&!u[0][2]){E.div(s("Commands:"));const e=t.getInternalMethods().getContext(),n=e.commands.length?`${e.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(u=u.sort(((t,e)=>t[0].localeCompare(e[0]))));const r=i?`${i} `:"";u.forEach((t=>{const e=`${r}${n}${t[0].replace(/^\$0 ?/,"")}`;E.span({text:e,padding:[0,2,0,2],width:b(u,k,`${i}${n}`)+4},{text:t[1]});const o=[];t[2]&&o.push(`[${s("default")}]`),t[3]&&t[3].length&&o.push(`[${s("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?o.push(`[${s("deprecated: %s",t[4])}]`):o.push(`[${s("deprecated")}]`)),o.length?E.div({text:o.join(" "),padding:[0,0,0,2],align:"right"}):E.div()})),E.div()}const A=(Object.keys(g.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);m=m.filter((e=>!t.parsed.newAliases[e]&&A.every((t=>-1===(g.alias[t]||[]).indexOf(e)))));const _=s("Options:");c[_]||(c[_]=[]),function(t,e,s,n){let i=[],r=null;Object.keys(s).forEach((t=>{i=i.concat(s[t])})),t.forEach((t=>{r=[t].concat(e[t]),r.some((t=>-1!==i.indexOf(t)))||s[n].push(t)}))}(m,g.alias,c,_);const $=t=>/^--/.test(Pt(t)),j=Object.keys(c).filter((t=>c[t].length>0)).map((t=>({groupName:t,normalizedKeys:c[t].filter(v).map((t=>{if(A.includes(t))return t;for(let e,s=0;void 0!==(e=A[s]);s++)if((g.alias[e]||[]).includes(t))return e;return t}))}))).filter((({normalizedKeys:t})=>t.length>0)).map((({groupName:t,normalizedKeys:e})=>{const s=e.reduce(((e,s)=>(e[s]=[s].concat(g.alias[s]||[]).map((e=>t===n.getPositionalGroupName()?e:(/^[0-9]$/.test(e)?g.boolean.includes(s)?"-":"--":e.length>1?"--":"-")+e)).sort(((t,e)=>$(t)===$(e)?0:$(t)?1:-1)).join(", "),e)),{});return{groupName:t,normalizedKeys:e,switches:s}}));if(j.filter((({groupName:t})=>t!==n.getPositionalGroupName())).some((({normalizedKeys:t,switches:e})=>!t.every((t=>$(e[t])))))&&j.filter((({groupName:t})=>t!==n.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:e})=>{t.forEach((t=>{var s,n;$(e[t])&&(e[t]=(s=e[t],n=4,xt(s)?{text:s.text,indentation:s.indentation+n}:{text:s,indentation:n}))}))})),j.forEach((({groupName:e,normalizedKeys:i,switches:o})=>{E.div(e),i.forEach((e=>{const i=o[e];let c=f[e]||"",l=null;c.includes(y)&&(c=s(c.substring(16))),g.boolean.includes(e)&&(l=`[${s("boolean")}]`),g.count.includes(e)&&(l=`[${s("count")}]`),g.string.includes(e)&&(l=`[${s("string")}]`),g.normalize.includes(e)&&(l=`[${s("string")}]`),g.array.includes(e)&&(l=`[${s("array")}]`),g.number.includes(e)&&(l=`[${s("number")}]`);const h=[e in a?(d=a[e],"string"==typeof d?`[${s("deprecated: %s",d)}]`:`[${s("deprecated")}]`):null,l,e in r?`[${s("required")}]`:null,g.choices&&g.choices[e]?`[${s("choices:")} ${n.stringifiedValues(g.choices[e])}]`:null,O(g.default[e],g.defaultDescription[e])].filter(Boolean).join(" ");var d;E.span({text:Pt(i),padding:[0,2,0,2+Ct(i)],width:b(o,k)+4},c);const u=!0===t.getInternalMethods().getUsageConfiguration()["hide-types"];h&&!u?E.div({text:h,padding:[0,0,0,2],align:"right"}):E.div()})),E.div()})),d.length&&(E.div(s("Examples:")),d.forEach((t=>{t[0]=t[0].replace(/\$0/g,i)})),d.forEach((t=>{""===t[1]?E.div({text:t[0],padding:[0,2,0,2]}):E.div({text:t[0],padding:[0,2,0,2],width:b(d,k)+4},{text:t[1]})})),E.div()),p.length>0){const t=p.map((t=>t.replace(/\$0/g,i))).join("\n");E.div(`${t}\n`)}return E.toString().replace(/\s*$/,"")},n.cacheHelpMessage=function(){w=this.help()},n.clearCachedHelpMessage=function(){w=void 0},n.hasCachedHelpMessage=function(){return!!w},n.showHelp=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(n.help())},n.functionDescription=t=>["(",t.name?e.Parser.decamelize(t.name,"-"):s("generated-value"),")"].join(""),n.stringifiedValues=function(t,e){let s="";const n=e||", ",i=[].concat(t);return t&&i.length?(i.forEach((t=>{s.length&&(s+=n),s+=JSON.stringify(t)})),s):s};let k=null;n.version=t=>{k=t},n.showVersion=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(k)},n.reset=function(t){return r=null,c=!1,l=[],h=!1,p=[],d=[],u=[],f=At(f,(e=>!t[e])),n};const E=[];return n.freeze=function(){E.push({failMessage:r,failureOutput:c,usages:l,usageDisabled:h,epilogs:p,examples:d,commands:u,descriptions:f})},n.unfreeze=function(t=!1){const e=E.pop();e&&(t?(f={...e.descriptions,...f},u=[...e.commands,...u],l=[...e.usages,...l],d=[...e.examples,...d],p=[...e.epilogs,...p]):({failMessage:r,failureOutput:c,usages:l,usageDisabled:h,epilogs:p,examples:d,commands:u,descriptions:f}=e))},n}function xt(t){return"object"==typeof t}function Ct(t){return xt(t)?t.indentation:0}function Pt(t){return xt(t)?t.text:t}class St{constructor(t,e,s,n){var i,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=n,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(o=(null===(i=this.shim.getEnv("SHELL"))||void 0===i?void 0:i.includes("zsh"))||(null===(r=this.shim.getEnv("ZSH_NAME"))||void 0===r?void 0:r.includes("zsh")))&&void 0!==o&&o}defaultCompletion(t,e,s,n){const i=this.command.getCommandHandlers();for(let e=0,s=t.length;e<s;++e)if(i[t[e]]&&i[t[e]].builder){const s=i[t[e]].builder;if(Et(s)){this.indexAfterLastReset=e+1;const t=this.yargs.getInternalMethods().reset();return s(t,!0),t.argv}}const r=[];this.commandCompletions(r,t,s),this.optionCompletions(r,t,e,s),this.choicesFromOptionsCompletions(r,t,e,s),this.choicesFromPositionalsCompletions(r,t,e,s),n(null,r)}commandCompletions(t,e,s){const n=this.yargs.getInternalMethods().getContext().commands;s.match(/^-/)||n[n.length-1]===s||this.previousArgHasChoices(e)||this.usage.getCommands().forEach((s=>{const n=ut(s[0]).cmd;if(-1===e.indexOf(n))if(this.zshShell){const e=s[1]||"";t.push(n.replace(/:/g,"\\:")+":"+e)}else t.push(n)}))}optionCompletions(t,e,s,n){if((n.match(/^-/)||""===n&&0===t.length)&&!this.previousArgHasChoices(e)){const s=this.yargs.getOptions(),i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach((r=>{const o=!!s.configuration["boolean-negation"]&&s.boolean.includes(r);i.includes(r)||s.hiddenOptions.includes(r)||this.argsContainKey(e,r,o)||this.completeOptionKey(r,t,n,o&&!!s.default[r])}))}}choicesFromOptionsCompletions(t,e,s,n){if(this.previousArgHasChoices(e)){const s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s.map((t=>t.replace(/:/g,"\\:"))))}}choicesFromPositionalsCompletions(t,e,s,n){if(""===n&&t.length>0&&this.previousArgHasChoices(e))return;const i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=i[s._.length-r-1];if(!o)return;const a=this.yargs.getOptions().choices[o]||[];for(const e of a)e.startsWith(n)&&t.push(e.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],s="";if(!e.startsWith("-")&&t.length>1&&(s=e,e=t[t.length-2]),!e.startsWith("-"))return;const n=e.replace(/^-+/,""),i=this.yargs.getOptions(),r=[n,...this.yargs.getAliases()[n]||[]];let o;for(const t of r)if(Object.prototype.hasOwnProperty.call(i.key,t)&&Array.isArray(i.choices[t])){o=i.choices[t];break}return o?o.filter((t=>!s||t.startsWith(s))):void 0}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return void 0!==e&&e.length>0}argsContainKey(t,e,s){const n=e=>-1!==t.indexOf((/^[^0-9]$/.test(e)?"-":"--")+e);if(n(e))return!0;if(s&&n(`no-${e}`))return!0;if(this.aliases)for(const t of this.aliases[e])if(n(t))return!0;return!1}completeOptionKey(t,e,s,n){var i,r,o,a;let c=t;if(this.zshShell){const e=this.usage.getDescriptions(),s=null===(r=null===(i=null==this?void 0:this.aliases)||void 0===i?void 0:i[t])||void 0===r?void 0:r.find((t=>{const s=e[t];return"string"==typeof s&&s.length>0})),n=s?e[s]:void 0,l=null!==(a=null!==(o=e[t])&&void 0!==o?o:n)&&void 0!==a?a:"";c=`${t.replace(/:/g,"\\:")}:${l.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const l=!/^--/.test(s)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";e.push(l+c),n&&e.push(l+"no-"+c)}customCompletion(t,e,s,n){if(ct(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(s,e);return dt(t)?t.then((t=>{this.shim.process.nextTick((()=>{n(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{n(t,void 0)}))})):n(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,e,((i=n)=>this.defaultCompletion(t,e,s,i)),(t=>{n(null,t)})):this.customCompletionFunction(s,e,(t=>{n(null,t)}))}getCompletion(t,e){const s=t.length?t[t.length-1]:"",n=this.yargs.parse(t,!0),i=this.customCompletionFunction?n=>this.customCompletion(t,n,s,e):n=>this.defaultCompletion(t,n,s,e);return dt(n)?n.then(i):i(n)}generateCompletionScript(t,e){let s=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const n=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,n),s=s.replace(/{{completion_command}}/g,e),s.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function Nt(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let n,i;for(n=0;n<=e.length;n++)s[n]=[n];for(i=0;i<=t.length;i++)s[0][i]=i;for(n=1;n<=e.length;n++)for(i=1;i<=t.length;i++)e.charAt(n-1)===t.charAt(i-1)?s[n][i]=s[n-1][i-1]:n>1&&i>1&&e.charAt(n-2)===t.charAt(i-1)&&e.charAt(n-1)===t.charAt(i-2)?s[n][i]=s[n-2][i-2]+1:s[n][i]=Math.min(s[n-1][i-1]+1,Math.min(s[n][i-1]+1,s[n-1][i]+1));return s[e.length][t.length]}const Mt=["$0","--","_"];let Dt,It=[];function Wt(t,e,s,n){Dt=n;let i={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return i;const n=/\.json|\..*rc$/.test(t.extends);let r=null;if(n)r=function(t,e){return Dt.path.resolve(t,e)}(e,t.extends);else try{r=require.resolve(t.extends)}catch(e){return t}!function(t){if(It.indexOf(t)>-1)throw new tt(`Circular extended configurations: '${t}'.`)}(r),It.push(r),i=n?JSON.parse(Dt.readFileSync(r,"utf8")):require(t.extends),delete t.extends,i=Wt(i,Dt.path.dirname(r),s,Dt)}return It=[],s?Rt(i,t):Object.assign({},i,t)}function Rt(t,e){const s={};function n(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const i of Object.keys(e))n(e[i])&&n(s[i])?s[i]=Rt(t[i],e[i]):s[i]=e[i];return s}var zt,Ft,Bt,Lt,Tt,Vt,Ut,Ht,qt,Yt,Jt,Gt,Kt,Qt,Xt,Zt,te,ee,se,ne,ie,re,oe,ae,ce,le,he,de,ue,fe,pe,ge,me,ye,be,we=function(t,e,s,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,s):i?i.value=s:e.set(t,s),s},ve=function(t,e,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(t):n?n.value:e.get(t)};const Oe=Symbol("copyDoubleDash"),ke=Symbol("copyDoubleDash"),Ee=Symbol("deleteFromParserHintObject"),Ae=Symbol("emitWarning"),_e=Symbol("freeze"),$e=Symbol("getDollarZero"),je=Symbol("getParserConfiguration"),xe=Symbol("getUsageConfiguration"),Ce=Symbol("guessLocale"),Pe=Symbol("guessVersion"),Se=Symbol("parsePositionalNumbers"),Ne=Symbol("pkgUp"),Me=Symbol("populateParserHintArray"),De=Symbol("populateParserHintSingleValueDictionary"),Ie=Symbol("populateParserHintArrayDictionary"),We=Symbol("populateParserHintDictionary"),Re=Symbol("sanitizeKey"),ze=Symbol("setKey"),Fe=Symbol("unfreeze"),Be=Symbol("validateAsync"),Le=Symbol("getCommandInstance"),Te=Symbol("getContext"),Ve=Symbol("getHasOutput"),Ue=Symbol("getLoggerInstance"),He=Symbol("getParseContext"),qe=Symbol("getUsageInstance"),Ye=Symbol("getValidationInstance"),Je=Symbol("hasParseCallback"),Ge=Symbol("isGlobalContext"),Ke=Symbol("postProcess"),Qe=Symbol("rebase"),Xe=Symbol("reset"),Ze=Symbol("runYargsParserAndExecuteCommands"),ts=Symbol("runValidation"),es=Symbol("setHasOutput"),ss=Symbol("kTrackManuallySetKeys");class ns{constructor(t=[],e,s,n){this.customScriptName=!1,this.parsed=!1,zt.set(this,void 0),Ft.set(this,void 0),Bt.set(this,{commands:[],fullCommands:[]}),Lt.set(this,null),Tt.set(this,null),Vt.set(this,"show-hidden"),Ut.set(this,null),Ht.set(this,!0),qt.set(this,{}),Yt.set(this,!0),Jt.set(this,[]),Gt.set(this,void 0),Kt.set(this,{}),Qt.set(this,!1),Xt.set(this,null),Zt.set(this,!0),te.set(this,void 0),ee.set(this,""),se.set(this,void 0),ne.set(this,void 0),ie.set(this,{}),re.set(this,null),oe.set(this,null),ae.set(this,{}),ce.set(this,{}),le.set(this,void 0),he.set(this,!1),de.set(this,void 0),ue.set(this,!1),fe.set(this,!1),pe.set(this,!1),ge.set(this,void 0),me.set(this,{}),ye.set(this,null),be.set(this,void 0),we(this,de,n,"f"),we(this,le,t,"f"),we(this,Ft,e,"f"),we(this,ne,s,"f"),we(this,Gt,new yt(this),"f"),this.$0=this[$e](),this[Xe](),we(this,zt,ve(this,zt,"f"),"f"),we(this,ge,ve(this,ge,"f"),"f"),we(this,be,ve(this,be,"f"),"f"),we(this,se,ve(this,se,"f"),"f"),ve(this,se,"f").showHiddenOpt=ve(this,Vt,"f"),we(this,te,this[ke](),"f")}addHelpOpt(t,e){return pt("[string|boolean] [string]",[t,e],arguments.length),ve(this,Xt,"f")&&(this[Ee](ve(this,Xt,"f")),we(this,Xt,null,"f")),!1===t&&void 0===e||(we(this,Xt,"string"==typeof t?t:"help","f"),this.boolean(ve(this,Xt,"f")),this.describe(ve(this,Xt,"f"),e||ve(this,ge,"f").deferY18nLookup("Show help"))),this}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(pt("[string|boolean] [string]",[t,e],arguments.length),!1===t&&void 0===e)return this;const s="string"==typeof t?t:ve(this,Vt,"f");return this.boolean(s),this.describe(s,e||ve(this,ge,"f").deferY18nLookup("Show hidden options")),ve(this,se,"f").showHiddenOpt=s,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return pt("<object|string|array> [string|array]",[t,e],arguments.length),this[Ie](this.alias.bind(this),"alias",t,e),this}array(t){return pt("<array|string>",[t],arguments.length),this[Me]("array",t),this[ss](t),this}boolean(t){return pt("<array|string>",[t],arguments.length),this[Me]("boolean",t),this[ss](t),this}check(t,e){return pt("<function> [boolean]",[t,e],arguments.length),this.middleware(((e,s)=>wt((()=>t(e,s.getOptions())),(s=>(s?("string"==typeof s||s instanceof Error)&&ve(this,ge,"f").fail(s.toString(),s):ve(this,ge,"f").fail(ve(this,de,"f").y18n.__("Argument check failed: %s",t.toString())),e)),(t=>(ve(this,ge,"f").fail(t.message?t.message:t.toString(),t),e)))),!1,e),this}choices(t,e){return pt("<object|string|array> [string|array]",[t,e],arguments.length),this[Ie](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(pt("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new tt("coerce callback must be provided");for(const s of t)this.coerce(s,e);return this}if("object"==typeof t){for(const e of Object.keys(t))this.coerce(e,t[e]);return this}if(!e)throw new tt("coerce callback must be provided");return ve(this,se,"f").key[t]=!0,ve(this,Gt,"f").addCoerceMiddleware(((s,n)=>{let i;return Object.prototype.hasOwnProperty.call(s,t)?wt((()=>(i=n.getAliases(),e(s[t]))),(e=>{s[t]=e;const r=n.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&!0!==r)for(const n of i[t])s[n]=e;return s}),(t=>{throw new tt(t.message)})):s}),t),this}conflicts(t,e){return pt("<string|object> [string|array]",[t,e],arguments.length),ve(this,be,"f").conflicts(t,e),this}config(t="config",e,s){return pt("[object|string] [string|function] [function]",[t,e,s],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof e&&(s=e,e=void 0),this.describe(t,e||ve(this,ge,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach((t=>{ve(this,se,"f").config[t]=s||!0})),this):(t=Wt(t,ve(this,Ft,"f"),this[je]()["deep-merge-config"]||!1,ve(this,de,"f")),ve(this,se,"f").configObjects=(ve(this,se,"f").configObjects||[]).concat(t),this)}completion(t,e,s){return pt("[string] [string|boolean|function] [function]",[t,e,s],arguments.length),"function"==typeof e&&(s=e,e=void 0),we(this,Tt,t||ve(this,Tt,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(ve(this,Tt,"f"),e),s&&ve(this,Lt,"f").registerFunction(s),this}command(t,e,s,n,i,r){return pt("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,n,i,r],arguments.length),ve(this,zt,"f").addHandler(t,e,s,n,i,r),this}commands(t,e,s,n,i,r){return this.command(t,e,s,n,i,r)}commandDir(t,e){pt("<string> [object]",[t,e],arguments.length);const s=ve(this,ne,"f")||ve(this,de,"f").require;return ve(this,zt,"f").addDirectory(t,s,ve(this,de,"f").getCallerFile(),e),this}count(t){return pt("<array|string>",[t],arguments.length),this[Me]("count",t),this[ss](t),this}default(t,e,s){return pt("<object|string|array> [*] [string]",[t,e,s],arguments.length),s&&(lt(t,ve(this,de,"f")),ve(this,se,"f").defaultDescription[t]=s),"function"==typeof e&&(lt(t,ve(this,de,"f")),ve(this,se,"f").defaultDescription[t]||(ve(this,se,"f").defaultDescription[t]=ve(this,ge,"f").functionDescription(e)),e=e.call()),this[De](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,n){return pt("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,n],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),ve(this,se,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:n},this}demand(t,e,s){return Array.isArray(e)?(e.forEach((t=>{ct(s,!0,ve(this,de,"f")),this.demandOption(t,s)})),e=1/0):"number"!=typeof e&&(s=e,e=1/0),"number"==typeof t?(ct(s,!0,ve(this,de,"f")),this.demandCommand(t,e,s,s)):Array.isArray(t)?t.forEach((t=>{ct(s,!0,ve(this,de,"f")),this.demandOption(t,s)})):"string"==typeof s?this.demandOption(t,s):!0!==s&&void 0!==s||this.demandOption(t),this}demandOption(t,e){return pt("<object|string|array> [string]",[t,e],arguments.length),this[De](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return pt("<string> [string|boolean]",[t,e],arguments.length),ve(this,se,"f").deprecatedOptions[t]=e,this}describe(t,e){return pt("<object|string|array> [string]",[t,e],arguments.length),this[ze](t,!0),ve(this,ge,"f").describe(t,e),this}detectLocale(t){return pt("<boolean>",[t],arguments.length),we(this,Ht,t,"f"),this}env(t){return pt("[string|boolean]",[t],arguments.length),!1===t?delete ve(this,se,"f").envPrefix:ve(this,se,"f").envPrefix=t||"",this}epilogue(t){return pt("<string>",[t],arguments.length),ve(this,ge,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return pt("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach((t=>this.example(...t))):ve(this,ge,"f").example(t,e),this}exit(t,e){we(this,Qt,!0,"f"),we(this,Ut,e,"f"),ve(this,Yt,"f")&&ve(this,de,"f").process.exit(t)}exitProcess(t=!0){return pt("[boolean]",[t],arguments.length),we(this,Yt,t,"f"),this}fail(t){if(pt("<function|boolean>",[t],arguments.length),"boolean"==typeof t&&!1!==t)throw new tt("Invalid first argument. Expected function or boolean 'false'");return ve(this,ge,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return pt("<array> [function]",[t,e],arguments.length),e?ve(this,Lt,"f").getCompletion(t,e):new Promise(((e,s)=>{ve(this,Lt,"f").getCompletion(t,((t,n)=>{t?s(t):e(n)}))}))}getDemandedOptions(){return pt([],0),ve(this,se,"f").demandedOptions}getDemandedCommands(){return pt([],0),ve(this,se,"f").demandedCommands}getDeprecatedOptions(){return pt([],0),ve(this,se,"f").deprecatedOptions}getDetectLocale(){return ve(this,Ht,"f")}getExitProcess(){return ve(this,Yt,"f")}getGroups(){return Object.assign({},ve(this,Kt,"f"),ve(this,ce,"f"))}getHelp(){if(we(this,Qt,!0,"f"),!ve(this,ge,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Ze](ve(this,le,"f"),void 0,void 0,0,!0);if(dt(t))return t.then((()=>ve(this,ge,"f").help()))}const t=ve(this,zt,"f").runDefaultBuilderOn(this);if(dt(t))return t.then((()=>ve(this,ge,"f").help()))}return Promise.resolve(ve(this,ge,"f").help())}getOptions(){return ve(this,se,"f")}getStrict(){return ve(this,ue,"f")}getStrictCommands(){return ve(this,fe,"f")}getStrictOptions(){return ve(this,pe,"f")}global(t,e){return pt("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),!1!==e?ve(this,se,"f").local=ve(this,se,"f").local.filter((e=>-1===t.indexOf(e))):t.forEach((t=>{ve(this,se,"f").local.includes(t)||ve(this,se,"f").local.push(t)})),this}group(t,e){pt("<string|array> <string>",[t,e],arguments.length);const s=ve(this,ce,"f")[e]||ve(this,Kt,"f")[e];ve(this,ce,"f")[e]&&delete ve(this,ce,"f")[e];const n={};return ve(this,Kt,"f")[e]=(s||[]).concat(t).filter((t=>!n[t]&&(n[t]=!0))),this}hide(t){return pt("<string>",[t],arguments.length),ve(this,se,"f").hiddenOptions.push(t),this}implies(t,e){return pt("<string|object> [number|string|array]",[t,e],arguments.length),ve(this,be,"f").implies(t,e),this}locale(t){return pt("[string]",[t],arguments.length),void 0===t?(this[Ce](),ve(this,de,"f").y18n.getLocale()):(we(this,Ht,!1,"f"),ve(this,de,"f").y18n.setLocale(t),this)}middleware(t,e,s){return ve(this,Gt,"f").addMiddleware(t,!!e,s)}nargs(t,e){return pt("<string|object|array> [number]",[t,e],arguments.length),this[De](this.nargs.bind(this),"narg",t,e),this}normalize(t){return pt("<array|string>",[t],arguments.length),this[Me]("normalize",t),this}number(t){return pt("<array|string>",[t],arguments.length),this[Me]("number",t),this[ss](t),this}option(t,e){if(pt("<string|object> [object]",[t,e],arguments.length),"object"==typeof t)Object.keys(t).forEach((e=>{this.options(e,t[e])}));else{"object"!=typeof e&&(e={}),this[ss](t),!ve(this,ye,"f")||"version"!==t&&"version"!==(null==e?void 0:e.alias)||this[Ae](['"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("\n"),void 0,"versionWarning"),ve(this,se,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const s=e.deprecate||e.deprecated;s&&this.deprecateOption(t,s);const n=e.demand||e.required||e.require;n&&this.demand(t,n),e.demandOption&&this.demandOption(t,"string"==typeof e.demandOption?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),void 0!==e.implies&&this.implies(t,e.implies),void 0!==e.nargs&&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||"boolean"===e.type)&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||"array"===e.type)&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||"number"===e.type)&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||"string"===e.type)&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||"count"===e.type)&&this.count(t),"boolean"==typeof e.global&&this.global(t,e.global),e.defaultDescription&&(ve(this,se,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const i=e.describe||e.description||e.desc,r=ve(this,ge,"f").getDescriptions();Object.prototype.hasOwnProperty.call(r,t)&&"string"!=typeof i||this.describe(t,i),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,s){pt("[string|array] [function|boolean|object] [function]",[t,e,s],arguments.length),this[_e](),void 0===t&&(t=ve(this,le,"f")),"object"==typeof e&&(we(this,oe,e,"f"),e=s),"function"==typeof e&&(we(this,re,e,"f"),e=!1),e||we(this,le,t,"f"),ve(this,re,"f")&&we(this,Yt,!1,"f");const n=this[Ze](t,!!e),i=this.parsed;return ve(this,Lt,"f").setParsed(this.parsed),dt(n)?n.then((t=>(ve(this,re,"f")&&ve(this,re,"f").call(this,ve(this,Ut,"f"),t,ve(this,ee,"f")),t))).catch((t=>{throw ve(this,re,"f")&&ve(this,re,"f")(t,this.parsed.argv,ve(this,ee,"f")),t})).finally((()=>{this[Fe](),this.parsed=i})):(ve(this,re,"f")&&ve(this,re,"f").call(this,ve(this,Ut,"f"),n,ve(this,ee,"f")),this[Fe](),this.parsed=i,n)}parseAsync(t,e,s){const n=this.parse(t,e,s);return dt(n)?n:Promise.resolve(n)}parseSync(t,e,s){const n=this.parse(t,e,s);if(dt(n))throw new tt(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return n}parserConfiguration(t){return pt("<object>",[t],arguments.length),we(this,ie,t,"f"),this}pkgConf(t,e){pt("<string> [string]",[t,e],arguments.length);let s=null;const n=this[Ne](e||ve(this,Ft,"f"));return n[t]&&"object"==typeof n[t]&&(s=Wt(n[t],e||ve(this,Ft,"f"),this[je]()["deep-merge-config"]||!1,ve(this,de,"f")),ve(this,se,"f").configObjects=(ve(this,se,"f").configObjects||[]).concat(s)),this}positional(t,e){pt("<string> <object>",[t,e],arguments.length);const s=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=At(e,((t,e)=>!("type"===t&&!["string","number","boolean"].includes(e))&&s.includes(t)));const n=ve(this,Bt,"f").fullCommands[ve(this,Bt,"f").fullCommands.length-1],i=n?ve(this,zt,"f").cmdToParseOptions(n):{array:[],alias:{},default:{},demand:{}};return ht(i).forEach((s=>{const n=i[s];Array.isArray(n)?-1!==n.indexOf(t)&&(e[s]=!0):n[t]&&!(s in e)&&(e[s]=n[t])})),this.group(t,ve(this,ge,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return pt("[boolean]",[t],arguments.length),we(this,he,t,"f"),this}required(t,e,s){return this.demand(t,e,s)}require(t,e,s){return this.demand(t,e,s)}requiresArg(t){return pt("<array|string|object> [number]",[t],arguments.length),"string"==typeof t&&ve(this,se,"f").narg[t]||this[De](this.requiresArg.bind(this),"narg",t,NaN),this}showCompletionScript(t,e){return pt("[string] [string]",[t,e],arguments.length),t=t||this.$0,ve(this,te,"f").log(ve(this,Lt,"f").generateCompletionScript(t,e||ve(this,Tt,"f")||"completion")),this}showHelp(t){if(pt("[string|function]",[t],arguments.length),we(this,Qt,!0,"f"),!ve(this,ge,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[Ze](ve(this,le,"f"),void 0,void 0,0,!0);if(dt(e))return e.then((()=>{ve(this,ge,"f").showHelp(t)})),this}const e=ve(this,zt,"f").runDefaultBuilderOn(this);if(dt(e))return e.then((()=>{ve(this,ge,"f").showHelp(t)})),this}return ve(this,ge,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return pt("[boolean|string] [string]",[t,e],arguments.length),ve(this,ge,"f").showHelpOnFail(t,e),this}showVersion(t){return pt("[string|function]",[t],arguments.length),ve(this,ge,"f").showVersion(t),this}skipValidation(t){return pt("<array|string>",[t],arguments.length),this[Me]("skipValidation",t),this}strict(t){return pt("[boolean]",[t],arguments.length),we(this,ue,!1!==t,"f"),this}strictCommands(t){return pt("[boolean]",[t],arguments.length),we(this,fe,!1!==t,"f"),this}strictOptions(t){return pt("[boolean]",[t],arguments.length),we(this,pe,!1!==t,"f"),this}string(t){return pt("<array|string>",[t],arguments.length),this[Me]("string",t),this[ss](t),this}terminalWidth(){return pt([],0),ve(this,de,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return pt("<object>",[t],arguments.length),we(this,Ht,!1,"f"),ve(this,de,"f").y18n.updateLocale(t),this}usage(t,e,s,n){if(pt("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,s,n],arguments.length),void 0!==e){if(ct(t,null,ve(this,de,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,s,n);throw new tt(".usage() description must start with $0 if being used as alias for .command()")}return ve(this,ge,"f").usage(t),this}usageConfiguration(t){return pt("<object>",[t],arguments.length),we(this,me,t,"f"),this}version(t,e,s){const n="version";if(pt("[boolean|string] [string] [string]",[t,e,s],arguments.length),ve(this,ye,"f")&&(this[Ee](ve(this,ye,"f")),ve(this,ge,"f").version(void 0),we(this,ye,null,"f")),0===arguments.length)s=this[Pe](),t=n;else if(1===arguments.length){if(!1===t)return this;s=t,t=n}else 2===arguments.length&&(s=e,e=void 0);return we(this,ye,"string"==typeof t?t:n,"f"),e=e||ve(this,ge,"f").deferY18nLookup("Show version number"),ve(this,ge,"f").version(s||void 0),this.boolean(ve(this,ye,"f")),this.describe(ve(this,ye,"f"),e),this}wrap(t){return pt("<number|null|undefined>",[t],arguments.length),ve(this,ge,"f").wrap(t),this}[(zt=new WeakMap,Ft=new WeakMap,Bt=new WeakMap,Lt=new WeakMap,Tt=new WeakMap,Vt=new WeakMap,Ut=new WeakMap,Ht=new WeakMap,qt=new WeakMap,Yt=new WeakMap,Jt=new WeakMap,Gt=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,te=new WeakMap,ee=new WeakMap,se=new WeakMap,ne=new WeakMap,ie=new WeakMap,re=new WeakMap,oe=new WeakMap,ae=new WeakMap,ce=new WeakMap,le=new WeakMap,he=new WeakMap,de=new WeakMap,ue=new WeakMap,fe=new WeakMap,pe=new WeakMap,ge=new WeakMap,me=new WeakMap,ye=new WeakMap,be=new WeakMap,Oe)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[ke](){return{log:(...t)=>{this[Je]()||console.log(...t),we(this,Qt,!0,"f"),ve(this,ee,"f").length&&we(this,ee,ve(this,ee,"f")+"\n","f"),we(this,ee,ve(this,ee,"f")+t.join(" "),"f")},error:(...t)=>{this[Je]()||console.error(...t),we(this,Qt,!0,"f"),ve(this,ee,"f").length&&we(this,ee,ve(this,ee,"f")+"\n","f"),we(this,ee,ve(this,ee,"f")+t.join(" "),"f")}}}[Ee](t){ht(ve(this,se,"f")).forEach((e=>{if("configObjects"===e)return;const s=ve(this,se,"f")[e];Array.isArray(s)?s.includes(t)&&s.splice(s.indexOf(t),1):"object"==typeof s&&delete s[t]})),delete ve(this,ge,"f").getDescriptions()[t]}[Ae](t,e,s){ve(this,qt,"f")[s]||(ve(this,de,"f").process.emitWarning(t,e),ve(this,qt,"f")[s]=!0)}[_e](){ve(this,Jt,"f").push({options:ve(this,se,"f"),configObjects:ve(this,se,"f").configObjects.slice(0),exitProcess:ve(this,Yt,"f"),groups:ve(this,Kt,"f"),strict:ve(this,ue,"f"),strictCommands:ve(this,fe,"f"),strictOptions:ve(this,pe,"f"),completionCommand:ve(this,Tt,"f"),output:ve(this,ee,"f"),exitError:ve(this,Ut,"f"),hasOutput:ve(this,Qt,"f"),parsed:this.parsed,parseFn:ve(this,re,"f"),parseContext:ve(this,oe,"f")}),ve(this,ge,"f").freeze(),ve(this,be,"f").freeze(),ve(this,zt,"f").freeze(),ve(this,Gt,"f").freeze()}[$e](){let t,e="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(ve(this,de,"f").process.argv()[0])?ve(this,de,"f").process.argv().slice(1,2):ve(this,de,"f").process.argv().slice(0,1),e=t.map((t=>{const e=this[Qe](ve(this,Ft,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&e.length<t.length?e:t})).join(" ").trim(),ve(this,de,"f").getEnv("_")&&ve(this,de,"f").getProcessArgvBin()===ve(this,de,"f").getEnv("_")&&(e=ve(this,de,"f").getEnv("_").replace(`${ve(this,de,"f").path.dirname(ve(this,de,"f").process.execPath())}/`,"")),e}[je](){return ve(this,ie,"f")}[xe](){return ve(this,me,"f")}[Ce](){if(!ve(this,Ht,"f"))return;const t=ve(this,de,"f").getEnv("LC_ALL")||ve(this,de,"f").getEnv("LC_MESSAGES")||ve(this,de,"f").getEnv("LANG")||ve(this,de,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Pe](){return this[Ne]().version||"unknown"}[Se](t){const e=t["--"]?t["--"]:t._;for(let t,s=0;void 0!==(t=e[s]);s++)ve(this,de,"f").Parser.looksLikeNumber(t)&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)))&&(e[s]=Number(t));return t}[Ne](t){const e=t||"*";if(ve(this,ae,"f")[e])return ve(this,ae,"f")[e];let s={};try{let e=t||ve(this,de,"f").mainFilename;!t&&ve(this,de,"f").path.extname(e)&&(e=ve(this,de,"f").path.dirname(e));const n=ve(this,de,"f").findUp(e,((t,e)=>e.includes("package.json")?"package.json":void 0));ct(n,void 0,ve(this,de,"f")),s=JSON.parse(ve(this,de,"f").readFileSync(n,"utf8"))}catch(t){}return ve(this,ae,"f")[e]=s||{},ve(this,ae,"f")[e]}[Me](t,e){(e=[].concat(e)).forEach((e=>{e=this[Re](e),ve(this,se,"f")[t].push(e)}))}[De](t,e,s,n){this[We](t,e,s,n,((t,e,s)=>{ve(this,se,"f")[t][e]=s}))}[Ie](t,e,s,n){this[We](t,e,s,n,((t,e,s)=>{ve(this,se,"f")[t][e]=(ve(this,se,"f")[t][e]||[]).concat(s)}))}[We](t,e,s,n,i){if(Array.isArray(s))s.forEach((e=>{t(e,n)}));else if((t=>"object"==typeof t)(s))for(const e of ht(s))t(e,s[e]);else i(e,this[Re](s),n)}[Re](t){return"__proto__"===t?"___proto___":t}[ze](t,e){return this[De](this[ze].bind(this),"key",t,e),this}[Fe](){var t,e,s,n,i,r,o,a,c,l,h,d;const u=ve(this,Jt,"f").pop();let f;ct(u,void 0,ve(this,de,"f")),t=this,e=this,s=this,n=this,i=this,r=this,o=this,a=this,c=this,l=this,h=this,d=this,({options:{set value(e){we(t,se,e,"f")}}.value,configObjects:f,exitProcess:{set value(t){we(e,Yt,t,"f")}}.value,groups:{set value(t){we(s,Kt,t,"f")}}.value,output:{set value(t){we(n,ee,t,"f")}}.value,exitError:{set value(t){we(i,Ut,t,"f")}}.value,hasOutput:{set value(t){we(r,Qt,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){we(o,ue,t,"f")}}.value,strictCommands:{set value(t){we(a,fe,t,"f")}}.value,strictOptions:{set value(t){we(c,pe,t,"f")}}.value,completionCommand:{set value(t){we(l,Tt,t,"f")}}.value,parseFn:{set value(t){we(h,re,t,"f")}}.value,parseContext:{set value(t){we(d,oe,t,"f")}}.value}=u),ve(this,se,"f").configObjects=f,ve(this,ge,"f").unfreeze(),ve(this,be,"f").unfreeze(),ve(this,zt,"f").unfreeze(),ve(this,Gt,"f").unfreeze()}[Be](t,e){return wt(e,(e=>(t(e),e)))}getInternalMethods(){return{getCommandInstance:this[Le].bind(this),getContext:this[Te].bind(this),getHasOutput:this[Ve].bind(this),getLoggerInstance:this[Ue].bind(this),getParseContext:this[He].bind(this),getParserConfiguration:this[je].bind(this),getUsageConfiguration:this[xe].bind(this),getUsageInstance:this[qe].bind(this),getValidationInstance:this[Ye].bind(this),hasParseCallback:this[Je].bind(this),isGlobalContext:this[Ge].bind(this),postProcess:this[Ke].bind(this),reset:this[Xe].bind(this),runValidation:this[ts].bind(this),runYargsParserAndExecuteCommands:this[Ze].bind(this),setHasOutput:this[es].bind(this)}}[Le](){return ve(this,zt,"f")}[Te](){return ve(this,Bt,"f")}[Ve](){return ve(this,Qt,"f")}[Ue](){return ve(this,te,"f")}[He](){return ve(this,oe,"f")||{}}[qe](){return ve(this,ge,"f")}[Ye](){return ve(this,be,"f")}[Je](){return!!ve(this,re,"f")}[Ge](){return ve(this,Zt,"f")}[Ke](t,e,s,n){if(s)return t;if(dt(t))return t;e||(t=this[Oe](t));return(this[je]()["parse-positional-numbers"]||void 0===this[je]()["parse-positional-numbers"])&&(t=this[Se](t)),n&&(t=bt(t,this,ve(this,Gt,"f").getMiddleware(),!1)),t}[Xe](t={}){we(this,se,ve(this,se,"f")||{},"f");const e={};e.local=ve(this,se,"f").local||[],e.configObjects=ve(this,se,"f").configObjects||[];const s={};e.local.forEach((e=>{s[e]=!0,(t[e]||[]).forEach((t=>{s[t]=!0}))})),Object.assign(ve(this,ce,"f"),Object.keys(ve(this,Kt,"f")).reduce(((t,e)=>{const n=ve(this,Kt,"f")[e].filter((t=>!(t in s)));return n.length>0&&(t[e]=n),t}),{})),we(this,Kt,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach((t=>{e[t]=(ve(this,se,"f")[t]||[]).filter((t=>!s[t]))})),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach((t=>{e[t]=At(ve(this,se,"f")[t],(t=>!s[t]))})),e.envPrefix=ve(this,se,"f").envPrefix,we(this,se,e,"f"),we(this,ge,ve(this,ge,"f")?ve(this,ge,"f").reset(s):jt(this,ve(this,de,"f")),"f"),we(this,be,ve(this,be,"f")?ve(this,be,"f").reset(s):function(t,e,s){const n=s.y18n.__,i=s.y18n.__n,r={nonOptionCount:function(s){const n=t.getDemandedCommands(),r=s._.length+(s["--"]?s["--"].length:0)-t.getInternalMethods().getContext().commands.length;n._&&(r<n._.min||r>n._.max)&&(r<n._.min?void 0!==n._.minMsg?e.fail(n._.minMsg?n._.minMsg.replace(/\$0/g,r.toString()).replace(/\$1/,n._.min.toString()):null):e.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",r,r.toString(),n._.min.toString())):r>n._.max&&(void 0!==n._.maxMsg?e.fail(n._.maxMsg?n._.maxMsg.replace(/\$0/g,r.toString()).replace(/\$1/,n._.max.toString()):null):e.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",r,r.toString(),n._.max.toString()))))},positionalCount:function(t,s){s<t&&e.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",s,s+"",t+""))},requiredArguments:function(t,s){let n=null;for(const e of Object.keys(s))Object.prototype.hasOwnProperty.call(t,e)&&void 0!==t[e]||(n=n||{},n[e]=s[e]);if(n){const t=[];for(const e of Object.keys(n)){const s=n[e];s&&t.indexOf(s)<0&&t.push(s)}const s=t.length?`\n${t.join("\n")}`:"";e.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(n).length,Object.keys(n).join(", ")+s))}},unknownArguments:function(s,n,o,a,c=!0){var l;const h=t.getInternalMethods().getCommandInstance().getCommands(),d=[],u=t.getInternalMethods().getContext();if(Object.keys(s).forEach((e=>{Mt.includes(e)||Object.prototype.hasOwnProperty.call(o,e)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),e)||r.isValidAndSomeAliasIsNotNew(e,n)||d.push(e)})),c&&(u.commands.length>0||h.length>0||a)&&s._.slice(u.commands.length).forEach((t=>{h.includes(""+t)||d.push(""+t)})),c){const e=(null===(l=t.getDemandedCommands()._)||void 0===l?void 0:l.max)||0,n=u.commands.length+e;n<s._.length&&s._.slice(n).forEach((t=>{t=String(t),u.commands.includes(t)||d.includes(t)||d.push(t)}))}d.length&&e.fail(i("Unknown argument: %s","Unknown arguments: %s",d.length,d.map((t=>t.trim()?t:`"${t}"`)).join(", ")))},unknownCommands:function(s){const n=t.getInternalMethods().getCommandInstance().getCommands(),r=[],o=t.getInternalMethods().getContext();return(o.commands.length>0||n.length>0)&&s._.slice(o.commands.length).forEach((t=>{n.includes(""+t)||r.push(""+t)})),r.length>0&&(e.fail(i("Unknown command: %s","Unknown commands: %s",r.length,r.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(e,s){if(!Object.prototype.hasOwnProperty.call(s,e))return!1;const n=t.parsed.newAliases;return[e,...s[e]].some((t=>!Object.prototype.hasOwnProperty.call(n,t)||!n[e]))},limitedChoices:function(s){const i=t.getOptions(),r={};if(!Object.keys(i.choices).length)return;Object.keys(s).forEach((t=>{-1===Mt.indexOf(t)&&Object.prototype.hasOwnProperty.call(i.choices,t)&&[].concat(s[t]).forEach((e=>{-1===i.choices[t].indexOf(e)&&void 0!==e&&(r[t]=(r[t]||[]).concat(e))}))}));const o=Object.keys(r);if(!o.length)return;let a=n("Invalid values:");o.forEach((t=>{a+=`\n ${n("Argument: %s, Given: %s, Choices: %s",t,e.stringifiedValues(r[t]),e.stringifiedValues(i.choices[t]))}`})),e.fail(a)}};let o={};function a(t,e){const s=Number(e);return"number"==typeof(e=isNaN(s)?e:s)?e=t._.length>=e:e.match(/^--no-.+/)?(e=e.match(/^--no-(.+)/)[1],e=!Object.prototype.hasOwnProperty.call(t,e)):e=Object.prototype.hasOwnProperty.call(t,e),e}r.implies=function(e,n){pt("<string|object> [array|number|string]",[e,n],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.implies(t,e[t])})):(t.global(e),o[e]||(o[e]=[]),Array.isArray(n)?n.forEach((t=>r.implies(e,t))):(ct(n,void 0,s),o[e].push(n)))},r.getImplied=function(){return o},r.implications=function(t){const s=[];if(Object.keys(o).forEach((e=>{const n=e;(o[e]||[]).forEach((e=>{let i=n;const r=e;i=a(t,i),e=a(t,e),i&&!e&&s.push(` ${n} -> ${r}`)}))})),s.length){let t=`${n("Implications failed:")}\n`;s.forEach((e=>{t+=e})),e.fail(t)}};let c={};r.conflicts=function(e,s){pt("<string|object> [array|string]",[e,s],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.conflicts(t,e[t])})):(t.global(e),c[e]||(c[e]=[]),Array.isArray(s)?s.forEach((t=>r.conflicts(e,t))):c[e].push(s))},r.getConflicting=()=>c,r.conflicting=function(i){Object.keys(i).forEach((t=>{c[t]&&c[t].forEach((s=>{s&&void 0!==i[t]&&void 0!==i[s]&&e.fail(n("Arguments %s and %s are mutually exclusive",t,s))}))})),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(c).forEach((t=>{c[t].forEach((r=>{r&&void 0!==i[s.Parser.camelCase(t)]&&void 0!==i[s.Parser.camelCase(r)]&&e.fail(n("Arguments %s and %s are mutually exclusive",t,r))}))}))},r.recommendCommands=function(t,s){s=s.sort(((t,e)=>e.length-t.length));let i=null,r=1/0;for(let e,n=0;void 0!==(e=s[n]);n++){const s=Nt(t,e);s<=3&&s<r&&(r=s,i=e)}i&&e.fail(n("Did you mean %s?",i))},r.reset=function(t){return o=At(o,(e=>!t[e])),c=At(c,(e=>!t[e])),r};const l=[];return r.freeze=function(){l.push({implied:o,conflicting:c})},r.unfreeze=function(){const t=l.pop();ct(t,void 0,s),({implied:o,conflicting:c}=t)},r}(this,ve(this,ge,"f"),ve(this,de,"f")),"f"),we(this,zt,ve(this,zt,"f")?ve(this,zt,"f").reset():function(t,e,s,n){return new Ot(t,e,s,n)}(ve(this,ge,"f"),ve(this,be,"f"),ve(this,Gt,"f"),ve(this,de,"f")),"f"),ve(this,Lt,"f")||we(this,Lt,function(t,e,s,n){return new St(t,e,s,n)}(this,ve(this,ge,"f"),ve(this,zt,"f"),ve(this,de,"f")),"f"),ve(this,Gt,"f").reset(),we(this,Tt,null,"f"),we(this,ee,"","f"),we(this,Ut,null,"f"),we(this,Qt,!1,"f"),this.parsed=!1,this}[Qe](t,e){return ve(this,de,"f").path.relative(t,e)}[Ze](t,e,s,n=0,i=!1){let r=!!s||i;t=t||ve(this,le,"f"),ve(this,se,"f").__=ve(this,de,"f").y18n.__,ve(this,se,"f").configuration=this[je]();const o=!!ve(this,se,"f").configuration["populate--"],a=Object.assign({},ve(this,se,"f").configuration,{"populate--":!0}),c=ve(this,de,"f").Parser.detailed(t,Object.assign({},ve(this,se,"f"),{configuration:{"parse-positional-numbers":!1,...a}})),l=Object.assign(c.argv,ve(this,oe,"f"));let h;const d=c.aliases;let u=!1,f=!1;Object.keys(l).forEach((t=>{t===ve(this,Xt,"f")&&l[t]?u=!0:t===ve(this,ye,"f")&&l[t]&&(f=!0)})),l.$0=this.$0,this.parsed=c,0===n&&ve(this,ge,"f").clearCachedHelpMessage();try{if(this[Ce](),e)return this[Ke](l,o,!!s,!1);if(ve(this,Xt,"f")){[ve(this,Xt,"f")].concat(d[ve(this,Xt,"f")]||[]).filter((t=>t.length>1)).includes(""+l._[l._.length-1])&&(l._.pop(),u=!0)}we(this,Zt,!1,"f");const a=ve(this,zt,"f").getCommands(),p=ve(this,Lt,"f").completionKey in l,g=u||p||i;if(l._.length){if(a.length){let t;for(let e,r=n||0;void 0!==l._[r];r++){if(e=String(l._[r]),a.includes(e)&&e!==ve(this,Tt,"f")){const t=ve(this,zt,"f").runCommand(e,this,c,r+1,i,u||f||i);return this[Ke](t,o,!!s,!1)}if(!t&&e!==ve(this,Tt,"f")){t=e;break}}!ve(this,zt,"f").hasDefaultCommand()&&ve(this,he,"f")&&t&&!g&&ve(this,be,"f").recommendCommands(t,a)}ve(this,Tt,"f")&&l._.includes(ve(this,Tt,"f"))&&!p&&(ve(this,Yt,"f")&&_t(!0),this.showCompletionScript(),this.exit(0))}if(ve(this,zt,"f").hasDefaultCommand()&&!g){const t=ve(this,zt,"f").runCommand(null,this,c,0,i,u||f||i);return this[Ke](t,o,!!s,!1)}if(p){ve(this,Yt,"f")&&_t(!0);const e=(t=[].concat(t)).slice(t.indexOf(`--${ve(this,Lt,"f").completionKey}`)+1);return ve(this,Lt,"f").getCompletion(e,((t,e)=>{if(t)throw new tt(t.message);(e||[]).forEach((t=>{ve(this,te,"f").log(t)})),this.exit(0)})),this[Ke](l,!o,!!s,!1)}if(ve(this,Qt,"f")||(u?(ve(this,Yt,"f")&&_t(!0),r=!0,this.showHelp("log"),this.exit(0)):f&&(ve(this,Yt,"f")&&_t(!0),r=!0,ve(this,ge,"f").showVersion("log"),this.exit(0))),!r&&ve(this,se,"f").skipValidation.length>0&&(r=Object.keys(l).some((t=>ve(this,se,"f").skipValidation.indexOf(t)>=0&&!0===l[t]))),!r){if(c.error)throw new tt(c.error.message);if(!p){const t=this[ts](d,{},c.error);s||(h=bt(l,this,ve(this,Gt,"f").getMiddleware(),!0)),h=this[Be](t,null!=h?h:l),dt(h)&&!s&&(h=h.then((()=>bt(l,this,ve(this,Gt,"f").getMiddleware(),!1))))}}}catch(t){if(!(t instanceof tt))throw t;ve(this,ge,"f").fail(t.message,t)}return this[Ke](null!=h?h:l,o,!!s,!0)}[ts](t,e,s,n){const i={...this.getDemandedOptions()};return r=>{if(s)throw new tt(s.message);ve(this,be,"f").nonOptionCount(r),ve(this,be,"f").requiredArguments(r,i);let o=!1;ve(this,fe,"f")&&(o=ve(this,be,"f").unknownCommands(r)),ve(this,ue,"f")&&!o?ve(this,be,"f").unknownArguments(r,t,e,!!n):ve(this,pe,"f")&&ve(this,be,"f").unknownArguments(r,t,{},!1,!1),ve(this,be,"f").limitedChoices(r),ve(this,be,"f").implications(r),ve(this,be,"f").conflicting(r)}}[es](){we(this,Qt,!0,"f")}[ss](t){if("string"==typeof t)ve(this,se,"f").key[t]=!0;else for(const e of t)ve(this,se,"f").key[e]=!0}}const is=(rs=at,(t=[],e=rs.process.cwd(),s)=>{const n=new ns(t,e,s,rs);return Object.defineProperty(n,"argv",{get:()=>n.parse(),enumerable:!0}),n.help(),n.version(),n});var rs;const os=new class{_pathByName=new Map;constructor(){this._dirPath=process.cwd()}getBuildCommand(t){return this._buildCommand??=this.packageJson.scripts?.build?.includes("buildIfNeeded")?"yarn build":"YARN wb buildIfNeeded "+(t?.verbose?"--verbose":"")}get dirPath(){return this._dirPath}set dirPath(e){this._dirPath=t.resolve(e)}get rootDirPath(){return this._rootDirPath??=l.existsSync(t.join(this.dirPath,"..","..","package.json"))?t.resolve(this.dirPath,"..",".."):this.dirPath}get dockerfile(){return this._dockerfile??=l.readFileSync(this.findFile("Dockerfile"),"utf8")}get hasDockerfile(){if(void 0!==this._hasDockerfile)return this._hasDockerfile;try{this._hasDockerfile=!!this.findFile("Dockerfile")}catch{this._hasDockerfile=!1}return this._hasDockerfile}get name(){return this._name??=os.rootPackageJson.name||"unknown"}get nameWithoutNamespace(){if(void 0===this._nameWithoutNamespace){const t=os.rootPackageJson.name||"unknown",e=t.lastIndexOf("/");this._nameWithoutNamespace=-1===e?t:t.slice(e+1)}return this._nameWithoutNamespace}get packageJson(){return this._packageJson??=JSON.parse(l.readFileSync(t.join(this.dirPath,"package.json"),"utf8"))}get rootPackageJson(){return this._rootPackageJson??=this.rootDirPath===this.dirPath?this.packageJson:JSON.parse(l.readFileSync(t.join(this.rootDirPath,"package.json"),"utf8"))}get dockerPackageJson(){return this._dockerPackageJson??=t.dirname(this.findFile("Dockerfile"))===this.dirPath?this.packageJson:JSON.parse(l.readFileSync(t.join(t.dirname(this.findFile("Dockerfile")),"package.json"),"utf8"))}findFile(e){let s=this._pathByName.get(e);if(s)return s;if(s=[e,t.join("..","..",e)].find((t=>l.existsSync(t))),!s)throw new Error(`File not found: ${e}`);return this._pathByName.set(e,s),s}},as={command:"buildIfNeeded",describe:"Build code if changes are detected",builder:{command:{description:"A build command",type:"string",default:"yarn build",alias:"c"}},async handler(e){await async function(e){if(!l.existsSync(t.join(os.rootDirPath,".git")))return cs(e),!0;const[s,n,i]=await async function(e){const s=t.resolve(os.dirPath,"node_modules",".cache","build"),n=t.resolve(s,"last-build");await l.promises.mkdir(s,{recursive:!0});const i=v("sha256"),r=y.execSync("git rev-parse HEAD",{cwd:os.dirPath}).toString().trim();i.update(r);const o=JSON.stringify(Object.entries(process.env).filter((([t])=>!ls.has(t))).sort((([t],[e])=>t.localeCompare(e))));i.update(o),await async function(t,e){return new Promise((s=>{const n=y.spawnSync("git",["diff","--name-only"],{cwd:os.dirPath,stdio:"pipe",encoding:"utf8"}).stdout.trim().split("\n").map((t=>"test"===process.env.WB_ENV?t.replace(/packages\/scripts\/test-fixtures\/[^/]+\//,""):t)).filter((t=>(hs.some((e=>t.includes(e)))||ds.some((e=>t.endsWith(e))))&&!us.some((e=>t.includes(e)))));t.verbose&&console.info(`Changed files: ${n.join(", ")}`);const i=y.spawn("git",["diff","--",...n],{cwd:os.rootDirPath});i.stdout?.on("data",(s=>{e.update(s),t.verbose&&(console.info(s.toString()),console.info("Hash:",e.copy().digest("hex")))})),i.on("close",(()=>{s()}))}))}(e,i);const a=i.digest("hex"),c=await async function(t){try{return await t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}}((()=>l.promises.readFile(n,"utf8")));return[c===a,n,a]}(e);if(s)return console.info(O.green(`Skip to run '${e.command}' 💫`)),!1;if(!cs(e))return;e.dryRun||await l.promises.writeFile(n,i,"utf8");return!0}(e)}};function cs(t){if(console.info(O.green(`Run '${t.command}'`)),!t.dryRun){const e=y.spawnSync(t.command??"",{cwd:os.dirPath,shell:!0,stdio:"inherit"});if(0!==e.status)return process.exitCode=e.status??1,!1}return!0}const ls=new Set(["CI","PWDEBUG","TMPDIR"]);const hs=["src/","public/"],ds=[".js",".cjs",".mjs",".jsx",".ts",".cts",".mts",".tsx",".json",".browserslistrc","yarn.lock"],us=["test/","tests/","__tests__/","test-fixtures/","package.json"];const fs={command:"optimizeForDockerBuild",describe:"Optimize configuration when building a Docker image",builder:{outside:{description:"Whether the optimization is executed outside a docker container or not",type:"boolean",alias:"o"}},async handler(e){const s={stdio:"inherit"},n=["package.json"];if(os.packageJson.workspaces){const e=await l.promises.readdir("packages",{withFileTypes:!0});for(const s of e){if(!s.isDirectory())continue;const e=t.join("packages",s.name,"package.json");l.existsSync(e)&&n.push(e)}}for(const s of n){const n=JSON.parse(l.readFileSync(s,"utf8")),i=["dependencies","devDependencies"];for(const t of i){const e=n[t]||{};for(const[t,s]of Object.entries(e))s?.startsWith("git@github.com:")&&(e[t]=`./${t}`)}if(ps(e,n),gs(n),ms(n),e.dryRun)continue;const r=e.outside?t.join(t.dirname(s),"dist"):t.dirname(s);await l.promises.mkdir(r,{recursive:!0}),await l.promises.writeFile(t.join(r,"package.json"),JSON.stringify(n),"utf8")}e.dryRun||e.outside||y.spawnSync("yarn",s)}};function ps(t,e){if(!t.outside)return void delete e.devDependencies;const s=e.devDependencies||{},n=["concurrently","conventional-changelog-conventionalcommits","eslint","husky","jest","kill-port","lint-staged","open-cli","playwright","prettier","pinst","sort-package-json","wait-on","semantic-release","vitest"];for(const e of Object.keys(s))(n.some((t=>e.includes(t)))||!t.outside&&e.includes("willbooster")&&e.includes("config"))&&delete s[e]}function gs(t){const e=["check","deploy","format","lint","start","test"],s=["pinst ","husky "],n=t.scripts||{};for(const[t,i]of Object.entries(n))(e.some((e=>t.includes(e)))||s.some((t=>i.includes(t))))&&delete n[t]}function ms(t){delete t.private,delete t.publishConfig,delete t.prettier}const ys=new class{deploy(){return"PRISMA migrate deploy"}deployForce(t){const e=os.packageJson.dependencies?.blitz?"db":"prisma";return`rm -Rf ${e}/mount/prod.sqlite3*; PRISMA migrate reset --force && rm -Rf ${e}/mount/prod.sqlite3*\n && litestream restore -o ${e}/mount/prod.sqlite3 ${t} && ALLOW_TO_SKIP_SEED=0 PRISMA migrate deploy`}litestream(){return'node -e \'\nconst { PrismaClient } = require("@prisma/client");\nnew PrismaClient().$queryRaw`PRAGMA journal_mode = WAL;`\n .catch((error) => { console.log("Failed due to:", error); process.exit(1); });\n\''}migrate(){return`PRISMA migrate deploy && PRISMA generate && ${this.seed()}`}migrateDev(){return"PRISMA migrate dev"}reset(){return`PRISMA migrate reset --force --skip-seed && ${this.seed()}`}restore(t,e){return`rm -Rf ${os.packageJson.dependencies?.blitz?"db":"prisma"}/restored.sqlite3; GOOGLE_APPLICATION_CREDENTIALS=gcp-sa-key.json litestream restore -o ${e} ${t}`}seed(t){return os.packageJson.dependencies?.blitz?"YARN blitz db seed"+(t?` -f ${t}`:""):t?"YARN build-ts run prisma/seeds.ts":os.packageJson.prisma?.seed?"YARN prisma db seed":'if [ -e "prisma/seeds.ts" ]; then YARN build-ts run prisma/seeds.ts; fi'}studio(e){let s="";if(e)try{new URL(e),s=`DATABASE_URL=${e} `}catch{const n=t.resolve(e);console.info(e,n),s=`DATABASE_URL=file://${n} `}return`${s}PRISMA studio`}},bs=new k,ws=new Set;async function vs(t){try{await E(t)}catch{}}const Os={exitIfFailed:!0};async function ks(t,e,s=Os){const[n,i]=As(t);if(_s(n),e.verbose&&_s(i,"Start (raw)",!0),e.dryRun)return $s(n,0,s),0;const r=i.match(/http:\/\/127.0.0.1:(\d+)/)?.[1];i.includes("wait-on")&&r&&!i.includes("docker run")&&await async function(t){await vs(t);const e=async()=>{ws.has(t)||(ws.add(t),await vs(t))};for(const t of["beforeExit","SIGINT","SIGTERM","SIGQUIT"])process.on(t,e)}(Number(r));const o=await P(i,void 0,{cwd:os.dirPath,shell:!0,stdio:"inherit",timeout:s?.timeout,killOnExit:!0,verbose:e.verbose});return $s(n,o.status,s),o.status??1}function Es(t,e,s=Os){return bs.run((async()=>{const[n,i]=As(t);if(_s(n,"Start (parallel)",!0),e.dryRun)return _s(n,"Started (log)"),e.verbose&&_s(i,"Started (raw)",!0),void $s(n,0,s);const r=await P(i,void 0,{cwd:os.dirPath,shell:!0,stdio:"pipe",timeout:s?.timeout,mergeOutAndError:!0,killOnExit:!0,verbose:e.verbose});_s(n,"Started (log)"),e.verbose&&_s(i,"Started (raw)",!0);const o=r.stdout.trim();o&&console.info(o),$s(n,r.status,s)}))}function As(e){const s=function(){if(js)return xs;js=!0;let e=os.dirPath;for(;;){const s=t.join(e,"node_modules",".bin");if(l.existsSync(s)&&(process.env.PATH=`${s}:${process.env.PATH}`,xs=!0),l.existsSync(t.join(e,".git")))break;const n=t.dirname(e);if(e===n)break;e=n}return xs}(),n=e.replaceAll("\n","").replaceAll(/\s\s+/g," ").replaceAll("PRISMA ",os.packageJson.dependencies?.blitz?"YARN blitz prisma ":"YARN prisma ").trim();return[n.replaceAll("YARN ","yarn "),n.replaceAll("YARN ",s?"":"yarn ")]}function _s(t,e="Start",s=!1){console.info("\n"+(s?O.gray:O.cyan)(O.bold(`${e}:`),t)+O.gray(` at ${os.dirPath}`))}function $s(t,e,s){0===e?console.info(O.green(O.bold("Finished:"),t)):(console.info(O.red(O.bold(`Failed (exit code ${e}): `),t)),!1!==s.exitIfFailed&&process.exit(e??1))}let js=!1,xs=!1;const Cs={},Ps={command:"prisma",describe:"Run prisma commands",builder:t=>t.command(Ss).command(Ms).command(Ds).command(Is).command(Ws).command(Rs).command(zs).command(Fs).command(Bs).demandCommand(),handler(){}},Ss={command:"deploy",describe:"Apply migration to DB without initializing it",builder:Cs,async handler(t){await ks(ys.deploy(),t)}},Ns={...Cs,"backup-path":{description:"Whether to skip actual command execution",demandOption:!0,type:"string",alias:"b"}},Ms={command:"deploy-force <backup-path>",describe:"Force to apply migration to DB utilizing Litestream's backup without initializing it",builder:Ns,async handler(t){await ks(ys.deployForce(t.backupPath),t)}},Ds={command:"litestream",describe:"Setup DB for Litestream",builder:Cs,async handler(t){await ks(ys.litestream(),t)}},Is={command:"migrate",describe:"Apply migration to DB with initializing it",builder:Cs,async handler(t){await ks(ys.migrate(),t)}},Ws={command:"migrate-dev",describe:"Create a migration file",builder:Cs,async handler(t){await ks(ys.migrateDev(),t)}},Rs={command:"reset",describe:"Reset DB",builder:Cs,async handler(t){await ks(ys.reset(),t)}},zs={command:"restore <backup-path>",describe:"Restore DB from Litestream's backup",builder:{...Ns,output:{description:'Output path of the restored database. Defaults to "<db|prisma>/restored.sqlite3".',type:"string"}},async handler(t){const e=t.output||(os.packageJson.dependencies?.blitz?"db/restored.sqlite3":"prisma/restored.sqlite3");await ks(ys.restore(t.backupPath,e),t)}},Fs={command:"seed",describe:"Populate DB with seed data",builder:{...Cs,file:{alias:"f",description:"Path of the seed script.",type:"string"}},async handler(t){await ks(ys.seed(t.file),t)}},Bs={command:"studio [db-url-or-path]",describe:"Open Prisma Studio",builder:{...Cs,"db-url-or-path":{description:"URL or path to the database",type:"string"},restored:{description:"Whether to open the default restored database (<db|prisma>/restored.sqlite3).",type:"boolean"}},async handler(t){if(t.restored&&t.dbUrlOrPath)throw new Error("You cannot specify both --restored and --db-url-or-path.");const e=t.restored?os.packageJson.dependencies?.blitz?"db/restored.sqlite3":"prisma/restored.sqlite3":t.dbUrlOrPath?.toString();await ks(ys.studio(e),t)}},Ls={command:"retry",describe:"Retry the given command until it succeeds",builder:{retry:{description:"A maximum retry count",type:"number",alias:"r",default:3}},async handler(t){const e=t._.slice(1);let s=0;for(let n=0;n<t.retry;n++)if(n>0&&console.info(`\n${O.yellow(`#${n} Retrying: ${e.join(" ")}`)}`),s=await ks(e.join(" "),t,{exitIfFailed:!1}),0===s)return;process.exit(s)}},Ts={command:"setup",describe:"Setup development environment",builder:{},async handler(t){await async function(t){const e=await _.readdir(os.dirPath,{withFileTypes:!0});e.some((t=>t.isFile()&&t.name.includes("-version")))&&await ks("asdf install",t);if(e.some((t=>t.isFile()&&"pyproject.toml"===t.name))){await Es("poetry config virtualenvs.in-project true",t),await Es("poetry config virtualenvs.prefer-active-python true",t);const[,e]=y.execSync("asdf current python").toString().trim().split(/\s+/);await Es(`poetry env use ${e}`,t),await bs.promiseAll(),await ks("poetry run pip install --upgrade pip",t),await ks("poetry install --ansi",t)}if("darwin"===$.platform()){const e=["pstree"];os.hasDockerfile&&e.push("expect"),await Es(`brew install ${e.join(" ")}`,t)}const s=os.packageJson.dependencies??{},n=os.packageJson.devDependencies||{},i=os.packageJson.scripts??{},r=[],o=[];s.blitz||s.next||n["@remix-run/dev"]?(r.push("pm2"),o.push("concurrently","open-cli","vitest","wait-on")):(s.express||s.fastify)&&(r.push("pm2"),o.push("concurrently","vitest","wait-on"));r.length>0&&await ks(`yarn add ${r.join(" ")}`,t);o.length>0&&await ks(`yarn add -D ${o.join(" ")}`,t);i["gen-code"]&&await ks("yarn gen-code",t)}(t)}};const Vs=new class{buildDevImage(e="local"){const s=os.dockerPackageJson.scripts?.["docker/build/prepare"]?"yarn run docker/build/prepare && ":"";return`cd ${t.dirname(os.findFile("Dockerfile"))}\n && ${s}YARN wb optimizeForDockerBuild --outside\n && YARN wb retry -- docker build -t ${os.nameWithoutNamespace}\n --build-arg ARCH=$([ $(uname -m) = 'arm64' ] && echo arm64 || echo amd64)\n --build-arg WB_ENV=${e}\n --build-arg WB_VERSION=dev .`}stopAndStart(t=!1,e="",s=""){return`${this.stop()} && ${t?"unbuffer ":""}${this.start(e,s)}`}start(t="",e=""){return function(t){const e=async()=>{if(ws.has(t))return;ws.add(t),_s(t);const{status:e}=w(t,{cwd:os.dirPath,shell:!0,stdio:"inherit"});$s(t,e,{})};for(const t of["beforeExit","SIGINT","SIGTERM","SIGQUIT"])process.on(t,e)}(this.stop()),`docker run --rm -it -p 8080:8080 --name ${os.nameWithoutNamespace} ${t} ${os.nameWithoutNamespace} ${e}`}stop(){return`true $(docker rm -f $(docker container ls -q -f name=${os.nameWithoutNamespace}) 2> /dev/null)`}stopAll(){return"true $(docker rm -f $(docker ps -q) 2> /dev/null)"}};class Us{constructor(t=3e3){this.defaultPort=t}buildDocker(t,e="local"){return Vs.buildDevImage(e)}startDocker(t){return`${this.buildDocker(t)}\n && YARN concurrently --raw --kill-others-on-fail\n "${Vs.stopAndStart(!1,t.normalizedDockerArgsText??"",t.normalizedArgsText??"")}"\n "${this.waitAndOpenApp(t,8080)}"`}testE2E(t,{playwrightArgs:e,prismaDirectory:s,startCommand:n}){const i=process.env.WB_ENV;return`WB_ENV=${i} NEXT_PUBLIC_WB_ENV=${i} APP_ENV=${i} PORT=8080 YARN concurrently --kill-others --raw --success first\n "rm -Rf ${s}/mount && ${n} && exit 1"\n "concurrently --kill-others-on-fail --raw 'wait-on -t 600000 -i 2000 http://127.0.0.1:8080' 'yarn playwright install --with-deps'\n && yarn playwright ${e}"`}testE2EDev(t,{playwrightArgs:e,startCommand:s}){const n=process.env.WB_ENV;return`WB_ENV=${n} NEXT_PUBLIC_WB_ENV=${n} APP_ENV=${n} PORT=8080 YARN concurrently --kill-others --raw --success first\n "${s} && exit 1"\n "concurrently --kill-others-on-fail --raw 'wait-on -t 600000 -i 2000 http://127.0.0.1:8080' 'yarn playwright install --with-deps'\n && yarn playwright ${e}"`}testUnit(t){return`WB_ENV=${process.env.WB_ENV} YARN vitest run tests/unit --color --passWithNoTests`}waitApp(t,e=this.defaultPort){return`wait-on -t 10000 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 10000 -i 500 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 10000 -i 1000 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 10000 -i 2000 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 20000 -i 4000 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 60000 -i 5000 http://127.0.0.1:${e}`}waitAndOpenApp(t,e=this.defaultPort){return`${this.waitApp(t,e)} || wait-on http://127.0.0.1:${e} && open-cli http://localhost:${e}`}}const Hs=new class extends Us{constructor(){super()}start(t){return`${process.env.WB_ENV?`APP_ENV=${process.env.WB_ENV} `:""}YARN concurrently --raw --kill-others-on-fail\n "blitz dev ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t)}"`}startProduction(t,e){return`${process.env.WB_ENV?`APP_ENV=${process.env.WB_ENV} `:""}NODE_ENV=production YARN concurrently --raw --kill-others-on-fail\n "${ys.reset()} && ${os.getBuildCommand(t)} && PORT=${e} pm2-runtime start ${os.findFile("ecosystem.config.cjs")} ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t,e)}"`}testE2E(t,{playwrightArgs:e="test tests/e2e",startCommand:s=`${ys.reset()} && ${os.getBuildCommand(t)} && pm2-runtime start ${os.findFile("ecosystem.config.cjs")}`}){return super.testE2E(t,{playwrightArgs:e,prismaDirectory:"db",startCommand:s})}testE2EDev(t,{playwrightArgs:e="test tests/e2e",startCommand:s="blitz dev -p 8080"}){return super.testE2EDev(t,{playwrightArgs:e,startCommand:s})}testStart(t){return`YARN concurrently --kill-others --raw --success first "blitz dev" "${this.waitApp(t)}"`}};const qs=new class extends Us{constructor(){super()}start(t){return`YARN build-ts run src/index.ts ${t.watch?"--watch":""} -- ${t.normalizedArgsText??""}`}startDocker(t){return`${this.buildDocker(t)} && ${Vs.stopAndStart(!1,t.normalizedDockerArgsText??"",t.normalizedArgsText??"")}`}startProduction(t,e=8080){return`NODE_ENV=production ${os.getBuildCommand(t)} && NODE_ENV=production PORT=\${PORT:-${e}} node dist/index.js ${t.normalizedArgsText??""}`}testE2E(t,{startCommand:e=`if [ -e "prisma" ]; then prisma migrate reset --force --skip-generate; fi && (${this.startProduction(t)})`}){return`NODE_ENV=production WB_ENV=${process.env.WB_ENV} PORT=8080 YARN concurrently --kill-others --raw --success first\n "${e} && exit 1"\n "wait-on -t 600000 -i 2000 http://127.0.0.1:8080 && vitest run tests/e2e --color --passWithNoTests"`}testE2EDev(t,{startCommand:e}){return`NODE_ENV=production WB_ENV=${process.env.WB_ENV} PORT=8080 YARN concurrently --kill-others --raw --success first\n "${e||this.start(t)} && exit 1"\n "wait-on -t 600000 -i 2000 http://127.0.0.1:8080 && vitest run tests/e2e --color --passWithNoTests"`}testStart(t){return`YARN concurrently --kill-others --raw --success first "${this.start(t)}" "${this.waitApp(t)}"`}};const Ys=new class extends Us{constructor(){super()}start(t){return`YARN concurrently --raw --kill-others-on-fail\n "next dev ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t)}"`}startProduction(t,e){return`NODE_ENV=production YARN concurrently --raw --kill-others-on-fail\n "${ys.reset()} && ${os.getBuildCommand(t)} && PORT=${e} pm2-runtime start ${os.findFile("ecosystem.config.cjs")} ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t,e)}"`}testE2E(t,{playwrightArgs:e="test tests/e2e",startCommand:s=`${ys.reset()} && ${os.getBuildCommand(t)} && pm2-runtime start ${os.findFile("ecosystem.config.cjs")}`}){return super.testE2E(t,{playwrightArgs:e,prismaDirectory:"db",startCommand:s})}testE2EDev(t,{playwrightArgs:e="test tests/e2e",startCommand:s="next dev -p 8080"}){return super.testE2EDev(t,{playwrightArgs:e,startCommand:s})}testStart(t){return`YARN concurrently --kill-others --raw --success first "next dev" "${this.waitApp(t)}"`}};const Js=new class extends Us{constructor(){super()}start(t){return`YARN build-ts run src/index.ts ${t.watch?"--watch":""} -- ${t.normalizedArgsText??""}`}startDocker(t){return`${this.buildDocker(t)} && ${Vs.stopAndStart(!1,t.normalizedDockerArgsText??"",t.normalizedArgsText??"")}`}startProduction(t){return`NODE_ENV=production ${os.getBuildCommand(t)} && NODE_ENV=production node dist/index.js ${t.normalizedArgsText??""}`}testE2E(){return"echo 'do nothing.'"}testE2EDev(){return"echo 'do nothing.'"}testStart(){return"echo 'do nothing.'"}};const Gs=new class extends Us{constructor(){super()}start(t){return`YARN concurrently --raw --kill-others-on-fail\n "remix dev ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t)}"`}startProduction(t,e){return`NODE_ENV=production YARN concurrently --raw --kill-others-on-fail\n "${ys.reset()} && ${os.getBuildCommand(t)} && PORT=${e} pm2-runtime start ${os.findFile("ecosystem.config.cjs")} ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t,e)}"`}testE2E(t,{playwrightArgs:e="test tests/e2e",startCommand:s=`${ys.reset()} && ${os.getBuildCommand(t)} && pm2-runtime start ${os.findFile("ecosystem.config.cjs")}`}){return super.testE2E(t,{playwrightArgs:e,prismaDirectory:"prisma",startCommand:s})}testE2EDev(t,{playwrightArgs:e="test tests/e2e",startCommand:s="remix dev"}){return super.testE2EDev(t,{playwrightArgs:e,startCommand:s})}testStart(t){return`YARN concurrently --kill-others --raw --success first "remix dev" "${this.waitApp(t)}"`}},Ks={command:"start [args..]",describe:"Start app",builder:{watch:{description:"Whether to watch files",type:"boolean"},args:{description:"Arguments for core command",type:"array",alias:"a",default:[]},"docker-args":{description:'Arguments for "docker run"',type:"array",default:[]},mode:{description:"Start mode: dev[elopment] (default) | staging | docker",type:"string",alias:"m"}},async handler(t){!function(t){t.normalizedArgsText=[...t.args??[],...t._?.slice(1)??[]].map((t=>`'${t}'`)).join(" "),t.normalizedDockerArgsText=(t.dockerArgs??[]).map((t=>`'${t}'`)).join(" ")}(t);const e=os.packageJson.dependencies||{},s=os.packageJson.devDependencies||{};let n;switch(n=e.blitz?Hs:e.next?Ys:s["@remix-run/dev"]?Gs:(e.express||e.fastify)&&!e["firebase-functions"]||os.hasDockerfile&&/EXPOSE\s+8080/.test(os.dockerfile)?qs:Js,t.mode||"dev"){case"dev":case"development":{const s=Qs(t,e,"development");await ks(`${s}${n.start(t)}`,t);break}case"staging":{const s=Qs(t,e,"staging");await ks(`${s}${n.startProduction(t,8080)}`,t);break}case"docker":{const s=Qs(t,e,"staging");await ks(`${s}${n.startDocker(t)}`,t);break}default:throw new Error(`Unknown start mode: ${t.mode}`)}}};function Qs(t,e,s){process.env.WB_ENV||=s;let n=`WB_ENV=${process.env.WB_ENV} `;return e.next&&(process.env.NEXT_PUBLIC_WB_ENV=process.env.WB_ENV,n+=`NEXT_PUBLIC_WB_ENV=${process.env.WB_ENV} `),x(t,os.dirPath),n}const Xs={command:"test",describe:"Test project",builder:{ci:{description:"Whether to run tests on CI",type:"boolean"},e2e:{description:"Whether to run e2e tests. You may pass mode as argument: none | headless (default) | headless-dev | headed | headed-dev | docker | docker-debug | debug | generate | trace",type:"string"},start:{description:"Whether to run start tests",type:"boolean"},unit:{description:"Whether to run unit tests",type:"boolean"},"unit-timeout":{description:"Timeout for unit tests",type:"number"}},async handler(e){await async function(e){process.env.FORCE_COLOR="3",await async function(t){if(!os.packageJson.workspaces)return;const e=process.argv.slice(2),s=e.findIndex((t=>["-w","--working-dir","--workingDir"].includes(t)));s>=0&&e.splice(s,2),process.env.CI="1",await ks(["yarn","workspaces","foreach","--all","--exclude",os.name,"--verbose","run","wb",...e].join(" "),t),process.exit(0)}(e);const s=os.packageJson.dependencies||{},n=os.packageJson.devDependencies||{};let i;i=s.blitz?Hs:s.next?Ys:n["@remix-run/dev"]?Gs:!s.express&&!s.fastify||s["firebase-functions"]?Js:qs;const r=[];if(e.ci){const s=C(t.join(os.dirPath,"tests","unit")),n=C(t.join(os.dirPath,"tests","e2e"));if(await Es(Vs.stopAll(),e),!1!==e.unit&&await s&&await Es(i.testUnit(e),e,{timeout:e.unitTimeout}),!1!==e.start&&await Es(i.testStart(e),e),await bs.promiseAll(),"none"!==e.e2e&&await n){os.hasDockerfile&&await ks(`${i.buildDocker(e,"test")}`,e);const t=os.hasDockerfile?{startCommand:Vs.stopAndStart(!0)}:{};process.exitCode=await ks(i.testE2E(e,t),e,{exitIfFailed:!1}),await ks(Vs.stop(),e)}return}(e.unit||!e.start&&void 0===e.e2e)&&r.push(ks(i.testUnit(e),e,{timeout:e.unitTimeout}));e.start&&r.push(ks(i.testStart(e),e));switch(await Promise.all(r),e.e2e){case void 0:case"none":return;case"":case"headless":return void await ks(i.testE2E(e,{}),e);case"headless-dev":return void await ks(i.testE2EDev(e,{}),e);case"docker":return void await Zs(e,i);case"docker-debug":return void await Zs(e,i,"PWDEBUG=1 ")}if(s.blitz||s.next||n["@remix-run/dev"])switch(e.e2e){case"headed":return void await ks(i.testE2E(e,{playwrightArgs:"test tests/e2e --headed"}),e);case"headed-dev":return void await ks(i.testE2EDev(e,{playwrightArgs:"test tests/e2e --headed"}),e);case"debug":return void await ks(`PWDEBUG=1 ${i.testE2E(e,{})}`,e);case"generate":return void await ks(i.testE2E(e,{playwrightArgs:"codegen http://localhost:8080"}),e);case"trace":return void await ks("playwright show-trace",e)}throw new Error(`Unknown e2e mode: ${e.e2e}`)}(e)}};async function Zs(t,e,s=""){await ks(`${e.buildDocker(t,"test")}`,t),process.exitCode=await ks(`${s}${e.testE2E(t,{startCommand:Vs.stopAndStart(!0)})}`,t,{exitIfFailed:!1}),await ks(Vs.stop(),t)}const tn={command:"typecheck",describe:"Run type checking. .env-related options are ignored.",builder:{},async handler(t){const e=[];if(os.packageJson.workspaces?e.push(`yarn workspaces foreach --all --parallel --exclude ${os.name} --verbose run typecheck`):((os.packageJson.dependencies?.typescript||os.packageJson.devDependencies?.typescript)&&e.push("tsc --noEmit --Pretty"),os.packageJson.devDependencies?.pyright&&e.push("pyright")),process.exitCode=await ks(e.join(" && "),t),0!==process.exitCode){(JSON.parse(await _.readFile("package.json","utf8")).dependencies||{}).blitz&&console.info(O.yellow('Please try "yarn gen-code" if you face unknown type errors.'))}}},en={...tn,command:"tc"},sn={env:{description:".env files to be loaded.",type:"array"},"cascade-env":{description:"Environment to load cascading .env files (e.g., `.env`, `.env.<environment>`, `.env.local` and `.env.<environment>.local`). Preferred over `cascade-node-env` and `auto-cascade-env`.",type:"string"},"cascade-node-env":{description:'Same with --cascade-env=<NODE_ENV || "development">. Preferred over `auto-cascade-env`.',type:"boolean"},"auto-cascade-env":{description:'Same with --cascade-env=<WB_ENV || NODE_ENV || "development">.',type:"boolean",default:!0},"check-env":{description:"Check whether the keys of the loaded .env files are same with the given .env file.",type:"string",default:".env.example"},"working-dir":{description:"A working directory",type:"string",alias:"w"},"dry-run":{description:"Whether to skip actual command execution",type:"boolean",alias:"d"},verbose:{description:"Whether to show verbose information",type:"boolean",alias:"v"}};var nn;await is((nn=process.argv,nn.slice(Z()+1))).scriptName("wb").options(sn).middleware((e=>{const s=e["working-dir"];if(s){const e=t.resolve(s);process.chdir(e),os.dirPath=e}!function(t){t.PATH&&t.BERRY_BIN_FOLDER&&(t.PATH=t.PATH.replace(`${t.BERRY_BIN_FOLDER}:`,"").replaceAll(/\/private\/var\/folders\/[^:]+:/g,"").replaceAll(/\/var\/tmp\/[^:]+:/g,"").replaceAll(/\/tmp\/[^:]+:/g,""));for(const e of Object.keys(t)){const s=e.toUpperCase();(s.startsWith("NPM_")||s.startsWith("YARN_")||s.startsWith("BERRY_")||"PROJECT_CWD"===s||"INIT_CWD"===s)&&delete t[e]}}(process.env);const n=e._[0].toString();["start","tc","typecheck"].includes(n)||("test"===n&&(process.env.WB_ENV||="test"),x(e,os.dirPath))})).command(as).command(fs).command(Ps).command(Ls).command(Ts).command(Ks).command(Xs).command(tn).command(en).demandCommand().strict().help().argv;for(const t of["SIGINT","SIGTERM","SIGQUIT"])process.on(t,(()=>process.exit()));
|
|
33
|
+
var H,q,Y;const J=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,G=null!==(q=null===(H=null===process||void 0===process?void 0:process.versions)||void 0===H?void 0:H.node)&&void 0!==q?q:null===(Y=null===process||void 0===process?void 0:process.version)||void 0===Y?void 0:Y.slice(1);if(G){if(Number(G.match(/^([^.]+)/)[1])<J)throw Error(`yargs parser supports a minimum Node.js version of ${J}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`)}const K=process?process.env:{},Q=new class{constructor(t){T=t}parse(t,e){const s=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),n=function(t){if(Array.isArray(t))return t.map((t=>"string"!=typeof t?t+"":t));t=t.trim();let e=0,s=null,n=null,i=null;const r=[];for(let o=0;o<t.length;o++)s=n,n=t.charAt(o)," "!==n||i?(n===i?i=null:"'"!==n&&'"'!==n||i||(i=n),r[e]||(r[e]=""),r[e]+=n):" "!==s&&e++;return r}(t),i="string"==typeof t,r=function(t){const e=[],s=Object.create(null);let n=!0;Object.keys(t).forEach((function(s){e.push([].concat(t[s],s))}));for(;n;){n=!1;for(let t=0;t<e.length;t++)for(let s=t+1;s<e.length;s++){if(e[t].filter((function(t){return-1!==e[s].indexOf(t)})).length){e[t]=e[t].concat(e[s]),e.splice(s,1),n=!0;break}}}return e.forEach((function(t){const e=(t=t.filter((function(t,e,s){return s.indexOf(t)===e}))).pop();void 0!==e&&"string"==typeof e&&(s[e]=t)})),s}(Object.assign(Object.create(null),s.alias)),o=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},s.configuration),a=Object.assign(Object.create(null),s.default),c=s.configObjects||[],l=s.envPrefix,h=o["populate--"],d=h?"--":"_",u=Object.create(null),f=Object.create(null),p=s.__||T.format,g={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:[]},m=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,y=new RegExp("^--"+o["negation-prefix"]+"(.+)");[].concat(s.array||[]).filter(Boolean).forEach((function(t){const e="object"==typeof t?t.key:t,s=Object.keys(t).map((function(t){return{boolean:"bools",string:"strings",number:"numbers"}[t]})).filter(Boolean).pop();s&&(g[s][e]=!0),g.arrays[e]=!0,g.keys.push(e)})),[].concat(s.boolean||[]).filter(Boolean).forEach((function(t){g.bools[t]=!0,g.keys.push(t)})),[].concat(s.string||[]).filter(Boolean).forEach((function(t){g.strings[t]=!0,g.keys.push(t)})),[].concat(s.number||[]).filter(Boolean).forEach((function(t){g.numbers[t]=!0,g.keys.push(t)})),[].concat(s.count||[]).filter(Boolean).forEach((function(t){g.counts[t]=!0,g.keys.push(t)})),[].concat(s.normalize||[]).filter(Boolean).forEach((function(t){g.normalize[t]=!0,g.keys.push(t)})),"object"==typeof s.narg&&Object.entries(s.narg).forEach((([t,e])=>{"number"==typeof e&&(g.nargs[t]=e,g.keys.push(t))})),"object"==typeof s.coerce&&Object.entries(s.coerce).forEach((([t,e])=>{"function"==typeof e&&(g.coercions[t]=e,g.keys.push(t))})),void 0!==s.config&&(Array.isArray(s.config)||"string"==typeof s.config?[].concat(s.config).filter(Boolean).forEach((function(t){g.configs[t]=!0})):"object"==typeof s.config&&Object.entries(s.config).forEach((([t,e])=>{"boolean"!=typeof e&&"function"!=typeof e||(g.configs[t]=e)}))),function(...t){t.forEach((function(t){Object.keys(t||{}).forEach((function(t){g.aliases[t]||(g.aliases[t]=[].concat(r[t]||[]),g.aliases[t].concat(t).forEach((function(e){if(/-/.test(e)&&o["camel-case-expansion"]){const s=z(e);s!==t&&-1===g.aliases[t].indexOf(s)&&(g.aliases[t].push(s),u[s]=!0)}})),g.aliases[t].concat(t).forEach((function(e){if(e.length>1&&/[A-Z]/.test(e)&&o["camel-case-expansion"]){const s=F(e,"-");s!==t&&-1===g.aliases[t].indexOf(s)&&(g.aliases[t].push(s),u[s]=!0)}})),g.aliases[t].forEach((function(e){g.aliases[e]=[t].concat(g.aliases[t].filter((function(t){return e!==t})))})))}))}))}(s.key,r,s.default,g.arrays),Object.keys(a).forEach((function(t){(g.aliases[t]||[]).forEach((function(e){a[e]=a[t]}))}));let b=null;Object.keys(g.counts).find((t=>D(t,g.arrays)?(b=Error(p("Invalid configuration: %s, opts.count excludes opts.array.",t)),!0):!!D(t,g.nargs)&&(b=Error(p("Invalid configuration: %s, opts.count excludes opts.narg.",t)),!0)));let w=[];const v=Object.assign(Object.create(null),{_:[]}),O={};for(let t=0;t<n.length;t++){const e=n[t],s=e.replace(/^-{3,}/,"---");let i,r,a,c,l,h;if("--"!==e&&/^-/.test(e)&&W(e))k(e);else{if(s.match(/^---+(=|$)/)){k(e);continue}if(e.match(/^--.+=/)||!o["short-option-groups"]&&e.match(/^-.+=/))c=e.match(/^--?([^=]+)=([\s\S]*)$/),null!==c&&Array.isArray(c)&&c.length>=3&&(D(c[1],g.arrays)?t=A(t,c[1],n,c[2]):!1!==D(c[1],g.nargs)?t=E(t,c[1],n,c[2]):_(c[1],c[2],!0));else if(e.match(y)&&o["boolean-negation"])c=e.match(y),null!==c&&Array.isArray(c)&&c.length>=2&&(r=c[1],_(r,!!D(r,g.arrays)&&[!1]));else if(e.match(/^--.+/)||!o["short-option-groups"]&&e.match(/^-[^-]+/))c=e.match(/^--?(.+)/),null!==c&&Array.isArray(c)&&c.length>=2&&(r=c[1],D(r,g.arrays)?t=A(t,r,n):!1!==D(r,g.nargs)?t=E(t,r,n):(l=n[t+1],void 0===l||l.match(/^-/)&&!l.match(m)||D(r,g.bools)||D(r,g.counts)?/^(true|false)$/.test(l)?(_(r,l),t++):_(r,R(r)):(_(r,l),t++)));else if(e.match(/^-.\..+=/))c=e.match(/^-([^=]+)=([\s\S]*)$/),null!==c&&Array.isArray(c)&&c.length>=3&&_(c[1],c[2]);else if(e.match(/^-.\..+/)&&!e.match(m))l=n[t+1],c=e.match(/^-(.\..+)/),null!==c&&Array.isArray(c)&&c.length>=2&&(r=c[1],void 0===l||l.match(/^-/)||D(r,g.bools)||D(r,g.counts)?_(r,R(r)):(_(r,l),t++));else if(e.match(/^-[^-]+/)&&!e.match(m)){a=e.slice(1,-1).split(""),i=!1;for(let s=0;s<a.length;s++){if(l=e.slice(s+2),a[s+1]&&"="===a[s+1]){h=e.slice(s+3),r=a[s],D(r,g.arrays)?t=A(t,r,n,h):!1!==D(r,g.nargs)?t=E(t,r,n,h):_(r,h),i=!0;break}if("-"!==l){if(/[A-Za-z]/.test(a[s])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(l)&&!1===D(l,g.bools)){_(a[s],l),i=!0;break}if(a[s+1]&&a[s+1].match(/\W/)){_(a[s],l),i=!0;break}_(a[s],R(a[s]))}else _(a[s],l)}r=e.slice(-1)[0],i||"-"===r||(D(r,g.arrays)?t=A(t,r,n):!1!==D(r,g.nargs)?t=E(t,r,n):(l=n[t+1],void 0===l||/^(-|--)[^-]/.test(l)&&!l.match(m)||D(r,g.bools)||D(r,g.counts)?/^(true|false)$/.test(l)?(_(r,l),t++):_(r,R(r)):(_(r,l),t++)))}else if(e.match(/^-[0-9]$/)&&e.match(m)&&D(e.slice(1),g.bools))r=e.slice(1),_(r,R(r));else{if("--"===e){w=n.slice(t+1);break}if(o["halt-at-non-option"]){w=n.slice(t);break}k(e)}}}function k(t){const e=x("_",t);"string"!=typeof e&&"number"!=typeof e||v._.push(e)}function E(t,e,s,n){let i,r=D(e,g.nargs);if(r="number"!=typeof r||isNaN(r)?1:r,0===r)return H(n)||(b=Error(p("Argument unexpected for: %s",e))),_(e,R(e)),t;let a=H(n)?0:1;if(o["nargs-eats-options"])s.length-(t+1)+a<r&&(b=Error(p("Not enough arguments following: %s",e))),a=r;else{for(i=t+1;i<s.length&&(!s[i].match(/^-[^0-9]/)||s[i].match(m)||W(s[i]));i++)a++;a<r&&(b=Error(p("Not enough arguments following: %s",e)))}let c=Math.min(a,r);for(!H(n)&&c>0&&(_(e,n),c--),i=t+1;i<c+t+1;i++)_(e,s[i]);return t+c}function A(t,e,s,n){let r=[],c=n||s[t+1];const l=D(e,g.nargs);if(D(e,g.bools)&&!/^(true|false)$/.test(c))r.push(!0);else if(H(c)||H(n)&&/^-/.test(c)&&!m.test(c)&&!W(c)){if(void 0!==a[e]){const t=a[e];r=Array.isArray(t)?t:[t]}}else{H(n)||r.push(j(e,n,!0));for(let n=t+1;n<s.length&&!(!o["greedy-arrays"]&&r.length>0||l&&"number"==typeof l&&r.length>=l)&&(c=s[n],!/^-/.test(c)||m.test(c)||W(c));n++)t=n,r.push(j(e,c,i))}return"number"==typeof l&&(l&&r.length<l||isNaN(l)&&0===r.length)&&(b=Error(p("Not enough arguments following: %s",e))),_(e,r),t}function _(t,e,s=i){if(/-/.test(t)&&o["camel-case-expansion"]){const e=t.split(".").map((function(t){return z(t)})).join(".");$(t,e)}const n=j(t,e,s),r=t.split(".");if(M(v,r,n),g.aliases[t]&&g.aliases[t].forEach((function(t){const e=t.split(".");M(v,e,n)})),r.length>1&&o["dot-notation"]&&(g.aliases[r[0]]||[]).forEach((function(e){let s=e.split(".");const i=[].concat(r);i.shift(),s=s.concat(i),(g.aliases[t]||[]).includes(s.join("."))||M(v,s,n)})),D(t,g.normalize)&&!D(t,g.arrays)){[t].concat(g.aliases[t]||[]).forEach((function(t){Object.defineProperty(O,t,{enumerable:!0,get:()=>e,set(t){e="string"==typeof t?T.normalize(t):t}})}))}}function $(t,e){g.aliases[t]&&g.aliases[t].length||(g.aliases[t]=[e],u[e]=!0),g.aliases[e]&&g.aliases[e].length||$(e,t)}function j(t,e,s){s&&(e=function(t){return"string"!=typeof t||"'"!==t[0]&&'"'!==t[0]||t[t.length-1]!==t[0]?t:t.substring(1,t.length-1)}(e)),(D(t,g.bools)||D(t,g.counts))&&"string"==typeof e&&(e="true"===e);let n=Array.isArray(e)?e.map((function(e){return x(t,e)})):x(t,e);return D(t,g.counts)&&(H(n)||"boolean"==typeof n)&&(n=V()),D(t,g.normalize)&&D(t,g.arrays)&&(n=Array.isArray(e)?e.map((t=>T.normalize(t))):T.normalize(e)),n}function x(t,e){if(!o["parse-positional-numbers"]&&"_"===t)return e;if(!D(t,g.strings)&&!D(t,g.bools)&&!Array.isArray(e)){(B(e)&&o["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${e}`)))||!H(e)&&D(t,g.numbers))&&(e=Number(e))}return e}function C(t,e){Object.keys(t).forEach((function(s){const n=t[s],i=e?e+"."+s:s;"object"==typeof n&&null!==n&&!Array.isArray(n)&&o["dot-notation"]?C(n,i):(!N(v,i.split("."))||D(i,g.arrays)&&o["combine-arrays"])&&_(i,n)}))}function P(t,e){if(void 0===l)return;const s="string"==typeof l?l:"",n=T.env();Object.keys(n).forEach((function(i){if(""===s||0===i.lastIndexOf(s,0)){const r=i.split("__").map((function(t,e){return 0===e&&(t=t.substring(s.length)),z(t)}));(e&&g.configs[r.join(".")]||!e)&&!N(t,r)&&_(r.join("."),n[i])}}))}function S(t,e,s,n=!1){Object.keys(s).forEach((function(i){N(t,i.split("."))||(M(t,i.split("."),s[i]),n&&(f[i]=!0),(e[i]||[]).forEach((function(e){N(t,e.split("."))||M(t,e.split("."),s[i])})))}))}function N(t,e){let s=t;o["dot-notation"]||(e=[e.join(".")]),e.slice(0,-1).forEach((function(t){s=s[t]||{}}));const n=e[e.length-1];return"object"==typeof s&&n in s}function M(t,e,s){let n=t;o["dot-notation"]||(e=[e.join(".")]),e.slice(0,-1).forEach((function(t){t=U(t),"object"==typeof n&&void 0===n[t]&&(n[t]={}),"object"!=typeof n[t]||Array.isArray(n[t])?(Array.isArray(n[t])?n[t].push({}):n[t]=[n[t],{}],n=n[t][n[t].length-1]):n=n[t]}));const i=U(e[e.length-1]),r=D(e.join("."),g.arrays),a=Array.isArray(s);let c=o["duplicate-arguments-array"];!c&&D(i,g.nargs)&&(c=!0,(!H(n[i])&&1===g.nargs[i]||Array.isArray(n[i])&&n[i].length===g.nargs[i])&&(n[i]=void 0)),s===V()?n[i]=V(n[i]):Array.isArray(n[i])?c&&r&&a?n[i]=o["flatten-duplicate-arrays"]?n[i].concat(s):(Array.isArray(n[i][0])?n[i]:[n[i]]).concat([s]):c||Boolean(r)!==Boolean(a)?n[i]=n[i].concat([s]):n[i]=s:void 0===n[i]&&r?n[i]=a?s:[s]:!c||void 0===n[i]||D(i,g.counts)||D(i,g.bools)?n[i]=s:n[i]=[n[i],s]}function D(t,e){const s=[].concat(g.aliases[t]||[],t),n=Object.keys(e),i=s.find((t=>n.includes(t)));return!!i&&e[i]}function I(t){const e=Object.keys(g);return[].concat(e.map((t=>g[t]))).some((function(e){return Array.isArray(e)?e.includes(t):e[t]}))}function W(t){return o["unknown-options-as-args"]&&function(t){if(t=t.replace(/^-{3,}/,"--"),t.match(m))return!1;if(function(t){if(t.match(m)||!t.match(/^-[^-]+/))return!1;let e,s=!0;const n=t.slice(1).split("");for(let i=0;i<n.length;i++){if(e=t.slice(i+2),!I(n[i])){s=!1;break}if(n[i+1]&&"="===n[i+1]||"-"===e||/[A-Za-z]/.test(n[i])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(e)||n[i+1]&&n[i+1].match(/\W/))break}return s}(t))return!1;return!function(t,...e){return[].concat(...e).some((function(e){const s=t.match(e);return s&&I(s[1])}))}(t,/^-+([^=]+?)=[\s\S]*$/,y,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}(t)}function R(t){return D(t,g.bools)||D(t,g.counts)||!(`${t}`in a)?(e=function(t){let e=L.BOOLEAN;return D(t,g.strings)?e=L.STRING:D(t,g.numbers)?e=L.NUMBER:D(t,g.bools)?e=L.BOOLEAN:D(t,g.arrays)&&(e=L.ARRAY),e}(t),{[L.BOOLEAN]:!0,[L.STRING]:"",[L.NUMBER]:void 0,[L.ARRAY]:[]}[e]):a[t];var e}function H(t){return void 0===t}return P(v,!0),P(v,!1),function(t){const e=Object.create(null);S(e,g.aliases,a),Object.keys(g.configs).forEach((function(s){const n=t[s]||e[s];if(n)try{let t=null;const e=T.resolve(T.cwd(),n),i=g.configs[s];if("function"==typeof i){try{t=i(e)}catch(e){t=e}if(t instanceof Error)return void(b=t)}else t=T.require(e);C(t)}catch(e){"PermissionDenied"===e.name?b=e:t[s]&&(b=Error(p("Invalid JSON config file: %s",n)))}}))}(v),void 0!==c&&c.forEach((function(t){C(t)})),S(v,g.aliases,a,!0),function(t){let e;const s=new Set;Object.keys(t).forEach((function(n){if(!s.has(n)&&(e=D(n,g.coercions),"function"==typeof e))try{const i=x(n,e(t[n]));[].concat(g.aliases[n]||[],n).forEach((e=>{s.add(e),t[e]=i}))}catch(t){b=t}}))}(v),o["set-placeholder-key"]&&function(t){g.keys.forEach((e=>{~e.indexOf(".")||void 0===t[e]&&(t[e]=void 0)}))}(v),Object.keys(g.counts).forEach((function(t){N(v,t.split("."))||_(t,0)})),h&&w.length&&(v[d]=[]),w.forEach((function(t){v[d].push(t)})),o["camel-case-expansion"]&&o["strip-dashed"]&&Object.keys(v).filter((t=>"--"!==t&&t.includes("-"))).forEach((t=>{delete v[t]})),o["strip-aliased"]&&[].concat(...Object.keys(r).map((t=>r[t]))).forEach((t=>{o["camel-case-expansion"]&&t.includes("-")&&delete v[t.split(".").map((t=>z(t))).join(".")],delete v[t]})),{aliases:Object.assign({},g.aliases),argv:Object.assign(O,v),configuration:o,defaulted:Object.assign({},f),error:b,newAliases:Object.assign({},u)}}}({cwd:process.cwd,env:()=>K,format:p,normalize:n,resolve:e,require:t=>{if("undefined"!=typeof require)return require(t);if(t.match(/\.json$/))return JSON.parse(u(t,"utf8"));throw Error("only .json config files are supported in ESM")}}),X=function(t,e){return Q.parse(t.slice(),e).argv};function Z(){return process.versions.electron&&!process.defaultApp?0:1}X.detailed=function(t,e){return Q.parse(t.slice(),e)},X.camelCase=z,X.decamelize=F,X.looksLikeNumber=B;class tt extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,tt)}}var et={fs:{readFileSync:u,writeFile:f},format:p,resolve:e,exists:t=>{try{return h(t).isFile()}catch(t){return!1}}};let st;class nt{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles="boolean"!=typeof t.updateFiles||t.updateFiles,this.locale=t.locale||"en",this.fallbackToLanguage="boolean"!=typeof t.fallbackToLanguage||t.fallbackToLanguage,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if("string"!=typeof arguments[0])return this._taggedLiteral(arguments[0],...arguments);const e=t.shift();let s=function(){};return"function"==typeof t[t.length-1]&&(s=t.pop()),s=s||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:s})):s(),st.format.apply(st.format,[this.cache[this.locale][e]||e].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),e=t.shift(),s=t.shift(),n=t.shift();let i=function(){};"function"==typeof t[t.length-1]&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let r=1===n?e:s;if(this.cache[this.locale][e]){r=this.cache[this.locale][e][1===n?"one":"other"]}!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:s},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const o=[r];return~r.indexOf("%d")&&o.push(n),st.format.apply(st.format,o.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let s="";return t.forEach((function(t,n){const i=e[n+1];s+=t,void 0!==i&&(s+="%s")})),this.__.apply(this,[s].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),1===this.writeQueue.length&&this._processWriteQueue()}_processWriteQueue(){const t=this,e=this.writeQueue[0],s=e.directory,n=e.locale,i=e.cb,r=this._resolveLocaleFile(s,n),o=JSON.stringify(this.cache[n],null,2);st.fs.writeFile(r,o,"utf-8",(function(e){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(e)}))}_readLocaleFile(){let t={};const e=this._resolveLocaleFile(this.directory,this.locale);try{st.fs.readFileSync&&(t=JSON.parse(st.fs.readFileSync(e,"utf-8")))}catch(s){if(s instanceof SyntaxError&&(s.message="syntax error in "+e),"ENOENT"!==s.code)throw s;t={}}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let s=st.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(s)&&~e.lastIndexOf("_")){const n=st.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(n)&&(s=n)}return s}_fileExistsSync(t){return st.exists(t)}}const it="loading a directory of commands is not supported yet for ESM";let rt;try{rt=m(import.meta.url)}catch(t){rt=process.cwd()}var ot,at={assert:{notStrictEqual:a,strictEqual:c},cliui:function(t){return function(t,e){return D=e,new N({width:(null==t?void 0:t.width)||("object"==typeof process&&process.stdout&&process.stdout.columns?process.stdout.columns:80),wrap:null==t?void 0:t.wrap})}(t,{stringWidth:t=>[...t].length,stripAnsi:W,wrap:R})},findUp:function(t,n){let i,r=e(".",t);for(h(r).isDirectory()||(r=s(r));;){if(i=n(r,d(r)),i)return e(r,i);if(r=s(i=r),i===r)break}},getEnv:t=>process.env[t],inspect:g,getCallerFile:()=>{throw new tt(it)},getProcessArgvBin:function(){return process.argv[Z()]},mainFilename:rt.substring(0,rt.lastIndexOf("node_modules"))||process.cwd(),Parser:X,path:{basename:i,dirname:s,extname:r,relative:o,resolve:e},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:u,require:()=>{throw new tt("require is not supported by ESM")},requireDirectory:()=>{throw new tt(it)},stringWidth:t=>[...t].length,y18n:(ot={directory:e(rt,"../../../locales"),updateFiles:!1},function(t,e){st=e;const s=new nt(t);return{__:s.__.bind(s),__n:s.__n.bind(s),setLocale:s.setLocale.bind(s),getLocale:s.getLocale.bind(s),updateLocale:s.updateLocale.bind(s),locale:s.locale}}(ot,et))};function ct(t,e,s,n){s.assert.notStrictEqual(t,e,n)}function lt(t,e){e.assert.strictEqual(typeof t,"string")}function ht(t){return Object.keys(t)}function dt(t){return!!t&&!!t.then&&"function"==typeof t.then}function ut(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,n=e.shift();if(!n)throw new Error(`No command found in: ${t}`);const i={cmd:n.replace(s,""),demanded:[],optional:[]};return e.forEach(((t,n)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&n===e.length-1&&(r=!0),/^\[/.test(t)?i.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):i.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})})),i}const ft=["first","second","third","fourth","fifth","sixth"];function pt(t,e,s){try{let n=0;const[i,r,o]="object"==typeof t?[{demanded:[],optional:[]},t,e]:[ut(`cmd ${t}`),e,s],a=[].slice.call(r);for(;a.length&&void 0===a[a.length-1];)a.pop();const c=o||a.length;if(c<i.demanded.length)throw new tt(`Not enough arguments provided. Expected ${i.demanded.length} but received ${a.length}.`);const l=i.demanded.length+i.optional.length;if(c>l)throw new tt(`Too many arguments provided. Expected max ${l} but received ${c}.`);i.demanded.forEach((t=>{const e=gt(a.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&mt(e,t.cmd,n),n+=1})),i.optional.forEach((t=>{if(0===a.length)return;const e=gt(a.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&mt(e,t.cmd,n),n+=1}))}catch(t){console.warn(t.stack)}}function gt(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function mt(t,e,s){throw new tt(`Invalid ${ft[s]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}class yt{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,n=!1){if(pt("<array|function> [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let n=0;n<t.length;n++){if("function"!=typeof t[n])throw Error("middleware must be a function");const i=t[n];i.applyBeforeValidation=e,i.global=s}Array.prototype.push.apply(this.globalMiddleware,t)}else if("function"==typeof t){const i=t;i.applyBeforeValidation=e,i.global=s,i.mutates=n,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const s=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((t=>{const n=[...s[e]||[],e];return!t.option||!n.includes(t.option)})),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter((t=>t.global))}}function bt(t,e,s,n){return s.reduce(((t,s)=>{if(s.applyBeforeValidation!==n)return t;if(s.mutates){if(s.applied)return t;s.applied=!0}if(dt(t))return t.then((t=>Promise.all([t,s(t,e)]))).then((([t,e])=>Object.assign(t,e)));{const n=s(t,e);return dt(n)?n.then((e=>Object.assign(t,e))):Object.assign(t,n)}}),t)}function wt(t,e,s=(t=>{throw t})){try{const s="function"==typeof t?t():t;return dt(s)?s.then((t=>e(t))):e(s)}catch(t){return s(t)}}const vt=/(^\*)|(^\$0)/;class Ot{constructor(t,e,s,n){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=n,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,n){"boolean"!=typeof(n=n||{}).recurse&&(n.recurse=!1),Array.isArray(n.extensions)||(n.extensions=["js"]);const i="function"==typeof n.visit?n.visit:t=>t;n.visit=(t,e,s)=>{const n=i(t,e,s);if(n){if(this.requireCache.has(e))return n;this.requireCache.add(e),this.addHandler(n)}return n},this.shim.requireDirectory({require:e,filename:s},t,n)}addHandler(t,e,s,n,i,r){let o=[];const a=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(i);if(n=n||(()=>{}),Array.isArray(t))if(function(t){return t.every((t=>"string"==typeof t))}(t))[t,...o]=t;else for(const e of t)this.addHandler(e);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let e=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(e=[].concat(e).concat(t.aliases)),void this.addHandler(e,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(kt(s))return void this.addHandler([t].concat(o),e,s.builder,s.handler,s.middlewares,s.deprecated)}if("string"==typeof t){const i=ut(t);o=o.map((t=>ut(t).cmd));let c=!1;const l=[i.cmd].concat(o).filter((t=>!vt.test(t)||(c=!0,!1)));0===l.length&&c&&l.push("$0"),c&&(i.cmd=l[0],o=l.slice(1),t=t.replace(vt,i.cmd)),o.forEach((t=>{this.aliasMap[t]=i.cmd})),!1!==e&&this.usage.command(t,e,c,o,r),this.handlers[i.cmd]={original:t,description:e,handler:n,builder:s||{},middlewares:a,deprecated:r,demanded:i.demanded,optional:i.optional},c&&(this.defaultCommand=this.handlers[i.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,n,i,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,a=e.getInternalMethods().getContext(),c=a.commands.slice(),l=!t;t&&(a.commands.push(t),a.fullCommands.push(o.original));const h=this.applyBuilderUpdateUsageAndParse(l,o,e,s.aliases,c,n,i,r);return dt(h)?h.then((t=>this.applyMiddlewareAndGetResult(l,o,t.innerArgv,a,i,t.aliases,e))):this.applyMiddlewareAndGetResult(l,o,h.innerArgv,a,i,h.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,n,i,r,o,a){const c=e.builder;let l=s;if(Et(c)){s.getInternalMethods().getUsageInstance().freeze();const h=c(s.getInternalMethods().reset(n),a);if(dt(h))return h.then((n=>{var a;return l=(a=n)&&"function"==typeof a.getInternalMethods?n:s,this.parseAndUpdateUsage(t,e,l,i,r,o)}))}else(function(t){return"object"==typeof t})(c)&&(s.getInternalMethods().getUsageInstance().freeze(),l=s.getInternalMethods().reset(n),Object.keys(e.builder).forEach((t=>{l.option(t,c[t])})));return this.parseAndUpdateUsage(t,e,l,i,r,o)}parseAndUpdateUsage(t,e,s,n,i,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(n,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,r);return dt(o)?o.then((t=>({aliases:s.parsed.aliases,innerArgv:t}))):{aliases:s.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,e){const s=vt.test(e.original)?e.original.replace(vt,"").trim():e.original,n=t.filter((t=>!vt.test(t)));return n.push(s),`$0 ${n.join(" ")}`}handleValidationAndGetResult(t,e,s,n,i,r,o,a){if(!r.getInternalMethods().getHasOutput()){const e=r.getInternalMethods().runValidation(i,a,r.parsed.error,t);s=wt(s,(t=>(e(t),t)))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const n=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(s,n,!1,!1),s=wt(s=bt(s,r,o,!1),(t=>{const s=e.handler(t);return dt(s)?s.then((()=>t)):t})),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),dt(s)&&!r.getInternalMethods().hasParseCallback()&&s.catch((t=>{try{r.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}}))}return t||(n.commands.pop(),n.fullCommands.pop()),s}applyMiddlewareAndGetResult(t,e,s,n,i,r,o){let a={};if(i)return s;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(e,s,n,o));const c=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),l=bt(s,o,c,!0);return dt(l)?l.then((s=>this.handleValidationAndGetResult(t,e,s,n,r,o,c,a))):this.handleValidationAndGetResult(t,e,l,n,r,o,c,a)}populatePositionals(t,e,s,n){e._=e._.slice(s.commands.length);const i=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(i.length,e._.length);i.length;){const t=i.shift();this.populatePositional(t,e,o)}for(;r.length;){const t=r.shift();this.populatePositional(t,e,o)}return e._=s.commands.concat(e._.map((t=>""+t))),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),n),o}populatePositional(t,e,s){const n=t.cmd[0];t.variadic?s[n]=e._.splice(0).map(String):e._.length&&(s[n]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=ut(t);return s.demanded.forEach((t=>{const[s,...n]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=n,e.demand[s]=!0})),s.optional.forEach((t=>{const[s,...n]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=n})),e}postProcessPositionals(t,e,s,n){const i=Object.assign({},n.getOptions());i.default=Object.assign(s.default,i.default);for(const t of Object.keys(s.alias))i.alias[t]=(i.alias[t]||[]).concat(s.alias[t]);i.array=i.array.concat(s.array),i.config={};const r=[];if(Object.keys(e).forEach((t=>{e[t].map((e=>{i.configuration["unknown-options-as-args"]&&(i.key[t]=!0),r.push(`--${t}`),r.push(e)}))})),!r.length)return;const o=Object.assign({},i.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},i,{configuration:o}));if(a.error)n.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const s=Object.keys(e);Object.keys(e).forEach((t=>{s.push(...a.aliases[t])})),Object.keys(a.argv).forEach((i=>{s.includes(i)&&(e[i]||(e[i]=a.argv[i]),!this.isInConfigs(n,i)&&!this.isDefaulted(n,i)&&Object.prototype.hasOwnProperty.call(t,i)&&Object.prototype.hasOwnProperty.call(a.argv,i)&&(Array.isArray(t[i])||Array.isArray(a.argv[i]))?t[i]=[].concat(t[i],a.argv[i]):t[i]=a.argv[i])}))}}isDefaulted(t,e){const{default:s}=t.getOptions();return Object.prototype.hasOwnProperty.call(s,e)||Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:s}=t.getOptions();return s.some((t=>Object.prototype.hasOwnProperty.call(t,e)))||s.some((t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(e))))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const e=vt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(e,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(Et(e))return e(t,!0);kt(e)||Object.keys(e).forEach((s=>{t.option(s,e[s])}))}moduleName(t){const e=function(t){if("undefined"==typeof require)return null;for(let e,s=0,n=Object.keys(require.cache);s<n.length;s++)if(e=require.cache[n[s]],e.exports===t)return e;return null}(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:s}){for(const n of[t,e,s]){if("string"==typeof n||!1===n)return n;ct(n,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();ct(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 kt(t){return"object"==typeof t&&!!t.builder&&"function"==typeof t.handler}function Et(t){return"function"==typeof t}function At(t={},e=(()=>!0)){const s={};return ht(t).forEach((n=>{e(n,t[n])&&(s[n]=t[n])})),s}function _t(t){"undefined"!=typeof process&&[process.stdout,process.stderr].forEach((e=>{const s=e;s._handle&&s.isTTY&&"function"==typeof s._handle.setBlocking&&s._handle.setBlocking(t)}))}function $t(t){return"boolean"==typeof t}function jt(t,e){const s=e.y18n.__,n={},i=[];n.failFn=function(t){i.push(t)};let r=null,o=null,a=!0;n.showHelpOnFail=function(e=!0,s){const[i,c]="string"==typeof e?[!0,e]:[e,s];return t.getInternalMethods().isGlobalContext()&&(o=c),r=c,a=i,n};let c=!1;n.fail=function(e,s){const l=t.getInternalMethods().getLoggerInstance();if(!i.length){if(t.getExitProcess()&&_t(!0),!c){c=!0,a&&(t.showHelp("error"),l.error()),(e||s)&&l.error(e||s);const n=r||o;n&&((e||s)&&l.error(""),l.error(n))}if(s=s||new tt(e),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,s);throw s}for(let t=i.length-1;t>=0;--t){const r=i[t];if($t(r)){if(s)throw s;if(e)throw Error(e)}else r(e,s,n)}};let l=[],h=!1;n.usage=(t,e)=>null===t?(h=!0,l=[],n):(h=!1,l.push([t,e||""]),n),n.getUsage=()=>l,n.getUsageDisabled=()=>h,n.getPositionalGroupName=()=>s("Positionals:");let d=[];n.example=(t,e)=>{d.push([t,e||""])};let u=[];n.command=function(t,e,s,n,i=!1){s&&(u=u.map((t=>(t[2]=!1,t)))),u.push([t,e||"",s,n,i])},n.getCommands=()=>u;let f={};n.describe=function(t,e){Array.isArray(t)?t.forEach((t=>{n.describe(t,e)})):"object"==typeof t?Object.keys(t).forEach((e=>{n.describe(e,t[e])})):f[t]=e},n.getDescriptions=()=>f;let p=[];n.epilog=t=>{p.push(t)};let g,m=!1;n.wrap=t=>{m=!0,g=t},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(m||(g=function(){const t=80;return e.process.stdColumns?Math.min(t,e.process.stdColumns):t}(),m=!0),g);const y="__yargsString__:";function b(t,s,n){let i=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{i=Math.max(e.stringWidth(n?`${n} ${Pt(t[0])}`:Pt(t[0]))+Ct(t[0]),i)})),s&&(i=Math.min(i,parseInt((.5*s).toString(),10))),i}let w;function v(e){return t.getOptions().hiddenOptions.indexOf(e)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function O(t,e){let n=`[${s("default:")} `;if(void 0===t&&!e)return null;if(e)n+=e;else switch(typeof t){case"string":n+=`"${t}"`;break;case"object":n+=JSON.stringify(t);break;default:n+=t}return`${n}]`}n.deferY18nLookup=t=>y+t,n.help=function(){if(w)return w;!function(){const e=t.getDemandedOptions(),s=t.getOptions();(Object.keys(s.alias)||[]).forEach((i=>{s.alias[i].forEach((r=>{f[r]&&n.describe(i,f[r]),r in e&&t.demandOption(i,e[r]),s.boolean.includes(r)&&t.boolean(i),s.count.includes(r)&&t.count(i),s.string.includes(r)&&t.string(i),s.normalize.includes(r)&&t.normalize(i),s.array.includes(r)&&t.array(i),s.number.includes(r)&&t.number(i)}))}))}();const i=t.customScriptName?t.$0:e.path.basename(t.$0),r=t.getDemandedOptions(),o=t.getDemandedCommands(),a=t.getDeprecatedOptions(),c=t.getGroups(),g=t.getOptions();let m=[];m=m.concat(Object.keys(f)),m=m.concat(Object.keys(r)),m=m.concat(Object.keys(o)),m=m.concat(Object.keys(g.default)),m=m.filter(v),m=Object.keys(m.reduce(((t,e)=>("_"!==e&&(t[e]=!0),t)),{}));const k=n.getWrap(),E=e.cliui({width:k,wrap:!!k});if(!h)if(l.length)l.forEach((t=>{E.div({text:`${t[0].replace(/\$0/g,i)}`}),t[1]&&E.div({text:`${t[1]}`,padding:[1,0,0,0]})})),E.div();else if(u.length){let t=null;t=o._?`${i} <${s("command")}>\n`:`${i} [${s("command")}]\n`,E.div(`${t}`)}if(u.length>1||1===u.length&&!u[0][2]){E.div(s("Commands:"));const e=t.getInternalMethods().getContext(),n=e.commands.length?`${e.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(u=u.sort(((t,e)=>t[0].localeCompare(e[0]))));const r=i?`${i} `:"";u.forEach((t=>{const e=`${r}${n}${t[0].replace(/^\$0 ?/,"")}`;E.span({text:e,padding:[0,2,0,2],width:b(u,k,`${i}${n}`)+4},{text:t[1]});const o=[];t[2]&&o.push(`[${s("default")}]`),t[3]&&t[3].length&&o.push(`[${s("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?o.push(`[${s("deprecated: %s",t[4])}]`):o.push(`[${s("deprecated")}]`)),o.length?E.div({text:o.join(" "),padding:[0,0,0,2],align:"right"}):E.div()})),E.div()}const A=(Object.keys(g.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);m=m.filter((e=>!t.parsed.newAliases[e]&&A.every((t=>-1===(g.alias[t]||[]).indexOf(e)))));const _=s("Options:");c[_]||(c[_]=[]),function(t,e,s,n){let i=[],r=null;Object.keys(s).forEach((t=>{i=i.concat(s[t])})),t.forEach((t=>{r=[t].concat(e[t]),r.some((t=>-1!==i.indexOf(t)))||s[n].push(t)}))}(m,g.alias,c,_);const $=t=>/^--/.test(Pt(t)),j=Object.keys(c).filter((t=>c[t].length>0)).map((t=>({groupName:t,normalizedKeys:c[t].filter(v).map((t=>{if(A.includes(t))return t;for(let e,s=0;void 0!==(e=A[s]);s++)if((g.alias[e]||[]).includes(t))return e;return t}))}))).filter((({normalizedKeys:t})=>t.length>0)).map((({groupName:t,normalizedKeys:e})=>{const s=e.reduce(((e,s)=>(e[s]=[s].concat(g.alias[s]||[]).map((e=>t===n.getPositionalGroupName()?e:(/^[0-9]$/.test(e)?g.boolean.includes(s)?"-":"--":e.length>1?"--":"-")+e)).sort(((t,e)=>$(t)===$(e)?0:$(t)?1:-1)).join(", "),e)),{});return{groupName:t,normalizedKeys:e,switches:s}}));if(j.filter((({groupName:t})=>t!==n.getPositionalGroupName())).some((({normalizedKeys:t,switches:e})=>!t.every((t=>$(e[t])))))&&j.filter((({groupName:t})=>t!==n.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:e})=>{t.forEach((t=>{var s,n;$(e[t])&&(e[t]=(s=e[t],n=4,xt(s)?{text:s.text,indentation:s.indentation+n}:{text:s,indentation:n}))}))})),j.forEach((({groupName:e,normalizedKeys:i,switches:o})=>{E.div(e),i.forEach((e=>{const i=o[e];let c=f[e]||"",l=null;c.includes(y)&&(c=s(c.substring(16))),g.boolean.includes(e)&&(l=`[${s("boolean")}]`),g.count.includes(e)&&(l=`[${s("count")}]`),g.string.includes(e)&&(l=`[${s("string")}]`),g.normalize.includes(e)&&(l=`[${s("string")}]`),g.array.includes(e)&&(l=`[${s("array")}]`),g.number.includes(e)&&(l=`[${s("number")}]`);const h=[e in a?(d=a[e],"string"==typeof d?`[${s("deprecated: %s",d)}]`:`[${s("deprecated")}]`):null,l,e in r?`[${s("required")}]`:null,g.choices&&g.choices[e]?`[${s("choices:")} ${n.stringifiedValues(g.choices[e])}]`:null,O(g.default[e],g.defaultDescription[e])].filter(Boolean).join(" ");var d;E.span({text:Pt(i),padding:[0,2,0,2+Ct(i)],width:b(o,k)+4},c);const u=!0===t.getInternalMethods().getUsageConfiguration()["hide-types"];h&&!u?E.div({text:h,padding:[0,0,0,2],align:"right"}):E.div()})),E.div()})),d.length&&(E.div(s("Examples:")),d.forEach((t=>{t[0]=t[0].replace(/\$0/g,i)})),d.forEach((t=>{""===t[1]?E.div({text:t[0],padding:[0,2,0,2]}):E.div({text:t[0],padding:[0,2,0,2],width:b(d,k)+4},{text:t[1]})})),E.div()),p.length>0){const t=p.map((t=>t.replace(/\$0/g,i))).join("\n");E.div(`${t}\n`)}return E.toString().replace(/\s*$/,"")},n.cacheHelpMessage=function(){w=this.help()},n.clearCachedHelpMessage=function(){w=void 0},n.hasCachedHelpMessage=function(){return!!w},n.showHelp=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(n.help())},n.functionDescription=t=>["(",t.name?e.Parser.decamelize(t.name,"-"):s("generated-value"),")"].join(""),n.stringifiedValues=function(t,e){let s="";const n=e||", ",i=[].concat(t);return t&&i.length?(i.forEach((t=>{s.length&&(s+=n),s+=JSON.stringify(t)})),s):s};let k=null;n.version=t=>{k=t},n.showVersion=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(k)},n.reset=function(t){return r=null,c=!1,l=[],h=!1,p=[],d=[],u=[],f=At(f,(e=>!t[e])),n};const E=[];return n.freeze=function(){E.push({failMessage:r,failureOutput:c,usages:l,usageDisabled:h,epilogs:p,examples:d,commands:u,descriptions:f})},n.unfreeze=function(t=!1){const e=E.pop();e&&(t?(f={...e.descriptions,...f},u=[...e.commands,...u],l=[...e.usages,...l],d=[...e.examples,...d],p=[...e.epilogs,...p]):({failMessage:r,failureOutput:c,usages:l,usageDisabled:h,epilogs:p,examples:d,commands:u,descriptions:f}=e))},n}function xt(t){return"object"==typeof t}function Ct(t){return xt(t)?t.indentation:0}function Pt(t){return xt(t)?t.text:t}class St{constructor(t,e,s,n){var i,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=n,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(o=(null===(i=this.shim.getEnv("SHELL"))||void 0===i?void 0:i.includes("zsh"))||(null===(r=this.shim.getEnv("ZSH_NAME"))||void 0===r?void 0:r.includes("zsh")))&&void 0!==o&&o}defaultCompletion(t,e,s,n){const i=this.command.getCommandHandlers();for(let e=0,s=t.length;e<s;++e)if(i[t[e]]&&i[t[e]].builder){const s=i[t[e]].builder;if(Et(s)){this.indexAfterLastReset=e+1;const t=this.yargs.getInternalMethods().reset();return s(t,!0),t.argv}}const r=[];this.commandCompletions(r,t,s),this.optionCompletions(r,t,e,s),this.choicesFromOptionsCompletions(r,t,e,s),this.choicesFromPositionalsCompletions(r,t,e,s),n(null,r)}commandCompletions(t,e,s){const n=this.yargs.getInternalMethods().getContext().commands;s.match(/^-/)||n[n.length-1]===s||this.previousArgHasChoices(e)||this.usage.getCommands().forEach((s=>{const n=ut(s[0]).cmd;if(-1===e.indexOf(n))if(this.zshShell){const e=s[1]||"";t.push(n.replace(/:/g,"\\:")+":"+e)}else t.push(n)}))}optionCompletions(t,e,s,n){if((n.match(/^-/)||""===n&&0===t.length)&&!this.previousArgHasChoices(e)){const s=this.yargs.getOptions(),i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach((r=>{const o=!!s.configuration["boolean-negation"]&&s.boolean.includes(r);i.includes(r)||s.hiddenOptions.includes(r)||this.argsContainKey(e,r,o)||this.completeOptionKey(r,t,n,o&&!!s.default[r])}))}}choicesFromOptionsCompletions(t,e,s,n){if(this.previousArgHasChoices(e)){const s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s.map((t=>t.replace(/:/g,"\\:"))))}}choicesFromPositionalsCompletions(t,e,s,n){if(""===n&&t.length>0&&this.previousArgHasChoices(e))return;const i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=i[s._.length-r-1];if(!o)return;const a=this.yargs.getOptions().choices[o]||[];for(const e of a)e.startsWith(n)&&t.push(e.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],s="";if(!e.startsWith("-")&&t.length>1&&(s=e,e=t[t.length-2]),!e.startsWith("-"))return;const n=e.replace(/^-+/,""),i=this.yargs.getOptions(),r=[n,...this.yargs.getAliases()[n]||[]];let o;for(const t of r)if(Object.prototype.hasOwnProperty.call(i.key,t)&&Array.isArray(i.choices[t])){o=i.choices[t];break}return o?o.filter((t=>!s||t.startsWith(s))):void 0}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return void 0!==e&&e.length>0}argsContainKey(t,e,s){const n=e=>-1!==t.indexOf((/^[^0-9]$/.test(e)?"-":"--")+e);if(n(e))return!0;if(s&&n(`no-${e}`))return!0;if(this.aliases)for(const t of this.aliases[e])if(n(t))return!0;return!1}completeOptionKey(t,e,s,n){var i,r,o,a;let c=t;if(this.zshShell){const e=this.usage.getDescriptions(),s=null===(r=null===(i=null==this?void 0:this.aliases)||void 0===i?void 0:i[t])||void 0===r?void 0:r.find((t=>{const s=e[t];return"string"==typeof s&&s.length>0})),n=s?e[s]:void 0,l=null!==(a=null!==(o=e[t])&&void 0!==o?o:n)&&void 0!==a?a:"";c=`${t.replace(/:/g,"\\:")}:${l.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const l=!/^--/.test(s)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";e.push(l+c),n&&e.push(l+"no-"+c)}customCompletion(t,e,s,n){if(ct(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(s,e);return dt(t)?t.then((t=>{this.shim.process.nextTick((()=>{n(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{n(t,void 0)}))})):n(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,e,((i=n)=>this.defaultCompletion(t,e,s,i)),(t=>{n(null,t)})):this.customCompletionFunction(s,e,(t=>{n(null,t)}))}getCompletion(t,e){const s=t.length?t[t.length-1]:"",n=this.yargs.parse(t,!0),i=this.customCompletionFunction?n=>this.customCompletion(t,n,s,e):n=>this.defaultCompletion(t,n,s,e);return dt(n)?n.then(i):i(n)}generateCompletionScript(t,e){let s=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const n=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,n),s=s.replace(/{{completion_command}}/g,e),s.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function Nt(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let n,i;for(n=0;n<=e.length;n++)s[n]=[n];for(i=0;i<=t.length;i++)s[0][i]=i;for(n=1;n<=e.length;n++)for(i=1;i<=t.length;i++)e.charAt(n-1)===t.charAt(i-1)?s[n][i]=s[n-1][i-1]:n>1&&i>1&&e.charAt(n-2)===t.charAt(i-1)&&e.charAt(n-1)===t.charAt(i-2)?s[n][i]=s[n-2][i-2]+1:s[n][i]=Math.min(s[n-1][i-1]+1,Math.min(s[n][i-1]+1,s[n-1][i]+1));return s[e.length][t.length]}const Mt=["$0","--","_"];let Dt,It=[];function Wt(t,e,s,n){Dt=n;let i={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return i;const n=/\.json|\..*rc$/.test(t.extends);let r=null;if(n)r=function(t,e){return Dt.path.resolve(t,e)}(e,t.extends);else try{r=require.resolve(t.extends)}catch(e){return t}!function(t){if(It.indexOf(t)>-1)throw new tt(`Circular extended configurations: '${t}'.`)}(r),It.push(r),i=n?JSON.parse(Dt.readFileSync(r,"utf8")):require(t.extends),delete t.extends,i=Wt(i,Dt.path.dirname(r),s,Dt)}return It=[],s?Rt(i,t):Object.assign({},i,t)}function Rt(t,e){const s={};function n(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const i of Object.keys(e))n(e[i])&&n(s[i])?s[i]=Rt(t[i],e[i]):s[i]=e[i];return s}var zt,Ft,Bt,Lt,Tt,Vt,Ut,Ht,qt,Yt,Jt,Gt,Kt,Qt,Xt,Zt,te,ee,se,ne,ie,re,oe,ae,ce,le,he,de,ue,fe,pe,ge,me,ye,be,we=function(t,e,s,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,s):i?i.value=s:e.set(t,s),s},ve=function(t,e,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(t):n?n.value:e.get(t)};const Oe=Symbol("copyDoubleDash"),ke=Symbol("copyDoubleDash"),Ee=Symbol("deleteFromParserHintObject"),Ae=Symbol("emitWarning"),_e=Symbol("freeze"),$e=Symbol("getDollarZero"),je=Symbol("getParserConfiguration"),xe=Symbol("getUsageConfiguration"),Ce=Symbol("guessLocale"),Pe=Symbol("guessVersion"),Se=Symbol("parsePositionalNumbers"),Ne=Symbol("pkgUp"),Me=Symbol("populateParserHintArray"),De=Symbol("populateParserHintSingleValueDictionary"),Ie=Symbol("populateParserHintArrayDictionary"),We=Symbol("populateParserHintDictionary"),Re=Symbol("sanitizeKey"),ze=Symbol("setKey"),Fe=Symbol("unfreeze"),Be=Symbol("validateAsync"),Le=Symbol("getCommandInstance"),Te=Symbol("getContext"),Ve=Symbol("getHasOutput"),Ue=Symbol("getLoggerInstance"),He=Symbol("getParseContext"),qe=Symbol("getUsageInstance"),Ye=Symbol("getValidationInstance"),Je=Symbol("hasParseCallback"),Ge=Symbol("isGlobalContext"),Ke=Symbol("postProcess"),Qe=Symbol("rebase"),Xe=Symbol("reset"),Ze=Symbol("runYargsParserAndExecuteCommands"),ts=Symbol("runValidation"),es=Symbol("setHasOutput"),ss=Symbol("kTrackManuallySetKeys");class ns{constructor(t=[],e,s,n){this.customScriptName=!1,this.parsed=!1,zt.set(this,void 0),Ft.set(this,void 0),Bt.set(this,{commands:[],fullCommands:[]}),Lt.set(this,null),Tt.set(this,null),Vt.set(this,"show-hidden"),Ut.set(this,null),Ht.set(this,!0),qt.set(this,{}),Yt.set(this,!0),Jt.set(this,[]),Gt.set(this,void 0),Kt.set(this,{}),Qt.set(this,!1),Xt.set(this,null),Zt.set(this,!0),te.set(this,void 0),ee.set(this,""),se.set(this,void 0),ne.set(this,void 0),ie.set(this,{}),re.set(this,null),oe.set(this,null),ae.set(this,{}),ce.set(this,{}),le.set(this,void 0),he.set(this,!1),de.set(this,void 0),ue.set(this,!1),fe.set(this,!1),pe.set(this,!1),ge.set(this,void 0),me.set(this,{}),ye.set(this,null),be.set(this,void 0),we(this,de,n,"f"),we(this,le,t,"f"),we(this,Ft,e,"f"),we(this,ne,s,"f"),we(this,Gt,new yt(this),"f"),this.$0=this[$e](),this[Xe](),we(this,zt,ve(this,zt,"f"),"f"),we(this,ge,ve(this,ge,"f"),"f"),we(this,be,ve(this,be,"f"),"f"),we(this,se,ve(this,se,"f"),"f"),ve(this,se,"f").showHiddenOpt=ve(this,Vt,"f"),we(this,te,this[ke](),"f")}addHelpOpt(t,e){return pt("[string|boolean] [string]",[t,e],arguments.length),ve(this,Xt,"f")&&(this[Ee](ve(this,Xt,"f")),we(this,Xt,null,"f")),!1===t&&void 0===e||(we(this,Xt,"string"==typeof t?t:"help","f"),this.boolean(ve(this,Xt,"f")),this.describe(ve(this,Xt,"f"),e||ve(this,ge,"f").deferY18nLookup("Show help"))),this}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(pt("[string|boolean] [string]",[t,e],arguments.length),!1===t&&void 0===e)return this;const s="string"==typeof t?t:ve(this,Vt,"f");return this.boolean(s),this.describe(s,e||ve(this,ge,"f").deferY18nLookup("Show hidden options")),ve(this,se,"f").showHiddenOpt=s,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return pt("<object|string|array> [string|array]",[t,e],arguments.length),this[Ie](this.alias.bind(this),"alias",t,e),this}array(t){return pt("<array|string>",[t],arguments.length),this[Me]("array",t),this[ss](t),this}boolean(t){return pt("<array|string>",[t],arguments.length),this[Me]("boolean",t),this[ss](t),this}check(t,e){return pt("<function> [boolean]",[t,e],arguments.length),this.middleware(((e,s)=>wt((()=>t(e,s.getOptions())),(s=>(s?("string"==typeof s||s instanceof Error)&&ve(this,ge,"f").fail(s.toString(),s):ve(this,ge,"f").fail(ve(this,de,"f").y18n.__("Argument check failed: %s",t.toString())),e)),(t=>(ve(this,ge,"f").fail(t.message?t.message:t.toString(),t),e)))),!1,e),this}choices(t,e){return pt("<object|string|array> [string|array]",[t,e],arguments.length),this[Ie](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(pt("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new tt("coerce callback must be provided");for(const s of t)this.coerce(s,e);return this}if("object"==typeof t){for(const e of Object.keys(t))this.coerce(e,t[e]);return this}if(!e)throw new tt("coerce callback must be provided");return ve(this,se,"f").key[t]=!0,ve(this,Gt,"f").addCoerceMiddleware(((s,n)=>{let i;return Object.prototype.hasOwnProperty.call(s,t)?wt((()=>(i=n.getAliases(),e(s[t]))),(e=>{s[t]=e;const r=n.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&!0!==r)for(const n of i[t])s[n]=e;return s}),(t=>{throw new tt(t.message)})):s}),t),this}conflicts(t,e){return pt("<string|object> [string|array]",[t,e],arguments.length),ve(this,be,"f").conflicts(t,e),this}config(t="config",e,s){return pt("[object|string] [string|function] [function]",[t,e,s],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof e&&(s=e,e=void 0),this.describe(t,e||ve(this,ge,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach((t=>{ve(this,se,"f").config[t]=s||!0})),this):(t=Wt(t,ve(this,Ft,"f"),this[je]()["deep-merge-config"]||!1,ve(this,de,"f")),ve(this,se,"f").configObjects=(ve(this,se,"f").configObjects||[]).concat(t),this)}completion(t,e,s){return pt("[string] [string|boolean|function] [function]",[t,e,s],arguments.length),"function"==typeof e&&(s=e,e=void 0),we(this,Tt,t||ve(this,Tt,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(ve(this,Tt,"f"),e),s&&ve(this,Lt,"f").registerFunction(s),this}command(t,e,s,n,i,r){return pt("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,n,i,r],arguments.length),ve(this,zt,"f").addHandler(t,e,s,n,i,r),this}commands(t,e,s,n,i,r){return this.command(t,e,s,n,i,r)}commandDir(t,e){pt("<string> [object]",[t,e],arguments.length);const s=ve(this,ne,"f")||ve(this,de,"f").require;return ve(this,zt,"f").addDirectory(t,s,ve(this,de,"f").getCallerFile(),e),this}count(t){return pt("<array|string>",[t],arguments.length),this[Me]("count",t),this[ss](t),this}default(t,e,s){return pt("<object|string|array> [*] [string]",[t,e,s],arguments.length),s&&(lt(t,ve(this,de,"f")),ve(this,se,"f").defaultDescription[t]=s),"function"==typeof e&&(lt(t,ve(this,de,"f")),ve(this,se,"f").defaultDescription[t]||(ve(this,se,"f").defaultDescription[t]=ve(this,ge,"f").functionDescription(e)),e=e.call()),this[De](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,n){return pt("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,n],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),ve(this,se,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:n},this}demand(t,e,s){return Array.isArray(e)?(e.forEach((t=>{ct(s,!0,ve(this,de,"f")),this.demandOption(t,s)})),e=1/0):"number"!=typeof e&&(s=e,e=1/0),"number"==typeof t?(ct(s,!0,ve(this,de,"f")),this.demandCommand(t,e,s,s)):Array.isArray(t)?t.forEach((t=>{ct(s,!0,ve(this,de,"f")),this.demandOption(t,s)})):"string"==typeof s?this.demandOption(t,s):!0!==s&&void 0!==s||this.demandOption(t),this}demandOption(t,e){return pt("<object|string|array> [string]",[t,e],arguments.length),this[De](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return pt("<string> [string|boolean]",[t,e],arguments.length),ve(this,se,"f").deprecatedOptions[t]=e,this}describe(t,e){return pt("<object|string|array> [string]",[t,e],arguments.length),this[ze](t,!0),ve(this,ge,"f").describe(t,e),this}detectLocale(t){return pt("<boolean>",[t],arguments.length),we(this,Ht,t,"f"),this}env(t){return pt("[string|boolean]",[t],arguments.length),!1===t?delete ve(this,se,"f").envPrefix:ve(this,se,"f").envPrefix=t||"",this}epilogue(t){return pt("<string>",[t],arguments.length),ve(this,ge,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return pt("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach((t=>this.example(...t))):ve(this,ge,"f").example(t,e),this}exit(t,e){we(this,Qt,!0,"f"),we(this,Ut,e,"f"),ve(this,Yt,"f")&&ve(this,de,"f").process.exit(t)}exitProcess(t=!0){return pt("[boolean]",[t],arguments.length),we(this,Yt,t,"f"),this}fail(t){if(pt("<function|boolean>",[t],arguments.length),"boolean"==typeof t&&!1!==t)throw new tt("Invalid first argument. Expected function or boolean 'false'");return ve(this,ge,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return pt("<array> [function]",[t,e],arguments.length),e?ve(this,Lt,"f").getCompletion(t,e):new Promise(((e,s)=>{ve(this,Lt,"f").getCompletion(t,((t,n)=>{t?s(t):e(n)}))}))}getDemandedOptions(){return pt([],0),ve(this,se,"f").demandedOptions}getDemandedCommands(){return pt([],0),ve(this,se,"f").demandedCommands}getDeprecatedOptions(){return pt([],0),ve(this,se,"f").deprecatedOptions}getDetectLocale(){return ve(this,Ht,"f")}getExitProcess(){return ve(this,Yt,"f")}getGroups(){return Object.assign({},ve(this,Kt,"f"),ve(this,ce,"f"))}getHelp(){if(we(this,Qt,!0,"f"),!ve(this,ge,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Ze](ve(this,le,"f"),void 0,void 0,0,!0);if(dt(t))return t.then((()=>ve(this,ge,"f").help()))}const t=ve(this,zt,"f").runDefaultBuilderOn(this);if(dt(t))return t.then((()=>ve(this,ge,"f").help()))}return Promise.resolve(ve(this,ge,"f").help())}getOptions(){return ve(this,se,"f")}getStrict(){return ve(this,ue,"f")}getStrictCommands(){return ve(this,fe,"f")}getStrictOptions(){return ve(this,pe,"f")}global(t,e){return pt("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),!1!==e?ve(this,se,"f").local=ve(this,se,"f").local.filter((e=>-1===t.indexOf(e))):t.forEach((t=>{ve(this,se,"f").local.includes(t)||ve(this,se,"f").local.push(t)})),this}group(t,e){pt("<string|array> <string>",[t,e],arguments.length);const s=ve(this,ce,"f")[e]||ve(this,Kt,"f")[e];ve(this,ce,"f")[e]&&delete ve(this,ce,"f")[e];const n={};return ve(this,Kt,"f")[e]=(s||[]).concat(t).filter((t=>!n[t]&&(n[t]=!0))),this}hide(t){return pt("<string>",[t],arguments.length),ve(this,se,"f").hiddenOptions.push(t),this}implies(t,e){return pt("<string|object> [number|string|array]",[t,e],arguments.length),ve(this,be,"f").implies(t,e),this}locale(t){return pt("[string]",[t],arguments.length),void 0===t?(this[Ce](),ve(this,de,"f").y18n.getLocale()):(we(this,Ht,!1,"f"),ve(this,de,"f").y18n.setLocale(t),this)}middleware(t,e,s){return ve(this,Gt,"f").addMiddleware(t,!!e,s)}nargs(t,e){return pt("<string|object|array> [number]",[t,e],arguments.length),this[De](this.nargs.bind(this),"narg",t,e),this}normalize(t){return pt("<array|string>",[t],arguments.length),this[Me]("normalize",t),this}number(t){return pt("<array|string>",[t],arguments.length),this[Me]("number",t),this[ss](t),this}option(t,e){if(pt("<string|object> [object]",[t,e],arguments.length),"object"==typeof t)Object.keys(t).forEach((e=>{this.options(e,t[e])}));else{"object"!=typeof e&&(e={}),this[ss](t),!ve(this,ye,"f")||"version"!==t&&"version"!==(null==e?void 0:e.alias)||this[Ae](['"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("\n"),void 0,"versionWarning"),ve(this,se,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const s=e.deprecate||e.deprecated;s&&this.deprecateOption(t,s);const n=e.demand||e.required||e.require;n&&this.demand(t,n),e.demandOption&&this.demandOption(t,"string"==typeof e.demandOption?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),void 0!==e.implies&&this.implies(t,e.implies),void 0!==e.nargs&&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||"boolean"===e.type)&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||"array"===e.type)&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||"number"===e.type)&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||"string"===e.type)&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||"count"===e.type)&&this.count(t),"boolean"==typeof e.global&&this.global(t,e.global),e.defaultDescription&&(ve(this,se,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const i=e.describe||e.description||e.desc,r=ve(this,ge,"f").getDescriptions();Object.prototype.hasOwnProperty.call(r,t)&&"string"!=typeof i||this.describe(t,i),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,s){pt("[string|array] [function|boolean|object] [function]",[t,e,s],arguments.length),this[_e](),void 0===t&&(t=ve(this,le,"f")),"object"==typeof e&&(we(this,oe,e,"f"),e=s),"function"==typeof e&&(we(this,re,e,"f"),e=!1),e||we(this,le,t,"f"),ve(this,re,"f")&&we(this,Yt,!1,"f");const n=this[Ze](t,!!e),i=this.parsed;return ve(this,Lt,"f").setParsed(this.parsed),dt(n)?n.then((t=>(ve(this,re,"f")&&ve(this,re,"f").call(this,ve(this,Ut,"f"),t,ve(this,ee,"f")),t))).catch((t=>{throw ve(this,re,"f")&&ve(this,re,"f")(t,this.parsed.argv,ve(this,ee,"f")),t})).finally((()=>{this[Fe](),this.parsed=i})):(ve(this,re,"f")&&ve(this,re,"f").call(this,ve(this,Ut,"f"),n,ve(this,ee,"f")),this[Fe](),this.parsed=i,n)}parseAsync(t,e,s){const n=this.parse(t,e,s);return dt(n)?n:Promise.resolve(n)}parseSync(t,e,s){const n=this.parse(t,e,s);if(dt(n))throw new tt(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return n}parserConfiguration(t){return pt("<object>",[t],arguments.length),we(this,ie,t,"f"),this}pkgConf(t,e){pt("<string> [string]",[t,e],arguments.length);let s=null;const n=this[Ne](e||ve(this,Ft,"f"));return n[t]&&"object"==typeof n[t]&&(s=Wt(n[t],e||ve(this,Ft,"f"),this[je]()["deep-merge-config"]||!1,ve(this,de,"f")),ve(this,se,"f").configObjects=(ve(this,se,"f").configObjects||[]).concat(s)),this}positional(t,e){pt("<string> <object>",[t,e],arguments.length);const s=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=At(e,((t,e)=>!("type"===t&&!["string","number","boolean"].includes(e))&&s.includes(t)));const n=ve(this,Bt,"f").fullCommands[ve(this,Bt,"f").fullCommands.length-1],i=n?ve(this,zt,"f").cmdToParseOptions(n):{array:[],alias:{},default:{},demand:{}};return ht(i).forEach((s=>{const n=i[s];Array.isArray(n)?-1!==n.indexOf(t)&&(e[s]=!0):n[t]&&!(s in e)&&(e[s]=n[t])})),this.group(t,ve(this,ge,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return pt("[boolean]",[t],arguments.length),we(this,he,t,"f"),this}required(t,e,s){return this.demand(t,e,s)}require(t,e,s){return this.demand(t,e,s)}requiresArg(t){return pt("<array|string|object> [number]",[t],arguments.length),"string"==typeof t&&ve(this,se,"f").narg[t]||this[De](this.requiresArg.bind(this),"narg",t,NaN),this}showCompletionScript(t,e){return pt("[string] [string]",[t,e],arguments.length),t=t||this.$0,ve(this,te,"f").log(ve(this,Lt,"f").generateCompletionScript(t,e||ve(this,Tt,"f")||"completion")),this}showHelp(t){if(pt("[string|function]",[t],arguments.length),we(this,Qt,!0,"f"),!ve(this,ge,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[Ze](ve(this,le,"f"),void 0,void 0,0,!0);if(dt(e))return e.then((()=>{ve(this,ge,"f").showHelp(t)})),this}const e=ve(this,zt,"f").runDefaultBuilderOn(this);if(dt(e))return e.then((()=>{ve(this,ge,"f").showHelp(t)})),this}return ve(this,ge,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return pt("[boolean|string] [string]",[t,e],arguments.length),ve(this,ge,"f").showHelpOnFail(t,e),this}showVersion(t){return pt("[string|function]",[t],arguments.length),ve(this,ge,"f").showVersion(t),this}skipValidation(t){return pt("<array|string>",[t],arguments.length),this[Me]("skipValidation",t),this}strict(t){return pt("[boolean]",[t],arguments.length),we(this,ue,!1!==t,"f"),this}strictCommands(t){return pt("[boolean]",[t],arguments.length),we(this,fe,!1!==t,"f"),this}strictOptions(t){return pt("[boolean]",[t],arguments.length),we(this,pe,!1!==t,"f"),this}string(t){return pt("<array|string>",[t],arguments.length),this[Me]("string",t),this[ss](t),this}terminalWidth(){return pt([],0),ve(this,de,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return pt("<object>",[t],arguments.length),we(this,Ht,!1,"f"),ve(this,de,"f").y18n.updateLocale(t),this}usage(t,e,s,n){if(pt("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,s,n],arguments.length),void 0!==e){if(ct(t,null,ve(this,de,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,s,n);throw new tt(".usage() description must start with $0 if being used as alias for .command()")}return ve(this,ge,"f").usage(t),this}usageConfiguration(t){return pt("<object>",[t],arguments.length),we(this,me,t,"f"),this}version(t,e,s){const n="version";if(pt("[boolean|string] [string] [string]",[t,e,s],arguments.length),ve(this,ye,"f")&&(this[Ee](ve(this,ye,"f")),ve(this,ge,"f").version(void 0),we(this,ye,null,"f")),0===arguments.length)s=this[Pe](),t=n;else if(1===arguments.length){if(!1===t)return this;s=t,t=n}else 2===arguments.length&&(s=e,e=void 0);return we(this,ye,"string"==typeof t?t:n,"f"),e=e||ve(this,ge,"f").deferY18nLookup("Show version number"),ve(this,ge,"f").version(s||void 0),this.boolean(ve(this,ye,"f")),this.describe(ve(this,ye,"f"),e),this}wrap(t){return pt("<number|null|undefined>",[t],arguments.length),ve(this,ge,"f").wrap(t),this}[(zt=new WeakMap,Ft=new WeakMap,Bt=new WeakMap,Lt=new WeakMap,Tt=new WeakMap,Vt=new WeakMap,Ut=new WeakMap,Ht=new WeakMap,qt=new WeakMap,Yt=new WeakMap,Jt=new WeakMap,Gt=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,te=new WeakMap,ee=new WeakMap,se=new WeakMap,ne=new WeakMap,ie=new WeakMap,re=new WeakMap,oe=new WeakMap,ae=new WeakMap,ce=new WeakMap,le=new WeakMap,he=new WeakMap,de=new WeakMap,ue=new WeakMap,fe=new WeakMap,pe=new WeakMap,ge=new WeakMap,me=new WeakMap,ye=new WeakMap,be=new WeakMap,Oe)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[ke](){return{log:(...t)=>{this[Je]()||console.log(...t),we(this,Qt,!0,"f"),ve(this,ee,"f").length&&we(this,ee,ve(this,ee,"f")+"\n","f"),we(this,ee,ve(this,ee,"f")+t.join(" "),"f")},error:(...t)=>{this[Je]()||console.error(...t),we(this,Qt,!0,"f"),ve(this,ee,"f").length&&we(this,ee,ve(this,ee,"f")+"\n","f"),we(this,ee,ve(this,ee,"f")+t.join(" "),"f")}}}[Ee](t){ht(ve(this,se,"f")).forEach((e=>{if("configObjects"===e)return;const s=ve(this,se,"f")[e];Array.isArray(s)?s.includes(t)&&s.splice(s.indexOf(t),1):"object"==typeof s&&delete s[t]})),delete ve(this,ge,"f").getDescriptions()[t]}[Ae](t,e,s){ve(this,qt,"f")[s]||(ve(this,de,"f").process.emitWarning(t,e),ve(this,qt,"f")[s]=!0)}[_e](){ve(this,Jt,"f").push({options:ve(this,se,"f"),configObjects:ve(this,se,"f").configObjects.slice(0),exitProcess:ve(this,Yt,"f"),groups:ve(this,Kt,"f"),strict:ve(this,ue,"f"),strictCommands:ve(this,fe,"f"),strictOptions:ve(this,pe,"f"),completionCommand:ve(this,Tt,"f"),output:ve(this,ee,"f"),exitError:ve(this,Ut,"f"),hasOutput:ve(this,Qt,"f"),parsed:this.parsed,parseFn:ve(this,re,"f"),parseContext:ve(this,oe,"f")}),ve(this,ge,"f").freeze(),ve(this,be,"f").freeze(),ve(this,zt,"f").freeze(),ve(this,Gt,"f").freeze()}[$e](){let t,e="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(ve(this,de,"f").process.argv()[0])?ve(this,de,"f").process.argv().slice(1,2):ve(this,de,"f").process.argv().slice(0,1),e=t.map((t=>{const e=this[Qe](ve(this,Ft,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&e.length<t.length?e:t})).join(" ").trim(),ve(this,de,"f").getEnv("_")&&ve(this,de,"f").getProcessArgvBin()===ve(this,de,"f").getEnv("_")&&(e=ve(this,de,"f").getEnv("_").replace(`${ve(this,de,"f").path.dirname(ve(this,de,"f").process.execPath())}/`,"")),e}[je](){return ve(this,ie,"f")}[xe](){return ve(this,me,"f")}[Ce](){if(!ve(this,Ht,"f"))return;const t=ve(this,de,"f").getEnv("LC_ALL")||ve(this,de,"f").getEnv("LC_MESSAGES")||ve(this,de,"f").getEnv("LANG")||ve(this,de,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Pe](){return this[Ne]().version||"unknown"}[Se](t){const e=t["--"]?t["--"]:t._;for(let t,s=0;void 0!==(t=e[s]);s++)ve(this,de,"f").Parser.looksLikeNumber(t)&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)))&&(e[s]=Number(t));return t}[Ne](t){const e=t||"*";if(ve(this,ae,"f")[e])return ve(this,ae,"f")[e];let s={};try{let e=t||ve(this,de,"f").mainFilename;!t&&ve(this,de,"f").path.extname(e)&&(e=ve(this,de,"f").path.dirname(e));const n=ve(this,de,"f").findUp(e,((t,e)=>e.includes("package.json")?"package.json":void 0));ct(n,void 0,ve(this,de,"f")),s=JSON.parse(ve(this,de,"f").readFileSync(n,"utf8"))}catch(t){}return ve(this,ae,"f")[e]=s||{},ve(this,ae,"f")[e]}[Me](t,e){(e=[].concat(e)).forEach((e=>{e=this[Re](e),ve(this,se,"f")[t].push(e)}))}[De](t,e,s,n){this[We](t,e,s,n,((t,e,s)=>{ve(this,se,"f")[t][e]=s}))}[Ie](t,e,s,n){this[We](t,e,s,n,((t,e,s)=>{ve(this,se,"f")[t][e]=(ve(this,se,"f")[t][e]||[]).concat(s)}))}[We](t,e,s,n,i){if(Array.isArray(s))s.forEach((e=>{t(e,n)}));else if((t=>"object"==typeof t)(s))for(const e of ht(s))t(e,s[e]);else i(e,this[Re](s),n)}[Re](t){return"__proto__"===t?"___proto___":t}[ze](t,e){return this[De](this[ze].bind(this),"key",t,e),this}[Fe](){var t,e,s,n,i,r,o,a,c,l,h,d;const u=ve(this,Jt,"f").pop();let f;ct(u,void 0,ve(this,de,"f")),t=this,e=this,s=this,n=this,i=this,r=this,o=this,a=this,c=this,l=this,h=this,d=this,({options:{set value(e){we(t,se,e,"f")}}.value,configObjects:f,exitProcess:{set value(t){we(e,Yt,t,"f")}}.value,groups:{set value(t){we(s,Kt,t,"f")}}.value,output:{set value(t){we(n,ee,t,"f")}}.value,exitError:{set value(t){we(i,Ut,t,"f")}}.value,hasOutput:{set value(t){we(r,Qt,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){we(o,ue,t,"f")}}.value,strictCommands:{set value(t){we(a,fe,t,"f")}}.value,strictOptions:{set value(t){we(c,pe,t,"f")}}.value,completionCommand:{set value(t){we(l,Tt,t,"f")}}.value,parseFn:{set value(t){we(h,re,t,"f")}}.value,parseContext:{set value(t){we(d,oe,t,"f")}}.value}=u),ve(this,se,"f").configObjects=f,ve(this,ge,"f").unfreeze(),ve(this,be,"f").unfreeze(),ve(this,zt,"f").unfreeze(),ve(this,Gt,"f").unfreeze()}[Be](t,e){return wt(e,(e=>(t(e),e)))}getInternalMethods(){return{getCommandInstance:this[Le].bind(this),getContext:this[Te].bind(this),getHasOutput:this[Ve].bind(this),getLoggerInstance:this[Ue].bind(this),getParseContext:this[He].bind(this),getParserConfiguration:this[je].bind(this),getUsageConfiguration:this[xe].bind(this),getUsageInstance:this[qe].bind(this),getValidationInstance:this[Ye].bind(this),hasParseCallback:this[Je].bind(this),isGlobalContext:this[Ge].bind(this),postProcess:this[Ke].bind(this),reset:this[Xe].bind(this),runValidation:this[ts].bind(this),runYargsParserAndExecuteCommands:this[Ze].bind(this),setHasOutput:this[es].bind(this)}}[Le](){return ve(this,zt,"f")}[Te](){return ve(this,Bt,"f")}[Ve](){return ve(this,Qt,"f")}[Ue](){return ve(this,te,"f")}[He](){return ve(this,oe,"f")||{}}[qe](){return ve(this,ge,"f")}[Ye](){return ve(this,be,"f")}[Je](){return!!ve(this,re,"f")}[Ge](){return ve(this,Zt,"f")}[Ke](t,e,s,n){if(s)return t;if(dt(t))return t;e||(t=this[Oe](t));return(this[je]()["parse-positional-numbers"]||void 0===this[je]()["parse-positional-numbers"])&&(t=this[Se](t)),n&&(t=bt(t,this,ve(this,Gt,"f").getMiddleware(),!1)),t}[Xe](t={}){we(this,se,ve(this,se,"f")||{},"f");const e={};e.local=ve(this,se,"f").local||[],e.configObjects=ve(this,se,"f").configObjects||[];const s={};e.local.forEach((e=>{s[e]=!0,(t[e]||[]).forEach((t=>{s[t]=!0}))})),Object.assign(ve(this,ce,"f"),Object.keys(ve(this,Kt,"f")).reduce(((t,e)=>{const n=ve(this,Kt,"f")[e].filter((t=>!(t in s)));return n.length>0&&(t[e]=n),t}),{})),we(this,Kt,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach((t=>{e[t]=(ve(this,se,"f")[t]||[]).filter((t=>!s[t]))})),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach((t=>{e[t]=At(ve(this,se,"f")[t],(t=>!s[t]))})),e.envPrefix=ve(this,se,"f").envPrefix,we(this,se,e,"f"),we(this,ge,ve(this,ge,"f")?ve(this,ge,"f").reset(s):jt(this,ve(this,de,"f")),"f"),we(this,be,ve(this,be,"f")?ve(this,be,"f").reset(s):function(t,e,s){const n=s.y18n.__,i=s.y18n.__n,r={nonOptionCount:function(s){const n=t.getDemandedCommands(),r=s._.length+(s["--"]?s["--"].length:0)-t.getInternalMethods().getContext().commands.length;n._&&(r<n._.min||r>n._.max)&&(r<n._.min?void 0!==n._.minMsg?e.fail(n._.minMsg?n._.minMsg.replace(/\$0/g,r.toString()).replace(/\$1/,n._.min.toString()):null):e.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",r,r.toString(),n._.min.toString())):r>n._.max&&(void 0!==n._.maxMsg?e.fail(n._.maxMsg?n._.maxMsg.replace(/\$0/g,r.toString()).replace(/\$1/,n._.max.toString()):null):e.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",r,r.toString(),n._.max.toString()))))},positionalCount:function(t,s){s<t&&e.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",s,s+"",t+""))},requiredArguments:function(t,s){let n=null;for(const e of Object.keys(s))Object.prototype.hasOwnProperty.call(t,e)&&void 0!==t[e]||(n=n||{},n[e]=s[e]);if(n){const t=[];for(const e of Object.keys(n)){const s=n[e];s&&t.indexOf(s)<0&&t.push(s)}const s=t.length?`\n${t.join("\n")}`:"";e.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(n).length,Object.keys(n).join(", ")+s))}},unknownArguments:function(s,n,o,a,c=!0){var l;const h=t.getInternalMethods().getCommandInstance().getCommands(),d=[],u=t.getInternalMethods().getContext();if(Object.keys(s).forEach((e=>{Mt.includes(e)||Object.prototype.hasOwnProperty.call(o,e)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),e)||r.isValidAndSomeAliasIsNotNew(e,n)||d.push(e)})),c&&(u.commands.length>0||h.length>0||a)&&s._.slice(u.commands.length).forEach((t=>{h.includes(""+t)||d.push(""+t)})),c){const e=(null===(l=t.getDemandedCommands()._)||void 0===l?void 0:l.max)||0,n=u.commands.length+e;n<s._.length&&s._.slice(n).forEach((t=>{t=String(t),u.commands.includes(t)||d.includes(t)||d.push(t)}))}d.length&&e.fail(i("Unknown argument: %s","Unknown arguments: %s",d.length,d.map((t=>t.trim()?t:`"${t}"`)).join(", ")))},unknownCommands:function(s){const n=t.getInternalMethods().getCommandInstance().getCommands(),r=[],o=t.getInternalMethods().getContext();return(o.commands.length>0||n.length>0)&&s._.slice(o.commands.length).forEach((t=>{n.includes(""+t)||r.push(""+t)})),r.length>0&&(e.fail(i("Unknown command: %s","Unknown commands: %s",r.length,r.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(e,s){if(!Object.prototype.hasOwnProperty.call(s,e))return!1;const n=t.parsed.newAliases;return[e,...s[e]].some((t=>!Object.prototype.hasOwnProperty.call(n,t)||!n[e]))},limitedChoices:function(s){const i=t.getOptions(),r={};if(!Object.keys(i.choices).length)return;Object.keys(s).forEach((t=>{-1===Mt.indexOf(t)&&Object.prototype.hasOwnProperty.call(i.choices,t)&&[].concat(s[t]).forEach((e=>{-1===i.choices[t].indexOf(e)&&void 0!==e&&(r[t]=(r[t]||[]).concat(e))}))}));const o=Object.keys(r);if(!o.length)return;let a=n("Invalid values:");o.forEach((t=>{a+=`\n ${n("Argument: %s, Given: %s, Choices: %s",t,e.stringifiedValues(r[t]),e.stringifiedValues(i.choices[t]))}`})),e.fail(a)}};let o={};function a(t,e){const s=Number(e);return"number"==typeof(e=isNaN(s)?e:s)?e=t._.length>=e:e.match(/^--no-.+/)?(e=e.match(/^--no-(.+)/)[1],e=!Object.prototype.hasOwnProperty.call(t,e)):e=Object.prototype.hasOwnProperty.call(t,e),e}r.implies=function(e,n){pt("<string|object> [array|number|string]",[e,n],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.implies(t,e[t])})):(t.global(e),o[e]||(o[e]=[]),Array.isArray(n)?n.forEach((t=>r.implies(e,t))):(ct(n,void 0,s),o[e].push(n)))},r.getImplied=function(){return o},r.implications=function(t){const s=[];if(Object.keys(o).forEach((e=>{const n=e;(o[e]||[]).forEach((e=>{let i=n;const r=e;i=a(t,i),e=a(t,e),i&&!e&&s.push(` ${n} -> ${r}`)}))})),s.length){let t=`${n("Implications failed:")}\n`;s.forEach((e=>{t+=e})),e.fail(t)}};let c={};r.conflicts=function(e,s){pt("<string|object> [array|string]",[e,s],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.conflicts(t,e[t])})):(t.global(e),c[e]||(c[e]=[]),Array.isArray(s)?s.forEach((t=>r.conflicts(e,t))):c[e].push(s))},r.getConflicting=()=>c,r.conflicting=function(i){Object.keys(i).forEach((t=>{c[t]&&c[t].forEach((s=>{s&&void 0!==i[t]&&void 0!==i[s]&&e.fail(n("Arguments %s and %s are mutually exclusive",t,s))}))})),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(c).forEach((t=>{c[t].forEach((r=>{r&&void 0!==i[s.Parser.camelCase(t)]&&void 0!==i[s.Parser.camelCase(r)]&&e.fail(n("Arguments %s and %s are mutually exclusive",t,r))}))}))},r.recommendCommands=function(t,s){s=s.sort(((t,e)=>e.length-t.length));let i=null,r=1/0;for(let e,n=0;void 0!==(e=s[n]);n++){const s=Nt(t,e);s<=3&&s<r&&(r=s,i=e)}i&&e.fail(n("Did you mean %s?",i))},r.reset=function(t){return o=At(o,(e=>!t[e])),c=At(c,(e=>!t[e])),r};const l=[];return r.freeze=function(){l.push({implied:o,conflicting:c})},r.unfreeze=function(){const t=l.pop();ct(t,void 0,s),({implied:o,conflicting:c}=t)},r}(this,ve(this,ge,"f"),ve(this,de,"f")),"f"),we(this,zt,ve(this,zt,"f")?ve(this,zt,"f").reset():function(t,e,s,n){return new Ot(t,e,s,n)}(ve(this,ge,"f"),ve(this,be,"f"),ve(this,Gt,"f"),ve(this,de,"f")),"f"),ve(this,Lt,"f")||we(this,Lt,function(t,e,s,n){return new St(t,e,s,n)}(this,ve(this,ge,"f"),ve(this,zt,"f"),ve(this,de,"f")),"f"),ve(this,Gt,"f").reset(),we(this,Tt,null,"f"),we(this,ee,"","f"),we(this,Ut,null,"f"),we(this,Qt,!1,"f"),this.parsed=!1,this}[Qe](t,e){return ve(this,de,"f").path.relative(t,e)}[Ze](t,e,s,n=0,i=!1){let r=!!s||i;t=t||ve(this,le,"f"),ve(this,se,"f").__=ve(this,de,"f").y18n.__,ve(this,se,"f").configuration=this[je]();const o=!!ve(this,se,"f").configuration["populate--"],a=Object.assign({},ve(this,se,"f").configuration,{"populate--":!0}),c=ve(this,de,"f").Parser.detailed(t,Object.assign({},ve(this,se,"f"),{configuration:{"parse-positional-numbers":!1,...a}})),l=Object.assign(c.argv,ve(this,oe,"f"));let h;const d=c.aliases;let u=!1,f=!1;Object.keys(l).forEach((t=>{t===ve(this,Xt,"f")&&l[t]?u=!0:t===ve(this,ye,"f")&&l[t]&&(f=!0)})),l.$0=this.$0,this.parsed=c,0===n&&ve(this,ge,"f").clearCachedHelpMessage();try{if(this[Ce](),e)return this[Ke](l,o,!!s,!1);if(ve(this,Xt,"f")){[ve(this,Xt,"f")].concat(d[ve(this,Xt,"f")]||[]).filter((t=>t.length>1)).includes(""+l._[l._.length-1])&&(l._.pop(),u=!0)}we(this,Zt,!1,"f");const a=ve(this,zt,"f").getCommands(),p=ve(this,Lt,"f").completionKey in l,g=u||p||i;if(l._.length){if(a.length){let t;for(let e,r=n||0;void 0!==l._[r];r++){if(e=String(l._[r]),a.includes(e)&&e!==ve(this,Tt,"f")){const t=ve(this,zt,"f").runCommand(e,this,c,r+1,i,u||f||i);return this[Ke](t,o,!!s,!1)}if(!t&&e!==ve(this,Tt,"f")){t=e;break}}!ve(this,zt,"f").hasDefaultCommand()&&ve(this,he,"f")&&t&&!g&&ve(this,be,"f").recommendCommands(t,a)}ve(this,Tt,"f")&&l._.includes(ve(this,Tt,"f"))&&!p&&(ve(this,Yt,"f")&&_t(!0),this.showCompletionScript(),this.exit(0))}if(ve(this,zt,"f").hasDefaultCommand()&&!g){const t=ve(this,zt,"f").runCommand(null,this,c,0,i,u||f||i);return this[Ke](t,o,!!s,!1)}if(p){ve(this,Yt,"f")&&_t(!0);const e=(t=[].concat(t)).slice(t.indexOf(`--${ve(this,Lt,"f").completionKey}`)+1);return ve(this,Lt,"f").getCompletion(e,((t,e)=>{if(t)throw new tt(t.message);(e||[]).forEach((t=>{ve(this,te,"f").log(t)})),this.exit(0)})),this[Ke](l,!o,!!s,!1)}if(ve(this,Qt,"f")||(u?(ve(this,Yt,"f")&&_t(!0),r=!0,this.showHelp("log"),this.exit(0)):f&&(ve(this,Yt,"f")&&_t(!0),r=!0,ve(this,ge,"f").showVersion("log"),this.exit(0))),!r&&ve(this,se,"f").skipValidation.length>0&&(r=Object.keys(l).some((t=>ve(this,se,"f").skipValidation.indexOf(t)>=0&&!0===l[t]))),!r){if(c.error)throw new tt(c.error.message);if(!p){const t=this[ts](d,{},c.error);s||(h=bt(l,this,ve(this,Gt,"f").getMiddleware(),!0)),h=this[Be](t,null!=h?h:l),dt(h)&&!s&&(h=h.then((()=>bt(l,this,ve(this,Gt,"f").getMiddleware(),!1))))}}}catch(t){if(!(t instanceof tt))throw t;ve(this,ge,"f").fail(t.message,t)}return this[Ke](null!=h?h:l,o,!!s,!0)}[ts](t,e,s,n){const i={...this.getDemandedOptions()};return r=>{if(s)throw new tt(s.message);ve(this,be,"f").nonOptionCount(r),ve(this,be,"f").requiredArguments(r,i);let o=!1;ve(this,fe,"f")&&(o=ve(this,be,"f").unknownCommands(r)),ve(this,ue,"f")&&!o?ve(this,be,"f").unknownArguments(r,t,e,!!n):ve(this,pe,"f")&&ve(this,be,"f").unknownArguments(r,t,{},!1,!1),ve(this,be,"f").limitedChoices(r),ve(this,be,"f").implications(r),ve(this,be,"f").conflicting(r)}}[es](){we(this,Qt,!0,"f")}[ss](t){if("string"==typeof t)ve(this,se,"f").key[t]=!0;else for(const e of t)ve(this,se,"f").key[e]=!0}}const is=(rs=at,(t=[],e=rs.process.cwd(),s)=>{const n=new ns(t,e,s,rs);return Object.defineProperty(n,"argv",{get:()=>n.parse(),enumerable:!0}),n.help(),n.version(),n});var rs;const os=new class{_pathByName=new Map;constructor(){this._dirPath=process.cwd()}getBuildCommand(t){return this._buildCommand??=this.packageJson.scripts?.build?.includes("buildIfNeeded")?"yarn build":"YARN wb buildIfNeeded "+(t?.verbose?"--verbose":"")}get dirPath(){return this._dirPath}set dirPath(e){this._dirPath=t.resolve(e)}get rootDirPath(){return this._rootDirPath??=l.existsSync(t.join(this.dirPath,"..","..","package.json"))?t.resolve(this.dirPath,"..",".."):this.dirPath}get dockerfile(){return this._dockerfile??=l.readFileSync(this.findFile("Dockerfile"),"utf8")}get hasDockerfile(){if(void 0!==this._hasDockerfile)return this._hasDockerfile;try{this._hasDockerfile=!!this.findFile("Dockerfile")}catch{this._hasDockerfile=!1}return this._hasDockerfile}get name(){return this._name??=os.rootPackageJson.name||"unknown"}get nameWithoutNamespace(){if(void 0===this._nameWithoutNamespace){const t=os.rootPackageJson.name||"unknown",e=t.lastIndexOf("/");this._nameWithoutNamespace=-1===e?t:t.slice(e+1)}return this._nameWithoutNamespace}get packageJson(){return this._packageJson??=JSON.parse(l.readFileSync(t.join(this.dirPath,"package.json"),"utf8"))}get rootPackageJson(){return this._rootPackageJson??=this.rootDirPath===this.dirPath?this.packageJson:JSON.parse(l.readFileSync(t.join(this.rootDirPath,"package.json"),"utf8"))}get dockerPackageJson(){return this._dockerPackageJson??=t.dirname(this.findFile("Dockerfile"))===this.dirPath?this.packageJson:JSON.parse(l.readFileSync(t.join(t.dirname(this.findFile("Dockerfile")),"package.json"),"utf8"))}findFile(e){let s=this._pathByName.get(e);if(s)return s;if(s=[e,t.join("..","..",e)].find((t=>l.existsSync(t))),!s)throw new Error(`File not found: ${e}`);return this._pathByName.set(e,s),s}},as={command:"buildIfNeeded",describe:"Build code if changes are detected",builder:{command:{description:"A build command",type:"string",default:"yarn build",alias:"c"}},async handler(e){await async function(e){if(!l.existsSync(t.join(os.rootDirPath,".git")))return cs(e),!0;const[s,n,i]=await async function(e){const s=t.resolve(os.dirPath,"node_modules",".cache","build"),n=t.resolve(s,"last-build");await l.promises.mkdir(s,{recursive:!0});const i=v("sha256"),r=y.execSync("git rev-parse HEAD",{cwd:os.dirPath}).toString().trim();i.update(r);const o=JSON.stringify(Object.entries(process.env).filter((([t])=>!ls.has(t))).sort((([t],[e])=>t.localeCompare(e))));i.update(o),await async function(t,e){return new Promise((s=>{const n=y.spawnSync("git",["diff","--name-only"],{cwd:os.dirPath,stdio:"pipe",encoding:"utf8"}).stdout.trim().split("\n").map((t=>"test"===process.env.WB_ENV?t.replace(/packages\/scripts\/test-fixtures\/[^/]+\//,""):t)).filter((t=>(hs.some((e=>t.includes(e)))||ds.some((e=>t.endsWith(e))))&&!us.some((e=>t.includes(e)))));t.verbose&&console.info(`Changed files: ${n.join(", ")}`);const i=y.spawn("git",["diff","--",...n],{cwd:os.rootDirPath});i.stdout?.on("data",(s=>{e.update(s),t.verbose&&(console.info(s.toString()),console.info("Hash:",e.copy().digest("hex")))})),i.on("close",(()=>{s()}))}))}(e,i);const a=i.digest("hex"),c=await async function(t){try{return await t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}}((()=>l.promises.readFile(n,"utf8")));return[c===a,n,a]}(e);if(s)return console.info(O.green(`Skip to run '${e.command}' 💫`)),!1;if(!cs(e))return;e.dryRun||await l.promises.writeFile(n,i,"utf8");return!0}(e)}};function cs(t){if(console.info(O.green(`Run '${t.command}'`)),!t.dryRun){const e=y.spawnSync(t.command??"",{cwd:os.dirPath,shell:!0,stdio:"inherit"});if(0!==e.status)return process.exitCode=e.status??1,!1}return!0}const ls=new Set(["CI","PWDEBUG","TMPDIR"]);const hs=["src/","public/"],ds=[".js",".cjs",".mjs",".jsx",".ts",".cts",".mts",".tsx",".json",".browserslistrc","yarn.lock"],us=["test/","tests/","__tests__/","test-fixtures/","package.json"];const fs={command:"optimizeForDockerBuild",describe:"Optimize configuration when building a Docker image",builder:{outside:{description:"Whether the optimization is executed outside a docker container or not",type:"boolean",alias:"o"}},async handler(e){const s={stdio:"inherit"},n=["package.json"];if(os.packageJson.workspaces){const e=await l.promises.readdir("packages",{withFileTypes:!0});for(const s of e){if(!s.isDirectory())continue;const e=t.join("packages",s.name,"package.json");l.existsSync(e)&&n.push(e)}}for(const s of n){const n=JSON.parse(l.readFileSync(s,"utf8")),i=["dependencies","devDependencies"];for(const t of i){const e=n[t]||{};for(const[t,s]of Object.entries(e))s?.startsWith("git@github.com:")&&(e[t]=`./${t}`)}if(ps(e,n),gs(n),ms(n),e.dryRun)continue;const r=e.outside?t.join(t.dirname(s),"dist"):t.dirname(s);await l.promises.mkdir(r,{recursive:!0}),await l.promises.writeFile(t.join(r,"package.json"),JSON.stringify(n),"utf8")}e.dryRun||e.outside||y.spawnSync("yarn",s)}};function ps(t,e){if(!t.outside)return void delete e.devDependencies;const s=e.devDependencies||{},n=["concurrently","conventional-changelog-conventionalcommits","eslint","husky","jest","kill-port","lint-staged","open-cli","playwright","prettier","pinst","sort-package-json","wait-on","semantic-release","vitest"];for(const e of Object.keys(s))(n.some((t=>e.includes(t)))||!t.outside&&e.includes("willbooster")&&e.includes("config"))&&delete s[e]}function gs(t){const e=["check","deploy","format","lint","start","test"],s=["pinst ","husky "],n=t.scripts||{};for(const[t,i]of Object.entries(n))(e.some((e=>t.includes(e)))||s.some((t=>i.includes(t))))&&delete n[t]}function ms(t){delete t.private,delete t.publishConfig,delete t.prettier}const ys=new class{deploy(){return"PRISMA migrate deploy"}deployForce(t){const e=os.packageJson.dependencies?.blitz?"db":"prisma";return`rm -Rf ${e}/mount/prod.sqlite3*; PRISMA migrate reset --force && rm -Rf ${e}/mount/prod.sqlite3*\n && litestream restore -o ${e}/mount/prod.sqlite3 ${t} && ALLOW_TO_SKIP_SEED=0 PRISMA migrate deploy`}litestream(){return'node -e \'\nconst { PrismaClient } = require("@prisma/client");\nnew PrismaClient().$queryRaw`PRAGMA journal_mode = WAL;`\n .catch((error) => { console.log("Failed due to:", error); process.exit(1); });\n\''}migrate(){return`PRISMA migrate deploy && PRISMA generate && ${this.seed()}`}migrateDev(){return"PRISMA migrate dev"}reset(){return`PRISMA migrate reset --force --skip-seed && ${this.seed()}`}restore(t,e){return`rm -Rf ${os.packageJson.dependencies?.blitz?"db":"prisma"}/restored.sqlite3; GOOGLE_APPLICATION_CREDENTIALS=gcp-sa-key.json litestream restore -o ${e} ${t}`}seed(t){return os.packageJson.dependencies?.blitz?"YARN blitz db seed"+(t?` -f ${t}`:""):t?"YARN build-ts run prisma/seeds.ts":os.packageJson.prisma?.seed?"YARN prisma db seed":'if [ -e "prisma/seeds.ts" ]; then YARN build-ts run prisma/seeds.ts; fi'}studio(e){let s="";if(e)try{new URL(e),s=`DATABASE_URL=${e} `}catch{const n=t.resolve(e);console.info(e,n),s=`DATABASE_URL=file://${n} `}return`${s}PRISMA studio`}},bs=new k,ws=new Set;async function vs(t){try{await E(t)}catch{}}const Os={exitIfFailed:!0};async function ks(t,e,s=Os){const[n,i]=As(t);if(_s(n),e.verbose&&_s(i,"Start (raw)",!0),e.dryRun)return $s(n,0,s),0;const r=i.match(/http:\/\/127.0.0.1:(\d+)/)?.[1];i.includes("wait-on")&&r&&!i.includes("docker run")&&await async function(t){await vs(t);const e=async()=>{ws.has(t)||(ws.add(t),await vs(t))};for(const t of["beforeExit","SIGINT","SIGTERM","SIGQUIT"])process.on(t,e)}(Number(r));const o=await P(i,void 0,{cwd:os.dirPath,shell:!0,stdio:"inherit",timeout:s?.timeout,killOnExit:!0,verbose:e.verbose});return $s(n,o.status,s),o.status??1}function Es(t,e,s=Os){return bs.run((async()=>{const[n,i]=As(t);if(_s(n,"Start (parallel)",!0),e.dryRun)return _s(n,"Started (log)"),e.verbose&&_s(i,"Started (raw)",!0),void $s(n,0,s);const r=await P(i,void 0,{cwd:os.dirPath,shell:!0,stdio:"pipe",timeout:s?.timeout,mergeOutAndError:!0,killOnExit:!0,verbose:e.verbose});_s(n,"Started (log)"),e.verbose&&_s(i,"Started (raw)",!0);const o=r.stdout.trim();o&&console.info(o),$s(n,r.status,s)}))}function As(e){const s=function(){if(js)return xs;js=!0;let e=os.dirPath;for(;;){const s=t.join(e,"node_modules",".bin");if(l.existsSync(s)&&(process.env.PATH=`${s}:${process.env.PATH}`,xs=!0),l.existsSync(t.join(e,".git")))break;const n=t.dirname(e);if(e===n)break;e=n}return xs}(),n=e.replaceAll("\n","").replaceAll(/\s\s+/g," ").replaceAll("PRISMA ",os.packageJson.dependencies?.blitz?"YARN blitz prisma ":"YARN prisma ").trim();return[n.replaceAll("YARN ","yarn "),n.replaceAll("YARN ",s?"":"yarn ")]}function _s(t,e="Start",s=!1){console.info("\n"+(s?O.gray:O.cyan)(O.bold(`${e}:`),t)+O.gray(` at ${os.dirPath}`))}function $s(t,e,s){0===e?console.info(O.green(O.bold("Finished:"),t)):(console.info(O.red(O.bold(`Failed (exit code ${e}): `),t)),!1!==s.exitIfFailed&&process.exit(e??1))}let js=!1,xs=!1;const Cs={},Ps={command:"prisma",describe:"Run prisma commands",builder:t=>t.command(Ss).command(Ms).command(Ds).command(Is).command(Ws).command(Rs).command(zs).command(Fs).command(Bs).demandCommand(),handler(){}},Ss={command:"deploy",describe:"Apply migration to DB without initializing it",builder:Cs,async handler(t){await ks(ys.deploy(),t)}},Ns={...Cs,"backup-path":{description:"Whether to skip actual command execution",demandOption:!0,type:"string",alias:"b"}},Ms={command:"deploy-force <backup-path>",describe:"Force to apply migration to DB utilizing Litestream's backup without initializing it",builder:Ns,async handler(t){await ks(ys.deployForce(t.backupPath),t)}},Ds={command:"litestream",describe:"Setup DB for Litestream",builder:Cs,async handler(t){await ks(ys.litestream(),t)}},Is={command:"migrate",describe:"Apply migration to DB with initializing it",builder:Cs,async handler(t){await ks(ys.migrate(),t)}},Ws={command:"migrate-dev",describe:"Create a migration file",builder:Cs,async handler(t){await ks(ys.migrateDev(),t)}},Rs={command:"reset",describe:"Reset DB",builder:Cs,async handler(t){await ks(ys.reset(),t)}},zs={command:"restore <backup-path>",describe:"Restore DB from Litestream's backup",builder:{...Ns,output:{description:'Output path of the restored database. Defaults to "<db|prisma>/restored.sqlite3".',type:"string"}},async handler(t){const e=t.output||(os.packageJson.dependencies?.blitz?"db/restored.sqlite3":"prisma/restored.sqlite3");await ks(ys.restore(t.backupPath,e),t)}},Fs={command:"seed",describe:"Populate DB with seed data",builder:{...Cs,file:{alias:"f",description:"Path of the seed script.",type:"string"}},async handler(t){await ks(ys.seed(t.file),t)}},Bs={command:"studio [db-url-or-path]",describe:"Open Prisma Studio",builder:{...Cs,"db-url-or-path":{description:"URL or path to the database",type:"string"},restored:{description:"Whether to open the default restored database (<db|prisma>/restored.sqlite3).",type:"boolean"}},async handler(t){if(t.restored&&t.dbUrlOrPath)throw new Error("You cannot specify both --restored and --db-url-or-path.");const e=t.restored?os.packageJson.dependencies?.blitz?"db/restored.sqlite3":"prisma/restored.sqlite3":t.dbUrlOrPath?.toString();await ks(ys.studio(e),t)}},Ls={command:"retry",describe:"Retry the given command until it succeeds",builder:{retry:{description:"A maximum retry count",type:"number",alias:"r",default:3}},async handler(t){const e=t._.slice(1);let s=0;for(let n=0;n<t.retry;n++)if(n>0&&console.info(`\n${O.yellow(`#${n} Retrying: ${e.join(" ")}`)}`),s=await ks(e.join(" "),t,{exitIfFailed:!1}),0===s)return;process.exit(s)}},Ts={command:"setup",describe:"Setup development environment",builder:{},async handler(t){await async function(t){const e=await _.readdir(os.dirPath,{withFileTypes:!0});e.some((t=>t.isFile()&&t.name.includes("-version")))&&await ks("asdf install",t);if(e.some((t=>t.isFile()&&"pyproject.toml"===t.name))){await Es("poetry config virtualenvs.in-project true",t),await Es("poetry config virtualenvs.prefer-active-python true",t);const[,e]=y.execSync("asdf current python").toString().trim().split(/\s+/);await Es(`poetry env use ${e}`,t),await bs.promiseAll(),await ks("poetry run pip install --upgrade pip",t),await ks("poetry install --ansi",t)}if("darwin"===$.platform()){const e=["pstree"];os.hasDockerfile&&e.push("expect"),await Es(`brew install ${e.join(" ")}`,t)}const s=os.packageJson.dependencies??{},n=os.packageJson.devDependencies||{},i=os.packageJson.scripts??{},r=[],o=[];s.blitz||s.next||n["@remix-run/dev"]?(r.push("pm2"),o.push("concurrently","open-cli","vitest","wait-on")):(s.express||s.fastify)&&(r.push("pm2"),o.push("concurrently","vitest","wait-on"));r.length>0&&await ks(`yarn add ${r.join(" ")}`,t);o.length>0&&await ks(`yarn add -D ${o.join(" ")}`,t);i["gen-code"]&&await ks("yarn gen-code",t)}(t)}};const Vs=new class{buildDevImage(){const e=os.dockerPackageJson.scripts?.["docker/build/prepare"]?"yarn run docker/build/prepare && ":"";return`cd ${t.dirname(os.findFile("Dockerfile"))}\n && ${e}YARN wb optimizeForDockerBuild --outside\n && YARN wb retry -- docker build -t ${os.nameWithoutNamespace}\n --build-arg ARCH=$([ $(uname -m) = 'arm64' ] && echo arm64 || echo amd64)\n --build-arg WB_ENV=${process.env.WB_ENV}\n --build-arg WB_VERSION=dev .`}stopAndStart(t=!1,e="",s=""){return`${this.stop()} && ${t?"unbuffer ":""}${this.start(e,s)}`}start(t="",e=""){return function(t){const e=async()=>{if(ws.has(t))return;ws.add(t),_s(t);const{status:e}=w(t,{cwd:os.dirPath,shell:!0,stdio:"inherit"});$s(t,e,{})};for(const t of["beforeExit","SIGINT","SIGTERM","SIGQUIT"])process.on(t,e)}(this.stop()),`docker run --rm -it -p 8080:8080 --name ${os.nameWithoutNamespace} ${t} ${os.nameWithoutNamespace} ${e}`}stop(){return`true $(docker rm -f $(docker container ls -q -f name=${os.nameWithoutNamespace}) 2> /dev/null)`}stopAll(){return"true $(docker rm -f $(docker ps -q) 2> /dev/null)"}};class Us{constructor(t=3e3){this.defaultPort=t}buildDocker(){return Vs.buildDevImage()}startDocker(t){return`${this.buildDocker()}\n && YARN concurrently --raw --kill-others-on-fail\n "${Vs.stopAndStart(!1,t.normalizedDockerArgsText??"",t.normalizedArgsText??"")}"\n "${this.waitAndOpenApp(t,8080)}"`}testE2E(t,{playwrightArgs:e,prismaDirectory:s,startCommand:n}){const i=process.env.WB_ENV;return`WB_ENV=${i} NEXT_PUBLIC_WB_ENV=${i} APP_ENV=${i} PORT=8080 YARN concurrently --kill-others --raw --success first\n "rm -Rf ${s}/mount && ${n} && exit 1"\n "concurrently --kill-others-on-fail --raw 'wait-on -t 600000 -i 2000 http://127.0.0.1:8080' 'yarn playwright install --with-deps'\n && yarn playwright ${e}"`}testE2EDev(t,{playwrightArgs:e,startCommand:s}){const n=process.env.WB_ENV;return`WB_ENV=${n} NEXT_PUBLIC_WB_ENV=${n} APP_ENV=${n} PORT=8080 YARN concurrently --kill-others --raw --success first\n "${s} && exit 1"\n "concurrently --kill-others-on-fail --raw 'wait-on -t 600000 -i 2000 http://127.0.0.1:8080' 'yarn playwright install --with-deps'\n && yarn playwright ${e}"`}testUnit(t){return`WB_ENV=${process.env.WB_ENV} YARN vitest run tests/unit --color --passWithNoTests`}waitApp(t,e=this.defaultPort){return`wait-on -t 10000 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 10000 -i 500 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 10000 -i 1000 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 10000 -i 2000 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 20000 -i 4000 http://127.0.0.1:${e} 2> /dev/null\n || wait-on -t 60000 -i 5000 http://127.0.0.1:${e}`}waitAndOpenApp(t,e=this.defaultPort){return`${this.waitApp(t,e)} || wait-on http://127.0.0.1:${e} && open-cli http://localhost:${e}`}}const Hs=new class extends Us{constructor(){super()}start(t){return`${process.env.WB_ENV?`APP_ENV=${process.env.WB_ENV} `:""}YARN concurrently --raw --kill-others-on-fail\n "blitz dev ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t)}"`}startProduction(t,e){return`${process.env.WB_ENV?`APP_ENV=${process.env.WB_ENV} `:""}NODE_ENV=production YARN concurrently --raw --kill-others-on-fail\n "${ys.reset()} && ${os.getBuildCommand(t)} && PORT=${e} pm2-runtime start ${os.findFile("ecosystem.config.cjs")} ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t,e)}"`}testE2E(t,{playwrightArgs:e="test tests/e2e",startCommand:s=`${ys.reset()} && ${os.getBuildCommand(t)} && pm2-runtime start ${os.findFile("ecosystem.config.cjs")}`}){return super.testE2E(t,{playwrightArgs:e,prismaDirectory:"db",startCommand:s})}testE2EDev(t,{playwrightArgs:e="test tests/e2e",startCommand:s="blitz dev -p 8080"}){return super.testE2EDev(t,{playwrightArgs:e,startCommand:s})}testStart(t){return`YARN concurrently --kill-others --raw --success first "blitz dev" "${this.waitApp(t)}"`}};const qs=new class extends Us{constructor(){super()}start(t){return`YARN build-ts run src/index.ts ${t.watch?"--watch":""} -- ${t.normalizedArgsText??""}`}startDocker(t){return`${this.buildDocker()} && ${Vs.stopAndStart(!1,t.normalizedDockerArgsText??"",t.normalizedArgsText??"")}`}startProduction(t,e=8080){return`NODE_ENV=production ${os.getBuildCommand(t)} && NODE_ENV=production PORT=\${PORT:-${e}} node dist/index.js ${t.normalizedArgsText??""}`}testE2E(t,{startCommand:e=`if [ -e "prisma" ]; then prisma migrate reset --force --skip-generate; fi && (${this.startProduction(t)})`}){return`NODE_ENV=production WB_ENV=${process.env.WB_ENV} PORT=8080 YARN concurrently --kill-others --raw --success first\n "${e} && exit 1"\n "wait-on -t 600000 -i 2000 http://127.0.0.1:8080 && vitest run tests/e2e --color --passWithNoTests"`}testE2EDev(t,{startCommand:e}){return`NODE_ENV=production WB_ENV=${process.env.WB_ENV} PORT=8080 YARN concurrently --kill-others --raw --success first\n "${e||this.start(t)} && exit 1"\n "wait-on -t 600000 -i 2000 http://127.0.0.1:8080 && vitest run tests/e2e --color --passWithNoTests"`}testStart(t){return`YARN concurrently --kill-others --raw --success first "${this.start(t)}" "${this.waitApp(t)}"`}};const Ys=new class extends Us{constructor(){super()}start(t){return`YARN concurrently --raw --kill-others-on-fail\n "next dev ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t)}"`}startProduction(t,e){return`NODE_ENV=production YARN concurrently --raw --kill-others-on-fail\n "${ys.reset()} && ${os.getBuildCommand(t)} && PORT=${e} pm2-runtime start ${os.findFile("ecosystem.config.cjs")} ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t,e)}"`}testE2E(t,{playwrightArgs:e="test tests/e2e",startCommand:s=`${ys.reset()} && ${os.getBuildCommand(t)} && pm2-runtime start ${os.findFile("ecosystem.config.cjs")}`}){return super.testE2E(t,{playwrightArgs:e,prismaDirectory:"db",startCommand:s})}testE2EDev(t,{playwrightArgs:e="test tests/e2e",startCommand:s="next dev -p 8080"}){return super.testE2EDev(t,{playwrightArgs:e,startCommand:s})}testStart(t){return`YARN concurrently --kill-others --raw --success first "next dev" "${this.waitApp(t)}"`}};const Js=new class extends Us{constructor(){super()}start(t){return`YARN build-ts run src/index.ts ${t.watch?"--watch":""} -- ${t.normalizedArgsText??""}`}startDocker(t){return`${this.buildDocker()} && ${Vs.stopAndStart(!1,t.normalizedDockerArgsText??"",t.normalizedArgsText??"")}`}startProduction(t){return`NODE_ENV=production ${os.getBuildCommand(t)} && NODE_ENV=production node dist/index.js ${t.normalizedArgsText??""}`}testE2E(){return"echo 'do nothing.'"}testE2EDev(){return"echo 'do nothing.'"}testStart(){return"echo 'do nothing.'"}};const Gs=new class extends Us{constructor(){super()}start(t){return`YARN concurrently --raw --kill-others-on-fail\n "remix dev ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t)}"`}startProduction(t,e){return`NODE_ENV=production YARN concurrently --raw --kill-others-on-fail\n "${ys.reset()} && ${os.getBuildCommand(t)} && PORT=${e} pm2-runtime start ${os.findFile("ecosystem.config.cjs")} ${t.normalizedArgsText??""}"\n "${this.waitAndOpenApp(t,e)}"`}testE2E(t,{playwrightArgs:e="test tests/e2e",startCommand:s=`${ys.reset()} && ${os.getBuildCommand(t)} && pm2-runtime start ${os.findFile("ecosystem.config.cjs")}`}){return super.testE2E(t,{playwrightArgs:e,prismaDirectory:"prisma",startCommand:s})}testE2EDev(t,{playwrightArgs:e="test tests/e2e",startCommand:s="remix dev"}){return super.testE2EDev(t,{playwrightArgs:e,startCommand:s})}testStart(t){return`YARN concurrently --kill-others --raw --success first "remix dev" "${this.waitApp(t)}"`}},Ks={command:"start [args..]",describe:"Start app",builder:{watch:{description:"Whether to watch files",type:"boolean"},args:{description:"Arguments for core command",type:"array",alias:"a",default:[]},"docker-args":{description:'Arguments for "docker run"',type:"array",default:[]},mode:{description:"Start mode: dev[elopment] (default) | staging | docker",type:"string",alias:"m"}},async handler(t){!function(t){t.normalizedArgsText=[...t.args??[],...t._?.slice(1)??[]].map((t=>`'${t}'`)).join(" "),t.normalizedDockerArgsText=(t.dockerArgs??[]).map((t=>`'${t}'`)).join(" ")}(t);const e=os.packageJson.dependencies||{},s=os.packageJson.devDependencies||{};let n;switch(n=e.blitz?Hs:e.next?Ys:s["@remix-run/dev"]?Gs:(e.express||e.fastify)&&!e["firebase-functions"]||os.hasDockerfile&&/EXPOSE\s+8080/.test(os.dockerfile)?qs:Js,t.mode||"dev"){case"dev":case"development":{const s=Qs(t,e,"development");await ks(`${s}${n.start(t)}`,t);break}case"staging":{const s=Qs(t,e,"staging");await ks(`${s}${n.startProduction(t,8080)}`,t);break}case"docker":{const s=Qs(t,e,"staging");await ks(`${s}${n.startDocker(t)}`,t);break}default:throw new Error(`Unknown start mode: ${t.mode}`)}}};function Qs(t,e,s){process.env.WB_ENV||=s;let n=`WB_ENV=${process.env.WB_ENV} `;return e.next&&(process.env.NEXT_PUBLIC_WB_ENV=process.env.WB_ENV,n+=`NEXT_PUBLIC_WB_ENV=${process.env.WB_ENV} `),x(t,os.dirPath),n}const Xs={command:"test",describe:"Test project",builder:{ci:{description:"Whether to run tests on CI",type:"boolean"},e2e:{description:"Whether to run e2e tests. You may pass mode as argument: none | headless (default) | headless-dev | headed | headed-dev | docker | docker-debug | debug | generate | trace",type:"string"},start:{description:"Whether to run start tests",type:"boolean"},unit:{description:"Whether to run unit tests",type:"boolean"},"unit-timeout":{description:"Timeout for unit tests",type:"number"}},async handler(e){await async function(e){process.env.FORCE_COLOR="3",await async function(t){if(!os.packageJson.workspaces)return;const e=process.argv.slice(2),s=e.findIndex((t=>["-w","--working-dir","--workingDir"].includes(t)));s>=0&&e.splice(s,2),process.env.CI="1",await ks(["yarn","workspaces","foreach","--all","--exclude",os.name,"--verbose","run","wb",...e].join(" "),t),process.exit(0)}(e);const s=os.packageJson.dependencies||{},n=os.packageJson.devDependencies||{};let i;i=s.blitz?Hs:s.next?Ys:n["@remix-run/dev"]?Gs:!s.express&&!s.fastify||s["firebase-functions"]?Js:qs;const r=[];if(e.ci){const s=C(t.join(os.dirPath,"tests","unit")),n=C(t.join(os.dirPath,"tests","e2e"));if(await Es(Vs.stopAll(),e),!1!==e.unit&&await s&&await Es(i.testUnit(e),e,{timeout:e.unitTimeout}),!1!==e.start&&await Es(i.testStart(e),e),await bs.promiseAll(),"none"!==e.e2e&&await n){os.hasDockerfile&&await ks(`${i.buildDocker()}`,e);const t=os.hasDockerfile?{startCommand:Vs.stopAndStart(!0)}:{};process.exitCode=await ks(i.testE2E(e,t),e,{exitIfFailed:!1}),await ks(Vs.stop(),e)}return}(e.unit||!e.start&&void 0===e.e2e)&&r.push(ks(i.testUnit(e),e,{timeout:e.unitTimeout}));e.start&&r.push(ks(i.testStart(e),e));switch(await Promise.all(r),e.e2e){case void 0:case"none":return;case"":case"headless":return void await ks(i.testE2E(e,{}),e);case"headless-dev":return void await ks(i.testE2EDev(e,{}),e);case"docker":return void await Zs(e,i);case"docker-debug":return void await Zs(e,i,"PWDEBUG=1 ")}if(s.blitz||s.next||n["@remix-run/dev"])switch(e.e2e){case"headed":return void await ks(i.testE2E(e,{playwrightArgs:"test tests/e2e --headed"}),e);case"headed-dev":return void await ks(i.testE2EDev(e,{playwrightArgs:"test tests/e2e --headed"}),e);case"debug":return void await ks(`PWDEBUG=1 ${i.testE2E(e,{})}`,e);case"generate":return void await ks(i.testE2E(e,{playwrightArgs:"codegen http://localhost:8080"}),e);case"trace":return void await ks("playwright show-trace",e)}throw new Error(`Unknown e2e mode: ${e.e2e}`)}(e)}};async function Zs(t,e,s=""){await ks(`${e.buildDocker()}`,t),process.exitCode=await ks(`${s}${e.testE2E(t,{startCommand:Vs.stopAndStart(!0)})}`,t,{exitIfFailed:!1}),await ks(Vs.stop(),t)}const tn={command:"typecheck",describe:"Run type checking. .env-related options are ignored.",builder:{},async handler(t){const e=[];if(os.packageJson.workspaces?e.push(`yarn workspaces foreach --all --parallel --exclude ${os.name} --verbose run typecheck`):((os.packageJson.dependencies?.typescript||os.packageJson.devDependencies?.typescript)&&e.push("tsc --noEmit --Pretty"),os.packageJson.devDependencies?.pyright&&e.push("pyright")),process.exitCode=await ks(e.join(" && "),t),0!==process.exitCode){(JSON.parse(await _.readFile("package.json","utf8")).dependencies||{}).blitz&&console.info(O.yellow('Please try "yarn gen-code" if you face unknown type errors.'))}}},en={...tn,command:"tc"},sn={env:{description:".env files to be loaded.",type:"array"},"cascade-env":{description:"Environment to load cascading .env files (e.g., `.env`, `.env.<environment>`, `.env.local` and `.env.<environment>.local`). Preferred over `cascade-node-env` and `auto-cascade-env`.",type:"string"},"cascade-node-env":{description:'Same with --cascade-env=<NODE_ENV || "development">. Preferred over `auto-cascade-env`.',type:"boolean"},"auto-cascade-env":{description:'Same with --cascade-env=<WB_ENV || NODE_ENV || "development">.',type:"boolean",default:!0},"check-env":{description:"Check whether the keys of the loaded .env files are same with the given .env file.",type:"string",default:".env.example"},"working-dir":{description:"A working directory",type:"string",alias:"w"},"dry-run":{description:"Whether to skip actual command execution",type:"boolean",alias:"d"},verbose:{description:"Whether to show verbose information",type:"boolean",alias:"v"}};var nn;await is((nn=process.argv,nn.slice(Z()+1))).scriptName("wb").options(sn).middleware((e=>{const s=e["working-dir"];if(s){const e=t.resolve(s);process.chdir(e),os.dirPath=e}!function(t){t.PATH&&t.BERRY_BIN_FOLDER&&(t.PATH=t.PATH.replace(`${t.BERRY_BIN_FOLDER}:`,"").replaceAll(/\/private\/var\/folders\/[^:]+:/g,"").replaceAll(/\/var\/tmp\/[^:]+:/g,"").replaceAll(/\/tmp\/[^:]+:/g,""));for(const e of Object.keys(t)){const s=e.toUpperCase();(s.startsWith("NPM_")||s.startsWith("YARN_")||s.startsWith("BERRY_")||"PROJECT_CWD"===s||"INIT_CWD"===s)&&delete t[e]}}(process.env);const n=e._[0].toString();["start","tc","typecheck"].includes(n)||("test"===n&&(process.env.WB_ENV||="test"),x(e,os.dirPath))})).command(as).command(fs).command(Ps).command(Ls).command(Ts).command(Ks).command(Xs).command(tn).command(en).demandCommand().strict().help().argv;for(const t of["SIGINT","SIGTERM","SIGQUIT"])process.on(t,(()=>process.exit()));
|
|
34
34
|
//# sourceMappingURL=index.js.map
|