UNPKG

imba

Version:

Intuitive and powerful language for building webapps that fly

1,566 lines (1,554 loc) 880 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); // node_modules/ansi-colors/symbols.js var require_symbols = __commonJS({ "node_modules/ansi-colors/symbols.js"(exports2, module2) { "use strict"; var isHyper = process.env.TERM_PROGRAM === "Hyper"; var isWindows = process.platform === "win32"; var isLinux = process.platform === "linux"; var common = { ballotDisabled: "☒", ballotOff: "☐", ballotOn: "☑", bullet: "•", bulletWhite: "◦", fullBlock: "█", heart: "❤", identicalTo: "≡", line: "─", mark: "※", middot: "·", minus: "-", multiplication: "×", obelus: "÷", pencilDownRight: "✎", pencilRight: "✏", pencilUpRight: "✐", percent: "%", pilcrow2: "❡", pilcrow: "¶", plusMinus: "±", section: "§", starsOff: "☆", starsOn: "★", upDownArrow: "↕" }; var windows = Object.assign({}, common, { check: "√", cross: "×", ellipsisLarge: "...", ellipsis: "...", info: "i", question: "?", questionSmall: "?", pointer: ">", pointerSmall: "»", radioOff: "( )", radioOn: "(*)", warning: "‼" }); var other = Object.assign({}, common, { ballotCross: "✘", check: "✔", cross: "✖", ellipsisLarge: "⋯", ellipsis: "…", info: "ℹ", question: "?", questionFull: "?", questionSmall: "﹖", pointer: isLinux ? "▸" : "❯", pointerSmall: isLinux ? "‣" : "›", radioOff: "◯", radioOn: "◉", warning: "⚠" }); module2.exports = isWindows && !isHyper ? windows : other; Reflect.defineProperty(module2.exports, "common", { enumerable: false, value: common }); Reflect.defineProperty(module2.exports, "windows", { enumerable: false, value: windows }); Reflect.defineProperty(module2.exports, "other", { enumerable: false, value: other }); } }); // node_modules/ansi-colors/index.js var require_ansi_colors = __commonJS({ "node_modules/ansi-colors/index.js"(exports2, module2) { "use strict"; var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val); var ANSI_REGEX = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g; var create = () => { const colors = { enabled: true, visible: true, styles: {}, keys: {} }; if ("FORCE_COLOR" in process.env) { colors.enabled = process.env.FORCE_COLOR !== "0"; } const ansi2 = (style2) => { let open = style2.open = `\x1B[${style2.codes[0]}m`; let close = style2.close = `\x1B[${style2.codes[1]}m`; let regex = style2.regex = new RegExp(`\\u001b\\[${style2.codes[1]}m`, "g"); style2.wrap = (input, newline) => { if (input.includes(close)) input = input.replace(regex, close + open); let output = open + input + close; return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output; }; return style2; }; const wrap = (style2, input, newline) => { return typeof style2 === "function" ? style2(input) : style2.wrap(input, newline); }; const style = (input, stack) => { if (input === "" || input == null) return ""; if (colors.enabled === false) return input; if (colors.visible === false) return ""; let str = "" + input; let nl = str.includes("\n"); let n = stack.length; if (n > 0 && stack.includes("unstyle")) { stack = [.../* @__PURE__ */ new Set(["unstyle", ...stack])].reverse(); } while (n-- > 0) str = wrap(colors.styles[stack[n]], str, nl); return str; }; const define = (name, codes, type) => { colors.styles[name] = ansi2({ name, codes }); let keys = colors.keys[type] || (colors.keys[type] = []); keys.push(name); Reflect.defineProperty(colors, name, { configurable: true, enumerable: true, set(value) { colors.alias(name, value); }, get() { let color = (input) => style(input, color.stack); Reflect.setPrototypeOf(color, colors); color.stack = this.stack ? this.stack.concat(name) : [name]; return color; } }); }; define("reset", [0, 0], "modifier"); define("bold", [1, 22], "modifier"); define("dim", [2, 22], "modifier"); define("italic", [3, 23], "modifier"); define("underline", [4, 24], "modifier"); define("inverse", [7, 27], "modifier"); define("hidden", [8, 28], "modifier"); define("strikethrough", [9, 29], "modifier"); define("black", [30, 39], "color"); define("red", [31, 39], "color"); define("green", [32, 39], "color"); define("yellow", [33, 39], "color"); define("blue", [34, 39], "color"); define("magenta", [35, 39], "color"); define("cyan", [36, 39], "color"); define("white", [37, 39], "color"); define("gray", [90, 39], "color"); define("grey", [90, 39], "color"); define("bgBlack", [40, 49], "bg"); define("bgRed", [41, 49], "bg"); define("bgGreen", [42, 49], "bg"); define("bgYellow", [43, 49], "bg"); define("bgBlue", [44, 49], "bg"); define("bgMagenta", [45, 49], "bg"); define("bgCyan", [46, 49], "bg"); define("bgWhite", [47, 49], "bg"); define("blackBright", [90, 39], "bright"); define("redBright", [91, 39], "bright"); define("greenBright", [92, 39], "bright"); define("yellowBright", [93, 39], "bright"); define("blueBright", [94, 39], "bright"); define("magentaBright", [95, 39], "bright"); define("cyanBright", [96, 39], "bright"); define("whiteBright", [97, 39], "bright"); define("bgBlackBright", [100, 49], "bgBright"); define("bgRedBright", [101, 49], "bgBright"); define("bgGreenBright", [102, 49], "bgBright"); define("bgYellowBright", [103, 49], "bgBright"); define("bgBlueBright", [104, 49], "bgBright"); define("bgMagentaBright", [105, 49], "bgBright"); define("bgCyanBright", [106, 49], "bgBright"); define("bgWhiteBright", [107, 49], "bgBright"); colors.ansiRegex = ANSI_REGEX; colors.hasColor = colors.hasAnsi = (str) => { colors.ansiRegex.lastIndex = 0; return typeof str === "string" && str !== "" && colors.ansiRegex.test(str); }; colors.alias = (name, color) => { let fn = typeof color === "string" ? colors[color] : color; if (typeof fn !== "function") { throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); } if (!fn.stack) { Reflect.defineProperty(fn, "name", { value: name }); colors.styles[name] = fn; fn.stack = [name]; } Reflect.defineProperty(colors, name, { configurable: true, enumerable: true, set(value) { colors.alias(name, value); }, get() { let color2 = (input) => style(input, color2.stack); Reflect.setPrototypeOf(color2, colors); color2.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack; return color2; } }); }; colors.theme = (custom) => { if (!isObject(custom)) throw new TypeError("Expected theme to be an object"); for (let name of Object.keys(custom)) { colors.alias(name, custom[name]); } return colors; }; colors.alias("unstyle", (str) => { if (typeof str === "string" && str !== "") { colors.ansiRegex.lastIndex = 0; return str.replace(colors.ansiRegex, ""); } return ""; }); colors.alias("noop", (str) => str); colors.none = colors.clear = colors.noop; colors.stripColor = colors.unstyle; colors.symbols = require_symbols(); colors.define = define; return colors; }; module2.exports = create(); module2.exports.create = create; } }); // node_modules/enquirer/lib/utils.js var require_utils = __commonJS({ "node_modules/enquirer/lib/utils.js"(exports2) { "use strict"; var toString = Object.prototype.toString; var colors = require_ansi_colors(); var called = false; var fns = []; var complements = { "yellow": "blue", "cyan": "red", "green": "magenta", "black": "white", "blue": "yellow", "red": "cyan", "magenta": "green", "white": "black" }; exports2.longest = (arr, prop) => { return arr.reduce((a, v) => Math.max(a, prop ? v[prop].length : v.length), 0); }; exports2.hasColor = (str) => !!str && colors.hasColor(str); var isObject = exports2.isObject = (val) => { return val !== null && typeof val === "object" && !Array.isArray(val); }; exports2.nativeType = (val) => { return toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, ""); }; exports2.isAsyncFn = (val) => { return exports2.nativeType(val) === "asyncfunction"; }; exports2.isPrimitive = (val) => { return val != null && typeof val !== "object" && typeof val !== "function"; }; exports2.resolve = (context, value, ...rest) => { if (typeof value === "function") { return value.call(context, ...rest); } return value; }; exports2.scrollDown = (choices = []) => [...choices.slice(1), choices[0]]; exports2.scrollUp = (choices = []) => [choices.pop(), ...choices]; exports2.reorder = (arr = []) => { let res = arr.slice(); res.sort((a, b) => { if (a.index > b.index) return 1; if (a.index < b.index) return -1; return 0; }); return res; }; exports2.swap = (arr, index, pos) => { let len = arr.length; let idx = pos === len ? 0 : pos < 0 ? len - 1 : pos; let choice = arr[index]; arr[index] = arr[idx]; arr[idx] = choice; }; exports2.width = (stream, fallback = 80) => { let columns = stream && stream.columns ? stream.columns : fallback; if (stream && typeof stream.getWindowSize === "function") { columns = stream.getWindowSize()[0]; } if (process.platform === "win32") { return columns - 1; } return columns; }; exports2.height = (stream, fallback = 20) => { let rows = stream && stream.rows ? stream.rows : fallback; if (stream && typeof stream.getWindowSize === "function") { rows = stream.getWindowSize()[1]; } return rows; }; exports2.wordWrap = (str, options = {}) => { if (!str) return str; if (typeof options === "number") { options = { width: options }; } let { indent = "", newline = "\n" + indent, width = 80 } = options; let spaces = (newline + indent).match(/[^\S\n]/g) || []; width -= spaces.length; let source = `.{1,${width}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`; let output = str.trim(); let regex = new RegExp(source, "g"); let lines = output.match(regex) || []; lines = lines.map((line) => line.replace(/\n$/, "")); if (options.padEnd) lines = lines.map((line) => line.padEnd(width, " ")); if (options.padStart) lines = lines.map((line) => line.padStart(width, " ")); return indent + lines.join(newline); }; exports2.unmute = (color) => { let name = color.stack.find((n) => colors.keys.color.includes(n)); if (name) { return colors[name]; } let bg = color.stack.find((n) => n.slice(2) === "bg"); if (bg) { return colors[name.slice(2)]; } return (str) => str; }; exports2.pascal = (str) => str ? str[0].toUpperCase() + str.slice(1) : ""; exports2.inverse = (color) => { if (!color || !color.stack) return color; let name = color.stack.find((n) => colors.keys.color.includes(n)); if (name) { let col = colors["bg" + exports2.pascal(name)]; return col ? col.black : color; } let bg = color.stack.find((n) => n.slice(0, 2) === "bg"); if (bg) { return colors[bg.slice(2).toLowerCase()] || color; } return colors.none; }; exports2.complement = (color) => { if (!color || !color.stack) return color; let name = color.stack.find((n) => colors.keys.color.includes(n)); let bg = color.stack.find((n) => n.slice(0, 2) === "bg"); if (name && !bg) { return colors[complements[name] || name]; } if (bg) { let lower = bg.slice(2).toLowerCase(); let comp = complements[lower]; if (!comp) return color; return colors["bg" + exports2.pascal(comp)] || color; } return colors.none; }; exports2.meridiem = (date) => { let hours = date.getHours(); let minutes = date.getMinutes(); let ampm = hours >= 12 ? "pm" : "am"; hours = hours % 12; let hrs = hours === 0 ? 12 : hours; let min = minutes < 10 ? "0" + minutes : minutes; return hrs + ":" + min + " " + ampm; }; exports2.set = (obj = {}, prop = "", val) => { return prop.split(".").reduce((acc, k, i, arr) => { let value = arr.length - 1 > i ? acc[k] || {} : val; if (!exports2.isObject(value) && i < arr.length - 1) value = {}; return acc[k] = value; }, obj); }; exports2.get = (obj = {}, prop = "", fallback) => { let value = obj[prop] == null ? prop.split(".").reduce((acc, k) => acc && acc[k], obj) : obj[prop]; return value == null ? fallback : value; }; exports2.mixin = (target, b) => { if (!isObject(target)) return b; if (!isObject(b)) return target; for (let key of Object.keys(b)) { let desc = Object.getOwnPropertyDescriptor(b, key); if (desc.hasOwnProperty("value")) { if (target.hasOwnProperty(key) && isObject(desc.value)) { let existing = Object.getOwnPropertyDescriptor(target, key); if (isObject(existing.value)) { target[key] = exports2.merge({}, target[key], b[key]); } else { Reflect.defineProperty(target, key, desc); } } else { Reflect.defineProperty(target, key, desc); } } else { Reflect.defineProperty(target, key, desc); } } return target; }; exports2.merge = (...args) => { let target = {}; for (let ele of args) exports2.mixin(target, ele); return target; }; exports2.mixinEmitter = (obj, emitter) => { let proto = emitter.constructor.prototype; for (let key of Object.keys(proto)) { let val = proto[key]; if (typeof val === "function") { exports2.define(obj, key, val.bind(emitter)); } else { exports2.define(obj, key, val); } } }; exports2.onExit = (callback) => { const onExit = (quit, code) => { if (called) return; called = true; fns.forEach((fn) => fn()); if (quit === true) { process.exit(128 + code); } }; if (fns.length === 0) { process.once("SIGTERM", onExit.bind(null, true, 15)); process.once("SIGINT", onExit.bind(null, true, 2)); process.once("exit", onExit); } fns.push(callback); }; exports2.define = (obj, key, value) => { Reflect.defineProperty(obj, key, { value }); }; exports2.defineExport = (obj, key, fn) => { let custom; Reflect.defineProperty(obj, key, { enumerable: true, configurable: true, set(val) { custom = val; }, get() { return custom ? custom() : fn(); } }); }; } }); // node_modules/enquirer/lib/combos.js var require_combos = __commonJS({ "node_modules/enquirer/lib/combos.js"(exports2) { "use strict"; exports2.ctrl = { a: "first", b: "backward", c: "cancel", d: "deleteForward", e: "last", f: "forward", g: "reset", i: "tab", k: "cutForward", l: "reset", n: "newItem", m: "cancel", j: "submit", p: "search", r: "remove", s: "save", u: "undo", w: "cutLeft", x: "toggleCursor", v: "paste" }; exports2.shift = { up: "shiftUp", down: "shiftDown", left: "shiftLeft", right: "shiftRight", tab: "prev" }; exports2.fn = { up: "pageUp", down: "pageDown", left: "pageLeft", right: "pageRight", delete: "deleteForward" }; exports2.option = { b: "backward", f: "forward", d: "cutRight", left: "cutLeft", up: "altUp", down: "altDown" }; exports2.keys = { pageup: "pageUp", pagedown: "pageDown", home: "home", end: "end", cancel: "cancel", delete: "deleteForward", backspace: "delete", down: "down", enter: "submit", escape: "cancel", left: "left", space: "space", number: "number", return: "submit", right: "right", tab: "next", up: "up" }; } }); // node_modules/enquirer/lib/keypress.js var require_keypress = __commonJS({ "node_modules/enquirer/lib/keypress.js"(exports2, module2) { "use strict"; var readline = require("readline"); var combos = require_combos(); var metaKeyCodeRe = /^(?:\x1b)([a-zA-Z0-9])$/; var fnKeyRe = /^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/; var keyName = { "OP": "f1", "OQ": "f2", "OR": "f3", "OS": "f4", "[11~": "f1", "[12~": "f2", "[13~": "f3", "[14~": "f4", "[[A": "f1", "[[B": "f2", "[[C": "f3", "[[D": "f4", "[[E": "f5", "[15~": "f5", "[17~": "f6", "[18~": "f7", "[19~": "f8", "[20~": "f9", "[21~": "f10", "[23~": "f11", "[24~": "f12", "[A": "up", "[B": "down", "[C": "right", "[D": "left", "[E": "clear", "[F": "end", "[H": "home", "OA": "up", "OB": "down", "OC": "right", "OD": "left", "OE": "clear", "OF": "end", "OH": "home", "[1~": "home", "[2~": "insert", "[3~": "delete", "[4~": "end", "[5~": "pageup", "[6~": "pagedown", "[[5~": "pageup", "[[6~": "pagedown", "[7~": "home", "[8~": "end", "[a": "up", "[b": "down", "[c": "right", "[d": "left", "[e": "clear", "[2$": "insert", "[3$": "delete", "[5$": "pageup", "[6$": "pagedown", "[7$": "home", "[8$": "end", "Oa": "up", "Ob": "down", "Oc": "right", "Od": "left", "Oe": "clear", "[2^": "insert", "[3^": "delete", "[5^": "pageup", "[6^": "pagedown", "[7^": "home", "[8^": "end", "[Z": "tab" }; function isShiftKey(code) { return ["[a", "[b", "[c", "[d", "[e", "[2$", "[3$", "[5$", "[6$", "[7$", "[8$", "[Z"].includes(code); } function isCtrlKey(code) { return ["Oa", "Ob", "Oc", "Od", "Oe", "[2^", "[3^", "[5^", "[6^", "[7^", "[8^"].includes(code); } var keypress = (s = "", event = {}) => { let parts; let key = { name: event.name, ctrl: false, meta: false, shift: false, option: false, sequence: s, raw: s, ...event }; if (Buffer.isBuffer(s)) { if (s[0] > 127 && s[1] === void 0) { s[0] -= 128; s = "\x1B" + String(s); } else { s = String(s); } } else if (s !== void 0 && typeof s !== "string") { s = String(s); } else if (!s) { s = key.sequence || ""; } key.sequence = key.sequence || s || key.name; if (s === "\r") { key.raw = void 0; key.name = "return"; } else if (s === "\n") { key.name = "enter"; } else if (s === " ") { key.name = "tab"; } else if (s === "\b" || s === "" || s === "\x1B" || s === "\x1B\b") { key.name = "backspace"; key.meta = s.charAt(0) === "\x1B"; } else if (s === "\x1B" || s === "\x1B\x1B") { key.name = "escape"; key.meta = s.length === 2; } else if (s === " " || s === "\x1B ") { key.name = "space"; key.meta = s.length === 2; } else if (s <= "") { key.name = String.fromCharCode(s.charCodeAt(0) + "a".charCodeAt(0) - 1); key.ctrl = true; } else if (s.length === 1 && s >= "0" && s <= "9") { key.name = "number"; } else if (s.length === 1 && s >= "a" && s <= "z") { key.name = s; } else if (s.length === 1 && s >= "A" && s <= "Z") { key.name = s.toLowerCase(); key.shift = true; } else if (parts = metaKeyCodeRe.exec(s)) { key.meta = true; key.shift = /^[A-Z]$/.test(parts[1]); } else if (parts = fnKeyRe.exec(s)) { let segs = [...s]; if (segs[0] === "\x1B" && segs[1] === "\x1B") { key.option = true; } let code = [parts[1], parts[2], parts[4], parts[6]].filter(Boolean).join(""); let modifier = (parts[3] || parts[5] || 1) - 1; key.ctrl = !!(modifier & 4); key.meta = !!(modifier & 10); key.shift = !!(modifier & 1); key.code = code; key.name = keyName[code]; key.shift = isShiftKey(code) || key.shift; key.ctrl = isCtrlKey(code) || key.ctrl; } return key; }; keypress.listen = (options = {}, onKeypress) => { let { stdin } = options; if (!stdin || stdin !== process.stdin && !stdin.isTTY) { throw new Error("Invalid stream passed"); } let rl = readline.createInterface({ terminal: true, input: stdin }); readline.emitKeypressEvents(stdin, rl); let on = (buf, key) => onKeypress(buf, keypress(buf, key), rl); let isRaw = stdin.isRaw; if (stdin.isTTY) stdin.setRawMode(true); stdin.on("keypress", on); rl.resume(); let off = () => { if (stdin.isTTY) stdin.setRawMode(isRaw); stdin.removeListener("keypress", on); rl.pause(); rl.close(); }; return off; }; keypress.action = (buf, key, customActions) => { let obj = { ...combos, ...customActions }; if (key.ctrl) { key.action = obj.ctrl[key.name]; return key; } if (key.option && obj.option) { key.action = obj.option[key.name]; return key; } if (key.shift) { key.action = obj.shift[key.name]; return key; } key.action = obj.keys[key.name]; return key; }; module2.exports = keypress; } }); // node_modules/enquirer/lib/timer.js var require_timer = __commonJS({ "node_modules/enquirer/lib/timer.js"(exports2, module2) { "use strict"; module2.exports = (prompt2) => { prompt2.timers = prompt2.timers || {}; let timers = prompt2.options.timers; if (!timers) return; for (let key of Object.keys(timers)) { let opts = timers[key]; if (typeof opts === "number") { opts = { interval: opts }; } create(prompt2, key, opts); } }; function create(prompt2, name, options = {}) { let timer = prompt2.timers[name] = { name, start: Date.now(), ms: 0, tick: 0 }; let ms = options.interval || 120; timer.frames = options.frames || []; timer.loading = true; let interval = setInterval(() => { timer.ms = Date.now() - timer.start; timer.tick++; prompt2.render(); }, ms); timer.stop = () => { timer.loading = false; clearInterval(interval); }; Reflect.defineProperty(timer, "interval", { value: interval }); prompt2.once("close", () => timer.stop()); return timer.stop; } } }); // node_modules/enquirer/lib/state.js var require_state = __commonJS({ "node_modules/enquirer/lib/state.js"(exports2, module2) { "use strict"; var { define, width } = require_utils(); var State = class { constructor(prompt2) { let options = prompt2.options; define(this, "_prompt", prompt2); this.type = prompt2.type; this.name = prompt2.name; this.message = ""; this.header = ""; this.footer = ""; this.error = ""; this.hint = ""; this.input = ""; this.cursor = 0; this.index = 0; this.lines = 0; this.tick = 0; this.prompt = ""; this.buffer = ""; this.width = width(options.stdout || process.stdout); Object.assign(this, options); this.name = this.name || this.message; this.message = this.message || this.name; this.symbols = prompt2.symbols; this.styles = prompt2.styles; this.required = /* @__PURE__ */ new Set(); this.cancelled = false; this.submitted = false; } clone() { let state = { ...this }; state.status = this.status; state.buffer = Buffer.from(state.buffer); delete state.clone; return state; } set color(val) { this._color = val; } get color() { let styles = this.prompt.styles; if (this.cancelled) return styles.cancelled; if (this.submitted) return styles.submitted; let color = this._color || styles[this.status]; return typeof color === "function" ? color : styles.pending; } set loading(value) { this._loading = value; } get loading() { if (typeof this._loading === "boolean") return this._loading; if (this.loadingChoices) return "choices"; return false; } get status() { if (this.cancelled) return "cancelled"; if (this.submitted) return "submitted"; return "pending"; } }; module2.exports = State; } }); // node_modules/enquirer/lib/styles.js var require_styles = __commonJS({ "node_modules/enquirer/lib/styles.js"(exports2, module2) { "use strict"; var utils = require_utils(); var colors = require_ansi_colors(); var styles = { default: colors.noop, noop: colors.noop, set inverse(custom) { this._inverse = custom; }, get inverse() { return this._inverse || utils.inverse(this.primary); }, set complement(custom) { this._complement = custom; }, get complement() { return this._complement || utils.complement(this.primary); }, primary: colors.cyan, success: colors.green, danger: colors.magenta, strong: colors.bold, warning: colors.yellow, muted: colors.dim, disabled: colors.gray, dark: colors.dim.gray, underline: colors.underline, set info(custom) { this._info = custom; }, get info() { return this._info || this.primary; }, set em(custom) { this._em = custom; }, get em() { return this._em || this.primary.underline; }, set heading(custom) { this._heading = custom; }, get heading() { return this._heading || this.muted.underline; }, set pending(custom) { this._pending = custom; }, get pending() { return this._pending || this.primary; }, set submitted(custom) { this._submitted = custom; }, get submitted() { return this._submitted || this.success; }, set cancelled(custom) { this._cancelled = custom; }, get cancelled() { return this._cancelled || this.danger; }, set typing(custom) { this._typing = custom; }, get typing() { return this._typing || this.dim; }, set placeholder(custom) { this._placeholder = custom; }, get placeholder() { return this._placeholder || this.primary.dim; }, set highlight(custom) { this._highlight = custom; }, get highlight() { return this._highlight || this.inverse; } }; styles.merge = (options = {}) => { if (options.styles && typeof options.styles.enabled === "boolean") { colors.enabled = options.styles.enabled; } if (options.styles && typeof options.styles.visible === "boolean") { colors.visible = options.styles.visible; } let result = utils.merge({}, styles, options.styles); delete result.merge; for (let key of Object.keys(colors)) { if (!result.hasOwnProperty(key)) { Reflect.defineProperty(result, key, { get: () => colors[key] }); } } for (let key of Object.keys(colors.styles)) { if (!result.hasOwnProperty(key)) { Reflect.defineProperty(result, key, { get: () => colors[key] }); } } return result; }; module2.exports = styles; } }); // node_modules/enquirer/lib/symbols.js var require_symbols2 = __commonJS({ "node_modules/enquirer/lib/symbols.js"(exports2, module2) { "use strict"; var isWindows = process.platform === "win32"; var colors = require_ansi_colors(); var utils = require_utils(); var symbols = { ...colors.symbols, upDownDoubleArrow: "⇕", upDownDoubleArrow2: "⬍", upDownArrow: "↕", asterisk: "*", asterism: "⁂", bulletWhite: "◦", electricArrow: "⌁", ellipsisLarge: "⋯", ellipsisSmall: "…", fullBlock: "█", identicalTo: "≡", indicator: colors.symbols.check, leftAngle: "‹", mark: "※", minus: "−", multiplication: "×", obelus: "÷", percent: "%", pilcrow: "¶", pilcrow2: "❡", pencilUpRight: "✐", pencilDownRight: "✎", pencilRight: "✏", plus: "+", plusMinus: "±", pointRight: "☞", rightAngle: "›", section: "§", hexagon: { off: "⬡", on: "⬢", disabled: "⬢" }, ballot: { on: "☑", off: "☐", disabled: "☒" }, stars: { on: "★", off: "☆", disabled: "☆" }, folder: { on: "▼", off: "▶", disabled: "▶" }, prefix: { pending: colors.symbols.question, submitted: colors.symbols.check, cancelled: colors.symbols.cross }, separator: { pending: colors.symbols.pointerSmall, submitted: colors.symbols.middot, cancelled: colors.symbols.middot }, radio: { off: isWindows ? "( )" : "◯", on: isWindows ? "(*)" : "◉", disabled: isWindows ? "(|)" : "Ⓘ" }, numbers: ["⓪", "①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨", "⑩", "⑪", "⑫", "⑬", "⑭", "⑮", "⑯", "⑰", "⑱", "⑲", "⑳", "㉑", "㉒", "㉓", "㉔", "㉕", "㉖", "㉗", "㉘", "㉙", "㉚", "㉛", "㉜", "㉝", "㉞", "㉟", "㊱", "㊲", "㊳", "㊴", "㊵", "㊶", "㊷", "㊸", "㊹", "㊺", "㊻", "㊼", "㊽", "㊾", "㊿"] }; symbols.merge = (options) => { let result = utils.merge({}, colors.symbols, symbols, options.symbols); delete result.merge; return result; }; module2.exports = symbols; } }); // node_modules/enquirer/lib/theme.js var require_theme = __commonJS({ "node_modules/enquirer/lib/theme.js"(exports2, module2) { "use strict"; var styles = require_styles(); var symbols = require_symbols2(); var utils = require_utils(); module2.exports = (prompt2) => { prompt2.options = utils.merge({}, prompt2.options.theme, prompt2.options); prompt2.symbols = symbols.merge(prompt2.options); prompt2.styles = styles.merge(prompt2.options); }; } }); // node_modules/enquirer/lib/ansi.js var require_ansi = __commonJS({ "node_modules/enquirer/lib/ansi.js"(exports2, module2) { "use strict"; var isTerm = process.env.TERM_PROGRAM === "Apple_Terminal"; var colors = require_ansi_colors(); var utils = require_utils(); var ansi2 = module2.exports = exports2; var ESC = "\x1B["; var BEL = "\x07"; var hidden = false; var code = ansi2.code = { bell: BEL, beep: BEL, beginning: `${ESC}G`, down: `${ESC}J`, esc: ESC, getPosition: `${ESC}6n`, hide: `${ESC}?25l`, line: `${ESC}2K`, lineEnd: `${ESC}K`, lineStart: `${ESC}1K`, restorePosition: ESC + (isTerm ? "8" : "u"), savePosition: ESC + (isTerm ? "7" : "s"), screen: `${ESC}2J`, show: `${ESC}?25h`, up: `${ESC}1J` }; var cursor = ansi2.cursor = { get hidden() { return hidden; }, hide() { hidden = true; return code.hide; }, show() { hidden = false; return code.show; }, forward: (count = 1) => `${ESC}${count}C`, backward: (count = 1) => `${ESC}${count}D`, nextLine: (count = 1) => `${ESC}E`.repeat(count), prevLine: (count = 1) => `${ESC}F`.repeat(count), up: (count = 1) => count ? `${ESC}${count}A` : "", down: (count = 1) => count ? `${ESC}${count}B` : "", right: (count = 1) => count ? `${ESC}${count}C` : "", left: (count = 1) => count ? `${ESC}${count}D` : "", to(x, y) { return y ? `${ESC}${y + 1};${x + 1}H` : `${ESC}${x + 1}G`; }, move(x = 0, y = 0) { let res = ""; res += x < 0 ? cursor.left(-x) : x > 0 ? cursor.right(x) : ""; res += y < 0 ? cursor.up(-y) : y > 0 ? cursor.down(y) : ""; return res; }, restore(state = {}) { let { after, cursor: cursor2, initial, input, prompt: prompt2, size, value } = state; initial = utils.isPrimitive(initial) ? String(initial) : ""; input = utils.isPrimitive(input) ? String(input) : ""; value = utils.isPrimitive(value) ? String(value) : ""; if (size) { let codes = ansi2.cursor.up(size) + ansi2.cursor.to(prompt2.length); let diff = input.length - cursor2; if (diff > 0) { codes += ansi2.cursor.left(diff); } return codes; } if (value || after) { let pos = !input && !!initial ? -initial.length : -input.length + cursor2; if (after) pos -= after.length; if (input === "" && initial && !prompt2.includes(initial)) { pos += initial.length; } return ansi2.cursor.move(pos); } } }; var erase = ansi2.erase = { screen: code.screen, up: code.up, down: code.down, line: code.line, lineEnd: code.lineEnd, lineStart: code.lineStart, lines(n) { let str = ""; for (let i = 0; i < n; i++) { str += ansi2.erase.line + (i < n - 1 ? ansi2.cursor.up(1) : ""); } if (n) str += ansi2.code.beginning; return str; } }; ansi2.clear = (input = "", columns = process.stdout.columns) => { if (!columns) return erase.line + cursor.to(0); let width = (str) => [...colors.unstyle(str)].length; let lines = input.split(/\r?\n/); let rows = 0; for (let line of lines) { rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / columns); } return (erase.line + cursor.prevLine()).repeat(rows - 1) + erase.line + cursor.to(0); }; } }); // node_modules/enquirer/lib/prompt.js var require_prompt = __commonJS({ "node_modules/enquirer/lib/prompt.js"(exports2, module2) { "use strict"; var Events = require("events"); var colors = require_ansi_colors(); var keypress = require_keypress(); var timer = require_timer(); var State = require_state(); var theme = require_theme(); var utils = require_utils(); var ansi2 = require_ansi(); var Prompt = class extends Events { constructor(options = {}) { super(); this.name = options.name; this.type = options.type; this.options = options; theme(this); timer(this); this.state = new State(this); this.initial = [options.initial, options.default].find((v) => v != null); this.stdout = options.stdout || process.stdout; this.stdin = options.stdin || process.stdin; this.scale = options.scale || 1; this.term = this.options.term || process.env.TERM_PROGRAM; this.margin = margin(this.options.margin); this.setMaxListeners(0); setOptions(this); } async keypress(input, event = {}) { this.keypressed = true; let key = keypress.action(input, keypress(input, event), this.options.actions); this.state.keypress = key; this.emit("keypress", input, key); this.emit("state", this.state.clone()); let fn = this.options[key.action] || this[key.action] || this.dispatch; if (typeof fn === "function") { return await fn.call(this, input, key); } this.alert(); } alert() { delete this.state.alert; if (this.options.show === false) { this.emit("alert"); } else { this.stdout.write(ansi2.code.beep); } } cursorHide() { this.stdout.write(ansi2.cursor.hide()); utils.onExit(() => this.cursorShow()); } cursorShow() { this.stdout.write(ansi2.cursor.show()); } write(str) { if (!str) return; if (this.stdout && this.state.show !== false) { this.stdout.write(str); } this.state.buffer += str; } clear(lines = 0) { let buffer = this.state.buffer; this.state.buffer = ""; if (!buffer && !lines || this.options.show === false) return; this.stdout.write(ansi2.cursor.down(lines) + ansi2.clear(buffer, this.width)); } restore() { if (this.state.closed || this.options.show === false) return; let { prompt: prompt2, after, rest } = this.sections(); let { cursor, initial = "", input = "", value = "" } = this; let size = this.state.size = rest.length; let state = { after, cursor, initial, input, prompt: prompt2, size, value }; let codes = ansi2.cursor.restore(state); if (codes) { this.stdout.write(codes); } } sections() { let { buffer, input, prompt: prompt2 } = this.state; prompt2 = colors.unstyle(prompt2); let buf = colors.unstyle(buffer); let idx = buf.indexOf(prompt2); let header = buf.slice(0, idx); let rest = buf.slice(idx); let lines = rest.split("\n"); let first = lines[0]; let last = lines[lines.length - 1]; let promptLine = prompt2 + (input ? " " + input : ""); let len = promptLine.length; let after = len < first.length ? first.slice(len + 1) : ""; return { header, prompt: first, after, rest: lines.slice(1), last }; } async submit() { this.state.submitted = true; this.state.validating = true; if (this.options.onSubmit) { await this.options.onSubmit.call(this, this.name, this.value, this); } let result = this.state.error || await this.validate(this.value, this.state); if (result !== true) { let error = "\n" + this.symbols.pointer + " "; if (typeof result === "string") { error += result.trim(); } else { error += "Invalid input"; } this.state.error = "\n" + this.styles.danger(error); this.state.submitted = false; await this.render(); await this.alert(); this.state.validating = false; this.state.error = void 0; return; } this.state.validating = false; await this.render(); await this.close(); this.value = await this.result(this.value); this.emit("submit", this.value); } async cancel(err) { this.state.cancelled = this.state.submitted = true; await this.render(); await this.close(); if (typeof this.options.onCancel === "function") { await this.options.onCancel.call(this, this.name, this.value, this); } this.emit("cancel", await this.error(err)); } async close() { this.state.closed = true; try { let sections = this.sections(); let lines = Math.ceil(sections.prompt.length / this.width); if (sections.rest) { this.write(ansi2.cursor.down(sections.rest.length)); } this.write("\n".repeat(lines)); } catch (err) { } this.emit("close"); } start() { if (!this.stop && this.options.show !== false) { this.stop = keypress.listen(this, this.keypress.bind(this)); this.once("close", this.stop); } } async skip() { this.skipped = this.options.skip === true; if (typeof this.options.skip === "function") { this.skipped = await this.options.skip.call(this, this.name, this.value); } return this.skipped; } async initialize() { let { format: format2, options, result } = this; this.format = () => format2.call(this, this.value); this.result = () => result.call(this, this.value); if (typeof options.initial === "function") { this.initial = await options.initial.call(this, this); } if (typeof options.onRun === "function") { await options.onRun.call(this, this); } if (typeof options.onSubmit === "function") { let onSubmit = options.onSubmit.bind(this); let submit = this.submit.bind(this); delete this.options.onSubmit; this.submit = async () => { await onSubmit(this.name, this.value, this); return submit(); }; } await this.start(); await this.render(); } render() { throw new Error("expected prompt to have a custom render method"); } run() { return new Promise(async (resolve, reject) => { this.once("submit", resolve); this.once("cancel", reject); if (await this.skip()) { this.render = () => { }; return this.submit(); } await this.initialize(); this.emit("run"); }); } async element(name, choice, i) { let { options, state, symbols, timers } = this; let timer2 = timers && timers[name]; state.timer = timer2; let value = options[name] || state[name] || symbols[name]; let val = choice && choice[name] != null ? choice[name] : await value; if (val === "") return val; let res = await this.resolve(val, state, choice, i); if (!res && choice && choice[name]) { return this.resolve(value, state, choice, i); } return res; } async prefix() { let element = await this.element("prefix") || this.symbols; let timer2 = this.timers && this.timers.prefix; let state = this.state; state.timer = timer2; if (utils.isObject(element)) element = element[state.status] || element.pending; if (!utils.hasColor(element)) { let style = this.styles[state.status] || this.styles.pending; return style(element); } return element; } async message() { let message = await this.element("message"); if (!utils.hasColor(message)) { return this.styles.strong(message); } return message; } async separator() { let element = await this.element("separator") || this.symbols; let timer2 = this.timers && this.timers.separator; let state = this.state; state.timer = timer2; let value = element[state.status] || element.pending || state.separator; let ele = await this.resolve(value, state); if (utils.isObject(ele)) ele = ele[state.status] || ele.pending; if (!utils.hasColor(ele)) { return this.styles.muted(ele); } return ele; } async pointer(choice, i) { let val = await this.element("pointer", choice, i); if (typeof val === "string" && utils.hasColor(val)) { return val; } if (val) { let styles = this.styles; let focused = this.index === i; let style = focused ? styles.primary : (val2) => val2; let ele = await this.resolve(val[focused ? "on" : "off"] || val, this.state); let styled = !utils.hasColor(ele) ? style(ele) : ele; return focused ? styled : " ".repeat(ele.length); } } async indicator(choice, i) { let val = await this.element("indicator", choice, i); if (typeof val === "string" && utils.hasColor(val)) { return val; } if (val) { let styles = this.styles; let enabled = choice.enabled === true; let style = enabled ? styles.success : styles.dark; let ele = val[enabled ? "on" : "off"] || val; return !utils.hasColor(ele) ? style(ele) : ele; } return ""; } body() { return null; } footer() { if (this.state.status === "pending") { return this.element("footer"); } } header() { if (this.state.status === "pending") { return this.element("header"); } } async hint() { if (this.state.status === "pending" && !this.isValue(this.state.input)) { let hint = await this.element("hint"); if (!utils.hasColor(hint)) { return this.styles.muted(hint); } return hint; } } error(err) { return !this.state.submitted ? err || this.state.error : ""; } format(value) { return value; } result(value) { return value; } validate(value) { if (this.options.required === true) { return this.isValue(value); } return true; } isValue(value) { return value != null && value !== ""; } resolve(value, ...args) { return utils.resolve(this, value, ...args); } get base() { return Prompt.prototype; } get style() { return this.styles[this.state.status]; } get height() { return this.options.rows || utils.height(this.stdout, 25); } get width() { return this.options.columns || utils.width(this.stdout, 80); } get size() { return { width: this.width, height: this.height }; } set cursor(value) { this.state.cursor = value; } get cursor() { return this.state.cursor; } set input(value) { this.state.input = value; } get input() { return this.state.input; } set value(value) { this.state.value = value; } get value() { let { input, value } = this.state; let result = [value, input].find(this.isValue.bind(this)); return this.isValue(result) ? result : this.initial; } static get prompt() { return (options) => new this(options).run(); } }; function setOptions(prompt2) { let isValidKey = (key) => { return prompt2[key] === void 0 || typeof prompt2[key] === "function"; }; let ignore = [ "actions", "choices", "initial", "margin", "roles", "styles", "symbols", "theme", "timers", "value" ]; let ignoreFn = [ "body", "footer", "error", "header", "hint", "indicator", "message", "prefix", "separator", "skip" ]; for (let key of Object.keys(prompt2.options)) { if (ignore.includes(key)) continue; if (/^on[A-Z]/.test(key)) continue; let option = prompt2.options