storybook 10.1.0-alpha.10 → 10.1.0-alpha.11
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.
- package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
- package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
- package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
- package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
- package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
- package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
- package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
- package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
- package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-74YHFU5B.js} +44 -109
- package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
- package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
- package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
- package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
- package/dist/_browser-chunks/chunk-BE2DAXKJ.js +2966 -0
- package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
- package/dist/_browser-chunks/chunk-EBHB6RPS.js +61 -0
- package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
- package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
- package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
- package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
- package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
- package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
- package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
- package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
- package/dist/_browser-chunks/{chunk-QMY4G4R2.js → chunk-L4RMQ7D7.js} +17 -64
- package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
- package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
- package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
- package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
- package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
- package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
- package/dist/_browser-chunks/chunk-WXP2XJ3O.js +950 -0
- package/dist/_browser-chunks/chunk-X3DUQ5RA.js +47 -0
- package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
- package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
- package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
- package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
- package/dist/_browser-chunks/{syntaxhighlighter-RJZASWHL.js → syntaxhighlighter-WKBQ5RC7.js} +704 -1848
- package/dist/_node-chunks/{builder-manager-HA7CYFCK.js → builder-manager-PMPHOSM2.js} +475 -1013
- package/dist/_node-chunks/camelcase-K3IOOFQW.js +18 -0
- package/dist/_node-chunks/{chunk-X4XU27M6.js → chunk-32NE3UE3.js} +15 -24
- package/dist/_node-chunks/chunk-4GZCFQFG.js +58 -0
- package/dist/_node-chunks/chunk-5QK5MSOI.js +943 -0
- package/dist/_node-chunks/{chunk-VPR5IBMG.js → chunk-6ZOLETQK.js} +8 -10
- package/dist/_node-chunks/chunk-7I22Y76Z.js +1047 -0
- package/dist/_node-chunks/chunk-AKTRSR3O.js +72 -0
- package/dist/_node-chunks/chunk-BBOP3XCK.js +119 -0
- package/dist/_node-chunks/chunk-C2GQVDWI.js +34 -0
- package/dist/_node-chunks/{chunk-ZHSCUGNP.js → chunk-GG2WQZSG.js} +3799 -7849
- package/dist/_node-chunks/chunk-GQJOWVVR.js +3214 -0
- package/dist/_node-chunks/chunk-JCRM2YVK.js +3009 -0
- package/dist/_node-chunks/chunk-KK4AT5F3.js +1029 -0
- package/dist/_node-chunks/chunk-L7MYXJUM.js +1114 -0
- package/dist/_node-chunks/{chunk-F3XOPI6H.js → chunk-LCZO45L7.js} +469 -983
- package/dist/_node-chunks/chunk-LR3QITDI.js +209 -0
- package/dist/_node-chunks/chunk-LXG4DK35.js +3171 -0
- package/dist/_node-chunks/chunk-MJ3WOS6F.js +37 -0
- package/dist/_node-chunks/chunk-PHOZWZZO.js +61 -0
- package/dist/_node-chunks/chunk-QECOQWRJ.js +936 -0
- package/dist/_node-chunks/chunk-QH4V5YDB.js +20 -0
- package/dist/_node-chunks/chunk-R6HWGZWD.js +26 -0
- package/dist/_node-chunks/chunk-SPQXMU2Q.js +759 -0
- package/dist/_node-chunks/chunk-TXZY6V6O.js +1564 -0
- package/dist/_node-chunks/chunk-UGDPX5LE.js +756 -0
- package/dist/_node-chunks/chunk-UY26MQLT.js +603 -0
- package/dist/_node-chunks/chunk-WK3EMYK6.js +61 -0
- package/dist/_node-chunks/{chunk-OVXB5GGT.js → chunk-WLHMN7AP.js} +292 -688
- package/dist/_node-chunks/chunk-XGVLB4UJ.js +54 -0
- package/dist/_node-chunks/{chunk-RMHAL25C.js → chunk-YHRFI6BE.js} +87 -227
- package/dist/_node-chunks/chunk-YK4KVMFW.js +18 -0
- package/dist/_node-chunks/chunk-ZZALGOA6.js +4523 -0
- package/dist/_node-chunks/chunk-ZZPBSYA5.js +301 -0
- package/dist/_node-chunks/chunk-ZZSRFAC6.js +45571 -0
- package/dist/_node-chunks/dist-4DWOCZUD.js +121 -0
- package/dist/_node-chunks/globby-AAARUKEU.js +3452 -0
- package/dist/_node-chunks/lib-HEUKGL62.js +366 -0
- package/dist/_node-chunks/mdx-N42X6CFJ-DCVRPS6N.js +14329 -0
- package/dist/_node-chunks/p-limit-F5ZKJ6WZ.js +116 -0
- package/dist/_node-chunks/plugin-7YY7JXCH.js +123 -0
- package/dist/_node-chunks/{plugin-6ZPCS4LI.js → plugin-SZP3CW6W.js} +36 -56
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-TGKNDPO6.js +46623 -0
- package/dist/_node-chunks/webpack-mock-plugin-LNTZZFBE.js +92 -0
- package/dist/actions/decorator.js +21 -42
- package/dist/actions/index.js +3 -3
- package/dist/babel/index.d.ts +671 -335
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +592 -1546
- package/dist/bin/dispatcher.js +26 -37
- package/dist/bin/loader.js +23 -34
- package/dist/channels/index.js +98 -234
- package/dist/cli/index.js +1951 -5308
- package/dist/client-logger/index.js +31 -61
- package/dist/common/index.js +20 -20
- package/dist/components/index.js +4211 -8586
- package/dist/core-events/index.js +2 -66
- package/dist/core-server/index.js +3054 -7290
- package/dist/core-server/presets/common-manager.css +2 -2
- package/dist/core-server/presets/common-manager.js +1806 -3427
- package/dist/core-server/presets/common-override-preset.js +31 -60
- package/dist/core-server/presets/common-preset.js +434 -924
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +15 -19
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +12 -17
- package/dist/csf/index.js +534 -1179
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +6 -6
- package/dist/highlight/index.js +2 -2
- package/dist/instrumenter/index.js +199 -415
- package/dist/manager/globals-runtime.js +24150 -47364
- package/dist/manager/globals.js +2 -3
- package/dist/manager/runtime.js +3961 -8373
- package/dist/manager-api/index.js +1231 -2425
- package/dist/manager-errors.d.ts +3 -0
- package/dist/manager-errors.js +3 -3
- package/dist/node-logger/index.js +1253 -2601
- package/dist/preview/globals.js +2 -3
- package/dist/preview/runtime.js +10364 -21990
- package/dist/preview-api/index.d.ts +67 -68
- package/dist/preview-api/index.js +13 -13
- package/dist/preview-errors.d.ts +3 -0
- package/dist/preview-errors.js +4 -4
- package/dist/router/index.js +347 -899
- package/dist/server-errors.d.ts +3 -0
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -24
- package/dist/test/index.js +5860 -11645
- package/dist/theming/create.js +4 -4
- package/dist/theming/index.d.ts +3363 -2597
- package/dist/theming/index.js +490 -1086
- package/dist/types/index.js +2 -11
- package/dist/viewport/index.js +3 -3
- package/package.json +5 -5
- package/dist/_browser-chunks/Color-FQNEU7YS.js +0 -1695
- package/dist/_browser-chunks/WithTooltip-6NHN2GXF.js +0 -2343
- package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
- package/dist/_browser-chunks/chunk-AW46NMGV.js +0 -1308
- package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
- package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
- package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
- package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
- package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
- package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
- package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
- package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
- package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
- package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
- package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
- package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
- package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
- package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
- package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
- package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
- package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
- package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
- package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
- package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
- package/dist/_node-chunks/camelcase-QALD4XFE.js +0 -18
- package/dist/_node-chunks/chunk-2XY53ALL.js +0 -420
- package/dist/_node-chunks/chunk-3CBQMG2A.js +0 -6712
- package/dist/_node-chunks/chunk-3WDAPZYQ.js +0 -28
- package/dist/_node-chunks/chunk-4ZB555EJ.js +0 -697
- package/dist/_node-chunks/chunk-52DXKXY3.js +0 -4272
- package/dist/_node-chunks/chunk-5OVB4A6F.js +0 -69
- package/dist/_node-chunks/chunk-AGHGNXGH.js +0 -18
- package/dist/_node-chunks/chunk-B23X5ZCK.js +0 -1531
- package/dist/_node-chunks/chunk-B2DAHWJK.js +0 -220
- package/dist/_node-chunks/chunk-CC4PW5MJ.js +0 -34
- package/dist/_node-chunks/chunk-D7NIZELR.js +0 -2256
- package/dist/_node-chunks/chunk-DO5Q3H4L.js +0 -1250
- package/dist/_node-chunks/chunk-ECK7WVFX.js +0 -304
- package/dist/_node-chunks/chunk-EUH3NHXA.js +0 -79
- package/dist/_node-chunks/chunk-FOQHPHCV.js +0 -1657
- package/dist/_node-chunks/chunk-G6EL47NS.js +0 -111
- package/dist/_node-chunks/chunk-GFLS4TJB.js +0 -90
- package/dist/_node-chunks/chunk-J3XZKWHE.js +0 -1586
- package/dist/_node-chunks/chunk-LE63EHJ5.js +0 -1518
- package/dist/_node-chunks/chunk-M47XA42S.js +0 -4741
- package/dist/_node-chunks/chunk-OOI74AL3.js +0 -61
- package/dist/_node-chunks/chunk-PRJHT3GJ.js +0 -61
- package/dist/_node-chunks/chunk-Q52PVUSU.js +0 -101
- package/dist/_node-chunks/chunk-SDCF5RNN.js +0 -1198
- package/dist/_node-chunks/chunk-UJ5SJ23M.js +0 -5029
- package/dist/_node-chunks/chunk-UPHK4ETU.js +0 -64658
- package/dist/_node-chunks/chunk-V7VURIPB.js +0 -1544
- package/dist/_node-chunks/dist-6TXHNR5C.js +0 -175
- package/dist/_node-chunks/globby-PBTV6PX6.js +0 -5222
- package/dist/_node-chunks/lib-4RTDZVGX.js +0 -518
- package/dist/_node-chunks/mdx-N42X6CFJ-COWEH7KR.js +0 -22017
- package/dist/_node-chunks/p-limit-PBVZQOFY.js +0 -168
- package/dist/_node-chunks/plugin-EOZKYZAG.js +0 -159
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-35HMSMR5.js +0 -69102
- package/dist/_node-chunks/webpack-mock-plugin-GT3MA5E2.js +0 -124
|
@@ -0,0 +1,3214 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_843v2rliy1 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_843v2rliy1 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_843v2rliy1 from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_843v2rliy1.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_843v2rliy1.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_843v2rliy1.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
__commonJS,
|
|
14
|
+
__require
|
|
15
|
+
} from "./chunk-XGVLB4UJ.js";
|
|
16
|
+
|
|
17
|
+
// ../node_modules/kleur/index.js
|
|
18
|
+
var require_kleur = __commonJS({
|
|
19
|
+
"../node_modules/kleur/index.js"(exports, module) {
|
|
20
|
+
"use strict";
|
|
21
|
+
var { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env, $ = {
|
|
22
|
+
enabled: !NODE_DISABLE_COLORS && TERM !== "dumb" && FORCE_COLOR !== "0",
|
|
23
|
+
// modifiers
|
|
24
|
+
reset: init(0, 0),
|
|
25
|
+
bold: init(1, 22),
|
|
26
|
+
dim: init(2, 22),
|
|
27
|
+
italic: init(3, 23),
|
|
28
|
+
underline: init(4, 24),
|
|
29
|
+
inverse: init(7, 27),
|
|
30
|
+
hidden: init(8, 28),
|
|
31
|
+
strikethrough: init(9, 29),
|
|
32
|
+
// colors
|
|
33
|
+
black: init(30, 39),
|
|
34
|
+
red: init(31, 39),
|
|
35
|
+
green: init(32, 39),
|
|
36
|
+
yellow: init(33, 39),
|
|
37
|
+
blue: init(34, 39),
|
|
38
|
+
magenta: init(35, 39),
|
|
39
|
+
cyan: init(36, 39),
|
|
40
|
+
white: init(37, 39),
|
|
41
|
+
gray: init(90, 39),
|
|
42
|
+
grey: init(90, 39),
|
|
43
|
+
// background colors
|
|
44
|
+
bgBlack: init(40, 49),
|
|
45
|
+
bgRed: init(41, 49),
|
|
46
|
+
bgGreen: init(42, 49),
|
|
47
|
+
bgYellow: init(43, 49),
|
|
48
|
+
bgBlue: init(44, 49),
|
|
49
|
+
bgMagenta: init(45, 49),
|
|
50
|
+
bgCyan: init(46, 49),
|
|
51
|
+
bgWhite: init(47, 49)
|
|
52
|
+
};
|
|
53
|
+
function run(arr, str) {
|
|
54
|
+
let i = 0, tmp, beg = "", end = "";
|
|
55
|
+
for (; i < arr.length; i++)
|
|
56
|
+
tmp = arr[i], beg += tmp.open, end += tmp.close, str.includes(tmp.close) && (str = str.replace(tmp.rgx, tmp.close + tmp.open));
|
|
57
|
+
return beg + str + end;
|
|
58
|
+
}
|
|
59
|
+
function chain(has, keys) {
|
|
60
|
+
let ctx = { has, keys };
|
|
61
|
+
return ctx.reset = $.reset.bind(ctx), ctx.bold = $.bold.bind(ctx), ctx.dim = $.dim.bind(ctx), ctx.italic = $.italic.bind(ctx), ctx.underline = $.underline.bind(ctx), ctx.inverse = $.inverse.bind(ctx), ctx.hidden = $.hidden.bind(ctx), ctx.strikethrough = $.strikethrough.bind(ctx), ctx.black = $.black.bind(ctx), ctx.red = $.red.bind(ctx), ctx.green = $.green.bind(ctx), ctx.yellow = $.yellow.bind(ctx), ctx.blue = $.blue.bind(ctx), ctx.magenta = $.magenta.bind(ctx), ctx.cyan = $.cyan.bind(ctx), ctx.white = $.white.bind(ctx), ctx.gray = $.gray.bind(ctx), ctx.grey = $.grey.bind(ctx), ctx.bgBlack = $.bgBlack.bind(ctx), ctx.bgRed = $.bgRed.bind(ctx), ctx.bgGreen = $.bgGreen.bind(ctx), ctx.bgYellow = $.bgYellow.bind(ctx), ctx.bgBlue = $.bgBlue.bind(ctx), ctx.bgMagenta = $.bgMagenta.bind(ctx), ctx.bgCyan = $.bgCyan.bind(ctx), ctx.bgWhite = $.bgWhite.bind(ctx), ctx;
|
|
62
|
+
}
|
|
63
|
+
function init(open, close) {
|
|
64
|
+
let blk = {
|
|
65
|
+
open: `\x1B[${open}m`,
|
|
66
|
+
close: `\x1B[${close}m`,
|
|
67
|
+
rgx: new RegExp(`\\x1b\\[${close}m`, "g")
|
|
68
|
+
};
|
|
69
|
+
return function(txt) {
|
|
70
|
+
return this !== void 0 && this.has !== void 0 ? (this.has.includes(open) || (this.has.push(open), this.keys.push(blk)), txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "") : txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
module.exports = $;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// ../node_modules/prompts/dist/util/action.js
|
|
78
|
+
var require_action = __commonJS({
|
|
79
|
+
"../node_modules/prompts/dist/util/action.js"(exports, module) {
|
|
80
|
+
"use strict";
|
|
81
|
+
module.exports = (key, isSelect) => {
|
|
82
|
+
if (!(key.meta && key.name !== "escape")) {
|
|
83
|
+
if (key.ctrl) {
|
|
84
|
+
if (key.name === "a") return "first";
|
|
85
|
+
if (key.name === "c" || key.name === "d") return "abort";
|
|
86
|
+
if (key.name === "e") return "last";
|
|
87
|
+
if (key.name === "g") return "reset";
|
|
88
|
+
}
|
|
89
|
+
if (isSelect) {
|
|
90
|
+
if (key.name === "j") return "down";
|
|
91
|
+
if (key.name === "k") return "up";
|
|
92
|
+
}
|
|
93
|
+
return key.name === "return" || key.name === "enter" ? "submit" : key.name === "backspace" ? "delete" : key.name === "delete" ? "deleteForward" : key.name === "abort" ? "abort" : key.name === "escape" ? "exit" : key.name === "tab" ? "next" : key.name === "pagedown" ? "nextPage" : key.name === "pageup" ? "prevPage" : key.name === "home" ? "home" : key.name === "end" ? "end" : key.name === "up" ? "up" : key.name === "down" ? "down" : key.name === "right" ? "right" : key.name === "left" ? "left" : !1;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// ../node_modules/prompts/dist/util/strip.js
|
|
100
|
+
var require_strip = __commonJS({
|
|
101
|
+
"../node_modules/prompts/dist/util/strip.js"(exports, module) {
|
|
102
|
+
"use strict";
|
|
103
|
+
module.exports = (str) => {
|
|
104
|
+
let pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"), RGX = new RegExp(pattern, "g");
|
|
105
|
+
return typeof str == "string" ? str.replace(RGX, "") : str;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// ../node_modules/sisteransi/src/index.js
|
|
111
|
+
var require_src = __commonJS({
|
|
112
|
+
"../node_modules/sisteransi/src/index.js"(exports, module) {
|
|
113
|
+
"use strict";
|
|
114
|
+
var cursor = {
|
|
115
|
+
to(x, y) {
|
|
116
|
+
return y ? `\x1B[${y + 1};${x + 1}H` : `\x1B[${x + 1}G`;
|
|
117
|
+
},
|
|
118
|
+
move(x, y) {
|
|
119
|
+
let ret = "";
|
|
120
|
+
return x < 0 ? ret += `\x1B[${-x}D` : x > 0 && (ret += `\x1B[${x}C`), y < 0 ? ret += `\x1B[${-y}A` : y > 0 && (ret += `\x1B[${y}B`), ret;
|
|
121
|
+
},
|
|
122
|
+
up: (count = 1) => `\x1B[${count}A`,
|
|
123
|
+
down: (count = 1) => `\x1B[${count}B`,
|
|
124
|
+
forward: (count = 1) => `\x1B[${count}C`,
|
|
125
|
+
backward: (count = 1) => `\x1B[${count}D`,
|
|
126
|
+
nextLine: (count = 1) => "\x1B[E".repeat(count),
|
|
127
|
+
prevLine: (count = 1) => "\x1B[F".repeat(count),
|
|
128
|
+
left: "\x1B[G",
|
|
129
|
+
hide: "\x1B[?25l",
|
|
130
|
+
show: "\x1B[?25h",
|
|
131
|
+
save: "\x1B7",
|
|
132
|
+
restore: "\x1B8"
|
|
133
|
+
}, scroll = {
|
|
134
|
+
up: (count = 1) => "\x1B[S".repeat(count),
|
|
135
|
+
down: (count = 1) => "\x1B[T".repeat(count)
|
|
136
|
+
}, erase = {
|
|
137
|
+
screen: "\x1B[2J",
|
|
138
|
+
up: (count = 1) => "\x1B[1J".repeat(count),
|
|
139
|
+
down: (count = 1) => "\x1B[J".repeat(count),
|
|
140
|
+
line: "\x1B[2K",
|
|
141
|
+
lineEnd: "\x1B[K",
|
|
142
|
+
lineStart: "\x1B[1K",
|
|
143
|
+
lines(count) {
|
|
144
|
+
let clear = "";
|
|
145
|
+
for (let i = 0; i < count; i++)
|
|
146
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
147
|
+
return count && (clear += cursor.left), clear;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
module.exports = { cursor, scroll, erase, beep: "\x07" };
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// ../node_modules/prompts/dist/util/clear.js
|
|
155
|
+
var require_clear = __commonJS({
|
|
156
|
+
"../node_modules/prompts/dist/util/clear.js"(exports, module) {
|
|
157
|
+
"use strict";
|
|
158
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
159
|
+
var it = typeof Symbol < "u" && o[Symbol.iterator] || o["@@iterator"];
|
|
160
|
+
if (!it) {
|
|
161
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length == "number") {
|
|
162
|
+
it && (o = it);
|
|
163
|
+
var i = 0, F = function() {
|
|
164
|
+
};
|
|
165
|
+
return { s: F, n: function() {
|
|
166
|
+
return i >= o.length ? { done: !0 } : { done: !1, value: o[i++] };
|
|
167
|
+
}, e: function(_e) {
|
|
168
|
+
throw _e;
|
|
169
|
+
}, f: F };
|
|
170
|
+
}
|
|
171
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
172
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
173
|
+
}
|
|
174
|
+
var normalCompletion = !0, didErr = !1, err;
|
|
175
|
+
return { s: function() {
|
|
176
|
+
it = it.call(o);
|
|
177
|
+
}, n: function() {
|
|
178
|
+
var step = it.next();
|
|
179
|
+
return normalCompletion = step.done, step;
|
|
180
|
+
}, e: function(_e2) {
|
|
181
|
+
didErr = !0, err = _e2;
|
|
182
|
+
}, f: function() {
|
|
183
|
+
try {
|
|
184
|
+
!normalCompletion && it.return != null && it.return();
|
|
185
|
+
} finally {
|
|
186
|
+
if (didErr) throw err;
|
|
187
|
+
}
|
|
188
|
+
} };
|
|
189
|
+
}
|
|
190
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
191
|
+
if (o) {
|
|
192
|
+
if (typeof o == "string") return _arrayLikeToArray(o, minLen);
|
|
193
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
194
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(o);
|
|
195
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function _arrayLikeToArray(arr, len) {
|
|
199
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
200
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
201
|
+
return arr2;
|
|
202
|
+
}
|
|
203
|
+
var strip = require_strip(), _require = require_src(), erase = _require.erase, cursor = _require.cursor, width = (str) => [...strip(str)].length;
|
|
204
|
+
module.exports = function(prompt, perLine) {
|
|
205
|
+
if (!perLine) return erase.line + cursor.to(0);
|
|
206
|
+
let rows = 0, lines = prompt.split(/\r?\n/);
|
|
207
|
+
var _iterator = _createForOfIteratorHelper(lines), _step;
|
|
208
|
+
try {
|
|
209
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
210
|
+
let line = _step.value;
|
|
211
|
+
rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
|
|
212
|
+
}
|
|
213
|
+
} catch (err) {
|
|
214
|
+
_iterator.e(err);
|
|
215
|
+
} finally {
|
|
216
|
+
_iterator.f();
|
|
217
|
+
}
|
|
218
|
+
return erase.lines(rows);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// ../node_modules/prompts/dist/util/figures.js
|
|
224
|
+
var require_figures = __commonJS({
|
|
225
|
+
"../node_modules/prompts/dist/util/figures.js"(exports, module) {
|
|
226
|
+
"use strict";
|
|
227
|
+
var main = {
|
|
228
|
+
arrowUp: "\u2191",
|
|
229
|
+
arrowDown: "\u2193",
|
|
230
|
+
arrowLeft: "\u2190",
|
|
231
|
+
arrowRight: "\u2192",
|
|
232
|
+
radioOn: "\u25C9",
|
|
233
|
+
radioOff: "\u25EF",
|
|
234
|
+
tick: "\u2714",
|
|
235
|
+
cross: "\u2716",
|
|
236
|
+
ellipsis: "\u2026",
|
|
237
|
+
pointerSmall: "\u203A",
|
|
238
|
+
line: "\u2500",
|
|
239
|
+
pointer: "\u276F"
|
|
240
|
+
}, win = {
|
|
241
|
+
arrowUp: main.arrowUp,
|
|
242
|
+
arrowDown: main.arrowDown,
|
|
243
|
+
arrowLeft: main.arrowLeft,
|
|
244
|
+
arrowRight: main.arrowRight,
|
|
245
|
+
radioOn: "(*)",
|
|
246
|
+
radioOff: "( )",
|
|
247
|
+
tick: "\u221A",
|
|
248
|
+
cross: "\xD7",
|
|
249
|
+
ellipsis: "...",
|
|
250
|
+
pointerSmall: "\xBB",
|
|
251
|
+
line: "\u2500",
|
|
252
|
+
pointer: ">"
|
|
253
|
+
}, figures = process.platform === "win32" ? win : main;
|
|
254
|
+
module.exports = figures;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// ../node_modules/prompts/dist/util/style.js
|
|
259
|
+
var require_style = __commonJS({
|
|
260
|
+
"../node_modules/prompts/dist/util/style.js"(exports, module) {
|
|
261
|
+
"use strict";
|
|
262
|
+
var c = require_kleur(), figures = require_figures(), styles = Object.freeze({
|
|
263
|
+
password: {
|
|
264
|
+
scale: 1,
|
|
265
|
+
render: (input) => "*".repeat(input.length)
|
|
266
|
+
},
|
|
267
|
+
emoji: {
|
|
268
|
+
scale: 2,
|
|
269
|
+
render: (input) => "\u{1F603}".repeat(input.length)
|
|
270
|
+
},
|
|
271
|
+
invisible: {
|
|
272
|
+
scale: 0,
|
|
273
|
+
render: (input) => ""
|
|
274
|
+
},
|
|
275
|
+
default: {
|
|
276
|
+
scale: 1,
|
|
277
|
+
render: (input) => `${input}`
|
|
278
|
+
}
|
|
279
|
+
}), render = (type) => styles[type] || styles.default, symbols = Object.freeze({
|
|
280
|
+
aborted: c.red(figures.cross),
|
|
281
|
+
done: c.green(figures.tick),
|
|
282
|
+
exited: c.yellow(figures.cross),
|
|
283
|
+
default: c.cyan("?")
|
|
284
|
+
}), symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default, delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall), item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
|
|
285
|
+
module.exports = {
|
|
286
|
+
styles,
|
|
287
|
+
render,
|
|
288
|
+
symbols,
|
|
289
|
+
symbol,
|
|
290
|
+
delimiter,
|
|
291
|
+
item
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// ../node_modules/prompts/dist/util/lines.js
|
|
297
|
+
var require_lines = __commonJS({
|
|
298
|
+
"../node_modules/prompts/dist/util/lines.js"(exports, module) {
|
|
299
|
+
"use strict";
|
|
300
|
+
var strip = require_strip();
|
|
301
|
+
module.exports = function(msg, perLine) {
|
|
302
|
+
let lines = String(strip(msg) || "").split(/\r?\n/);
|
|
303
|
+
return perLine ? lines.map((l) => Math.ceil(l.length / perLine)).reduce((a, b) => a + b) : lines.length;
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
// ../node_modules/prompts/dist/util/wrap.js
|
|
309
|
+
var require_wrap = __commonJS({
|
|
310
|
+
"../node_modules/prompts/dist/util/wrap.js"(exports, module) {
|
|
311
|
+
"use strict";
|
|
312
|
+
module.exports = (msg, opts = {}) => {
|
|
313
|
+
let tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(" ").join("") : opts.margin || "", width = opts.width;
|
|
314
|
+
return (msg || "").split(/\r?\n/g).map((line) => line.split(/\s+/g).reduce((arr, w) => (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width ? arr[arr.length - 1] += ` ${w}` : arr.push(`${tab}${w}`), arr), [tab]).join(`
|
|
315
|
+
`)).join(`
|
|
316
|
+
`);
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// ../node_modules/prompts/dist/util/entriesToDisplay.js
|
|
322
|
+
var require_entriesToDisplay = __commonJS({
|
|
323
|
+
"../node_modules/prompts/dist/util/entriesToDisplay.js"(exports, module) {
|
|
324
|
+
"use strict";
|
|
325
|
+
module.exports = (cursor, total, maxVisible) => {
|
|
326
|
+
maxVisible = maxVisible || total;
|
|
327
|
+
let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
|
|
328
|
+
startIndex < 0 && (startIndex = 0);
|
|
329
|
+
let endIndex = Math.min(startIndex + maxVisible, total);
|
|
330
|
+
return {
|
|
331
|
+
startIndex,
|
|
332
|
+
endIndex
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
// ../node_modules/prompts/dist/util/index.js
|
|
339
|
+
var require_util = __commonJS({
|
|
340
|
+
"../node_modules/prompts/dist/util/index.js"(exports, module) {
|
|
341
|
+
"use strict";
|
|
342
|
+
module.exports = {
|
|
343
|
+
action: require_action(),
|
|
344
|
+
clear: require_clear(),
|
|
345
|
+
style: require_style(),
|
|
346
|
+
strip: require_strip(),
|
|
347
|
+
figures: require_figures(),
|
|
348
|
+
lines: require_lines(),
|
|
349
|
+
wrap: require_wrap(),
|
|
350
|
+
entriesToDisplay: require_entriesToDisplay()
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// ../node_modules/prompts/dist/elements/prompt.js
|
|
356
|
+
var require_prompt = __commonJS({
|
|
357
|
+
"../node_modules/prompts/dist/elements/prompt.js"(exports, module) {
|
|
358
|
+
"use strict";
|
|
359
|
+
var readline = __require("readline"), _require = require_util(), action = _require.action, EventEmitter = __require("events"), _require2 = require_src(), beep = _require2.beep, cursor = _require2.cursor, color = require_kleur(), Prompt = class extends EventEmitter {
|
|
360
|
+
constructor(opts = {}) {
|
|
361
|
+
super(), this.firstRender = !0, this.in = opts.stdin || process.stdin, this.out = opts.stdout || process.stdout, this.onRender = (opts.onRender || (() => {
|
|
362
|
+
})).bind(this);
|
|
363
|
+
let rl = readline.createInterface({
|
|
364
|
+
input: this.in,
|
|
365
|
+
escapeCodeTimeout: 50
|
|
366
|
+
});
|
|
367
|
+
readline.emitKeypressEvents(this.in, rl), this.in.isTTY && this.in.setRawMode(!0);
|
|
368
|
+
let isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1, keypress = (str, key) => {
|
|
369
|
+
let a = action(key, isSelect);
|
|
370
|
+
a === !1 ? this._ && this._(str, key) : typeof this[a] == "function" ? this[a](key) : this.bell();
|
|
371
|
+
};
|
|
372
|
+
this.close = () => {
|
|
373
|
+
this.out.write(cursor.show), this.in.removeListener("keypress", keypress), this.in.isTTY && this.in.setRawMode(!1), rl.close(), this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value), this.closed = !0;
|
|
374
|
+
}, this.in.on("keypress", keypress);
|
|
375
|
+
}
|
|
376
|
+
fire() {
|
|
377
|
+
this.emit("state", {
|
|
378
|
+
value: this.value,
|
|
379
|
+
aborted: !!this.aborted,
|
|
380
|
+
exited: !!this.exited
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
bell() {
|
|
384
|
+
this.out.write(beep);
|
|
385
|
+
}
|
|
386
|
+
render() {
|
|
387
|
+
this.onRender(color), this.firstRender && (this.firstRender = !1);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
module.exports = Prompt;
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
// ../node_modules/prompts/dist/elements/text.js
|
|
395
|
+
var require_text = __commonJS({
|
|
396
|
+
"../node_modules/prompts/dist/elements/text.js"(exports, module) {
|
|
397
|
+
"use strict";
|
|
398
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
399
|
+
try {
|
|
400
|
+
var info = gen[key](arg), value = info.value;
|
|
401
|
+
} catch (error) {
|
|
402
|
+
reject(error);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
|
|
406
|
+
}
|
|
407
|
+
function _asyncToGenerator(fn) {
|
|
408
|
+
return function() {
|
|
409
|
+
var self = this, args = arguments;
|
|
410
|
+
return new Promise(function(resolve, reject) {
|
|
411
|
+
var gen = fn.apply(self, args);
|
|
412
|
+
function _next(value) {
|
|
413
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
414
|
+
}
|
|
415
|
+
function _throw(err) {
|
|
416
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
417
|
+
}
|
|
418
|
+
_next(void 0);
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
var color = require_kleur(), Prompt = require_prompt(), _require = require_src(), erase = _require.erase, cursor = _require.cursor, _require2 = require_util(), style = _require2.style, clear = _require2.clear, lines = _require2.lines, figures = _require2.figures, TextPrompt = class extends Prompt {
|
|
423
|
+
constructor(opts = {}) {
|
|
424
|
+
super(opts), this.transform = style.render(opts.style), this.scale = this.transform.scale, this.msg = opts.message, this.initial = opts.initial || "", this.validator = opts.validate || (() => !0), this.value = "", this.errorMsg = opts.error || "Please Enter A Valid Value", this.cursor = +!!this.initial, this.cursorOffset = 0, this.clear = clear("", this.out.columns), this.render();
|
|
425
|
+
}
|
|
426
|
+
set value(v) {
|
|
427
|
+
!v && this.initial ? (this.placeholder = !0, this.rendered = color.gray(this.transform.render(this.initial))) : (this.placeholder = !1, this.rendered = this.transform.render(v)), this._value = v, this.fire();
|
|
428
|
+
}
|
|
429
|
+
get value() {
|
|
430
|
+
return this._value;
|
|
431
|
+
}
|
|
432
|
+
reset() {
|
|
433
|
+
this.value = "", this.cursor = +!!this.initial, this.cursorOffset = 0, this.fire(), this.render();
|
|
434
|
+
}
|
|
435
|
+
exit() {
|
|
436
|
+
this.abort();
|
|
437
|
+
}
|
|
438
|
+
abort() {
|
|
439
|
+
this.value = this.value || this.initial, this.done = this.aborted = !0, this.error = !1, this.red = !1, this.fire(), this.render(), this.out.write(`
|
|
440
|
+
`), this.close();
|
|
441
|
+
}
|
|
442
|
+
validate() {
|
|
443
|
+
var _this = this;
|
|
444
|
+
return _asyncToGenerator(function* () {
|
|
445
|
+
let valid = yield _this.validator(_this.value);
|
|
446
|
+
typeof valid == "string" && (_this.errorMsg = valid, valid = !1), _this.error = !valid;
|
|
447
|
+
})();
|
|
448
|
+
}
|
|
449
|
+
submit() {
|
|
450
|
+
var _this2 = this;
|
|
451
|
+
return _asyncToGenerator(function* () {
|
|
452
|
+
if (_this2.value = _this2.value || _this2.initial, _this2.cursorOffset = 0, _this2.cursor = _this2.rendered.length, yield _this2.validate(), _this2.error) {
|
|
453
|
+
_this2.red = !0, _this2.fire(), _this2.render();
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
_this2.done = !0, _this2.aborted = !1, _this2.fire(), _this2.render(), _this2.out.write(`
|
|
457
|
+
`), _this2.close();
|
|
458
|
+
})();
|
|
459
|
+
}
|
|
460
|
+
next() {
|
|
461
|
+
if (!this.placeholder) return this.bell();
|
|
462
|
+
this.value = this.initial, this.cursor = this.rendered.length, this.fire(), this.render();
|
|
463
|
+
}
|
|
464
|
+
moveCursor(n) {
|
|
465
|
+
this.placeholder || (this.cursor = this.cursor + n, this.cursorOffset += n);
|
|
466
|
+
}
|
|
467
|
+
_(c, key) {
|
|
468
|
+
let s1 = this.value.slice(0, this.cursor), s2 = this.value.slice(this.cursor);
|
|
469
|
+
this.value = `${s1}${c}${s2}`, this.red = !1, this.cursor = this.placeholder ? 0 : s1.length + 1, this.render();
|
|
470
|
+
}
|
|
471
|
+
delete() {
|
|
472
|
+
if (this.isCursorAtStart()) return this.bell();
|
|
473
|
+
let s1 = this.value.slice(0, this.cursor - 1), s2 = this.value.slice(this.cursor);
|
|
474
|
+
this.value = `${s1}${s2}`, this.red = !1, this.isCursorAtStart() ? this.cursorOffset = 0 : (this.cursorOffset++, this.moveCursor(-1)), this.render();
|
|
475
|
+
}
|
|
476
|
+
deleteForward() {
|
|
477
|
+
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
|
|
478
|
+
let s1 = this.value.slice(0, this.cursor), s2 = this.value.slice(this.cursor + 1);
|
|
479
|
+
this.value = `${s1}${s2}`, this.red = !1, this.isCursorAtEnd() ? this.cursorOffset = 0 : this.cursorOffset++, this.render();
|
|
480
|
+
}
|
|
481
|
+
first() {
|
|
482
|
+
this.cursor = 0, this.render();
|
|
483
|
+
}
|
|
484
|
+
last() {
|
|
485
|
+
this.cursor = this.value.length, this.render();
|
|
486
|
+
}
|
|
487
|
+
left() {
|
|
488
|
+
if (this.cursor <= 0 || this.placeholder) return this.bell();
|
|
489
|
+
this.moveCursor(-1), this.render();
|
|
490
|
+
}
|
|
491
|
+
right() {
|
|
492
|
+
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
|
|
493
|
+
this.moveCursor(1), this.render();
|
|
494
|
+
}
|
|
495
|
+
isCursorAtStart() {
|
|
496
|
+
return this.cursor === 0 || this.placeholder && this.cursor === 1;
|
|
497
|
+
}
|
|
498
|
+
isCursorAtEnd() {
|
|
499
|
+
return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
|
|
500
|
+
}
|
|
501
|
+
render() {
|
|
502
|
+
this.closed || (this.firstRender || (this.outputError && this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns)), this.out.write(clear(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(" "), this.error && (this.outputError += this.errorMsg.split(`
|
|
503
|
+
`).reduce((a, l, i) => a + `
|
|
504
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, "")), this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0)));
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
module.exports = TextPrompt;
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
// ../node_modules/prompts/dist/elements/select.js
|
|
512
|
+
var require_select = __commonJS({
|
|
513
|
+
"../node_modules/prompts/dist/elements/select.js"(exports, module) {
|
|
514
|
+
"use strict";
|
|
515
|
+
var color = require_kleur(), Prompt = require_prompt(), _require = require_util(), style = _require.style, clear = _require.clear, figures = _require.figures, wrap = _require.wrap, entriesToDisplay = _require.entriesToDisplay, _require2 = require_src(), cursor = _require2.cursor, SelectPrompt = class extends Prompt {
|
|
516
|
+
constructor(opts = {}) {
|
|
517
|
+
super(opts), this.msg = opts.message, this.hint = opts.hint || "- Use arrow-keys. Return to submit.", this.warn = opts.warn || "- This option is disabled", this.cursor = opts.initial || 0, this.choices = opts.choices.map((ch, idx) => (typeof ch == "string" && (ch = {
|
|
518
|
+
title: ch,
|
|
519
|
+
value: idx
|
|
520
|
+
}), {
|
|
521
|
+
title: ch && (ch.title || ch.value || ch),
|
|
522
|
+
value: ch && (ch.value === void 0 ? idx : ch.value),
|
|
523
|
+
description: ch && ch.description,
|
|
524
|
+
selected: ch && ch.selected,
|
|
525
|
+
disabled: ch && ch.disabled
|
|
526
|
+
})), this.optionsPerPage = opts.optionsPerPage || 10, this.value = (this.choices[this.cursor] || {}).value, this.clear = clear("", this.out.columns), this.render();
|
|
527
|
+
}
|
|
528
|
+
moveCursor(n) {
|
|
529
|
+
this.cursor = n, this.value = this.choices[n].value, this.fire();
|
|
530
|
+
}
|
|
531
|
+
reset() {
|
|
532
|
+
this.moveCursor(0), this.fire(), this.render();
|
|
533
|
+
}
|
|
534
|
+
exit() {
|
|
535
|
+
this.abort();
|
|
536
|
+
}
|
|
537
|
+
abort() {
|
|
538
|
+
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
|
|
539
|
+
`), this.close();
|
|
540
|
+
}
|
|
541
|
+
submit() {
|
|
542
|
+
this.selection.disabled ? this.bell() : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
543
|
+
`), this.close());
|
|
544
|
+
}
|
|
545
|
+
first() {
|
|
546
|
+
this.moveCursor(0), this.render();
|
|
547
|
+
}
|
|
548
|
+
last() {
|
|
549
|
+
this.moveCursor(this.choices.length - 1), this.render();
|
|
550
|
+
}
|
|
551
|
+
up() {
|
|
552
|
+
this.cursor === 0 ? this.moveCursor(this.choices.length - 1) : this.moveCursor(this.cursor - 1), this.render();
|
|
553
|
+
}
|
|
554
|
+
down() {
|
|
555
|
+
this.cursor === this.choices.length - 1 ? this.moveCursor(0) : this.moveCursor(this.cursor + 1), this.render();
|
|
556
|
+
}
|
|
557
|
+
next() {
|
|
558
|
+
this.moveCursor((this.cursor + 1) % this.choices.length), this.render();
|
|
559
|
+
}
|
|
560
|
+
_(c, key) {
|
|
561
|
+
if (c === " ") return this.submit();
|
|
562
|
+
}
|
|
563
|
+
get selection() {
|
|
564
|
+
return this.choices[this.cursor];
|
|
565
|
+
}
|
|
566
|
+
render() {
|
|
567
|
+
if (this.closed) return;
|
|
568
|
+
this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render();
|
|
569
|
+
let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
570
|
+
if (this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(!1), this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)].join(" "), !this.done) {
|
|
571
|
+
this.outputText += `
|
|
572
|
+
`;
|
|
573
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
574
|
+
let title, prefix, desc = "", v = this.choices[i];
|
|
575
|
+
i === startIndex && startIndex > 0 ? prefix = figures.arrowUp : i === endIndex - 1 && endIndex < this.choices.length ? prefix = figures.arrowDown : prefix = " ", v.disabled ? (title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title), prefix = (this.cursor === i ? color.bold().gray(figures.pointer) + " " : " ") + prefix) : (title = this.cursor === i ? color.cyan().underline(v.title) : v.title, prefix = (this.cursor === i ? color.cyan(figures.pointer) + " " : " ") + prefix, v.description && this.cursor === i && (desc = ` - ${v.description}`, (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) && (desc = `
|
|
576
|
+
` + wrap(v.description, {
|
|
577
|
+
margin: 3,
|
|
578
|
+
width: this.out.columns
|
|
579
|
+
})))), this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
580
|
+
`;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
this.out.write(this.outputText);
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
module.exports = SelectPrompt;
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
// ../node_modules/prompts/dist/elements/toggle.js
|
|
591
|
+
var require_toggle = __commonJS({
|
|
592
|
+
"../node_modules/prompts/dist/elements/toggle.js"(exports, module) {
|
|
593
|
+
"use strict";
|
|
594
|
+
var color = require_kleur(), Prompt = require_prompt(), _require = require_util(), style = _require.style, clear = _require.clear, _require2 = require_src(), cursor = _require2.cursor, erase = _require2.erase, TogglePrompt = class extends Prompt {
|
|
595
|
+
constructor(opts = {}) {
|
|
596
|
+
super(opts), this.msg = opts.message, this.value = !!opts.initial, this.active = opts.active || "on", this.inactive = opts.inactive || "off", this.initialValue = this.value, this.render();
|
|
597
|
+
}
|
|
598
|
+
reset() {
|
|
599
|
+
this.value = this.initialValue, this.fire(), this.render();
|
|
600
|
+
}
|
|
601
|
+
exit() {
|
|
602
|
+
this.abort();
|
|
603
|
+
}
|
|
604
|
+
abort() {
|
|
605
|
+
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
|
|
606
|
+
`), this.close();
|
|
607
|
+
}
|
|
608
|
+
submit() {
|
|
609
|
+
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
610
|
+
`), this.close();
|
|
611
|
+
}
|
|
612
|
+
deactivate() {
|
|
613
|
+
if (this.value === !1) return this.bell();
|
|
614
|
+
this.value = !1, this.render();
|
|
615
|
+
}
|
|
616
|
+
activate() {
|
|
617
|
+
if (this.value === !0) return this.bell();
|
|
618
|
+
this.value = !0, this.render();
|
|
619
|
+
}
|
|
620
|
+
delete() {
|
|
621
|
+
this.deactivate();
|
|
622
|
+
}
|
|
623
|
+
left() {
|
|
624
|
+
this.deactivate();
|
|
625
|
+
}
|
|
626
|
+
right() {
|
|
627
|
+
this.activate();
|
|
628
|
+
}
|
|
629
|
+
down() {
|
|
630
|
+
this.deactivate();
|
|
631
|
+
}
|
|
632
|
+
up() {
|
|
633
|
+
this.activate();
|
|
634
|
+
}
|
|
635
|
+
next() {
|
|
636
|
+
this.value = !this.value, this.fire(), this.render();
|
|
637
|
+
}
|
|
638
|
+
_(c, key) {
|
|
639
|
+
if (c === " ")
|
|
640
|
+
this.value = !this.value;
|
|
641
|
+
else if (c === "1")
|
|
642
|
+
this.value = !0;
|
|
643
|
+
else if (c === "0")
|
|
644
|
+
this.value = !1;
|
|
645
|
+
else return this.bell();
|
|
646
|
+
this.render();
|
|
647
|
+
}
|
|
648
|
+
render() {
|
|
649
|
+
this.closed || (this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render(), this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.value ? this.inactive : color.cyan().underline(this.inactive), color.gray("/"), this.value ? color.cyan().underline(this.active) : this.active].join(" "), this.out.write(erase.line + cursor.to(0) + this.outputText));
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
module.exports = TogglePrompt;
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
// ../node_modules/prompts/dist/dateparts/datepart.js
|
|
657
|
+
var require_datepart = __commonJS({
|
|
658
|
+
"../node_modules/prompts/dist/dateparts/datepart.js"(exports, module) {
|
|
659
|
+
"use strict";
|
|
660
|
+
var DatePart = class _DatePart {
|
|
661
|
+
constructor({
|
|
662
|
+
token,
|
|
663
|
+
date,
|
|
664
|
+
parts,
|
|
665
|
+
locales
|
|
666
|
+
}) {
|
|
667
|
+
this.token = token, this.date = date || /* @__PURE__ */ new Date(), this.parts = parts || [this], this.locales = locales || {};
|
|
668
|
+
}
|
|
669
|
+
up() {
|
|
670
|
+
}
|
|
671
|
+
down() {
|
|
672
|
+
}
|
|
673
|
+
next() {
|
|
674
|
+
let currentIdx = this.parts.indexOf(this);
|
|
675
|
+
return this.parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
|
|
676
|
+
}
|
|
677
|
+
setTo(val) {
|
|
678
|
+
}
|
|
679
|
+
prev() {
|
|
680
|
+
let parts = [].concat(this.parts).reverse(), currentIdx = parts.indexOf(this);
|
|
681
|
+
return parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
|
|
682
|
+
}
|
|
683
|
+
toString() {
|
|
684
|
+
return String(this.date);
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
module.exports = DatePart;
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
// ../node_modules/prompts/dist/dateparts/meridiem.js
|
|
692
|
+
var require_meridiem = __commonJS({
|
|
693
|
+
"../node_modules/prompts/dist/dateparts/meridiem.js"(exports, module) {
|
|
694
|
+
"use strict";
|
|
695
|
+
var DatePart = require_datepart(), Meridiem = class extends DatePart {
|
|
696
|
+
constructor(opts = {}) {
|
|
697
|
+
super(opts);
|
|
698
|
+
}
|
|
699
|
+
up() {
|
|
700
|
+
this.date.setHours((this.date.getHours() + 12) % 24);
|
|
701
|
+
}
|
|
702
|
+
down() {
|
|
703
|
+
this.up();
|
|
704
|
+
}
|
|
705
|
+
toString() {
|
|
706
|
+
let meridiem = this.date.getHours() > 12 ? "pm" : "am";
|
|
707
|
+
return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
module.exports = Meridiem;
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
// ../node_modules/prompts/dist/dateparts/day.js
|
|
715
|
+
var require_day = __commonJS({
|
|
716
|
+
"../node_modules/prompts/dist/dateparts/day.js"(exports, module) {
|
|
717
|
+
"use strict";
|
|
718
|
+
var DatePart = require_datepart(), pos = (n) => (n = n % 10, n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th"), Day = class extends DatePart {
|
|
719
|
+
constructor(opts = {}) {
|
|
720
|
+
super(opts);
|
|
721
|
+
}
|
|
722
|
+
up() {
|
|
723
|
+
this.date.setDate(this.date.getDate() + 1);
|
|
724
|
+
}
|
|
725
|
+
down() {
|
|
726
|
+
this.date.setDate(this.date.getDate() - 1);
|
|
727
|
+
}
|
|
728
|
+
setTo(val) {
|
|
729
|
+
this.date.setDate(parseInt(val.substr(-2)));
|
|
730
|
+
}
|
|
731
|
+
toString() {
|
|
732
|
+
let date = this.date.getDate(), day = this.date.getDay();
|
|
733
|
+
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;
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
module.exports = Day;
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
// ../node_modules/prompts/dist/dateparts/hours.js
|
|
741
|
+
var require_hours = __commonJS({
|
|
742
|
+
"../node_modules/prompts/dist/dateparts/hours.js"(exports, module) {
|
|
743
|
+
"use strict";
|
|
744
|
+
var DatePart = require_datepart(), Hours = class extends DatePart {
|
|
745
|
+
constructor(opts = {}) {
|
|
746
|
+
super(opts);
|
|
747
|
+
}
|
|
748
|
+
up() {
|
|
749
|
+
this.date.setHours(this.date.getHours() + 1);
|
|
750
|
+
}
|
|
751
|
+
down() {
|
|
752
|
+
this.date.setHours(this.date.getHours() - 1);
|
|
753
|
+
}
|
|
754
|
+
setTo(val) {
|
|
755
|
+
this.date.setHours(parseInt(val.substr(-2)));
|
|
756
|
+
}
|
|
757
|
+
toString() {
|
|
758
|
+
let hours = this.date.getHours();
|
|
759
|
+
return /h/.test(this.token) && (hours = hours % 12 || 12), this.token.length > 1 ? String(hours).padStart(2, "0") : hours;
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
module.exports = Hours;
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
// ../node_modules/prompts/dist/dateparts/milliseconds.js
|
|
767
|
+
var require_milliseconds = __commonJS({
|
|
768
|
+
"../node_modules/prompts/dist/dateparts/milliseconds.js"(exports, module) {
|
|
769
|
+
"use strict";
|
|
770
|
+
var DatePart = require_datepart(), Milliseconds = class extends DatePart {
|
|
771
|
+
constructor(opts = {}) {
|
|
772
|
+
super(opts);
|
|
773
|
+
}
|
|
774
|
+
up() {
|
|
775
|
+
this.date.setMilliseconds(this.date.getMilliseconds() + 1);
|
|
776
|
+
}
|
|
777
|
+
down() {
|
|
778
|
+
this.date.setMilliseconds(this.date.getMilliseconds() - 1);
|
|
779
|
+
}
|
|
780
|
+
setTo(val) {
|
|
781
|
+
this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));
|
|
782
|
+
}
|
|
783
|
+
toString() {
|
|
784
|
+
return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
module.exports = Milliseconds;
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
// ../node_modules/prompts/dist/dateparts/minutes.js
|
|
792
|
+
var require_minutes = __commonJS({
|
|
793
|
+
"../node_modules/prompts/dist/dateparts/minutes.js"(exports, module) {
|
|
794
|
+
"use strict";
|
|
795
|
+
var DatePart = require_datepart(), Minutes = class extends DatePart {
|
|
796
|
+
constructor(opts = {}) {
|
|
797
|
+
super(opts);
|
|
798
|
+
}
|
|
799
|
+
up() {
|
|
800
|
+
this.date.setMinutes(this.date.getMinutes() + 1);
|
|
801
|
+
}
|
|
802
|
+
down() {
|
|
803
|
+
this.date.setMinutes(this.date.getMinutes() - 1);
|
|
804
|
+
}
|
|
805
|
+
setTo(val) {
|
|
806
|
+
this.date.setMinutes(parseInt(val.substr(-2)));
|
|
807
|
+
}
|
|
808
|
+
toString() {
|
|
809
|
+
let m = this.date.getMinutes();
|
|
810
|
+
return this.token.length > 1 ? String(m).padStart(2, "0") : m;
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
module.exports = Minutes;
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
// ../node_modules/prompts/dist/dateparts/month.js
|
|
818
|
+
var require_month = __commonJS({
|
|
819
|
+
"../node_modules/prompts/dist/dateparts/month.js"(exports, module) {
|
|
820
|
+
"use strict";
|
|
821
|
+
var DatePart = require_datepart(), Month = class extends DatePart {
|
|
822
|
+
constructor(opts = {}) {
|
|
823
|
+
super(opts);
|
|
824
|
+
}
|
|
825
|
+
up() {
|
|
826
|
+
this.date.setMonth(this.date.getMonth() + 1);
|
|
827
|
+
}
|
|
828
|
+
down() {
|
|
829
|
+
this.date.setMonth(this.date.getMonth() - 1);
|
|
830
|
+
}
|
|
831
|
+
setTo(val) {
|
|
832
|
+
val = parseInt(val.substr(-2)) - 1, this.date.setMonth(val < 0 ? 0 : val);
|
|
833
|
+
}
|
|
834
|
+
toString() {
|
|
835
|
+
let month = this.date.getMonth(), tl = this.token.length;
|
|
836
|
+
return tl === 2 ? String(month + 1).padStart(2, "0") : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
module.exports = Month;
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
|
|
843
|
+
// ../node_modules/prompts/dist/dateparts/seconds.js
|
|
844
|
+
var require_seconds = __commonJS({
|
|
845
|
+
"../node_modules/prompts/dist/dateparts/seconds.js"(exports, module) {
|
|
846
|
+
"use strict";
|
|
847
|
+
var DatePart = require_datepart(), Seconds = class extends DatePart {
|
|
848
|
+
constructor(opts = {}) {
|
|
849
|
+
super(opts);
|
|
850
|
+
}
|
|
851
|
+
up() {
|
|
852
|
+
this.date.setSeconds(this.date.getSeconds() + 1);
|
|
853
|
+
}
|
|
854
|
+
down() {
|
|
855
|
+
this.date.setSeconds(this.date.getSeconds() - 1);
|
|
856
|
+
}
|
|
857
|
+
setTo(val) {
|
|
858
|
+
this.date.setSeconds(parseInt(val.substr(-2)));
|
|
859
|
+
}
|
|
860
|
+
toString() {
|
|
861
|
+
let s = this.date.getSeconds();
|
|
862
|
+
return this.token.length > 1 ? String(s).padStart(2, "0") : s;
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
module.exports = Seconds;
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
// ../node_modules/prompts/dist/dateparts/year.js
|
|
870
|
+
var require_year = __commonJS({
|
|
871
|
+
"../node_modules/prompts/dist/dateparts/year.js"(exports, module) {
|
|
872
|
+
"use strict";
|
|
873
|
+
var DatePart = require_datepart(), Year = class extends DatePart {
|
|
874
|
+
constructor(opts = {}) {
|
|
875
|
+
super(opts);
|
|
876
|
+
}
|
|
877
|
+
up() {
|
|
878
|
+
this.date.setFullYear(this.date.getFullYear() + 1);
|
|
879
|
+
}
|
|
880
|
+
down() {
|
|
881
|
+
this.date.setFullYear(this.date.getFullYear() - 1);
|
|
882
|
+
}
|
|
883
|
+
setTo(val) {
|
|
884
|
+
this.date.setFullYear(val.substr(-4));
|
|
885
|
+
}
|
|
886
|
+
toString() {
|
|
887
|
+
let year = String(this.date.getFullYear()).padStart(4, "0");
|
|
888
|
+
return this.token.length === 2 ? year.substr(-2) : year;
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
module.exports = Year;
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
|
|
895
|
+
// ../node_modules/prompts/dist/dateparts/index.js
|
|
896
|
+
var require_dateparts = __commonJS({
|
|
897
|
+
"../node_modules/prompts/dist/dateparts/index.js"(exports, module) {
|
|
898
|
+
"use strict";
|
|
899
|
+
module.exports = {
|
|
900
|
+
DatePart: require_datepart(),
|
|
901
|
+
Meridiem: require_meridiem(),
|
|
902
|
+
Day: require_day(),
|
|
903
|
+
Hours: require_hours(),
|
|
904
|
+
Milliseconds: require_milliseconds(),
|
|
905
|
+
Minutes: require_minutes(),
|
|
906
|
+
Month: require_month(),
|
|
907
|
+
Seconds: require_seconds(),
|
|
908
|
+
Year: require_year()
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
// ../node_modules/prompts/dist/elements/date.js
|
|
914
|
+
var require_date = __commonJS({
|
|
915
|
+
"../node_modules/prompts/dist/elements/date.js"(exports, module) {
|
|
916
|
+
"use strict";
|
|
917
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
918
|
+
try {
|
|
919
|
+
var info = gen[key](arg), value = info.value;
|
|
920
|
+
} catch (error) {
|
|
921
|
+
reject(error);
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
|
|
925
|
+
}
|
|
926
|
+
function _asyncToGenerator(fn) {
|
|
927
|
+
return function() {
|
|
928
|
+
var self = this, args = arguments;
|
|
929
|
+
return new Promise(function(resolve, reject) {
|
|
930
|
+
var gen = fn.apply(self, args);
|
|
931
|
+
function _next(value) {
|
|
932
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
933
|
+
}
|
|
934
|
+
function _throw(err) {
|
|
935
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
936
|
+
}
|
|
937
|
+
_next(void 0);
|
|
938
|
+
});
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
var color = require_kleur(), Prompt = require_prompt(), _require = require_util(), style = _require.style, clear = _require.clear, figures = _require.figures, _require2 = require_src(), erase = _require2.erase, cursor = _require2.cursor, _require3 = require_dateparts(), DatePart = _require3.DatePart, Meridiem = _require3.Meridiem, Day = _require3.Day, Hours = _require3.Hours, Milliseconds = _require3.Milliseconds, Minutes = _require3.Minutes, Month = _require3.Month, Seconds = _require3.Seconds, Year = _require3.Year, 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, regexGroups = {
|
|
942
|
+
1: ({
|
|
943
|
+
token
|
|
944
|
+
}) => token.replace(/\\(.)/g, "$1"),
|
|
945
|
+
2: (opts) => new Day(opts),
|
|
946
|
+
// Day // TODO
|
|
947
|
+
3: (opts) => new Month(opts),
|
|
948
|
+
// Month
|
|
949
|
+
4: (opts) => new Year(opts),
|
|
950
|
+
// Year
|
|
951
|
+
5: (opts) => new Meridiem(opts),
|
|
952
|
+
// AM/PM // TODO (special)
|
|
953
|
+
6: (opts) => new Hours(opts),
|
|
954
|
+
// Hours
|
|
955
|
+
7: (opts) => new Minutes(opts),
|
|
956
|
+
// Minutes
|
|
957
|
+
8: (opts) => new Seconds(opts),
|
|
958
|
+
// Seconds
|
|
959
|
+
9: (opts) => new Milliseconds(opts)
|
|
960
|
+
// Fractional seconds
|
|
961
|
+
}, dfltLocales = {
|
|
962
|
+
months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
|
|
963
|
+
monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
|
|
964
|
+
weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
|
|
965
|
+
weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
|
|
966
|
+
}, DatePrompt = class extends Prompt {
|
|
967
|
+
constructor(opts = {}) {
|
|
968
|
+
super(opts), this.msg = opts.message, this.cursor = 0, this.typed = "", this.locales = Object.assign(dfltLocales, opts.locales), this._date = opts.initial || /* @__PURE__ */ new Date(), this.errorMsg = opts.error || "Please Enter A Valid Value", this.validator = opts.validate || (() => !0), this.mask = opts.mask || "YYYY-MM-DD HH:mm:ss", this.clear = clear("", this.out.columns), this.render();
|
|
969
|
+
}
|
|
970
|
+
get value() {
|
|
971
|
+
return this.date;
|
|
972
|
+
}
|
|
973
|
+
get date() {
|
|
974
|
+
return this._date;
|
|
975
|
+
}
|
|
976
|
+
set date(date) {
|
|
977
|
+
date && this._date.setTime(date.getTime());
|
|
978
|
+
}
|
|
979
|
+
set mask(mask) {
|
|
980
|
+
let result;
|
|
981
|
+
for (this.parts = []; result = regex.exec(mask); ) {
|
|
982
|
+
let match = result.shift(), idx = result.findIndex((gr) => gr != null);
|
|
983
|
+
this.parts.push(idx in regexGroups ? regexGroups[idx]({
|
|
984
|
+
token: result[idx] || match,
|
|
985
|
+
date: this.date,
|
|
986
|
+
parts: this.parts,
|
|
987
|
+
locales: this.locales
|
|
988
|
+
}) : result[idx] || match);
|
|
989
|
+
}
|
|
990
|
+
let parts = this.parts.reduce((arr, i) => (typeof i == "string" && typeof arr[arr.length - 1] == "string" ? arr[arr.length - 1] += i : arr.push(i), arr), []);
|
|
991
|
+
this.parts.splice(0), this.parts.push(...parts), this.reset();
|
|
992
|
+
}
|
|
993
|
+
moveCursor(n) {
|
|
994
|
+
this.typed = "", this.cursor = n, this.fire();
|
|
995
|
+
}
|
|
996
|
+
reset() {
|
|
997
|
+
this.moveCursor(this.parts.findIndex((p) => p instanceof DatePart)), this.fire(), this.render();
|
|
998
|
+
}
|
|
999
|
+
exit() {
|
|
1000
|
+
this.abort();
|
|
1001
|
+
}
|
|
1002
|
+
abort() {
|
|
1003
|
+
this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`
|
|
1004
|
+
`), this.close();
|
|
1005
|
+
}
|
|
1006
|
+
validate() {
|
|
1007
|
+
var _this = this;
|
|
1008
|
+
return _asyncToGenerator(function* () {
|
|
1009
|
+
let valid = yield _this.validator(_this.value);
|
|
1010
|
+
typeof valid == "string" && (_this.errorMsg = valid, valid = !1), _this.error = !valid;
|
|
1011
|
+
})();
|
|
1012
|
+
}
|
|
1013
|
+
submit() {
|
|
1014
|
+
var _this2 = this;
|
|
1015
|
+
return _asyncToGenerator(function* () {
|
|
1016
|
+
if (yield _this2.validate(), _this2.error) {
|
|
1017
|
+
_this2.color = "red", _this2.fire(), _this2.render();
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
_this2.done = !0, _this2.aborted = !1, _this2.fire(), _this2.render(), _this2.out.write(`
|
|
1021
|
+
`), _this2.close();
|
|
1022
|
+
})();
|
|
1023
|
+
}
|
|
1024
|
+
up() {
|
|
1025
|
+
this.typed = "", this.parts[this.cursor].up(), this.render();
|
|
1026
|
+
}
|
|
1027
|
+
down() {
|
|
1028
|
+
this.typed = "", this.parts[this.cursor].down(), this.render();
|
|
1029
|
+
}
|
|
1030
|
+
left() {
|
|
1031
|
+
let prev = this.parts[this.cursor].prev();
|
|
1032
|
+
if (prev == null) return this.bell();
|
|
1033
|
+
this.moveCursor(this.parts.indexOf(prev)), this.render();
|
|
1034
|
+
}
|
|
1035
|
+
right() {
|
|
1036
|
+
let next = this.parts[this.cursor].next();
|
|
1037
|
+
if (next == null) return this.bell();
|
|
1038
|
+
this.moveCursor(this.parts.indexOf(next)), this.render();
|
|
1039
|
+
}
|
|
1040
|
+
next() {
|
|
1041
|
+
let next = this.parts[this.cursor].next();
|
|
1042
|
+
this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex((part) => part instanceof DatePart)), this.render();
|
|
1043
|
+
}
|
|
1044
|
+
_(c) {
|
|
1045
|
+
/\d/.test(c) && (this.typed += c, this.parts[this.cursor].setTo(this.typed), this.render());
|
|
1046
|
+
}
|
|
1047
|
+
render() {
|
|
1048
|
+
this.closed || (this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render(), this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(!1), this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join("")].join(" "), this.error && (this.outputText += this.errorMsg.split(`
|
|
1049
|
+
`).reduce((a, l, i) => a + `
|
|
1050
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, "")), this.out.write(erase.line + cursor.to(0) + this.outputText));
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
module.exports = DatePrompt;
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
// ../node_modules/prompts/dist/elements/number.js
|
|
1058
|
+
var require_number = __commonJS({
|
|
1059
|
+
"../node_modules/prompts/dist/elements/number.js"(exports, module) {
|
|
1060
|
+
"use strict";
|
|
1061
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1062
|
+
try {
|
|
1063
|
+
var info = gen[key](arg), value = info.value;
|
|
1064
|
+
} catch (error) {
|
|
1065
|
+
reject(error);
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
|
|
1069
|
+
}
|
|
1070
|
+
function _asyncToGenerator(fn) {
|
|
1071
|
+
return function() {
|
|
1072
|
+
var self = this, args = arguments;
|
|
1073
|
+
return new Promise(function(resolve, reject) {
|
|
1074
|
+
var gen = fn.apply(self, args);
|
|
1075
|
+
function _next(value) {
|
|
1076
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1077
|
+
}
|
|
1078
|
+
function _throw(err) {
|
|
1079
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1080
|
+
}
|
|
1081
|
+
_next(void 0);
|
|
1082
|
+
});
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
var color = require_kleur(), Prompt = require_prompt(), _require = require_src(), cursor = _require.cursor, erase = _require.erase, _require2 = require_util(), style = _require2.style, figures = _require2.figures, clear = _require2.clear, lines = _require2.lines, isNumber = /[0-9]/, isDef = (any) => any !== void 0, round = (number, precision) => {
|
|
1086
|
+
let factor = Math.pow(10, precision);
|
|
1087
|
+
return Math.round(number * factor) / factor;
|
|
1088
|
+
}, NumberPrompt = class extends Prompt {
|
|
1089
|
+
constructor(opts = {}) {
|
|
1090
|
+
super(opts), this.transform = style.render(opts.style), this.msg = opts.message, this.initial = isDef(opts.initial) ? opts.initial : "", this.float = !!opts.float, this.round = opts.round || 2, this.inc = opts.increment || 1, this.min = isDef(opts.min) ? opts.min : -1 / 0, this.max = isDef(opts.max) ? opts.max : 1 / 0, this.errorMsg = opts.error || "Please Enter A Valid Value", this.validator = opts.validate || (() => !0), this.color = "cyan", this.value = "", this.typed = "", this.lastHit = 0, this.render();
|
|
1091
|
+
}
|
|
1092
|
+
set value(v) {
|
|
1093
|
+
!v && v !== 0 ? (this.placeholder = !0, this.rendered = color.gray(this.transform.render(`${this.initial}`)), this._value = "") : (this.placeholder = !1, this.rendered = this.transform.render(`${round(v, this.round)}`), this._value = round(v, this.round)), this.fire();
|
|
1094
|
+
}
|
|
1095
|
+
get value() {
|
|
1096
|
+
return this._value;
|
|
1097
|
+
}
|
|
1098
|
+
parse(x) {
|
|
1099
|
+
return this.float ? parseFloat(x) : parseInt(x);
|
|
1100
|
+
}
|
|
1101
|
+
valid(c) {
|
|
1102
|
+
return c === "-" || c === "." && this.float || isNumber.test(c);
|
|
1103
|
+
}
|
|
1104
|
+
reset() {
|
|
1105
|
+
this.typed = "", this.value = "", this.fire(), this.render();
|
|
1106
|
+
}
|
|
1107
|
+
exit() {
|
|
1108
|
+
this.abort();
|
|
1109
|
+
}
|
|
1110
|
+
abort() {
|
|
1111
|
+
let x = this.value;
|
|
1112
|
+
this.value = x !== "" ? x : this.initial, this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`
|
|
1113
|
+
`), this.close();
|
|
1114
|
+
}
|
|
1115
|
+
validate() {
|
|
1116
|
+
var _this = this;
|
|
1117
|
+
return _asyncToGenerator(function* () {
|
|
1118
|
+
let valid = yield _this.validator(_this.value);
|
|
1119
|
+
typeof valid == "string" && (_this.errorMsg = valid, valid = !1), _this.error = !valid;
|
|
1120
|
+
})();
|
|
1121
|
+
}
|
|
1122
|
+
submit() {
|
|
1123
|
+
var _this2 = this;
|
|
1124
|
+
return _asyncToGenerator(function* () {
|
|
1125
|
+
if (yield _this2.validate(), _this2.error) {
|
|
1126
|
+
_this2.color = "red", _this2.fire(), _this2.render();
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
let x = _this2.value;
|
|
1130
|
+
_this2.value = x !== "" ? x : _this2.initial, _this2.done = !0, _this2.aborted = !1, _this2.error = !1, _this2.fire(), _this2.render(), _this2.out.write(`
|
|
1131
|
+
`), _this2.close();
|
|
1132
|
+
})();
|
|
1133
|
+
}
|
|
1134
|
+
up() {
|
|
1135
|
+
if (this.typed = "", this.value === "" && (this.value = this.min - this.inc), this.value >= this.max) return this.bell();
|
|
1136
|
+
this.value += this.inc, this.color = "cyan", this.fire(), this.render();
|
|
1137
|
+
}
|
|
1138
|
+
down() {
|
|
1139
|
+
if (this.typed = "", this.value === "" && (this.value = this.min + this.inc), this.value <= this.min) return this.bell();
|
|
1140
|
+
this.value -= this.inc, this.color = "cyan", this.fire(), this.render();
|
|
1141
|
+
}
|
|
1142
|
+
delete() {
|
|
1143
|
+
let val = this.value.toString();
|
|
1144
|
+
if (val.length === 0) return this.bell();
|
|
1145
|
+
this.value = this.parse(val = val.slice(0, -1)) || "", this.value !== "" && this.value < this.min && (this.value = this.min), this.color = "cyan", this.fire(), this.render();
|
|
1146
|
+
}
|
|
1147
|
+
next() {
|
|
1148
|
+
this.value = this.initial, this.fire(), this.render();
|
|
1149
|
+
}
|
|
1150
|
+
_(c, key) {
|
|
1151
|
+
if (!this.valid(c)) return this.bell();
|
|
1152
|
+
let now = Date.now();
|
|
1153
|
+
if (now - this.lastHit > 1e3 && (this.typed = ""), this.typed += c, this.lastHit = now, this.color = "cyan", c === ".") return this.fire();
|
|
1154
|
+
this.value = Math.min(this.parse(this.typed), this.max), this.value > this.max && (this.value = this.max), this.value < this.min && (this.value = this.min), this.fire(), this.render();
|
|
1155
|
+
}
|
|
1156
|
+
render() {
|
|
1157
|
+
this.closed || (this.firstRender || (this.outputError && this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns)), this.out.write(clear(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), !this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered].join(" "), this.error && (this.outputError += this.errorMsg.split(`
|
|
1158
|
+
`).reduce((a, l, i) => a + `
|
|
1159
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, "")), this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore));
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
module.exports = NumberPrompt;
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
// ../node_modules/prompts/dist/elements/multiselect.js
|
|
1167
|
+
var require_multiselect = __commonJS({
|
|
1168
|
+
"../node_modules/prompts/dist/elements/multiselect.js"(exports, module) {
|
|
1169
|
+
"use strict";
|
|
1170
|
+
var color = require_kleur(), _require = require_src(), cursor = _require.cursor, Prompt = require_prompt(), _require2 = require_util(), clear = _require2.clear, figures = _require2.figures, style = _require2.style, wrap = _require2.wrap, entriesToDisplay = _require2.entriesToDisplay, MultiselectPrompt = class extends Prompt {
|
|
1171
|
+
constructor(opts = {}) {
|
|
1172
|
+
super(opts), this.msg = opts.message, this.cursor = opts.cursor || 0, this.scrollIndex = opts.cursor || 0, this.hint = opts.hint || "", this.warn = opts.warn || "- This option is disabled -", this.minSelected = opts.min, this.showMinError = !1, this.maxChoices = opts.max, this.instructions = opts.instructions, this.optionsPerPage = opts.optionsPerPage || 10, this.value = opts.choices.map((ch, idx) => (typeof ch == "string" && (ch = {
|
|
1173
|
+
title: ch,
|
|
1174
|
+
value: idx
|
|
1175
|
+
}), {
|
|
1176
|
+
title: ch && (ch.title || ch.value || ch),
|
|
1177
|
+
description: ch && ch.description,
|
|
1178
|
+
value: ch && (ch.value === void 0 ? idx : ch.value),
|
|
1179
|
+
selected: ch && ch.selected,
|
|
1180
|
+
disabled: ch && ch.disabled
|
|
1181
|
+
})), this.clear = clear("", this.out.columns), opts.overrideRender || this.render();
|
|
1182
|
+
}
|
|
1183
|
+
reset() {
|
|
1184
|
+
this.value.map((v) => !v.selected), this.cursor = 0, this.fire(), this.render();
|
|
1185
|
+
}
|
|
1186
|
+
selected() {
|
|
1187
|
+
return this.value.filter((v) => v.selected);
|
|
1188
|
+
}
|
|
1189
|
+
exit() {
|
|
1190
|
+
this.abort();
|
|
1191
|
+
}
|
|
1192
|
+
abort() {
|
|
1193
|
+
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
|
|
1194
|
+
`), this.close();
|
|
1195
|
+
}
|
|
1196
|
+
submit() {
|
|
1197
|
+
let selected = this.value.filter((e) => e.selected);
|
|
1198
|
+
this.minSelected && selected.length < this.minSelected ? (this.showMinError = !0, this.render()) : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
1199
|
+
`), this.close());
|
|
1200
|
+
}
|
|
1201
|
+
first() {
|
|
1202
|
+
this.cursor = 0, this.render();
|
|
1203
|
+
}
|
|
1204
|
+
last() {
|
|
1205
|
+
this.cursor = this.value.length - 1, this.render();
|
|
1206
|
+
}
|
|
1207
|
+
next() {
|
|
1208
|
+
this.cursor = (this.cursor + 1) % this.value.length, this.render();
|
|
1209
|
+
}
|
|
1210
|
+
up() {
|
|
1211
|
+
this.cursor === 0 ? this.cursor = this.value.length - 1 : this.cursor--, this.render();
|
|
1212
|
+
}
|
|
1213
|
+
down() {
|
|
1214
|
+
this.cursor === this.value.length - 1 ? this.cursor = 0 : this.cursor++, this.render();
|
|
1215
|
+
}
|
|
1216
|
+
left() {
|
|
1217
|
+
this.value[this.cursor].selected = !1, this.render();
|
|
1218
|
+
}
|
|
1219
|
+
right() {
|
|
1220
|
+
if (this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell();
|
|
1221
|
+
this.value[this.cursor].selected = !0, this.render();
|
|
1222
|
+
}
|
|
1223
|
+
handleSpaceToggle() {
|
|
1224
|
+
let v = this.value[this.cursor];
|
|
1225
|
+
if (v.selected)
|
|
1226
|
+
v.selected = !1, this.render();
|
|
1227
|
+
else {
|
|
1228
|
+
if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices)
|
|
1229
|
+
return this.bell();
|
|
1230
|
+
v.selected = !0, this.render();
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
toggleAll() {
|
|
1234
|
+
if (this.maxChoices !== void 0 || this.value[this.cursor].disabled)
|
|
1235
|
+
return this.bell();
|
|
1236
|
+
let newSelected = !this.value[this.cursor].selected;
|
|
1237
|
+
this.value.filter((v) => !v.disabled).forEach((v) => v.selected = newSelected), this.render();
|
|
1238
|
+
}
|
|
1239
|
+
_(c, key) {
|
|
1240
|
+
if (c === " ")
|
|
1241
|
+
this.handleSpaceToggle();
|
|
1242
|
+
else if (c === "a")
|
|
1243
|
+
this.toggleAll();
|
|
1244
|
+
else
|
|
1245
|
+
return this.bell();
|
|
1246
|
+
}
|
|
1247
|
+
renderInstructions() {
|
|
1248
|
+
return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : `
|
|
1249
|
+
Instructions:
|
|
1250
|
+
${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
1251
|
+
${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
1252
|
+
` + (this.maxChoices === void 0 ? ` a: Toggle all
|
|
1253
|
+
` : "") + " enter/return: Complete answer" : "";
|
|
1254
|
+
}
|
|
1255
|
+
renderOption(cursor2, v, i, arrowIndicator) {
|
|
1256
|
+
let prefix = (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + arrowIndicator + " ", title, desc;
|
|
1257
|
+
return v.disabled ? title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title) : (title = cursor2 === i ? color.cyan().underline(v.title) : v.title, cursor2 === i && v.description && (desc = ` - ${v.description}`, (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) && (desc = `
|
|
1258
|
+
` + wrap(v.description, {
|
|
1259
|
+
margin: prefix.length,
|
|
1260
|
+
width: this.out.columns
|
|
1261
|
+
})))), prefix + title + color.gray(desc || "");
|
|
1262
|
+
}
|
|
1263
|
+
// shared with autocompleteMultiselect
|
|
1264
|
+
paginateOptions(options) {
|
|
1265
|
+
if (options.length === 0)
|
|
1266
|
+
return color.red("No matches for this query.");
|
|
1267
|
+
let _entriesToDisplay = entriesToDisplay(this.cursor, options.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex, prefix, styledOptions = [];
|
|
1268
|
+
for (let i = startIndex; i < endIndex; i++)
|
|
1269
|
+
i === startIndex && startIndex > 0 ? prefix = figures.arrowUp : i === endIndex - 1 && endIndex < options.length ? prefix = figures.arrowDown : prefix = " ", styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
|
|
1270
|
+
return `
|
|
1271
|
+
` + styledOptions.join(`
|
|
1272
|
+
`);
|
|
1273
|
+
}
|
|
1274
|
+
// shared with autocomleteMultiselect
|
|
1275
|
+
renderOptions(options) {
|
|
1276
|
+
return this.done ? "" : this.paginateOptions(options);
|
|
1277
|
+
}
|
|
1278
|
+
renderDoneOrInstructions() {
|
|
1279
|
+
if (this.done)
|
|
1280
|
+
return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
|
|
1281
|
+
let output = [color.gray(this.hint), this.renderInstructions()];
|
|
1282
|
+
return this.value[this.cursor].disabled && output.push(color.yellow(this.warn)), output.join(" ");
|
|
1283
|
+
}
|
|
1284
|
+
render() {
|
|
1285
|
+
if (this.closed) return;
|
|
1286
|
+
this.firstRender && this.out.write(cursor.hide), super.render();
|
|
1287
|
+
let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(!1), this.renderDoneOrInstructions()].join(" ");
|
|
1288
|
+
this.showMinError && (prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), prompt += this.renderOptions(this.value), this.out.write(this.clear + prompt), this.clear = clear(prompt, this.out.columns);
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
module.exports = MultiselectPrompt;
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
|
|
1295
|
+
// ../node_modules/prompts/dist/elements/autocomplete.js
|
|
1296
|
+
var require_autocomplete = __commonJS({
|
|
1297
|
+
"../node_modules/prompts/dist/elements/autocomplete.js"(exports, module) {
|
|
1298
|
+
"use strict";
|
|
1299
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1300
|
+
try {
|
|
1301
|
+
var info = gen[key](arg), value = info.value;
|
|
1302
|
+
} catch (error) {
|
|
1303
|
+
reject(error);
|
|
1304
|
+
return;
|
|
1305
|
+
}
|
|
1306
|
+
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
|
|
1307
|
+
}
|
|
1308
|
+
function _asyncToGenerator(fn) {
|
|
1309
|
+
return function() {
|
|
1310
|
+
var self = this, args = arguments;
|
|
1311
|
+
return new Promise(function(resolve, reject) {
|
|
1312
|
+
var gen = fn.apply(self, args);
|
|
1313
|
+
function _next(value) {
|
|
1314
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1315
|
+
}
|
|
1316
|
+
function _throw(err) {
|
|
1317
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1318
|
+
}
|
|
1319
|
+
_next(void 0);
|
|
1320
|
+
});
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
var color = require_kleur(), Prompt = require_prompt(), _require = require_src(), erase = _require.erase, cursor = _require.cursor, _require2 = require_util(), style = _require2.style, clear = _require2.clear, figures = _require2.figures, wrap = _require2.wrap, entriesToDisplay = _require2.entriesToDisplay, getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]), getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]), getIndex = (arr, valOrTitle) => {
|
|
1324
|
+
let index = arr.findIndex((el) => el.value === valOrTitle || el.title === valOrTitle);
|
|
1325
|
+
return index > -1 ? index : void 0;
|
|
1326
|
+
}, AutocompletePrompt = class extends Prompt {
|
|
1327
|
+
constructor(opts = {}) {
|
|
1328
|
+
super(opts), this.msg = opts.message, this.suggest = opts.suggest, this.choices = opts.choices, this.initial = typeof opts.initial == "number" ? opts.initial : getIndex(opts.choices, opts.initial), this.select = this.initial || opts.cursor || 0, this.i18n = {
|
|
1329
|
+
noMatches: opts.noMatches || "no matches found"
|
|
1330
|
+
}, this.fallback = opts.fallback || this.initial, this.clearFirst = opts.clearFirst || !1, this.suggestions = [], this.input = "", this.limit = opts.limit || 10, this.cursor = 0, this.transform = style.render(opts.style), this.scale = this.transform.scale, this.render = this.render.bind(this), this.complete = this.complete.bind(this), this.clear = clear("", this.out.columns), this.complete(this.render), this.render();
|
|
1331
|
+
}
|
|
1332
|
+
set fallback(fb) {
|
|
1333
|
+
this._fb = Number.isSafeInteger(parseInt(fb)) ? parseInt(fb) : fb;
|
|
1334
|
+
}
|
|
1335
|
+
get fallback() {
|
|
1336
|
+
let choice;
|
|
1337
|
+
return typeof this._fb == "number" ? choice = this.choices[this._fb] : typeof this._fb == "string" && (choice = {
|
|
1338
|
+
title: this._fb
|
|
1339
|
+
}), choice || this._fb || {
|
|
1340
|
+
title: this.i18n.noMatches
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
moveSelect(i) {
|
|
1344
|
+
this.select = i, this.suggestions.length > 0 ? this.value = getVal(this.suggestions, i) : this.value = this.fallback.value, this.fire();
|
|
1345
|
+
}
|
|
1346
|
+
complete(cb) {
|
|
1347
|
+
var _this = this;
|
|
1348
|
+
return _asyncToGenerator(function* () {
|
|
1349
|
+
let p = _this.completing = _this.suggest(_this.input, _this.choices), suggestions = yield p;
|
|
1350
|
+
if (_this.completing !== p) return;
|
|
1351
|
+
_this.suggestions = suggestions.map((s, i, arr) => ({
|
|
1352
|
+
title: getTitle(arr, i),
|
|
1353
|
+
value: getVal(arr, i),
|
|
1354
|
+
description: s.description
|
|
1355
|
+
})), _this.completing = !1;
|
|
1356
|
+
let l = Math.max(suggestions.length - 1, 0);
|
|
1357
|
+
_this.moveSelect(Math.min(l, _this.select)), cb && cb();
|
|
1358
|
+
})();
|
|
1359
|
+
}
|
|
1360
|
+
reset() {
|
|
1361
|
+
this.input = "", this.complete(() => {
|
|
1362
|
+
this.moveSelect(this.initial !== void 0 ? this.initial : 0), this.render();
|
|
1363
|
+
}), this.render();
|
|
1364
|
+
}
|
|
1365
|
+
exit() {
|
|
1366
|
+
this.clearFirst && this.input.length > 0 ? this.reset() : (this.done = this.exited = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
1367
|
+
`), this.close());
|
|
1368
|
+
}
|
|
1369
|
+
abort() {
|
|
1370
|
+
this.done = this.aborted = !0, this.exited = !1, this.fire(), this.render(), this.out.write(`
|
|
1371
|
+
`), this.close();
|
|
1372
|
+
}
|
|
1373
|
+
submit() {
|
|
1374
|
+
this.done = !0, this.aborted = this.exited = !1, this.fire(), this.render(), this.out.write(`
|
|
1375
|
+
`), this.close();
|
|
1376
|
+
}
|
|
1377
|
+
_(c, key) {
|
|
1378
|
+
let s1 = this.input.slice(0, this.cursor), s2 = this.input.slice(this.cursor);
|
|
1379
|
+
this.input = `${s1}${c}${s2}`, this.cursor = s1.length + 1, this.complete(this.render), this.render();
|
|
1380
|
+
}
|
|
1381
|
+
delete() {
|
|
1382
|
+
if (this.cursor === 0) return this.bell();
|
|
1383
|
+
let s1 = this.input.slice(0, this.cursor - 1), s2 = this.input.slice(this.cursor);
|
|
1384
|
+
this.input = `${s1}${s2}`, this.complete(this.render), this.cursor = this.cursor - 1, this.render();
|
|
1385
|
+
}
|
|
1386
|
+
deleteForward() {
|
|
1387
|
+
if (this.cursor * this.scale >= this.rendered.length) return this.bell();
|
|
1388
|
+
let s1 = this.input.slice(0, this.cursor), s2 = this.input.slice(this.cursor + 1);
|
|
1389
|
+
this.input = `${s1}${s2}`, this.complete(this.render), this.render();
|
|
1390
|
+
}
|
|
1391
|
+
first() {
|
|
1392
|
+
this.moveSelect(0), this.render();
|
|
1393
|
+
}
|
|
1394
|
+
last() {
|
|
1395
|
+
this.moveSelect(this.suggestions.length - 1), this.render();
|
|
1396
|
+
}
|
|
1397
|
+
up() {
|
|
1398
|
+
this.select === 0 ? this.moveSelect(this.suggestions.length - 1) : this.moveSelect(this.select - 1), this.render();
|
|
1399
|
+
}
|
|
1400
|
+
down() {
|
|
1401
|
+
this.select === this.suggestions.length - 1 ? this.moveSelect(0) : this.moveSelect(this.select + 1), this.render();
|
|
1402
|
+
}
|
|
1403
|
+
next() {
|
|
1404
|
+
this.select === this.suggestions.length - 1 ? this.moveSelect(0) : this.moveSelect(this.select + 1), this.render();
|
|
1405
|
+
}
|
|
1406
|
+
nextPage() {
|
|
1407
|
+
this.moveSelect(Math.min(this.select + this.limit, this.suggestions.length - 1)), this.render();
|
|
1408
|
+
}
|
|
1409
|
+
prevPage() {
|
|
1410
|
+
this.moveSelect(Math.max(this.select - this.limit, 0)), this.render();
|
|
1411
|
+
}
|
|
1412
|
+
left() {
|
|
1413
|
+
if (this.cursor <= 0) return this.bell();
|
|
1414
|
+
this.cursor = this.cursor - 1, this.render();
|
|
1415
|
+
}
|
|
1416
|
+
right() {
|
|
1417
|
+
if (this.cursor * this.scale >= this.rendered.length) return this.bell();
|
|
1418
|
+
this.cursor = this.cursor + 1, this.render();
|
|
1419
|
+
}
|
|
1420
|
+
renderOption(v, hovered, isStart, isEnd) {
|
|
1421
|
+
let desc, prefix = isStart ? figures.arrowUp : isEnd ? figures.arrowDown : " ", title = hovered ? color.cyan().underline(v.title) : v.title;
|
|
1422
|
+
return prefix = (hovered ? color.cyan(figures.pointer) + " " : " ") + prefix, v.description && (desc = ` - ${v.description}`, (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) && (desc = `
|
|
1423
|
+
` + wrap(v.description, {
|
|
1424
|
+
margin: 3,
|
|
1425
|
+
width: this.out.columns
|
|
1426
|
+
}))), prefix + " " + title + color.gray(desc || "");
|
|
1427
|
+
}
|
|
1428
|
+
render() {
|
|
1429
|
+
if (this.closed) return;
|
|
1430
|
+
this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render();
|
|
1431
|
+
let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
1432
|
+
if (this.outputText = [style.symbol(this.done, this.aborted, this.exited), color.bold(this.msg), style.delimiter(this.completing), this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)].join(" "), !this.done) {
|
|
1433
|
+
let suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join(`
|
|
1434
|
+
`);
|
|
1435
|
+
this.outputText += `
|
|
1436
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
1437
|
+
}
|
|
1438
|
+
this.out.write(erase.line + cursor.to(0) + this.outputText);
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
module.exports = AutocompletePrompt;
|
|
1442
|
+
}
|
|
1443
|
+
});
|
|
1444
|
+
|
|
1445
|
+
// ../node_modules/prompts/dist/elements/autocompleteMultiselect.js
|
|
1446
|
+
var require_autocompleteMultiselect = __commonJS({
|
|
1447
|
+
"../node_modules/prompts/dist/elements/autocompleteMultiselect.js"(exports, module) {
|
|
1448
|
+
"use strict";
|
|
1449
|
+
var color = require_kleur(), _require = require_src(), cursor = _require.cursor, MultiselectPrompt = require_multiselect(), _require2 = require_util(), clear = _require2.clear, style = _require2.style, figures = _require2.figures, AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
|
|
1450
|
+
constructor(opts = {}) {
|
|
1451
|
+
opts.overrideRender = !0, super(opts), this.inputValue = "", this.clear = clear("", this.out.columns), this.filteredOptions = this.value, this.render();
|
|
1452
|
+
}
|
|
1453
|
+
last() {
|
|
1454
|
+
this.cursor = this.filteredOptions.length - 1, this.render();
|
|
1455
|
+
}
|
|
1456
|
+
next() {
|
|
1457
|
+
this.cursor = (this.cursor + 1) % this.filteredOptions.length, this.render();
|
|
1458
|
+
}
|
|
1459
|
+
up() {
|
|
1460
|
+
this.cursor === 0 ? this.cursor = this.filteredOptions.length - 1 : this.cursor--, this.render();
|
|
1461
|
+
}
|
|
1462
|
+
down() {
|
|
1463
|
+
this.cursor === this.filteredOptions.length - 1 ? this.cursor = 0 : this.cursor++, this.render();
|
|
1464
|
+
}
|
|
1465
|
+
left() {
|
|
1466
|
+
this.filteredOptions[this.cursor].selected = !1, this.render();
|
|
1467
|
+
}
|
|
1468
|
+
right() {
|
|
1469
|
+
if (this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell();
|
|
1470
|
+
this.filteredOptions[this.cursor].selected = !0, this.render();
|
|
1471
|
+
}
|
|
1472
|
+
delete() {
|
|
1473
|
+
this.inputValue.length && (this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1), this.updateFilteredOptions());
|
|
1474
|
+
}
|
|
1475
|
+
updateFilteredOptions() {
|
|
1476
|
+
let currentHighlight = this.filteredOptions[this.cursor];
|
|
1477
|
+
this.filteredOptions = this.value.filter((v) => this.inputValue ? !!(typeof v.title == "string" && v.title.toLowerCase().includes(this.inputValue.toLowerCase()) || typeof v.value == "string" && v.value.toLowerCase().includes(this.inputValue.toLowerCase())) : !0);
|
|
1478
|
+
let newHighlightIndex = this.filteredOptions.findIndex((v) => v === currentHighlight);
|
|
1479
|
+
this.cursor = newHighlightIndex < 0 ? 0 : newHighlightIndex, this.render();
|
|
1480
|
+
}
|
|
1481
|
+
handleSpaceToggle() {
|
|
1482
|
+
let v = this.filteredOptions[this.cursor];
|
|
1483
|
+
if (v.selected)
|
|
1484
|
+
v.selected = !1, this.render();
|
|
1485
|
+
else {
|
|
1486
|
+
if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices)
|
|
1487
|
+
return this.bell();
|
|
1488
|
+
v.selected = !0, this.render();
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
handleInputChange(c) {
|
|
1492
|
+
this.inputValue = this.inputValue + c, this.updateFilteredOptions();
|
|
1493
|
+
}
|
|
1494
|
+
_(c, key) {
|
|
1495
|
+
c === " " ? this.handleSpaceToggle() : this.handleInputChange(c);
|
|
1496
|
+
}
|
|
1497
|
+
renderInstructions() {
|
|
1498
|
+
return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : `
|
|
1499
|
+
Instructions:
|
|
1500
|
+
${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
1501
|
+
${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
1502
|
+
[a,b,c]/delete: Filter choices
|
|
1503
|
+
enter/return: Complete answer
|
|
1504
|
+
` : "";
|
|
1505
|
+
}
|
|
1506
|
+
renderCurrentInput() {
|
|
1507
|
+
return `
|
|
1508
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
1509
|
+
`;
|
|
1510
|
+
}
|
|
1511
|
+
renderOption(cursor2, v, i) {
|
|
1512
|
+
let title;
|
|
1513
|
+
return v.disabled ? title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title) : title = cursor2 === i ? color.cyan().underline(v.title) : v.title, (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
|
|
1514
|
+
}
|
|
1515
|
+
renderDoneOrInstructions() {
|
|
1516
|
+
if (this.done)
|
|
1517
|
+
return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
|
|
1518
|
+
let output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
|
|
1519
|
+
return this.filteredOptions.length && this.filteredOptions[this.cursor].disabled && output.push(color.yellow(this.warn)), output.join(" ");
|
|
1520
|
+
}
|
|
1521
|
+
render() {
|
|
1522
|
+
if (this.closed) return;
|
|
1523
|
+
this.firstRender && this.out.write(cursor.hide), super.render();
|
|
1524
|
+
let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(!1), this.renderDoneOrInstructions()].join(" ");
|
|
1525
|
+
this.showMinError && (prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), prompt += this.renderOptions(this.filteredOptions), this.out.write(this.clear + prompt), this.clear = clear(prompt, this.out.columns);
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
module.exports = AutocompleteMultiselectPrompt;
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
|
|
1532
|
+
// ../node_modules/prompts/dist/elements/confirm.js
|
|
1533
|
+
var require_confirm = __commonJS({
|
|
1534
|
+
"../node_modules/prompts/dist/elements/confirm.js"(exports, module) {
|
|
1535
|
+
"use strict";
|
|
1536
|
+
var color = require_kleur(), Prompt = require_prompt(), _require = require_util(), style = _require.style, clear = _require.clear, _require2 = require_src(), erase = _require2.erase, cursor = _require2.cursor, ConfirmPrompt = class extends Prompt {
|
|
1537
|
+
constructor(opts = {}) {
|
|
1538
|
+
super(opts), this.msg = opts.message, this.value = opts.initial, this.initialValue = !!opts.initial, this.yesMsg = opts.yes || "yes", this.yesOption = opts.yesOption || "(Y/n)", this.noMsg = opts.no || "no", this.noOption = opts.noOption || "(y/N)", this.render();
|
|
1539
|
+
}
|
|
1540
|
+
reset() {
|
|
1541
|
+
this.value = this.initialValue, this.fire(), this.render();
|
|
1542
|
+
}
|
|
1543
|
+
exit() {
|
|
1544
|
+
this.abort();
|
|
1545
|
+
}
|
|
1546
|
+
abort() {
|
|
1547
|
+
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
|
|
1548
|
+
`), this.close();
|
|
1549
|
+
}
|
|
1550
|
+
submit() {
|
|
1551
|
+
this.value = this.value || !1, this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
1552
|
+
`), this.close();
|
|
1553
|
+
}
|
|
1554
|
+
_(c, key) {
|
|
1555
|
+
return c.toLowerCase() === "y" ? (this.value = !0, this.submit()) : c.toLowerCase() === "n" ? (this.value = !1, this.submit()) : this.bell();
|
|
1556
|
+
}
|
|
1557
|
+
render() {
|
|
1558
|
+
this.closed || (this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render(), this.outputText = [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(" "), this.out.write(erase.line + cursor.to(0) + this.outputText));
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
module.exports = ConfirmPrompt;
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
|
|
1565
|
+
// ../node_modules/prompts/dist/elements/index.js
|
|
1566
|
+
var require_elements = __commonJS({
|
|
1567
|
+
"../node_modules/prompts/dist/elements/index.js"(exports, module) {
|
|
1568
|
+
"use strict";
|
|
1569
|
+
module.exports = {
|
|
1570
|
+
TextPrompt: require_text(),
|
|
1571
|
+
SelectPrompt: require_select(),
|
|
1572
|
+
TogglePrompt: require_toggle(),
|
|
1573
|
+
DatePrompt: require_date(),
|
|
1574
|
+
NumberPrompt: require_number(),
|
|
1575
|
+
MultiselectPrompt: require_multiselect(),
|
|
1576
|
+
AutocompletePrompt: require_autocomplete(),
|
|
1577
|
+
AutocompleteMultiselectPrompt: require_autocompleteMultiselect(),
|
|
1578
|
+
ConfirmPrompt: require_confirm()
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
|
|
1583
|
+
// ../node_modules/prompts/dist/prompts.js
|
|
1584
|
+
var require_prompts = __commonJS({
|
|
1585
|
+
"../node_modules/prompts/dist/prompts.js"(exports) {
|
|
1586
|
+
"use strict";
|
|
1587
|
+
var $ = exports, el = require_elements(), noop = (v) => v;
|
|
1588
|
+
function toPrompt(type, args, opts = {}) {
|
|
1589
|
+
return new Promise((res, rej) => {
|
|
1590
|
+
let p = new el[type](args), onAbort = opts.onAbort || noop, onSubmit = opts.onSubmit || noop, onExit = opts.onExit || noop;
|
|
1591
|
+
p.on("state", args.onState || noop), p.on("submit", (x) => res(onSubmit(x))), p.on("exit", (x) => res(onExit(x))), p.on("abort", (x) => rej(onAbort(x)));
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
$.text = (args) => toPrompt("TextPrompt", args);
|
|
1595
|
+
$.password = (args) => (args.style = "password", $.text(args));
|
|
1596
|
+
$.invisible = (args) => (args.style = "invisible", $.text(args));
|
|
1597
|
+
$.number = (args) => toPrompt("NumberPrompt", args);
|
|
1598
|
+
$.date = (args) => toPrompt("DatePrompt", args);
|
|
1599
|
+
$.confirm = (args) => toPrompt("ConfirmPrompt", args);
|
|
1600
|
+
$.list = (args) => {
|
|
1601
|
+
let sep = args.separator || ",";
|
|
1602
|
+
return toPrompt("TextPrompt", args, {
|
|
1603
|
+
onSubmit: (str) => str.split(sep).map((s) => s.trim())
|
|
1604
|
+
});
|
|
1605
|
+
};
|
|
1606
|
+
$.toggle = (args) => toPrompt("TogglePrompt", args);
|
|
1607
|
+
$.select = (args) => toPrompt("SelectPrompt", args);
|
|
1608
|
+
$.multiselect = (args) => {
|
|
1609
|
+
args.choices = [].concat(args.choices || []);
|
|
1610
|
+
let toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
|
|
1611
|
+
return toPrompt("MultiselectPrompt", args, {
|
|
1612
|
+
onAbort: toSelected,
|
|
1613
|
+
onSubmit: toSelected
|
|
1614
|
+
});
|
|
1615
|
+
};
|
|
1616
|
+
$.autocompleteMultiselect = (args) => {
|
|
1617
|
+
args.choices = [].concat(args.choices || []);
|
|
1618
|
+
let toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
|
|
1619
|
+
return toPrompt("AutocompleteMultiselectPrompt", args, {
|
|
1620
|
+
onAbort: toSelected,
|
|
1621
|
+
onSubmit: toSelected
|
|
1622
|
+
});
|
|
1623
|
+
};
|
|
1624
|
+
var byTitle = (input, choices) => Promise.resolve(choices.filter((item) => item.title.slice(0, input.length).toLowerCase() === input.toLowerCase()));
|
|
1625
|
+
$.autocomplete = (args) => (args.suggest = args.suggest || byTitle, args.choices = [].concat(args.choices || []), toPrompt("AutocompletePrompt", args));
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
|
|
1629
|
+
// ../node_modules/prompts/dist/index.js
|
|
1630
|
+
var require_dist = __commonJS({
|
|
1631
|
+
"../node_modules/prompts/dist/index.js"(exports, module) {
|
|
1632
|
+
"use strict";
|
|
1633
|
+
function ownKeys(object, enumerableOnly) {
|
|
1634
|
+
var keys = Object.keys(object);
|
|
1635
|
+
if (Object.getOwnPropertySymbols) {
|
|
1636
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1637
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
1638
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1639
|
+
})), keys.push.apply(keys, symbols);
|
|
1640
|
+
}
|
|
1641
|
+
return keys;
|
|
1642
|
+
}
|
|
1643
|
+
function _objectSpread(target) {
|
|
1644
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1645
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1646
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function(key) {
|
|
1647
|
+
_defineProperty(target, key, source[key]);
|
|
1648
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
1649
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
return target;
|
|
1653
|
+
}
|
|
1654
|
+
function _defineProperty(obj, key, value) {
|
|
1655
|
+
return key in obj ? Object.defineProperty(obj, key, { value, enumerable: !0, configurable: !0, writable: !0 }) : obj[key] = value, obj;
|
|
1656
|
+
}
|
|
1657
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
1658
|
+
var it = typeof Symbol < "u" && o[Symbol.iterator] || o["@@iterator"];
|
|
1659
|
+
if (!it) {
|
|
1660
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length == "number") {
|
|
1661
|
+
it && (o = it);
|
|
1662
|
+
var i = 0, F = function() {
|
|
1663
|
+
};
|
|
1664
|
+
return { s: F, n: function() {
|
|
1665
|
+
return i >= o.length ? { done: !0 } : { done: !1, value: o[i++] };
|
|
1666
|
+
}, e: function(_e) {
|
|
1667
|
+
throw _e;
|
|
1668
|
+
}, f: F };
|
|
1669
|
+
}
|
|
1670
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
1671
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1672
|
+
}
|
|
1673
|
+
var normalCompletion = !0, didErr = !1, err;
|
|
1674
|
+
return { s: function() {
|
|
1675
|
+
it = it.call(o);
|
|
1676
|
+
}, n: function() {
|
|
1677
|
+
var step = it.next();
|
|
1678
|
+
return normalCompletion = step.done, step;
|
|
1679
|
+
}, e: function(_e2) {
|
|
1680
|
+
didErr = !0, err = _e2;
|
|
1681
|
+
}, f: function() {
|
|
1682
|
+
try {
|
|
1683
|
+
!normalCompletion && it.return != null && it.return();
|
|
1684
|
+
} finally {
|
|
1685
|
+
if (didErr) throw err;
|
|
1686
|
+
}
|
|
1687
|
+
} };
|
|
1688
|
+
}
|
|
1689
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
1690
|
+
if (o) {
|
|
1691
|
+
if (typeof o == "string") return _arrayLikeToArray(o, minLen);
|
|
1692
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1693
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(o);
|
|
1694
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
function _arrayLikeToArray(arr, len) {
|
|
1698
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
1699
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1700
|
+
return arr2;
|
|
1701
|
+
}
|
|
1702
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1703
|
+
try {
|
|
1704
|
+
var info = gen[key](arg), value = info.value;
|
|
1705
|
+
} catch (error) {
|
|
1706
|
+
reject(error);
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
|
|
1710
|
+
}
|
|
1711
|
+
function _asyncToGenerator(fn) {
|
|
1712
|
+
return function() {
|
|
1713
|
+
var self = this, args = arguments;
|
|
1714
|
+
return new Promise(function(resolve, reject) {
|
|
1715
|
+
var gen = fn.apply(self, args);
|
|
1716
|
+
function _next(value) {
|
|
1717
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1718
|
+
}
|
|
1719
|
+
function _throw(err) {
|
|
1720
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1721
|
+
}
|
|
1722
|
+
_next(void 0);
|
|
1723
|
+
});
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
var prompts = require_prompts(), passOn = ["suggest", "format", "onState", "validate", "onRender", "type"], noop = () => {
|
|
1727
|
+
};
|
|
1728
|
+
function prompt() {
|
|
1729
|
+
return _prompt.apply(this, arguments);
|
|
1730
|
+
}
|
|
1731
|
+
function _prompt() {
|
|
1732
|
+
return _prompt = _asyncToGenerator(function* (questions = [], {
|
|
1733
|
+
onSubmit = noop,
|
|
1734
|
+
onCancel = noop
|
|
1735
|
+
} = {}) {
|
|
1736
|
+
let answers = {}, override2 = prompt._override || {};
|
|
1737
|
+
questions = [].concat(questions);
|
|
1738
|
+
let answer, question, quit, name, type, lastPrompt, getFormattedAnswer = (function() {
|
|
1739
|
+
var _ref = _asyncToGenerator(function* (question2, answer2, skipValidation = !1) {
|
|
1740
|
+
if (!(!skipValidation && question2.validate && question2.validate(answer2) !== !0))
|
|
1741
|
+
return question2.format ? yield question2.format(answer2, answers) : answer2;
|
|
1742
|
+
});
|
|
1743
|
+
return function(_x, _x2) {
|
|
1744
|
+
return _ref.apply(this, arguments);
|
|
1745
|
+
};
|
|
1746
|
+
})();
|
|
1747
|
+
var _iterator = _createForOfIteratorHelper(questions), _step;
|
|
1748
|
+
try {
|
|
1749
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
1750
|
+
question = _step.value;
|
|
1751
|
+
var _question = question;
|
|
1752
|
+
if (name = _question.name, type = _question.type, typeof type == "function" && (type = yield type(answer, _objectSpread({}, answers), question), question.type = type), !!type) {
|
|
1753
|
+
for (let key in question) {
|
|
1754
|
+
if (passOn.includes(key)) continue;
|
|
1755
|
+
let value = question[key];
|
|
1756
|
+
question[key] = typeof value == "function" ? yield value(answer, _objectSpread({}, answers), lastPrompt) : value;
|
|
1757
|
+
}
|
|
1758
|
+
if (lastPrompt = question, typeof question.message != "string")
|
|
1759
|
+
throw new Error("prompt message is required");
|
|
1760
|
+
var _question2 = question;
|
|
1761
|
+
if (name = _question2.name, type = _question2.type, prompts[type] === void 0)
|
|
1762
|
+
throw new Error(`prompt type (${type}) is not defined`);
|
|
1763
|
+
if (override2[question.name] !== void 0 && (answer = yield getFormattedAnswer(question, override2[question.name]), answer !== void 0)) {
|
|
1764
|
+
answers[name] = answer;
|
|
1765
|
+
continue;
|
|
1766
|
+
}
|
|
1767
|
+
try {
|
|
1768
|
+
answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : yield prompts[type](question), answers[name] = answer = yield getFormattedAnswer(question, answer, !0), quit = yield onSubmit(question, answer, answers);
|
|
1769
|
+
} catch {
|
|
1770
|
+
quit = !(yield onCancel(question, answers));
|
|
1771
|
+
}
|
|
1772
|
+
if (quit) return answers;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
} catch (err) {
|
|
1776
|
+
_iterator.e(err);
|
|
1777
|
+
} finally {
|
|
1778
|
+
_iterator.f();
|
|
1779
|
+
}
|
|
1780
|
+
return answers;
|
|
1781
|
+
}), _prompt.apply(this, arguments);
|
|
1782
|
+
}
|
|
1783
|
+
function getInjectedAnswer(injected, deafultValue) {
|
|
1784
|
+
let answer = injected.shift();
|
|
1785
|
+
if (answer instanceof Error)
|
|
1786
|
+
throw answer;
|
|
1787
|
+
return answer === void 0 ? deafultValue : answer;
|
|
1788
|
+
}
|
|
1789
|
+
function inject(answers) {
|
|
1790
|
+
prompt._injected = (prompt._injected || []).concat(answers);
|
|
1791
|
+
}
|
|
1792
|
+
function override(answers) {
|
|
1793
|
+
prompt._override = Object.assign({}, answers);
|
|
1794
|
+
}
|
|
1795
|
+
module.exports = Object.assign(prompt, {
|
|
1796
|
+
prompt,
|
|
1797
|
+
prompts,
|
|
1798
|
+
inject,
|
|
1799
|
+
override
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1803
|
+
|
|
1804
|
+
// ../node_modules/prompts/lib/util/action.js
|
|
1805
|
+
var require_action2 = __commonJS({
|
|
1806
|
+
"../node_modules/prompts/lib/util/action.js"(exports, module) {
|
|
1807
|
+
"use strict";
|
|
1808
|
+
module.exports = (key, isSelect) => {
|
|
1809
|
+
if (!(key.meta && key.name !== "escape")) {
|
|
1810
|
+
if (key.ctrl) {
|
|
1811
|
+
if (key.name === "a") return "first";
|
|
1812
|
+
if (key.name === "c" || key.name === "d") return "abort";
|
|
1813
|
+
if (key.name === "e") return "last";
|
|
1814
|
+
if (key.name === "g") return "reset";
|
|
1815
|
+
}
|
|
1816
|
+
if (isSelect) {
|
|
1817
|
+
if (key.name === "j") return "down";
|
|
1818
|
+
if (key.name === "k") return "up";
|
|
1819
|
+
}
|
|
1820
|
+
return key.name === "return" || key.name === "enter" ? "submit" : key.name === "backspace" ? "delete" : key.name === "delete" ? "deleteForward" : key.name === "abort" ? "abort" : key.name === "escape" ? "exit" : key.name === "tab" ? "next" : key.name === "pagedown" ? "nextPage" : key.name === "pageup" ? "prevPage" : key.name === "home" ? "home" : key.name === "end" ? "end" : key.name === "up" ? "up" : key.name === "down" ? "down" : key.name === "right" ? "right" : key.name === "left" ? "left" : !1;
|
|
1821
|
+
}
|
|
1822
|
+
};
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
|
|
1826
|
+
// ../node_modules/prompts/lib/util/strip.js
|
|
1827
|
+
var require_strip2 = __commonJS({
|
|
1828
|
+
"../node_modules/prompts/lib/util/strip.js"(exports, module) {
|
|
1829
|
+
"use strict";
|
|
1830
|
+
module.exports = (str) => {
|
|
1831
|
+
let pattern = [
|
|
1832
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
1833
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
|
|
1834
|
+
].join("|"), RGX = new RegExp(pattern, "g");
|
|
1835
|
+
return typeof str == "string" ? str.replace(RGX, "") : str;
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1839
|
+
|
|
1840
|
+
// ../node_modules/prompts/lib/util/clear.js
|
|
1841
|
+
var require_clear2 = __commonJS({
|
|
1842
|
+
"../node_modules/prompts/lib/util/clear.js"(exports, module) {
|
|
1843
|
+
"use strict";
|
|
1844
|
+
var strip = require_strip2(), { erase, cursor } = require_src(), width = (str) => [...strip(str)].length;
|
|
1845
|
+
module.exports = function(prompt, perLine) {
|
|
1846
|
+
if (!perLine) return erase.line + cursor.to(0);
|
|
1847
|
+
let rows = 0, lines = prompt.split(/\r?\n/);
|
|
1848
|
+
for (let line of lines)
|
|
1849
|
+
rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
|
|
1850
|
+
return erase.lines(rows);
|
|
1851
|
+
};
|
|
1852
|
+
}
|
|
1853
|
+
});
|
|
1854
|
+
|
|
1855
|
+
// ../node_modules/prompts/lib/util/figures.js
|
|
1856
|
+
var require_figures2 = __commonJS({
|
|
1857
|
+
"../node_modules/prompts/lib/util/figures.js"(exports, module) {
|
|
1858
|
+
"use strict";
|
|
1859
|
+
var main = {
|
|
1860
|
+
arrowUp: "\u2191",
|
|
1861
|
+
arrowDown: "\u2193",
|
|
1862
|
+
arrowLeft: "\u2190",
|
|
1863
|
+
arrowRight: "\u2192",
|
|
1864
|
+
radioOn: "\u25C9",
|
|
1865
|
+
radioOff: "\u25EF",
|
|
1866
|
+
tick: "\u2714",
|
|
1867
|
+
cross: "\u2716",
|
|
1868
|
+
ellipsis: "\u2026",
|
|
1869
|
+
pointerSmall: "\u203A",
|
|
1870
|
+
line: "\u2500",
|
|
1871
|
+
pointer: "\u276F"
|
|
1872
|
+
}, win = {
|
|
1873
|
+
arrowUp: main.arrowUp,
|
|
1874
|
+
arrowDown: main.arrowDown,
|
|
1875
|
+
arrowLeft: main.arrowLeft,
|
|
1876
|
+
arrowRight: main.arrowRight,
|
|
1877
|
+
radioOn: "(*)",
|
|
1878
|
+
radioOff: "( )",
|
|
1879
|
+
tick: "\u221A",
|
|
1880
|
+
cross: "\xD7",
|
|
1881
|
+
ellipsis: "...",
|
|
1882
|
+
pointerSmall: "\xBB",
|
|
1883
|
+
line: "\u2500",
|
|
1884
|
+
pointer: ">"
|
|
1885
|
+
}, figures = process.platform === "win32" ? win : main;
|
|
1886
|
+
module.exports = figures;
|
|
1887
|
+
}
|
|
1888
|
+
});
|
|
1889
|
+
|
|
1890
|
+
// ../node_modules/prompts/lib/util/style.js
|
|
1891
|
+
var require_style2 = __commonJS({
|
|
1892
|
+
"../node_modules/prompts/lib/util/style.js"(exports, module) {
|
|
1893
|
+
"use strict";
|
|
1894
|
+
var c = require_kleur(), figures = require_figures2(), styles = Object.freeze({
|
|
1895
|
+
password: { scale: 1, render: (input) => "*".repeat(input.length) },
|
|
1896
|
+
emoji: { scale: 2, render: (input) => "\u{1F603}".repeat(input.length) },
|
|
1897
|
+
invisible: { scale: 0, render: (input) => "" },
|
|
1898
|
+
default: { scale: 1, render: (input) => `${input}` }
|
|
1899
|
+
}), render = (type) => styles[type] || styles.default, symbols = Object.freeze({
|
|
1900
|
+
aborted: c.red(figures.cross),
|
|
1901
|
+
done: c.green(figures.tick),
|
|
1902
|
+
exited: c.yellow(figures.cross),
|
|
1903
|
+
default: c.cyan("?")
|
|
1904
|
+
}), symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default, delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall), item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
|
|
1905
|
+
module.exports = {
|
|
1906
|
+
styles,
|
|
1907
|
+
render,
|
|
1908
|
+
symbols,
|
|
1909
|
+
symbol,
|
|
1910
|
+
delimiter,
|
|
1911
|
+
item
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
});
|
|
1915
|
+
|
|
1916
|
+
// ../node_modules/prompts/lib/util/lines.js
|
|
1917
|
+
var require_lines2 = __commonJS({
|
|
1918
|
+
"../node_modules/prompts/lib/util/lines.js"(exports, module) {
|
|
1919
|
+
"use strict";
|
|
1920
|
+
var strip = require_strip2();
|
|
1921
|
+
module.exports = function(msg, perLine) {
|
|
1922
|
+
let lines = String(strip(msg) || "").split(/\r?\n/);
|
|
1923
|
+
return perLine ? lines.map((l) => Math.ceil(l.length / perLine)).reduce((a, b) => a + b) : lines.length;
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
});
|
|
1927
|
+
|
|
1928
|
+
// ../node_modules/prompts/lib/util/wrap.js
|
|
1929
|
+
var require_wrap2 = __commonJS({
|
|
1930
|
+
"../node_modules/prompts/lib/util/wrap.js"(exports, module) {
|
|
1931
|
+
"use strict";
|
|
1932
|
+
module.exports = (msg, opts = {}) => {
|
|
1933
|
+
let tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(" ").join("") : opts.margin || "", width = opts.width;
|
|
1934
|
+
return (msg || "").split(/\r?\n/g).map((line) => line.split(/\s+/g).reduce((arr, w) => (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width ? arr[arr.length - 1] += ` ${w}` : arr.push(`${tab}${w}`), arr), [tab]).join(`
|
|
1935
|
+
`)).join(`
|
|
1936
|
+
`);
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
|
|
1941
|
+
// ../node_modules/prompts/lib/util/entriesToDisplay.js
|
|
1942
|
+
var require_entriesToDisplay2 = __commonJS({
|
|
1943
|
+
"../node_modules/prompts/lib/util/entriesToDisplay.js"(exports, module) {
|
|
1944
|
+
"use strict";
|
|
1945
|
+
module.exports = (cursor, total, maxVisible) => {
|
|
1946
|
+
maxVisible = maxVisible || total;
|
|
1947
|
+
let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
|
|
1948
|
+
startIndex < 0 && (startIndex = 0);
|
|
1949
|
+
let endIndex = Math.min(startIndex + maxVisible, total);
|
|
1950
|
+
return { startIndex, endIndex };
|
|
1951
|
+
};
|
|
1952
|
+
}
|
|
1953
|
+
});
|
|
1954
|
+
|
|
1955
|
+
// ../node_modules/prompts/lib/util/index.js
|
|
1956
|
+
var require_util2 = __commonJS({
|
|
1957
|
+
"../node_modules/prompts/lib/util/index.js"(exports, module) {
|
|
1958
|
+
"use strict";
|
|
1959
|
+
module.exports = {
|
|
1960
|
+
action: require_action2(),
|
|
1961
|
+
clear: require_clear2(),
|
|
1962
|
+
style: require_style2(),
|
|
1963
|
+
strip: require_strip2(),
|
|
1964
|
+
figures: require_figures2(),
|
|
1965
|
+
lines: require_lines2(),
|
|
1966
|
+
wrap: require_wrap2(),
|
|
1967
|
+
entriesToDisplay: require_entriesToDisplay2()
|
|
1968
|
+
};
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
|
|
1972
|
+
// ../node_modules/prompts/lib/elements/prompt.js
|
|
1973
|
+
var require_prompt2 = __commonJS({
|
|
1974
|
+
"../node_modules/prompts/lib/elements/prompt.js"(exports, module) {
|
|
1975
|
+
"use strict";
|
|
1976
|
+
var readline = __require("readline"), { action } = require_util2(), EventEmitter = __require("events"), { beep, cursor } = require_src(), color = require_kleur(), Prompt = class extends EventEmitter {
|
|
1977
|
+
constructor(opts = {}) {
|
|
1978
|
+
super(), this.firstRender = !0, this.in = opts.stdin || process.stdin, this.out = opts.stdout || process.stdout, this.onRender = (opts.onRender || (() => {
|
|
1979
|
+
})).bind(this);
|
|
1980
|
+
let rl = readline.createInterface({ input: this.in, escapeCodeTimeout: 50 });
|
|
1981
|
+
readline.emitKeypressEvents(this.in, rl), this.in.isTTY && this.in.setRawMode(!0);
|
|
1982
|
+
let isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1, keypress = (str, key) => {
|
|
1983
|
+
let a = action(key, isSelect);
|
|
1984
|
+
a === !1 ? this._ && this._(str, key) : typeof this[a] == "function" ? this[a](key) : this.bell();
|
|
1985
|
+
};
|
|
1986
|
+
this.close = () => {
|
|
1987
|
+
this.out.write(cursor.show), this.in.removeListener("keypress", keypress), this.in.isTTY && this.in.setRawMode(!1), rl.close(), this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value), this.closed = !0;
|
|
1988
|
+
}, this.in.on("keypress", keypress);
|
|
1989
|
+
}
|
|
1990
|
+
fire() {
|
|
1991
|
+
this.emit("state", {
|
|
1992
|
+
value: this.value,
|
|
1993
|
+
aborted: !!this.aborted,
|
|
1994
|
+
exited: !!this.exited
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
bell() {
|
|
1998
|
+
this.out.write(beep);
|
|
1999
|
+
}
|
|
2000
|
+
render() {
|
|
2001
|
+
this.onRender(color), this.firstRender && (this.firstRender = !1);
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
2004
|
+
module.exports = Prompt;
|
|
2005
|
+
}
|
|
2006
|
+
});
|
|
2007
|
+
|
|
2008
|
+
// ../node_modules/prompts/lib/elements/text.js
|
|
2009
|
+
var require_text2 = __commonJS({
|
|
2010
|
+
"../node_modules/prompts/lib/elements/text.js"(exports, module) {
|
|
2011
|
+
var color = require_kleur(), Prompt = require_prompt2(), { erase, cursor } = require_src(), { style, clear, lines, figures } = require_util2(), TextPrompt = class extends Prompt {
|
|
2012
|
+
constructor(opts = {}) {
|
|
2013
|
+
super(opts), this.transform = style.render(opts.style), this.scale = this.transform.scale, this.msg = opts.message, this.initial = opts.initial || "", this.validator = opts.validate || (() => !0), this.value = "", this.errorMsg = opts.error || "Please Enter A Valid Value", this.cursor = +!!this.initial, this.cursorOffset = 0, this.clear = clear("", this.out.columns), this.render();
|
|
2014
|
+
}
|
|
2015
|
+
set value(v) {
|
|
2016
|
+
!v && this.initial ? (this.placeholder = !0, this.rendered = color.gray(this.transform.render(this.initial))) : (this.placeholder = !1, this.rendered = this.transform.render(v)), this._value = v, this.fire();
|
|
2017
|
+
}
|
|
2018
|
+
get value() {
|
|
2019
|
+
return this._value;
|
|
2020
|
+
}
|
|
2021
|
+
reset() {
|
|
2022
|
+
this.value = "", this.cursor = +!!this.initial, this.cursorOffset = 0, this.fire(), this.render();
|
|
2023
|
+
}
|
|
2024
|
+
exit() {
|
|
2025
|
+
this.abort();
|
|
2026
|
+
}
|
|
2027
|
+
abort() {
|
|
2028
|
+
this.value = this.value || this.initial, this.done = this.aborted = !0, this.error = !1, this.red = !1, this.fire(), this.render(), this.out.write(`
|
|
2029
|
+
`), this.close();
|
|
2030
|
+
}
|
|
2031
|
+
async validate() {
|
|
2032
|
+
let valid = await this.validator(this.value);
|
|
2033
|
+
typeof valid == "string" && (this.errorMsg = valid, valid = !1), this.error = !valid;
|
|
2034
|
+
}
|
|
2035
|
+
async submit() {
|
|
2036
|
+
if (this.value = this.value || this.initial, this.cursorOffset = 0, this.cursor = this.rendered.length, await this.validate(), this.error) {
|
|
2037
|
+
this.red = !0, this.fire(), this.render();
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
2041
|
+
`), this.close();
|
|
2042
|
+
}
|
|
2043
|
+
next() {
|
|
2044
|
+
if (!this.placeholder) return this.bell();
|
|
2045
|
+
this.value = this.initial, this.cursor = this.rendered.length, this.fire(), this.render();
|
|
2046
|
+
}
|
|
2047
|
+
moveCursor(n) {
|
|
2048
|
+
this.placeholder || (this.cursor = this.cursor + n, this.cursorOffset += n);
|
|
2049
|
+
}
|
|
2050
|
+
_(c, key) {
|
|
2051
|
+
let s1 = this.value.slice(0, this.cursor), s2 = this.value.slice(this.cursor);
|
|
2052
|
+
this.value = `${s1}${c}${s2}`, this.red = !1, this.cursor = this.placeholder ? 0 : s1.length + 1, this.render();
|
|
2053
|
+
}
|
|
2054
|
+
delete() {
|
|
2055
|
+
if (this.isCursorAtStart()) return this.bell();
|
|
2056
|
+
let s1 = this.value.slice(0, this.cursor - 1), s2 = this.value.slice(this.cursor);
|
|
2057
|
+
this.value = `${s1}${s2}`, this.red = !1, this.isCursorAtStart() ? this.cursorOffset = 0 : (this.cursorOffset++, this.moveCursor(-1)), this.render();
|
|
2058
|
+
}
|
|
2059
|
+
deleteForward() {
|
|
2060
|
+
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
|
|
2061
|
+
let s1 = this.value.slice(0, this.cursor), s2 = this.value.slice(this.cursor + 1);
|
|
2062
|
+
this.value = `${s1}${s2}`, this.red = !1, this.isCursorAtEnd() ? this.cursorOffset = 0 : this.cursorOffset++, this.render();
|
|
2063
|
+
}
|
|
2064
|
+
first() {
|
|
2065
|
+
this.cursor = 0, this.render();
|
|
2066
|
+
}
|
|
2067
|
+
last() {
|
|
2068
|
+
this.cursor = this.value.length, this.render();
|
|
2069
|
+
}
|
|
2070
|
+
left() {
|
|
2071
|
+
if (this.cursor <= 0 || this.placeholder) return this.bell();
|
|
2072
|
+
this.moveCursor(-1), this.render();
|
|
2073
|
+
}
|
|
2074
|
+
right() {
|
|
2075
|
+
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
|
|
2076
|
+
this.moveCursor(1), this.render();
|
|
2077
|
+
}
|
|
2078
|
+
isCursorAtStart() {
|
|
2079
|
+
return this.cursor === 0 || this.placeholder && this.cursor === 1;
|
|
2080
|
+
}
|
|
2081
|
+
isCursorAtEnd() {
|
|
2082
|
+
return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
|
|
2083
|
+
}
|
|
2084
|
+
render() {
|
|
2085
|
+
this.closed || (this.firstRender || (this.outputError && this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns)), this.out.write(clear(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [
|
|
2086
|
+
style.symbol(this.done, this.aborted),
|
|
2087
|
+
color.bold(this.msg),
|
|
2088
|
+
style.delimiter(this.done),
|
|
2089
|
+
this.red ? color.red(this.rendered) : this.rendered
|
|
2090
|
+
].join(" "), this.error && (this.outputError += this.errorMsg.split(`
|
|
2091
|
+
`).reduce((a, l, i) => a + `
|
|
2092
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, "")), this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0)));
|
|
2093
|
+
}
|
|
2094
|
+
};
|
|
2095
|
+
module.exports = TextPrompt;
|
|
2096
|
+
}
|
|
2097
|
+
});
|
|
2098
|
+
|
|
2099
|
+
// ../node_modules/prompts/lib/elements/select.js
|
|
2100
|
+
var require_select2 = __commonJS({
|
|
2101
|
+
"../node_modules/prompts/lib/elements/select.js"(exports, module) {
|
|
2102
|
+
"use strict";
|
|
2103
|
+
var color = require_kleur(), Prompt = require_prompt2(), { style, clear, figures, wrap, entriesToDisplay } = require_util2(), { cursor } = require_src(), SelectPrompt = class extends Prompt {
|
|
2104
|
+
constructor(opts = {}) {
|
|
2105
|
+
super(opts), this.msg = opts.message, this.hint = opts.hint || "- Use arrow-keys. Return to submit.", this.warn = opts.warn || "- This option is disabled", this.cursor = opts.initial || 0, this.choices = opts.choices.map((ch, idx) => (typeof ch == "string" && (ch = { title: ch, value: idx }), {
|
|
2106
|
+
title: ch && (ch.title || ch.value || ch),
|
|
2107
|
+
value: ch && (ch.value === void 0 ? idx : ch.value),
|
|
2108
|
+
description: ch && ch.description,
|
|
2109
|
+
selected: ch && ch.selected,
|
|
2110
|
+
disabled: ch && ch.disabled
|
|
2111
|
+
})), this.optionsPerPage = opts.optionsPerPage || 10, this.value = (this.choices[this.cursor] || {}).value, this.clear = clear("", this.out.columns), this.render();
|
|
2112
|
+
}
|
|
2113
|
+
moveCursor(n) {
|
|
2114
|
+
this.cursor = n, this.value = this.choices[n].value, this.fire();
|
|
2115
|
+
}
|
|
2116
|
+
reset() {
|
|
2117
|
+
this.moveCursor(0), this.fire(), this.render();
|
|
2118
|
+
}
|
|
2119
|
+
exit() {
|
|
2120
|
+
this.abort();
|
|
2121
|
+
}
|
|
2122
|
+
abort() {
|
|
2123
|
+
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
|
|
2124
|
+
`), this.close();
|
|
2125
|
+
}
|
|
2126
|
+
submit() {
|
|
2127
|
+
this.selection.disabled ? this.bell() : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
2128
|
+
`), this.close());
|
|
2129
|
+
}
|
|
2130
|
+
first() {
|
|
2131
|
+
this.moveCursor(0), this.render();
|
|
2132
|
+
}
|
|
2133
|
+
last() {
|
|
2134
|
+
this.moveCursor(this.choices.length - 1), this.render();
|
|
2135
|
+
}
|
|
2136
|
+
up() {
|
|
2137
|
+
this.cursor === 0 ? this.moveCursor(this.choices.length - 1) : this.moveCursor(this.cursor - 1), this.render();
|
|
2138
|
+
}
|
|
2139
|
+
down() {
|
|
2140
|
+
this.cursor === this.choices.length - 1 ? this.moveCursor(0) : this.moveCursor(this.cursor + 1), this.render();
|
|
2141
|
+
}
|
|
2142
|
+
next() {
|
|
2143
|
+
this.moveCursor((this.cursor + 1) % this.choices.length), this.render();
|
|
2144
|
+
}
|
|
2145
|
+
_(c, key) {
|
|
2146
|
+
if (c === " ") return this.submit();
|
|
2147
|
+
}
|
|
2148
|
+
get selection() {
|
|
2149
|
+
return this.choices[this.cursor];
|
|
2150
|
+
}
|
|
2151
|
+
render() {
|
|
2152
|
+
if (this.closed) return;
|
|
2153
|
+
this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render();
|
|
2154
|
+
let { startIndex, endIndex } = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage);
|
|
2155
|
+
if (this.outputText = [
|
|
2156
|
+
style.symbol(this.done, this.aborted),
|
|
2157
|
+
color.bold(this.msg),
|
|
2158
|
+
style.delimiter(!1),
|
|
2159
|
+
this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
|
|
2160
|
+
].join(" "), !this.done) {
|
|
2161
|
+
this.outputText += `
|
|
2162
|
+
`;
|
|
2163
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
2164
|
+
let title, prefix, desc = "", v = this.choices[i];
|
|
2165
|
+
i === startIndex && startIndex > 0 ? prefix = figures.arrowUp : i === endIndex - 1 && endIndex < this.choices.length ? prefix = figures.arrowDown : prefix = " ", v.disabled ? (title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title), prefix = (this.cursor === i ? color.bold().gray(figures.pointer) + " " : " ") + prefix) : (title = this.cursor === i ? color.cyan().underline(v.title) : v.title, prefix = (this.cursor === i ? color.cyan(figures.pointer) + " " : " ") + prefix, v.description && this.cursor === i && (desc = ` - ${v.description}`, (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) && (desc = `
|
|
2166
|
+
` + wrap(v.description, { margin: 3, width: this.out.columns })))), this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
2167
|
+
`;
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
this.out.write(this.outputText);
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
module.exports = SelectPrompt;
|
|
2174
|
+
}
|
|
2175
|
+
});
|
|
2176
|
+
|
|
2177
|
+
// ../node_modules/prompts/lib/elements/toggle.js
|
|
2178
|
+
var require_toggle2 = __commonJS({
|
|
2179
|
+
"../node_modules/prompts/lib/elements/toggle.js"(exports, module) {
|
|
2180
|
+
var color = require_kleur(), Prompt = require_prompt2(), { style, clear } = require_util2(), { cursor, erase } = require_src(), TogglePrompt = class extends Prompt {
|
|
2181
|
+
constructor(opts = {}) {
|
|
2182
|
+
super(opts), this.msg = opts.message, this.value = !!opts.initial, this.active = opts.active || "on", this.inactive = opts.inactive || "off", this.initialValue = this.value, this.render();
|
|
2183
|
+
}
|
|
2184
|
+
reset() {
|
|
2185
|
+
this.value = this.initialValue, this.fire(), this.render();
|
|
2186
|
+
}
|
|
2187
|
+
exit() {
|
|
2188
|
+
this.abort();
|
|
2189
|
+
}
|
|
2190
|
+
abort() {
|
|
2191
|
+
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
|
|
2192
|
+
`), this.close();
|
|
2193
|
+
}
|
|
2194
|
+
submit() {
|
|
2195
|
+
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
2196
|
+
`), this.close();
|
|
2197
|
+
}
|
|
2198
|
+
deactivate() {
|
|
2199
|
+
if (this.value === !1) return this.bell();
|
|
2200
|
+
this.value = !1, this.render();
|
|
2201
|
+
}
|
|
2202
|
+
activate() {
|
|
2203
|
+
if (this.value === !0) return this.bell();
|
|
2204
|
+
this.value = !0, this.render();
|
|
2205
|
+
}
|
|
2206
|
+
delete() {
|
|
2207
|
+
this.deactivate();
|
|
2208
|
+
}
|
|
2209
|
+
left() {
|
|
2210
|
+
this.deactivate();
|
|
2211
|
+
}
|
|
2212
|
+
right() {
|
|
2213
|
+
this.activate();
|
|
2214
|
+
}
|
|
2215
|
+
down() {
|
|
2216
|
+
this.deactivate();
|
|
2217
|
+
}
|
|
2218
|
+
up() {
|
|
2219
|
+
this.activate();
|
|
2220
|
+
}
|
|
2221
|
+
next() {
|
|
2222
|
+
this.value = !this.value, this.fire(), this.render();
|
|
2223
|
+
}
|
|
2224
|
+
_(c, key) {
|
|
2225
|
+
if (c === " ")
|
|
2226
|
+
this.value = !this.value;
|
|
2227
|
+
else if (c === "1")
|
|
2228
|
+
this.value = !0;
|
|
2229
|
+
else if (c === "0")
|
|
2230
|
+
this.value = !1;
|
|
2231
|
+
else return this.bell();
|
|
2232
|
+
this.render();
|
|
2233
|
+
}
|
|
2234
|
+
render() {
|
|
2235
|
+
this.closed || (this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render(), this.outputText = [
|
|
2236
|
+
style.symbol(this.done, this.aborted),
|
|
2237
|
+
color.bold(this.msg),
|
|
2238
|
+
style.delimiter(this.done),
|
|
2239
|
+
this.value ? this.inactive : color.cyan().underline(this.inactive),
|
|
2240
|
+
color.gray("/"),
|
|
2241
|
+
this.value ? color.cyan().underline(this.active) : this.active
|
|
2242
|
+
].join(" "), this.out.write(erase.line + cursor.to(0) + this.outputText));
|
|
2243
|
+
}
|
|
2244
|
+
};
|
|
2245
|
+
module.exports = TogglePrompt;
|
|
2246
|
+
}
|
|
2247
|
+
});
|
|
2248
|
+
|
|
2249
|
+
// ../node_modules/prompts/lib/dateparts/datepart.js
|
|
2250
|
+
var require_datepart2 = __commonJS({
|
|
2251
|
+
"../node_modules/prompts/lib/dateparts/datepart.js"(exports, module) {
|
|
2252
|
+
"use strict";
|
|
2253
|
+
var DatePart = class _DatePart {
|
|
2254
|
+
constructor({ token, date, parts, locales }) {
|
|
2255
|
+
this.token = token, this.date = date || /* @__PURE__ */ new Date(), this.parts = parts || [this], this.locales = locales || {};
|
|
2256
|
+
}
|
|
2257
|
+
up() {
|
|
2258
|
+
}
|
|
2259
|
+
down() {
|
|
2260
|
+
}
|
|
2261
|
+
next() {
|
|
2262
|
+
let currentIdx = this.parts.indexOf(this);
|
|
2263
|
+
return this.parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
|
|
2264
|
+
}
|
|
2265
|
+
setTo(val) {
|
|
2266
|
+
}
|
|
2267
|
+
prev() {
|
|
2268
|
+
let parts = [].concat(this.parts).reverse(), currentIdx = parts.indexOf(this);
|
|
2269
|
+
return parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
|
|
2270
|
+
}
|
|
2271
|
+
toString() {
|
|
2272
|
+
return String(this.date);
|
|
2273
|
+
}
|
|
2274
|
+
};
|
|
2275
|
+
module.exports = DatePart;
|
|
2276
|
+
}
|
|
2277
|
+
});
|
|
2278
|
+
|
|
2279
|
+
// ../node_modules/prompts/lib/dateparts/meridiem.js
|
|
2280
|
+
var require_meridiem2 = __commonJS({
|
|
2281
|
+
"../node_modules/prompts/lib/dateparts/meridiem.js"(exports, module) {
|
|
2282
|
+
"use strict";
|
|
2283
|
+
var DatePart = require_datepart2(), Meridiem = class extends DatePart {
|
|
2284
|
+
constructor(opts = {}) {
|
|
2285
|
+
super(opts);
|
|
2286
|
+
}
|
|
2287
|
+
up() {
|
|
2288
|
+
this.date.setHours((this.date.getHours() + 12) % 24);
|
|
2289
|
+
}
|
|
2290
|
+
down() {
|
|
2291
|
+
this.up();
|
|
2292
|
+
}
|
|
2293
|
+
toString() {
|
|
2294
|
+
let meridiem = this.date.getHours() > 12 ? "pm" : "am";
|
|
2295
|
+
return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2298
|
+
module.exports = Meridiem;
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2301
|
+
|
|
2302
|
+
// ../node_modules/prompts/lib/dateparts/day.js
|
|
2303
|
+
var require_day2 = __commonJS({
|
|
2304
|
+
"../node_modules/prompts/lib/dateparts/day.js"(exports, module) {
|
|
2305
|
+
"use strict";
|
|
2306
|
+
var DatePart = require_datepart2(), pos = (n) => (n = n % 10, n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th"), Day = class extends DatePart {
|
|
2307
|
+
constructor(opts = {}) {
|
|
2308
|
+
super(opts);
|
|
2309
|
+
}
|
|
2310
|
+
up() {
|
|
2311
|
+
this.date.setDate(this.date.getDate() + 1);
|
|
2312
|
+
}
|
|
2313
|
+
down() {
|
|
2314
|
+
this.date.setDate(this.date.getDate() - 1);
|
|
2315
|
+
}
|
|
2316
|
+
setTo(val) {
|
|
2317
|
+
this.date.setDate(parseInt(val.substr(-2)));
|
|
2318
|
+
}
|
|
2319
|
+
toString() {
|
|
2320
|
+
let date = this.date.getDate(), day = this.date.getDay();
|
|
2321
|
+
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;
|
|
2322
|
+
}
|
|
2323
|
+
};
|
|
2324
|
+
module.exports = Day;
|
|
2325
|
+
}
|
|
2326
|
+
});
|
|
2327
|
+
|
|
2328
|
+
// ../node_modules/prompts/lib/dateparts/hours.js
|
|
2329
|
+
var require_hours2 = __commonJS({
|
|
2330
|
+
"../node_modules/prompts/lib/dateparts/hours.js"(exports, module) {
|
|
2331
|
+
"use strict";
|
|
2332
|
+
var DatePart = require_datepart2(), Hours = class extends DatePart {
|
|
2333
|
+
constructor(opts = {}) {
|
|
2334
|
+
super(opts);
|
|
2335
|
+
}
|
|
2336
|
+
up() {
|
|
2337
|
+
this.date.setHours(this.date.getHours() + 1);
|
|
2338
|
+
}
|
|
2339
|
+
down() {
|
|
2340
|
+
this.date.setHours(this.date.getHours() - 1);
|
|
2341
|
+
}
|
|
2342
|
+
setTo(val) {
|
|
2343
|
+
this.date.setHours(parseInt(val.substr(-2)));
|
|
2344
|
+
}
|
|
2345
|
+
toString() {
|
|
2346
|
+
let hours = this.date.getHours();
|
|
2347
|
+
return /h/.test(this.token) && (hours = hours % 12 || 12), this.token.length > 1 ? String(hours).padStart(2, "0") : hours;
|
|
2348
|
+
}
|
|
2349
|
+
};
|
|
2350
|
+
module.exports = Hours;
|
|
2351
|
+
}
|
|
2352
|
+
});
|
|
2353
|
+
|
|
2354
|
+
// ../node_modules/prompts/lib/dateparts/milliseconds.js
|
|
2355
|
+
var require_milliseconds2 = __commonJS({
|
|
2356
|
+
"../node_modules/prompts/lib/dateparts/milliseconds.js"(exports, module) {
|
|
2357
|
+
"use strict";
|
|
2358
|
+
var DatePart = require_datepart2(), Milliseconds = class extends DatePart {
|
|
2359
|
+
constructor(opts = {}) {
|
|
2360
|
+
super(opts);
|
|
2361
|
+
}
|
|
2362
|
+
up() {
|
|
2363
|
+
this.date.setMilliseconds(this.date.getMilliseconds() + 1);
|
|
2364
|
+
}
|
|
2365
|
+
down() {
|
|
2366
|
+
this.date.setMilliseconds(this.date.getMilliseconds() - 1);
|
|
2367
|
+
}
|
|
2368
|
+
setTo(val) {
|
|
2369
|
+
this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));
|
|
2370
|
+
}
|
|
2371
|
+
toString() {
|
|
2372
|
+
return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
|
|
2373
|
+
}
|
|
2374
|
+
};
|
|
2375
|
+
module.exports = Milliseconds;
|
|
2376
|
+
}
|
|
2377
|
+
});
|
|
2378
|
+
|
|
2379
|
+
// ../node_modules/prompts/lib/dateparts/minutes.js
|
|
2380
|
+
var require_minutes2 = __commonJS({
|
|
2381
|
+
"../node_modules/prompts/lib/dateparts/minutes.js"(exports, module) {
|
|
2382
|
+
"use strict";
|
|
2383
|
+
var DatePart = require_datepart2(), Minutes = class extends DatePart {
|
|
2384
|
+
constructor(opts = {}) {
|
|
2385
|
+
super(opts);
|
|
2386
|
+
}
|
|
2387
|
+
up() {
|
|
2388
|
+
this.date.setMinutes(this.date.getMinutes() + 1);
|
|
2389
|
+
}
|
|
2390
|
+
down() {
|
|
2391
|
+
this.date.setMinutes(this.date.getMinutes() - 1);
|
|
2392
|
+
}
|
|
2393
|
+
setTo(val) {
|
|
2394
|
+
this.date.setMinutes(parseInt(val.substr(-2)));
|
|
2395
|
+
}
|
|
2396
|
+
toString() {
|
|
2397
|
+
let m = this.date.getMinutes();
|
|
2398
|
+
return this.token.length > 1 ? String(m).padStart(2, "0") : m;
|
|
2399
|
+
}
|
|
2400
|
+
};
|
|
2401
|
+
module.exports = Minutes;
|
|
2402
|
+
}
|
|
2403
|
+
});
|
|
2404
|
+
|
|
2405
|
+
// ../node_modules/prompts/lib/dateparts/month.js
|
|
2406
|
+
var require_month2 = __commonJS({
|
|
2407
|
+
"../node_modules/prompts/lib/dateparts/month.js"(exports, module) {
|
|
2408
|
+
"use strict";
|
|
2409
|
+
var DatePart = require_datepart2(), Month = class extends DatePart {
|
|
2410
|
+
constructor(opts = {}) {
|
|
2411
|
+
super(opts);
|
|
2412
|
+
}
|
|
2413
|
+
up() {
|
|
2414
|
+
this.date.setMonth(this.date.getMonth() + 1);
|
|
2415
|
+
}
|
|
2416
|
+
down() {
|
|
2417
|
+
this.date.setMonth(this.date.getMonth() - 1);
|
|
2418
|
+
}
|
|
2419
|
+
setTo(val) {
|
|
2420
|
+
val = parseInt(val.substr(-2)) - 1, this.date.setMonth(val < 0 ? 0 : val);
|
|
2421
|
+
}
|
|
2422
|
+
toString() {
|
|
2423
|
+
let month = this.date.getMonth(), tl = this.token.length;
|
|
2424
|
+
return tl === 2 ? String(month + 1).padStart(2, "0") : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
|
|
2425
|
+
}
|
|
2426
|
+
};
|
|
2427
|
+
module.exports = Month;
|
|
2428
|
+
}
|
|
2429
|
+
});
|
|
2430
|
+
|
|
2431
|
+
// ../node_modules/prompts/lib/dateparts/seconds.js
|
|
2432
|
+
var require_seconds2 = __commonJS({
|
|
2433
|
+
"../node_modules/prompts/lib/dateparts/seconds.js"(exports, module) {
|
|
2434
|
+
"use strict";
|
|
2435
|
+
var DatePart = require_datepart2(), Seconds = class extends DatePart {
|
|
2436
|
+
constructor(opts = {}) {
|
|
2437
|
+
super(opts);
|
|
2438
|
+
}
|
|
2439
|
+
up() {
|
|
2440
|
+
this.date.setSeconds(this.date.getSeconds() + 1);
|
|
2441
|
+
}
|
|
2442
|
+
down() {
|
|
2443
|
+
this.date.setSeconds(this.date.getSeconds() - 1);
|
|
2444
|
+
}
|
|
2445
|
+
setTo(val) {
|
|
2446
|
+
this.date.setSeconds(parseInt(val.substr(-2)));
|
|
2447
|
+
}
|
|
2448
|
+
toString() {
|
|
2449
|
+
let s = this.date.getSeconds();
|
|
2450
|
+
return this.token.length > 1 ? String(s).padStart(2, "0") : s;
|
|
2451
|
+
}
|
|
2452
|
+
};
|
|
2453
|
+
module.exports = Seconds;
|
|
2454
|
+
}
|
|
2455
|
+
});
|
|
2456
|
+
|
|
2457
|
+
// ../node_modules/prompts/lib/dateparts/year.js
|
|
2458
|
+
var require_year2 = __commonJS({
|
|
2459
|
+
"../node_modules/prompts/lib/dateparts/year.js"(exports, module) {
|
|
2460
|
+
"use strict";
|
|
2461
|
+
var DatePart = require_datepart2(), Year = class extends DatePart {
|
|
2462
|
+
constructor(opts = {}) {
|
|
2463
|
+
super(opts);
|
|
2464
|
+
}
|
|
2465
|
+
up() {
|
|
2466
|
+
this.date.setFullYear(this.date.getFullYear() + 1);
|
|
2467
|
+
}
|
|
2468
|
+
down() {
|
|
2469
|
+
this.date.setFullYear(this.date.getFullYear() - 1);
|
|
2470
|
+
}
|
|
2471
|
+
setTo(val) {
|
|
2472
|
+
this.date.setFullYear(val.substr(-4));
|
|
2473
|
+
}
|
|
2474
|
+
toString() {
|
|
2475
|
+
let year = String(this.date.getFullYear()).padStart(4, "0");
|
|
2476
|
+
return this.token.length === 2 ? year.substr(-2) : year;
|
|
2477
|
+
}
|
|
2478
|
+
};
|
|
2479
|
+
module.exports = Year;
|
|
2480
|
+
}
|
|
2481
|
+
});
|
|
2482
|
+
|
|
2483
|
+
// ../node_modules/prompts/lib/dateparts/index.js
|
|
2484
|
+
var require_dateparts2 = __commonJS({
|
|
2485
|
+
"../node_modules/prompts/lib/dateparts/index.js"(exports, module) {
|
|
2486
|
+
"use strict";
|
|
2487
|
+
module.exports = {
|
|
2488
|
+
DatePart: require_datepart2(),
|
|
2489
|
+
Meridiem: require_meridiem2(),
|
|
2490
|
+
Day: require_day2(),
|
|
2491
|
+
Hours: require_hours2(),
|
|
2492
|
+
Milliseconds: require_milliseconds2(),
|
|
2493
|
+
Minutes: require_minutes2(),
|
|
2494
|
+
Month: require_month2(),
|
|
2495
|
+
Seconds: require_seconds2(),
|
|
2496
|
+
Year: require_year2()
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2500
|
+
|
|
2501
|
+
// ../node_modules/prompts/lib/elements/date.js
|
|
2502
|
+
var require_date2 = __commonJS({
|
|
2503
|
+
"../node_modules/prompts/lib/elements/date.js"(exports, module) {
|
|
2504
|
+
"use strict";
|
|
2505
|
+
var color = require_kleur(), Prompt = require_prompt2(), { style, clear, figures } = require_util2(), { erase, cursor } = require_src(), { DatePart, Meridiem, Day, Hours, Milliseconds, Minutes, Month, Seconds, Year } = require_dateparts2(), 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, regexGroups = {
|
|
2506
|
+
1: ({ token }) => token.replace(/\\(.)/g, "$1"),
|
|
2507
|
+
2: (opts) => new Day(opts),
|
|
2508
|
+
// Day // TODO
|
|
2509
|
+
3: (opts) => new Month(opts),
|
|
2510
|
+
// Month
|
|
2511
|
+
4: (opts) => new Year(opts),
|
|
2512
|
+
// Year
|
|
2513
|
+
5: (opts) => new Meridiem(opts),
|
|
2514
|
+
// AM/PM // TODO (special)
|
|
2515
|
+
6: (opts) => new Hours(opts),
|
|
2516
|
+
// Hours
|
|
2517
|
+
7: (opts) => new Minutes(opts),
|
|
2518
|
+
// Minutes
|
|
2519
|
+
8: (opts) => new Seconds(opts),
|
|
2520
|
+
// Seconds
|
|
2521
|
+
9: (opts) => new Milliseconds(opts)
|
|
2522
|
+
// Fractional seconds
|
|
2523
|
+
}, dfltLocales = {
|
|
2524
|
+
months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
|
|
2525
|
+
monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
|
|
2526
|
+
weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
|
|
2527
|
+
weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
|
|
2528
|
+
}, DatePrompt = class extends Prompt {
|
|
2529
|
+
constructor(opts = {}) {
|
|
2530
|
+
super(opts), this.msg = opts.message, this.cursor = 0, this.typed = "", this.locales = Object.assign(dfltLocales, opts.locales), this._date = opts.initial || /* @__PURE__ */ new Date(), this.errorMsg = opts.error || "Please Enter A Valid Value", this.validator = opts.validate || (() => !0), this.mask = opts.mask || "YYYY-MM-DD HH:mm:ss", this.clear = clear("", this.out.columns), this.render();
|
|
2531
|
+
}
|
|
2532
|
+
get value() {
|
|
2533
|
+
return this.date;
|
|
2534
|
+
}
|
|
2535
|
+
get date() {
|
|
2536
|
+
return this._date;
|
|
2537
|
+
}
|
|
2538
|
+
set date(date) {
|
|
2539
|
+
date && this._date.setTime(date.getTime());
|
|
2540
|
+
}
|
|
2541
|
+
set mask(mask) {
|
|
2542
|
+
let result;
|
|
2543
|
+
for (this.parts = []; result = regex.exec(mask); ) {
|
|
2544
|
+
let match = result.shift(), idx = result.findIndex((gr) => gr != null);
|
|
2545
|
+
this.parts.push(idx in regexGroups ? regexGroups[idx]({ token: result[idx] || match, date: this.date, parts: this.parts, locales: this.locales }) : result[idx] || match);
|
|
2546
|
+
}
|
|
2547
|
+
let parts = this.parts.reduce((arr, i) => (typeof i == "string" && typeof arr[arr.length - 1] == "string" ? arr[arr.length - 1] += i : arr.push(i), arr), []);
|
|
2548
|
+
this.parts.splice(0), this.parts.push(...parts), this.reset();
|
|
2549
|
+
}
|
|
2550
|
+
moveCursor(n) {
|
|
2551
|
+
this.typed = "", this.cursor = n, this.fire();
|
|
2552
|
+
}
|
|
2553
|
+
reset() {
|
|
2554
|
+
this.moveCursor(this.parts.findIndex((p) => p instanceof DatePart)), this.fire(), this.render();
|
|
2555
|
+
}
|
|
2556
|
+
exit() {
|
|
2557
|
+
this.abort();
|
|
2558
|
+
}
|
|
2559
|
+
abort() {
|
|
2560
|
+
this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`
|
|
2561
|
+
`), this.close();
|
|
2562
|
+
}
|
|
2563
|
+
async validate() {
|
|
2564
|
+
let valid = await this.validator(this.value);
|
|
2565
|
+
typeof valid == "string" && (this.errorMsg = valid, valid = !1), this.error = !valid;
|
|
2566
|
+
}
|
|
2567
|
+
async submit() {
|
|
2568
|
+
if (await this.validate(), this.error) {
|
|
2569
|
+
this.color = "red", this.fire(), this.render();
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
2573
|
+
`), this.close();
|
|
2574
|
+
}
|
|
2575
|
+
up() {
|
|
2576
|
+
this.typed = "", this.parts[this.cursor].up(), this.render();
|
|
2577
|
+
}
|
|
2578
|
+
down() {
|
|
2579
|
+
this.typed = "", this.parts[this.cursor].down(), this.render();
|
|
2580
|
+
}
|
|
2581
|
+
left() {
|
|
2582
|
+
let prev = this.parts[this.cursor].prev();
|
|
2583
|
+
if (prev == null) return this.bell();
|
|
2584
|
+
this.moveCursor(this.parts.indexOf(prev)), this.render();
|
|
2585
|
+
}
|
|
2586
|
+
right() {
|
|
2587
|
+
let next = this.parts[this.cursor].next();
|
|
2588
|
+
if (next == null) return this.bell();
|
|
2589
|
+
this.moveCursor(this.parts.indexOf(next)), this.render();
|
|
2590
|
+
}
|
|
2591
|
+
next() {
|
|
2592
|
+
let next = this.parts[this.cursor].next();
|
|
2593
|
+
this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex((part) => part instanceof DatePart)), this.render();
|
|
2594
|
+
}
|
|
2595
|
+
_(c) {
|
|
2596
|
+
/\d/.test(c) && (this.typed += c, this.parts[this.cursor].setTo(this.typed), this.render());
|
|
2597
|
+
}
|
|
2598
|
+
render() {
|
|
2599
|
+
this.closed || (this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render(), this.outputText = [
|
|
2600
|
+
style.symbol(this.done, this.aborted),
|
|
2601
|
+
color.bold(this.msg),
|
|
2602
|
+
style.delimiter(!1),
|
|
2603
|
+
this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join("")
|
|
2604
|
+
].join(" "), this.error && (this.outputText += this.errorMsg.split(`
|
|
2605
|
+
`).reduce(
|
|
2606
|
+
(a, l, i) => a + `
|
|
2607
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`,
|
|
2608
|
+
""
|
|
2609
|
+
)), this.out.write(erase.line + cursor.to(0) + this.outputText));
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2612
|
+
module.exports = DatePrompt;
|
|
2613
|
+
}
|
|
2614
|
+
});
|
|
2615
|
+
|
|
2616
|
+
// ../node_modules/prompts/lib/elements/number.js
|
|
2617
|
+
var require_number2 = __commonJS({
|
|
2618
|
+
"../node_modules/prompts/lib/elements/number.js"(exports, module) {
|
|
2619
|
+
var color = require_kleur(), Prompt = require_prompt2(), { cursor, erase } = require_src(), { style, figures, clear, lines } = require_util2(), isNumber = /[0-9]/, isDef = (any) => any !== void 0, round = (number, precision) => {
|
|
2620
|
+
let factor = Math.pow(10, precision);
|
|
2621
|
+
return Math.round(number * factor) / factor;
|
|
2622
|
+
}, NumberPrompt = class extends Prompt {
|
|
2623
|
+
constructor(opts = {}) {
|
|
2624
|
+
super(opts), this.transform = style.render(opts.style), this.msg = opts.message, this.initial = isDef(opts.initial) ? opts.initial : "", this.float = !!opts.float, this.round = opts.round || 2, this.inc = opts.increment || 1, this.min = isDef(opts.min) ? opts.min : -1 / 0, this.max = isDef(opts.max) ? opts.max : 1 / 0, this.errorMsg = opts.error || "Please Enter A Valid Value", this.validator = opts.validate || (() => !0), this.color = "cyan", this.value = "", this.typed = "", this.lastHit = 0, this.render();
|
|
2625
|
+
}
|
|
2626
|
+
set value(v) {
|
|
2627
|
+
!v && v !== 0 ? (this.placeholder = !0, this.rendered = color.gray(this.transform.render(`${this.initial}`)), this._value = "") : (this.placeholder = !1, this.rendered = this.transform.render(`${round(v, this.round)}`), this._value = round(v, this.round)), this.fire();
|
|
2628
|
+
}
|
|
2629
|
+
get value() {
|
|
2630
|
+
return this._value;
|
|
2631
|
+
}
|
|
2632
|
+
parse(x) {
|
|
2633
|
+
return this.float ? parseFloat(x) : parseInt(x);
|
|
2634
|
+
}
|
|
2635
|
+
valid(c) {
|
|
2636
|
+
return c === "-" || c === "." && this.float || isNumber.test(c);
|
|
2637
|
+
}
|
|
2638
|
+
reset() {
|
|
2639
|
+
this.typed = "", this.value = "", this.fire(), this.render();
|
|
2640
|
+
}
|
|
2641
|
+
exit() {
|
|
2642
|
+
this.abort();
|
|
2643
|
+
}
|
|
2644
|
+
abort() {
|
|
2645
|
+
let x = this.value;
|
|
2646
|
+
this.value = x !== "" ? x : this.initial, this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`
|
|
2647
|
+
`), this.close();
|
|
2648
|
+
}
|
|
2649
|
+
async validate() {
|
|
2650
|
+
let valid = await this.validator(this.value);
|
|
2651
|
+
typeof valid == "string" && (this.errorMsg = valid, valid = !1), this.error = !valid;
|
|
2652
|
+
}
|
|
2653
|
+
async submit() {
|
|
2654
|
+
if (await this.validate(), this.error) {
|
|
2655
|
+
this.color = "red", this.fire(), this.render();
|
|
2656
|
+
return;
|
|
2657
|
+
}
|
|
2658
|
+
let x = this.value;
|
|
2659
|
+
this.value = x !== "" ? x : this.initial, this.done = !0, this.aborted = !1, this.error = !1, this.fire(), this.render(), this.out.write(`
|
|
2660
|
+
`), this.close();
|
|
2661
|
+
}
|
|
2662
|
+
up() {
|
|
2663
|
+
if (this.typed = "", this.value === "" && (this.value = this.min - this.inc), this.value >= this.max) return this.bell();
|
|
2664
|
+
this.value += this.inc, this.color = "cyan", this.fire(), this.render();
|
|
2665
|
+
}
|
|
2666
|
+
down() {
|
|
2667
|
+
if (this.typed = "", this.value === "" && (this.value = this.min + this.inc), this.value <= this.min) return this.bell();
|
|
2668
|
+
this.value -= this.inc, this.color = "cyan", this.fire(), this.render();
|
|
2669
|
+
}
|
|
2670
|
+
delete() {
|
|
2671
|
+
let val = this.value.toString();
|
|
2672
|
+
if (val.length === 0) return this.bell();
|
|
2673
|
+
this.value = this.parse(val = val.slice(0, -1)) || "", this.value !== "" && this.value < this.min && (this.value = this.min), this.color = "cyan", this.fire(), this.render();
|
|
2674
|
+
}
|
|
2675
|
+
next() {
|
|
2676
|
+
this.value = this.initial, this.fire(), this.render();
|
|
2677
|
+
}
|
|
2678
|
+
_(c, key) {
|
|
2679
|
+
if (!this.valid(c)) return this.bell();
|
|
2680
|
+
let now = Date.now();
|
|
2681
|
+
if (now - this.lastHit > 1e3 && (this.typed = ""), this.typed += c, this.lastHit = now, this.color = "cyan", c === ".") return this.fire();
|
|
2682
|
+
this.value = Math.min(this.parse(this.typed), this.max), this.value > this.max && (this.value = this.max), this.value < this.min && (this.value = this.min), this.fire(), this.render();
|
|
2683
|
+
}
|
|
2684
|
+
render() {
|
|
2685
|
+
this.closed || (this.firstRender || (this.outputError && this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns)), this.out.write(clear(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [
|
|
2686
|
+
style.symbol(this.done, this.aborted),
|
|
2687
|
+
color.bold(this.msg),
|
|
2688
|
+
style.delimiter(this.done),
|
|
2689
|
+
!this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
|
|
2690
|
+
].join(" "), this.error && (this.outputError += this.errorMsg.split(`
|
|
2691
|
+
`).reduce((a, l, i) => a + `
|
|
2692
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, "")), this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore));
|
|
2693
|
+
}
|
|
2694
|
+
};
|
|
2695
|
+
module.exports = NumberPrompt;
|
|
2696
|
+
}
|
|
2697
|
+
});
|
|
2698
|
+
|
|
2699
|
+
// ../node_modules/prompts/lib/elements/multiselect.js
|
|
2700
|
+
var require_multiselect2 = __commonJS({
|
|
2701
|
+
"../node_modules/prompts/lib/elements/multiselect.js"(exports, module) {
|
|
2702
|
+
"use strict";
|
|
2703
|
+
var color = require_kleur(), { cursor } = require_src(), Prompt = require_prompt2(), { clear, figures, style, wrap, entriesToDisplay } = require_util2(), MultiselectPrompt = class extends Prompt {
|
|
2704
|
+
constructor(opts = {}) {
|
|
2705
|
+
super(opts), this.msg = opts.message, this.cursor = opts.cursor || 0, this.scrollIndex = opts.cursor || 0, this.hint = opts.hint || "", this.warn = opts.warn || "- This option is disabled -", this.minSelected = opts.min, this.showMinError = !1, this.maxChoices = opts.max, this.instructions = opts.instructions, this.optionsPerPage = opts.optionsPerPage || 10, this.value = opts.choices.map((ch, idx) => (typeof ch == "string" && (ch = { title: ch, value: idx }), {
|
|
2706
|
+
title: ch && (ch.title || ch.value || ch),
|
|
2707
|
+
description: ch && ch.description,
|
|
2708
|
+
value: ch && (ch.value === void 0 ? idx : ch.value),
|
|
2709
|
+
selected: ch && ch.selected,
|
|
2710
|
+
disabled: ch && ch.disabled
|
|
2711
|
+
})), this.clear = clear("", this.out.columns), opts.overrideRender || this.render();
|
|
2712
|
+
}
|
|
2713
|
+
reset() {
|
|
2714
|
+
this.value.map((v) => !v.selected), this.cursor = 0, this.fire(), this.render();
|
|
2715
|
+
}
|
|
2716
|
+
selected() {
|
|
2717
|
+
return this.value.filter((v) => v.selected);
|
|
2718
|
+
}
|
|
2719
|
+
exit() {
|
|
2720
|
+
this.abort();
|
|
2721
|
+
}
|
|
2722
|
+
abort() {
|
|
2723
|
+
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
|
|
2724
|
+
`), this.close();
|
|
2725
|
+
}
|
|
2726
|
+
submit() {
|
|
2727
|
+
let selected = this.value.filter((e) => e.selected);
|
|
2728
|
+
this.minSelected && selected.length < this.minSelected ? (this.showMinError = !0, this.render()) : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
2729
|
+
`), this.close());
|
|
2730
|
+
}
|
|
2731
|
+
first() {
|
|
2732
|
+
this.cursor = 0, this.render();
|
|
2733
|
+
}
|
|
2734
|
+
last() {
|
|
2735
|
+
this.cursor = this.value.length - 1, this.render();
|
|
2736
|
+
}
|
|
2737
|
+
next() {
|
|
2738
|
+
this.cursor = (this.cursor + 1) % this.value.length, this.render();
|
|
2739
|
+
}
|
|
2740
|
+
up() {
|
|
2741
|
+
this.cursor === 0 ? this.cursor = this.value.length - 1 : this.cursor--, this.render();
|
|
2742
|
+
}
|
|
2743
|
+
down() {
|
|
2744
|
+
this.cursor === this.value.length - 1 ? this.cursor = 0 : this.cursor++, this.render();
|
|
2745
|
+
}
|
|
2746
|
+
left() {
|
|
2747
|
+
this.value[this.cursor].selected = !1, this.render();
|
|
2748
|
+
}
|
|
2749
|
+
right() {
|
|
2750
|
+
if (this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell();
|
|
2751
|
+
this.value[this.cursor].selected = !0, this.render();
|
|
2752
|
+
}
|
|
2753
|
+
handleSpaceToggle() {
|
|
2754
|
+
let v = this.value[this.cursor];
|
|
2755
|
+
if (v.selected)
|
|
2756
|
+
v.selected = !1, this.render();
|
|
2757
|
+
else {
|
|
2758
|
+
if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices)
|
|
2759
|
+
return this.bell();
|
|
2760
|
+
v.selected = !0, this.render();
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
toggleAll() {
|
|
2764
|
+
if (this.maxChoices !== void 0 || this.value[this.cursor].disabled)
|
|
2765
|
+
return this.bell();
|
|
2766
|
+
let newSelected = !this.value[this.cursor].selected;
|
|
2767
|
+
this.value.filter((v) => !v.disabled).forEach((v) => v.selected = newSelected), this.render();
|
|
2768
|
+
}
|
|
2769
|
+
_(c, key) {
|
|
2770
|
+
if (c === " ")
|
|
2771
|
+
this.handleSpaceToggle();
|
|
2772
|
+
else if (c === "a")
|
|
2773
|
+
this.toggleAll();
|
|
2774
|
+
else
|
|
2775
|
+
return this.bell();
|
|
2776
|
+
}
|
|
2777
|
+
renderInstructions() {
|
|
2778
|
+
return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : `
|
|
2779
|
+
Instructions:
|
|
2780
|
+
${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
2781
|
+
${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
2782
|
+
` + (this.maxChoices === void 0 ? ` a: Toggle all
|
|
2783
|
+
` : "") + " enter/return: Complete answer" : "";
|
|
2784
|
+
}
|
|
2785
|
+
renderOption(cursor2, v, i, arrowIndicator) {
|
|
2786
|
+
let prefix = (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + arrowIndicator + " ", title, desc;
|
|
2787
|
+
return v.disabled ? title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title) : (title = cursor2 === i ? color.cyan().underline(v.title) : v.title, cursor2 === i && v.description && (desc = ` - ${v.description}`, (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) && (desc = `
|
|
2788
|
+
` + wrap(v.description, { margin: prefix.length, width: this.out.columns })))), prefix + title + color.gray(desc || "");
|
|
2789
|
+
}
|
|
2790
|
+
// shared with autocompleteMultiselect
|
|
2791
|
+
paginateOptions(options) {
|
|
2792
|
+
if (options.length === 0)
|
|
2793
|
+
return color.red("No matches for this query.");
|
|
2794
|
+
let { startIndex, endIndex } = entriesToDisplay(this.cursor, options.length, this.optionsPerPage), prefix, styledOptions = [];
|
|
2795
|
+
for (let i = startIndex; i < endIndex; i++)
|
|
2796
|
+
i === startIndex && startIndex > 0 ? prefix = figures.arrowUp : i === endIndex - 1 && endIndex < options.length ? prefix = figures.arrowDown : prefix = " ", styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
|
|
2797
|
+
return `
|
|
2798
|
+
` + styledOptions.join(`
|
|
2799
|
+
`);
|
|
2800
|
+
}
|
|
2801
|
+
// shared with autocomleteMultiselect
|
|
2802
|
+
renderOptions(options) {
|
|
2803
|
+
return this.done ? "" : this.paginateOptions(options);
|
|
2804
|
+
}
|
|
2805
|
+
renderDoneOrInstructions() {
|
|
2806
|
+
if (this.done)
|
|
2807
|
+
return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
|
|
2808
|
+
let output = [color.gray(this.hint), this.renderInstructions()];
|
|
2809
|
+
return this.value[this.cursor].disabled && output.push(color.yellow(this.warn)), output.join(" ");
|
|
2810
|
+
}
|
|
2811
|
+
render() {
|
|
2812
|
+
if (this.closed) return;
|
|
2813
|
+
this.firstRender && this.out.write(cursor.hide), super.render();
|
|
2814
|
+
let prompt = [
|
|
2815
|
+
style.symbol(this.done, this.aborted),
|
|
2816
|
+
color.bold(this.msg),
|
|
2817
|
+
style.delimiter(!1),
|
|
2818
|
+
this.renderDoneOrInstructions()
|
|
2819
|
+
].join(" ");
|
|
2820
|
+
this.showMinError && (prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), prompt += this.renderOptions(this.value), this.out.write(this.clear + prompt), this.clear = clear(prompt, this.out.columns);
|
|
2821
|
+
}
|
|
2822
|
+
};
|
|
2823
|
+
module.exports = MultiselectPrompt;
|
|
2824
|
+
}
|
|
2825
|
+
});
|
|
2826
|
+
|
|
2827
|
+
// ../node_modules/prompts/lib/elements/autocomplete.js
|
|
2828
|
+
var require_autocomplete2 = __commonJS({
|
|
2829
|
+
"../node_modules/prompts/lib/elements/autocomplete.js"(exports, module) {
|
|
2830
|
+
"use strict";
|
|
2831
|
+
var color = require_kleur(), Prompt = require_prompt2(), { erase, cursor } = require_src(), { style, clear, figures, wrap, entriesToDisplay } = require_util2(), getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]), getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]), getIndex = (arr, valOrTitle) => {
|
|
2832
|
+
let index = arr.findIndex((el) => el.value === valOrTitle || el.title === valOrTitle);
|
|
2833
|
+
return index > -1 ? index : void 0;
|
|
2834
|
+
}, AutocompletePrompt = class extends Prompt {
|
|
2835
|
+
constructor(opts = {}) {
|
|
2836
|
+
super(opts), this.msg = opts.message, this.suggest = opts.suggest, this.choices = opts.choices, this.initial = typeof opts.initial == "number" ? opts.initial : getIndex(opts.choices, opts.initial), this.select = this.initial || opts.cursor || 0, this.i18n = { noMatches: opts.noMatches || "no matches found" }, this.fallback = opts.fallback || this.initial, this.clearFirst = opts.clearFirst || !1, this.suggestions = [], this.input = "", this.limit = opts.limit || 10, this.cursor = 0, this.transform = style.render(opts.style), this.scale = this.transform.scale, this.render = this.render.bind(this), this.complete = this.complete.bind(this), this.clear = clear("", this.out.columns), this.complete(this.render), this.render();
|
|
2837
|
+
}
|
|
2838
|
+
set fallback(fb) {
|
|
2839
|
+
this._fb = Number.isSafeInteger(parseInt(fb)) ? parseInt(fb) : fb;
|
|
2840
|
+
}
|
|
2841
|
+
get fallback() {
|
|
2842
|
+
let choice;
|
|
2843
|
+
return typeof this._fb == "number" ? choice = this.choices[this._fb] : typeof this._fb == "string" && (choice = { title: this._fb }), choice || this._fb || { title: this.i18n.noMatches };
|
|
2844
|
+
}
|
|
2845
|
+
moveSelect(i) {
|
|
2846
|
+
this.select = i, this.suggestions.length > 0 ? this.value = getVal(this.suggestions, i) : this.value = this.fallback.value, this.fire();
|
|
2847
|
+
}
|
|
2848
|
+
async complete(cb) {
|
|
2849
|
+
let p = this.completing = this.suggest(this.input, this.choices), suggestions = await p;
|
|
2850
|
+
if (this.completing !== p) return;
|
|
2851
|
+
this.suggestions = suggestions.map((s, i, arr) => ({ title: getTitle(arr, i), value: getVal(arr, i), description: s.description })), this.completing = !1;
|
|
2852
|
+
let l = Math.max(suggestions.length - 1, 0);
|
|
2853
|
+
this.moveSelect(Math.min(l, this.select)), cb && cb();
|
|
2854
|
+
}
|
|
2855
|
+
reset() {
|
|
2856
|
+
this.input = "", this.complete(() => {
|
|
2857
|
+
this.moveSelect(this.initial !== void 0 ? this.initial : 0), this.render();
|
|
2858
|
+
}), this.render();
|
|
2859
|
+
}
|
|
2860
|
+
exit() {
|
|
2861
|
+
this.clearFirst && this.input.length > 0 ? this.reset() : (this.done = this.exited = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
2862
|
+
`), this.close());
|
|
2863
|
+
}
|
|
2864
|
+
abort() {
|
|
2865
|
+
this.done = this.aborted = !0, this.exited = !1, this.fire(), this.render(), this.out.write(`
|
|
2866
|
+
`), this.close();
|
|
2867
|
+
}
|
|
2868
|
+
submit() {
|
|
2869
|
+
this.done = !0, this.aborted = this.exited = !1, this.fire(), this.render(), this.out.write(`
|
|
2870
|
+
`), this.close();
|
|
2871
|
+
}
|
|
2872
|
+
_(c, key) {
|
|
2873
|
+
let s1 = this.input.slice(0, this.cursor), s2 = this.input.slice(this.cursor);
|
|
2874
|
+
this.input = `${s1}${c}${s2}`, this.cursor = s1.length + 1, this.complete(this.render), this.render();
|
|
2875
|
+
}
|
|
2876
|
+
delete() {
|
|
2877
|
+
if (this.cursor === 0) return this.bell();
|
|
2878
|
+
let s1 = this.input.slice(0, this.cursor - 1), s2 = this.input.slice(this.cursor);
|
|
2879
|
+
this.input = `${s1}${s2}`, this.complete(this.render), this.cursor = this.cursor - 1, this.render();
|
|
2880
|
+
}
|
|
2881
|
+
deleteForward() {
|
|
2882
|
+
if (this.cursor * this.scale >= this.rendered.length) return this.bell();
|
|
2883
|
+
let s1 = this.input.slice(0, this.cursor), s2 = this.input.slice(this.cursor + 1);
|
|
2884
|
+
this.input = `${s1}${s2}`, this.complete(this.render), this.render();
|
|
2885
|
+
}
|
|
2886
|
+
first() {
|
|
2887
|
+
this.moveSelect(0), this.render();
|
|
2888
|
+
}
|
|
2889
|
+
last() {
|
|
2890
|
+
this.moveSelect(this.suggestions.length - 1), this.render();
|
|
2891
|
+
}
|
|
2892
|
+
up() {
|
|
2893
|
+
this.select === 0 ? this.moveSelect(this.suggestions.length - 1) : this.moveSelect(this.select - 1), this.render();
|
|
2894
|
+
}
|
|
2895
|
+
down() {
|
|
2896
|
+
this.select === this.suggestions.length - 1 ? this.moveSelect(0) : this.moveSelect(this.select + 1), this.render();
|
|
2897
|
+
}
|
|
2898
|
+
next() {
|
|
2899
|
+
this.select === this.suggestions.length - 1 ? this.moveSelect(0) : this.moveSelect(this.select + 1), this.render();
|
|
2900
|
+
}
|
|
2901
|
+
nextPage() {
|
|
2902
|
+
this.moveSelect(Math.min(this.select + this.limit, this.suggestions.length - 1)), this.render();
|
|
2903
|
+
}
|
|
2904
|
+
prevPage() {
|
|
2905
|
+
this.moveSelect(Math.max(this.select - this.limit, 0)), this.render();
|
|
2906
|
+
}
|
|
2907
|
+
left() {
|
|
2908
|
+
if (this.cursor <= 0) return this.bell();
|
|
2909
|
+
this.cursor = this.cursor - 1, this.render();
|
|
2910
|
+
}
|
|
2911
|
+
right() {
|
|
2912
|
+
if (this.cursor * this.scale >= this.rendered.length) return this.bell();
|
|
2913
|
+
this.cursor = this.cursor + 1, this.render();
|
|
2914
|
+
}
|
|
2915
|
+
renderOption(v, hovered, isStart, isEnd) {
|
|
2916
|
+
let desc, prefix = isStart ? figures.arrowUp : isEnd ? figures.arrowDown : " ", title = hovered ? color.cyan().underline(v.title) : v.title;
|
|
2917
|
+
return prefix = (hovered ? color.cyan(figures.pointer) + " " : " ") + prefix, v.description && (desc = ` - ${v.description}`, (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) && (desc = `
|
|
2918
|
+
` + wrap(v.description, { margin: 3, width: this.out.columns }))), prefix + " " + title + color.gray(desc || "");
|
|
2919
|
+
}
|
|
2920
|
+
render() {
|
|
2921
|
+
if (this.closed) return;
|
|
2922
|
+
this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render();
|
|
2923
|
+
let { startIndex, endIndex } = entriesToDisplay(this.select, this.choices.length, this.limit);
|
|
2924
|
+
if (this.outputText = [
|
|
2925
|
+
style.symbol(this.done, this.aborted, this.exited),
|
|
2926
|
+
color.bold(this.msg),
|
|
2927
|
+
style.delimiter(this.completing),
|
|
2928
|
+
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
|
|
2929
|
+
].join(" "), !this.done) {
|
|
2930
|
+
let suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(
|
|
2931
|
+
item,
|
|
2932
|
+
this.select === i + startIndex,
|
|
2933
|
+
i === 0 && startIndex > 0,
|
|
2934
|
+
i + startIndex === endIndex - 1 && endIndex < this.choices.length
|
|
2935
|
+
)).join(`
|
|
2936
|
+
`);
|
|
2937
|
+
this.outputText += `
|
|
2938
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
2939
|
+
}
|
|
2940
|
+
this.out.write(erase.line + cursor.to(0) + this.outputText);
|
|
2941
|
+
}
|
|
2942
|
+
};
|
|
2943
|
+
module.exports = AutocompletePrompt;
|
|
2944
|
+
}
|
|
2945
|
+
});
|
|
2946
|
+
|
|
2947
|
+
// ../node_modules/prompts/lib/elements/autocompleteMultiselect.js
|
|
2948
|
+
var require_autocompleteMultiselect2 = __commonJS({
|
|
2949
|
+
"../node_modules/prompts/lib/elements/autocompleteMultiselect.js"(exports, module) {
|
|
2950
|
+
"use strict";
|
|
2951
|
+
var color = require_kleur(), { cursor } = require_src(), MultiselectPrompt = require_multiselect2(), { clear, style, figures } = require_util2(), AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
|
|
2952
|
+
constructor(opts = {}) {
|
|
2953
|
+
opts.overrideRender = !0, super(opts), this.inputValue = "", this.clear = clear("", this.out.columns), this.filteredOptions = this.value, this.render();
|
|
2954
|
+
}
|
|
2955
|
+
last() {
|
|
2956
|
+
this.cursor = this.filteredOptions.length - 1, this.render();
|
|
2957
|
+
}
|
|
2958
|
+
next() {
|
|
2959
|
+
this.cursor = (this.cursor + 1) % this.filteredOptions.length, this.render();
|
|
2960
|
+
}
|
|
2961
|
+
up() {
|
|
2962
|
+
this.cursor === 0 ? this.cursor = this.filteredOptions.length - 1 : this.cursor--, this.render();
|
|
2963
|
+
}
|
|
2964
|
+
down() {
|
|
2965
|
+
this.cursor === this.filteredOptions.length - 1 ? this.cursor = 0 : this.cursor++, this.render();
|
|
2966
|
+
}
|
|
2967
|
+
left() {
|
|
2968
|
+
this.filteredOptions[this.cursor].selected = !1, this.render();
|
|
2969
|
+
}
|
|
2970
|
+
right() {
|
|
2971
|
+
if (this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell();
|
|
2972
|
+
this.filteredOptions[this.cursor].selected = !0, this.render();
|
|
2973
|
+
}
|
|
2974
|
+
delete() {
|
|
2975
|
+
this.inputValue.length && (this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1), this.updateFilteredOptions());
|
|
2976
|
+
}
|
|
2977
|
+
updateFilteredOptions() {
|
|
2978
|
+
let currentHighlight = this.filteredOptions[this.cursor];
|
|
2979
|
+
this.filteredOptions = this.value.filter((v) => this.inputValue ? !!(typeof v.title == "string" && v.title.toLowerCase().includes(this.inputValue.toLowerCase()) || typeof v.value == "string" && v.value.toLowerCase().includes(this.inputValue.toLowerCase())) : !0);
|
|
2980
|
+
let newHighlightIndex = this.filteredOptions.findIndex((v) => v === currentHighlight);
|
|
2981
|
+
this.cursor = newHighlightIndex < 0 ? 0 : newHighlightIndex, this.render();
|
|
2982
|
+
}
|
|
2983
|
+
handleSpaceToggle() {
|
|
2984
|
+
let v = this.filteredOptions[this.cursor];
|
|
2985
|
+
if (v.selected)
|
|
2986
|
+
v.selected = !1, this.render();
|
|
2987
|
+
else {
|
|
2988
|
+
if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices)
|
|
2989
|
+
return this.bell();
|
|
2990
|
+
v.selected = !0, this.render();
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
handleInputChange(c) {
|
|
2994
|
+
this.inputValue = this.inputValue + c, this.updateFilteredOptions();
|
|
2995
|
+
}
|
|
2996
|
+
_(c, key) {
|
|
2997
|
+
c === " " ? this.handleSpaceToggle() : this.handleInputChange(c);
|
|
2998
|
+
}
|
|
2999
|
+
renderInstructions() {
|
|
3000
|
+
return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : `
|
|
3001
|
+
Instructions:
|
|
3002
|
+
${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
3003
|
+
${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
3004
|
+
[a,b,c]/delete: Filter choices
|
|
3005
|
+
enter/return: Complete answer
|
|
3006
|
+
` : "";
|
|
3007
|
+
}
|
|
3008
|
+
renderCurrentInput() {
|
|
3009
|
+
return `
|
|
3010
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
3011
|
+
`;
|
|
3012
|
+
}
|
|
3013
|
+
renderOption(cursor2, v, i) {
|
|
3014
|
+
let title;
|
|
3015
|
+
return v.disabled ? title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title) : title = cursor2 === i ? color.cyan().underline(v.title) : v.title, (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
|
|
3016
|
+
}
|
|
3017
|
+
renderDoneOrInstructions() {
|
|
3018
|
+
if (this.done)
|
|
3019
|
+
return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
|
|
3020
|
+
let output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
|
|
3021
|
+
return this.filteredOptions.length && this.filteredOptions[this.cursor].disabled && output.push(color.yellow(this.warn)), output.join(" ");
|
|
3022
|
+
}
|
|
3023
|
+
render() {
|
|
3024
|
+
if (this.closed) return;
|
|
3025
|
+
this.firstRender && this.out.write(cursor.hide), super.render();
|
|
3026
|
+
let prompt = [
|
|
3027
|
+
style.symbol(this.done, this.aborted),
|
|
3028
|
+
color.bold(this.msg),
|
|
3029
|
+
style.delimiter(!1),
|
|
3030
|
+
this.renderDoneOrInstructions()
|
|
3031
|
+
].join(" ");
|
|
3032
|
+
this.showMinError && (prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), prompt += this.renderOptions(this.filteredOptions), this.out.write(this.clear + prompt), this.clear = clear(prompt, this.out.columns);
|
|
3033
|
+
}
|
|
3034
|
+
};
|
|
3035
|
+
module.exports = AutocompleteMultiselectPrompt;
|
|
3036
|
+
}
|
|
3037
|
+
});
|
|
3038
|
+
|
|
3039
|
+
// ../node_modules/prompts/lib/elements/confirm.js
|
|
3040
|
+
var require_confirm2 = __commonJS({
|
|
3041
|
+
"../node_modules/prompts/lib/elements/confirm.js"(exports, module) {
|
|
3042
|
+
var color = require_kleur(), Prompt = require_prompt2(), { style, clear } = require_util2(), { erase, cursor } = require_src(), ConfirmPrompt = class extends Prompt {
|
|
3043
|
+
constructor(opts = {}) {
|
|
3044
|
+
super(opts), this.msg = opts.message, this.value = opts.initial, this.initialValue = !!opts.initial, this.yesMsg = opts.yes || "yes", this.yesOption = opts.yesOption || "(Y/n)", this.noMsg = opts.no || "no", this.noOption = opts.noOption || "(y/N)", this.render();
|
|
3045
|
+
}
|
|
3046
|
+
reset() {
|
|
3047
|
+
this.value = this.initialValue, this.fire(), this.render();
|
|
3048
|
+
}
|
|
3049
|
+
exit() {
|
|
3050
|
+
this.abort();
|
|
3051
|
+
}
|
|
3052
|
+
abort() {
|
|
3053
|
+
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
|
|
3054
|
+
`), this.close();
|
|
3055
|
+
}
|
|
3056
|
+
submit() {
|
|
3057
|
+
this.value = this.value || !1, this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
|
|
3058
|
+
`), this.close();
|
|
3059
|
+
}
|
|
3060
|
+
_(c, key) {
|
|
3061
|
+
return c.toLowerCase() === "y" ? (this.value = !0, this.submit()) : c.toLowerCase() === "n" ? (this.value = !1, this.submit()) : this.bell();
|
|
3062
|
+
}
|
|
3063
|
+
render() {
|
|
3064
|
+
this.closed || (this.firstRender ? this.out.write(cursor.hide) : this.out.write(clear(this.outputText, this.out.columns)), super.render(), this.outputText = [
|
|
3065
|
+
style.symbol(this.done, this.aborted),
|
|
3066
|
+
color.bold(this.msg),
|
|
3067
|
+
style.delimiter(this.done),
|
|
3068
|
+
this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)
|
|
3069
|
+
].join(" "), this.out.write(erase.line + cursor.to(0) + this.outputText));
|
|
3070
|
+
}
|
|
3071
|
+
};
|
|
3072
|
+
module.exports = ConfirmPrompt;
|
|
3073
|
+
}
|
|
3074
|
+
});
|
|
3075
|
+
|
|
3076
|
+
// ../node_modules/prompts/lib/elements/index.js
|
|
3077
|
+
var require_elements2 = __commonJS({
|
|
3078
|
+
"../node_modules/prompts/lib/elements/index.js"(exports, module) {
|
|
3079
|
+
"use strict";
|
|
3080
|
+
module.exports = {
|
|
3081
|
+
TextPrompt: require_text2(),
|
|
3082
|
+
SelectPrompt: require_select2(),
|
|
3083
|
+
TogglePrompt: require_toggle2(),
|
|
3084
|
+
DatePrompt: require_date2(),
|
|
3085
|
+
NumberPrompt: require_number2(),
|
|
3086
|
+
MultiselectPrompt: require_multiselect2(),
|
|
3087
|
+
AutocompletePrompt: require_autocomplete2(),
|
|
3088
|
+
AutocompleteMultiselectPrompt: require_autocompleteMultiselect2(),
|
|
3089
|
+
ConfirmPrompt: require_confirm2()
|
|
3090
|
+
};
|
|
3091
|
+
}
|
|
3092
|
+
});
|
|
3093
|
+
|
|
3094
|
+
// ../node_modules/prompts/lib/prompts.js
|
|
3095
|
+
var require_prompts2 = __commonJS({
|
|
3096
|
+
"../node_modules/prompts/lib/prompts.js"(exports) {
|
|
3097
|
+
"use strict";
|
|
3098
|
+
var $ = exports, el = require_elements2(), noop = (v) => v;
|
|
3099
|
+
function toPrompt(type, args, opts = {}) {
|
|
3100
|
+
return new Promise((res, rej) => {
|
|
3101
|
+
let p = new el[type](args), onAbort = opts.onAbort || noop, onSubmit = opts.onSubmit || noop, onExit = opts.onExit || noop;
|
|
3102
|
+
p.on("state", args.onState || noop), p.on("submit", (x) => res(onSubmit(x))), p.on("exit", (x) => res(onExit(x))), p.on("abort", (x) => rej(onAbort(x)));
|
|
3103
|
+
});
|
|
3104
|
+
}
|
|
3105
|
+
$.text = (args) => toPrompt("TextPrompt", args);
|
|
3106
|
+
$.password = (args) => (args.style = "password", $.text(args));
|
|
3107
|
+
$.invisible = (args) => (args.style = "invisible", $.text(args));
|
|
3108
|
+
$.number = (args) => toPrompt("NumberPrompt", args);
|
|
3109
|
+
$.date = (args) => toPrompt("DatePrompt", args);
|
|
3110
|
+
$.confirm = (args) => toPrompt("ConfirmPrompt", args);
|
|
3111
|
+
$.list = (args) => {
|
|
3112
|
+
let sep = args.separator || ",";
|
|
3113
|
+
return toPrompt("TextPrompt", args, {
|
|
3114
|
+
onSubmit: (str) => str.split(sep).map((s) => s.trim())
|
|
3115
|
+
});
|
|
3116
|
+
};
|
|
3117
|
+
$.toggle = (args) => toPrompt("TogglePrompt", args);
|
|
3118
|
+
$.select = (args) => toPrompt("SelectPrompt", args);
|
|
3119
|
+
$.multiselect = (args) => {
|
|
3120
|
+
args.choices = [].concat(args.choices || []);
|
|
3121
|
+
let toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
|
|
3122
|
+
return toPrompt("MultiselectPrompt", args, {
|
|
3123
|
+
onAbort: toSelected,
|
|
3124
|
+
onSubmit: toSelected
|
|
3125
|
+
});
|
|
3126
|
+
};
|
|
3127
|
+
$.autocompleteMultiselect = (args) => {
|
|
3128
|
+
args.choices = [].concat(args.choices || []);
|
|
3129
|
+
let toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
|
|
3130
|
+
return toPrompt("AutocompleteMultiselectPrompt", args, {
|
|
3131
|
+
onAbort: toSelected,
|
|
3132
|
+
onSubmit: toSelected
|
|
3133
|
+
});
|
|
3134
|
+
};
|
|
3135
|
+
var byTitle = (input, choices) => Promise.resolve(
|
|
3136
|
+
choices.filter((item) => item.title.slice(0, input.length).toLowerCase() === input.toLowerCase())
|
|
3137
|
+
);
|
|
3138
|
+
$.autocomplete = (args) => (args.suggest = args.suggest || byTitle, args.choices = [].concat(args.choices || []), toPrompt("AutocompletePrompt", args));
|
|
3139
|
+
}
|
|
3140
|
+
});
|
|
3141
|
+
|
|
3142
|
+
// ../node_modules/prompts/lib/index.js
|
|
3143
|
+
var require_lib = __commonJS({
|
|
3144
|
+
"../node_modules/prompts/lib/index.js"(exports, module) {
|
|
3145
|
+
"use strict";
|
|
3146
|
+
var prompts = require_prompts2(), passOn = ["suggest", "format", "onState", "validate", "onRender", "type"], noop = () => {
|
|
3147
|
+
};
|
|
3148
|
+
async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {}) {
|
|
3149
|
+
let answers = {}, override2 = prompt._override || {};
|
|
3150
|
+
questions = [].concat(questions);
|
|
3151
|
+
let answer, question, quit, name, type, lastPrompt, getFormattedAnswer = async (question2, answer2, skipValidation = !1) => {
|
|
3152
|
+
if (!(!skipValidation && question2.validate && question2.validate(answer2) !== !0))
|
|
3153
|
+
return question2.format ? await question2.format(answer2, answers) : answer2;
|
|
3154
|
+
};
|
|
3155
|
+
for (question of questions)
|
|
3156
|
+
if ({ name, type } = question, typeof type == "function" && (type = await type(answer, { ...answers }, question), question.type = type), !!type) {
|
|
3157
|
+
for (let key in question) {
|
|
3158
|
+
if (passOn.includes(key)) continue;
|
|
3159
|
+
let value = question[key];
|
|
3160
|
+
question[key] = typeof value == "function" ? await value(answer, { ...answers }, lastPrompt) : value;
|
|
3161
|
+
}
|
|
3162
|
+
if (lastPrompt = question, typeof question.message != "string")
|
|
3163
|
+
throw new Error("prompt message is required");
|
|
3164
|
+
if ({ name, type } = question, prompts[type] === void 0)
|
|
3165
|
+
throw new Error(`prompt type (${type}) is not defined`);
|
|
3166
|
+
if (override2[question.name] !== void 0 && (answer = await getFormattedAnswer(question, override2[question.name]), answer !== void 0)) {
|
|
3167
|
+
answers[name] = answer;
|
|
3168
|
+
continue;
|
|
3169
|
+
}
|
|
3170
|
+
try {
|
|
3171
|
+
answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts[type](question), answers[name] = answer = await getFormattedAnswer(question, answer, !0), quit = await onSubmit(question, answer, answers);
|
|
3172
|
+
} catch {
|
|
3173
|
+
quit = !await onCancel(question, answers);
|
|
3174
|
+
}
|
|
3175
|
+
if (quit) return answers;
|
|
3176
|
+
}
|
|
3177
|
+
return answers;
|
|
3178
|
+
}
|
|
3179
|
+
function getInjectedAnswer(injected, deafultValue) {
|
|
3180
|
+
let answer = injected.shift();
|
|
3181
|
+
if (answer instanceof Error)
|
|
3182
|
+
throw answer;
|
|
3183
|
+
return answer === void 0 ? deafultValue : answer;
|
|
3184
|
+
}
|
|
3185
|
+
function inject(answers) {
|
|
3186
|
+
prompt._injected = (prompt._injected || []).concat(answers);
|
|
3187
|
+
}
|
|
3188
|
+
function override(answers) {
|
|
3189
|
+
prompt._override = Object.assign({}, answers);
|
|
3190
|
+
}
|
|
3191
|
+
module.exports = Object.assign(prompt, { prompt, prompts, inject, override });
|
|
3192
|
+
}
|
|
3193
|
+
});
|
|
3194
|
+
|
|
3195
|
+
// ../node_modules/prompts/index.js
|
|
3196
|
+
var require_prompts3 = __commonJS({
|
|
3197
|
+
"../node_modules/prompts/index.js"(exports, module) {
|
|
3198
|
+
function isNodeLT(tar) {
|
|
3199
|
+
tar = (Array.isArray(tar) ? tar : tar.split(".")).map(Number);
|
|
3200
|
+
let i = 0, src = process.versions.node.split(".").map(Number);
|
|
3201
|
+
for (; i < tar.length; i++) {
|
|
3202
|
+
if (src[i] > tar[i]) return !1;
|
|
3203
|
+
if (tar[i] > src[i]) return !0;
|
|
3204
|
+
}
|
|
3205
|
+
return !1;
|
|
3206
|
+
}
|
|
3207
|
+
module.exports = isNodeLT("8.6.0") ? require_dist() : require_lib();
|
|
3208
|
+
}
|
|
3209
|
+
});
|
|
3210
|
+
|
|
3211
|
+
export {
|
|
3212
|
+
require_src,
|
|
3213
|
+
require_prompts3 as require_prompts
|
|
3214
|
+
};
|