appbir
Version:
常用脚手架库 -【app-lib-cli】
3 lines • 71.5 kB
JavaScript
/*! For license information please see cli-bundle-min.js.LICENSE.txt */
(()=>{var e={491:(e,t,r)=>{const{Argument:n}=r(811),{Command:i}=r(527),{CommanderError:o,InvalidArgumentError:s}=r(831),{Help:a}=r(437),{Option:l}=r(311);(t=e.exports=new i).program=t,t.Argument=n,t.Command=i,t.CommanderError=o,t.Help=a,t.InvalidArgumentError=s,t.InvalidOptionArgumentError=s,t.Option=l},811:(e,t,r)=>{const{InvalidArgumentError:n}=r(831);t.Argument=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.length>3&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},t.humanReadableArgName=function(e){const t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"}},527:(e,t,r)=>{const n=r(239).EventEmitter,i=r(303),o=r(423),s=r(231),a=r(369),{Argument:l,humanReadableArgName:c}=r(811),{CommanderError:u}=r(831),{Help:h}=r(437),{Option:p,splitOptionFlags:d,DualOptions:m}=r(311),{suggestSimilar:g}=r(426);class f extends n{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._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._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,outputError:(e,t)=>t(e)},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,t,r){let n=t,i=r;"object"==typeof n&&null!==n&&(i=n,n=null),i=i||{};const[,o,s]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(o);return n&&(a.description(n),a._executableHandler=!0),i.isDefault&&(this._defaultCommandName=a._name),a._hidden=!(!i.noHelp&&!i.hidden),a._executableFile=i.executableFile||null,s&&a.arguments(s),this.commands.push(a),a.parent=this,a.copyInheritedSettings(this),n?this:a}createCommand(e){return new f(e)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()");return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,t){return new l(e,t)}argument(e,t,r,n){const i=this.createArgument(e,t);return"function"==typeof r?i.default(n).argParser(r):i.default(r),this.addArgument(i),this}arguments(e){return e.split(/ +/).forEach((e=>{this.argument(e)})),this}addArgument(e){const t=this._args.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this._args.push(e),this}addHelpCommand(e,t){return!1===e?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,"string"==typeof e&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=t||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return void 0===this._addImplicitHelpCommand?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(e,t){const r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if("commander.executeSubCommandAsync"!==e.code)throw e}),this}_exit(e,t,r){this._exitCallback&&this._exitCallback(new u(e,t,r)),a.exit(e)}action(e){return this._actionHandler=t=>{const r=this._args.length,n=t.slice(0,r);return this._storeOptionsAsProperties?n[r]=this:n[r]=this.opts(),n.push(this),e.apply(this,n)},this}createOption(e,t){return new p(e,t)}addOption(e){const t=e.name(),r=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(r,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(r,e.defaultValue,"default");this.options.push(e);const n=(t,n,i)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);const o=this.getOptionValue(r);if(null!==t&&e.parseArg)try{t=e.parseArg(t,o)}catch(e){if("commander.invalidArgument"===e.code){const t=`${n} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}else null!==t&&e.variadic&&(t=e._concatValue(t,o));null==t&&(t=!e.negate&&(!(!e.isBoolean()&&!e.optional)||"")),this.setOptionValueWithSource(r,t,i)};return this.on("option:"+t,(t=>{const r=`error: option '${e.flags}' argument '${t}' is invalid.`;n(t,r,"cli")})),e.envVar&&this.on("optionEnv:"+t,(t=>{const r=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;n(t,r,"env")})),this}_optionEx(e,t,r,n,i){if("object"==typeof t&&t instanceof p)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const o=this.createOption(t,r);if(o.makeOptionMandatory(!!e.mandatory),"function"==typeof n)o.default(i).argParser(n);else if(n instanceof RegExp){const e=n;n=(t,r)=>{const n=e.exec(t);return n?n[0]:r},o.default(i).argParser(n)}else o.default(n);return this.addOption(o)}option(e,t,r,n){return this._optionEx({},e,t,r,n)}requiredOption(e,t,r,n){return this._optionEx({mandatory:!0},e,t,r,n)}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,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return v(this).forEach((r=>{void 0!==r.getOptionValueSource(e)&&(t=r.getOptionValueSource(e))})),t}_prepareUserArgs(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");let r;switch(t=t||{},void 0===e&&(e=a.argv,a.versions&&a.versions.electron&&(t.from="electron")),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":a.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(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(e,t){const r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){const r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_executeSubCommand(e,t){t=t.slice();let r=!1;const n=[".js",".ts",".tsx",".mjs",".cjs"];function l(e,t){const r=o.resolve(e,t);if(s.existsSync(r))return r;if(n.includes(o.extname(t)))return;const i=n.find((e=>s.existsSync(`${r}${e}`)));return i?`${r}${i}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let c,h=e._executableFile||`${this._name}-${e._name}`,p=this._executableDir||"";if(this._scriptPath){let e;try{e=s.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}p=o.resolve(o.dirname(e),p)}if(p){let t=l(p,h);if(!t&&!e._executableFile&&this._scriptPath){const r=o.basename(this._scriptPath,o.extname(this._scriptPath));r!==this._name&&(t=l(p,`${r}-${e._name}`))}h=t||h}r=n.includes(o.extname(h)),"win32"!==a.platform?r?(t.unshift(h),t=_(a.execArgv).concat(t),c=i.spawn(a.argv[0],t,{stdio:"inherit"})):c=i.spawn(h,t,{stdio:"inherit"}):(t.unshift(h),t=_(a.execArgv).concat(t),c=i.spawn(a.execPath,t,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((e=>{a.on(e,(()=>{!1===c.killed&&null===c.exitCode&&c.kill(e)}))}));const d=this._exitCallback;d?c.on("close",(()=>{d(new u(a.exitCode||0,"commander.executeSubCommandAsync","(close)"))})):c.on("close",a.exit.bind(a)),c.on("error",(t=>{if("ENOENT"===t.code){const t=p?`searched for local subcommand relative to directory '${p}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",r=`'${h}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(r)}if("EACCES"===t.code)throw new Error(`'${h}' not executable`);if(d){const e=new u(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,d(e)}else a.exit(1)})),this.runningCommand=c}_dispatchSubcommand(e,t,r){const n=this._findCommand(e);let i;return n||this.help({error:!0}),i=this._chainOrCallSubCommandHook(i,n,"preSubcommand"),i=this._chainOrCall(i,(()=>{if(!n._executableHandler)return n._parseCommand(t,r);this._executeSubCommand(n,t.concat(r))})),i}_checkNumberOfArguments(){this._args.forEach(((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())})),this._args.length>0&&this._args[this._args.length-1].variadic||this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){const e=(e,t,r)=>{let n=t;if(null!==t&&e.parseArg)try{n=e.parseArg(t,r)}catch(r){if("commander.invalidArgument"===r.code){const n=`error: command-argument value '${t}' is invalid for argument '${e.name()}'. ${r.message}`;this.error(n,{exitCode:r.exitCode,code:r.code})}throw r}return n};this._checkNumberOfArguments();const t=[];this._args.forEach(((r,n)=>{let i=r.defaultValue;r.variadic?n<this.args.length?(i=this.args.slice(n),r.parseArg&&(i=i.reduce(((t,n)=>e(r,n,t)),r.defaultValue))):void 0===i&&(i=[]):n<this.args.length&&(i=this.args[n],r.parseArg&&(i=e(r,i,r.defaultValue))),t[n]=i})),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then((()=>t())):t()}_chainOrCallHooks(e,t){let r=e;const n=[];return v(this).reverse().filter((e=>void 0!==e._lifeCycleHooks[t])).forEach((e=>{e._lifeCycleHooks[t].forEach((t=>{n.push({hookedCommand:e,callback:t})}))})),"postAction"===t&&n.reverse(),n.forEach((e=>{r=this._chainOrCall(r,(()=>e.callback(e.hookedCommand,this)))})),r}_chainOrCallSubCommandHook(e,t,r){let n=e;return void 0!==this._lifeCycleHooks[r]&&this._lifeCycleHooks[r].forEach((e=>{n=this._chainOrCall(n,(()=>e(this,t)))})),n}_parseCommand(e,t){const r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return 1===e.length&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return b(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),b(this,r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const n=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){let r;return n(),this._processArguments(),r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,(()=>this._actionHandler(this.processedArgs))),this.parent&&(r=this._chainOrCall(r,(()=>{this.parent.emit(i,e,t)}))),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent&&this.parent.listenerCount(i))n(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find((t=>t._name===e||t._aliases.includes(e)))}_findOption(e){return this.options.find((t=>t.is(e)))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent)e.options.forEach((t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)}))}_checkForConflictingLocalOptions(){const e=this.options.filter((e=>{const t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)}));e.filter((e=>e.conflictsWith.length>0)).forEach((t=>{const r=e.find((e=>t.conflictsWith.includes(e.attributeName())));r&&this._conflictingOption(t,r)}))}_checkForConflictingOptions(){for(let e=this;e;e=e.parent)e._checkForConflictingLocalOptions()}parseOptions(e){const t=[],r=[];let n=t;const i=e.slice();function o(e){return e.length>1&&"-"===e[0]}let s=null;for(;i.length;){const e=i.shift();if("--"===e){n===r&&n.push(e),n.push(...i);break}if(!s||o(e)){if(s=null,o(e)){const t=this._findOption(e);if(t){if(t.required){const e=i.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;i.length>0&&!o(i[0])&&(e=i.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);s=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){const t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),i.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("="),r=this._findOption(e.slice(0,t));if(r&&(r.required||r.optional)){this.emit(`option:${r.name()}`,e.slice(t+1));continue}}if(o(e)&&(n=r),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===r.length){if(this._findCommand(e)){t.push(e),i.length>0&&r.push(...i);break}if(e===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(e),i.length>0&&t.push(...i);break}if(this._defaultCommandName){r.push(e),i.length>0&&r.push(...i);break}}if(this._passThroughOptions){n.push(e),i.length>0&&n.push(...i);break}n.push(e)}else this.emit(`option:${s.name()}`,e)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){const e={},t=this.options.length;for(let r=0;r<t;r++){const t=this.options[r].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return v(this).reduce(((e,t)=>Object.assign(e,t.opts())),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const r=t||{},n=r.exitCode||1,i=r.code||"commander.error";this._exit(n,i,e)}_parseOptionsEnv(){this.options.forEach((e=>{if(e.envVar&&e.envVar in a.env){const t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}}))}_parseOptionsImplied(){const e=new m(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter((r=>void 0!==r.implied&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r))).forEach((e=>{Object.keys(e.implied).filter((e=>!t(e))).forEach((t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")}))}))}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const r=e=>{const t=e.attributeName(),r=this.getOptionValue(t),n=this.options.find((e=>e.negate&&t===e.attributeName())),i=this.options.find((e=>!e.negate&&t===e.attributeName()));return n&&(void 0===n.presetArg&&!1===r||void 0!==n.presetArg&&r===n.presetArg)?n:i||e},n=e=>{const t=r(e),n=t.attributeName();return"env"===this.getOptionValueSource(n)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],n=this;do{const e=n.createHelp().visibleOptions(n).filter((e=>e.long)).map((e=>e.long));r=r.concat(e),n=n.parent}while(n&&!n._enablePositionalOptions);t=g(e,r)}const r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this._args.length,r=1===t?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const r=[];this.createHelp().visibleCommands(this).forEach((e=>{r.push(e.name()),e.alias()&&r.push(e.alias())})),t=g(e,r)}const r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";const n=this.createOption(t,r);return this._versionOptionName=n.attributeName(),this.options.push(n),this.on("option:"+n.name(),(()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,"commander.version",e)})),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach((e=>this.alias(e))),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;const e=this._args.map((e=>c(e)));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=o.basename(e,o.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){const t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){const t={error:!!(e=e||{}).error};let r;return r=t.error?e=>this._outputConfiguration.writeErr(e):e=>this._outputConfiguration.writeOut(e),t.write=e.write||r,t.command=this,t}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);const r=this._getHelpContext(e);v(this).reverse().forEach((e=>e.emit("beforeAllHelp",r))),this.emit("beforeHelp",r);let n=this.helpInformation(r);if(t&&(n=t(n),"string"!=typeof n&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(n),this.emit(this._helpLongFlag),this.emit("afterHelp",r),v(this).forEach((e=>e.emit("afterAllHelp",r)))}helpOption(e,t){if("boolean"==typeof e)return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription;const r=d(this._helpFlags);return this._helpShortFlag=r.shortFlag,this._helpLongFlag=r.longFlag,this}help(e){this.outputHelp(e);let t=a.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${r.join("', '")}'`);const n=`${e}Help`;return this.on(n,(e=>{let r;r="function"==typeof t?t({error:e.error,command:e.command}):t,r&&e.write(`${r}\n`)})),this}}function b(e,t){e._hasHelpOption&&t.find((t=>t===e._helpLongFlag||t===e._helpShortFlag))&&(e.outputHelp(),e._exit(0,"commander.helpDisplayed","(outputHelp)"))}function _(e){return e.map((e=>{if(!e.startsWith("--inspect"))return e;let t,r,n="127.0.0.1",i="9229";return null!==(r=e.match(/^(--inspect(-brk)?)$/))?t=r[1]:null!==(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):null!==(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=r[1],n=r[3],i=r[4]),t&&"0"!==i?`${t}=${n}:${parseInt(i)+1}`:e}))}function v(e){const t=[];for(let r=e;r;r=r.parent)t.push(r);return t}t.Command=f},831:(e,t)=>{class r extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}t.CommanderError=r,t.InvalidArgumentError=class extends r{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}},437:(e,t,r)=>{const{humanReadableArgName:n}=r(811);t.Help=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){const t=e.commands.filter((e=>!e._hidden));if(e._hasImplicitHelpCommand()){const[,r,n]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),i=e.createCommand(r).helpOption(!1);i.description(e._helpCommandDescription),n&&i.arguments(n),t.push(i)}return this.sortSubcommands&&t.sort(((e,t)=>e.name().localeCompare(t.name()))),t}compareOptions(e,t){const r=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){const t=e.options.filter((e=>!e.hidden)),r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),n=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(r||n){let i;i=r?n?e.createOption(e._helpFlags,e._helpDescription):e.createOption(e._helpShortFlag,e._helpDescription):e.createOption(e._helpLongFlag,e._helpDescription),t.push(i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let r=e.parent;r;r=r.parent){const e=r.options.filter((e=>!e.hidden));t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e._args.forEach((t=>{t.description=t.description||e._argsDescription[t.name()]||""})),e._args.find((e=>e.description))?e._args:[]}subcommandTerm(e){const t=e._args.map((e=>n(e))).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce(((e,r)=>Math.max(e,t.subcommandTerm(r).length)),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce(((e,r)=>Math.max(e,t.argumentTerm(r).length)),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let t=e.parent;t;t=t.parent)r=t.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`),void 0!==e.defaultValue&&(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),void 0!==e.presetArg&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),void 0!==e.envVar&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`),void 0!==e.defaultValue&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){const r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatHelp(e,t){const r=t.padWidth(e,t),n=t.helpWidth||80;function i(e,i){if(i){const o=`${e.padEnd(r+2)}${i}`;return t.wrap(o,n-2,r+2)}return e}function o(e){return e.join("\n").replace(/^/gm," ".repeat(2))}let s=[`Usage: ${t.commandUsage(e)}`,""];const a=t.commandDescription(e);a.length>0&&(s=s.concat([t.wrap(a,n,0),""]));const l=t.visibleArguments(e).map((e=>i(t.argumentTerm(e),t.argumentDescription(e))));l.length>0&&(s=s.concat(["Arguments:",o(l),""]));const c=t.visibleOptions(e).map((e=>i(t.optionTerm(e),t.optionDescription(e))));if(c.length>0&&(s=s.concat(["Options:",o(c),""])),this.showGlobalOptions){const r=t.visibleGlobalOptions(e).map((e=>i(t.optionTerm(e),t.optionDescription(e))));r.length>0&&(s=s.concat(["Global Options:",o(r),""]))}const u=t.visibleCommands(e).map((e=>i(t.subcommandTerm(e),t.subcommandDescription(e))));return u.length>0&&(s=s.concat(["Commands:",o(u),""])),s.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,n=40){const i=new RegExp("[\\n][ \\f\\t\\v - \ufeff]+");if(e.match(i))return e;const o=t-r;if(o<n)return e;const s=e.slice(0,r),a=e.slice(r).replace("\r\n","\n"),l=" ".repeat(r),c="\\s",u=new RegExp(`\n|.{1,${o-1}}([${c}]|$)|[^${c}]+?([${c}]|$)`,"g");return s+(a.match(u)||[]).map(((e,t)=>"\n"===e?"":(t>0?l:"")+e.trimEnd())).join("\n")}}},311:(e,t,r)=>{const{InvalidArgumentError:n}=r(831);function i(e){let t,r;const n=e.split(/[ |,]+/);return n.length>1&&!/^[[<]/.test(n[1])&&(t=n.shift()),r=n.shift(),!t&&/^-[^-]$/.test(r)&&(t=r,r=void 0),{shortFlag:t,longFlag:r}}t.Option=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;const r=i(e);this.short=r.shortFlag,this.long=r.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(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){return this.implied=Object.assign(this.implied||{},e),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.name().replace(/^no-/,"").split("-").reduce(((e,t)=>e+t[0].toUpperCase()+t.slice(1)))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},t.splitOptionFlags=i,t.DualOptions=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach((e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)})),this.negativeOptions.forEach(((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)}))}valueFromOption(e,t){const r=t.attributeName();if(!this.dualOptions.has(r))return!0;const n=this.negativeOptions.get(r).presetArg,i=void 0!==n&&n;return t.negate===(i===e)}}},426:(e,t)=>{t.suggestSimilar=function(e,t){if(!t||0===t.length)return"";t=Array.from(new Set(t));const r=e.startsWith("--");r&&(e=e.slice(2),t=t.map((e=>e.slice(2))));let n=[],i=3;return t.forEach((t=>{if(t.length<=1)return;const r=function(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);const r=[];for(let t=0;t<=e.length;t++)r[t]=[t];for(let e=0;e<=t.length;e++)r[0][e]=e;for(let n=1;n<=t.length;n++)for(let i=1;i<=e.length;i++){let o=1;o=e[i-1]===t[n-1]?0:1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&e[i-1]===t[n-2]&&e[i-2]===t[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[e.length][t.length]}(e,t),o=Math.max(e.length,t.length);(o-r)/o>.4&&(r<i?(i=r,n=[t]):r===i&&n.push(t))})),n.sort(((e,t)=>e.localeCompare(t))),r&&(n=n.map((e=>`--${e}`))),n.length>1?`\n(Did you mean one of ${n.join(", ")}?)`:1===n.length?`\n(Did you mean ${n[0]}?)`:""}},708:function(e,t,r){var n;n=(e,t,r,n)=>(()=>{var i={"./src/cross-spawn/index.js":(e,t,r)=>{"use strict";const n=r("child_process"),i=r("./src/cross-spawn/lib/parse.js"),o=r("./src/cross-spawn/lib/enoent.js"),{log:s}=r("app-lib-log");function a(e,t,r){const s=i(e,t,r),a=n.spawn(s.command,s.args,s.options);return o.hookChildProcess(a,s),a}e.exports=a,e.exports.spawn=a,e.exports.sync=function(e,t,r){const a=i(e,t,r);s.md("exe node:",a.command,a.args,{...a.options,windowsHide:!0});const l=n.spawnSync(a.command,a.args,{...a.options});return l.error=l.error||o.verifyENOENTSync(l.status,a),l},e.exports._parse=i,e.exports._enoent=o},"./src/cross-spawn/lib/enoent.js":e=>{"use strict";const t="win32"===process.platform;function r(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function n(e,n){return t&&1===e&&!n.file?r(n.original,"spawn"):null}e.exports={hookChildProcess:function(e,r){if(!t)return;const i=e.emit;e.emit=function(t,o){if("exit"===t){const t=n(o,r);if(t)return i.call(e,"error",t)}return i.apply(e,arguments)}},verifyENOENT:n,verifyENOENTSync:function(e,n){return t&&1===e&&!n.file?r(n.original,"spawnSync"):null},notFoundError:r}},"./src/cross-spawn/lib/parse.js":(e,t,r)=>{"use strict";const n=r("path"),i=r("./src/cross-spawn/lib/util/resolveCommand.js"),o=r("./src/cross-spawn/lib/util/escape.js"),s=r("./src/cross-spawn/lib/util/readShebang.js"),a="win32"===process.platform,l=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;e.exports=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);const u={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?u:function(e){if(!a)return e;const t=function(e){e.file=i(e);const t=e.file&&s(e.file);return t?(e.args.unshift(e.file),e.command=t,i(e)):e.file}(e),r=!l.test(t);if(e.options.forceShell||r){const r=c.test(t);e.command=n.normalize(e.command),e.command=o.command(e.command),e.args=e.args.map((e=>o.argument(e,r)));const i=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${i}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}(u)}},"./src/cross-spawn/lib/util/escape.js":e=>{"use strict";const t=/([()\][%!^"`<>&|;, *?])/g;e.exports.command=function(e){return e.replace(t,"^$1")},e.exports.argument=function(e,r){return e=(e=`"${e=(e=(e=`${e}`).replace(/(\\*)"/g,'$1$1\\"')).replace(/(\\*)$/,"$1$1")}"`).replace(t,"^$1"),r&&(e=e.replace(t,"^$1")),e}},"./src/cross-spawn/lib/util/path-key/path-key.js":e=>{"use strict";const t=(e={})=>{const t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find((e=>"PATH"===e.toUpperCase()))||"Path"};e.exports=t,e.exports.default=t},"./src/cross-spawn/lib/util/readShebang.js":(e,t,r)=>{"use strict";const n=r("fs"),i=r("./src/cross-spawn/lib/util/shebang-command/shebang-command.js");e.exports=function(e){const t=Buffer.alloc(150);let r;try{r=n.openSync(e,"r"),n.readSync(r,t,0,150,0),n.closeSync(r)}catch(e){}return i(t.toString())}},"./src/cross-spawn/lib/util/resolveCommand.js":(e,t,r)=>{"use strict";const n=r("path"),i=r("./src/cross-spawn/lib/util/which/which.js"),o=r("./src/cross-spawn/lib/util/path-key/path-key.js");function s(e,t){const r=e.options.env||process.env,s=process.cwd(),a=null!=e.options.cwd,l=a&&void 0!==process.chdir&&!process.chdir.disabled;if(l)try{process.chdir(e.options.cwd)}catch(e){}let c;try{c=i.sync(e.command,{path:r[o({env:r})],pathExt:t?n.delimiter:void 0})}catch(e){}finally{l&&process.chdir(s)}return c&&(c=n.resolve(a?e.options.cwd:"",c)),c}e.exports=function(e){return s(e)||s(e,!0)}},"./src/cross-spawn/lib/util/shebang-command/shebang-command.js":(e,t,r)=>{"use strict";const n=r("./src/cross-spawn/lib/util/shebang-command/shebang-regex/shebang-regex.js");e.exports=(e="")=>{const t=e.match(n);if(!t)return null;const[r,i]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return"env"===o?i:i?`${o} ${i}`:o}},"./src/cross-spawn/lib/util/shebang-command/shebang-regex/shebang-regex.js":e=>{"use strict";e.exports=/^#!(.*)/},"./src/cross-spawn/lib/util/which/isexe/isexe.js":(e,t,r)=>{var n;function i(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise((function(r,n){i(e,t||{},(function(e,t){e?n(e):r(t)}))}))}n(e,t||{},(function(e,n){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,n=!1),r(e,n)}))}r("fs"),n="win32"===process.platform||r.g.TESTING_WINDOWS?r("./src/cross-spawn/lib/util/which/isexe/windows.js"):r("./src/cross-spawn/lib/util/which/isexe/mode.js"),e.exports=i,i.sync=function(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}}},"./src/cross-spawn/lib/util/which/isexe/mode.js":(e,t,r)=>{e.exports=i,i.sync=function(e,t){return o(n.statSync(e),t)};var n=r("fs");function i(e,t,r){n.stat(e,(function(e,n){r(e,!e&&o(n,t))}))}function o(e,t){return e.isFile()&&function(e,t){var r=e.mode,n=e.uid,i=e.gid,o=void 0!==t.uid?t.uid:process.getuid&&process.getuid(),s=void 0!==t.gid?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),l=parseInt("010",8);return r&parseInt("001",8)||r&l&&i===s||r&a&&n===o||r&(a|l)&&0===o}(e,t)}},"./src/cross-spawn/lib/util/which/isexe/windows.js":(e,t,r)=>{e.exports=o,o.sync=function(e,t){return i(n.statSync(e),e,t)};var n=r("fs");function i(e,t,r){return!(!e.isSymbolicLink()&&!e.isFile())&&function(e,t){var r=void 0!==t.pathExt?t.pathExt:process.env.PATHEXT;if(!r)return!0;if(-1!==(r=r.split(";")).indexOf(""))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}(t,r)}function o(e,t,r){n.stat(e,(function(n,o){r(n,!n&&i(o,e,t))}))}},"./src/cross-spawn/lib/util/which/which.js":(e,t,r)=>{const n="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,i=r("path"),o=n?";":":",s=r("./src/cross-spawn/lib/util/which/isexe/isexe.js"),a=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),l=(e,t)=>{const r=t.colon||o,i=e.match(/\//)||n&&e.match(/\\/)?[""]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],s=n?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",a=n?s.split(r):[""];return n&&-1!==e.indexOf(".")&&""!==a[0]&&a.unshift(""),{pathEnv:i,pathExt:a,pathExtExe:s}},c=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});const{pathEnv:n,pathExt:o,pathExtExe:c}=l(e,t),u=[],h=r=>new Promise(((o,s)=>{if(r===n.length)return t.all&&u.length?o(u):s(a(e));const l=n[r],c=/^".*"$/.test(l)?l.slice(1,-1):l,h=i.join(c,e),d=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;o(p(d,r,0))})),p=(e,r,n)=>new Promise(((i,a)=>{if(n===o.length)return i(h(r+1));const l=o[n];s(e+l,{pathExt:c},((o,s)=>{if(!o&&s){if(!t.all)return i(e+l);u.push(e+l)}return i(p(e,r,n+1))}))}));return r?h(0).then((e=>r(null,e)),r):h(0)};e.exports=c,c.sync=(e,t)=>{t=t||{};const{pathEnv:r,pathExt:n,pathExtExe:o}=l(e,t),c=[];for(let a=0;a<r.length;a++){const l=r[a],u=/^".*"$/.test(l)?l.slice(1,-1):l,h=i.join(u,e),p=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;for(let e=0;e<n.length;e++){const r=p+n[e];try{if(s.sync(r,{pathExt:o})){if(!t.all)return r;c.push(r)}}catch(e){}}}if(t.all&&c.length)return c;if(t.nothrow)return null;throw a(e)}},"app-lib-log":e=>{"use strict";e.exports=n},child_process:t=>{"use strict";t.exports=e},fs:e=>{"use strict";e.exports=r},path:e=>{"use strict";e.exports=t}},o={};function s(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return i[e](r,r.exports,s),r.exports}s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var a={};return(()=>{var e=a;const t=s("./src/cross-spawn/index.js"),{log:r}=s("app-lib-log");e.exec=(e,n,i,o=!0)=>{let s=o?t.sync:t,a=i||{};return a.stdio||(a.stdio=(()=>{const{DEBUG:e}=process?.env||{};return process.argv.slice(2).includes("--debug")||e})()?"inherit":["ignore","ignore","inherit"]),r.md.apply(r,[s.name,e,JSON.stringify(n),i,a,o]),s(e,n,a)}})(),a})(),e.exports=n(r(303),r(423),r(231),r(810))},798:function(e){var t;t=()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};e.r(t),e.d(t,{ENV:()=>r,bindToGlobal:()=>l,default:()=>u,getEnv:()=>n,getGlobal:()=>s,getbindData:()=>a,isBindToGlobal:()=>c,isBroswerEnv:()=>o,isNodeEnv:()=>i});const r={NODE:"node",BROWSER:"browser"},n=()=>{let e=s();return e.window==e?r.BROWSER:r.NODE},i=()=>n()===r.NODE,o=()=>n()===r.BROWSER,s=()=>{let t;return"object"==typeof e.g?t=e.g:"object"==typeof window&&(t=window),t},a=e=>{let t=s();if(!t)throw new Error("未找到当前环境的全局变量");return t[e]},l=(e,t,r)=>c(e)&&!r?a(e):(s()[e]=t,t),c=(e,t)=>{if(!e)throw new Error("必须执行绑定名称");let r=s();if(!r)throw new Error("未找到当前环境的全局变量");let n=r[e];return void 0!==n&&(null==t||n===t||JSON.stringify(n)===JSON.stringify(t))},u=l;return t})(),e.exports=t()},810:function(e,t,r){var n;n=e=>(()=>{"use strict";var t={"app-lib-global":t=>{t.exports=e},"./src/chalk/source/index.js":(e,t,r)=>{r.r(t),r.d(t,{Chalk:()=>d,backgroundColorNames:()=>n.backgroundColorNames,backgroundColors:()=>n.backgroundColorNames,chalkStderr:()=>y,colorNames:()=>n.colorNames,colors:()=>n.colorNames,default:()=>E,foregroundColorNames:()=>n.foregroundColorNames,foregroundColors:()=>n.foregroundColorNames,modifierNames:()=>n.modifierNames,modifiers:()=>n.modifierNames,supportsColor:()=>s,supportsColorStderr:()=>a});var n=r("./src/chalk/source/vendor/ansi-styles/index.js"),i=r("./src/chalk/source/vendor/supports-color/browser.js"),o=r("./src/chalk/source/utilities.js");const{stdout:s,stderr:a}=i.default,l=Symbol("GENERATOR"),c=Symbol("STYLER"),u=Symbol("IS_EMPTY"),h=["ansi","ansi","ansi256","ansi16m"],p=Object.create(null);class d{constructor(e){return m(e)}}const m=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=s?s.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,g.prototype),t};function g(e){return m(e)}Object.setPrototypeOf(g.prototype,Function.prototype);for(const[e,t]of Object.entries(n.default))p[e]={get(){const r=x(this,v(t.open,t.close,this[c]),this[u]);return Object.defineProperty(this,e,{value:r}),r}};p.visible={get(){const e=x(this,this[c],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const f=(e,t,r,...i)=>"rgb"===e?"ansi16m"===t?n.default[r].ansi16m(...i):"ansi256"===t?n.default[r].ansi256(n.default.rgbToAnsi256(...i)):n.default[r].ansi(n.default.rgbToAnsi(...i)):"hex"===e?f("rgb",t,r,...n.default.hexToRgb(...i)):n.default[r][e](...i),b=["rgb","hex","ansi256"];for(const e of b)p[e]={get(){const{level:t}=this;return function(...r){const i=v(f(e,h[t],"color",...r),n.default.color.close,this[c]);return x(this,i,this[u])}}},p["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const i=v(f(e,h[t],"bgColor",...r),n.default.bgColor.close,this[c]);return x(this,i,this[u])}}};const _=Object.defineProperties((()=>{}),{...p,level:{enumerable:!0,get(){return this[l].level},set(e){this[l].level=e}}}),v=(e,t,r)=>{let n,i;return void 0===r?(n=e,i=t):(n=r.openAll+e,i=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:i,parent:r}},x=(e,t,r)=>{const n=(...e)=>w(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,_),n[l]=e,n[c]=t,n[u]=r,n},w=(e,t)=>{if(e.level<=0||!t)return e[u]?"":t;let r=e[c];if(void 0===r)return t;const{openAll:n,closeAll:i}=r;if(t.includes(""))for(;void 0!==r;)t=(0,o.stringReplaceAll)(t,r.close,r.open),r=r.parent;const s=t.indexOf("\n");return-1!==s&&(t=(0,o.stringEncaseCRLFWithFirstIndex)(t,i,n,s)),n+t+i};Object.defineProperties(g.prototype,p);const O=g(),y=g({level:a?a.level:0}),E=O},"./src/chalk/source/utilities.js":(e,t,r)=>{function n(e,t,r){let n=e.indexOf(t);if(-1===n)return e;const i=t.length;let o=0,s="";do{s+=e.slice(o,n)+t+r,o=n+i,n=e.indexOf(t,o)}while(-1!==n);return s+=e.slice(o),s}function i(e,t,r,n){let i=0,o="";do{const s="\r"===e[n-1];o+=e.slice(i,s?n-1:n)+t+(s?"\r\n":"\n")+r,i=n+1,n=e.indexOf("\n",i)}while(-1!==n);return o+=e.slice(i),o}r.r(t),r.d(t,{stringEncaseCRLFWithFirstIndex:()=>i,stringReplaceAll:()=>n})},"./src/chalk/source/vendor/ansi-styles/index.js":(e,t,r)=>{r.r(t),r.d(t,{backgroundColorNames:()=>c,colorNames:()=>u,default:()=>h,foregroundColorNames:()=>l,modifierNames:()=>a});const n=(e=0)=>t=>`[${t+e}m`,i=(e=0)=>t=>`[${38+e};5;${t}m`,o=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,s={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},a=Object.keys(s.modifier),l=Object.keys(s.color),c=Object.keys(s.bgColor),u=[...l,...c],h=function(){const e=new Map;for(const[t,r]of Object.entries(s)){for(const[t,n]of Object.entries(r))s[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=s[t],e.set(n[0],n[1]);Object.defineProperty(s,t,{value:r,enumerable:!1})}return Object.defineProperty(s,"codes",{value:e,enumerable:!1}),s.color.close="[39m",s.bgColor.close="[49m",s.color.ansi=n(),s.color.ansi256=i(),s.color.ansi16m=o(),s.bgColor.ansi=n(10),s.bgColor.ansi256=i(10),s.bgColor.ansi16m=o(10),Object.defineProperties(s,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;3===r.length&&(r=[...r].map((e=>e+e)).join(""));const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>s.rgbToAnsi256(...s.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,n;if(e>=232)t=(10*(e-232)+8)/255,r=t,n=t;else{const i=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(i/6)/5,n=i%6/5}const i=2*Math.max(t,r,n);if(0===i)return 30;let o=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return 2===i&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>s.ansi256ToAnsi(s.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>s.ansi256ToAnsi(s.hexToAnsi256(e)),enumerable:!1}}),s}()},"./src/chalk/source/vendor/supports-color/browser.js":(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});let n=!1;"undefined"!=typeof navigator&&(n=navigator&&navigator.userAgentData?navigator.userAgentData.brands.some((({brand:e})=>"Chromium"===e)):/\b(Chrome|Chromium)\//.test(navigator.userAgent));const i=!!n&&{level:1,hasBasic:!0,has256:!1,has16m:!1},o={stdout:i,stderr:i}}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{ALL_FUNCTIONS:()=>r,LEVEL:()=>c,Logger:()=>G,TYPE:()=>l,create:()=>W,default:()=>q,log:()=>U});var e=n("./src/chalk/source/index.js"),t=n("app-lib-global");const r=[],o=(0,t.isBroswerEnv)(),s=(0,t.getEnv)(),a=new e.Chalk({level:2}),l={TRACE:"trace",DEBUG:"debug",INFO:"info",LOG:"log",SUCCESS:"success",TABLE:"table",TIME:"time",WARN:"warn",ERROR:"error"},c={trace:10,debug:20,info:30,log:31,success:32,table:33,time:40,warn:60,error:70},u={node:{maxCharLength:9,textAlgin:"right",space:"",module:{background:"#0a0afb",color:"#ffffff"},trace:{background:"#4a4848",color:"#ffffff"},debug:{background:"#4a4848",color:"#ffffff",index:" "},info:{background:"#08df08",color:"#ffffff",index:" "},success:{background:"#0808ef",color:"#ffffff",index:" "},warn:{background:"#ffff08",color:"#ff0000"},error:{background:"#f50303",color:"#ffffff"},time:{background:"#47b2b2",color:"#ffffff",index:" "}},browser:{maxCharLength:9,textAlgin:"right",index:"background: transparent;margin-left:4px;",space:"background: transparent;",trace:"background: linear-gradient(90deg, #b7b2b2,#8080804d, #b7b2b2); color:white; font-weight:bold; border-radius: 1px; ",debug:"background:linear-gradient(70deg, #b7b2b2, #8080804d, #b7b2b2); color:white; font-weight:bold; border-radius: 1px;",info:"background: linear-gradient(70deg, #00800085, #57d4c1,#57d4c1, #00800085); color:white; font-weight:bold;border-radius: 1px;",success:"background: linear-gradient(70deg, #172bdca1, #0000ff36, #172bdca1); color:white; font-weight:bold;border-radius: 1px;",time:"background: linear-gradient(70deg, #00bfffcf,#00bfff4f,#00bfffcf); color:white; font-weight:bold;border-radius: 1px;",warn:"background: linear-gradient(90deg, #eab60e, #eab60e6e, #eab60e); color:yellow; font-weight:bold; border-radius: 1px;",error:"background: linear-gradient(90deg, #ff00006b, #ff000033,#ff000033, #ff00006b); color:red; font-weight:bold; border-radius: 1px;",dateTime:"background: none; border: 1px #ad10da4d solid; color:#ad10dacf; font-weight:bold; border-radius: 1px;",module:"background: linear-gradient(70deg, #0a0afb, #44448a); color:white; font-weight:bold; border-radius: 1px;padding:0 5px"}},h={bindGlobalName:"log",level:0,moduleName:"",isModule:!1,isColorful:!0,colorful:u[s],LEVEL:c,dateFormatter:"YYYY-MM-DD HH:mm:ss",onLogger:null},p=(e,t)=>{var r={"M+":e.getMonth()+1,"D+":e.getDate(),"H+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds()};for(var n in/(Y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),r)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[n]:("00"+r[n]).substr((""+r[n]).length)));return t},d=function(){const{DEBUG:e}=process?.env||{};let t=process.argv.slice(2).includes("--debug")||e;this.setOption({level:t&&"undefined"!=t?0:21})};function m(e,t){let{indent:r,width:n,algin:i,color:o,background:s}=t;return U.fill(r||0)+U.tx(U.autoFillText(e,n,i),o,s)}function g(e,t,r){let n=a.hex(t||"#ffffff");return r&&(n=n.bgHex(r)),n(e)}function f(e,t,r){let n=this.tx(e,t,r);return console.log(n),n}function b(e=l.INFO,t="",r=!0){let{background:n,color:i}=u.node[e]||u.node[l.INFO],o=a.hex(i||n||"#ffffff");return r&&n&&(o=o.bgHex(n)),o(t)}function _(e=l.INFO,t="",r=!1){console.log.apply(null,this.tl(e,t,r))}function v(e,t,r){if(!["object","undefined"].includes(typeof r))return this.error("transLevelTextColorAndLog(level,text,chalkOption)方法参数chalkOption传递错误, 请传递{ bg, color }对象形式");let n=e?this._getTerminalColorfulArguments(e):[];n=n.length?[n.join("")]:n;let{background:i}=u.node[e],{bg:o,color:s}=r||{color:i||"#ffffff"},l=a.hex(s||i||"#ffffff");return o&&(l=l.bgHex(o)),n.push(l(" "+t+" ")),n.join("")}function x(...e){return this.exe(l.TRACE,e)}function w(...e){return this.exe(l.DEBUG,[...arguments])}function O(...e){return this.exe(l.INFO,[...arguments])}function y(...e){return this.exe(l.LOG,[...arguments])}function E(...e){return this.exe(l.SUCCESS,[...arguments])}function C(...e){return this.exe(l.TIME,[...arguments])}function A(...e){return this.exe(l.TABLE,[...arguments])}function S(...e){return this.exe(l.WARN,[...arguments])}function T(...e){return this.exe(l.WARN,[...arguments],{noTrace:!0})}function $(...e){return this.exe(l.ERROR,[...arguments])}function k(...e){return this.exe(l.ERROR,[...arguments],{noTrace:!0})}function N(...e){return this._mExecute(l.TRACE,[...arguments])}function j(...e){return this._mExecute(l.DEBUG,[...arguments])}function F(...e){return this._mExecute(l.INFO,[...arguments])}function R(...e){return this._mExecute(l.LOG,[...arguments])}function H(...e){return this._mExecute(l.SUCCESS,[...arguments])}function P(...e){return this._mExecute(l.TIME,[...arguments])}function D(...e){return this._mExecute(l.TABLE,[...arguments])}function V(...e){return this._mExecute(l.WARN,[...arguments])}function L(...e){return this._mExecute(l.WARN,[...arguments],{noTrace:!0})}function I(...e){return this._mExecute(l.ERROR,[...arguments])}function M(...e){return this._mExecute(l.ERROR,[...arguments],{noTrace:!0})}const B={setOption:function(e){return this.option={...this.option,...e},this.option},getOption:function(){return this.option},auotLogLevel:d,auotLevel:d,autoFillText:function(e,t,r="right"){let n=this.option.colorful.maxCharLength;return this._autoFillLength(t||n,e,r)},fill:function(e,t){return this._fill(e,t)},transTextColorBlock:m,tb:m,trace:x,debug:w,info:O,log:y,success:E,time:C,table:A,warn:S,warnNoTrace:T,error:$,errorNoTrace:k,t:x,d:w,i:O,l:y,s:E,tt:C,T:A,w:S,wn:T,e:$,en:k,mTrace:N,mDebug:j,mInfo:F,mLog:R,mSuccess:H,mTime:P,mTable:D,mWarn:V,mWarnNoTrace:L,mError:I,mErrorNoTrace:M,mt:N,md:j,mi:F,ml:R,ms:H,mtt:P,mT:D,mw:V,mwn:L,me:I,men:M,transTextColor:g,transTextColorAndLog:f,transLevelTextColor:b,transLevelTextColorAndLog:_,transLevelHeaderAndLog:v,tx:g,txl:f,tl:b,tll:_,tlh:v};class G{constructor(e){this.option={...h,...e},(e=>{for(let t in B)e[t]=B[t]})(this)}_isIndex(e){return![l.TRACE,l.WARN,l.ERROR].includes(e)}_getSpace(e){let t="";for(let r=0;r<e;r++)t+=" ";return t}_getAlgin(e,t,r){let n=r-e.length,i=0,o=1;return"center"===t?(i=Math.floor(n/2),o=Math.ceil(n/2)):i=n-1,"%c"+this._getSpace(i)+e.toLowerCase()+this._getSpace(o)}_getBroswerColorfulArguments(e){let{isColorful:t,colorful:r,moduleName:n,dateFormatter:i}=this.option,{textAlgin:o,maxCharLength:s,index:a,space:c,module:u,dateTime:h}=r;if(!t)return[];let d="",m=[];if(this._isIndex(e)&&(d+="%c ",m.push(a)),d+=this._getAlgin(e,o,s),m.push(r[e.toLowerCase()]),n&&(d+="%c %c%s",m=m.concat([c,u,n])),e===l.TIME){d+="%c %c%s";let e="string"==typeof i?p(new Date,i):i(new Date);m=m.concat([c,h,e])}return[d].concat(m)}_fill(e,t=" "){let r=[];for(let n=0;n<e;n++)r.push(t);return r.join("")}_getPosition(e){let t=e/2;return[Math.ceil(t),Math.floor(t)]}_autoFillLength(e,t,r="right"){let n=e-(t+=" ").length;if("center"===r){let[e,r]=this._getPosition(n);return this._fill(e)+t+this._fill(r)}return n<=0?t:"right"==r?this._fill(n)+t:t+this._fill(n)}_getTerminalColorfulArguments(e,t={}){let{isColorful:r,colorful:n,moduleName:i,dateFormatter:o}=this.option;if(!r)return[];let{textAlgin:s,maxCharLength:c,space:u,module:h}=n,{background:d,color:m,index:g}=n[e]||n.trace,f=[];(t.noTrace||g)&&f.push(t.noTrace?n.debug.index:g);let b=this._autoFillLength(c,e.toLowerCase(),s);if(f.push(a.bgHex(d).hex(m)(b)),f.push(u),i&&f.push(a.bgHex(h.background).hex(h.color)(" "+i+" ")),e===l.TIME){let e="string"==typeof o?p(new Date,o):o(new Date);f=f.concat([e])}return f}_output(e,t,r,n={}){let{onLogger:i,level:s}=this.option;if("number"==typeof s){if(s>this.option.LEVEL[e])return}else if(Array.isArray(s)&&!s.includes(e))return!1;if(i&&i(e,r),console){let i=o||![l.WARN,l.ERROR].includes(e)||n.noTrace?e:l.TRACE;i=o&&[l.DEBUG].includes(e)?l.INFO:i;let s=console[i.toLowerCase()]||console[l.INFO];i.toLowerCase()===l.TABLE?console.table.apply(null,r):i.toLowerCase()===l.TIME?console.log.apply(null,t.concat(r)):i.toLowerCase()===l.LOG?console.log.apply(null,r):s.apply(null,t.concat(r))}}exe(e,t,r){let n=o?this._getBroswerColorfulArguments(e):this._getTerminalColorfulArguments(e,r);return this._output(e,n,t,r),null}_mExecute(e,t,r={}){this.option.moduleName=t[0];let n=e.toLowerCase()+(r.noTrace?"NoTrace":"");this[n]&&this[n].apply(this,t.slice(1,t.length)),this.option.moduleName=""}}const W=function(e){let r=e.bindGlobalName;return(0,t.isBindToGlobal)(r)?(0,t.getbindData)(r):(0,t.bindToGlobal)(r,new G(e||{}))},U=W(h),q=U})(),i})(),e.exports=n(r(798))},882:function(e,t,r){var n;n=(e,t,r,n,i,o,s)=>(()=>{var a={138:(e,t,r)=>{const n=r(56),i=r(89),{log:o}=r(668),{exec:s}=r(86),a=r(908),{appRequire:l}=r(305),c=Object.keys(process.binding("natives")).filter((e=>!/^internal\//.test(e))).sort(),u=i.existsSync,h=n.resolve,p=()=>{let e=O();return f(h(e,"../../node.exe"))},d=(e,t)=>{let r=h(e,`./node_modules/.bin/${t}`);return u(r)?r:null},m=()=>["DEVELOP","DEV","develop","dev"].includes(process.env.MODE||process.env.M),g=(e,t,r={})=>i.writeFileSync(e,t,{encoding:"utf8",options:r}),f=e=>!!i.existsSync(e)&&i.statSync(e).isDirectory(),b=(e,t,r=0,n=[])=>{let i=h(e,t);return i===h(e,"../",t)?null:f(i)?{path:i,layer:r,paths:n}:(n.push(e.split("\\").pop()),b(h(e,"../"),t,r+1,n))},_=(e,t,r,n=0)=>new Promise(((n,s)=>{const a=h(t,"../"),l=()=>{i.copyFileSync(e,t),n()};i.existsSync(a)||x(a),(async()=>{if(!r)if(u(t)){o.mwn(`exist file [${t}], recover it ?`);let e=await w("yes/no","yes");["yes","y"].includes(e)?l():n()}else l()})()})),v=(e,t)=>{const r=h(t,"../");i.existsSync(r)||x(r),i.copyFileSync(e,t),res()},x=(e,t={recursive:!0})=>{i.mkdirSync(e,t)},w=(e="",t="",r=!1)=>new Promise((n=>{o.mi(e+"");const i=a.createInterface({input:process.stdin,output:process.stdout});let s=t?`(${t})`:"",l=`${o.fill(7)+o.tx(o.autoFillText("default"),"#FFFFFF","#7506ef")} ${o.tx(s,"#00ffdc")}`,c=()=>{i.question(l,(e=>{if(r)i.close(),n(e||t);else{let r=e||t;r?(i.close(),n(r)):(o.mwn("can't empty! please input again"),c())}}))};c()})),O=(e="./")=>h(y(),e),y=(e="../../")=>h(l.main.filename,e),E=e=>{let t=[];i.existsSync(e)&&(t=i.readdirSync(e),t.forEach(((t,r)=>{let n=e+"/"+t;i.statSync(n).isDirectory()?E(n):i.unlinkSync(n)})),i.rmdirSync(e))},C=e=>{let t=h(O(),"./init.justport.used.config.ps1"),r=s("powershell",[t,e],{stdio:"pipe"}).stdout.toString();return o.md("test port result:",r),!!r},A=async e=>{let t=1*e;return await C(t)?await A(t+1):t},S=(e,t)=>{i.existsSync(t)||i.mkdirSync(t),i.readdirSync(e).forEach((r=>{const o=n.join(e,r),s=n.join(t,r);i.lstatSync(o).isDirectory()?S(o,s):((e,t)=>{i.copyFileSync(e,t)})(o,s)}))};e.exports={copyFile:_,copyFileSync:v,copyProjectFile:async(e,t,r=0)=>{let n=h(O(),e),i=h(t);return u(n)?(await _(n,i),o.md(`finish copy [${n}] to ${i}`),0):(o.mwn(`not exist [${n}]`),r)},copyFolder:S,copyProjectFileSync:(e,t,r=0)=>{let n=h(O(),e),i=h(t);return u(n)?(v(n,i),o.md(`finish copy [${n}] to ${i}`),0):(o.mwn(`not exist [${n}]`),r)},delDir:E,delFile:e=>i.unlinkSync(e),getBin:e=>{let t=y(),r=d(t,e);return o.md("getBin:",e,r),r||e},getBinPath:()=>{let e=O();return p()?h(e,"../.."):m()?h(e,"./node_modules/.bin"):h(e,"../.bin")},getCanUsePort:A,getLocalIP:function(){const e=r(44),t=e.type(),n=e.networkInterfaces();let i="";if("Windows_NT"===t){for(let e in n)if("本地连接"===e||"以太网"===e)for(let t=0;t<n[e].length;t++)if("IPv4"===n[e][t].family){i=n[e][t].address;break}}else"Linux"===t&&(i=n.eth0[0].address);return i},getMainPath:y,getParentDir:b,getRootPath:O,getTemplate:()=>{let e="./src/template.html";return u(e)||(o.mi(`use default tempalte config! diy in [${e}]`),e=h(O(),"../../","./src/template","./init.index.default.template.html")),e},isDev:m,isExistBin:d,isExistDir:f,isExistFile:u,isGlobalInstall:p,isSysUsePort:C,mkdir:x,NODE_INNER_MODULES:c,readFile:(e,t={})=>new Promise(((r,n)=>{(!0===t||t.cwd)&&(e=h(e),(t={}).cwd&&delete t.cwd),i.readFile(e,{encoding:"utf8",...t},(function(e,t){if(e)return n(e);r(t)}))})),readFileSync:(e,t={})=>i.readFileSync(e,{encoding:"utf8",options:t}),readdirSync:(e,t)=>i.readdirSync(e,t),readline:w,resolve:h,updateContent:({content:e,startflag:t,endFalg:r,appContent:n,isRepalce:i,isStart:o,isInnerStart:s,space:a,newHeader:l})=>{const c=a||"\r\n";let u=e.indexOf(t),h=e.indexOf(r);if(-1===u||-1===h){let i=[t,l,n,r].filter((e=>e));return o?i.concat([e]).join(c):[e].concat(i).join(c)}let p=e.substr(u,h-u),d=p.replace(/\r\n$/,"").replace(/\r\n$/,""),m=[];return m=i?[t,l,n].filter((e=>e)):s?l?[t,l,n,d.replace(t,"").replace(l,"")]:[n,d]:[d,n],m=m.join(c)+c,e.replace(p,m)},writeFile:(e,t,r={})=>new Promise(((n,o)=>{(!0===r||r.cwd)&&(e=n(e),(r={}).cwd&&delete r.cwd),i.writeFile(e,t,{encoding:"utf8",flag:"w+",...r},(function(e){if(e)return o(e);n(t)}))})),writeFileSync:g,writeFileSyncAndCreate:(e,t,r={})=>{let i=n.parse(e).dir;f(i)||x(i),g(e,t,{})},yesOrNo:async(e,t="yes")=>{let r=await w(`${e} [yes/no]`,t);return["yes","y"].includes(r)}}},86:t=>{"use strict";t.exports=e},668:e=>{"use strict";e.exports=t},305:e=>{"use strict";e.exports=r},89:e=>{"use strict";e.exports=n},44:e=>{"use strict";e.exports=i},56:e=>{"use strict";e.exports=o},908:e=>{"use strict";e.exports=s}},l={},c=function e(t){var r=l[t];if(void 0!==r)return r.exports;var n=l[t]={exports:{}};return a[t](n,n.exports,e),n.exports}(138);return c})(),e.exports=n(r(708),r(810),r(718),r(231),r(719),r(423),r(189))},561:(e,t,r)=>{(()=>{var e={138:(e,t,r)=>{const n=r(423),{readFileSync:i,isExistFile:o,resolve:s,isExistDir:a,writeFileSyncAndCreate:l,readdirSync:c,getRootPath:u}=r(32),{log:h}=r(115),p="./static/",d="./static/store.json",m=(e=[],t=d)=>{let r=e.map((e=>{if(o(e)){let t=i(e);return{name:e.split("\\").pop(),content:t}}return h.men("不存在文件文件",n.resolve(e)),null})).filter((e=>!!e));return r.length&&l(t,JSON.stringify(r,null,2)),r},g=(e=[],t=p,r=!1)=>e.map((({name:e,content:i})=>{let s=u(n.join(t||"",e));return!r&&o(s)||l(s,i),s}));e.exports={filesToJson:m,pathToFile:(e=d,t=p)=>o(e)?g(JSON.parse(i(e)),t):h.men("不存在文件文件",e),jsonToFile:g,buildDirFiles:(e="./src/trans-static",t=d)=>{if(!a(e))return h.md("不存在静态文件目录",e);let r=c(e).filter((t=>!a(n.resolve(e,t)))).map((t=>n.resolve(e,t)));return m(r,t)}}},115:e=>{"use strict";e.exports=r(810)},32:e=>{"use strict";e.exports=r(882)},423:e=>{"use strict";e.exports=r(423)}},n={},i=function t(r){var i=n[r];if(void 0!==i)return i.exports;var o=n[r]={exports:{}};return e[r](o,o.exports,t),o.exports}(138),o=t;for(var s in i)o[s]=i[s];i.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})()},17:(e,t,r)=>{const{log:n}=r(810),i={ERROR:-1,WARN:1,SUCESS:0};let o=[];for(let e in i)o.push(i[e]);const s={[i.ERROR]:"e",[i.WARN]:"w",[i.SUCESS]:"s"};e.exports={AppError:class{constructor(e,t=i.WARN,r={}){if(!o.includes(t))throw n.me(`create AppError code [${t}] is no't in ERROR_CODE [${o}] `);let s=Array.isArray(e)?e:null==e?[]:[e],a={trace:!1,module:!0,data:void 0,print:!0,...r};this.options={message:s,code:t,config:a},a.print&&this.print()}print(e={}){let{message:t,code:r,config:i}={...this.options,...e},{trace:o,module:a}=i;if(t&&t.length){let e=[a&&"m",s[r],o?"":"n"].join(""),i=n[e];if(!i)throw n.me(`log no exist ${e} function`);i.apply(n,t)}}isError(){return this.options.code===i.ERROR}noError(){return this.options.code===i.SUCESS}},ERROR_CODE:i}},585:(e,t,r)=>{const{LANGUAGE:n}=r(598),i={language:e=>["[language]",`[${n.join("/")}] default(${n[0]})`,t=>{if(!n.includes(t))throw log.en("error",`command-argument value '${t}' is invalid for argument 'language' , please choice right language in [${n.join(",")}]`),new e.commander.InvalidArgumentError;return t},n[0]]};e.exports={ARGUMENTS:i}},598:e=>{const t={umd:{key:"umd"},commonjs:{key:"commonjs"},window:{key:"window"}};let r=(()=>{let e=[];for(prop in t)e.push(t[prop].key);return e})();e.exports={TARGET:["server","doc","build","process"],LANGUAGE:["es","node","bin","react","vue","static"],LIBRARY_TARGET_OBJ:t,LIBRARY_TARGET:r}},919:(e,t,r)=>{const{TARGET:n,LIBRARY_TARGET:i}=r(598),o={target:({Option:e})=>new e("-t, --target [string]","server target module").choices(n),debug:({Option:e})=>new e("-d, --debug","show debug log"),libraryTarget:({Option:e})=>new e("-t, --libraryTarget [string]","output libraryTarget").choices(i).default(i[0],"default is umd"),message:({Option:e})=>new e("-msg, --message [string]","git submit or change log message")};e.exports=o},783:e=>{const t=(e,t)=>{let r=1*t;if(isNaN(r))throw new e;return r},r=t;e.exports={int:t,port:r}},174:(e,t,r)=>{const{log:n}=r(810),{ERROR_CODE:i,AppError:o}=r(17),{getRootPath:s,resolve:a}=r(882),{autoRequire:l}=r(718),c=r(783),u=(e="")=>a(s(),"./static/",e),h=(e,t=!0)=>l(t?a(s(),e):a(e));e.exports={praseOpt:e=>{let{options:t}=e,r=t.slice(t.length-2,t.length-1)[0];return{arg:t.slice(0,t.length-2),option:r}},action:async(e,...t)=>{let{commond:r,start:s,...a}=e,l=t.slice(0,t.length-1);const c="string"==typeof t[0]?t[0]:"";n.md(`${r} ${c}::BEGAIN`,{...a,options:l});let u=await s({commond:r,...a,options:t});return void 0===u?new o(`[./plugins/${r}.commong.js] function need return `,i.ERROR):("object"!=typeof u&&(u=new o("",u,{print:!1})),u.noError()?n.md(`${r} ${t[0]}::SUCCESS`):(n.md(`execute [${r} ${c}] result is not 0, confirm is execute success`,`exexute file is [./plugins/${r}.commong.js]`),u.isError()?n.men(`execute [${r} ${c}] result is error!`):n.mwn(`execute [${r} ${c}] is not complete!`)),u)},optionsToArray:(e={},t=[])=>{let r=[];for(key in e)t.includes(key)||(r.push(`--${key}`),r.push(e[key]));return r},bindArg:(e,t)=>{let r={};for(key in e)r[key]=e[key].bind(null,t);return r},prase:c,transEnv:(e,t=[])=>{let r=[];for(let o in e)t.includes(o)&&r.push(`${n=o,i=void 0,(i=n,i.replace(/([A-Z])/g,"_$1").toLowerCase()).toUpperCase()}=${e[o]}`);var n,i;return r},getConfigPath:e=>{let{opt:t,append:r}=e,{commond:n,options:i}=t,o=[n,i[0]].concat(r||[]).concat(["config.js"]).join(".");return a(s(),"./static/config",o)},getStaticPath:u,autoRequireFile:h,autoRequireStaticFile:e=>h(u(e))}},625:e=>{const t={umd:{key:"umd"},commonjs:{key:"commonjs"},window:{key:"window"}};let r=(()=>{let e=[];for(prop in t)e.push(t[prop].key);return e})();e.exports={TARGET:["server","doc","build","process"],LANGUAGE:["es","bin","node","react","vue"],LIBRARY_TARGET_OBJ:t,LIBRARY_TARGET:r}},424:(e,t,r)=>{const n=r(177);e.exports={initCommond:e=>{let{STATIC:{jsonToFile:t},utils:{autoRequireStaticFile:r}}=e;t(n);let i=r("plugin.config.json"),o=((e,t)=>{let{program:r,commander:n,utils:{autoRequireStaticFile:i,action:o},OPTIONS:s,noBuild:{appRequire:a}}=t;const l=[];e.forEach((e=>{if(e?.enable){let c=e.path,u=e.name;try{let h="local"==e?.type?i(`plugin/${c}`):a(c);const p=h?.start(t);if(!p.init)return log.me("need init method export in "+c);if(!p.start)return log.me("need start method export in "+c);let d=r.command(u);p.init(d,t),d.addOption(s.debug(n)).action(o.bind(null,{start:p.start,commond:u})),d.addOption(s.message(n)),l.push(e)}catch(e){log.me(`regiter ${u} commond error,please check [${c}] file`,e)}}})),log.md(`already success register ${l.length} commonds`);let c=l.map((e=>({commond:e.name,"see commond help":`appbir ${e.name} --help`,enable:e.enable,type:e.type,discription:e.discription})));return process.argv.includes("--debug")&&log.T(c),c})(i,e);return{commonds:i,registerCommond:o}}}},555:(e,t,r)=>{const{log:n}=r(810),i=r(491),o=r(882),s=r(561),{exec:a}=r(708),l=r(174),c=r(718),u=r(919),{ARGUMENTS:h}=r(585),p=r(17),d=r(625);e.exports={nodeUtils:o,utils:l,exec:a,commander:i,log:n,noBuild:c,OPTIONS:u,ARGUMENTS:h,Error:p,STATIC:s,CONSTANT:d}},718:e=>{"use strict";e.exports=require("app-lib-nobuild")},303:e=>{"use strict";e.exports=require("child_process")},239:e=>{"use strict";e.exports=require("events")},231:e=>{"use strict";e.exports=require("fs")},719:e=>{"use strict";e.exports=require("os")},423:e=>{"use strict";e.exports=require("path")},369:e=>{"use strict";e.exports=require("process")},189:e=>{"use strict";e.exports=require("readline")},177:e=>{"use strict";e.exports=JSON.parse('[{"name":"plugin.config.json","content":"[\\r\\n {\\"name\\":\\"plugin\\",\\"enable\\":true,\\"type\\":\\"package\\",\\"path\\":\\"app-lib-cli-plugin-plugin\\",\\"discription\\":\\"//TODO 插件管理\\"},\\r\\n {\\"name\\":\\"git\\",\\"enable\\":true,\\"type\\":\\"package\\",\\"path\\":\\"app-lib-cli-plugin-git\\",\\"discription\\":\\"GIT操作\\"},\\r\\n {\\"name\\":\\"build\\",\\"enable\\":true,\\"type\\":\\"package\\",\\"path\\":\\"app-lib-cli-plugin-build\\",\\"discription\\":\\"构建编译\\"},\\r\\n {\\"name\\":\\"md\\",\\"enable\\":true,\\"type\\":\\"package\\",\\"path\\":\\"app-lib-cli-plugin-md\\",\\"discription\\":\\"markdown编译\\"},\\r\\n {\\"name\\":\\"run\\",\\"enable\\":true,\\"type\\":\\"package\\",\\"path\\":\\"app-lib-cli-plugin-run\\",\\"discription\\":\\"自定义命令\\"},\\r\\n {\\"name\\":\\"server\\",\\"enable\\":true,\\"type\\":\\"package\\",\\"path\\":\\"app-lib-cli-plugin-server\\",\\"discription\\":\\"启动服务\\"},\\r\\n {\\"name\\":\\"init\\",\\"enable\\":true,\\"type\\":\\"package\\",\\"path\\":\\"app-lib-cli-plugin-init\\",\\"discription\\":\\"初始工程\\"},\\r\\n {\\"name\\":\\"doc\\",\\"enable\\":true,\\"type\\":\\"package\\",\\"path\\":\\"app-lib-cli-plugin-doc\\",\\"discription\\":\\"API文档\\"}\\r\\n]"}]')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n={};(()=>{const{initCommond:e}=r(424),t=r(555);let{log:n,commander:{Command:i},utils:{action:o,autoRequireFile:s}}=t;const a=new i;n.auotLevel();let{registerCommond:l}=e({...t,program:a});const c=s("package.json");a.version(`v${c.version}`,"-v,--version","the current version").description("appbir personal cli tool for speed work, you can connection email for appbir@163.com").action(o.bind(null,{start:async()=>(n.mi("usage [ appbir --help ] , show support commond >"),n.T(l),0),commond:c.name})),n.md("run.argv",JSON.stringify(process.argv.slice(2))),a.parse(process.argv)})();var i=exports;for(var o in n)i[o]=n[o];n.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
//# sourceMappingURL=cli-bundle-min.js.map