@rockcarver/frodo-cli 5.0.0-6 → 5.0.0-8

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.
@@ -0,0 +1,2356 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
+ const require_Console = require("./Console-1LBCP_JZ.cjs");
3
+ let node_module = require("node:module");
4
+ let node_path = require("node:path");
5
+ node_path = require_rolldown_runtime.__toESM(node_path, 1);
6
+ let node_process = require("node:process");
7
+ node_process = require_rolldown_runtime.__toESM(node_process, 1);
8
+ let node_util = require("node:util");
9
+ let node_async_hooks = require("node:async_hooks");
10
+ let node_readline = require("node:readline");
11
+ node_readline = require_rolldown_runtime.__toESM(node_readline, 1);
12
+ let patched = false;
13
+ function applyEscapeSequenceTimeout() {
14
+ if (patched) return;
15
+ patched = true;
16
+ const rl = (() => {
17
+ try {
18
+ return (0, node_module.createRequire)(__filename);
19
+ } catch {
20
+ return (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
21
+ }
22
+ })()("node:readline");
23
+ const original = rl.createInterface;
24
+ rl.createInterface = function patchedCreateInterface(options) {
25
+ return original({
26
+ escapeCodeTimeout: 50,
27
+ ...options
28
+ });
29
+ };
30
+ }
31
+ //#endregion
32
+ //#region src/utils/interactive/ExitAll.ts
33
+ applyEscapeSequenceTimeout();
34
+ /**
35
+ * The sentinel every escapable prompt resolves with when the user
36
+ * double-pressed ESC. Distinct from the per-surface escape symbols
37
+ * (ESCAPE / MULTISEL_ESCAPE / PAGE_ESCAPE / the value box's reject):
38
+ * those mean "back one level", this means "leave everything".
39
+ */
40
+ const EXIT_ALL = Symbol("interactive:exitAll");
41
+ /**
42
+ * The unwind signal consumers of EXIT_ALL THROW (never return): exit-all
43
+ * means "leave the session entirely -- straight back to the shell" (docs/
44
+ * INTERACTIVE-COMMANDS.md), from any nesting depth. A thrown symbol
45
+ * traverses commander's async action/hooks and every intermediate loop
46
+ * untouched -- the per-surface STEP_BACK catches already let
47
+ * non-STEP_BACK errors propagate -- until app.ts's top-level handler
48
+ * converts it into a clean exit. Throwing (rather than threading a
49
+ * return value through every loop) is what makes the unwind work from
50
+ * pickers called INSIDE nested loops (realm/entity pickers inside the
51
+ * action body, editors inside routing loops): each of those would
52
+ * otherwise need its own EXIT_ALL branch.
53
+ */
54
+ const EXIT_ALL_SIGNAL = Symbol("interactive:exitAllSignal");
55
+ /**
56
+ * Starts the grace window for the first ESC of a possible double-press
57
+ * and arms the second-press handler. `onSecondEscape` runs immediately
58
+ * when a second ESC arrives inside the window (the prompt then resolves
59
+ * EXIT_ALL); `onGraceExpire` runs when the window closes with no second
60
+ * press (the prompt then resolves its per-surface single-ESC action).
61
+ * `onOtherKey` cancels the grace and resolves the single-ESC action
62
+ * immediately -- the presses must be CONSECUTIVE (the double-click
63
+ * analogy); any other key ends the gesture.
64
+ *
65
+ * Returns a disposer that clears the timer without resolving anything
66
+ * (for prompt teardown).
67
+ */
68
+ function armEscapeGrace({ windowMs = 400, onSecondEscape, onGraceExpire }) {
69
+ let concluded = false;
70
+ const timer = setTimeout(() => {
71
+ if (concluded) return;
72
+ concluded = true;
73
+ onGraceExpire();
74
+ }, windowMs);
75
+ timer.unref?.();
76
+ return {
77
+ secondEscape() {
78
+ if (concluded) return;
79
+ concluded = true;
80
+ clearTimeout(timer);
81
+ onSecondEscape();
82
+ },
83
+ otherKey() {
84
+ if (concluded) return;
85
+ concluded = true;
86
+ clearTimeout(timer);
87
+ onGraceExpire();
88
+ },
89
+ dispose() {
90
+ clearTimeout(timer);
91
+ concluded = true;
92
+ }
93
+ };
94
+ }
95
+ //#endregion
96
+ //#region src/utils/interactive/PromptGateState.ts
97
+ /**
98
+ * The prompt gate's pure state, split from PromptGate.ts so it stays
99
+ * importable from unit tests: PromptGate pulls in @inquirer/core and the
100
+ * frodo-lib-importing ColorTheme, and this CLI's Jest setup cannot load
101
+ * frodo-lib (see src/app.commandWiring.test.ts's header comment).
102
+ *
103
+ * Prompts fire only when EVERY one of these holds --
104
+ *
105
+ * - `FRODO_NO_PROMPT` is unset (the explicit user opt-out, honored no
106
+ * matter how interactive the session looks; also settable per command
107
+ * via --no-prompt, see FrodoCommand);
108
+ * - `FRODO_TEST !== '1'` (the e2e harness tools/with-frodo-bin.mjs spawns
109
+ * with stdio: 'inherit', so local test runs DO have a TTY -- an
110
+ * isTTY-only gate would hang them);
111
+ * - both stdin and stdout are TTYs (piped/redirected sessions, the MCP
112
+ * server's stdio protocol channel, and CI all fail this naturally);
113
+ * - and setNeverPrompt() has not been called for this process (belt and
114
+ * braces for surfaces whose stdio is a protocol channel by
115
+ * construction, e.g. `frodo mcp server start --transport stdio`).
116
+ *
117
+ * Outside the gate, behavior is byte-identical to before the interactive
118
+ * layer existed: same errors, same exit codes.
119
+ */
120
+ /** Module-scoped hard kill switch for protocol-channel surfaces. */
121
+ let neverPrompt = false;
122
+ /**
123
+ * Prompts actually rendered this process (incremented by the prompt
124
+ * modules as they open). The resolution pass consults this to tell an
125
+ * interactive-assisted run (at least one prompt concluded) from a fully
126
+ * specified TTY run where the pass found nothing to do -- the command
127
+ * preview's final print belongs to the former (its payoff is the
128
+ * prompts' concluding <enter>), not the latter. Counter, not flag: a
129
+ * connection page + picker session must not lose the fact because the
130
+ * FIRST prompt of the session renders before the print gate could read a
131
+ * boolean.
132
+ */
133
+ let promptSessionCount = 0;
134
+ /**
135
+ * Records that an interactive prompt is being shown. Called by the
136
+ * prompt modules (textPrompt, escapableSelect, escapableMultiSelect,
137
+ * connectionPage) at open time.
138
+ */
139
+ function notePromptRendered() {
140
+ promptSessionCount += 1;
141
+ }
142
+ /** How many prompts have rendered this process. */
143
+ function promptsRendered() {
144
+ return promptSessionCount;
145
+ }
146
+ /**
147
+ * Permanently disables prompting for the remainder of this process. Used
148
+ * by surfaces whose stdin/stdout are a protocol channel by construction
149
+ * (e.g. the MCP server's stdio transport) as belt-and-braces alongside
150
+ * the natural isTTY check.
151
+ */
152
+ function setNeverPrompt() {
153
+ neverPrompt = true;
154
+ }
155
+ /**
156
+ * Whether prompts may fire in this process right now. Pure (no I/O) and
157
+ * cheap, so it can be consulted per prompt.
158
+ */
159
+ function canPrompt() {
160
+ if (neverPrompt) return false;
161
+ if (process.env.FRODO_NO_PROMPT) return false;
162
+ if (process.env.FRODO_TEST === "1") return false;
163
+ return !!process.stdin.isTTY && !!process.stdout.isTTY;
164
+ }
165
+ //#endregion
166
+ //#region src/utils/interactive/EditableOptions.ts
167
+ /**
168
+ * The command's editable options for this invocation -- the exact
169
+ * candidate list the invocation editor offers: options not yet valued,
170
+ * PLUS already-valued ones (editing what was given
171
+ * is the point of an editor; the value step pre-fills the current
172
+ * value). Non-editable machinery (help/version/prompting) never counts.
173
+ */
174
+ function editableOptionalOptions(command) {
175
+ return command.options.filter((option) => {
176
+ if (option.name() === "help" || option.name() === "help-more" || option.name() === "help-all" || option.name() === "version" || option.name() === "prompt" || option.name() === "no-prompt" || option.name() === "edit" || option.name() === "save-defaults") return false;
177
+ return true;
178
+ });
179
+ }
180
+ /**
181
+ * The discoverability hint for `command`'s pickers: a counted
182
+ * promise of what pressing → opens. Undefined when there is nothing to
183
+ * configure -- silence means done, so pickers without a hint keep the
184
+ * → key unclaimed.
185
+ */
186
+ function editableOptionsHint(command) {
187
+ const count = editableOptionalOptions(command).length;
188
+ return count > 0 ? `→ ${count} options` : void 0;
189
+ }
190
+ /**
191
+ * Zero-import: `helpGroupHeading` is commander's own Option property;
192
+ * no frodo-lib. Headings 'Options:' and '' mean the command's OWN
193
+ * options -- the group every leaf option lands in unless FrodoCommand
194
+ * assigned a shared heading (the same data the -h/-hh layout uses, so
195
+ * help and the editor can never disagree about where an option
196
+ * belongs).
197
+ */
198
+ const COMMAND_SPECIFIC_HEADINGS = /* @__PURE__ */ new Set(["Options:", ""]);
199
+ /**
200
+ * The option's editable-group id in the invocation editor:
201
+ * `undefined` = the command's own options (rendered flat, always
202
+ * visible), a heading string = a collapsible shared section.
203
+ */
204
+ function editableOptionGroupOf(option) {
205
+ const heading = option.helpGroupHeading ?? "";
206
+ return COMMAND_SPECIFIC_HEADINGS.has(heading) ? void 0 : heading;
207
+ }
208
+ /**
209
+ * The collapsible sections `options` actually populate, ordered
210
+ * alphabetically by heading -- the same order `-hh` help prints the
211
+ * groups in, so the editor and expanded help read alike. Empty groups
212
+ * never render (silence = this command carries no such options).
213
+ */
214
+ function editableOptionGroups(options) {
215
+ const present = /* @__PURE__ */ new Set();
216
+ for (const option of options) {
217
+ const group = editableOptionGroupOf(option);
218
+ if (group !== void 0) present.add(group);
219
+ }
220
+ return [...present].sort((a, b) => a.localeCompare(b)).map((heading) => ({
221
+ id: heading,
222
+ label: groupLabel(heading)
223
+ }));
224
+ }
225
+ /** 'Authentication Options:' -> 'Authentication options'. */
226
+ function groupLabel(heading) {
227
+ const words = heading.replace(/:$/, "").trim();
228
+ if (words.length === 0) return "Options";
229
+ const parts = words.split(" ");
230
+ parts[parts.length - 1] = parts[parts.length - 1].toLowerCase();
231
+ return parts.join(" ");
232
+ }
233
+ /**
234
+ * The editor's candidate ORDER: the command's own options first, then
235
+ * the shared groups alphabetically by heading (the -hh order), the
236
+ * dash-insensitive word sort INSIDE each (user feedback 2026-10-12: a
237
+ * flat alphabetical list buries the command's own options among global/
238
+ * connection machinery). Derived from the same grouping helpers the
239
+ * grouped editor renders, so order and sections can never drift apart.
240
+ */
241
+ function sortEditableOptions(options) {
242
+ const groups = editableOptionGroups(options);
243
+ const rankOf = (option) => {
244
+ const group = editableOptionGroupOf(option);
245
+ return group === void 0 ? -1 : groups.findIndex((g) => g.id === group);
246
+ };
247
+ const label = (option) => {
248
+ return option.flags.split(/[, ]+/).filter((token) => token.startsWith("-")).map((token) => token.replace(/^-+/, "")).filter((word) => !/^[<[]/.test(word)).join(" ").toLowerCase();
249
+ };
250
+ return [...options].sort((a, b) => {
251
+ const rankA = rankOf(a);
252
+ const rankB = rankOf(b);
253
+ if (rankA !== rankB) return rankA - rankB;
254
+ return label(a).localeCompare(label(b));
255
+ });
256
+ }
257
+ //#endregion
258
+ //#region node_modules/@inquirer/core/dist/lib/key.js
259
+ const keybindingLookup = /* @__PURE__ */ new Set(["emacs", "vim"]);
260
+ function isKeybinding(value) {
261
+ return keybindingLookup.has(value);
262
+ }
263
+ function getDefaultKeybindings() {
264
+ const env = process.env["INQUIRER_KEYBINDINGS"];
265
+ if (!env) return [];
266
+ return Array.from(new Set(env.toLowerCase().split(/[\s,]+/).filter(isKeybinding)));
267
+ }
268
+ const isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
269
+ const isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
270
+ const isSpaceKey = (key) => key.name === "space";
271
+ const isTabKey = (key) => key.name === "tab";
272
+ const isEnterKey = (key) => key.name === "enter" || key.name === "return";
273
+ //#endregion
274
+ //#region node_modules/@inquirer/core/dist/lib/errors.js
275
+ var AbortPromptError = class extends Error {
276
+ name = "AbortPromptError";
277
+ message = "Prompt was aborted";
278
+ constructor(options) {
279
+ super();
280
+ this.cause = options?.cause;
281
+ }
282
+ };
283
+ var CancelPromptError = class extends Error {
284
+ name = "CancelPromptError";
285
+ message = "Prompt was canceled";
286
+ };
287
+ var ExitPromptError = class extends Error {
288
+ name = "ExitPromptError";
289
+ };
290
+ var HookError = class extends Error {
291
+ name = "HookError";
292
+ };
293
+ var ValidationError = class extends Error {
294
+ name = "ValidationError";
295
+ };
296
+ //#endregion
297
+ //#region node_modules/@inquirer/core/dist/lib/hook-engine.js
298
+ const hookStorage = new node_async_hooks.AsyncLocalStorage();
299
+ function createStore(rl) {
300
+ return {
301
+ rl,
302
+ hooks: [],
303
+ hooksCleanup: [],
304
+ hooksEffect: [],
305
+ index: 0,
306
+ handleChange() {}
307
+ };
308
+ }
309
+ function withHooks(rl, cb) {
310
+ const store = createStore(rl);
311
+ function cycle(render) {
312
+ store.handleChange = () => {
313
+ store.index = 0;
314
+ render();
315
+ };
316
+ store.handleChange();
317
+ }
318
+ return hookStorage.run(store, () => cb(cycle));
319
+ }
320
+ function getStore() {
321
+ const store = hookStorage.getStore();
322
+ if (!store) throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
323
+ return store;
324
+ }
325
+ function readline() {
326
+ return getStore().rl;
327
+ }
328
+ function withUpdates(fn) {
329
+ const wrapped = (...args) => {
330
+ const store = getStore();
331
+ let shouldUpdate = false;
332
+ const oldHandleChange = store.handleChange;
333
+ store.handleChange = () => {
334
+ shouldUpdate = true;
335
+ };
336
+ const returnValue = fn(...args);
337
+ if (shouldUpdate) oldHandleChange();
338
+ store.handleChange = oldHandleChange;
339
+ return returnValue;
340
+ };
341
+ return node_async_hooks.AsyncResource.bind(wrapped);
342
+ }
343
+ function withPointer(cb) {
344
+ const store = getStore();
345
+ const { index } = store;
346
+ const returnValue = cb({
347
+ get() {
348
+ return store.hooks[index];
349
+ },
350
+ set(value) {
351
+ store.hooks[index] = value;
352
+ },
353
+ initialized: index in store.hooks
354
+ });
355
+ store.index++;
356
+ return returnValue;
357
+ }
358
+ function handleChange() {
359
+ getStore().handleChange();
360
+ }
361
+ const effectScheduler = {
362
+ queue(cb) {
363
+ const store = getStore();
364
+ const { index } = store;
365
+ store.hooksEffect.push(() => {
366
+ store.hooksCleanup[index]?.();
367
+ const cleanFn = cb(readline());
368
+ if (cleanFn != null && typeof cleanFn !== "function") throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
369
+ store.hooksCleanup[index] = cleanFn;
370
+ });
371
+ },
372
+ run() {
373
+ const store = getStore();
374
+ withUpdates(() => {
375
+ store.hooksEffect.forEach((effect) => {
376
+ effect();
377
+ });
378
+ store.hooksEffect.length = 0;
379
+ })();
380
+ },
381
+ clearAll() {
382
+ const store = getStore();
383
+ store.hooksCleanup.forEach((cleanFn) => {
384
+ cleanFn?.();
385
+ });
386
+ store.hooksEffect.length = 0;
387
+ store.hooksCleanup.length = 0;
388
+ }
389
+ };
390
+ //#endregion
391
+ //#region node_modules/@inquirer/core/dist/lib/use-state.js
392
+ function isFactory(value) {
393
+ return typeof value === "function";
394
+ }
395
+ function isReducer(value) {
396
+ return typeof value === "function";
397
+ }
398
+ function useState(defaultValue) {
399
+ return withPointer((pointer) => {
400
+ const setState = node_async_hooks.AsyncResource.bind(function setState(newValue) {
401
+ const currentValue = pointer.get();
402
+ const nextValue = isReducer(newValue) ? newValue(currentValue) : newValue;
403
+ if (!Object.is(currentValue, nextValue)) {
404
+ pointer.set(nextValue);
405
+ handleChange();
406
+ }
407
+ });
408
+ if (pointer.initialized) return [pointer.get(), setState];
409
+ const value = isFactory(defaultValue) ? defaultValue() : defaultValue;
410
+ pointer.set(value);
411
+ return [value, setState];
412
+ });
413
+ }
414
+ //#endregion
415
+ //#region node_modules/@inquirer/core/dist/lib/use-effect.js
416
+ function useEffect(cb, depArray) {
417
+ withPointer((pointer) => {
418
+ const oldDeps = pointer.get();
419
+ if (!Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]))) effectScheduler.queue(cb);
420
+ pointer.set(depArray);
421
+ });
422
+ }
423
+ //#endregion
424
+ //#region node_modules/@inquirer/figures/dist/index.js
425
+ function isUnicodeSupported() {
426
+ if (!node_process.default.platform.startsWith("win")) return node_process.default.env["TERM"] !== "linux";
427
+ 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";
428
+ }
429
+ const common = {
430
+ circleQuestionMark: "(?)",
431
+ questionMarkPrefix: "(?)",
432
+ square: "█",
433
+ squareDarkShade: "▓",
434
+ squareMediumShade: "▒",
435
+ squareLightShade: "░",
436
+ squareTop: "▀",
437
+ squareBottom: "▄",
438
+ squareLeft: "▌",
439
+ squareRight: "▐",
440
+ squareCenter: "■",
441
+ bullet: "●",
442
+ dot: "․",
443
+ ellipsis: "…",
444
+ pointerSmall: "›",
445
+ triangleUp: "▲",
446
+ triangleUpSmall: "▴",
447
+ triangleDown: "▼",
448
+ triangleDownSmall: "▾",
449
+ triangleLeftSmall: "◂",
450
+ triangleRightSmall: "▸",
451
+ home: "⌂",
452
+ heart: "♥",
453
+ musicNote: "♪",
454
+ musicNoteBeamed: "♫",
455
+ arrowUp: "↑",
456
+ arrowDown: "↓",
457
+ arrowLeft: "←",
458
+ arrowRight: "→",
459
+ arrowLeftRight: "↔",
460
+ arrowUpDown: "↕",
461
+ almostEqual: "≈",
462
+ notEqual: "≠",
463
+ lessOrEqual: "≤",
464
+ greaterOrEqual: "≥",
465
+ identical: "≡",
466
+ infinity: "∞",
467
+ subscriptZero: "₀",
468
+ subscriptOne: "₁",
469
+ subscriptTwo: "₂",
470
+ subscriptThree: "₃",
471
+ subscriptFour: "₄",
472
+ subscriptFive: "₅",
473
+ subscriptSix: "₆",
474
+ subscriptSeven: "₇",
475
+ subscriptEight: "₈",
476
+ subscriptNine: "₉",
477
+ oneHalf: "½",
478
+ oneThird: "⅓",
479
+ oneQuarter: "¼",
480
+ oneFifth: "⅕",
481
+ oneSixth: "⅙",
482
+ oneEighth: "⅛",
483
+ twoThirds: "⅔",
484
+ twoFifths: "⅖",
485
+ threeQuarters: "¾",
486
+ threeFifths: "⅗",
487
+ threeEighths: "⅜",
488
+ fourFifths: "⅘",
489
+ fiveSixths: "⅚",
490
+ fiveEighths: "⅝",
491
+ sevenEighths: "⅞",
492
+ line: "─",
493
+ lineBold: "━",
494
+ lineDouble: "═",
495
+ lineDashed0: "┄",
496
+ lineDashed1: "┅",
497
+ lineDashed2: "┈",
498
+ lineDashed3: "┉",
499
+ lineDashed4: "╌",
500
+ lineDashed5: "╍",
501
+ lineDashed6: "╴",
502
+ lineDashed7: "╶",
503
+ lineDashed8: "╸",
504
+ lineDashed9: "╺",
505
+ lineDashed10: "╼",
506
+ lineDashed11: "╾",
507
+ lineDashed12: "−",
508
+ lineDashed13: "–",
509
+ lineDashed14: "‐",
510
+ lineDashed15: "⁃",
511
+ lineVertical: "│",
512
+ lineVerticalBold: "┃",
513
+ lineVerticalDouble: "║",
514
+ lineVerticalDashed0: "┆",
515
+ lineVerticalDashed1: "┇",
516
+ lineVerticalDashed2: "┊",
517
+ lineVerticalDashed3: "┋",
518
+ lineVerticalDashed4: "╎",
519
+ lineVerticalDashed5: "╏",
520
+ lineVerticalDashed6: "╵",
521
+ lineVerticalDashed7: "╷",
522
+ lineVerticalDashed8: "╹",
523
+ lineVerticalDashed9: "╻",
524
+ lineVerticalDashed10: "╽",
525
+ lineVerticalDashed11: "╿",
526
+ lineDownLeft: "┐",
527
+ lineDownLeftArc: "╮",
528
+ lineDownBoldLeftBold: "┓",
529
+ lineDownBoldLeft: "┒",
530
+ lineDownLeftBold: "┑",
531
+ lineDownDoubleLeftDouble: "╗",
532
+ lineDownDoubleLeft: "╖",
533
+ lineDownLeftDouble: "╕",
534
+ lineDownRight: "┌",
535
+ lineDownRightArc: "╭",
536
+ lineDownBoldRightBold: "┏",
537
+ lineDownBoldRight: "┎",
538
+ lineDownRightBold: "┍",
539
+ lineDownDoubleRightDouble: "╔",
540
+ lineDownDoubleRight: "╓",
541
+ lineDownRightDouble: "╒",
542
+ lineUpLeft: "┘",
543
+ lineUpLeftArc: "╯",
544
+ lineUpBoldLeftBold: "┛",
545
+ lineUpBoldLeft: "┚",
546
+ lineUpLeftBold: "┙",
547
+ lineUpDoubleLeftDouble: "╝",
548
+ lineUpDoubleLeft: "╜",
549
+ lineUpLeftDouble: "╛",
550
+ lineUpRight: "└",
551
+ lineUpRightArc: "╰",
552
+ lineUpBoldRightBold: "┗",
553
+ lineUpBoldRight: "┖",
554
+ lineUpRightBold: "┕",
555
+ lineUpDoubleRightDouble: "╚",
556
+ lineUpDoubleRight: "╙",
557
+ lineUpRightDouble: "╘",
558
+ lineUpDownLeft: "┤",
559
+ lineUpBoldDownBoldLeftBold: "┫",
560
+ lineUpBoldDownBoldLeft: "┨",
561
+ lineUpDownLeftBold: "┥",
562
+ lineUpBoldDownLeftBold: "┩",
563
+ lineUpDownBoldLeftBold: "┪",
564
+ lineUpDownBoldLeft: "┧",
565
+ lineUpBoldDownLeft: "┦",
566
+ lineUpDoubleDownDoubleLeftDouble: "╣",
567
+ lineUpDoubleDownDoubleLeft: "╢",
568
+ lineUpDownLeftDouble: "╡",
569
+ lineUpDownRight: "├",
570
+ lineUpBoldDownBoldRightBold: "┣",
571
+ lineUpBoldDownBoldRight: "┠",
572
+ lineUpDownRightBold: "┝",
573
+ lineUpBoldDownRightBold: "┡",
574
+ lineUpDownBoldRightBold: "┢",
575
+ lineUpDownBoldRight: "┟",
576
+ lineUpBoldDownRight: "┞",
577
+ lineUpDoubleDownDoubleRightDouble: "╠",
578
+ lineUpDoubleDownDoubleRight: "╟",
579
+ lineUpDownRightDouble: "╞",
580
+ lineDownLeftRight: "┬",
581
+ lineDownBoldLeftBoldRightBold: "┳",
582
+ lineDownLeftBoldRightBold: "┯",
583
+ lineDownBoldLeftRight: "┰",
584
+ lineDownBoldLeftBoldRight: "┱",
585
+ lineDownBoldLeftRightBold: "┲",
586
+ lineDownLeftRightBold: "┮",
587
+ lineDownLeftBoldRight: "┭",
588
+ lineDownDoubleLeftDoubleRightDouble: "╦",
589
+ lineDownDoubleLeftRight: "╥",
590
+ lineDownLeftDoubleRightDouble: "╤",
591
+ lineUpLeftRight: "┴",
592
+ lineUpBoldLeftBoldRightBold: "┻",
593
+ lineUpLeftBoldRightBold: "┷",
594
+ lineUpBoldLeftRight: "┸",
595
+ lineUpBoldLeftBoldRight: "┹",
596
+ lineUpBoldLeftRightBold: "┺",
597
+ lineUpLeftRightBold: "┶",
598
+ lineUpLeftBoldRight: "┵",
599
+ lineUpDoubleLeftDoubleRightDouble: "╩",
600
+ lineUpDoubleLeftRight: "╨",
601
+ lineUpLeftDoubleRightDouble: "╧",
602
+ lineUpDownLeftRight: "┼",
603
+ lineUpBoldDownBoldLeftBoldRightBold: "╋",
604
+ lineUpDownBoldLeftBoldRightBold: "╈",
605
+ lineUpBoldDownLeftBoldRightBold: "╇",
606
+ lineUpBoldDownBoldLeftRightBold: "╊",
607
+ lineUpBoldDownBoldLeftBoldRight: "╉",
608
+ lineUpBoldDownLeftRight: "╀",
609
+ lineUpDownBoldLeftRight: "╁",
610
+ lineUpDownLeftBoldRight: "┽",
611
+ lineUpDownLeftRightBold: "┾",
612
+ lineUpBoldDownBoldLeftRight: "╂",
613
+ lineUpDownLeftBoldRightBold: "┿",
614
+ lineUpBoldDownLeftBoldRight: "╃",
615
+ lineUpBoldDownLeftRightBold: "╄",
616
+ lineUpDownBoldLeftBoldRight: "╅",
617
+ lineUpDownBoldLeftRightBold: "╆",
618
+ lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
619
+ lineUpDoubleDownDoubleLeftRight: "╫",
620
+ lineUpDownLeftDoubleRightDouble: "╪",
621
+ lineCross: "╳",
622
+ lineBackslash: "╲",
623
+ lineSlash: "╱"
624
+ };
625
+ const specialMainSymbols = {
626
+ tick: "✔",
627
+ info: "ℹ",
628
+ warning: "⚠",
629
+ cross: "✘",
630
+ squareSmall: "◻",
631
+ squareSmallFilled: "◼",
632
+ circle: "◯",
633
+ circleFilled: "◉",
634
+ circleDotted: "◌",
635
+ circleDouble: "◎",
636
+ circleCircle: "ⓞ",
637
+ circleCross: "ⓧ",
638
+ circlePipe: "Ⓘ",
639
+ radioOn: "◉",
640
+ radioOff: "◯",
641
+ checkboxOn: "☒",
642
+ checkboxOff: "☐",
643
+ checkboxCircleOn: "ⓧ",
644
+ checkboxCircleOff: "Ⓘ",
645
+ pointer: "❯",
646
+ triangleUpOutline: "△",
647
+ triangleLeft: "◀",
648
+ triangleRight: "▶",
649
+ lozenge: "◆",
650
+ lozengeOutline: "◇",
651
+ hamburger: "☰",
652
+ smiley: "㋡",
653
+ mustache: "෴",
654
+ star: "★",
655
+ play: "▶",
656
+ nodejs: "⬢",
657
+ oneSeventh: "⅐",
658
+ oneNinth: "⅑",
659
+ oneTenth: "⅒"
660
+ };
661
+ const specialFallbackSymbols = {
662
+ tick: "√",
663
+ info: "i",
664
+ warning: "‼",
665
+ cross: "×",
666
+ squareSmall: "□",
667
+ squareSmallFilled: "■",
668
+ circle: "( )",
669
+ circleFilled: "(*)",
670
+ circleDotted: "( )",
671
+ circleDouble: "( )",
672
+ circleCircle: "(○)",
673
+ circleCross: "(×)",
674
+ circlePipe: "(│)",
675
+ radioOn: "(*)",
676
+ radioOff: "( )",
677
+ checkboxOn: "[×]",
678
+ checkboxOff: "[ ]",
679
+ checkboxCircleOn: "(×)",
680
+ checkboxCircleOff: "( )",
681
+ pointer: ">",
682
+ triangleUpOutline: "∆",
683
+ triangleLeft: "◄",
684
+ triangleRight: "►",
685
+ lozenge: "♦",
686
+ lozengeOutline: "◊",
687
+ hamburger: "≡",
688
+ smiley: "☺",
689
+ mustache: "┌─┐",
690
+ star: "✶",
691
+ play: "►",
692
+ nodejs: "♦",
693
+ oneSeventh: "1/7",
694
+ oneNinth: "1/9",
695
+ oneTenth: "1/10"
696
+ };
697
+ const mainSymbols = {
698
+ ...common,
699
+ ...specialMainSymbols
700
+ };
701
+ const fallbackSymbols = {
702
+ ...common,
703
+ ...specialFallbackSymbols
704
+ };
705
+ const figures = isUnicodeSupported() ? mainSymbols : fallbackSymbols;
706
+ Object.entries(specialMainSymbols);
707
+ //#endregion
708
+ //#region node_modules/@inquirer/core/dist/lib/theme.js
709
+ const defaultTheme = {
710
+ prefix: {
711
+ idle: (0, node_util.styleText)("blue", "?"),
712
+ done: (0, node_util.styleText)("green", figures.tick)
713
+ },
714
+ spinner: {
715
+ interval: 80,
716
+ frames: [
717
+ "⠋",
718
+ "⠙",
719
+ "⠹",
720
+ "⠸",
721
+ "⠼",
722
+ "⠴",
723
+ "⠦",
724
+ "⠧",
725
+ "⠇",
726
+ "⠏"
727
+ ].map((frame) => (0, node_util.styleText)("yellow", frame))
728
+ },
729
+ keybindings: [],
730
+ style: {
731
+ answer: (text) => (0, node_util.styleText)("cyan", text),
732
+ message: (text) => (0, node_util.styleText)("bold", text),
733
+ error: (text) => (0, node_util.styleText)("red", `> ${text}`),
734
+ defaultAnswer: (text) => (0, node_util.styleText)("dim", `(${text})`),
735
+ help: (text) => (0, node_util.styleText)("dim", text),
736
+ highlight: (text) => (0, node_util.styleText)("cyan", text),
737
+ key: (text) => (0, node_util.styleText)("cyan", (0, node_util.styleText)("bold", `<${text}>`))
738
+ }
739
+ };
740
+ function getDefaultTheme() {
741
+ return {
742
+ ...defaultTheme,
743
+ keybindings: getDefaultKeybindings()
744
+ };
745
+ }
746
+ //#endregion
747
+ //#region node_modules/@inquirer/core/dist/lib/make-theme.js
748
+ function isPlainObject(value) {
749
+ if (typeof value !== "object" || value === null) return false;
750
+ let proto = value;
751
+ while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
752
+ return Object.getPrototypeOf(value) === proto;
753
+ }
754
+ function deepMerge(...objects) {
755
+ const output = {};
756
+ for (const obj of objects) for (const [key, value] of Object.entries(obj)) {
757
+ const prevValue = output[key];
758
+ output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
759
+ }
760
+ return output;
761
+ }
762
+ function makeTheme(...themes) {
763
+ return deepMerge(...[getDefaultTheme(), ...themes.filter((theme) => theme != null)]);
764
+ }
765
+ //#endregion
766
+ //#region node_modules/@inquirer/core/dist/lib/use-prefix.js
767
+ function usePrefix({ status = "idle", theme }) {
768
+ const [showLoader, setShowLoader] = useState(false);
769
+ const [tick, setTick] = useState(0);
770
+ const { prefix, spinner } = makeTheme(theme);
771
+ useEffect(() => {
772
+ if (status === "loading") {
773
+ let tickInterval;
774
+ let inc = -1;
775
+ const delayTimeout = setTimeout(() => {
776
+ setShowLoader(true);
777
+ tickInterval = setInterval(() => {
778
+ inc = inc + 1;
779
+ setTick(inc % spinner.frames.length);
780
+ }, spinner.interval);
781
+ }, 300);
782
+ return () => {
783
+ clearTimeout(delayTimeout);
784
+ clearInterval(tickInterval);
785
+ };
786
+ } else setShowLoader(false);
787
+ }, [status]);
788
+ if (showLoader) return spinner.frames[tick];
789
+ return typeof prefix === "string" ? prefix : prefix[status === "loading" ? "idle" : status] ?? prefix["idle"];
790
+ }
791
+ //#endregion
792
+ //#region node_modules/@inquirer/core/dist/lib/use-memo.js
793
+ function useMemo(fn, dependencies) {
794
+ return withPointer((pointer) => {
795
+ const prev = pointer.get();
796
+ if (!pointer.initialized || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
797
+ const value = fn();
798
+ pointer.set({
799
+ value,
800
+ dependencies
801
+ });
802
+ return value;
803
+ }
804
+ return prev.value;
805
+ });
806
+ }
807
+ //#endregion
808
+ //#region node_modules/@inquirer/core/dist/lib/use-ref.js
809
+ function useRef(val) {
810
+ return useState({ current: val })[0];
811
+ }
812
+ //#endregion
813
+ //#region node_modules/@inquirer/core/dist/lib/use-keypress.js
814
+ function useKeypress(userHandler) {
815
+ const signal = useRef(userHandler);
816
+ signal.current = userHandler;
817
+ useEffect((rl) => {
818
+ let ignore = false;
819
+ const handler = withUpdates((_input, event) => {
820
+ if (ignore) return;
821
+ signal.current(event, rl);
822
+ });
823
+ rl.input.on("keypress", handler);
824
+ return () => {
825
+ ignore = true;
826
+ rl.input.removeListener("keypress", handler);
827
+ };
828
+ }, []);
829
+ }
830
+ //#endregion
831
+ //#region node_modules/cli-width/index.js
832
+ var require_cli_width = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
833
+ module.exports = cliWidth;
834
+ function normalizeOpts(options) {
835
+ const defaultOpts = {
836
+ defaultWidth: 0,
837
+ output: process.stdout,
838
+ tty: require("tty")
839
+ };
840
+ if (!options) return defaultOpts;
841
+ Object.keys(defaultOpts).forEach(function(key) {
842
+ if (!options[key]) options[key] = defaultOpts[key];
843
+ });
844
+ return options;
845
+ }
846
+ function cliWidth(options) {
847
+ const opts = normalizeOpts(options);
848
+ if (opts.output.getWindowSize) return opts.output.getWindowSize()[0] || opts.defaultWidth;
849
+ if (opts.tty.getWindowSize) return opts.tty.getWindowSize()[1] || opts.defaultWidth;
850
+ if (opts.output.columns) return opts.output.columns;
851
+ if (process.env.CLI_WIDTH) {
852
+ const width = parseInt(process.env.CLI_WIDTH, 10);
853
+ if (!isNaN(width) && width !== 0) return width;
854
+ }
855
+ return opts.defaultWidth;
856
+ }
857
+ }));
858
+ //#endregion
859
+ //#region node_modules/fast-string-truncated-width/dist/utils.js
860
+ var import_cli_width = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_cli_width(), 1);
861
+ const getCodePointsLength = (() => {
862
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
863
+ return (input) => {
864
+ let surrogatePairsNr = 0;
865
+ SURROGATE_PAIR_RE.lastIndex = 0;
866
+ while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
867
+ return input.length - surrogatePairsNr;
868
+ };
869
+ })();
870
+ const isFullWidth = (x) => {
871
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
872
+ };
873
+ const isWideNotCJKTNotEmoji = (x) => {
874
+ 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;
875
+ };
876
+ //#endregion
877
+ //#region node_modules/fast-string-truncated-width/dist/index.js
878
+ const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
879
+ const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
880
+ 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;
881
+ const TAB_RE = /\t{1,1000}/y;
882
+ 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;
883
+ const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
884
+ const MODIFIER_RE = /\p{M}+/gu;
885
+ const NO_TRUNCATION$1 = {
886
+ limit: Infinity,
887
+ ellipsis: ""
888
+ };
889
+ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
890
+ const LIMIT = truncationOptions.limit ?? Infinity;
891
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
892
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
893
+ const ANSI_WIDTH = 0;
894
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
895
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
896
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
897
+ const FULL_WIDTH_WIDTH = 2;
898
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
899
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
900
+ const PARSE_BLOCKS = [
901
+ [LATIN_RE, REGULAR_WIDTH],
902
+ [ANSI_RE, ANSI_WIDTH],
903
+ [CONTROL_RE, CONTROL_WIDTH],
904
+ [TAB_RE, TAB_WIDTH],
905
+ [EMOJI_RE, EMOJI_WIDTH],
906
+ [CJKT_WIDE_RE, WIDE_WIDTH]
907
+ ];
908
+ let indexPrev = 0;
909
+ let index = 0;
910
+ let length = input.length;
911
+ let lengthExtra = 0;
912
+ let truncationEnabled = false;
913
+ let truncationIndex = length;
914
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
915
+ let unmatchedStart = 0;
916
+ let unmatchedEnd = 0;
917
+ let width = 0;
918
+ let widthExtra = 0;
919
+ outer: while (true) {
920
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
921
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
922
+ lengthExtra = 0;
923
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
924
+ const codePoint = char.codePointAt(0) || 0;
925
+ if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
926
+ else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
927
+ else widthExtra = REGULAR_WIDTH;
928
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
929
+ if (width + widthExtra > LIMIT) {
930
+ truncationEnabled = true;
931
+ break outer;
932
+ }
933
+ lengthExtra += char.length;
934
+ width += widthExtra;
935
+ }
936
+ unmatchedStart = unmatchedEnd = 0;
937
+ }
938
+ if (index >= length) break outer;
939
+ for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
940
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
941
+ BLOCK_RE.lastIndex = index;
942
+ if (BLOCK_RE.test(input)) {
943
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
944
+ widthExtra = lengthExtra * BLOCK_WIDTH;
945
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
946
+ if (width + widthExtra > LIMIT) {
947
+ truncationEnabled = true;
948
+ break outer;
949
+ }
950
+ width += widthExtra;
951
+ unmatchedStart = indexPrev;
952
+ unmatchedEnd = index;
953
+ index = indexPrev = BLOCK_RE.lastIndex;
954
+ continue outer;
955
+ }
956
+ }
957
+ index += 1;
958
+ }
959
+ return {
960
+ width: truncationEnabled ? truncationLimit : width,
961
+ index: truncationEnabled ? truncationIndex : length,
962
+ truncated: truncationEnabled,
963
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
964
+ };
965
+ };
966
+ //#endregion
967
+ //#region node_modules/fast-string-width/dist/index.js
968
+ const NO_TRUNCATION = {
969
+ limit: Infinity,
970
+ ellipsis: "",
971
+ ellipsisWidth: 0
972
+ };
973
+ const fastStringWidth = (input, options = {}) => {
974
+ return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
975
+ };
976
+ //#endregion
977
+ //#region node_modules/fast-wrap-ansi/lib/main.js
978
+ const ESC$1 = "\x1B";
979
+ const CSI = "›";
980
+ const END_CODE = 39;
981
+ const ANSI_ESCAPE_BELL = "\x07";
982
+ const ANSI_CSI = "[";
983
+ const ANSI_OSC = "]";
984
+ const ANSI_SGR_TERMINATOR = "m";
985
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
986
+ const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
987
+ const getClosingCode = (openingCode) => {
988
+ if (openingCode >= 30 && openingCode <= 37) return 39;
989
+ if (openingCode >= 90 && openingCode <= 97) return 39;
990
+ if (openingCode >= 40 && openingCode <= 47) return 49;
991
+ if (openingCode >= 100 && openingCode <= 107) return 49;
992
+ if (openingCode === 1 || openingCode === 2) return 22;
993
+ if (openingCode === 3) return 23;
994
+ if (openingCode === 4) return 24;
995
+ if (openingCode === 7) return 27;
996
+ if (openingCode === 8) return 28;
997
+ if (openingCode === 9) return 29;
998
+ if (openingCode === 0) return 0;
999
+ };
1000
+ const wrapAnsiCode = (code) => `${ESC$1}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
1001
+ const wrapAnsiHyperlink = (url) => `${ESC$1}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
1002
+ const wrapWord = (rows, word, columns) => {
1003
+ const characters = word[Symbol.iterator]();
1004
+ let isInsideEscape = false;
1005
+ let isInsideLinkEscape = false;
1006
+ let lastRow = rows.at(-1);
1007
+ let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
1008
+ let currentCharacter = characters.next();
1009
+ let nextCharacter = characters.next();
1010
+ let rawCharacterIndex = 0;
1011
+ while (!currentCharacter.done) {
1012
+ const character = currentCharacter.value;
1013
+ const characterLength = fastStringWidth(character);
1014
+ if (visible + characterLength <= columns) rows[rows.length - 1] += character;
1015
+ else {
1016
+ rows.push(character);
1017
+ visible = 0;
1018
+ }
1019
+ if (character === ESC$1 || character === CSI) {
1020
+ isInsideEscape = true;
1021
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
1022
+ }
1023
+ if (isInsideEscape) {
1024
+ if (isInsideLinkEscape) {
1025
+ if (character === ANSI_ESCAPE_BELL) {
1026
+ isInsideEscape = false;
1027
+ isInsideLinkEscape = false;
1028
+ }
1029
+ } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
1030
+ } else {
1031
+ visible += characterLength;
1032
+ if (visible === columns && !nextCharacter.done) {
1033
+ rows.push("");
1034
+ visible = 0;
1035
+ }
1036
+ }
1037
+ currentCharacter = nextCharacter;
1038
+ nextCharacter = characters.next();
1039
+ rawCharacterIndex += character.length;
1040
+ }
1041
+ lastRow = rows.at(-1);
1042
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
1043
+ };
1044
+ const stringVisibleTrimSpacesRight = (string) => {
1045
+ const words = string.split(" ");
1046
+ let last = words.length;
1047
+ while (last) {
1048
+ if (fastStringWidth(words[last - 1])) break;
1049
+ last--;
1050
+ }
1051
+ if (last === words.length) return string;
1052
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
1053
+ };
1054
+ const exec = (string, columns, options = {}) => {
1055
+ if (options.trim !== false && string.trim() === "") return "";
1056
+ let returnValue = "";
1057
+ let escapeCode;
1058
+ let escapeUrl;
1059
+ const words = string.split(" ");
1060
+ let rows = [""];
1061
+ let rowLength = 0;
1062
+ for (let index = 0; index < words.length; index++) {
1063
+ const word = words[index];
1064
+ if (options.trim !== false) {
1065
+ const row = rows.at(-1) ?? "";
1066
+ const trimmed = row.trimStart();
1067
+ if (row.length !== trimmed.length) {
1068
+ rows[rows.length - 1] = trimmed;
1069
+ rowLength = fastStringWidth(trimmed);
1070
+ }
1071
+ }
1072
+ if (index !== 0) {
1073
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
1074
+ rows.push("");
1075
+ rowLength = 0;
1076
+ }
1077
+ if (rowLength || options.trim === false) {
1078
+ rows[rows.length - 1] += " ";
1079
+ rowLength++;
1080
+ }
1081
+ }
1082
+ const wordLength = fastStringWidth(word);
1083
+ if (options.hard && wordLength > columns) {
1084
+ const remainingColumns = columns - rowLength;
1085
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
1086
+ if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
1087
+ wrapWord(rows, word, columns);
1088
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
1089
+ continue;
1090
+ }
1091
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
1092
+ if (options.wordWrap === false && rowLength < columns) {
1093
+ wrapWord(rows, word, columns);
1094
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
1095
+ continue;
1096
+ }
1097
+ rows.push("");
1098
+ rowLength = 0;
1099
+ }
1100
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
1101
+ wrapWord(rows, word, columns);
1102
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
1103
+ continue;
1104
+ }
1105
+ rows[rows.length - 1] += word;
1106
+ rowLength += wordLength;
1107
+ }
1108
+ if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
1109
+ const preString = rows.join("\n");
1110
+ let inSurrogate = false;
1111
+ for (let i = 0; i < preString.length; i++) {
1112
+ const character = preString[i];
1113
+ returnValue += character;
1114
+ if (!inSurrogate) {
1115
+ inSurrogate = character >= "\ud800" && character <= "\udbff";
1116
+ if (inSurrogate) continue;
1117
+ } else inSurrogate = false;
1118
+ if (character === ESC$1 || character === CSI) {
1119
+ GROUP_REGEX.lastIndex = i + 1;
1120
+ const groups = GROUP_REGEX.exec(preString)?.groups;
1121
+ if (groups?.code !== void 0) {
1122
+ const code = Number.parseFloat(groups.code);
1123
+ escapeCode = code === END_CODE ? void 0 : code;
1124
+ } else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
1125
+ }
1126
+ if (preString[i + 1] === "\n") {
1127
+ if (escapeUrl) returnValue += wrapAnsiHyperlink("");
1128
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
1129
+ if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
1130
+ } else if (character === "\n") {
1131
+ if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
1132
+ if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
1133
+ }
1134
+ }
1135
+ return returnValue;
1136
+ };
1137
+ const CRLF_OR_LF = /\r?\n/;
1138
+ function wrapAnsi(string, columns, options) {
1139
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
1140
+ }
1141
+ //#endregion
1142
+ //#region node_modules/@inquirer/core/dist/lib/utils.js
1143
+ /**
1144
+ * Force line returns at specific width. This function is ANSI code friendly and it'll
1145
+ * ignore invisible codes during width calculation.
1146
+ * @param {string} content
1147
+ * @param {number} width
1148
+ * @return {string}
1149
+ */
1150
+ function breakLines(content, width) {
1151
+ return content.split("\n").flatMap((line) => wrapAnsi(line, width, {
1152
+ trim: false,
1153
+ wordWrap: false
1154
+ }).split("\n").map((str) => str.trimEnd())).join("\n");
1155
+ }
1156
+ /**
1157
+ * Returns the width of the active readline, or 80 as default value.
1158
+ * @returns {number}
1159
+ */
1160
+ function readlineWidth() {
1161
+ return (0, import_cli_width.default)({
1162
+ defaultWidth: 80,
1163
+ output: readline().output
1164
+ });
1165
+ }
1166
+ //#endregion
1167
+ //#region node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
1168
+ function usePointerPosition({ active, renderedItems, pageSize, loop }) {
1169
+ const state = useRef({
1170
+ lastPointer: active,
1171
+ lastActive: void 0
1172
+ });
1173
+ const { lastPointer, lastActive } = state.current;
1174
+ const middle = Math.floor(pageSize / 2);
1175
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
1176
+ const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
1177
+ let pointer = defaultPointerPosition;
1178
+ if (renderedLength > pageSize) {
1179
+ if (loop) {
1180
+ /**
1181
+ * Creates the next position for the pointer considering an infinitely
1182
+ * looping list of items to be rendered on the page.
1183
+ *
1184
+ * The goal is to progressively move the cursor to the middle position as the user move down, and then keep
1185
+ * the cursor there. When the user move up, maintain the cursor position.
1186
+ */
1187
+ pointer = lastPointer;
1188
+ if (lastActive != null && lastActive < active && active - lastActive < pageSize) pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
1189
+ } else {
1190
+ /**
1191
+ * Creates the next position for the pointer considering a finite list of
1192
+ * items to be rendered on a page.
1193
+ *
1194
+ * The goal is to keep the pointer in the middle of the page whenever possible, until
1195
+ * we reach the bounds of the list (top or bottom). In which case, the cursor moves progressively
1196
+ * to the bottom or top of the list.
1197
+ */
1198
+ const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
1199
+ pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
1200
+ }
1201
+ }
1202
+ state.current.lastPointer = pointer;
1203
+ state.current.lastActive = active;
1204
+ return pointer;
1205
+ }
1206
+ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
1207
+ const width = readlineWidth();
1208
+ const bound = (num) => (num % items.length + items.length) % items.length;
1209
+ const renderedItems = items.map((item, index) => {
1210
+ if (item == null) return [];
1211
+ return breakLines(renderItem({
1212
+ item,
1213
+ index,
1214
+ isActive: index === active
1215
+ }), width).split("\n");
1216
+ });
1217
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
1218
+ const renderItemAtIndex = (index) => renderedItems[index] ?? [];
1219
+ const pointer = usePointerPosition({
1220
+ active,
1221
+ renderedItems,
1222
+ pageSize,
1223
+ loop
1224
+ });
1225
+ const activeItem = renderItemAtIndex(active).slice(0, pageSize);
1226
+ const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
1227
+ const pageBuffer = Array.from({ length: pageSize });
1228
+ pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
1229
+ const itemVisited = /* @__PURE__ */ new Set([active]);
1230
+ let bufferPointer = activeItemPosition + activeItem.length;
1231
+ let itemPointer = bound(active + 1);
1232
+ while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
1233
+ const linesToAdd = renderItemAtIndex(itemPointer).slice(0, pageSize - bufferPointer);
1234
+ pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
1235
+ itemVisited.add(itemPointer);
1236
+ bufferPointer += linesToAdd.length;
1237
+ itemPointer = bound(itemPointer + 1);
1238
+ }
1239
+ bufferPointer = activeItemPosition - 1;
1240
+ itemPointer = bound(active - 1);
1241
+ while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
1242
+ const lines = renderItemAtIndex(itemPointer);
1243
+ const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
1244
+ pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
1245
+ itemVisited.add(itemPointer);
1246
+ bufferPointer -= linesToAdd.length;
1247
+ itemPointer = bound(itemPointer - 1);
1248
+ }
1249
+ return pageBuffer.filter((line) => typeof line === "string").join("\n");
1250
+ }
1251
+ //#endregion
1252
+ //#region node_modules/@inquirer/type/dist/utils.js
1253
+ /**
1254
+ * Create a promise and get access to its `resolve` and `reject` functions.
1255
+ *
1256
+ * Mirrors `Promise.withResolvers()`, available starting from Node 22.
1257
+ * TODO: Remove once Node 22 becomes the minimum supported version.
1258
+ */
1259
+ function withResolver() {
1260
+ let resolve;
1261
+ let reject;
1262
+ return {
1263
+ promise: new Promise((res, rej) => {
1264
+ resolve = res;
1265
+ reject = rej;
1266
+ }),
1267
+ resolve,
1268
+ reject
1269
+ };
1270
+ }
1271
+ //#endregion
1272
+ //#region node_modules/mute-stream/lib/index.js
1273
+ var require_lib = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1274
+ const Stream = require("stream");
1275
+ var MuteStream = class extends Stream {
1276
+ #isTTY = null;
1277
+ constructor(opts = {}) {
1278
+ super(opts);
1279
+ this.writable = this.readable = true;
1280
+ this.muted = false;
1281
+ this.on("pipe", this._onpipe);
1282
+ this.replace = opts.replace;
1283
+ this._prompt = opts.prompt || null;
1284
+ this._hadControl = false;
1285
+ }
1286
+ #destSrc(key, def) {
1287
+ if (this._dest) return this._dest[key];
1288
+ if (this._src) return this._src[key];
1289
+ return def;
1290
+ }
1291
+ #proxy(method, ...args) {
1292
+ if (typeof this._dest?.[method] === "function") this._dest[method](...args);
1293
+ if (typeof this._src?.[method] === "function") this._src[method](...args);
1294
+ }
1295
+ get isTTY() {
1296
+ if (this.#isTTY !== null) return this.#isTTY;
1297
+ return this.#destSrc("isTTY", false);
1298
+ }
1299
+ set isTTY(val) {
1300
+ this.#isTTY = val;
1301
+ }
1302
+ get rows() {
1303
+ return this.#destSrc("rows");
1304
+ }
1305
+ get columns() {
1306
+ return this.#destSrc("columns");
1307
+ }
1308
+ mute() {
1309
+ this.muted = true;
1310
+ }
1311
+ unmute() {
1312
+ this.muted = false;
1313
+ }
1314
+ _onpipe(src) {
1315
+ this._src = src;
1316
+ }
1317
+ pipe(dest, options) {
1318
+ this._dest = dest;
1319
+ return super.pipe(dest, options);
1320
+ }
1321
+ pause() {
1322
+ if (this._src) return this._src.pause();
1323
+ }
1324
+ resume() {
1325
+ if (this._src) return this._src.resume();
1326
+ }
1327
+ write(c) {
1328
+ if (this.muted) {
1329
+ if (!this.replace) return true;
1330
+ if (c.match(/^\u001b/)) {
1331
+ if (c.indexOf(this._prompt) === 0) {
1332
+ c = c.slice(this._prompt.length);
1333
+ c = c.replace(/./g, this.replace);
1334
+ c = this._prompt + c;
1335
+ }
1336
+ this._hadControl = true;
1337
+ return this.emit("data", c);
1338
+ } else {
1339
+ if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
1340
+ this._hadControl = false;
1341
+ this.emit("data", this._prompt);
1342
+ c = c.slice(this._prompt.length);
1343
+ }
1344
+ c = c.toString().replace(/./g, this.replace);
1345
+ }
1346
+ }
1347
+ this.emit("data", c);
1348
+ }
1349
+ end(c) {
1350
+ if (this.muted) {
1351
+ if (c && this.replace) c = c.toString().replace(/./g, this.replace);
1352
+ else c = null;
1353
+ }
1354
+ if (c) this.emit("data", c);
1355
+ this.emit("end");
1356
+ }
1357
+ destroy(...args) {
1358
+ return this.#proxy("destroy", ...args);
1359
+ }
1360
+ destroySoon(...args) {
1361
+ return this.#proxy("destroySoon", ...args);
1362
+ }
1363
+ close(...args) {
1364
+ return this.#proxy("close", ...args);
1365
+ }
1366
+ };
1367
+ module.exports = MuteStream;
1368
+ }));
1369
+ //#endregion
1370
+ //#region node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/signals.js
1371
+ var import_lib = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_lib(), 1);
1372
+ /**
1373
+ * This is not the set of all possible signals.
1374
+ *
1375
+ * It IS, however, the set of all signals that trigger
1376
+ * an exit on either Linux or BSD systems. Linux is a
1377
+ * superset of the signal names supported on BSD, and
1378
+ * the unknown signals just fail to register, so we can
1379
+ * catch that easily enough.
1380
+ *
1381
+ * Windows signals are a different set, since there are
1382
+ * signals that terminate Windows processes, but don't
1383
+ * terminate (or don't even exist) on Posix systems.
1384
+ *
1385
+ * Don't bother with SIGKILL. It's uncatchable, which
1386
+ * means that we can't fire any callbacks anyway.
1387
+ *
1388
+ * If a user does happen to register a handler on a non-
1389
+ * fatal signal like SIGWINCH or something, and then
1390
+ * exit, it'll end up firing `process.emit('exit')`, so
1391
+ * the handler will be fired anyway.
1392
+ *
1393
+ * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
1394
+ * artificially, inherently leave the process in a
1395
+ * state from which it is not safe to try and enter JS
1396
+ * listeners.
1397
+ */
1398
+ const signals = [];
1399
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
1400
+ if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
1401
+ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1402
+ //#endregion
1403
+ //#region node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/index.js
1404
+ const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
1405
+ const kExitEmitter = Symbol.for("signal-exit emitter");
1406
+ const global = globalThis;
1407
+ const ObjectDefineProperty = Object.defineProperty.bind(Object);
1408
+ var Emitter = class {
1409
+ emitted = {
1410
+ afterExit: false,
1411
+ exit: false
1412
+ };
1413
+ listeners = {
1414
+ afterExit: [],
1415
+ exit: []
1416
+ };
1417
+ count = 0;
1418
+ id = Math.random();
1419
+ constructor() {
1420
+ if (global[kExitEmitter]) return global[kExitEmitter];
1421
+ ObjectDefineProperty(global, kExitEmitter, {
1422
+ value: this,
1423
+ writable: false,
1424
+ enumerable: false,
1425
+ configurable: false
1426
+ });
1427
+ }
1428
+ on(ev, fn) {
1429
+ this.listeners[ev].push(fn);
1430
+ }
1431
+ removeListener(ev, fn) {
1432
+ const list = this.listeners[ev];
1433
+ const i = list.indexOf(fn);
1434
+ /* c8 ignore start */
1435
+ if (i === -1) return;
1436
+ /* c8 ignore stop */
1437
+ if (i === 0 && list.length === 1) list.length = 0;
1438
+ else list.splice(i, 1);
1439
+ }
1440
+ emit(ev, code, signal) {
1441
+ if (this.emitted[ev]) return false;
1442
+ this.emitted[ev] = true;
1443
+ let ret = false;
1444
+ for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
1445
+ if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
1446
+ return ret;
1447
+ }
1448
+ };
1449
+ var SignalExitBase = class {};
1450
+ const signalExitWrap = (handler) => {
1451
+ return {
1452
+ onExit(cb, opts) {
1453
+ return handler.onExit(cb, opts);
1454
+ },
1455
+ load() {
1456
+ return handler.load();
1457
+ },
1458
+ unload() {
1459
+ return handler.unload();
1460
+ }
1461
+ };
1462
+ };
1463
+ var SignalExitFallback = class extends SignalExitBase {
1464
+ onExit() {
1465
+ return () => {};
1466
+ }
1467
+ load() {}
1468
+ unload() {}
1469
+ };
1470
+ var SignalExit = class extends SignalExitBase {
1471
+ /* c8 ignore start */
1472
+ #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
1473
+ /* c8 ignore stop */
1474
+ #emitter = new Emitter();
1475
+ #process;
1476
+ #originalProcessEmit;
1477
+ #originalProcessReallyExit;
1478
+ #sigListeners = {};
1479
+ #loaded = false;
1480
+ constructor(process) {
1481
+ super();
1482
+ this.#process = process;
1483
+ this.#sigListeners = {};
1484
+ for (const sig of signals) this.#sigListeners[sig] = () => {
1485
+ const listeners = this.#process.listeners(sig);
1486
+ let { count } = this.#emitter;
1487
+ /* c8 ignore start */
1488
+ const p = process;
1489
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
1490
+ /* c8 ignore stop */
1491
+ if (listeners.length === count) {
1492
+ this.unload();
1493
+ const ret = this.#emitter.emit("exit", null, sig);
1494
+ /* c8 ignore start */
1495
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
1496
+ if (!ret) process.kill(process.pid, s);
1497
+ }
1498
+ };
1499
+ this.#originalProcessReallyExit = process.reallyExit;
1500
+ this.#originalProcessEmit = process.emit;
1501
+ }
1502
+ onExit(cb, opts) {
1503
+ /* c8 ignore start */
1504
+ if (!processOk(this.#process)) return () => {};
1505
+ /* c8 ignore stop */
1506
+ if (this.#loaded === false) this.load();
1507
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
1508
+ this.#emitter.on(ev, cb);
1509
+ return () => {
1510
+ this.#emitter.removeListener(ev, cb);
1511
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
1512
+ };
1513
+ }
1514
+ load() {
1515
+ if (this.#loaded) return;
1516
+ this.#loaded = true;
1517
+ this.#emitter.count += 1;
1518
+ for (const sig of signals) try {
1519
+ const fn = this.#sigListeners[sig];
1520
+ if (fn) this.#process.on(sig, fn);
1521
+ } catch (_) {}
1522
+ this.#process.emit = (ev, ...a) => {
1523
+ return this.#processEmit(ev, ...a);
1524
+ };
1525
+ this.#process.reallyExit = (code) => {
1526
+ return this.#processReallyExit(code);
1527
+ };
1528
+ }
1529
+ unload() {
1530
+ if (!this.#loaded) return;
1531
+ this.#loaded = false;
1532
+ signals.forEach((sig) => {
1533
+ const listener = this.#sigListeners[sig];
1534
+ /* c8 ignore start */
1535
+ if (!listener) throw new Error("Listener not defined for signal: " + sig);
1536
+ /* c8 ignore stop */
1537
+ try {
1538
+ this.#process.removeListener(sig, listener);
1539
+ } catch (_) {}
1540
+ /* c8 ignore stop */
1541
+ });
1542
+ this.#process.emit = this.#originalProcessEmit;
1543
+ this.#process.reallyExit = this.#originalProcessReallyExit;
1544
+ this.#emitter.count -= 1;
1545
+ }
1546
+ #processReallyExit(code) {
1547
+ /* c8 ignore start */
1548
+ if (!processOk(this.#process)) return 0;
1549
+ this.#process.exitCode = code || 0;
1550
+ /* c8 ignore stop */
1551
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1552
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
1553
+ }
1554
+ #processEmit(ev, ...args) {
1555
+ const og = this.#originalProcessEmit;
1556
+ if (ev === "exit" && processOk(this.#process)) {
1557
+ if (typeof args[0] === "number") this.#process.exitCode = args[0];
1558
+ /* c8 ignore start */
1559
+ const ret = og.call(this.#process, ev, ...args);
1560
+ /* c8 ignore start */
1561
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1562
+ /* c8 ignore stop */
1563
+ return ret;
1564
+ } else return og.call(this.#process, ev, ...args);
1565
+ }
1566
+ };
1567
+ const process$1 = globalThis.process;
1568
+ const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
1569
+ //#endregion
1570
+ //#region node_modules/@inquirer/ansi/dist/index.js
1571
+ const ESC = "\x1B[";
1572
+ /** Show the cursor */
1573
+ const cursorShow = "\x1B[?25h";
1574
+ /** Move cursor up by count rows */
1575
+ const cursorUp = (rows = 1) => rows > 0 ? `${ESC}${rows}A` : "";
1576
+ /** Move cursor down by count rows */
1577
+ const cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : "";
1578
+ /** Move cursor to position (x, y) */
1579
+ const cursorTo = (x, y) => {
1580
+ if (typeof y === "number" && !Number.isNaN(y)) return `${ESC}${y + 1};${x + 1}H`;
1581
+ return `${ESC}${x + 1}G`;
1582
+ };
1583
+ const eraseLine = "\x1B[2K";
1584
+ /** Erase the specified number of lines above the cursor */
1585
+ const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + "\x1B[2K\x1B[G" : "";
1586
+ //#endregion
1587
+ //#region node_modules/@inquirer/core/dist/lib/screen-manager.js
1588
+ const height = (content) => content.split("\n").length;
1589
+ const lastLine = (content) => content.split("\n").pop() ?? "";
1590
+ var ScreenManager = class {
1591
+ height = 0;
1592
+ extraLinesUnderPrompt = 0;
1593
+ cursorPos;
1594
+ rl;
1595
+ constructor(rl) {
1596
+ this.rl = rl;
1597
+ this.cursorPos = rl.getCursorPos();
1598
+ }
1599
+ write(content) {
1600
+ this.rl.output.unmute();
1601
+ this.rl.output.write(content);
1602
+ this.rl.output.mute();
1603
+ }
1604
+ render(content, bottomContent = "") {
1605
+ const promptLine = lastLine(content);
1606
+ const rawPromptLine = (0, node_util.stripVTControlCharacters)(promptLine);
1607
+ let prompt = rawPromptLine;
1608
+ if (this.rl.line.length > 0) prompt = prompt.slice(0, -this.rl.line.length);
1609
+ this.rl.setPrompt(prompt);
1610
+ this.cursorPos = this.rl.getCursorPos();
1611
+ const width = readlineWidth();
1612
+ content = breakLines(content, width);
1613
+ bottomContent = breakLines(bottomContent, width);
1614
+ if (rawPromptLine.length % width === 0) content += "\n";
1615
+ let output = content + (bottomContent ? "\n" + bottomContent : "");
1616
+ const bottomContentHeight = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows + (bottomContent ? height(bottomContent) : 0);
1617
+ if (bottomContentHeight > 0) output += cursorUp(bottomContentHeight);
1618
+ output += cursorTo(this.cursorPos.cols);
1619
+ /**
1620
+ * Render and store state for future re-rendering
1621
+ */
1622
+ this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
1623
+ this.extraLinesUnderPrompt = bottomContentHeight;
1624
+ this.height = height(output);
1625
+ }
1626
+ checkCursorPos() {
1627
+ const cursorPos = this.rl.getCursorPos();
1628
+ if (cursorPos.cols !== this.cursorPos.cols) {
1629
+ this.write(cursorTo(cursorPos.cols));
1630
+ this.cursorPos = cursorPos;
1631
+ }
1632
+ }
1633
+ done({ clearContent }) {
1634
+ this.rl.setPrompt("");
1635
+ let output = cursorDown(this.extraLinesUnderPrompt);
1636
+ output += clearContent ? eraseLines(this.height) : "\n";
1637
+ output += "\x1B[G";
1638
+ output += cursorShow;
1639
+ this.write(output);
1640
+ this.rl.close();
1641
+ }
1642
+ };
1643
+ //#endregion
1644
+ //#region node_modules/@inquirer/core/dist/lib/create-prompt.js
1645
+ const nativeSetImmediate = globalThis.setImmediate;
1646
+ /**
1647
+ * Register an event listener and return its disposer, so registrations collapse
1648
+ * into a single statement: `cleanups.add(listenTo(rl, 'close', handler))`.
1649
+ */
1650
+ function listenTo(target, event, listener) {
1651
+ if ("on" in target) {
1652
+ target.on(event, listener);
1653
+ return () => target.removeListener(event, listener);
1654
+ }
1655
+ target.addEventListener(event, listener);
1656
+ return () => target.removeEventListener(event, listener);
1657
+ }
1658
+ function getCallSites() {
1659
+ const savedPrepareStackTrace = Error.prepareStackTrace;
1660
+ let result = [];
1661
+ try {
1662
+ Error.prepareStackTrace = (_, callSites) => {
1663
+ const callSitesWithoutCurrent = callSites.slice(1);
1664
+ result = callSitesWithoutCurrent;
1665
+ return callSitesWithoutCurrent;
1666
+ };
1667
+ (/* @__PURE__ */ new Error()).stack;
1668
+ } catch {
1669
+ return result;
1670
+ }
1671
+ Error.prepareStackTrace = savedPrepareStackTrace;
1672
+ return result;
1673
+ }
1674
+ function createPrompt(view) {
1675
+ const callSites = getCallSites();
1676
+ const prompt = (config, context = {}) => {
1677
+ const { input = process.stdin, signal } = context;
1678
+ const cleanups = /* @__PURE__ */ new Set();
1679
+ const output = new import_lib.default();
1680
+ output.pipe(context.output ?? process.stdout);
1681
+ const rl = node_readline.createInterface({
1682
+ terminal: true,
1683
+ input,
1684
+ output
1685
+ });
1686
+ output.mute();
1687
+ const screen = new ScreenManager(rl);
1688
+ const { promise, resolve, reject } = withResolver();
1689
+ return withHooks(rl, (cycle) => {
1690
+ const clearEffects = node_async_hooks.AsyncResource.bind(() => effectScheduler.clearAll());
1691
+ const settlePrompt = (settle) => {
1692
+ try {
1693
+ clearEffects();
1694
+ settle();
1695
+ } catch (error) {
1696
+ reject(error);
1697
+ }
1698
+ };
1699
+ const resolvePrompt = (value) => settlePrompt(() => resolve(value));
1700
+ const rejectPrompt = (error) => settlePrompt(() => reject(error));
1701
+ const promptPromise = Object.assign(promise.finally(() => {
1702
+ cleanups.forEach((cleanup) => cleanup());
1703
+ screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
1704
+ output.end();
1705
+ }).then(() => promise), { cancel: () => rejectPrompt(new CancelPromptError()) });
1706
+ if (signal) {
1707
+ const abort = () => rejectPrompt(new AbortPromptError({ cause: signal.reason }));
1708
+ if (signal.aborted) {
1709
+ abort();
1710
+ return promptPromise;
1711
+ }
1712
+ cleanups.add(listenTo(signal, "abort", abort));
1713
+ }
1714
+ cleanups.add(onExit((code, signal) => {
1715
+ rejectPrompt(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`));
1716
+ }));
1717
+ cleanups.add(listenTo(rl, "SIGINT", () => rejectPrompt(new ExitPromptError(`User force closed the prompt with SIGINT`))));
1718
+ cleanups.add(listenTo(rl, "close", clearEffects));
1719
+ const startCycle = () => {
1720
+ cleanups.add(listenTo(rl.input, "keypress", () => screen.checkCursorPos()));
1721
+ let pendingDone = null;
1722
+ cycle(() => {
1723
+ let effectsSettled = false;
1724
+ try {
1725
+ const nextView = view(config, (value) => {
1726
+ if (effectsSettled) resolvePrompt(value);
1727
+ else pendingDone = { value };
1728
+ });
1729
+ if (nextView === void 0) {
1730
+ let callerFilename = callSites[1]?.getFileName();
1731
+ if (callerFilename && !callerFilename.startsWith("file://")) callerFilename = node_path.default.resolve(callerFilename);
1732
+ throw new Error(`Prompt functions must return a string.\n at ${callerFilename}`);
1733
+ }
1734
+ const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
1735
+ screen.render(content, bottomContent);
1736
+ effectScheduler.run();
1737
+ } catch (error) {
1738
+ rejectPrompt(error);
1739
+ }
1740
+ effectsSettled = true;
1741
+ if (pendingDone !== null) {
1742
+ const { value } = pendingDone;
1743
+ pendingDone = null;
1744
+ resolvePrompt(value);
1745
+ }
1746
+ });
1747
+ };
1748
+ if ("readableFlowing" in input) nativeSetImmediate(startCycle);
1749
+ else startCycle();
1750
+ return promptPromise;
1751
+ });
1752
+ };
1753
+ return prompt;
1754
+ }
1755
+ //#endregion
1756
+ //#region src/utils/interactive/NavigationMenu.ts
1757
+ /**
1758
+ * The navigation menu (docs/INTERACTIVE-COMMANDS.md): a framed box at
1759
+ * the TOP of every prompt frame, so the user reads the available keys
1760
+ * BEFORE the question. Only keys that apply to the current prompt
1761
+ * appear, each rendered in its theme color -- the visual grammar:
1762
+ *
1763
+ * - movement (up/down, and space/enter in multi-selects) -- `muted`
1764
+ * (always available, so it reads as furniture, not news);
1765
+ * - the segment keys (-> where a hint arms it, <- in the editor) --
1766
+ * `command` (the navigation actions worth spotting);
1767
+ * - conclude (enter in single-selects, space+enter in multi-selects) --
1768
+ * `positive` (the committing action);
1769
+ * - exit (esc) -- `negative` (the backing-out action).
1770
+ *
1771
+ * Zero-import aside from the theme (same constraint as EditableOptions):
1772
+ * every prompt module renders this, so it must not drag frodo-lib
1773
+ * graphs into tests that mock frodo-lib wholesale.
1774
+ */
1775
+ /**
1776
+ * The direction keys as the bar draws them: Unicode medium triangles
1777
+ * (heavier than the slim arrows, no arrow shaft), shown in [] like every
1778
+ * key label.
1779
+ */
1780
+ const DIRECTION_KEYS = {
1781
+ upDown: "⏶⏷",
1782
+ left: "⏴",
1783
+ right: "⏵"
1784
+ };
1785
+ /**
1786
+ * Builds the menu items for one prompt frame from the affordances it
1787
+ * actually has -- callers pass what applies; absent keys simply don't
1788
+ * render (silence = that key does nothing here, the same "counted,
1789
+ * truthful" discipline the -> hint follows).
1790
+ */
1791
+ function navigationMenuItems(options) {
1792
+ const items = [];
1793
+ items.push({
1794
+ keys: `[${DIRECTION_KEYS.upDown}]`,
1795
+ action: "move",
1796
+ intent: "muted"
1797
+ });
1798
+ if (options.filter) items.push({
1799
+ keys: "type",
1800
+ action: "to filter",
1801
+ intent: "muted"
1802
+ });
1803
+ if (options.space) items.push({
1804
+ keys: "[space]",
1805
+ action: options.space,
1806
+ intent: "muted"
1807
+ });
1808
+ if (options.enter) items.push({
1809
+ keys: "[ENTER]",
1810
+ action: options.enter,
1811
+ intent: "positive"
1812
+ });
1813
+ if (options.right) items.push({
1814
+ keys: `[${DIRECTION_KEYS.right}]`,
1815
+ action: options.right,
1816
+ intent: "command"
1817
+ });
1818
+ if (options.left) items.push({
1819
+ keys: `[${DIRECTION_KEYS.left}]`,
1820
+ action: "back",
1821
+ intent: "command"
1822
+ });
1823
+ items.push({
1824
+ keys: "[ESC]",
1825
+ action: options.escape ?? "back out",
1826
+ intent: "negative"
1827
+ });
1828
+ return items;
1829
+ }
1830
+ const INTENT_COLOR = {
1831
+ muted: (text) => require_Console.theme.muted(text),
1832
+ command: (text) => require_Console.theme.command(text),
1833
+ positive: (text) => require_Console.theme.positive(text),
1834
+ negative: (text) => require_Console.theme.negative(text)
1835
+ };
1836
+ /**
1837
+ * The ANSI-stripped width input for the box math: every SGR sequence
1838
+ * (ESC [ ... m) carries no cells, everything the frames render is plain
1839
+ * UTF-8 or SGR -- the same assumption the wall alignment already makes.
1840
+ */
1841
+ function stripAnsi(text) {
1842
+ return text.replace(/\x1b\[[0-9;]*m/g, "");
1843
+ }
1844
+ /** The columns every frame is drawn at unless the caller says otherwise. */
1845
+ const DEFAULT_FRAME_WIDTH = 120;
1846
+ const FRAME_BORDER = 2;
1847
+ /**
1848
+ * The text width available INSIDE a frame drawn at `width` columns --
1849
+ * the one place the wall + padding math lives, so box renderers and the
1850
+ * wrappers feeding them can never disagree about where the wall is.
1851
+ */
1852
+ function frameInnerWidth(width = DEFAULT_FRAME_WIDTH) {
1853
+ return Math.max(10, width - FRAME_BORDER - 2);
1854
+ }
1855
+ /**
1856
+ * Word-wraps ONE logical line to `width` columns (ANSI stripped first, so
1857
+ * the measured text is the drawn text). Spacing between words is kept
1858
+ * (aligned "key: text" columns survive a wrap), leading indentation
1859
+ * repeats on continuation rows, and a word longer than a whole row is
1860
+ * hard-split rather than pushed through the right wall.
1861
+ */
1862
+ function wrapLine(line, width) {
1863
+ const text = stripAnsi(line).trimEnd();
1864
+ if (text.length <= width) return [text];
1865
+ const indent = /^\s*/.exec(text)?.[0] ?? "";
1866
+ const room = Math.max(1, width - indent.length);
1867
+ const rows = [];
1868
+ let current = "";
1869
+ for (const chunk of text.slice(indent.length).match(/\S+\s*/g) ?? []) {
1870
+ let piece = chunk;
1871
+ while (piece.trimEnd().length > room) {
1872
+ if (current) {
1873
+ rows.push(indent + current.trimEnd());
1874
+ current = "";
1875
+ }
1876
+ rows.push(indent + piece.slice(0, room));
1877
+ piece = piece.slice(room);
1878
+ }
1879
+ if (current && current.length + piece.trimEnd().length > room) {
1880
+ rows.push(indent + current.trimEnd());
1881
+ current = piece;
1882
+ } else current += piece;
1883
+ }
1884
+ if (current.trim()) rows.push(indent + current.trimEnd());
1885
+ return rows.length > 0 ? rows : [""];
1886
+ }
1887
+ /**
1888
+ * A highlighted entry's description as muted panel rows, wrapped to the
1889
+ * frame so a long description can never push past the right wall (a
1890
+ * multi-line description keeps its own line breaks; each line wraps on
1891
+ * its own).
1892
+ */
1893
+ function descriptionPanelLines(description, width = DEFAULT_FRAME_WIDTH) {
1894
+ const inner = frameInnerWidth(width);
1895
+ return description.split("\n").flatMap((row) => wrapLine(row, inner)).map((row) => ({
1896
+ text: require_Console.theme.muted(row),
1897
+ plain: row
1898
+ }));
1899
+ }
1900
+ /**
1901
+ * One framed box renderer for all prompt-frame furniture (the Navigate
1902
+ * menu, every prompt's question+list panel, the inline value editor's
1903
+ * Value box): the title (a plain string, or a {text, plain} pair when it
1904
+ * carries colored content -- e.g. the question line with its prefix and
1905
+ * query echo), the body lines (pre-colored), and the width the frame is
1906
+ * drawn at -- so every box in a frame shares the same silhouette and the
1907
+ * same wrap/measure discipline (ANSI excluded from every measurement).
1908
+ *
1909
+ * The {text, plain} pair exists for ONE historical reason -- the query
1910
+ * echo used to be conditional on the caller's search configuration, so
1911
+ * the colored and measured forms could diverge (the bare-stub picker's
1912
+ * panel top wall came out short by the query's length: the renderer
1913
+ * drew to a text WITHOUT the echo, the walls measured a plain WITH it).
1914
+ * The renderer now measures the title on stripAnsi(title.text) itself,
1915
+ * so the pair is belt-and-braces: callers may still pass plain for
1916
+ * clarity, but a divergent plain can no longer skew the walls.
1917
+ */
1918
+ function renderFramedBox(options) {
1919
+ const { lines } = options;
1920
+ const title = typeof options.title === "string" ? { text: options.title } : options.title;
1921
+ const titleText = ` ${title.text} `;
1922
+ const titlePlain = ` ${stripAnsi(title.text)} `;
1923
+ const innerWidth = frameInnerWidth(options.width ?? DEFAULT_FRAME_WIDTH);
1924
+ const top = `┌${titleText}${"─".repeat(Math.max(0, innerWidth + 2 - titlePlain.length))}┐`;
1925
+ const bottom = `└${"─".repeat(innerWidth + 2)}┘`;
1926
+ return `${top}\n${lines.map((line) => {
1927
+ const pad = " ".repeat(Math.max(0, innerWidth - line.plain.length));
1928
+ return `│ ${line.text}${pad} │`;
1929
+ }).join("\n")}\n${bottom}`;
1930
+ }
1931
+ /**
1932
+ * Renders the framed box, wrapped to `width` columns (the prompt frames
1933
+ * live in a real terminal -- the PTY pins 120; the box respects the
1934
+ * caller's width so narrow terminals wrap the ITEMS, not the border).
1935
+ * Returns '' when there are no items.
1936
+ */
1937
+ function renderNavigationMenu(items, width = DEFAULT_FRAME_WIDTH) {
1938
+ if (items.length === 0) return "";
1939
+ const rendered = items.map((item) => ({
1940
+ text: `${INTENT_COLOR[item.intent](item.keys)} ${require_Console.theme.muted(item.action)}`,
1941
+ plainWidth: item.keys.length + 1 + item.action.length,
1942
+ plain: `${item.keys} ${item.action}`
1943
+ }));
1944
+ const GAP = " · ";
1945
+ const GAP_WIDTH = 3;
1946
+ const innerWidth = frameInnerWidth(width);
1947
+ const rows = [];
1948
+ let current = [];
1949
+ let currentWidth = 0;
1950
+ for (const item of rendered) {
1951
+ const addition = current.length === 0 ? item.plainWidth : GAP_WIDTH + item.plainWidth;
1952
+ if (current.length > 0 && currentWidth + addition > innerWidth) {
1953
+ rows.push(current);
1954
+ current = [item];
1955
+ currentWidth = item.plainWidth;
1956
+ } else {
1957
+ current.push(item);
1958
+ currentWidth += addition;
1959
+ }
1960
+ }
1961
+ if (current.length > 0) rows.push(current);
1962
+ return renderFramedBox({
1963
+ title: "Navigate",
1964
+ lines: rows.map((row) => {
1965
+ const plainWidth = row.reduce((sum, item, index) => sum + item.plainWidth + (index > 0 ? GAP_WIDTH : 0), 0);
1966
+ const pad = " ".repeat(Math.max(0, innerWidth - plainWidth));
1967
+ return {
1968
+ text: `${row.map((item) => item.text).join(GAP)}${pad}`,
1969
+ plain: `${row.map((item) => item.plain).join(GAP)}${pad}`
1970
+ };
1971
+ }),
1972
+ width
1973
+ });
1974
+ }
1975
+ //#endregion
1976
+ //#region src/utils/interactive/EscapableSelectPrompt.ts
1977
+ /**
1978
+ * Distinct return value `escapableSelect` resolves with when the user
1979
+ * presses Escape instead of choosing something -- callers branch on this
1980
+ * to go back a menu level (or exit cleanly at the top level) instead of
1981
+ * treating it as a real selection.
1982
+ */
1983
+ const ESCAPE = Symbol("escapableSelect:escape");
1984
+ /**
1985
+ * Distinct return value `escapableSelect` resolves with when the user
1986
+ * presses → (right arrow) instead of choosing something -- the
1987
+ * "enter the next editor segment" key of the segment navigation
1988
+ * described in docs/INTERACTIVE-COMMANDS.md.
1989
+ * Only fires when the prompt is configured with a `hint` (the caller's
1990
+ * promise that something more to configure exists); without a hint the
1991
+ * key is left to readline, so plain pickers keep today's behavior.
1992
+ * Callers branch on this to open the options editor / connection page
1993
+ * and then re-run the picker.
1994
+ */
1995
+ const RIGHT = Symbol("escapableSelect:right");
1996
+ const escapableSelectImpl = createPrompt((config, done) => {
1997
+ const { pageSize = 20, choices } = config;
1998
+ const [status, setStatus] = useState("idle");
1999
+ const prefix = usePrefix({ status: status === "escaped" ? "done" : status });
2000
+ const [query, setQuery] = useState("");
2001
+ const filtered = useMemo(() => {
2002
+ if (!config.search) {
2003
+ if (query.length === 0) return choices;
2004
+ const needle = query.toLowerCase();
2005
+ return choices.filter((choice) => choice.name.toLowerCase().includes(needle));
2006
+ }
2007
+ return choices.filter((choice) => config.search(choice, query));
2008
+ }, [
2009
+ choices,
2010
+ query,
2011
+ config.search
2012
+ ]);
2013
+ const firstRender = useRef(true);
2014
+ const lastQueryRef = useRef(query);
2015
+ useEffect(() => {
2016
+ if (firstRender.current) {
2017
+ firstRender.current = false;
2018
+ lastQueryRef.current = query;
2019
+ return;
2020
+ }
2021
+ if (lastQueryRef.current === query) return;
2022
+ lastQueryRef.current = query;
2023
+ setActive(0);
2024
+ }, [query]);
2025
+ const [active, setActive] = useState(useMemo(() => {
2026
+ if (!("default" in config)) return 0;
2027
+ const index = choices.findIndex((choice) => choice.value === config.default);
2028
+ return index === -1 ? 0 : index;
2029
+ }, [config.default, choices]));
2030
+ const selected = filtered[active];
2031
+ const escapeGraceRef = useRef(void 0);
2032
+ const [escapeGraceOpen, setEscapeGraceOpen] = useState(false);
2033
+ useEffect(() => () => escapeGraceRef.current?.dispose(), []);
2034
+ const resolveEscapeGrace = (kind) => {
2035
+ setEscapeGraceOpen(false);
2036
+ setStatus("escaped");
2037
+ done(kind === "all" ? EXIT_ALL : ESCAPE);
2038
+ };
2039
+ useKeypress((key, rl) => {
2040
+ if (key.name === "escape") {
2041
+ if (rl.line.length > 0) {
2042
+ rl.clearLine(0);
2043
+ setQuery("");
2044
+ escapeGraceRef.current?.otherKey();
2045
+ escapeGraceRef.current = void 0;
2046
+ return;
2047
+ }
2048
+ if (escapeGraceRef.current) {
2049
+ const grace = escapeGraceRef.current;
2050
+ escapeGraceRef.current = void 0;
2051
+ grace.secondEscape();
2052
+ return;
2053
+ }
2054
+ setEscapeGraceOpen(true);
2055
+ escapeGraceRef.current = armEscapeGrace({
2056
+ onSecondEscape: () => resolveEscapeGrace("all"),
2057
+ onGraceExpire: () => resolveEscapeGrace("escape")
2058
+ });
2059
+ return;
2060
+ } else if (key.name === "right" && config.hint && rl.line.length === 0) {
2061
+ escapeGraceRef.current?.otherKey();
2062
+ escapeGraceRef.current = void 0;
2063
+ setStatus("done");
2064
+ done(RIGHT);
2065
+ } else if (isEnterKey(key)) {
2066
+ escapeGraceRef.current?.otherKey();
2067
+ escapeGraceRef.current = void 0;
2068
+ if (!selected) return;
2069
+ setStatus("done");
2070
+ done(selected.value);
2071
+ } else if (isUpKey(key) || isDownKey(key)) {
2072
+ escapeGraceRef.current?.otherKey();
2073
+ escapeGraceRef.current = void 0;
2074
+ if (filtered.length === 0) return;
2075
+ const offset = isUpKey(key) ? -1 : 1;
2076
+ setActive((previous) => Math.min(filtered.length - 1, Math.max(0, previous + offset)));
2077
+ } else {
2078
+ escapeGraceRef.current?.otherKey();
2079
+ escapeGraceRef.current = void 0;
2080
+ setQuery(rl.line);
2081
+ }
2082
+ });
2083
+ if (status === "escaped") return `${prefix} ${config.message} ${require_Console.theme.muted("(cancelled)")}`;
2084
+ if (status === "done") return `${prefix} ${config.message} ${require_Console.theme.positive(selected.name)}`;
2085
+ const page = usePagination({
2086
+ items: filtered,
2087
+ active,
2088
+ renderItem: ({ item, isActive }) => {
2089
+ const line = `${isActive ? "›" : " "} ${item.name}`;
2090
+ return isActive ? require_Console.theme.command(line) : line;
2091
+ },
2092
+ pageSize,
2093
+ loop: false
2094
+ });
2095
+ const queryEcho = query.length > 0 ? require_Console.theme.command(` query: ${query}`) : "";
2096
+ const menu = renderNavigationMenu(navigationMenuItems({
2097
+ filter: true,
2098
+ enter: "select",
2099
+ right: config.hint ? config.hint.replace(/^→\s*/, "") : void 0,
2100
+ escape: "back · [ESC]×2 exit all"
2101
+ }));
2102
+ const panelLines = [];
2103
+ if (escapeGraceOpen) panelLines.push({
2104
+ text: require_Console.theme.muted("esc again to exit all -- or wait to go back one level"),
2105
+ plain: "esc again to exit all -- or wait to go back one level"
2106
+ });
2107
+ if (filtered.length > 0) for (const row of page.split("\n")) panelLines.push({
2108
+ text: row,
2109
+ plain: stripAnsi(row)
2110
+ });
2111
+ else panelLines.push({
2112
+ text: require_Console.theme.muted("(no matches -- backspace to edit)"),
2113
+ plain: "(no matches -- backspace to edit)"
2114
+ });
2115
+ if (selected?.description) {
2116
+ panelLines.push({
2117
+ text: "",
2118
+ plain: ""
2119
+ });
2120
+ panelLines.push(...descriptionPanelLines(selected.description));
2121
+ }
2122
+ return [
2123
+ menu,
2124
+ renderFramedBox({
2125
+ title: {
2126
+ text: `${prefix} ${config.message}${queryEcho}`,
2127
+ plain: `? ${config.message}${queryEcho}`
2128
+ },
2129
+ lines: panelLines
2130
+ }),
2131
+ typeof config.preview === "function" ? config.preview(selected?.value) : config.preview
2132
+ ].filter(Boolean).join("\n");
2133
+ });
2134
+ const escapableSelect = ((config) => {
2135
+ notePromptRendered();
2136
+ return escapableSelectImpl(config, { clearPromptOnDone: true });
2137
+ });
2138
+ //#endregion
2139
+ Object.defineProperty(exports, "ESCAPE", {
2140
+ enumerable: true,
2141
+ get: function() {
2142
+ return ESCAPE;
2143
+ }
2144
+ });
2145
+ Object.defineProperty(exports, "EXIT_ALL", {
2146
+ enumerable: true,
2147
+ get: function() {
2148
+ return EXIT_ALL;
2149
+ }
2150
+ });
2151
+ Object.defineProperty(exports, "EXIT_ALL_SIGNAL", {
2152
+ enumerable: true,
2153
+ get: function() {
2154
+ return EXIT_ALL_SIGNAL;
2155
+ }
2156
+ });
2157
+ Object.defineProperty(exports, "ExitPromptError", {
2158
+ enumerable: true,
2159
+ get: function() {
2160
+ return ExitPromptError;
2161
+ }
2162
+ });
2163
+ Object.defineProperty(exports, "RIGHT", {
2164
+ enumerable: true,
2165
+ get: function() {
2166
+ return RIGHT;
2167
+ }
2168
+ });
2169
+ Object.defineProperty(exports, "applyEscapeSequenceTimeout", {
2170
+ enumerable: true,
2171
+ get: function() {
2172
+ return applyEscapeSequenceTimeout;
2173
+ }
2174
+ });
2175
+ Object.defineProperty(exports, "armEscapeGrace", {
2176
+ enumerable: true,
2177
+ get: function() {
2178
+ return armEscapeGrace;
2179
+ }
2180
+ });
2181
+ Object.defineProperty(exports, "canPrompt", {
2182
+ enumerable: true,
2183
+ get: function() {
2184
+ return canPrompt;
2185
+ }
2186
+ });
2187
+ Object.defineProperty(exports, "createPrompt", {
2188
+ enumerable: true,
2189
+ get: function() {
2190
+ return createPrompt;
2191
+ }
2192
+ });
2193
+ Object.defineProperty(exports, "descriptionPanelLines", {
2194
+ enumerable: true,
2195
+ get: function() {
2196
+ return descriptionPanelLines;
2197
+ }
2198
+ });
2199
+ Object.defineProperty(exports, "editableOptionGroupOf", {
2200
+ enumerable: true,
2201
+ get: function() {
2202
+ return editableOptionGroupOf;
2203
+ }
2204
+ });
2205
+ Object.defineProperty(exports, "editableOptionGroups", {
2206
+ enumerable: true,
2207
+ get: function() {
2208
+ return editableOptionGroups;
2209
+ }
2210
+ });
2211
+ Object.defineProperty(exports, "editableOptionalOptions", {
2212
+ enumerable: true,
2213
+ get: function() {
2214
+ return editableOptionalOptions;
2215
+ }
2216
+ });
2217
+ Object.defineProperty(exports, "editableOptionsHint", {
2218
+ enumerable: true,
2219
+ get: function() {
2220
+ return editableOptionsHint;
2221
+ }
2222
+ });
2223
+ Object.defineProperty(exports, "escapableSelect", {
2224
+ enumerable: true,
2225
+ get: function() {
2226
+ return escapableSelect;
2227
+ }
2228
+ });
2229
+ Object.defineProperty(exports, "isDownKey", {
2230
+ enumerable: true,
2231
+ get: function() {
2232
+ return isDownKey;
2233
+ }
2234
+ });
2235
+ Object.defineProperty(exports, "isEnterKey", {
2236
+ enumerable: true,
2237
+ get: function() {
2238
+ return isEnterKey;
2239
+ }
2240
+ });
2241
+ Object.defineProperty(exports, "isSpaceKey", {
2242
+ enumerable: true,
2243
+ get: function() {
2244
+ return isSpaceKey;
2245
+ }
2246
+ });
2247
+ Object.defineProperty(exports, "isTabKey", {
2248
+ enumerable: true,
2249
+ get: function() {
2250
+ return isTabKey;
2251
+ }
2252
+ });
2253
+ Object.defineProperty(exports, "isUpKey", {
2254
+ enumerable: true,
2255
+ get: function() {
2256
+ return isUpKey;
2257
+ }
2258
+ });
2259
+ Object.defineProperty(exports, "makeTheme", {
2260
+ enumerable: true,
2261
+ get: function() {
2262
+ return makeTheme;
2263
+ }
2264
+ });
2265
+ Object.defineProperty(exports, "navigationMenuItems", {
2266
+ enumerable: true,
2267
+ get: function() {
2268
+ return navigationMenuItems;
2269
+ }
2270
+ });
2271
+ Object.defineProperty(exports, "notePromptRendered", {
2272
+ enumerable: true,
2273
+ get: function() {
2274
+ return notePromptRendered;
2275
+ }
2276
+ });
2277
+ Object.defineProperty(exports, "promptsRendered", {
2278
+ enumerable: true,
2279
+ get: function() {
2280
+ return promptsRendered;
2281
+ }
2282
+ });
2283
+ Object.defineProperty(exports, "renderFramedBox", {
2284
+ enumerable: true,
2285
+ get: function() {
2286
+ return renderFramedBox;
2287
+ }
2288
+ });
2289
+ Object.defineProperty(exports, "renderNavigationMenu", {
2290
+ enumerable: true,
2291
+ get: function() {
2292
+ return renderNavigationMenu;
2293
+ }
2294
+ });
2295
+ Object.defineProperty(exports, "setNeverPrompt", {
2296
+ enumerable: true,
2297
+ get: function() {
2298
+ return setNeverPrompt;
2299
+ }
2300
+ });
2301
+ Object.defineProperty(exports, "sortEditableOptions", {
2302
+ enumerable: true,
2303
+ get: function() {
2304
+ return sortEditableOptions;
2305
+ }
2306
+ });
2307
+ Object.defineProperty(exports, "stripAnsi", {
2308
+ enumerable: true,
2309
+ get: function() {
2310
+ return stripAnsi;
2311
+ }
2312
+ });
2313
+ Object.defineProperty(exports, "useEffect", {
2314
+ enumerable: true,
2315
+ get: function() {
2316
+ return useEffect;
2317
+ }
2318
+ });
2319
+ Object.defineProperty(exports, "useKeypress", {
2320
+ enumerable: true,
2321
+ get: function() {
2322
+ return useKeypress;
2323
+ }
2324
+ });
2325
+ Object.defineProperty(exports, "useMemo", {
2326
+ enumerable: true,
2327
+ get: function() {
2328
+ return useMemo;
2329
+ }
2330
+ });
2331
+ Object.defineProperty(exports, "usePagination", {
2332
+ enumerable: true,
2333
+ get: function() {
2334
+ return usePagination;
2335
+ }
2336
+ });
2337
+ Object.defineProperty(exports, "usePrefix", {
2338
+ enumerable: true,
2339
+ get: function() {
2340
+ return usePrefix;
2341
+ }
2342
+ });
2343
+ Object.defineProperty(exports, "useRef", {
2344
+ enumerable: true,
2345
+ get: function() {
2346
+ return useRef;
2347
+ }
2348
+ });
2349
+ Object.defineProperty(exports, "useState", {
2350
+ enumerable: true,
2351
+ get: function() {
2352
+ return useState;
2353
+ }
2354
+ });
2355
+
2356
+ //# sourceMappingURL=EscapableSelectPrompt-BljVxNDm.cjs.map