@baton-dx/cli 0.6.1 → 0.7.1

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.
@@ -1,14 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from "node:module";
3
- import { access } from "node:fs/promises";
4
- import { dirname, join, sep } from "node:path";
5
- import { formatWithOptions, stripVTControlCharacters } from "node:util";
6
- import N, { stdin, stdout } from "node:process";
7
- import * as tty from "node:tty";
8
- import { ReadStream } from "node:tty";
9
- import * as k from "node:readline";
10
- import f from "node:readline";
11
- import { existsSync, lstatSync, readdirSync } from "node:fs";
12
3
 
13
4
  //#region \0rolldown/runtime.js
14
5
  var __create = Object.create;
@@ -38,1286 +29,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
38
29
  }) : target, mod));
39
30
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
40
31
 
41
- //#endregion
42
- //#region ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/core.mjs
43
- const LogLevels = {
44
- silent: Number.NEGATIVE_INFINITY,
45
- fatal: 0,
46
- error: 0,
47
- warn: 1,
48
- log: 2,
49
- info: 3,
50
- success: 3,
51
- fail: 3,
52
- ready: 3,
53
- start: 3,
54
- box: 3,
55
- debug: 4,
56
- trace: 5,
57
- verbose: Number.POSITIVE_INFINITY
58
- };
59
- const LogTypes = {
60
- silent: { level: -1 },
61
- fatal: { level: LogLevels.fatal },
62
- error: { level: LogLevels.error },
63
- warn: { level: LogLevels.warn },
64
- log: { level: LogLevels.log },
65
- info: { level: LogLevels.info },
66
- success: { level: LogLevels.success },
67
- fail: { level: LogLevels.fail },
68
- ready: { level: LogLevels.info },
69
- start: { level: LogLevels.info },
70
- box: { level: LogLevels.info },
71
- debug: { level: LogLevels.debug },
72
- trace: { level: LogLevels.trace },
73
- verbose: { level: LogLevels.verbose }
74
- };
75
- function isPlainObject$1(value) {
76
- if (value === null || typeof value !== "object") return false;
77
- const prototype = Object.getPrototypeOf(value);
78
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
79
- if (Symbol.iterator in value) return false;
80
- if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
81
- return true;
82
- }
83
- function _defu(baseObject, defaults, namespace = ".", merger) {
84
- if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
85
- const object = Object.assign({}, defaults);
86
- for (const key in baseObject) {
87
- if (key === "__proto__" || key === "constructor") continue;
88
- const value = baseObject[key];
89
- if (value === null || value === void 0) continue;
90
- if (merger && merger(object, key, value, namespace)) continue;
91
- if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
92
- else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
93
- else object[key] = value;
94
- }
95
- return object;
96
- }
97
- function createDefu(merger) {
98
- return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
99
- }
100
- const defu = createDefu();
101
- function isPlainObject(obj) {
102
- return Object.prototype.toString.call(obj) === "[object Object]";
103
- }
104
- function isLogObj(arg) {
105
- if (!isPlainObject(arg)) return false;
106
- if (!arg.message && !arg.args) return false;
107
- if (arg.stack) return false;
108
- return true;
109
- }
110
- let paused = false;
111
- const queue = [];
112
- var Consola = class Consola {
113
- options;
114
- _lastLog;
115
- _mockFn;
116
- /**
117
- * Creates an instance of Consola with specified options or defaults.
118
- *
119
- * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
120
- */
121
- constructor(options = {}) {
122
- const types = options.types || LogTypes;
123
- this.options = defu({
124
- ...options,
125
- defaults: { ...options.defaults },
126
- level: _normalizeLogLevel(options.level, types),
127
- reporters: [...options.reporters || []]
128
- }, {
129
- types: LogTypes,
130
- throttle: 1e3,
131
- throttleMin: 5,
132
- formatOptions: {
133
- date: true,
134
- colors: false,
135
- compact: true
136
- }
137
- });
138
- for (const type in types) {
139
- const defaults = {
140
- type,
141
- ...this.options.defaults,
142
- ...types[type]
143
- };
144
- this[type] = this._wrapLogFn(defaults);
145
- this[type].raw = this._wrapLogFn(defaults, true);
146
- }
147
- if (this.options.mockFn) this.mockTypes();
148
- this._lastLog = {};
149
- }
150
- /**
151
- * Gets the current log level of the Consola instance.
152
- *
153
- * @returns {number} The current log level.
154
- */
155
- get level() {
156
- return this.options.level;
157
- }
158
- /**
159
- * Sets the minimum log level that will be output by the instance.
160
- *
161
- * @param {number} level - The new log level to set.
162
- */
163
- set level(level) {
164
- this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
165
- }
166
- /**
167
- * Displays a prompt to the user and returns the response.
168
- * Throw an error if `prompt` is not supported by the current configuration.
169
- *
170
- * @template T
171
- * @param {string} message - The message to display in the prompt.
172
- * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
173
- * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
174
- */
175
- prompt(message, opts) {
176
- if (!this.options.prompt) throw new Error("prompt is not supported!");
177
- return this.options.prompt(message, opts);
178
- }
179
- /**
180
- * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
181
- *
182
- * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
183
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
184
- */
185
- create(options) {
186
- const instance = new Consola({
187
- ...this.options,
188
- ...options
189
- });
190
- if (this._mockFn) instance.mockTypes(this._mockFn);
191
- return instance;
192
- }
193
- /**
194
- * Creates a new Consola instance with the specified default log object properties.
195
- *
196
- * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
197
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
198
- */
199
- withDefaults(defaults) {
200
- return this.create({
201
- ...this.options,
202
- defaults: {
203
- ...this.options.defaults,
204
- ...defaults
205
- }
206
- });
207
- }
208
- /**
209
- * Creates a new Consola instance with a specified tag, which will be included in every log.
210
- *
211
- * @param {string} tag - The tag to include in each log of the new instance.
212
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
213
- */
214
- withTag(tag) {
215
- return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
216
- }
217
- /**
218
- * Adds a custom reporter to the Consola instance.
219
- * Reporters will be called for each log message, depending on their implementation and log level.
220
- *
221
- * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
222
- * @returns {Consola} The current Consola instance.
223
- */
224
- addReporter(reporter) {
225
- this.options.reporters.push(reporter);
226
- return this;
227
- }
228
- /**
229
- * Removes a custom reporter from the Consola instance.
230
- * If no reporter is specified, all reporters will be removed.
231
- *
232
- * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
233
- * @returns {Consola} The current Consola instance.
234
- */
235
- removeReporter(reporter) {
236
- if (reporter) {
237
- const i = this.options.reporters.indexOf(reporter);
238
- if (i !== -1) return this.options.reporters.splice(i, 1);
239
- } else this.options.reporters.splice(0);
240
- return this;
241
- }
242
- /**
243
- * Replaces all reporters of the Consola instance with the specified array of reporters.
244
- *
245
- * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
246
- * @returns {Consola} The current Consola instance.
247
- */
248
- setReporters(reporters) {
249
- this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
250
- return this;
251
- }
252
- wrapAll() {
253
- this.wrapConsole();
254
- this.wrapStd();
255
- }
256
- restoreAll() {
257
- this.restoreConsole();
258
- this.restoreStd();
259
- }
260
- /**
261
- * Overrides console methods with Consola logging methods for consistent logging.
262
- */
263
- wrapConsole() {
264
- for (const type in this.options.types) {
265
- if (!console["__" + type]) console["__" + type] = console[type];
266
- console[type] = this[type].raw;
267
- }
268
- }
269
- /**
270
- * Restores the original console methods, removing Consola overrides.
271
- */
272
- restoreConsole() {
273
- for (const type in this.options.types) if (console["__" + type]) {
274
- console[type] = console["__" + type];
275
- delete console["__" + type];
276
- }
277
- }
278
- /**
279
- * Overrides standard output and error streams to redirect them through Consola.
280
- */
281
- wrapStd() {
282
- this._wrapStream(this.options.stdout, "log");
283
- this._wrapStream(this.options.stderr, "log");
284
- }
285
- _wrapStream(stream, type) {
286
- if (!stream) return;
287
- if (!stream.__write) stream.__write = stream.write;
288
- stream.write = (data) => {
289
- this[type].raw(String(data).trim());
290
- };
291
- }
292
- /**
293
- * Restores the original standard output and error streams, removing the Consola redirection.
294
- */
295
- restoreStd() {
296
- this._restoreStream(this.options.stdout);
297
- this._restoreStream(this.options.stderr);
298
- }
299
- _restoreStream(stream) {
300
- if (!stream) return;
301
- if (stream.__write) {
302
- stream.write = stream.__write;
303
- delete stream.__write;
304
- }
305
- }
306
- /**
307
- * Pauses logging, queues incoming logs until resumed.
308
- */
309
- pauseLogs() {
310
- paused = true;
311
- }
312
- /**
313
- * Resumes logging, processing any queued logs.
314
- */
315
- resumeLogs() {
316
- paused = false;
317
- const _queue = queue.splice(0);
318
- for (const item of _queue) item[0]._logFn(item[1], item[2]);
319
- }
320
- /**
321
- * Replaces logging methods with mocks if a mock function is provided.
322
- *
323
- * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
324
- */
325
- mockTypes(mockFn) {
326
- const _mockFn = mockFn || this.options.mockFn;
327
- this._mockFn = _mockFn;
328
- if (typeof _mockFn !== "function") return;
329
- for (const type in this.options.types) {
330
- this[type] = _mockFn(type, this.options.types[type]) || this[type];
331
- this[type].raw = this[type];
332
- }
333
- }
334
- _wrapLogFn(defaults, isRaw) {
335
- return (...args) => {
336
- if (paused) {
337
- queue.push([
338
- this,
339
- defaults,
340
- args,
341
- isRaw
342
- ]);
343
- return;
344
- }
345
- return this._logFn(defaults, args, isRaw);
346
- };
347
- }
348
- _logFn(defaults, args, isRaw) {
349
- if ((defaults.level || 0) > this.level) return false;
350
- const logObj = {
351
- date: /* @__PURE__ */ new Date(),
352
- args: [],
353
- ...defaults,
354
- level: _normalizeLogLevel(defaults.level, this.options.types)
355
- };
356
- if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
357
- else logObj.args = [...args];
358
- if (logObj.message) {
359
- logObj.args.unshift(logObj.message);
360
- delete logObj.message;
361
- }
362
- if (logObj.additional) {
363
- if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
364
- logObj.args.push("\n" + logObj.additional.join("\n"));
365
- delete logObj.additional;
366
- }
367
- logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
368
- logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
369
- const resolveLog = (newLog = false) => {
370
- const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
371
- if (this._lastLog.object && repeated > 0) {
372
- const args2 = [...this._lastLog.object.args];
373
- if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
374
- this._log({
375
- ...this._lastLog.object,
376
- args: args2
377
- });
378
- this._lastLog.count = 1;
379
- }
380
- if (newLog) {
381
- this._lastLog.object = logObj;
382
- this._log(logObj);
383
- }
384
- };
385
- clearTimeout(this._lastLog.timeout);
386
- const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
387
- this._lastLog.time = logObj.date;
388
- if (diffTime < this.options.throttle) try {
389
- const serializedLog = JSON.stringify([
390
- logObj.type,
391
- logObj.tag,
392
- logObj.args
393
- ]);
394
- const isSameLog = this._lastLog.serialized === serializedLog;
395
- this._lastLog.serialized = serializedLog;
396
- if (isSameLog) {
397
- this._lastLog.count = (this._lastLog.count || 0) + 1;
398
- if (this._lastLog.count > this.options.throttleMin) {
399
- this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
400
- return;
401
- }
402
- }
403
- } catch {}
404
- resolveLog(true);
405
- }
406
- _log(logObj) {
407
- for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
408
- }
409
- };
410
- function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
411
- if (input === void 0) return defaultLevel;
412
- if (typeof input === "number") return input;
413
- if (types[input] && types[input].level !== void 0) return types[input].level;
414
- return defaultLevel;
415
- }
416
- Consola.prototype.add = Consola.prototype.addReporter;
417
- Consola.prototype.remove = Consola.prototype.removeReporter;
418
- Consola.prototype.clear = Consola.prototype.removeReporter;
419
- Consola.prototype.withScope = Consola.prototype.withTag;
420
- Consola.prototype.mock = Consola.prototype.mockTypes;
421
- Consola.prototype.pause = Consola.prototype.pauseLogs;
422
- Consola.prototype.resume = Consola.prototype.resumeLogs;
423
- function createConsola$1(options = {}) {
424
- return new Consola(options);
425
- }
426
-
427
- //#endregion
428
- //#region ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
429
- function parseStack(stack, message) {
430
- const cwd = process.cwd() + sep;
431
- return stack.split("\n").splice(message.split("\n").length).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
432
- }
433
- function writeStream(data, stream) {
434
- return (stream.__write || stream.write).call(stream, data);
435
- }
436
- const bracket = (x) => x ? `[${x}]` : "";
437
- var BasicReporter = class {
438
- formatStack(stack, message, opts) {
439
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
440
- return indent + parseStack(stack, message).join(`
441
- ${indent}`);
442
- }
443
- formatError(err, opts) {
444
- const message = err.message ?? formatWithOptions(opts, err);
445
- const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
446
- const level = opts?.errorLevel || 0;
447
- const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
448
- const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
449
- ...opts,
450
- errorLevel: level + 1
451
- }) : "";
452
- return causedPrefix + message + "\n" + stack + causedError;
453
- }
454
- formatArgs(args, opts) {
455
- return formatWithOptions(opts, ...args.map((arg) => {
456
- if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
457
- return arg;
458
- }));
459
- }
460
- formatDate(date, opts) {
461
- return opts.date ? date.toLocaleTimeString() : "";
462
- }
463
- filterAndJoin(arr) {
464
- return arr.filter(Boolean).join(" ");
465
- }
466
- formatLogObj(logObj, opts) {
467
- const message = this.formatArgs(logObj.args, opts);
468
- if (logObj.type === "box") return "\n" + [
469
- bracket(logObj.tag),
470
- logObj.title && logObj.title,
471
- ...message.split("\n")
472
- ].filter(Boolean).map((l) => " > " + l).join("\n") + "\n";
473
- return this.filterAndJoin([
474
- bracket(logObj.type),
475
- bracket(logObj.tag),
476
- message
477
- ]);
478
- }
479
- log(logObj, ctx) {
480
- return writeStream(this.formatLogObj(logObj, {
481
- columns: ctx.options.stdout.columns || 0,
482
- ...ctx.options.formatOptions
483
- }) + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
484
- }
485
- };
486
-
487
- //#endregion
488
- //#region ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
489
- const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
490
- const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
491
- const isForced = "FORCE_COLOR" in env || argv.includes("--color");
492
- const isWindows = platform === "win32";
493
- const isDumbTerminal = env.TERM === "dumb";
494
- const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
495
- const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
496
- const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
497
- function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
498
- return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
499
- }
500
- function clearBleed(index, string, open, close, replace) {
501
- return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
502
- }
503
- function filterEmpty(open, close, replace = open, at = open.length + 1) {
504
- return (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
505
- }
506
- function init(open, close, replace) {
507
- return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
508
- }
509
- const colorDefs = {
510
- reset: init(0, 0),
511
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
512
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
513
- italic: init(3, 23),
514
- underline: init(4, 24),
515
- inverse: init(7, 27),
516
- hidden: init(8, 28),
517
- strikethrough: init(9, 29),
518
- black: init(30, 39),
519
- red: init(31, 39),
520
- green: init(32, 39),
521
- yellow: init(33, 39),
522
- blue: init(34, 39),
523
- magenta: init(35, 39),
524
- cyan: init(36, 39),
525
- white: init(37, 39),
526
- gray: init(90, 39),
527
- bgBlack: init(40, 49),
528
- bgRed: init(41, 49),
529
- bgGreen: init(42, 49),
530
- bgYellow: init(43, 49),
531
- bgBlue: init(44, 49),
532
- bgMagenta: init(45, 49),
533
- bgCyan: init(46, 49),
534
- bgWhite: init(47, 49),
535
- blackBright: init(90, 39),
536
- redBright: init(91, 39),
537
- greenBright: init(92, 39),
538
- yellowBright: init(93, 39),
539
- blueBright: init(94, 39),
540
- magentaBright: init(95, 39),
541
- cyanBright: init(96, 39),
542
- whiteBright: init(97, 39),
543
- bgBlackBright: init(100, 49),
544
- bgRedBright: init(101, 49),
545
- bgGreenBright: init(102, 49),
546
- bgYellowBright: init(103, 49),
547
- bgBlueBright: init(104, 49),
548
- bgMagentaBright: init(105, 49),
549
- bgCyanBright: init(106, 49),
550
- bgWhiteBright: init(107, 49)
551
- };
552
- function createColors(useColor = isColorSupported) {
553
- return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
554
- }
555
- const colors = createColors();
556
- function getColor$1(color, fallback = "reset") {
557
- return colors[color] || colors[fallback];
558
- }
559
- const ansiRegex$1 = [String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`, String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");
560
- function stripAnsi$1(text) {
561
- return text.replace(new RegExp(ansiRegex$1, "g"), "");
562
- }
563
- const boxStylePresets = {
564
- solid: {
565
- tl: "┌",
566
- tr: "┐",
567
- bl: "└",
568
- br: "┘",
569
- h: "─",
570
- v: "│"
571
- },
572
- double: {
573
- tl: "╔",
574
- tr: "╗",
575
- bl: "╚",
576
- br: "╝",
577
- h: "═",
578
- v: "║"
579
- },
580
- doubleSingle: {
581
- tl: "╓",
582
- tr: "╖",
583
- bl: "╙",
584
- br: "╜",
585
- h: "─",
586
- v: "║"
587
- },
588
- doubleSingleRounded: {
589
- tl: "╭",
590
- tr: "╮",
591
- bl: "╰",
592
- br: "╯",
593
- h: "─",
594
- v: "║"
595
- },
596
- singleThick: {
597
- tl: "┏",
598
- tr: "┓",
599
- bl: "┗",
600
- br: "┛",
601
- h: "━",
602
- v: "┃"
603
- },
604
- singleDouble: {
605
- tl: "╒",
606
- tr: "╕",
607
- bl: "╘",
608
- br: "╛",
609
- h: "═",
610
- v: "│"
611
- },
612
- singleDoubleRounded: {
613
- tl: "╭",
614
- tr: "╮",
615
- bl: "╰",
616
- br: "╯",
617
- h: "═",
618
- v: "│"
619
- },
620
- rounded: {
621
- tl: "╭",
622
- tr: "╮",
623
- bl: "╰",
624
- br: "╯",
625
- h: "─",
626
- v: "│"
627
- }
628
- };
629
- const defaultStyle = {
630
- borderColor: "white",
631
- borderStyle: "rounded",
632
- valign: "center",
633
- padding: 2,
634
- marginLeft: 1,
635
- marginTop: 1,
636
- marginBottom: 1
637
- };
638
- function box(text, _opts = {}) {
639
- const opts = {
640
- ..._opts,
641
- style: {
642
- ...defaultStyle,
643
- ..._opts.style
644
- }
645
- };
646
- const textLines = text.split("\n");
647
- const boxLines = [];
648
- const _color = getColor$1(opts.style.borderColor);
649
- const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
650
- if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
651
- const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
652
- const height = textLines.length + paddingOffset;
653
- const width = Math.max(...textLines.map((line) => stripAnsi$1(line).length), opts.title ? stripAnsi$1(opts.title).length : 0) + paddingOffset;
654
- const widthOffset = width + paddingOffset;
655
- const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
656
- if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
657
- if (opts.title) {
658
- const title = _color ? _color(opts.title) : opts.title;
659
- const left = borderStyle.h.repeat(Math.floor((width - stripAnsi$1(opts.title).length) / 2));
660
- const right = borderStyle.h.repeat(width - stripAnsi$1(opts.title).length - stripAnsi$1(left).length + paddingOffset);
661
- boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
662
- } else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
663
- const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
664
- for (let i = 0; i < height; i++) if (i < valignOffset || i >= valignOffset + textLines.length) boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
665
- else {
666
- const line = textLines[i - valignOffset];
667
- const left = " ".repeat(paddingOffset);
668
- const right = " ".repeat(width - stripAnsi$1(line).length);
669
- boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
670
- }
671
- boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
672
- if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
673
- return boxLines.join("\n");
674
- }
675
-
676
- //#endregion
677
- //#region ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/index.mjs
678
- const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis), o = new Proxy(r, {
679
- get(e, s) {
680
- return i()[s] ?? r[s];
681
- },
682
- has(e, s) {
683
- return s in i() || s in r;
684
- },
685
- set(e, s, E) {
686
- const B = i(true);
687
- return B[s] = E, true;
688
- },
689
- deleteProperty(e, s) {
690
- if (!s) return false;
691
- const E = i(true);
692
- return delete E[s], true;
693
- },
694
- ownKeys() {
695
- const e = i(true);
696
- return Object.keys(e);
697
- }
698
- }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f$1 = [
699
- ["APPVEYOR"],
700
- [
701
- "AWS_AMPLIFY",
702
- "AWS_APP_ID",
703
- { ci: true }
704
- ],
705
- ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
706
- ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
707
- ["APPCIRCLE", "AC_APPCIRCLE"],
708
- ["BAMBOO", "bamboo_planKey"],
709
- ["BITBUCKET", "BITBUCKET_COMMIT"],
710
- ["BITRISE", "BITRISE_IO"],
711
- ["BUDDY", "BUDDY_WORKSPACE_ID"],
712
- ["BUILDKITE"],
713
- ["CIRCLE", "CIRCLECI"],
714
- ["CIRRUS", "CIRRUS_CI"],
715
- [
716
- "CLOUDFLARE_PAGES",
717
- "CF_PAGES",
718
- { ci: true }
719
- ],
720
- ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
721
- ["CODEFRESH", "CF_BUILD_ID"],
722
- ["DRONE"],
723
- ["DRONE", "DRONE_BUILD_EVENT"],
724
- ["DSARI"],
725
- ["GITHUB_ACTIONS"],
726
- ["GITLAB", "GITLAB_CI"],
727
- ["GITLAB", "CI_MERGE_REQUEST_ID"],
728
- ["GOCD", "GO_PIPELINE_LABEL"],
729
- ["LAYERCI"],
730
- ["HUDSON", "HUDSON_URL"],
731
- ["JENKINS", "JENKINS_URL"],
732
- ["MAGNUM"],
733
- ["NETLIFY"],
734
- [
735
- "NETLIFY",
736
- "NETLIFY_LOCAL",
737
- { ci: false }
738
- ],
739
- ["NEVERCODE"],
740
- ["RENDER"],
741
- ["SAIL", "SAILCI"],
742
- ["SEMAPHORE"],
743
- ["SCREWDRIVER"],
744
- ["SHIPPABLE"],
745
- ["SOLANO", "TDDIUM"],
746
- ["STRIDER"],
747
- ["TEAMCITY", "TEAMCITY_VERSION"],
748
- ["TRAVIS"],
749
- ["VERCEL", "NOW_BUILDER"],
750
- [
751
- "VERCEL",
752
- "VERCEL",
753
- { ci: false }
754
- ],
755
- [
756
- "VERCEL",
757
- "VERCEL_ENV",
758
- { ci: false }
759
- ],
760
- ["APPCENTER", "APPCENTER_BUILD_ID"],
761
- [
762
- "CODESANDBOX",
763
- "CODESANDBOX_SSE",
764
- { ci: false }
765
- ],
766
- [
767
- "CODESANDBOX",
768
- "CODESANDBOX_HOST",
769
- { ci: false }
770
- ],
771
- ["STACKBLITZ"],
772
- ["STORMKIT"],
773
- ["CLEAVR"],
774
- ["ZEABUR"],
775
- [
776
- "CODESPHERE",
777
- "CODESPHERE_APP_ID",
778
- { ci: true }
779
- ],
780
- ["RAILWAY", "RAILWAY_PROJECT_ID"],
781
- ["RAILWAY", "RAILWAY_SERVICE_ID"],
782
- ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
783
- [
784
- "FIREBASE_APP_HOSTING",
785
- "FIREBASE_APP_HOSTING",
786
- { ci: true }
787
- ]
788
- ];
789
- function b() {
790
- if (globalThis.process?.env) for (const e of f$1) {
791
- const s = e[1] || e[0];
792
- if (globalThis.process?.env[s]) return {
793
- name: e[0].toLowerCase(),
794
- ...e[2]
795
- };
796
- }
797
- return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
798
- name: "stackblitz",
799
- ci: false
800
- } : {
801
- name: "",
802
- ci: false
803
- };
804
- }
805
- const l = b();
806
- l.name;
807
- function n(e) {
808
- return e ? e !== "false" : false;
809
- }
810
- const I$1 = globalThis.process?.platform || "", T$1 = n(o.CI) || l.ci !== false, a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), g = n(o.DEBUG), R$1 = t === "test" || n(o.TEST);
811
- n(o.MINIMAL);
812
- const A = /^win/i.test(I$1);
813
- !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
814
- const C$1 = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
815
- Number(C$1?.split(".")[0]);
816
- const y$1 = globalThis.process || Object.create(null), _$1 = { versions: {} };
817
- new Proxy(y$1, { get(e, s) {
818
- if (s === "env") return o;
819
- if (s in e) return e[s];
820
- if (s in _$1) return _$1[s];
821
- } });
822
- const c = globalThis.process?.release?.name === "node", O$1 = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D$1 = !!globalThis.Deno, L$1 = !!globalThis.fastly, S$1 = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N$2 = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
823
- [S$1, "netlify"],
824
- [u, "edge-light"],
825
- [N$2, "workerd"],
826
- [L$1, "fastly"],
827
- [D$1, "deno"],
828
- [O$1, "bun"],
829
- [c, "node"]
830
- ];
831
- function G$1() {
832
- const e = F.find((s) => s[0]);
833
- if (e) return { name: e[1] };
834
- }
835
- G$1()?.name;
836
- function ansiRegex({ onlyFirst = false } = {}) {
837
- const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
838
- return new RegExp(pattern, onlyFirst ? void 0 : "g");
839
- }
840
- const regex = ansiRegex();
841
- function stripAnsi(string) {
842
- if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
843
- return string.replace(regex, "");
844
- }
845
- function isAmbiguous(x) {
846
- return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
847
- }
848
- function isFullWidth(x) {
849
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
850
- }
851
- function isWide(x) {
852
- return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
853
- }
854
- function validate(codePoint) {
855
- if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
856
- }
857
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
858
- validate(codePoint);
859
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
860
- return 1;
861
- }
862
- const emojiRegex = () => {
863
- return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
864
- };
865
- const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
866
- const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
867
- function stringWidth$1(string, options = {}) {
868
- if (typeof string !== "string" || string.length === 0) return 0;
869
- const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
870
- if (!countAnsiEscapeCodes) string = stripAnsi(string);
871
- if (string.length === 0) return 0;
872
- let width = 0;
873
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
874
- for (const { segment: character } of segmenter.segment(string)) {
875
- const codePoint = character.codePointAt(0);
876
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
877
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
878
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
879
- if (codePoint >= 55296 && codePoint <= 57343) continue;
880
- if (codePoint >= 65024 && codePoint <= 65039) continue;
881
- if (defaultIgnorableCodePointRegex.test(character)) continue;
882
- if (emojiRegex().test(character)) {
883
- width += 2;
884
- continue;
885
- }
886
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
887
- }
888
- return width;
889
- }
890
- function isUnicodeSupported() {
891
- const { env } = N;
892
- const { TERM, TERM_PROGRAM } = env;
893
- if (N.platform !== "win32") return TERM !== "linux";
894
- return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
895
- }
896
- const TYPE_COLOR_MAP = {
897
- info: "cyan",
898
- fail: "red",
899
- success: "green",
900
- ready: "green",
901
- start: "magenta"
902
- };
903
- const LEVEL_COLOR_MAP = {
904
- 0: "red",
905
- 1: "yellow"
906
- };
907
- const unicode = isUnicodeSupported();
908
- const s = (c, fallback) => unicode ? c : fallback;
909
- const TYPE_ICONS = {
910
- error: s("✖", "×"),
911
- fatal: s("✖", "×"),
912
- ready: s("✔", "√"),
913
- warn: s("⚠", "‼"),
914
- info: s("ℹ", "i"),
915
- success: s("✔", "√"),
916
- debug: s("⚙", "D"),
917
- trace: s("→", "→"),
918
- fail: s("✖", "×"),
919
- start: s("◐", "o"),
920
- log: ""
921
- };
922
- function stringWidth(str) {
923
- if (!(typeof Intl === "object") || !Intl.Segmenter) return stripAnsi$1(str).length;
924
- return stringWidth$1(str);
925
- }
926
- var FancyReporter = class extends BasicReporter {
927
- formatStack(stack, message, opts) {
928
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
929
- return `
930
- ${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)).join(`
931
- ${indent}`);
932
- }
933
- formatType(logObj, isBadge, opts) {
934
- const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
935
- if (isBadge) return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
936
- const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
937
- return _type ? getColor(typeColor)(_type) : "";
938
- }
939
- formatLogObj(logObj, opts) {
940
- const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
941
- if (logObj.type === "box") return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
942
- title: logObj.title ? characterFormat(logObj.title) : void 0,
943
- style: logObj.style
944
- });
945
- const date = this.formatDate(logObj.date, opts);
946
- const coloredDate = date && colors.gray(date);
947
- const isBadge = logObj.badge ?? logObj.level < 2;
948
- const type = this.formatType(logObj, isBadge, opts);
949
- const tag = logObj.tag ? colors.gray(logObj.tag) : "";
950
- let line;
951
- const left = this.filterAndJoin([type, characterFormat(message)]);
952
- const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
953
- const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
954
- line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
955
- line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
956
- if (logObj.type === "trace") {
957
- const _err = /* @__PURE__ */ new Error("Trace: " + logObj.message);
958
- line += this.formatStack(_err.stack || "", _err.message);
959
- }
960
- return isBadge ? "\n" + line + "\n" : line;
961
- }
962
- };
963
- function characterFormat(str) {
964
- return str.replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_, m) => ` ${colors.underline(m)} `);
965
- }
966
- function getColor(color = "white") {
967
- return colors[color] || colors.white;
968
- }
969
- function getBgColor(color = "bgWhite") {
970
- return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
971
- }
972
- function createConsola(options = {}) {
973
- let level = _getDefaultLogLevel();
974
- if (process.env.CONSOLA_LEVEL) level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
975
- return createConsola$1({
976
- level,
977
- defaults: { level },
978
- stdout: process.stdout,
979
- stderr: process.stderr,
980
- prompt: (...args) => import("./prompt-JYaE4U2w.mjs").then((m) => m.prompt(...args)),
981
- reporters: options.reporters || [options.fancy ?? !(T$1 || R$1) ? new FancyReporter() : new BasicReporter()],
982
- ...options
983
- });
984
- }
985
- function _getDefaultLogLevel() {
986
- if (g) return LogLevels.debug;
987
- if (R$1) return LogLevels.warn;
988
- return LogLevels.info;
989
- }
990
- const consola = createConsola();
991
-
992
- //#endregion
993
- //#region ../../node_modules/.bun/citty@0.1.6/node_modules/citty/dist/index.mjs
994
- function toArray(val) {
995
- if (Array.isArray(val)) return val;
996
- return val === void 0 ? [] : [val];
997
- }
998
- function formatLineColumns(lines, linePrefix = "") {
999
- const maxLengh = [];
1000
- for (const line of lines) for (const [i, element] of line.entries()) maxLengh[i] = Math.max(maxLengh[i] || 0, element.length);
1001
- return lines.map((l) => l.map((c, i) => linePrefix + c[i === 0 ? "padStart" : "padEnd"](maxLengh[i])).join(" ")).join("\n");
1002
- }
1003
- function resolveValue(input) {
1004
- return typeof input === "function" ? input() : input;
1005
- }
1006
- var CLIError = class extends Error {
1007
- constructor(message, code) {
1008
- super(message);
1009
- this.code = code;
1010
- this.name = "CLIError";
1011
- }
1012
- };
1013
- const NUMBER_CHAR_RE = /\d/;
1014
- const STR_SPLITTERS = [
1015
- "-",
1016
- "_",
1017
- "/",
1018
- "."
1019
- ];
1020
- function isUppercase(char = "") {
1021
- if (NUMBER_CHAR_RE.test(char)) return;
1022
- return char !== char.toLowerCase();
1023
- }
1024
- function splitByCase(str, separators) {
1025
- const splitters = separators ?? STR_SPLITTERS;
1026
- const parts = [];
1027
- if (!str || typeof str !== "string") return parts;
1028
- let buff = "";
1029
- let previousUpper;
1030
- let previousSplitter;
1031
- for (const char of str) {
1032
- const isSplitter = splitters.includes(char);
1033
- if (isSplitter === true) {
1034
- parts.push(buff);
1035
- buff = "";
1036
- previousUpper = void 0;
1037
- continue;
1038
- }
1039
- const isUpper = isUppercase(char);
1040
- if (previousSplitter === false) {
1041
- if (previousUpper === false && isUpper === true) {
1042
- parts.push(buff);
1043
- buff = char;
1044
- previousUpper = isUpper;
1045
- continue;
1046
- }
1047
- if (previousUpper === true && isUpper === false && buff.length > 1) {
1048
- const lastChar = buff.at(-1);
1049
- parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
1050
- buff = lastChar + char;
1051
- previousUpper = isUpper;
1052
- continue;
1053
- }
1054
- }
1055
- buff += char;
1056
- previousUpper = isUpper;
1057
- previousSplitter = isSplitter;
1058
- }
1059
- parts.push(buff);
1060
- return parts;
1061
- }
1062
- function upperFirst(str) {
1063
- return str ? str[0].toUpperCase() + str.slice(1) : "";
1064
- }
1065
- function lowerFirst(str) {
1066
- return str ? str[0].toLowerCase() + str.slice(1) : "";
1067
- }
1068
- function pascalCase(str, opts) {
1069
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
1070
- }
1071
- function camelCase(str, opts) {
1072
- return lowerFirst(pascalCase(str || "", opts));
1073
- }
1074
- function kebabCase(str, joiner) {
1075
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
1076
- }
1077
- function toArr(any) {
1078
- return any == void 0 ? [] : Array.isArray(any) ? any : [any];
1079
- }
1080
- function toVal(out, key, val, opts) {
1081
- let x;
1082
- const old = out[key];
1083
- const nxt = ~opts.string.indexOf(key) ? val == void 0 || val === true ? "" : String(val) : typeof val === "boolean" ? val : ~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
1084
- out[key] = old == void 0 ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
1085
- }
1086
- function parseRawArgs(args = [], opts = {}) {
1087
- let k;
1088
- let arr;
1089
- let arg;
1090
- let name;
1091
- let val;
1092
- const out = { _: [] };
1093
- let i = 0;
1094
- let j = 0;
1095
- let idx = 0;
1096
- const len = args.length;
1097
- const alibi = opts.alias !== void 0;
1098
- const strict = opts.unknown !== void 0;
1099
- const defaults = opts.default !== void 0;
1100
- opts.alias = opts.alias || {};
1101
- opts.string = toArr(opts.string);
1102
- opts.boolean = toArr(opts.boolean);
1103
- if (alibi) for (k in opts.alias) {
1104
- arr = opts.alias[k] = toArr(opts.alias[k]);
1105
- for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
1106
- }
1107
- for (i = opts.boolean.length; i-- > 0;) {
1108
- arr = opts.alias[opts.boolean[i]] || [];
1109
- for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
1110
- }
1111
- for (i = opts.string.length; i-- > 0;) {
1112
- arr = opts.alias[opts.string[i]] || [];
1113
- for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
1114
- }
1115
- if (defaults) for (k in opts.default) {
1116
- name = typeof opts.default[k];
1117
- arr = opts.alias[k] = opts.alias[k] || [];
1118
- if (opts[name] !== void 0) {
1119
- opts[name].push(k);
1120
- for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
1121
- }
1122
- }
1123
- const keys = strict ? Object.keys(opts.alias) : [];
1124
- for (i = 0; i < len; i++) {
1125
- arg = args[i];
1126
- if (arg === "--") {
1127
- out._ = out._.concat(args.slice(++i));
1128
- break;
1129
- }
1130
- for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
1131
- if (j === 0) out._.push(arg);
1132
- else if (arg.substring(j, j + 3) === "no-") {
1133
- name = arg.slice(Math.max(0, j + 3));
1134
- if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
1135
- out[name] = false;
1136
- } else {
1137
- for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
1138
- name = arg.substring(j, idx);
1139
- val = arg.slice(Math.max(0, ++idx)) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
1140
- arr = j === 2 ? [name] : name;
1141
- for (idx = 0; idx < arr.length; idx++) {
1142
- name = arr[idx];
1143
- if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
1144
- toVal(out, name, idx + 1 < arr.length || val, opts);
1145
- }
1146
- }
1147
- }
1148
- if (defaults) {
1149
- for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
1150
- }
1151
- if (alibi) for (k in out) {
1152
- arr = opts.alias[k] || [];
1153
- while (arr.length > 0) out[arr.shift()] = out[k];
1154
- }
1155
- return out;
1156
- }
1157
- function parseArgs(rawArgs, argsDef) {
1158
- const parseOptions = {
1159
- boolean: [],
1160
- string: [],
1161
- mixed: [],
1162
- alias: {},
1163
- default: {}
1164
- };
1165
- const args = resolveArgs(argsDef);
1166
- for (const arg of args) {
1167
- if (arg.type === "positional") continue;
1168
- if (arg.type === "string") parseOptions.string.push(arg.name);
1169
- else if (arg.type === "boolean") parseOptions.boolean.push(arg.name);
1170
- if (arg.default !== void 0) parseOptions.default[arg.name] = arg.default;
1171
- if (arg.alias) parseOptions.alias[arg.name] = arg.alias;
1172
- }
1173
- const parsed = parseRawArgs(rawArgs, parseOptions);
1174
- const [ ...positionalArguments] = parsed._;
1175
- const parsedArgsProxy = new Proxy(parsed, { get(target, prop) {
1176
- return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
1177
- } });
1178
- for (const [, arg] of args.entries()) if (arg.type === "positional") {
1179
- const nextPositionalArgument = positionalArguments.shift();
1180
- if (nextPositionalArgument !== void 0) parsedArgsProxy[arg.name] = nextPositionalArgument;
1181
- else if (arg.default === void 0 && arg.required !== false) throw new CLIError(`Missing required positional argument: ${arg.name.toUpperCase()}`, "EARG");
1182
- else parsedArgsProxy[arg.name] = arg.default;
1183
- } else if (arg.required && parsedArgsProxy[arg.name] === void 0) throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
1184
- return parsedArgsProxy;
1185
- }
1186
- function resolveArgs(argsDef) {
1187
- const args = [];
1188
- for (const [name, argDef] of Object.entries(argsDef || {})) args.push({
1189
- ...argDef,
1190
- name,
1191
- alias: toArray(argDef.alias)
1192
- });
1193
- return args;
1194
- }
1195
- function defineCommand(def) {
1196
- return def;
1197
- }
1198
- async function runCommand(cmd, opts) {
1199
- const cmdArgs = await resolveValue(cmd.args || {});
1200
- const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
1201
- const context = {
1202
- rawArgs: opts.rawArgs,
1203
- args: parsedArgs,
1204
- data: opts.data,
1205
- cmd
1206
- };
1207
- if (typeof cmd.setup === "function") await cmd.setup(context);
1208
- let result;
1209
- try {
1210
- const subCommands = await resolveValue(cmd.subCommands);
1211
- if (subCommands && Object.keys(subCommands).length > 0) {
1212
- const subCommandArgIndex = opts.rawArgs.findIndex((arg) => !arg.startsWith("-"));
1213
- const subCommandName = opts.rawArgs[subCommandArgIndex];
1214
- if (subCommandName) {
1215
- if (!subCommands[subCommandName]) throw new CLIError(`Unknown command \`${subCommandName}\``, "E_UNKNOWN_COMMAND");
1216
- const subCommand = await resolveValue(subCommands[subCommandName]);
1217
- if (subCommand) await runCommand(subCommand, { rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1) });
1218
- } else if (!cmd.run) throw new CLIError(`No command specified.`, "E_NO_COMMAND");
1219
- }
1220
- if (typeof cmd.run === "function") result = await cmd.run(context);
1221
- } finally {
1222
- if (typeof cmd.cleanup === "function") await cmd.cleanup(context);
1223
- }
1224
- return { result };
1225
- }
1226
- async function resolveSubCommand(cmd, rawArgs, parent) {
1227
- const subCommands = await resolveValue(cmd.subCommands);
1228
- if (subCommands && Object.keys(subCommands).length > 0) {
1229
- const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
1230
- const subCommandName = rawArgs[subCommandArgIndex];
1231
- const subCommand = await resolveValue(subCommands[subCommandName]);
1232
- if (subCommand) return resolveSubCommand(subCommand, rawArgs.slice(subCommandArgIndex + 1), cmd);
1233
- }
1234
- return [cmd, parent];
1235
- }
1236
- async function showUsage(cmd, parent) {
1237
- try {
1238
- consola.log(await renderUsage(cmd, parent) + "\n");
1239
- } catch (error) {
1240
- consola.error(error);
1241
- }
1242
- }
1243
- async function renderUsage(cmd, parent) {
1244
- const cmdMeta = await resolveValue(cmd.meta || {});
1245
- const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
1246
- const parentMeta = await resolveValue(parent?.meta || {});
1247
- const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
1248
- const argLines = [];
1249
- const posLines = [];
1250
- const commandsLines = [];
1251
- const usageLine = [];
1252
- for (const arg of cmdArgs) if (arg.type === "positional") {
1253
- const name = arg.name.toUpperCase();
1254
- const isRequired = arg.required !== false && arg.default === void 0;
1255
- const defaultHint = arg.default ? `="${arg.default}"` : "";
1256
- posLines.push([
1257
- "`" + name + defaultHint + "`",
1258
- arg.description || "",
1259
- arg.valueHint ? `<${arg.valueHint}>` : ""
1260
- ]);
1261
- usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
1262
- } else {
1263
- const isRequired = arg.required === true && arg.default === void 0;
1264
- const argStr = (arg.type === "boolean" && arg.default === true ? [...(arg.alias || []).map((a) => `--no-${a}`), `--no-${arg.name}`].join(", ") : [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(", ")) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
1265
- argLines.push(["`" + argStr + (isRequired ? " (required)" : "") + "`", arg.description || ""]);
1266
- if (isRequired) usageLine.push(argStr);
1267
- }
1268
- if (cmd.subCommands) {
1269
- const commandNames = [];
1270
- const subCommands = await resolveValue(cmd.subCommands);
1271
- for (const [name, sub] of Object.entries(subCommands)) {
1272
- const meta = await resolveValue((await resolveValue(sub))?.meta);
1273
- commandsLines.push([`\`${name}\``, meta?.description || ""]);
1274
- commandNames.push(name);
1275
- }
1276
- usageLine.push(commandNames.join("|"));
1277
- }
1278
- const usageLines = [];
1279
- const version = cmdMeta.version || parentMeta.version;
1280
- usageLines.push(colors.gray(`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`), "");
1281
- const hasOptions = argLines.length > 0 || posLines.length > 0;
1282
- usageLines.push(`${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``, "");
1283
- if (posLines.length > 0) {
1284
- usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
1285
- usageLines.push(formatLineColumns(posLines, " "));
1286
- usageLines.push("");
1287
- }
1288
- if (argLines.length > 0) {
1289
- usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
1290
- usageLines.push(formatLineColumns(argLines, " "));
1291
- usageLines.push("");
1292
- }
1293
- if (commandsLines.length > 0) {
1294
- usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
1295
- usageLines.push(formatLineColumns(commandsLines, " "));
1296
- usageLines.push("", `Use \`${commandName} <command> --help\` for more information about a command.`);
1297
- }
1298
- return usageLines.filter((l) => typeof l === "string").join("\n");
1299
- }
1300
- async function runMain(cmd, opts = {}) {
1301
- const rawArgs = opts.rawArgs || process.argv.slice(2);
1302
- const showUsage$1 = opts.showUsage || showUsage;
1303
- try {
1304
- if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
1305
- await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
1306
- process.exit(0);
1307
- } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
1308
- const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
1309
- if (!meta?.version) throw new CLIError("No version specified", "E_NO_VERSION");
1310
- consola.log(meta.version);
1311
- } else await runCommand(cmd, { rawArgs });
1312
- } catch (error) {
1313
- const isCLIError = error instanceof CLIError;
1314
- if (!isCLIError) consola.error(error, "\n");
1315
- if (isCLIError) await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
1316
- consola.error(error.message);
1317
- process.exit(1);
1318
- }
1319
- }
1320
-
1321
32
  //#endregion
1322
33
  //#region ../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js
1323
34
  var require_identity = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -7969,1902 +6680,5 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
7969
6680
  }));
7970
6681
 
7971
6682
  //#endregion
7972
- //#region ../../node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
7973
- var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7974
- let p = process || {}, argv = p.argv || [], env = p.env || {};
7975
- let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
7976
- let formatter = (open, close, replace = open) => (input) => {
7977
- let string = "" + input, index = string.indexOf(close, open.length);
7978
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
7979
- };
7980
- let replaceClose = (string, close, replace, index) => {
7981
- let result = "", cursor = 0;
7982
- do {
7983
- result += string.substring(cursor, index) + replace;
7984
- cursor = index + close.length;
7985
- index = string.indexOf(close, cursor);
7986
- } while (~index);
7987
- return result + string.substring(cursor);
7988
- };
7989
- let createColors = (enabled = isColorSupported) => {
7990
- let f = enabled ? formatter : () => String;
7991
- return {
7992
- isColorSupported: enabled,
7993
- reset: f("\x1B[0m", "\x1B[0m"),
7994
- bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
7995
- dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
7996
- italic: f("\x1B[3m", "\x1B[23m"),
7997
- underline: f("\x1B[4m", "\x1B[24m"),
7998
- inverse: f("\x1B[7m", "\x1B[27m"),
7999
- hidden: f("\x1B[8m", "\x1B[28m"),
8000
- strikethrough: f("\x1B[9m", "\x1B[29m"),
8001
- black: f("\x1B[30m", "\x1B[39m"),
8002
- red: f("\x1B[31m", "\x1B[39m"),
8003
- green: f("\x1B[32m", "\x1B[39m"),
8004
- yellow: f("\x1B[33m", "\x1B[39m"),
8005
- blue: f("\x1B[34m", "\x1B[39m"),
8006
- magenta: f("\x1B[35m", "\x1B[39m"),
8007
- cyan: f("\x1B[36m", "\x1B[39m"),
8008
- white: f("\x1B[37m", "\x1B[39m"),
8009
- gray: f("\x1B[90m", "\x1B[39m"),
8010
- bgBlack: f("\x1B[40m", "\x1B[49m"),
8011
- bgRed: f("\x1B[41m", "\x1B[49m"),
8012
- bgGreen: f("\x1B[42m", "\x1B[49m"),
8013
- bgYellow: f("\x1B[43m", "\x1B[49m"),
8014
- bgBlue: f("\x1B[44m", "\x1B[49m"),
8015
- bgMagenta: f("\x1B[45m", "\x1B[49m"),
8016
- bgCyan: f("\x1B[46m", "\x1B[49m"),
8017
- bgWhite: f("\x1B[47m", "\x1B[49m"),
8018
- blackBright: f("\x1B[90m", "\x1B[39m"),
8019
- redBright: f("\x1B[91m", "\x1B[39m"),
8020
- greenBright: f("\x1B[92m", "\x1B[39m"),
8021
- yellowBright: f("\x1B[93m", "\x1B[39m"),
8022
- blueBright: f("\x1B[94m", "\x1B[39m"),
8023
- magentaBright: f("\x1B[95m", "\x1B[39m"),
8024
- cyanBright: f("\x1B[96m", "\x1B[39m"),
8025
- whiteBright: f("\x1B[97m", "\x1B[39m"),
8026
- bgBlackBright: f("\x1B[100m", "\x1B[49m"),
8027
- bgRedBright: f("\x1B[101m", "\x1B[49m"),
8028
- bgGreenBright: f("\x1B[102m", "\x1B[49m"),
8029
- bgYellowBright: f("\x1B[103m", "\x1B[49m"),
8030
- bgBlueBright: f("\x1B[104m", "\x1B[49m"),
8031
- bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
8032
- bgCyanBright: f("\x1B[106m", "\x1B[49m"),
8033
- bgWhiteBright: f("\x1B[107m", "\x1B[49m")
8034
- };
8035
- };
8036
- module.exports = createColors();
8037
- module.exports.createColors = createColors;
8038
- }));
8039
-
8040
- //#endregion
8041
- //#region ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
8042
- var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
8043
- const ESC = "\x1B";
8044
- const CSI = `${ESC}[`;
8045
- const beep = "\x07";
8046
- const cursor = {
8047
- to(x, y) {
8048
- if (!y) return `${CSI}${x + 1}G`;
8049
- return `${CSI}${y + 1};${x + 1}H`;
8050
- },
8051
- move(x, y) {
8052
- let ret = "";
8053
- if (x < 0) ret += `${CSI}${-x}D`;
8054
- else if (x > 0) ret += `${CSI}${x}C`;
8055
- if (y < 0) ret += `${CSI}${-y}A`;
8056
- else if (y > 0) ret += `${CSI}${y}B`;
8057
- return ret;
8058
- },
8059
- up: (count = 1) => `${CSI}${count}A`,
8060
- down: (count = 1) => `${CSI}${count}B`,
8061
- forward: (count = 1) => `${CSI}${count}C`,
8062
- backward: (count = 1) => `${CSI}${count}D`,
8063
- nextLine: (count = 1) => `${CSI}E`.repeat(count),
8064
- prevLine: (count = 1) => `${CSI}F`.repeat(count),
8065
- left: `${CSI}G`,
8066
- hide: `${CSI}?25l`,
8067
- show: `${CSI}?25h`,
8068
- save: `${ESC}7`,
8069
- restore: `${ESC}8`
8070
- };
8071
- const scroll = {
8072
- up: (count = 1) => `${CSI}S`.repeat(count),
8073
- down: (count = 1) => `${CSI}T`.repeat(count)
8074
- };
8075
- const erase = {
8076
- screen: `${CSI}2J`,
8077
- up: (count = 1) => `${CSI}1J`.repeat(count),
8078
- down: (count = 1) => `${CSI}J`.repeat(count),
8079
- line: `${CSI}2K`,
8080
- lineEnd: `${CSI}K`,
8081
- lineStart: `${CSI}1K`,
8082
- lines(count) {
8083
- let clear = "";
8084
- for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
8085
- if (count) clear += cursor.left;
8086
- return clear;
8087
- }
8088
- };
8089
- module.exports = {
8090
- cursor,
8091
- scroll,
8092
- erase,
8093
- beep
8094
- };
8095
- }));
8096
-
8097
- //#endregion
8098
- //#region ../../node_modules/.bun/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs
8099
- var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
8100
- var import_src = require_src();
8101
- function B(t, e, s) {
8102
- if (!s.some((u) => !u.disabled)) return t;
8103
- const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
8104
- return s[n].disabled ? B(n, e < 0 ? -1 : 1, s) : n;
8105
- }
8106
- const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt$1 = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht$1 = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L = /\t{1,1000}/y, P = /[\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, M$1 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct$1 = /\p{M}+/gu, ft$1 = {
8107
- limit: Infinity,
8108
- ellipsis: ""
8109
- }, X$1 = (t, e = {}, s = {}) => {
8110
- const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X$1(r, ft$1, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
8111
- let h = 0, o = 0, p = t.length, v = 0, F = !1, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
8112
- t: for (;;) {
8113
- if (w > C || o >= p && o > h) {
8114
- const ut = t.slice(C, w) || t.slice(h, o);
8115
- v = 0;
8116
- for (const Y of ut.replaceAll(ct$1, "")) {
8117
- const $ = Y.codePointAt(0) || 0;
8118
- if (lt$1($) ? f = m : ht$1($) ? f = V : E !== A && at$1($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
8119
- F = !0;
8120
- break t;
8121
- }
8122
- v += Y.length, c += f;
8123
- }
8124
- C = w = 0;
8125
- }
8126
- if (o >= p) break;
8127
- if (M$1.lastIndex = o, M$1.test(t)) {
8128
- if (v = M$1.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
8129
- F = !0;
8130
- break;
8131
- }
8132
- c += f, C = h, w = o, o = h = M$1.lastIndex;
8133
- continue;
8134
- }
8135
- if (O.lastIndex = o, O.test(t)) {
8136
- if (c + u > b && (d = Math.min(d, o)), c + u > i) {
8137
- F = !0;
8138
- break;
8139
- }
8140
- c += u, C = h, w = o, o = h = O.lastIndex;
8141
- continue;
8142
- }
8143
- if (y.lastIndex = o, y.test(t)) {
8144
- if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
8145
- F = !0;
8146
- break;
8147
- }
8148
- c += f, C = h, w = o, o = h = y.lastIndex;
8149
- continue;
8150
- }
8151
- if (L.lastIndex = o, L.test(t)) {
8152
- if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
8153
- F = !0;
8154
- break;
8155
- }
8156
- c += f, C = h, w = o, o = h = L.lastIndex;
8157
- continue;
8158
- }
8159
- if (P.lastIndex = o, P.test(t)) {
8160
- if (c + g > b && (d = Math.min(d, o)), c + g > i) {
8161
- F = !0;
8162
- break;
8163
- }
8164
- c += g, C = h, w = o, o = h = P.lastIndex;
8165
- continue;
8166
- }
8167
- o += 1;
8168
- }
8169
- return {
8170
- width: F ? b : c,
8171
- index: F ? d : p,
8172
- truncated: F,
8173
- ellipsed: F && i >= n
8174
- };
8175
- }, pt$1 = {
8176
- limit: Infinity,
8177
- ellipsis: "",
8178
- ellipsisWidth: 0
8179
- }, S = (t, e = {}) => X$1(t, pt$1, e).width, W$1 = "\x1B", Z$1 = "›", Ft$1 = 39, j = "\x07", Q$1 = "[", dt$1 = "]", tt = "m", U$1 = `${dt$1}8;;`, et$1 = new RegExp(`(?:\\${Q$1}(?<code>\\d+)m|\\${U$1}(?<uri>.*)${j})`, "y"), mt$1 = (t) => {
8180
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
8181
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
8182
- if (t === 1 || t === 2) return 22;
8183
- if (t === 3) return 23;
8184
- if (t === 4) return 24;
8185
- if (t === 7) return 27;
8186
- if (t === 8) return 28;
8187
- if (t === 9) return 29;
8188
- if (t === 0) return 0;
8189
- }, st$1 = (t) => `${W$1}${Q$1}${t}${tt}`, it$1 = (t) => `${W$1}${U$1}${t}${j}`, gt$1 = (t) => t.map((e) => S(e)), G = (t, e, s) => {
8190
- const i = e[Symbol.iterator]();
8191
- let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
8192
- for (; !l.done;) {
8193
- const m = l.value, A = S(m);
8194
- a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W$1 || m === Z$1) && (r = !0, n = e.startsWith(U$1, g + 1)), r ? n ? m === j && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
8195
- }
8196
- u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
8197
- }, vt$1 = (t) => {
8198
- const e = t.split(" ");
8199
- let s = e.length;
8200
- for (; s > 0 && !(S(e[s - 1]) > 0);) s--;
8201
- return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
8202
- }, Et$1 = (t, e, s = {}) => {
8203
- if (s.trim !== !1 && t.trim() === "") return "";
8204
- let i = "", r, n;
8205
- const u = t.split(" "), a = gt$1(u);
8206
- let l = [""];
8207
- for (const [h, o] of u.entries()) {
8208
- s.trim !== !1 && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
8209
- let p = S(l.at(-1) ?? "");
8210
- if (h !== 0 && (p >= e && (s.wordWrap === !1 || s.trim === !1) && (l.push(""), p = 0), (p > 0 || s.trim === !1) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
8211
- const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
8212
- Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
8213
- continue;
8214
- }
8215
- if (p + a[h] > e && p > 0 && a[h] > 0) {
8216
- if (s.wordWrap === !1 && p < e) {
8217
- G(l, o, e);
8218
- continue;
8219
- }
8220
- l.push("");
8221
- }
8222
- if (p + a[h] > e && s.wordWrap === !1) {
8223
- G(l, o, e);
8224
- continue;
8225
- }
8226
- l[l.length - 1] += o;
8227
- }
8228
- s.trim !== !1 && (l = l.map((h) => vt$1(h)));
8229
- const E = l.join(`
8230
- `), g = E[Symbol.iterator]();
8231
- let m = g.next(), A = g.next(), V = 0;
8232
- for (; !m.done;) {
8233
- const h = m.value, o = A.value;
8234
- if (i += h, h === W$1 || h === Z$1) {
8235
- et$1.lastIndex = V + 1;
8236
- const F = et$1.exec(E)?.groups;
8237
- if (F?.code !== void 0) {
8238
- const d = Number.parseFloat(F.code);
8239
- r = d === Ft$1 ? void 0 : d;
8240
- } else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
8241
- }
8242
- const p = r ? mt$1(r) : void 0;
8243
- o === `
8244
- ` ? (n && (i += it$1("")), r && p && (i += st$1(p))) : h === `
8245
- ` && (r && p && (i += st$1(r)), n && (i += it$1(n))), V += h.length, m = A, A = g.next();
8246
- }
8247
- return i;
8248
- };
8249
- function K$1(t, e, s) {
8250
- return String(t).normalize().replaceAll(`\r
8251
- `, `
8252
- `).split(`
8253
- `).map((i) => Et$1(i, e, s)).join(`
8254
- `);
8255
- }
8256
- const _ = {
8257
- actions: new Set([
8258
- "up",
8259
- "down",
8260
- "left",
8261
- "right",
8262
- "space",
8263
- "enter",
8264
- "cancel"
8265
- ]),
8266
- aliases: new Map([
8267
- ["k", "up"],
8268
- ["j", "down"],
8269
- ["h", "left"],
8270
- ["l", "right"],
8271
- ["", "cancel"],
8272
- ["escape", "cancel"]
8273
- ]),
8274
- messages: {
8275
- cancel: "Canceled",
8276
- error: "Something went wrong"
8277
- },
8278
- withGuide: !0
8279
- };
8280
- function H$1(t, e) {
8281
- if (typeof t == "string") return _.aliases.get(t) === e;
8282
- for (const s of t) if (s !== void 0 && H$1(s, e)) return !0;
8283
- return !1;
8284
- }
8285
- function _t(t, e) {
8286
- if (t === e) return;
8287
- const s = t.split(`
8288
- `), i = e.split(`
8289
- `), r = Math.max(s.length, i.length), n = [];
8290
- for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u);
8291
- return {
8292
- lines: n,
8293
- numLinesBefore: s.length,
8294
- numLinesAfter: i.length,
8295
- numLines: r
8296
- };
8297
- }
8298
- const bt$1 = globalThis.process.platform.startsWith("win"), z = Symbol("clack:cancel");
8299
- function Ct$1(t) {
8300
- return t === z;
8301
- }
8302
- function T(t, e) {
8303
- const s = t;
8304
- s.isTTY && s.setRawMode(e);
8305
- }
8306
- function Bt({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCursor: i = !0 } = {}) {
8307
- const r = k.createInterface({
8308
- input: t,
8309
- output: e,
8310
- prompt: "",
8311
- tabSize: 1
8312
- });
8313
- k.emitKeypressEvents(t, r), t instanceof ReadStream && t.isTTY && t.setRawMode(!0);
8314
- const n = (u, { name: a, sequence: l }) => {
8315
- if (H$1([
8316
- String(u),
8317
- a,
8318
- l
8319
- ], "cancel")) {
8320
- i && e.write(import_src.cursor.show), process.exit(0);
8321
- return;
8322
- }
8323
- if (!s) return;
8324
- const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
8325
- k.moveCursor(e, g, m, () => {
8326
- k.clearLine(e, 1, () => {
8327
- t.once("keypress", n);
8328
- });
8329
- });
8330
- };
8331
- return i && e.write(import_src.cursor.hide), t.once("keypress", n), () => {
8332
- t.off("keypress", n), i && e.write(import_src.cursor.show), t instanceof ReadStream && t.isTTY && !bt$1 && t.setRawMode(!1), r.terminal = !1, r.close();
8333
- };
8334
- }
8335
- const rt$1 = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80, nt$1 = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
8336
- function xt(t, e, s, i = s) {
8337
- return K$1(e, rt$1(t ?? stdout) - s.length, {
8338
- hard: !0,
8339
- trim: !1
8340
- }).split(`
8341
- `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
8342
- `);
8343
- }
8344
- var x$1 = class {
8345
- input;
8346
- output;
8347
- _abortSignal;
8348
- rl;
8349
- opts;
8350
- _render;
8351
- _track = !1;
8352
- _prevFrame = "";
8353
- _subscribers = /* @__PURE__ */ new Map();
8354
- _cursor = 0;
8355
- state = "initial";
8356
- error = "";
8357
- value;
8358
- userInput = "";
8359
- constructor(e, s = !0) {
8360
- const { input: i = stdin, output: r = stdout, render: n, signal: u, ...a } = e;
8361
- this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
8362
- }
8363
- unsubscribe() {
8364
- this._subscribers.clear();
8365
- }
8366
- setSubscriber(e, s) {
8367
- const i = this._subscribers.get(e) ?? [];
8368
- i.push(s), this._subscribers.set(e, i);
8369
- }
8370
- on(e, s) {
8371
- this.setSubscriber(e, { cb: s });
8372
- }
8373
- once(e, s) {
8374
- this.setSubscriber(e, {
8375
- cb: s,
8376
- once: !0
8377
- });
8378
- }
8379
- emit(e, ...s) {
8380
- const i = this._subscribers.get(e) ?? [], r = [];
8381
- for (const n of i) n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
8382
- for (const n of r) n();
8383
- }
8384
- prompt() {
8385
- return new Promise((e) => {
8386
- if (this._abortSignal) {
8387
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z);
8388
- this._abortSignal.addEventListener("abort", () => {
8389
- this.state = "cancel", this.close();
8390
- }, { once: !0 });
8391
- }
8392
- this.rl = f.createInterface({
8393
- input: this.input,
8394
- tabSize: 2,
8395
- prompt: "",
8396
- escapeCodeTimeout: 50,
8397
- terminal: !0
8398
- }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), T(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
8399
- this.output.write(import_src.cursor.show), this.output.off("resize", this.render), T(this.input, !1), e(this.value);
8400
- }), this.once("cancel", () => {
8401
- this.output.write(import_src.cursor.show), this.output.off("resize", this.render), T(this.input, !1), e(z);
8402
- });
8403
- });
8404
- }
8405
- _isActionKey(e, s) {
8406
- return e === " ";
8407
- }
8408
- _setValue(e) {
8409
- this.value = e, this.emit("value", this.value);
8410
- }
8411
- _setUserInput(e, s) {
8412
- this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
8413
- }
8414
- _clearUserInput() {
8415
- this.rl?.write(null, {
8416
- ctrl: !0,
8417
- name: "u"
8418
- }), this._setUserInput("");
8419
- }
8420
- onKeypress(e, s) {
8421
- if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, {
8422
- ctrl: !0,
8423
- name: "h"
8424
- }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
8425
- if (this.opts.validate) {
8426
- const i = this.opts.validate(this.value);
8427
- i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
8428
- }
8429
- this.state !== "error" && (this.state = "submit");
8430
- }
8431
- H$1([
8432
- e,
8433
- s?.name,
8434
- s?.sequence
8435
- ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
8436
- }
8437
- close() {
8438
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
8439
- `), T(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
8440
- }
8441
- restoreCursor() {
8442
- const e = K$1(this._prevFrame, process.stdout.columns, {
8443
- hard: !0,
8444
- trim: !1
8445
- }).split(`
8446
- `).length - 1;
8447
- this.output.write(import_src.cursor.move(-999, e * -1));
8448
- }
8449
- render() {
8450
- const e = K$1(this._render(this) ?? "", process.stdout.columns, {
8451
- hard: !0,
8452
- trim: !1
8453
- });
8454
- if (e !== this._prevFrame) {
8455
- if (this.state === "initial") this.output.write(import_src.cursor.hide);
8456
- else {
8457
- const s = _t(this._prevFrame, e), i = nt$1(this.output);
8458
- if (this.restoreCursor(), s) {
8459
- const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
8460
- let u = s.lines.find((a) => a >= r);
8461
- if (u === void 0) {
8462
- this._prevFrame = e;
8463
- return;
8464
- }
8465
- if (s.lines.length === 1) {
8466
- this.output.write(import_src.cursor.move(0, u - n)), this.output.write(import_src.erase.lines(1));
8467
- const a = e.split(`
8468
- `);
8469
- this.output.write(a[u]), this._prevFrame = e, this.output.write(import_src.cursor.move(0, a.length - u - 1));
8470
- return;
8471
- } else if (s.lines.length > 1) {
8472
- if (r < n) u = r;
8473
- else {
8474
- const l = u - n;
8475
- l > 0 && this.output.write(import_src.cursor.move(0, l));
8476
- }
8477
- this.output.write(import_src.erase.down());
8478
- const a = e.split(`
8479
- `).slice(u);
8480
- this.output.write(a.join(`
8481
- `)), this._prevFrame = e;
8482
- return;
8483
- }
8484
- }
8485
- this.output.write(import_src.erase.down());
8486
- }
8487
- this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
8488
- }
8489
- }
8490
- };
8491
- function wt$1(t, e) {
8492
- if (t === void 0 || e.length === 0) return 0;
8493
- const s = e.findIndex((i) => i.value === t);
8494
- return s !== -1 ? s : 0;
8495
- }
8496
- function Dt$1(t, e) {
8497
- return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
8498
- }
8499
- function St$1(t, e) {
8500
- if (e) return t ? e : e[0];
8501
- }
8502
- var Vt$1 = class extends x$1 {
8503
- filteredOptions;
8504
- multiple;
8505
- isNavigating = !1;
8506
- selectedValues = [];
8507
- focusedValue;
8508
- #t = 0;
8509
- #s = "";
8510
- #i;
8511
- #e;
8512
- get cursor() {
8513
- return this.#t;
8514
- }
8515
- get userInputWithCursor() {
8516
- if (!this.userInput) return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
8517
- if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
8518
- const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
8519
- return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
8520
- }
8521
- get options() {
8522
- return typeof this.#e == "function" ? this.#e() : this.#e;
8523
- }
8524
- constructor(e) {
8525
- super(e), this.#e = e.options;
8526
- const s = this.options;
8527
- this.filteredOptions = [...s], this.multiple = e.multiple === !0, this.#i = e.filter ?? Dt$1;
8528
- let i;
8529
- if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i) for (const r of i) {
8530
- const n = s.findIndex((u) => u.value === r);
8531
- n !== -1 && (this.toggleSelected(r), this.#t = n);
8532
- }
8533
- this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
8534
- }
8535
- _isActionKey(e, s) {
8536
- return e === " " || this.multiple && this.isNavigating && s.name === "space" && e !== void 0 && e !== "";
8537
- }
8538
- #r(e, s) {
8539
- const i = s.name === "up", r = s.name === "down", n = s.name === "return";
8540
- i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = !0) : n ? this.value = St$1(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = !1);
8541
- }
8542
- deselectAll() {
8543
- this.selectedValues = [];
8544
- }
8545
- toggleSelected(e) {
8546
- this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
8547
- }
8548
- #n(e) {
8549
- if (e !== this.#s) {
8550
- this.#s = e;
8551
- const s = this.options;
8552
- e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
8553
- this.#t = B(wt$1(this.focusedValue, this.filteredOptions), 0, this.filteredOptions);
8554
- const r = this.filteredOptions[this.#t];
8555
- r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
8556
- }
8557
- }
8558
- };
8559
- var kt$1 = class extends x$1 {
8560
- get cursor() {
8561
- return this.value ? 0 : 1;
8562
- }
8563
- get _value() {
8564
- return this.cursor === 0;
8565
- }
8566
- constructor(e) {
8567
- super(e, !1), this.value = !!e.initialValue, this.on("userInput", () => {
8568
- this.value = this._value;
8569
- }), this.on("confirm", (s) => {
8570
- this.output.write(import_src.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
8571
- }), this.on("cursor", () => {
8572
- this.value = !this.value;
8573
- });
8574
- }
8575
- };
8576
- var yt$1 = class extends x$1 {
8577
- options;
8578
- cursor = 0;
8579
- #t;
8580
- getGroupItems(e) {
8581
- return this.options.filter((s) => s.group === e);
8582
- }
8583
- isGroupSelected(e) {
8584
- const s = this.getGroupItems(e), i = this.value;
8585
- return i === void 0 ? !1 : s.every((r) => i.includes(r.value));
8586
- }
8587
- toggleValue() {
8588
- const e = this.options[this.cursor];
8589
- if (this.value === void 0 && (this.value = []), e.group === !0) {
8590
- const s = e.value, i = this.getGroupItems(s);
8591
- this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
8592
- } else this.value = this.value.includes(e.value) ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
8593
- }
8594
- constructor(e) {
8595
- super(e, !1);
8596
- const { options: s } = e;
8597
- this.#t = e.selectableGroups !== !1, this.options = Object.entries(s).flatMap(([i, r]) => [{
8598
- value: i,
8599
- group: !0,
8600
- label: i
8601
- }, ...r.map((n) => ({
8602
- ...n,
8603
- group: i
8604
- }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
8605
- switch (i) {
8606
- case "left":
8607
- case "up": {
8608
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
8609
- const r = this.options[this.cursor]?.group === !0;
8610
- !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
8611
- break;
8612
- }
8613
- case "down":
8614
- case "right": {
8615
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
8616
- const r = this.options[this.cursor]?.group === !0;
8617
- !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
8618
- break;
8619
- }
8620
- case "space":
8621
- this.toggleValue();
8622
- break;
8623
- }
8624
- });
8625
- }
8626
- };
8627
- var Lt$1 = class extends x$1 {
8628
- options;
8629
- cursor = 0;
8630
- get _value() {
8631
- return this.options[this.cursor].value;
8632
- }
8633
- get _enabledOptions() {
8634
- return this.options.filter((e) => e.disabled !== !0);
8635
- }
8636
- toggleAll() {
8637
- const e = this._enabledOptions;
8638
- this.value = this.value !== void 0 && this.value.length === e.length ? [] : e.map((i) => i.value);
8639
- }
8640
- toggleInvert() {
8641
- const e = this.value;
8642
- if (!e) return;
8643
- this.value = this._enabledOptions.filter((i) => !e.includes(i.value)).map((i) => i.value);
8644
- }
8645
- toggleValue() {
8646
- this.value === void 0 && (this.value = []);
8647
- this.value = this.value.includes(this._value) ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
8648
- }
8649
- constructor(e) {
8650
- super(e, !1), this.options = e.options, this.value = [...e.initialValues ?? []];
8651
- const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
8652
- this.cursor = this.options[s].disabled ? B(s, 1, this.options) : s, this.on("key", (i) => {
8653
- i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
8654
- }), this.on("cursor", (i) => {
8655
- switch (i) {
8656
- case "left":
8657
- case "up":
8658
- this.cursor = B(this.cursor, -1, this.options);
8659
- break;
8660
- case "down":
8661
- case "right":
8662
- this.cursor = B(this.cursor, 1, this.options);
8663
- break;
8664
- case "space":
8665
- this.toggleValue();
8666
- break;
8667
- }
8668
- });
8669
- }
8670
- };
8671
- let Mt$1 = class extends x$1 {
8672
- _mask = "•";
8673
- get cursor() {
8674
- return this._cursor;
8675
- }
8676
- get masked() {
8677
- return this.userInput.replaceAll(/./g, this._mask);
8678
- }
8679
- get userInputWithCursor() {
8680
- if (this.state === "submit" || this.state === "cancel") return this.masked;
8681
- const e = this.userInput;
8682
- if (this.cursor >= e.length) return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
8683
- const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
8684
- return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`;
8685
- }
8686
- clear() {
8687
- this._clearUserInput();
8688
- }
8689
- constructor({ mask: e, ...s }) {
8690
- super(s), this._mask = e ?? "•", this.on("userInput", (i) => {
8691
- this._setValue(i);
8692
- });
8693
- }
8694
- };
8695
- var Wt$1 = class extends x$1 {
8696
- options;
8697
- cursor = 0;
8698
- get _selectedValue() {
8699
- return this.options[this.cursor];
8700
- }
8701
- changeValue() {
8702
- this.value = this._selectedValue.value;
8703
- }
8704
- constructor(e) {
8705
- super(e, !1), this.options = e.options;
8706
- const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
8707
- this.cursor = this.options[i].disabled ? B(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
8708
- switch (r) {
8709
- case "left":
8710
- case "up":
8711
- this.cursor = B(this.cursor, -1, this.options);
8712
- break;
8713
- case "down":
8714
- case "right":
8715
- this.cursor = B(this.cursor, 1, this.options);
8716
- break;
8717
- }
8718
- this.changeValue();
8719
- });
8720
- }
8721
- };
8722
- var Tt$1 = class extends x$1 {
8723
- options;
8724
- cursor = 0;
8725
- constructor(e) {
8726
- super(e, !1), this.options = e.options;
8727
- const s = e.caseSensitive === !0, i = this.options.map(({ value: [r] }) => s ? r : r?.toLowerCase());
8728
- this.cursor = Math.max(i.indexOf(e.initialValue), 0), this.on("key", (r, n) => {
8729
- if (!r) return;
8730
- const u = s && n.shift ? r.toUpperCase() : r;
8731
- if (!i.includes(u)) return;
8732
- const a = this.options.find(({ value: [l] }) => s ? l === u : l?.toLowerCase() === r);
8733
- a && (this.value = a.value, this.state = "submit", this.emit("submit"));
8734
- });
8735
- }
8736
- };
8737
- var $t$1 = class extends x$1 {
8738
- get userInputWithCursor() {
8739
- if (this.state === "submit") return this.userInput;
8740
- const e = this.userInput;
8741
- if (this.cursor >= e.length) return `${this.userInput}\u2588`;
8742
- const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
8743
- return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
8744
- }
8745
- get cursor() {
8746
- return this._cursor;
8747
- }
8748
- constructor(e) {
8749
- super({
8750
- ...e,
8751
- initialUserInput: e.initialUserInput ?? e.initialValue
8752
- }), this.on("userInput", (s) => {
8753
- this._setValue(s);
8754
- }), this.on("finalize", () => {
8755
- this.value || (this.value = e.defaultValue), this.value === void 0 && (this.value = "");
8756
- });
8757
- }
8758
- };
8759
-
8760
- //#endregion
8761
- //#region ../../node_modules/.bun/@clack+prompts@1.0.1/node_modules/@clack/prompts/dist/index.mjs
8762
- function me() {
8763
- return N.platform !== "win32" ? N.env.TERM !== "linux" : !!N.env.CI || !!N.env.WT_SESSION || !!N.env.TERMINUS_SUBLIME || N.env.ConEmuTask === "{cmd::Cmder}" || N.env.TERM_PROGRAM === "Terminus-Sublime" || N.env.TERM_PROGRAM === "vscode" || N.env.TERM === "xterm-256color" || N.env.TERM === "alacritty" || N.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
8764
- }
8765
- const et = me(), ct = () => process.env.CI === "true", Mt = (t) => t.isTTY === !0, C = (t, r) => et ? t : r, Rt = C("◆", "*"), dt = C("■", "x"), $t = C("▲", "x"), V = C("◇", "o"), ht = C("┌", "T"), d = C("│", "|"), x = C("└", "—"), Ot = C("┐", "T"), Pt = C("┘", "—"), Q = C("●", ">"), H = C("○", " "), st = C("◻", "[•]"), U = C("◼", "[+]"), q = C("◻", "[ ]"), Nt = C("▪", "•"), rt = C("─", "-"), mt = C("╮", "+"), Wt = C("├", "+"), pt = C("╯", "+"), gt = C("╰", "+"), Lt = C("╭", "+"), ft = C("●", "•"), Ft = C("◆", "*"), yt = C("▲", "!"), Et = C("■", "x"), W = (t) => {
8766
- switch (t) {
8767
- case "initial":
8768
- case "active": return import_picocolors.default.cyan(Rt);
8769
- case "cancel": return import_picocolors.default.red(dt);
8770
- case "error": return import_picocolors.default.yellow($t);
8771
- case "submit": return import_picocolors.default.green(V);
8772
- }
8773
- }, vt = (t) => {
8774
- switch (t) {
8775
- case "initial":
8776
- case "active": return import_picocolors.default.cyan(d);
8777
- case "cancel": return import_picocolors.default.red(d);
8778
- case "error": return import_picocolors.default.yellow(d);
8779
- case "submit": return import_picocolors.default.green(d);
8780
- }
8781
- }, pe = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, fe = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, At = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, it = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, nt = /\t{1,1000}/y, wt = /[\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, at = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Fe = /\p{M}+/gu, ye = {
8782
- limit: Infinity,
8783
- ellipsis: ""
8784
- }, jt = (t, r = {}, s = {}) => {
8785
- const i = r.limit ?? Infinity, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
8786
- let $ = 0, m = 0, h = t.length, y = 0, f = !1, v = h, S = Math.max(0, i - o), I = 0, B = 0, A = 0, w = 0;
8787
- t: for (;;) {
8788
- if (B > I || m >= h && m > $) {
8789
- const _ = t.slice(I, B) || t.slice($, m);
8790
- y = 0;
8791
- for (const D of _.replaceAll(Fe, "")) {
8792
- const T = D.codePointAt(0) || 0;
8793
- if (ge(T) ? w = F : fe(T) ? w = E : c !== p && pe(T) ? w = c : w = p, A + w > S && (v = Math.min(v, Math.max(I, $) + y)), A + w > i) {
8794
- f = !0;
8795
- break t;
8796
- }
8797
- y += D.length, A += w;
8798
- }
8799
- I = B = 0;
8800
- }
8801
- if (m >= h) break;
8802
- if (at.lastIndex = m, at.test(t)) {
8803
- if (y = at.lastIndex - m, w = y * p, A + w > S && (v = Math.min(v, m + Math.floor((S - A) / p))), A + w > i) {
8804
- f = !0;
8805
- break;
8806
- }
8807
- A += w, I = $, B = m, m = $ = at.lastIndex;
8808
- continue;
8809
- }
8810
- if (At.lastIndex = m, At.test(t)) {
8811
- if (A + u > S && (v = Math.min(v, m)), A + u > i) {
8812
- f = !0;
8813
- break;
8814
- }
8815
- A += u, I = $, B = m, m = $ = At.lastIndex;
8816
- continue;
8817
- }
8818
- if (it.lastIndex = m, it.test(t)) {
8819
- if (y = it.lastIndex - m, w = y * l, A + w > S && (v = Math.min(v, m + Math.floor((S - A) / l))), A + w > i) {
8820
- f = !0;
8821
- break;
8822
- }
8823
- A += w, I = $, B = m, m = $ = it.lastIndex;
8824
- continue;
8825
- }
8826
- if (nt.lastIndex = m, nt.test(t)) {
8827
- if (y = nt.lastIndex - m, w = y * n, A + w > S && (v = Math.min(v, m + Math.floor((S - A) / n))), A + w > i) {
8828
- f = !0;
8829
- break;
8830
- }
8831
- A += w, I = $, B = m, m = $ = nt.lastIndex;
8832
- continue;
8833
- }
8834
- if (wt.lastIndex = m, wt.test(t)) {
8835
- if (A + g > S && (v = Math.min(v, m)), A + g > i) {
8836
- f = !0;
8837
- break;
8838
- }
8839
- A += g, I = $, B = m, m = $ = wt.lastIndex;
8840
- continue;
8841
- }
8842
- m += 1;
8843
- }
8844
- return {
8845
- width: f ? S : A,
8846
- index: f ? v : h,
8847
- truncated: f,
8848
- ellipsed: f && i >= o
8849
- };
8850
- }, Ee = {
8851
- limit: Infinity,
8852
- ellipsis: "",
8853
- ellipsisWidth: 0
8854
- }, M = (t, r = {}) => jt(t, Ee, r).width, ot = "\x1B", Gt = "›", ve = 39, Ct = "\x07", kt = "[", Ae = "]", Vt = "m", St = `${Ae}8;;`, Ht = new RegExp(`(?:\\${kt}(?<code>\\d+)m|\\${St}(?<uri>.*)${Ct})`, "y"), we = (t) => {
8855
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
8856
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
8857
- if (t === 1 || t === 2) return 22;
8858
- if (t === 3) return 23;
8859
- if (t === 4) return 24;
8860
- if (t === 7) return 27;
8861
- if (t === 8) return 28;
8862
- if (t === 9) return 29;
8863
- if (t === 0) return 0;
8864
- }, Ut = (t) => `${ot}${kt}${t}${Vt}`, Kt = (t) => `${ot}${St}${t}${Ct}`, Ce = (t) => t.map((r) => M(r)), It = (t, r, s) => {
8865
- const i = r[Symbol.iterator]();
8866
- let a = !1, o = !1, u = t.at(-1), l = u === void 0 ? 0 : M(u), n = i.next(), c = i.next(), g = 0;
8867
- for (; !n.done;) {
8868
- const F = n.value, p = M(F);
8869
- l + p <= s ? t[t.length - 1] += F : (t.push(F), l = 0), (F === ot || F === Gt) && (a = !0, o = r.startsWith(St, g + 1)), a ? o ? F === Ct && (a = !1, o = !1) : F === Vt && (a = !1) : (l += p, l === s && !c.done && (t.push(""), l = 0)), n = c, c = i.next(), g += F.length;
8870
- }
8871
- u = t.at(-1), !l && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
8872
- }, Se = (t) => {
8873
- const r = t.split(" ");
8874
- let s = r.length;
8875
- for (; s > 0 && !(M(r[s - 1]) > 0);) s--;
8876
- return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
8877
- }, Ie = (t, r, s = {}) => {
8878
- if (s.trim !== !1 && t.trim() === "") return "";
8879
- let i = "", a, o;
8880
- const u = t.split(" "), l = Ce(u);
8881
- let n = [""];
8882
- for (const [$, m] of u.entries()) {
8883
- s.trim !== !1 && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
8884
- let h = M(n.at(-1) ?? "");
8885
- if ($ !== 0 && (h >= r && (s.wordWrap === !1 || s.trim === !1) && (n.push(""), h = 0), (h > 0 || s.trim === !1) && (n[n.length - 1] += " ", h++)), s.hard && l[$] > r) {
8886
- const y = r - h, f = 1 + Math.floor((l[$] - y - 1) / r);
8887
- Math.floor((l[$] - 1) / r) < f && n.push(""), It(n, m, r);
8888
- continue;
8889
- }
8890
- if (h + l[$] > r && h > 0 && l[$] > 0) {
8891
- if (s.wordWrap === !1 && h < r) {
8892
- It(n, m, r);
8893
- continue;
8894
- }
8895
- n.push("");
8896
- }
8897
- if (h + l[$] > r && s.wordWrap === !1) {
8898
- It(n, m, r);
8899
- continue;
8900
- }
8901
- n[n.length - 1] += m;
8902
- }
8903
- s.trim !== !1 && (n = n.map(($) => Se($)));
8904
- const c = n.join(`
8905
- `), g = c[Symbol.iterator]();
8906
- let F = g.next(), p = g.next(), E = 0;
8907
- for (; !F.done;) {
8908
- const $ = F.value, m = p.value;
8909
- if (i += $, $ === ot || $ === Gt) {
8910
- Ht.lastIndex = E + 1;
8911
- const f = Ht.exec(c)?.groups;
8912
- if (f?.code !== void 0) {
8913
- const v = Number.parseFloat(f.code);
8914
- a = v === ve ? void 0 : v;
8915
- } else f?.uri !== void 0 && (o = f.uri.length === 0 ? void 0 : f.uri);
8916
- }
8917
- const h = a ? we(a) : void 0;
8918
- m === `
8919
- ` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
8920
- ` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
8921
- }
8922
- return i;
8923
- };
8924
- function J(t, r, s) {
8925
- return String(t).normalize().replaceAll(`\r
8926
- `, `
8927
- `).split(`
8928
- `).map((i) => Ie(i, r, s)).join(`
8929
- `);
8930
- }
8931
- const be = (t, r, s, i, a) => {
8932
- let o = r, u = 0;
8933
- for (let l = s; l < i; l++) {
8934
- const n = t[l];
8935
- if (o = o - n.length, u++, o <= a) break;
8936
- }
8937
- return {
8938
- lineCount: o,
8939
- removals: u
8940
- };
8941
- }, X = (t) => {
8942
- const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt$1(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt$1(a), g = import_picocolors.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
8943
- let $ = 0;
8944
- r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
8945
- let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
8946
- const y = Math.min($ + E, s.length), f = [];
8947
- let v = 0;
8948
- m && v++, h && v++;
8949
- const S = $ + (m ? 1 : 0), I = y - (h ? 1 : 0);
8950
- for (let A = S; A < I; A++) {
8951
- const w = J(i(s[A], A === r), n, {
8952
- hard: !0,
8953
- trim: !1
8954
- }).split(`
8955
- `);
8956
- f.push(w), v += w.length;
8957
- }
8958
- if (v > p) {
8959
- let A = 0, w = 0, _ = v;
8960
- const D = r - S, T = (Y, L) => be(f, _, Y, L, p);
8961
- m ? ({lineCount: _, removals: A} = T(0, D), _ > p && ({lineCount: _, removals: w} = T(D + 1, f.length))) : ({lineCount: _, removals: w} = T(D + 1, f.length), _ > p && ({lineCount: _, removals: A} = T(0, D))), A > 0 && (m = !0, f.splice(0, A)), w > 0 && (h = !0, f.splice(f.length - w, w));
8962
- }
8963
- const B = [];
8964
- m && B.push(g);
8965
- for (const A of f) for (const w of A) B.push(w);
8966
- return h && B.push(g), B;
8967
- };
8968
- function qt(t) {
8969
- return t.label ?? String(t.value ?? "");
8970
- }
8971
- function Jt(t, r) {
8972
- if (!t) return !0;
8973
- const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), a = String(r.value).toLowerCase(), o = t.toLowerCase();
8974
- return s.includes(o) || i.includes(o) || a.includes(o);
8975
- }
8976
- function Be(t, r) {
8977
- const s = [];
8978
- for (const i of r) t.includes(i.value) && s.push(i);
8979
- return s;
8980
- }
8981
- const Xt = (t) => new Vt$1({
8982
- options: t.options,
8983
- initialValue: t.initialValue ? [t.initialValue] : void 0,
8984
- initialUserInput: t.initialUserInput,
8985
- filter: t.filter ?? ((r, s) => Jt(r, s)),
8986
- signal: t.signal,
8987
- input: t.input,
8988
- output: t.output,
8989
- validate: t.validate,
8990
- render() {
8991
- const r = t.withGuide ?? _.withGuide, s = r ? [`${import_picocolors.default.gray(d)}`, `${W(this.state)} ${t.message}`] : [`${W(this.state)} ${t.message}`], i = this.userInput, a = this.options, o = t.placeholder, u = i === "" && o !== void 0, l = (n, c) => {
8992
- const g = qt(n), F = n.hint && n.value === this.focusedValue ? import_picocolors.default.dim(` (${n.hint})`) : "";
8993
- switch (c) {
8994
- case "active": return `${import_picocolors.default.green(Q)} ${g}${F}`;
8995
- case "inactive": return `${import_picocolors.default.dim(H)} ${import_picocolors.default.dim(g)}`;
8996
- case "disabled": return `${import_picocolors.default.gray(H)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(g))}`;
8997
- }
8998
- };
8999
- switch (this.state) {
9000
- case "submit": {
9001
- const n = Be(this.selectedValues, a), c = n.length > 0 ? ` ${import_picocolors.default.dim(n.map(qt).join(", "))}` : "", g = r ? import_picocolors.default.gray(d) : "";
9002
- return `${s.join(`
9003
- `)}
9004
- ${g}${c}`;
9005
- }
9006
- case "cancel": {
9007
- const n = i ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}` : "", c = r ? import_picocolors.default.gray(d) : "";
9008
- return `${s.join(`
9009
- `)}
9010
- ${c}${n}`;
9011
- }
9012
- default: {
9013
- const n = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, c = r ? `${n(d)} ` : "", g = r ? n(x) : "";
9014
- let F = "";
9015
- if (this.isNavigating || u) {
9016
- const f = u ? o : i;
9017
- F = f !== "" ? ` ${import_picocolors.default.dim(f)}` : "";
9018
- } else F = ` ${this.userInputWithCursor}`;
9019
- const p = this.filteredOptions.length !== a.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", E = this.filteredOptions.length === 0 && i ? [`${c}${import_picocolors.default.yellow("No matches found")}`] : [], $ = this.state === "error" ? [`${c}${import_picocolors.default.yellow(this.error)}`] : [];
9020
- r && s.push(`${c.trimEnd()}`), s.push(`${c}${import_picocolors.default.dim("Search:")}${F}${p}`, ...E, ...$);
9021
- const h = [`${c}${[
9022
- `${import_picocolors.default.dim("↑/↓")} to select`,
9023
- `${import_picocolors.default.dim("Enter:")} confirm`,
9024
- `${import_picocolors.default.dim("Type:")} to search`
9025
- ].join(" • ")}`, g], y = this.filteredOptions.length === 0 ? [] : X({
9026
- cursor: this.cursor,
9027
- options: this.filteredOptions,
9028
- columnPadding: r ? 3 : 0,
9029
- rowPadding: s.length + h.length,
9030
- style: (f, v) => l(f, f.disabled ? "disabled" : v ? "active" : "inactive"),
9031
- maxItems: t.maxItems,
9032
- output: t.output
9033
- });
9034
- return [
9035
- ...s,
9036
- ...y.map((f) => `${c}${f}`),
9037
- ...h
9038
- ].join(`
9039
- `);
9040
- }
9041
- }
9042
- }
9043
- }).prompt(), xe = (t) => {
9044
- const r = (i, a, o, u) => {
9045
- const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== void 0 && i.value === u ? import_picocolors.default.dim(` (${i.hint})`) : "", g = l ? import_picocolors.default.green(U) : import_picocolors.default.dim(q);
9046
- return i.disabled ? `${import_picocolors.default.gray(q)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(n))}` : a ? `${g} ${n}${c}` : `${g} ${import_picocolors.default.dim(n)}`;
9047
- }, s = new Vt$1({
9048
- options: t.options,
9049
- multiple: !0,
9050
- filter: t.filter ?? ((i, a) => Jt(i, a)),
9051
- validate: () => {
9052
- if (t.required && s.selectedValues.length === 0) return "Please select at least one item";
9053
- },
9054
- initialValue: t.initialValues,
9055
- signal: t.signal,
9056
- input: t.input,
9057
- output: t.output,
9058
- render() {
9059
- const i = `${import_picocolors.default.gray(d)}
9060
- ${W(this.state)} ${t.message}
9061
- `, a = this.userInput, o = t.placeholder, u = a === "" && o !== void 0, l = this.isNavigating || u ? import_picocolors.default.dim(u ? o : a) : this.userInputWithCursor, n = this.options, c = this.filteredOptions.length !== n.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
9062
- switch (this.state) {
9063
- case "submit": return `${i}${import_picocolors.default.gray(d)} ${import_picocolors.default.dim(`${this.selectedValues.length} items selected`)}`;
9064
- case "cancel": return `${i}${import_picocolors.default.gray(d)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}`;
9065
- default: {
9066
- const g = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, F = [
9067
- `${import_picocolors.default.dim("↑/↓")} to navigate`,
9068
- `${import_picocolors.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
9069
- `${import_picocolors.default.dim("Enter:")} confirm`,
9070
- `${import_picocolors.default.dim("Type:")} to search`
9071
- ], p = this.filteredOptions.length === 0 && a ? [`${g(d)} ${import_picocolors.default.yellow("No matches found")}`] : [], E = this.state === "error" ? [`${g(d)} ${import_picocolors.default.yellow(this.error)}`] : [], $ = [
9072
- ...`${i}${g(d)}`.split(`
9073
- `),
9074
- `${g(d)} ${import_picocolors.default.dim("Search:")} ${l}${c}`,
9075
- ...p,
9076
- ...E
9077
- ], m = [`${g(d)} ${F.join(" • ")}`, `${g(x)}`], h = X({
9078
- cursor: this.cursor,
9079
- options: this.filteredOptions,
9080
- style: (y, f) => r(y, f, this.selectedValues, this.focusedValue),
9081
- maxItems: t.maxItems,
9082
- output: t.output,
9083
- rowPadding: $.length + m.length
9084
- });
9085
- return [
9086
- ...$,
9087
- ...h.map((y) => `${g(d)} ${y}`),
9088
- ...m
9089
- ].join(`
9090
- `);
9091
- }
9092
- }
9093
- }
9094
- });
9095
- return s.prompt();
9096
- }, _e = [
9097
- Lt,
9098
- mt,
9099
- gt,
9100
- pt
9101
- ], De = [
9102
- ht,
9103
- Ot,
9104
- x,
9105
- Pt
9106
- ];
9107
- function Yt(t, r, s, i) {
9108
- let a = s, o = s;
9109
- return i === "center" ? a = Math.floor((r - t) / 2) : i === "right" && (a = r - t - s), o = r - a - t, [a, o];
9110
- }
9111
- const Te = (t) => t, Me = (t = "", r = "", s) => {
9112
- const i = s?.output ?? process.stdout, a = rt$1(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, n = s?.width === void 0 || s.width === "auto" ? 1 : Math.min(1, s.width), c = s?.withGuide ?? _.withGuide ? `${d} ` : "", g = s?.formatBorder ?? Te, F = (s?.rounded ? _e : De).map(g), p = g(rt), E = g(d), $ = M(c), m = M(r), h = a - $;
9113
- let y = Math.floor(a * n) - $;
9114
- if (s?.width === "auto") {
9115
- const _ = t.split(`
9116
- `);
9117
- let D = m + u * 2;
9118
- for (const Y of _) {
9119
- const L = M(Y) + l * 2;
9120
- L > D && (D = L);
9121
- }
9122
- const T = D + o;
9123
- T < y && (y = T);
9124
- }
9125
- y % 2 !== 0 && (y < h ? y++ : y--);
9126
- const f = y - o, v = f - u * 2, S = m > v ? `${r.slice(0, v - 3)}...` : r, [I, B] = Yt(M(S), f, u, s?.titleAlign), A = J(t, f - l * 2, {
9127
- hard: !0,
9128
- trim: !1
9129
- });
9130
- i.write(`${c}${F[0]}${p.repeat(I)}${S}${p.repeat(B)}${F[1]}
9131
- `);
9132
- const w = A.split(`
9133
- `);
9134
- for (const _ of w) {
9135
- const [D, T] = Yt(M(_), f, l, s?.contentAlign);
9136
- i.write(`${c}${E}${" ".repeat(D)}${_}${" ".repeat(T)}${E}
9137
- `);
9138
- }
9139
- i.write(`${c}${F[2]}${p.repeat(f)}${F[3]}
9140
- `);
9141
- }, Re = (t) => {
9142
- const r = t.active ?? "Yes", s = t.inactive ?? "No";
9143
- return new kt$1({
9144
- active: r,
9145
- inactive: s,
9146
- signal: t.signal,
9147
- input: t.input,
9148
- output: t.output,
9149
- initialValue: t.initialValue ?? !0,
9150
- render() {
9151
- const i = t.withGuide ?? _.withGuide, a = `${i ? `${import_picocolors.default.gray(d)}
9152
- ` : ""}${W(this.state)} ${t.message}
9153
- `, o = this.value ? r : s;
9154
- switch (this.state) {
9155
- case "submit": return `${a}${i ? `${import_picocolors.default.gray(d)} ` : ""}${import_picocolors.default.dim(o)}`;
9156
- case "cancel": return `${a}${i ? `${import_picocolors.default.gray(d)} ` : ""}${import_picocolors.default.strikethrough(import_picocolors.default.dim(o))}${i ? `
9157
- ${import_picocolors.default.gray(d)}` : ""}`;
9158
- default: {
9159
- const u = i ? `${import_picocolors.default.cyan(d)} ` : "", l = i ? import_picocolors.default.cyan(x) : "";
9160
- return `${a}${u}${this.value ? `${import_picocolors.default.green(Q)} ${r}` : `${import_picocolors.default.dim(H)} ${import_picocolors.default.dim(r)}`}${t.vertical ? i ? `
9161
- ${import_picocolors.default.cyan(d)} ` : `
9162
- ` : ` ${import_picocolors.default.dim("/")} `}${this.value ? `${import_picocolors.default.dim(H)} ${import_picocolors.default.dim(s)}` : `${import_picocolors.default.green(Q)} ${s}`}
9163
- ${l}
9164
- `;
9165
- }
9166
- }
9167
- }
9168
- }).prompt();
9169
- }, Oe = async (t, r) => {
9170
- const s = {}, i = Object.keys(t);
9171
- for (const a of i) {
9172
- const o = t[a], u = await o({ results: s })?.catch((l) => {
9173
- throw l;
9174
- });
9175
- if (typeof r?.onCancel == "function" && Ct$1(u)) {
9176
- s[a] = "canceled", r.onCancel({ results: s });
9177
- continue;
9178
- }
9179
- s[a] = u;
9180
- }
9181
- return s;
9182
- }, Pe = (t) => {
9183
- const { selectableGroups: r = !0, groupSpacing: s = 0 } = t, i = (o, u, l = []) => {
9184
- const n = o.label ?? String(o.value), c = typeof o.group == "string", g = c && (l[l.indexOf(o) + 1] ?? { group: !0 }), F = c && g && g.group === !0, p = c ? r ? `${F ? x : d} ` : " " : "";
9185
- let E = "";
9186
- if (s > 0 && !c) {
9187
- const m = `
9188
- ${import_picocolors.default.cyan(d)}`;
9189
- E = `${m.repeat(s - 1)}${m} `;
9190
- }
9191
- if (u === "active") return `${E}${import_picocolors.default.dim(p)}${import_picocolors.default.cyan(st)} ${n}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
9192
- if (u === "group-active") return `${E}${p}${import_picocolors.default.cyan(st)} ${import_picocolors.default.dim(n)}`;
9193
- if (u === "group-active-selected") return `${E}${p}${import_picocolors.default.green(U)} ${import_picocolors.default.dim(n)}`;
9194
- if (u === "selected") {
9195
- const m = c || r ? import_picocolors.default.green(U) : "";
9196
- return `${E}${import_picocolors.default.dim(p)}${m} ${import_picocolors.default.dim(n)}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
9197
- }
9198
- if (u === "cancelled") return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(n))}`;
9199
- if (u === "active-selected") return `${E}${import_picocolors.default.dim(p)}${import_picocolors.default.green(U)} ${n}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
9200
- if (u === "submitted") return `${import_picocolors.default.dim(n)}`;
9201
- const $ = c || r ? import_picocolors.default.dim(q) : "";
9202
- return `${E}${import_picocolors.default.dim(p)}${$} ${import_picocolors.default.dim(n)}`;
9203
- }, a = t.required ?? !0;
9204
- return new yt$1({
9205
- options: t.options,
9206
- signal: t.signal,
9207
- input: t.input,
9208
- output: t.output,
9209
- initialValues: t.initialValues,
9210
- required: a,
9211
- cursorAt: t.cursorAt,
9212
- selectableGroups: r,
9213
- validate(o) {
9214
- if (a && (o === void 0 || o.length === 0)) return `Please select at least one option.
9215
- ${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
9216
- },
9217
- render() {
9218
- const o = `${import_picocolors.default.gray(d)}
9219
- ${W(this.state)} ${t.message}
9220
- `, u = this.value ?? [];
9221
- switch (this.state) {
9222
- case "submit": {
9223
- const l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(import_picocolors.default.dim(", "))}`;
9224
- return `${o}${import_picocolors.default.gray(d)}${n}`;
9225
- }
9226
- case "cancel": {
9227
- const l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(import_picocolors.default.dim(", "));
9228
- return `${o}${import_picocolors.default.gray(d)} ${l.trim() ? `${l}
9229
- ${import_picocolors.default.gray(d)}` : ""}`;
9230
- }
9231
- case "error": {
9232
- const l = this.error.split(`
9233
- `).map((n, c) => c === 0 ? `${import_picocolors.default.yellow(x)} ${import_picocolors.default.yellow(n)}` : ` ${n}`).join(`
9234
- `);
9235
- return `${o}${import_picocolors.default.yellow(d)} ${this.options.map((n, c, g) => {
9236
- const F = u.includes(n.value) || n.group === !0 && this.isGroupSelected(`${n.value}`), p = c === this.cursor;
9237
- return !p && typeof n.group == "string" && this.options[this.cursor].value === n.group ? i(n, F ? "group-active-selected" : "group-active", g) : p && F ? i(n, "active-selected", g) : F ? i(n, "selected", g) : i(n, p ? "active" : "inactive", g);
9238
- }).join(`
9239
- ${import_picocolors.default.yellow(d)} `)}
9240
- ${l}
9241
- `;
9242
- }
9243
- default: {
9244
- const l = this.options.map((c, g, F) => {
9245
- const p = u.includes(c.value) || c.group === !0 && this.isGroupSelected(`${c.value}`), E = g === this.cursor, $ = !E && typeof c.group == "string" && this.options[this.cursor].value === c.group;
9246
- let m = "";
9247
- return $ ? m = i(c, p ? "group-active-selected" : "group-active", F) : E && p ? m = i(c, "active-selected", F) : p ? m = i(c, "selected", F) : m = i(c, E ? "active" : "inactive", F), `${g !== 0 && !m.startsWith(`
9248
- `) ? " " : ""}${m}`;
9249
- }).join(`
9250
- ${import_picocolors.default.cyan(d)}`), n = l.startsWith(`
9251
- `) ? "" : " ";
9252
- return `${o}${import_picocolors.default.cyan(d)}${n}${l}
9253
- ${import_picocolors.default.cyan(x)}
9254
- `;
9255
- }
9256
- }
9257
- }
9258
- }).prompt();
9259
- }, R = {
9260
- message: (t = [], { symbol: r = import_picocolors.default.gray(d), secondarySymbol: s = import_picocolors.default.gray(d), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
9261
- const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
9262
- for (let p = 0; p < a; p++) u.push(n);
9263
- const F = Array.isArray(t) ? t : t.split(`
9264
- `);
9265
- if (F.length > 0) {
9266
- const [p, ...E] = F;
9267
- p.length > 0 ? u.push(`${c}${p}`) : u.push(l ? r : "");
9268
- for (const $ of E) $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
9269
- }
9270
- i.write(`${u.join(`
9271
- `)}
9272
- `);
9273
- },
9274
- info: (t, r) => {
9275
- R.message(t, {
9276
- ...r,
9277
- symbol: import_picocolors.default.blue(ft)
9278
- });
9279
- },
9280
- success: (t, r) => {
9281
- R.message(t, {
9282
- ...r,
9283
- symbol: import_picocolors.default.green(Ft)
9284
- });
9285
- },
9286
- step: (t, r) => {
9287
- R.message(t, {
9288
- ...r,
9289
- symbol: import_picocolors.default.green(V)
9290
- });
9291
- },
9292
- warn: (t, r) => {
9293
- R.message(t, {
9294
- ...r,
9295
- symbol: import_picocolors.default.yellow(yt)
9296
- });
9297
- },
9298
- warning: (t, r) => {
9299
- R.warn(t, r);
9300
- },
9301
- error: (t, r) => {
9302
- R.message(t, {
9303
- ...r,
9304
- symbol: import_picocolors.default.red(Et)
9305
- });
9306
- }
9307
- }, Ne = (t = "", r) => {
9308
- (r?.output ?? process.stdout).write(`${import_picocolors.default.gray(x)} ${import_picocolors.default.red(t)}
9309
-
9310
- `);
9311
- }, We = (t = "", r) => {
9312
- (r?.output ?? process.stdout).write(`${import_picocolors.default.gray(ht)} ${t}
9313
- `);
9314
- }, Le = (t = "", r) => {
9315
- (r?.output ?? process.stdout).write(`${import_picocolors.default.gray(d)}
9316
- ${import_picocolors.default.gray(x)} ${t}
9317
-
9318
- `);
9319
- }, Z = (t, r) => t.split(`
9320
- `).map((s) => r(s)).join(`
9321
- `), je = (t) => {
9322
- const r = (i, a) => {
9323
- const o = i.label ?? String(i.value);
9324
- return a === "disabled" ? `${import_picocolors.default.gray(q)} ${Z(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.gray(u)))}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${import_picocolors.default.cyan(st)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "selected" ? `${import_picocolors.default.green(U)} ${Z(o, import_picocolors.default.dim)}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Z(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.dim(u)))}` : a === "active-selected" ? `${import_picocolors.default.green(U)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "submitted" ? `${Z(o, import_picocolors.default.dim)}` : `${import_picocolors.default.dim(q)} ${Z(o, import_picocolors.default.dim)}`;
9325
- }, s = t.required ?? !0;
9326
- return new Lt$1({
9327
- options: t.options,
9328
- signal: t.signal,
9329
- input: t.input,
9330
- output: t.output,
9331
- initialValues: t.initialValues,
9332
- required: s,
9333
- cursorAt: t.cursorAt,
9334
- validate(i) {
9335
- if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
9336
- ${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
9337
- },
9338
- render() {
9339
- const i = xt(t.output, t.message, `${vt(this.state)} `, `${W(this.state)} `), a = `${import_picocolors.default.gray(d)}
9340
- ${i}
9341
- `, o = this.value ?? [], u = (l, n) => {
9342
- if (l.disabled) return r(l, "disabled");
9343
- const c = o.includes(l.value);
9344
- return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
9345
- };
9346
- switch (this.state) {
9347
- case "submit": {
9348
- const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none");
9349
- return `${a}${xt(t.output, l, `${import_picocolors.default.gray(d)} `)}`;
9350
- }
9351
- case "cancel": {
9352
- const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(import_picocolors.default.dim(", "));
9353
- if (l.trim() === "") return `${a}${import_picocolors.default.gray(d)}`;
9354
- return `${a}${xt(t.output, l, `${import_picocolors.default.gray(d)} `)}
9355
- ${import_picocolors.default.gray(d)}`;
9356
- }
9357
- case "error": {
9358
- const l = `${import_picocolors.default.yellow(d)} `, n = this.error.split(`
9359
- `).map((F, p) => p === 0 ? `${import_picocolors.default.yellow(x)} ${import_picocolors.default.yellow(F)}` : ` ${F}`).join(`
9360
- `), c = a.split(`
9361
- `).length, g = n.split(`
9362
- `).length + 1;
9363
- return `${a}${l}${X({
9364
- output: t.output,
9365
- options: this.options,
9366
- cursor: this.cursor,
9367
- maxItems: t.maxItems,
9368
- columnPadding: l.length,
9369
- rowPadding: c + g,
9370
- style: u
9371
- }).join(`
9372
- ${l}`)}
9373
- ${n}
9374
- `;
9375
- }
9376
- default: {
9377
- const l = `${import_picocolors.default.cyan(d)} `, n = a.split(`
9378
- `).length;
9379
- return `${a}${l}${X({
9380
- output: t.output,
9381
- options: this.options,
9382
- cursor: this.cursor,
9383
- maxItems: t.maxItems,
9384
- columnPadding: l.length,
9385
- rowPadding: n + 2,
9386
- style: u
9387
- }).join(`
9388
- ${l}`)}
9389
- ${import_picocolors.default.cyan(x)}
9390
- `;
9391
- }
9392
- }
9393
- }
9394
- }).prompt();
9395
- }, Ge = (t) => import_picocolors.default.dim(t), ke = (t, r, s) => {
9396
- const i = {
9397
- hard: !0,
9398
- trim: !1
9399
- }, a = J(t, r, i).split(`
9400
- `), o = a.reduce((n, c) => Math.max(M(c), n), 0);
9401
- return J(t, r - (a.map(s).reduce((n, c) => Math.max(M(c), n), 0) - o), i);
9402
- }, Ve = (t = "", r = "", s) => {
9403
- const i = s?.output ?? N.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = [
9404
- "",
9405
- ...ke(t, rt$1(i) - 6, o).split(`
9406
- `).map(o),
9407
- ""
9408
- ], l = M(r), n = Math.max(u.reduce((p, E) => {
9409
- const $ = M(E);
9410
- return $ > p ? $ : p;
9411
- }, 0), l) + 2, c = u.map((p) => `${import_picocolors.default.gray(d)} ${p}${" ".repeat(n - M(p))}${import_picocolors.default.gray(d)}`).join(`
9412
- `), g = a ? `${import_picocolors.default.gray(d)}
9413
- ` : "", F = a ? Wt : gt;
9414
- i.write(`${g}${import_picocolors.default.green(V)} ${import_picocolors.default.reset(r)} ${import_picocolors.default.gray(rt.repeat(Math.max(n - l - 1, 1)) + mt)}
9415
- ${c}
9416
- ${import_picocolors.default.gray(F + rt.repeat(n + 2) + pt)}
9417
- `);
9418
- }, He = (t) => new Mt$1({
9419
- validate: t.validate,
9420
- mask: t.mask ?? Nt,
9421
- signal: t.signal,
9422
- input: t.input,
9423
- output: t.output,
9424
- render() {
9425
- const r = t.withGuide ?? _.withGuide, s = `${r ? `${import_picocolors.default.gray(d)}
9426
- ` : ""}${W(this.state)} ${t.message}
9427
- `, i = this.userInputWithCursor, a = this.masked;
9428
- switch (this.state) {
9429
- case "error": {
9430
- const o = r ? `${import_picocolors.default.yellow(d)} ` : "", u = r ? `${import_picocolors.default.yellow(x)} ` : "", l = a ?? "";
9431
- return t.clearOnError && this.clear(), `${s.trim()}
9432
- ${o}${l}
9433
- ${u}${import_picocolors.default.yellow(this.error)}
9434
- `;
9435
- }
9436
- case "submit": return `${s}${r ? `${import_picocolors.default.gray(d)} ` : ""}${a ? import_picocolors.default.dim(a) : ""}`;
9437
- case "cancel": return `${s}${r ? `${import_picocolors.default.gray(d)} ` : ""}${a ? import_picocolors.default.strikethrough(import_picocolors.default.dim(a)) : ""}${a && r ? `
9438
- ${import_picocolors.default.gray(d)}` : ""}`;
9439
- default: return `${s}${r ? `${import_picocolors.default.cyan(d)} ` : ""}${i}
9440
- ${r ? import_picocolors.default.cyan(x) : ""}
9441
- `;
9442
- }
9443
- }
9444
- }).prompt(), Ue = (t) => {
9445
- const r = t.validate;
9446
- return Xt({
9447
- ...t,
9448
- initialUserInput: t.initialValue ?? t.root ?? process.cwd(),
9449
- maxItems: 5,
9450
- validate(s) {
9451
- if (!Array.isArray(s)) {
9452
- if (!s) return "Please select a path";
9453
- if (r) return r(s);
9454
- }
9455
- },
9456
- options() {
9457
- const s = this.userInput;
9458
- if (s === "") return [];
9459
- try {
9460
- let i;
9461
- return existsSync(s) ? lstatSync(s).isDirectory() ? i = s : i = dirname(s) : i = dirname(s), readdirSync(i).map((a) => {
9462
- const o = join(i, a);
9463
- return {
9464
- name: a,
9465
- path: o,
9466
- isDirectory: lstatSync(o).isDirectory()
9467
- };
9468
- }).filter(({ path: a, isDirectory: o }) => a.startsWith(s) && (t.directory || !o)).map((a) => ({ value: a.path }));
9469
- } catch {
9470
- return [];
9471
- }
9472
- }
9473
- });
9474
- }, Ke = import_picocolors.default.magenta, bt = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et ? [
9475
- "◒",
9476
- "◐",
9477
- "◓",
9478
- "◑"
9479
- ] : [
9480
- "•",
9481
- "o",
9482
- "O",
9483
- "0"
9484
- ], delay: u = et ? 80 : 120, signal: l, ...n } = {}) => {
9485
- const c = ct();
9486
- let g, F, p = !1, E = !1, $ = "", m, h = performance.now();
9487
- const y = rt$1(s), f = n?.styleFrame ?? Ke, v = (b) => {
9488
- const O = b > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
9489
- E = b === 1, p && (L(O, b), E && typeof r == "function" && r());
9490
- }, S = () => v(2), I = () => v(1), B = () => {
9491
- process.on("uncaughtExceptionMonitor", S), process.on("unhandledRejection", S), process.on("SIGINT", I), process.on("SIGTERM", I), process.on("exit", v), l && l.addEventListener("abort", I);
9492
- }, A = () => {
9493
- process.removeListener("uncaughtExceptionMonitor", S), process.removeListener("unhandledRejection", S), process.removeListener("SIGINT", I), process.removeListener("SIGTERM", I), process.removeListener("exit", v), l && l.removeEventListener("abort", I);
9494
- }, w = () => {
9495
- if (m === void 0) return;
9496
- c && s.write(`
9497
- `);
9498
- const b = J(m, y, {
9499
- hard: !0,
9500
- trim: !1
9501
- }).split(`
9502
- `);
9503
- b.length > 1 && s.write(import_src.cursor.up(b.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
9504
- }, _$2 = (b) => b.replace(/\.+$/, ""), D = (b) => {
9505
- const O = (performance.now() - b) / 1e3, j = Math.floor(O / 60), G = Math.floor(O % 60);
9506
- return j > 0 ? `[${j}m ${G}s]` : `[${G}s]`;
9507
- }, T = n.withGuide ?? _.withGuide, Y = (b = "") => {
9508
- p = !0, g = Bt({ output: s }), $ = _$2(b), h = performance.now(), T && s.write(`${import_picocolors.default.gray(d)}
9509
- `);
9510
- let O = 0, j = 0;
9511
- B(), F = setInterval(() => {
9512
- if (c && $ === m) return;
9513
- w(), m = $;
9514
- const G = f(o[O]);
9515
- let tt;
9516
- if (c) tt = `${G} ${$}...`;
9517
- else if (t === "timer") tt = `${G} ${$} ${D(h)}`;
9518
- else {
9519
- const te = ".".repeat(Math.floor(j)).slice(0, 3);
9520
- tt = `${G} ${$}${te}`;
9521
- }
9522
- const Zt = J(tt, y, {
9523
- hard: !0,
9524
- trim: !1
9525
- });
9526
- s.write(Zt), O = O + 1 < o.length ? O + 1 : 0, j = j < 4 ? j + .125 : 0;
9527
- }, u);
9528
- }, L = (b = "", O = 0, j = !1) => {
9529
- if (!p) return;
9530
- p = !1, clearInterval(F), w();
9531
- const G = O === 0 ? import_picocolors.default.green(V) : O === 1 ? import_picocolors.default.red(dt) : import_picocolors.default.red($t);
9532
- $ = b ?? $, j || (t === "timer" ? s.write(`${G} ${$} ${D(h)}
9533
- `) : s.write(`${G} ${$}
9534
- `)), A(), g();
9535
- };
9536
- return {
9537
- start: Y,
9538
- stop: (b = "") => L(b, 0),
9539
- message: (b = "") => {
9540
- $ = _$2(b ?? $);
9541
- },
9542
- cancel: (b = "") => L(b, 1),
9543
- error: (b = "") => L(b, 2),
9544
- clear: () => L("", 0, !0),
9545
- get isCancelled() {
9546
- return E;
9547
- }
9548
- };
9549
- }, zt = {
9550
- light: C("─", "-"),
9551
- heavy: C("━", "="),
9552
- block: C("█", "#")
9553
- };
9554
- const lt = (t, r) => t.includes(`
9555
- `) ? t.split(`
9556
- `).map((s) => r(s)).join(`
9557
- `) : r(t), Je = (t) => {
9558
- const r = (s, i) => {
9559
- const a = s.label ?? String(s.value);
9560
- switch (i) {
9561
- case "disabled": return `${import_picocolors.default.gray(H)} ${lt(a, import_picocolors.default.gray)}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
9562
- case "selected": return `${lt(a, import_picocolors.default.dim)}`;
9563
- case "active": return `${import_picocolors.default.green(Q)} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
9564
- case "cancelled": return `${lt(a, (o) => import_picocolors.default.strikethrough(import_picocolors.default.dim(o)))}`;
9565
- default: return `${import_picocolors.default.dim(H)} ${lt(a, import_picocolors.default.dim)}`;
9566
- }
9567
- };
9568
- return new Wt$1({
9569
- options: t.options,
9570
- signal: t.signal,
9571
- input: t.input,
9572
- output: t.output,
9573
- initialValue: t.initialValue,
9574
- render() {
9575
- const s = t.withGuide ?? _.withGuide, i = `${W(this.state)} `, a = `${vt(this.state)} `, o = xt(t.output, t.message, a, i), u = `${s ? `${import_picocolors.default.gray(d)}
9576
- ` : ""}${o}
9577
- `;
9578
- switch (this.state) {
9579
- case "submit": {
9580
- const l = s ? `${import_picocolors.default.gray(d)} ` : "";
9581
- return `${u}${xt(t.output, r(this.options[this.cursor], "selected"), l)}`;
9582
- }
9583
- case "cancel": {
9584
- const l = s ? `${import_picocolors.default.gray(d)} ` : "";
9585
- return `${u}${xt(t.output, r(this.options[this.cursor], "cancelled"), l)}${s ? `
9586
- ${import_picocolors.default.gray(d)}` : ""}`;
9587
- }
9588
- default: {
9589
- const l = s ? `${import_picocolors.default.cyan(d)} ` : "", n = s ? import_picocolors.default.cyan(x) : "", c = u.split(`
9590
- `).length, g = s ? 2 : 1;
9591
- return `${u}${l}${X({
9592
- output: t.output,
9593
- cursor: this.cursor,
9594
- options: this.options,
9595
- maxItems: t.maxItems,
9596
- columnPadding: l.length,
9597
- rowPadding: c + g,
9598
- style: (F, p) => r(F, F.disabled ? "disabled" : p ? "active" : "inactive")
9599
- }).join(`
9600
- ${l}`)}
9601
- ${n}
9602
- `;
9603
- }
9604
- }
9605
- }
9606
- }).prompt();
9607
- }, Xe = (t) => {
9608
- const r = (s, i = "inactive") => {
9609
- const a = s.label ?? String(s.value);
9610
- return i === "selected" ? `${import_picocolors.default.dim(a)}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}` : i === "active" ? `${import_picocolors.default.bgCyan(import_picocolors.default.gray(` ${s.value} `))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${s.value} `)))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
9611
- };
9612
- return new Tt$1({
9613
- options: t.options,
9614
- signal: t.signal,
9615
- input: t.input,
9616
- output: t.output,
9617
- initialValue: t.initialValue,
9618
- caseSensitive: t.caseSensitive,
9619
- render() {
9620
- const s = t.withGuide ?? _.withGuide, i = `${s ? `${import_picocolors.default.gray(d)}
9621
- ` : ""}${W(this.state)} ${t.message}
9622
- `;
9623
- switch (this.state) {
9624
- case "submit": {
9625
- const a = s ? `${import_picocolors.default.gray(d)} ` : "", o = this.options.find((l) => l.value === this.value) ?? t.options[0];
9626
- return `${i}${xt(t.output, r(o, "selected"), a)}`;
9627
- }
9628
- case "cancel": {
9629
- const a = s ? `${import_picocolors.default.gray(d)} ` : "";
9630
- return `${i}${xt(t.output, r(this.options[0], "cancelled"), a)}${s ? `
9631
- ${import_picocolors.default.gray(d)}` : ""}`;
9632
- }
9633
- default: {
9634
- const a = s ? `${import_picocolors.default.cyan(d)} ` : "", o = s ? import_picocolors.default.cyan(x) : "";
9635
- return `${i}${this.options.map((l, n) => xt(t.output, r(l, n === this.cursor ? "active" : "inactive"), a)).join(`
9636
- `)}
9637
- ${o}
9638
- `;
9639
- }
9640
- }
9641
- }
9642
- }).prompt();
9643
- }, Qt = `${import_picocolors.default.gray(d)} `, K = {
9644
- message: async (t, { symbol: r = import_picocolors.default.gray(d) } = {}) => {
9645
- process.stdout.write(`${import_picocolors.default.gray(d)}
9646
- ${r} `);
9647
- let s = 3;
9648
- for await (let i of t) {
9649
- i = i.replace(/\n/g, `
9650
- ${Qt}`), i.includes(`
9651
- `) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
9652
- `))).length);
9653
- const a = stripVTControlCharacters(i).length;
9654
- s + a < process.stdout.columns ? (s += a, process.stdout.write(i)) : (process.stdout.write(`
9655
- ${Qt}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
9656
- }
9657
- process.stdout.write(`
9658
- `);
9659
- },
9660
- info: (t) => K.message(t, { symbol: import_picocolors.default.blue(ft) }),
9661
- success: (t) => K.message(t, { symbol: import_picocolors.default.green(Ft) }),
9662
- step: (t) => K.message(t, { symbol: import_picocolors.default.green(V) }),
9663
- warn: (t) => K.message(t, { symbol: import_picocolors.default.yellow(yt) }),
9664
- warning: (t) => K.warn(t),
9665
- error: (t) => K.message(t, { symbol: import_picocolors.default.red(Et) })
9666
- }, Ye = async (t, r) => {
9667
- for (const s of t) {
9668
- if (s.enabled === !1) continue;
9669
- const i = bt(r);
9670
- i.start(s.title);
9671
- const a = await s.task(i.message);
9672
- i.stop(a || s.title);
9673
- }
9674
- }, ze = (t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), Qe = (t) => {
9675
- const r = t.output ?? process.stdout, s = rt$1(r), i = import_picocolors.default.gray(d), a = t.spacing ?? 1, o = 3, u = t.retainLog === !0, l = !ct() && Mt(r);
9676
- r.write(`${i}
9677
- `), r.write(`${import_picocolors.default.green(V)} ${t.title}
9678
- `);
9679
- for (let h = 0; h < a; h++) r.write(`${i}
9680
- `);
9681
- const n = [{
9682
- value: "",
9683
- full: ""
9684
- }];
9685
- let c = !1;
9686
- const g = (h) => {
9687
- if (n.length === 0) return;
9688
- let y = 0;
9689
- h && (y += a + 2);
9690
- for (const f of n) {
9691
- const { value: v, result: S } = f;
9692
- let I = S?.message ?? v;
9693
- if (I.length === 0) continue;
9694
- S === void 0 && f.header !== void 0 && f.header !== "" && (I += `
9695
- ${f.header}`);
9696
- const B = I.split(`
9697
- `).reduce((A, w) => w === "" ? A + 1 : A + Math.ceil((w.length + o) / s), 0);
9698
- y += B;
9699
- }
9700
- y > 0 && (y += 1, r.write(import_src.erase.lines(y)));
9701
- }, F = (h, y, f) => {
9702
- const v = f ? `${h.full}
9703
- ${h.value}` : h.value;
9704
- h.header !== void 0 && h.header !== "" && R.message(h.header.split(`
9705
- `).map(import_picocolors.default.bold), {
9706
- output: r,
9707
- secondarySymbol: i,
9708
- symbol: i,
9709
- spacing: 0
9710
- }), R.message(v.split(`
9711
- `).map(import_picocolors.default.dim), {
9712
- output: r,
9713
- secondarySymbol: i,
9714
- symbol: i,
9715
- spacing: y ?? a
9716
- });
9717
- }, p = () => {
9718
- for (const h of n) {
9719
- const { header: y, value: f, full: v } = h;
9720
- (y === void 0 || y.length === 0) && f.length === 0 || F(h, void 0, u === !0 && v.length > 0);
9721
- }
9722
- }, E = (h, y, f) => {
9723
- if (g(!1), (f?.raw !== !0 || !c) && h.value !== "" && (h.value += `
9724
- `), h.value += ze(y), c = f?.raw === !0, t.limit !== void 0) {
9725
- const v = h.value.split(`
9726
- `), S = v.length - t.limit;
9727
- if (S > 0) {
9728
- const I = v.splice(0, S);
9729
- u && (h.full += (h.full === "" ? "" : `
9730
- `) + I.join(`
9731
- `));
9732
- }
9733
- h.value = v.join(`
9734
- `);
9735
- }
9736
- l && $();
9737
- }, $ = () => {
9738
- for (const h of n) h.result ? h.result.status === "error" ? R.error(h.result.message, {
9739
- output: r,
9740
- secondarySymbol: i,
9741
- spacing: 0
9742
- }) : R.success(h.result.message, {
9743
- output: r,
9744
- secondarySymbol: i,
9745
- spacing: 0
9746
- }) : h.value !== "" && F(h, 0);
9747
- }, m = (h, y) => {
9748
- g(!1), h.result = y, l && $();
9749
- };
9750
- return {
9751
- message(h, y) {
9752
- E(n[0], h, y);
9753
- },
9754
- group(h) {
9755
- const y = {
9756
- header: h,
9757
- value: "",
9758
- full: ""
9759
- };
9760
- return n.push(y), {
9761
- message(f, v) {
9762
- E(y, f, v);
9763
- },
9764
- error(f) {
9765
- m(y, {
9766
- status: "error",
9767
- message: f
9768
- });
9769
- },
9770
- success(f) {
9771
- m(y, {
9772
- status: "success",
9773
- message: f
9774
- });
9775
- }
9776
- };
9777
- },
9778
- error(h, y) {
9779
- g(!0), R.error(h, {
9780
- output: r,
9781
- secondarySymbol: i,
9782
- spacing: 1
9783
- }), y?.showLog !== !1 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
9784
- },
9785
- success(h, y) {
9786
- g(!0), R.success(h, {
9787
- output: r,
9788
- secondarySymbol: i,
9789
- spacing: 1
9790
- }), y?.showLog === !0 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
9791
- }
9792
- };
9793
- }, Ze = (t) => new $t$1({
9794
- validate: t.validate,
9795
- placeholder: t.placeholder,
9796
- defaultValue: t.defaultValue,
9797
- initialValue: t.initialValue,
9798
- output: t.output,
9799
- signal: t.signal,
9800
- input: t.input,
9801
- render() {
9802
- const r = t?.withGuide ?? _.withGuide, s = `${`${r ? `${import_picocolors.default.gray(d)}
9803
- ` : ""}${W(this.state)} `}${t.message}
9804
- `, i = t.placeholder ? import_picocolors.default.inverse(t.placeholder[0]) + import_picocolors.default.dim(t.placeholder.slice(1)) : import_picocolors.default.inverse(import_picocolors.default.hidden("_")), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
9805
- switch (this.state) {
9806
- case "error": {
9807
- const u = this.error ? ` ${import_picocolors.default.yellow(this.error)}` : "", l = r ? `${import_picocolors.default.yellow(d)} ` : "", n = r ? import_picocolors.default.yellow(x) : "";
9808
- return `${s.trim()}
9809
- ${l}${a}
9810
- ${n}${u}
9811
- `;
9812
- }
9813
- case "submit": {
9814
- const u = o ? ` ${import_picocolors.default.dim(o)}` : "";
9815
- return `${s}${r ? import_picocolors.default.gray(d) : ""}${u}`;
9816
- }
9817
- case "cancel": {
9818
- const u = o ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(o))}` : "", l = r ? import_picocolors.default.gray(d) : "";
9819
- return `${s}${l}${u}${o.trim() ? `
9820
- ${l}` : ""}`;
9821
- }
9822
- default: return `${s}${r ? `${import_picocolors.default.cyan(d)} ` : ""}${a}
9823
- ${r ? import_picocolors.default.cyan(x) : ""}
9824
- `;
9825
- }
9826
- }
9827
- }).prompt();
9828
-
9829
- //#endregion
9830
- //#region src/utils/context-detection.ts
9831
- /**
9832
- * Check if the current directory is a source repository
9833
- * A source repository contains a baton.source.yaml file in the root
9834
- * @param cwd - Current working directory (defaults to process.cwd())
9835
- * @returns true if baton.source.yaml exists in cwd, false otherwise
9836
- */
9837
- async function isInSourceRepo(cwd = process.cwd()) {
9838
- const manifestPath = join(cwd, "baton.source.yaml");
9839
- try {
9840
- await access(manifestPath);
9841
- return true;
9842
- } catch {
9843
- return false;
9844
- }
9845
- }
9846
- /**
9847
- * Find the source repository root by searching upwards from cwd
9848
- * Checks the current directory and all parent directories for baton.source.yaml
9849
- * @param cwd - Starting directory (defaults to process.cwd())
9850
- * @param options.fallbackToStart - If true, return cwd instead of null when not found
9851
- * @returns The absolute path to the source root, or null (or cwd) if not found
9852
- */
9853
- async function findSourceRoot(cwd = process.cwd(), options) {
9854
- let current = cwd;
9855
- while (true) {
9856
- const manifestPath = join(current, "baton.source.yaml");
9857
- try {
9858
- await access(manifestPath);
9859
- return current;
9860
- } catch {
9861
- const parent = dirname(current);
9862
- if (parent === current) return options?.fallbackToStart ? cwd : null;
9863
- current = parent;
9864
- }
9865
- }
9866
- }
9867
-
9868
- //#endregion
9869
- export { __commonJSMin as _, Ne as a, Ve as c, bt as d, je as f, runMain as g, defineCommand as h, Le as i, We as l, require_dist as m, isInSourceRepo as n, R as o, Ct$1 as p, Je as r, Re as s, findSourceRoot as t, Ze as u, __require as v, __toESM as y };
9870
- //# sourceMappingURL=context-detection-CGh_5f6N.mjs.map
6683
+ export { __toESM as i, __commonJSMin as n, __require as r, require_dist as t };
6684
+ //# sourceMappingURL=dist-BoZnMvNi.mjs.map