npm-check-updates
Version:
Find newer versions of dependencies than what your package.json allows
1,233 lines • 1.81 MB
JavaScript
import { a as vt, i as be, n as Ot, o as Lt, r as ft, t as z } from "./chunks/chunk-D-V8JGID.js";
import { createRequire as Up } from "node:module";
import qe from "path";
import xr from "fs";
import Jt from "os";
import Hp from "util";
import Xe from "fs/promises";
import Si from "node:process";
import ui from "node:os";
import Fl from "node:tty";
import { URL as qp } from "url";
import lt, { dirname as Gp } from "node:path";
import { fileURLToPath as mo } from "node:url";
import { promisify as bu, stripVTControlCharacters as zp } from "node:util";
import Fs, { promises as Ml } from "node:fs";
import Wp, { execFile as Vp } from "node:child_process";
import { text as Yp } from "node:stream/consumers";
var Mt = /* @__PURE__ */ z(((e, t) => {
var r, i, s, d, c = !0;
typeof process < "u" && ({ FORCE_COLOR: r, NODE_DISABLE_COLORS: i, NO_COLOR: s, TERM: d } = process.env || {}, c = process.stdout && process.stdout.isTTY);
var n = {
enabled: !i && s == null && d !== "dumb" && (r != null && r !== "0" || c),
reset: h(0, 0),
bold: h(1, 22),
dim: h(2, 22),
italic: h(3, 23),
underline: h(4, 24),
inverse: h(7, 27),
hidden: h(8, 28),
strikethrough: h(9, 29),
black: h(30, 39),
red: h(31, 39),
green: h(32, 39),
yellow: h(33, 39),
blue: h(34, 39),
magenta: h(35, 39),
cyan: h(36, 39),
white: h(37, 39),
gray: h(90, 39),
grey: h(90, 39),
bgBlack: h(40, 49),
bgRed: h(41, 49),
bgGreen: h(42, 49),
bgYellow: h(43, 49),
bgBlue: h(44, 49),
bgMagenta: h(45, 49),
bgCyan: h(46, 49),
bgWhite: h(47, 49)
};
function u(a, l) {
let f = 0, p, g = "", m = "";
for (; f < a.length; f++)
p = a[f], g += p.open, m += p.close, ~l.indexOf(p.close) && (l = l.replace(p.rgx, p.close + p.open));
return g + l + m;
}
function o(a, l) {
let f = {
has: a,
keys: l
};
return f.reset = n.reset.bind(f), f.bold = n.bold.bind(f), f.dim = n.dim.bind(f), f.italic = n.italic.bind(f), f.underline = n.underline.bind(f), f.inverse = n.inverse.bind(f), f.hidden = n.hidden.bind(f), f.strikethrough = n.strikethrough.bind(f), f.black = n.black.bind(f), f.red = n.red.bind(f), f.green = n.green.bind(f), f.yellow = n.yellow.bind(f), f.blue = n.blue.bind(f), f.magenta = n.magenta.bind(f), f.cyan = n.cyan.bind(f), f.white = n.white.bind(f), f.gray = n.gray.bind(f), f.grey = n.grey.bind(f), f.bgBlack = n.bgBlack.bind(f), f.bgRed = n.bgRed.bind(f), f.bgGreen = n.bgGreen.bind(f), f.bgYellow = n.bgYellow.bind(f), f.bgBlue = n.bgBlue.bind(f), f.bgMagenta = n.bgMagenta.bind(f), f.bgCyan = n.bgCyan.bind(f), f.bgWhite = n.bgWhite.bind(f), f;
}
function h(a, l) {
let f = {
open: `\x1B[${a}m`,
close: `\x1B[${l}m`,
rgx: new RegExp(`\\x1b\\[${l}m`, "g")
};
return function(p) {
return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(a) || (this.has.push(a), this.keys.push(f)), p === void 0 ? this : n.enabled ? u(this.keys, p + "") : p + "") : p === void 0 ? o([a], [f]) : n.enabled ? u([f], p + "") : p + "";
};
}
t.exports = n;
})), Kp = /* @__PURE__ */ z(((e, t) => {
t.exports = (r, i) => {
if (!(r.meta && r.name !== "escape")) {
if (r.ctrl) {
if (r.name === "a") return "first";
if (r.name === "c" || r.name === "d") return "abort";
if (r.name === "e") return "last";
if (r.name === "g") return "reset";
}
if (i) {
if (r.name === "j") return "down";
if (r.name === "k") return "up";
}
return r.name === "return" || r.name === "enter" ? "submit" : r.name === "backspace" ? "delete" : r.name === "delete" ? "deleteForward" : r.name === "abort" ? "abort" : r.name === "escape" ? "exit" : r.name === "tab" ? "next" : r.name === "pagedown" ? "nextPage" : r.name === "pageup" ? "prevPage" : r.name === "home" ? "home" : r.name === "end" ? "end" : r.name === "up" ? "up" : r.name === "down" ? "down" : r.name === "right" ? "right" : r.name === "left" ? "left" : !1;
}
};
})), vo = /* @__PURE__ */ z(((e, t) => {
t.exports = (r) => {
const i = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"), s = new RegExp(i, "g");
return typeof r == "string" ? r.replace(s, "") : r;
};
})), jt = /* @__PURE__ */ z(((e, t) => {
var r = "\x1B", i = `${r}[`, s = "\x07", d = {
to(u, o) {
return o ? `${i}${o + 1};${u + 1}H` : `${i}${u + 1}G`;
},
move(u, o) {
let h = "";
return u < 0 ? h += `${i}${-u}D` : u > 0 && (h += `${i}${u}C`), o < 0 ? h += `${i}${-o}A` : o > 0 && (h += `${i}${o}B`), h;
},
up: (u = 1) => `${i}${u}A`,
down: (u = 1) => `${i}${u}B`,
forward: (u = 1) => `${i}${u}C`,
backward: (u = 1) => `${i}${u}D`,
nextLine: (u = 1) => `${i}E`.repeat(u),
prevLine: (u = 1) => `${i}F`.repeat(u),
left: `${i}G`,
hide: `${i}?25l`,
show: `${i}?25h`,
save: `${r}7`,
restore: `${r}8`
}, c = {
up: (u = 1) => `${i}S`.repeat(u),
down: (u = 1) => `${i}T`.repeat(u)
}, n = {
screen: `${i}2J`,
up: (u = 1) => `${i}1J`.repeat(u),
down: (u = 1) => `${i}J`.repeat(u),
line: `${i}2K`,
lineEnd: `${i}K`,
lineStart: `${i}1K`,
lines(u) {
let o = "";
for (let h = 0; h < u; h++) o += this.line + (h < u - 1 ? d.up() : "");
return u && (o += d.left), o;
}
};
t.exports = {
cursor: d,
scroll: c,
erase: n,
beep: s
};
})), Zp = /* @__PURE__ */ z(((e, t) => {
var r = vo(), { erase: i, cursor: s } = jt(), d = (c) => [...r(c)].length;
t.exports = function(c, n) {
if (!n) return i.line + s.to(0);
let u = 0;
const o = c.split(/\r?\n/);
for (let h of o) u += 1 + Math.floor(Math.max(d(h) - 1, 0) / n);
return i.lines(u);
};
})), wu = /* @__PURE__ */ z(((e, t) => {
var r = {
arrowUp: "↑",
arrowDown: "↓",
arrowLeft: "←",
arrowRight: "→",
radioOn: "◉",
radioOff: "◯",
tick: "✔",
cross: "✖",
ellipsis: "…",
pointerSmall: "›",
line: "─",
pointer: "❯"
}, i = {
arrowUp: r.arrowUp,
arrowDown: r.arrowDown,
arrowLeft: r.arrowLeft,
arrowRight: r.arrowRight,
radioOn: "(*)",
radioOff: "( )",
tick: "√",
cross: "×",
ellipsis: "...",
pointerSmall: "»",
line: "─",
pointer: ">"
}, s = process.platform === "win32" ? i : r;
t.exports = s;
})), Jp = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), i = wu(), s = Object.freeze({
password: {
scale: 1,
render: (h) => "*".repeat(h.length)
},
emoji: {
scale: 2,
render: (h) => "😃".repeat(h.length)
},
invisible: {
scale: 0,
render: (h) => ""
},
default: {
scale: 1,
render: (h) => `${h}`
}
}), d = (h) => s[h] || s.default, c = Object.freeze({
aborted: r.red(i.cross),
done: r.green(i.tick),
exited: r.yellow(i.cross),
default: r.cyan("?")
}), n = (h, a, l) => a ? c.aborted : l ? c.exited : h ? c.done : c.default, u = (h) => r.gray(h ? i.ellipsis : i.pointerSmall), o = (h, a) => r.gray(h ? a ? i.pointerSmall : "+" : i.line);
t.exports = {
styles: s,
render: d,
symbols: c,
symbol: n,
delimiter: u,
item: o
};
})), Xp = /* @__PURE__ */ z(((e, t) => {
var r = vo();
t.exports = function(i, s) {
let d = String(r(i) || "").split(/\r?\n/);
return s ? d.map((c) => Math.ceil(c.length / s)).reduce((c, n) => c + n) : d.length;
};
})), Qp = /* @__PURE__ */ z(((e, t) => {
t.exports = (r, i = {}) => {
const s = Number.isSafeInteger(parseInt(i.margin)) ? new Array(parseInt(i.margin)).fill(" ").join("") : i.margin || "", d = i.width;
return (r || "").split(/\r?\n/g).map((c) => c.split(/\s+/g).reduce((n, u) => (u.length + s.length >= d || n[n.length - 1].length + u.length + 1 < d ? n[n.length - 1] += ` ${u}` : n.push(`${s}${u}`), n), [s]).join(`
`)).join(`
`);
};
})), eg = /* @__PURE__ */ z(((e, t) => {
t.exports = (r, i, s) => {
s = s || i;
let d = Math.min(i - s, r - Math.floor(s / 2));
d < 0 && (d = 0);
let c = Math.min(d + s, i);
return {
startIndex: d,
endIndex: c
};
};
})), Yt = /* @__PURE__ */ z(((e, t) => {
t.exports = {
action: Kp(),
clear: Zp(),
style: Jp(),
strip: vo(),
figures: wu(),
lines: Xp(),
wrap: Qp(),
entriesToDisplay: eg()
};
})), nr = /* @__PURE__ */ z(((e, t) => {
var r = be("readline"), { action: i } = Yt(), s = be("events"), { beep: d, cursor: c } = jt(), n = Mt(), u = class extends s {
constructor(o = {}) {
super(), this.firstRender = !0, this.in = o.stdin || process.stdin, this.out = o.stdout || process.stdout, this.onRender = (o.onRender || (() => {
})).bind(this);
const h = r.createInterface({
input: this.in,
escapeCodeTimeout: 50
});
r.emitKeypressEvents(this.in, h), this.in.isTTY && this.in.setRawMode(!0);
const a = (l, f) => {
let p = i(f, this.isSelect);
p === !1 ? this._ && this._(l, f) : typeof this[p] == "function" ? this[p](f) : this.bell();
};
this.close = () => {
this.out.write(c.show), this.in.removeListener("keypress", a), this.in.isTTY && this.in.setRawMode(!1), h.close(), this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value), this.closed = !0;
}, this.in.on("keypress", a);
}
fire() {
this.emit("state", {
value: this.value,
aborted: !!this.aborted,
exited: !!this.exited
});
}
bell() {
this.out.write(d);
}
render() {
this.onRender(n), this.firstRender && (this.firstRender = !1);
}
};
t.exports = u;
})), tg = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), i = nr(), { erase: s, cursor: d } = jt(), { style: c, clear: n, lines: u, figures: o } = Yt(), h = class extends i {
constructor(a = {}) {
super(a), this.transform = c.render(a.style), this.scale = this.transform.scale, this.msg = a.message, this.initial = a.initial || "", this.validator = a.validate || (() => !0), this.value = "", this.errorMsg = a.error || "Please Enter A Valid Value", this.cursor = +!!this.initial, this.cursorOffset = 0, this.clear = n("", this.out.columns), this.render();
}
set value(a) {
!a && this.initial ? (this.placeholder = !0, this.rendered = r.gray(this.transform.render(this.initial))) : (this.placeholder = !1, this.rendered = this.transform.render(a)), this._value = a, this.fire();
}
get value() {
return this._value;
}
reset() {
this.value = "", this.cursor = +!!this.initial, this.cursorOffset = 0, this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.value = this.value || this.initial, this.done = this.aborted = !0, this.error = !1, this.red = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
async validate() {
let a = await this.validator(this.value);
typeof a == "string" && (this.errorMsg = a, a = !1), this.error = !a;
}
async submit() {
if (this.value = this.value || this.initial, this.cursorOffset = 0, this.cursor = this.rendered.length, await this.validate(), this.error) {
this.red = !0, this.fire(), this.render();
return;
}
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
next() {
if (!this.placeholder) return this.bell();
this.value = this.initial, this.cursor = this.rendered.length, this.fire(), this.render();
}
moveCursor(a) {
this.placeholder || (this.cursor = this.cursor + a, this.cursorOffset += a);
}
_(a, l) {
let f = this.value.slice(0, this.cursor), p = this.value.slice(this.cursor);
this.value = `${f}${a}${p}`, this.red = !1, this.cursor = this.placeholder ? 0 : f.length + 1, this.render();
}
delete() {
if (this.isCursorAtStart()) return this.bell();
let a = this.value.slice(0, this.cursor - 1), l = this.value.slice(this.cursor);
this.value = `${a}${l}`, this.red = !1, this.isCursorAtStart() ? this.cursorOffset = 0 : (this.cursorOffset++, this.moveCursor(-1)), this.render();
}
deleteForward() {
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
let a = this.value.slice(0, this.cursor), l = this.value.slice(this.cursor + 1);
this.value = `${a}${l}`, this.red = !1, this.isCursorAtEnd() ? this.cursorOffset = 0 : this.cursorOffset++, this.render();
}
first() {
this.cursor = 0, this.render();
}
last() {
this.cursor = this.value.length, this.render();
}
left() {
if (this.cursor <= 0 || this.placeholder) return this.bell();
this.moveCursor(-1), this.render();
}
right() {
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
this.moveCursor(1), this.render();
}
isCursorAtStart() {
return this.cursor === 0 || this.placeholder && this.cursor === 1;
}
isCursorAtEnd() {
return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
}
render() {
this.closed || (this.firstRender || (this.outputError && this.out.write(d.down(u(this.outputError, this.out.columns) - 1) + n(this.outputError, this.out.columns)), this.out.write(n(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [
c.symbol(this.done, this.aborted),
r.bold(this.msg),
c.delimiter(this.done),
this.red ? r.red(this.rendered) : this.rendered
].join(" "), this.error && (this.outputError += this.errorMsg.split(`
`).reduce((a, l, f) => a + `
${f ? " " : o.pointerSmall} ${r.red().italic(l)}`, "")), this.out.write(s.line + d.to(0) + this.outputText + d.save + this.outputError + d.restore + d.move(this.cursorOffset, 0)));
}
};
t.exports = h;
})), rg = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), i = nr(), { style: s, clear: d, figures: c, wrap: n, entriesToDisplay: u } = Yt(), { cursor: o } = jt(), h = class extends i {
constructor(a = {}) {
super(a), this.isSelect = !0, this.msg = a.message, this.hint = a.hint || "- Use arrow-keys. Return to submit.", this.warn = a.warn || "- This option is disabled", this.cursor = a.initial || 0, this.choices = a.choices.map((l, f) => (typeof l == "string" && (l = {
title: l,
value: f
}), {
title: l && (l.title || l.value || l),
value: l && (l.value === void 0 ? f : l.value),
description: l && l.description,
selected: l && l.selected,
disabled: l && l.disabled
})), this.optionsPerPage = a.optionsPerPage || 10, this.value = (this.choices[this.cursor] || {}).value, this.clear = d("", this.out.columns), this.render();
}
moveCursor(a) {
this.cursor = a, this.value = this.choices[a].value, this.fire();
}
reset() {
this.moveCursor(0), this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.selection.disabled ? this.bell() : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close());
}
first() {
this.moveCursor(0), this.render();
}
last() {
this.moveCursor(this.choices.length - 1), this.render();
}
up() {
this.cursor === 0 ? this.moveCursor(this.choices.length - 1) : this.moveCursor(this.cursor - 1), this.render();
}
down() {
this.cursor === this.choices.length - 1 ? this.moveCursor(0) : this.moveCursor(this.cursor + 1), this.render();
}
next() {
this.moveCursor((this.cursor + 1) % this.choices.length), this.render();
}
_(a, l) {
if (a === " ") return this.submit();
}
get selection() {
return this.choices[this.cursor];
}
render() {
if (this.closed) return;
this.firstRender ? this.out.write(o.hide) : this.out.write(d(this.outputText, this.out.columns)), super.render();
let { startIndex: a, endIndex: l } = u(this.cursor, this.choices.length, this.optionsPerPage);
if (this.outputText = [
s.symbol(this.done, this.aborted),
r.bold(this.msg),
s.delimiter(!1),
this.done ? this.selection.title : this.selection.disabled ? r.yellow(this.warn) : r.gray(this.hint)
].join(" "), !this.done) {
this.outputText += `
`;
for (let f = a; f < l; f++) {
let p, g, m = "", v = this.choices[f];
f === a && a > 0 ? g = c.arrowUp : f === l - 1 && l < this.choices.length ? g = c.arrowDown : g = " ", v.disabled ? (p = this.cursor === f ? r.gray().underline(v.title) : r.strikethrough().gray(v.title), g = (this.cursor === f ? r.bold().gray(c.pointer) + " " : " ") + g) : (p = this.cursor === f ? r.cyan().underline(v.title) : v.title, g = (this.cursor === f ? r.cyan(c.pointer) + " " : " ") + g, v.description && this.cursor === f && (m = ` - ${v.description}`, (g.length + p.length + m.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) && (m = `
` + n(v.description, {
margin: 3,
width: this.out.columns
})))), this.outputText += `${g} ${p}${r.gray(m)}
`;
}
}
this.out.write(this.outputText);
}
};
t.exports = h;
})), ig = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), i = nr(), { style: s, clear: d } = Yt(), { cursor: c, erase: n } = jt(), u = class extends i {
constructor(o = {}) {
super(o), this.msg = o.message, this.value = !!o.initial, this.active = o.active || "on", this.inactive = o.inactive || "off", this.initialValue = this.value, this.render();
}
reset() {
this.value = this.initialValue, this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
deactivate() {
if (this.value === !1) return this.bell();
this.value = !1, this.render();
}
activate() {
if (this.value === !0) return this.bell();
this.value = !0, this.render();
}
delete() {
this.deactivate();
}
left() {
this.deactivate();
}
right() {
this.activate();
}
down() {
this.deactivate();
}
up() {
this.activate();
}
next() {
this.value = !this.value, this.fire(), this.render();
}
_(o, h) {
if (o === " ") this.value = !this.value;
else if (o === "1") this.value = !0;
else if (o === "0") this.value = !1;
else return this.bell();
this.render();
}
render() {
this.closed || (this.firstRender ? this.out.write(c.hide) : this.out.write(d(this.outputText, this.out.columns)), super.render(), this.outputText = [
s.symbol(this.done, this.aborted),
r.bold(this.msg),
s.delimiter(this.done),
this.value ? this.inactive : r.cyan().underline(this.inactive),
r.gray("/"),
this.value ? r.cyan().underline(this.active) : this.active
].join(" "), this.out.write(n.line + c.to(0) + this.outputText));
}
};
t.exports = u;
})), er = /* @__PURE__ */ z(((e, t) => {
var r = class Ms {
constructor({ token: s, date: d, parts: c, locales: n }) {
this.token = s, this.date = d || /* @__PURE__ */ new Date(), this.parts = c || [this], this.locales = n || {};
}
up() {
}
down() {
}
next() {
const s = this.parts.indexOf(this);
return this.parts.find((d, c) => c > s && d instanceof Ms);
}
setTo(s) {
}
prev() {
let s = [].concat(this.parts).reverse();
const d = s.indexOf(this);
return s.find((c, n) => n > d && c instanceof Ms);
}
toString() {
return String(this.date);
}
};
t.exports = r;
})), ng = /* @__PURE__ */ z(((e, t) => {
var r = er(), i = class extends r {
constructor(s = {}) {
super(s);
}
up() {
this.date.setHours((this.date.getHours() + 12) % 24);
}
down() {
this.up();
}
toString() {
let s = this.date.getHours() > 12 ? "pm" : "am";
return /\A/.test(this.token) ? s.toUpperCase() : s;
}
};
t.exports = i;
})), sg = /* @__PURE__ */ z(((e, t) => {
var r = er(), i = (d) => (d = d % 10, d === 1 ? "st" : d === 2 ? "nd" : d === 3 ? "rd" : "th"), s = class extends r {
constructor(d = {}) {
super(d);
}
up() {
this.date.setDate(this.date.getDate() + 1);
}
down() {
this.date.setDate(this.date.getDate() - 1);
}
setTo(d) {
this.date.setDate(parseInt(d.substr(-2)));
}
toString() {
let d = this.date.getDate(), c = this.date.getDay();
return this.token === "DD" ? String(d).padStart(2, "0") : this.token === "Do" ? d + i(d) : this.token === "d" ? c + 1 : this.token === "ddd" ? this.locales.weekdaysShort[c] : this.token === "dddd" ? this.locales.weekdays[c] : d;
}
};
t.exports = s;
})), ag = /* @__PURE__ */ z(((e, t) => {
var r = er(), i = class extends r {
constructor(s = {}) {
super(s);
}
up() {
this.date.setHours(this.date.getHours() + 1);
}
down() {
this.date.setHours(this.date.getHours() - 1);
}
setTo(s) {
this.date.setHours(parseInt(s.substr(-2)));
}
toString() {
let s = this.date.getHours();
return /h/.test(this.token) && (s = s % 12 || 12), this.token.length > 1 ? String(s).padStart(2, "0") : s;
}
};
t.exports = i;
})), og = /* @__PURE__ */ z(((e, t) => {
var r = er(), i = class extends r {
constructor(s = {}) {
super(s);
}
up() {
this.date.setMilliseconds(this.date.getMilliseconds() + 1);
}
down() {
this.date.setMilliseconds(this.date.getMilliseconds() - 1);
}
setTo(s) {
this.date.setMilliseconds(parseInt(s.substr(-this.token.length)));
}
toString() {
return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
}
};
t.exports = i;
})), lg = /* @__PURE__ */ z(((e, t) => {
var r = er(), i = class extends r {
constructor(s = {}) {
super(s);
}
up() {
this.date.setMinutes(this.date.getMinutes() + 1);
}
down() {
this.date.setMinutes(this.date.getMinutes() - 1);
}
setTo(s) {
this.date.setMinutes(parseInt(s.substr(-2)));
}
toString() {
let s = this.date.getMinutes();
return this.token.length > 1 ? String(s).padStart(2, "0") : s;
}
};
t.exports = i;
})), cg = /* @__PURE__ */ z(((e, t) => {
var r = er(), i = class extends r {
constructor(s = {}) {
super(s);
}
up() {
this.date.setMonth(this.date.getMonth() + 1);
}
down() {
this.date.setMonth(this.date.getMonth() - 1);
}
setTo(s) {
s = parseInt(s.substr(-2)) - 1, this.date.setMonth(s < 0 ? 0 : s);
}
toString() {
let s = this.date.getMonth(), d = this.token.length;
return d === 2 ? String(s + 1).padStart(2, "0") : d === 3 ? this.locales.monthsShort[s] : d === 4 ? this.locales.months[s] : String(s + 1);
}
};
t.exports = i;
})), ug = /* @__PURE__ */ z(((e, t) => {
var r = er(), i = class extends r {
constructor(s = {}) {
super(s);
}
up() {
this.date.setSeconds(this.date.getSeconds() + 1);
}
down() {
this.date.setSeconds(this.date.getSeconds() - 1);
}
setTo(s) {
this.date.setSeconds(parseInt(s.substr(-2)));
}
toString() {
let s = this.date.getSeconds();
return this.token.length > 1 ? String(s).padStart(2, "0") : s;
}
};
t.exports = i;
})), hg = /* @__PURE__ */ z(((e, t) => {
var r = er(), i = class extends r {
constructor(s = {}) {
super(s);
}
up() {
this.date.setFullYear(this.date.getFullYear() + 1);
}
down() {
this.date.setFullYear(this.date.getFullYear() - 1);
}
setTo(s) {
this.date.setFullYear(s.substr(-4));
}
toString() {
let s = String(this.date.getFullYear()).padStart(4, "0");
return this.token.length === 2 ? s.substr(-2) : s;
}
};
t.exports = i;
})), fg = /* @__PURE__ */ z(((e, t) => {
t.exports = {
DatePart: er(),
Meridiem: ng(),
Day: sg(),
Hours: ag(),
Milliseconds: og(),
Minutes: lg(),
Month: cg(),
Seconds: ug(),
Year: hg()
};
})), dg = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), i = nr(), { style: s, clear: d, figures: c } = Yt(), { erase: n, cursor: u } = jt(), { DatePart: o, Meridiem: h, Day: a, Hours: l, Milliseconds: f, Minutes: p, Month: g, Seconds: m, Year: v } = fg(), _ = /\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g, E = {
1: ({ token: b }) => b.replace(/\\(.)/g, "$1"),
2: (b) => new a(b),
3: (b) => new g(b),
4: (b) => new v(b),
5: (b) => new h(b),
6: (b) => new l(b),
7: (b) => new p(b),
8: (b) => new m(b),
9: (b) => new f(b)
}, S = {
months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
}, w = class extends i {
constructor(b = {}) {
super(b), this.msg = b.message, this.cursor = 0, this.typed = "", this.locales = Object.assign(S, b.locales), this._date = b.initial || /* @__PURE__ */ new Date(), this.errorMsg = b.error || "Please Enter A Valid Value", this.validator = b.validate || (() => !0), this.mask = b.mask || "YYYY-MM-DD HH:mm:ss", this.clear = d("", this.out.columns), this.render();
}
get value() {
return this.date;
}
get date() {
return this._date;
}
set date(b) {
b && this._date.setTime(b.getTime());
}
set mask(b) {
let A;
for (this.parts = []; A = _.exec(b); ) {
let C = A.shift(), O = A.findIndex((I) => I != null);
this.parts.push(O in E ? E[O]({
token: A[O] || C,
date: this.date,
parts: this.parts,
locales: this.locales
}) : A[O] || C);
}
let D = this.parts.reduce((C, O) => (typeof O == "string" && typeof C[C.length - 1] == "string" ? C[C.length - 1] += O : C.push(O), C), []);
this.parts.splice(0), this.parts.push(...D), this.reset();
}
moveCursor(b) {
this.typed = "", this.cursor = b, this.fire();
}
reset() {
this.moveCursor(this.parts.findIndex((b) => b instanceof o)), this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
async validate() {
let b = await this.validator(this.value);
typeof b == "string" && (this.errorMsg = b, b = !1), this.error = !b;
}
async submit() {
if (await this.validate(), this.error) {
this.color = "red", this.fire(), this.render();
return;
}
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
up() {
this.typed = "", this.parts[this.cursor].up(), this.render();
}
down() {
this.typed = "", this.parts[this.cursor].down(), this.render();
}
left() {
let b = this.parts[this.cursor].prev();
if (b == null) return this.bell();
this.moveCursor(this.parts.indexOf(b)), this.render();
}
right() {
let b = this.parts[this.cursor].next();
if (b == null) return this.bell();
this.moveCursor(this.parts.indexOf(b)), this.render();
}
next() {
let b = this.parts[this.cursor].next();
this.moveCursor(b ? this.parts.indexOf(b) : this.parts.findIndex((A) => A instanceof o)), this.render();
}
_(b) {
/\d/.test(b) && (this.typed += b, this.parts[this.cursor].setTo(this.typed), this.render());
}
render() {
this.closed || (this.firstRender ? this.out.write(u.hide) : this.out.write(d(this.outputText, this.out.columns)), super.render(), this.outputText = [
s.symbol(this.done, this.aborted),
r.bold(this.msg),
s.delimiter(!1),
this.parts.reduce((b, A, D) => b.concat(D === this.cursor && !this.done ? r.cyan().underline(A.toString()) : A), []).join("")
].join(" "), this.error && (this.outputText += this.errorMsg.split(`
`).reduce((b, A, D) => b + `
${D ? " " : c.pointerSmall} ${r.red().italic(A)}`, "")), this.out.write(n.line + u.to(0) + this.outputText));
}
};
t.exports = w;
})), pg = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), i = nr(), { cursor: s, erase: d } = jt(), { style: c, figures: n, clear: u, lines: o } = Yt(), h = /[0-9]/, a = (p) => p !== void 0, l = (p, g) => {
let m = Math.pow(10, g);
return Math.round(p * m) / m;
}, f = class extends i {
constructor(p = {}) {
super(p), this.transform = c.render(p.style), this.msg = p.message, this.initial = a(p.initial) ? p.initial : "", this.float = !!p.float, this.round = p.round || 2, this.inc = p.increment || 1, this.min = a(p.min) ? p.min : -1 / 0, this.max = a(p.max) ? p.max : 1 / 0, this.errorMsg = p.error || "Please Enter A Valid Value", this.validator = p.validate || (() => !0), this.color = "cyan", this.value = "", this.typed = "", this.lastHit = 0, this.render();
}
set value(p) {
!p && p !== 0 ? (this.placeholder = !0, this.rendered = r.gray(this.transform.render(`${this.initial}`)), this._value = "") : (this.placeholder = !1, this.rendered = this.transform.render(`${l(p, this.round)}`), this._value = l(p, this.round)), this.fire();
}
get value() {
return this._value;
}
parse(p) {
return this.float ? parseFloat(p) : parseInt(p);
}
valid(p) {
return p === "-" || p === "." && this.float || h.test(p);
}
reset() {
this.typed = "", this.value = "", this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
let p = this.value;
this.value = p !== "" ? p : this.initial, this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
async validate() {
let p = await this.validator(this.value);
typeof p == "string" && (this.errorMsg = p, p = !1), this.error = !p;
}
async submit() {
if (await this.validate(), this.error) {
this.color = "red", this.fire(), this.render();
return;
}
let p = this.value;
this.value = p !== "" ? p : this.initial, this.done = !0, this.aborted = !1, this.error = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
up() {
if (this.typed = "", this.value === "" && (this.value = this.min - this.inc), this.value >= this.max) return this.bell();
this.value += this.inc, this.color = "cyan", this.fire(), this.render();
}
down() {
if (this.typed = "", this.value === "" && (this.value = this.min + this.inc), this.value <= this.min) return this.bell();
this.value -= this.inc, this.color = "cyan", this.fire(), this.render();
}
delete() {
let p = this.value.toString();
if (p.length === 0) return this.bell();
this.value = this.parse(p = p.slice(0, -1)) || "", this.value !== "" && this.value < this.min && (this.value = this.min), this.color = "cyan", this.fire(), this.render();
}
next() {
this.value = this.initial, this.fire(), this.render();
}
_(p, g) {
if (!this.valid(p)) return this.bell();
const m = Date.now();
if (m - this.lastHit > 1e3 && (this.typed = ""), this.typed += p, this.lastHit = m, this.color = "cyan", p === ".") return this.fire();
this.value = Math.min(this.parse(this.typed), this.max), this.value > this.max && (this.value = this.max), this.value < this.min && (this.value = this.min), this.fire(), this.render();
}
render() {
this.closed || (this.firstRender || (this.outputError && this.out.write(s.down(o(this.outputError, this.out.columns) - 1) + u(this.outputError, this.out.columns)), this.out.write(u(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [
c.symbol(this.done, this.aborted),
r.bold(this.msg),
c.delimiter(this.done),
!this.done || !this.done && !this.placeholder ? r[this.color]().underline(this.rendered) : this.rendered
].join(" "), this.error && (this.outputError += this.errorMsg.split(`
`).reduce((p, g, m) => p + `
${m ? " " : n.pointerSmall} ${r.red().italic(g)}`, "")), this.out.write(d.line + s.to(0) + this.outputText + s.save + this.outputError + s.restore));
}
};
t.exports = f;
})), Eu = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), { cursor: i } = jt(), s = nr(), { clear: d, figures: c, style: n, wrap: u, entriesToDisplay: o } = Yt(), h = class extends s {
constructor(a = {}) {
super(a), this.isSelect = !0, this.msg = a.message, this.cursorStart = a.choices.findIndex((l) => !l.heading), this.cursor = a.cursor || this.cursorStart, this.scrollIndex = a.cursor || 0, this.hint = a.hint || "", this.warn = a.warn || "- This option is disabled -", this.minSelected = a.min, this.showMinError = !1, this.maxChoices = a.max, this.instructions = a.instructions, this.optionsPerPage = a.optionsPerPage || 10, this.value = a.choices.map((l, f) => (typeof l == "string" && (l = {
title: l,
value: f
}), {
title: l && (l.title || l.value || l),
description: l && l.description,
value: l && (l.value === void 0 ? f : l.value),
selected: l && l.selected,
disabled: l && l.disabled,
heading: l && l.heading
})), this.clear = d("", this.out.columns), a.overrideRender || this.render();
}
reset() {
this.value.map((a) => !a.selected), this.cursor = this.cursorStart, this.fire(), this.render();
}
selected() {
return this.value.filter((a) => a.selected);
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
const a = this.value.filter((l) => l.selected);
this.minSelected && a.length < this.minSelected ? (this.showMinError = !0, this.render()) : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close());
}
first() {
this.cursor = this.cursorStart, this.render();
}
last() {
this.cursor = this.value.length - 1, this.render();
}
next() {
this.cursor = (this.cursor + 1) % this.value.length, this.value[this.cursor].heading && this.next(), this.render();
}
up() {
this.cursor === this.cursorStart ? this.cursor = this.value.length - 1 : this.cursor--, this.value[this.cursor].heading && this.up(), this.render();
}
down() {
this.cursor === this.value.length - 1 ? this.cursor = this.cursorStart : this.cursor++, this.value[this.cursor].heading && this.down(), this.render();
}
left() {
this.value[this.cursor].selected = !1, this.render();
}
right() {
if (this.value.filter((a) => a.selected).length >= this.maxChoices) return this.bell();
this.value[this.cursor].selected = !0, this.render();
}
handleSpaceToggle() {
const a = this.value[this.cursor];
if (a.selected)
a.selected = !1, this.render();
else {
if (a.disabled || this.value.filter((l) => l.selected).length >= this.maxChoices) return this.bell();
a.selected = !0, this.render();
}
}
toggleAll() {
if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) return this.bell();
const a = !this.value[this.cursor].selected;
this.value.filter((l) => !l.disabled && !l.heading).forEach((l) => l.selected = a), this.render();
}
_(a, l) {
if (a === " ") this.handleSpaceToggle();
else if (a === "a") this.toggleAll();
else return this.bell();
}
renderInstructions() {
return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : `
Instructions:
${c.arrowUp}/${c.arrowDown}: Highlight option
${c.arrowLeft}/${c.arrowRight}/[space]: Toggle selection
` + (this.maxChoices === void 0 ? ` a: Toggle all
` : "") + " enter/return: Complete answer" : "";
}
renderOption(a, l, f, p) {
const g = (a === f ? "❯ " : " ") + (l.selected ? r.green(c.radioOn) : c.radioOff) + " ";
let m, v;
if (l.disabled) m = a === f ? r.gray(l.title) : r.strikethrough().gray(l.title);
else {
if (l.heading)
return m = l.title, m + r.gray(v || "");
m = l.title, a === f && l.description && (v = ` - ${l.description}`, (g.length + m.length + v.length >= this.out.columns || l.description.split(/\r?\n/).length > 1) && (v = `
` + u(l.description, {
margin: g.length,
width: this.out.columns
})));
}
return g + m + r.gray(v || "");
}
paginateOptions(a) {
if (a.length === 0) return r.red("No matches for this query.");
let { startIndex: l, endIndex: f } = o(this.cursor, a.length, this.optionsPerPage), p, g = [];
for (let m = l; m < f; m++)
m === l && l > 0 ? p = c.arrowUp : m === f - 1 && f < a.length ? p = c.arrowDown : p = " ", g.push(this.renderOption(this.cursor, a[m], m, p));
return `
` + g.join(`
`);
}
renderOptions(a) {
return this.done ? "" : this.paginateOptions(a);
}
renderDoneOrInstructions() {
if (this.done) return "";
const a = [r.gray(this.hint), this.renderInstructions()];
return this.value[this.cursor].disabled && a.push(r.yellow(this.warn)), a.join(" ");
}
render() {
if (this.closed) return;
this.firstRender && this.out.write(i.hide), super.render();
let a = [
n.symbol(this.done, this.aborted),
r.bold(this.msg),
n.delimiter(!1),
this.renderDoneOrInstructions()
].join(" ");
this.showMinError && (a += r.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), a += this.renderOptions(this.value), this.out.write(this.clear + a), this.clear = d(a, this.out.columns);
}
};
t.exports = h;
})), gg = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), i = nr(), { erase: s, cursor: d } = jt(), { style: c, clear: n, figures: u, wrap: o, entriesToDisplay: h } = Yt(), a = (g, m) => g[m] && (g[m].value || g[m].title || g[m]), l = (g, m) => g[m] && (g[m].title || g[m].value || g[m]), f = (g, m) => {
const v = g.findIndex((_) => _.value === m || _.title === m);
return v > -1 ? v : void 0;
}, p = class extends i {
constructor(g = {}) {
super(g), this.msg = g.message, this.suggest = g.suggest, this.choices = g.choices, this.initial = typeof g.initial == "number" ? g.initial : f(g.choices, g.initial), this.select = this.initial || g.cursor || 0, this.i18n = { noMatches: g.noMatches || "no matches found" }, this.fallback = g.fallback || this.initial, this.clearFirst = g.clearFirst || !1, this.suggestions = [], this.input = "", this.limit = g.limit || 10, this.cursor = 0, this.transform = c.render(g.style), this.scale = this.transform.scale, this.render = this.render.bind(this), this.complete = this.complete.bind(this), this.clear = n("", this.out.columns), this.complete(this.render), this.render();
}
set fallback(g) {
this._fb = Number.isSafeInteger(parseInt(g)) ? parseInt(g) : g;
}
get fallback() {
let g;
return typeof this._fb == "number" ? g = this.choices[this._fb] : typeof this._fb == "string" && (g = { title: this._fb }), g || this._fb || { title: this.i18n.noMatches };
}
moveSelect(g) {
this.select = g, this.suggestions.length > 0 ? this.value = a(this.suggestions, g) : this.value = this.fallback.value, this.fire();
}
async complete(g) {
const m = this.completing = this.suggest(this.input, this.choices), v = await m;
if (this.completing !== m) return;
this.suggestions = v.map((E, S, w) => ({
title: l(w, S),
value: a(w, S),
description: E.description
})), this.completing = !1;
const _ = Math.max(v.length - 1, 0);
this.moveSelect(Math.min(_, this.select)), g && g();
}
reset() {
this.input = "", this.complete(() => {
this.moveSelect(this.initial !== void 0 ? this.initial : 0), this.render();
}), this.render();
}
exit() {
this.clearFirst && this.input.length > 0 ? this.reset() : (this.done = this.exited = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close());
}
abort() {
this.done = this.aborted = !0, this.exited = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.done = !0, this.aborted = this.exited = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
_(g, m) {
let v = this.input.slice(0, this.cursor), _ = this.input.slice(this.cursor);
this.input = `${v}${g}${_}`, this.cursor = v.length + 1, this.complete(this.render), this.render();
}
delete() {
if (this.cursor === 0) return this.bell();
let g = this.input.slice(0, this.cursor - 1), m = this.input.slice(this.cursor);
this.input = `${g}${m}`, this.complete(this.render), this.cursor = this.cursor - 1, this.render();
}
deleteForward() {
if (this.cursor * this.scale >= this.rendered.length) return this.bell();
let g = this.input.slice(0, this.cursor), m = this.input.slice(this.cursor + 1);
this.input = `${g}${m}`, this.complete(this.render), this.render();
}
first() {
this.moveSelect(0), this.render();
}
last() {
this.moveSelect(this.suggestions.length - 1), this.render();
}
up() {
this.select === 0 ? this.moveSelect(this.suggestions.length - 1) : this.moveSelect(this.select - 1), this.render();
}
down() {
this.select === this.suggestions.length - 1 ? this.moveSelect(0) : this.moveSelect(this.select + 1), this.render();
}
next() {
this.select === this.suggestions.length - 1 ? this.moveSelect(0) : this.moveSelect(this.select + 1), this.render();
}
nextPage() {
this.moveSelect(Math.min(this.select + this.limit, this.suggestions.length - 1)), this.render();
}
prevPage() {
this.moveSelect(Math.max(this.select - this.limit, 0)), this.render();
}
left() {
if (this.cursor <= 0) return this.bell();
this.cursor = this.cursor - 1, this.render();
}
right() {
if (this.cursor * this.scale >= this.rendered.length) return this.bell();
this.cursor = this.cursor + 1, this.render();
}
renderOption(g, m, v, _) {
let E, S = v ? u.arrowUp : _ ? u.arrowDown : " ", w = m ? r.cyan().underline(g.title) : g.title;
return S = (m ? r.cyan(u.pointer) + " " : " ") + S, g.description && (E = ` - ${g.description}`, (S.length + w.length + E.length >= this.out.columns || g.description.split(/\r?\n/).length > 1) && (E = `
` + o(g.description, {
margin: 3,
width: this.out.columns
}))), S + " " + w + r.gray(E || "");
}
render() {
if (this.closed) return;
this.firstRender ? this.out.write(d.hide) : this.out.write(n(this.outputText, this.out.columns)), super.render();
let { startIndex: g, endIndex: m } = h(this.select, this.choices.length, this.limit);
if (this.outputText = [
c.symbol(this.done, this.aborted, this.exited),
r.bold(this.msg),
c.delimiter(this.completing),
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
].join(" "), !this.done) {
const v = this.suggestions.slice(g, m).map((_, E) => this.renderOption(_, this.select === E + g, E === 0 && g > 0, E + g === m - 1 && m < this.choices.length)).join(`
`);
this.outputText += `
` + (v || r.gray(this.fallback.title));
}
this.out.write(s.line + d.to(0) + this.outputText);
}
};
t.exports = p;
})), mg = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), { cursor: i } = jt(), s = Eu(), { clear: d, style: c, figures: n } = Yt(), u = class extends s {
constructor(o = {}) {
o.overrideRender = !0, super(o), this.inputValue = "", this.clear = d("", this.out.columns), this.filteredOptions = this.value, this.render();
}
last() {
this.cursor = this.filteredOptions.length - 1, this.render();
}
next() {
this.cursor = (this.cursor + 1) % this.filteredOptions.length, this.render();
}
up() {
this.cursor === 0 ? this.cursor = this.filteredOptions.length - 1 : this.cursor--, this.render();
}
down() {
this.cursor === this.filteredOptions.length - 1 ? this.cursor = 0 : this.cursor++, this.render();
}
left() {
this.filteredOptions[this.cursor].selected = !1, this.render();
}
right() {
if (this.value.filter((o) => o.selected).length >= this.maxChoices) return this.bell();
this.filteredOptions[this.cursor].selected = !0, this.render();
}
delete() {
this.inputValue.length && (this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1), this.updateFilteredOptions());
}
updateFilteredOptions() {
const o = this.filteredOptions[this.cursor];
this.filteredOptions = this.value.filter((a) => this.inputValue ? !!(typeof a.title == "string" && a.title.toLowerCase().includes(this.inputValue.toLowerCase()) || typeof a.value == "string" && a.value.toLowerCase().includes(this.inputValue.toLowerCase())) : !0);
const h = this.filteredOptions.findIndex((a) => a === o);
this.cursor = h < 0 ? 0 : h, this.render();
}
handleSpaceToggle() {
const o = this.filteredOptions[this.cursor];
if (o.selected)
o.selected = !1, this.render();
else {
if (o.disabled || this.value.filter((h) => h.selected).length >= this.maxChoices) return this.bell();
o.selected = !0, this.render();
}
}
handleInputChange(o) {
this.inputValue = this.inputValue + o, this.updateFilteredOptions();
}
_(o, h) {
o === " " ? this.handleSpaceToggle() : this.handleInputChange(o);
}
renderInstructions() {
return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : `
Instructions:
${n.arrowUp}/${n.arrowDown}: Highlight option
${n.arrowLeft}/${n.arrowRight}/[space]: Toggle selection
[a,b,c]/delete: Filter choices
enter/return: Complete answer
` : "";
}
renderCurrentInput() {
return `
Filtered results for: ${this.inputValue ? this.inputValue : r.gray("Enter something to filter")}
`;
}
renderOption(o, h, a, l) {
const f = (h.selected ? r.green(n.radioOn) : n.radioOff) + " " + l + " ";
let p;
return h.disabled ? p = o === a ? r.gray().underline(h.title) : r.strikethrough().gray(h.title) : p = o === a ? r.cyan().underline(h.title) : h.title, f + p;
}
renderDoneOrInstructions() {
if (this.done) return this.value.filter((h) => h.selected).map((h) => h.title).join(", ");
const o = [
r.gray(this.hint),
this.renderInstructions(),
this.renderCurrentInput()
];
return this.filteredOptions.length && this.filteredOptions[this.cursor].disabled && o.push(r.yellow(this.warn)), o.join(" ");
}
render() {
if (this.closed) return;
this.firstRender && this.out.write(i.hide), super.render();
let o = [
c.symbol(this.done, this.aborted),
r.bold(this.msg),
c.delimiter(!1),
this.renderDoneOrInstructions()
].join(" ");
this.showMinError && (o += r.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), o += this.renderOptions(this.filteredOptions), this.out.write(this.clear + o), this.clear = d(o, this.out.columns);
}
};
t.exports = u;
})), vg = /* @__PURE__ */ z(((e, t) => {
var r = Mt(), i = nr(), { style: s, clear: d } = Yt(), { erase: c, cursor: n } = jt(), u = class extends i {
constructor(o = {}) {
super(o), this.msg = o.message, this.value = o.initial, this.initialValue = !!o.initial, this.yesMsg = o.yes || "yes", this.yesOption = o.yesOption || "(Y/n)", this.noMsg = o.no || "no", this.noOption = o.noOption || "(y/N)", this.render();
}
reset() {
this.value = this.initialValue, this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.value = this.value || !1, this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
_(o, h) {
return o.toLowerCase() === "y" ? (this.value = !0, this.submit()) : o.toLowerCase() === "n" ? (this.value = !1, this.submit()) : this.bell();
}
render() {
if (this.closed) return;
this.firstRender ? this.out.write(n.hide) : this.out.write(d(this.outputText, this.out.columns)), super.render(