engagelab-email-cli 1.1.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +233 -75
- package/dist/index.cjs +58 -41
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,53 +1,70 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`).replace(/^/gm," ".repeat(
|
|
4
|
-
`)}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,i,
|
|
2
|
+
var zo=Object.create;var $r=Object.defineProperty;var Xo=Object.getOwnPropertyDescriptor;var Jo=Object.getOwnPropertyNames;var Ko=Object.getPrototypeOf,Yo=Object.prototype.hasOwnProperty;var p=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var Zo=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Jo(e))!Yo.call(r,s)&&s!==t&&$r(r,s,{get:()=>e[s],enumerable:!(i=Xo(e,s))||i.enumerable});return r};var ae=(r,e,t)=>(t=r!=null?zo(Ko(r)):{},Zo(e||!r||!r.__esModule?$r(t,"default",{value:r,enumerable:!0}):t,r));var ye=p(yt=>{var Ve=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Ft=class extends Ve{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};yt.CommanderError=Ve;yt.InvalidArgumentError=Ft});var Ue=p(At=>{var{InvalidArgumentError:Qo}=ye(),xt=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;break}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)?[e]:t.concat(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=(t,i)=>{if(!this.argChoices.includes(t))throw new Qo(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function eu(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}At.Argument=xt;At.humanReadableArgName=eu});var Rt=p(Tr=>{var{humanReadableArgName:tu}=Ue(),Ot=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(s=>!s._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((s,n)=>s.name().localeCompare(n.name())),t}compareOptions(e,t){let i=s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._getHelpOption();if(i&&!i.hidden){let s=i.short&&e._findOption(i.short),n=i.long&&e._findOption(i.long);!s&&!n?t.push(i):i.long&&!n?t.push(e.createOption(i.long,i.description)):i.short&&!s&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let s=i.options.filter(n=>!n.hidden);t.push(...s)}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(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>tu(i)).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((i,s)=>Math.max(i,t.subcommandTerm(s).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,s)=>Math.max(i,t.optionTerm(s).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,s)=>Math.max(i,t.optionTerm(s).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,s)=>Math.max(i,t.argumentTerm(s).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let s=e.parent;s;s=s.parent)i=s.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),s=t.helpWidth||80,n=2,o=2;function a(D,E){if(E){let C=`${D.padEnd(i+o)}${E}`;return t.wrap(C,s-n,i+o)}return D}function u(D){return D.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(n))}let l=[`Usage: ${t.commandUsage(e)}`,""],c=t.commandDescription(e);c.length>0&&(l=l.concat([t.wrap(c,s,0),""]));let h=t.visibleArguments(e).map(D=>a(t.argumentTerm(D),t.argumentDescription(D)));h.length>0&&(l=l.concat(["Arguments:",u(h),""]));let d=t.visibleOptions(e).map(D=>a(t.optionTerm(D),t.optionDescription(D)));if(d.length>0&&(l=l.concat(["Options:",u(d),""])),this.showGlobalOptions){let D=t.visibleGlobalOptions(e).map(E=>a(t.optionTerm(E),t.optionDescription(E)));D.length>0&&(l=l.concat(["Global Options:",u(D),""]))}let f=t.visibleCommands(e).map(D=>a(t.subcommandTerm(D),t.subcommandDescription(D)));return f.length>0&&(l=l.concat(["Commands:",u(f),""])),l.join(`
|
|
4
|
+
`)}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,i,s=40){let n=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",o=new RegExp(`[\\n][${n}]+`);if(e.match(o))return e;let a=t-i;if(a<s)return e;let u=e.slice(0,i),l=e.slice(i).replace(`\r
|
|
5
5
|
`,`
|
|
6
|
-
`),
|
|
7
|
-
|.{1,${a-1}}([${
|
|
8
|
-
`?"":(
|
|
9
|
-
`)}};
|
|
6
|
+
`),c=" ".repeat(i),d="\\s\u200B",f=new RegExp(`
|
|
7
|
+
|.{1,${a-1}}([${d}]|$)|[^${d}]+?([${d}]|$)`,"g"),D=l.match(f)||[];return u+D.map((E,C)=>E===`
|
|
8
|
+
`?"":(C>0?c:"")+E.trimEnd()).join(`
|
|
9
|
+
`)}};Tr.Help=Ot});var Tt=p($t=>{var{InvalidArgumentError:ru}=ye(),St=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;let i=su(e);this.short=i.shortFlag,this.long=i.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 typeof e=="string"&&(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)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new ru(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return iu(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},_t=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let s=this.negativeOptions.get(i).presetArg,n=s!==void 0?s:!1;return t.negate===(n===e)}};function iu(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function su(r){let e,t,i=r.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}$t.Option=St;$t.DualOptions=_t});var vr=p(Ir=>{function nu(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let i=0;i<=r.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let s=1;s<=r.length;s++){let n=1;r[s-1]===e[i-1]?n=0:n=1,t[s][i]=Math.min(t[s-1][i]+1,t[s][i-1]+1,t[s-1][i-1]+n),s>1&&i>1&&r[s-1]===e[i-2]&&r[s-2]===e[i-1]&&(t[s][i]=Math.min(t[s][i],t[s-2][i-2]+1))}return t[r.length][e.length]}function ou(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(o=>o.slice(2)));let i=[],s=3,n=.4;return e.forEach(o=>{if(o.length<=1)return;let a=nu(r,o),u=Math.max(r.length,o.length);(u-a)/u>n&&(a<s?(s=a,i=[o]):a===s&&i.push(o))}),i.sort((o,a)=>o.localeCompare(a)),t&&(i=i.map(o=>`--${o}`)),i.length>1?`
|
|
10
10
|
(Did you mean one of ${i.join(", ")}?)`:i.length===1?`
|
|
11
|
-
(Did you mean ${i[0]}?)`:""}
|
|
12
|
-
- specify the name in Command constructor or using .name()`);return t=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
|
|
13
|
-
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new
|
|
14
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=
|
|
11
|
+
(Did you mean ${i[0]}?)`:""}Ir.suggestSimilar=ou});var Pr=p(Nr=>{var uu=require("node:events").EventEmitter,It=require("node:child_process"),Q=require("node:path"),vt=require("node:fs"),R=require("node:process"),{Argument:au,humanReadableArgName:lu}=Ue(),{CommanderError:Lt}=ye(),{Help:cu}=Rt(),{Option:Lr,DualOptions:hu}=Tt(),{suggestSimilar:Br}=vr(),Bt=class r extends uu{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,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._outputConfiguration={writeOut:t=>R.stdout.write(t),writeErr:t=>R.stderr.write(t),getOutHelpWidth:()=>R.stdout.isTTY?R.stdout.columns:void 0,getErrHelpWidth:()=>R.stderr.isTTY?R.stderr.columns:void 0,outputError:(t,i)=>i(t)},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(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let s=t,n=i;typeof s=="object"&&s!==null&&(n=s,s=null),n=n||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(o);return s&&(u.description(s),u._executableHandler=!0),n.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(n.noHelp||n.hidden),u._executableFile=n.executableFile||null,a&&u.arguments(a),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),s?this:u}createCommand(e){return new r(e)}createHelp(){return Object.assign(new cu,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
12
|
+
- specify the name in Command constructor or using .name()`);return t=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 au(e,t)}argument(e,t,i,s){let n=this.createArgument(e,t);return typeof i=="function"?n.default(s).argParser(i):n.default(i),this.addArgument(n),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let 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&&e.defaultValue!==void 0&&e.parseArg===void 0)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(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,i,s]=e.match(/([^ ]+) *(.*)/),n=t??"display help for command",o=this.createCommand(i);return o.helpOption(!1),s&&o.arguments(s),n&&o.description(n),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
+
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new Lt(e,t,i)),R.exit(e)}action(e){let t=i=>{let s=this.registeredArguments.length,n=i.slice(0,s);return this._storeOptionsAsProperties?n[s]=this:n[s]=this.opts(),n.push(this),e.apply(this,n)};return this._actionHandler=t,this}createOption(e,t){return new Lr(e,t)}_callParseArg(e,t,i,s){try{return e.parseArg(t,i)}catch(n){if(n.code==="commander.invalidArgument"){let o=`${s} ${n.message}`;this.error(o,{exitCode:n.exitCode,code:n.code})}throw n}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=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 '${i}'
|
|
14
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=s=>[s.name()].concat(s.aliases()),i=t(e).find(s=>this._findCommand(s));if(i){let s=t(this._findCommand(i)).join("|"),n=t(e).join("|");throw new Error(`cannot add command '${n}' as already have command '${s}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let n=e.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let s=(n,o,a)=>{n==null&&e.presetArg!==void 0&&(n=e.presetArg);let u=this.getOptionValue(i);n!==null&&e.parseArg?n=this._callParseArg(e,n,u,o):n!==null&&e.variadic&&(n=e._concatValue(n,u)),n==null&&(e.negate?n=!1:e.isBoolean()||e.optional?n=!0:n=""),this.setOptionValueWithSource(i,n,a)};return this.on("option:"+t,n=>{let o=`error: option '${e.flags}' argument '${n}' is invalid.`;s(n,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,n=>{let o=`error: option '${e.flags}' value '${n}' from env '${e.envVar}' is invalid.`;s(n,o,"env")}),this}_optionEx(e,t,i,s,n){if(typeof t=="object"&&t instanceof Lr)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,i);if(o.makeOptionMandatory(!!e.mandatory),typeof s=="function")o.default(n).argParser(s);else if(s instanceof RegExp){let a=s;s=(u,l)=>{let c=a.exec(u);return c?c[0]:l},o.default(n).argParser(s)}else o.default(s);return this.addOption(o)}option(e,t,i,s){return this._optionEx({},e,t,i,s)}requiredOption(e,t,i,s){return this._optionEx({mandatory:!0},e,t,i,s)}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,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){R.versions?.electron&&(t.from="electron");let s=R.execArgv??[];(s.includes("-e")||s.includes("--eval")||s.includes("-p")||s.includes("--print"))&&(t.from="eval")}e===void 0&&(e=R.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":R.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=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",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=!1,s=[".js",".ts",".tsx",".mjs",".cjs"];function n(c,h){let d=Q.resolve(c,h);if(vt.existsSync(d))return d;if(s.includes(Q.extname(h)))return;let f=s.find(D=>vt.existsSync(`${d}${D}`));if(f)return`${d}${f}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=vt.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=Q.resolve(Q.dirname(c),a)}if(a){let c=n(a,o);if(!c&&!e._executableFile&&this._scriptPath){let h=Q.basename(this._scriptPath,Q.extname(this._scriptPath));h!==this._name&&(c=n(a,`${h}-${e._name}`))}o=c||o}i=s.includes(Q.extname(o));let u;R.platform!=="win32"?i?(t.unshift(o),t=qr(R.execArgv).concat(t),u=It.spawn(R.argv[0],t,{stdio:"inherit"})):u=It.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=qr(R.execArgv).concat(t),u=It.spawn(R.execPath,t,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(h=>{R.on(h,()=>{u.killed===!1&&u.exitCode===null&&u.kill(h)})});let l=this._exitCallback;u.on("close",c=>{c=c??1,l?l(new Lt(c,"commander.executeSubCommandAsync","(close)")):R.exit(c)}),u.on("error",c=>{if(c.code==="ENOENT"){let h=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",d=`'${o}' does not exist
|
|
15
15
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${
|
|
17
|
+
- ${h}`;throw new Error(d)}else if(c.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)R.exit(1);else{let h=new Lt(1,"commander.executeSubCommandAsync","(error)");h.nestedError=c,l(h)}}),this.runningCommand=u}_dispatchSubcommand(e,t,i){let s=this._findCommand(e);s||this.help({error:!0});let n;return n=this._chainOrCallSubCommandHook(n,s,"preSubcommand"),n=this._chainOrCall(n,()=>{if(s._executableHandler)this._executeSubCommand(s,t.concat(i));else return s._parseCommand(t,i)}),n}_dispatchHelpCommand(e){e||this.help();let 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&&this.args[t]==null&&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(){let e=(i,s,n)=>{let o=s;if(s!==null&&i.parseArg){let a=`error: command-argument value '${s}' is invalid for argument '${i.name()}'.`;o=this._callParseArg(i,s,n,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,s)=>{let n=i.defaultValue;i.variadic?s<this.args.length?(n=this.args.slice(s),i.parseArg&&(n=n.reduce((o,a)=>e(i,a,o),i.defaultValue))):n===void 0&&(n=[]):s<this.args.length&&(n=this.args[s],i.parseArg&&(n=e(i,n,i.defaultValue))),t[s]=n}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,s=[];return this._getCommandAndAncestors().reverse().filter(n=>n._lifeCycleHooks[t]!==void 0).forEach(n=>{n._lifeCycleHooks[t].forEach(o=>{s.push({hookedCommand:n,callback:o})})}),t==="postAction"&&s.reverse(),s.forEach(n=>{i=this._chainOrCall(i,()=>n.callback(n.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let s=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(n=>{s=this._chainOrCall(s,()=>n(this,t))}),s}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.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&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},n=`command:${this.name()}`;if(this._actionHandler){s(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(n,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(n))s(),this._processArguments(),this.parent.emit(n,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():(s(),this._processArguments())}else this.commands.length?(s(),this.help({error:!0})):(s(),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&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let s=i.attributeName();return this.getOptionValue(s)===void 0?!1:this.getOptionValueSource(s)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let s=e.find(n=>i.conflictsWith.includes(n.attributeName()));s&&this._conflictingOption(i,s)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],s=t,n=e.slice();function o(u){return u.length>1&&u[0]==="-"}let a=null;for(;n.length;){let u=n.shift();if(u==="--"){s===i&&s.push(u),s.push(...n);break}if(a&&!o(u)){this.emit(`option:${a.name()}`,u);continue}if(a=null,o(u)){let l=this._findOption(u);if(l){if(l.required){let c=n.shift();c===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,c)}else if(l.optional){let c=null;n.length>0&&!o(n[0])&&(c=n.shift()),this.emit(`option:${l.name()}`,c)}else this.emit(`option:${l.name()}`);a=l.variadic?l:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let l=this._findOption(`-${u[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,u.slice(2)):(this.emit(`option:${l.name()}`),n.unshift(`-${u.slice(2)}`));continue}}if(/^--[^=]+=/.test(u)){let l=u.indexOf("="),c=this._findOption(u.slice(0,l));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,u.slice(l+1));continue}}if(o(u)&&(s=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(u)){t.push(u),n.length>0&&i.push(...n);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){t.push(u),n.length>0&&t.push(...n);break}else if(this._defaultCommandName){i.push(u),n.length>0&&i.push(...n);break}}if(this._passThroughOptions){s.push(u),n.length>0&&s.push(...n);break}s.push(u)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let s=this.options[i].attributeName();e[s]=s===this._versionOptionName?this._version:this[s]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
18
18
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
19
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
20
|
-
`),this.outputHelp({error:!0}));let i=t||{},
|
|
21
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&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");let i=this.parent?._findCommand(e);if(i){let
|
|
22
|
-
Expecting one of '${i.join("', '")}'`);let
|
|
23
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function $t(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],n=s[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}jt.Command=Qe});var Nt=b(S=>{var{Argument:It}=Fe(),{Command:et}=qt(),{CommanderError:dn,InvalidArgumentError:Mt}=se(),{Help:mn}=Ue(),{Option:Lt}=Ke();S.program=new et;S.createCommand=r=>new et(r);S.createOption=(r,e)=>new Lt(r,e);S.createArgument=(r,e)=>new It(r,e);S.Command=et;S.Option=Lt;S.Argument=It;S.Help=mn;S.CommanderError=dn;S.InvalidArgumentError=Mt;S.InvalidOptionArgumentError=Mt});var Ae=b((Co,nt)=>{var xe=process||{},Qt=xe.argv||[],we=xe.env||{},Cn=!(we.NO_COLOR||Qt.includes("--no-color"))&&(!!we.FORCE_COLOR||Qt.includes("--color")||xe.platform==="win32"||(xe.stdout||{}).isTTY&&we.TERM!=="dumb"||!!we.CI),bn=(r,e,t=r)=>i=>{let n=""+i,s=n.indexOf(e,r.length);return~s?r+En(n,e,t,s)+e:r+n+e},En=(r,e,t,i)=>{let n="",s=0;do n+=r.substring(s,i)+t,s=i+e.length,i=r.indexOf(e,s);while(~i);return n+r.substring(s)},er=(r=Cn)=>{let e=r?bn:()=>String;return{isColorSupported:r,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};nt.exports=er();nt.exports.createColors=er});var _e=b((Fo,ir)=>{var st=[],rr=0,w=(r,e)=>{rr>=e&&st.push(r)};w.WARN=1;w.INFO=2;w.DEBUG=3;w.reset=()=>{st=[]};w.setDebugLevel=r=>{rr=r};w.warn=r=>w(r,w.WARN);w.info=r=>w(r,w.INFO);w.debug=r=>w(r,w.DEBUG);w.debugMessages=()=>st;ir.exports=w});var sr=b((yo,nr)=>{"use strict";nr.exports=({onlyFirst:r=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,r?void 0:"g")}});var ur=b((wo,or)=>{"use strict";var Fn=sr();or.exports=r=>typeof r=="string"?r.replace(Fn(),""):r});var lr=b((xo,ot)=>{"use strict";var ar=r=>Number.isNaN(r)?!1:r>=4352&&(r<=4447||r===9001||r===9002||11904<=r&&r<=12871&&r!==12351||12880<=r&&r<=19903||19968<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65131||65281<=r&&r<=65376||65504<=r&&r<=65510||110592<=r&&r<=110593||127488<=r&&r<=127569||131072<=r&&r<=262141);ot.exports=ar;ot.exports.default=ar});var hr=b((Ao,cr)=>{"use strict";cr.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var fr=b((_o,ut)=>{"use strict";var yn=ur(),wn=lr(),xn=hr(),Dr=r=>{if(typeof r!="string"||r.length===0||(r=yn(r),r.length===0))return 0;r=r.replace(xn()," ");let e=0;for(let t=0;t<r.length;t++){let i=r.codePointAt(t);i<=31||i>=127&&i<=159||i>=768&&i<=879||(i>65535&&t++,e+=wn(i)?2:1)}return e};ut.exports=Dr;ut.exports.default=Dr});var at=b((Oo,gr)=>{var dr=fr();function Oe(r){return r?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function $(r){let e=Oe();return(""+r).replace(e,"").split(`
|
|
24
|
-
`).reduce(function(n
|
|
25
|
-
`);let
|
|
26
|
-
`)!=-1,i=this._styles,
|
|
27
|
-
`))}wrapLines(e){let t=
|
|
20
|
+
`),this.outputHelp({error:!0}));let i=t||{},s=i.exitCode||1,n=i.code||"commander.error";this._exit(s,n,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in R.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,R.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new hu(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(s=>!t(s)).forEach(s=>{this.setOptionValueWithSource(s,i.implied[s],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=o=>{let a=o.attributeName(),u=this.getOptionValue(a),l=this.options.find(h=>h.negate&&a===h.attributeName()),c=this.options.find(h=>!h.negate&&a===h.attributeName());return l&&(l.presetArg===void 0&&u===!1||l.presetArg!==void 0&&u===l.presetArg)?l:c||o},s=o=>{let a=i(o),u=a.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},n=`error: ${s(e)} cannot be used with ${s(t)}`;this.error(n,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let s=[],n=this;do{let o=n.createHelp().visibleOptions(n).filter(a=>a.long).map(a=>a.long);s=s.concat(o),n=n.parent}while(n&&!n._enablePositionalOptions);t=Br(e,s)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let s=[];this.createHelp().visibleCommands(this).forEach(n=>{s.push(n.name()),n.alias()&&s.push(n.alias())}),t=Br(e,s)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let s=this.createOption(t,i);return this._versionOptionName=s.attributeName(),this._registerOption(s),this.on("option:"+s.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
21
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&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");let i=this.parent?._findCommand(e);if(i){let s=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${s}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>lu(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=Q.basename(e,Q.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},i;return t.error?i=s=>this._outputConfiguration.writeErr(s):i=s=>this._outputConfiguration.writeOut(s),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(n=>n.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let s=this.helpInformation(i);if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(n=>n.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=R.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
|
+
Expecting one of '${i.join("', '")}'`);let s=`${e}Help`;return this.on(s,n=>{let o;typeof t=="function"?o=t({error:n.error,command:n.command}):o=t,o&&n.write(`${o}
|
|
23
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(s=>t.is(s))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function qr(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",s="9229",n;return(n=e.match(/^(--inspect(-brk)?)$/))!==null?t=n[1]:(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=n[1],/^\d+$/.test(n[3])?s=n[3]:i=n[3]):(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=n[1],i=n[3],s=n[4]),t&&s!=="0"?`${t}=${i}:${parseInt(s)+1}`:e})}Nr.Command=Bt});var Hr=p(k=>{var{Argument:kr}=Ue(),{Command:qt}=Pr(),{CommanderError:fu,InvalidArgumentError:jr}=ye(),{Help:Du}=Rt(),{Option:Mr}=Tt();k.program=new qt;k.createCommand=r=>new qt(r);k.createOption=(r,e)=>new Mr(r,e);k.createArgument=(r,e)=>new kr(r,e);k.Command=qt;k.Option=Mr;k.Argument=kr;k.Help=Du;k.CommanderError=fu;k.InvalidArgumentError=jr;k.InvalidOptionArgumentError=jr});var Kr=p((Nf,jt)=>{var ze=process||{},Xr=ze.argv||[],We=ze.env||{},du=!(We.NO_COLOR||Xr.includes("--no-color"))&&(!!We.FORCE_COLOR||Xr.includes("--color")||ze.platform==="win32"||(ze.stdout||{}).isTTY&&We.TERM!=="dumb"||!!We.CI),pu=(r,e,t=r)=>i=>{let s=""+i,n=s.indexOf(e,r.length);return~n?r+mu(s,e,t,n)+e:r+s+e},mu=(r,e,t,i)=>{let s="",n=0;do s+=r.substring(n,i)+t,n=i+e.length,i=r.indexOf(e,n);while(~i);return s+r.substring(n)},Jr=(r=du)=>{let e=r?pu:()=>String;return{isColorSupported:r,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};jt.exports=Jr();jt.exports.createColors=Jr});var Je=p((Jf,ni)=>{var Ht=[],si=0,v=(r,e)=>{si>=e&&Ht.push(r)};v.WARN=1;v.INFO=2;v.DEBUG=3;v.reset=()=>{Ht=[]};v.setDebugLevel=r=>{si=r};v.warn=r=>v(r,v.WARN);v.info=r=>v(r,v.INFO);v.debug=r=>v(r,v.DEBUG);v.debugMessages=()=>Ht;ni.exports=v});var ui=p((Kf,oi)=>{"use strict";oi.exports=({onlyFirst:r=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,r?void 0:"g")}});var li=p((Yf,ai)=>{"use strict";var Au=ui();ai.exports=r=>typeof r=="string"?r.replace(Au(),""):r});var hi=p((Zf,Vt)=>{"use strict";var ci=r=>Number.isNaN(r)?!1:r>=4352&&(r<=4447||r===9001||r===9002||11904<=r&&r<=12871&&r!==12351||12880<=r&&r<=19903||19968<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65131||65281<=r&&r<=65376||65504<=r&&r<=65510||110592<=r&&r<=110593||127488<=r&&r<=127569||131072<=r&&r<=262141);Vt.exports=ci;Vt.exports.default=ci});var Di=p((Qf,fi)=>{"use strict";fi.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var pi=p((eD,Ut)=>{"use strict";var Ou=li(),Ru=hi(),Su=Di(),di=r=>{if(typeof r!="string"||r.length===0||(r=Ou(r),r.length===0))return 0;r=r.replace(Su()," ");let e=0;for(let t=0;t<r.length;t++){let i=r.codePointAt(t);i<=31||i>=127&&i<=159||i>=768&&i<=879||(i>65535&&t++,e+=Ru(i)?2:1)}return e};Ut.exports=di;Ut.exports.default=di});var Gt=p((tD,Ci)=>{var mi=pi();function Ke(r){return r?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function X(r){let e=Ke();return(""+r).replace(e,"").split(`
|
|
24
|
+
`).reduce(function(s,n){return mi(n)>s?mi(n):s},0)}function Re(r,e){return Array(e+1).join(r)}function _u(r,e,t,i){let s=X(r);if(e+1>=s){let n=e-s;switch(i){case"right":{r=Re(t,n)+r;break}case"center":{let o=Math.ceil(n/2),a=n-o;r=Re(t,a)+r+Re(t,o);break}default:{r=r+Re(t,n);break}}}return r}var he={};function Se(r,e,t){e="\x1B["+e+"m",t="\x1B["+t+"m",he[e]={set:r,to:!0},he[t]={set:r,to:!1},he[r]={on:e,off:t}}Se("bold",1,22);Se("italics",3,23);Se("underline",4,24);Se("inverse",7,27);Se("strikethrough",9,29);function gi(r,e){let t=e[1]?parseInt(e[1].split(";")[0]):0;if(t>=30&&t<=39||t>=90&&t<=97){r.lastForegroundAdded=e[0];return}if(t>=40&&t<=49||t>=100&&t<=107){r.lastBackgroundAdded=e[0];return}if(t===0){for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&delete r[s];return}let i=he[e[0]];i&&(r[i.set]=i.to)}function $u(r){let e=Ke(!0),t=e.exec(r),i={};for(;t!==null;)gi(i,t),t=e.exec(r);return i}function Ei(r,e){let t=r.lastBackgroundAdded,i=r.lastForegroundAdded;return delete r.lastBackgroundAdded,delete r.lastForegroundAdded,Object.keys(r).forEach(function(s){r[s]&&(e+=he[s].off)}),t&&t!="\x1B[49m"&&(e+="\x1B[49m"),i&&i!="\x1B[39m"&&(e+="\x1B[39m"),e}function Tu(r,e){let t=r.lastBackgroundAdded,i=r.lastForegroundAdded;return delete r.lastBackgroundAdded,delete r.lastForegroundAdded,Object.keys(r).forEach(function(s){r[s]&&(e=he[s].on+e)}),t&&t!="\x1B[49m"&&(e=t+e),i&&i!="\x1B[39m"&&(e=i+e),e}function Iu(r,e){if(r.length===X(r))return r.substr(0,e);for(;X(r)>e;)r=r.slice(0,-1);return r}function vu(r,e){let t=Ke(!0),i=r.split(Ke()),s=0,n=0,o="",a,u={};for(;n<e;){a=t.exec(r);let l=i[s];if(s++,n+X(l)>e&&(l=Iu(l,e-n)),o+=l,n+=X(l),n<e){if(!a)break;o+=a[0],gi(u,a)}}return Ei(u,o)}function Lu(r,e,t){if(t=t||"\u2026",X(r)<=e)return r;e-=X(t);let s=vu(r,e);s+=t;let n="\x1B]8;;\x07";return r.includes(n)&&!s.includes(n)&&(s+=n),s}function Bu(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function qu(r,e){r=r||{},e=e||Bu();let t=Object.assign({},e,r);return t.chars=Object.assign({},e.chars,r.chars),t.style=Object.assign({},e.style,r.style),t}function Nu(r,e){let t=[],i=e.split(/(\s+)/g),s=[],n=0,o;for(let a=0;a<i.length;a+=2){let u=i[a],l=n+X(u);n>0&&o&&(l+=o.length),l>r?(n!==0&&t.push(s.join("")),s=[u],n=X(u)):(s.push(o||"",u),n=l),o=i[a+1]}return n&&t.push(s.join("")),t}function Pu(r,e){let t=[],i="";function s(o,a){for(i.length&&a&&(i+=a),i+=o;i.length>r;)t.push(i.slice(0,r)),i=i.slice(r)}let n=e.split(/(\s+)/g);for(let o=0;o<n.length;o+=2)s(n[o],o&&n[o-1]);return i.length&&t.push(i),t}function ku(r,e,t=!0){let i=[];e=e.split(`
|
|
25
|
+
`);let s=t?Nu:Pu;for(let n=0;n<e.length;n++)i.push.apply(i,s(r,e[n]));return i}function ju(r){let e={},t=[];for(let i=0;i<r.length;i++){let s=Tu(e,r[i]);e=$u(s);let n=Object.assign({},e);t.push(Ei(n,s))}return t}function Mu(r,e){return["\x1B]","8",";",";",r||e,"\x07",e,"\x1B]","8",";",";","\x07"].join("")}Ci.exports={strlen:X,repeat:Re,pad:_u,truncate:Lu,mergeOptions:qu,wordWrap:ku,colorizeLines:ju,hyperlink:Mu}});var yi=p((rD,Fi)=>{var wi={};Fi.exports=wi;var bi={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(bi).forEach(function(r){var e=bi[r],t=wi[r]=[];t.open="\x1B["+e[0]+"m",t.close="\x1B["+e[1]+"m"})});var Ai=p((iD,xi)=>{"use strict";xi.exports=function(r,e){e=e||process.argv;var t=e.indexOf("--"),i=/^-{1,2}/.test(r)?"":"--",s=e.indexOf(i+r);return s!==-1&&(t===-1?!0:s<t)}});var Ri=p((sD,Oi)=>{"use strict";var Hu=require("os"),U=Ai(),B=process.env,fe=void 0;U("no-color")||U("no-colors")||U("color=false")?fe=!1:(U("color")||U("colors")||U("color=true")||U("color=always"))&&(fe=!0);"FORCE_COLOR"in B&&(fe=B.FORCE_COLOR.length===0||parseInt(B.FORCE_COLOR,10)!==0);function Vu(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function Uu(r){if(fe===!1)return 0;if(U("color=16m")||U("color=full")||U("color=truecolor"))return 3;if(U("color=256"))return 2;if(r&&!r.isTTY&&fe!==!0)return 0;var e=fe?1:0;if(process.platform==="win32"){var t=Hu.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in B)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(s){return s in B})||B.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in B)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(B.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in B){var i=parseInt((B.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(B.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(B.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(B.TERM)||"COLORTERM"in B?1:(B.TERM==="dumb",e)}function Wt(r){var e=Uu(r);return Vu(e)}Oi.exports={supportsColor:Wt,stdout:Wt(process.stdout),stderr:Wt(process.stderr)}});var _i=p((nD,Si)=>{Si.exports=function(e,t){var i="";e=e||"Run the trap, drop the bass",e=e.split("");var s={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(n){n=n.toLowerCase();var o=s[n]||[" "],a=Math.floor(Math.random()*o.length);typeof s[n]<"u"?i+=s[n][a]:i+=n}),i}});var Ti=p((oD,$i)=>{$i.exports=function(e,t){e=e||" he is here ";var i={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},s=[].concat(i.up,i.down,i.mid);function n(u){var l=Math.floor(Math.random()*u);return l}function o(u){var l=!1;return s.filter(function(c){l=c===u}),l}function a(u,l){var c="",h,d;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",u=u.split("");for(d in u)if(!o(d)){switch(c=c+u[d],h={up:0,down:0,mid:0},l.size){case"mini":h.up=n(8),h.mid=n(2),h.down=n(8);break;case"maxi":h.up=n(16)+3,h.mid=n(4)+1,h.down=n(64)+3;break;default:h.up=n(8)+1,h.mid=n(6)/2,h.down=n(8)+1;break}var f=["up","mid","down"];for(var D in f)for(var E=f[D],C=0;C<=h[E];C++)l[E]&&(c=c+i[E][n(i[E].length)])}return c}return a(e,t)}});var vi=p((uD,Ii)=>{Ii.exports=function(r){return function(e,t,i){if(e===" ")return e;switch(t%3){case 0:return r.red(e);case 1:return r.white(e);case 2:return r.blue(e)}}}});var Bi=p((aD,Li)=>{Li.exports=function(r){return function(e,t,i){return t%2===0?e:r.inverse(e)}}});var Ni=p((lD,qi)=>{qi.exports=function(r){var e=["red","yellow","green","blue","magenta"];return function(t,i,s){return t===" "?t:r[e[i++%e.length]](t)}}});var ki=p((cD,Pi)=>{Pi.exports=function(r){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(t,i,s){return t===" "?t:r[e[Math.round(Math.random()*(e.length-2))]](t)}}});var Gi=p((fD,Ui)=>{var F={};Ui.exports=F;F.themes={};var Gu=require("util"),ne=F.styles=yi(),Mi=Object.defineProperties,Wu=new RegExp(/[\r\n]+/g);F.supportsColor=Ri().supportsColor;typeof F.enabled>"u"&&(F.enabled=F.supportsColor()!==!1);F.enable=function(){F.enabled=!0};F.disable=function(){F.enabled=!1};F.stripColors=F.strip=function(r){return(""+r).replace(/\x1B\[\d+m/g,"")};var hD=F.stylize=function(e,t){if(!F.enabled)return e+"";var i=ne[t];return!i&&t in F?F[t](e):i.open+e+i.close},zu=/[|\\{}()[\]^$+*?.]/g,Xu=function(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(zu,"\\$&")};function Hi(r){var e=function t(){return Ku.apply(t,arguments)};return e._styles=r,e.__proto__=Ju,e}var Vi=(function(){var r={};return ne.grey=ne.gray,Object.keys(ne).forEach(function(e){ne[e].closeRe=new RegExp(Xu(ne[e].close),"g"),r[e]={get:function(){return Hi(this._styles.concat(e))}}}),r})(),Ju=Mi(function(){},Vi);function Ku(){var r=Array.prototype.slice.call(arguments),e=r.map(function(o){return o!=null&&o.constructor===String?o:Gu.inspect(o)}).join(" ");if(!F.enabled||!e)return e;for(var t=e.indexOf(`
|
|
26
|
+
`)!=-1,i=this._styles,s=i.length;s--;){var n=ne[i[s]];e=n.open+e.replace(n.closeRe,n.open)+n.close,t&&(e=e.replace(Wu,function(o){return n.close+o+n.open}))}return e}F.setTheme=function(r){if(typeof r=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in r)(function(t){F[t]=function(i){if(typeof r[t]=="object"){var s=i;for(var n in r[t])s=F[r[t][n]](s);return s}return F[r[t]](i)}})(e)};function Yu(){var r={};return Object.keys(Vi).forEach(function(e){r[e]={get:function(){return Hi([e])}}}),r}var Zu=function(e,t){var i=t.split("");return i=i.map(e),i.join("")};F.trap=_i();F.zalgo=Ti();F.maps={};F.maps.america=vi()(F);F.maps.zebra=Bi()(F);F.maps.rainbow=Ni()(F);F.maps.random=ki()(F);for(ji in F.maps)(function(r){F[r]=function(e){return Zu(F.maps[r],e)}})(ji);var ji;Mi(F,Yu())});var zi=p((DD,Wi)=>{var Qu=Gi();Wi.exports=Qu});var Yi=p((dD,Ye)=>{var{info:ea,debug:Ki}=Je(),P=Gt(),Xt=class r{constructor(e){this.setOptions(e),this.x=null,this.y=null}setOptions(e){["boolean","number","bigint","string"].indexOf(typeof e)!==-1&&(e={content:""+e}),e=e||{},this.options=e;let t=e.content;if(["boolean","number","bigint","string"].indexOf(typeof t)!==-1)this.content=String(t);else if(!t)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof t);this.colSpan=e.colSpan||1,this.rowSpan=e.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(e,t){this.cells=t;let i=this.options.chars||{},s=e.chars,n=this.chars={};ra.forEach(function(u){zt(i,s,u,n)}),this.truncate=this.options.truncate||e.truncate;let o=this.options.style=this.options.style||{},a=e.style;zt(o,a,"padding-left",this),zt(o,a,"padding-right",this),this.head=o.head||a.head,this.border=o.border||a.border,this.fixedWidth=e.colWidths[this.x],this.lines=this.computeLines(e),this.desiredWidth=P.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(e){let t=e.wordWrap||e.textWrap,{wordWrap:i=t}=this.options;if(this.fixedWidth&&i){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let o=1;for(;o<this.colSpan;)this.fixedWidth+=e.colWidths[this.x+o],o++}let{wrapOnWordBoundary:s=!0}=e,{wrapOnWordBoundary:n=s}=this.options;return this.wrapLines(P.wordWrap(this.fixedWidth,this.content,n))}return this.wrapLines(this.content.split(`
|
|
27
|
+
`))}wrapLines(e){let t=P.colorizeLines(e);return this.href?t.map(i=>P.hyperlink(this.href,i)):t}init(e){let t=this.x,i=this.y;this.widths=e.colWidths.slice(t,t+this.colSpan),this.heights=e.rowHeights.slice(i,i+this.rowSpan),this.width=this.widths.reduce(Ji,-1),this.height=this.heights.reduce(Ji,-1),this.hAlign=this.options.hAlign||e.colAligns[t],this.vAlign=this.options.vAlign||e.rowAligns[i],this.drawRight=t+this.colSpan==e.colWidths.length}draw(e,t){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let i=P.truncate(this.content,10,this.truncate);e||ea(`${this.y}-${this.x}: ${this.rowSpan-e}x${this.colSpan} Cell ${i}`);let s=Math.max(this.height-this.lines.length,0),n;switch(this.vAlign){case"center":n=Math.ceil(s/2);break;case"bottom":n=s;break;default:n=0}if(e<n||e>=n+this.lines.length)return this.drawEmpty(this.drawRight,t);let o=this.lines.length>this.height&&e+1>=this.height;return this.drawLine(e-n,this.drawRight,o,t)}drawTop(e){let t=[];return this.cells?this.widths.forEach(function(i,s){t.push(this._topLeftChar(s)),t.push(P.repeat(this.chars[this.y==0?"top":"mid"],i))},this):(t.push(this._topLeftChar(0)),t.push(P.repeat(this.chars[this.y==0?"top":"mid"],this.width))),e&&t.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",t.join(""))}_topLeftChar(e){let t=this.x+e,i;if(this.y==0)i=t==0?"topLeft":e==0?"topMid":"top";else if(t==0)i="leftMid";else if(i=e==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][t]instanceof r.ColSpanCell&&(i=e==0?"topMid":"mid"),e==0)){let n=1;for(;this.cells[this.y][t-n]instanceof r.ColSpanCell;)n++;this.cells[this.y][t-n]instanceof r.RowSpanCell&&(i="leftMid")}return this.chars[i]}wrapWithStyleColors(e,t){if(this[e]&&this[e].length)try{let i=zi();for(let s=this[e].length-1;s>=0;s--)i=i[this[e][s]];return i(t)}catch{return t}else return t}drawLine(e,t,i,s){let n=this.chars[this.x==0?"left":"middle"];if(this.x&&s&&this.cells){let d=this.cells[this.y+s][this.x-1];for(;d instanceof _e;)d=this.cells[d.y][d.x-1];d instanceof $e||(n=this.chars.rightMid)}let o=P.repeat(" ",this.paddingLeft),a=t?this.chars.right:"",u=P.repeat(" ",this.paddingRight),l=this.lines[e],c=this.width-(this.paddingLeft+this.paddingRight);i&&(l+=this.truncate||"\u2026");let h=P.truncate(l,c,this.truncate);return h=P.pad(h,c," ",this.hAlign),h=o+h+u,this.stylizeLine(n,h,a)}stylizeLine(e,t,i){return e=this.wrapWithStyleColors("border",e),i=this.wrapWithStyleColors("border",i),this.y===0&&(t=this.wrapWithStyleColors("head",t)),e+t+i}drawBottom(e){let t=this.chars[this.x==0?"bottomLeft":"bottomMid"],i=P.repeat(this.chars.bottom,this.width),s=e?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",t+i+s)}drawEmpty(e,t){let i=this.chars[this.x==0?"left":"middle"];if(this.x&&t&&this.cells){let o=this.cells[this.y+t][this.x-1];for(;o instanceof _e;)o=this.cells[o.y][o.x-1];o instanceof $e||(i=this.chars.rightMid)}let s=e?this.chars.right:"",n=P.repeat(" ",this.width);return this.stylizeLine(i,n,s)}},_e=class{constructor(){}draw(e){return typeof e=="number"&&Ki(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}},$e=class{constructor(e){this.originalCell=e}init(e){let t=this.y,i=this.originalCell.y;this.cellOffset=t-i,this.offset=ta(e.rowHeights,i,this.cellOffset)}draw(e){return e=="top"?this.originalCell.draw(this.offset,this.cellOffset):e=="bottom"?this.originalCell.draw("bottom"):(Ki(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+e))}mergeTableOptions(){}};function Xi(...r){return r.filter(e=>e!=null).shift()}function zt(r,e,t,i){let s=t.split("-");s.length>1?(s[1]=s[1].charAt(0).toUpperCase()+s[1].substr(1),s=s.join(""),i[s]=Xi(r[s],r[t],e[s],e[t])):i[t]=Xi(r[t],e[t])}function ta(r,e,t){let i=r[e];for(let s=1;s<t;s++)i+=1+r[e+s];return i}function Ji(r,e){return r+e+1}var ra=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];Ye.exports=Xt;Ye.exports.ColSpanCell=_e;Ye.exports.RowSpanCell=$e});var es=p((pD,Qi)=>{var{warn:ia,debug:sa}=Je(),Jt=Yi(),{ColSpanCell:na,RowSpanCell:oa}=Jt;(function(){function r(f,D){return f[D]>0?r(f,D+1):D}function e(f){let D={};f.forEach(function(E,C){let x=0;E.forEach(function(y){y.y=C,y.x=C?r(D,x):x;let L=y.rowSpan||1,N=y.colSpan||1;if(L>1)for(let Fe=0;Fe<N;Fe++)D[y.x+Fe]=L;x=y.x+N}),Object.keys(D).forEach(y=>{D[y]--,D[y]<1&&delete D[y]})})}function t(f){let D=0;return f.forEach(function(E){E.forEach(function(C){D=Math.max(D,C.x+(C.colSpan||1))})}),D}function i(f){return f.length}function s(f,D){let E=f.y,C=f.y-1+(f.rowSpan||1),x=D.y,y=D.y-1+(D.rowSpan||1),L=!(E>y||x>C),N=f.x,Fe=f.x-1+(f.colSpan||1),Uo=D.x,Go=D.x-1+(D.colSpan||1),Wo=!(N>Go||Uo>Fe);return L&&Wo}function n(f,D,E){let C=Math.min(f.length-1,E),x={x:D,y:E};for(let y=0;y<=C;y++){let L=f[y];for(let N=0;N<L.length;N++)if(s(x,L[N]))return!0}return!1}function o(f,D,E,C){for(let x=E;x<C;x++)if(n(f,x,D))return!1;return!0}function a(f){f.forEach(function(D,E){D.forEach(function(C){for(let x=1;x<C.rowSpan;x++){let y=new oa(C);y.x=C.x,y.y=C.y+x,y.colSpan=C.colSpan,l(y,f[E+x])}})})}function u(f){for(let D=f.length-1;D>=0;D--){let E=f[D];for(let C=0;C<E.length;C++){let x=E[C];for(let y=1;y<x.colSpan;y++){let L=new na;L.x=x.x+y,L.y=x.y,E.splice(C+1,0,L)}}}}function l(f,D){let E=0;for(;E<D.length&&D[E].x<f.x;)E++;D.splice(E,0,f)}function c(f){let D=i(f),E=t(f);sa(`Max rows: ${D}; Max cols: ${E}`);for(let C=0;C<D;C++)for(let x=0;x<E;x++)if(!n(f,x,C)){let y={x,y:C,colSpan:1,rowSpan:1};for(x++;x<E&&!n(f,x,C);)y.colSpan++,x++;let L=C+1;for(;L<D&&o(f,L,y.x,y.x+y.colSpan);)y.rowSpan++,L++;let N=new Jt(y);N.x=y.x,N.y=y.y,ia(`Missing cell at ${N.y}-${N.x}.`),l(N,f[C])}}function h(f){return f.map(function(D){if(!Array.isArray(D)){let E=Object.keys(D)[0];D=D[E],Array.isArray(D)?(D=D.slice(),D.unshift(E)):D=[E,D]}return D.map(function(E){return new Jt(E)})})}function d(f){let D=h(f);return e(D),c(D),a(D),u(D),D}Qi.exports={makeTableLayout:d,layoutTable:e,addRowSpanCells:a,maxWidth:t,fillInTable:c,computeWidths:Zi("colSpan","desiredWidth","x",1),computeHeights:Zi("rowSpan","desiredHeight","y",1)}})();function Zi(r,e,t,i){return function(s,n){let o=[],a=[],u={};n.forEach(function(l){l.forEach(function(c){(c[r]||1)>1?a.push(c):o[c[t]]=Math.max(o[c[t]]||0,c[e]||0,i)})}),s.forEach(function(l,c){typeof l=="number"&&(o[c]=l)});for(let l=a.length-1;l>=0;l--){let c=a[l],h=c[r],d=c[t],f=o[d],D=typeof s[d]=="number"?0:1;if(typeof f=="number")for(let E=1;E<h;E++)f+=1+o[d+E],typeof s[d+E]!="number"&&D++;else f=e==="desiredWidth"?c.desiredWidth-1:1,(!u[d]||u[d]<f)&&(u[d]=f);if(c[e]>f){let E=0;for(;D>0&&c[e]>f;){if(typeof s[d+E]!="number"){let C=Math.round((c[e]-f)/D);f+=C,o[d+E]+=C,D--}E++}}}Object.assign(s,o,u);for(let l=0;l<s.length;l++)s[l]=Math.max(i,s[l]||0)}}});var rs=p((mD,ts)=>{var ee=Je(),ua=Gt(),Kt=es(),Ze=class extends Array{constructor(e){super();let t=ua.mergeOptions(e);if(Object.defineProperty(this,"options",{value:t,enumerable:t.debug}),t.debug){switch(typeof t.debug){case"boolean":ee.setDebugLevel(ee.WARN);break;case"number":ee.setDebugLevel(t.debug);break;case"string":ee.setDebugLevel(parseInt(t.debug,10));break;default:ee.setDebugLevel(ee.WARN),ee.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof t.debug}`)}Object.defineProperty(this,"messages",{get(){return ee.debugMessages()}})}}toString(){let e=this,t=this.options.head&&this.options.head.length;t?(e=[this.options.head],this.length&&e.push.apply(e,this)):this.options.style.head=[];let i=Kt.makeTableLayout(e);i.forEach(function(n){n.forEach(function(o){o.mergeTableOptions(this.options,i)},this)},this),Kt.computeWidths(this.options.colWidths,i),Kt.computeHeights(this.options.rowHeights,i),i.forEach(function(n){n.forEach(function(o){o.init(this.options)},this)},this);let s=[];for(let n=0;n<i.length;n++){let o=i[n],a=this.options.rowHeights[n];(n===0||!this.options.style.compact||n==1&&t)&&Yt(o,"top",s);for(let u=0;u<a;u++)Yt(o,u,s);n+1==i.length&&Yt(o,"bottom",s)}return s.join(`
|
|
28
28
|
`)}get width(){return this.toString().split(`
|
|
29
|
-
`)[0].length}};Be.reset=()=>L.reset();function dt(r,e,t){let i=[];r.forEach(function(s){i.push(s.draw(e))});let n=i.join("");n.length&&t.push(n)}Qr.exports=Be});var ri=b((Vo,ti)=>{ti.exports=ei()});var Ht=V(Nt(),1),{program:Qs,createCommand:eo,createArgument:to,createOption:ro,CommanderError:io,InvalidArgumentError:no,InvalidOptionArgumentError:so,Command:Pt,Argument:oo,Option:uo,Help:ao}=Ht.default;var J=require("node:fs/promises"),oe=V(require("node:path"),1),tt=V(require("node:os"),1);async function ue({configPath:r=Wt()}={}){try{return JSON.parse(await(0,J.readFile)(r,"utf8"))}catch(e){if(e.code==="ENOENT")return{};throw e}}async function Vt(r,{configPath:e=Wt()}={}){await(0,J.mkdir)(oe.default.dirname(e),{recursive:!0}),await(0,J.writeFile)(e,`${JSON.stringify(r,null,2)}
|
|
30
|
-
`,{encoding:"utf8",mode:384})}function
|
|
31
|
-
`)}),e.command("list").description("Show local CLI configuration").action(async()=>{let t=await
|
|
32
|
-
`),process.stdout.write(
|
|
33
|
-
`)})
|
|
34
|
-
`)}function ss(r,{httpStatus:e}={}){if(!r||typeof r!="object"||typeof r.code!="number")throw new T("Invalid server response format",{code:"invalid_response",exitCode:5,status:e,data:r});if(r.code!==200)throw new T(r.message||"Request failed",{code:ai(r.code),exitCode:rt(r.code),status:r.code,data:r});return r}async function k(r){let e;try{e=await r.json()}catch(t){throw new T("Invalid server response format",{code:"invalid_response",exitCode:5,status:r.status,cause:t})}if(r.status<200||r.status>=300)throw new T(e?.message||`Request failed with status code ${r.status}`,{code:ai(r.status),exitCode:rt(r.status),status:r.status,data:e});return ss(e,{httpStatus:r.status})}function ai(r){return r===401||r===403?"auth_error":r===404?"not_found":r===409?"state_conflict":r===400?"validation_error":"server_error"}var U=class{constructor(e){this.client=e}listMessages(e={}){return this.client.get("/v1/message/list",{searchParams:e}).then(k)}getMessage(e){return this.client.get("/v1/message/get",{searchParams:{messageUid:e}}).then(k)}listenMessages(e={}){return this.client.get("/v1/message/listen",{searchParams:e}).then(k)}replyMessage(e,t){return this.client.post("/v1/message/reply",{searchParams:{messageUid:e},json:t}).then(k)}};var ve=class{constructor(e){this.client=e}sendEmail(e){return this.client.post("/v1/mail/send",{json:e}).then(k)}};var j=class extends Error{name="KyError";get isKyError(){return!0}};var Z=class extends j{name="HTTPError";response;request;options;data;constructor(e,t,i){let n=e.status||e.status===0?e.status:"",s=e.statusText??"",o=`${n} ${s}`.trim(),a=o?`status code ${o}`:"an unknown error";super(`Request failed with ${a}: ${t.method} ${t.url}`),this.response=e,this.request=t,this.options=i}};var Q=class extends j{name="NetworkError";request;constructor(e,t){super(`Request failed due to a network error: ${e.method} ${e.url}`,t),this.request=e}};var ee=class extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{typeof e=="string"?t=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(t=e.message)}catch{}super(t),this.value=e}};var G=class extends j{name="ForceRetryError";customDelay;code;customRequest;constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new ee(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};var ke=class extends Error{name="SchemaValidationError";issues;constructor(e){super("Response schema validation failed"),this.issues=e}};var R=class extends j{name="TimeoutError";request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}};var Ct=(()=>{let r=!1,e=!1,t=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(t&&i)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return r&&!e})(),li=typeof globalThis.AbortController=="function",$e=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",ci=typeof globalThis.ReadableStream=="function",hi=typeof globalThis.FormData=="function",je=["get","post","put","patch","head","delete"],os=()=>{};os();var Di={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},te=2147483647,fi=40,qe=Symbol("stop"),fe=class{options;constructor(e){this.options=e}},di=r=>new fe(r),mi={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},pi={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var Ie=new TextEncoder,us=r=>{if(!r)return 0;if(r instanceof FormData){let e=0;for(let[t,i]of r)e+=fi,e+=Ie.encode(`Content-Disposition: form-data; name="${t}"`).byteLength,e+=typeof i=="string"?Ie.encode(i).byteLength:i.size;return e}return r instanceof Blob?r.size:r instanceof ArrayBuffer||ArrayBuffer.isView(r)?r.byteLength:typeof r=="string"?Ie.encode(r).byteLength:r instanceof URLSearchParams?Ie.encode(r.toString()).byteLength:0},gi=(r,e,t)=>{let i,n=0;return r.pipeThrough(new TransformStream({transform(s,o){if(o.enqueue(s),i){n+=i.byteLength;let a=e===0?0:n/e;a>=1&&(a=1-Number.EPSILON),t?.({percent:a,totalBytes:Math.max(e,n),transferredBytes:n},i)}i=s},flush(){i&&(n+=i.byteLength,t?.({percent:1,totalBytes:Math.max(e,n),transferredBytes:n},i))}}))},Ci=(r,e)=>{if(!r.body)return r;let t={status:r.status,statusText:r.statusText,headers:r.headers};if(r.status===204)return new Response(null,t);let i=Math.max(0,Number(r.headers.get("content-length"))||0);return new Response(gi(r.body,i,e),t)},bi=(r,e,t)=>{if(!r.body)return r;let i=us(t??r.body);return new Request(r,{duplex:"half",body:gi(r.body,i,e)})};var q=r=>r!==null&&typeof r=="object";var as=Symbol("replaceOption"),bt=r=>q(r)&&r[as]===!0?{isReplace:!0,value:r.value}:{isReplace:!1,value:r};var me=(...r)=>{for(let e of r)if((!q(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return yt({},...r)},Ft=(r={},e={})=>{let t=new globalThis.Headers(r),i=e instanceof globalThis.Headers,n=new globalThis.Headers(e);for(let[s,o]of n.entries())i&&o==="undefined"||o===void 0?t.delete(s):t.set(s,o);return t},Et=r=>{if(!q(r)||Array.isArray(r))return!1;let e=Object.getPrototypeOf(r);return e===Object.prototype||e===null},re=r=>{if(r instanceof URLSearchParams){let e=new URLSearchParams(r),t=r[P];return t&&(e[P]=new Set(t)),e}return r instanceof globalThis.Headers?new globalThis.Headers(r):Array.isArray(r)?[...r]:Et(r)?{...r}:r},ls=r=>Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),cs=(r,e)=>Et(r)&&Et(e)?ls({...r,...e}):Ft(r,e);function de(r,e,t){return Object.hasOwn(e,t)&&e[t]===void 0?[]:yt(r[t]??[],e[t]??[])}var Me=(r={},e={})=>({init:de(r,e,"init"),beforeRequest:de(r,e,"beforeRequest"),beforeRetry:de(r,e,"beforeRetry"),beforeError:de(r,e,"beforeError"),afterResponse:de(r,e,"afterResponse")}),P=Symbol("deletedParameters"),hs=(r,e)=>{let t=new URLSearchParams,i=new Set;for(let n of[r,e])if(n!==void 0)if(n instanceof URLSearchParams){for(let[o,a]of n.entries())t.append(o,a),i.delete(o);let s=n[P];if(s)for(let o of s)t.delete(o),i.add(o)}else if(Array.isArray(n))for(let s of n){if(!Array.isArray(s)||s.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");t.append(String(s[0]),String(s[1])),i.delete(String(s[0]))}else if(q(n))for(let[s,o]of Object.entries(n))o===void 0?(t.delete(s),i.add(s)):(t.append(s,String(o)),i.delete(s));else{let s=new URLSearchParams(n);for(let[o,a]of s.entries())t.append(o,a),i.delete(o)}return i.size>0&&(t[P]=i),t},yt=(...r)=>{let e={},t={},i={},n,s=[];for(let o of r)if(Array.isArray(o))Array.isArray(e)||(e=[]),e=[...e,...o];else if(q(o)){for(let[a,u]of Object.entries(o)){if(a==="signal"&&u instanceof globalThis.AbortSignal){s.push(u);continue}let l=bt(u),{isReplace:h}=l;if(u=l.value,a==="context"){if(u!=null&&(!q(u)||Array.isArray(u)))throw new TypeError("The `context` option must be an object");e={...e,context:u==null?{}:h?{...u}:{...e.context,...u}};continue}if(a==="searchParams"){u==null?n=void 0:h?n=u:n=n===void 0?u:hs(n,u);continue}q(u)&&!h&&a in e&&(u=yt(e[a],u)),e={...e,[a]:u}}if(q(o.hooks)){let{value:a,isReplace:u}=bt(o.hooks);i=Me(u?{}:i,a),e.hooks=i}if(q(o.headers)){let{value:a,isReplace:u}=bt(o.headers);t=u?re(a):cs(t,a),e.headers=t}}return n!==void 0&&(e.searchParams=n),s.length>0&&(s.length===1?e.signal=s[0]:$e?e.signal=AbortSignal.any(s):e.signal=s.at(-1)),e};var Fi=r=>je.includes(r)?r.toUpperCase():r,Ds=["get","put","head","delete","options","trace"],fs=[408,413,429,500,502,503,504],ds=[413,429,503],Ei={limit:2,methods:Ds,statusCodes:fs,afterStatusCodes:ds,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:r=>.3*2**(r-1)*1e3,jitter:void 0,retryOnTimeout:!1},yi=(r={})=>{if(typeof r=="number")return{...Ei,limit:r};if(r.methods&&!Array.isArray(r.methods))throw new Error("retry.methods must be an array");if(r.statusCodes&&!Array.isArray(r.statusCodes))throw new Error("retry.statusCodes must be an array");let e=Object.fromEntries(Object.entries({...r,methods:r.methods?.map(t=>t.toLowerCase())}).filter(([,t])=>t!==void 0));return{...Ei,...e}};async function wt(r,e,t,i){return new Promise((n,s)=>{let o=setTimeout(()=>{t&&t.abort(),s(new R(r))},i.timeout);i.fetch(r,e).then(n).catch(s).then(()=>{clearTimeout(o)})})}async function Le(r,{signal:e}){return new Promise((t,i)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(s),i(e.reason)}let s=setTimeout(()=>{e?.removeEventListener("abort",n),t()},r)})}var wi=r=>{let e={};for(let t in r)Object.hasOwn(r,t)&&!(t in pi)&&!(t in mi)&&(e[t]=r[t]);return e},xi=r=>r===void 0?!1:Array.isArray(r)?r.length>0:r instanceof URLSearchParams?r.size>0||!!r[P]?.size:typeof r=="object"?Object.keys(r).length>0:typeof r=="string"?r.trim().length>0:!!r;var ms=Object.prototype.toString,ps=r=>ms.call(r)==="[object Error]",gs=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function xt(r){if(!(r&&ps(r)&&r.name==="TypeError"&&typeof r.message=="string"))return!1;let{message:t,stack:i}=r;return t==="Load failed"?i===void 0||"__sentry_captured__"in r:t.startsWith("error sending request for url")||t==="Failed to fetch"||t.startsWith("Failed to fetch (")&&t.endsWith(")")?!0:gs.has(t)}var At=(r,e)=>r instanceof e||r?.name===e.name;function Ai(r){return At(r,Z)}function _i(r){return At(r,Q)}function Oi(r){return At(r,R)}var Cs=10*1024*1024,bs="The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl",pe=Symbol("timedOutResponseData"),Es=r=>{let e=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(r),t=e?.[1]??e?.[2];if(t)try{return new TextDecoder(t)}catch{}return new TextDecoder},Si="The `schema` argument must follow the Standard Schema specification",Fs=r=>typeof r!="object"?r:{...r,...r.methods&&{methods:[...r.methods]},...r.statusCodes&&{statusCodes:[...r.statusCodes]},...r.afterStatusCodes&&{afterStatusCodes:[...r.afterStatusCodes]}},Ti=Object.prototype.toString,Bi=r=>r instanceof globalThis.Request||Ti.call(r)==="[object Request]",ge=r=>r instanceof globalThis.Response||Ti.call(r)==="[object Response]",ys=r=>Array.isArray(r)?r.map(e=>[...e]):re(r);function ws(r){let e={...r,json:re(r.json),context:re(r.context),headers:re(r.headers),searchParams:ys(r.searchParams)};return r.retry!==void 0&&(e.retry=Fs(r.retry)),e}var Ri=async(r,e)=>{if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError(Si);let t=e["~standard"];if(typeof t!="object"||t===null||typeof t.validate!="function")throw new TypeError(Si);let i=await t.validate(r);if(i.issues)throw new ke(i.issues);return i.value},Ce=class r{static create(e,t){let i=t.hooks?.init??[],n=i.length>0?ws(t):t;for(let u of i)u(n);let s=new r(e,n),o=async()=>{if(typeof s.#e.timeout=="number"&&s.#e.timeout>te)throw new RangeError(`The \`timeout\` option cannot be greater than ${te}`);if(typeof s.#e.totalTimeout=="number"&&s.#e.totalTimeout>te)throw new RangeError(`The \`totalTimeout\` option cannot be greater than ${te}`);await Promise.resolve();let u=await s.#$(),l=u??await s.#_(async()=>s.#g()),h=u!==void 0||s.#p();for(;;){if(l===void 0)return l;if(ge(l))try{l=await s.#j(l)}catch(m){if(!(m instanceof G))throw m;let D=await s.#m(m,async()=>s.#g());if(D===void 0)return D;l=D,h=s.#p();continue}let f=l;if(!f.ok&&f.type!=="opaque"&&(typeof s.#e.throwHttpErrors=="function"?s.#e.throwHttpErrors(f.status):s.#e.throwHttpErrors)){let m=new Z(f,s.#u(f),s.#o()),D=m;if(m.data=await s.#R(f),h)throw D;let c=await s.#m(m,async()=>s.#g());if(c===void 0)return c;l=c,h=s.#p();continue}break}if(!ge(l))return l;if(s.#w(l),s.#e.onDownloadProgress){if(typeof s.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!ci)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");let f=l.clone();return s.#i(l),Ci(f,s.#e.onDownloadProgress)}return l},a=(async()=>{try{return await o()}catch(u){if(!(u instanceof Error)||s.#F.has(u))throw u;let l=u;for(let h of s.#e.hooks.beforeError){let f=await h({request:s.request,options:s.#o(),error:l,retryCount:s.#r});f instanceof Error&&(l=f)}throw l}finally{let u=s.#E;s.#d(u?.body??void 0),s.request!==u&&s.#d(s.request.body??void 0)}})();for(let[u,l]of Object.entries(Di))u==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(a[u]=async h=>{s.request.headers.set("accept",s.request.headers.get("accept")||l);let f=await a;if(u!=="json")return f[u]();let m=await f.text();if(m==="")return h!==void 0?Ri(void 0,h):JSON.parse(m);let D=n.parseJson?await n.parseJson(m,{request:s.#u(f),response:f}):JSON.parse(m);return h===void 0?D:Ri(D,h)});return a}static#S(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)):e}request;#n;#r=0;#t;#e;#E;#a;#F=new WeakSet;#l;#f;#c=!1;#y=new WeakMap;constructor(e,t={}){if(this.#t=e,Object.hasOwn(t,"prefixUrl"))throw new Error(bs);if(this.#e={...t,headers:Ft(this.#t.headers,t.headers),hooks:Me({},t.hooks),method:Fi(t.method??this.#t.method??"GET"),prefix:String(t.prefix||""),retry:yi(t.retry),throwHttpErrors:t.throwHttpErrors??!0,timeout:t.timeout??1e4,totalTimeout:t.totalTimeout??!1,fetch:t.fetch??globalThis.fetch.bind(globalThis),context:t.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(typeof this.#t=="string"){if(this.#e.prefix){let n=this.#e.prefix.replace(/\/+$/,""),s=this.#t.replace(/^\/+/,"");this.#t=`${n}/${s}`}if(this.#e.baseUrl){let n;try{n=new URL(this.#t)}catch{}n||(this.#t=new URL(this.#t,new Request(this.#e.baseUrl).url))}}li&&$e&&(this.#a=this.#e.signal??this.#t.signal,this.#n=new globalThis.AbortController,this.#e.signal=this.#A()),Ct&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));let i=t.headers&&new globalThis.Headers(t.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(hi&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!i&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),xi(this.#e.searchParams)){let n=new URL(this.request.url),s=this.#e.searchParams?.[P];if(s)for(let o of s)n.searchParams.delete(o);if(typeof this.#e.searchParams=="string"){let o=this.#e.searchParams.replace(/^\?/,"");o!==""&&(n.search=n.search?`${n.search}&${o}`:`?${o}`)}else{let o=new URLSearchParams(r.#S(this.#e.searchParams));for(let[a,u]of o.entries())n.searchParams.append(a,u)}if(this.#e.searchParams&&typeof this.#e.searchParams=="object"&&!Array.isArray(this.#e.searchParams)&&!(this.#e.searchParams instanceof URLSearchParams))for(let[o,a]of Object.entries(this.#e.searchParams))a===void 0&&n.searchParams.delete(o);this.request=new globalThis.Request(n,this.#e)}if(this.#e.onUploadProgress&&typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");this.#f=typeof this.#e.totalTimeout=="number"?this.#O():void 0}#s(){let e=this.#e.retry.delay(this.#r+1),t=e;return this.#e.retry.jitter===!0?t=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(t=this.#e.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e)),Math.min(this.#e.retry.backoffLimit,t)}async#B(e){if(this.#r>=this.#e.retry.limit)throw e;let t=e instanceof Error?e:new ee(e);if(t instanceof G)return t.customDelay??this.#s();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){let i=await this.#e.retry.shouldRetry({error:t,retryCount:this.#r+1});if(i===!1)throw e;if(i===!0)return this.#s()}if(Oi(e)){if(!this.#e.retry.retryOnTimeout)throw e;return this.#s()}if(Ai(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;let i=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(i&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let n=Number(i)*1e3;return Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now()),Number.isFinite(n)?(n=Math.max(0,n),Math.min(this.#e.retry.maxRetryAfter,n)):Math.min(this.#e.retry.maxRetryAfter,this.#s())}if(e.response.status===413)throw e;return this.#s()}if(!_i(e))throw e;return this.#s()}#w(e){let t=this.#u(e);return this.#e.parseJson&&(e.json=async()=>{let i=await e.text();return i===""?JSON.parse(i):this.#e.parseJson(i,{request:t,response:e})}),e}async#R(e){let t=await this.#v(e,this.#x());if(t===pe){this.#h();return}if(!t)return;if(!this.#T(e.headers.get("content-type")??""))return t;let i=await this.#k(t,e,this.#x(),this.#u(e));if(i===pe){this.#h();return}return i}#x(){let e=this.#e.timeout===!1?1e4:this.#e.timeout,t=this.#D();if(t===void 0)return e;if(t<=0)throw new R(this.request);return Math.min(e,t)}#T(e){let t=(e.split(";",1)[0]??"").trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(t)}async#v(e,t){let{body:i}=e;if(!i)try{return await e.text()}catch{return}let n;try{n=i.getReader()}catch{return}let s=Es(e.headers.get("content-type")??""),o=[],a=0,u=(async()=>{try{for(;;){let{done:f,value:m}=await n.read();if(f)break;if(a+=m.byteLength,a>Cs){n.cancel().catch(()=>{});return}o.push(s.decode(m,{stream:!0}))}}catch{return}return o.push(s.decode()),o.join("")})(),l=new Promise(f=>{let m=setTimeout(()=>{f(pe)},t);u.finally(()=>{clearTimeout(m)})}),h=await Promise.race([u,l]);return h===pe&&n.cancel().catch(()=>{}),h}async#k(e,t,i,n){let s;try{return await Promise.race([Promise.resolve().then(()=>this.#e.parseJson?this.#e.parseJson(e,{request:n,response:t}):JSON.parse(e)),new Promise(o=>{s=setTimeout(()=>{o(pe)},i)})])}catch{return}finally{clearTimeout(s)}}#d(e){e&&e.cancel().catch(()=>{})}#i(e){this.#d(e.body??void 0)}#A(){return this.#a?AbortSignal.any([this.#a,this.#n.signal]):this.#n.signal}#h(){let e=this.#D();if(e!==void 0&&e<=0)throw new R(this.request)}async#$(){for(let e of this.#e.hooks.beforeRequest){let t=await e({request:this.request,options:this.#o(),retryCount:0});if(Bi(t))this.#C(t);else if(ge(t))return t}}async#j(e){let t=this.#u(e);for(let i of this.#e.hooks.afterResponse){let n=this.#b(e.clone(),t);this.#w(n);let s;try{s=await i({request:this.request,options:this.#o(),response:n,retryCount:this.#r})}catch(a){throw n!==e&&this.#i(n),this.#i(e),a}if(s instanceof fe)throw n!==e&&this.#i(n),this.#i(e),new G(s.options);let o=ge(s)?this.#b(s,t):e;n!==e&&n!==o&&n.body!==o.body&&this.#i(n),e!==o&&e.body!==o.body&&this.#i(e),e=o}return e}async#_(e){try{return await e()}catch(t){return this.#m(t,e)}}async#m(e,t){this.#c=!1;let i=Math.min(await this.#B(e),te),n={signal:this.#a},s=this.#D();if(s!==void 0){if(s<=0)throw new R(this.request);if(i>=s)throw await Le(s,n),new R(this.request)}if(await Le(i,n),this.#h(),e instanceof G&&e.customRequest){let o=new globalThis.Request(e.customRequest,this.#e.signal?{signal:this.#e.signal}:void 0);this.#C(o)}for(let o of this.#e.hooks.beforeRetry){let a;try{a=await o({request:this.request,options:this.#o(),error:e,retryCount:this.#r+1})}catch(u){throw u instanceof Error&&u!==e&&this.#F.add(u),u}if(Bi(a)){this.#C(a);break}if(ge(a))return this.#c=!0,this.#r++,a;if(a===qe)return}return this.#h(),this.#r++,this.#_(t)}#p(){let e=this.#c;return this.#c=!1,e}async#g(){this.#n?.signal.aborted&&(this.#n=new globalThis.AbortController,this.#e.signal=this.#A(),this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));let e=wi(this.#e),t=this.#e.retry.limit>0?this.request.clone():void 0,i=this.#q(this.request,this.#e.body??void 0);this.#E=i,t&&(this.request=t);try{let n=this.#D();if(n!==void 0&&n<=0)throw new R(this.request);let s=this.#e.timeout===!1?n:n===void 0?this.#e.timeout:Math.min(this.#e.timeout,n),o=s===void 0?await this.#e.fetch(i,e):await wt(i,e,this.#n,{timeout:s,fetch:this.#e.fetch});return this.#b(o,i)}catch(n){throw xt(n)?new Q(this.request,{cause:n}):n}}#D(){if(this.#f===void 0)return;let e=this.#O()-this.#f;return Math.max(0,this.#e.totalTimeout-e)}#O(){return globalThis.performance?.now()??Date.now()}#o(){if(!this.#l){let{hooks:e,json:t,parseJson:i,stringifyJson:n,searchParams:s,timeout:o,totalTimeout:a,throwHttpErrors:u,fetch:l,...h}=this.#e;this.#l=Object.freeze(h)}return this.#l}#C(e){this.#l=void 0,this.request=e}#u(e){return this.#y.get(e)??this.request}#b(e,t){return this.#y.set(e,t),e}#q(e,t){return!this.#e.onUploadProgress||!e.body||!Ct?e:bi(e,this.#e.onUploadProgress,t??this.#e.body??void 0)}};var _t=r=>{let e=(t,i)=>Ce.create(t,me(r,i));for(let t of je)e[t]=(i,n)=>Ce.create(i,me(r,n,{method:t}));return e.create=t=>_t(me(t)),e.extend=t=>(typeof t=="function"&&(t=t(r??{})),_t(me(r,t))),e.stop=qe,e.retry=di,e},xs=_t(),vi=xs;async function ki({cliOptions:r={},env:e=process.env,readConfig:t=ue,requireSecretKey:i=!0}={}){let n=await t(),s=r.baseUrl||e.ENGAGELAB_EMAIL_BASE_URL||n.baseUrl,o=r.secretKey||e.ENGAGELAB_EMAIL_SECRET_KEY||n.secretKey;if(!s)throw ye("Missing base URL. Set --base-url, ENGAGELAB_EMAIL_BASE_URL, or config set.");if(i&&!o)throw ye("Missing Secret Key. Set --secret-key, ENGAGELAB_EMAIL_SECRET_KEY, or config set.");if(i&&!o.startsWith("sk_"))throw ye("Secret Key must start with sk_");return{baseUrl:s,secretKey:o}}async function I(r){let e=await ki({cliOptions:r.optsWithGlobals()});return vi.extend({prefix:As(e.baseUrl),headers:{Authorization:`Bearer ${e.secretKey}`},timeout:3e4,throwHttpErrors:!1})}function N(r,e,t){r.opts().json&&r.parent?.parent?.stdout?.write?.("");let i=r.programOutput?.stdout||process.stdout;if(r.opts().json){i.write(`${JSON.stringify(e,null,2)}
|
|
29
|
+
`)[0].length}};Ze.reset=()=>ee.reset();function Yt(r,e,t){let i=[];r.forEach(function(n){i.push(n.draw(e))});let s=i.join("");s.length&&t.push(s)}ts.exports=Ze});var ss=p((gD,is)=>{is.exports=rs()});var Ee=p((Ad,Ls)=>{"use strict";var Sa="2.0.0",_a=Number.MAX_SAFE_INTEGER||9007199254740991,$a=16,Ta=250,Ia=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ls.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:$a,MAX_SAFE_BUILD_LENGTH:Ta,MAX_SAFE_INTEGER:_a,RELEASE_TYPES:Ia,SEMVER_SPEC_VERSION:Sa,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Ne=p((Od,Bs)=>{"use strict";var va=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Bs.exports=va});var Ce=p((Y,qs)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:lr,MAX_SAFE_BUILD_LENGTH:La,MAX_LENGTH:Ba}=Ee(),qa=Ne();Y=qs.exports={};var Na=Y.re=[],Pa=Y.safeRe=[],m=Y.src=[],ka=Y.safeSrc=[],g=Y.t={},ja=0,cr="[a-zA-Z0-9-]",Ma=[["\\s",1],["\\d",Ba],[cr,La]],Ha=r=>{for(let[e,t]of Ma)r=r.split(`${e}*`).join(`${e}{0,${t}}`).split(`${e}+`).join(`${e}{1,${t}}`);return r},b=(r,e,t)=>{let i=Ha(e),s=ja++;qa(r,s,e),g[r]=s,m[s]=e,ka[s]=i,Na[s]=new RegExp(e,t?"g":void 0),Pa[s]=new RegExp(i,t?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*");b("NUMERICIDENTIFIERLOOSE","\\d+");b("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${cr}*`);b("MAINVERSION",`(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})`);b("MAINVERSIONLOOSE",`(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})`);b("PRERELEASEIDENTIFIER",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIER]})`);b("PRERELEASEIDENTIFIERLOOSE",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIERLOOSE]})`);b("PRERELEASE",`(?:-(${m[g.PRERELEASEIDENTIFIER]}(?:\\.${m[g.PRERELEASEIDENTIFIER]})*))`);b("PRERELEASELOOSE",`(?:-?(${m[g.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${m[g.PRERELEASEIDENTIFIERLOOSE]})*))`);b("BUILDIDENTIFIER",`${cr}+`);b("BUILD",`(?:\\+(${m[g.BUILDIDENTIFIER]}(?:\\.${m[g.BUILDIDENTIFIER]})*))`);b("FULLPLAIN",`v?${m[g.MAINVERSION]}${m[g.PRERELEASE]}?${m[g.BUILD]}?`);b("FULL",`^${m[g.FULLPLAIN]}$`);b("LOOSEPLAIN",`[v=\\s]*${m[g.MAINVERSIONLOOSE]}${m[g.PRERELEASELOOSE]}?${m[g.BUILD]}?`);b("LOOSE",`^${m[g.LOOSEPLAIN]}$`);b("GTLT","((?:<|>)?=?)");b("XRANGEIDENTIFIERLOOSE",`${m[g.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);b("XRANGEIDENTIFIER",`${m[g.NUMERICIDENTIFIER]}|x|X|\\*`);b("XRANGEPLAIN",`[v=\\s]*(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:${m[g.PRERELEASE]})?${m[g.BUILD]}?)?)?`);b("XRANGEPLAINLOOSE",`[v=\\s]*(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:${m[g.PRERELEASELOOSE]})?${m[g.BUILD]}?)?)?`);b("XRANGE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAIN]}$`);b("XRANGELOOSE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAINLOOSE]}$`);b("COERCEPLAIN",`(^|[^\\d])(\\d{1,${lr}})(?:\\.(\\d{1,${lr}}))?(?:\\.(\\d{1,${lr}}))?`);b("COERCE",`${m[g.COERCEPLAIN]}(?:$|[^\\d])`);b("COERCEFULL",m[g.COERCEPLAIN]+`(?:${m[g.PRERELEASE]})?(?:${m[g.BUILD]})?(?:$|[^\\d])`);b("COERCERTL",m[g.COERCE],!0);b("COERCERTLFULL",m[g.COERCEFULL],!0);b("LONETILDE","(?:~>?)");b("TILDETRIM",`(\\s*)${m[g.LONETILDE]}\\s+`,!0);Y.tildeTrimReplace="$1~";b("TILDE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAIN]}$`);b("TILDELOOSE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAINLOOSE]}$`);b("LONECARET","(?:\\^)");b("CARETTRIM",`(\\s*)${m[g.LONECARET]}\\s+`,!0);Y.caretTrimReplace="$1^";b("CARET",`^${m[g.LONECARET]}${m[g.XRANGEPLAIN]}$`);b("CARETLOOSE",`^${m[g.LONECARET]}${m[g.XRANGEPLAINLOOSE]}$`);b("COMPARATORLOOSE",`^${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]})$|^$`);b("COMPARATOR",`^${m[g.GTLT]}\\s*(${m[g.FULLPLAIN]})$|^$`);b("COMPARATORTRIM",`(\\s*)${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]}|${m[g.XRANGEPLAIN]})`,!0);Y.comparatorTrimReplace="$1$2$3";b("HYPHENRANGE",`^\\s*(${m[g.XRANGEPLAIN]})\\s+-\\s+(${m[g.XRANGEPLAIN]})\\s*$`);b("HYPHENRANGELOOSE",`^\\s*(${m[g.XRANGEPLAINLOOSE]})\\s+-\\s+(${m[g.XRANGEPLAINLOOSE]})\\s*$`);b("STAR","(<|>)?=?\\s*\\*");b("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");b("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var at=p((Rd,Ns)=>{"use strict";var Va=Object.freeze({loose:!0}),Ua=Object.freeze({}),Ga=r=>r?typeof r!="object"?Va:r:Ua;Ns.exports=Ga});var hr=p((Sd,js)=>{"use strict";var Ps=/^[0-9]+$/,ks=(r,e)=>{if(typeof r=="number"&&typeof e=="number")return r===e?0:r<e?-1:1;let t=Ps.test(r),i=Ps.test(e);return t&&i&&(r=+r,e=+e),r===e?0:t&&!i?-1:i&&!t?1:r<e?-1:1},Wa=(r,e)=>ks(e,r);js.exports={compareIdentifiers:ks,rcompareIdentifiers:Wa}});var T=p((_d,Hs)=>{"use strict";var lt=Ne(),{MAX_LENGTH:Ms,MAX_SAFE_INTEGER:ct}=Ee(),{safeRe:ht,t:ft}=Ce(),za=at(),{compareIdentifiers:fr}=hr(),Xa=(r,e)=>{let t=e.split(".");if(t.length>r.length)return!1;for(let i=0;i<t.length;i++)if(fr(r[i],t[i])!==0)return!1;return!0},Dr=class r{constructor(e,t){if(t=za(t),e instanceof r){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Ms)throw new TypeError(`version is longer than ${Ms} characters`);lt("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let i=e.trim().match(t.loose?ht[ft.LOOSE]:ht[ft.FULL]);if(!i)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>ct||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ct||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ct||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let n=+s;if(n>=0&&n<ct)return n}return s}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(lt("SemVer.compare",this.version,this.options,e),!(e instanceof r)){if(typeof e=="string"&&e===this.version)return 0;e=new r(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof r||(e=new r(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof r||(e=new r(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let i=this.prerelease[t],s=e.prerelease[t];if(lt("prerelease compare",t,i,s),i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(i===s)continue;return fr(i,s)}while(++t)}compareBuild(e){e instanceof r||(e=new r(e,this.options));let t=0;do{let i=this.build[t],s=e.build[t];if(lt("build compare",t,i,s),i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(i===s)continue;return fr(i,s)}while(++t)}inc(e,t,i){if(e.startsWith("pre")){if(!t&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let s=`-${t}`.match(this.options.loose?ht[ft.PRERELEASELOOSE]:ht[ft.PRERELEASE]);if(!s||s[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,i),this.inc("pre",t,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,i),this.inc("pre",t,i);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(i)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let n=this.prerelease.length;for(;--n>=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);if(n===-1){if(t===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(t){let n=[t,s];if(i===!1&&(n=[t]),Xa(this.prerelease,t)){let o=this.prerelease[t.split(".").length];isNaN(o)&&(this.prerelease=n)}else this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Hs.exports=Dr});var se=p(($d,Us)=>{"use strict";var Vs=T(),Ja=(r,e,t=!1)=>{if(r instanceof Vs)return r;try{return new Vs(r,e)}catch(i){if(!t)return null;throw i}};Us.exports=Ja});var Ws=p((Td,Gs)=>{"use strict";var Ka=se(),Ya=(r,e)=>{let t=Ka(r,e);return t?t.version:null};Gs.exports=Ya});var Xs=p((Id,zs)=>{"use strict";var Za=se(),Qa=(r,e)=>{let t=Za(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null};zs.exports=Qa});var Ys=p((vd,Ks)=>{"use strict";var Js=T(),el=(r,e,t,i,s)=>{typeof t=="string"&&(s=i,i=t,t=void 0);try{return new Js(r instanceof Js?r.version:r,t).inc(e,i,s).version}catch{return null}};Ks.exports=el});var en=p((Ld,Qs)=>{"use strict";var Zs=se(),tl=(r,e)=>{let t=Zs(r,null,!0),i=Zs(e,null,!0),s=t.compare(i);if(s===0)return null;let n=s>0,o=n?t:i,a=n?i:t,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let c=u?"pre":"";return t.major!==i.major?c+"major":t.minor!==i.minor?c+"minor":t.patch!==i.patch?c+"patch":"prerelease"};Qs.exports=tl});var rn=p((Bd,tn)=>{"use strict";var rl=T(),il=(r,e)=>new rl(r,e).major;tn.exports=il});var nn=p((qd,sn)=>{"use strict";var sl=T(),nl=(r,e)=>new sl(r,e).minor;sn.exports=nl});var un=p((Nd,on)=>{"use strict";var ol=T(),ul=(r,e)=>new ol(r,e).patch;on.exports=ul});var ln=p((Pd,an)=>{"use strict";var al=se(),ll=(r,e)=>{let t=al(r,e);return t&&t.prerelease.length?t.prerelease:null};an.exports=ll});var H=p((kd,hn)=>{"use strict";var cn=T(),cl=(r,e,t)=>new cn(r,t).compare(new cn(e,t));hn.exports=cl});var Dn=p((jd,fn)=>{"use strict";var hl=H(),fl=(r,e,t)=>hl(e,r,t);fn.exports=fl});var pn=p((Md,dn)=>{"use strict";var Dl=H(),dl=(r,e)=>Dl(r,e,!0);dn.exports=dl});var Dt=p((Hd,gn)=>{"use strict";var mn=T(),pl=(r,e,t)=>{let i=new mn(r,t),s=new mn(e,t);return i.compare(s)||i.compareBuild(s)};gn.exports=pl});var Cn=p((Vd,En)=>{"use strict";var ml=Dt(),gl=(r,e)=>r.sort((t,i)=>ml(t,i,e));En.exports=gl});var wn=p((Ud,bn)=>{"use strict";var El=Dt(),Cl=(r,e)=>r.sort((t,i)=>El(i,t,e));bn.exports=Cl});var Pe=p((Gd,Fn)=>{"use strict";var bl=H(),wl=(r,e,t)=>bl(r,e,t)>0;Fn.exports=wl});var dt=p((Wd,yn)=>{"use strict";var Fl=H(),yl=(r,e,t)=>Fl(r,e,t)<0;yn.exports=yl});var dr=p((zd,xn)=>{"use strict";var xl=H(),Al=(r,e,t)=>xl(r,e,t)===0;xn.exports=Al});var pr=p((Xd,An)=>{"use strict";var Ol=H(),Rl=(r,e,t)=>Ol(r,e,t)!==0;An.exports=Rl});var pt=p((Jd,On)=>{"use strict";var Sl=H(),_l=(r,e,t)=>Sl(r,e,t)>=0;On.exports=_l});var mt=p((Kd,Rn)=>{"use strict";var $l=H(),Tl=(r,e,t)=>$l(r,e,t)<=0;Rn.exports=Tl});var mr=p((Yd,Sn)=>{"use strict";var Il=dr(),vl=pr(),Ll=Pe(),Bl=pt(),ql=dt(),Nl=mt(),Pl=(r,e,t,i)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return Il(r,t,i);case"!=":return vl(r,t,i);case">":return Ll(r,t,i);case">=":return Bl(r,t,i);case"<":return ql(r,t,i);case"<=":return Nl(r,t,i);default:throw new TypeError(`Invalid operator: ${e}`)}};Sn.exports=Pl});var $n=p((Zd,_n)=>{"use strict";var kl=T(),jl=se(),{safeRe:gt,t:Et}=Ce(),Ml=(r,e)=>{if(r instanceof kl)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;e=e||{};let t=null;if(!e.rtl)t=r.match(e.includePrerelease?gt[Et.COERCEFULL]:gt[Et.COERCE]);else{let u=e.includePrerelease?gt[Et.COERCERTLFULL]:gt[Et.COERCERTL],l;for(;(l=u.exec(r))&&(!t||t.index+t[0].length!==r.length);)(!t||l.index+l[0].length!==t.index+t[0].length)&&(t=l),u.lastIndex=l.index+l[1].length+l[2].length;u.lastIndex=-1}if(t===null)return null;let i=t[2],s=t[3]||"0",n=t[4]||"0",o=e.includePrerelease&&t[5]?`-${t[5]}`:"",a=e.includePrerelease&&t[6]?`+${t[6]}`:"";return jl(`${i}.${s}.${n}${o}${a}`,e)};_n.exports=Ml});var In=p((Qd,Tn)=>{"use strict";var Hl=se(),Vl=Ee(),Ul=T(),Gl=(r,e,t)=>{if(!Vl.RELEASE_TYPES.includes(e))return null;let i=Wl(r,t);return i&&zl(i,e)},Wl=(r,e)=>{let t=r instanceof Ul?r.version:r;return Hl(t,e)},zl=(r,e)=>{if(Xl(e))return r.version;switch(r.prerelease=[],e){case"major":r.minor=0,r.patch=0;break;case"minor":r.patch=0;break}return r.format()},Xl=r=>r.startsWith("pre");Tn.exports=Gl});var Ln=p((ep,vn)=>{"use strict";var gr=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(e,t)}return this}};vn.exports=gr});var V=p((tp,Pn)=>{"use strict";var Jl=/\s+/g,Er=class r{constructor(e,t){if(t=Yl(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof Cr)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(Jl," "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(s=>!qn(s[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&oc(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let i=0;i<t.length;i++)i>0&&(this.formatted+=" "),this.formatted+=t[i].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(nc,"");let i=((this.options.includePrerelease&&ic)|(this.options.loose&&sc))+":"+e,s=Bn.get(i);if(s)return s;let n=this.options.loose,o=n?q[I.HYPHENRANGELOOSE]:q[I.HYPHENRANGE];e=e.replace(o,gc(this.options.includePrerelease)),O("hyphen replace",e),e=e.replace(q[I.COMPARATORTRIM],ec),O("comparator trim",e),e=e.replace(q[I.TILDETRIM],tc),O("tilde trim",e),e=e.replace(q[I.CARETTRIM],rc),O("caret trim",e);let a=e.split(" ").map(h=>uc(h,this.options)).join(" ").split(/\s+/).map(h=>mc(h,this.options));n&&(a=a.filter(h=>(O("loose invalid filter",h,this.options),!!h.match(q[I.COMPARATORLOOSE])))),O("range list",a);let u=new Map,l=a.map(h=>new Cr(h,this.options));for(let h of l){if(qn(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return Bn.set(i,c),c}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>Nn(i,t)&&e.set.some(s=>Nn(s,t)&&i.every(n=>s.every(o=>n.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Zl(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(Ec(this.set[t],e,this.options))return!0;return!1}};Pn.exports=Er;var Kl=Ln(),Bn=new Kl,Yl=at(),Cr=ke(),O=Ne(),Zl=T(),{safeRe:q,src:Ql,t:I,comparatorTrimReplace:ec,tildeTrimReplace:tc,caretTrimReplace:rc}=Ce(),{FLAG_INCLUDE_PRERELEASE:ic,FLAG_LOOSE:sc}=Ee(),nc=new RegExp(Ql[I.BUILD],"g"),qn=r=>r.value==="<0.0.0-0",oc=r=>r.value==="",Nn=(r,e)=>{let t=!0,i=r.slice(),s=i.pop();for(;t&&i.length;)t=i.every(n=>s.intersects(n,e)),s=i.pop();return t},uc=(r,e)=>(r=r.replace(q[I.BUILD],""),O("comp",r,e),r=hc(r,e),O("caret",r),r=lc(r,e),O("tildes",r),r=Dc(r,e),O("xrange",r),r=pc(r,e),O("stars",r),r),S=r=>!r||r.toLowerCase()==="x"||r==="*",ac=(r,e,t)=>S(r)&&!S(e)||S(e)&&t&&!S(t),lc=(r,e)=>r.trim().split(/\s+/).map(t=>cc(t,e)).join(" "),cc=(r,e)=>{let t=e.loose?q[I.TILDELOOSE]:q[I.TILDE],i=e.includePrerelease?"-0":"";return r.replace(t,(s,n,o,a,u)=>{O("tilde",r,s,n,o,a,u);let l;return S(n)?l="":S(o)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:S(a)?l=`>=${n}.${o}.0${i} <${n}.${+o+1}.0-0`:u?(O("replaceTilde pr",u),l=`>=${n}.${o}.${a}-${u} <${n}.${+o+1}.0-0`):l=`>=${n}.${o}.${a} <${n}.${+o+1}.0-0`,O("tilde return",l),l})},hc=(r,e)=>r.trim().split(/\s+/).map(t=>fc(t,e)).join(" "),fc=(r,e)=>{O("caret",r,e);let t=e.loose?q[I.CARETLOOSE]:q[I.CARET],i=e.includePrerelease?"-0":"";return r.replace(t,(s,n,o,a,u)=>{O("caret",r,s,n,o,a,u);let l;return S(n)?l="":S(o)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:S(a)?n==="0"?l=`>=${n}.${o}.0${i} <${n}.${+o+1}.0-0`:l=`>=${n}.${o}.0${i} <${+n+1}.0.0-0`:u?(O("replaceCaret pr",u),n==="0"?o==="0"?l=`>=${n}.${o}.${a}-${u} <${n}.${o}.${+a+1}-0`:l=`>=${n}.${o}.${a}-${u} <${n}.${+o+1}.0-0`:l=`>=${n}.${o}.${a}-${u} <${+n+1}.0.0-0`):(O("no pr"),n==="0"?o==="0"?l=`>=${n}.${o}.${a} <${n}.${o}.${+a+1}-0`:l=`>=${n}.${o}.${a} <${n}.${+o+1}.0-0`:l=`>=${n}.${o}.${a} <${+n+1}.0.0-0`),O("caret return",l),l})},Dc=(r,e)=>(O("replaceXRanges",r,e),r.split(/\s+/).map(t=>dc(t,e)).join(" ")),dc=(r,e)=>{r=r.trim();let t=e.loose?q[I.XRANGELOOSE]:q[I.XRANGE];return r.replace(t,(i,s,n,o,a,u)=>{if(O("xRange",r,i,s,n,o,a,u),ac(n,o,a))return r;let l=S(n),c=l||S(o),h=c||S(a),d=h;return s==="="&&d&&(s=""),u=e.includePrerelease?"-0":"",l?s===">"||s==="<"?i="<0.0.0-0":i="*":s&&d?(c&&(o=0),a=0,s===">"?(s=">=",c?(n=+n+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",c?n=+n+1:o=+o+1),s==="<"&&(u="-0"),i=`${s+n}.${o}.${a}${u}`):c?i=`>=${n}.0.0${u} <${+n+1}.0.0-0`:h&&(i=`>=${n}.${o}.0${u} <${n}.${+o+1}.0-0`),O("xRange return",i),i})},pc=(r,e)=>(O("replaceStars",r,e),r.trim().replace(q[I.STAR],"")),mc=(r,e)=>(O("replaceGTE0",r,e),r.trim().replace(q[e.includePrerelease?I.GTE0PRE:I.GTE0],"")),gc=r=>(e,t,i,s,n,o,a,u,l,c,h,d)=>(S(i)?t="":S(s)?t=`>=${i}.0.0${r?"-0":""}`:S(n)?t=`>=${i}.${s}.0${r?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,S(l)?u="":S(c)?u=`<${+l+1}.0.0-0`:S(h)?u=`<${l}.${+c+1}.0-0`:d?u=`<=${l}.${c}.${h}-${d}`:r?u=`<${l}.${c}.${+h+1}-0`:u=`<=${u}`,`${t} ${u}`.trim()),Ec=(r,e,t)=>{for(let i=0;i<r.length;i++)if(!r[i].test(e))return!1;if(e.prerelease.length&&!t.includePrerelease){for(let i=0;i<r.length;i++)if(O(r[i].semver),r[i].semver!==Cr.ANY&&r[i].semver.prerelease.length>0){let s=r[i].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0}});var ke=p((rp,Un)=>{"use strict";var je=Symbol("SemVer ANY"),Fr=class r{static get ANY(){return je}constructor(e,t){if(t=kn(t),e instanceof r){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),wr("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===je?this.value="":this.value=this.operator+this.semver.version,wr("comp",this)}parse(e){let t=this.options.loose?jn[Mn.COMPARATORLOOSE]:jn[Mn.COMPARATOR],i=e.match(t);if(!i)throw new TypeError(`Invalid comparator: ${e}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new Hn(i[2],this.options.loose):this.semver=je}toString(){return this.value}test(e){if(wr("Comparator.test",e,this.options.loose),this.semver===je||e===je)return!0;if(typeof e=="string")try{e=new Hn(e,this.options)}catch{return!1}return br(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Vn(e.value,t).test(this.value):e.operator===""?e.value===""?!0:new Vn(this.value,t).test(e.semver):(t=kn(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||br(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||br(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Un.exports=Fr;var kn=at(),{safeRe:jn,t:Mn}=Ce(),br=mr(),wr=Ne(),Hn=T(),Vn=V()});var Me=p((ip,Gn)=>{"use strict";var Cc=V(),bc=(r,e,t)=>{try{e=new Cc(e,t)}catch{return!1}return e.test(r)};Gn.exports=bc});var zn=p((sp,Wn)=>{"use strict";var wc=V(),Fc=(r,e)=>new wc(r,e).set.map(t=>t.map(i=>i.value).join(" ").trim().split(" "));Wn.exports=Fc});var Jn=p((np,Xn)=>{"use strict";var yc=T(),xc=V(),Ac=(r,e,t)=>{let i=null,s=null,n=null;try{n=new xc(e,t)}catch{return null}return r.forEach(o=>{n.test(o)&&(!i||s.compare(o)===-1)&&(i=o,s=new yc(i,t))}),i};Xn.exports=Ac});var Yn=p((op,Kn)=>{"use strict";var Oc=T(),Rc=V(),Sc=(r,e,t)=>{let i=null,s=null,n=null;try{n=new Rc(e,t)}catch{return null}return r.forEach(o=>{n.test(o)&&(!i||s.compare(o)===1)&&(i=o,s=new Oc(i,t))}),i};Kn.exports=Sc});var eo=p((up,Qn)=>{"use strict";var yr=T(),_c=V(),Zn=Pe(),$c=(r,e)=>{r=new _c(r,e);let t=new yr("0.0.0");if(r.test(t)||(t=new yr("0.0.0-0"),r.test(t)))return t;t=null;for(let i=0;i<r.set.length;++i){let s=r.set[i],n=null;s.forEach(o=>{let a=new yr(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!n||Zn(a,n))&&(n=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),n&&(!t||Zn(t,n))&&(t=n)}return t&&r.test(t)?t:null};Qn.exports=$c});var ro=p((ap,to)=>{"use strict";var Tc=V(),Ic=(r,e)=>{try{return new Tc(r,e).range||"*"}catch{return null}};to.exports=Ic});var Ct=p((lp,oo)=>{"use strict";var vc=T(),no=ke(),{ANY:Lc}=no,Bc=V(),qc=Me(),io=Pe(),so=dt(),Nc=mt(),Pc=pt(),kc=(r,e,t,i)=>{r=new vc(r,i),e=new Bc(e,i);let s,n,o,a,u;switch(t){case">":s=io,n=Nc,o=so,a=">",u=">=";break;case"<":s=so,n=Pc,o=io,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(qc(r,e,i))return!1;for(let l=0;l<e.set.length;++l){let c=e.set[l],h=null,d=null;if(c.forEach(f=>{f.semver===Lc&&(f=new no(">=0.0.0")),h=h||f,d=d||f,s(f.semver,h.semver,i)?h=f:o(f.semver,d.semver,i)&&(d=f)}),h.operator===a||h.operator===u||(!d.operator||d.operator===a)&&n(r,d.semver))return!1;if(d.operator===u&&o(r,d.semver))return!1}return!0};oo.exports=kc});var ao=p((cp,uo)=>{"use strict";var jc=Ct(),Mc=(r,e,t)=>jc(r,e,">",t);uo.exports=Mc});var co=p((hp,lo)=>{"use strict";var Hc=Ct(),Vc=(r,e,t)=>Hc(r,e,"<",t);lo.exports=Vc});var Do=p((fp,fo)=>{"use strict";var ho=V(),Uc=(r,e,t)=>(r=new ho(r,t),e=new ho(e,t),r.intersects(e,t));fo.exports=Uc});var mo=p((Dp,po)=>{"use strict";var Gc=Me(),Wc=H();po.exports=(r,e,t)=>{let i=[],s=null,n=null,o=r.sort((c,h)=>Wc(c,h,t));for(let c of o)Gc(c,e,t)?(n=c,s||(s=c)):(n&&i.push([s,n]),n=null,s=null);s&&i.push([s,null]);let a=[];for(let[c,h]of i)c===h?a.push(c):!h&&c===o[0]?a.push("*"):h?c===o[0]?a.push(`<=${h}`):a.push(`${c} - ${h}`):a.push(`>=${c}`);let u=a.join(" || "),l=typeof e.raw=="string"?e.raw:String(e);return u.length<l.length?u:e}});var Fo=p((dp,wo)=>{"use strict";var go=V(),Or=ke(),{ANY:xr}=Or,Ar=Me(),Rr=H(),zc=(r,e,t={})=>{if(r===e)return!0;r=new go(r,t),e=new go(e,t);let i=!1;e:for(let s of r.set){for(let n of e.set){let o=Jc(s,n,t);if(i=i||o!==null,o)continue e}if(i)return!1}return!0},Xc=[new Or(">=0.0.0-0")],Eo=[new Or(">=0.0.0")],Jc=(r,e,t)=>{if(r===e)return!0;if(r.length===1&&r[0].semver===xr){if(e.length===1&&e[0].semver===xr)return!0;t.includePrerelease?r=Xc:r=Eo}if(e.length===1&&e[0].semver===xr){if(t.includePrerelease)return!0;e=Eo}let i=new Set,s,n;for(let f of r)f.operator===">"||f.operator===">="?s=Co(s,f,t):f.operator==="<"||f.operator==="<="?n=bo(n,f,t):i.add(f.semver);if(i.size>1)return null;let o;if(s&&n){if(o=Rr(s.semver,n.semver,t),o>0)return null;if(o===0&&(s.operator!==">="||n.operator!=="<="))return null}for(let f of i){if(s&&!Ar(f,String(s),t)||n&&!Ar(f,String(n),t))return null;for(let D of e)if(!Ar(f,String(D),t))return!1;return!0}let a,u,l,c,h=n&&!t.includePrerelease&&n.semver.prerelease.length?n.semver:!1,d=s&&!t.includePrerelease&&s.semver.prerelease.length?s.semver:!1;h&&h.prerelease.length===1&&n.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(c=c||f.operator===">"||f.operator===">=",l=l||f.operator==="<"||f.operator==="<=",s){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator===">"||f.operator===">="){if(a=Co(s,f,t),a===f&&a!==s)return!1}else if(s.operator===">="&&!f.test(s.semver))return!1}if(n){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(u=bo(n,f,t),u===f&&u!==n)return!1}else if(n.operator==="<="&&!f.test(n.semver))return!1}if(!f.operator&&(n||s)&&o!==0)return!1}return!(s&&l&&!n&&o!==0||n&&c&&!s&&o!==0||d||h)},Co=(r,e,t)=>{if(!r)return e;let i=Rr(r.semver,e.semver,t);return i>0?r:i<0||e.operator===">"&&r.operator===">="?e:r},bo=(r,e,t)=>{if(!r)return e;let i=Rr(r.semver,e.semver,t);return i<0?r:i>0||e.operator==="<"&&r.operator==="<="?e:r};wo.exports=zc});var Oo=p((pp,Ao)=>{"use strict";var Sr=Ce(),yo=Ee(),Kc=T(),xo=hr(),Yc=se(),Zc=Ws(),Qc=Xs(),eh=Ys(),th=en(),rh=rn(),ih=nn(),sh=un(),nh=ln(),oh=H(),uh=Dn(),ah=pn(),lh=Dt(),ch=Cn(),hh=wn(),fh=Pe(),Dh=dt(),dh=dr(),ph=pr(),mh=pt(),gh=mt(),Eh=mr(),Ch=$n(),bh=In(),wh=ke(),Fh=V(),yh=Me(),xh=zn(),Ah=Jn(),Oh=Yn(),Rh=eo(),Sh=ro(),_h=Ct(),$h=ao(),Th=co(),Ih=Do(),vh=mo(),Lh=Fo();Ao.exports={parse:Yc,valid:Zc,clean:Qc,inc:eh,diff:th,major:rh,minor:ih,patch:sh,prerelease:nh,compare:oh,rcompare:uh,compareLoose:ah,compareBuild:lh,sort:ch,rsort:hh,gt:fh,lt:Dh,eq:dh,neq:ph,gte:mh,lte:gh,cmp:Eh,coerce:Ch,truncate:bh,Comparator:wh,Range:Fh,satisfies:yh,toComparators:xh,maxSatisfying:Ah,minSatisfying:Oh,minVersion:Rh,validRange:Sh,outside:_h,gtr:$h,ltr:Th,intersects:Ih,simplifyRange:vh,subset:Lh,SemVer:Kc,re:Sr.re,src:Sr.src,tokens:Sr.t,SEMVER_SPEC_VERSION:yo.SEMVER_SPEC_VERSION,RELEASE_TYPES:yo.RELEASE_TYPES,compareIdentifiers:xo.compareIdentifiers,rcompareIdentifiers:xo.rcompareIdentifiers}});var Vr=ae(Hr(),1),{program:xf,createCommand:Af,createArgument:Of,createOption:Rf,CommanderError:Sf,InvalidArgumentError:_f,InvalidOptionArgumentError:$f,Command:Ur,Argument:Tf,Option:If,Help:vf}=Vr.default;var le=require("node:fs/promises"),xe=ae(require("node:path"),1),Nt=ae(require("node:os"),1);async function Ae({configPath:r=Gr()}={}){try{return JSON.parse(await(0,le.readFile)(r,"utf8"))}catch(e){if(e.code==="ENOENT")return{};throw e}}async function Pt(r,{configPath:e=Gr()}={}){await(0,le.mkdir)(xe.default.dirname(e),{recursive:!0}),await(0,le.writeFile)(e,`${JSON.stringify(r,null,2)}
|
|
30
|
+
`,{encoding:"utf8",mode:384})}function Gr(r=process.env,e=process.platform){if(r.ENGAGELAB_EMAIL_CONFIG)return r.ENGAGELAB_EMAIL_CONFIG;let t=r.XDG_CONFIG_HOME||(e==="win32"?r.APPDATA||xe.default.join(Nt.default.homedir(),"AppData","Roaming"):xe.default.join(Nt.default.homedir(),".config"));return xe.default.join(t,"engagelab-email-cli","config.json")}function Wr(r){return r?`${r.slice(0,7)}****`:""}var $=class extends Error{constructor(e,{code:t="cli_error",exitCode:i=1,status:s,data:n,cause:o}={}){super(e,{cause:o}),this.name="CliError",this.code=t,this.exitCode=i,this.status=s,this.data=n}};function kt(r){return r===401||r===403?2:r===404?3:r===409?4:5}function zr(r){return r instanceof $?r:new $(r?.message||"Command failed",{code:"unknown_error",exitCode:5,cause:r})}function _(r){return new $(r,{code:"validation_error",exitCode:1})}function Ge(r){return new $(r,{code:"config_error",exitCode:1})}var Yr=ae(Kr(),1),A=(0,Yr.createColors)(!process.env.NO_COLOR);var Zr=[A.cyan,A.yellow,A.magenta,A.blue,A.green],w={start(r){return`${A.cyan(">>")} ${r}`},success(r){return`${A.green("OK")} ${r}`},failure(r){return`${A.red("X")} ${r}`},warning(r){return`${A.yellow("Warning:")} ${r}`},label(r){return A.cyan(r)},heading(r){return A.bold(r)},muted(r){return A.dim(r)},command(r){return A.bold(r)},empty(r){return A.dim(r)},tableHeader(r){return A.bold(A.cyan(r))},tableCell(r,e){let t=gu(r);if(!t)return"";let i=Eu(t);if(i)return i(t);let s=Zr[e%Zr.length];return s(t)},listenMessage({time:r,route:e,subject:t,id:i}){return[A.dim(`[${r}]`),A.cyan(e),A.bold(A.yellow(`"${t}"`)),i?A.dim(String(i)):null].filter(Boolean).join(" ")}};function gu(r){return Array.isArray(r)?r.join(", "):r==null?"":String(r)}function Eu(r){let e=r.trim().toLowerCase();return/fail|error|reject|invalid/.test(e)?A.red:/pending|processing|parsing|waiting/.test(e)?A.yellow:/ok|success|sent|done|parsed|received|replied|active/.test(e)?A.green:null}function Qr(r){let e=r.command("config").description("Manage local EngageLab Email CLI config");e.command("set").description("Save local CLI configuration").option("--base-url <url>","EngageLab Email API base URL").option("--secret-key <key>","EngageLab Email Secret Key").action(async(t,i)=>{if(t={...i.optsWithGlobals(),...t},!t.baseUrl&&!t.secretKey)throw _("Provide at least one of --base-url or --secret-key");if(t.secretKey&&!t.secretKey.startsWith("sk_"))throw _("Secret Key must start with sk_");let s=await Ae();await Pt({...s,...Cu(t)}),process.stdout.write(`${w.success("Config saved")}
|
|
31
|
+
`)}),e.command("list").description("Show local CLI configuration").action(async()=>{let t=await Ae();process.stdout.write(`${w.label("baseUrl")}: ${t.baseUrl||""}
|
|
32
|
+
`),process.stdout.write(`${w.label("secretKey")}: ${Wr(t.secretKey)}
|
|
33
|
+
`)}),e.command("clear").description("Clear local CLI configuration").action(async()=>{await Pt({}),process.stdout.write(`${w.success("Config cleared")}
|
|
34
|
+
`)})}function Cu(r){return Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0))}var ti=require("node:fs/promises"),Xe=require("node:path");var bu=10,wu=10*1024*1024,ri=[["text","textFile"],["html","htmlFile"]];async function Mt(r={},{readFile:e=ti.readFile}={}){Fu(r);let t={};for(let[i,s]of Object.entries(r))i.endsWith("File")||i==="attachment"||s===void 0||(t[i]=s);for(let[i,s]of ri)r[s]&&(t[i]=await e(r[s],"utf8"));return r.attachment&&(t.attachments=await yu(r.attachment,{readFile:e})),t}function Fu(r){for(let[e,t]of ri)if(r[e]&&r[t])throw _(`--${ei(e)} and --${ei(t)} are mutually exclusive`)}async function yu(r,{readFile:e}){let t=Array.isArray(r)?r:[r];if(t.length>bu)throw _("Attachments cannot exceed 10 files.");let i=await Promise.all(t.map(async n=>{let o=await e(n);return{filePath:n,content:o}}));if(i.reduce((n,o)=>n+o.content.byteLength,0)>wu)throw _("Attachments total size cannot exceed 10MB.");return i.map(({filePath:n,content:o})=>{let a=(0,Xe.basename)(n),u=xu(a);return{filename:a,contentType:u,type:u,content:Buffer.from(o).toString("base64")}})}function xu(r){switch((0,Xe.extname)(r).toLowerCase()){case".txt":return"text/plain";case".html":case".htm":return"text/html";case".json":return"application/json";case".pdf":return"application/pdf";case".csv":return"text/csv";case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".svg":return"image/svg+xml";case".zip":return"application/zip";default:return"application/octet-stream"}}function ei(r){return r.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function j(r){let e=Number.parseInt(r,10);if(!Number.isInteger(e)||e<=0)throw _("Expected a positive integer");return e}function Oe(r){let e=Number.parseInt(r,10);if(!Number.isInteger(e)||e<0)throw _("Expected a non-negative integer");return e}function z(r,e=[]){return[...e,r]}function ii(r){return Object.fromEntries(Object.entries(r).filter(([,e])=>e!=null&&e!==""))}function ce(r,e){if(r==null||r==="")throw _(e);return r}var ns=ae(ss(),1);function Zt(r,e){if(!r||r.length===0)return w.empty("No results");let t=new ns.default({head:e.map(i=>w.tableHeader(i.header)),style:{border:[],head:[]},chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"}});return t.push(...r.map(i=>e.map((s,n)=>w.tableCell(s.value(i),n)))),t.toString()}function os(r){return{0:"received",1:"parsing",2:"parsed",3:"parse_failed",4:"replied"}[r]??r}function us(r){return{0:"pending",1:"processing",2:"done",3:"failed"}[r]??r}function as(r){return Zt(r.data?.list||[],[{header:"Thread ID",value:e=>e.threadId},{header:"Subject",value:e=>e.subject},{header:"Participants",value:e=>e.participants},{header:"Last Message",value:e=>e.lastMessageAt},{header:"Count",value:e=>e.messageCount},{header:"Status",value:e=>e.status}])}function Qe(r){return Zt(r.data?.list||r.data||[],[{header:"Message UID",value:e=>e.messageUid},{header:"Thread ID",value:e=>e.threadId},{header:"From",value:e=>e.fromEmail||e.envelopeFrom},{header:"Subject",value:e=>e.subject},{header:"Status",value:e=>os(e.status)},{header:"Agent",value:e=>us(e.agentConsumeStatus)},{header:"Received",value:e=>e.receivedAt}])}function et(r){return JSON.stringify(r.data??r,null,2)}function Qt(r){let e=r.data||{};return[w.success(w.heading("Sent")),e.messageUid?`${w.label("messageUid")}: ${e.messageUid}`:null,e.requestId?`${w.label("requestId")}: ${e.requestId}`:null,e.emailIds?`${w.label("emailIds")}: ${e.emailIds.join(", ")}`:null].filter(Boolean).join(`
|
|
35
|
+
`)}function aa(r,{httpStatus:e}={}){if(!r||typeof r!="object"||typeof r.code!="number")throw new $("Invalid server response format",{code:"invalid_response",exitCode:5,status:e,data:r});if(r.code!==200)throw new $(r.message||"Request failed",{code:ls(r.code),exitCode:kt(r.code),status:r.code,data:r});return r}async function G(r){let e;try{e=await r.json()}catch(t){throw new $("Invalid server response format",{code:"invalid_response",exitCode:5,status:r.status,cause:t})}if(r.status<200||r.status>=300)throw new $(e?.message||`Request failed with status code ${r.status}`,{code:ls(r.status),exitCode:kt(r.status),status:r.status,data:e});return aa(e,{httpStatus:r.status})}function ls(r){return r===401||r===403?"auth_error":r===404?"not_found":r===409?"state_conflict":r===400?"validation_error":"server_error"}var J=class extends Error{name="KyError";get isKyError(){return!0}};var De=class extends J{name="HTTPError";response;request;options;data;constructor(e,t,i){let s=e.status||e.status===0?e.status:"",n=e.statusText??"",o=`${s} ${n}`.trim(),a=o?`status code ${o}`:"an unknown error";super(`Request failed with ${a}: ${t.method} ${t.url}`),this.response=e,this.request=t,this.options=i}};var de=class extends J{name="NetworkError";request;constructor(e,t){super(`Request failed due to a network error: ${e.method} ${e.url}`,t),this.request=e}};var pe=class extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{typeof e=="string"?t=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(t=e.message)}catch{}super(t),this.value=e}};var oe=class extends J{name="ForceRetryError";customDelay;code;customRequest;constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new pe(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};var tt=class extends Error{name="SchemaValidationError";issues;constructor(e){super("Response schema validation failed"),this.issues=e}};var M=class extends J{name="TimeoutError";request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}};var er=(()=>{let r=!1,e=!1,t=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(t&&i)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type")}catch(s){if(s instanceof Error&&s.message==="unsupported BodyInit type")return!1;throw s}return r&&!e})(),cs=typeof globalThis.AbortController=="function",rt=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",hs=typeof globalThis.ReadableStream=="function",fs=typeof globalThis.FormData=="function",it=["get","post","put","patch","head","delete"],la=()=>{};la();var Ds={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},me=2147483647,ds=40,st=Symbol("stop"),Te=class{options;constructor(e){this.options=e}},ps=r=>new Te(r),ms={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},gs={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var nt=new TextEncoder,ca=r=>{if(!r)return 0;if(r instanceof FormData){let e=0;for(let[t,i]of r)e+=ds,e+=nt.encode(`Content-Disposition: form-data; name="${t}"`).byteLength,e+=typeof i=="string"?nt.encode(i).byteLength:i.size;return e}return r instanceof Blob?r.size:r instanceof ArrayBuffer||ArrayBuffer.isView(r)?r.byteLength:typeof r=="string"?nt.encode(r).byteLength:r instanceof URLSearchParams?nt.encode(r.toString()).byteLength:0},Es=(r,e,t)=>{let i,s=0;return r.pipeThrough(new TransformStream({transform(n,o){if(o.enqueue(n),i){s+=i.byteLength;let a=e===0?0:s/e;a>=1&&(a=1-Number.EPSILON),t?.({percent:a,totalBytes:Math.max(e,s),transferredBytes:s},i)}i=n},flush(){i&&(s+=i.byteLength,t?.({percent:1,totalBytes:Math.max(e,s),transferredBytes:s},i))}}))},Cs=(r,e)=>{if(!r.body)return r;let t={status:r.status,statusText:r.statusText,headers:r.headers};if(r.status===204)return new Response(null,t);let i=Math.max(0,Number(r.headers.get("content-length"))||0);return new Response(Es(r.body,i,e),t)},bs=(r,e,t)=>{if(!r.body)return r;let i=ca(t??r.body);return new Request(r,{duplex:"half",body:Es(r.body,i,e)})};var K=r=>r!==null&&typeof r=="object";var ha=Symbol("replaceOption"),tr=r=>K(r)&&r[ha]===!0?{isReplace:!0,value:r.value}:{isReplace:!1,value:r};var ve=(...r)=>{for(let e of r)if((!K(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return sr({},...r)},ir=(r={},e={})=>{let t=new globalThis.Headers(r),i=e instanceof globalThis.Headers,s=new globalThis.Headers(e);for(let[n,o]of s.entries())i&&o==="undefined"||o===void 0?t.delete(n):t.set(n,o);return t},rr=r=>{if(!K(r)||Array.isArray(r))return!1;let e=Object.getPrototypeOf(r);return e===Object.prototype||e===null},ge=r=>{if(r instanceof URLSearchParams){let e=new URLSearchParams(r),t=r[ie];return t&&(e[ie]=new Set(t)),e}return r instanceof globalThis.Headers?new globalThis.Headers(r):Array.isArray(r)?[...r]:rr(r)?{...r}:r},fa=r=>Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),Da=(r,e)=>rr(r)&&rr(e)?fa({...r,...e}):ir(r,e);function Ie(r,e,t){return Object.hasOwn(e,t)&&e[t]===void 0?[]:sr(r[t]??[],e[t]??[])}var ot=(r={},e={})=>({init:Ie(r,e,"init"),beforeRequest:Ie(r,e,"beforeRequest"),beforeRetry:Ie(r,e,"beforeRetry"),beforeError:Ie(r,e,"beforeError"),afterResponse:Ie(r,e,"afterResponse")}),ie=Symbol("deletedParameters"),da=(r,e)=>{let t=new URLSearchParams,i=new Set;for(let s of[r,e])if(s!==void 0)if(s instanceof URLSearchParams){for(let[o,a]of s.entries())t.append(o,a),i.delete(o);let n=s[ie];if(n)for(let o of n)t.delete(o),i.add(o)}else if(Array.isArray(s))for(let n of s){if(!Array.isArray(n)||n.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");t.append(String(n[0]),String(n[1])),i.delete(String(n[0]))}else if(K(s))for(let[n,o]of Object.entries(s))o===void 0?(t.delete(n),i.add(n)):(t.append(n,String(o)),i.delete(n));else{let n=new URLSearchParams(s);for(let[o,a]of n.entries())t.append(o,a),i.delete(o)}return i.size>0&&(t[ie]=i),t},sr=(...r)=>{let e={},t={},i={},s,n=[];for(let o of r)if(Array.isArray(o))Array.isArray(e)||(e=[]),e=[...e,...o];else if(K(o)){for(let[a,u]of Object.entries(o)){if(a==="signal"&&u instanceof globalThis.AbortSignal){n.push(u);continue}let l=tr(u),{isReplace:c}=l;if(u=l.value,a==="context"){if(u!=null&&(!K(u)||Array.isArray(u)))throw new TypeError("The `context` option must be an object");e={...e,context:u==null?{}:c?{...u}:{...e.context,...u}};continue}if(a==="searchParams"){u==null?s=void 0:c?s=u:s=s===void 0?u:da(s,u);continue}K(u)&&!c&&a in e&&(u=sr(e[a],u)),e={...e,[a]:u}}if(K(o.hooks)){let{value:a,isReplace:u}=tr(o.hooks);i=ot(u?{}:i,a),e.hooks=i}if(K(o.headers)){let{value:a,isReplace:u}=tr(o.headers);t=u?ge(a):Da(t,a),e.headers=t}}return s!==void 0&&(e.searchParams=s),n.length>0&&(n.length===1?e.signal=n[0]:rt?e.signal=AbortSignal.any(n):e.signal=n.at(-1)),e};var Fs=r=>it.includes(r)?r.toUpperCase():r,pa=["get","put","head","delete","options","trace"],ma=[408,413,429,500,502,503,504],ga=[413,429,503],ws={limit:2,methods:pa,statusCodes:ma,afterStatusCodes:ga,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:r=>.3*2**(r-1)*1e3,jitter:void 0,retryOnTimeout:!1},ys=(r={})=>{if(typeof r=="number")return{...ws,limit:r};if(r.methods&&!Array.isArray(r.methods))throw new Error("retry.methods must be an array");if(r.statusCodes&&!Array.isArray(r.statusCodes))throw new Error("retry.statusCodes must be an array");let e=Object.fromEntries(Object.entries({...r,methods:r.methods?.map(t=>t.toLowerCase())}).filter(([,t])=>t!==void 0));return{...ws,...e}};async function nr(r,e,t,i){return new Promise((s,n)=>{let o=setTimeout(()=>{t&&t.abort(),n(new M(r))},i.timeout);i.fetch(r,e).then(s).catch(n).then(()=>{clearTimeout(o)})})}async function ut(r,{signal:e}){return new Promise((t,i)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",s,{once:!0}));function s(){clearTimeout(n),i(e.reason)}let n=setTimeout(()=>{e?.removeEventListener("abort",s),t()},r)})}var xs=r=>{let e={};for(let t in r)Object.hasOwn(r,t)&&!(t in gs)&&!(t in ms)&&(e[t]=r[t]);return e},As=r=>r===void 0?!1:Array.isArray(r)?r.length>0:r instanceof URLSearchParams?r.size>0||!!r[ie]?.size:typeof r=="object"?Object.keys(r).length>0:typeof r=="string"?r.trim().length>0:!!r;var Ea=Object.prototype.toString,Ca=r=>Ea.call(r)==="[object Error]",ba=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function or(r){if(!(r&&Ca(r)&&r.name==="TypeError"&&typeof r.message=="string"))return!1;let{message:t,stack:i}=r;return t==="Load failed"?i===void 0||"__sentry_captured__"in r:t.startsWith("error sending request for url")||t==="Failed to fetch"||t.startsWith("Failed to fetch (")&&t.endsWith(")")?!0:ba.has(t)}var ur=(r,e)=>r instanceof e||r?.name===e.name;function Os(r){return ur(r,De)}function Rs(r){return ur(r,de)}function Ss(r){return ur(r,M)}var wa=10*1024*1024,Fa="The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl",Le=Symbol("timedOutResponseData"),ya=r=>{let e=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(r),t=e?.[1]??e?.[2];if(t)try{return new TextDecoder(t)}catch{}return new TextDecoder},_s="The `schema` argument must follow the Standard Schema specification",xa=r=>typeof r!="object"?r:{...r,...r.methods&&{methods:[...r.methods]},...r.statusCodes&&{statusCodes:[...r.statusCodes]},...r.afterStatusCodes&&{afterStatusCodes:[...r.afterStatusCodes]}},Is=Object.prototype.toString,$s=r=>r instanceof globalThis.Request||Is.call(r)==="[object Request]",Be=r=>r instanceof globalThis.Response||Is.call(r)==="[object Response]",Aa=r=>Array.isArray(r)?r.map(e=>[...e]):ge(r);function Oa(r){let e={...r,json:ge(r.json),context:ge(r.context),headers:ge(r.headers),searchParams:Aa(r.searchParams)};return r.retry!==void 0&&(e.retry=xa(r.retry)),e}var Ts=async(r,e)=>{if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError(_s);let t=e["~standard"];if(typeof t!="object"||t===null||typeof t.validate!="function")throw new TypeError(_s);let i=await t.validate(r);if(i.issues)throw new tt(i.issues);return i.value},qe=class r{static create(e,t){let i=t.hooks?.init??[],s=i.length>0?Oa(t):t;for(let u of i)u(s);let n=new r(e,s),o=async()=>{if(typeof n.#e.timeout=="number"&&n.#e.timeout>me)throw new RangeError(`The \`timeout\` option cannot be greater than ${me}`);if(typeof n.#e.totalTimeout=="number"&&n.#e.totalTimeout>me)throw new RangeError(`The \`totalTimeout\` option cannot be greater than ${me}`);await Promise.resolve();let u=await n.#L(),l=u??await n.#O(async()=>n.#g()),c=u!==void 0||n.#m();for(;;){if(l===void 0)return l;if(Be(l))try{l=await n.#B(l)}catch(d){if(!(d instanceof oe))throw d;let f=await n.#p(d,async()=>n.#g());if(f===void 0)return f;l=f,c=n.#m();continue}let h=l;if(!h.ok&&h.type!=="opaque"&&(typeof n.#e.throwHttpErrors=="function"?n.#e.throwHttpErrors(h.status):n.#e.throwHttpErrors)){let d=new De(h,n.#u(h),n.#o()),f=d;if(d.data=await n.#$(h),c)throw f;let D=await n.#p(d,async()=>n.#g());if(D===void 0)return D;l=D,c=n.#m();continue}break}if(!Be(l))return l;if(n.#y(l),n.#e.onDownloadProgress){if(typeof n.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!hs)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");let h=l.clone();return n.#i(l),Cs(h,n.#e.onDownloadProgress)}return l},a=(async()=>{try{return await o()}catch(u){if(!(u instanceof Error)||n.#w.has(u))throw u;let l=u;for(let c of n.#e.hooks.beforeError){let h=await c({request:n.request,options:n.#o(),error:l,retryCount:n.#r});h instanceof Error&&(l=h)}throw l}finally{let u=n.#b;n.#d(u?.body??void 0),n.request!==u&&n.#d(n.request.body??void 0)}})();for(let[u,l]of Object.entries(Ds))u==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(a[u]=async c=>{n.request.headers.set("accept",n.request.headers.get("accept")||l);let h=await a;if(u!=="json")return h[u]();let d=await h.text();if(d==="")return c!==void 0?Ts(void 0,c):JSON.parse(d);let f=s.parseJson?await s.parseJson(d,{request:n.#u(h),response:h}):JSON.parse(d);return c===void 0?f:Ts(f,c)});return a}static#S(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)):e}request;#s;#r=0;#t;#e;#b;#a;#w=new WeakSet;#l;#D;#c=!1;#F=new WeakMap;constructor(e,t={}){if(this.#t=e,Object.hasOwn(t,"prefixUrl"))throw new Error(Fa);if(this.#e={...t,headers:ir(this.#t.headers,t.headers),hooks:ot({},t.hooks),method:Fs(t.method??this.#t.method??"GET"),prefix:String(t.prefix||""),retry:ys(t.retry),throwHttpErrors:t.throwHttpErrors??!0,timeout:t.timeout??1e4,totalTimeout:t.totalTimeout??!1,fetch:t.fetch??globalThis.fetch.bind(globalThis),context:t.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(typeof this.#t=="string"){if(this.#e.prefix){let s=this.#e.prefix.replace(/\/+$/,""),n=this.#t.replace(/^\/+/,"");this.#t=`${s}/${n}`}if(this.#e.baseUrl){let s;try{s=new URL(this.#t)}catch{}s||(this.#t=new URL(this.#t,new Request(this.#e.baseUrl).url))}}cs&&rt&&(this.#a=this.#e.signal??this.#t.signal,this.#s=new globalThis.AbortController,this.#e.signal=this.#A()),er&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));let i=t.headers&&new globalThis.Headers(t.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(fs&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!i&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),As(this.#e.searchParams)){let s=new URL(this.request.url),n=this.#e.searchParams?.[ie];if(n)for(let o of n)s.searchParams.delete(o);if(typeof this.#e.searchParams=="string"){let o=this.#e.searchParams.replace(/^\?/,"");o!==""&&(s.search=s.search?`${s.search}&${o}`:`?${o}`)}else{let o=new URLSearchParams(r.#S(this.#e.searchParams));for(let[a,u]of o.entries())s.searchParams.append(a,u)}if(this.#e.searchParams&&typeof this.#e.searchParams=="object"&&!Array.isArray(this.#e.searchParams)&&!(this.#e.searchParams instanceof URLSearchParams))for(let[o,a]of Object.entries(this.#e.searchParams))a===void 0&&s.searchParams.delete(o);this.request=new globalThis.Request(s,this.#e)}if(this.#e.onUploadProgress&&typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");this.#D=typeof this.#e.totalTimeout=="number"?this.#R():void 0}#n(){let e=this.#e.retry.delay(this.#r+1),t=e;return this.#e.retry.jitter===!0?t=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(t=this.#e.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e)),Math.min(this.#e.retry.backoffLimit,t)}async#_(e){if(this.#r>=this.#e.retry.limit)throw e;let t=e instanceof Error?e:new pe(e);if(t instanceof oe)return t.customDelay??this.#n();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){let i=await this.#e.retry.shouldRetry({error:t,retryCount:this.#r+1});if(i===!1)throw e;if(i===!0)return this.#n()}if(Ss(e)){if(!this.#e.retry.retryOnTimeout)throw e;return this.#n()}if(Os(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;let i=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(i&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let s=Number(i)*1e3;return Number.isNaN(s)?s=Date.parse(i)-Date.now():s>=Date.parse("2024-01-01")&&(s-=Date.now()),Number.isFinite(s)?(s=Math.max(0,s),Math.min(this.#e.retry.maxRetryAfter,s)):Math.min(this.#e.retry.maxRetryAfter,this.#n())}if(e.response.status===413)throw e;return this.#n()}if(!Rs(e))throw e;return this.#n()}#y(e){let t=this.#u(e);return this.#e.parseJson&&(e.json=async()=>{let i=await e.text();return i===""?JSON.parse(i):this.#e.parseJson(i,{request:t,response:e})}),e}async#$(e){let t=await this.#I(e,this.#x());if(t===Le){this.#h();return}if(!t)return;if(!this.#T(e.headers.get("content-type")??""))return t;let i=await this.#v(t,e,this.#x(),this.#u(e));if(i===Le){this.#h();return}return i}#x(){let e=this.#e.timeout===!1?1e4:this.#e.timeout,t=this.#f();if(t===void 0)return e;if(t<=0)throw new M(this.request);return Math.min(e,t)}#T(e){let t=(e.split(";",1)[0]??"").trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(t)}async#I(e,t){let{body:i}=e;if(!i)try{return await e.text()}catch{return}let s;try{s=i.getReader()}catch{return}let n=ya(e.headers.get("content-type")??""),o=[],a=0,u=(async()=>{try{for(;;){let{done:h,value:d}=await s.read();if(h)break;if(a+=d.byteLength,a>wa){s.cancel().catch(()=>{});return}o.push(n.decode(d,{stream:!0}))}}catch{return}return o.push(n.decode()),o.join("")})(),l=new Promise(h=>{let d=setTimeout(()=>{h(Le)},t);u.finally(()=>{clearTimeout(d)})}),c=await Promise.race([u,l]);return c===Le&&s.cancel().catch(()=>{}),c}async#v(e,t,i,s){let n;try{return await Promise.race([Promise.resolve().then(()=>this.#e.parseJson?this.#e.parseJson(e,{request:s,response:t}):JSON.parse(e)),new Promise(o=>{n=setTimeout(()=>{o(Le)},i)})])}catch{return}finally{clearTimeout(n)}}#d(e){e&&e.cancel().catch(()=>{})}#i(e){this.#d(e.body??void 0)}#A(){return this.#a?AbortSignal.any([this.#a,this.#s.signal]):this.#s.signal}#h(){let e=this.#f();if(e!==void 0&&e<=0)throw new M(this.request)}async#L(){for(let e of this.#e.hooks.beforeRequest){let t=await e({request:this.request,options:this.#o(),retryCount:0});if($s(t))this.#E(t);else if(Be(t))return t}}async#B(e){let t=this.#u(e);for(let i of this.#e.hooks.afterResponse){let s=this.#C(e.clone(),t);this.#y(s);let n;try{n=await i({request:this.request,options:this.#o(),response:s,retryCount:this.#r})}catch(a){throw s!==e&&this.#i(s),this.#i(e),a}if(n instanceof Te)throw s!==e&&this.#i(s),this.#i(e),new oe(n.options);let o=Be(n)?this.#C(n,t):e;s!==e&&s!==o&&s.body!==o.body&&this.#i(s),e!==o&&e.body!==o.body&&this.#i(e),e=o}return e}async#O(e){try{return await e()}catch(t){return this.#p(t,e)}}async#p(e,t){this.#c=!1;let i=Math.min(await this.#_(e),me),s={signal:this.#a},n=this.#f();if(n!==void 0){if(n<=0)throw new M(this.request);if(i>=n)throw await ut(n,s),new M(this.request)}if(await ut(i,s),this.#h(),e instanceof oe&&e.customRequest){let o=new globalThis.Request(e.customRequest,this.#e.signal?{signal:this.#e.signal}:void 0);this.#E(o)}for(let o of this.#e.hooks.beforeRetry){let a;try{a=await o({request:this.request,options:this.#o(),error:e,retryCount:this.#r+1})}catch(u){throw u instanceof Error&&u!==e&&this.#w.add(u),u}if($s(a)){this.#E(a);break}if(Be(a))return this.#c=!0,this.#r++,a;if(a===st)return}return this.#h(),this.#r++,this.#O(t)}#m(){let e=this.#c;return this.#c=!1,e}async#g(){this.#s?.signal.aborted&&(this.#s=new globalThis.AbortController,this.#e.signal=this.#A(),this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));let e=xs(this.#e),t=this.#e.retry.limit>0?this.request.clone():void 0,i=this.#q(this.request,this.#e.body??void 0);this.#b=i,t&&(this.request=t);try{let s=this.#f();if(s!==void 0&&s<=0)throw new M(this.request);let n=this.#e.timeout===!1?s:s===void 0?this.#e.timeout:Math.min(this.#e.timeout,s),o=n===void 0?await this.#e.fetch(i,e):await nr(i,e,this.#s,{timeout:n,fetch:this.#e.fetch});return this.#C(o,i)}catch(s){throw or(s)?new de(this.request,{cause:s}):s}}#f(){if(this.#D===void 0)return;let e=this.#R()-this.#D;return Math.max(0,this.#e.totalTimeout-e)}#R(){return globalThis.performance?.now()??Date.now()}#o(){if(!this.#l){let{hooks:e,json:t,parseJson:i,stringifyJson:s,searchParams:n,timeout:o,totalTimeout:a,throwHttpErrors:u,fetch:l,...c}=this.#e;this.#l=Object.freeze(c)}return this.#l}#E(e){this.#l=void 0,this.request=e}#u(e){return this.#F.get(e)??this.request}#C(e,t){return this.#F.set(e,t),e}#q(e,t){return!this.#e.onUploadProgress||!e.body||!er?e:bs(e,this.#e.onUploadProgress,t??this.#e.body??void 0)}};var ar=r=>{let e=(t,i)=>qe.create(t,ve(r,i));for(let t of it)e[t]=(i,s)=>qe.create(i,ve(r,s,{method:t}));return e.create=t=>ar(ve(t)),e.extend=t=>(typeof t=="function"&&(t=t(r??{})),ar(ve(r,t))),e.stop=st,e.retry=ps,e},Ra=ar(),vs=Ra;var bt=ae(Oo(),1);var Bh={sg:"https://www.engagelab.com",tr:"https://email-tr.engagelab.com"};async function Ro({cliOptions:r={},env:e=process.env,readConfig:t=Ae,requireSecretKey:i=!0}={}){let s=await t(),n=r.secretKey||e.ENGAGELAB_EMAIL_SECRET_KEY||s.secretKey,o=r.baseUrl||e.ENGAGELAB_EMAIL_BASE_URL||s.baseUrl||qh(n);if(!o)throw Ge("Missing base URL. Set --base-url, ENGAGELAB_EMAIL_BASE_URL, or config set.");if(i&&!n)throw Ge("Missing Secret Key. Set --secret-key, ENGAGELAB_EMAIL_SECRET_KEY, or config set.");if(i&&!n.startsWith("sk_"))throw Ge("Secret Key must start with sk_");return{baseUrl:o,secretKey:n}}function qh(r){if(!r||!r.startsWith("sk_"))return;let[,e]=r.split("_");return Bh[e?.toLowerCase()]}var _o=require("node:child_process"),$o=require("node:readline/promises");function Nh(r){return`npm install -g ${r}@latest`}function Ph(r){return{command:process.platform==="win32"?"npm.cmd":"npm",args:["install","-g",`${r}@latest`],display:Nh(r)}}async function To({packageName:r,currentVersion:e,latestVersion:t,jsonMode:i,stdin:s=process.stdin,stderr:n=process.stderr,confirm:o=Vh,runCommand:a=Uh,env:u=process.env}){let l=Ph(r),c={currentVersion:e,latestVersion:t,updateCommand:l.display};if(i)throw new $(Mh(r,e,t,l.display),{code:"update_required",exitCode:1,data:c});if(!kh(s,n,u))throw new $(Hh(r,e,t,l.display),{code:"update_required",exitCode:1,data:c});jh(n,r,e,t,l.display),await o(s),n.write(`${w.start(`Updating ${r}...`)}
|
|
36
|
+
`);let h;try{h=await a(l)}catch(d){throw new $(So(r,l.display),{code:"update_failed",exitCode:1,data:{...c,updateError:d instanceof Error?d.message:String(d)},cause:d})}throw h!==0?new $(So(r,l.display),{code:"update_failed",exitCode:1,data:{...c,updateExitCode:h}}):(n.write(`${w.success(`Updated ${r} to ${t}`)}
|
|
37
|
+
`),n.write(`${w.muted("Please run your command again.")}
|
|
38
|
+
`),new $("",{code:"update_completed",exitCode:0,data:{...c,silent:!0}}))}function kh(r,e,t=process.env){return!!(r?.isTTY&&e?.isTTY&&!t.CI)}function jh(r,e,t,i,s){r.write(`${w.failure(`A newer version is available: ${t} -> ${i}`)}
|
|
39
|
+
|
|
40
|
+
`),r.write(`This command requires the latest CLI version before continuing.
|
|
41
|
+
`),r.write(`Press Enter to update automatically, or press Ctrl+C to cancel.
|
|
42
|
+
|
|
43
|
+
`),r.write(`${w.heading("Command:")}
|
|
44
|
+
${w.command(s)}
|
|
45
|
+
`)}function Mh(r,e,t,i){return[`A newer version of ${r} is required: ${e} -> ${t}`,`Please run: ${i}`].join(`
|
|
46
|
+
`)}function Hh(r,e,t,i){return[`A newer version of ${r} is required: ${e} -> ${t}`,"This session is not interactive, so automatic update cannot continue.",`Please run: ${i}`].join(`
|
|
47
|
+
`)}function So(r,e){return[`Failed to update ${r} automatically.`,`Please run manually: ${e}`].join(`
|
|
48
|
+
`)}async function Vh(r){let e=(0,$o.createInterface)({input:r,output:void 0,terminal:!1});try{await e.question("")}finally{e.close()}}function Uh(r){return new Promise((e,t)=>{let i=(0,_o.spawn)(r.command,r.args,{stdio:"inherit"});i.once("error",t),i.once("exit",s=>e(s??1))})}var Io=require("node:fs"),vo=require("node:path"),Gh="1.4.0",be=Gh??Wh();function Wh(){try{return JSON.parse((0,Io.readFileSync)((0,vo.join)(process.cwd(),"package.json"),"utf8")).version||"0.0.0"}catch{return"0.0.0"}}var zh="/api/email/agent/v1",Lo="engagelab-email-cli",Xh="https://registry.npmjs.org",Jh=1500;async function Z(r){await Kh(r);let e=await Ro({cliOptions:r.optsWithGlobals()});return vs.extend({prefix:Bo(e.baseUrl),headers:{Authorization:`Bearer ${e.secretKey}`},timeout:3e4,throwHttpErrors:!1})}function W(r){return`${zh}${r}`}async function te(r,e,t){if(r.opts().json)return t();process.stderr.write(`${w.start(`Starting ${e}...`)}
|
|
49
|
+
`);try{let i=await t();return process.stderr.write(`${w.success(`Done ${e}`)}
|
|
50
|
+
`),i}catch(i){throw process.stderr.write(`${w.failure(`Failed ${e}`)}
|
|
51
|
+
`),i}}function re(r,e,t){r.opts().json&&r.parent?.parent?.stdout?.write?.("");let i=r.programOutput?.stdout||process.stdout;if(r.opts().json){i.write(`${JSON.stringify(e,null,2)}
|
|
35
52
|
`);return}i.write(`${t(e)}
|
|
36
|
-
`)}function
|
|
37
|
-
Stopped listening.
|
|
38
|
-
`),process.exit(130)};if(process.once("SIGINT",
|
|
39
|
-
`),u===void 0){let
|
|
53
|
+
`)}function He(r,e){let t={};for(let[i,s=i]of Object.entries(e))t[s]=r[i];return ii(t)}function _r(r,e){let t={};for(let i of e)r[i]!==void 0&&(t[i]=r[i]);return t}async function Kh(r){if(process.env.ENGAGELAB_EMAIL_CLI_DISABLE_UPDATE_CHECK)return;let e;try{let t=Bo(process.env.ENGAGELAB_EMAIL_CLI_UPDATE_REGISTRY_URL||Xh),i=await fetch(`${t}/${Lo}/latest`,{signal:AbortSignal.timeout(Jh),headers:{accept:"application/json"}});if(!i.ok)return;e=(await i.json()).version}catch{return}!e||!bt.default.valid(e)||!bt.default.valid(be)||bt.default.gt(e,be)&&await To({packageName:Lo,currentVersion:be,latestVersion:e,jsonMode:r.opts().json})}function Bo(r){return r.endsWith("/")?r.slice(0,-1):r}var ue=class{constructor(e){this.client=e}listMessages(e={}){return this.client.get(W("/message/list"),{searchParams:e}).then(G)}getMessage(e){return this.client.get(W("/message/get"),{searchParams:{messageUid:e}}).then(G)}listenMessages(e={}){return this.client.get(W("/message/listen"),{searchParams:e}).then(G)}replyMessage(e,t){return this.client.post(W("/message/reply"),{searchParams:{messageUid:e},json:t}).then(G)}};var wt=class{constructor(e){this.client=e}sendEmail(e){return this.client.post(W("/mail/send"),{json:e}).then(G)}};var Yh=["mailboxId","from","to","cc","bcc","replyTo","subject","text","html","textFile","htmlFile","previewText","attachment","sandbox"],Zh=["subject","text","html","textFile","htmlFile","cc","bcc","replyTo","previewText","attachment","sandbox"],Qh=10,ef=5,tf=2,rf=5;function Po(r){let e=r.command("emails").description("Work with email messages");sf(e),nf(e)}function sf(r){r.command("send").description("Send a new email").option("--mailbox-id <id>","Mailbox ID",j).option("--from <email>","Sender email address").option("--to <email>","Recipient email address",z).option("--subject <text>","Email subject").option("--text <text>","Plain text body").option("--html <html>","HTML body").option("--text-file <path>","Read plain text body from file").option("--html-file <path>","Read HTML body from file").option("--cc <email>","CC address",z).option("--bcc <email>","BCC address",z).option("--reply-to <email>","Reply-To address",z).option("--preview-text <text>","Email preview text").option("--attachment <path>","Attach local file",z).option("--sandbox","Send in sandbox mode").option("--json","Output raw JSON").action(async(e,t)=>{let i=await Mt(_r(e,Yh));of(i);let s=new wt(await Z(t)),n=await te(t,"Sending email",()=>s.sendEmail(i));re(t,n,Qt)})}function nf(r){let e=r.command("receiving").description("Work with inbound email");e.command("list").description("List inbound messages").option("--mailbox-id <id>","Filter by mailbox ID",j).option("--keyword <text>","Search keyword").option("--page-no <number>","Page number",j).option("--page-size <number>","Page size",j).option("--json","Output raw JSON").action(async(t,i)=>{let s=new ue(await Z(i)),n=He(t,{mailboxId:"mailboxId",keyword:"keyword",pageNo:"pageNo",pageSize:"pageSize"}),o=await te(i,"Fetching inbound messages",()=>s.listMessages(n));re(i,o,Qe)}),e.command("get").description("Get inbound message details").argument("<message-uid>","Message UID").option("--json","Output raw JSON").action(async(t,i,s)=>{ce(t,"Message UID is required");let n=new ue(await Z(s)),o=await te(s,"Fetching inbound message",()=>n.getMessage(t));re(s,o,et)}),e.command("listen").description("Poll new inbound messages for Agent processing").option("--after <id>","Cursor ID from the previous result",Oe).option("--limit <number>","Message limit",j).option("--interval <seconds>","Polling interval in seconds (minimum 2)",j).option("--json","Output raw JSON").action(async(t,i)=>{let s=new ue(await Z(i));await af(s,t,i)}),e.command("reply").description("Reply to an inbound message").argument("<message-uid>","Message UID").option("--subject <text>","Reply subject").option("--text <text>","Plain text body").option("--html <html>","HTML body").option("--text-file <path>","Read plain text body from file").option("--html-file <path>","Read HTML body from file").option("--cc <email>","CC address",z).option("--bcc <email>","BCC address",z).option("--reply-to <email>","Reply-To address",z).option("--preview-text <text>","Email preview text").option("--attachment <path>","Attach local file",z).option("--sandbox","Send in sandbox mode").option("--json","Output raw JSON").action(async(t,i,s)=>{ce(t,"Message UID is required");let n=await Mt(_r(i,Zh));uf(n);let o=new ue(await Z(s)),a=await te(s,"Sending reply",()=>o.replyMessage(t,n));re(s,a,Qt)})}function of(r){if(!r.mailboxId)throw _("mailboxId is required");if(!Array.isArray(r.to)||r.to.length===0)throw _("At least one recipient is required");if(!r.subject)throw _("subject is required");ko(r)}function uf(r){ko(r)}function ko(r){if(!r.text&&!r.html)throw _("At least one of text or html is required")}async function af(r,e,t){let i=process.stdout,s=process.stderr,n=!!e.json,o=e.limit??Qh,a=e.interval??ef;lf(a);let u=e.after,l=0,c,h=!1,d=()=>{h=!0,c&&clearTimeout(c),n||s.write(`
|
|
54
|
+
${w.muted("Stopped listening.")}
|
|
55
|
+
`),process.exit(130)};if(process.once("SIGINT",d),process.once("SIGTERM",d),n||s.write(`${w.start("Connecting...")}
|
|
56
|
+
`),u===void 0){let D=await r.listenMessages({limit:1});u=No(qo(D))}n||(s.write(`${w.success("Ready")}
|
|
40
57
|
|
|
41
|
-
`),
|
|
42
|
-
`),
|
|
58
|
+
`),s.write(`${w.heading("Polling:")} every ${a}s
|
|
59
|
+
`),s.write(`${w.muted("Listening for new inbound emails. Press Ctrl+C to stop.")}
|
|
43
60
|
|
|
44
|
-
`));let
|
|
45
|
-
`):
|
|
46
|
-
`),l>=
|
|
47
|
-
`),process.exit(5)})},a*1e3))}};
|
|
48
|
-
`),process.exit(5)})},a*1e3),await new Promise(()=>{})}function
|
|
49
|
-
`);return}for(let i of e)r.write(`${
|
|
50
|
-
`)}function
|
|
51
|
-
`)}
|
|
52
|
-
`),process.exitCode=i.exitCode}}
|
|
61
|
+
`));let f=async()=>{if(!h)try{let D=u===void 0?{limit:o}:{after:u,limit:o},E=await r.listenMessages(D),C=qo(E);C.length>0&&(u=No(C)??u,hf(i,C,n)),l=0}catch(D){l+=1;let E=D instanceof Error?D.message:String(D);if(n?s.write(`${JSON.stringify({error:{code:"poll_error",message:E}})}
|
|
62
|
+
`):s.write(`${w.muted(`[${jo()}]`)} ${w.warning(E)}
|
|
63
|
+
`),l>=rf)throw _("Exiting after 5 consecutive API failures.")}finally{h||(c=setTimeout(()=>{f().catch(D=>{let E=D instanceof Error?D.message:String(D);s.write(`${w.failure(E)}
|
|
64
|
+
`),process.exit(5)})},a*1e3))}};c=setTimeout(()=>{f().catch(D=>{let E=D instanceof Error?D.message:String(D);s.write(`${w.failure(E)}
|
|
65
|
+
`),process.exit(5)})},a*1e3),await new Promise(()=>{})}function lf(r){if(!Number.isInteger(r)||r<tf)throw _("Polling interval must be at least 2 seconds.")}function qo(r){return Array.isArray(r.data)?r.data:Array.isArray(r.data?.list)?r.data.list:[]}function No(r){let e=r.map(cf).filter(i=>i!==void 0);if(e.length===0)return;let t=e.map(Number).filter(Number.isFinite);return t.length===e.length?Math.max(...t):e.at(-1)}function cf(r){return r.id??r.messageId??r.messageUid}function hf(r,e,t){if(t){for(let i of e)r.write(`${JSON.stringify(i)}
|
|
66
|
+
`);return}for(let i of e)r.write(`${ff(i)}
|
|
67
|
+
`)}function jo(){return new Date().toLocaleTimeString("en-GB",{hour12:!1})}function ff(r){let e=r.fromEmail||r.envelopeFrom||"(unknown sender)",t=Df(r.to||r.toEmail||r.recipients),i=df(r.subject||"(no subject)",60),s=r.messageUid||r.id||"",n=t?`${e} -> ${t}`:e;return w.listenMessage({time:jo(),route:n,subject:i,id:s})}function Df(r){return Array.isArray(r)?r.join(", "):r||""}function df(r,e){let t=String(r);return t.length<=e?t:`${t.slice(0,e-3)}...`}var we=class{constructor(e){this.client=e}listThreads(e={}){return this.client.get(W("/thread/list"),{searchParams:e}).then(G)}getThread(e){return this.client.get(W("/thread/get"),{searchParams:{threadId:e}}).then(G)}listThreadMessages(e,t={}){return this.client.get(W("/thread/messages"),{searchParams:{threadId:e,...t}}).then(G)}};function Mo(r){let e=r.command("threads").description("Work with email threads");e.command("list").description("List threads").option("--mailbox-id <id>","Filter by mailbox ID",j).option("--subject <text>","Search normalized subject").option("--participant <email>","Search participant").option("--start-time <timestamp>","Latest message start timestamp in milliseconds",Oe).option("--end-time <timestamp>","Latest message end timestamp in milliseconds",Oe).option("--page-no <number>","Page number",j).option("--page-size <number>","Page size",j).option("--json","Output raw JSON").action(async(t,i)=>{let s=new we(await Z(i)),n=He(t,{mailboxId:"mailboxId",subject:"subject",participant:"participant",startTime:"startTime",endTime:"endTime",pageNo:"pageNo",pageSize:"pageSize"}),o=await te(i,"Fetching threads",()=>s.listThreads(n));re(i,o,as)}),e.command("get").description("Get thread details").argument("<thread-id>","Thread ID").option("--json","Output raw JSON").action(async(t,i,s)=>{ce(t,"Thread ID is required");let n=new we(await Z(s)),o=await te(s,"Fetching thread",()=>n.getThread(t));re(s,o,et)}),e.command("messages").description("List messages in a thread").argument("<thread-id>","Thread ID").option("--limit <number>","Message limit",j).option("--include-content","Include text/html/headers/attachments").option("--json","Output raw JSON").action(async(t,i,s)=>{ce(t,"Thread ID is required");let n=new we(await Z(s)),o=He(i,{limit:"limit",includeContent:"includeContent"}),a=await te(s,"Fetching thread messages",()=>n.listThreadMessages(t,o));re(s,a,Qe)})}function Ho(r,e){let t={error:{code:e.code||"unknown_error",message:e.message||"Command failed"}};e.data!==void 0&&(t.error.data=e.data),r.write(`${JSON.stringify(t,null,2)}
|
|
68
|
+
`)}function pf(r=new Ur){return r.name("engagelab-email-cli").description("CLI for EngageLab Email Agent workflows").version(be).option("-u, --base-url <url>","EngageLab Email API base URL",process.env.ENGAGELAB_EMAIL_BASE_URL).option("--secret-key <key>","EngageLab Email Secret Key",process.env.ENGAGELAB_EMAIL_SECRET_KEY),Qr(r),Mo(r),Po(r),r}async function Vo(r=process.argv){let e=pf();try{await e.parseAsync(r)}catch(t){let i=zr(t);if(i.data?.silent){process.exitCode=i.exitCode;return}r.includes("--json")?Ho(process.stderr,i):process.stderr.write(`${w.failure(i.message)}
|
|
69
|
+
`),process.exitCode=i.exitCode}}Vo().catch(r=>{process.stderr.write(`${w.failure(r instanceof Error?r.message:String(r))}
|
|
53
70
|
`),process.exitCode=1});
|