UNPKG

@versiwfekit/verify-commit

Version:

verify-commit config used by versiw

27 lines 95.1 kB
#!/usr/bin/env node "use strict";const require$$0=require("node:events"),require$$1=require("node:child_process"),require$$2=require("node:path"),require$$3=require("node:fs"),g=require("node:process");require("node:util");const f$1=require("node:readline"),node_tty=require("node:tty"),require$$0$3=require("child_process"),require$$0$2=require("path"),require$$0$1=require("fs");function _interopDefaultCompat(l){return l&&typeof l=="object"&&"default"in l?l.default:l}function _interopNamespaceCompat(l){if(l&&typeof l=="object"&&"default"in l)return l;const a=Object.create(null);if(l)for(const E in l)a[E]=l[E];return a.default=l,a}const require$$0__default=_interopDefaultCompat(require$$0),require$$1__default=_interopDefaultCompat(require$$1),require$$2__default=_interopDefaultCompat(require$$2),require$$3__default=_interopDefaultCompat(require$$3),g__default=_interopDefaultCompat(g),f__default=_interopDefaultCompat(f$1),f__namespace=_interopNamespaceCompat(f$1),require$$0__default$3=_interopDefaultCompat(require$$0$3),require$$0__default$2=_interopDefaultCompat(require$$0$2),require$$0__default$1=_interopDefaultCompat(require$$0$1);var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var picocolors={exports:{}},hasRequiredPicocolors;function requirePicocolors(){if(hasRequiredPicocolors)return picocolors.exports;hasRequiredPicocolors=1;let l=process||{},a=l.argv||[],E=l.env||{},$=!(E.NO_COLOR||a.includes("--no-color"))&&(!!E.FORCE_COLOR||a.includes("--color")||l.platform==="win32"||(l.stdout||{}).isTTY&&E.TERM!=="dumb"||!!E.CI),i=(F,H,ee=F)=>te=>{let re=""+te,ne=re.indexOf(H,F.length);return~ne?F+n(re,H,ee,ne)+H:F+re+H},n=(F,H,ee,te)=>{let re="",ne=0;do re+=F.substring(ne,te)+ee,ne=te+H.length,te=F.indexOf(H,ne);while(~te);return re+F.substring(ne)},t=(F=$)=>{let H=F?i:()=>String;return{isColorSupported:F,reset:H("\x1B[0m","\x1B[0m"),bold:H("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:H("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:H("\x1B[3m","\x1B[23m"),underline:H("\x1B[4m","\x1B[24m"),inverse:H("\x1B[7m","\x1B[27m"),hidden:H("\x1B[8m","\x1B[28m"),strikethrough:H("\x1B[9m","\x1B[29m"),black:H("\x1B[30m","\x1B[39m"),red:H("\x1B[31m","\x1B[39m"),green:H("\x1B[32m","\x1B[39m"),yellow:H("\x1B[33m","\x1B[39m"),blue:H("\x1B[34m","\x1B[39m"),magenta:H("\x1B[35m","\x1B[39m"),cyan:H("\x1B[36m","\x1B[39m"),white:H("\x1B[37m","\x1B[39m"),gray:H("\x1B[90m","\x1B[39m"),bgBlack:H("\x1B[40m","\x1B[49m"),bgRed:H("\x1B[41m","\x1B[49m"),bgGreen:H("\x1B[42m","\x1B[49m"),bgYellow:H("\x1B[43m","\x1B[49m"),bgBlue:H("\x1B[44m","\x1B[49m"),bgMagenta:H("\x1B[45m","\x1B[49m"),bgCyan:H("\x1B[46m","\x1B[49m"),bgWhite:H("\x1B[47m","\x1B[49m"),blackBright:H("\x1B[90m","\x1B[39m"),redBright:H("\x1B[91m","\x1B[39m"),greenBright:H("\x1B[92m","\x1B[39m"),yellowBright:H("\x1B[93m","\x1B[39m"),blueBright:H("\x1B[94m","\x1B[39m"),magentaBright:H("\x1B[95m","\x1B[39m"),cyanBright:H("\x1B[96m","\x1B[39m"),whiteBright:H("\x1B[97m","\x1B[39m"),bgBlackBright:H("\x1B[100m","\x1B[49m"),bgRedBright:H("\x1B[101m","\x1B[49m"),bgGreenBright:H("\x1B[102m","\x1B[49m"),bgYellowBright:H("\x1B[103m","\x1B[49m"),bgBlueBright:H("\x1B[104m","\x1B[49m"),bgMagentaBright:H("\x1B[105m","\x1B[49m"),bgCyanBright:H("\x1B[106m","\x1B[49m"),bgWhiteBright:H("\x1B[107m","\x1B[49m")}};return picocolors.exports=t(),picocolors.exports.createColors=t,picocolors.exports}var picocolorsExports=requirePicocolors();const c$1=getDefaultExportFromCjs(picocolorsExports);var commander$1={},argument={},error={},hasRequiredError;function requireError(){if(hasRequiredError)return error;hasRequiredError=1;class l extends Error{constructor($,i,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=i,this.exitCode=$,this.nestedError=void 0}}class a extends l{constructor($){super(1,"commander.invalidArgument",$),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return error.CommanderError=l,error.InvalidArgumentError=a,error}var hasRequiredArgument;function requireArgument(){if(hasRequiredArgument)return argument;hasRequiredArgument=1;const{InvalidArgumentError:l}=requireError();class a{constructor(i,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,i[0]){case"<":this.required=!0,this._name=i.slice(1,-1);break;case"[":this.required=!1,this._name=i.slice(1,-1);break;default:this.required=!0,this._name=i;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(i,n){return n===this.defaultValue||!Array.isArray(n)?[i]:n.concat(i)}default(i,n){return this.defaultValue=i,this.defaultValueDescription=n,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(n,t)=>{if(!this.argChoices.includes(n))throw new l(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(n,t):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function E($){const i=$.name()+($.variadic===!0?"...":"");return $.required?"<"+i+">":"["+i+"]"}return argument.Argument=a,argument.humanReadableArgName=E,argument}var command={},help={},hasRequiredHelp;function requireHelp(){if(hasRequiredHelp)return help;hasRequiredHelp=1;const{humanReadableArgName:l}=requireArgument();class a{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(i){this.helpWidth=this.helpWidth??i.helpWidth??80}visibleCommands(i){const n=i.commands.filter(F=>!F._hidden),t=i._getHelpCommand();return t&&!t._hidden&&n.push(t),this.sortSubcommands&&n.sort((F,H)=>F.name().localeCompare(H.name())),n}compareOptions(i,n){const t=F=>F.short?F.short.replace(/^-/,""):F.long.replace(/^--/,"");return t(i).localeCompare(t(n))}visibleOptions(i){const n=i.options.filter(F=>!F.hidden),t=i._getHelpOption();if(t&&!t.hidden){const F=t.short&&i._findOption(t.short),H=t.long&&i._findOption(t.long);!F&&!H?n.push(t):t.long&&!H?n.push(i.createOption(t.long,t.description)):t.short&&!F&&n.push(i.createOption(t.short,t.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(i){if(!this.showGlobalOptions)return[];const n=[];for(let t=i.parent;t;t=t.parent){const F=t.options.filter(H=>!H.hidden);n.push(...F)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(i){return i._argsDescription&&i.registeredArguments.forEach(n=>{n.description=n.description||i._argsDescription[n.name()]||""}),i.registeredArguments.find(n=>n.description)?i.registeredArguments:[]}subcommandTerm(i){const n=i.registeredArguments.map(t=>l(t)).join(" ");return i._name+(i._aliases[0]?"|"+i._aliases[0]:"")+(i.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(i){return i.flags}argumentTerm(i){return i.name()}longestSubcommandTermLength(i,n){return n.visibleCommands(i).reduce((t,F)=>Math.max(t,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(F)))),0)}longestOptionTermLength(i,n){return n.visibleOptions(i).reduce((t,F)=>Math.max(t,this.displayWidth(n.styleOptionTerm(n.optionTerm(F)))),0)}longestGlobalOptionTermLength(i,n){return n.visibleGlobalOptions(i).reduce((t,F)=>Math.max(t,this.displayWidth(n.styleOptionTerm(n.optionTerm(F)))),0)}longestArgumentTermLength(i,n){return n.visibleArguments(i).reduce((t,F)=>Math.max(t,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(F)))),0)}commandUsage(i){let n=i._name;i._aliases[0]&&(n=n+"|"+i._aliases[0]);let t="";for(let F=i.parent;F;F=F.parent)t=F.name()+" "+t;return t+n+" "+i.usage()}commandDescription(i){return i.description()}subcommandDescription(i){return i.summary()||i.description()}optionDescription(i){const n=[];return i.argChoices&&n.push(`choices: ${i.argChoices.map(t=>JSON.stringify(t)).join(", ")}`),i.defaultValue!==void 0&&(i.required||i.optional||i.isBoolean()&&typeof i.defaultValue=="boolean")&&n.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),i.presetArg!==void 0&&i.optional&&n.push(`preset: ${JSON.stringify(i.presetArg)}`),i.envVar!==void 0&&n.push(`env: ${i.envVar}`),n.length>0?`${i.description} (${n.join(", ")})`:i.description}argumentDescription(i){const n=[];if(i.argChoices&&n.push(`choices: ${i.argChoices.map(t=>JSON.stringify(t)).join(", ")}`),i.defaultValue!==void 0&&n.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),n.length>0){const t=`(${n.join(", ")})`;return i.description?`${i.description} ${t}`:t}return i.description}formatHelp(i,n){const t=n.padWidth(i,n),F=n.helpWidth??80;function H(ae,de){return n.formatItem(ae,t,de,n)}let ee=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(i))}`,""];const te=n.commandDescription(i);te.length>0&&(ee=ee.concat([n.boxWrap(n.styleCommandDescription(te),F),""]));const re=n.visibleArguments(i).map(ae=>H(n.styleArgumentTerm(n.argumentTerm(ae)),n.styleArgumentDescription(n.argumentDescription(ae))));re.length>0&&(ee=ee.concat([n.styleTitle("Arguments:"),...re,""]));const ne=n.visibleOptions(i).map(ae=>H(n.styleOptionTerm(n.optionTerm(ae)),n.styleOptionDescription(n.optionDescription(ae))));if(ne.length>0&&(ee=ee.concat([n.styleTitle("Options:"),...ne,""])),n.showGlobalOptions){const ae=n.visibleGlobalOptions(i).map(de=>H(n.styleOptionTerm(n.optionTerm(de)),n.styleOptionDescription(n.optionDescription(de))));ae.length>0&&(ee=ee.concat([n.styleTitle("Global Options:"),...ae,""]))}const oe=n.visibleCommands(i).map(ae=>H(n.styleSubcommandTerm(n.subcommandTerm(ae)),n.styleSubcommandDescription(n.subcommandDescription(ae))));return oe.length>0&&(ee=ee.concat([n.styleTitle("Commands:"),...oe,""])),ee.join(` `)}displayWidth(i){return E(i).length}styleTitle(i){return i}styleUsage(i){return i.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n==="[command]"?this.styleSubcommandText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleCommandText(n)).join(" ")}styleCommandDescription(i){return this.styleDescriptionText(i)}styleOptionDescription(i){return this.styleDescriptionText(i)}styleSubcommandDescription(i){return this.styleDescriptionText(i)}styleArgumentDescription(i){return this.styleDescriptionText(i)}styleDescriptionText(i){return i}styleOptionTerm(i){return this.styleOptionText(i)}styleSubcommandTerm(i){return i.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(i){return this.styleArgumentText(i)}styleOptionText(i){return i}styleArgumentText(i){return i}styleSubcommandText(i){return i}styleCommandText(i){return i}padWidth(i,n){return Math.max(n.longestOptionTermLength(i,n),n.longestGlobalOptionTermLength(i,n),n.longestSubcommandTermLength(i,n),n.longestArgumentTermLength(i,n))}preformatted(i){return/\n[^\S\r\n]/.test(i)}formatItem(i,n,t,F){const ee=" ".repeat(2);if(!t)return ee+i;const te=i.padEnd(n+i.length-F.displayWidth(i)),re=2,oe=(this.helpWidth??80)-n-re-2;let ae;return oe<this.minWidthToWrap||F.preformatted(t)?ae=t:ae=F.boxWrap(t,oe).replace(/\n/g,` `+" ".repeat(n+re)),ee+te+" ".repeat(re)+ae.replace(/\n/g,` ${ee}`)}boxWrap(i,n){if(n<this.minWidthToWrap)return i;const t=i.split(/\r\n|\n/),F=/[\s]*[^\s]+/g,H=[];return t.forEach(ee=>{const te=ee.match(F);if(te===null){H.push("");return}let re=[te.shift()],ne=this.displayWidth(re[0]);te.forEach(oe=>{const ae=this.displayWidth(oe);if(ne+ae<=n){re.push(oe),ne+=ae;return}H.push(re.join(""));const de=oe.trimStart();re=[de],ne=this.displayWidth(de)}),H.push(re.join(""))}),H.join(` `)}}function E($){const i=/\x1b\[\d*(;\d*)*m/g;return $.replace(i,"")}return help.Help=a,help.stripColor=E,help}var option={},hasRequiredOption;function requireOption(){if(hasRequiredOption)return option;hasRequiredOption=1;const{InvalidArgumentError:l}=requireError();class a{constructor(t,F){this.flags=t,this.description=F||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;const H=i(t);this.short=H.shortFlag,this.long=H.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,F){return this.defaultValue=t,this.defaultValueDescription=F,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let F=t;return typeof t=="string"&&(F={[t]:!0}),this.implied=Object.assign(this.implied||{},F),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,F){return F===this.defaultValue||!Array.isArray(F)?[t]:F.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(F,H)=>{if(!this.argChoices.includes(F))throw new l(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(F,H):F},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?$(this.name().replace(/^no-/,"")):$(this.name())}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class E{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(F=>{F.negate?this.negativeOptions.set(F.attributeName(),F):this.positiveOptions.set(F.attributeName(),F)}),this.negativeOptions.forEach((F,H)=>{this.positiveOptions.has(H)&&this.dualOptions.add(H)})}valueFromOption(t,F){const H=F.attributeName();if(!this.dualOptions.has(H))return!0;const ee=this.negativeOptions.get(H).presetArg,te=ee!==void 0?ee:!1;return F.negate===(te===t)}}function $(n){return n.split("-").reduce((t,F)=>t+F[0].toUpperCase()+F.slice(1))}function i(n){let t,F;const H=/^-[^-]$/,ee=/^--[^-]/,te=n.split(/[ |,]+/).concat("guard");if(H.test(te[0])&&(t=te.shift()),ee.test(te[0])&&(F=te.shift()),!t&&H.test(te[0])&&(t=te.shift()),!t&&ee.test(te[0])&&(t=F,F=te.shift()),te[0].startsWith("-")){const re=te[0],ne=`option creation failed due to '${re}' in option flags '${n}'`;throw/^-[^-][^-]/.test(re)?new Error(`${ne} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):H.test(re)?new Error(`${ne} - too many short flags`):ee.test(re)?new Error(`${ne} - too many long flags`):new Error(`${ne} - unrecognised flag format`)}if(t===void 0&&F===void 0)throw new Error(`option creation failed due to no flags found in '${n}'.`);return{shortFlag:t,longFlag:F}}return option.Option=a,option.DualOptions=E,option}var suggestSimilar={},hasRequiredSuggestSimilar;function requireSuggestSimilar(){if(hasRequiredSuggestSimilar)return suggestSimilar;hasRequiredSuggestSimilar=1;const l=3;function a($,i){if(Math.abs($.length-i.length)>l)return Math.max($.length,i.length);const n=[];for(let t=0;t<=$.length;t++)n[t]=[t];for(let t=0;t<=i.length;t++)n[0][t]=t;for(let t=1;t<=i.length;t++)for(let F=1;F<=$.length;F++){let H=1;$[F-1]===i[t-1]?H=0:H=1,n[F][t]=Math.min(n[F-1][t]+1,n[F][t-1]+1,n[F-1][t-1]+H),F>1&&t>1&&$[F-1]===i[t-2]&&$[F-2]===i[t-1]&&(n[F][t]=Math.min(n[F][t],n[F-2][t-2]+1))}return n[$.length][i.length]}function E($,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));const n=$.startsWith("--");n&&($=$.slice(2),i=i.map(ee=>ee.slice(2)));let t=[],F=l;const H=.4;return i.forEach(ee=>{if(ee.length<=1)return;const te=a($,ee),re=Math.max($.length,ee.length);(re-te)/re>H&&(te<F?(F=te,t=[ee]):te===F&&t.push(ee))}),t.sort((ee,te)=>ee.localeCompare(te)),n&&(t=t.map(ee=>`--${ee}`)),t.length>1?` (Did you mean one of ${t.join(", ")}?)`:t.length===1?` (Did you mean ${t[0]}?)`:""}return suggestSimilar.suggestSimilar=E,suggestSimilar}var hasRequiredCommand;function requireCommand(){if(hasRequiredCommand)return command;hasRequiredCommand=1;const l=require$$0__default.EventEmitter,a=require$$1__default,E=require$$2__default,$=require$$3__default,i=g__default,{Argument:n,humanReadableArgName:t}=requireArgument(),{CommanderError:F}=requireError(),{Help:H,stripColor:ee}=requireHelp(),{Option:te,DualOptions:re}=requireOption(),{suggestSimilar:ne}=requireSuggestSimilar();class oe extends l{constructor(s){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=s||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:p=>i.stdout.write(p),writeErr:p=>i.stderr.write(p),outputError:(p,j)=>j(p),getOutHelpWidth:()=>i.stdout.isTTY?i.stdout.columns:void 0,getErrHelpWidth:()=>i.stderr.isTTY?i.stderr.columns:void 0,getOutHasColors:()=>de()??(i.stdout.isTTY&&i.stdout.hasColors?.()),getErrHasColors:()=>de()??(i.stderr.isTTY&&i.stderr.hasColors?.()),stripColor:p=>ee(p)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(s){return this._outputConfiguration=s._outputConfiguration,this._helpOption=s._helpOption,this._helpCommand=s._helpCommand,this._helpConfiguration=s._helpConfiguration,this._exitCallback=s._exitCallback,this._storeOptionsAsProperties=s._storeOptionsAsProperties,this._combineFlagAndOptionalValue=s._combineFlagAndOptionalValue,this._allowExcessArguments=s._allowExcessArguments,this._enablePositionalOptions=s._enablePositionalOptions,this._showHelpAfterError=s._showHelpAfterError,this._showSuggestionAfterError=s._showSuggestionAfterError,this}_getCommandAndAncestors(){const s=[];for(let p=this;p;p=p.parent)s.push(p);return s}command(s,p,j){let M=p,Z=j;typeof M=="object"&&M!==null&&(Z=M,M=null),Z=Z||{};const[,se,De]=s.match(/([^ ]+) *(.*)/),ie=this.createCommand(se);return M&&(ie.description(M),ie._executableHandler=!0),Z.isDefault&&(this._defaultCommandName=ie._name),ie._hidden=!!(Z.noHelp||Z.hidden),ie._executableFile=Z.executableFile||null,De&&ie.arguments(De),this._registerCommand(ie),ie.parent=this,ie.copyInheritedSettings(this),M?this:ie}createCommand(s){return new oe(s)}createHelp(){return Object.assign(new H,this.configureHelp())}configureHelp(s){return s===void 0?this._helpConfiguration:(this._helpConfiguration=s,this)}configureOutput(s){return s===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,s),this)}showHelpAfterError(s=!0){return typeof s!="string"&&(s=!!s),this._showHelpAfterError=s,this}showSuggestionAfterError(s=!0){return this._showSuggestionAfterError=!!s,this}addCommand(s,p){if(!s._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return p=p||{},p.isDefault&&(this._defaultCommandName=s._name),(p.noHelp||p.hidden)&&(s._hidden=!0),this._registerCommand(s),s.parent=this,s._checkForBrokenPassThrough(),this}createArgument(s,p){return new n(s,p)}argument(s,p,j,M){const Z=this.createArgument(s,p);return typeof j=="function"?Z.default(M).argParser(j):Z.default(j),this.addArgument(Z),this}arguments(s){return s.trim().split(/ +/).forEach(p=>{this.argument(p)}),this}addArgument(s){const p=this.registeredArguments.slice(-1)[0];if(p&&p.variadic)throw new Error(`only the last argument can be variadic '${p.name()}'`);if(s.required&&s.defaultValue!==void 0&&s.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${s.name()}'`);return this.registeredArguments.push(s),this}helpCommand(s,p){if(typeof s=="boolean")return this._addImplicitHelpCommand=s,this;s=s??"help [command]";const[,j,M]=s.match(/([^ ]+) *(.*)/),Z=p??"display help for command",se=this.createCommand(j);return se.helpOption(!1),M&&se.arguments(M),Z&&se.description(Z),this._addImplicitHelpCommand=!0,this._helpCommand=se,this}addHelpCommand(s,p){return typeof s!="object"?(this.helpCommand(s,p),this):(this._addImplicitHelpCommand=!0,this._helpCommand=s,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(s,p){const j=["preSubcommand","preAction","postAction"];if(!j.includes(s))throw new Error(`Unexpected value for event passed to hook : '${s}'. Expecting one of '${j.join("', '")}'`);return this._lifeCycleHooks[s]?this._lifeCycleHooks[s].push(p):this._lifeCycleHooks[s]=[p],this}exitOverride(s){return s?this._exitCallback=s:this._exitCallback=p=>{if(p.code!=="commander.executeSubCommandAsync")throw p},this}_exit(s,p,j){this._exitCallback&&this._exitCallback(new F(s,p,j)),i.exit(s)}action(s){const p=j=>{const M=this.registeredArguments.length,Z=j.slice(0,M);return this._storeOptionsAsProperties?Z[M]=this:Z[M]=this.opts(),Z.push(this),s.apply(this,Z)};return this._actionHandler=p,this}createOption(s,p){return new te(s,p)}_callParseArg(s,p,j,M){try{return s.parseArg(p,j)}catch(Z){if(Z.code==="commander.invalidArgument"){const se=`${M} ${Z.message}`;this.error(se,{exitCode:Z.exitCode,code:Z.code})}throw Z}}_registerOption(s){const p=s.short&&this._findOption(s.short)||s.long&&this._findOption(s.long);if(p){const j=s.long&&this._findOption(s.long)?s.long:s.short;throw new Error(`Cannot add option '${s.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${j}' - already used by option '${p.flags}'`)}this.options.push(s)}_registerCommand(s){const p=M=>[M.name()].concat(M.aliases()),j=p(s).find(M=>this._findCommand(M));if(j){const M=p(this._findCommand(j)).join("|"),Z=p(s).join("|");throw new Error(`cannot add command '${Z}' as already have command '${M}'`)}this.commands.push(s)}addOption(s){this._registerOption(s);const p=s.name(),j=s.attributeName();if(s.negate){const Z=s.long.replace(/^--no-/,"--");this._findOption(Z)||this.setOptionValueWithSource(j,s.defaultValue===void 0?!0:s.defaultValue,"default")}else s.defaultValue!==void 0&&this.setOptionValueWithSource(j,s.defaultValue,"default");const M=(Z,se,De)=>{Z==null&&s.presetArg!==void 0&&(Z=s.presetArg);const ie=this.getOptionValue(j);Z!==null&&s.parseArg?Z=this._callParseArg(s,Z,ie,se):Z!==null&&s.variadic&&(Z=s._concatValue(Z,ie)),Z==null&&(s.negate?Z=!1:s.isBoolean()||s.optional?Z=!0:Z=""),this.setOptionValueWithSource(j,Z,De)};return this.on("option:"+p,Z=>{const se=`error: option '${s.flags}' argument '${Z}' is invalid.`;M(Z,se,"cli")}),s.envVar&&this.on("optionEnv:"+p,Z=>{const se=`error: option '${s.flags}' value '${Z}' from env '${s.envVar}' is invalid.`;M(Z,se,"env")}),this}_optionEx(s,p,j,M,Z){if(typeof p=="object"&&p instanceof te)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const se=this.createOption(p,j);if(se.makeOptionMandatory(!!s.mandatory),typeof M=="function")se.default(Z).argParser(M);else if(M instanceof RegExp){const De=M;M=(ie,pe)=>{const me=De.exec(ie);return me?me[0]:pe},se.default(Z).argParser(M)}else se.default(M);return this.addOption(se)}option(s,p,j,M){return this._optionEx({},s,p,j,M)}requiredOption(s,p,j,M){return this._optionEx({mandatory:!0},s,p,j,M)}combineFlagAndOptionalValue(s=!0){return this._combineFlagAndOptionalValue=!!s,this}allowUnknownOption(s=!0){return this._allowUnknownOption=!!s,this}allowExcessArguments(s=!0){return this._allowExcessArguments=!!s,this}enablePositionalOptions(s=!0){return this._enablePositionalOptions=!!s,this}passThroughOptions(s=!0){return this._passThroughOptions=!!s,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(s=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!s,this}getOptionValue(s){return this._storeOptionsAsProperties?this[s]:this._optionValues[s]}setOptionValue(s,p){return this.setOptionValueWithSource(s,p,void 0)}setOptionValueWithSource(s,p,j){return this._storeOptionsAsProperties?this[s]=p:this._optionValues[s]=p,this._optionValueSources[s]=j,this}getOptionValueSource(s){return this._optionValueSources[s]}getOptionValueSourceWithGlobals(s){let p;return this._getCommandAndAncestors().forEach(j=>{j.getOptionValueSource(s)!==void 0&&(p=j.getOptionValueSource(s))}),p}_prepareUserArgs(s,p){if(s!==void 0&&!Array.isArray(s))throw new Error("first parameter to parse must be array or undefined");if(p=p||{},s===void 0&&p.from===void 0){i.versions?.electron&&(p.from="electron");const M=i.execArgv??[];(M.includes("-e")||M.includes("--eval")||M.includes("-p")||M.includes("--print"))&&(p.from="eval")}s===void 0&&(s=i.argv),this.rawArgs=s.slice();let j;switch(p.from){case void 0:case"node":this._scriptPath=s[1],j=s.slice(2);break;case"electron":i.defaultApp?(this._scriptPath=s[1],j=s.slice(2)):j=s.slice(1);break;case"user":j=s.slice(0);break;case"eval":j=s.slice(1);break;default:throw new Error(`unexpected parse option { from: '${p.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",j}parse(s,p){this._prepareForParse();const j=this._prepareUserArgs(s,p);return this._parseCommand([],j),this}async parseAsync(s,p){this._prepareForParse();const j=this._prepareUserArgs(s,p);return await this._parseCommand([],j),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(s,p,j){if($.existsSync(s))return;const M=p?`searched for local subcommand relative to directory '${p}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",Z=`'${s}' does not exist - if '${j}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - ${M}`;throw new Error(Z)}_executeSubCommand(s,p){p=p.slice();let j=!1;const M=[".js",".ts",".tsx",".mjs",".cjs"];function Z(me,fe){const Ee=E.resolve(me,fe);if($.existsSync(Ee))return Ee;if(M.includes(E.extname(fe)))return;const ge=M.find(be=>$.existsSync(`${Ee}${be}`));if(ge)return`${Ee}${ge}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let se=s._executableFile||`${this._name}-${s._name}`,De=this._executableDir||"";if(this._scriptPath){let me;try{me=$.realpathSync(this._scriptPath)}catch{me=this._scriptPath}De=E.resolve(E.dirname(me),De)}if(De){let me=Z(De,se);if(!me&&!s._executableFile&&this._scriptPath){const fe=E.basename(this._scriptPath,E.extname(this._scriptPath));fe!==this._name&&(me=Z(De,`${fe}-${s._name}`))}se=me||se}j=M.includes(E.extname(se));let ie;i.platform!=="win32"?j?(p.unshift(se),p=ae(i.execArgv).concat(p),ie=a.spawn(i.argv[0],p,{stdio:"inherit"})):ie=a.spawn(se,p,{stdio:"inherit"}):(this._checkForMissingExecutable(se,De,s._name),p.unshift(se),p=ae(i.execArgv).concat(p),ie=a.spawn(i.execPath,p,{stdio:"inherit"})),ie.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(fe=>{i.on(fe,()=>{ie.killed===!1&&ie.exitCode===null&&ie.kill(fe)})});const pe=this._exitCallback;ie.on("close",me=>{me=me??1,pe?pe(new F(me,"commander.executeSubCommandAsync","(close)")):i.exit(me)}),ie.on("error",me=>{if(me.code==="ENOENT")this._checkForMissingExecutable(se,De,s._name);else if(me.code==="EACCES")throw new Error(`'${se}' not executable`);if(!pe)i.exit(1);else{const fe=new F(1,"commander.executeSubCommandAsync","(error)");fe.nestedError=me,pe(fe)}}),this.runningCommand=ie}_dispatchSubcommand(s,p,j){const M=this._findCommand(s);M||this.help({error:!0}),M._prepareForParse();let Z;return Z=this._chainOrCallSubCommandHook(Z,M,"preSubcommand"),Z=this._chainOrCall(Z,()=>{if(M._executableHandler)this._executeSubCommand(M,p.concat(j));else return M._parseCommand(p,j)}),Z}_dispatchHelpCommand(s){s||this.help();const p=this._findCommand(s);return p&&!p._executableHandler&&p.help(),this._dispatchSubcommand(s,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((s,p)=>{s.required&&this.args[p]==null&&this.missingArgument(s.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const s=(j,M,Z)=>{let se=M;if(M!==null&&j.parseArg){const De=`error: command-argument value '${M}' is invalid for argument '${j.name()}'.`;se=this._callParseArg(j,M,Z,De)}return se};this._checkNumberOfArguments();const p=[];this.registeredArguments.forEach((j,M)=>{let Z=j.defaultValue;j.variadic?M<this.args.length?(Z=this.args.slice(M),j.parseArg&&(Z=Z.reduce((se,De)=>s(j,De,se),j.defaultValue))):Z===void 0&&(Z=[]):M<this.args.length&&(Z=this.args[M],j.parseArg&&(Z=s(j,Z,j.defaultValue))),p[M]=Z}),this.processedArgs=p}_chainOrCall(s,p){return s&&s.then&&typeof s.then=="function"?s.then(()=>p()):p()}_chainOrCallHooks(s,p){let j=s;const M=[];return this._getCommandAndAncestors().reverse().filter(Z=>Z._lifeCycleHooks[p]!==void 0).forEach(Z=>{Z._lifeCycleHooks[p].forEach(se=>{M.push({hookedCommand:Z,callback:se})})}),p==="postAction"&&M.reverse(),M.forEach(Z=>{j=this._chainOrCall(j,()=>Z.callback(Z.hookedCommand,this))}),j}_chainOrCallSubCommandHook(s,p,j){let M=s;return this._lifeCycleHooks[j]!==void 0&&this._lifeCycleHooks[j].forEach(Z=>{M=this._chainOrCall(M,()=>Z(this,p))}),M}_parseCommand(s,p){const j=this.parseOptions(p);if(this._parseOptionsEnv(),this._parseOptionsImplied(),s=s.concat(j.operands),p=j.unknown,this.args=s.concat(p),s&&this._findCommand(s[0]))return this._dispatchSubcommand(s[0],s.slice(1),p);if(this._getHelpCommand()&&s[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(s[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(p),this._dispatchSubcommand(this._defaultCommandName,s,p);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(j.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const M=()=>{j.unknown.length>0&&this.unknownOption(j.unknown[0])},Z=`command:${this.name()}`;if(this._actionHandler){M(),this._processArguments();let se;return se=this._chainOrCallHooks(se,"preAction"),se=this._chainOrCall(se,()=>this._actionHandler(this.processedArgs)),this.parent&&(se=this._chainOrCall(se,()=>{this.parent.emit(Z,s,p)})),se=this._chainOrCallHooks(se,"postAction"),se}if(this.parent&&this.parent.listenerCount(Z))M(),this._processArguments(),this.parent.emit(Z,s,p);else if(s.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",s,p);this.listenerCount("command:*")?this.emit("command:*",s,p):this.commands.length?this.unknownCommand():(M(),this._processArguments())}else this.commands.length?(M(),this.help({error:!0})):(M(),this._processArguments())}_findCommand(s){if(s)return this.commands.find(p=>p._name===s||p._aliases.includes(s))}_findOption(s){return this.options.find(p=>p.is(s))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(s=>{s.options.forEach(p=>{p.mandatory&&s.getOptionValue(p.attributeName())===void 0&&s.missingMandatoryOptionValue(p)})})}_checkForConflictingLocalOptions(){const s=this.options.filter(j=>{const M=j.attributeName();return this.getOptionValue(M)===void 0?!1:this.getOptionValueSource(M)!=="default"});s.filter(j=>j.conflictsWith.length>0).forEach(j=>{const M=s.find(Z=>j.conflictsWith.includes(Z.attributeName()));M&&this._conflictingOption(j,M)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(s=>{s._checkForConflictingLocalOptions()})}parseOptions(s){const p=[],j=[];let M=p;const Z=s.slice();function se(ie){return ie.length>1&&ie[0]==="-"}let De=null;for(;Z.length;){const ie=Z.shift();if(ie==="--"){M===j&&M.push(ie),M.push(...Z);break}if(De&&!se(ie)){this.emit(`option:${De.name()}`,ie);continue}if(De=null,se(ie)){const pe=this._findOption(ie);if(pe){if(pe.required){const me=Z.shift();me===void 0&&this.optionMissingArgument(pe),this.emit(`option:${pe.name()}`,me)}else if(pe.optional){let me=null;Z.length>0&&!se(Z[0])&&(me=Z.shift()),this.emit(`option:${pe.name()}`,me)}else this.emit(`option:${pe.name()}`);De=pe.variadic?pe:null;continue}}if(ie.length>2&&ie[0]==="-"&&ie[1]!=="-"){const pe=this._findOption(`-${ie[1]}`);if(pe){pe.required||pe.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${pe.name()}`,ie.slice(2)):(this.emit(`option:${pe.name()}`),Z.unshift(`-${ie.slice(2)}`));continue}}if(/^--[^=]+=/.test(ie)){const pe=ie.indexOf("="),me=this._findOption(ie.slice(0,pe));if(me&&(me.required||me.optional)){this.emit(`option:${me.name()}`,ie.slice(pe+1));continue}}if(se(ie)&&(M=j),(this._enablePositionalOptions||this._passThroughOptions)&&p.length===0&&j.length===0){if(this._findCommand(ie)){p.push(ie),Z.length>0&&j.push(...Z);break}else if(this._getHelpCommand()&&ie===this._getHelpCommand().name()){p.push(ie),Z.length>0&&p.push(...Z);break}else if(this._defaultCommandName){j.push(ie),Z.length>0&&j.push(...Z);break}}if(this._passThroughOptions){M.push(ie),Z.length>0&&M.push(...Z);break}M.push(ie)}return{operands:p,unknown:j}}opts(){if(this._storeOptionsAsProperties){const s={},p=this.options.length;for(let j=0;j<p;j++){const M=this.options[j].attributeName();s[M]=M===this._versionOptionName?this._version:this[M]}return s}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((s,p)=>Object.assign(s,p.opts()),{})}error(s,p){this._outputConfiguration.outputError(`${s} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0}));const j=p||{},M=j.exitCode||1,Z=j.code||"commander.error";this._exit(M,Z,s)}_parseOptionsEnv(){this.options.forEach(s=>{if(s.envVar&&s.envVar in i.env){const p=s.attributeName();(this.getOptionValue(p)===void 0||["default","config","env"].includes(this.getOptionValueSource(p)))&&(s.required||s.optional?this.emit(`optionEnv:${s.name()}`,i.env[s.envVar]):this.emit(`optionEnv:${s.name()}`))}})}_parseOptionsImplied(){const s=new re(this.options),p=j=>this.getOptionValue(j)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(j));this.options.filter(j=>j.implied!==void 0&&p(j.attributeName())&&s.valueFromOption(this.getOptionValue(j.attributeName()),j)).forEach(j=>{Object.keys(j.implied).filter(M=>!p(M)).forEach(M=>{this.setOptionValueWithSource(M,j.implied[M],"implied")})})}missingArgument(s){const p=`error: missing required argument '${s}'`;this.error(p,{code:"commander.missingArgument"})}optionMissingArgument(s){const p=`error: option '${s.flags}' argument missing`;this.error(p,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(s){const p=`error: required option '${s.flags}' not specified`;this.error(p,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(s,p){const j=se=>{const De=se.attributeName(),ie=this.getOptionValue(De),pe=this.options.find(fe=>fe.negate&&De===fe.attributeName()),me=this.options.find(fe=>!fe.negate&&De===fe.attributeName());return pe&&(pe.presetArg===void 0&&ie===!1||pe.presetArg!==void 0&&ie===pe.presetArg)?pe:me||se},M=se=>{const De=j(se),ie=De.attributeName();return this.getOptionValueSource(ie)==="env"?`environment variable '${De.envVar}'`:`option '${De.flags}'`},Z=`error: ${M(s)} cannot be used with ${M(p)}`;this.error(Z,{code:"commander.conflictingOption"})}unknownOption(s){if(this._allowUnknownOption)return;let p="";if(s.startsWith("--")&&this._showSuggestionAfterError){let M=[],Z=this;do{const se=Z.createHelp().visibleOptions(Z).filter(De=>De.long).map(De=>De.long);M=M.concat(se),Z=Z.parent}while(Z&&!Z._enablePositionalOptions);p=ne(s,M)}const j=`error: unknown option '${s}'${p}`;this.error(j,{code:"commander.unknownOption"})}_excessArguments(s){if(this._allowExcessArguments)return;const p=this.registeredArguments.length,j=p===1?"":"s",Z=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${p} argument${j} but got ${s.length}.`;this.error(Z,{code:"commander.excessArguments"})}unknownCommand(){const s=this.args[0];let p="";if(this._showSuggestionAfterError){const M=[];this.createHelp().visibleCommands(this).forEach(Z=>{M.push(Z.name()),Z.alias()&&M.push(Z.alias())}),p=ne(s,M)}const j=`error: unknown command '${s}'${p}`;this.error(j,{code:"commander.unknownCommand"})}version(s,p,j){if(s===void 0)return this._version;this._version=s,p=p||"-V, --version",j=j||"output the version number";const M=this.createOption(p,j);return this._versionOptionName=M.attributeName(),this._registerOption(M),this.on("option:"+M.name(),()=>{this._outputConfiguration.writeOut(`${s} `),this._exit(0,"commander.version",s)}),this}description(s,p){return s===void 0&&p===void 0?this._description:(this._description=s,p&&(this._argsDescription=p),this)}summary(s){return s===void 0?this._summary:(this._summary=s,this)}alias(s){if(s===void 0)return this._aliases[0];let p=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(p=this.commands[this.commands.length-1]),s===p._name)throw new Error("Command alias can't be the same as its name");const j=this.parent?._findCommand(s);if(j){const M=[j.name()].concat(j.aliases()).join("|");throw new Error(`cannot add alias '${s}' to command '${this.name()}' as already have command '${M}'`)}return p._aliases.push(s),this}aliases(s){return s===void 0?this._aliases:(s.forEach(p=>this.alias(p)),this)}usage(s){if(s===void 0){if(this._usage)return this._usage;const p=this.registeredArguments.map(j=>t(j));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?p:[]).join(" ")}return this._usage=s,this}name(s){return s===void 0?this._name:(this._name=s,this)}nameFromFilename(s){return this._name=E.basename(s,E.extname(s)),this}executableDir(s){return s===void 0?this._executableDir:(this._executableDir=s,this)}helpInformation(s){const p=this.createHelp(),j=this._getOutputContext(s);p.prepareContext({error:j.error,helpWidth:j.helpWidth,outputHasColors:j.hasColors});const M=p.formatHelp(this,p);return j.hasColors?M:this._outputConfiguration.stripColor(M)}_getOutputContext(s){s=s||{};const p=!!s.error;let j,M,Z;return p?(j=De=>this._outputConfiguration.writeErr(De),M=this._outputConfiguration.getErrHasColors(),Z=this._outputConfiguration.getErrHelpWidth()):(j=De=>this._outputConfiguration.writeOut(De),M=this._outputConfiguration.getOutHasColors(),Z=this._outputConfiguration.getOutHelpWidth()),{error:p,write:De=>(M||(De=this._outputConfiguration.stripColor(De)),j(De)),hasColors:M,helpWidth:Z}}outputHelp(s){let p;typeof s=="function"&&(p=s,s=void 0);const j=this._getOutputContext(s),M={error:j.error,write:j.write,command:this};this._getCommandAndAncestors().reverse().forEach(se=>se.emit("beforeAllHelp",M)),this.emit("beforeHelp",M);let Z=this.helpInformation({error:j.error});if(p&&(Z=p(Z),typeof Z!="string"&&!Buffer.isBuffer(Z)))throw new Error("outputHelp callback must return a string or a Buffer");j.write(Z),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",M),this._getCommandAndAncestors().forEach(se=>se.emit("afterAllHelp",M))}helpOption(s,p){return typeof s=="boolean"?(s?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(s=s??"-h, --help",p=p??"display help for command",this._helpOption=this.createOption(s,p),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(s){return this._helpOption=s,this}help(s){this.outputHelp(s);let p=Number(i.exitCode??0);p===0&&s&&typeof s!="function"&&s.error&&(p=1),this._exit(p,"commander.help","(outputHelp)")}addHelpText(s,p){const j=["beforeAll","before","after","afterAll"];if(!j.includes(s))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${j.join("', '")}'`);const M=`${s}Help`;return this.on(M,Z=>{let se;typeof p=="function"?se=p({error:Z.error,command:Z.command}):se=p,se&&Z.write(`${se} `)}),this}_outputHelpIfRequested(s){const p=this._getHelpOption();p&&s.find(M=>p.is(M))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function ae(Fe){return Fe.map(s=>{if(!s.startsWith("--inspect"))return s;let p,j="127.0.0.1",M="9229",Z;return(Z=s.match(/^(--inspect(-brk)?)$/))!==null?p=Z[1]:(Z=s.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(p=Z[1],/^\d+$/.test(Z[3])?M=Z[3]:j=Z[3]):(Z=s.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(p=Z[1],j=Z[3],M=Z[4]),p&&M!=="0"?`${p}=${j}:${parseInt(M)+1}`:s})}function de(){if(i.env.NO_COLOR||i.env.FORCE_COLOR==="0"||i.env.FORCE_COLOR==="false")return!1;if(i.env.FORCE_COLOR||i.env.CLICOLOR_FORCE!==void 0)return!0}return command.Command=oe,command.useColor=de,command}var hasRequiredCommander;function requireCommander(){if(hasRequiredCommander)return commander$1;hasRequiredCommander=1;const{Argument:l}=requireArgument(),{Command:a}=requireCommand(),{CommanderError:E,InvalidArgumentError:$}=requireError(),{Help:i}=requireHelp(),{Option:n}=requireOption();return commander$1.program=new a,commander$1.createCommand=t=>new a(t),commander$1.createOption=(t,F)=>new n(t,F),commander$1.createArgument=(t,F)=>new l(t,F),commander$1.Command=a,commander$1.Option=n,commander$1.Argument=l,commander$1.Help=i,commander$1.CommanderError=E,commander$1.InvalidArgumentError=$,commander$1.InvalidOptionArgumentError=$,commander$1}var commanderExports=requireCommander();const commander=getDefaultExportFromCjs(commanderExports),{program,createCommand,createArgument,createOption,CommanderError,InvalidArgumentError,InvalidOptionArgumentError,Command,Argument,Option,Help}=commander;var src,hasRequiredSrc;function requireSrc(){if(hasRequiredSrc)return src;hasRequiredSrc=1;const l="\x1B",a=`${l}[`,E="\x07",$={to(t,F){return F?`${a}${F+1};${t+1}H`:`${a}${t+1}G`},move(t,F){let H="";return t<0?H+=`${a}${-t}D`:t>0&&(H+=`${a}${t}C`),F<0?H+=`${a}${-F}A`:F>0&&(H+=`${a}${F}B`),H},up:(t=1)=>`${a}${t}A`,down:(t=1)=>`${a}${t}B`,forward:(t=1)=>`${a}${t}C`,backward:(t=1)=>`${a}${t}D`,nextLine:(t=1)=>`${a}E`.repeat(t),prevLine:(t=1)=>`${a}F`.repeat(t),left:`${a}G`,hide:`${a}?25l`,show:`${a}?25h`,save:`${l}7`,restore:`${l}8`},i={up:(t=1)=>`${a}S`.repeat(t),down:(t=1)=>`${a}T`.repeat(t)},n={screen:`${a}2J`,up:(t=1)=>`${a}1J`.repeat(t),down:(t=1)=>`${a}J`.repeat(t),line:`${a}2K`,lineEnd:`${a}K`,lineStart:`${a}1K`,lines(t){let F="";for(let H=0;H<t;H++)F+=this.line+(H<t-1?$.up():"");return t&&(F+=$.left),F}};return src={cursor:$,scroll:i,erase:n,beep:E},src}var srcExports=requireSrc();function J({onlyFirst:l=!1}={}){const a=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(a,l?void 0:"g")}const Q=J();function T(l){if(typeof l!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof l}\``);return l.replace(Q,"")}function O(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var P$1={exports:{}};(function(l){var a={};l.exports=a,a.eastAsianWidth=function($){var i=$.charCodeAt(0),n=$.length==2?$.charCodeAt(1):0,t=i;return 55296<=i&&i<=56319&&56320<=n&&n<=57343&&(i&=1023,n&=1023,t=i<<10|n,t+=65536),t==12288||65281<=t&&t<=65376||65504<=t&&t<=65510?"F":t==8361||65377<=t&&t<=65470||65474<=t&&t<=65479||65482<=t&&t<=65487||65490<=t&&t<=65495||65498<=t&&t<=65500||65512<=t&&t<=65518?"H":4352<=t&&t<=4447||4515<=t&&t<=4519||4602<=t&&t<=4607||9001<=t&&t<=9002||11904<=t&&t<=11929||11931<=t&&t<=12019||12032<=t&&t<=12245||12272<=t&&t<=12283||12289<=t&&t<=12350||12353<=t&&t<=12438||12441<=t&&t<=12543||12549<=t&&t<=12589||12593<=t&&t<=12686||12688<=t&&t<=12730||12736<=t&&t<=12771||12784<=t&&t<=12830||12832<=t&&t<=12871||12880<=t&&t<=13054||13056<=t&&t<=19903||19968<=t&&t<=42124||42128<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||55216<=t&&t<=55238||55243<=t&&t<=55291||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65106||65108<=t&&t<=65126||65128<=t&&t<=65131||110592<=t&&t<=110593||127488<=t&&t<=127490||127504<=t&&t<=127546||127552<=t&&t<=127560||127568<=t&&t<=127569||131072<=t&&t<=194367||177984<=t&&t<=196605||196608<=t&&t<=262141?"W":32<=t&&t<=126||162<=t&&t<=163||165<=t&&t<=166||t==172||t==175||10214<=t&&t<=10221||10629<=t&&t<=10630?"Na":t==161||t==164||167<=t&&t<=168||t==170||173<=t&&t<=174||176<=t&&t<=180||182<=t&&t<=186||188<=t&&t<=191||t==198||t==208||215<=t&&t<=216||222<=t&&t<=225||t==230||232<=t&&t<=234||236<=t&&t<=237||t==240||242<=t&&t<=243||247<=t&&t<=250||t==252||t==254||t==257||t==273||t==275||t==283||294<=t&&t<=295||t==299||305<=t&&t<=307||t==312||319<=t&&t<=322||t==324||328<=t&&t<=331||t==333||338<=t&&t<=339||358<=t&&t<=359||t==363||t==462||t==464||t==466||t==468||t==470||t==472||t==474||t==476||t==593||t==609||t==708||t==711||713<=t&&t<=715||t==717||t==720||728<=t&&t<=731||t==733||t==735||768<=t&&t<=879||913<=t&&t<=929||931<=t&&t<=937||945<=t&&t<=961||963<=t&&t<=969||t==1025||1040<=t&&t<=1103||t==1105||t==8208||8211<=t&&t<=8214||8216<=t&&t<=8217||8220<=t&&t<=8221||8224<=t&&t<=8226||8228<=t&&t<=8231||t==8240||8242<=t&&t<=8243||t==8245||t==8251||t==8254||t==8308||t==8319||8321<=t&&t<=8324||t==8364||t==8451||t==8453||t==8457||t==8467||t==8470||8481<=t&&t<=8482||t==8486||t==8491||8531<=t&&t<=8532||8539<=t&&t<=8542||8544<=t&&t<=8555||8560<=t&&t<=8569||t==8585||8592<=t&&t<=8601||8632<=t&&t<=8633||t==8658||t==8660||t==8679||t==8704||8706<=t&&t<=8707||8711<=t&&t<=8712||t==8715||t==8719||t==8721||t==8725||t==8730||8733<=t&&t<=8736||t==8739||t==8741||8743<=t&&t<=8748||t==8750||8756<=t&&t<=8759||8764<=t&&t<=8765||t==8776||t==8780||t==8786||8800<=t&&t<=8801||8804<=t&&t<=8807||8810<=t&&t<=8811||8814<=t&&t<=8815||8834<=t&&t<=8835||8838<=t&&t<=8839||t==8853||t==8857||t==8869||t==8895||t==8978||9312<=t&&t<=9449||9451<=t&&t<=9547||9552<=t&&t<=9587||9600<=t&&t<=9615||9618<=t&&t<=9621||9632<=t&&t<=9633||9635<=t&&t<=9641||9650<=t&&t<=9651||9654<=t&&t<=9655||9660<=t&&t<=9661||9664<=t&&t<=9665||9670<=t&&t<=9672||t==9675||9678<=t&&t<=9681||9698<=t&&t<=9701||t==9711||9733<=t&&t<=9734||t==9737||9742<=t&&t<=9743||9748<=t&&t<=9749||t==9756||t==9758||t==9792||t==9794||9824<=t&&t<=9825||9827<=t&&t<=9829||9831<=t&&t<=9834||9836<=t&&t<=9837||t==9839||9886<=t&&t<=9887||9918<=t&&t<=9919||9924<=t&&t<=9933||9935<=t&&t<=9953||t==9955||9960<=t&&t<=9983||t==10045||t==10071||10102<=t&&t<=10111||11093<=t&&t<=11097||12872<=t&&t<=12879||57344<=t&&t<=63743||65024<=t&&t<=65039||t==65533||127232<=t&&t<=127242||127248<=t&&t<=127277||127280<=t&&t<=127337||127344<=t&&t<=127386||917760<=t&&t<=917999||983040<=t&&t<=1048573||1048576<=t&&t<=1114109?"A":"N"},a.characterLength=function($){var i=this.eastAsianWidth($);return i=="F"||i=="W"||i=="A"?2:1};function E($){return $.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}a.length=function($){for(var i=E($),n=0,t=0;t<i.length;t++)n=n+this.characterLength(i[t]);return n},a.slice=function($,i,n){textLen=a.length($),i=i||0,n=n||1,i<0&&(i=textLen+i),n<0&&(n=textLen+n);for(var t="",F=0,H=E($),ee=0;ee<H.length;ee++){var te=H[ee],re=a.length(te);if(F>=i-(re==2?1:0))if(F+re<=n)t+=te;else break;F+=re}return t}})(P$1);var X=P$1.exports;const DD=O(X);var uD=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFF