create-tamagui 1.30.21 → 1.30.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/constants.js +31 -0
  2. package/dist/constants.js.map +6 -0
  3. package/dist/helpers/asciiArts.js +1652 -0
  4. package/dist/helpers/asciiArts.js.map +6 -0
  5. package/dist/helpers/cloneStarter.js +19729 -0
  6. package/dist/helpers/cloneStarter.js.map +6 -0
  7. package/dist/helpers/getProjectName.js +6467 -0
  8. package/dist/helpers/getProjectName.js.map +6 -0
  9. package/dist/helpers/getShouldInstallDependencies.js +4696 -0
  10. package/dist/helpers/getShouldInstallDependencies.js.map +6 -0
  11. package/dist/helpers/getShouldUseGit.js +4696 -0
  12. package/dist/helpers/getShouldUseGit.js.map +6 -0
  13. package/dist/helpers/getTemplateInfo.js +6341 -0
  14. package/dist/helpers/getTemplateInfo.js.map +6 -0
  15. package/dist/helpers/installDependencies.js +16697 -0
  16. package/dist/helpers/installDependencies.js.map +6 -0
  17. package/dist/helpers/rainbowChalk.js +1603 -0
  18. package/dist/helpers/rainbowChalk.js.map +6 -0
  19. package/dist/helpers/validateNpmPackage.js +181 -0
  20. package/dist/helpers/validateNpmPackage.js.map +6 -0
  21. package/dist/index.js +30317 -39361
  22. package/dist/index.js.map +3 -3
  23. package/dist/steps/next-expo-solito.js +1614 -0
  24. package/dist/steps/next-expo-solito.js.map +6 -0
  25. package/dist/steps/simple-web.js +1603 -0
  26. package/dist/steps/simple-web.js.map +6 -0
  27. package/dist/steps/takeout.js +6346 -0
  28. package/dist/steps/takeout.js.map +6 -0
  29. package/dist/steps/types.js +19 -0
  30. package/dist/steps/types.js.map +6 -0
  31. package/dist/templates.js +1683 -0
  32. package/dist/templates.js.map +6 -0
  33. package/package.json +2 -2
@@ -0,0 +1,4696 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../node_modules/kleur/index.js
34
+ var require_kleur = __commonJS({
35
+ "../../node_modules/kleur/index.js"(exports, module2) {
36
+ "use strict";
37
+ var { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env;
38
+ var $ = {
39
+ enabled: !NODE_DISABLE_COLORS && TERM !== "dumb" && FORCE_COLOR !== "0",
40
+ // modifiers
41
+ reset: init(0, 0),
42
+ bold: init(1, 22),
43
+ dim: init(2, 22),
44
+ italic: init(3, 23),
45
+ underline: init(4, 24),
46
+ inverse: init(7, 27),
47
+ hidden: init(8, 28),
48
+ strikethrough: init(9, 29),
49
+ // colors
50
+ black: init(30, 39),
51
+ red: init(31, 39),
52
+ green: init(32, 39),
53
+ yellow: init(33, 39),
54
+ blue: init(34, 39),
55
+ magenta: init(35, 39),
56
+ cyan: init(36, 39),
57
+ white: init(37, 39),
58
+ gray: init(90, 39),
59
+ grey: init(90, 39),
60
+ // background colors
61
+ bgBlack: init(40, 49),
62
+ bgRed: init(41, 49),
63
+ bgGreen: init(42, 49),
64
+ bgYellow: init(43, 49),
65
+ bgBlue: init(44, 49),
66
+ bgMagenta: init(45, 49),
67
+ bgCyan: init(46, 49),
68
+ bgWhite: init(47, 49)
69
+ };
70
+ function run(arr, str) {
71
+ let i = 0, tmp, beg = "", end = "";
72
+ for (; i < arr.length; i++) {
73
+ tmp = arr[i];
74
+ beg += tmp.open;
75
+ end += tmp.close;
76
+ if (str.includes(tmp.close)) {
77
+ str = str.replace(tmp.rgx, tmp.close + tmp.open);
78
+ }
79
+ }
80
+ return beg + str + end;
81
+ }
82
+ function chain(has, keys) {
83
+ let ctx = { has, keys };
84
+ ctx.reset = $.reset.bind(ctx);
85
+ ctx.bold = $.bold.bind(ctx);
86
+ ctx.dim = $.dim.bind(ctx);
87
+ ctx.italic = $.italic.bind(ctx);
88
+ ctx.underline = $.underline.bind(ctx);
89
+ ctx.inverse = $.inverse.bind(ctx);
90
+ ctx.hidden = $.hidden.bind(ctx);
91
+ ctx.strikethrough = $.strikethrough.bind(ctx);
92
+ ctx.black = $.black.bind(ctx);
93
+ ctx.red = $.red.bind(ctx);
94
+ ctx.green = $.green.bind(ctx);
95
+ ctx.yellow = $.yellow.bind(ctx);
96
+ ctx.blue = $.blue.bind(ctx);
97
+ ctx.magenta = $.magenta.bind(ctx);
98
+ ctx.cyan = $.cyan.bind(ctx);
99
+ ctx.white = $.white.bind(ctx);
100
+ ctx.gray = $.gray.bind(ctx);
101
+ ctx.grey = $.grey.bind(ctx);
102
+ ctx.bgBlack = $.bgBlack.bind(ctx);
103
+ ctx.bgRed = $.bgRed.bind(ctx);
104
+ ctx.bgGreen = $.bgGreen.bind(ctx);
105
+ ctx.bgYellow = $.bgYellow.bind(ctx);
106
+ ctx.bgBlue = $.bgBlue.bind(ctx);
107
+ ctx.bgMagenta = $.bgMagenta.bind(ctx);
108
+ ctx.bgCyan = $.bgCyan.bind(ctx);
109
+ ctx.bgWhite = $.bgWhite.bind(ctx);
110
+ return ctx;
111
+ }
112
+ function init(open, close) {
113
+ let blk = {
114
+ open: `\x1B[${open}m`,
115
+ close: `\x1B[${close}m`,
116
+ rgx: new RegExp(`\\x1b\\[${close}m`, "g")
117
+ };
118
+ return function(txt) {
119
+ if (this !== void 0 && this.has !== void 0) {
120
+ this.has.includes(open) || (this.has.push(open), this.keys.push(blk));
121
+ return txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
122
+ }
123
+ return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
124
+ };
125
+ }
126
+ module2.exports = $;
127
+ }
128
+ });
129
+
130
+ // ../../node_modules/prompts/dist/util/action.js
131
+ var require_action = __commonJS({
132
+ "../../node_modules/prompts/dist/util/action.js"(exports, module2) {
133
+ "use strict";
134
+ module2.exports = (key) => {
135
+ if (key.ctrl) {
136
+ if (key.name === "a")
137
+ return "first";
138
+ if (key.name === "c")
139
+ return "abort";
140
+ if (key.name === "d")
141
+ return "abort";
142
+ if (key.name === "e")
143
+ return "last";
144
+ if (key.name === "g")
145
+ return "reset";
146
+ }
147
+ if (key.name === "return")
148
+ return "submit";
149
+ if (key.name === "enter")
150
+ return "submit";
151
+ if (key.name === "backspace")
152
+ return "delete";
153
+ if (key.name === "delete")
154
+ return "deleteForward";
155
+ if (key.name === "abort")
156
+ return "abort";
157
+ if (key.name === "escape")
158
+ return "abort";
159
+ if (key.name === "tab")
160
+ return "next";
161
+ if (key.name === "pagedown")
162
+ return "nextPage";
163
+ if (key.name === "pageup")
164
+ return "prevPage";
165
+ if (key.name === "up")
166
+ return "up";
167
+ if (key.name === "down")
168
+ return "down";
169
+ if (key.name === "right")
170
+ return "right";
171
+ if (key.name === "left")
172
+ return "left";
173
+ return false;
174
+ };
175
+ }
176
+ });
177
+
178
+ // ../../node_modules/prompts/dist/util/strip.js
179
+ var require_strip = __commonJS({
180
+ "../../node_modules/prompts/dist/util/strip.js"(exports, module2) {
181
+ "use strict";
182
+ module2.exports = (str) => {
183
+ const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");
184
+ const RGX = new RegExp(pattern, "g");
185
+ return typeof str === "string" ? str.replace(RGX, "") : str;
186
+ };
187
+ }
188
+ });
189
+
190
+ // ../../node_modules/sisteransi/src/index.js
191
+ var require_src = __commonJS({
192
+ "../../node_modules/sisteransi/src/index.js"(exports, module2) {
193
+ "use strict";
194
+ var ESC = "\x1B";
195
+ var CSI = `${ESC}[`;
196
+ var beep = "\x07";
197
+ var cursor = {
198
+ to(x, y) {
199
+ if (!y)
200
+ return `${CSI}${x + 1}G`;
201
+ return `${CSI}${y + 1};${x + 1}H`;
202
+ },
203
+ move(x, y) {
204
+ let ret = "";
205
+ if (x < 0)
206
+ ret += `${CSI}${-x}D`;
207
+ else if (x > 0)
208
+ ret += `${CSI}${x}C`;
209
+ if (y < 0)
210
+ ret += `${CSI}${-y}A`;
211
+ else if (y > 0)
212
+ ret += `${CSI}${y}B`;
213
+ return ret;
214
+ },
215
+ up: (count = 1) => `${CSI}${count}A`,
216
+ down: (count = 1) => `${CSI}${count}B`,
217
+ forward: (count = 1) => `${CSI}${count}C`,
218
+ backward: (count = 1) => `${CSI}${count}D`,
219
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
220
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
221
+ left: `${CSI}G`,
222
+ hide: `${CSI}?25l`,
223
+ show: `${CSI}?25h`,
224
+ save: `${ESC}7`,
225
+ restore: `${ESC}8`
226
+ };
227
+ var scroll = {
228
+ up: (count = 1) => `${CSI}S`.repeat(count),
229
+ down: (count = 1) => `${CSI}T`.repeat(count)
230
+ };
231
+ var erase = {
232
+ screen: `${CSI}2J`,
233
+ up: (count = 1) => `${CSI}1J`.repeat(count),
234
+ down: (count = 1) => `${CSI}J`.repeat(count),
235
+ line: `${CSI}2K`,
236
+ lineEnd: `${CSI}K`,
237
+ lineStart: `${CSI}1K`,
238
+ lines(count) {
239
+ let clear = "";
240
+ for (let i = 0; i < count; i++)
241
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
242
+ if (count)
243
+ clear += cursor.left;
244
+ return clear;
245
+ }
246
+ };
247
+ module2.exports = { cursor, scroll, erase, beep };
248
+ }
249
+ });
250
+
251
+ // ../../node_modules/prompts/dist/util/clear.js
252
+ var require_clear = __commonJS({
253
+ "../../node_modules/prompts/dist/util/clear.js"(exports, module2) {
254
+ "use strict";
255
+ var strip = require_strip();
256
+ var _require = require_src();
257
+ var erase = _require.erase;
258
+ var cursor = _require.cursor;
259
+ var width = (str) => [...strip(str)].length;
260
+ module2.exports = function(prompt, perLine = process.stdout.columns) {
261
+ if (!perLine)
262
+ return erase.line + cursor.to(0);
263
+ let rows = 0;
264
+ const lines = prompt.split(/\r?\n/);
265
+ var _iteratorNormalCompletion = true;
266
+ var _didIteratorError = false;
267
+ var _iteratorError = void 0;
268
+ try {
269
+ for (var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
270
+ let line = _step.value;
271
+ rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
272
+ }
273
+ } catch (err) {
274
+ _didIteratorError = true;
275
+ _iteratorError = err;
276
+ } finally {
277
+ try {
278
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
279
+ _iterator.return();
280
+ }
281
+ } finally {
282
+ if (_didIteratorError) {
283
+ throw _iteratorError;
284
+ }
285
+ }
286
+ }
287
+ return (erase.line + cursor.prevLine()).repeat(rows - 1) + erase.line + cursor.to(0);
288
+ };
289
+ }
290
+ });
291
+
292
+ // ../../node_modules/prompts/dist/util/figures.js
293
+ var require_figures = __commonJS({
294
+ "../../node_modules/prompts/dist/util/figures.js"(exports, module2) {
295
+ "use strict";
296
+ var main = {
297
+ arrowUp: "\u2191",
298
+ arrowDown: "\u2193",
299
+ arrowLeft: "\u2190",
300
+ arrowRight: "\u2192",
301
+ radioOn: "\u25C9",
302
+ radioOff: "\u25EF",
303
+ tick: "\u2714",
304
+ cross: "\u2716",
305
+ ellipsis: "\u2026",
306
+ pointerSmall: "\u203A",
307
+ line: "\u2500",
308
+ pointer: "\u276F"
309
+ };
310
+ var win = {
311
+ arrowUp: main.arrowUp,
312
+ arrowDown: main.arrowDown,
313
+ arrowLeft: main.arrowLeft,
314
+ arrowRight: main.arrowRight,
315
+ radioOn: "(*)",
316
+ radioOff: "( )",
317
+ tick: "\u221A",
318
+ cross: "\xD7",
319
+ ellipsis: "...",
320
+ pointerSmall: "\xBB",
321
+ line: "\u2500",
322
+ pointer: ">"
323
+ };
324
+ var figures = process.platform === "win32" ? win : main;
325
+ module2.exports = figures;
326
+ }
327
+ });
328
+
329
+ // ../../node_modules/prompts/dist/util/style.js
330
+ var require_style = __commonJS({
331
+ "../../node_modules/prompts/dist/util/style.js"(exports, module2) {
332
+ "use strict";
333
+ var c = require_kleur();
334
+ var figures = require_figures();
335
+ var styles = Object.freeze({
336
+ password: {
337
+ scale: 1,
338
+ render: (input) => "*".repeat(input.length)
339
+ },
340
+ emoji: {
341
+ scale: 2,
342
+ render: (input) => "\u{1F603}".repeat(input.length)
343
+ },
344
+ invisible: {
345
+ scale: 0,
346
+ render: (input) => ""
347
+ },
348
+ default: {
349
+ scale: 1,
350
+ render: (input) => `${input}`
351
+ }
352
+ });
353
+ var render = (type) => styles[type] || styles.default;
354
+ var symbols = Object.freeze({
355
+ aborted: c.red(figures.cross),
356
+ done: c.green(figures.tick),
357
+ default: c.cyan("?")
358
+ });
359
+ var symbol = (done, aborted) => aborted ? symbols.aborted : done ? symbols.done : symbols.default;
360
+ var delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
361
+ var item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
362
+ module2.exports = {
363
+ styles,
364
+ render,
365
+ symbols,
366
+ symbol,
367
+ delimiter,
368
+ item
369
+ };
370
+ }
371
+ });
372
+
373
+ // ../../node_modules/prompts/dist/util/index.js
374
+ var require_util = __commonJS({
375
+ "../../node_modules/prompts/dist/util/index.js"(exports, module2) {
376
+ "use strict";
377
+ module2.exports = {
378
+ action: require_action(),
379
+ clear: require_clear(),
380
+ style: require_style(),
381
+ strip: require_strip(),
382
+ figures: require_figures()
383
+ };
384
+ }
385
+ });
386
+
387
+ // ../../node_modules/prompts/dist/elements/prompt.js
388
+ var require_prompt = __commonJS({
389
+ "../../node_modules/prompts/dist/elements/prompt.js"(exports, module2) {
390
+ "use strict";
391
+ var readline = require("readline");
392
+ var _require = require_util();
393
+ var action = _require.action;
394
+ var EventEmitter = require("events");
395
+ var _require2 = require_src();
396
+ var beep = _require2.beep;
397
+ var cursor = _require2.cursor;
398
+ var color = require_kleur();
399
+ var Prompt = class extends EventEmitter {
400
+ constructor(opts = {}) {
401
+ super();
402
+ this.firstRender = true;
403
+ this.in = opts.in || process.stdin;
404
+ this.out = opts.out || process.stdout;
405
+ this.onRender = (opts.onRender || (() => void 0)).bind(this);
406
+ const rl = readline.createInterface(this.in);
407
+ readline.emitKeypressEvents(this.in, rl);
408
+ if (this.in.isTTY)
409
+ this.in.setRawMode(true);
410
+ const keypress = (str, key) => {
411
+ let a = action(key);
412
+ if (a === false) {
413
+ this._ && this._(str, key);
414
+ } else if (typeof this[a] === "function") {
415
+ this[a](key);
416
+ } else {
417
+ this.bell();
418
+ }
419
+ };
420
+ this.close = () => {
421
+ this.out.write(cursor.show);
422
+ this.in.removeListener("keypress", keypress);
423
+ if (this.in.isTTY)
424
+ this.in.setRawMode(false);
425
+ rl.close();
426
+ this.emit(this.aborted ? "abort" : "submit", this.value);
427
+ this.closed = true;
428
+ };
429
+ this.in.on("keypress", keypress);
430
+ }
431
+ fire() {
432
+ this.emit("state", {
433
+ value: this.value,
434
+ aborted: !!this.aborted
435
+ });
436
+ }
437
+ bell() {
438
+ this.out.write(beep);
439
+ }
440
+ render() {
441
+ this.onRender(color);
442
+ if (this.firstRender)
443
+ this.firstRender = false;
444
+ }
445
+ };
446
+ module2.exports = Prompt;
447
+ }
448
+ });
449
+
450
+ // ../../node_modules/prompts/dist/elements/text.js
451
+ var require_text = __commonJS({
452
+ "../../node_modules/prompts/dist/elements/text.js"(exports, module2) {
453
+ "use strict";
454
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
455
+ try {
456
+ var info = gen[key](arg);
457
+ var value = info.value;
458
+ } catch (error) {
459
+ reject(error);
460
+ return;
461
+ }
462
+ if (info.done) {
463
+ resolve(value);
464
+ } else {
465
+ Promise.resolve(value).then(_next, _throw);
466
+ }
467
+ }
468
+ function _asyncToGenerator(fn) {
469
+ return function() {
470
+ var self = this, args = arguments;
471
+ return new Promise(function(resolve, reject) {
472
+ var gen = fn.apply(self, args);
473
+ function _next(value) {
474
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
475
+ }
476
+ function _throw(err) {
477
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
478
+ }
479
+ _next(void 0);
480
+ });
481
+ };
482
+ }
483
+ var color = require_kleur();
484
+ var Prompt = require_prompt();
485
+ var _require = require_src();
486
+ var cursor = _require.cursor;
487
+ var _require2 = require_util();
488
+ var style = _require2.style;
489
+ var clear = _require2.clear;
490
+ var strip = _require2.strip;
491
+ var figures = _require2.figures;
492
+ var TextPrompt = class extends Prompt {
493
+ constructor(opts = {}) {
494
+ super(opts);
495
+ this.transform = style.render(opts.style);
496
+ this.scale = this.transform.scale;
497
+ this.msg = opts.message;
498
+ this.initial = opts.initial || ``;
499
+ this.validator = opts.validate || (() => true);
500
+ this.value = ``;
501
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
502
+ this.cursor = Number(!!this.initial);
503
+ this.clear = clear(``);
504
+ this.render();
505
+ }
506
+ set value(v) {
507
+ if (!v && this.initial) {
508
+ this.placeholder = true;
509
+ this.rendered = color.gray(this.transform.render(this.initial));
510
+ } else {
511
+ this.placeholder = false;
512
+ this.rendered = this.transform.render(v);
513
+ }
514
+ this._value = v;
515
+ this.fire();
516
+ }
517
+ get value() {
518
+ return this._value;
519
+ }
520
+ reset() {
521
+ this.value = ``;
522
+ this.cursor = Number(!!this.initial);
523
+ this.fire();
524
+ this.render();
525
+ }
526
+ abort() {
527
+ this.value = this.value || this.initial;
528
+ this.done = this.aborted = true;
529
+ this.error = false;
530
+ this.red = false;
531
+ this.fire();
532
+ this.render();
533
+ this.out.write("\n");
534
+ this.close();
535
+ }
536
+ validate() {
537
+ var _this = this;
538
+ return _asyncToGenerator(function* () {
539
+ let valid = yield _this.validator(_this.value);
540
+ if (typeof valid === `string`) {
541
+ _this.errorMsg = valid;
542
+ valid = false;
543
+ }
544
+ _this.error = !valid;
545
+ })();
546
+ }
547
+ submit() {
548
+ var _this2 = this;
549
+ return _asyncToGenerator(function* () {
550
+ _this2.value = _this2.value || _this2.initial;
551
+ yield _this2.validate();
552
+ if (_this2.error) {
553
+ _this2.red = true;
554
+ _this2.fire();
555
+ _this2.render();
556
+ return;
557
+ }
558
+ _this2.done = true;
559
+ _this2.aborted = false;
560
+ _this2.fire();
561
+ _this2.render();
562
+ _this2.out.write("\n");
563
+ _this2.close();
564
+ })();
565
+ }
566
+ next() {
567
+ if (!this.placeholder)
568
+ return this.bell();
569
+ this.value = this.initial;
570
+ this.cursor = this.rendered.length;
571
+ this.fire();
572
+ this.render();
573
+ }
574
+ moveCursor(n) {
575
+ if (this.placeholder)
576
+ return;
577
+ this.cursor = this.cursor + n;
578
+ }
579
+ _(c, key) {
580
+ let s1 = this.value.slice(0, this.cursor);
581
+ let s2 = this.value.slice(this.cursor);
582
+ this.value = `${s1}${c}${s2}`;
583
+ this.red = false;
584
+ this.cursor = this.placeholder ? 0 : s1.length + 1;
585
+ this.render();
586
+ }
587
+ delete() {
588
+ if (this.cursor === 0)
589
+ return this.bell();
590
+ let s1 = this.value.slice(0, this.cursor - 1);
591
+ let s2 = this.value.slice(this.cursor);
592
+ this.value = `${s1}${s2}`;
593
+ this.red = false;
594
+ this.moveCursor(-1);
595
+ this.render();
596
+ }
597
+ deleteForward() {
598
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
599
+ return this.bell();
600
+ let s1 = this.value.slice(0, this.cursor);
601
+ let s2 = this.value.slice(this.cursor + 1);
602
+ this.value = `${s1}${s2}`;
603
+ this.red = false;
604
+ this.render();
605
+ }
606
+ first() {
607
+ this.cursor = 0;
608
+ this.render();
609
+ }
610
+ last() {
611
+ this.cursor = this.value.length;
612
+ this.render();
613
+ }
614
+ left() {
615
+ if (this.cursor <= 0 || this.placeholder)
616
+ return this.bell();
617
+ this.moveCursor(-1);
618
+ this.render();
619
+ }
620
+ right() {
621
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
622
+ return this.bell();
623
+ this.moveCursor(1);
624
+ this.render();
625
+ }
626
+ render() {
627
+ if (this.closed)
628
+ return;
629
+ super.render();
630
+ let erase = (this.lines ? cursor.down(this.lines) : ``) + this.clear;
631
+ this.lines = 0;
632
+ let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(` `);
633
+ let error = ``;
634
+ if (this.error) {
635
+ let lines = this.errorMsg.split(`
636
+ `);
637
+ error += lines.reduce((a, l, i) => a += `
638
+ ${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, ``);
639
+ this.lines = lines.length;
640
+ }
641
+ let position = ``;
642
+ if (this.lines) {
643
+ position += cursor.up(this.lines);
644
+ position += cursor.left + cursor.to(strip(prompt).length);
645
+ }
646
+ position += cursor.move(this.placeholder ? -this.initial.length * this.scale : -this.rendered.length + this.cursor * this.scale);
647
+ this.out.write(erase + prompt + error + position);
648
+ this.clear = clear(prompt + error);
649
+ }
650
+ };
651
+ module2.exports = TextPrompt;
652
+ }
653
+ });
654
+
655
+ // ../../node_modules/prompts/dist/elements/select.js
656
+ var require_select = __commonJS({
657
+ "../../node_modules/prompts/dist/elements/select.js"(exports, module2) {
658
+ "use strict";
659
+ var color = require_kleur();
660
+ var Prompt = require_prompt();
661
+ var _require = require_util();
662
+ var style = _require.style;
663
+ var clear = _require.clear;
664
+ var figures = _require.figures;
665
+ var _require2 = require_src();
666
+ var erase = _require2.erase;
667
+ var cursor = _require2.cursor;
668
+ var SelectPrompt = class extends Prompt {
669
+ constructor(opts = {}) {
670
+ super(opts);
671
+ this.msg = opts.message;
672
+ this.hint = opts.hint || "- Use arrow-keys. Return to submit.";
673
+ this.warn = opts.warn || "- This option is disabled";
674
+ this.cursor = opts.initial || 0;
675
+ this.choices = opts.choices.map((ch, idx) => {
676
+ if (typeof ch === "string")
677
+ ch = {
678
+ title: ch,
679
+ value: idx
680
+ };
681
+ return {
682
+ title: ch && (ch.title || ch.value || ch),
683
+ value: ch && (ch.value || idx),
684
+ selected: ch && ch.selected,
685
+ disabled: ch && ch.disabled
686
+ };
687
+ });
688
+ this.value = (this.choices[this.cursor] || {}).value;
689
+ this.clear = clear("");
690
+ this.render();
691
+ }
692
+ moveCursor(n) {
693
+ this.cursor = n;
694
+ this.value = this.choices[n].value;
695
+ this.fire();
696
+ }
697
+ reset() {
698
+ this.moveCursor(0);
699
+ this.fire();
700
+ this.render();
701
+ }
702
+ abort() {
703
+ this.done = this.aborted = true;
704
+ this.fire();
705
+ this.render();
706
+ this.out.write("\n");
707
+ this.close();
708
+ }
709
+ submit() {
710
+ if (!this.selection.disabled) {
711
+ this.done = true;
712
+ this.aborted = false;
713
+ this.fire();
714
+ this.render();
715
+ this.out.write("\n");
716
+ this.close();
717
+ } else
718
+ this.bell();
719
+ }
720
+ first() {
721
+ this.moveCursor(0);
722
+ this.render();
723
+ }
724
+ last() {
725
+ this.moveCursor(this.choices.length - 1);
726
+ this.render();
727
+ }
728
+ up() {
729
+ if (this.cursor === 0)
730
+ return this.bell();
731
+ this.moveCursor(this.cursor - 1);
732
+ this.render();
733
+ }
734
+ down() {
735
+ if (this.cursor === this.choices.length - 1)
736
+ return this.bell();
737
+ this.moveCursor(this.cursor + 1);
738
+ this.render();
739
+ }
740
+ next() {
741
+ this.moveCursor((this.cursor + 1) % this.choices.length);
742
+ this.render();
743
+ }
744
+ _(c, key) {
745
+ if (c === " ")
746
+ return this.submit();
747
+ }
748
+ get selection() {
749
+ return this.choices[this.cursor];
750
+ }
751
+ render() {
752
+ if (this.closed)
753
+ return;
754
+ if (this.firstRender)
755
+ this.out.write(cursor.hide);
756
+ else
757
+ this.out.write(erase.lines(this.choices.length + 1));
758
+ super.render();
759
+ this.out.write([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(" "));
760
+ if (!this.done) {
761
+ this.out.write("\n" + this.choices.map((v, i) => {
762
+ let title, prefix;
763
+ if (v.disabled) {
764
+ title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
765
+ prefix = this.cursor === i ? color.bold().gray(figures.pointer) + " " : " ";
766
+ } else {
767
+ title = this.cursor === i ? color.cyan().underline(v.title) : v.title;
768
+ prefix = this.cursor === i ? color.cyan(figures.pointer) + " " : " ";
769
+ }
770
+ return `${prefix} ${title}`;
771
+ }).join("\n"));
772
+ }
773
+ }
774
+ };
775
+ module2.exports = SelectPrompt;
776
+ }
777
+ });
778
+
779
+ // ../../node_modules/prompts/dist/elements/toggle.js
780
+ var require_toggle = __commonJS({
781
+ "../../node_modules/prompts/dist/elements/toggle.js"(exports, module2) {
782
+ "use strict";
783
+ var color = require_kleur();
784
+ var Prompt = require_prompt();
785
+ var _require = require_util();
786
+ var style = _require.style;
787
+ var clear = _require.clear;
788
+ var _require2 = require_src();
789
+ var cursor = _require2.cursor;
790
+ var erase = _require2.erase;
791
+ var TogglePrompt = class extends Prompt {
792
+ constructor(opts = {}) {
793
+ super(opts);
794
+ this.msg = opts.message;
795
+ this.value = !!opts.initial;
796
+ this.active = opts.active || "on";
797
+ this.inactive = opts.inactive || "off";
798
+ this.initialValue = this.value;
799
+ this.render();
800
+ }
801
+ reset() {
802
+ this.value = this.initialValue;
803
+ this.fire();
804
+ this.render();
805
+ }
806
+ abort() {
807
+ this.done = this.aborted = true;
808
+ this.fire();
809
+ this.render();
810
+ this.out.write("\n");
811
+ this.close();
812
+ }
813
+ submit() {
814
+ this.done = true;
815
+ this.aborted = false;
816
+ this.fire();
817
+ this.render();
818
+ this.out.write("\n");
819
+ this.close();
820
+ }
821
+ deactivate() {
822
+ if (this.value === false)
823
+ return this.bell();
824
+ this.value = false;
825
+ this.render();
826
+ }
827
+ activate() {
828
+ if (this.value === true)
829
+ return this.bell();
830
+ this.value = true;
831
+ this.render();
832
+ }
833
+ delete() {
834
+ this.deactivate();
835
+ }
836
+ left() {
837
+ this.deactivate();
838
+ }
839
+ right() {
840
+ this.activate();
841
+ }
842
+ down() {
843
+ this.deactivate();
844
+ }
845
+ up() {
846
+ this.activate();
847
+ }
848
+ next() {
849
+ this.value = !this.value;
850
+ this.fire();
851
+ this.render();
852
+ }
853
+ _(c, key) {
854
+ if (c === " ") {
855
+ this.value = !this.value;
856
+ } else if (c === "1") {
857
+ this.value = true;
858
+ } else if (c === "0") {
859
+ this.value = false;
860
+ } else
861
+ return this.bell();
862
+ this.render();
863
+ }
864
+ render() {
865
+ if (this.closed)
866
+ return;
867
+ if (this.firstRender)
868
+ this.out.write(cursor.hide);
869
+ super.render();
870
+ this.out.write(erase.lines(this.first ? 1 : this.msg.split(/\n/g).length) + cursor.to(0) + [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(" "));
871
+ }
872
+ };
873
+ module2.exports = TogglePrompt;
874
+ }
875
+ });
876
+
877
+ // ../../node_modules/prompts/dist/dateparts/datepart.js
878
+ var require_datepart = __commonJS({
879
+ "../../node_modules/prompts/dist/dateparts/datepart.js"(exports, module2) {
880
+ "use strict";
881
+ var DatePart = class {
882
+ constructor({
883
+ token,
884
+ date,
885
+ parts,
886
+ locales
887
+ }) {
888
+ this.token = token;
889
+ this.date = date || /* @__PURE__ */ new Date();
890
+ this.parts = parts || [this];
891
+ this.locales = locales || {};
892
+ }
893
+ up() {
894
+ }
895
+ down() {
896
+ }
897
+ next() {
898
+ const currentIdx = this.parts.indexOf(this);
899
+ return this.parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
900
+ }
901
+ setTo(val) {
902
+ }
903
+ prev() {
904
+ let parts = [].concat(this.parts).reverse();
905
+ const currentIdx = parts.indexOf(this);
906
+ return parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
907
+ }
908
+ toString() {
909
+ return String(this.date);
910
+ }
911
+ };
912
+ module2.exports = DatePart;
913
+ }
914
+ });
915
+
916
+ // ../../node_modules/prompts/dist/dateparts/meridiem.js
917
+ var require_meridiem = __commonJS({
918
+ "../../node_modules/prompts/dist/dateparts/meridiem.js"(exports, module2) {
919
+ "use strict";
920
+ var DatePart = require_datepart();
921
+ var Meridiem = class extends DatePart {
922
+ constructor(opts = {}) {
923
+ super(opts);
924
+ }
925
+ up() {
926
+ this.date.setHours((this.date.getHours() + 12) % 24);
927
+ }
928
+ down() {
929
+ this.up();
930
+ }
931
+ toString() {
932
+ let meridiem = this.date.getHours() > 12 ? "pm" : "am";
933
+ return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
934
+ }
935
+ };
936
+ module2.exports = Meridiem;
937
+ }
938
+ });
939
+
940
+ // ../../node_modules/prompts/dist/dateparts/day.js
941
+ var require_day = __commonJS({
942
+ "../../node_modules/prompts/dist/dateparts/day.js"(exports, module2) {
943
+ "use strict";
944
+ var DatePart = require_datepart();
945
+ var pos = (n) => {
946
+ n = n % 10;
947
+ return n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th";
948
+ };
949
+ var Day = class extends DatePart {
950
+ constructor(opts = {}) {
951
+ super(opts);
952
+ }
953
+ up() {
954
+ this.date.setDate(this.date.getDate() + 1);
955
+ }
956
+ down() {
957
+ this.date.setDate(this.date.getDate() - 1);
958
+ }
959
+ setTo(val) {
960
+ this.date.setDate(parseInt(val.substr(-2)));
961
+ }
962
+ toString() {
963
+ let date = this.date.getDate();
964
+ let day = this.date.getDay();
965
+ 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;
966
+ }
967
+ };
968
+ module2.exports = Day;
969
+ }
970
+ });
971
+
972
+ // ../../node_modules/prompts/dist/dateparts/hours.js
973
+ var require_hours = __commonJS({
974
+ "../../node_modules/prompts/dist/dateparts/hours.js"(exports, module2) {
975
+ "use strict";
976
+ var DatePart = require_datepart();
977
+ var Hours = class extends DatePart {
978
+ constructor(opts = {}) {
979
+ super(opts);
980
+ }
981
+ up() {
982
+ this.date.setHours(this.date.getHours() + 1);
983
+ }
984
+ down() {
985
+ this.date.setHours(this.date.getHours() - 1);
986
+ }
987
+ setTo(val) {
988
+ this.date.setHours(parseInt(val.substr(-2)));
989
+ }
990
+ toString() {
991
+ let hours = this.date.getHours();
992
+ if (/h/.test(this.token))
993
+ hours = hours % 12 || 12;
994
+ return this.token.length > 1 ? String(hours).padStart(2, "0") : hours;
995
+ }
996
+ };
997
+ module2.exports = Hours;
998
+ }
999
+ });
1000
+
1001
+ // ../../node_modules/prompts/dist/dateparts/milliseconds.js
1002
+ var require_milliseconds = __commonJS({
1003
+ "../../node_modules/prompts/dist/dateparts/milliseconds.js"(exports, module2) {
1004
+ "use strict";
1005
+ var DatePart = require_datepart();
1006
+ var Milliseconds = class extends DatePart {
1007
+ constructor(opts = {}) {
1008
+ super(opts);
1009
+ }
1010
+ up() {
1011
+ this.date.setMilliseconds(this.date.getMilliseconds() + 1);
1012
+ }
1013
+ down() {
1014
+ this.date.setMilliseconds(this.date.getMilliseconds() - 1);
1015
+ }
1016
+ setTo(val) {
1017
+ this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));
1018
+ }
1019
+ toString() {
1020
+ return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
1021
+ }
1022
+ };
1023
+ module2.exports = Milliseconds;
1024
+ }
1025
+ });
1026
+
1027
+ // ../../node_modules/prompts/dist/dateparts/minutes.js
1028
+ var require_minutes = __commonJS({
1029
+ "../../node_modules/prompts/dist/dateparts/minutes.js"(exports, module2) {
1030
+ "use strict";
1031
+ var DatePart = require_datepart();
1032
+ var Minutes = class extends DatePart {
1033
+ constructor(opts = {}) {
1034
+ super(opts);
1035
+ }
1036
+ up() {
1037
+ this.date.setMinutes(this.date.getMinutes() + 1);
1038
+ }
1039
+ down() {
1040
+ this.date.setMinutes(this.date.getMinutes() - 1);
1041
+ }
1042
+ setTo(val) {
1043
+ this.date.setMinutes(parseInt(val.substr(-2)));
1044
+ }
1045
+ toString() {
1046
+ let m = this.date.getMinutes();
1047
+ return this.token.length > 1 ? String(m).padStart(2, "0") : m;
1048
+ }
1049
+ };
1050
+ module2.exports = Minutes;
1051
+ }
1052
+ });
1053
+
1054
+ // ../../node_modules/prompts/dist/dateparts/month.js
1055
+ var require_month = __commonJS({
1056
+ "../../node_modules/prompts/dist/dateparts/month.js"(exports, module2) {
1057
+ "use strict";
1058
+ var DatePart = require_datepart();
1059
+ var Month = class extends DatePart {
1060
+ constructor(opts = {}) {
1061
+ super(opts);
1062
+ }
1063
+ up() {
1064
+ this.date.setMonth(this.date.getMonth() + 1);
1065
+ }
1066
+ down() {
1067
+ this.date.setMonth(this.date.getMonth() - 1);
1068
+ }
1069
+ setTo(val) {
1070
+ val = parseInt(val.substr(-2)) - 1;
1071
+ this.date.setMonth(val < 0 ? 0 : val);
1072
+ }
1073
+ toString() {
1074
+ let month = this.date.getMonth();
1075
+ let tl = this.token.length;
1076
+ return tl === 2 ? String(month + 1).padStart(2, "0") : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
1077
+ }
1078
+ };
1079
+ module2.exports = Month;
1080
+ }
1081
+ });
1082
+
1083
+ // ../../node_modules/prompts/dist/dateparts/seconds.js
1084
+ var require_seconds = __commonJS({
1085
+ "../../node_modules/prompts/dist/dateparts/seconds.js"(exports, module2) {
1086
+ "use strict";
1087
+ var DatePart = require_datepart();
1088
+ var Seconds = class extends DatePart {
1089
+ constructor(opts = {}) {
1090
+ super(opts);
1091
+ }
1092
+ up() {
1093
+ this.date.setSeconds(this.date.getSeconds() + 1);
1094
+ }
1095
+ down() {
1096
+ this.date.setSeconds(this.date.getSeconds() - 1);
1097
+ }
1098
+ setTo(val) {
1099
+ this.date.setSeconds(parseInt(val.substr(-2)));
1100
+ }
1101
+ toString() {
1102
+ let s = this.date.getSeconds();
1103
+ return this.token.length > 1 ? String(s).padStart(2, "0") : s;
1104
+ }
1105
+ };
1106
+ module2.exports = Seconds;
1107
+ }
1108
+ });
1109
+
1110
+ // ../../node_modules/prompts/dist/dateparts/year.js
1111
+ var require_year = __commonJS({
1112
+ "../../node_modules/prompts/dist/dateparts/year.js"(exports, module2) {
1113
+ "use strict";
1114
+ var DatePart = require_datepart();
1115
+ var Year = class extends DatePart {
1116
+ constructor(opts = {}) {
1117
+ super(opts);
1118
+ }
1119
+ up() {
1120
+ this.date.setFullYear(this.date.getFullYear() + 1);
1121
+ }
1122
+ down() {
1123
+ this.date.setFullYear(this.date.getFullYear() - 1);
1124
+ }
1125
+ setTo(val) {
1126
+ this.date.setFullYear(val.substr(-4));
1127
+ }
1128
+ toString() {
1129
+ let year = String(this.date.getFullYear()).padStart(4, "0");
1130
+ return this.token.length === 2 ? year.substr(-2) : year;
1131
+ }
1132
+ };
1133
+ module2.exports = Year;
1134
+ }
1135
+ });
1136
+
1137
+ // ../../node_modules/prompts/dist/dateparts/index.js
1138
+ var require_dateparts = __commonJS({
1139
+ "../../node_modules/prompts/dist/dateparts/index.js"(exports, module2) {
1140
+ "use strict";
1141
+ module2.exports = {
1142
+ DatePart: require_datepart(),
1143
+ Meridiem: require_meridiem(),
1144
+ Day: require_day(),
1145
+ Hours: require_hours(),
1146
+ Milliseconds: require_milliseconds(),
1147
+ Minutes: require_minutes(),
1148
+ Month: require_month(),
1149
+ Seconds: require_seconds(),
1150
+ Year: require_year()
1151
+ };
1152
+ }
1153
+ });
1154
+
1155
+ // ../../node_modules/prompts/dist/elements/date.js
1156
+ var require_date = __commonJS({
1157
+ "../../node_modules/prompts/dist/elements/date.js"(exports, module2) {
1158
+ "use strict";
1159
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1160
+ try {
1161
+ var info = gen[key](arg);
1162
+ var value = info.value;
1163
+ } catch (error) {
1164
+ reject(error);
1165
+ return;
1166
+ }
1167
+ if (info.done) {
1168
+ resolve(value);
1169
+ } else {
1170
+ Promise.resolve(value).then(_next, _throw);
1171
+ }
1172
+ }
1173
+ function _asyncToGenerator(fn) {
1174
+ return function() {
1175
+ var self = this, args = arguments;
1176
+ return new Promise(function(resolve, reject) {
1177
+ var gen = fn.apply(self, args);
1178
+ function _next(value) {
1179
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1180
+ }
1181
+ function _throw(err) {
1182
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1183
+ }
1184
+ _next(void 0);
1185
+ });
1186
+ };
1187
+ }
1188
+ var color = require_kleur();
1189
+ var Prompt = require_prompt();
1190
+ var _require = require_util();
1191
+ var style = _require.style;
1192
+ var clear = _require.clear;
1193
+ var figures = _require.figures;
1194
+ var strip = _require.strip;
1195
+ var _require2 = require_src();
1196
+ var erase = _require2.erase;
1197
+ var cursor = _require2.cursor;
1198
+ var _require3 = require_dateparts();
1199
+ var DatePart = _require3.DatePart;
1200
+ var Meridiem = _require3.Meridiem;
1201
+ var Day = _require3.Day;
1202
+ var Hours = _require3.Hours;
1203
+ var Milliseconds = _require3.Milliseconds;
1204
+ var Minutes = _require3.Minutes;
1205
+ var Month = _require3.Month;
1206
+ var Seconds = _require3.Seconds;
1207
+ var Year = _require3.Year;
1208
+ var 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;
1209
+ var regexGroups = {
1210
+ 1: ({
1211
+ token
1212
+ }) => token.replace(/\\(.)/g, "$1"),
1213
+ 2: (opts) => new Day(opts),
1214
+ // Day // TODO
1215
+ 3: (opts) => new Month(opts),
1216
+ // Month
1217
+ 4: (opts) => new Year(opts),
1218
+ // Year
1219
+ 5: (opts) => new Meridiem(opts),
1220
+ // AM/PM // TODO (special)
1221
+ 6: (opts) => new Hours(opts),
1222
+ // Hours
1223
+ 7: (opts) => new Minutes(opts),
1224
+ // Minutes
1225
+ 8: (opts) => new Seconds(opts),
1226
+ // Seconds
1227
+ 9: (opts) => new Milliseconds(opts)
1228
+ // Fractional seconds
1229
+ };
1230
+ var dfltLocales = {
1231
+ months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
1232
+ monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
1233
+ weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
1234
+ weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
1235
+ /**
1236
+ * DatePrompt Base Element
1237
+ * @param {Object} opts Options
1238
+ * @param {String} opts.message Message
1239
+ * @param {Number} [opts.initial] Index of default value
1240
+ * @param {String} [opts.mask] The format mask
1241
+ * @param {object} [opts.locales] The date locales
1242
+ * @param {String} [opts.error] The error message shown on invalid value
1243
+ * @param {Function} [opts.validate] Function to validate the submitted value
1244
+ * @param {Stream} [opts.stdin] The Readable stream to listen to
1245
+ * @param {Stream} [opts.stdout] The Writable stream to write readline data to
1246
+ */
1247
+ };
1248
+ var DatePrompt = class extends Prompt {
1249
+ constructor(opts = {}) {
1250
+ super(opts);
1251
+ this.msg = opts.message;
1252
+ this.cursor = 0;
1253
+ this.typed = "";
1254
+ this.locales = Object.assign(dfltLocales, opts.locales);
1255
+ this._date = opts.initial || /* @__PURE__ */ new Date();
1256
+ this.errorMsg = opts.error || "Please Enter A Valid Value";
1257
+ this.validator = opts.validate || (() => true);
1258
+ this.mask = opts.mask || "YYYY-MM-DD HH:mm:ss";
1259
+ this.clear = clear("");
1260
+ this.render();
1261
+ }
1262
+ get value() {
1263
+ return this.date;
1264
+ }
1265
+ get date() {
1266
+ return this._date;
1267
+ }
1268
+ set date(date) {
1269
+ if (date)
1270
+ this._date.setTime(date.getTime());
1271
+ }
1272
+ set mask(mask) {
1273
+ let result;
1274
+ this.parts = [];
1275
+ while (result = regex.exec(mask)) {
1276
+ let match = result.shift();
1277
+ let idx = result.findIndex((gr) => gr != null);
1278
+ this.parts.push(idx in regexGroups ? regexGroups[idx]({
1279
+ token: result[idx] || match,
1280
+ date: this.date,
1281
+ parts: this.parts,
1282
+ locales: this.locales
1283
+ }) : result[idx] || match);
1284
+ }
1285
+ let parts = this.parts.reduce((arr, i) => {
1286
+ if (typeof i === "string" && typeof arr[arr.length - 1] === "string")
1287
+ arr[arr.length - 1] += i;
1288
+ else
1289
+ arr.push(i);
1290
+ return arr;
1291
+ }, []);
1292
+ this.parts.splice(0);
1293
+ this.parts.push(...parts);
1294
+ this.reset();
1295
+ }
1296
+ moveCursor(n) {
1297
+ this.typed = "";
1298
+ this.cursor = n;
1299
+ this.fire();
1300
+ }
1301
+ reset() {
1302
+ this.moveCursor(this.parts.findIndex((p) => p instanceof DatePart));
1303
+ this.fire();
1304
+ this.render();
1305
+ }
1306
+ abort() {
1307
+ this.done = this.aborted = true;
1308
+ this.error = false;
1309
+ this.fire();
1310
+ this.render();
1311
+ this.out.write("\n");
1312
+ this.close();
1313
+ }
1314
+ validate() {
1315
+ var _this = this;
1316
+ return _asyncToGenerator(function* () {
1317
+ let valid = yield _this.validator(_this.value);
1318
+ if (typeof valid === "string") {
1319
+ _this.errorMsg = valid;
1320
+ valid = false;
1321
+ }
1322
+ _this.error = !valid;
1323
+ })();
1324
+ }
1325
+ submit() {
1326
+ var _this2 = this;
1327
+ return _asyncToGenerator(function* () {
1328
+ yield _this2.validate();
1329
+ if (_this2.error) {
1330
+ _this2.color = "red";
1331
+ _this2.fire();
1332
+ _this2.render();
1333
+ return;
1334
+ }
1335
+ _this2.done = true;
1336
+ _this2.aborted = false;
1337
+ _this2.fire();
1338
+ _this2.render();
1339
+ _this2.out.write("\n");
1340
+ _this2.close();
1341
+ })();
1342
+ }
1343
+ up() {
1344
+ this.typed = "";
1345
+ this.parts[this.cursor].up();
1346
+ this.render();
1347
+ }
1348
+ down() {
1349
+ this.typed = "";
1350
+ this.parts[this.cursor].down();
1351
+ this.render();
1352
+ }
1353
+ left() {
1354
+ let prev = this.parts[this.cursor].prev();
1355
+ if (prev == null)
1356
+ return this.bell();
1357
+ this.moveCursor(this.parts.indexOf(prev));
1358
+ this.render();
1359
+ }
1360
+ right() {
1361
+ let next = this.parts[this.cursor].next();
1362
+ if (next == null)
1363
+ return this.bell();
1364
+ this.moveCursor(this.parts.indexOf(next));
1365
+ this.render();
1366
+ }
1367
+ next() {
1368
+ let next = this.parts[this.cursor].next();
1369
+ this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex((part) => part instanceof DatePart));
1370
+ this.render();
1371
+ }
1372
+ _(c) {
1373
+ if (/\d/.test(c)) {
1374
+ this.typed += c;
1375
+ this.parts[this.cursor].setTo(this.typed);
1376
+ this.render();
1377
+ }
1378
+ }
1379
+ render() {
1380
+ if (this.closed)
1381
+ return;
1382
+ if (this.firstRender)
1383
+ this.out.write(cursor.hide);
1384
+ else
1385
+ this.out.write(erase.lines(1));
1386
+ super.render();
1387
+ let clear2 = erase.line + (this.lines ? erase.down(this.lines) : "") + cursor.to(0);
1388
+ this.lines = 0;
1389
+ let error = "";
1390
+ if (this.error) {
1391
+ let lines = this.errorMsg.split("\n");
1392
+ error = lines.reduce((a, l, i) => a + `
1393
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
1394
+ this.lines = lines.length;
1395
+ }
1396
+ let prompt = [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(" ");
1397
+ let position = "";
1398
+ if (this.lines) {
1399
+ position += cursor.up(this.lines);
1400
+ position += cursor.left + cursor.to(strip(prompt).length);
1401
+ }
1402
+ this.out.write(clear2 + prompt + error + position);
1403
+ }
1404
+ };
1405
+ module2.exports = DatePrompt;
1406
+ }
1407
+ });
1408
+
1409
+ // ../../node_modules/prompts/dist/elements/number.js
1410
+ var require_number = __commonJS({
1411
+ "../../node_modules/prompts/dist/elements/number.js"(exports, module2) {
1412
+ "use strict";
1413
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1414
+ try {
1415
+ var info = gen[key](arg);
1416
+ var value = info.value;
1417
+ } catch (error) {
1418
+ reject(error);
1419
+ return;
1420
+ }
1421
+ if (info.done) {
1422
+ resolve(value);
1423
+ } else {
1424
+ Promise.resolve(value).then(_next, _throw);
1425
+ }
1426
+ }
1427
+ function _asyncToGenerator(fn) {
1428
+ return function() {
1429
+ var self = this, args = arguments;
1430
+ return new Promise(function(resolve, reject) {
1431
+ var gen = fn.apply(self, args);
1432
+ function _next(value) {
1433
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1434
+ }
1435
+ function _throw(err) {
1436
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1437
+ }
1438
+ _next(void 0);
1439
+ });
1440
+ };
1441
+ }
1442
+ var color = require_kleur();
1443
+ var Prompt = require_prompt();
1444
+ var _require = require_src();
1445
+ var cursor = _require.cursor;
1446
+ var erase = _require.erase;
1447
+ var _require2 = require_util();
1448
+ var style = _require2.style;
1449
+ var clear = _require2.clear;
1450
+ var figures = _require2.figures;
1451
+ var strip = _require2.strip;
1452
+ var isNumber = /[0-9]/;
1453
+ var isDef = (any) => any !== void 0;
1454
+ var round = (number, precision) => {
1455
+ let factor = Math.pow(10, precision);
1456
+ return Math.round(number * factor) / factor;
1457
+ };
1458
+ var NumberPrompt = class extends Prompt {
1459
+ constructor(opts = {}) {
1460
+ super(opts);
1461
+ this.transform = style.render(opts.style);
1462
+ this.msg = opts.message;
1463
+ this.initial = isDef(opts.initial) ? opts.initial : "";
1464
+ this.float = !!opts.float;
1465
+ this.round = opts.round || 2;
1466
+ this.inc = opts.increment || 1;
1467
+ this.min = isDef(opts.min) ? opts.min : -Infinity;
1468
+ this.max = isDef(opts.max) ? opts.max : Infinity;
1469
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
1470
+ this.validator = opts.validate || (() => true);
1471
+ this.color = `cyan`;
1472
+ this.value = ``;
1473
+ this.typed = ``;
1474
+ this.lastHit = 0;
1475
+ this.render();
1476
+ }
1477
+ set value(v) {
1478
+ if (!v && v !== 0) {
1479
+ this.placeholder = true;
1480
+ this.rendered = color.gray(this.transform.render(`${this.initial}`));
1481
+ this._value = ``;
1482
+ } else {
1483
+ this.placeholder = false;
1484
+ this.rendered = this.transform.render(`${round(v, this.round)}`);
1485
+ this._value = round(v, this.round);
1486
+ }
1487
+ this.fire();
1488
+ }
1489
+ get value() {
1490
+ return this._value;
1491
+ }
1492
+ parse(x) {
1493
+ return this.float ? parseFloat(x) : parseInt(x);
1494
+ }
1495
+ valid(c) {
1496
+ return c === `-` || c === `.` && this.float || isNumber.test(c);
1497
+ }
1498
+ reset() {
1499
+ this.typed = ``;
1500
+ this.value = ``;
1501
+ this.fire();
1502
+ this.render();
1503
+ }
1504
+ abort() {
1505
+ let x = this.value;
1506
+ this.value = x !== `` ? x : this.initial;
1507
+ this.done = this.aborted = true;
1508
+ this.error = false;
1509
+ this.fire();
1510
+ this.render();
1511
+ this.out.write(`
1512
+ `);
1513
+ this.close();
1514
+ }
1515
+ validate() {
1516
+ var _this = this;
1517
+ return _asyncToGenerator(function* () {
1518
+ let valid = yield _this.validator(_this.value);
1519
+ if (typeof valid === `string`) {
1520
+ _this.errorMsg = valid;
1521
+ valid = false;
1522
+ }
1523
+ _this.error = !valid;
1524
+ })();
1525
+ }
1526
+ submit() {
1527
+ var _this2 = this;
1528
+ return _asyncToGenerator(function* () {
1529
+ yield _this2.validate();
1530
+ if (_this2.error) {
1531
+ _this2.color = `red`;
1532
+ _this2.fire();
1533
+ _this2.render();
1534
+ return;
1535
+ }
1536
+ let x = _this2.value;
1537
+ _this2.value = x !== `` ? x : _this2.initial;
1538
+ _this2.done = true;
1539
+ _this2.aborted = false;
1540
+ _this2.error = false;
1541
+ _this2.fire();
1542
+ _this2.render();
1543
+ _this2.out.write(`
1544
+ `);
1545
+ _this2.close();
1546
+ })();
1547
+ }
1548
+ up() {
1549
+ this.typed = ``;
1550
+ if (this.value >= this.max)
1551
+ return this.bell();
1552
+ this.value += this.inc;
1553
+ this.color = `cyan`;
1554
+ this.fire();
1555
+ this.render();
1556
+ }
1557
+ down() {
1558
+ this.typed = ``;
1559
+ if (this.value <= this.min)
1560
+ return this.bell();
1561
+ this.value -= this.inc;
1562
+ this.color = `cyan`;
1563
+ this.fire();
1564
+ this.render();
1565
+ }
1566
+ delete() {
1567
+ let val = this.value.toString();
1568
+ if (val.length === 0)
1569
+ return this.bell();
1570
+ this.value = this.parse(val = val.slice(0, -1)) || ``;
1571
+ this.color = `cyan`;
1572
+ this.fire();
1573
+ this.render();
1574
+ }
1575
+ next() {
1576
+ this.value = this.initial;
1577
+ this.fire();
1578
+ this.render();
1579
+ }
1580
+ _(c, key) {
1581
+ if (!this.valid(c))
1582
+ return this.bell();
1583
+ const now = Date.now();
1584
+ if (now - this.lastHit > 1e3)
1585
+ this.typed = ``;
1586
+ this.typed += c;
1587
+ this.lastHit = now;
1588
+ this.color = `cyan`;
1589
+ if (c === `.`)
1590
+ return this.fire();
1591
+ this.value = Math.min(this.parse(this.typed), this.max);
1592
+ if (this.value > this.max)
1593
+ this.value = this.max;
1594
+ if (this.value < this.min)
1595
+ this.value = this.min;
1596
+ this.fire();
1597
+ this.render();
1598
+ }
1599
+ render() {
1600
+ if (this.closed)
1601
+ return;
1602
+ super.render();
1603
+ let clear2 = erase.line + (this.lines ? erase.down(this.lines) : ``) + cursor.to(0);
1604
+ this.lines = 0;
1605
+ let error = ``;
1606
+ if (this.error) {
1607
+ let lines = this.errorMsg.split(`
1608
+ `);
1609
+ error += lines.reduce((a, l, i) => a + `
1610
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
1611
+ this.lines = lines.length;
1612
+ }
1613
+ let underline = !this.done || !this.done && !this.placeholder;
1614
+ let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), underline ? color[this.color]().underline(this.rendered) : this.rendered].join(` `);
1615
+ let position = ``;
1616
+ if (this.lines) {
1617
+ position += cursor.up(this.lines);
1618
+ position += cursor.left + cursor.to(strip(prompt).length);
1619
+ }
1620
+ this.out.write(clear2 + prompt + error + position);
1621
+ }
1622
+ };
1623
+ module2.exports = NumberPrompt;
1624
+ }
1625
+ });
1626
+
1627
+ // ../../node_modules/prompts/dist/elements/multiselect.js
1628
+ var require_multiselect = __commonJS({
1629
+ "../../node_modules/prompts/dist/elements/multiselect.js"(exports, module2) {
1630
+ "use strict";
1631
+ var color = require_kleur();
1632
+ var _require = require_src();
1633
+ var cursor = _require.cursor;
1634
+ var Prompt = require_prompt();
1635
+ var _require2 = require_util();
1636
+ var clear = _require2.clear;
1637
+ var figures = _require2.figures;
1638
+ var style = _require2.style;
1639
+ var MultiselectPrompt = class extends Prompt {
1640
+ constructor(opts = {}) {
1641
+ super(opts);
1642
+ this.msg = opts.message;
1643
+ this.cursor = opts.cursor || 0;
1644
+ this.scrollIndex = opts.cursor || 0;
1645
+ this.hint = opts.hint || "";
1646
+ this.warn = opts.warn || "- This option is disabled -";
1647
+ this.minSelected = opts.min;
1648
+ this.showMinError = false;
1649
+ this.maxChoices = opts.max;
1650
+ this.value = opts.choices.map((ch, idx) => {
1651
+ if (typeof ch === "string")
1652
+ ch = {
1653
+ title: ch,
1654
+ value: idx
1655
+ };
1656
+ return {
1657
+ title: ch && (ch.title || ch.value || ch),
1658
+ value: ch && (ch.value || idx),
1659
+ selected: ch && ch.selected,
1660
+ disabled: ch && ch.disabled
1661
+ };
1662
+ });
1663
+ this.clear = clear("");
1664
+ if (!opts.overrideRender) {
1665
+ this.render();
1666
+ }
1667
+ }
1668
+ reset() {
1669
+ this.value.map((v) => !v.selected);
1670
+ this.cursor = 0;
1671
+ this.fire();
1672
+ this.render();
1673
+ }
1674
+ selected() {
1675
+ return this.value.filter((v) => v.selected);
1676
+ }
1677
+ abort() {
1678
+ this.done = this.aborted = true;
1679
+ this.fire();
1680
+ this.render();
1681
+ this.out.write("\n");
1682
+ this.close();
1683
+ }
1684
+ submit() {
1685
+ const selected = this.value.filter((e) => e.selected);
1686
+ if (this.minSelected && selected.length < this.minSelected) {
1687
+ this.showMinError = true;
1688
+ this.render();
1689
+ } else {
1690
+ this.done = true;
1691
+ this.aborted = false;
1692
+ this.fire();
1693
+ this.render();
1694
+ this.out.write("\n");
1695
+ this.close();
1696
+ }
1697
+ }
1698
+ first() {
1699
+ this.cursor = 0;
1700
+ this.render();
1701
+ }
1702
+ last() {
1703
+ this.cursor = this.value.length - 1;
1704
+ this.render();
1705
+ }
1706
+ next() {
1707
+ this.cursor = (this.cursor + 1) % this.value.length;
1708
+ this.render();
1709
+ }
1710
+ up() {
1711
+ if (this.cursor === 0) {
1712
+ this.cursor = this.value.length - 1;
1713
+ } else {
1714
+ this.cursor--;
1715
+ }
1716
+ this.render();
1717
+ }
1718
+ down() {
1719
+ if (this.cursor === this.value.length - 1) {
1720
+ this.cursor = 0;
1721
+ } else {
1722
+ this.cursor++;
1723
+ }
1724
+ this.render();
1725
+ }
1726
+ left() {
1727
+ this.value[this.cursor].selected = false;
1728
+ this.render();
1729
+ }
1730
+ right() {
1731
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices)
1732
+ return this.bell();
1733
+ this.value[this.cursor].selected = true;
1734
+ this.render();
1735
+ }
1736
+ handleSpaceToggle() {
1737
+ const v = this.value[this.cursor];
1738
+ if (v.selected) {
1739
+ v.selected = false;
1740
+ this.render();
1741
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
1742
+ return this.bell();
1743
+ } else {
1744
+ v.selected = true;
1745
+ this.render();
1746
+ }
1747
+ }
1748
+ _(c, key) {
1749
+ if (c === " ") {
1750
+ this.handleSpaceToggle();
1751
+ } else {
1752
+ return this.bell();
1753
+ }
1754
+ }
1755
+ renderInstructions() {
1756
+ return `
1757
+ Instructions:
1758
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
1759
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
1760
+ enter/return: Complete answer
1761
+ `;
1762
+ }
1763
+ renderOption(cursor2, v, i) {
1764
+ let title;
1765
+ if (v.disabled)
1766
+ title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
1767
+ else
1768
+ title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
1769
+ return (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
1770
+ }
1771
+ // shared with autocompleteMultiselect
1772
+ paginateOptions(options) {
1773
+ const c = this.cursor;
1774
+ let styledOptions = options.map((v, i) => this.renderOption(c, v, i));
1775
+ const numOfOptionsToRender = 10;
1776
+ let scopedOptions = styledOptions;
1777
+ let hint = "";
1778
+ if (styledOptions.length === 0) {
1779
+ return color.red("No matches for this query.");
1780
+ } else if (styledOptions.length > numOfOptionsToRender) {
1781
+ let startIndex = c - numOfOptionsToRender / 2;
1782
+ let endIndex = c + numOfOptionsToRender / 2;
1783
+ if (startIndex < 0) {
1784
+ startIndex = 0;
1785
+ endIndex = numOfOptionsToRender;
1786
+ } else if (endIndex > options.length) {
1787
+ endIndex = options.length;
1788
+ startIndex = endIndex - numOfOptionsToRender;
1789
+ }
1790
+ scopedOptions = styledOptions.slice(startIndex, endIndex);
1791
+ hint = color.dim("(Move up and down to reveal more choices)");
1792
+ }
1793
+ return "\n" + scopedOptions.join("\n") + "\n" + hint;
1794
+ }
1795
+ // shared with autocomleteMultiselect
1796
+ renderOptions(options) {
1797
+ if (!this.done) {
1798
+ return this.paginateOptions(options);
1799
+ }
1800
+ return "";
1801
+ }
1802
+ renderDoneOrInstructions() {
1803
+ if (this.done) {
1804
+ const selected = this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
1805
+ return selected;
1806
+ }
1807
+ const output = [color.gray(this.hint), this.renderInstructions()];
1808
+ if (this.value[this.cursor].disabled) {
1809
+ output.push(color.yellow(this.warn));
1810
+ }
1811
+ return output.join(" ");
1812
+ }
1813
+ render() {
1814
+ if (this.closed)
1815
+ return;
1816
+ if (this.firstRender)
1817
+ this.out.write(cursor.hide);
1818
+ super.render();
1819
+ let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.renderDoneOrInstructions()].join(" ");
1820
+ if (this.showMinError) {
1821
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
1822
+ this.showMinError = false;
1823
+ }
1824
+ prompt += this.renderOptions(this.value);
1825
+ this.out.write(this.clear + prompt);
1826
+ this.clear = clear(prompt);
1827
+ }
1828
+ };
1829
+ module2.exports = MultiselectPrompt;
1830
+ }
1831
+ });
1832
+
1833
+ // ../../node_modules/prompts/dist/elements/autocomplete.js
1834
+ var require_autocomplete = __commonJS({
1835
+ "../../node_modules/prompts/dist/elements/autocomplete.js"(exports, module2) {
1836
+ "use strict";
1837
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1838
+ try {
1839
+ var info = gen[key](arg);
1840
+ var value = info.value;
1841
+ } catch (error) {
1842
+ reject(error);
1843
+ return;
1844
+ }
1845
+ if (info.done) {
1846
+ resolve(value);
1847
+ } else {
1848
+ Promise.resolve(value).then(_next, _throw);
1849
+ }
1850
+ }
1851
+ function _asyncToGenerator(fn) {
1852
+ return function() {
1853
+ var self = this, args = arguments;
1854
+ return new Promise(function(resolve, reject) {
1855
+ var gen = fn.apply(self, args);
1856
+ function _next(value) {
1857
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1858
+ }
1859
+ function _throw(err) {
1860
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1861
+ }
1862
+ _next(void 0);
1863
+ });
1864
+ };
1865
+ }
1866
+ var color = require_kleur();
1867
+ var Prompt = require_prompt();
1868
+ var _require = require_src();
1869
+ var cursor = _require.cursor;
1870
+ var _require2 = require_util();
1871
+ var style = _require2.style;
1872
+ var clear = _require2.clear;
1873
+ var figures = _require2.figures;
1874
+ var strip = _require2.strip;
1875
+ var getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]);
1876
+ var getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]);
1877
+ var getIndex = (arr, valOrTitle) => {
1878
+ const index = arr.findIndex((el) => el.value === valOrTitle || el.title === valOrTitle);
1879
+ return index > -1 ? index : void 0;
1880
+ };
1881
+ var AutocompletePrompt = class extends Prompt {
1882
+ constructor(opts = {}) {
1883
+ super(opts);
1884
+ this.msg = opts.message;
1885
+ this.suggest = opts.suggest;
1886
+ this.choices = opts.choices;
1887
+ this.initial = typeof opts.initial === "number" ? opts.initial : getIndex(opts.choices, opts.initial);
1888
+ this.select = this.initial || opts.cursor || 0;
1889
+ this.fallback = opts.fallback || (opts.initial !== void 0 ? `${figures.pointerSmall} ${getTitle(this.choices, this.initial)}` : `${figures.pointerSmall} ${opts.noMatches || "no matches found"}`);
1890
+ this.suggestions = [[]];
1891
+ this.page = 0;
1892
+ this.input = "";
1893
+ this.limit = opts.limit || 10;
1894
+ this.cursor = 0;
1895
+ this.transform = style.render(opts.style);
1896
+ this.scale = this.transform.scale;
1897
+ this.render = this.render.bind(this);
1898
+ this.complete = this.complete.bind(this);
1899
+ this.clear = clear("");
1900
+ this.complete(this.render);
1901
+ this.render();
1902
+ }
1903
+ moveSelect(i) {
1904
+ this.select = i;
1905
+ if (this.suggestions[this.page].length > 0) {
1906
+ this.value = getVal(this.suggestions[this.page], i);
1907
+ } else {
1908
+ this.value = this.initial !== void 0 ? getVal(this.choices, this.initial) : null;
1909
+ }
1910
+ this.fire();
1911
+ }
1912
+ complete(cb) {
1913
+ var _this = this;
1914
+ return _asyncToGenerator(function* () {
1915
+ const p = _this.completing = _this.suggest(_this.input, _this.choices);
1916
+ const suggestions = yield p;
1917
+ if (_this.completing !== p)
1918
+ return;
1919
+ _this.suggestions = suggestions.map((s, i, arr) => ({
1920
+ title: getTitle(arr, i),
1921
+ value: getVal(arr, i)
1922
+ })).reduce((arr, sug) => {
1923
+ if (arr[arr.length - 1].length < _this.limit)
1924
+ arr[arr.length - 1].push(sug);
1925
+ else
1926
+ arr.push([sug]);
1927
+ return arr;
1928
+ }, [[]]);
1929
+ _this.isFallback = false;
1930
+ _this.completing = false;
1931
+ if (!_this.suggestions[_this.page])
1932
+ _this.page = 0;
1933
+ if (!_this.suggestions.length && _this.fallback) {
1934
+ const index = getIndex(_this.choices, _this.fallback);
1935
+ _this.suggestions = [[]];
1936
+ if (index !== void 0)
1937
+ _this.suggestions[0].push({
1938
+ title: getTitle(_this.choices, index),
1939
+ value: getVal(_this.choices, index)
1940
+ });
1941
+ _this.isFallback = true;
1942
+ }
1943
+ const l = Math.max(suggestions.length - 1, 0);
1944
+ _this.moveSelect(Math.min(l, _this.select));
1945
+ cb && cb();
1946
+ })();
1947
+ }
1948
+ reset() {
1949
+ this.input = "";
1950
+ this.complete(() => {
1951
+ this.moveSelect(this.initial !== void 0 ? this.initial : 0);
1952
+ this.render();
1953
+ });
1954
+ this.render();
1955
+ }
1956
+ abort() {
1957
+ this.done = this.aborted = true;
1958
+ this.fire();
1959
+ this.render();
1960
+ this.out.write("\n");
1961
+ this.close();
1962
+ }
1963
+ submit() {
1964
+ this.done = true;
1965
+ this.aborted = false;
1966
+ this.fire();
1967
+ this.render();
1968
+ this.out.write("\n");
1969
+ this.close();
1970
+ }
1971
+ _(c, key) {
1972
+ let s1 = this.input.slice(0, this.cursor);
1973
+ let s2 = this.input.slice(this.cursor);
1974
+ this.input = `${s1}${c}${s2}`;
1975
+ this.cursor = s1.length + 1;
1976
+ this.complete(this.render);
1977
+ this.render();
1978
+ }
1979
+ delete() {
1980
+ if (this.cursor === 0)
1981
+ return this.bell();
1982
+ let s1 = this.input.slice(0, this.cursor - 1);
1983
+ let s2 = this.input.slice(this.cursor);
1984
+ this.input = `${s1}${s2}`;
1985
+ this.complete(this.render);
1986
+ this.cursor = this.cursor - 1;
1987
+ this.render();
1988
+ }
1989
+ deleteForward() {
1990
+ if (this.cursor * this.scale >= this.rendered.length)
1991
+ return this.bell();
1992
+ let s1 = this.input.slice(0, this.cursor);
1993
+ let s2 = this.input.slice(this.cursor + 1);
1994
+ this.input = `${s1}${s2}`;
1995
+ this.complete(this.render);
1996
+ this.render();
1997
+ }
1998
+ first() {
1999
+ this.moveSelect(0);
2000
+ this.render();
2001
+ }
2002
+ last() {
2003
+ this.moveSelect(this.suggestions[this.page].length - 1);
2004
+ this.render();
2005
+ }
2006
+ up() {
2007
+ if (this.select <= 0)
2008
+ return this.bell();
2009
+ this.moveSelect(this.select - 1);
2010
+ this.render();
2011
+ }
2012
+ down() {
2013
+ if (this.select >= this.suggestions[this.page].length - 1)
2014
+ return this.bell();
2015
+ this.moveSelect(this.select + 1);
2016
+ this.render();
2017
+ }
2018
+ next() {
2019
+ if (this.select === this.suggestions[this.page].length - 1) {
2020
+ this.page = (this.page + 1) % this.suggestions.length;
2021
+ this.moveSelect(0);
2022
+ } else
2023
+ this.moveSelect(this.select + 1);
2024
+ this.render();
2025
+ }
2026
+ nextPage() {
2027
+ if (this.page >= this.suggestions.length - 1)
2028
+ return this.bell();
2029
+ this.page++;
2030
+ this.moveSelect(0);
2031
+ this.render();
2032
+ }
2033
+ prevPage() {
2034
+ if (this.page <= 0)
2035
+ return this.bell();
2036
+ this.page--;
2037
+ this.moveSelect(0);
2038
+ this.render();
2039
+ }
2040
+ left() {
2041
+ if (this.cursor <= 0)
2042
+ return this.bell();
2043
+ this.cursor = this.cursor - 1;
2044
+ this.render();
2045
+ }
2046
+ right() {
2047
+ if (this.cursor * this.scale >= this.rendered.length)
2048
+ return this.bell();
2049
+ this.cursor = this.cursor + 1;
2050
+ this.render();
2051
+ }
2052
+ render() {
2053
+ if (this.closed)
2054
+ return;
2055
+ super.render();
2056
+ if (this.lineCount)
2057
+ this.out.write(cursor.down(this.lineCount));
2058
+ let prompt = color.bold(`${style.symbol(this.done, this.aborted)} ${this.msg} `) + `${style.delimiter(this.completing)} `;
2059
+ let length = strip(prompt).length;
2060
+ if (this.done && this.suggestions[this.page][this.select]) {
2061
+ prompt += `${this.suggestions[this.page][this.select].title}`;
2062
+ } else {
2063
+ this.rendered = `${this.transform.render(this.input)}`;
2064
+ length += this.rendered.length;
2065
+ prompt += this.rendered;
2066
+ }
2067
+ if (!this.done) {
2068
+ this.lineCount = this.suggestions[this.page].length;
2069
+ let suggestions = this.suggestions[this.page].reduce((acc, item, i) => acc + `
2070
+ ${i === this.select ? color.cyan(item.title) : item.title}`, "");
2071
+ if (suggestions && !this.isFallback) {
2072
+ prompt += suggestions;
2073
+ if (this.suggestions.length > 1) {
2074
+ this.lineCount++;
2075
+ prompt += color.blue(`
2076
+ Page ${this.page + 1}/${this.suggestions.length}`);
2077
+ }
2078
+ } else {
2079
+ const fallbackIndex = getIndex(this.choices, this.fallback);
2080
+ const fallbackTitle = fallbackIndex !== void 0 ? getTitle(this.choices, fallbackIndex) : this.fallback;
2081
+ prompt += `
2082
+ ${color.gray(fallbackTitle)}`;
2083
+ this.lineCount++;
2084
+ }
2085
+ }
2086
+ this.out.write(this.clear + prompt);
2087
+ this.clear = clear(prompt);
2088
+ if (this.lineCount && !this.done) {
2089
+ let pos = cursor.up(this.lineCount);
2090
+ pos += cursor.left + cursor.to(length);
2091
+ pos += cursor.move(-this.rendered.length + this.cursor * this.scale);
2092
+ this.out.write(pos);
2093
+ }
2094
+ }
2095
+ };
2096
+ module2.exports = AutocompletePrompt;
2097
+ }
2098
+ });
2099
+
2100
+ // ../../node_modules/prompts/dist/elements/autocompleteMultiselect.js
2101
+ var require_autocompleteMultiselect = __commonJS({
2102
+ "../../node_modules/prompts/dist/elements/autocompleteMultiselect.js"(exports, module2) {
2103
+ "use strict";
2104
+ var color = require_kleur();
2105
+ var _require = require_src();
2106
+ var cursor = _require.cursor;
2107
+ var MultiselectPrompt = require_multiselect();
2108
+ var _require2 = require_util();
2109
+ var clear = _require2.clear;
2110
+ var style = _require2.style;
2111
+ var figures = _require2.figures;
2112
+ var AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
2113
+ constructor(opts = {}) {
2114
+ opts.overrideRender = true;
2115
+ super(opts);
2116
+ this.inputValue = "";
2117
+ this.clear = clear("");
2118
+ this.filteredOptions = this.value;
2119
+ this.render();
2120
+ }
2121
+ last() {
2122
+ this.cursor = this.filteredOptions.length - 1;
2123
+ this.render();
2124
+ }
2125
+ next() {
2126
+ this.cursor = (this.cursor + 1) % this.filteredOptions.length;
2127
+ this.render();
2128
+ }
2129
+ up() {
2130
+ if (this.cursor === 0) {
2131
+ this.cursor = this.filteredOptions.length - 1;
2132
+ } else {
2133
+ this.cursor--;
2134
+ }
2135
+ this.render();
2136
+ }
2137
+ down() {
2138
+ if (this.cursor === this.filteredOptions.length - 1) {
2139
+ this.cursor = 0;
2140
+ } else {
2141
+ this.cursor++;
2142
+ }
2143
+ this.render();
2144
+ }
2145
+ left() {
2146
+ this.filteredOptions[this.cursor].selected = false;
2147
+ this.render();
2148
+ }
2149
+ right() {
2150
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices)
2151
+ return this.bell();
2152
+ this.filteredOptions[this.cursor].selected = true;
2153
+ this.render();
2154
+ }
2155
+ delete() {
2156
+ if (this.inputValue.length) {
2157
+ this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1);
2158
+ this.updateFilteredOptions();
2159
+ }
2160
+ }
2161
+ updateFilteredOptions() {
2162
+ const currentHighlight = this.filteredOptions[this.cursor];
2163
+ this.filteredOptions = this.value.filter((v) => {
2164
+ if (this.inputValue) {
2165
+ if (typeof v.title === "string") {
2166
+ if (v.title.toLowerCase().includes(this.inputValue.toLowerCase())) {
2167
+ return true;
2168
+ }
2169
+ }
2170
+ if (typeof v.value === "string") {
2171
+ if (v.value.toLowerCase().includes(this.inputValue.toLowerCase())) {
2172
+ return true;
2173
+ }
2174
+ }
2175
+ return false;
2176
+ }
2177
+ return true;
2178
+ });
2179
+ const newHighlightIndex = this.filteredOptions.findIndex((v) => v === currentHighlight);
2180
+ this.cursor = newHighlightIndex < 0 ? 0 : newHighlightIndex;
2181
+ this.render();
2182
+ }
2183
+ handleSpaceToggle() {
2184
+ const v = this.filteredOptions[this.cursor];
2185
+ if (v.selected) {
2186
+ v.selected = false;
2187
+ this.render();
2188
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
2189
+ return this.bell();
2190
+ } else {
2191
+ v.selected = true;
2192
+ this.render();
2193
+ }
2194
+ }
2195
+ handleInputChange(c) {
2196
+ this.inputValue = this.inputValue + c;
2197
+ this.updateFilteredOptions();
2198
+ }
2199
+ _(c, key) {
2200
+ if (c === " ") {
2201
+ this.handleSpaceToggle();
2202
+ } else {
2203
+ this.handleInputChange(c);
2204
+ }
2205
+ }
2206
+ renderInstructions() {
2207
+ return `
2208
+ Instructions:
2209
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
2210
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
2211
+ [a,b,c]/delete: Filter choices
2212
+ enter/return: Complete answer
2213
+ `;
2214
+ }
2215
+ renderCurrentInput() {
2216
+ return `
2217
+ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
2218
+ `;
2219
+ }
2220
+ renderOption(cursor2, v, i) {
2221
+ let title;
2222
+ if (v.disabled)
2223
+ title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
2224
+ else
2225
+ title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
2226
+ return (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
2227
+ }
2228
+ renderDoneOrInstructions() {
2229
+ if (this.done) {
2230
+ const selected = this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
2231
+ return selected;
2232
+ }
2233
+ const output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
2234
+ if (this.filteredOptions.length && this.filteredOptions[this.cursor].disabled) {
2235
+ output.push(color.yellow(this.warn));
2236
+ }
2237
+ return output.join(" ");
2238
+ }
2239
+ render() {
2240
+ if (this.closed)
2241
+ return;
2242
+ if (this.firstRender)
2243
+ this.out.write(cursor.hide);
2244
+ super.render();
2245
+ let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.renderDoneOrInstructions()].join(" ");
2246
+ if (this.showMinError) {
2247
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
2248
+ this.showMinError = false;
2249
+ }
2250
+ prompt += this.renderOptions(this.filteredOptions);
2251
+ this.out.write(this.clear + prompt);
2252
+ this.clear = clear(prompt);
2253
+ }
2254
+ };
2255
+ module2.exports = AutocompleteMultiselectPrompt;
2256
+ }
2257
+ });
2258
+
2259
+ // ../../node_modules/prompts/dist/elements/confirm.js
2260
+ var require_confirm = __commonJS({
2261
+ "../../node_modules/prompts/dist/elements/confirm.js"(exports, module2) {
2262
+ "use strict";
2263
+ var color = require_kleur();
2264
+ var Prompt = require_prompt();
2265
+ var _require = require_util();
2266
+ var style = _require.style;
2267
+ var _require2 = require_src();
2268
+ var erase = _require2.erase;
2269
+ var cursor = _require2.cursor;
2270
+ var ConfirmPrompt = class extends Prompt {
2271
+ constructor(opts = {}) {
2272
+ super(opts);
2273
+ this.msg = opts.message;
2274
+ this.value = opts.initial;
2275
+ this.initialValue = !!opts.initial;
2276
+ this.yesMsg = opts.yes || "yes";
2277
+ this.yesOption = opts.yesOption || "(Y/n)";
2278
+ this.noMsg = opts.no || "no";
2279
+ this.noOption = opts.noOption || "(y/N)";
2280
+ this.render();
2281
+ }
2282
+ reset() {
2283
+ this.value = this.initialValue;
2284
+ this.fire();
2285
+ this.render();
2286
+ }
2287
+ abort() {
2288
+ this.done = this.aborted = true;
2289
+ this.fire();
2290
+ this.render();
2291
+ this.out.write("\n");
2292
+ this.close();
2293
+ }
2294
+ submit() {
2295
+ this.value = this.value || false;
2296
+ this.done = true;
2297
+ this.aborted = false;
2298
+ this.fire();
2299
+ this.render();
2300
+ this.out.write("\n");
2301
+ this.close();
2302
+ }
2303
+ _(c, key) {
2304
+ if (c.toLowerCase() === "y") {
2305
+ this.value = true;
2306
+ return this.submit();
2307
+ }
2308
+ if (c.toLowerCase() === "n") {
2309
+ this.value = false;
2310
+ return this.submit();
2311
+ }
2312
+ return this.bell();
2313
+ }
2314
+ render() {
2315
+ if (this.closed)
2316
+ return;
2317
+ if (this.firstRender)
2318
+ this.out.write(cursor.hide);
2319
+ super.render();
2320
+ this.out.write(erase.line + cursor.to(0) + [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)].join(" "));
2321
+ }
2322
+ };
2323
+ module2.exports = ConfirmPrompt;
2324
+ }
2325
+ });
2326
+
2327
+ // ../../node_modules/prompts/dist/elements/index.js
2328
+ var require_elements = __commonJS({
2329
+ "../../node_modules/prompts/dist/elements/index.js"(exports, module2) {
2330
+ "use strict";
2331
+ module2.exports = {
2332
+ TextPrompt: require_text(),
2333
+ SelectPrompt: require_select(),
2334
+ TogglePrompt: require_toggle(),
2335
+ DatePrompt: require_date(),
2336
+ NumberPrompt: require_number(),
2337
+ MultiselectPrompt: require_multiselect(),
2338
+ AutocompletePrompt: require_autocomplete(),
2339
+ AutocompleteMultiselectPrompt: require_autocompleteMultiselect(),
2340
+ ConfirmPrompt: require_confirm()
2341
+ };
2342
+ }
2343
+ });
2344
+
2345
+ // ../../node_modules/prompts/dist/prompts.js
2346
+ var require_prompts = __commonJS({
2347
+ "../../node_modules/prompts/dist/prompts.js"(exports) {
2348
+ "use strict";
2349
+ var $ = exports;
2350
+ var el = require_elements();
2351
+ var noop = (v) => v;
2352
+ function toPrompt(type, args, opts = {}) {
2353
+ return new Promise((res, rej) => {
2354
+ const p = new el[type](args);
2355
+ const onAbort = opts.onAbort || noop;
2356
+ const onSubmit = opts.onSubmit || noop;
2357
+ p.on("state", args.onState || noop);
2358
+ p.on("submit", (x) => res(onSubmit(x)));
2359
+ p.on("abort", (x) => rej(onAbort(x)));
2360
+ });
2361
+ }
2362
+ $.text = (args) => toPrompt("TextPrompt", args);
2363
+ $.password = (args) => {
2364
+ args.style = "password";
2365
+ return $.text(args);
2366
+ };
2367
+ $.invisible = (args) => {
2368
+ args.style = "invisible";
2369
+ return $.text(args);
2370
+ };
2371
+ $.number = (args) => toPrompt("NumberPrompt", args);
2372
+ $.date = (args) => toPrompt("DatePrompt", args);
2373
+ $.confirm = (args) => toPrompt("ConfirmPrompt", args);
2374
+ $.list = (args) => {
2375
+ const sep = args.separator || ",";
2376
+ return toPrompt("TextPrompt", args, {
2377
+ onSubmit: (str) => str.split(sep).map((s) => s.trim())
2378
+ });
2379
+ };
2380
+ $.toggle = (args) => toPrompt("TogglePrompt", args);
2381
+ $.select = (args) => toPrompt("SelectPrompt", args);
2382
+ $.multiselect = (args) => {
2383
+ args.choices = [].concat(args.choices || []);
2384
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
2385
+ return toPrompt("MultiselectPrompt", args, {
2386
+ onAbort: toSelected,
2387
+ onSubmit: toSelected
2388
+ });
2389
+ };
2390
+ $.autocompleteMultiselect = (args) => {
2391
+ args.choices = [].concat(args.choices || []);
2392
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
2393
+ return toPrompt("AutocompleteMultiselectPrompt", args, {
2394
+ onAbort: toSelected,
2395
+ onSubmit: toSelected
2396
+ });
2397
+ };
2398
+ var byTitle = (input, choices) => Promise.resolve(choices.filter((item) => item.title.slice(0, input.length).toLowerCase() === input.toLowerCase()));
2399
+ $.autocomplete = (args) => {
2400
+ args.suggest = args.suggest || byTitle;
2401
+ args.choices = [].concat(args.choices || []);
2402
+ return toPrompt("AutocompletePrompt", args);
2403
+ };
2404
+ }
2405
+ });
2406
+
2407
+ // ../../node_modules/prompts/dist/index.js
2408
+ var require_dist = __commonJS({
2409
+ "../../node_modules/prompts/dist/index.js"(exports, module2) {
2410
+ "use strict";
2411
+ function _objectSpread(target) {
2412
+ for (var i = 1; i < arguments.length; i++) {
2413
+ var source = arguments[i] != null ? arguments[i] : {};
2414
+ var ownKeys = Object.keys(source);
2415
+ if (typeof Object.getOwnPropertySymbols === "function") {
2416
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2417
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2418
+ }));
2419
+ }
2420
+ ownKeys.forEach(function(key) {
2421
+ _defineProperty(target, key, source[key]);
2422
+ });
2423
+ }
2424
+ return target;
2425
+ }
2426
+ function _defineProperty(obj, key, value) {
2427
+ if (key in obj) {
2428
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
2429
+ } else {
2430
+ obj[key] = value;
2431
+ }
2432
+ return obj;
2433
+ }
2434
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2435
+ try {
2436
+ var info = gen[key](arg);
2437
+ var value = info.value;
2438
+ } catch (error) {
2439
+ reject(error);
2440
+ return;
2441
+ }
2442
+ if (info.done) {
2443
+ resolve(value);
2444
+ } else {
2445
+ Promise.resolve(value).then(_next, _throw);
2446
+ }
2447
+ }
2448
+ function _asyncToGenerator(fn) {
2449
+ return function() {
2450
+ var self = this, args = arguments;
2451
+ return new Promise(function(resolve, reject) {
2452
+ var gen = fn.apply(self, args);
2453
+ function _next(value) {
2454
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
2455
+ }
2456
+ function _throw(err) {
2457
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
2458
+ }
2459
+ _next(void 0);
2460
+ });
2461
+ };
2462
+ }
2463
+ var prompts2 = require_prompts();
2464
+ var passOn = ["suggest", "format", "onState", "validate", "onRender"];
2465
+ var noop = () => {
2466
+ };
2467
+ function prompt() {
2468
+ return _prompt.apply(this, arguments);
2469
+ }
2470
+ function _prompt() {
2471
+ _prompt = _asyncToGenerator(function* (questions = [], {
2472
+ onSubmit = noop,
2473
+ onCancel = noop
2474
+ } = {}) {
2475
+ const answers = {};
2476
+ const override2 = prompt._override || {};
2477
+ questions = [].concat(questions);
2478
+ let answer, question, quit, name, type;
2479
+ const getFormattedAnswer = /* @__PURE__ */ function() {
2480
+ var _ref = _asyncToGenerator(function* (question2, answer2, skipValidation = false) {
2481
+ if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
2482
+ return;
2483
+ }
2484
+ return question2.format ? yield question2.format(answer2, answers) : answer2;
2485
+ });
2486
+ return function getFormattedAnswer2(_x, _x2) {
2487
+ return _ref.apply(this, arguments);
2488
+ };
2489
+ }();
2490
+ var _iteratorNormalCompletion = true;
2491
+ var _didIteratorError = false;
2492
+ var _iteratorError = void 0;
2493
+ try {
2494
+ for (var _iterator = questions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2495
+ question = _step.value;
2496
+ var _question = question;
2497
+ name = _question.name;
2498
+ type = _question.type;
2499
+ for (let key in question) {
2500
+ if (passOn.includes(key))
2501
+ continue;
2502
+ let value = question[key];
2503
+ question[key] = typeof value === "function" ? yield value(answer, _objectSpread({}, answers), question) : value;
2504
+ }
2505
+ if (typeof question.message !== "string") {
2506
+ throw new Error("prompt message is required");
2507
+ }
2508
+ var _question2 = question;
2509
+ name = _question2.name;
2510
+ type = _question2.type;
2511
+ if (!type)
2512
+ continue;
2513
+ if (prompts2[type] === void 0) {
2514
+ throw new Error(`prompt type (${type}) is not defined`);
2515
+ }
2516
+ if (override2[question.name] !== void 0) {
2517
+ answer = yield getFormattedAnswer(question, override2[question.name]);
2518
+ if (answer !== void 0) {
2519
+ answers[name] = answer;
2520
+ continue;
2521
+ }
2522
+ }
2523
+ try {
2524
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected) : yield prompts2[type](question);
2525
+ answers[name] = answer = yield getFormattedAnswer(question, answer, true);
2526
+ quit = yield onSubmit(question, answer, answers);
2527
+ } catch (err) {
2528
+ quit = !(yield onCancel(question, answers));
2529
+ }
2530
+ if (quit)
2531
+ return answers;
2532
+ }
2533
+ } catch (err) {
2534
+ _didIteratorError = true;
2535
+ _iteratorError = err;
2536
+ } finally {
2537
+ try {
2538
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2539
+ _iterator.return();
2540
+ }
2541
+ } finally {
2542
+ if (_didIteratorError) {
2543
+ throw _iteratorError;
2544
+ }
2545
+ }
2546
+ }
2547
+ return answers;
2548
+ });
2549
+ return _prompt.apply(this, arguments);
2550
+ }
2551
+ function getInjectedAnswer(injected) {
2552
+ const answer = injected.shift();
2553
+ if (answer instanceof Error) {
2554
+ throw answer;
2555
+ }
2556
+ return answer;
2557
+ }
2558
+ function inject(answers) {
2559
+ prompt._injected = (prompt._injected || []).concat(answers);
2560
+ }
2561
+ function override(answers) {
2562
+ prompt._override = Object.assign({}, answers);
2563
+ }
2564
+ module2.exports = Object.assign(prompt, {
2565
+ prompt,
2566
+ prompts: prompts2,
2567
+ inject,
2568
+ override
2569
+ });
2570
+ }
2571
+ });
2572
+
2573
+ // ../../node_modules/prompts/lib/util/action.js
2574
+ var require_action2 = __commonJS({
2575
+ "../../node_modules/prompts/lib/util/action.js"(exports, module2) {
2576
+ "use strict";
2577
+ module2.exports = (key) => {
2578
+ if (key.ctrl) {
2579
+ if (key.name === "a")
2580
+ return "first";
2581
+ if (key.name === "c")
2582
+ return "abort";
2583
+ if (key.name === "d")
2584
+ return "abort";
2585
+ if (key.name === "e")
2586
+ return "last";
2587
+ if (key.name === "g")
2588
+ return "reset";
2589
+ }
2590
+ if (key.name === "return")
2591
+ return "submit";
2592
+ if (key.name === "enter")
2593
+ return "submit";
2594
+ if (key.name === "backspace")
2595
+ return "delete";
2596
+ if (key.name === "delete")
2597
+ return "deleteForward";
2598
+ if (key.name === "abort")
2599
+ return "abort";
2600
+ if (key.name === "escape")
2601
+ return "abort";
2602
+ if (key.name === "tab")
2603
+ return "next";
2604
+ if (key.name === "pagedown")
2605
+ return "nextPage";
2606
+ if (key.name === "pageup")
2607
+ return "prevPage";
2608
+ if (key.name === "up")
2609
+ return "up";
2610
+ if (key.name === "down")
2611
+ return "down";
2612
+ if (key.name === "right")
2613
+ return "right";
2614
+ if (key.name === "left")
2615
+ return "left";
2616
+ return false;
2617
+ };
2618
+ }
2619
+ });
2620
+
2621
+ // ../../node_modules/prompts/lib/util/strip.js
2622
+ var require_strip2 = __commonJS({
2623
+ "../../node_modules/prompts/lib/util/strip.js"(exports, module2) {
2624
+ "use strict";
2625
+ module2.exports = (str) => {
2626
+ const pattern = [
2627
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)",
2628
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
2629
+ ].join("|");
2630
+ const RGX = new RegExp(pattern, "g");
2631
+ return typeof str === "string" ? str.replace(RGX, "") : str;
2632
+ };
2633
+ }
2634
+ });
2635
+
2636
+ // ../../node_modules/prompts/lib/util/clear.js
2637
+ var require_clear2 = __commonJS({
2638
+ "../../node_modules/prompts/lib/util/clear.js"(exports, module2) {
2639
+ "use strict";
2640
+ var strip = require_strip2();
2641
+ var { erase, cursor } = require_src();
2642
+ var width = (str) => [...strip(str)].length;
2643
+ module2.exports = function(prompt, perLine = process.stdout.columns) {
2644
+ if (!perLine)
2645
+ return erase.line + cursor.to(0);
2646
+ let rows = 0;
2647
+ const lines = prompt.split(/\r?\n/);
2648
+ for (let line of lines) {
2649
+ rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
2650
+ }
2651
+ return (erase.line + cursor.prevLine()).repeat(rows - 1) + erase.line + cursor.to(0);
2652
+ };
2653
+ }
2654
+ });
2655
+
2656
+ // ../../node_modules/prompts/lib/util/figures.js
2657
+ var require_figures2 = __commonJS({
2658
+ "../../node_modules/prompts/lib/util/figures.js"(exports, module2) {
2659
+ "use strict";
2660
+ var main = {
2661
+ arrowUp: "\u2191",
2662
+ arrowDown: "\u2193",
2663
+ arrowLeft: "\u2190",
2664
+ arrowRight: "\u2192",
2665
+ radioOn: "\u25C9",
2666
+ radioOff: "\u25EF",
2667
+ tick: "\u2714",
2668
+ cross: "\u2716",
2669
+ ellipsis: "\u2026",
2670
+ pointerSmall: "\u203A",
2671
+ line: "\u2500",
2672
+ pointer: "\u276F"
2673
+ };
2674
+ var win = {
2675
+ arrowUp: main.arrowUp,
2676
+ arrowDown: main.arrowDown,
2677
+ arrowLeft: main.arrowLeft,
2678
+ arrowRight: main.arrowRight,
2679
+ radioOn: "(*)",
2680
+ radioOff: "( )",
2681
+ tick: "\u221A",
2682
+ cross: "\xD7",
2683
+ ellipsis: "...",
2684
+ pointerSmall: "\xBB",
2685
+ line: "\u2500",
2686
+ pointer: ">"
2687
+ };
2688
+ var figures = process.platform === "win32" ? win : main;
2689
+ module2.exports = figures;
2690
+ }
2691
+ });
2692
+
2693
+ // ../../node_modules/prompts/lib/util/style.js
2694
+ var require_style2 = __commonJS({
2695
+ "../../node_modules/prompts/lib/util/style.js"(exports, module2) {
2696
+ "use strict";
2697
+ var c = require_kleur();
2698
+ var figures = require_figures2();
2699
+ var styles = Object.freeze({
2700
+ password: { scale: 1, render: (input) => "*".repeat(input.length) },
2701
+ emoji: { scale: 2, render: (input) => "\u{1F603}".repeat(input.length) },
2702
+ invisible: { scale: 0, render: (input) => "" },
2703
+ default: { scale: 1, render: (input) => `${input}` }
2704
+ });
2705
+ var render = (type) => styles[type] || styles.default;
2706
+ var symbols = Object.freeze({
2707
+ aborted: c.red(figures.cross),
2708
+ done: c.green(figures.tick),
2709
+ default: c.cyan("?")
2710
+ });
2711
+ var symbol = (done, aborted) => aborted ? symbols.aborted : done ? symbols.done : symbols.default;
2712
+ var delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
2713
+ var item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
2714
+ module2.exports = {
2715
+ styles,
2716
+ render,
2717
+ symbols,
2718
+ symbol,
2719
+ delimiter,
2720
+ item
2721
+ };
2722
+ }
2723
+ });
2724
+
2725
+ // ../../node_modules/prompts/lib/util/index.js
2726
+ var require_util2 = __commonJS({
2727
+ "../../node_modules/prompts/lib/util/index.js"(exports, module2) {
2728
+ "use strict";
2729
+ module2.exports = {
2730
+ action: require_action2(),
2731
+ clear: require_clear2(),
2732
+ style: require_style2(),
2733
+ strip: require_strip2(),
2734
+ figures: require_figures2()
2735
+ };
2736
+ }
2737
+ });
2738
+
2739
+ // ../../node_modules/prompts/lib/elements/prompt.js
2740
+ var require_prompt2 = __commonJS({
2741
+ "../../node_modules/prompts/lib/elements/prompt.js"(exports, module2) {
2742
+ "use strict";
2743
+ var readline = require("readline");
2744
+ var { action } = require_util2();
2745
+ var EventEmitter = require("events");
2746
+ var { beep, cursor } = require_src();
2747
+ var color = require_kleur();
2748
+ var Prompt = class extends EventEmitter {
2749
+ constructor(opts = {}) {
2750
+ super();
2751
+ this.firstRender = true;
2752
+ this.in = opts.in || process.stdin;
2753
+ this.out = opts.out || process.stdout;
2754
+ this.onRender = (opts.onRender || (() => void 0)).bind(this);
2755
+ const rl = readline.createInterface(this.in);
2756
+ readline.emitKeypressEvents(this.in, rl);
2757
+ if (this.in.isTTY)
2758
+ this.in.setRawMode(true);
2759
+ const keypress = (str, key) => {
2760
+ let a = action(key);
2761
+ if (a === false) {
2762
+ this._ && this._(str, key);
2763
+ } else if (typeof this[a] === "function") {
2764
+ this[a](key);
2765
+ } else {
2766
+ this.bell();
2767
+ }
2768
+ };
2769
+ this.close = () => {
2770
+ this.out.write(cursor.show);
2771
+ this.in.removeListener("keypress", keypress);
2772
+ if (this.in.isTTY)
2773
+ this.in.setRawMode(false);
2774
+ rl.close();
2775
+ this.emit(this.aborted ? "abort" : "submit", this.value);
2776
+ this.closed = true;
2777
+ };
2778
+ this.in.on("keypress", keypress);
2779
+ }
2780
+ fire() {
2781
+ this.emit("state", {
2782
+ value: this.value,
2783
+ aborted: !!this.aborted
2784
+ });
2785
+ }
2786
+ bell() {
2787
+ this.out.write(beep);
2788
+ }
2789
+ render() {
2790
+ this.onRender(color);
2791
+ if (this.firstRender)
2792
+ this.firstRender = false;
2793
+ }
2794
+ };
2795
+ module2.exports = Prompt;
2796
+ }
2797
+ });
2798
+
2799
+ // ../../node_modules/prompts/lib/elements/text.js
2800
+ var require_text2 = __commonJS({
2801
+ "../../node_modules/prompts/lib/elements/text.js"(exports, module2) {
2802
+ var color = require_kleur();
2803
+ var Prompt = require_prompt2();
2804
+ var { cursor } = require_src();
2805
+ var { style, clear, strip, figures } = require_util2();
2806
+ var TextPrompt = class extends Prompt {
2807
+ constructor(opts = {}) {
2808
+ super(opts);
2809
+ this.transform = style.render(opts.style);
2810
+ this.scale = this.transform.scale;
2811
+ this.msg = opts.message;
2812
+ this.initial = opts.initial || ``;
2813
+ this.validator = opts.validate || (() => true);
2814
+ this.value = ``;
2815
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
2816
+ this.cursor = Number(!!this.initial);
2817
+ this.clear = clear(``);
2818
+ this.render();
2819
+ }
2820
+ set value(v) {
2821
+ if (!v && this.initial) {
2822
+ this.placeholder = true;
2823
+ this.rendered = color.gray(this.transform.render(this.initial));
2824
+ } else {
2825
+ this.placeholder = false;
2826
+ this.rendered = this.transform.render(v);
2827
+ }
2828
+ this._value = v;
2829
+ this.fire();
2830
+ }
2831
+ get value() {
2832
+ return this._value;
2833
+ }
2834
+ reset() {
2835
+ this.value = ``;
2836
+ this.cursor = Number(!!this.initial);
2837
+ this.fire();
2838
+ this.render();
2839
+ }
2840
+ abort() {
2841
+ this.value = this.value || this.initial;
2842
+ this.done = this.aborted = true;
2843
+ this.error = false;
2844
+ this.red = false;
2845
+ this.fire();
2846
+ this.render();
2847
+ this.out.write("\n");
2848
+ this.close();
2849
+ }
2850
+ async validate() {
2851
+ let valid = await this.validator(this.value);
2852
+ if (typeof valid === `string`) {
2853
+ this.errorMsg = valid;
2854
+ valid = false;
2855
+ }
2856
+ this.error = !valid;
2857
+ }
2858
+ async submit() {
2859
+ this.value = this.value || this.initial;
2860
+ await this.validate();
2861
+ if (this.error) {
2862
+ this.red = true;
2863
+ this.fire();
2864
+ this.render();
2865
+ return;
2866
+ }
2867
+ this.done = true;
2868
+ this.aborted = false;
2869
+ this.fire();
2870
+ this.render();
2871
+ this.out.write("\n");
2872
+ this.close();
2873
+ }
2874
+ next() {
2875
+ if (!this.placeholder)
2876
+ return this.bell();
2877
+ this.value = this.initial;
2878
+ this.cursor = this.rendered.length;
2879
+ this.fire();
2880
+ this.render();
2881
+ }
2882
+ moveCursor(n) {
2883
+ if (this.placeholder)
2884
+ return;
2885
+ this.cursor = this.cursor + n;
2886
+ }
2887
+ _(c, key) {
2888
+ let s1 = this.value.slice(0, this.cursor);
2889
+ let s2 = this.value.slice(this.cursor);
2890
+ this.value = `${s1}${c}${s2}`;
2891
+ this.red = false;
2892
+ this.cursor = this.placeholder ? 0 : s1.length + 1;
2893
+ this.render();
2894
+ }
2895
+ delete() {
2896
+ if (this.cursor === 0)
2897
+ return this.bell();
2898
+ let s1 = this.value.slice(0, this.cursor - 1);
2899
+ let s2 = this.value.slice(this.cursor);
2900
+ this.value = `${s1}${s2}`;
2901
+ this.red = false;
2902
+ this.moveCursor(-1);
2903
+ this.render();
2904
+ }
2905
+ deleteForward() {
2906
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
2907
+ return this.bell();
2908
+ let s1 = this.value.slice(0, this.cursor);
2909
+ let s2 = this.value.slice(this.cursor + 1);
2910
+ this.value = `${s1}${s2}`;
2911
+ this.red = false;
2912
+ this.render();
2913
+ }
2914
+ first() {
2915
+ this.cursor = 0;
2916
+ this.render();
2917
+ }
2918
+ last() {
2919
+ this.cursor = this.value.length;
2920
+ this.render();
2921
+ }
2922
+ left() {
2923
+ if (this.cursor <= 0 || this.placeholder)
2924
+ return this.bell();
2925
+ this.moveCursor(-1);
2926
+ this.render();
2927
+ }
2928
+ right() {
2929
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
2930
+ return this.bell();
2931
+ this.moveCursor(1);
2932
+ this.render();
2933
+ }
2934
+ render() {
2935
+ if (this.closed)
2936
+ return;
2937
+ super.render();
2938
+ let erase = (this.lines ? cursor.down(this.lines) : ``) + this.clear;
2939
+ this.lines = 0;
2940
+ let prompt = [
2941
+ style.symbol(this.done, this.aborted),
2942
+ color.bold(this.msg),
2943
+ style.delimiter(this.done),
2944
+ this.red ? color.red(this.rendered) : this.rendered
2945
+ ].join(` `);
2946
+ let error = ``;
2947
+ if (this.error) {
2948
+ let lines = this.errorMsg.split(`
2949
+ `);
2950
+ error += lines.reduce((a, l, i) => a += `
2951
+ ${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, ``);
2952
+ this.lines = lines.length;
2953
+ }
2954
+ let position = ``;
2955
+ if (this.lines) {
2956
+ position += cursor.up(this.lines);
2957
+ position += cursor.left + cursor.to(strip(prompt).length);
2958
+ }
2959
+ position += cursor.move(
2960
+ this.placeholder ? -this.initial.length * this.scale : -this.rendered.length + this.cursor * this.scale
2961
+ );
2962
+ this.out.write(erase + prompt + error + position);
2963
+ this.clear = clear(prompt + error);
2964
+ }
2965
+ };
2966
+ module2.exports = TextPrompt;
2967
+ }
2968
+ });
2969
+
2970
+ // ../../node_modules/prompts/lib/elements/select.js
2971
+ var require_select2 = __commonJS({
2972
+ "../../node_modules/prompts/lib/elements/select.js"(exports, module2) {
2973
+ "use strict";
2974
+ var color = require_kleur();
2975
+ var Prompt = require_prompt2();
2976
+ var { style, clear, figures } = require_util2();
2977
+ var { erase, cursor } = require_src();
2978
+ var SelectPrompt = class extends Prompt {
2979
+ constructor(opts = {}) {
2980
+ super(opts);
2981
+ this.msg = opts.message;
2982
+ this.hint = opts.hint || "- Use arrow-keys. Return to submit.";
2983
+ this.warn = opts.warn || "- This option is disabled";
2984
+ this.cursor = opts.initial || 0;
2985
+ this.choices = opts.choices.map((ch, idx) => {
2986
+ if (typeof ch === "string")
2987
+ ch = { title: ch, value: idx };
2988
+ return {
2989
+ title: ch && (ch.title || ch.value || ch),
2990
+ value: ch && (ch.value || idx),
2991
+ selected: ch && ch.selected,
2992
+ disabled: ch && ch.disabled
2993
+ };
2994
+ });
2995
+ this.value = (this.choices[this.cursor] || {}).value;
2996
+ this.clear = clear("");
2997
+ this.render();
2998
+ }
2999
+ moveCursor(n) {
3000
+ this.cursor = n;
3001
+ this.value = this.choices[n].value;
3002
+ this.fire();
3003
+ }
3004
+ reset() {
3005
+ this.moveCursor(0);
3006
+ this.fire();
3007
+ this.render();
3008
+ }
3009
+ abort() {
3010
+ this.done = this.aborted = true;
3011
+ this.fire();
3012
+ this.render();
3013
+ this.out.write("\n");
3014
+ this.close();
3015
+ }
3016
+ submit() {
3017
+ if (!this.selection.disabled) {
3018
+ this.done = true;
3019
+ this.aborted = false;
3020
+ this.fire();
3021
+ this.render();
3022
+ this.out.write("\n");
3023
+ this.close();
3024
+ } else
3025
+ this.bell();
3026
+ }
3027
+ first() {
3028
+ this.moveCursor(0);
3029
+ this.render();
3030
+ }
3031
+ last() {
3032
+ this.moveCursor(this.choices.length - 1);
3033
+ this.render();
3034
+ }
3035
+ up() {
3036
+ if (this.cursor === 0)
3037
+ return this.bell();
3038
+ this.moveCursor(this.cursor - 1);
3039
+ this.render();
3040
+ }
3041
+ down() {
3042
+ if (this.cursor === this.choices.length - 1)
3043
+ return this.bell();
3044
+ this.moveCursor(this.cursor + 1);
3045
+ this.render();
3046
+ }
3047
+ next() {
3048
+ this.moveCursor((this.cursor + 1) % this.choices.length);
3049
+ this.render();
3050
+ }
3051
+ _(c, key) {
3052
+ if (c === " ")
3053
+ return this.submit();
3054
+ }
3055
+ get selection() {
3056
+ return this.choices[this.cursor];
3057
+ }
3058
+ render() {
3059
+ if (this.closed)
3060
+ return;
3061
+ if (this.firstRender)
3062
+ this.out.write(cursor.hide);
3063
+ else
3064
+ this.out.write(erase.lines(this.choices.length + 1));
3065
+ super.render();
3066
+ this.out.write([
3067
+ style.symbol(this.done, this.aborted),
3068
+ color.bold(this.msg),
3069
+ style.delimiter(false),
3070
+ this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
3071
+ ].join(" "));
3072
+ if (!this.done) {
3073
+ this.out.write(
3074
+ "\n" + this.choices.map((v, i) => {
3075
+ let title, prefix;
3076
+ if (v.disabled) {
3077
+ title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
3078
+ prefix = this.cursor === i ? color.bold().gray(figures.pointer) + " " : " ";
3079
+ } else {
3080
+ title = this.cursor === i ? color.cyan().underline(v.title) : v.title;
3081
+ prefix = this.cursor === i ? color.cyan(figures.pointer) + " " : " ";
3082
+ }
3083
+ return `${prefix} ${title}`;
3084
+ }).join("\n")
3085
+ );
3086
+ }
3087
+ }
3088
+ };
3089
+ module2.exports = SelectPrompt;
3090
+ }
3091
+ });
3092
+
3093
+ // ../../node_modules/prompts/lib/elements/toggle.js
3094
+ var require_toggle2 = __commonJS({
3095
+ "../../node_modules/prompts/lib/elements/toggle.js"(exports, module2) {
3096
+ var color = require_kleur();
3097
+ var Prompt = require_prompt2();
3098
+ var { style, clear } = require_util2();
3099
+ var { cursor, erase } = require_src();
3100
+ var TogglePrompt = class extends Prompt {
3101
+ constructor(opts = {}) {
3102
+ super(opts);
3103
+ this.msg = opts.message;
3104
+ this.value = !!opts.initial;
3105
+ this.active = opts.active || "on";
3106
+ this.inactive = opts.inactive || "off";
3107
+ this.initialValue = this.value;
3108
+ this.render();
3109
+ }
3110
+ reset() {
3111
+ this.value = this.initialValue;
3112
+ this.fire();
3113
+ this.render();
3114
+ }
3115
+ abort() {
3116
+ this.done = this.aborted = true;
3117
+ this.fire();
3118
+ this.render();
3119
+ this.out.write("\n");
3120
+ this.close();
3121
+ }
3122
+ submit() {
3123
+ this.done = true;
3124
+ this.aborted = false;
3125
+ this.fire();
3126
+ this.render();
3127
+ this.out.write("\n");
3128
+ this.close();
3129
+ }
3130
+ deactivate() {
3131
+ if (this.value === false)
3132
+ return this.bell();
3133
+ this.value = false;
3134
+ this.render();
3135
+ }
3136
+ activate() {
3137
+ if (this.value === true)
3138
+ return this.bell();
3139
+ this.value = true;
3140
+ this.render();
3141
+ }
3142
+ delete() {
3143
+ this.deactivate();
3144
+ }
3145
+ left() {
3146
+ this.deactivate();
3147
+ }
3148
+ right() {
3149
+ this.activate();
3150
+ }
3151
+ down() {
3152
+ this.deactivate();
3153
+ }
3154
+ up() {
3155
+ this.activate();
3156
+ }
3157
+ next() {
3158
+ this.value = !this.value;
3159
+ this.fire();
3160
+ this.render();
3161
+ }
3162
+ _(c, key) {
3163
+ if (c === " ") {
3164
+ this.value = !this.value;
3165
+ } else if (c === "1") {
3166
+ this.value = true;
3167
+ } else if (c === "0") {
3168
+ this.value = false;
3169
+ } else
3170
+ return this.bell();
3171
+ this.render();
3172
+ }
3173
+ render() {
3174
+ if (this.closed)
3175
+ return;
3176
+ if (this.firstRender)
3177
+ this.out.write(cursor.hide);
3178
+ super.render();
3179
+ this.out.write(
3180
+ erase.lines(this.first ? 1 : this.msg.split(/\n/g).length) + cursor.to(0) + [
3181
+ style.symbol(this.done, this.aborted),
3182
+ color.bold(this.msg),
3183
+ style.delimiter(this.done),
3184
+ this.value ? this.inactive : color.cyan().underline(this.inactive),
3185
+ color.gray("/"),
3186
+ this.value ? color.cyan().underline(this.active) : this.active
3187
+ ].join(" ")
3188
+ );
3189
+ }
3190
+ };
3191
+ module2.exports = TogglePrompt;
3192
+ }
3193
+ });
3194
+
3195
+ // ../../node_modules/prompts/lib/dateparts/datepart.js
3196
+ var require_datepart2 = __commonJS({
3197
+ "../../node_modules/prompts/lib/dateparts/datepart.js"(exports, module2) {
3198
+ "use strict";
3199
+ var DatePart = class {
3200
+ constructor({ token, date, parts, locales }) {
3201
+ this.token = token;
3202
+ this.date = date || /* @__PURE__ */ new Date();
3203
+ this.parts = parts || [this];
3204
+ this.locales = locales || {};
3205
+ }
3206
+ up() {
3207
+ }
3208
+ down() {
3209
+ }
3210
+ next() {
3211
+ const currentIdx = this.parts.indexOf(this);
3212
+ return this.parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
3213
+ }
3214
+ setTo(val) {
3215
+ }
3216
+ prev() {
3217
+ let parts = [].concat(this.parts).reverse();
3218
+ const currentIdx = parts.indexOf(this);
3219
+ return parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
3220
+ }
3221
+ toString() {
3222
+ return String(this.date);
3223
+ }
3224
+ };
3225
+ module2.exports = DatePart;
3226
+ }
3227
+ });
3228
+
3229
+ // ../../node_modules/prompts/lib/dateparts/meridiem.js
3230
+ var require_meridiem2 = __commonJS({
3231
+ "../../node_modules/prompts/lib/dateparts/meridiem.js"(exports, module2) {
3232
+ "use strict";
3233
+ var DatePart = require_datepart2();
3234
+ var Meridiem = class extends DatePart {
3235
+ constructor(opts = {}) {
3236
+ super(opts);
3237
+ }
3238
+ up() {
3239
+ this.date.setHours((this.date.getHours() + 12) % 24);
3240
+ }
3241
+ down() {
3242
+ this.up();
3243
+ }
3244
+ toString() {
3245
+ let meridiem = this.date.getHours() > 12 ? "pm" : "am";
3246
+ return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
3247
+ }
3248
+ };
3249
+ module2.exports = Meridiem;
3250
+ }
3251
+ });
3252
+
3253
+ // ../../node_modules/prompts/lib/dateparts/day.js
3254
+ var require_day2 = __commonJS({
3255
+ "../../node_modules/prompts/lib/dateparts/day.js"(exports, module2) {
3256
+ "use strict";
3257
+ var DatePart = require_datepart2();
3258
+ var pos = (n) => {
3259
+ n = n % 10;
3260
+ return n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th";
3261
+ };
3262
+ var Day = class extends DatePart {
3263
+ constructor(opts = {}) {
3264
+ super(opts);
3265
+ }
3266
+ up() {
3267
+ this.date.setDate(this.date.getDate() + 1);
3268
+ }
3269
+ down() {
3270
+ this.date.setDate(this.date.getDate() - 1);
3271
+ }
3272
+ setTo(val) {
3273
+ this.date.setDate(parseInt(val.substr(-2)));
3274
+ }
3275
+ toString() {
3276
+ let date = this.date.getDate();
3277
+ let day = this.date.getDay();
3278
+ 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;
3279
+ }
3280
+ };
3281
+ module2.exports = Day;
3282
+ }
3283
+ });
3284
+
3285
+ // ../../node_modules/prompts/lib/dateparts/hours.js
3286
+ var require_hours2 = __commonJS({
3287
+ "../../node_modules/prompts/lib/dateparts/hours.js"(exports, module2) {
3288
+ "use strict";
3289
+ var DatePart = require_datepart2();
3290
+ var Hours = class extends DatePart {
3291
+ constructor(opts = {}) {
3292
+ super(opts);
3293
+ }
3294
+ up() {
3295
+ this.date.setHours(this.date.getHours() + 1);
3296
+ }
3297
+ down() {
3298
+ this.date.setHours(this.date.getHours() - 1);
3299
+ }
3300
+ setTo(val) {
3301
+ this.date.setHours(parseInt(val.substr(-2)));
3302
+ }
3303
+ toString() {
3304
+ let hours = this.date.getHours();
3305
+ if (/h/.test(this.token))
3306
+ hours = hours % 12 || 12;
3307
+ return this.token.length > 1 ? String(hours).padStart(2, "0") : hours;
3308
+ }
3309
+ };
3310
+ module2.exports = Hours;
3311
+ }
3312
+ });
3313
+
3314
+ // ../../node_modules/prompts/lib/dateparts/milliseconds.js
3315
+ var require_milliseconds2 = __commonJS({
3316
+ "../../node_modules/prompts/lib/dateparts/milliseconds.js"(exports, module2) {
3317
+ "use strict";
3318
+ var DatePart = require_datepart2();
3319
+ var Milliseconds = class extends DatePart {
3320
+ constructor(opts = {}) {
3321
+ super(opts);
3322
+ }
3323
+ up() {
3324
+ this.date.setMilliseconds(this.date.getMilliseconds() + 1);
3325
+ }
3326
+ down() {
3327
+ this.date.setMilliseconds(this.date.getMilliseconds() - 1);
3328
+ }
3329
+ setTo(val) {
3330
+ this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));
3331
+ }
3332
+ toString() {
3333
+ return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
3334
+ }
3335
+ };
3336
+ module2.exports = Milliseconds;
3337
+ }
3338
+ });
3339
+
3340
+ // ../../node_modules/prompts/lib/dateparts/minutes.js
3341
+ var require_minutes2 = __commonJS({
3342
+ "../../node_modules/prompts/lib/dateparts/minutes.js"(exports, module2) {
3343
+ "use strict";
3344
+ var DatePart = require_datepart2();
3345
+ var Minutes = class extends DatePart {
3346
+ constructor(opts = {}) {
3347
+ super(opts);
3348
+ }
3349
+ up() {
3350
+ this.date.setMinutes(this.date.getMinutes() + 1);
3351
+ }
3352
+ down() {
3353
+ this.date.setMinutes(this.date.getMinutes() - 1);
3354
+ }
3355
+ setTo(val) {
3356
+ this.date.setMinutes(parseInt(val.substr(-2)));
3357
+ }
3358
+ toString() {
3359
+ let m = this.date.getMinutes();
3360
+ return this.token.length > 1 ? String(m).padStart(2, "0") : m;
3361
+ }
3362
+ };
3363
+ module2.exports = Minutes;
3364
+ }
3365
+ });
3366
+
3367
+ // ../../node_modules/prompts/lib/dateparts/month.js
3368
+ var require_month2 = __commonJS({
3369
+ "../../node_modules/prompts/lib/dateparts/month.js"(exports, module2) {
3370
+ "use strict";
3371
+ var DatePart = require_datepart2();
3372
+ var Month = class extends DatePart {
3373
+ constructor(opts = {}) {
3374
+ super(opts);
3375
+ }
3376
+ up() {
3377
+ this.date.setMonth(this.date.getMonth() + 1);
3378
+ }
3379
+ down() {
3380
+ this.date.setMonth(this.date.getMonth() - 1);
3381
+ }
3382
+ setTo(val) {
3383
+ val = parseInt(val.substr(-2)) - 1;
3384
+ this.date.setMonth(val < 0 ? 0 : val);
3385
+ }
3386
+ toString() {
3387
+ let month = this.date.getMonth();
3388
+ let tl = this.token.length;
3389
+ return tl === 2 ? String(month + 1).padStart(2, "0") : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
3390
+ }
3391
+ };
3392
+ module2.exports = Month;
3393
+ }
3394
+ });
3395
+
3396
+ // ../../node_modules/prompts/lib/dateparts/seconds.js
3397
+ var require_seconds2 = __commonJS({
3398
+ "../../node_modules/prompts/lib/dateparts/seconds.js"(exports, module2) {
3399
+ "use strict";
3400
+ var DatePart = require_datepart2();
3401
+ var Seconds = class extends DatePart {
3402
+ constructor(opts = {}) {
3403
+ super(opts);
3404
+ }
3405
+ up() {
3406
+ this.date.setSeconds(this.date.getSeconds() + 1);
3407
+ }
3408
+ down() {
3409
+ this.date.setSeconds(this.date.getSeconds() - 1);
3410
+ }
3411
+ setTo(val) {
3412
+ this.date.setSeconds(parseInt(val.substr(-2)));
3413
+ }
3414
+ toString() {
3415
+ let s = this.date.getSeconds();
3416
+ return this.token.length > 1 ? String(s).padStart(2, "0") : s;
3417
+ }
3418
+ };
3419
+ module2.exports = Seconds;
3420
+ }
3421
+ });
3422
+
3423
+ // ../../node_modules/prompts/lib/dateparts/year.js
3424
+ var require_year2 = __commonJS({
3425
+ "../../node_modules/prompts/lib/dateparts/year.js"(exports, module2) {
3426
+ "use strict";
3427
+ var DatePart = require_datepart2();
3428
+ var Year = class extends DatePart {
3429
+ constructor(opts = {}) {
3430
+ super(opts);
3431
+ }
3432
+ up() {
3433
+ this.date.setFullYear(this.date.getFullYear() + 1);
3434
+ }
3435
+ down() {
3436
+ this.date.setFullYear(this.date.getFullYear() - 1);
3437
+ }
3438
+ setTo(val) {
3439
+ this.date.setFullYear(val.substr(-4));
3440
+ }
3441
+ toString() {
3442
+ let year = String(this.date.getFullYear()).padStart(4, "0");
3443
+ return this.token.length === 2 ? year.substr(-2) : year;
3444
+ }
3445
+ };
3446
+ module2.exports = Year;
3447
+ }
3448
+ });
3449
+
3450
+ // ../../node_modules/prompts/lib/dateparts/index.js
3451
+ var require_dateparts2 = __commonJS({
3452
+ "../../node_modules/prompts/lib/dateparts/index.js"(exports, module2) {
3453
+ "use strict";
3454
+ module2.exports = {
3455
+ DatePart: require_datepart2(),
3456
+ Meridiem: require_meridiem2(),
3457
+ Day: require_day2(),
3458
+ Hours: require_hours2(),
3459
+ Milliseconds: require_milliseconds2(),
3460
+ Minutes: require_minutes2(),
3461
+ Month: require_month2(),
3462
+ Seconds: require_seconds2(),
3463
+ Year: require_year2()
3464
+ };
3465
+ }
3466
+ });
3467
+
3468
+ // ../../node_modules/prompts/lib/elements/date.js
3469
+ var require_date2 = __commonJS({
3470
+ "../../node_modules/prompts/lib/elements/date.js"(exports, module2) {
3471
+ "use strict";
3472
+ var color = require_kleur();
3473
+ var Prompt = require_prompt2();
3474
+ var { style, clear, figures, strip } = require_util2();
3475
+ var { erase, cursor } = require_src();
3476
+ var { DatePart, Meridiem, Day, Hours, Milliseconds, Minutes, Month, Seconds, Year } = require_dateparts2();
3477
+ var 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;
3478
+ var regexGroups = {
3479
+ 1: ({ token }) => token.replace(/\\(.)/g, "$1"),
3480
+ 2: (opts) => new Day(opts),
3481
+ // Day // TODO
3482
+ 3: (opts) => new Month(opts),
3483
+ // Month
3484
+ 4: (opts) => new Year(opts),
3485
+ // Year
3486
+ 5: (opts) => new Meridiem(opts),
3487
+ // AM/PM // TODO (special)
3488
+ 6: (opts) => new Hours(opts),
3489
+ // Hours
3490
+ 7: (opts) => new Minutes(opts),
3491
+ // Minutes
3492
+ 8: (opts) => new Seconds(opts),
3493
+ // Seconds
3494
+ 9: (opts) => new Milliseconds(opts)
3495
+ // Fractional seconds
3496
+ };
3497
+ var dfltLocales = {
3498
+ months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
3499
+ monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
3500
+ weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
3501
+ weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
3502
+ };
3503
+ var DatePrompt = class extends Prompt {
3504
+ constructor(opts = {}) {
3505
+ super(opts);
3506
+ this.msg = opts.message;
3507
+ this.cursor = 0;
3508
+ this.typed = "";
3509
+ this.locales = Object.assign(dfltLocales, opts.locales);
3510
+ this._date = opts.initial || /* @__PURE__ */ new Date();
3511
+ this.errorMsg = opts.error || "Please Enter A Valid Value";
3512
+ this.validator = opts.validate || (() => true);
3513
+ this.mask = opts.mask || "YYYY-MM-DD HH:mm:ss";
3514
+ this.clear = clear("");
3515
+ this.render();
3516
+ }
3517
+ get value() {
3518
+ return this.date;
3519
+ }
3520
+ get date() {
3521
+ return this._date;
3522
+ }
3523
+ set date(date) {
3524
+ if (date)
3525
+ this._date.setTime(date.getTime());
3526
+ }
3527
+ set mask(mask) {
3528
+ let result;
3529
+ this.parts = [];
3530
+ while (result = regex.exec(mask)) {
3531
+ let match = result.shift();
3532
+ let idx = result.findIndex((gr) => gr != null);
3533
+ this.parts.push(idx in regexGroups ? regexGroups[idx]({ token: result[idx] || match, date: this.date, parts: this.parts, locales: this.locales }) : result[idx] || match);
3534
+ }
3535
+ let parts = this.parts.reduce((arr, i) => {
3536
+ if (typeof i === "string" && typeof arr[arr.length - 1] === "string")
3537
+ arr[arr.length - 1] += i;
3538
+ else
3539
+ arr.push(i);
3540
+ return arr;
3541
+ }, []);
3542
+ this.parts.splice(0);
3543
+ this.parts.push(...parts);
3544
+ this.reset();
3545
+ }
3546
+ moveCursor(n) {
3547
+ this.typed = "";
3548
+ this.cursor = n;
3549
+ this.fire();
3550
+ }
3551
+ reset() {
3552
+ this.moveCursor(this.parts.findIndex((p) => p instanceof DatePart));
3553
+ this.fire();
3554
+ this.render();
3555
+ }
3556
+ abort() {
3557
+ this.done = this.aborted = true;
3558
+ this.error = false;
3559
+ this.fire();
3560
+ this.render();
3561
+ this.out.write("\n");
3562
+ this.close();
3563
+ }
3564
+ async validate() {
3565
+ let valid = await this.validator(this.value);
3566
+ if (typeof valid === "string") {
3567
+ this.errorMsg = valid;
3568
+ valid = false;
3569
+ }
3570
+ this.error = !valid;
3571
+ }
3572
+ async submit() {
3573
+ await this.validate();
3574
+ if (this.error) {
3575
+ this.color = "red";
3576
+ this.fire();
3577
+ this.render();
3578
+ return;
3579
+ }
3580
+ this.done = true;
3581
+ this.aborted = false;
3582
+ this.fire();
3583
+ this.render();
3584
+ this.out.write("\n");
3585
+ this.close();
3586
+ }
3587
+ up() {
3588
+ this.typed = "";
3589
+ this.parts[this.cursor].up();
3590
+ this.render();
3591
+ }
3592
+ down() {
3593
+ this.typed = "";
3594
+ this.parts[this.cursor].down();
3595
+ this.render();
3596
+ }
3597
+ left() {
3598
+ let prev = this.parts[this.cursor].prev();
3599
+ if (prev == null)
3600
+ return this.bell();
3601
+ this.moveCursor(this.parts.indexOf(prev));
3602
+ this.render();
3603
+ }
3604
+ right() {
3605
+ let next = this.parts[this.cursor].next();
3606
+ if (next == null)
3607
+ return this.bell();
3608
+ this.moveCursor(this.parts.indexOf(next));
3609
+ this.render();
3610
+ }
3611
+ next() {
3612
+ let next = this.parts[this.cursor].next();
3613
+ this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex((part) => part instanceof DatePart));
3614
+ this.render();
3615
+ }
3616
+ _(c) {
3617
+ if (/\d/.test(c)) {
3618
+ this.typed += c;
3619
+ this.parts[this.cursor].setTo(this.typed);
3620
+ this.render();
3621
+ }
3622
+ }
3623
+ render() {
3624
+ if (this.closed)
3625
+ return;
3626
+ if (this.firstRender)
3627
+ this.out.write(cursor.hide);
3628
+ else
3629
+ this.out.write(erase.lines(1));
3630
+ super.render();
3631
+ let clear2 = erase.line + (this.lines ? erase.down(this.lines) : "") + cursor.to(0);
3632
+ this.lines = 0;
3633
+ let error = "";
3634
+ if (this.error) {
3635
+ let lines = this.errorMsg.split("\n");
3636
+ error = lines.reduce((a, l, i) => a + `
3637
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
3638
+ this.lines = lines.length;
3639
+ }
3640
+ let prompt = [
3641
+ style.symbol(this.done, this.aborted),
3642
+ color.bold(this.msg),
3643
+ style.delimiter(false),
3644
+ this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join("")
3645
+ ].join(" ");
3646
+ let position = "";
3647
+ if (this.lines) {
3648
+ position += cursor.up(this.lines);
3649
+ position += cursor.left + cursor.to(strip(prompt).length);
3650
+ }
3651
+ this.out.write(clear2 + prompt + error + position);
3652
+ }
3653
+ };
3654
+ module2.exports = DatePrompt;
3655
+ }
3656
+ });
3657
+
3658
+ // ../../node_modules/prompts/lib/elements/number.js
3659
+ var require_number2 = __commonJS({
3660
+ "../../node_modules/prompts/lib/elements/number.js"(exports, module2) {
3661
+ var color = require_kleur();
3662
+ var Prompt = require_prompt2();
3663
+ var { cursor, erase } = require_src();
3664
+ var { style, clear, figures, strip } = require_util2();
3665
+ var isNumber = /[0-9]/;
3666
+ var isDef = (any) => any !== void 0;
3667
+ var round = (number, precision) => {
3668
+ let factor = Math.pow(10, precision);
3669
+ return Math.round(number * factor) / factor;
3670
+ };
3671
+ var NumberPrompt = class extends Prompt {
3672
+ constructor(opts = {}) {
3673
+ super(opts);
3674
+ this.transform = style.render(opts.style);
3675
+ this.msg = opts.message;
3676
+ this.initial = isDef(opts.initial) ? opts.initial : "";
3677
+ this.float = !!opts.float;
3678
+ this.round = opts.round || 2;
3679
+ this.inc = opts.increment || 1;
3680
+ this.min = isDef(opts.min) ? opts.min : -Infinity;
3681
+ this.max = isDef(opts.max) ? opts.max : Infinity;
3682
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
3683
+ this.validator = opts.validate || (() => true);
3684
+ this.color = `cyan`;
3685
+ this.value = ``;
3686
+ this.typed = ``;
3687
+ this.lastHit = 0;
3688
+ this.render();
3689
+ }
3690
+ set value(v) {
3691
+ if (!v && v !== 0) {
3692
+ this.placeholder = true;
3693
+ this.rendered = color.gray(this.transform.render(`${this.initial}`));
3694
+ this._value = ``;
3695
+ } else {
3696
+ this.placeholder = false;
3697
+ this.rendered = this.transform.render(`${round(v, this.round)}`);
3698
+ this._value = round(v, this.round);
3699
+ }
3700
+ this.fire();
3701
+ }
3702
+ get value() {
3703
+ return this._value;
3704
+ }
3705
+ parse(x) {
3706
+ return this.float ? parseFloat(x) : parseInt(x);
3707
+ }
3708
+ valid(c) {
3709
+ return c === `-` || c === `.` && this.float || isNumber.test(c);
3710
+ }
3711
+ reset() {
3712
+ this.typed = ``;
3713
+ this.value = ``;
3714
+ this.fire();
3715
+ this.render();
3716
+ }
3717
+ abort() {
3718
+ let x = this.value;
3719
+ this.value = x !== `` ? x : this.initial;
3720
+ this.done = this.aborted = true;
3721
+ this.error = false;
3722
+ this.fire();
3723
+ this.render();
3724
+ this.out.write(`
3725
+ `);
3726
+ this.close();
3727
+ }
3728
+ async validate() {
3729
+ let valid = await this.validator(this.value);
3730
+ if (typeof valid === `string`) {
3731
+ this.errorMsg = valid;
3732
+ valid = false;
3733
+ }
3734
+ this.error = !valid;
3735
+ }
3736
+ async submit() {
3737
+ await this.validate();
3738
+ if (this.error) {
3739
+ this.color = `red`;
3740
+ this.fire();
3741
+ this.render();
3742
+ return;
3743
+ }
3744
+ let x = this.value;
3745
+ this.value = x !== `` ? x : this.initial;
3746
+ this.done = true;
3747
+ this.aborted = false;
3748
+ this.error = false;
3749
+ this.fire();
3750
+ this.render();
3751
+ this.out.write(`
3752
+ `);
3753
+ this.close();
3754
+ }
3755
+ up() {
3756
+ this.typed = ``;
3757
+ if (this.value >= this.max)
3758
+ return this.bell();
3759
+ this.value += this.inc;
3760
+ this.color = `cyan`;
3761
+ this.fire();
3762
+ this.render();
3763
+ }
3764
+ down() {
3765
+ this.typed = ``;
3766
+ if (this.value <= this.min)
3767
+ return this.bell();
3768
+ this.value -= this.inc;
3769
+ this.color = `cyan`;
3770
+ this.fire();
3771
+ this.render();
3772
+ }
3773
+ delete() {
3774
+ let val = this.value.toString();
3775
+ if (val.length === 0)
3776
+ return this.bell();
3777
+ this.value = this.parse(val = val.slice(0, -1)) || ``;
3778
+ this.color = `cyan`;
3779
+ this.fire();
3780
+ this.render();
3781
+ }
3782
+ next() {
3783
+ this.value = this.initial;
3784
+ this.fire();
3785
+ this.render();
3786
+ }
3787
+ _(c, key) {
3788
+ if (!this.valid(c))
3789
+ return this.bell();
3790
+ const now = Date.now();
3791
+ if (now - this.lastHit > 1e3)
3792
+ this.typed = ``;
3793
+ this.typed += c;
3794
+ this.lastHit = now;
3795
+ this.color = `cyan`;
3796
+ if (c === `.`)
3797
+ return this.fire();
3798
+ this.value = Math.min(this.parse(this.typed), this.max);
3799
+ if (this.value > this.max)
3800
+ this.value = this.max;
3801
+ if (this.value < this.min)
3802
+ this.value = this.min;
3803
+ this.fire();
3804
+ this.render();
3805
+ }
3806
+ render() {
3807
+ if (this.closed)
3808
+ return;
3809
+ super.render();
3810
+ let clear2 = erase.line + (this.lines ? erase.down(this.lines) : ``) + cursor.to(0);
3811
+ this.lines = 0;
3812
+ let error = ``;
3813
+ if (this.error) {
3814
+ let lines = this.errorMsg.split(`
3815
+ `);
3816
+ error += lines.reduce((a, l, i) => a + `
3817
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
3818
+ this.lines = lines.length;
3819
+ }
3820
+ let underline = !this.done || !this.done && !this.placeholder;
3821
+ let prompt = [
3822
+ style.symbol(this.done, this.aborted),
3823
+ color.bold(this.msg),
3824
+ style.delimiter(this.done),
3825
+ underline ? color[this.color]().underline(this.rendered) : this.rendered
3826
+ ].join(` `);
3827
+ let position = ``;
3828
+ if (this.lines) {
3829
+ position += cursor.up(this.lines);
3830
+ position += cursor.left + cursor.to(strip(prompt).length);
3831
+ }
3832
+ this.out.write(clear2 + prompt + error + position);
3833
+ }
3834
+ };
3835
+ module2.exports = NumberPrompt;
3836
+ }
3837
+ });
3838
+
3839
+ // ../../node_modules/prompts/lib/elements/multiselect.js
3840
+ var require_multiselect2 = __commonJS({
3841
+ "../../node_modules/prompts/lib/elements/multiselect.js"(exports, module2) {
3842
+ "use strict";
3843
+ var color = require_kleur();
3844
+ var { cursor } = require_src();
3845
+ var Prompt = require_prompt2();
3846
+ var { clear, figures, style } = require_util2();
3847
+ var MultiselectPrompt = class extends Prompt {
3848
+ constructor(opts = {}) {
3849
+ super(opts);
3850
+ this.msg = opts.message;
3851
+ this.cursor = opts.cursor || 0;
3852
+ this.scrollIndex = opts.cursor || 0;
3853
+ this.hint = opts.hint || "";
3854
+ this.warn = opts.warn || "- This option is disabled -";
3855
+ this.minSelected = opts.min;
3856
+ this.showMinError = false;
3857
+ this.maxChoices = opts.max;
3858
+ this.value = opts.choices.map((ch, idx) => {
3859
+ if (typeof ch === "string")
3860
+ ch = { title: ch, value: idx };
3861
+ return {
3862
+ title: ch && (ch.title || ch.value || ch),
3863
+ value: ch && (ch.value || idx),
3864
+ selected: ch && ch.selected,
3865
+ disabled: ch && ch.disabled
3866
+ };
3867
+ });
3868
+ this.clear = clear("");
3869
+ if (!opts.overrideRender) {
3870
+ this.render();
3871
+ }
3872
+ }
3873
+ reset() {
3874
+ this.value.map((v) => !v.selected);
3875
+ this.cursor = 0;
3876
+ this.fire();
3877
+ this.render();
3878
+ }
3879
+ selected() {
3880
+ return this.value.filter((v) => v.selected);
3881
+ }
3882
+ abort() {
3883
+ this.done = this.aborted = true;
3884
+ this.fire();
3885
+ this.render();
3886
+ this.out.write("\n");
3887
+ this.close();
3888
+ }
3889
+ submit() {
3890
+ const selected = this.value.filter((e) => e.selected);
3891
+ if (this.minSelected && selected.length < this.minSelected) {
3892
+ this.showMinError = true;
3893
+ this.render();
3894
+ } else {
3895
+ this.done = true;
3896
+ this.aborted = false;
3897
+ this.fire();
3898
+ this.render();
3899
+ this.out.write("\n");
3900
+ this.close();
3901
+ }
3902
+ }
3903
+ first() {
3904
+ this.cursor = 0;
3905
+ this.render();
3906
+ }
3907
+ last() {
3908
+ this.cursor = this.value.length - 1;
3909
+ this.render();
3910
+ }
3911
+ next() {
3912
+ this.cursor = (this.cursor + 1) % this.value.length;
3913
+ this.render();
3914
+ }
3915
+ up() {
3916
+ if (this.cursor === 0) {
3917
+ this.cursor = this.value.length - 1;
3918
+ } else {
3919
+ this.cursor--;
3920
+ }
3921
+ this.render();
3922
+ }
3923
+ down() {
3924
+ if (this.cursor === this.value.length - 1) {
3925
+ this.cursor = 0;
3926
+ } else {
3927
+ this.cursor++;
3928
+ }
3929
+ this.render();
3930
+ }
3931
+ left() {
3932
+ this.value[this.cursor].selected = false;
3933
+ this.render();
3934
+ }
3935
+ right() {
3936
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices)
3937
+ return this.bell();
3938
+ this.value[this.cursor].selected = true;
3939
+ this.render();
3940
+ }
3941
+ handleSpaceToggle() {
3942
+ const v = this.value[this.cursor];
3943
+ if (v.selected) {
3944
+ v.selected = false;
3945
+ this.render();
3946
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
3947
+ return this.bell();
3948
+ } else {
3949
+ v.selected = true;
3950
+ this.render();
3951
+ }
3952
+ }
3953
+ _(c, key) {
3954
+ if (c === " ") {
3955
+ this.handleSpaceToggle();
3956
+ } else {
3957
+ return this.bell();
3958
+ }
3959
+ }
3960
+ renderInstructions() {
3961
+ return `
3962
+ Instructions:
3963
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
3964
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
3965
+ enter/return: Complete answer
3966
+ `;
3967
+ }
3968
+ renderOption(cursor2, v, i) {
3969
+ let title;
3970
+ if (v.disabled)
3971
+ title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
3972
+ else
3973
+ title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
3974
+ return (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
3975
+ }
3976
+ // shared with autocompleteMultiselect
3977
+ paginateOptions(options) {
3978
+ const c = this.cursor;
3979
+ let styledOptions = options.map((v, i) => this.renderOption(c, v, i));
3980
+ const numOfOptionsToRender = 10;
3981
+ let scopedOptions = styledOptions;
3982
+ let hint = "";
3983
+ if (styledOptions.length === 0) {
3984
+ return color.red("No matches for this query.");
3985
+ } else if (styledOptions.length > numOfOptionsToRender) {
3986
+ let startIndex = c - numOfOptionsToRender / 2;
3987
+ let endIndex = c + numOfOptionsToRender / 2;
3988
+ if (startIndex < 0) {
3989
+ startIndex = 0;
3990
+ endIndex = numOfOptionsToRender;
3991
+ } else if (endIndex > options.length) {
3992
+ endIndex = options.length;
3993
+ startIndex = endIndex - numOfOptionsToRender;
3994
+ }
3995
+ scopedOptions = styledOptions.slice(startIndex, endIndex);
3996
+ hint = color.dim("(Move up and down to reveal more choices)");
3997
+ }
3998
+ return "\n" + scopedOptions.join("\n") + "\n" + hint;
3999
+ }
4000
+ // shared with autocomleteMultiselect
4001
+ renderOptions(options) {
4002
+ if (!this.done) {
4003
+ return this.paginateOptions(options);
4004
+ }
4005
+ return "";
4006
+ }
4007
+ renderDoneOrInstructions() {
4008
+ if (this.done) {
4009
+ const selected = this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
4010
+ return selected;
4011
+ }
4012
+ const output = [color.gray(this.hint), this.renderInstructions()];
4013
+ if (this.value[this.cursor].disabled) {
4014
+ output.push(color.yellow(this.warn));
4015
+ }
4016
+ return output.join(" ");
4017
+ }
4018
+ render() {
4019
+ if (this.closed)
4020
+ return;
4021
+ if (this.firstRender)
4022
+ this.out.write(cursor.hide);
4023
+ super.render();
4024
+ let prompt = [
4025
+ style.symbol(this.done, this.aborted),
4026
+ color.bold(this.msg),
4027
+ style.delimiter(false),
4028
+ this.renderDoneOrInstructions()
4029
+ ].join(" ");
4030
+ if (this.showMinError) {
4031
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
4032
+ this.showMinError = false;
4033
+ }
4034
+ prompt += this.renderOptions(this.value);
4035
+ this.out.write(this.clear + prompt);
4036
+ this.clear = clear(prompt);
4037
+ }
4038
+ };
4039
+ module2.exports = MultiselectPrompt;
4040
+ }
4041
+ });
4042
+
4043
+ // ../../node_modules/prompts/lib/elements/autocomplete.js
4044
+ var require_autocomplete2 = __commonJS({
4045
+ "../../node_modules/prompts/lib/elements/autocomplete.js"(exports, module2) {
4046
+ "use strict";
4047
+ var color = require_kleur();
4048
+ var Prompt = require_prompt2();
4049
+ var { cursor } = require_src();
4050
+ var { style, clear, figures, strip } = require_util2();
4051
+ var getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]);
4052
+ var getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]);
4053
+ var getIndex = (arr, valOrTitle) => {
4054
+ const index = arr.findIndex((el) => el.value === valOrTitle || el.title === valOrTitle);
4055
+ return index > -1 ? index : void 0;
4056
+ };
4057
+ var AutocompletePrompt = class extends Prompt {
4058
+ constructor(opts = {}) {
4059
+ super(opts);
4060
+ this.msg = opts.message;
4061
+ this.suggest = opts.suggest;
4062
+ this.choices = opts.choices;
4063
+ this.initial = typeof opts.initial === "number" ? opts.initial : getIndex(opts.choices, opts.initial);
4064
+ this.select = this.initial || opts.cursor || 0;
4065
+ this.fallback = opts.fallback || (opts.initial !== void 0 ? `${figures.pointerSmall} ${getTitle(this.choices, this.initial)}` : `${figures.pointerSmall} ${opts.noMatches || "no matches found"}`);
4066
+ this.suggestions = [[]];
4067
+ this.page = 0;
4068
+ this.input = "";
4069
+ this.limit = opts.limit || 10;
4070
+ this.cursor = 0;
4071
+ this.transform = style.render(opts.style);
4072
+ this.scale = this.transform.scale;
4073
+ this.render = this.render.bind(this);
4074
+ this.complete = this.complete.bind(this);
4075
+ this.clear = clear("");
4076
+ this.complete(this.render);
4077
+ this.render();
4078
+ }
4079
+ moveSelect(i) {
4080
+ this.select = i;
4081
+ if (this.suggestions[this.page].length > 0) {
4082
+ this.value = getVal(this.suggestions[this.page], i);
4083
+ } else {
4084
+ this.value = this.initial !== void 0 ? getVal(this.choices, this.initial) : null;
4085
+ }
4086
+ this.fire();
4087
+ }
4088
+ async complete(cb) {
4089
+ const p = this.completing = this.suggest(this.input, this.choices);
4090
+ const suggestions = await p;
4091
+ if (this.completing !== p)
4092
+ return;
4093
+ this.suggestions = suggestions.map((s, i, arr) => ({ title: getTitle(arr, i), value: getVal(arr, i) })).reduce((arr, sug) => {
4094
+ if (arr[arr.length - 1].length < this.limit)
4095
+ arr[arr.length - 1].push(sug);
4096
+ else
4097
+ arr.push([sug]);
4098
+ return arr;
4099
+ }, [[]]);
4100
+ this.isFallback = false;
4101
+ this.completing = false;
4102
+ if (!this.suggestions[this.page])
4103
+ this.page = 0;
4104
+ if (!this.suggestions.length && this.fallback) {
4105
+ const index = getIndex(this.choices, this.fallback);
4106
+ this.suggestions = [[]];
4107
+ if (index !== void 0)
4108
+ this.suggestions[0].push({ title: getTitle(this.choices, index), value: getVal(this.choices, index) });
4109
+ this.isFallback = true;
4110
+ }
4111
+ const l = Math.max(suggestions.length - 1, 0);
4112
+ this.moveSelect(Math.min(l, this.select));
4113
+ cb && cb();
4114
+ }
4115
+ reset() {
4116
+ this.input = "";
4117
+ this.complete(() => {
4118
+ this.moveSelect(this.initial !== void 0 ? this.initial : 0);
4119
+ this.render();
4120
+ });
4121
+ this.render();
4122
+ }
4123
+ abort() {
4124
+ this.done = this.aborted = true;
4125
+ this.fire();
4126
+ this.render();
4127
+ this.out.write("\n");
4128
+ this.close();
4129
+ }
4130
+ submit() {
4131
+ this.done = true;
4132
+ this.aborted = false;
4133
+ this.fire();
4134
+ this.render();
4135
+ this.out.write("\n");
4136
+ this.close();
4137
+ }
4138
+ _(c, key) {
4139
+ let s1 = this.input.slice(0, this.cursor);
4140
+ let s2 = this.input.slice(this.cursor);
4141
+ this.input = `${s1}${c}${s2}`;
4142
+ this.cursor = s1.length + 1;
4143
+ this.complete(this.render);
4144
+ this.render();
4145
+ }
4146
+ delete() {
4147
+ if (this.cursor === 0)
4148
+ return this.bell();
4149
+ let s1 = this.input.slice(0, this.cursor - 1);
4150
+ let s2 = this.input.slice(this.cursor);
4151
+ this.input = `${s1}${s2}`;
4152
+ this.complete(this.render);
4153
+ this.cursor = this.cursor - 1;
4154
+ this.render();
4155
+ }
4156
+ deleteForward() {
4157
+ if (this.cursor * this.scale >= this.rendered.length)
4158
+ return this.bell();
4159
+ let s1 = this.input.slice(0, this.cursor);
4160
+ let s2 = this.input.slice(this.cursor + 1);
4161
+ this.input = `${s1}${s2}`;
4162
+ this.complete(this.render);
4163
+ this.render();
4164
+ }
4165
+ first() {
4166
+ this.moveSelect(0);
4167
+ this.render();
4168
+ }
4169
+ last() {
4170
+ this.moveSelect(this.suggestions[this.page].length - 1);
4171
+ this.render();
4172
+ }
4173
+ up() {
4174
+ if (this.select <= 0)
4175
+ return this.bell();
4176
+ this.moveSelect(this.select - 1);
4177
+ this.render();
4178
+ }
4179
+ down() {
4180
+ if (this.select >= this.suggestions[this.page].length - 1)
4181
+ return this.bell();
4182
+ this.moveSelect(this.select + 1);
4183
+ this.render();
4184
+ }
4185
+ next() {
4186
+ if (this.select === this.suggestions[this.page].length - 1) {
4187
+ this.page = (this.page + 1) % this.suggestions.length;
4188
+ this.moveSelect(0);
4189
+ } else
4190
+ this.moveSelect(this.select + 1);
4191
+ this.render();
4192
+ }
4193
+ nextPage() {
4194
+ if (this.page >= this.suggestions.length - 1)
4195
+ return this.bell();
4196
+ this.page++;
4197
+ this.moveSelect(0);
4198
+ this.render();
4199
+ }
4200
+ prevPage() {
4201
+ if (this.page <= 0)
4202
+ return this.bell();
4203
+ this.page--;
4204
+ this.moveSelect(0);
4205
+ this.render();
4206
+ }
4207
+ left() {
4208
+ if (this.cursor <= 0)
4209
+ return this.bell();
4210
+ this.cursor = this.cursor - 1;
4211
+ this.render();
4212
+ }
4213
+ right() {
4214
+ if (this.cursor * this.scale >= this.rendered.length)
4215
+ return this.bell();
4216
+ this.cursor = this.cursor + 1;
4217
+ this.render();
4218
+ }
4219
+ render() {
4220
+ if (this.closed)
4221
+ return;
4222
+ super.render();
4223
+ if (this.lineCount)
4224
+ this.out.write(cursor.down(this.lineCount));
4225
+ let prompt = color.bold(`${style.symbol(this.done, this.aborted)} ${this.msg} `) + `${style.delimiter(this.completing)} `;
4226
+ let length = strip(prompt).length;
4227
+ if (this.done && this.suggestions[this.page][this.select]) {
4228
+ prompt += `${this.suggestions[this.page][this.select].title}`;
4229
+ } else {
4230
+ this.rendered = `${this.transform.render(this.input)}`;
4231
+ length += this.rendered.length;
4232
+ prompt += this.rendered;
4233
+ }
4234
+ if (!this.done) {
4235
+ this.lineCount = this.suggestions[this.page].length;
4236
+ let suggestions = this.suggestions[this.page].reduce((acc, item, i) => acc + `
4237
+ ${i === this.select ? color.cyan(item.title) : item.title}`, "");
4238
+ if (suggestions && !this.isFallback) {
4239
+ prompt += suggestions;
4240
+ if (this.suggestions.length > 1) {
4241
+ this.lineCount++;
4242
+ prompt += color.blue(`
4243
+ Page ${this.page + 1}/${this.suggestions.length}`);
4244
+ }
4245
+ } else {
4246
+ const fallbackIndex = getIndex(this.choices, this.fallback);
4247
+ const fallbackTitle = fallbackIndex !== void 0 ? getTitle(this.choices, fallbackIndex) : this.fallback;
4248
+ prompt += `
4249
+ ${color.gray(fallbackTitle)}`;
4250
+ this.lineCount++;
4251
+ }
4252
+ }
4253
+ this.out.write(this.clear + prompt);
4254
+ this.clear = clear(prompt);
4255
+ if (this.lineCount && !this.done) {
4256
+ let pos = cursor.up(this.lineCount);
4257
+ pos += cursor.left + cursor.to(length);
4258
+ pos += cursor.move(-this.rendered.length + this.cursor * this.scale);
4259
+ this.out.write(pos);
4260
+ }
4261
+ }
4262
+ };
4263
+ module2.exports = AutocompletePrompt;
4264
+ }
4265
+ });
4266
+
4267
+ // ../../node_modules/prompts/lib/elements/autocompleteMultiselect.js
4268
+ var require_autocompleteMultiselect2 = __commonJS({
4269
+ "../../node_modules/prompts/lib/elements/autocompleteMultiselect.js"(exports, module2) {
4270
+ "use strict";
4271
+ var color = require_kleur();
4272
+ var { cursor } = require_src();
4273
+ var MultiselectPrompt = require_multiselect2();
4274
+ var { clear, style, figures } = require_util2();
4275
+ var AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
4276
+ constructor(opts = {}) {
4277
+ opts.overrideRender = true;
4278
+ super(opts);
4279
+ this.inputValue = "";
4280
+ this.clear = clear("");
4281
+ this.filteredOptions = this.value;
4282
+ this.render();
4283
+ }
4284
+ last() {
4285
+ this.cursor = this.filteredOptions.length - 1;
4286
+ this.render();
4287
+ }
4288
+ next() {
4289
+ this.cursor = (this.cursor + 1) % this.filteredOptions.length;
4290
+ this.render();
4291
+ }
4292
+ up() {
4293
+ if (this.cursor === 0) {
4294
+ this.cursor = this.filteredOptions.length - 1;
4295
+ } else {
4296
+ this.cursor--;
4297
+ }
4298
+ this.render();
4299
+ }
4300
+ down() {
4301
+ if (this.cursor === this.filteredOptions.length - 1) {
4302
+ this.cursor = 0;
4303
+ } else {
4304
+ this.cursor++;
4305
+ }
4306
+ this.render();
4307
+ }
4308
+ left() {
4309
+ this.filteredOptions[this.cursor].selected = false;
4310
+ this.render();
4311
+ }
4312
+ right() {
4313
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices)
4314
+ return this.bell();
4315
+ this.filteredOptions[this.cursor].selected = true;
4316
+ this.render();
4317
+ }
4318
+ delete() {
4319
+ if (this.inputValue.length) {
4320
+ this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1);
4321
+ this.updateFilteredOptions();
4322
+ }
4323
+ }
4324
+ updateFilteredOptions() {
4325
+ const currentHighlight = this.filteredOptions[this.cursor];
4326
+ this.filteredOptions = this.value.filter((v) => {
4327
+ if (this.inputValue) {
4328
+ if (typeof v.title === "string") {
4329
+ if (v.title.toLowerCase().includes(this.inputValue.toLowerCase())) {
4330
+ return true;
4331
+ }
4332
+ }
4333
+ if (typeof v.value === "string") {
4334
+ if (v.value.toLowerCase().includes(this.inputValue.toLowerCase())) {
4335
+ return true;
4336
+ }
4337
+ }
4338
+ return false;
4339
+ }
4340
+ return true;
4341
+ });
4342
+ const newHighlightIndex = this.filteredOptions.findIndex((v) => v === currentHighlight);
4343
+ this.cursor = newHighlightIndex < 0 ? 0 : newHighlightIndex;
4344
+ this.render();
4345
+ }
4346
+ handleSpaceToggle() {
4347
+ const v = this.filteredOptions[this.cursor];
4348
+ if (v.selected) {
4349
+ v.selected = false;
4350
+ this.render();
4351
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
4352
+ return this.bell();
4353
+ } else {
4354
+ v.selected = true;
4355
+ this.render();
4356
+ }
4357
+ }
4358
+ handleInputChange(c) {
4359
+ this.inputValue = this.inputValue + c;
4360
+ this.updateFilteredOptions();
4361
+ }
4362
+ _(c, key) {
4363
+ if (c === " ") {
4364
+ this.handleSpaceToggle();
4365
+ } else {
4366
+ this.handleInputChange(c);
4367
+ }
4368
+ }
4369
+ renderInstructions() {
4370
+ return `
4371
+ Instructions:
4372
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
4373
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
4374
+ [a,b,c]/delete: Filter choices
4375
+ enter/return: Complete answer
4376
+ `;
4377
+ }
4378
+ renderCurrentInput() {
4379
+ return `
4380
+ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
4381
+ `;
4382
+ }
4383
+ renderOption(cursor2, v, i) {
4384
+ let title;
4385
+ if (v.disabled)
4386
+ title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
4387
+ else
4388
+ title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
4389
+ return (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
4390
+ }
4391
+ renderDoneOrInstructions() {
4392
+ if (this.done) {
4393
+ const selected = this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
4394
+ return selected;
4395
+ }
4396
+ const output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
4397
+ if (this.filteredOptions.length && this.filteredOptions[this.cursor].disabled) {
4398
+ output.push(color.yellow(this.warn));
4399
+ }
4400
+ return output.join(" ");
4401
+ }
4402
+ render() {
4403
+ if (this.closed)
4404
+ return;
4405
+ if (this.firstRender)
4406
+ this.out.write(cursor.hide);
4407
+ super.render();
4408
+ let prompt = [
4409
+ style.symbol(this.done, this.aborted),
4410
+ color.bold(this.msg),
4411
+ style.delimiter(false),
4412
+ this.renderDoneOrInstructions()
4413
+ ].join(" ");
4414
+ if (this.showMinError) {
4415
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
4416
+ this.showMinError = false;
4417
+ }
4418
+ prompt += this.renderOptions(this.filteredOptions);
4419
+ this.out.write(this.clear + prompt);
4420
+ this.clear = clear(prompt);
4421
+ }
4422
+ };
4423
+ module2.exports = AutocompleteMultiselectPrompt;
4424
+ }
4425
+ });
4426
+
4427
+ // ../../node_modules/prompts/lib/elements/confirm.js
4428
+ var require_confirm2 = __commonJS({
4429
+ "../../node_modules/prompts/lib/elements/confirm.js"(exports, module2) {
4430
+ var color = require_kleur();
4431
+ var Prompt = require_prompt2();
4432
+ var { style } = require_util2();
4433
+ var { erase, cursor } = require_src();
4434
+ var ConfirmPrompt = class extends Prompt {
4435
+ constructor(opts = {}) {
4436
+ super(opts);
4437
+ this.msg = opts.message;
4438
+ this.value = opts.initial;
4439
+ this.initialValue = !!opts.initial;
4440
+ this.yesMsg = opts.yes || "yes";
4441
+ this.yesOption = opts.yesOption || "(Y/n)";
4442
+ this.noMsg = opts.no || "no";
4443
+ this.noOption = opts.noOption || "(y/N)";
4444
+ this.render();
4445
+ }
4446
+ reset() {
4447
+ this.value = this.initialValue;
4448
+ this.fire();
4449
+ this.render();
4450
+ }
4451
+ abort() {
4452
+ this.done = this.aborted = true;
4453
+ this.fire();
4454
+ this.render();
4455
+ this.out.write("\n");
4456
+ this.close();
4457
+ }
4458
+ submit() {
4459
+ this.value = this.value || false;
4460
+ this.done = true;
4461
+ this.aborted = false;
4462
+ this.fire();
4463
+ this.render();
4464
+ this.out.write("\n");
4465
+ this.close();
4466
+ }
4467
+ _(c, key) {
4468
+ if (c.toLowerCase() === "y") {
4469
+ this.value = true;
4470
+ return this.submit();
4471
+ }
4472
+ if (c.toLowerCase() === "n") {
4473
+ this.value = false;
4474
+ return this.submit();
4475
+ }
4476
+ return this.bell();
4477
+ }
4478
+ render() {
4479
+ if (this.closed)
4480
+ return;
4481
+ if (this.firstRender)
4482
+ this.out.write(cursor.hide);
4483
+ super.render();
4484
+ this.out.write(
4485
+ erase.line + cursor.to(0) + [
4486
+ style.symbol(this.done, this.aborted),
4487
+ color.bold(this.msg),
4488
+ style.delimiter(this.done),
4489
+ this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)
4490
+ ].join(" ")
4491
+ );
4492
+ }
4493
+ };
4494
+ module2.exports = ConfirmPrompt;
4495
+ }
4496
+ });
4497
+
4498
+ // ../../node_modules/prompts/lib/elements/index.js
4499
+ var require_elements2 = __commonJS({
4500
+ "../../node_modules/prompts/lib/elements/index.js"(exports, module2) {
4501
+ "use strict";
4502
+ module2.exports = {
4503
+ TextPrompt: require_text2(),
4504
+ SelectPrompt: require_select2(),
4505
+ TogglePrompt: require_toggle2(),
4506
+ DatePrompt: require_date2(),
4507
+ NumberPrompt: require_number2(),
4508
+ MultiselectPrompt: require_multiselect2(),
4509
+ AutocompletePrompt: require_autocomplete2(),
4510
+ AutocompleteMultiselectPrompt: require_autocompleteMultiselect2(),
4511
+ ConfirmPrompt: require_confirm2()
4512
+ };
4513
+ }
4514
+ });
4515
+
4516
+ // ../../node_modules/prompts/lib/prompts.js
4517
+ var require_prompts2 = __commonJS({
4518
+ "../../node_modules/prompts/lib/prompts.js"(exports) {
4519
+ "use strict";
4520
+ var $ = exports;
4521
+ var el = require_elements2();
4522
+ var noop = (v) => v;
4523
+ function toPrompt(type, args, opts = {}) {
4524
+ return new Promise((res, rej) => {
4525
+ const p = new el[type](args);
4526
+ const onAbort = opts.onAbort || noop;
4527
+ const onSubmit = opts.onSubmit || noop;
4528
+ p.on("state", args.onState || noop);
4529
+ p.on("submit", (x) => res(onSubmit(x)));
4530
+ p.on("abort", (x) => rej(onAbort(x)));
4531
+ });
4532
+ }
4533
+ $.text = (args) => toPrompt("TextPrompt", args);
4534
+ $.password = (args) => {
4535
+ args.style = "password";
4536
+ return $.text(args);
4537
+ };
4538
+ $.invisible = (args) => {
4539
+ args.style = "invisible";
4540
+ return $.text(args);
4541
+ };
4542
+ $.number = (args) => toPrompt("NumberPrompt", args);
4543
+ $.date = (args) => toPrompt("DatePrompt", args);
4544
+ $.confirm = (args) => toPrompt("ConfirmPrompt", args);
4545
+ $.list = (args) => {
4546
+ const sep = args.separator || ",";
4547
+ return toPrompt("TextPrompt", args, {
4548
+ onSubmit: (str) => str.split(sep).map((s) => s.trim())
4549
+ });
4550
+ };
4551
+ $.toggle = (args) => toPrompt("TogglePrompt", args);
4552
+ $.select = (args) => toPrompt("SelectPrompt", args);
4553
+ $.multiselect = (args) => {
4554
+ args.choices = [].concat(args.choices || []);
4555
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
4556
+ return toPrompt("MultiselectPrompt", args, {
4557
+ onAbort: toSelected,
4558
+ onSubmit: toSelected
4559
+ });
4560
+ };
4561
+ $.autocompleteMultiselect = (args) => {
4562
+ args.choices = [].concat(args.choices || []);
4563
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
4564
+ return toPrompt("AutocompleteMultiselectPrompt", args, {
4565
+ onAbort: toSelected,
4566
+ onSubmit: toSelected
4567
+ });
4568
+ };
4569
+ var byTitle = (input, choices) => Promise.resolve(
4570
+ choices.filter((item) => item.title.slice(0, input.length).toLowerCase() === input.toLowerCase())
4571
+ );
4572
+ $.autocomplete = (args) => {
4573
+ args.suggest = args.suggest || byTitle;
4574
+ args.choices = [].concat(args.choices || []);
4575
+ return toPrompt("AutocompletePrompt", args);
4576
+ };
4577
+ }
4578
+ });
4579
+
4580
+ // ../../node_modules/prompts/lib/index.js
4581
+ var require_lib = __commonJS({
4582
+ "../../node_modules/prompts/lib/index.js"(exports, module2) {
4583
+ "use strict";
4584
+ var prompts2 = require_prompts2();
4585
+ var passOn = ["suggest", "format", "onState", "validate", "onRender"];
4586
+ var noop = () => {
4587
+ };
4588
+ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {}) {
4589
+ const answers = {};
4590
+ const override2 = prompt._override || {};
4591
+ questions = [].concat(questions);
4592
+ let answer, question, quit, name, type;
4593
+ const getFormattedAnswer = async (question2, answer2, skipValidation = false) => {
4594
+ if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
4595
+ return;
4596
+ }
4597
+ return question2.format ? await question2.format(answer2, answers) : answer2;
4598
+ };
4599
+ for (question of questions) {
4600
+ ({ name, type } = question);
4601
+ for (let key in question) {
4602
+ if (passOn.includes(key))
4603
+ continue;
4604
+ let value = question[key];
4605
+ question[key] = typeof value === "function" ? await value(answer, { ...answers }, question) : value;
4606
+ }
4607
+ if (typeof question.message !== "string") {
4608
+ throw new Error("prompt message is required");
4609
+ }
4610
+ ({ name, type } = question);
4611
+ if (!type)
4612
+ continue;
4613
+ if (prompts2[type] === void 0) {
4614
+ throw new Error(`prompt type (${type}) is not defined`);
4615
+ }
4616
+ if (override2[question.name] !== void 0) {
4617
+ answer = await getFormattedAnswer(question, override2[question.name]);
4618
+ if (answer !== void 0) {
4619
+ answers[name] = answer;
4620
+ continue;
4621
+ }
4622
+ }
4623
+ try {
4624
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected) : await prompts2[type](question);
4625
+ answers[name] = answer = await getFormattedAnswer(question, answer, true);
4626
+ quit = await onSubmit(question, answer, answers);
4627
+ } catch (err) {
4628
+ quit = !await onCancel(question, answers);
4629
+ }
4630
+ if (quit)
4631
+ return answers;
4632
+ }
4633
+ return answers;
4634
+ }
4635
+ function getInjectedAnswer(injected) {
4636
+ const answer = injected.shift();
4637
+ if (answer instanceof Error) {
4638
+ throw answer;
4639
+ }
4640
+ return answer;
4641
+ }
4642
+ function inject(answers) {
4643
+ prompt._injected = (prompt._injected || []).concat(answers);
4644
+ }
4645
+ function override(answers) {
4646
+ prompt._override = Object.assign({}, answers);
4647
+ }
4648
+ module2.exports = Object.assign(prompt, { prompt, prompts: prompts2, inject, override });
4649
+ }
4650
+ });
4651
+
4652
+ // ../../node_modules/prompts/index.js
4653
+ var require_prompts3 = __commonJS({
4654
+ "../../node_modules/prompts/index.js"(exports, module2) {
4655
+ function isNodeLT(tar) {
4656
+ tar = (Array.isArray(tar) ? tar : tar.split(".")).map(Number);
4657
+ let i = 0, src = process.versions.node.split(".").map(Number);
4658
+ for (; i < tar.length; i++) {
4659
+ if (src[i] > tar[i])
4660
+ return false;
4661
+ if (tar[i] > src[i])
4662
+ return true;
4663
+ }
4664
+ return false;
4665
+ }
4666
+ module2.exports = isNodeLT("8.6.0") ? require_dist() : require_lib();
4667
+ }
4668
+ });
4669
+
4670
+ // src/helpers/getShouldUseGit.ts
4671
+ var getShouldUseGit_exports = {};
4672
+ __export(getShouldUseGit_exports, {
4673
+ getShouldUseGit: () => getShouldUseGit
4674
+ });
4675
+ module.exports = __toCommonJS(getShouldUseGit_exports);
4676
+ var import_prompts = __toESM(require_prompts3());
4677
+
4678
+ // src/constants.ts
4679
+ var IS_TEST = process.env.NODE_ENV === "test";
4680
+
4681
+ // src/helpers/getShouldUseGit.ts
4682
+ var getShouldUseGit = async () => {
4683
+ return IS_TEST || Boolean(
4684
+ (await (0, import_prompts.default)({
4685
+ type: "confirm",
4686
+ name: "gitInit",
4687
+ message: "Do you want to use git?",
4688
+ initial: true
4689
+ })).gitInit
4690
+ );
4691
+ };
4692
+ // Annotate the CommonJS export names for ESM import in node:
4693
+ 0 && (module.exports = {
4694
+ getShouldUseGit
4695
+ });
4696
+ //# sourceMappingURL=getShouldUseGit.js.map