node-ovh-ts
Version:
OVH API wrapper library for TypeScript
1 lines • 298 kB
Source Map (JSON)
{"version":3,"sources":["../node_modules/.pnpm/vitest@0.24.5_happy-dom@6.0.4/node_modules/vitest/dist/vendor-index.9f20a9be.js"],"sourcesContent":["import require$$0 from 'readline';\nimport require$$2 from 'events';\n\nfunction _mergeNamespaces(n, m) {\n\tm.forEach(function (e) {\n\t\te && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {\n\t\t\tif (k !== 'default' && !(k in n)) {\n\t\t\t\tvar d = Object.getOwnPropertyDescriptor(e, k);\n\t\t\t\tObject.defineProperty(n, k, d.get ? d : {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tget: function () { return e[k]; }\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t});\n\treturn Object.freeze(n);\n}\n\nvar prompts$2 = {};\n\nvar kleur;\nvar hasRequiredKleur;\n\nfunction requireKleur () {\n\tif (hasRequiredKleur) return kleur;\n\thasRequiredKleur = 1;\n\n\tconst { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env;\n\n\tconst $ = {\n\t\tenabled: !NODE_DISABLE_COLORS && TERM !== 'dumb' && FORCE_COLOR !== '0',\n\n\t\t// modifiers\n\t\treset: init(0, 0),\n\t\tbold: init(1, 22),\n\t\tdim: init(2, 22),\n\t\titalic: init(3, 23),\n\t\tunderline: init(4, 24),\n\t\tinverse: init(7, 27),\n\t\thidden: init(8, 28),\n\t\tstrikethrough: init(9, 29),\n\n\t\t// colors\n\t\tblack: init(30, 39),\n\t\tred: init(31, 39),\n\t\tgreen: init(32, 39),\n\t\tyellow: init(33, 39),\n\t\tblue: init(34, 39),\n\t\tmagenta: init(35, 39),\n\t\tcyan: init(36, 39),\n\t\twhite: init(37, 39),\n\t\tgray: init(90, 39),\n\t\tgrey: init(90, 39),\n\n\t\t// background colors\n\t\tbgBlack: init(40, 49),\n\t\tbgRed: init(41, 49),\n\t\tbgGreen: init(42, 49),\n\t\tbgYellow: init(43, 49),\n\t\tbgBlue: init(44, 49),\n\t\tbgMagenta: init(45, 49),\n\t\tbgCyan: init(46, 49),\n\t\tbgWhite: init(47, 49)\n\t};\n\n\tfunction run(arr, str) {\n\t\tlet i=0, tmp, beg='', end='';\n\t\tfor (; i < arr.length; i++) {\n\t\t\ttmp = arr[i];\n\t\t\tbeg += tmp.open;\n\t\t\tend += tmp.close;\n\t\t\tif (str.includes(tmp.close)) {\n\t\t\t\tstr = str.replace(tmp.rgx, tmp.close + tmp.open);\n\t\t\t}\n\t\t}\n\t\treturn beg + str + end;\n\t}\n\n\tfunction chain(has, keys) {\n\t\tlet ctx = { has, keys };\n\n\t\tctx.reset = $.reset.bind(ctx);\n\t\tctx.bold = $.bold.bind(ctx);\n\t\tctx.dim = $.dim.bind(ctx);\n\t\tctx.italic = $.italic.bind(ctx);\n\t\tctx.underline = $.underline.bind(ctx);\n\t\tctx.inverse = $.inverse.bind(ctx);\n\t\tctx.hidden = $.hidden.bind(ctx);\n\t\tctx.strikethrough = $.strikethrough.bind(ctx);\n\n\t\tctx.black = $.black.bind(ctx);\n\t\tctx.red = $.red.bind(ctx);\n\t\tctx.green = $.green.bind(ctx);\n\t\tctx.yellow = $.yellow.bind(ctx);\n\t\tctx.blue = $.blue.bind(ctx);\n\t\tctx.magenta = $.magenta.bind(ctx);\n\t\tctx.cyan = $.cyan.bind(ctx);\n\t\tctx.white = $.white.bind(ctx);\n\t\tctx.gray = $.gray.bind(ctx);\n\t\tctx.grey = $.grey.bind(ctx);\n\n\t\tctx.bgBlack = $.bgBlack.bind(ctx);\n\t\tctx.bgRed = $.bgRed.bind(ctx);\n\t\tctx.bgGreen = $.bgGreen.bind(ctx);\n\t\tctx.bgYellow = $.bgYellow.bind(ctx);\n\t\tctx.bgBlue = $.bgBlue.bind(ctx);\n\t\tctx.bgMagenta = $.bgMagenta.bind(ctx);\n\t\tctx.bgCyan = $.bgCyan.bind(ctx);\n\t\tctx.bgWhite = $.bgWhite.bind(ctx);\n\n\t\treturn ctx;\n\t}\n\n\tfunction init(open, close) {\n\t\tlet blk = {\n\t\t\topen: `\\x1b[${open}m`,\n\t\t\tclose: `\\x1b[${close}m`,\n\t\t\trgx: new RegExp(`\\\\x1b\\\\[${close}m`, 'g')\n\t\t};\n\t\treturn function (txt) {\n\t\t\tif (this !== void 0 && this.has !== void 0) {\n\t\t\t\tthis.has.includes(open) || (this.has.push(open),this.keys.push(blk));\n\t\t\t\treturn txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+'';\n\t\t\t}\n\t\t\treturn txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';\n\t\t};\n\t}\n\n\tkleur = $;\n\treturn kleur;\n}\n\nvar action$1;\nvar hasRequiredAction$1;\n\nfunction requireAction$1 () {\n\tif (hasRequiredAction$1) return action$1;\n\thasRequiredAction$1 = 1;\n\n\taction$1 = (key, isSelect) => {\n\t if (key.meta && key.name !== 'escape') return;\n\n\t if (key.ctrl) {\n\t if (key.name === 'a') return 'first';\n\t if (key.name === 'c') return 'abort';\n\t if (key.name === 'd') return 'abort';\n\t if (key.name === 'e') return 'last';\n\t if (key.name === 'g') return 'reset';\n\t }\n\n\t if (isSelect) {\n\t if (key.name === 'j') return 'down';\n\t if (key.name === 'k') return 'up';\n\t }\n\n\t if (key.name === 'return') return 'submit';\n\t if (key.name === 'enter') return 'submit'; // ctrl + J\n\n\t if (key.name === 'backspace') return 'delete';\n\t if (key.name === 'delete') return 'deleteForward';\n\t if (key.name === 'abort') return 'abort';\n\t if (key.name === 'escape') return 'exit';\n\t if (key.name === 'tab') return 'next';\n\t if (key.name === 'pagedown') return 'nextPage';\n\t if (key.name === 'pageup') return 'prevPage'; // TODO create home() in prompt types (e.g. TextPrompt)\n\n\t if (key.name === 'home') return 'home'; // TODO create end() in prompt types (e.g. TextPrompt)\n\n\t if (key.name === 'end') return 'end';\n\t if (key.name === 'up') return 'up';\n\t if (key.name === 'down') return 'down';\n\t if (key.name === 'right') return 'right';\n\t if (key.name === 'left') return 'left';\n\t return false;\n\t};\n\treturn action$1;\n}\n\nvar strip$1;\nvar hasRequiredStrip$1;\n\nfunction requireStrip$1 () {\n\tif (hasRequiredStrip$1) return strip$1;\n\thasRequiredStrip$1 = 1;\n\n\tstrip$1 = str => {\n\t const pattern = ['[\\\\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('|');\n\t const RGX = new RegExp(pattern, 'g');\n\t return typeof str === 'string' ? str.replace(RGX, '') : str;\n\t};\n\treturn strip$1;\n}\n\nvar src;\nvar hasRequiredSrc;\n\nfunction requireSrc () {\n\tif (hasRequiredSrc) return src;\n\thasRequiredSrc = 1;\n\n\tconst ESC = '\\x1B';\n\tconst CSI = `${ESC}[`;\n\tconst beep = '\\u0007';\n\n\tconst cursor = {\n\t to(x, y) {\n\t if (!y) return `${CSI}${x + 1}G`;\n\t return `${CSI}${y + 1};${x + 1}H`;\n\t },\n\t move(x, y) {\n\t let ret = '';\n\n\t if (x < 0) ret += `${CSI}${-x}D`;\n\t else if (x > 0) ret += `${CSI}${x}C`;\n\n\t if (y < 0) ret += `${CSI}${-y}A`;\n\t else if (y > 0) ret += `${CSI}${y}B`;\n\n\t return ret;\n\t },\n\t up: (count = 1) => `${CSI}${count}A`,\n\t down: (count = 1) => `${CSI}${count}B`,\n\t forward: (count = 1) => `${CSI}${count}C`,\n\t backward: (count = 1) => `${CSI}${count}D`,\n\t nextLine: (count = 1) => `${CSI}E`.repeat(count),\n\t prevLine: (count = 1) => `${CSI}F`.repeat(count),\n\t left: `${CSI}G`,\n\t hide: `${CSI}?25l`,\n\t show: `${CSI}?25h`,\n\t save: `${ESC}7`,\n\t restore: `${ESC}8`\n\t};\n\n\tconst scroll = {\n\t up: (count = 1) => `${CSI}S`.repeat(count),\n\t down: (count = 1) => `${CSI}T`.repeat(count)\n\t};\n\n\tconst erase = {\n\t screen: `${CSI}2J`,\n\t up: (count = 1) => `${CSI}1J`.repeat(count),\n\t down: (count = 1) => `${CSI}J`.repeat(count),\n\t line: `${CSI}2K`,\n\t lineEnd: `${CSI}K`,\n\t lineStart: `${CSI}1K`,\n\t lines(count) {\n\t let clear = '';\n\t for (let i = 0; i < count; i++)\n\t clear += this.line + (i < count - 1 ? cursor.up() : '');\n\t if (count)\n\t clear += cursor.left;\n\t return clear;\n\t }\n\t};\n\n\tsrc = { cursor, scroll, erase, beep };\n\treturn src;\n}\n\nvar clear$1;\nvar hasRequiredClear$1;\n\nfunction requireClear$1 () {\n\tif (hasRequiredClear$1) return clear$1;\n\thasRequiredClear$1 = 1;\n\n\tfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\n\tfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\n\tfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\n\n\tconst strip = requireStrip$1();\n\n\tconst _require = requireSrc(),\n\t erase = _require.erase,\n\t cursor = _require.cursor;\n\n\tconst width = str => [...strip(str)].length;\n\t/**\n\t * @param {string} prompt\n\t * @param {number} perLine\n\t */\n\n\n\tclear$1 = function (prompt, perLine) {\n\t if (!perLine) return erase.line + cursor.to(0);\n\t let rows = 0;\n\t const lines = prompt.split(/\\r?\\n/);\n\n\t var _iterator = _createForOfIteratorHelper(lines),\n\t _step;\n\n\t try {\n\t for (_iterator.s(); !(_step = _iterator.n()).done;) {\n\t let line = _step.value;\n\t rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);\n\t }\n\t } catch (err) {\n\t _iterator.e(err);\n\t } finally {\n\t _iterator.f();\n\t }\n\n\t return erase.lines(rows);\n\t};\n\treturn clear$1;\n}\n\nvar figures_1$1;\nvar hasRequiredFigures$1;\n\nfunction requireFigures$1 () {\n\tif (hasRequiredFigures$1) return figures_1$1;\n\thasRequiredFigures$1 = 1;\n\n\tconst main = {\n\t arrowUp: '↑',\n\t arrowDown: '↓',\n\t arrowLeft: '←',\n\t arrowRight: '→',\n\t radioOn: '◉',\n\t radioOff: '◯',\n\t tick: '✔',\n\t cross: '✖',\n\t ellipsis: '…',\n\t pointerSmall: '›',\n\t line: '─',\n\t pointer: '❯'\n\t};\n\tconst win = {\n\t arrowUp: main.arrowUp,\n\t arrowDown: main.arrowDown,\n\t arrowLeft: main.arrowLeft,\n\t arrowRight: main.arrowRight,\n\t radioOn: '(*)',\n\t radioOff: '( )',\n\t tick: '√',\n\t cross: '×',\n\t ellipsis: '...',\n\t pointerSmall: '»',\n\t line: '─',\n\t pointer: '>'\n\t};\n\tconst figures = process.platform === 'win32' ? win : main;\n\tfigures_1$1 = figures;\n\treturn figures_1$1;\n}\n\nvar style$1;\nvar hasRequiredStyle$1;\n\nfunction requireStyle$1 () {\n\tif (hasRequiredStyle$1) return style$1;\n\thasRequiredStyle$1 = 1;\n\n\tconst c = requireKleur();\n\n\tconst figures = requireFigures$1(); // rendering user input.\n\n\n\tconst styles = Object.freeze({\n\t password: {\n\t scale: 1,\n\t render: input => '*'.repeat(input.length)\n\t },\n\t emoji: {\n\t scale: 2,\n\t render: input => '😃'.repeat(input.length)\n\t },\n\t invisible: {\n\t scale: 0,\n\t render: input => ''\n\t },\n\t default: {\n\t scale: 1,\n\t render: input => `${input}`\n\t }\n\t});\n\n\tconst render = type => styles[type] || styles.default; // icon to signalize a prompt.\n\n\n\tconst symbols = Object.freeze({\n\t aborted: c.red(figures.cross),\n\t done: c.green(figures.tick),\n\t exited: c.yellow(figures.cross),\n\t default: c.cyan('?')\n\t});\n\n\tconst symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default; // between the question and the user's input.\n\n\n\tconst delimiter = completing => c.gray(completing ? figures.ellipsis : figures.pointerSmall);\n\n\tconst item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : '+' : figures.line);\n\n\tstyle$1 = {\n\t styles,\n\t render,\n\t symbols,\n\t symbol,\n\t delimiter,\n\t item\n\t};\n\treturn style$1;\n}\n\nvar lines$1;\nvar hasRequiredLines$1;\n\nfunction requireLines$1 () {\n\tif (hasRequiredLines$1) return lines$1;\n\thasRequiredLines$1 = 1;\n\n\tconst strip = requireStrip$1();\n\t/**\n\t * @param {string} msg\n\t * @param {number} perLine\n\t */\n\n\n\tlines$1 = function (msg, perLine) {\n\t let lines = String(strip(msg) || '').split(/\\r?\\n/);\n\t if (!perLine) return lines.length;\n\t return lines.map(l => Math.ceil(l.length / perLine)).reduce((a, b) => a + b);\n\t};\n\treturn lines$1;\n}\n\nvar wrap$1;\nvar hasRequiredWrap$1;\n\nfunction requireWrap$1 () {\n\tif (hasRequiredWrap$1) return wrap$1;\n\thasRequiredWrap$1 = 1;\n\t/**\n\t * @param {string} msg The message to wrap\n\t * @param {object} opts\n\t * @param {number|string} [opts.margin] Left margin\n\t * @param {number} opts.width Maximum characters per line including the margin\n\t */\n\n\twrap$1 = (msg, opts = {}) => {\n\t const tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(' ').join('') : opts.margin || '';\n\t const width = opts.width;\n\t return (msg || '').split(/\\r?\\n/g).map(line => line.split(/\\s+/g).reduce((arr, w) => {\n\t if (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width) arr[arr.length - 1] += ` ${w}`;else arr.push(`${tab}${w}`);\n\t return arr;\n\t }, [tab]).join('\\n')).join('\\n');\n\t};\n\treturn wrap$1;\n}\n\nvar entriesToDisplay$1;\nvar hasRequiredEntriesToDisplay$1;\n\nfunction requireEntriesToDisplay$1 () {\n\tif (hasRequiredEntriesToDisplay$1) return entriesToDisplay$1;\n\thasRequiredEntriesToDisplay$1 = 1;\n\t/**\n\t * Determine what entries should be displayed on the screen, based on the\n\t * currently selected index and the maximum visible. Used in list-based\n\t * prompts like `select` and `multiselect`.\n\t *\n\t * @param {number} cursor the currently selected entry\n\t * @param {number} total the total entries available to display\n\t * @param {number} [maxVisible] the number of entries that can be displayed\n\t */\n\n\tentriesToDisplay$1 = (cursor, total, maxVisible) => {\n\t maxVisible = maxVisible || total;\n\t let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));\n\t if (startIndex < 0) startIndex = 0;\n\t let endIndex = Math.min(startIndex + maxVisible, total);\n\t return {\n\t startIndex,\n\t endIndex\n\t };\n\t};\n\treturn entriesToDisplay$1;\n}\n\nvar util$1;\nvar hasRequiredUtil$1;\n\nfunction requireUtil$1 () {\n\tif (hasRequiredUtil$1) return util$1;\n\thasRequiredUtil$1 = 1;\n\n\tutil$1 = {\n\t action: requireAction$1(),\n\t clear: requireClear$1(),\n\t style: requireStyle$1(),\n\t strip: requireStrip$1(),\n\t figures: requireFigures$1(),\n\t lines: requireLines$1(),\n\t wrap: requireWrap$1(),\n\t entriesToDisplay: requireEntriesToDisplay$1()\n\t};\n\treturn util$1;\n}\n\nvar prompt$1;\nvar hasRequiredPrompt$1;\n\nfunction requirePrompt$1 () {\n\tif (hasRequiredPrompt$1) return prompt$1;\n\thasRequiredPrompt$1 = 1;\n\n\tconst readline = require$$0;\n\n\tconst _require = requireUtil$1(),\n\t action = _require.action;\n\n\tconst EventEmitter = require$$2;\n\n\tconst _require2 = requireSrc(),\n\t beep = _require2.beep,\n\t cursor = _require2.cursor;\n\n\tconst color = requireKleur();\n\t/**\n\t * Base prompt skeleton\n\t * @param {Stream} [opts.stdin] The Readable stream to listen to\n\t * @param {Stream} [opts.stdout] The Writable stream to write readline data to\n\t */\n\n\n\tclass Prompt extends EventEmitter {\n\t constructor(opts = {}) {\n\t super();\n\t this.firstRender = true;\n\t this.in = opts.stdin || process.stdin;\n\t this.out = opts.stdout || process.stdout;\n\n\t this.onRender = (opts.onRender || (() => void 0)).bind(this);\n\n\t const rl = readline.createInterface({\n\t input: this.in,\n\t escapeCodeTimeout: 50\n\t });\n\t readline.emitKeypressEvents(this.in, rl);\n\t if (this.in.isTTY) this.in.setRawMode(true);\n\t const isSelect = ['SelectPrompt', 'MultiselectPrompt'].indexOf(this.constructor.name) > -1;\n\n\t const keypress = (str, key) => {\n\t let a = action(key, isSelect);\n\n\t if (a === false) {\n\t this._ && this._(str, key);\n\t } else if (typeof this[a] === 'function') {\n\t this[a](key);\n\t } else {\n\t this.bell();\n\t }\n\t };\n\n\t this.close = () => {\n\t this.out.write(cursor.show);\n\t this.in.removeListener('keypress', keypress);\n\t if (this.in.isTTY) this.in.setRawMode(false);\n\t rl.close();\n\t this.emit(this.aborted ? 'abort' : this.exited ? 'exit' : 'submit', this.value);\n\t this.closed = true;\n\t };\n\n\t this.in.on('keypress', keypress);\n\t }\n\n\t fire() {\n\t this.emit('state', {\n\t value: this.value,\n\t aborted: !!this.aborted,\n\t exited: !!this.exited\n\t });\n\t }\n\n\t bell() {\n\t this.out.write(beep);\n\t }\n\n\t render() {\n\t this.onRender(color);\n\t if (this.firstRender) this.firstRender = false;\n\t }\n\n\t}\n\n\tprompt$1 = Prompt;\n\treturn prompt$1;\n}\n\nvar text$1;\nvar hasRequiredText$1;\n\nfunction requireText$1 () {\n\tif (hasRequiredText$1) return text$1;\n\thasRequiredText$1 = 1;\n\n\tfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\n\tfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\tconst color = requireKleur();\n\n\tconst Prompt = requirePrompt$1();\n\n\tconst _require = requireSrc(),\n\t erase = _require.erase,\n\t cursor = _require.cursor;\n\n\tconst _require2 = requireUtil$1(),\n\t style = _require2.style,\n\t clear = _require2.clear,\n\t lines = _require2.lines,\n\t figures = _require2.figures;\n\t/**\n\t * TextPrompt Base Element\n\t * @param {Object} opts Options\n\t * @param {String} opts.message Message\n\t * @param {String} [opts.style='default'] Render style\n\t * @param {String} [opts.initial] Default value\n\t * @param {Function} [opts.validate] Validate function\n\t * @param {Stream} [opts.stdin] The Readable stream to listen to\n\t * @param {Stream} [opts.stdout] The Writable stream to write readline data to\n\t * @param {String} [opts.error] The invalid error label\n\t */\n\n\n\tclass TextPrompt extends Prompt {\n\t constructor(opts = {}) {\n\t super(opts);\n\t this.transform = style.render(opts.style);\n\t this.scale = this.transform.scale;\n\t this.msg = opts.message;\n\t this.initial = opts.initial || ``;\n\n\t this.validator = opts.validate || (() => true);\n\n\t this.value = ``;\n\t this.errorMsg = opts.error || `Please Enter A Valid Value`;\n\t this.cursor = Number(!!this.initial);\n\t this.cursorOffset = 0;\n\t this.clear = clear(``, this.out.columns);\n\t this.render();\n\t }\n\n\t set value(v) {\n\t if (!v && this.initial) {\n\t this.placeholder = true;\n\t this.rendered = color.gray(this.transform.render(this.initial));\n\t } else {\n\t this.placeholder = false;\n\t this.rendered = this.transform.render(v);\n\t }\n\n\t this._value = v;\n\t this.fire();\n\t }\n\n\t get value() {\n\t return this._value;\n\t }\n\n\t reset() {\n\t this.value = ``;\n\t this.cursor = Number(!!this.initial);\n\t this.cursorOffset = 0;\n\t this.fire();\n\t this.render();\n\t }\n\n\t exit() {\n\t this.abort();\n\t }\n\n\t abort() {\n\t this.value = this.value || this.initial;\n\t this.done = this.aborted = true;\n\t this.error = false;\n\t this.red = false;\n\t this.fire();\n\t this.render();\n\t this.out.write('\\n');\n\t this.close();\n\t }\n\n\t validate() {\n\t var _this = this;\n\n\t return _asyncToGenerator(function* () {\n\t let valid = yield _this.validator(_this.value);\n\n\t if (typeof valid === `string`) {\n\t _this.errorMsg = valid;\n\t valid = false;\n\t }\n\n\t _this.error = !valid;\n\t })();\n\t }\n\n\t submit() {\n\t var _this2 = this;\n\n\t return _asyncToGenerator(function* () {\n\t _this2.value = _this2.value || _this2.initial;\n\t _this2.cursorOffset = 0;\n\t _this2.cursor = _this2.rendered.length;\n\t yield _this2.validate();\n\n\t if (_this2.error) {\n\t _this2.red = true;\n\n\t _this2.fire();\n\n\t _this2.render();\n\n\t return;\n\t }\n\n\t _this2.done = true;\n\t _this2.aborted = false;\n\n\t _this2.fire();\n\n\t _this2.render();\n\n\t _this2.out.write('\\n');\n\n\t _this2.close();\n\t })();\n\t }\n\n\t next() {\n\t if (!this.placeholder) return this.bell();\n\t this.value = this.initial;\n\t this.cursor = this.rendered.length;\n\t this.fire();\n\t this.render();\n\t }\n\n\t moveCursor(n) {\n\t if (this.placeholder) return;\n\t this.cursor = this.cursor + n;\n\t this.cursorOffset += n;\n\t }\n\n\t _(c, key) {\n\t let s1 = this.value.slice(0, this.cursor);\n\t let s2 = this.value.slice(this.cursor);\n\t this.value = `${s1}${c}${s2}`;\n\t this.red = false;\n\t this.cursor = this.placeholder ? 0 : s1.length + 1;\n\t this.render();\n\t }\n\n\t delete() {\n\t if (this.isCursorAtStart()) return this.bell();\n\t let s1 = this.value.slice(0, this.cursor - 1);\n\t let s2 = this.value.slice(this.cursor);\n\t this.value = `${s1}${s2}`;\n\t this.red = false;\n\n\t if (this.isCursorAtStart()) {\n\t this.cursorOffset = 0;\n\t } else {\n\t this.cursorOffset++;\n\t this.moveCursor(-1);\n\t }\n\n\t this.render();\n\t }\n\n\t deleteForward() {\n\t if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();\n\t let s1 = this.value.slice(0, this.cursor);\n\t let s2 = this.value.slice(this.cursor + 1);\n\t this.value = `${s1}${s2}`;\n\t this.red = false;\n\n\t if (this.isCursorAtEnd()) {\n\t this.cursorOffset = 0;\n\t } else {\n\t this.cursorOffset++;\n\t }\n\n\t this.render();\n\t }\n\n\t first() {\n\t this.cursor = 0;\n\t this.render();\n\t }\n\n\t last() {\n\t this.cursor = this.value.length;\n\t this.render();\n\t }\n\n\t left() {\n\t if (this.cursor <= 0 || this.placeholder) return this.bell();\n\t this.moveCursor(-1);\n\t this.render();\n\t }\n\n\t right() {\n\t if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();\n\t this.moveCursor(1);\n\t this.render();\n\t }\n\n\t isCursorAtStart() {\n\t return this.cursor === 0 || this.placeholder && this.cursor === 1;\n\t }\n\n\t isCursorAtEnd() {\n\t return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;\n\t }\n\n\t render() {\n\t if (this.closed) return;\n\n\t if (!this.firstRender) {\n\t if (this.outputError) this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));\n\t this.out.write(clear(this.outputText, this.out.columns));\n\t }\n\n\t super.render();\n\t this.outputError = '';\n\t this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(` `);\n\n\t if (this.error) {\n\t this.outputError += this.errorMsg.split(`\\n`).reduce((a, l, i) => a + `\\n${i ? ' ' : figures.pointerSmall} ${color.red().italic(l)}`, ``);\n\t }\n\n\t this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0));\n\t }\n\n\t}\n\n\ttext$1 = TextPrompt;\n\treturn text$1;\n}\n\nvar select$1;\nvar hasRequiredSelect$1;\n\nfunction requireSelect$1 () {\n\tif (hasRequiredSelect$1) return select$1;\n\thasRequiredSelect$1 = 1;\n\n\tconst color = requireKleur();\n\n\tconst Prompt = requirePrompt$1();\n\n\tconst _require = requireUtil$1(),\n\t style = _require.style,\n\t clear = _require.clear,\n\t figures = _require.figures,\n\t wrap = _require.wrap,\n\t entriesToDisplay = _require.entriesToDisplay;\n\n\tconst _require2 = requireSrc(),\n\t cursor = _require2.cursor;\n\t/**\n\t * SelectPrompt Base Element\n\t * @param {Object} opts Options\n\t * @param {String} opts.message Message\n\t * @param {Array} opts.choices Array of choice objects\n\t * @param {String} [opts.hint] Hint to display\n\t * @param {Number} [opts.initial] Index of default value\n\t * @param {Stream} [opts.stdin] The Readable stream to listen to\n\t * @param {Stream} [opts.stdout] The Writable stream to write readline data to\n\t * @param {Number} [opts.optionsPerPage=10] Max options to display at once\n\t */\n\n\n\tclass SelectPrompt extends Prompt {\n\t constructor(opts = {}) {\n\t super(opts);\n\t this.msg = opts.message;\n\t this.hint = opts.hint || '- Use arrow-keys. Return to submit.';\n\t this.warn = opts.warn || '- This option is disabled';\n\t this.cursor = opts.initial || 0;\n\t this.choices = opts.choices.map((ch, idx) => {\n\t if (typeof ch === 'string') ch = {\n\t title: ch,\n\t value: idx\n\t };\n\t return {\n\t title: ch && (ch.title || ch.value || ch),\n\t value: ch && (ch.value === undefined ? idx : ch.value),\n\t description: ch && ch.description,\n\t selected: ch && ch.selected,\n\t disabled: ch && ch.disabled\n\t };\n\t });\n\t this.optionsPerPage = opts.optionsPerPage || 10;\n\t this.value = (this.choices[this.cursor] || {}).value;\n\t this.clear = clear('', this.out.columns);\n\t this.render();\n\t }\n\n\t moveCursor(n) {\n\t this.cursor = n;\n\t this.value = this.choices[n].value;\n\t this.fire();\n\t }\n\n\t reset() {\n\t this.moveCursor(0);\n\t this.fire();\n\t this.render();\n\t }\n\n\t exit() {\n\t this.abort();\n\t }\n\n\t abort() {\n\t this.done = this.aborted = true;\n\t this.fire();\n\t this.render();\n\t this.out.write('\\n');\n\t this.close();\n\t }\n\n\t submit() {\n\t if (!this.selection.disabled) {\n\t this.done = true;\n\t this.aborted = false;\n\t this.fire();\n\t this.render();\n\t this.out.write('\\n');\n\t this.close();\n\t } else this.bell();\n\t }\n\n\t first() {\n\t this.moveCursor(0);\n\t this.render();\n\t }\n\n\t last() {\n\t this.moveCursor(this.choices.length - 1);\n\t this.render();\n\t }\n\n\t up() {\n\t if (this.cursor === 0) {\n\t this.moveCursor(this.choices.length - 1);\n\t } else {\n\t this.moveCursor(this.cursor - 1);\n\t }\n\n\t this.render();\n\t }\n\n\t down() {\n\t if (this.cursor === this.choices.length - 1) {\n\t this.moveCursor(0);\n\t } else {\n\t this.moveCursor(this.cursor + 1);\n\t }\n\n\t this.render();\n\t }\n\n\t next() {\n\t this.moveCursor((this.cursor + 1) % this.choices.length);\n\t this.render();\n\t }\n\n\t _(c, key) {\n\t if (c === ' ') return this.submit();\n\t }\n\n\t get selection() {\n\t return this.choices[this.cursor];\n\t }\n\n\t render() {\n\t if (this.closed) return;\n\t if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText, this.out.columns));\n\t super.render();\n\n\t let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage),\n\t startIndex = _entriesToDisplay.startIndex,\n\t endIndex = _entriesToDisplay.endIndex; // Print prompt\n\n\n\t this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)].join(' '); // Print choices\n\n\t if (!this.done) {\n\t this.outputText += '\\n';\n\n\t for (let i = startIndex; i < endIndex; i++) {\n\t let title,\n\t prefix,\n\t desc = '',\n\t v = this.choices[i]; // Determine whether to display \"more choices\" indicators\n\n\t if (i === startIndex && startIndex > 0) {\n\t prefix = figures.arrowUp;\n\t } else if (i === endIndex - 1 && endIndex < this.choices.length) {\n\t prefix = figures.arrowDown;\n\t } else {\n\t prefix = ' ';\n\t }\n\n\t if (v.disabled) {\n\t title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);\n\t prefix = (this.cursor === i ? color.bold().gray(figures.pointer) + ' ' : ' ') + prefix;\n\t } else {\n\t title = this.cursor === i ? color.cyan().underline(v.title) : v.title;\n\t prefix = (this.cursor === i ? color.cyan(figures.pointer) + ' ' : ' ') + prefix;\n\n\t if (v.description && this.cursor === i) {\n\t desc = ` - ${v.description}`;\n\n\t if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\\r?\\n/).length > 1) {\n\t desc = '\\n' + wrap(v.description, {\n\t margin: 3,\n\t width: this.out.columns\n\t });\n\t }\n\t }\n\t }\n\n\t this.outputText += `${prefix} ${title}${color.gray(desc)}\\n`;\n\t }\n\t }\n\n\t this.out.write(this.outputText);\n\t }\n\n\t}\n\n\tselect$1 = SelectPrompt;\n\treturn select$1;\n}\n\nvar toggle$1;\nvar hasRequiredToggle$1;\n\nfunction requireToggle$1 () {\n\tif (hasRequiredToggle$1) return toggle$1;\n\thasRequiredToggle$1 = 1;\n\n\tconst color = requireKleur();\n\n\tconst Prompt = requirePrompt$1();\n\n\tconst _require = requireUtil$1(),\n\t style = _require.style,\n\t clear = _require.clear;\n\n\tconst _require2 = requireSrc(),\n\t cursor = _require2.cursor,\n\t erase = _require2.erase;\n\t/**\n\t * TogglePrompt Base Element\n\t * @param {Object} opts Options\n\t * @param {String} opts.message Message\n\t * @param {Boolean} [opts.initial=false] Default value\n\t * @param {String} [opts.active='no'] Active label\n\t * @param {String} [opts.inactive='off'] Inactive label\n\t * @param {Stream} [opts.stdin] The Readable stream to listen to\n\t * @param {Stream} [opts.stdout] The Writable stream to write readline data to\n\t */\n\n\n\tclass TogglePrompt extends Prompt {\n\t constructor(opts = {}) {\n\t super(opts);\n\t this.msg = opts.message;\n\t this.value = !!opts.initial;\n\t this.active = opts.active || 'on';\n\t this.inactive = opts.inactive || 'off';\n\t this.initialValue = this.value;\n\t this.render();\n\t }\n\n\t reset() {\n\t this.value = this.initialValue;\n\t this.fire();\n\t this.render();\n\t }\n\n\t exit() {\n\t this.abort();\n\t }\n\n\t abort() {\n\t this.done = this.aborted = true;\n\t this.fire();\n\t this.render();\n\t this.out.write('\\n');\n\t this.close();\n\t }\n\n\t submit() {\n\t this.done = true;\n\t this.aborted = false;\n\t this.fire();\n\t this.render();\n\t this.out.write('\\n');\n\t this.close();\n\t }\n\n\t deactivate() {\n\t if (this.value === false) return this.bell();\n\t this.value = false;\n\t this.render();\n\t }\n\n\t activate() {\n\t if (this.value === true) return this.bell();\n\t this.value = true;\n\t this.render();\n\t }\n\n\t delete() {\n\t this.deactivate();\n\t }\n\n\t left() {\n\t this.deactivate();\n\t }\n\n\t right() {\n\t this.activate();\n\t }\n\n\t down() {\n\t this.deactivate();\n\t }\n\n\t up() {\n\t this.activate();\n\t }\n\n\t next() {\n\t this.value = !this.value;\n\t this.fire();\n\t this.render();\n\t }\n\n\t _(c, key) {\n\t if (c === ' ') {\n\t this.value = !this.value;\n\t } else if (c === '1') {\n\t this.value = true;\n\t } else if (c === '0') {\n\t this.value = false;\n\t } else return this.bell();\n\n\t this.render();\n\t }\n\n\t render() {\n\t if (this.closed) return;\n\t if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText, this.out.columns));\n\t super.render();\n\t this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.value ? this.inactive : color.cyan().underline(this.inactive), color.gray('/'), this.value ? color.cyan().underline(this.active) : this.active].join(' ');\n\t this.out.write(erase.line + cursor.to(0) + this.outputText);\n\t }\n\n\t}\n\n\ttoggle$1 = TogglePrompt;\n\treturn toggle$1;\n}\n\nvar datepart$1;\nvar hasRequiredDatepart$1;\n\nfunction requireDatepart$1 () {\n\tif (hasRequiredDatepart$1) return datepart$1;\n\thasRequiredDatepart$1 = 1;\n\n\tclass DatePart {\n\t constructor({\n\t token,\n\t date,\n\t parts,\n\t locales\n\t }) {\n\t this.token = token;\n\t this.date = date || new Date();\n\t this.parts = parts || [this];\n\t this.locales = locales || {};\n\t }\n\n\t up() {}\n\n\t down() {}\n\n\t next() {\n\t const currentIdx = this.parts.indexOf(this);\n\t return this.parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);\n\t }\n\n\t setTo(val) {}\n\n\t prev() {\n\t let parts = [].concat(this.parts).reverse();\n\t const currentIdx = parts.indexOf(this);\n\t return parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);\n\t }\n\n\t toString() {\n\t return String(this.date);\n\t }\n\n\t}\n\n\tdatepart$1 = DatePart;\n\treturn datepart$1;\n}\n\nvar meridiem$1;\nvar hasRequiredMeridiem$1;\n\nfunction requireMeridiem$1 () {\n\tif (hasRequiredMeridiem$1) return meridiem$1;\n\thasRequiredMeridiem$1 = 1;\n\n\tconst DatePart = requireDatepart$1();\n\n\tclass Meridiem extends DatePart {\n\t constructor(opts = {}) {\n\t super(opts);\n\t }\n\n\t up() {\n\t this.date.setHours((this.date.getHours() + 12) % 24);\n\t }\n\n\t down() {\n\t this.up();\n\t }\n\n\t toString() {\n\t let meridiem = this.date.getHours() > 12 ? 'pm' : 'am';\n\t return /\\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;\n\t }\n\n\t}\n\n\tmeridiem$1 = Meridiem;\n\treturn meridiem$1;\n}\n\nvar day$1;\nvar hasRequiredDay$1;\n\nfunction requireDay$1 () {\n\tif (hasRequiredDay$1) return day$1;\n\thasRequiredDay$1 = 1;\n\n\tconst DatePart = requireDatepart$1();\n\n\tconst pos = n => {\n\t n = n % 10;\n\t return n === 1 ? 'st' : n === 2 ? 'nd' : n === 3 ? 'rd' : 'th';\n\t};\n\n\tclass Day extends DatePart {\n\t constructor(opts = {}) {\n\t super(opts);\n\t }\n\n\t up() {\n\t this.date.setDate(this.date.getDate() + 1);\n\t }\n\n\t down() {\n\t this.date.setDate(this.date.getDate() - 1);\n\t }\n\n\t setTo(val) {\n\t this.date.setDate(parseInt(val.substr(-2)));\n\t }\n\n\t toString() {\n\t let date = this.date.getDate();\n\t let day = this.date.getDay();\n\t return this.token === 'DD' ? String(date).padStart(2, '0') : this.token === 'Do' ? date + pos(date) : this.token === 'd' ? day + 1 : this.token === 'ddd' ? this.locales.weekdaysShort[day] : this.token === 'dddd' ? this.locales.weekdays[day] : date;\n\t }\n\n\t}\n\n\tday$1 = Day;\n\treturn day$1;\n}\n\nvar hours$1;\nvar hasRequiredHours$1;\n\nfunction requireHours$1 () {\n\tif (hasRequiredHours$1) return hours$1;\n\thasRequiredHours$1 = 1;\n\n\tconst DatePart = requireDatepart$1();\n\n\tclass Hours extends DatePart {\n\t constructor(opts = {}) {\n\t super(opts);\n\t }\n\n\t up() {\n\t this.date.setHours(this.date.getHours() + 1);\n\t }\n\n\t down() {\n\t this.date.setHours(this.date.getHours() - 1);\n\t }\n\n\t setTo(val) {\n\t this.date.setHours(parseInt(val.substr(-2)));\n\t }\n\n\t toString() {\n\t let hours = this.date.getHours();\n\t if (/h/.test(this.token)) hours = hours % 12 || 12;\n\t return this.token.length > 1 ? String(hours).padStart(2, '0') : hours;\n\t }\n\n\t}\n\n\thours$1 = Hours;\n\treturn hours$1;\n}\n\nvar milliseconds$1;\nvar hasRequiredMilliseconds$1;\n\nfunction requireMilliseconds$1 () {\n\tif (hasRequiredMilliseconds$1) return milliseconds$1;\n\thasRequiredMilliseconds$1 = 1;\n\n\tconst DatePart = requireDatepart$1();\n\n\tclass Milliseconds extends DatePart {\n\t constructor(opts = {}) {\n\t super(opts);\n\t }\n\n\t up() {\n\t this.date.setMilliseconds(this.date.getMilliseconds() + 1);\n\t }\n\n\t down() {\n\t this.date.setMilliseconds(this.date.getMilliseconds() - 1);\n\t }\n\n\t setTo(val) {\n\t this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));\n\t }\n\n\t toString() {\n\t return String(this.date.getMilliseconds()).padStart(4, '0').substr(0, this.token.length);\n\t }\n\n\t}\n\n\tmilliseconds$1 = Milliseconds;\n\treturn milliseconds$1;\n}\n\nvar minutes$1;\nvar hasRequiredMinutes$1;\n\nfunction requireMinutes$1 () {\n\tif (hasRequiredMinutes$1) return minutes$1;\n\thasRequiredMinutes$1 = 1;\n\n\tconst DatePart = requireDatepart$1();\n\n\tclass Minutes extends DatePart {\n\t constructor(opts = {}) {\n\t super(opts);\n\t }\n\n\t up() {\n\t this.date.setMinutes(this.date.getMinutes() + 1);\n\t }\n\n\t down() {\n\t this.date.setMinutes(this.date.getMinutes() - 1);\n\t }\n\n\t setTo(val) {\n\t this.date.setMinutes(parseInt(val.substr(-2)));\n\t }\n\n\t toString() {\n\t let m = this.date.getMinutes();\n\t return this.token.length > 1 ? String(m).padStart(2, '0') : m;\n\t }\n\n\t}\n\n\tminutes$1 = Minutes;\n\treturn minutes$1;\n}\n\nvar month$1;\nvar hasRequiredMonth$1;\n\nfunction requireMonth$1 () {\n\tif (hasRequiredMonth$1) return month$1;\n\thasRequiredMonth$1 = 1;\n\n\tconst DatePart = requireDatepart$1();\n\n\tclass Month extends DatePart {\n\t constructor(opts = {}) {\n\t super(opts);\n\t }\n\n\t up() {\n\t this.date.setMonth(this.date.getMonth() + 1);\n\t }\n\n\t down() {\n\t this.date.setMonth(this.date.getMonth() - 1);\n\t }\n\n\t setTo(val) {\n\t val = parseInt(val.substr(-2)) - 1;\n\t this.date.setMonth(val < 0 ? 0 : val);\n\t }\n\n\t toString() {\n\t let month = this.date.getMonth();\n\t let tl = this.token.length;\n\t return tl === 2 ? String(month + 1).padStart(2, '0') : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);\n\t }\n\n\t}\n\n\tmonth$1 = Month;\n\treturn month$1;\n}\n\nvar seconds$1;\nvar hasRequiredSeconds$1;\n\nfunction requireSeconds$1 () {\n\tif (hasRequiredSeconds$1) return seconds$1;\n\thasRequiredSeconds$1 = 1;\n\n\tconst DatePart = requireDatepart$1();\n\n\tclass Seconds extends DatePart {\n\t constructor(opts = {}) {\n\t super(opts);\n\t }\n\n\t up() {\n\t this.date.setSeconds(this.date.getSeconds() + 1);\n\t }\n\n\t down() {\n\t this.date.setSeconds(this.date.getSeconds() - 1);\n\t }\n\n\t setTo(val) {\n\t this.date.setSeconds(parseInt(val.substr(-2)));\n\t }\n\n\t toString() {\n\t let s = this.date.getSeconds();\n\t return this.token.length > 1 ? String(s).padStart(2, '0') : s;\n\t }\n\n\t}\n\n\tseconds$1 = Seconds;\n\treturn seconds$1;\n}\n\nvar year$1;\nvar hasRequiredYear$1;\n\nfunction requireYear$1 () {\n\tif (hasRequiredYear$1) return year$1;\n\thasRequiredYear$1 = 1;\n\n\tconst DatePart = requireDatepart$1();\n\n\tclass Year extends DatePart {\n\t constructor(opts = {}) {\n\t super(opts);\n\t }\n\n\t up() {\n\t this.date.setFullYear(this.date.getFullYear() + 1);\n\t }\n\n\t down() {\n\t this.date.setFullYear(this.date.getFullYear() - 1);\n\t }\n\n\t setTo(val) {\n\t this.date.setFullYear(val.substr(-4));\n\t }\n\n\t toString() {\n\t let year = String(this.date.getFullYear()).padStart(4, '0');\n\t return this.token.length === 2 ? year.substr(-2) : year;\n\t }\n\n\t}\n\n\tyear$1 = Year;\n\treturn year$1;\n}\n\nvar dateparts$1;\nvar hasRequiredDateparts$1;\n\nfunction requireDateparts$1 () {\n\tif (hasRequiredDateparts$1) return dateparts$1;\n\thasRequiredDateparts$1 = 1;\n\n\tdateparts$1 = {\n\t DatePart: requireDatepart$1(),\n\t Meridiem: requireMeridiem$1(),\n\t Day: requireDay$1(),\n\t Hours: requireHours$1(),\n\t Milliseconds: requireMilliseconds$1(),\n\t Minutes: requireMinutes$1(),\n\t Month: requireMonth$1(),\n\t Seconds: requireSeconds$1(),\n\t Year: requireYear$1()\n\t};\n\treturn dateparts$1;\n}\n\nvar date$1;\nvar hasRequiredDate$1;\n\nfunction requireDate$1 () {\n\tif (hasRequiredDate$1) return date$1;\n\thasRequiredDate$1 = 1;\n\n\tfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\n\tfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\tconst color = requireKleur();\n\n\tconst Prompt = requirePrompt$1();\n\n\tconst _require = requireUtil$1(),\n\t style = _require.style,\n\t clear = _require.clear,\n\t figures = _require.figures;\n\n\tconst _require2 = requireSrc(),\n\t erase = _require2.erase,\n\t cursor = _require2.cursor;\n\n\tconst _require3 = requireDateparts$1(),\n\t DatePart = _require3.DatePart,\n\t Meridiem = _require3.Meridiem,\n\t Day = _require3.Day,\n\t Hours = _require3.Hours,\n\t Milliseconds = _require3.Milliseconds,\n\t Minutes = _require3.Minutes,\n\t Month = _require3.Month,\n\t Seconds = _require3.Seconds,\n\t Year = _require3.Year;\n\n\tconst regex = /\\\\(.)|\"((?:\\\\[\"\\\\]|[^\"])+)\"|(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;\n\tconst regexGroups = {\n\t 1: ({\n\t token\n\t }) => token.replace(/\\\\(.)/g, '$1'),\n\t 2: opts => new Day(opts),\n\t // Day // TODO\n\t 3: opts => new Month(opts),\n\t // Month\n\t 4: opts => new Year(opts),\n\t // Year\n\t 5: opts => new Meridiem(opts),\n\t // AM/PM // TODO (special)\n\t 6: opts => new Hours(opts),\n\t // Hours\n\t 7: opts => new Minutes(opts),\n\t // Minutes\n\t 8: opts => new Seconds(opts),\n\t // Seconds\n\t 9: opts => new Milliseconds(opts) // Fractional seconds\n\n\t};\n\tconst dfltLocales = {\n\t months: 'January,February,March,April,May,June,July,August,September,October,November,December'.split(','),\n\t monthsShort: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),\n\t weekdays: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),\n\t weekdaysShort: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(',')\n\t};\n\t/**\n\t * DatePrompt Base Element\n\t * @param {Object} opts Options\n\t * @param {String} opts.message Message\n\t * @param {Number} [opts.initial] Index of default value\n\t * @param {String} [opts.mask] The format mask\n\t * @param {object} [opts.locales] The date locales\n\t * @param {String} [opts.error] The error message shown on invalid value\n\t * @param {Function} [opts.validate] Function to validate the submitted value\n\t * @param {Stream} [opts.stdin] The Readable stream to listen to\n\t * @param {Stream} [opts.stdout] The Writable stream to write readline data to\n\t */\n\n\tclass DatePrompt extends Prompt {\n\t constructor(opts = {}) {\n\t super(opts);\n\t this.msg = opts.message;\n\t this.cursor = 0;\n\t this.typed = '';\n\t this.locales = Object.assign(dfltLocales, opts.locales);\n\t this._date = opts.initial || new Date();\n\t this.errorMsg = opts.error || 'Please Enter A Valid Value';\n\n\t this.validator = opts.validate || (() => true);\n\n\t this.mask = opts.mask || 'YYYY-MM-DD HH:mm:ss';\n\t this.clear = clear('', this.out.columns);\n\t this.render();\n\t }\n\n\t get value() {\n\t return this.date;\n\t }\n\n\t get date() {\n\t return this._date;\n\t }\n\n\t set date(date) {\n\t if (date) this._date.setTime(date.getTime());\n\t }\n\n\t set mask(mask) {\n\t let result;\n\t this.parts = [];\n\n\t while (result = regex.exec(mask)) {\n\t let match = result.shift();\n\t let idx = result.findIndex(gr => gr != null);\n\t this.parts.push(idx in regexGroups ? regexGroups[idx]({\n\t token: result[idx] || match,\n\t date: this.date,\n\t parts: this.parts,\n\t locales: this.locales\n\t }) : result[idx] || match);\n\t }\n\n\t let parts = this.parts.reduce((arr, i) => {\n\t if (typeof i === 'string' && typeof arr[arr.length - 1] === 'string') arr[arr.length - 1] += i;else arr.push(i);\n\t return arr;\n\t }, []);\n\t this.parts.splice(0);\n\t this.parts.push(...parts);\n\t this.reset();\n\t }\n\n\t moveCursor(n) {\n\t this.typed = '';\n\t this.cursor = n;\n\t this.fire();\n\t }\n\n\t reset() {\n\t this.moveCursor(this.parts.findIndex(p => p instanceof DatePart));\n\t this.fire();\n\t this.render();\n\t }\n\n\t exit() {\n\t this.abort();\n\t }\n\n\t abort() {\n\t this.done = this.aborted = true;\n\t this.error = false;\n\t this.fire();\n\t this.render();\n\t this.out.write('\\n');\n\t this.close();\n\t }\n\n\t validate() {\n\t var _this = this;\n\n\t return _asyncToGenerator(function* () {\n\t let valid = yield _this.validator(_this.value);\n\n\t if (typeof valid === 'string') {\n\t _this.errorMsg = valid;\n\t valid = false;\n\t }\n\n\t _this.error = !valid;\n\t })();\n\t }\n\n\t submit() {\n\t var _this2 = this;\n\n\t return _asyncToGenerator(function* () {\n\t yield _this2.validate();\n\n\t if (_this2.error) {\n\t _this2.color = 'red';\n\n\t _this2.fire();\n\n\t _this2.render();\n\n\t return;\n\t }\n\n\t _this2.done = true;\n\t _this2.aborted = false;\n\n\t _this2.fire();\n\n\t _this2.render();\n\n\t _this2.out.write('\\n');\n\n\t _this2.close();\n\t })();\n\t }\n\n\t up() {\n\t this.typed = '';\n\t this.parts[this.cursor].up();\n\t this.render();\n\t }\n\n\t down() {\n\t this.typed = '';\n\t this.parts[this.cursor].down();\n\t this.render();\n\t }\n\n\t left() {\n\t let prev = this.parts[this.cursor].prev();\n\t if (prev == null) return this.bell();\n\t this.moveCursor(this.parts.indexOf(prev));\n\t this.render();\n\t }\n\n\t right() {\n\t let next = this.parts[this.cursor].next();\n\t if (next == null) return this.bell();\n\t this.moveCursor(this.parts.indexOf(next));\n\t this.render();\n\t }\n\n\t next() {\n\t let next = this.parts[this.cursor].next();\n\t this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex(part => part instanceof DatePart));\n\t this.render();\n\t }\n\n\t _(c) {\n\t if (/\\d/.test(c)) {\n\t this.typed += c;\n\t this.parts[this.cursor].setTo(this.typed);\n\t this.render();\n\t }\n\t }\n\n\t render() {\n\t if (this.closed) return;\n\t if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText, this.out.columns));\n\t super.render(); // Print prompt\n\n\t this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join('')].join(' '); // Print error\n\n\t if (this.error) {\n\t this.outputText += this.errorMsg.split('\\n').reduce((a, l, i) => a + `\\n${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);\n\t }\n\n\t this.out.write(erase.line + cursor.to(0) + this.outputText);\n\t }\n\n\t}\n\n\tdate$1 = DatePrompt;\n\treturn date$1;\n}\n\nvar number$1;\nvar hasRequiredNumber$1;\n\nfunction requireNumber$1 () {\n\tif (hasRequiredNumber$1) return number$1;\n\thasRequiredNumber$1 = 1;\n\n\tfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\n\tfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\tconst color = requireKleur();\n\n\tconst Prompt = requirePrompt$1();\n\n\tconst _require = requireSrc(),\n\t cursor = _require.cursor,\n\t erase = _require.erase;\n\n\tconst _require2 = requireUtil$1(),\n\t style = _require2.style,\n\t figures = _require2.figures,\n\t clear = _require2.clear,\n\t lines = _require2.