kanbo-cli 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +202 -0
  2. package/README.md +17 -46
  3. package/dist/{better-sqlite3-fU3G4xnX.cjs → better-sqlite3-DPdSZ6sH.cjs} +244 -247
  4. package/dist/cli-main.cjs +51690 -0
  5. package/dist/cli.cjs +32 -45216
  6. package/dist/dist-IHRTF-b5.cjs +2552 -0
  7. package/dist/lib/{tool-names-WfH4IURz.d.cts → approval-BsBk2xVr.d.cts} +72 -3
  8. package/dist/lib/{tool-names-3q_GEZej.d.mts → approval-LRZ6ontC.d.mts} +72 -3
  9. package/dist/lib/{board-store-BvWn9xTB.d.mts → board-store-D_Mpfb84.d.mts} +75 -2
  10. package/dist/lib/{board-store-BfszzAJB.d.cts → board-store-Dx-mw2I6.d.cts} +75 -2
  11. package/dist/lib/index.cjs +8 -2
  12. package/dist/lib/index.d.cts +202 -91
  13. package/dist/lib/index.d.mts +202 -91
  14. package/dist/lib/index.mjs +3 -3
  15. package/dist/lib/{manifest-D9nCRtXM.cjs → manifest-DcIMYvWk.cjs} +7363 -1556
  16. package/dist/lib/manifest-Dmo6IlWk.mjs +14654 -0
  17. package/dist/lib/mcp/index.cjs +166 -22
  18. package/dist/lib/mcp/index.d.cts +144 -5
  19. package/dist/lib/mcp/index.d.mts +144 -5
  20. package/dist/lib/mcp/index.mjs +162 -23
  21. package/dist/lib/{migrate-DnMjTCvu.cjs → migrate-Dca5WdYd.cjs} +144 -14
  22. package/dist/lib/{migrate-BhYi9cXw.mjs → migrate-DtBeW3Fs.mjs} +134 -16
  23. package/dist/lib/{migrations-path-Ciwan537.mjs → migrations-path-ClaYRNwk.mjs} +5 -7
  24. package/dist/lib/{migrations-path-CZxVOgeD.cjs → migrations-path-DBCE17dT.cjs} +5 -7
  25. package/dist/lib/postgres/index.cjs +2 -4
  26. package/dist/lib/postgres/index.d.cts +2 -3
  27. package/dist/lib/postgres/index.d.mts +2 -3
  28. package/dist/lib/postgres/index.mjs +2 -4
  29. package/dist/lib/{roles.sql-CvyCGt38.mjs → roles.sql-BoOZSkBp.mjs} +96 -5
  30. package/dist/lib/{roles.sql-B9rt-x4o.cjs → roles.sql-E58x7mLS.cjs} +95 -4
  31. package/dist/lib/schema-D0MyXcej.d.cts +1 -2
  32. package/dist/lib/schema-D0MyXcej.d.mts +1 -2
  33. package/dist/lib/schema-epoch-ZyumVL_A.d.cts +1 -2
  34. package/dist/lib/schema-epoch-ZyumVL_A.d.mts +1 -2
  35. package/dist/lib/sqlite/index.cjs +2 -2
  36. package/dist/lib/sqlite/index.d.cts +3 -4
  37. package/dist/lib/sqlite/index.d.mts +3 -4
  38. package/dist/lib/sqlite/index.mjs +2 -2
  39. package/dist/lib/sqlite/schema.cjs +0 -2
  40. package/dist/lib/sqlite/schema.mjs +0 -2
  41. package/dist/page/board.css +1622 -327
  42. package/dist/page/board.js +2 -2
  43. package/package.json +13 -10
  44. package/dist/better-sqlite3-fU3G4xnX.cjs.map +0 -1
  45. package/dist/cli.cjs.map +0 -1
  46. package/dist/dist-BsCwQFEl.cjs +0 -989
  47. package/dist/dist-BsCwQFEl.cjs.map +0 -1
  48. package/dist/lib/manifest-D9nCRtXM.cjs.map +0 -1
  49. package/dist/lib/manifest-DHV2fRdO.mjs +0 -8933
  50. package/dist/lib/manifest-DHV2fRdO.mjs.map +0 -1
  51. package/dist/lib/mcp/index.cjs.map +0 -1
  52. package/dist/lib/mcp/index.mjs.map +0 -1
  53. package/dist/lib/migrate-BhYi9cXw.mjs.map +0 -1
  54. package/dist/lib/migrate-DnMjTCvu.cjs.map +0 -1
  55. package/dist/lib/migrations-path-CZxVOgeD.cjs.map +0 -1
  56. package/dist/lib/migrations-path-Ciwan537.mjs.map +0 -1
  57. package/dist/lib/postgres/index.cjs.map +0 -1
  58. package/dist/lib/postgres/index.mjs.map +0 -1
  59. package/dist/lib/roles.sql-B9rt-x4o.cjs.map +0 -1
  60. package/dist/lib/roles.sql-CvyCGt38.mjs.map +0 -1
  61. package/dist/lib/sqlite/schema.cjs.map +0 -1
  62. package/dist/lib/sqlite/schema.mjs.map +0 -1
  63. package/drizzle-postgres/0000_board.sql +0 -135
  64. package/drizzle-postgres/0001_history_order.sql +0 -2
  65. package/drizzle-postgres/0002_issue_pull_requests.sql +0 -16
  66. package/drizzle-postgres/0003_milestone_start_date.sql +0 -1
  67. package/drizzle-postgres/0004_status_entry_rules.sql +0 -1
  68. package/drizzle-postgres/0005_run_external_session_ref.sql +0 -1
  69. package/drizzle-postgres/README.md +0 -61
  70. package/drizzle-postgres/meta/0000_snapshot.json +0 -1078
  71. package/drizzle-postgres/meta/0001_snapshot.json +0 -1090
  72. package/drizzle-postgres/meta/0002_snapshot.json +0 -1239
  73. package/drizzle-postgres/meta/0003_snapshot.json +0 -1245
  74. package/drizzle-postgres/meta/0004_snapshot.json +0 -1251
  75. package/drizzle-postgres/meta/0005_snapshot.json +0 -1257
  76. package/drizzle-postgres/meta/_journal.json +0 -48
  77. package/drizzle-sqlite/0000_board.sql +0 -133
  78. package/drizzle-sqlite/0001_issue_pull_requests.sql +0 -15
  79. package/drizzle-sqlite/0002_milestone_start_date.sql +0 -1
  80. package/drizzle-sqlite/0003_status_entry_rules.sql +0 -1
  81. package/drizzle-sqlite/0004_run_external_session_ref.sql +0 -1
  82. package/drizzle-sqlite/README.md +0 -67
  83. package/drizzle-sqlite/meta/0000_snapshot.json +0 -946
  84. package/drizzle-sqlite/meta/0001_snapshot.json +0 -1054
  85. package/drizzle-sqlite/meta/0002_snapshot.json +0 -1061
  86. package/drizzle-sqlite/meta/0003_snapshot.json +0 -1068
  87. package/drizzle-sqlite/meta/0004_snapshot.json +0 -1075
  88. package/drizzle-sqlite/meta/_journal.json +0 -41
@@ -1,989 +0,0 @@
1
- #!/usr/bin/env node
2
- const require_cli = require("./cli.cjs");
3
- require("node:path");
4
- require("node:fs");
5
- let node_process = require("node:process");
6
- node_process = require_cli.__toESM(node_process, 1);
7
- let node_util = require("node:util");
8
- let node_readline = require("node:readline");
9
- node_readline = require_cli.__toESM(node_readline, 1);
10
- //#region node_modules/fast-string-truncated-width/dist/utils.js
11
- const getCodePointsLength = (() => {
12
- const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
13
- return (input) => {
14
- let surrogatePairsNr = 0;
15
- SURROGATE_PAIR_RE.lastIndex = 0;
16
- while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
17
- return input.length - surrogatePairsNr;
18
- };
19
- })();
20
- const isFullWidth = (x) => {
21
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
22
- };
23
- const isWideNotCJKTNotEmoji = (x) => {
24
- return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
25
- };
26
- //#endregion
27
- //#region node_modules/fast-string-truncated-width/dist/index.js
28
- const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
29
- const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
30
- const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
31
- const TAB_RE = /\t{1,1000}/y;
32
- const EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy;
33
- const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
34
- const MODIFIER_RE = /\p{M}+/gu;
35
- const NO_TRUNCATION$1 = {
36
- limit: Infinity,
37
- ellipsis: ""
38
- };
39
- const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
40
- const LIMIT = truncationOptions.limit ?? Infinity;
41
- const ELLIPSIS = truncationOptions.ellipsis ?? "";
42
- const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
43
- const ANSI_WIDTH = 0;
44
- const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
45
- const TAB_WIDTH = widthOptions.tabWidth ?? 8;
46
- const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
47
- const FULL_WIDTH_WIDTH = 2;
48
- const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
49
- const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
50
- const PARSE_BLOCKS = [
51
- [LATIN_RE, REGULAR_WIDTH],
52
- [ANSI_RE, ANSI_WIDTH],
53
- [CONTROL_RE, CONTROL_WIDTH],
54
- [TAB_RE, TAB_WIDTH],
55
- [EMOJI_RE, EMOJI_WIDTH],
56
- [CJKT_WIDE_RE, WIDE_WIDTH]
57
- ];
58
- let indexPrev = 0;
59
- let index = 0;
60
- let length = input.length;
61
- let lengthExtra = 0;
62
- let truncationEnabled = false;
63
- let truncationIndex = length;
64
- let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
65
- let unmatchedStart = 0;
66
- let unmatchedEnd = 0;
67
- let width = 0;
68
- let widthExtra = 0;
69
- outer: while (true) {
70
- if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
71
- const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
72
- lengthExtra = 0;
73
- for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
74
- const codePoint = char.codePointAt(0) || 0;
75
- if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
76
- else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
77
- else widthExtra = REGULAR_WIDTH;
78
- if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
79
- if (width + widthExtra > LIMIT) {
80
- truncationEnabled = true;
81
- break outer;
82
- }
83
- lengthExtra += char.length;
84
- width += widthExtra;
85
- }
86
- unmatchedStart = unmatchedEnd = 0;
87
- }
88
- if (index >= length) break outer;
89
- for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
90
- const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
91
- BLOCK_RE.lastIndex = index;
92
- if (BLOCK_RE.test(input)) {
93
- lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
94
- widthExtra = lengthExtra * BLOCK_WIDTH;
95
- if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
96
- if (width + widthExtra > LIMIT) {
97
- truncationEnabled = true;
98
- break outer;
99
- }
100
- width += widthExtra;
101
- unmatchedStart = indexPrev;
102
- unmatchedEnd = index;
103
- index = indexPrev = BLOCK_RE.lastIndex;
104
- continue outer;
105
- }
106
- }
107
- index += 1;
108
- }
109
- return {
110
- width: truncationEnabled ? truncationLimit : width,
111
- index: truncationEnabled ? truncationIndex : length,
112
- truncated: truncationEnabled,
113
- ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
114
- };
115
- };
116
- //#endregion
117
- //#region node_modules/fast-string-width/dist/index.js
118
- const NO_TRUNCATION = {
119
- limit: Infinity,
120
- ellipsis: "",
121
- ellipsisWidth: 0
122
- };
123
- const fastStringWidth = (input, options = {}) => {
124
- return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
125
- };
126
- //#endregion
127
- //#region node_modules/fast-wrap-ansi/lib/main.js
128
- const ESC = "\x1B";
129
- const CSI = "›";
130
- const END_CODE = 39;
131
- const ANSI_ESCAPE_BELL = "\x07";
132
- const ANSI_CSI = "[";
133
- const ANSI_OSC = "]";
134
- const ANSI_SGR_TERMINATOR = "m";
135
- const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
136
- const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
137
- const getClosingCode = (openingCode) => {
138
- if (openingCode >= 30 && openingCode <= 37) return 39;
139
- if (openingCode >= 90 && openingCode <= 97) return 39;
140
- if (openingCode >= 40 && openingCode <= 47) return 49;
141
- if (openingCode >= 100 && openingCode <= 107) return 49;
142
- if (openingCode === 1 || openingCode === 2) return 22;
143
- if (openingCode === 3) return 23;
144
- if (openingCode === 4) return 24;
145
- if (openingCode === 7) return 27;
146
- if (openingCode === 8) return 28;
147
- if (openingCode === 9) return 29;
148
- if (openingCode === 0) return 0;
149
- };
150
- const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
151
- const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
152
- const wrapWord = (rows, word, columns) => {
153
- const characters = word[Symbol.iterator]();
154
- let isInsideEscape = false;
155
- let isInsideLinkEscape = false;
156
- let lastRow = rows.at(-1);
157
- let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
158
- let currentCharacter = characters.next();
159
- let nextCharacter = characters.next();
160
- let rawCharacterIndex = 0;
161
- while (!currentCharacter.done) {
162
- const character = currentCharacter.value;
163
- const characterLength = fastStringWidth(character);
164
- if (visible + characterLength <= columns) rows[rows.length - 1] += character;
165
- else {
166
- rows.push(character);
167
- visible = 0;
168
- }
169
- if (character === ESC || character === CSI) {
170
- isInsideEscape = true;
171
- isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
172
- }
173
- if (isInsideEscape) {
174
- if (isInsideLinkEscape) {
175
- if (character === ANSI_ESCAPE_BELL) {
176
- isInsideEscape = false;
177
- isInsideLinkEscape = false;
178
- }
179
- } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
180
- } else {
181
- visible += characterLength;
182
- if (visible === columns && !nextCharacter.done) {
183
- rows.push("");
184
- visible = 0;
185
- }
186
- }
187
- currentCharacter = nextCharacter;
188
- nextCharacter = characters.next();
189
- rawCharacterIndex += character.length;
190
- }
191
- lastRow = rows.at(-1);
192
- if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
193
- };
194
- const stringVisibleTrimSpacesRight = (string) => {
195
- const words = string.split(" ");
196
- let last = words.length;
197
- while (last) {
198
- if (fastStringWidth(words[last - 1])) break;
199
- last--;
200
- }
201
- if (last === words.length) return string;
202
- return words.slice(0, last).join(" ") + words.slice(last).join("");
203
- };
204
- const exec = (string, columns, options = {}) => {
205
- if (options.trim !== false && string.trim() === "") return "";
206
- let returnValue = "";
207
- let escapeCode;
208
- let escapeUrl;
209
- const words = string.split(" ");
210
- let rows = [""];
211
- let rowLength = 0;
212
- for (let index = 0; index < words.length; index++) {
213
- const word = words[index];
214
- if (options.trim !== false) {
215
- const row = rows.at(-1) ?? "";
216
- const trimmed = row.trimStart();
217
- if (row.length !== trimmed.length) {
218
- rows[rows.length - 1] = trimmed;
219
- rowLength = fastStringWidth(trimmed);
220
- }
221
- }
222
- if (index !== 0) {
223
- if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
224
- rows.push("");
225
- rowLength = 0;
226
- }
227
- if (rowLength || options.trim === false) {
228
- rows[rows.length - 1] += " ";
229
- rowLength++;
230
- }
231
- }
232
- const wordLength = fastStringWidth(word);
233
- if (options.hard && wordLength > columns) {
234
- const remainingColumns = columns - rowLength;
235
- const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
236
- if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
237
- wrapWord(rows, word, columns);
238
- rowLength = fastStringWidth(rows.at(-1) ?? "");
239
- continue;
240
- }
241
- if (rowLength + wordLength > columns && rowLength && wordLength) {
242
- if (options.wordWrap === false && rowLength < columns) {
243
- wrapWord(rows, word, columns);
244
- rowLength = fastStringWidth(rows.at(-1) ?? "");
245
- continue;
246
- }
247
- rows.push("");
248
- rowLength = 0;
249
- }
250
- if (rowLength + wordLength > columns && options.wordWrap === false) {
251
- wrapWord(rows, word, columns);
252
- rowLength = fastStringWidth(rows.at(-1) ?? "");
253
- continue;
254
- }
255
- rows[rows.length - 1] += word;
256
- rowLength += wordLength;
257
- }
258
- if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
259
- const preString = rows.join("\n");
260
- let inSurrogate = false;
261
- for (let i = 0; i < preString.length; i++) {
262
- const character = preString[i];
263
- returnValue += character;
264
- if (!inSurrogate) {
265
- inSurrogate = character >= "\ud800" && character <= "\udbff";
266
- if (inSurrogate) continue;
267
- } else inSurrogate = false;
268
- if (character === ESC || character === CSI) {
269
- GROUP_REGEX.lastIndex = i + 1;
270
- const groups = GROUP_REGEX.exec(preString)?.groups;
271
- if (groups?.code !== void 0) {
272
- const code = Number.parseFloat(groups.code);
273
- escapeCode = code === END_CODE ? void 0 : code;
274
- } else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
275
- }
276
- if (preString[i + 1] === "\n") {
277
- if (escapeUrl) returnValue += wrapAnsiHyperlink("");
278
- const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
279
- if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
280
- } else if (character === "\n") {
281
- if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
282
- if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
283
- }
284
- }
285
- return returnValue;
286
- };
287
- const CRLF_OR_LF = /\r?\n/;
288
- function wrapAnsi(string, columns, options) {
289
- return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
290
- }
291
- //#endregion
292
- //#region node_modules/@clack/core/dist/index.mjs
293
- var import_src = (/* @__PURE__ */ require_cli.__commonJSMin(((exports, module) => {
294
- const ESC = "\x1B";
295
- const CSI = `${ESC}[`;
296
- const beep = "\x07";
297
- const cursor = {
298
- to(x, y) {
299
- if (!y) return `${CSI}${x + 1}G`;
300
- return `${CSI}${y + 1};${x + 1}H`;
301
- },
302
- move(x, y) {
303
- let ret = "";
304
- if (x < 0) ret += `${CSI}${-x}D`;
305
- else if (x > 0) ret += `${CSI}${x}C`;
306
- if (y < 0) ret += `${CSI}${-y}A`;
307
- else if (y > 0) ret += `${CSI}${y}B`;
308
- return ret;
309
- },
310
- up: (count = 1) => `${CSI}${count}A`,
311
- down: (count = 1) => `${CSI}${count}B`,
312
- forward: (count = 1) => `${CSI}${count}C`,
313
- backward: (count = 1) => `${CSI}${count}D`,
314
- nextLine: (count = 1) => `${CSI}E`.repeat(count),
315
- prevLine: (count = 1) => `${CSI}F`.repeat(count),
316
- left: `${CSI}G`,
317
- hide: `${CSI}?25l`,
318
- show: `${CSI}?25h`,
319
- save: `${ESC}7`,
320
- restore: `${ESC}8`
321
- };
322
- module.exports = {
323
- cursor,
324
- scroll: {
325
- up: (count = 1) => `${CSI}S`.repeat(count),
326
- down: (count = 1) => `${CSI}T`.repeat(count)
327
- },
328
- erase: {
329
- screen: `${CSI}2J`,
330
- up: (count = 1) => `${CSI}1J`.repeat(count),
331
- down: (count = 1) => `${CSI}J`.repeat(count),
332
- line: `${CSI}2K`,
333
- lineEnd: `${CSI}K`,
334
- lineStart: `${CSI}1K`,
335
- lines(count) {
336
- let clear = "";
337
- for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
338
- if (count) clear += cursor.left;
339
- return clear;
340
- }
341
- },
342
- beep
343
- };
344
- })))();
345
- function findCursor(s, o, l) {
346
- if (!l.some((r) => !r.disabled)) return s;
347
- const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
348
- return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
349
- }
350
- const settings = {
351
- actions: /* @__PURE__ */ new Set([
352
- "up",
353
- "down",
354
- "left",
355
- "right",
356
- "space",
357
- "enter",
358
- "cancel"
359
- ]),
360
- aliases: /* @__PURE__ */ new Map([
361
- ["k", "up"],
362
- ["j", "down"],
363
- ["h", "left"],
364
- ["l", "right"],
365
- ["", "cancel"],
366
- ["escape", "cancel"]
367
- ]),
368
- messages: {
369
- cancel: "Canceled",
370
- error: "Something went wrong"
371
- },
372
- withGuide: true,
373
- accessible: void 0,
374
- date: {
375
- monthNames: [...[
376
- "January",
377
- "February",
378
- "March",
379
- "April",
380
- "May",
381
- "June",
382
- "July",
383
- "August",
384
- "September",
385
- "October",
386
- "November",
387
- "December"
388
- ]],
389
- messages: {
390
- required: "Please enter a valid date",
391
- invalidMonth: "There are only 12 months in a year",
392
- invalidDay: (n, e) => `There are only ${n} days in ${e}`,
393
- afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
394
- beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
395
- }
396
- }
397
- };
398
- function isAccessible(n) {
399
- if (n !== void 0) return n;
400
- if (settings.accessible !== void 0) return settings.accessible;
401
- const e = process.env.ACCESSIBLE;
402
- return e !== void 0 && e !== "" && e !== "0" && e !== "false";
403
- }
404
- function isActionKey(n, e) {
405
- if (typeof n == "string") return settings.aliases.get(n) === e;
406
- for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
407
- return false;
408
- }
409
- function diffLines(i, s) {
410
- if (i === s) return;
411
- const e = i.split(`
412
- `), t = s.split(`
413
- `), r = Math.max(e.length, t.length), f = [];
414
- for (let n = 0; n < r; n++) e[n] !== t[n] && f.push(n);
415
- return {
416
- lines: f,
417
- numLinesBefore: e.length,
418
- numLinesAfter: t.length,
419
- numLines: r
420
- };
421
- }
422
- globalThis.process.platform.startsWith("win");
423
- const CANCEL_SYMBOL = Symbol("clack:cancel");
424
- function isCancel(e) {
425
- return e === CANCEL_SYMBOL;
426
- }
427
- function setRawMode(e, r) {
428
- const o = e;
429
- o.isTTY && o.setRawMode(r);
430
- }
431
- const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
432
- const getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
433
- function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
434
- return wrapAnsi(r, getColumns(e ?? node_process.stdout) - o.length, {
435
- hard: true,
436
- trim: false
437
- }).split(`
438
- `).map((c, i, m) => {
439
- const d = t ? t(c, i) : c;
440
- return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
441
- }).join(`
442
- `);
443
- }
444
- function runValidation(e, a) {
445
- if ("~standard" in e) {
446
- const n = e["~standard"].validate(a);
447
- return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
448
- }
449
- return e(a);
450
- }
451
- var y = class {
452
- input;
453
- output;
454
- _abortSignal;
455
- rl;
456
- opts;
457
- _render;
458
- _track = false;
459
- _prevFrame = "";
460
- _subscribers = /* @__PURE__ */ new Map();
461
- _cursor = 0;
462
- state = "initial";
463
- error = "";
464
- value;
465
- userInput = "";
466
- /**
467
- * Whether accessible (static, screen-reader friendly) output is enabled for
468
- * this prompt, resolved from the `accessible` option, the global setting,
469
- * and the `ACCESSIBLE` env var.
470
- */
471
- get accessible() {
472
- return isAccessible(this.opts.accessible);
473
- }
474
- constructor(t, e = true) {
475
- const { input: i = node_process.stdin, output: s = node_process.stdout, render: r, signal: n, ...o } = t;
476
- this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
477
- }
478
- /**
479
- * Unsubscribe all listeners
480
- */
481
- unsubscribe() {
482
- this._subscribers.clear();
483
- }
484
- /**
485
- * Set a subscriber with opts
486
- * @param event - The event name
487
- */
488
- setSubscriber(t, e) {
489
- const i = this._subscribers.get(t) ?? [];
490
- i.push(e), this._subscribers.set(t, i);
491
- }
492
- /**
493
- * Subscribe to an event
494
- * @param event - The event name
495
- * @param cb - The callback
496
- */
497
- on(t, e) {
498
- this.setSubscriber(t, { cb: e });
499
- }
500
- /**
501
- * Subscribe to an event once
502
- * @param event - The event name
503
- * @param cb - The callback
504
- */
505
- once(t, e) {
506
- this.setSubscriber(t, {
507
- cb: e,
508
- once: true
509
- });
510
- }
511
- /**
512
- * Emit an event with data
513
- * @param event - The event name
514
- * @param data - The data to pass to the callback
515
- */
516
- emit(t, ...e) {
517
- const i = this._subscribers.get(t) ?? [], s = [];
518
- for (const r of i) r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
519
- for (const r of s) r();
520
- }
521
- prompt() {
522
- return new Promise((t) => {
523
- if (this._abortSignal) {
524
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
525
- this._abortSignal.addEventListener("abort", () => {
526
- this.state = "cancel", this.close();
527
- }, { once: true });
528
- }
529
- this.rl = node_readline.default.createInterface({
530
- input: this.input,
531
- tabSize: 2,
532
- prompt: "",
533
- escapeCodeTimeout: 50,
534
- terminal: true
535
- }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
536
- this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
537
- }), this.once("cancel", () => {
538
- this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
539
- });
540
- });
541
- }
542
- _isActionKey(t, e) {
543
- return t === " ";
544
- }
545
- _shouldSubmit(t, e) {
546
- return true;
547
- }
548
- _setValue(t) {
549
- this.value = t, this.emit("value", this.value);
550
- }
551
- _setUserInput(t, e) {
552
- this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
553
- }
554
- _clearUserInput() {
555
- this.rl?.write(null, {
556
- ctrl: true,
557
- name: "u"
558
- }), this._setUserInput("");
559
- }
560
- async onKeypress(t, e) {
561
- if (this.state !== "validating") {
562
- if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
563
- ctrl: true,
564
- name: "h"
565
- }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
566
- if (this.opts.validate) {
567
- const i = runValidation(this.opts.validate, this.value);
568
- let s;
569
- i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
570
- }
571
- this.state !== "error" && (this.state = "submit");
572
- }
573
- isActionKey([
574
- t,
575
- e?.name,
576
- e?.sequence
577
- ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
578
- }
579
- }
580
- close() {
581
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
582
- `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
583
- }
584
- restoreCursor() {
585
- const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
586
- hard: true,
587
- trim: false
588
- }).split(`
589
- `).length - 1;
590
- this.output.write(import_src.cursor.move(-999, t * -1));
591
- }
592
- render() {
593
- const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
594
- hard: true,
595
- trim: false
596
- });
597
- if (t !== this._prevFrame) {
598
- if (this.state === "initial") this.output.write(import_src.cursor.hide);
599
- else {
600
- const e = diffLines(this._prevFrame, t), i = getRows(this.output);
601
- if (this.restoreCursor(), e) {
602
- const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
603
- let n = e.lines.find((o) => o >= s);
604
- if (n === void 0) {
605
- this._prevFrame = t;
606
- return;
607
- }
608
- if (e.lines.length === 1) {
609
- this.output.write(import_src.cursor.move(0, n - r)), this.output.write(import_src.erase.lines(1));
610
- const o = t.split(`
611
- `);
612
- this.output.write(o[n]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - n - 1));
613
- return;
614
- } else if (e.lines.length > 1) {
615
- if (s < r) n = s;
616
- else {
617
- const h = n - r;
618
- h > 0 && this.output.write(import_src.cursor.move(0, h));
619
- }
620
- this.output.write(import_src.erase.down());
621
- const f = t.split(`
622
- `).slice(n);
623
- this.output.write(f.join(`
624
- `)), this._prevFrame = t;
625
- return;
626
- }
627
- }
628
- this.output.write(import_src.erase.down());
629
- }
630
- this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
631
- }
632
- }
633
- };
634
- var r = class extends y {
635
- get cursor() {
636
- return this.value ? 0 : 1;
637
- }
638
- get _value() {
639
- return this.cursor === 0;
640
- }
641
- constructor(t) {
642
- super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
643
- this.value = this._value;
644
- }), this.on("confirm", (i) => {
645
- this.output.write(import_src.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
646
- }), this.on("cursor", () => {
647
- this.value = !this.value;
648
- });
649
- }
650
- };
651
- var a = class extends y {
652
- options;
653
- cursor = 0;
654
- get _value() {
655
- return this.options[this.cursor]?.value;
656
- }
657
- get _enabledOptions() {
658
- return this.options.filter((e) => e.disabled !== true);
659
- }
660
- toggleAll() {
661
- const e = this._enabledOptions, i = this.value !== void 0 && this.value.length === e.length;
662
- this.value = i ? [] : e.map((t) => t.value);
663
- }
664
- toggleInvert() {
665
- const e = this.value;
666
- if (!e) return;
667
- const i = this._enabledOptions.filter((t) => !e.includes(t.value));
668
- this.value = i.map((t) => t.value);
669
- }
670
- toggleValue() {
671
- this.value === void 0 && (this.value = []);
672
- const e = this.value.includes(this._value);
673
- this.value = e ? this.value.filter((i) => i !== this._value) : [...this.value, this._value];
674
- }
675
- constructor(e) {
676
- super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
677
- const i = Math.max(this.options.findIndex(({ value: t }) => t === e.cursorAt), 0);
678
- this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t, l) => {
679
- l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
680
- }), this.on("cursor", (t) => {
681
- switch (t) {
682
- case "left":
683
- case "up":
684
- this.cursor = findCursor(this.cursor, -1, this.options);
685
- break;
686
- case "down":
687
- case "right":
688
- this.cursor = findCursor(this.cursor, 1, this.options);
689
- break;
690
- case "space": this.toggleValue();
691
- }
692
- });
693
- }
694
- };
695
- let n$1 = class n extends y {
696
- options;
697
- cursor = 0;
698
- get _selectedValue() {
699
- return this.options[this.cursor];
700
- }
701
- changeValue() {
702
- const e = this._selectedValue;
703
- this.value = e === void 0 ? void 0 : e.value;
704
- }
705
- constructor(e) {
706
- super(e, false), this.options = e.options;
707
- const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t = o === -1 ? 0 : o;
708
- this.cursor = this.options[t]?.disabled ? findCursor(t, 1, this.options) : t, this.changeValue(), this.on("cursor", (s) => {
709
- switch (s) {
710
- case "left":
711
- case "up":
712
- this.cursor = findCursor(this.cursor, -1, this.options);
713
- break;
714
- case "down":
715
- case "right": this.cursor = findCursor(this.cursor, 1, this.options);
716
- }
717
- this.changeValue();
718
- });
719
- }
720
- };
721
- //#endregion
722
- //#region node_modules/@clack/prompts/dist/index.mjs
723
- function isUnicodeSupported() {
724
- if (node_process.default.platform !== "win32") return node_process.default.env.TERM !== "linux";
725
- return Boolean(node_process.default.env.CI) || Boolean(node_process.default.env.WT_SESSION) || Boolean(node_process.default.env.TERMINUS_SUBLIME) || node_process.default.env.ConEmuTask === "{cmd::Cmder}" || node_process.default.env.TERM_PROGRAM === "Terminus-Sublime" || node_process.default.env.TERM_PROGRAM === "vscode" || node_process.default.env.TERM === "xterm-256color" || node_process.default.env.TERM === "alacritty" || node_process.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
726
- }
727
- const unicode = isUnicodeSupported();
728
- const unicodeOr = (o, e) => unicode ? o : e;
729
- const S_STEP_ACTIVE = unicodeOr("◆", "*");
730
- const S_STEP_CANCEL = unicodeOr("■", "x");
731
- const S_STEP_ERROR = unicodeOr("▲", "x");
732
- const S_STEP_SUBMIT = unicodeOr("◇", "o");
733
- const S_BAR = unicodeOr("│", "|");
734
- const S_BAR_END = unicodeOr("└", "—");
735
- const S_RADIO_ACTIVE = unicodeOr("●", ">");
736
- const S_RADIO_INACTIVE = unicodeOr("○", " ");
737
- const S_CHECKBOX_ACTIVE = unicodeOr("◻", "[•]");
738
- const S_CHECKBOX_SELECTED = unicodeOr("◼", "[+]");
739
- const S_CHECKBOX_INACTIVE = unicodeOr("◻", "[ ]");
740
- const symbol = (o) => {
741
- switch (o) {
742
- case "initial":
743
- case "active": return (0, node_util.styleText)("cyan", S_STEP_ACTIVE);
744
- case "cancel": return (0, node_util.styleText)("red", S_STEP_CANCEL);
745
- case "error": return (0, node_util.styleText)("yellow", S_STEP_ERROR);
746
- case "submit": return (0, node_util.styleText)("green", S_STEP_SUBMIT);
747
- case "validating": return (0, node_util.styleText)("dim", S_STEP_ACTIVE);
748
- }
749
- };
750
- const symbolBar = (o) => {
751
- switch (o) {
752
- case "initial":
753
- case "active": return (0, node_util.styleText)("cyan", S_BAR);
754
- case "cancel": return (0, node_util.styleText)("red", S_BAR);
755
- case "error": return (0, node_util.styleText)("yellow", S_BAR);
756
- case "submit": return (0, node_util.styleText)("green", S_BAR);
757
- }
758
- };
759
- function formatInstructionFooter(o, e) {
760
- const r = [`${e ? `${(0, node_util.styleText)("cyan", S_BAR)} ` : ""}${o.join(" • ")}`];
761
- return e && r.push((0, node_util.styleText)("cyan", S_BAR_END)), r;
762
- }
763
- const I = (l, e, w, p, b, C = false) => {
764
- let r = e, O = 0;
765
- if (C) for (let i = p - 1; i >= w; i--) {
766
- const m = l[i];
767
- if (m && (r -= m.length), O++, r <= b) break;
768
- }
769
- else for (let i = w; i < p; i++) {
770
- const m = l[i];
771
- if (m && (r -= m.length), O++, r <= b) break;
772
- }
773
- return {
774
- lineCount: r,
775
- removals: O
776
- };
777
- };
778
- const limitOptions = ({ cursor: l, options: e, style: w, output: p = process.stdout, maxItems: b = Number.POSITIVE_INFINITY, columnPadding: C = 0, rowPadding: r = 4 }) => {
779
- const i = getColumns(p) - C, m = getRows(p), M = (0, node_util.styleText)("dim", "..."), v = Math.max(m - r, 0), a = Math.max(Math.min(b, v), 5);
780
- let f = 0;
781
- l >= a - 3 && (f = Math.max(Math.min(l - a + 3, e.length - a), 0));
782
- let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
783
- const W = Math.min(f + a, e.length), s = [];
784
- let g = 0;
785
- d && g++, c && g++;
786
- const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
787
- for (let t = T; t < y; t++) {
788
- const n = e[t], h = wrapAnsi(n ? w(n, t === l) : "", i, {
789
- hard: true,
790
- trim: false
791
- }).split(`
792
- `);
793
- s.push(h), g += h.length;
794
- }
795
- if (g > v) {
796
- let t = 0, n = 0, o = g;
797
- const h = l - T;
798
- let u = v;
799
- const L = () => I(s, o, 0, h, u), E = () => I(s, o, h + 1, s.length, u, true);
800
- d ? ({lineCount: o, removals: t} = L(), o > u && (c || (u -= 1), {lineCount: o, removals: n} = E())) : (c || (u -= 1), {lineCount: o, removals: n} = E(), o > u && (u -= 1, {lineCount: o, removals: t} = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
801
- }
802
- const x = [];
803
- d && x.push(M);
804
- for (const t of s) for (const n of t) x.push(n);
805
- return c && x.push(M), x;
806
- };
807
- const confirm = (e) => {
808
- const a = e.active ?? "Yes", o = e.inactive ?? "No";
809
- return new r({
810
- active: a,
811
- inactive: o,
812
- signal: e.signal,
813
- input: e.input,
814
- output: e.output,
815
- initialValue: e.initialValue ?? true,
816
- render() {
817
- const i = e.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = i ? `${(0, node_util.styleText)("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(e.output, e.message, l, u), s = `${i ? `${(0, node_util.styleText)("gray", S_BAR)}
818
- ` : ""}${f}
819
- `, c = this.value ? a : o;
820
- switch (this.state) {
821
- case "submit": return `${s}${i ? `${(0, node_util.styleText)("gray", S_BAR)} ` : ""}${(0, node_util.styleText)("dim", c)}`;
822
- case "cancel": return `${s}${i ? `${(0, node_util.styleText)("gray", S_BAR)} ` : ""}${(0, node_util.styleText)(["strikethrough", "dim"], c)}${i ? `
823
- ${(0, node_util.styleText)("gray", S_BAR)}` : ""}`;
824
- default: {
825
- const r = i ? `${(0, node_util.styleText)("cyan", S_BAR)} ` : "", g = i ? (0, node_util.styleText)("cyan", S_BAR_END) : "";
826
- return `${s}${r}${this.value ? `${(0, node_util.styleText)("green", S_RADIO_ACTIVE)} ${a}` : `${(0, node_util.styleText)("dim", S_RADIO_INACTIVE)} ${(0, node_util.styleText)("dim", a)}`}${e.vertical ? i ? `
827
- ${(0, node_util.styleText)("cyan", S_BAR)} ` : `
828
- ` : ` ${(0, node_util.styleText)("dim", "/")} `}${this.value ? `${(0, node_util.styleText)("dim", S_RADIO_INACTIVE)} ${(0, node_util.styleText)("dim", o)}` : `${(0, node_util.styleText)("green", S_RADIO_ACTIVE)} ${o}`}
829
- ${g}
830
- `;
831
- }
832
- }
833
- }
834
- }).prompt();
835
- };
836
- const MULTISELECT_INSTRUCTIONS = [
837
- `${(0, node_util.styleText)("dim", "↑/↓")} to navigate`,
838
- `${(0, node_util.styleText)("dim", "Space:")} select`,
839
- `${(0, node_util.styleText)("dim", "Enter:")} confirm`
840
- ];
841
- const m = (i, u) => i.split(`
842
- `).map((d) => u(d)).join(`
843
- `);
844
- const multiselect = (i) => {
845
- const u = (t, a) => {
846
- const r = t.label ?? String(t.value);
847
- return a === "disabled" ? `${(0, node_util.styleText)("gray", S_CHECKBOX_INACTIVE)} ${m(r, (o) => (0, node_util.styleText)(["strikethrough", "gray"], o))}${t.hint ? ` ${(0, node_util.styleText)("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${(0, node_util.styleText)("cyan", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${(0, node_util.styleText)("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${(0, node_util.styleText)("green", S_CHECKBOX_SELECTED)} ${m(r, (o) => (0, node_util.styleText)("dim", o))}${t.hint ? ` ${(0, node_util.styleText)("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => (0, node_util.styleText)(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${(0, node_util.styleText)("green", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${(0, node_util.styleText)("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => (0, node_util.styleText)("dim", o))}` : `${(0, node_util.styleText)("dim", S_CHECKBOX_INACTIVE)} ${m(r, (o) => (0, node_util.styleText)("dim", o))}`;
848
- }, d = i.required ?? true, x = i.showInstructions ?? true;
849
- return new a({
850
- options: i.options,
851
- signal: i.signal,
852
- input: i.input,
853
- output: i.output,
854
- initialValues: i.initialValues,
855
- required: d,
856
- cursorAt: i.cursorAt,
857
- validate(t) {
858
- if (d && (t === void 0 || t.length === 0)) return `Please select at least one option.
859
- ${(0, node_util.styleText)("reset", (0, node_util.styleText)("dim", `Press ${(0, node_util.styleText)([
860
- "gray",
861
- "bgWhite",
862
- "inverse"
863
- ], " space ")} to select, ${(0, node_util.styleText)("gray", (0, node_util.styleText)("bgWhite", (0, node_util.styleText)("inverse", " enter ")))} to submit`))}`;
864
- },
865
- render() {
866
- const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r = `${t ? `${(0, node_util.styleText)("gray", S_BAR)}
867
- ` : ""}${a}
868
- `, o = this.value ?? [], g = (n, l) => {
869
- if (n.disabled) return u(n, "disabled");
870
- const s = o.includes(n.value);
871
- return l && s ? u(n, "active-selected") : s ? u(n, "selected") : u(n, l ? "active" : "inactive");
872
- };
873
- switch (this.state) {
874
- case "submit": {
875
- const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "submitted")).join((0, node_util.styleText)("dim", ", ")) || (0, node_util.styleText)("dim", "none");
876
- return `${r}${wrapTextWithPrefix(i.output, n, t ? `${(0, node_util.styleText)("gray", S_BAR)} ` : "")}`;
877
- }
878
- case "cancel": {
879
- const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "cancelled")).join((0, node_util.styleText)("dim", ", "));
880
- if (n.trim() === "") return `${r}${(0, node_util.styleText)("gray", S_BAR)}`;
881
- return `${r}${wrapTextWithPrefix(i.output, n, t ? `${(0, node_util.styleText)("gray", S_BAR)} ` : "")}${t ? `
882
- ${(0, node_util.styleText)("gray", S_BAR)}` : ""}`;
883
- }
884
- case "error": {
885
- const n = t ? `${(0, node_util.styleText)("yellow", S_BAR)} ` : "", l = this.error.split(`
886
- `).map(($, v) => v === 0 ? `${t ? `${(0, node_util.styleText)("yellow", S_BAR_END)} ` : ""}${(0, node_util.styleText)("yellow", $)}` : ` ${$}`).join(`
887
- `), s = r.split(`
888
- `).length, h = l.split(`
889
- `).length + 1;
890
- return `${r}${n}${limitOptions({
891
- output: i.output,
892
- options: this.options,
893
- cursor: this.cursor,
894
- maxItems: i.maxItems,
895
- columnPadding: n.length,
896
- rowPadding: s + h,
897
- style: g
898
- }).join(`
899
- ${n}`)}
900
- ${l}
901
- `;
902
- }
903
- default: {
904
- const n = t ? `${(0, node_util.styleText)("cyan", S_BAR)} ` : "", l = r.split(`
905
- `).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [(0, node_util.styleText)("cyan", S_BAR_END)] : [], h = s.join(`
906
- `), $ = s.length + 1;
907
- return `${r}${n}${limitOptions({
908
- output: i.output,
909
- options: this.options,
910
- cursor: this.cursor,
911
- maxItems: i.maxItems,
912
- columnPadding: n.length,
913
- rowPadding: l + $,
914
- style: g
915
- }).join(`
916
- ${n}`)}
917
- ${h}
918
- `;
919
- }
920
- }
921
- }
922
- }).prompt();
923
- };
924
- const SELECT_INSTRUCTIONS = [`${(0, node_util.styleText)("dim", "↑/↓")} to navigate`, `${(0, node_util.styleText)("dim", "Enter:")} confirm`];
925
- const c = (t, o) => t.includes(`
926
- `) ? t.split(`
927
- `).map((d) => o(d)).join(`
928
- `) : o(t);
929
- const select = (t) => {
930
- const o = (n, m) => {
931
- if (n === void 0) return "";
932
- const s = n.label ?? String(n.value);
933
- switch (m) {
934
- case "disabled": return `${(0, node_util.styleText)("gray", S_RADIO_INACTIVE)} ${c(s, (i) => (0, node_util.styleText)("gray", i))}${n.hint ? ` ${(0, node_util.styleText)("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
935
- case "selected": return `${c(s, (i) => (0, node_util.styleText)("dim", i))}`;
936
- case "active": return `${(0, node_util.styleText)("green", S_RADIO_ACTIVE)} ${s}${n.hint ? ` ${(0, node_util.styleText)("dim", `(${n.hint})`)}` : ""}`;
937
- case "cancelled": return `${c(s, (i) => (0, node_util.styleText)(["strikethrough", "dim"], i))}`;
938
- default: return `${(0, node_util.styleText)("dim", S_RADIO_INACTIVE)} ${c(s, (i) => (0, node_util.styleText)("dim", i))}`;
939
- }
940
- }, d = t.showInstructions ?? true;
941
- return new n$1({
942
- options: t.options,
943
- signal: t.signal,
944
- input: t.input,
945
- output: t.output,
946
- initialValue: t.initialValue,
947
- render() {
948
- const n = t.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(t.output, t.message, s, m), u = `${n ? `${(0, node_util.styleText)("gray", S_BAR)}
949
- ` : ""}${i}
950
- `;
951
- switch (this.state) {
952
- case "submit": {
953
- const r = n ? `${(0, node_util.styleText)("gray", S_BAR)} ` : "";
954
- return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "selected"), r)}`;
955
- }
956
- case "cancel": {
957
- const r = n ? `${(0, node_util.styleText)("gray", S_BAR)} ` : "";
958
- return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "cancelled"), r)}${n ? `
959
- ${(0, node_util.styleText)("gray", S_BAR)}` : ""}`;
960
- }
961
- default: {
962
- const r = n ? `${(0, node_util.styleText)("cyan", S_BAR)} ` : "", a = u.split(`
963
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [(0, node_util.styleText)("cyan", S_BAR_END)] : [], f = p.join(`
964
- `), b = p.length + 1;
965
- return `${u}${r}${limitOptions({
966
- output: t.output,
967
- cursor: this.cursor,
968
- options: this.options,
969
- maxItems: t.maxItems,
970
- columnPadding: r.length,
971
- rowPadding: a + b,
972
- style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
973
- }).join(`
974
- ${r}`)}
975
- ${f}
976
- `;
977
- }
978
- }
979
- }
980
- }).prompt();
981
- };
982
- `${(0, node_util.styleText)("gray", S_BAR)}`;
983
- //#endregion
984
- exports.confirm = confirm;
985
- exports.isCancel = isCancel;
986
- exports.multiselect = multiselect;
987
- exports.select = select;
988
-
989
- //# sourceMappingURL=dist-BsCwQFEl.cjs.map