@elgato/cli
Version:
Stream Deck CLI tool for building with Stream Deck.
2 lines • 1.13 MB
JavaScript
#!/usr/bin/env node
import e,{EventEmitter as t}from"node:events";import r from"node:child_process";import n,{posix as i,basename as o,win32 as s,join as a,resolve as u,dirname as c,delimiter as l,extname as f}from"node:path";import d,{existsSync as h,lstatSync as p,createReadStream as m,readlinkSync as v,rmSync as g,mkdirSync as y,cpSync as b,readdirSync as w,readFileSync as _,createWriteStream as D,writeFileSync as E,unlinkSync as x,symlinkSync as S}from"node:fs";import O from"node:process";import k,{platform as C,homedir as A,EOL as $}from"node:os";import P from"node:tty";import j,{mkdir as F,stat as T,statSync as R,mkdirSync as I,existsSync as M,rmSync as N,writeFileSync as L,readFileSync as B}from"fs";import{randomBytes as z,createHash as U}from"node:crypto";import W,{Readable as V,Writable as q}from"node:stream";import H,{EventEmitter as G}from"events";import{StringDecoder as K}from"node:string_decoder";import Y,{parse as J,dirname as Z,resolve as X,extname as Q}from"path";import ee from"assert";import te,{Buffer as re}from"buffer";import ne from"zlib";import ie from"node:assert";import{readdir as oe,lstat as se,mkdir as ae,readFile as ue,rm as ce}from"node:fs/promises";import*as le from"node:readline";import fe,{createInterface as de}from"node:readline";import{fileURLToPath as he}from"node:url";import pe from"stream";import{AsyncLocalStorage as me,AsyncResource as ve}from"node:async_hooks";import ge from"tty";import ye from"util";import be from"child_process";import we from"string_decoder";import _e from"crypto";import De from"os";import{keywordDefinitions as Ee}from"@elgato/schemas";var xe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oe,ke,Ce={},Ae={},$e={};function Pe(){if(Oe)return $e;Oe=1;class e 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}}return $e.CommanderError=e,$e.InvalidArgumentError=class extends e{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}},$e}function je(){if(ke)return Ae;ke=1;const{InvalidArgumentError:e}=Pe();return Ae.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(t){return this.argChoices=t.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new e(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},Ae.humanReadableArgName=function(e){const t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"},Ae}var Fe,Te={},Re={};function Ie(){if(Fe)return Re;Fe=1;const{humanReadableArgName:e}=je();function t(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,"")}return Re.Help=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){const t=e.commands.filter((e=>!e._hidden)),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),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._getHelpOption();if(r&&!r.hidden){const n=r.short&&e._findOption(r.short),i=r.long&&e._findOption(r.long);n||i?r.long&&!i?t.push(e.createOption(r.long,r.description)):r.short&&!n&&t.push(e.createOption(r.short,r.description)):t.push(r)}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.registeredArguments.forEach((t=>{t.description=t.description||e._argsDescription[t.name()]||""})),e.registeredArguments.find((e=>e.description))?e.registeredArguments:[]}subcommandTerm(t){const r=t.registeredArguments.map((t=>e(t))).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce(((e,r)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(r))))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce(((e,r)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(r))))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce(((e,r)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(r))))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce(((e,r)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(r))))),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=[];if(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)}`)}return 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,n){return t.formatItem(e,r,n,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""];const s=t.commandDescription(e);s.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(s),n),""]));const a=t.visibleArguments(e).map((e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e)))));a.length>0&&(o=o.concat([t.styleTitle("Arguments:"),...a,""]));const u=t.visibleOptions(e).map((e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e)))));if(u.length>0&&(o=o.concat([t.styleTitle("Options:"),...u,""])),t.showGlobalOptions){const r=t.visibleGlobalOptions(e).map((e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e)))));r.length>0&&(o=o.concat([t.styleTitle("Global Options:"),...r,""]))}const c=t.visibleCommands(e).map((e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e)))));return c.length>0&&(o=o.concat([t.styleTitle("Commands:"),...c,""])),o.join("\n")}displayWidth(e){return t(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map((e=>"[options]"===e?this.styleOptionText(e):"[command]"===e?this.styleSubcommandText(e):"["===e[0]||"<"===e[0]?this.styleArgumentText(e):this.styleCommandText(e))).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map((e=>"[options]"===e?this.styleOptionText(e):"["===e[0]||"<"===e[0]?this.styleArgumentText(e):this.styleSubcommandText(e))).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,r,n){const i=" ".repeat(2);if(!r)return i+e;const o=e.padEnd(t+e.length-n.displayWidth(e)),s=(this.helpWidth??80)-t-2-2;let a;if(s<this.minWidthToWrap||n.preformatted(r))a=r;else{a=n.boxWrap(r,s).replace(/\n/g,"\n"+" ".repeat(t+2))}return i+o+" ".repeat(2)+a.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;const r=e.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,i=[];return r.forEach((e=>{const r=e.match(n);if(null===r)return void i.push("");let o=[r.shift()],s=this.displayWidth(o[0]);r.forEach((e=>{const r=this.displayWidth(e);if(s+r<=t)return o.push(e),void(s+=r);i.push(o.join(""));const n=e.trimStart();o=[n],s=this.displayWidth(n)})),i.push(o.join(""))})),i.join("\n")}},Re.stripColor=t,Re}var Me,Ne={};function Le(){if(Me)return Ne;Me=1;const{InvalidArgumentError:e}=Pe();function t(e){return e.split("-").reduce(((e,t)=>e+t[0].toUpperCase()+t.slice(1)))}return Ne.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=function(e){let t,r;const n=/^-[^-]$/,i=/^--[^-]/,o=e.split(/[ |,]+/).concat("guard");n.test(o[0])&&(t=o.shift());i.test(o[0])&&(r=o.shift());if(/^-[^-][^-]/.test(o[0]))throw new Error(`invalid Option flags, short option is dash and single character: '${e}'`);if(t&&n.test(o[0]))throw new Error(`invalid Option flags, more than one short flag: '${e}'`);if(r&&i.test(o[0]))throw new Error(`invalid Option flags, more than one long flag: '${e}'`);if(!t&&!r||o[0].startsWith("-"))throw new Error(`invalid Option flags: '${e}'`);return{shortFlag:t,longFlag:r}}(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){let t=e;return"string"==typeof e&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),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(t){return this.argChoices=t.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new e(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?t(this.name().replace(/^no-/,"")):t(this.name())}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Ne.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)}},Ne}var Be,ze,Ue,We={};function Ve(){if(Be)return We;Be=1;const e=3;return We.suggestSimilar=function(t,r){if(!r||0===r.length)return"";r=Array.from(new Set(r));const n=t.startsWith("--");n&&(t=t.slice(2),r=r.map((e=>e.slice(2))));let i=[],o=e;return r.forEach((r=>{if(r.length<=1)return;const n=function(t,r){if(Math.abs(t.length-r.length)>e)return Math.max(t.length,r.length);const n=[];for(let e=0;e<=t.length;e++)n[e]=[e];for(let e=0;e<=r.length;e++)n[0][e]=e;for(let e=1;e<=r.length;e++)for(let i=1;i<=t.length;i++){let o=1;o=t[i-1]===r[e-1]?0:1,n[i][e]=Math.min(n[i-1][e]+1,n[i][e-1]+1,n[i-1][e-1]+o),i>1&&e>1&&t[i-1]===r[e-2]&&t[i-2]===r[e-1]&&(n[i][e]=Math.min(n[i][e],n[i-2][e-2]+1))}return n[t.length][r.length]}(t,r),s=Math.max(t.length,r.length);(s-n)/s>.4&&(n<o?(o=n,i=[r]):n===o&&i.push(r))})),i.sort(((e,t)=>e.localeCompare(t))),n&&(i=i.map((e=>`--${e}`))),i.length>1?`\n(Did you mean one of ${i.join(", ")}?)`:1===i.length?`\n(Did you mean ${i[0]}?)`:""},We}var qe=function(){if(Ue)return Ce;Ue=1;const{Argument:t}=je(),{Command:i}=function(){if(ze)return Te;ze=1;const t=e.EventEmitter,i=r,o=n,s=d,a=O,{Argument:u,humanReadableArgName:c}=je(),{CommanderError:l}=Pe(),{Help:f,stripColor:h}=Ie(),{Option:p,DualOptions:m}=Le(),{suggestSimilar:v}=Ve();class g extends t{constructor(e){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=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._savedState=null,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>b()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>b()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:e=>h(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,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}_getCommandAndAncestors(){const e=[];for(let t=this;t;t=t.parent)e.push(t);return e}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._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),n?this:a}createCommand(e){return new g(e)}createHelp(){return Object.assign(new f,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._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new u(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.trim().split(/ +/).forEach((e=>{this.argument(e)})),this}addArgument(e){const t=this.registeredArguments.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.registeredArguments.push(e),this}helpCommand(e,t){if("boolean"==typeof e)return this._addImplicitHelpCommand=e,this;e=e??"help [command]";const[,r,n]=e.match(/([^ ]+) *(.*)/),i=t??"display help for command",o=this.createCommand(r);return o.helpOption(!1),n&&o.arguments(n),i&&o.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return"object"!=typeof e?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}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 l(e,t,r)),a.exit(e)}action(e){return this._actionHandler=t=>{const r=this.registeredArguments.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)}_callParseArg(e,t,r,n){try{return e.parseArg(t,r)}catch(e){if("commander.invalidArgument"===e.code){const t=`${n} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){const t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){const r=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'\n- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){const t=e=>[e.name()].concat(e.aliases()),r=t(e).find((e=>this._findCommand(e)));if(r){const n=t(this._findCommand(r)).join("|"),i=t(e).join("|");throw new Error(`cannot add command '${i}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(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");const n=(t,n,i)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);const o=this.getOptionValue(r);null!==t&&e.parseArg?t=this._callParseArg(e,t,o,n):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){return this._passThroughOptions=!!e,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(e=!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=!!e,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 this._getCommandAndAncestors().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");if(t=t||{},void 0===e&&void 0===t.from){a.versions?.electron&&(t.from="electron");const e=a.execArgv??[];(e.includes("-e")||e.includes("--eval")||e.includes("-p")||e.includes("--print"))&&(t.from="eval")}let r;switch(void 0===e&&(e=a.argv),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;case"eval":r=e.slice(1);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){this._prepareForParse();const r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){this._prepareForParse();const r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_prepareForParse(){null===this._savedState?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.\n- 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(e,t,r){if(!s.existsSync(e))throw new Error(`'${e}' does not exist\n - if '${r}' 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?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory"}`)}_executeSubCommand(e,t){t=t.slice();let r=!1;const n=[".js",".ts",".tsx",".mjs",".cjs"];function u(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,f=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||"";if(this._scriptPath){let e;try{e=s.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=o.resolve(o.dirname(e),d)}if(d){let t=u(d,f);if(!t&&!e._executableFile&&this._scriptPath){const r=o.basename(this._scriptPath,o.extname(this._scriptPath));r!==this._name&&(t=u(d,`${r}-${e._name}`))}f=t||f}r=n.includes(o.extname(f)),"win32"!==a.platform?r?(t.unshift(f),t=y(a.execArgv).concat(t),c=i.spawn(a.argv[0],t,{stdio:"inherit"})):c=i.spawn(f,t,{stdio:"inherit"}):(this._checkForMissingExecutable(f,d,e._name),t.unshift(f),t=y(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 h=this._exitCallback;c.on("close",(e=>{e=e??1,h?h(new l(e,"commander.executeSubCommandAsync","(close)")):a.exit(e)})),c.on("error",(t=>{if("ENOENT"===t.code)this._checkForMissingExecutable(f,d,e._name);else if("EACCES"===t.code)throw new Error(`'${f}' not executable`);if(h){const e=new l(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,h(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}),n._prepareForParse(),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}_dispatchHelpCommand(e){e||this.help();const t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach(((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())})),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const e=(e,t,r)=>{let n=t;if(null!==t&&e.parseArg){const i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;n=this._callParseArg(e,t,r,i)}return n};this._checkNumberOfArguments();const t=[];this.registeredArguments.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 this._getCommandAndAncestors().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._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(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(){this._getCommandAndAncestors().forEach((e=>{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)})),t=e.filter((e=>e.conflictsWith.length>0));t.forEach((t=>{const r=e.find((e=>t.conflictsWith.includes(e.attributeName())));r&&this._conflictingOption(t,r)}))}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((e=>{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(this._getHelpCommand()&&e===this._getHelpCommand().name()){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 this._getCommandAndAncestors().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=v(e,r)}const r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this.registeredArguments.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=v(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._registerOption(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");const r=this.parent?._findCommand(e);if(r){const t=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}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.registeredArguments.map((e=>c(e)));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.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(),r=this._getOutputContext(e);t.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});const n=t.formatHelp(this,t);return r.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(e){const t=!!(e=e||{}).error;let r,n,i;return t?(r=e=>this._outputConfiguration.writeErr(e),n=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(r=e=>this._outputConfiguration.writeOut(e),n=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(n||(e=this._outputConfiguration.stripColor(e)),r(e)),hasColors:n,helpWidth:i}}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);const r=this._getOutputContext(e),n={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach((e=>e.emit("beforeAllHelp",n))),this.emit("beforeHelp",n);let i=this.helpInformation({error:r.error});if(t&&(i=t(i),"string"!=typeof i&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach((e=>e.emit("afterAllHelp",n)))}helpOption(e,t){return"boolean"==typeof e?(this._helpOption=e?this._helpOption??void 0:null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=Number(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}_outputHelpIfRequested(e){const t=this._getHelpOption();t&&e.find((e=>t.is(e)))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function y(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 b(){return!a.env.NO_COLOR&&"0"!==a.env.FORCE_COLOR&&"false"!==a.env.FORCE_COLOR&&(!(!a.env.FORCE_COLOR&&void 0===a.env.CLICOLOR_FORCE)||void 0)}return Te.Command=g,Te.useColor=b,Te}(),{CommanderError:o,InvalidArgumentError:s}=Pe(),{Help:a}=Ie(),{Option:u}=Le();return Ce.program=new i,Ce.createCommand=e=>new i(e),Ce.createOption=(e,t)=>new u(e,t),Ce.createArgument=(e,r)=>new t(e,r),Ce.Command=i,Ce.Option=u,Ce.Argument=t,Ce.Help=a,Ce.CommanderError=o,Ce.InvalidArgumentError=s,Ce.InvalidOptionArgumentError=s,Ce}(),He=Se(qe);const{program:Ge,createCommand:Ke,createArgument:Ye,createOption:Je,CommanderError:Ze,InvalidArgumentError:Xe,InvalidOptionArgumentError:Qe,Command:et,Argument:tt,Option:rt,Help:nt}=He,it=(e=0)=>t=>`[${t+e}m`,ot=(e=0)=>t=>`[${38+e};5;${t}m`,st=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,at={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]}};Object.keys(at.modifier);Object.keys(at.color),Object.keys(at.bgColor);const ut=function(){const e=new Map;for(const[t,r]of Object.entries(at)){for(const[t,n]of Object.entries(r))at[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=at[t],e.set(n[0],n[1]);Object.defineProperty(at,t,{value:r,enumerable:!1})}return Object.defineProperty(at,"codes",{value:e,enumerable:!1}),at.color.close="[39m",at.bgColor.close="[49m",at.color.ansi=it(),at.color.ansi256=ot(),at.color.ansi16m=st(),at.bgColor.ansi=it(10),at.bgColor.ansi256=ot(10),at.bgColor.ansi16m=st(10),Object.defineProperties(at,{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=>at.rgbToAnsi256(...at.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)=>at.ansi256ToAnsi(at.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>at.ansi256ToAnsi(at.hexToAnsi256(e)),enumerable:!1}}),at}();function ct(e,t=(globalThis.Deno?globalThis.Deno.args:O.argv)){const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return-1!==n&&(-1===i||n<i)}const{env:lt}=O;let ft;function dt(e,{streamIsTTY:t,sniffFlags:r=!0}={}){const n=function(){if("FORCE_COLOR"in lt)return"true"===lt.FORCE_COLOR?1:"false"===lt.FORCE_COLOR?0:0===lt.FORCE_COLOR.length?1:Math.min(Number.parseInt(lt.FORCE_COLOR,10),3)}();void 0!==n&&(ft=n);const i=r?ft:n;if(0===i)return 0;if(r){if(ct("color=16m")||ct("color=full")||ct("color=truecolor"))return 3;if(ct("color=256"))return 2}if("TF_BUILD"in lt&&"AGENT_NAME"in lt)return 1;if(e&&!t&&void 0===i)return 0;const o=i||0;if("dumb"===lt.TERM)return o;if("win32"===O.platform){const e=k.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in lt)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((e=>e in lt))?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((e=>e in lt))||"codeship"===lt.CI_NAME?1:o;if("TEAMCITY_VERSION"in lt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(lt.TEAMCITY_VERSION)?1:0;if("truecolor"===lt.COLORTERM)return 3;if("xterm-kitty"===lt.TERM)return 3;if("TERM_PROGRAM"in lt){const e=Number.parseInt((lt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(lt.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(lt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(lt.TERM)||"COLORTERM"in lt?1:o}function ht(e,t={}){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(dt(e,{streamIsTTY:e&&e.isTTY,...t}))}ct("no-color")||ct("no-colors")||ct("color=false")||ct("color=never")?ft=0:(ct("color")||ct("colors")||ct("color=true")||ct("color=always"))&&(ft=1);const pt={stdout:ht({isTTY:P.isatty(1)}),stderr:ht({isTTY:P.isatty(2)})};function mt(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}const{stdout:vt,stderr:gt}=pt,yt=Symbol("GENERATOR"),bt=Symbol("STYLER"),wt=Symbol("IS_EMPTY"),_t=["ansi","ansi","ansi256","ansi16m"],Dt=Object.create(null),Et=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=vt?vt.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,xt.prototype),t};function xt(e){return Et(e)}Object.setPrototypeOf(xt.prototype,Function.prototype);for(const[e,t]of Object.entries(ut))Dt[e]={get(){const r=At(this,Ct(t.open,t.close,this[bt]),this[wt]);return Object.defineProperty(this,e,{value:r}),r}};Dt.visible={get(){const e=At(this,this[bt],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const St=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?ut[r].ansi16m(...n):"ansi256"===t?ut[r].ansi256(ut.rgbToAnsi256(...n)):ut[r].ansi(ut.rgbToAnsi(...n)):"hex"===e?St("rgb",t,r,...ut.hexToRgb(...n)):ut[r][e](...n),Ot=["rgb","hex","ansi256"];for(const e of Ot){Dt[e]={get(){const{level:t}=this;return function(...r){const n=Ct(St(e,_t[t],"color",...r),ut.color.close,this[bt]);return At(this,n,this[wt])}}};Dt["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=Ct(St(e,_t[t],"bgColor",...r),ut.bgColor.close,this[bt]);return At(this,n,this[wt])}}}}const kt=Object.defineProperties((()=>{}),{...Dt,level:{enumerable:!0,get(){return this[yt].level},set(e){this[yt].level=e}}}),Ct=(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}},At=(e,t,r)=>{const n=(...e)=>$t(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,kt),n[yt]=e,n[bt]=t,n[wt]=r,n},$t=(e,t)=>{if(e.level<=0||!t)return e[wt]?"":t;let r=e[bt];if(void 0===r)return t;const{openAll:n,closeAll:i}=r;if(t.includes(""))for(;void 0!==r;)t=mt(t,r.close,r.open),r=r.parent;const o=t.indexOf("\n");return-1!==o&&(t=function(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}(t,i,n,o)),n+t+i};Object.defineProperties(xt.prototype,Dt);const Pt=xt();xt({level:gt?gt.level:0});var jt,Ft={exports:{}};var Tt,Rt,It,Mt=(jt||(jt=1,Tt=Ft,Rt=Ft.exports,function(){var e,t="Expected a function",r="__lodash_hash_undefined__",n="__lodash_placeholder__",i=32,o=128,s=256,a=1/0,u=9007199254740991,c=NaN,l=4294967295,f=[["ary",o],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",i],["partialRight",64],["rearg",s]],d="[object Arguments]",h="[object Array]",p="[object Boolean]",m="[object Date]",v="[object Error]",g="[object Function]",y="[object GeneratorFunction]",b="[object Map]",w="[object Number]",_="[object Object]",D="[object Promise]",E="[object RegExp]",x="[object Set]",S="[object String]",O="[object Symbol]",k="[object WeakMap]",C="[object ArrayBuffer]",A="[object DataView]",$="[object Float32Array]",P="[object Float64Array]",j="[object Int8Array]",F="[object Int16Array]",T="[object Int32Array]",R="[object Uint8Array]",I="[object Uint8ClampedArray]",M="[object Uint16Array]",N="[object Uint32Array]",L=/\b__p \+= '';/g,B=/\b(__p \+=) '' \+/g,z=/(__e\(.*?\)|\b__t\)) \+\n'';/g,U=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,V=RegExp(U.source),q=RegExp(W.source),H=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,Y=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,Z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,X=/[\\^$.*+?()[\]{}|]/g,Q=RegExp(X.source),ee=/^\s+/,te=/\s/,re=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ne=/\{\n\/\* \[wrapped with (.+)\] \*/,ie=/,? & /,oe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ae=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ce=/\w*$/,le=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,he=/^0o[0-7]+$/i,pe=/^(?:0|[1-9]\d*)$/,me=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,ge=/['\n\r\u2028\u2029\\]/g,ye="\\ud800-\\udfff",be="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",we="\\u2700-\\u27bf",_e="a-z\\xdf-\\xf6\\xf8-\\xff",De="A-Z\\xc0-\\xd6\\xd8-\\xde",Ee="\\ufe0e\\ufe0f",Se="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Oe="['’]",ke="["+ye+"]",Ce="["+Se+"]",Ae="["+be+"]",$e="\\d+",Pe="["+we+"]",je="["+_e+"]",Fe="[^"+ye+Se+$e+we+_e+De+"]",Te="\\ud83c[\\udffb-\\udfff]",Re="[^"+ye+"]",Ie="(?:\\ud83c[\\udde6-\\uddff]){2}",Me="[\\ud800-\\udbff][\\udc00-\\udfff]",Ne="["+De+"]",Le="\\u200d",Be="(?:"+je+"|"+Fe+")",ze="(?:"+Ne+"|"+Fe+")",Ue="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+Ae+"|"+Te+")?",qe="["+Ee+"]?",He=qe+Ve+"(?:"+Le+"(?:"+[Re,Ie,Me].join("|")+")"+qe+Ve+")*",Ge="(?: