(Didyoumean${r[0]}?)`:""}vt.suggestSimilar=Vs});var wt=_(Ft=>{var Ks=require("events").EventEmitter,Me=require("child_process"),G=require("path"),Le=require("fs"),{Argument:$s,humanReadableArgName:Gs}=fe(),{CommanderError:Xe}=te(),{Help:Ws}=_e(),{Option:qs,splitOptionFlags:Ys}=Oe(),{suggestSimilar:At}=Ct(),ie=class extends Ks{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!1,this._outputConfiguration={writeOut:s=>process.stdout.write(s),writeErr:s=>process.stderr.write(s),getOutHelpWidth:()=>process.stdout.isTTY?process.stdout.columns:void 0,getErrHelpWidth:()=>process.stderr.isTTY?process.stderr.columns:void 0,outputError:(s,r)=>r(s)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}command(e,s,r){let u=s,l=r;typeof u=="object"&&u!==null&&(l=u,u=null),l=l||{};let[,o,D]=e.match(/([^ ]+) *(.*)/),m=this.createCommand(o);return u&&(m.description(u),m._executableHandler=!0),l.isDefault&&(this._defaultCommandName=m._name),m._hidden=!!(l.noHelp||l.hidden),m._executableFile=l.executableFile||null,D&&m.arguments(D),this.commands.push(m),m.parent=this,m.copyInheritedSettings(this),u?this:m}createCommand(e){return new ie(e)}createHelp(){return Object.assign(new Ws,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,s){if(!e._name)throw new Error("Command passed to .addCommand() must have a name");function r(u){u.forEach(l=>{if(l._executableHandler&&!l._executableFile)throw new Error(`MustspecifyexecutableFilefordeeplynestedexecutable:${l.name()}`);r(l.commands)})}return r(e.commands),s=s||{},s.isDefault&&(this._defaultCommandName=e._name),(s.noHelp||s.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,s){return new $s(e,s)}argument(e,s,r,u){let l=this.createArgument(e,s);return typeof r=="function"?l.default(u).argParser(r):l.default(r),this.addArgument(l),this}arguments(e){return e.split(/ +/).forEach(s=>{this.argument(s)}),this}addArgument(e){let s=this._args.slice(-1)[0
Expectingoneof'${r.join("','")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(s):this._lifeCycleHooks[e]=[s],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=s=>{if(s.code!=="commander.executeSubCommandAsync")throw s},this}_exit(e,s,r){this._exitCallback&&this._exitCallback(new Xe(e,s,r)),process.exit(e)}action(e){let s=r=>{let u=this._args.length,l=r.slice(0,u);return this._storeOptionsAsProperties?l[u]=this:l[u]=this.opts(),l.push(this),e.apply(this,l)};return this._actionHandler=s,this}createOption(e,s){return new qs(e,s)}addOption(e){let s=e.name(),r=e.attributeName(),u=e.defaultValue;if(e.negate||e.optional||e.required||typeof u=="boolean"){if(e.negate){let o=e.long.replace(/^--no-/,"--");u=this._findOption(o)?this.getOptionValue(r):!0}u!==void 0&&this.setOptionValueWithSource(r,u,"default")}this.options.push(e);let l=(o,D,m)=>{let f=this.getOptionValue(r);if(o!==null&&e.parseArg)try{o=e.parseArg(o,f===void 0?u:f)}catch(p){if(p.code==="commander.invalidArgument"){let d=`${D}${p.message}`;this._displayError(p.exitCode,p.code,d)}throw p}else o!==null&&e.variadic&&(o=e._concatValue(o,f));typeof f=="boolean"||typeof f>"u"?o==null?this.setOptionValueWithSource(r,e.negate?!1:u||!0,m):this.setOptionValueWithSource(r,o,m):o!==null&&this.setOptionValueWithSource(r,e.negate?!1:o,m)};return this.on("option:"+s,o=>{let D=`error:option'${e.flags}'argument'${o}'isinvalid.`;l(o,D,"cli")}),e.envVar&&this.on("optionEnv:"+s,o=>{let D=`error:option'${e.flags}'value'${o}'fromenv'${e.envVar}'isinvalid.`;l(o,D,"env")}),this}_optionEx(e,s,r,u,l){let o=this.createOption(s,r);if(o.makeOptionMandatory(!!e.mandatory),typeof u=="function")o.default(l).argParser(u);else if(u instanceof RegExp){let D=u;u=(m,f)=>{let p=D.exec(m);return p?p[0]:f},o.default(l).argParser(u)}else o.default(u);return this.addOption(o)}option(e,s,r,u){return this._optionEx({},e,s,r,u)}requiredOption(e,s,r,u){return this._optionEx({mandatory:!0},e,s,r,u)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){if(this._passThroughOptions=!!e,this.parent&&e&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(e=!0){if(this._storeOptionsAsProperties=!!e,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,s){return this._storeOptionsAsProperties?this[e]=s:this._optionValues[e]=s,this}setOptionValueWithSource(e,s,r){return this.setOptionValue(e,s),this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}_prepareUserArgs(e,s){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");s=s||{},e===void 0&&(e=process.argv,process.versions&&process.versions.electron&&(s.from="electron")),this.rawArgs=e.slice();let r;switch(s.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":process.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;default:throw new Error(`unexpectedparseoption{from:'${s.from}'}`)}return!this._scriptPath&&require.main&&(this._scriptPath=require.main.filename),this._name=this._name||this._scriptPath&&G.basename(this._scriptPath,G.extname(this._scriptPath)),r}parse(e,s){let r=this._prepareUserArgs(e,s);return this._parseCommand([],r),this}async parseAsync(e,s){let r=this._prepareUserArgs(e,s);return await this._parseCommand([],r),this}_executeSubCommand(e,s){s=s.slice();let r=!1,u=[".js",".ts",".tsx",".mjs",".cjs"];this._checkForMissingMandatoryOptions();let l=this._scriptPath;!l&&require
`),this.outputHelp({error:!0})),this._exit(e,s,r)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in process.env){let s=e.attributeName();(this.getOptionValue(s)===void 0||["default","config","env"].includes(this.getOptionValueSource(s)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,process.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}missingArgument(e){let s=`error:missingrequiredargument'${e}'`;this._displayError(1,"commander.missingArgument",s)}optionMissingArgument(e){let s=`error:option'${e.flags}'argumentmissing`;this._displayError(1,"commander.optionMissingArgument",s)}missingMandatoryOptionValue(e){let s=`error:requiredoption'${e.flags}'notspecified`;this._displayError(1,"commander.missingMandatoryOptionValue",s)}unknownOption(e){if(this._allowUnknownOption)return;let s="";if(e.startsWith("--")&&this._showSuggestionAfterError){let u=[],l=this;do{let o=l.createHelp().visibleOptions(l).filter(D=>D.long).map(D=>D.long);u=u.concat(o),l=l.parent}while(l&&!l._enablePositionalOptions);s=At(e,u)}let r=`error:unknownoption'${e}'${s}`;this._displayError(1,"commander.unknownOption",r)}_excessArguments(e){if(this._allowExcessArguments)return;let s=this._args.length,r=s===1?"":"s",l=`error:toomanyarguments${this.parent?` for '${this.name()}'`:""}.Expected${s}argument${r}butgot${e.length}.`;this._displayError(1,"commander.excessArguments",l)}unknownCommand(){let e=this.args[0],s="";if(this._showSuggestionAfterError){let u=[];this.createHelp().visibleCommands(this).forEach(l=>{u.push(l.name()),l.alias()&&u.push(l.alias())}),s=At(e,u)}let r=`error:unknowncommand'${e}'${s}`;this._displayError(1,"commander.unknownCommand",r)}version(e,s,r){if(e===void 0)return this._version;this._version=e,s=s||"-V, --version",r=r||"output the version number";let u=this.createOption(s,r);return this._versionOptionName=u.attributeName(),this.options.push(u),this.on("option:"+u.name(),()=>{this._outputConfiguration.writeOut(`${e}
`),this._exit(0,"commander.version",e)}),this}description(e,s){return e===void 0&&s===void 0?this._description:(this._description=e,s&&(this._argsDescription=s),this)}alias(e){if(e===void 0)return this._aliases[0];let s=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(s=this.commands[this.commands.length-1]),e===s._name)throw new Error("Command alias can't be the same as its name");return s._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(s=>this.alias(s)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let s=this._args.map(r=>Gs(r));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?s:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpInformation(e){let s=this.createHelp();return s.helpWidth===void 0&&(s.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),s.formatHelp(this,s)}_getHelpContext(e){e=e||{};let s={error:!!e.error},r;return s.error?r=u=>this._outputConfiguration.writeErr(u):r=u=>this._outputConfiguration.writeOut(u),s.write=e.write||r,s.command=this,s}outputHelp(e){let s;typeof e=="function"&&(s=e,e=void 0);let r=this._getHelpContext(e);Re(this).reverse().forEach(l=>l.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let u=this.helpInformation(r);if(s&&(u=s(u),typeof u!="string"&&!Buffer.isBuffer(u)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(u),this.emit(this._helpLongFlag),this.emit("afterHelp",r),Re(this).forEach(l=>l.emit("afterAllHelp",r))}helpOption(e,s){if(typeof e=="boolean")return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=s||this._helpDescription;let r=Ys(this._helpFlags);return this._helpShortFlag=r.shortFlag,this._helpLongFlag=r.longFlag,this}help(e){this.outputHelp(e);let s=process.exitCode||0;s===0&&e&&typeof e!="function"&&e.error&&(s=1),this._exit(s,"commander.help","(outputHelp)")}addHelpText(e,s){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`UnexpectedvalueforpositiontoaddHelpText.