UNPKG

npm-check-updates

Version:

Find newer versions of dependencies than what your package.json allows

1,232 lines (1,231 loc) 1.75 MB
import { a as qt, c as At, i as j, l as zt, n as Ih, o as bt, s as ve, t as kh } from "./chunks/p-map-DaKUJ_MH.js"; import { createRequire as _m } from "node:module"; import Ye from "path"; import ui from "fs"; import fi from "os"; import Em from "util"; import it from "fs/promises"; import sn from "node:process"; import Gi from "node:os"; import xl from "node:tty"; import { URL as bm } from "url"; import pt, { dirname as wm } from "node:path"; import { fileURLToPath as ou } from "node:url"; import { promisify as Lh, stripVTControlCharacters as Dm } from "node:util"; import ba, { promises as Bl } from "node:fs"; import Am, { execFile as Sm } from "node:child_process"; import { text as Cm } from "node:stream/consumers"; var er = /* @__PURE__ */ j(((e, t) => { var r, i, s, h, a = !0; typeof process < "u" && ({ FORCE_COLOR: r, NODE_DISABLE_COLORS: i, NO_COLOR: s, TERM: h } = process.env || {}, a = process.stdout && process.stdout.isTTY); var n = { enabled: !i && s == null && h !== "dumb" && (r != null && r !== "0" || a), reset: f(0, 0), bold: f(1, 22), dim: f(2, 22), italic: f(3, 23), underline: f(4, 24), inverse: f(7, 27), hidden: f(8, 28), strikethrough: f(9, 29), black: f(30, 39), red: f(31, 39), green: f(32, 39), yellow: f(33, 39), blue: f(34, 39), magenta: f(35, 39), cyan: f(36, 39), white: f(37, 39), gray: f(90, 39), grey: f(90, 39), bgBlack: f(40, 49), bgRed: f(41, 49), bgGreen: f(42, 49), bgYellow: f(43, 49), bgBlue: f(44, 49), bgMagenta: f(45, 49), bgCyan: f(46, 49), bgWhite: f(47, 49) }; function l(o, c) { let p = 0, d, m = "", g = ""; for (; p < o.length; p++) d = o[p], m += d.open, g += d.close, ~c.indexOf(d.close) && (c = c.replace(d.rgx, d.close + d.open)); return m + c + g; } function u(o, c) { let p = { has: o, keys: c }; return p.reset = n.reset.bind(p), p.bold = n.bold.bind(p), p.dim = n.dim.bind(p), p.italic = n.italic.bind(p), p.underline = n.underline.bind(p), p.inverse = n.inverse.bind(p), p.hidden = n.hidden.bind(p), p.strikethrough = n.strikethrough.bind(p), p.black = n.black.bind(p), p.red = n.red.bind(p), p.green = n.green.bind(p), p.yellow = n.yellow.bind(p), p.blue = n.blue.bind(p), p.magenta = n.magenta.bind(p), p.cyan = n.cyan.bind(p), p.white = n.white.bind(p), p.gray = n.gray.bind(p), p.grey = n.grey.bind(p), p.bgBlack = n.bgBlack.bind(p), p.bgRed = n.bgRed.bind(p), p.bgGreen = n.bgGreen.bind(p), p.bgYellow = n.bgYellow.bind(p), p.bgBlue = n.bgBlue.bind(p), p.bgMagenta = n.bgMagenta.bind(p), p.bgCyan = n.bgCyan.bind(p), p.bgWhite = n.bgWhite.bind(p), p; } function f(o, c) { let p = { open: `\x1B[${o}m`, close: `\x1B[${c}m`, rgx: new RegExp(`\\x1b\\[${c}m`, "g") }; return function(d) { return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(o) || (this.has.push(o), this.keys.push(p)), d === void 0 ? this : n.enabled ? l(this.keys, d + "") : d + "") : d === void 0 ? u([o], [p]) : n.enabled ? l([p], d + "") : d + ""; }; } t.exports = n; })), Tm = /* @__PURE__ */ j(((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; } }; })), uu = /* @__PURE__ */ j(((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; }; })), tr = /* @__PURE__ */ j(((e, t) => { var r = "\x1B", i = `${r}[`, s = "\x07", h = { to(l, u) { return u ? `${i}${u + 1};${l + 1}H` : `${i}${l + 1}G`; }, move(l, u) { let f = ""; return l < 0 ? f += `${i}${-l}D` : l > 0 && (f += `${i}${l}C`), u < 0 ? f += `${i}${-u}A` : u > 0 && (f += `${i}${u}B`), f; }, up: (l = 1) => `${i}${l}A`, down: (l = 1) => `${i}${l}B`, forward: (l = 1) => `${i}${l}C`, backward: (l = 1) => `${i}${l}D`, nextLine: (l = 1) => `${i}E`.repeat(l), prevLine: (l = 1) => `${i}F`.repeat(l), left: `${i}G`, hide: `${i}?25l`, show: `${i}?25h`, save: `${r}7`, restore: `${r}8` }, a = { up: (l = 1) => `${i}S`.repeat(l), down: (l = 1) => `${i}T`.repeat(l) }, n = { screen: `${i}2J`, up: (l = 1) => `${i}1J`.repeat(l), down: (l = 1) => `${i}J`.repeat(l), line: `${i}2K`, lineEnd: `${i}K`, lineStart: `${i}1K`, lines(l) { let u = ""; for (let f = 0; f < l; f++) u += this.line + (f < l - 1 ? h.up() : ""); return l && (u += h.left), u; } }; t.exports = { cursor: h, scroll: a, erase: n, beep: s }; })), Rm = /* @__PURE__ */ j(((e, t) => { var r = uu(), { erase: i, cursor: s } = tr(), h = (a) => [...r(a)].length; t.exports = function(a, n) { if (!n) return i.line + s.to(0); let l = 0; const u = a.split(/\r?\n/); for (let f of u) l += 1 + Math.floor(Math.max(h(f) - 1, 0) / n); return i.lines(l); }; })), Fh = /* @__PURE__ */ j(((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; })), Om = /* @__PURE__ */ j(((e, t) => { var r = er(), i = Fh(), s = Object.freeze({ password: { scale: 1, render: (f) => "*".repeat(f.length) }, emoji: { scale: 2, render: (f) => "😃".repeat(f.length) }, invisible: { scale: 0, render: (f) => "" }, default: { scale: 1, render: (f) => `${f}` } }), h = (f) => s[f] || s.default, a = Object.freeze({ aborted: r.red(i.cross), done: r.green(i.tick), exited: r.yellow(i.cross), default: r.cyan("?") }), n = (f, o, c) => o ? a.aborted : c ? a.exited : f ? a.done : a.default, l = (f) => r.gray(f ? i.ellipsis : i.pointerSmall), u = (f, o) => r.gray(f ? o ? i.pointerSmall : "+" : i.line); t.exports = { styles: s, render: h, symbols: a, symbol: n, delimiter: l, item: u }; })), Im = /* @__PURE__ */ j(((e, t) => { var r = uu(); t.exports = function(i, s) { let h = String(r(i) || "").split(/\r?\n/); return s ? h.map((a) => Math.ceil(a.length / s)).reduce((a, n) => a + n) : h.length; }; })), km = /* @__PURE__ */ j(((e, t) => { t.exports = (r, i = {}) => { const s = Number.isSafeInteger(parseInt(i.margin)) ? new Array(parseInt(i.margin)).fill(" ").join("") : i.margin || "", h = i.width; return (r || "").split(/\r?\n/g).map((a) => a.split(/\s+/g).reduce((n, l) => (l.length + s.length >= h || n[n.length - 1].length + l.length + 1 < h ? n[n.length - 1] += ` ${l}` : n.push(`${s}${l}`), n), [s]).join(` `)).join(` `); }; })), Lm = /* @__PURE__ */ j(((e, t) => { t.exports = (r, i, s) => { s = s || i; let h = Math.min(i - s, r - Math.floor(s / 2)); h < 0 && (h = 0); let a = Math.min(h + s, i); return { startIndex: h, endIndex: a }; }; })), cr = /* @__PURE__ */ j(((e, t) => { t.exports = { action: Tm(), clear: Rm(), style: Om(), strip: uu(), figures: Fh(), lines: Im(), wrap: km(), entriesToDisplay: Lm() }; })), Cr = /* @__PURE__ */ j(((e, t) => { var r = ve("readline"), { action: i } = cr(), s = ve("events"), { beep: h, cursor: a } = tr(), n = er(), l = class extends s { constructor(u = {}) { super(), this.firstRender = !0, this.in = u.stdin || process.stdin, this.out = u.stdout || process.stdout, this.onRender = (u.onRender || (() => { })).bind(this); const f = r.createInterface({ input: this.in, escapeCodeTimeout: 50 }); r.emitKeypressEvents(this.in, f), this.in.isTTY && this.in.setRawMode(!0); const o = (c, p) => { let d = i(p, this.isSelect); d === !1 ? this._ && this._(c, p) : typeof this[d] == "function" ? this[d](p) : this.bell(); }; this.close = () => { this.out.write(a.show), this.in.removeListener("keypress", o), this.in.isTTY && this.in.setRawMode(!1), f.close(), this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value), this.closed = !0; }, this.in.on("keypress", o); } fire() { this.emit("state", { value: this.value, aborted: !!this.aborted, exited: !!this.exited }); } bell() { this.out.write(h); } render() { this.onRender(n), this.firstRender && (this.firstRender = !1); } }; t.exports = l; })), Fm = /* @__PURE__ */ j(((e, t) => { var r = er(), i = Cr(), { erase: s, cursor: h } = tr(), { style: a, clear: n, lines: l, figures: u } = cr(), f = class extends i { constructor(o = {}) { super(o), this.transform = a.render(o.style), this.scale = this.transform.scale, this.msg = o.message, this.initial = o.initial || "", this.validator = o.validate || (() => !0), this.value = "", this.errorMsg = o.error || "Please Enter A Valid Value", this.cursor = +!!this.initial, this.cursorOffset = 0, this.clear = n("", this.out.columns), this.render(); } set value(o) { !o && this.initial ? (this.placeholder = !0, this.rendered = r.gray(this.transform.render(this.initial))) : (this.placeholder = !1, this.rendered = this.transform.render(o)), this._value = o, 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 o = await this.validator(this.value); typeof o == "string" && (this.errorMsg = o, o = !1), this.error = !o; } 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(o) { this.placeholder || (this.cursor = this.cursor + o, this.cursorOffset += o); } _(o, c) { let p = this.value.slice(0, this.cursor); this.value = `${p}${o}${this.value.slice(this.cursor)}`, this.red = !1, this.cursor = this.placeholder ? 0 : p.length + 1, this.render(); } delete() { if (this.isCursorAtStart()) return this.bell(); this.value = `${this.value.slice(0, this.cursor - 1)}${this.value.slice(this.cursor)}`, 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(); this.value = `${this.value.slice(0, this.cursor)}${this.value.slice(this.cursor + 1)}`, 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(h.down(l(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 = [ a.symbol(this.done, this.aborted), r.bold(this.msg), a.delimiter(this.done), this.red ? r.red(this.rendered) : this.rendered ].join(" "), this.error && (this.outputError += this.errorMsg.split(` `).reduce((o, c, p) => o + ` ${p ? " " : u.pointerSmall} ${r.red().italic(c)}`, "")), this.out.write(s.line + h.to(0) + this.outputText + h.save + this.outputError + h.restore + h.move(this.cursorOffset, 0))); } }; t.exports = f; })), Nm = /* @__PURE__ */ j(((e, t) => { var r = er(), i = Cr(), { style: s, clear: h, figures: a, wrap: n, entriesToDisplay: l } = cr(), { cursor: u } = tr(), f = class extends i { constructor(o = {}) { super(o), this.isSelect = !0, this.msg = o.message, this.hint = o.hint || "- Use arrow-keys. Return to submit.", this.warn = o.warn || "- This option is disabled", this.cursor = o.initial || 0, this.choices = o.choices.map((c, p) => (typeof c == "string" && (c = { title: c, value: p }), { title: c && (c.title || c.value || c), value: c && (c.value === void 0 ? p : c.value), description: c && c.description, selected: c && c.selected, disabled: c && c.disabled })), this.optionsPerPage = o.optionsPerPage || 10, this.value = (this.choices[this.cursor] || {}).value, this.clear = h("", this.out.columns), this.render(); } moveCursor(o) { this.cursor = o, this.value = this.choices[o].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(); } _(o, c) { if (o === " ") return this.submit(); } get selection() { return this.choices[this.cursor]; } render() { if (this.closed) return; this.firstRender ? this.out.write(u.hide) : this.out.write(h(this.outputText, this.out.columns)), super.render(); let { startIndex: o, endIndex: c } = l(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 p = o; p < c; p++) { let d, m, g = "", v = this.choices[p]; p === o && o > 0 ? m = a.arrowUp : p === c - 1 && c < this.choices.length ? m = a.arrowDown : m = " ", v.disabled ? (d = this.cursor === p ? r.gray().underline(v.title) : r.strikethrough().gray(v.title), m = (this.cursor === p ? r.bold().gray(a.pointer) + " " : " ") + m) : (d = this.cursor === p ? r.cyan().underline(v.title) : v.title, m = (this.cursor === p ? r.cyan(a.pointer) + " " : " ") + m, v.description && this.cursor === p && (g = ` - ${v.description}`, (m.length + d.length + g.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) && (g = ` ` + n(v.description, { margin: 3, width: this.out.columns })))), this.outputText += `${m} ${d}${r.gray(g)} `; } } this.out.write(this.outputText); } }; t.exports = f; })), $m = /* @__PURE__ */ j(((e, t) => { var r = er(), i = Cr(), { style: s, clear: h } = cr(), { cursor: a, erase: n } = tr(), l = class extends i { constructor(u = {}) { super(u), this.msg = u.message, this.value = !!u.initial, this.active = u.active || "on", this.inactive = u.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(); } _(u, f) { if (u === " ") this.value = !this.value; else if (u === "1") this.value = !0; else if (u === "0") this.value = !1; else return this.bell(); this.render(); } render() { this.closed || (this.firstRender ? this.out.write(a.hide) : this.out.write(h(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 + a.to(0) + this.outputText)); } }; t.exports = l; })), vr = /* @__PURE__ */ j(((e, t) => { var r = class wa { constructor({ token: s, date: h, parts: a, locales: n }) { this.token = s, this.date = h || /* @__PURE__ */ new Date(), this.parts = a || [this], this.locales = n || {}; } up() { } down() { } next() { const s = this.parts.indexOf(this); return this.parts.find((h, a) => a > s && h instanceof wa); } setTo(s) { } prev() { let s = [].concat(this.parts).reverse(); const h = s.indexOf(this); return s.find((a, n) => n > h && a instanceof wa); } toString() { return String(this.date); } }; t.exports = r; })), xm = /* @__PURE__ */ j(((e, t) => { var r = vr(), 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; })), Bm = /* @__PURE__ */ j(((e, t) => { var r = vr(), i = (h) => (h = h % 10, h === 1 ? "st" : h === 2 ? "nd" : h === 3 ? "rd" : "th"), s = class extends r { constructor(h = {}) { super(h); } up() { this.date.setDate(this.date.getDate() + 1); } down() { this.date.setDate(this.date.getDate() - 1); } setTo(h) { this.date.setDate(parseInt(h.substr(-2))); } toString() { let h = this.date.getDate(), a = this.date.getDay(); return this.token === "DD" ? String(h).padStart(2, "0") : this.token === "Do" ? h + i(h) : this.token === "d" ? a + 1 : this.token === "ddd" ? this.locales.weekdaysShort[a] : this.token === "dddd" ? this.locales.weekdays[a] : h; } }; t.exports = s; })), Pm = /* @__PURE__ */ j(((e, t) => { var r = vr(), 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; })), Mm = /* @__PURE__ */ j(((e, t) => { var r = vr(), 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; })), jm = /* @__PURE__ */ j(((e, t) => { var r = vr(), 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; })), Um = /* @__PURE__ */ j(((e, t) => { var r = vr(), 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(), h = this.token.length; return h === 2 ? String(s + 1).padStart(2, "0") : h === 3 ? this.locales.monthsShort[s] : h === 4 ? this.locales.months[s] : String(s + 1); } }; t.exports = i; })), Hm = /* @__PURE__ */ j(((e, t) => { var r = vr(), 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; })), qm = /* @__PURE__ */ j(((e, t) => { var r = vr(), 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; })), zm = /* @__PURE__ */ j(((e, t) => { t.exports = { DatePart: vr(), Meridiem: xm(), Day: Bm(), Hours: Pm(), Milliseconds: Mm(), Minutes: jm(), Month: Um(), Seconds: Hm(), Year: qm() }; })), Gm = /* @__PURE__ */ j(((e, t) => { var r = er(), i = Cr(), { style: s, clear: h, figures: a } = cr(), { erase: n, cursor: l } = tr(), { DatePart: u, Meridiem: f, Day: o, Hours: c, Milliseconds: p, Minutes: d, Month: m, Seconds: g, Year: v } = zm(), y = /\\(.)|"((?:\\["\\]|[^"])+)"|(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, w = { 1: ({ token: E }) => E.replace(/\\(.)/g, "$1"), 2: (E) => new o(E), 3: (E) => new m(E), 4: (E) => new v(E), 5: (E) => new f(E), 6: (E) => new c(E), 7: (E) => new d(E), 8: (E) => new g(E), 9: (E) => new p(E) }, _ = { 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(",") }, b = class extends i { constructor(E = {}) { super(E), this.msg = E.message, this.cursor = 0, this.typed = "", this.locales = Object.assign(_, E.locales), this._date = E.initial || /* @__PURE__ */ new Date(), this.errorMsg = E.error || "Please Enter A Valid Value", this.validator = E.validate || (() => !0), this.mask = E.mask || "YYYY-MM-DD HH:mm:ss", this.clear = h("", this.out.columns), this.render(); } get value() { return this.date; } get date() { return this._date; } set date(E) { E && this._date.setTime(E.getTime()); } set mask(E) { let D; for (this.parts = []; D = y.exec(E); ) { let C = D.shift(), T = D.findIndex((U) => U != null); this.parts.push(T in w ? w[T]({ token: D[T] || C, date: this.date, parts: this.parts, locales: this.locales }) : D[T] || C); } let S = this.parts.reduce((C, T) => (typeof T == "string" && typeof C[C.length - 1] == "string" ? C[C.length - 1] += T : C.push(T), C), []); this.parts.splice(0), this.parts.push(...S), this.reset(); } moveCursor(E) { this.typed = "", this.cursor = E, this.fire(); } reset() { this.moveCursor(this.parts.findIndex((E) => E instanceof u)), 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 E = await this.validator(this.value); typeof E == "string" && (this.errorMsg = E, E = !1), this.error = !E; } 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 E = this.parts[this.cursor].prev(); if (E == null) return this.bell(); this.moveCursor(this.parts.indexOf(E)), this.render(); } right() { let E = this.parts[this.cursor].next(); if (E == null) return this.bell(); this.moveCursor(this.parts.indexOf(E)), this.render(); } next() { let E = this.parts[this.cursor].next(); this.moveCursor(E ? this.parts.indexOf(E) : this.parts.findIndex((D) => D instanceof u)), this.render(); } _(E) { /\d/.test(E) && (this.typed += E, this.parts[this.cursor].setTo(this.typed), this.render()); } render() { this.closed || (this.firstRender ? this.out.write(l.hide) : this.out.write(h(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((E, D, S) => E.concat(S === this.cursor && !this.done ? r.cyan().underline(D.toString()) : D), []).join("") ].join(" "), this.error && (this.outputText += this.errorMsg.split(` `).reduce((E, D, S) => E + ` ${S ? " " : a.pointerSmall} ${r.red().italic(D)}`, "")), this.out.write(n.line + l.to(0) + this.outputText)); } }; t.exports = b; })), Wm = /* @__PURE__ */ j(((e, t) => { var r = er(), i = Cr(), { cursor: s, erase: h } = tr(), { style: a, figures: n, clear: l, lines: u } = cr(), f = /[0-9]/, o = (d) => d !== void 0, c = (d, m) => { let g = Math.pow(10, m); return Math.round(d * g) / g; }, p = class extends i { constructor(d = {}) { super(d), this.transform = a.render(d.style), this.msg = d.message, this.initial = o(d.initial) ? d.initial : "", this.float = !!d.float, this.round = d.round || 2, this.inc = d.increment || 1, this.min = o(d.min) ? d.min : -1 / 0, this.max = o(d.max) ? d.max : 1 / 0, this.errorMsg = d.error || "Please Enter A Valid Value", this.validator = d.validate || (() => !0), this.color = "cyan", this.value = "", this.typed = "", this.lastHit = 0, this.render(); } set value(d) { !d && d !== 0 ? (this.placeholder = !0, this.rendered = r.gray(this.transform.render(`${this.initial}`)), this._value = "") : (this.placeholder = !1, this.rendered = this.transform.render(`${c(d, this.round)}`), this._value = c(d, this.round)), this.fire(); } get value() { return this._value; } parse(d) { return this.float ? parseFloat(d) : parseInt(d); } valid(d) { return d === "-" || d === "." && this.float || f.test(d); } reset() { this.typed = "", this.value = "", this.fire(), this.render(); } exit() { this.abort(); } abort() { let d = this.value; this.value = d !== "" ? d : this.initial, this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(` `), this.close(); } async validate() { let d = await this.validator(this.value); typeof d == "string" && (this.errorMsg = d, d = !1), this.error = !d; } async submit() { if (await this.validate(), this.error) { this.color = "red", this.fire(), this.render(); return; } let d = this.value; this.value = d !== "" ? d : 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 d = this.value.toString(); if (d.length === 0) return this.bell(); this.value = this.parse(d = d.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(); } _(d, m) { if (!this.valid(d)) return this.bell(); const g = Date.now(); if (g - this.lastHit > 1e3 && (this.typed = ""), this.typed += d, this.lastHit = g, this.color = "cyan", d === ".") 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(u(this.outputError, this.out.columns) - 1) + l(this.outputError, this.out.columns)), this.out.write(l(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [ a.symbol(this.done, this.aborted), r.bold(this.msg), a.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((d, m, g) => d + ` ${g ? " " : n.pointerSmall} ${r.red().italic(m)}`, "")), this.out.write(h.line + s.to(0) + this.outputText + s.save + this.outputError + s.restore)); } }; t.exports = p; })), Nh = /* @__PURE__ */ j(((e, t) => { var r = er(), { cursor: i } = tr(), s = Cr(), { clear: h, figures: a, style: n, wrap: l, entriesToDisplay: u } = cr(), f = class extends s { constructor(o = {}) { super(o), this.isSelect = !0, this.msg = o.message, this.cursorStart = o.choices.findIndex((c) => !c.heading), this.cursor = o.cursor || this.cursorStart, this.scrollIndex = o.cursor || 0, this.hint = o.hint || "", this.warn = o.warn || "- This option is disabled -", this.minSelected = o.min, this.showMinError = !1, this.maxChoices = o.max, this.instructions = o.instructions, this.optionsPerPage = o.optionsPerPage || 10, this.value = o.choices.map((c, p) => (typeof c == "string" && (c = { title: c, value: p }), { title: c && (c.title || c.value || c), description: c && c.description, value: c && (c.value === void 0 ? p : c.value), selected: c && c.selected, disabled: c && c.disabled, heading: c && c.heading })), this.clear = h("", this.out.columns), o.overrideRender || this.render(); } reset() { this.value.map((o) => !o.selected), this.cursor = this.cursorStart, this.fire(), this.render(); } selected() { return this.value.filter((o) => o.selected); } exit() { this.abort(); } abort() { this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(` `), this.close(); } submit() { const o = this.value.filter((c) => c.selected); this.minSelected && o.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((o) => o.selected).length >= this.maxChoices) return this.bell(); this.value[this.cursor].selected = !0, this.render(); } handleSpaceToggle() { const o = this.value[this.cursor]; if (o.selected) o.selected = !1, this.render(); else { if (o.disabled || this.value.filter((c) => c.selected).length >= this.maxChoices) return this.bell(); o.selected = !0, this.render(); } } toggleAll() { if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) return this.bell(); const o = !this.value[this.cursor].selected; this.value.filter((c) => !c.disabled && !c.heading).forEach((c) => c.selected = o), this.render(); } _(o, c) { if (o === " ") this.handleSpaceToggle(); else if (o === "a") this.toggleAll(); else return this.bell(); } renderInstructions() { return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : ` Instructions: ${a.arrowUp}/${a.arrowDown}: Highlight option ${a.arrowLeft}/${a.arrowRight}/[space]: Toggle selection ` + (this.maxChoices === void 0 ? ` a: Toggle all ` : "") + " enter/return: Complete answer" : ""; } renderOption(o, c, p, d) { const m = (o === p ? "❯ " : " ") + (c.selected ? r.green(a.radioOn) : a.radioOff) + " "; let g, v; if (c.disabled) g = o === p ? r.gray(c.title) : r.strikethrough().gray(c.title); else { if (c.heading) return g = c.title, g + r.gray(v || ""); g = c.title, o === p && c.description && (v = ` - ${c.description}`, (m.length + g.length + v.length >= this.out.columns || c.description.split(/\r?\n/).length > 1) && (v = ` ` + l(c.description, { margin: m.length, width: this.out.columns }))); } return m + g + r.gray(v || ""); } paginateOptions(o) { if (o.length === 0) return r.red("No matches for this query."); let { startIndex: c, endIndex: p } = u(this.cursor, o.length, this.optionsPerPage), d, m = []; for (let g = c; g < p; g++) g === c && c > 0 ? d = a.arrowUp : g === p - 1 && p < o.length ? d = a.arrowDown : d = " ", m.push(this.renderOption(this.cursor, o[g], g, d)); return ` ` + m.join(` `); } renderOptions(o) { return this.done ? "" : this.paginateOptions(o); } renderDoneOrInstructions() { if (this.done) return ""; const o = [r.gray(this.hint), this.renderInstructions()]; return this.value[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 = [ n.symbol(this.done, this.aborted), r.bold(this.msg), n.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.value), this.out.write(this.clear + o), this.clear = h(o, this.out.columns); } }; t.exports = f; })), Vm = /* @__PURE__ */ j(((e, t) => { var r = er(), i = Cr(), { erase: s, cursor: h } = tr(), { style: a, clear: n, figures: l, wrap: u, entriesToDisplay: f } = cr(), o = (m, g) => m[g] && (m[g].value || m[g].title || m[g]), c = (m, g) => m[g] && (m[g].title || m[g].value || m[g]), p = (m, g) => { const v = m.findIndex((y) => y.value === g || y.title === g); return v > -1 ? v : void 0; }, d = class extends i { constructor(m = {}) { super(m), this.msg = m.message, this.suggest = m.suggest, this.choices = m.choices, this.initial = typeof m.initial == "number" ? m.initial : p(m.choices, m.initial), this.select = this.initial || m.cursor || 0, this.i18n = { noMatches: m.noMatches || "no matches found" }, this.fallback = m.fallback || this.initial, this.clearFirst = m.clearFirst || !1, this.suggestions = [], this.input = "", this.limit = m.limit || 10, this.cursor = 0, this.transform = a.render(m.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(m) { this._fb = Number.isSafeInteger(parseInt(m)) ? parseInt(m) : m; } get fallback() { let m; return typeof this._fb == "number" ? m = this.choices[this._fb] : typeof this._fb == "string" && (m = { title: this._fb }), m || this._fb || { title: this.i18n.noMatches }; } moveSelect(m) { this.select = m, this.suggestions.length > 0 ? this.value = o(this.suggestions, m) : this.value = this.fallback.value, this.fire(); } async complete(m) { const g = this.completing = this.suggest(this.input, this.choices), v = await g; if (this.completing !== g) return; this.suggestions = v.map((w, _, b) => ({ title: c(b, _), value: o(b, _), description: w.description })), this.completing = !1; const y = Math.max(v.length - 1, 0); this.moveSelect(Math.min(y, this.select)), m && m(); } 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(); } _(m, g) { let v = this.input.slice(0, this.cursor); this.input = `${v}${m}${this.input.slice(this.cursor)}`, this.cursor = v.length + 1, this.complete(this.render), this.render(); } delete() { if (this.cursor === 0) return this.bell(); this.input = `${this.input.slice(0, this.cursor - 1)}${this.input.slice(this.cursor)}`, this.complete(this.render), this.cursor = this.cursor - 1, this.render(); } deleteForward() { if (this.cursor * this.scale >= this.rendered.length) return this.bell(); this.input = `${this.input.slice(0, this.cursor)}${this.input.slice(this.cursor + 1)}`, 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(m, g, v, y) { let w, _ = v ? l.arrowUp : y ? l.arrowDown : " ", b = g ? r.cyan().underline(m.title) : m.title; return _ = (g ? r.cyan(l.pointer) + " " : " ") + _, m.description && (w = ` - ${m.description}`, (_.length + b.length + w.length >= this.out.columns || m.description.split(/\r?\n/).length > 1) && (w = ` ` + u(m.description, { margin: 3, width: this.out.columns }))), _ + " " + b + r.gray(w || ""); } render() { if (this.closed) return; this.firstRender ? this.out.write(h.hide) : this.out.write(n(this.outputText, this.out.columns)), super.render(); let { startIndex: m, endIndex: g } = f(this.select, this.choices.length, this.limit); if (this.outputText = [ a.symbol(this.done, this.aborted, this.exited), r.bold(this.msg), a.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(m, g).map((y, w) => this.renderOption(y, this.select === w + m, w === 0 && m > 0, w + m === g - 1 && g < this.choices.length)).join(` `); this.outputText += ` ` + (v || r.gray(this.fallback.title)); } this.out.write(s.line + h.to(0) + this.outputText); } }; t.exports = d; })), Ym = /* @__PURE__ */ j(((e, t) => { var r = er(), { cursor: i } = tr(), s = Nh(), { clear: h, style: a, figures: n } = cr(), l = class extends s { constructor(u = {}) { u.overrideRender = !0, super(u), this.inputValue = "", this.clear = h("", 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((u) => u.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 u = this.filteredOptions[this.cursor]; this.filteredOptions = this.value.filter((o) => this.inputValue ? !!(typeof o.title == "string" && o.title.toLowerCase().includes(this.inputValue.toLowerCase()) || typeof o.value == "string" && o.value.toLowerCase().includes(this.inputValue.toLowerCase())) : !0); const f = this.filteredOptions.findIndex((o) => o === u); this.cursor = f < 0 ? 0 : f, this.render(); } handleSpaceToggle() { const u = this.filteredOptions[this.cursor]; if (u.selected) u.selected = !1, this.render(); else { if (u.disabled || this.value.filter((f) => f.selected).length >= this.maxChoices) return this.bell(); u.selected = !0, this.render(); } } handleInputChange(u) { this.inputValue = this.inputValue + u, this.updateFilteredOptions(); } _(u, f) { u === " " ? this.handleSpaceToggle() : this.handleInputChange(u); } 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(u, f, o, c) { const p = (f.selected ? r.green(n.radioOn) : n.radioOff) + " " + c + " "; let d; return f.disabled ? d = u === o ? r.gray().underline(f.title) : r.strikethrough().gray(f.title) : d = u === o ? r.cyan().underline(f.title) : f.title, p + d; } renderDoneOrInstructions() { if (this.done) return this.value.filter((f) => f.selected).map((f) => f.title).join(", "); const u = [ r.gray(this.hint), this.renderInstructions(), this.renderCurrentInput() ]; return this.filteredOptions.length && this.filteredOptions[this.cursor].disabled && u.push(r.yellow(this.warn)), u.join(" "); } render() { if (this.closed) return; this.firstRender && this.out.write(i.hide), super.render(); let u = [ a.symbol(this.done, this.aborted), r.bold(this.msg), a.delimiter(!1), this.renderDoneOrInstructions() ].join(" "); this.showMinError && (u += r.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), u += this.renderOptions(this.filteredOptions), this.out.write(this.clear + u), this.clear = h(u, this.out.columns); } }; t.exports = l; })), Km = /* @__PURE__ */ j(((e, t) => { var r = er(), i = Cr(), { style: s, clear: h } = cr(), { erase: a, cursor: n } = tr(), l = class extends i { constructor(u = {}) { super(u), this.msg = u.message, this.value = u.initial, this.initialValue = !!u.initial, this.yesMsg = u.yes || "yes", this.yesOption = u.yesOption || "(Y/n)", this.noMsg = u.no || "no", this.noOption = u.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(); } _(u, f) { return u.toLowerCase() === "y" ? (this.value = !0, this.submit()) : u.toLowerCase() === "n" ? (this.value = !1, this.submit()) : this.bell(); } render() { if (this.closed) return; this.firstRender ? this.out.write(n.hide) : this.out.write(h(this.outputText, this.out.columns)), super.render(); const u = this.aborted || this.done && !this.value; this.outputText = [