@nestjs-ssr/react 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/init.js CHANGED
@@ -1,2438 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var util = require('util');
5
- var g = require('process');
6
- var f = require('readline');
7
- var tty = require('tty');
8
4
  var fs = require('fs');
9
5
  var path = require('path');
10
6
  var url = require('url');
11
7
  var child_process = require('child_process');
8
+ var consola = require('consola');
9
+ var citty = require('citty');
12
10
 
13
11
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
14
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
-
16
- function _interopNamespace(e) {
17
- if (e && e.__esModule) return e;
18
- var n = Object.create(null);
19
- if (e) {
20
- Object.keys(e).forEach(function (k) {
21
- if (k !== 'default') {
22
- var d = Object.getOwnPropertyDescriptor(e, k);
23
- Object.defineProperty(n, k, d.get ? d : {
24
- enumerable: true,
25
- get: function () { return e[k]; }
26
- });
27
- }
28
- });
29
- }
30
- n.default = e;
31
- return Object.freeze(n);
32
- }
33
-
34
- var g__default = /*#__PURE__*/_interopDefault(g);
35
- var f__default = /*#__PURE__*/_interopDefault(f);
36
- var tty__namespace = /*#__PURE__*/_interopNamespace(tty);
37
-
38
- var __defProp = Object.defineProperty;
39
- var __getOwnPropNames = Object.getOwnPropertyNames;
40
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
41
- var __esm = (fn, res) => function __init() {
42
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
43
- };
44
- var __export = (target, all) => {
45
- for (var name in all)
46
- __defProp(target, name, { get: all[name], enumerable: true });
47
- };
48
-
49
- // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
50
- var prompt_exports = {};
51
- __export(prompt_exports, {
52
- kCancel: () => kCancel,
53
- prompt: () => prompt
54
- });
55
- function getDefaultExportFromCjs(x2) {
56
- return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
57
- }
58
- function requireSrc() {
59
- if (hasRequiredSrc) return src;
60
- hasRequiredSrc = 1;
61
- const ESC = "\x1B";
62
- const CSI = `${ESC}[`;
63
- const beep = "\x07";
64
- const cursor = {
65
- to(x2, y3) {
66
- if (!y3) return `${CSI}${x2 + 1}G`;
67
- return `${CSI}${y3 + 1};${x2 + 1}H`;
68
- },
69
- move(x2, y3) {
70
- let ret = "";
71
- if (x2 < 0) ret += `${CSI}${-x2}D`;
72
- else if (x2 > 0) ret += `${CSI}${x2}C`;
73
- if (y3 < 0) ret += `${CSI}${-y3}A`;
74
- else if (y3 > 0) ret += `${CSI}${y3}B`;
75
- return ret;
76
- },
77
- up: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}A`, "up"),
78
- down: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}B`, "down"),
79
- forward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}C`, "forward"),
80
- backward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}D`, "backward"),
81
- nextLine: /* @__PURE__ */ __name((count = 1) => `${CSI}E`.repeat(count), "nextLine"),
82
- prevLine: /* @__PURE__ */ __name((count = 1) => `${CSI}F`.repeat(count), "prevLine"),
83
- left: `${CSI}G`,
84
- hide: `${CSI}?25l`,
85
- show: `${CSI}?25h`,
86
- save: `${ESC}7`,
87
- restore: `${ESC}8`
88
- };
89
- const scroll = {
90
- up: /* @__PURE__ */ __name((count = 1) => `${CSI}S`.repeat(count), "up"),
91
- down: /* @__PURE__ */ __name((count = 1) => `${CSI}T`.repeat(count), "down")
92
- };
93
- const erase = {
94
- screen: `${CSI}2J`,
95
- up: /* @__PURE__ */ __name((count = 1) => `${CSI}1J`.repeat(count), "up"),
96
- down: /* @__PURE__ */ __name((count = 1) => `${CSI}J`.repeat(count), "down"),
97
- line: `${CSI}2K`,
98
- lineEnd: `${CSI}K`,
99
- lineStart: `${CSI}1K`,
100
- lines(count) {
101
- let clear = "";
102
- for (let i2 = 0; i2 < count; i2++)
103
- clear += this.line + (i2 < count - 1 ? cursor.up() : "");
104
- if (count)
105
- clear += cursor.left;
106
- return clear;
107
- }
108
- };
109
- src = { cursor, scroll, erase, beep };
110
- return src;
111
- }
112
- function requirePicocolors() {
113
- if (hasRequiredPicocolors) return picocolors.exports;
114
- hasRequiredPicocolors = 1;
115
- let p = process || {}, argv2 = p.argv || [], env2 = p.env || {};
116
- let isColorSupported2 = !(!!env2.NO_COLOR || argv2.includes("--no-color")) && (!!env2.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
117
- let formatter = /* @__PURE__ */ __name((open, close, replace = open) => (input) => {
118
- let string = "" + input, index = string.indexOf(close, open.length);
119
- return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
120
- }, "formatter");
121
- let replaceClose2 = /* @__PURE__ */ __name((string, close, replace, index) => {
122
- let result = "", cursor = 0;
123
- do {
124
- result += string.substring(cursor, index) + replace;
125
- cursor = index + close.length;
126
- index = string.indexOf(close, cursor);
127
- } while (~index);
128
- return result + string.substring(cursor);
129
- }, "replaceClose");
130
- let createColors2 = /* @__PURE__ */ __name((enabled = isColorSupported2) => {
131
- let f3 = enabled ? formatter : () => String;
132
- return {
133
- isColorSupported: enabled,
134
- reset: f3("\x1B[0m", "\x1B[0m"),
135
- bold: f3("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
136
- dim: f3("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
137
- italic: f3("\x1B[3m", "\x1B[23m"),
138
- underline: f3("\x1B[4m", "\x1B[24m"),
139
- inverse: f3("\x1B[7m", "\x1B[27m"),
140
- hidden: f3("\x1B[8m", "\x1B[28m"),
141
- strikethrough: f3("\x1B[9m", "\x1B[29m"),
142
- black: f3("\x1B[30m", "\x1B[39m"),
143
- red: f3("\x1B[31m", "\x1B[39m"),
144
- green: f3("\x1B[32m", "\x1B[39m"),
145
- yellow: f3("\x1B[33m", "\x1B[39m"),
146
- blue: f3("\x1B[34m", "\x1B[39m"),
147
- magenta: f3("\x1B[35m", "\x1B[39m"),
148
- cyan: f3("\x1B[36m", "\x1B[39m"),
149
- white: f3("\x1B[37m", "\x1B[39m"),
150
- gray: f3("\x1B[90m", "\x1B[39m"),
151
- bgBlack: f3("\x1B[40m", "\x1B[49m"),
152
- bgRed: f3("\x1B[41m", "\x1B[49m"),
153
- bgGreen: f3("\x1B[42m", "\x1B[49m"),
154
- bgYellow: f3("\x1B[43m", "\x1B[49m"),
155
- bgBlue: f3("\x1B[44m", "\x1B[49m"),
156
- bgMagenta: f3("\x1B[45m", "\x1B[49m"),
157
- bgCyan: f3("\x1B[46m", "\x1B[49m"),
158
- bgWhite: f3("\x1B[47m", "\x1B[49m"),
159
- blackBright: f3("\x1B[90m", "\x1B[39m"),
160
- redBright: f3("\x1B[91m", "\x1B[39m"),
161
- greenBright: f3("\x1B[92m", "\x1B[39m"),
162
- yellowBright: f3("\x1B[93m", "\x1B[39m"),
163
- blueBright: f3("\x1B[94m", "\x1B[39m"),
164
- magentaBright: f3("\x1B[95m", "\x1B[39m"),
165
- cyanBright: f3("\x1B[96m", "\x1B[39m"),
166
- whiteBright: f3("\x1B[97m", "\x1B[39m"),
167
- bgBlackBright: f3("\x1B[100m", "\x1B[49m"),
168
- bgRedBright: f3("\x1B[101m", "\x1B[49m"),
169
- bgGreenBright: f3("\x1B[102m", "\x1B[49m"),
170
- bgYellowBright: f3("\x1B[103m", "\x1B[49m"),
171
- bgBlueBright: f3("\x1B[104m", "\x1B[49m"),
172
- bgMagentaBright: f3("\x1B[105m", "\x1B[49m"),
173
- bgCyanBright: f3("\x1B[106m", "\x1B[49m"),
174
- bgWhiteBright: f3("\x1B[107m", "\x1B[49m")
175
- };
176
- }, "createColors");
177
- picocolors.exports = createColors2();
178
- picocolors.exports.createColors = createColors2;
179
- return picocolors.exports;
180
- }
181
- function J({ onlyFirst: t2 = false } = {}) {
182
- const F3 = ["[\\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("|");
183
- return new RegExp(F3, t2 ? void 0 : "g");
184
- }
185
- function T$1(t2) {
186
- if (typeof t2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t2}\``);
187
- return t2.replace(Q, "");
188
- }
189
- function O(t2) {
190
- return t2 && t2.__esModule && Object.prototype.hasOwnProperty.call(t2, "default") ? t2.default : t2;
191
- }
192
- function A$1(t2, u3 = {}) {
193
- if (typeof t2 != "string" || t2.length === 0 || (u3 = { ambiguousIsNarrow: true, ...u3 }, t2 = T$1(t2), t2.length === 0)) return 0;
194
- t2 = t2.replace(FD(), " ");
195
- const F3 = u3.ambiguousIsNarrow ? 1 : 2;
196
- let e2 = 0;
197
- for (const s2 of t2) {
198
- const i2 = s2.codePointAt(0);
199
- if (i2 <= 31 || i2 >= 127 && i2 <= 159 || i2 >= 768 && i2 <= 879) continue;
200
- switch (DD.eastAsianWidth(s2)) {
201
- case "F":
202
- case "W":
203
- e2 += 2;
204
- break;
205
- case "A":
206
- e2 += F3;
207
- break;
208
- default:
209
- e2 += 1;
210
- }
211
- }
212
- return e2;
213
- }
214
- function sD() {
215
- const t2 = /* @__PURE__ */ new Map();
216
- for (const [u3, F3] of Object.entries(r)) {
217
- for (const [e2, s2] of Object.entries(F3)) r[e2] = { open: `\x1B[${s2[0]}m`, close: `\x1B[${s2[1]}m` }, F3[e2] = r[e2], t2.set(s2[0], s2[1]);
218
- Object.defineProperty(r, u3, { value: F3, enumerable: false });
219
- }
220
- return Object.defineProperty(r, "codes", { value: t2, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L$1(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L$1(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, { rgbToAnsi256: { value: /* @__PURE__ */ __name((u3, F3, e2) => u3 === F3 && F3 === e2 ? u3 < 8 ? 16 : u3 > 248 ? 231 : Math.round((u3 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u3 / 255 * 5) + 6 * Math.round(F3 / 255 * 5) + Math.round(e2 / 255 * 5), "value"), enumerable: false }, hexToRgb: { value: /* @__PURE__ */ __name((u3) => {
221
- const F3 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u3.toString(16));
222
- if (!F3) return [0, 0, 0];
223
- let [e2] = F3;
224
- e2.length === 3 && (e2 = [...e2].map((i2) => i2 + i2).join(""));
225
- const s2 = Number.parseInt(e2, 16);
226
- return [s2 >> 16 & 255, s2 >> 8 & 255, s2 & 255];
227
- }, "value"), enumerable: false }, hexToAnsi256: { value: /* @__PURE__ */ __name((u3) => r.rgbToAnsi256(...r.hexToRgb(u3)), "value"), enumerable: false }, ansi256ToAnsi: { value: /* @__PURE__ */ __name((u3) => {
228
- if (u3 < 8) return 30 + u3;
229
- if (u3 < 16) return 90 + (u3 - 8);
230
- let F3, e2, s2;
231
- if (u3 >= 232) F3 = ((u3 - 232) * 10 + 8) / 255, e2 = F3, s2 = F3;
232
- else {
233
- u3 -= 16;
234
- const C3 = u3 % 36;
235
- F3 = Math.floor(u3 / 36) / 5, e2 = Math.floor(C3 / 6) / 5, s2 = C3 % 6 / 5;
236
- }
237
- const i2 = Math.max(F3, e2, s2) * 2;
238
- if (i2 === 0) return 30;
239
- let D2 = 30 + (Math.round(s2) << 2 | Math.round(e2) << 1 | Math.round(F3));
240
- return i2 === 2 && (D2 += 60), D2;
241
- }, "value"), enumerable: false }, rgbToAnsi: { value: /* @__PURE__ */ __name((u3, F3, e2) => r.ansi256ToAnsi(r.rgbToAnsi256(u3, F3, e2)), "value"), enumerable: false }, hexToAnsi: { value: /* @__PURE__ */ __name((u3) => r.ansi256ToAnsi(r.hexToAnsi256(u3)), "value"), enumerable: false } }), r;
242
- }
243
- function G(t2, u3, F3) {
244
- return String(t2).normalize().replace(/\r\n/g, `
245
- `).split(`
246
- `).map((e2) => oD(e2, u3, F3)).join(`
247
- `);
248
- }
249
- function k$1(t2, u3) {
250
- if (typeof t2 == "string") return c.aliases.get(t2) === u3;
251
- for (const F3 of t2) if (F3 !== void 0 && k$1(F3, u3)) return true;
252
- return false;
253
- }
254
- function lD(t2, u3) {
255
- if (t2 === u3) return;
256
- const F3 = t2.split(`
257
- `), e2 = u3.split(`
258
- `), s2 = [];
259
- for (let i2 = 0; i2 < Math.max(F3.length, e2.length); i2++) F3[i2] !== e2[i2] && s2.push(i2);
260
- return s2;
261
- }
262
- function d$1(t2, u3) {
263
- const F3 = t2;
264
- F3.isTTY && F3.setRawMode(u3);
265
- }
266
- function ce() {
267
- return g__default.default.platform !== "win32" ? g__default.default.env.TERM !== "linux" : !!g__default.default.env.CI || !!g__default.default.env.WT_SESSION || !!g__default.default.env.TERMINUS_SUBLIME || g__default.default.env.ConEmuTask === "{cmd::Cmder}" || g__default.default.env.TERM_PROGRAM === "Terminus-Sublime" || g__default.default.env.TERM_PROGRAM === "vscode" || g__default.default.env.TERM === "xterm-256color" || g__default.default.env.TERM === "alacritty" || g__default.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
268
- }
269
- async function prompt(message, opts = {}) {
270
- const handleCancel = /* @__PURE__ */ __name((value) => {
271
- if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") {
272
- return value;
273
- }
274
- switch (opts.cancel) {
275
- case "reject": {
276
- const error = new Error("Prompt cancelled.");
277
- error.name = "ConsolaPromptCancelledError";
278
- if (Error.captureStackTrace) {
279
- Error.captureStackTrace(error, prompt);
280
- }
281
- throw error;
282
- }
283
- case "undefined": {
284
- return void 0;
285
- }
286
- case "null": {
287
- return null;
288
- }
289
- case "symbol": {
290
- return kCancel;
291
- }
292
- default:
293
- case "default": {
294
- return opts.default ?? opts.initial;
295
- }
296
- }
297
- }, "handleCancel");
298
- if (!opts.type || opts.type === "text") {
299
- return await he({
300
- message,
301
- defaultValue: opts.default,
302
- placeholder: opts.placeholder,
303
- initialValue: opts.initial
304
- }).then(handleCancel);
305
- }
306
- if (opts.type === "confirm") {
307
- return await ye({
308
- message,
309
- initialValue: opts.initial
310
- }).then(handleCancel);
311
- }
312
- if (opts.type === "select") {
313
- return await ve({
314
- message,
315
- options: opts.options.map(
316
- (o3) => typeof o3 === "string" ? { value: o3, label: o3 } : o3
317
- ),
318
- initialValue: opts.initial
319
- }).then(handleCancel);
320
- }
321
- if (opts.type === "multiselect") {
322
- return await fe({
323
- message,
324
- options: opts.options.map(
325
- (o3) => typeof o3 === "string" ? { value: o3, label: o3 } : o3
326
- ),
327
- required: opts.required,
328
- initialValues: opts.initial
329
- }).then(handleCancel);
330
- }
331
- throw new Error(`Unknown prompt type: ${opts.type}`);
332
- }
333
- var src, hasRequiredSrc, srcExports, picocolors, hasRequiredPicocolors, picocolorsExports, e, Q, P$1, X, DD, uD, FD, m, L$1, N, I, r, tD, eD, iD, v, CD, w$1, W$1, rD, R, y, V$1, z, ED, _, nD, oD, aD, c, S, AD, pD, h, x, fD, bD, mD, Y, wD, SD, $D, q, jD, PD, V, u, le, L, W, C, o, d, k, P, A, T, F, w, B, he, ye, ve, fe, kCancel;
334
- var init_prompt = __esm({
335
- "../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs"() {
336
- __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
337
- __name(requireSrc, "requireSrc");
338
- srcExports = requireSrc();
339
- picocolors = { exports: {} };
340
- __name(requirePicocolors, "requirePicocolors");
341
- picocolorsExports = /* @__PURE__ */ requirePicocolors();
342
- e = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
343
- __name(J, "J");
344
- Q = J();
345
- __name(T$1, "T$1");
346
- __name(O, "O");
347
- P$1 = { exports: {} };
348
- (function(t2) {
349
- var u3 = {};
350
- t2.exports = u3, u3.eastAsianWidth = function(e2) {
351
- var s2 = e2.charCodeAt(0), i2 = e2.length == 2 ? e2.charCodeAt(1) : 0, D2 = s2;
352
- return 55296 <= s2 && s2 <= 56319 && 56320 <= i2 && i2 <= 57343 && (s2 &= 1023, i2 &= 1023, D2 = s2 << 10 | i2, D2 += 65536), D2 == 12288 || 65281 <= D2 && D2 <= 65376 || 65504 <= D2 && D2 <= 65510 ? "F" : D2 == 8361 || 65377 <= D2 && D2 <= 65470 || 65474 <= D2 && D2 <= 65479 || 65482 <= D2 && D2 <= 65487 || 65490 <= D2 && D2 <= 65495 || 65498 <= D2 && D2 <= 65500 || 65512 <= D2 && D2 <= 65518 ? "H" : 4352 <= D2 && D2 <= 4447 || 4515 <= D2 && D2 <= 4519 || 4602 <= D2 && D2 <= 4607 || 9001 <= D2 && D2 <= 9002 || 11904 <= D2 && D2 <= 11929 || 11931 <= D2 && D2 <= 12019 || 12032 <= D2 && D2 <= 12245 || 12272 <= D2 && D2 <= 12283 || 12289 <= D2 && D2 <= 12350 || 12353 <= D2 && D2 <= 12438 || 12441 <= D2 && D2 <= 12543 || 12549 <= D2 && D2 <= 12589 || 12593 <= D2 && D2 <= 12686 || 12688 <= D2 && D2 <= 12730 || 12736 <= D2 && D2 <= 12771 || 12784 <= D2 && D2 <= 12830 || 12832 <= D2 && D2 <= 12871 || 12880 <= D2 && D2 <= 13054 || 13056 <= D2 && D2 <= 19903 || 19968 <= D2 && D2 <= 42124 || 42128 <= D2 && D2 <= 42182 || 43360 <= D2 && D2 <= 43388 || 44032 <= D2 && D2 <= 55203 || 55216 <= D2 && D2 <= 55238 || 55243 <= D2 && D2 <= 55291 || 63744 <= D2 && D2 <= 64255 || 65040 <= D2 && D2 <= 65049 || 65072 <= D2 && D2 <= 65106 || 65108 <= D2 && D2 <= 65126 || 65128 <= D2 && D2 <= 65131 || 110592 <= D2 && D2 <= 110593 || 127488 <= D2 && D2 <= 127490 || 127504 <= D2 && D2 <= 127546 || 127552 <= D2 && D2 <= 127560 || 127568 <= D2 && D2 <= 127569 || 131072 <= D2 && D2 <= 194367 || 177984 <= D2 && D2 <= 196605 || 196608 <= D2 && D2 <= 262141 ? "W" : 32 <= D2 && D2 <= 126 || 162 <= D2 && D2 <= 163 || 165 <= D2 && D2 <= 166 || D2 == 172 || D2 == 175 || 10214 <= D2 && D2 <= 10221 || 10629 <= D2 && D2 <= 10630 ? "Na" : D2 == 161 || D2 == 164 || 167 <= D2 && D2 <= 168 || D2 == 170 || 173 <= D2 && D2 <= 174 || 176 <= D2 && D2 <= 180 || 182 <= D2 && D2 <= 186 || 188 <= D2 && D2 <= 191 || D2 == 198 || D2 == 208 || 215 <= D2 && D2 <= 216 || 222 <= D2 && D2 <= 225 || D2 == 230 || 232 <= D2 && D2 <= 234 || 236 <= D2 && D2 <= 237 || D2 == 240 || 242 <= D2 && D2 <= 243 || 247 <= D2 && D2 <= 250 || D2 == 252 || D2 == 254 || D2 == 257 || D2 == 273 || D2 == 275 || D2 == 283 || 294 <= D2 && D2 <= 295 || D2 == 299 || 305 <= D2 && D2 <= 307 || D2 == 312 || 319 <= D2 && D2 <= 322 || D2 == 324 || 328 <= D2 && D2 <= 331 || D2 == 333 || 338 <= D2 && D2 <= 339 || 358 <= D2 && D2 <= 359 || D2 == 363 || D2 == 462 || D2 == 464 || D2 == 466 || D2 == 468 || D2 == 470 || D2 == 472 || D2 == 474 || D2 == 476 || D2 == 593 || D2 == 609 || D2 == 708 || D2 == 711 || 713 <= D2 && D2 <= 715 || D2 == 717 || D2 == 720 || 728 <= D2 && D2 <= 731 || D2 == 733 || D2 == 735 || 768 <= D2 && D2 <= 879 || 913 <= D2 && D2 <= 929 || 931 <= D2 && D2 <= 937 || 945 <= D2 && D2 <= 961 || 963 <= D2 && D2 <= 969 || D2 == 1025 || 1040 <= D2 && D2 <= 1103 || D2 == 1105 || D2 == 8208 || 8211 <= D2 && D2 <= 8214 || 8216 <= D2 && D2 <= 8217 || 8220 <= D2 && D2 <= 8221 || 8224 <= D2 && D2 <= 8226 || 8228 <= D2 && D2 <= 8231 || D2 == 8240 || 8242 <= D2 && D2 <= 8243 || D2 == 8245 || D2 == 8251 || D2 == 8254 || D2 == 8308 || D2 == 8319 || 8321 <= D2 && D2 <= 8324 || D2 == 8364 || D2 == 8451 || D2 == 8453 || D2 == 8457 || D2 == 8467 || D2 == 8470 || 8481 <= D2 && D2 <= 8482 || D2 == 8486 || D2 == 8491 || 8531 <= D2 && D2 <= 8532 || 8539 <= D2 && D2 <= 8542 || 8544 <= D2 && D2 <= 8555 || 8560 <= D2 && D2 <= 8569 || D2 == 8585 || 8592 <= D2 && D2 <= 8601 || 8632 <= D2 && D2 <= 8633 || D2 == 8658 || D2 == 8660 || D2 == 8679 || D2 == 8704 || 8706 <= D2 && D2 <= 8707 || 8711 <= D2 && D2 <= 8712 || D2 == 8715 || D2 == 8719 || D2 == 8721 || D2 == 8725 || D2 == 8730 || 8733 <= D2 && D2 <= 8736 || D2 == 8739 || D2 == 8741 || 8743 <= D2 && D2 <= 8748 || D2 == 8750 || 8756 <= D2 && D2 <= 8759 || 8764 <= D2 && D2 <= 8765 || D2 == 8776 || D2 == 8780 || D2 == 8786 || 8800 <= D2 && D2 <= 8801 || 8804 <= D2 && D2 <= 8807 || 8810 <= D2 && D2 <= 8811 || 8814 <= D2 && D2 <= 8815 || 8834 <= D2 && D2 <= 8835 || 8838 <= D2 && D2 <= 8839 || D2 == 8853 || D2 == 8857 || D2 == 8869 || D2 == 8895 || D2 == 8978 || 9312 <= D2 && D2 <= 9449 || 9451 <= D2 && D2 <= 9547 || 9552 <= D2 && D2 <= 9587 || 9600 <= D2 && D2 <= 9615 || 9618 <= D2 && D2 <= 9621 || 9632 <= D2 && D2 <= 9633 || 9635 <= D2 && D2 <= 9641 || 9650 <= D2 && D2 <= 9651 || 9654 <= D2 && D2 <= 9655 || 9660 <= D2 && D2 <= 9661 || 9664 <= D2 && D2 <= 9665 || 9670 <= D2 && D2 <= 9672 || D2 == 9675 || 9678 <= D2 && D2 <= 9681 || 9698 <= D2 && D2 <= 9701 || D2 == 9711 || 9733 <= D2 && D2 <= 9734 || D2 == 9737 || 9742 <= D2 && D2 <= 9743 || 9748 <= D2 && D2 <= 9749 || D2 == 9756 || D2 == 9758 || D2 == 9792 || D2 == 9794 || 9824 <= D2 && D2 <= 9825 || 9827 <= D2 && D2 <= 9829 || 9831 <= D2 && D2 <= 9834 || 9836 <= D2 && D2 <= 9837 || D2 == 9839 || 9886 <= D2 && D2 <= 9887 || 9918 <= D2 && D2 <= 9919 || 9924 <= D2 && D2 <= 9933 || 9935 <= D2 && D2 <= 9953 || D2 == 9955 || 9960 <= D2 && D2 <= 9983 || D2 == 10045 || D2 == 10071 || 10102 <= D2 && D2 <= 10111 || 11093 <= D2 && D2 <= 11097 || 12872 <= D2 && D2 <= 12879 || 57344 <= D2 && D2 <= 63743 || 65024 <= D2 && D2 <= 65039 || D2 == 65533 || 127232 <= D2 && D2 <= 127242 || 127248 <= D2 && D2 <= 127277 || 127280 <= D2 && D2 <= 127337 || 127344 <= D2 && D2 <= 127386 || 917760 <= D2 && D2 <= 917999 || 983040 <= D2 && D2 <= 1048573 || 1048576 <= D2 && D2 <= 1114109 ? "A" : "N";
353
- }, u3.characterLength = function(e2) {
354
- var s2 = this.eastAsianWidth(e2);
355
- return s2 == "F" || s2 == "W" || s2 == "A" ? 2 : 1;
356
- };
357
- function F3(e2) {
358
- return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
359
- }
360
- __name(F3, "F");
361
- u3.length = function(e2) {
362
- for (var s2 = F3(e2), i2 = 0, D2 = 0; D2 < s2.length; D2++) i2 = i2 + this.characterLength(s2[D2]);
363
- return i2;
364
- }, u3.slice = function(e2, s2, i2) {
365
- textLen = u3.length(e2), s2 = s2 || 0, i2 = i2 || 1, s2 < 0 && (s2 = textLen + s2), i2 < 0 && (i2 = textLen + i2);
366
- for (var D2 = "", C3 = 0, o3 = F3(e2), E = 0; E < o3.length; E++) {
367
- var a2 = o3[E], n2 = u3.length(a2);
368
- if (C3 >= s2 - (n2 == 2 ? 1 : 0)) if (C3 + n2 <= i2) D2 += a2;
369
- else break;
370
- C3 += n2;
371
- }
372
- return D2;
373
- };
374
- })(P$1);
375
- X = P$1.exports;
376
- DD = O(X);
377
- uD = /* @__PURE__ */ __name(function() {
378
- return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\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|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\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]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
379
- }, "uD");
380
- FD = O(uD);
381
- __name(A$1, "A$1");
382
- m = 10;
383
- L$1 = /* @__PURE__ */ __name((t2 = 0) => (u3) => `\x1B[${u3 + t2}m`, "L$1");
384
- N = /* @__PURE__ */ __name((t2 = 0) => (u3) => `\x1B[${38 + t2};5;${u3}m`, "N");
385
- I = /* @__PURE__ */ __name((t2 = 0) => (u3, F3, e2) => `\x1B[${38 + t2};2;${u3};${F3};${e2}m`, "I");
386
- r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
387
- Object.keys(r.modifier);
388
- tD = Object.keys(r.color);
389
- eD = Object.keys(r.bgColor);
390
- [...tD, ...eD];
391
- __name(sD, "sD");
392
- iD = sD();
393
- v = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
394
- CD = 39;
395
- w$1 = "\x07";
396
- W$1 = "[";
397
- rD = "]";
398
- R = "m";
399
- y = `${rD}8;;`;
400
- V$1 = /* @__PURE__ */ __name((t2) => `${v.values().next().value}${W$1}${t2}${R}`, "V$1");
401
- z = /* @__PURE__ */ __name((t2) => `${v.values().next().value}${y}${t2}${w$1}`, "z");
402
- ED = /* @__PURE__ */ __name((t2) => t2.split(" ").map((u3) => A$1(u3)), "ED");
403
- _ = /* @__PURE__ */ __name((t2, u3, F3) => {
404
- const e2 = [...u3];
405
- let s2 = false, i2 = false, D2 = A$1(T$1(t2[t2.length - 1]));
406
- for (const [C3, o3] of e2.entries()) {
407
- const E = A$1(o3);
408
- if (D2 + E <= F3 ? t2[t2.length - 1] += o3 : (t2.push(o3), D2 = 0), v.has(o3) && (s2 = true, i2 = e2.slice(C3 + 1).join("").startsWith(y)), s2) {
409
- i2 ? o3 === w$1 && (s2 = false, i2 = false) : o3 === R && (s2 = false);
410
- continue;
411
- }
412
- D2 += E, D2 === F3 && C3 < e2.length - 1 && (t2.push(""), D2 = 0);
413
- }
414
- !D2 && t2[t2.length - 1].length > 0 && t2.length > 1 && (t2[t2.length - 2] += t2.pop());
415
- }, "_");
416
- nD = /* @__PURE__ */ __name((t2) => {
417
- const u3 = t2.split(" ");
418
- let F3 = u3.length;
419
- for (; F3 > 0 && !(A$1(u3[F3 - 1]) > 0); ) F3--;
420
- return F3 === u3.length ? t2 : u3.slice(0, F3).join(" ") + u3.slice(F3).join("");
421
- }, "nD");
422
- oD = /* @__PURE__ */ __name((t2, u3, F3 = {}) => {
423
- if (F3.trim !== false && t2.trim() === "") return "";
424
- let e2 = "", s2, i2;
425
- const D2 = ED(t2);
426
- let C3 = [""];
427
- for (const [E, a2] of t2.split(" ").entries()) {
428
- F3.trim !== false && (C3[C3.length - 1] = C3[C3.length - 1].trimStart());
429
- let n2 = A$1(C3[C3.length - 1]);
430
- if (E !== 0 && (n2 >= u3 && (F3.wordWrap === false || F3.trim === false) && (C3.push(""), n2 = 0), (n2 > 0 || F3.trim === false) && (C3[C3.length - 1] += " ", n2++)), F3.hard && D2[E] > u3) {
431
- const B2 = u3 - n2, p = 1 + Math.floor((D2[E] - B2 - 1) / u3);
432
- Math.floor((D2[E] - 1) / u3) < p && C3.push(""), _(C3, a2, u3);
433
- continue;
434
- }
435
- if (n2 + D2[E] > u3 && n2 > 0 && D2[E] > 0) {
436
- if (F3.wordWrap === false && n2 < u3) {
437
- _(C3, a2, u3);
438
- continue;
439
- }
440
- C3.push("");
441
- }
442
- if (n2 + D2[E] > u3 && F3.wordWrap === false) {
443
- _(C3, a2, u3);
444
- continue;
445
- }
446
- C3[C3.length - 1] += a2;
447
- }
448
- F3.trim !== false && (C3 = C3.map((E) => nD(E)));
449
- const o3 = [...C3.join(`
450
- `)];
451
- for (const [E, a2] of o3.entries()) {
452
- if (e2 += a2, v.has(a2)) {
453
- const { groups: B2 } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o3.slice(E).join("")) || { groups: {} };
454
- if (B2.code !== void 0) {
455
- const p = Number.parseFloat(B2.code);
456
- s2 = p === CD ? void 0 : p;
457
- } else B2.uri !== void 0 && (i2 = B2.uri.length === 0 ? void 0 : B2.uri);
458
- }
459
- const n2 = iD.codes.get(Number(s2));
460
- o3[E + 1] === `
461
- ` ? (i2 && (e2 += z("")), s2 && n2 && (e2 += V$1(n2))) : a2 === `
462
- ` && (s2 && n2 && (e2 += V$1(s2)), i2 && (e2 += z(i2)));
463
- }
464
- return e2;
465
- }, "oD");
466
- __name(G, "G");
467
- aD = ["up", "down", "left", "right", "space", "enter", "cancel"];
468
- c = { actions: new Set(aD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
469
- __name(k$1, "k$1");
470
- __name(lD, "lD");
471
- globalThis.process.platform.startsWith("win");
472
- S = Symbol("clack:cancel");
473
- __name(d$1, "d$1");
474
- AD = Object.defineProperty;
475
- pD = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? AD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "pD");
476
- h = /* @__PURE__ */ __name((t2, u3, F3) => (pD(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "h");
477
- x = class {
478
- static {
479
- __name(this, "x");
480
- }
481
- constructor(u3, F3 = true) {
482
- h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
483
- const { input: e2 = g.stdin, output: s2 = g.stdout, render: i2, signal: D2, ...C3 } = u3;
484
- this.opts = C3, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i2.bind(this), this._track = F3, this._abortSignal = D2, this.input = e2, this.output = s2;
485
- }
486
- unsubscribe() {
487
- this._subscribers.clear();
488
- }
489
- setSubscriber(u3, F3) {
490
- const e2 = this._subscribers.get(u3) ?? [];
491
- e2.push(F3), this._subscribers.set(u3, e2);
492
- }
493
- on(u3, F3) {
494
- this.setSubscriber(u3, { cb: F3 });
495
- }
496
- once(u3, F3) {
497
- this.setSubscriber(u3, { cb: F3, once: true });
498
- }
499
- emit(u3, ...F3) {
500
- const e2 = this._subscribers.get(u3) ?? [], s2 = [];
501
- for (const i2 of e2) i2.cb(...F3), i2.once && s2.push(() => e2.splice(e2.indexOf(i2), 1));
502
- for (const i2 of s2) i2();
503
- }
504
- prompt() {
505
- return new Promise((u3, F3) => {
506
- if (this._abortSignal) {
507
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u3(S);
508
- this._abortSignal.addEventListener("abort", () => {
509
- this.state = "cancel", this.close();
510
- }, { once: true });
511
- }
512
- const e2 = new tty.WriteStream(0);
513
- e2._write = (s2, i2, D2) => {
514
- this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
515
- }, this.input.pipe(e2), this.rl = f__default.default.createInterface({ input: this.input, output: e2, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), f__default.default.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
516
- this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u3(this.value);
517
- }), this.once("cancel", () => {
518
- this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u3(S);
519
- });
520
- });
521
- }
522
- onKeypress(u3, F3) {
523
- if (this.state === "error" && (this.state = "active"), F3?.name && (!this._track && c.aliases.has(F3.name) && this.emit("cursor", c.aliases.get(F3.name)), c.actions.has(F3.name) && this.emit("cursor", F3.name)), u3 && (u3.toLowerCase() === "y" || u3.toLowerCase() === "n") && this.emit("confirm", u3.toLowerCase() === "y"), u3 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u3 && this.emit("key", u3.toLowerCase()), F3?.name === "return") {
524
- if (this.opts.validate) {
525
- const e2 = this.opts.validate(this.value);
526
- e2 && (this.error = e2 instanceof Error ? e2.message : e2, this.state = "error", this.rl?.write(this.value));
527
- }
528
- this.state !== "error" && (this.state = "submit");
529
- }
530
- k$1([u3, F3?.name, F3?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
531
- }
532
- close() {
533
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
534
- `), d$1(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
535
- }
536
- restoreCursor() {
537
- const u3 = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
538
- `).length - 1;
539
- this.output.write(srcExports.cursor.move(-999, u3 * -1));
540
- }
541
- render() {
542
- const u3 = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
543
- if (u3 !== this._prevFrame) {
544
- if (this.state === "initial") this.output.write(srcExports.cursor.hide);
545
- else {
546
- const F3 = lD(this._prevFrame, u3);
547
- if (this.restoreCursor(), F3 && F3?.length === 1) {
548
- const e2 = F3[0];
549
- this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.lines(1));
550
- const s2 = u3.split(`
551
- `);
552
- this.output.write(s2[e2]), this._prevFrame = u3, this.output.write(srcExports.cursor.move(0, s2.length - e2 - 1));
553
- return;
554
- }
555
- if (F3 && F3?.length > 1) {
556
- const e2 = F3[0];
557
- this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.down());
558
- const s2 = u3.split(`
559
- `).slice(e2);
560
- this.output.write(s2.join(`
561
- `)), this._prevFrame = u3;
562
- return;
563
- }
564
- this.output.write(srcExports.erase.down());
565
- }
566
- this.output.write(u3), this.state === "initial" && (this.state = "active"), this._prevFrame = u3;
567
- }
568
- }
569
- };
570
- fD = class extends x {
571
- static {
572
- __name(this, "fD");
573
- }
574
- get cursor() {
575
- return this.value ? 0 : 1;
576
- }
577
- get _value() {
578
- return this.cursor === 0;
579
- }
580
- constructor(u3) {
581
- super(u3, false), this.value = !!u3.initialValue, this.on("value", () => {
582
- this.value = this._value;
583
- }), this.on("confirm", (F3) => {
584
- this.output.write(srcExports.cursor.move(0, -1)), this.value = F3, this.state = "submit", this.close();
585
- }), this.on("cursor", () => {
586
- this.value = !this.value;
587
- });
588
- }
589
- };
590
- bD = Object.defineProperty;
591
- mD = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? bD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "mD");
592
- Y = /* @__PURE__ */ __name((t2, u3, F3) => (mD(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "Y");
593
- wD = class extends x {
594
- static {
595
- __name(this, "wD");
596
- }
597
- constructor(u3) {
598
- super(u3, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u3.options, this.value = [...u3.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F3 }) => F3 === u3.cursorAt), 0), this.on("key", (F3) => {
599
- F3 === "a" && this.toggleAll();
600
- }), this.on("cursor", (F3) => {
601
- switch (F3) {
602
- case "left":
603
- case "up":
604
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
605
- break;
606
- case "down":
607
- case "right":
608
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
609
- break;
610
- case "space":
611
- this.toggleValue();
612
- break;
613
- }
614
- });
615
- }
616
- get _value() {
617
- return this.options[this.cursor].value;
618
- }
619
- toggleAll() {
620
- const u3 = this.value.length === this.options.length;
621
- this.value = u3 ? [] : this.options.map((F3) => F3.value);
622
- }
623
- toggleValue() {
624
- const u3 = this.value.includes(this._value);
625
- this.value = u3 ? this.value.filter((F3) => F3 !== this._value) : [...this.value, this._value];
626
- }
627
- };
628
- SD = Object.defineProperty;
629
- $D = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? SD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "$D");
630
- q = /* @__PURE__ */ __name((t2, u3, F3) => ($D(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "q");
631
- jD = class extends x {
632
- static {
633
- __name(this, "jD");
634
- }
635
- constructor(u3) {
636
- super(u3, false), q(this, "options"), q(this, "cursor", 0), this.options = u3.options, this.cursor = this.options.findIndex(({ value: F3 }) => F3 === u3.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F3) => {
637
- switch (F3) {
638
- case "left":
639
- case "up":
640
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
641
- break;
642
- case "down":
643
- case "right":
644
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
645
- break;
646
- }
647
- this.changeValue();
648
- });
649
- }
650
- get _value() {
651
- return this.options[this.cursor];
652
- }
653
- changeValue() {
654
- this.value = this._value.value;
655
- }
656
- };
657
- PD = class extends x {
658
- static {
659
- __name(this, "PD");
660
- }
661
- get valueWithCursor() {
662
- if (this.state === "submit") return this.value;
663
- if (this.cursor >= this.value.length) return `${this.value}\u2588`;
664
- const u3 = this.value.slice(0, this.cursor), [F3, ...e$1] = this.value.slice(this.cursor);
665
- return `${u3}${e.inverse(F3)}${e$1.join("")}`;
666
- }
667
- get cursor() {
668
- return this._cursor;
669
- }
670
- constructor(u3) {
671
- super(u3), this.on("finalize", () => {
672
- this.value || (this.value = u3.defaultValue);
673
- });
674
- }
675
- };
676
- __name(ce, "ce");
677
- V = ce();
678
- u = /* @__PURE__ */ __name((t2, n2) => V ? t2 : n2, "u");
679
- le = u("\u276F", ">");
680
- L = u("\u25A0", "x");
681
- W = u("\u25B2", "x");
682
- C = u("\u2714", "\u221A");
683
- o = u("");
684
- d = u("");
685
- k = u("\u25CF", ">");
686
- P = u("\u25CB", " ");
687
- A = u("\u25FB", "[\u2022]");
688
- T = u("\u25FC", "[+]");
689
- F = u("\u25FB", "[ ]");
690
- w = /* @__PURE__ */ __name((t2) => {
691
- switch (t2) {
692
- case "initial":
693
- case "active":
694
- return e.cyan(le);
695
- case "cancel":
696
- return e.red(L);
697
- case "error":
698
- return e.yellow(W);
699
- case "submit":
700
- return e.green(C);
701
- }
702
- }, "w");
703
- B = /* @__PURE__ */ __name((t2) => {
704
- const { cursor: n2, options: s2, style: r3 } = t2, i2 = t2.maxItems ?? Number.POSITIVE_INFINITY, a2 = Math.max(process.stdout.rows - 4, 0), c3 = Math.min(a2, Math.max(i2, 5));
705
- let l2 = 0;
706
- n2 >= l2 + c3 - 3 ? l2 = Math.max(Math.min(n2 - c3 + 3, s2.length - c3), 0) : n2 < l2 + 2 && (l2 = Math.max(n2 - 2, 0));
707
- const $ = c3 < s2.length && l2 > 0, p = c3 < s2.length && l2 + c3 < s2.length;
708
- return s2.slice(l2, l2 + c3).map((M, v2, x2) => {
709
- const j = v2 === 0 && $, E = v2 === x2.length - 1 && p;
710
- return j || E ? e.dim("...") : r3(M, v2 + l2 === n2);
711
- });
712
- }, "B");
713
- he = /* @__PURE__ */ __name((t2) => new PD({ validate: t2.validate, placeholder: t2.placeholder, defaultValue: t2.defaultValue, initialValue: t2.initialValue, render() {
714
- const n2 = `${e.gray(o)}
715
- ${w(this.state)} ${t2.message}
716
- `, s2 = t2.placeholder ? e.inverse(t2.placeholder[0]) + e.dim(t2.placeholder.slice(1)) : e.inverse(e.hidden("_")), r3 = this.value ? this.valueWithCursor : s2;
717
- switch (this.state) {
718
- case "error":
719
- return `${n2.trim()}
720
- ${e.yellow(o)} ${r3}
721
- ${e.yellow(d)} ${e.yellow(this.error)}
722
- `;
723
- case "submit":
724
- return `${n2}${e.gray(o)} ${e.dim(this.value || t2.placeholder)}`;
725
- case "cancel":
726
- return `${n2}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
727
- ${e.gray(o)}` : ""}`;
728
- default:
729
- return `${n2}${e.cyan(o)} ${r3}
730
- ${e.cyan(d)}
731
- `;
732
- }
733
- } }).prompt(), "he");
734
- ye = /* @__PURE__ */ __name((t2) => {
735
- const n2 = t2.active ?? "Yes", s2 = t2.inactive ?? "No";
736
- return new fD({ active: n2, inactive: s2, initialValue: t2.initialValue ?? true, render() {
737
- const r3 = `${e.gray(o)}
738
- ${w(this.state)} ${t2.message}
739
- `, i2 = this.value ? n2 : s2;
740
- switch (this.state) {
741
- case "submit":
742
- return `${r3}${e.gray(o)} ${e.dim(i2)}`;
743
- case "cancel":
744
- return `${r3}${e.gray(o)} ${e.strikethrough(e.dim(i2))}
745
- ${e.gray(o)}`;
746
- default:
747
- return `${r3}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n2}` : `${e.dim(P)} ${e.dim(n2)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(s2)}` : `${e.green(k)} ${s2}`}
748
- ${e.cyan(d)}
749
- `;
750
- }
751
- } }).prompt();
752
- }, "ye");
753
- ve = /* @__PURE__ */ __name((t2) => {
754
- const n2 = /* @__PURE__ */ __name((s2, r3) => {
755
- const i2 = s2.label ?? String(s2.value);
756
- switch (r3) {
757
- case "selected":
758
- return `${e.dim(i2)}`;
759
- case "active":
760
- return `${e.green(k)} ${i2} ${s2.hint ? e.dim(`(${s2.hint})`) : ""}`;
761
- case "cancelled":
762
- return `${e.strikethrough(e.dim(i2))}`;
763
- default:
764
- return `${e.dim(P)} ${e.dim(i2)}`;
765
- }
766
- }, "n");
767
- return new jD({ options: t2.options, initialValue: t2.initialValue, render() {
768
- const s2 = `${e.gray(o)}
769
- ${w(this.state)} ${t2.message}
770
- `;
771
- switch (this.state) {
772
- case "submit":
773
- return `${s2}${e.gray(o)} ${n2(this.options[this.cursor], "selected")}`;
774
- case "cancel":
775
- return `${s2}${e.gray(o)} ${n2(this.options[this.cursor], "cancelled")}
776
- ${e.gray(o)}`;
777
- default:
778
- return `${s2}${e.cyan(o)} ${B({ cursor: this.cursor, options: this.options, maxItems: t2.maxItems, style: /* @__PURE__ */ __name((r3, i2) => n2(r3, i2 ? "active" : "inactive"), "style") }).join(`
779
- ${e.cyan(o)} `)}
780
- ${e.cyan(d)}
781
- `;
782
- }
783
- } }).prompt();
784
- }, "ve");
785
- fe = /* @__PURE__ */ __name((t2) => {
786
- const n2 = /* @__PURE__ */ __name((s2, r3) => {
787
- const i2 = s2.label ?? String(s2.value);
788
- return r3 === "active" ? `${e.cyan(A)} ${i2} ${s2.hint ? e.dim(`(${s2.hint})`) : ""}` : r3 === "selected" ? `${e.green(T)} ${e.dim(i2)}` : r3 === "cancelled" ? `${e.strikethrough(e.dim(i2))}` : r3 === "active-selected" ? `${e.green(T)} ${i2} ${s2.hint ? e.dim(`(${s2.hint})`) : ""}` : r3 === "submitted" ? `${e.dim(i2)}` : `${e.dim(F)} ${e.dim(i2)}`;
789
- }, "n");
790
- return new wD({ options: t2.options, initialValues: t2.initialValues, required: t2.required ?? true, cursorAt: t2.cursorAt, validate(s2) {
791
- if (this.required && s2.length === 0) return `Please select at least one option.
792
- ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
793
- }, render() {
794
- const s2 = `${e.gray(o)}
795
- ${w(this.state)} ${t2.message}
796
- `, r3 = /* @__PURE__ */ __name((i2, a2) => {
797
- const c3 = this.value.includes(i2.value);
798
- return a2 && c3 ? n2(i2, "active-selected") : c3 ? n2(i2, "selected") : n2(i2, a2 ? "active" : "inactive");
799
- }, "r");
800
- switch (this.state) {
801
- case "submit":
802
- return `${s2}${e.gray(o)} ${this.options.filter(({ value: i2 }) => this.value.includes(i2)).map((i2) => n2(i2, "submitted")).join(e.dim(", ")) || e.dim("none")}`;
803
- case "cancel": {
804
- const i2 = this.options.filter(({ value: a2 }) => this.value.includes(a2)).map((a2) => n2(a2, "cancelled")).join(e.dim(", "));
805
- return `${s2}${e.gray(o)} ${i2.trim() ? `${i2}
806
- ${e.gray(o)}` : ""}`;
807
- }
808
- case "error": {
809
- const i2 = this.error.split(`
810
- `).map((a2, c3) => c3 === 0 ? `${e.yellow(d)} ${e.yellow(a2)}` : ` ${a2}`).join(`
811
- `);
812
- return `${s2 + e.yellow(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t2.maxItems, style: r3 }).join(`
813
- ${e.yellow(o)} `)}
814
- ${i2}
815
- `;
816
- }
817
- default:
818
- return `${s2}${e.cyan(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t2.maxItems, style: r3 }).join(`
819
- ${e.cyan(o)} `)}
820
- ${e.cyan(d)}
821
- `;
822
- }
823
- } }).prompt();
824
- }, "fe");
825
- `${e.gray(o)} `;
826
- kCancel = Symbol.for("cancel");
827
- __name(prompt, "prompt");
828
- }
829
- });
830
-
831
- // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
832
- var LogLevels = {
833
- fatal: 0,
834
- error: 0,
835
- warn: 1,
836
- log: 2,
837
- info: 3,
838
- success: 3,
839
- fail: 3,
840
- debug: 4,
841
- trace: 5,
842
- verbose: Number.POSITIVE_INFINITY
843
- };
844
- var LogTypes = {
845
- // Silent
846
- silent: {
847
- level: -1
848
- },
849
- // Level 0
850
- fatal: {
851
- level: LogLevels.fatal
852
- },
853
- error: {
854
- level: LogLevels.error
855
- },
856
- // Level 1
857
- warn: {
858
- level: LogLevels.warn
859
- },
860
- // Level 2
861
- log: {
862
- level: LogLevels.log
863
- },
864
- // Level 3
865
- info: {
866
- level: LogLevels.info
867
- },
868
- success: {
869
- level: LogLevels.success
870
- },
871
- fail: {
872
- level: LogLevels.fail
873
- },
874
- ready: {
875
- level: LogLevels.info
876
- },
877
- start: {
878
- level: LogLevels.info
879
- },
880
- box: {
881
- level: LogLevels.info
882
- },
883
- // Level 4
884
- debug: {
885
- level: LogLevels.debug
886
- },
887
- // Level 5
888
- trace: {
889
- level: LogLevels.trace
890
- },
891
- // Verbose
892
- verbose: {
893
- level: LogLevels.verbose
894
- }
895
- };
896
- function isPlainObject$1(value) {
897
- if (value === null || typeof value !== "object") {
898
- return false;
899
- }
900
- const prototype = Object.getPrototypeOf(value);
901
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
902
- return false;
903
- }
904
- if (Symbol.iterator in value) {
905
- return false;
906
- }
907
- if (Symbol.toStringTag in value) {
908
- return Object.prototype.toString.call(value) === "[object Module]";
909
- }
910
- return true;
911
- }
912
- __name(isPlainObject$1, "isPlainObject$1");
913
- function _defu(baseObject, defaults, namespace = ".", merger) {
914
- if (!isPlainObject$1(defaults)) {
915
- return _defu(baseObject, {}, namespace, merger);
916
- }
917
- const object = Object.assign({}, defaults);
918
- for (const key in baseObject) {
919
- if (key === "__proto__" || key === "constructor") {
920
- continue;
921
- }
922
- const value = baseObject[key];
923
- if (value === null || value === void 0) {
924
- continue;
925
- }
926
- if (merger && merger(object, key, value, namespace)) {
927
- continue;
928
- }
929
- if (Array.isArray(value) && Array.isArray(object[key])) {
930
- object[key] = [...value, ...object[key]];
931
- } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
932
- object[key] = _defu(
933
- value,
934
- object[key],
935
- (namespace ? `${namespace}.` : "") + key.toString(),
936
- merger
937
- );
938
- } else {
939
- object[key] = value;
940
- }
941
- }
942
- return object;
943
- }
944
- __name(_defu, "_defu");
945
- function createDefu(merger) {
946
- return (...arguments_) => (
947
- // eslint-disable-next-line unicorn/no-array-reduce
948
- arguments_.reduce((p, c3) => _defu(p, c3, "", merger), {})
949
- );
950
- }
951
- __name(createDefu, "createDefu");
952
- var defu = createDefu();
953
- function isPlainObject(obj) {
954
- return Object.prototype.toString.call(obj) === "[object Object]";
955
- }
956
- __name(isPlainObject, "isPlainObject");
957
- function isLogObj(arg) {
958
- if (!isPlainObject(arg)) {
959
- return false;
960
- }
961
- if (!arg.message && !arg.args) {
962
- return false;
963
- }
964
- if (arg.stack) {
965
- return false;
966
- }
967
- return true;
968
- }
969
- __name(isLogObj, "isLogObj");
970
- var paused = false;
971
- var queue = [];
972
- var Consola = class _Consola {
973
- static {
974
- __name(this, "Consola");
975
- }
976
- options;
977
- _lastLog;
978
- _mockFn;
979
- /**
980
- * Creates an instance of Consola with specified options or defaults.
981
- *
982
- * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
983
- */
984
- constructor(options = {}) {
985
- const types = options.types || LogTypes;
986
- this.options = defu(
987
- {
988
- ...options,
989
- defaults: { ...options.defaults },
990
- level: _normalizeLogLevel(options.level, types),
991
- reporters: [...options.reporters || []]
992
- },
993
- {
994
- types: LogTypes,
995
- throttle: 1e3,
996
- throttleMin: 5,
997
- formatOptions: {
998
- date: true,
999
- colors: false,
1000
- compact: true
1001
- }
1002
- }
1003
- );
1004
- for (const type in types) {
1005
- const defaults = {
1006
- type,
1007
- ...this.options.defaults,
1008
- ...types[type]
1009
- };
1010
- this[type] = this._wrapLogFn(defaults);
1011
- this[type].raw = this._wrapLogFn(
1012
- defaults,
1013
- true
1014
- );
1015
- }
1016
- if (this.options.mockFn) {
1017
- this.mockTypes();
1018
- }
1019
- this._lastLog = {};
1020
- }
1021
- /**
1022
- * Gets the current log level of the Consola instance.
1023
- *
1024
- * @returns {number} The current log level.
1025
- */
1026
- get level() {
1027
- return this.options.level;
1028
- }
1029
- /**
1030
- * Sets the minimum log level that will be output by the instance.
1031
- *
1032
- * @param {number} level - The new log level to set.
1033
- */
1034
- set level(level) {
1035
- this.options.level = _normalizeLogLevel(
1036
- level,
1037
- this.options.types,
1038
- this.options.level
1039
- );
1040
- }
1041
- /**
1042
- * Displays a prompt to the user and returns the response.
1043
- * Throw an error if `prompt` is not supported by the current configuration.
1044
- *
1045
- * @template T
1046
- * @param {string} message - The message to display in the prompt.
1047
- * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
1048
- * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
1049
- */
1050
- prompt(message, opts) {
1051
- if (!this.options.prompt) {
1052
- throw new Error("prompt is not supported!");
1053
- }
1054
- return this.options.prompt(message, opts);
1055
- }
1056
- /**
1057
- * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
1058
- *
1059
- * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
1060
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1061
- */
1062
- create(options) {
1063
- const instance = new _Consola({
1064
- ...this.options,
1065
- ...options
1066
- });
1067
- if (this._mockFn) {
1068
- instance.mockTypes(this._mockFn);
1069
- }
1070
- return instance;
1071
- }
1072
- /**
1073
- * Creates a new Consola instance with the specified default log object properties.
1074
- *
1075
- * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
1076
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1077
- */
1078
- withDefaults(defaults) {
1079
- return this.create({
1080
- ...this.options,
1081
- defaults: {
1082
- ...this.options.defaults,
1083
- ...defaults
1084
- }
1085
- });
1086
- }
1087
- /**
1088
- * Creates a new Consola instance with a specified tag, which will be included in every log.
1089
- *
1090
- * @param {string} tag - The tag to include in each log of the new instance.
1091
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1092
- */
1093
- withTag(tag) {
1094
- return this.withDefaults({
1095
- tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
1096
- });
1097
- }
1098
- /**
1099
- * Adds a custom reporter to the Consola instance.
1100
- * Reporters will be called for each log message, depending on their implementation and log level.
1101
- *
1102
- * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
1103
- * @returns {Consola} The current Consola instance.
1104
- */
1105
- addReporter(reporter) {
1106
- this.options.reporters.push(reporter);
1107
- return this;
1108
- }
1109
- /**
1110
- * Removes a custom reporter from the Consola instance.
1111
- * If no reporter is specified, all reporters will be removed.
1112
- *
1113
- * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
1114
- * @returns {Consola} The current Consola instance.
1115
- */
1116
- removeReporter(reporter) {
1117
- if (reporter) {
1118
- const i2 = this.options.reporters.indexOf(reporter);
1119
- if (i2 !== -1) {
1120
- return this.options.reporters.splice(i2, 1);
1121
- }
1122
- } else {
1123
- this.options.reporters.splice(0);
1124
- }
1125
- return this;
1126
- }
1127
- /**
1128
- * Replaces all reporters of the Consola instance with the specified array of reporters.
1129
- *
1130
- * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
1131
- * @returns {Consola} The current Consola instance.
1132
- */
1133
- setReporters(reporters) {
1134
- this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
1135
- return this;
1136
- }
1137
- wrapAll() {
1138
- this.wrapConsole();
1139
- this.wrapStd();
1140
- }
1141
- restoreAll() {
1142
- this.restoreConsole();
1143
- this.restoreStd();
1144
- }
1145
- /**
1146
- * Overrides console methods with Consola logging methods for consistent logging.
1147
- */
1148
- wrapConsole() {
1149
- for (const type in this.options.types) {
1150
- if (!console["__" + type]) {
1151
- console["__" + type] = console[type];
1152
- }
1153
- console[type] = this[type].raw;
1154
- }
1155
- }
1156
- /**
1157
- * Restores the original console methods, removing Consola overrides.
1158
- */
1159
- restoreConsole() {
1160
- for (const type in this.options.types) {
1161
- if (console["__" + type]) {
1162
- console[type] = console["__" + type];
1163
- delete console["__" + type];
1164
- }
1165
- }
1166
- }
1167
- /**
1168
- * Overrides standard output and error streams to redirect them through Consola.
1169
- */
1170
- wrapStd() {
1171
- this._wrapStream(this.options.stdout, "log");
1172
- this._wrapStream(this.options.stderr, "log");
1173
- }
1174
- _wrapStream(stream, type) {
1175
- if (!stream) {
1176
- return;
1177
- }
1178
- if (!stream.__write) {
1179
- stream.__write = stream.write;
1180
- }
1181
- stream.write = (data) => {
1182
- this[type].raw(String(data).trim());
1183
- };
1184
- }
1185
- /**
1186
- * Restores the original standard output and error streams, removing the Consola redirection.
1187
- */
1188
- restoreStd() {
1189
- this._restoreStream(this.options.stdout);
1190
- this._restoreStream(this.options.stderr);
1191
- }
1192
- _restoreStream(stream) {
1193
- if (!stream) {
1194
- return;
1195
- }
1196
- if (stream.__write) {
1197
- stream.write = stream.__write;
1198
- delete stream.__write;
1199
- }
1200
- }
1201
- /**
1202
- * Pauses logging, queues incoming logs until resumed.
1203
- */
1204
- pauseLogs() {
1205
- paused = true;
1206
- }
1207
- /**
1208
- * Resumes logging, processing any queued logs.
1209
- */
1210
- resumeLogs() {
1211
- paused = false;
1212
- const _queue = queue.splice(0);
1213
- for (const item of _queue) {
1214
- item[0]._logFn(item[1], item[2]);
1215
- }
1216
- }
1217
- /**
1218
- * Replaces logging methods with mocks if a mock function is provided.
1219
- *
1220
- * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
1221
- */
1222
- mockTypes(mockFn) {
1223
- const _mockFn = mockFn || this.options.mockFn;
1224
- this._mockFn = _mockFn;
1225
- if (typeof _mockFn !== "function") {
1226
- return;
1227
- }
1228
- for (const type in this.options.types) {
1229
- this[type] = _mockFn(type, this.options.types[type]) || this[type];
1230
- this[type].raw = this[type];
1231
- }
1232
- }
1233
- _wrapLogFn(defaults, isRaw) {
1234
- return (...args) => {
1235
- if (paused) {
1236
- queue.push([this, defaults, args, isRaw]);
1237
- return;
1238
- }
1239
- return this._logFn(defaults, args, isRaw);
1240
- };
1241
- }
1242
- _logFn(defaults, args, isRaw) {
1243
- if ((defaults.level || 0) > this.level) {
1244
- return false;
1245
- }
1246
- const logObj = {
1247
- date: /* @__PURE__ */ new Date(),
1248
- args: [],
1249
- ...defaults,
1250
- level: _normalizeLogLevel(defaults.level, this.options.types)
1251
- };
1252
- if (!isRaw && args.length === 1 && isLogObj(args[0])) {
1253
- Object.assign(logObj, args[0]);
1254
- } else {
1255
- logObj.args = [...args];
1256
- }
1257
- if (logObj.message) {
1258
- logObj.args.unshift(logObj.message);
1259
- delete logObj.message;
1260
- }
1261
- if (logObj.additional) {
1262
- if (!Array.isArray(logObj.additional)) {
1263
- logObj.additional = logObj.additional.split("\n");
1264
- }
1265
- logObj.args.push("\n" + logObj.additional.join("\n"));
1266
- delete logObj.additional;
1267
- }
1268
- logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
1269
- logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
1270
- const resolveLog = /* @__PURE__ */ __name((newLog = false) => {
1271
- const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
1272
- if (this._lastLog.object && repeated > 0) {
1273
- const args2 = [...this._lastLog.object.args];
1274
- if (repeated > 1) {
1275
- args2.push(`(repeated ${repeated} times)`);
1276
- }
1277
- this._log({ ...this._lastLog.object, args: args2 });
1278
- this._lastLog.count = 1;
1279
- }
1280
- if (newLog) {
1281
- this._lastLog.object = logObj;
1282
- this._log(logObj);
1283
- }
1284
- }, "resolveLog");
1285
- clearTimeout(this._lastLog.timeout);
1286
- const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
1287
- this._lastLog.time = logObj.date;
1288
- if (diffTime < this.options.throttle) {
1289
- try {
1290
- const serializedLog = JSON.stringify([
1291
- logObj.type,
1292
- logObj.tag,
1293
- logObj.args
1294
- ]);
1295
- const isSameLog = this._lastLog.serialized === serializedLog;
1296
- this._lastLog.serialized = serializedLog;
1297
- if (isSameLog) {
1298
- this._lastLog.count = (this._lastLog.count || 0) + 1;
1299
- if (this._lastLog.count > this.options.throttleMin) {
1300
- this._lastLog.timeout = setTimeout(
1301
- resolveLog,
1302
- this.options.throttle
1303
- );
1304
- return;
1305
- }
1306
- }
1307
- } catch {
1308
- }
1309
- }
1310
- resolveLog(true);
1311
- }
1312
- _log(logObj) {
1313
- for (const reporter of this.options.reporters) {
1314
- reporter.log(logObj, {
1315
- options: this.options
1316
- });
1317
- }
1318
- }
1319
- };
1320
- function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
1321
- if (input === void 0) {
1322
- return defaultLevel;
1323
- }
1324
- if (typeof input === "number") {
1325
- return input;
1326
- }
1327
- if (types[input] && types[input].level !== void 0) {
1328
- return types[input].level;
1329
- }
1330
- return defaultLevel;
1331
- }
1332
- __name(_normalizeLogLevel, "_normalizeLogLevel");
1333
- Consola.prototype.add = Consola.prototype.addReporter;
1334
- Consola.prototype.remove = Consola.prototype.removeReporter;
1335
- Consola.prototype.clear = Consola.prototype.removeReporter;
1336
- Consola.prototype.withScope = Consola.prototype.withTag;
1337
- Consola.prototype.mock = Consola.prototype.mockTypes;
1338
- Consola.prototype.pause = Consola.prototype.pauseLogs;
1339
- Consola.prototype.resume = Consola.prototype.resumeLogs;
1340
- function createConsola(options = {}) {
1341
- return new Consola(options);
1342
- }
1343
- __name(createConsola, "createConsola");
1344
- function parseStack(stack, message) {
1345
- const cwd = process.cwd() + path.sep;
1346
- const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
1347
- return lines;
1348
- }
1349
- __name(parseStack, "parseStack");
1350
- function writeStream(data, stream) {
1351
- const write = stream.__write || stream.write;
1352
- return write.call(stream, data);
1353
- }
1354
- __name(writeStream, "writeStream");
1355
- var bracket = /* @__PURE__ */ __name((x2) => x2 ? `[${x2}]` : "", "bracket");
1356
- var BasicReporter = class {
1357
- static {
1358
- __name(this, "BasicReporter");
1359
- }
1360
- formatStack(stack, message, opts) {
1361
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1362
- return indent + parseStack(stack, message).join(`
1363
- ${indent}`);
1364
- }
1365
- formatError(err, opts) {
1366
- const message = err.message ?? util.formatWithOptions(opts, err);
1367
- const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
1368
- const level = opts?.errorLevel || 0;
1369
- const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
1370
- const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
1371
- return causedPrefix + message + "\n" + stack + causedError;
1372
- }
1373
- formatArgs(args, opts) {
1374
- const _args = args.map((arg) => {
1375
- if (arg && typeof arg.stack === "string") {
1376
- return this.formatError(arg, opts);
1377
- }
1378
- return arg;
1379
- });
1380
- return util.formatWithOptions(opts, ..._args);
1381
- }
1382
- formatDate(date, opts) {
1383
- return opts.date ? date.toLocaleTimeString() : "";
1384
- }
1385
- filterAndJoin(arr) {
1386
- return arr.filter(Boolean).join(" ");
1387
- }
1388
- formatLogObj(logObj, opts) {
1389
- const message = this.formatArgs(logObj.args, opts);
1390
- if (logObj.type === "box") {
1391
- return "\n" + [
1392
- bracket(logObj.tag),
1393
- logObj.title && logObj.title,
1394
- ...message.split("\n")
1395
- ].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
1396
- }
1397
- return this.filterAndJoin([
1398
- bracket(logObj.type),
1399
- bracket(logObj.tag),
1400
- message
1401
- ]);
1402
- }
1403
- log(logObj, ctx) {
1404
- const line = this.formatLogObj(logObj, {
1405
- columns: ctx.options.stdout.columns || 0,
1406
- ...ctx.options.formatOptions
1407
- });
1408
- return writeStream(
1409
- line + "\n",
1410
- logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
1411
- );
1412
- }
1413
- };
1414
- var {
1415
- env = {},
1416
- argv = [],
1417
- platform = ""
1418
- } = typeof process === "undefined" ? {} : process;
1419
- var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
1420
- var isForced = "FORCE_COLOR" in env || argv.includes("--color");
1421
- var isWindows = platform === "win32";
1422
- var isDumbTerminal = env.TERM === "dumb";
1423
- var isCompatibleTerminal = tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
1424
- var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
1425
- var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
1426
- 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)) {
1427
- return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
1428
- }
1429
- __name(replaceClose, "replaceClose");
1430
- function clearBleed(index, string, open, close, replace) {
1431
- return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
1432
- }
1433
- __name(clearBleed, "clearBleed");
1434
- function filterEmpty(open, close, replace = open, at = open.length + 1) {
1435
- return (string) => string || !(string === "" || string === void 0) ? clearBleed(
1436
- ("" + string).indexOf(close, at),
1437
- string,
1438
- open,
1439
- close,
1440
- replace
1441
- ) : "";
1442
- }
1443
- __name(filterEmpty, "filterEmpty");
1444
- function init(open, close, replace) {
1445
- return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
1446
- }
1447
- __name(init, "init");
1448
- var colorDefs = {
1449
- reset: init(0, 0),
1450
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
1451
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
1452
- italic: init(3, 23),
1453
- underline: init(4, 24),
1454
- inverse: init(7, 27),
1455
- hidden: init(8, 28),
1456
- strikethrough: init(9, 29),
1457
- black: init(30, 39),
1458
- red: init(31, 39),
1459
- green: init(32, 39),
1460
- yellow: init(33, 39),
1461
- blue: init(34, 39),
1462
- magenta: init(35, 39),
1463
- cyan: init(36, 39),
1464
- white: init(37, 39),
1465
- gray: init(90, 39),
1466
- bgBlack: init(40, 49),
1467
- bgRed: init(41, 49),
1468
- bgGreen: init(42, 49),
1469
- bgYellow: init(43, 49),
1470
- bgBlue: init(44, 49),
1471
- bgMagenta: init(45, 49),
1472
- bgCyan: init(46, 49),
1473
- bgWhite: init(47, 49),
1474
- blackBright: init(90, 39),
1475
- redBright: init(91, 39),
1476
- greenBright: init(92, 39),
1477
- yellowBright: init(93, 39),
1478
- blueBright: init(94, 39),
1479
- magentaBright: init(95, 39),
1480
- cyanBright: init(96, 39),
1481
- whiteBright: init(97, 39),
1482
- bgBlackBright: init(100, 49),
1483
- bgRedBright: init(101, 49),
1484
- bgGreenBright: init(102, 49),
1485
- bgYellowBright: init(103, 49),
1486
- bgBlueBright: init(104, 49),
1487
- bgMagentaBright: init(105, 49),
1488
- bgCyanBright: init(106, 49),
1489
- bgWhiteBright: init(107, 49)
1490
- };
1491
- function createColors(useColor = isColorSupported) {
1492
- return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
1493
- }
1494
- __name(createColors, "createColors");
1495
- var colors = createColors();
1496
- function getColor(color, fallback = "reset") {
1497
- return colors[color] || colors[fallback];
1498
- }
1499
- __name(getColor, "getColor");
1500
- var ansiRegex = [
1501
- String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
1502
- String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
1503
- ].join("|");
1504
- function stripAnsi(text) {
1505
- return text.replace(new RegExp(ansiRegex, "g"), "");
1506
- }
1507
- __name(stripAnsi, "stripAnsi");
1508
- var boxStylePresets = {
1509
- solid: {
1510
- tl: "\u250C",
1511
- tr: "\u2510",
1512
- bl: "\u2514",
1513
- br: "\u2518",
1514
- h: "\u2500",
1515
- v: "\u2502"
1516
- },
1517
- double: {
1518
- tl: "\u2554",
1519
- tr: "\u2557",
1520
- bl: "\u255A",
1521
- br: "\u255D",
1522
- h: "\u2550",
1523
- v: "\u2551"
1524
- },
1525
- doubleSingle: {
1526
- tl: "\u2553",
1527
- tr: "\u2556",
1528
- bl: "\u2559",
1529
- br: "\u255C",
1530
- h: "\u2500",
1531
- v: "\u2551"
1532
- },
1533
- doubleSingleRounded: {
1534
- tl: "\u256D",
1535
- tr: "\u256E",
1536
- bl: "\u2570",
1537
- br: "\u256F",
1538
- h: "\u2500",
1539
- v: "\u2551"
1540
- },
1541
- singleThick: {
1542
- tl: "\u250F",
1543
- tr: "\u2513",
1544
- bl: "\u2517",
1545
- br: "\u251B",
1546
- h: "\u2501",
1547
- v: "\u2503"
1548
- },
1549
- singleDouble: {
1550
- tl: "\u2552",
1551
- tr: "\u2555",
1552
- bl: "\u2558",
1553
- br: "\u255B",
1554
- h: "\u2550",
1555
- v: "\u2502"
1556
- },
1557
- singleDoubleRounded: {
1558
- tl: "\u256D",
1559
- tr: "\u256E",
1560
- bl: "\u2570",
1561
- br: "\u256F",
1562
- h: "\u2550",
1563
- v: "\u2502"
1564
- },
1565
- rounded: {
1566
- tl: "\u256D",
1567
- tr: "\u256E",
1568
- bl: "\u2570",
1569
- br: "\u256F",
1570
- h: "\u2500",
1571
- v: "\u2502"
1572
- }
1573
- };
1574
- var defaultStyle = {
1575
- borderColor: "white",
1576
- borderStyle: "rounded",
1577
- valign: "center",
1578
- padding: 2,
1579
- marginLeft: 1,
1580
- marginTop: 1,
1581
- marginBottom: 1
1582
- };
1583
- function box(text, _opts = {}) {
1584
- const opts = {
1585
- ..._opts,
1586
- style: {
1587
- ...defaultStyle,
1588
- ..._opts.style
1589
- }
1590
- };
1591
- const textLines = text.split("\n");
1592
- const boxLines = [];
1593
- const _color = getColor(opts.style.borderColor);
1594
- const borderStyle = {
1595
- ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
1596
- };
1597
- if (_color) {
1598
- for (const key in borderStyle) {
1599
- borderStyle[key] = _color(
1600
- borderStyle[key]
1601
- );
1602
- }
1603
- }
1604
- const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
1605
- const height = textLines.length + paddingOffset;
1606
- const width = Math.max(
1607
- ...textLines.map((line) => stripAnsi(line).length),
1608
- opts.title ? stripAnsi(opts.title).length : 0
1609
- ) + paddingOffset;
1610
- const widthOffset = width + paddingOffset;
1611
- const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
1612
- if (opts.style.marginTop > 0) {
1613
- boxLines.push("".repeat(opts.style.marginTop));
1614
- }
1615
- if (opts.title) {
1616
- const title = _color ? _color(opts.title) : opts.title;
1617
- const left = borderStyle.h.repeat(
1618
- Math.floor((width - stripAnsi(opts.title).length) / 2)
1619
- );
1620
- const right = borderStyle.h.repeat(
1621
- width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
1622
- );
1623
- boxLines.push(
1624
- `${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
1625
- );
1626
- } else {
1627
- boxLines.push(
1628
- `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
1629
- );
1630
- }
1631
- const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
1632
- for (let i2 = 0; i2 < height; i2++) {
1633
- if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
1634
- boxLines.push(
1635
- `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
1636
- );
1637
- } else {
1638
- const line = textLines[i2 - valignOffset];
1639
- const left = " ".repeat(paddingOffset);
1640
- const right = " ".repeat(width - stripAnsi(line).length);
1641
- boxLines.push(
1642
- `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
1643
- );
1644
- }
1645
- }
1646
- boxLines.push(
1647
- `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
1648
- );
1649
- if (opts.style.marginBottom > 0) {
1650
- boxLines.push("".repeat(opts.style.marginBottom));
1651
- }
1652
- return boxLines.join("\n");
1653
- }
1654
- __name(box, "box");
1655
- var r2 = /* @__PURE__ */ Object.create(null);
1656
- var i = /* @__PURE__ */ __name((e2) => globalThis.process?.env || undefined || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e2 ? r2 : globalThis), "i");
1657
- var o2 = new Proxy(r2, { get(e2, s2) {
1658
- return i()[s2] ?? r2[s2];
1659
- }, has(e2, s2) {
1660
- const E = i();
1661
- return s2 in E || s2 in r2;
1662
- }, set(e2, s2, E) {
1663
- const B2 = i(true);
1664
- return B2[s2] = E, true;
1665
- }, deleteProperty(e2, s2) {
1666
- if (!s2) return false;
1667
- const E = i(true);
1668
- return delete E[s2], true;
1669
- }, ownKeys() {
1670
- const e2 = i(true);
1671
- return Object.keys(e2);
1672
- } });
1673
- var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
1674
- var f2 = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["CODESANDBOX", "CODESANDBOX_HOST", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
1675
- function b() {
1676
- if (globalThis.process?.env) for (const e2 of f2) {
1677
- const s2 = e2[1] || e2[0];
1678
- if (globalThis.process?.env[s2]) return { name: e2[0].toLowerCase(), ...e2[2] };
1679
- }
1680
- return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
1681
- }
1682
- __name(b, "b");
1683
- var l = b();
1684
- l.name;
1685
- function n(e2) {
1686
- return e2 ? e2 !== "false" : false;
1687
- }
1688
- __name(n, "n");
1689
- var I2 = globalThis.process?.platform || "";
1690
- var T2 = n(o2.CI) || l.ci !== false;
1691
- var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
1692
- var g2 = n(o2.DEBUG);
1693
- var R2 = t === "test" || n(o2.TEST);
1694
- n(o2.MINIMAL) || T2 || R2 || !a;
1695
- var A2 = /^win/i.test(I2);
1696
- !n(o2.NO_COLOR) && (n(o2.FORCE_COLOR) || (a || A2) && o2.TERM !== "dumb" || T2);
1697
- var C2 = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
1698
- Number(C2?.split(".")[0]) || null;
1699
- var y2 = globalThis.process || /* @__PURE__ */ Object.create(null);
1700
- var _2 = { versions: {} };
1701
- new Proxy(y2, { get(e2, s2) {
1702
- if (s2 === "env") return o2;
1703
- if (s2 in e2) return e2[s2];
1704
- if (s2 in _2) return _2[s2];
1705
- } });
1706
- var c2 = globalThis.process?.release?.name === "node";
1707
- var O2 = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
1708
- var D = !!globalThis.Deno;
1709
- var L2 = !!globalThis.fastly;
1710
- var S2 = !!globalThis.Netlify;
1711
- var u2 = !!globalThis.EdgeRuntime;
1712
- var N2 = globalThis.navigator?.userAgent === "Cloudflare-Workers";
1713
- var F2 = [[S2, "netlify"], [u2, "edge-light"], [N2, "workerd"], [L2, "fastly"], [D, "deno"], [O2, "bun"], [c2, "node"]];
1714
- function G2() {
1715
- const e2 = F2.find((s2) => s2[0]);
1716
- if (e2) return { name: e2[1] };
1717
- }
1718
- __name(G2, "G");
1719
- var P2 = G2();
1720
- P2?.name || "";
1721
- function ansiRegex2({ onlyFirst = false } = {}) {
1722
- const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
1723
- const pattern = [
1724
- `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
1725
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
1726
- ].join("|");
1727
- return new RegExp(pattern, onlyFirst ? void 0 : "g");
1728
- }
1729
- __name(ansiRegex2, "ansiRegex");
1730
- var regex = ansiRegex2();
1731
- function stripAnsi2(string) {
1732
- if (typeof string !== "string") {
1733
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
1734
- }
1735
- return string.replace(regex, "");
1736
- }
1737
- __name(stripAnsi2, "stripAnsi");
1738
- function isAmbiguous(x2) {
1739
- return x2 === 161 || x2 === 164 || x2 === 167 || x2 === 168 || x2 === 170 || x2 === 173 || x2 === 174 || x2 >= 176 && x2 <= 180 || x2 >= 182 && x2 <= 186 || x2 >= 188 && x2 <= 191 || x2 === 198 || x2 === 208 || x2 === 215 || x2 === 216 || x2 >= 222 && x2 <= 225 || x2 === 230 || x2 >= 232 && x2 <= 234 || x2 === 236 || x2 === 237 || x2 === 240 || x2 === 242 || x2 === 243 || x2 >= 247 && x2 <= 250 || x2 === 252 || x2 === 254 || x2 === 257 || x2 === 273 || x2 === 275 || x2 === 283 || x2 === 294 || x2 === 295 || x2 === 299 || x2 >= 305 && x2 <= 307 || x2 === 312 || x2 >= 319 && x2 <= 322 || x2 === 324 || x2 >= 328 && x2 <= 331 || x2 === 333 || x2 === 338 || x2 === 339 || x2 === 358 || x2 === 359 || x2 === 363 || x2 === 462 || x2 === 464 || x2 === 466 || x2 === 468 || x2 === 470 || x2 === 472 || x2 === 474 || x2 === 476 || x2 === 593 || x2 === 609 || x2 === 708 || x2 === 711 || x2 >= 713 && x2 <= 715 || x2 === 717 || x2 === 720 || x2 >= 728 && x2 <= 731 || x2 === 733 || x2 === 735 || x2 >= 768 && x2 <= 879 || x2 >= 913 && x2 <= 929 || x2 >= 931 && x2 <= 937 || x2 >= 945 && x2 <= 961 || x2 >= 963 && x2 <= 969 || x2 === 1025 || x2 >= 1040 && x2 <= 1103 || x2 === 1105 || x2 === 8208 || x2 >= 8211 && x2 <= 8214 || x2 === 8216 || x2 === 8217 || x2 === 8220 || x2 === 8221 || x2 >= 8224 && x2 <= 8226 || x2 >= 8228 && x2 <= 8231 || x2 === 8240 || x2 === 8242 || x2 === 8243 || x2 === 8245 || x2 === 8251 || x2 === 8254 || x2 === 8308 || x2 === 8319 || x2 >= 8321 && x2 <= 8324 || x2 === 8364 || x2 === 8451 || x2 === 8453 || x2 === 8457 || x2 === 8467 || x2 === 8470 || x2 === 8481 || x2 === 8482 || x2 === 8486 || x2 === 8491 || x2 === 8531 || x2 === 8532 || x2 >= 8539 && x2 <= 8542 || x2 >= 8544 && x2 <= 8555 || x2 >= 8560 && x2 <= 8569 || x2 === 8585 || x2 >= 8592 && x2 <= 8601 || x2 === 8632 || x2 === 8633 || x2 === 8658 || x2 === 8660 || x2 === 8679 || x2 === 8704 || x2 === 8706 || x2 === 8707 || x2 === 8711 || x2 === 8712 || x2 === 8715 || x2 === 8719 || x2 === 8721 || x2 === 8725 || x2 === 8730 || x2 >= 8733 && x2 <= 8736 || x2 === 8739 || x2 === 8741 || x2 >= 8743 && x2 <= 8748 || x2 === 8750 || x2 >= 8756 && x2 <= 8759 || x2 === 8764 || x2 === 8765 || x2 === 8776 || x2 === 8780 || x2 === 8786 || x2 === 8800 || x2 === 8801 || x2 >= 8804 && x2 <= 8807 || x2 === 8810 || x2 === 8811 || x2 === 8814 || x2 === 8815 || x2 === 8834 || x2 === 8835 || x2 === 8838 || x2 === 8839 || x2 === 8853 || x2 === 8857 || x2 === 8869 || x2 === 8895 || x2 === 8978 || x2 >= 9312 && x2 <= 9449 || x2 >= 9451 && x2 <= 9547 || x2 >= 9552 && x2 <= 9587 || x2 >= 9600 && x2 <= 9615 || x2 >= 9618 && x2 <= 9621 || x2 === 9632 || x2 === 9633 || x2 >= 9635 && x2 <= 9641 || x2 === 9650 || x2 === 9651 || x2 === 9654 || x2 === 9655 || x2 === 9660 || x2 === 9661 || x2 === 9664 || x2 === 9665 || x2 >= 9670 && x2 <= 9672 || x2 === 9675 || x2 >= 9678 && x2 <= 9681 || x2 >= 9698 && x2 <= 9701 || x2 === 9711 || x2 === 9733 || x2 === 9734 || x2 === 9737 || x2 === 9742 || x2 === 9743 || x2 === 9756 || x2 === 9758 || x2 === 9792 || x2 === 9794 || x2 === 9824 || x2 === 9825 || x2 >= 9827 && x2 <= 9829 || x2 >= 9831 && x2 <= 9834 || x2 === 9836 || x2 === 9837 || x2 === 9839 || x2 === 9886 || x2 === 9887 || x2 === 9919 || x2 >= 9926 && x2 <= 9933 || x2 >= 9935 && x2 <= 9939 || x2 >= 9941 && x2 <= 9953 || x2 === 9955 || x2 === 9960 || x2 === 9961 || x2 >= 9963 && x2 <= 9969 || x2 === 9972 || x2 >= 9974 && x2 <= 9977 || x2 === 9979 || x2 === 9980 || x2 === 9982 || x2 === 9983 || x2 === 10045 || x2 >= 10102 && x2 <= 10111 || x2 >= 11094 && x2 <= 11097 || x2 >= 12872 && x2 <= 12879 || x2 >= 57344 && x2 <= 63743 || x2 >= 65024 && x2 <= 65039 || x2 === 65533 || x2 >= 127232 && x2 <= 127242 || x2 >= 127248 && x2 <= 127277 || x2 >= 127280 && x2 <= 127337 || x2 >= 127344 && x2 <= 127373 || x2 === 127375 || x2 === 127376 || x2 >= 127387 && x2 <= 127404 || x2 >= 917760 && x2 <= 917999 || x2 >= 983040 && x2 <= 1048573 || x2 >= 1048576 && x2 <= 1114109;
1740
- }
1741
- __name(isAmbiguous, "isAmbiguous");
1742
- function isFullWidth(x2) {
1743
- return x2 === 12288 || x2 >= 65281 && x2 <= 65376 || x2 >= 65504 && x2 <= 65510;
1744
- }
1745
- __name(isFullWidth, "isFullWidth");
1746
- function isWide(x2) {
1747
- return x2 >= 4352 && x2 <= 4447 || x2 === 8986 || x2 === 8987 || x2 === 9001 || x2 === 9002 || x2 >= 9193 && x2 <= 9196 || x2 === 9200 || x2 === 9203 || x2 === 9725 || x2 === 9726 || x2 === 9748 || x2 === 9749 || x2 >= 9776 && x2 <= 9783 || x2 >= 9800 && x2 <= 9811 || x2 === 9855 || x2 >= 9866 && x2 <= 9871 || x2 === 9875 || x2 === 9889 || x2 === 9898 || x2 === 9899 || x2 === 9917 || x2 === 9918 || x2 === 9924 || x2 === 9925 || x2 === 9934 || x2 === 9940 || x2 === 9962 || x2 === 9970 || x2 === 9971 || x2 === 9973 || x2 === 9978 || x2 === 9981 || x2 === 9989 || x2 === 9994 || x2 === 9995 || x2 === 10024 || x2 === 10060 || x2 === 10062 || x2 >= 10067 && x2 <= 10069 || x2 === 10071 || x2 >= 10133 && x2 <= 10135 || x2 === 10160 || x2 === 10175 || x2 === 11035 || x2 === 11036 || x2 === 11088 || x2 === 11093 || x2 >= 11904 && x2 <= 11929 || x2 >= 11931 && x2 <= 12019 || x2 >= 12032 && x2 <= 12245 || x2 >= 12272 && x2 <= 12287 || x2 >= 12289 && x2 <= 12350 || x2 >= 12353 && x2 <= 12438 || x2 >= 12441 && x2 <= 12543 || x2 >= 12549 && x2 <= 12591 || x2 >= 12593 && x2 <= 12686 || x2 >= 12688 && x2 <= 12773 || x2 >= 12783 && x2 <= 12830 || x2 >= 12832 && x2 <= 12871 || x2 >= 12880 && x2 <= 42124 || x2 >= 42128 && x2 <= 42182 || x2 >= 43360 && x2 <= 43388 || x2 >= 44032 && x2 <= 55203 || x2 >= 63744 && x2 <= 64255 || x2 >= 65040 && x2 <= 65049 || x2 >= 65072 && x2 <= 65106 || x2 >= 65108 && x2 <= 65126 || x2 >= 65128 && x2 <= 65131 || x2 >= 94176 && x2 <= 94180 || x2 === 94192 || x2 === 94193 || x2 >= 94208 && x2 <= 100343 || x2 >= 100352 && x2 <= 101589 || x2 >= 101631 && x2 <= 101640 || x2 >= 110576 && x2 <= 110579 || x2 >= 110581 && x2 <= 110587 || x2 === 110589 || x2 === 110590 || x2 >= 110592 && x2 <= 110882 || x2 === 110898 || x2 >= 110928 && x2 <= 110930 || x2 === 110933 || x2 >= 110948 && x2 <= 110951 || x2 >= 110960 && x2 <= 111355 || x2 >= 119552 && x2 <= 119638 || x2 >= 119648 && x2 <= 119670 || x2 === 126980 || x2 === 127183 || x2 === 127374 || x2 >= 127377 && x2 <= 127386 || x2 >= 127488 && x2 <= 127490 || x2 >= 127504 && x2 <= 127547 || x2 >= 127552 && x2 <= 127560 || x2 === 127568 || x2 === 127569 || x2 >= 127584 && x2 <= 127589 || x2 >= 127744 && x2 <= 127776 || x2 >= 127789 && x2 <= 127797 || x2 >= 127799 && x2 <= 127868 || x2 >= 127870 && x2 <= 127891 || x2 >= 127904 && x2 <= 127946 || x2 >= 127951 && x2 <= 127955 || x2 >= 127968 && x2 <= 127984 || x2 === 127988 || x2 >= 127992 && x2 <= 128062 || x2 === 128064 || x2 >= 128066 && x2 <= 128252 || x2 >= 128255 && x2 <= 128317 || x2 >= 128331 && x2 <= 128334 || x2 >= 128336 && x2 <= 128359 || x2 === 128378 || x2 === 128405 || x2 === 128406 || x2 === 128420 || x2 >= 128507 && x2 <= 128591 || x2 >= 128640 && x2 <= 128709 || x2 === 128716 || x2 >= 128720 && x2 <= 128722 || x2 >= 128725 && x2 <= 128727 || x2 >= 128732 && x2 <= 128735 || x2 === 128747 || x2 === 128748 || x2 >= 128756 && x2 <= 128764 || x2 >= 128992 && x2 <= 129003 || x2 === 129008 || x2 >= 129292 && x2 <= 129338 || x2 >= 129340 && x2 <= 129349 || x2 >= 129351 && x2 <= 129535 || x2 >= 129648 && x2 <= 129660 || x2 >= 129664 && x2 <= 129673 || x2 >= 129679 && x2 <= 129734 || x2 >= 129742 && x2 <= 129756 || x2 >= 129759 && x2 <= 129769 || x2 >= 129776 && x2 <= 129784 || x2 >= 131072 && x2 <= 196605 || x2 >= 196608 && x2 <= 262141;
1748
- }
1749
- __name(isWide, "isWide");
1750
- function validate(codePoint) {
1751
- if (!Number.isSafeInteger(codePoint)) {
1752
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
1753
- }
1754
- }
1755
- __name(validate, "validate");
1756
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
1757
- validate(codePoint);
1758
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
1759
- return 2;
1760
- }
1761
- return 1;
1762
- }
1763
- __name(eastAsianWidth, "eastAsianWidth");
1764
- var emojiRegex = /* @__PURE__ */ __name(() => {
1765
- 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;
1766
- }, "emojiRegex");
1767
- var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: /* @__PURE__ */ __name((str) => str.split(""), "segment") };
1768
- var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
1769
- function stringWidth$1(string, options = {}) {
1770
- if (typeof string !== "string" || string.length === 0) {
1771
- return 0;
1772
- }
1773
- const {
1774
- ambiguousIsNarrow = true,
1775
- countAnsiEscapeCodes = false
1776
- } = options;
1777
- if (!countAnsiEscapeCodes) {
1778
- string = stripAnsi2(string);
1779
- }
1780
- if (string.length === 0) {
1781
- return 0;
1782
- }
1783
- let width = 0;
1784
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
1785
- for (const { segment: character } of segmenter.segment(string)) {
1786
- const codePoint = character.codePointAt(0);
1787
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
1788
- continue;
1789
- }
1790
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
1791
- continue;
1792
- }
1793
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
1794
- continue;
1795
- }
1796
- if (codePoint >= 55296 && codePoint <= 57343) {
1797
- continue;
1798
- }
1799
- if (codePoint >= 65024 && codePoint <= 65039) {
1800
- continue;
1801
- }
1802
- if (defaultIgnorableCodePointRegex.test(character)) {
1803
- continue;
1804
- }
1805
- if (emojiRegex().test(character)) {
1806
- width += 2;
1807
- continue;
1808
- }
1809
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
1810
- }
1811
- return width;
1812
- }
1813
- __name(stringWidth$1, "stringWidth$1");
1814
- function isUnicodeSupported() {
1815
- const { env: env2 } = g__default.default;
1816
- const { TERM, TERM_PROGRAM } = env2;
1817
- if (g__default.default.platform !== "win32") {
1818
- return TERM !== "linux";
1819
- }
1820
- return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1821
- }
1822
- __name(isUnicodeSupported, "isUnicodeSupported");
1823
- var TYPE_COLOR_MAP = {
1824
- info: "cyan",
1825
- fail: "red",
1826
- success: "green",
1827
- ready: "green",
1828
- start: "magenta"
1829
- };
1830
- var LEVEL_COLOR_MAP = {
1831
- 0: "red",
1832
- 1: "yellow"
1833
- };
1834
- var unicode = isUnicodeSupported();
1835
- var s = /* @__PURE__ */ __name((c3, fallback) => unicode ? c3 : fallback, "s");
1836
- var TYPE_ICONS = {
1837
- error: s("\u2716", "\xD7"),
1838
- fatal: s("\u2716", "\xD7"),
1839
- ready: s("\u2714", "\u221A"),
1840
- warn: s("\u26A0", "\u203C"),
1841
- info: s("\u2139", "i"),
1842
- success: s("\u2714", "\u221A"),
1843
- debug: s("\u2699", "D"),
1844
- trace: s("\u2192", "\u2192"),
1845
- fail: s("\u2716", "\xD7"),
1846
- start: s("\u25D0", "o"),
1847
- log: ""
1848
- };
1849
- function stringWidth(str) {
1850
- const hasICU = typeof Intl === "object";
1851
- if (!hasICU || !Intl.Segmenter) {
1852
- return stripAnsi(str).length;
1853
- }
1854
- return stringWidth$1(str);
1855
- }
1856
- __name(stringWidth, "stringWidth");
1857
- var FancyReporter = class extends BasicReporter {
1858
- static {
1859
- __name(this, "FancyReporter");
1860
- }
1861
- formatStack(stack, message, opts) {
1862
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1863
- return `
1864
- ${indent}` + parseStack(stack, message).map(
1865
- (line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_3, m2) => `(${colors.cyan(m2)})`)
1866
- ).join(`
1867
- ${indent}`);
1868
- }
1869
- formatType(logObj, isBadge, opts) {
1870
- const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
1871
- if (isBadge) {
1872
- return getBgColor(typeColor)(
1873
- colors.black(` ${logObj.type.toUpperCase()} `)
1874
- );
1875
- }
1876
- const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
1877
- return _type ? getColor2(typeColor)(_type) : "";
1878
- }
1879
- formatLogObj(logObj, opts) {
1880
- const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
1881
- "\n"
1882
- );
1883
- if (logObj.type === "box") {
1884
- return box(
1885
- characterFormat(
1886
- message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
1887
- ),
1888
- {
1889
- title: logObj.title ? characterFormat(logObj.title) : void 0,
1890
- style: logObj.style
1891
- }
1892
- );
1893
- }
1894
- const date = this.formatDate(logObj.date, opts);
1895
- const coloredDate = date && colors.gray(date);
1896
- const isBadge = logObj.badge ?? logObj.level < 2;
1897
- const type = this.formatType(logObj, isBadge, opts);
1898
- const tag = logObj.tag ? colors.gray(logObj.tag) : "";
1899
- let line;
1900
- const left = this.filterAndJoin([type, characterFormat(message)]);
1901
- const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
1902
- const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
1903
- line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
1904
- line += characterFormat(
1905
- additional.length > 0 ? "\n" + additional.join("\n") : ""
1906
- );
1907
- if (logObj.type === "trace") {
1908
- const _err = new Error("Trace: " + logObj.message);
1909
- line += this.formatStack(_err.stack || "", _err.message);
1910
- }
1911
- return isBadge ? "\n" + line + "\n" : line;
1912
- }
1913
- };
1914
- function characterFormat(str) {
1915
- return str.replace(/`([^`]+)`/gm, (_3, m2) => colors.cyan(m2)).replace(/\s+_([^_]+)_\s+/gm, (_3, m2) => ` ${colors.underline(m2)} `);
1916
- }
1917
- __name(characterFormat, "characterFormat");
1918
- function getColor2(color = "white") {
1919
- return colors[color] || colors.white;
1920
- }
1921
- __name(getColor2, "getColor");
1922
- function getBgColor(color = "bgWhite") {
1923
- return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
1924
- }
1925
- __name(getBgColor, "getBgColor");
1926
- function createConsola2(options = {}) {
1927
- let level = _getDefaultLogLevel();
1928
- if (process.env.CONSOLA_LEVEL) {
1929
- level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
1930
- }
1931
- const consola2 = createConsola({
1932
- level,
1933
- defaults: { level },
1934
- stdout: process.stdout,
1935
- stderr: process.stderr,
1936
- prompt: /* @__PURE__ */ __name((...args) => Promise.resolve().then(() => (init_prompt(), prompt_exports)).then((m2) => m2.prompt(...args)), "prompt"),
1937
- reporters: options.reporters || [
1938
- options.fancy ?? !(T2 || R2) ? new FancyReporter() : new BasicReporter()
1939
- ],
1940
- ...options
1941
- });
1942
- return consola2;
1943
- }
1944
- __name(createConsola2, "createConsola");
1945
- function _getDefaultLogLevel() {
1946
- if (g2) {
1947
- return LogLevels.debug;
1948
- }
1949
- if (R2) {
1950
- return LogLevels.warn;
1951
- }
1952
- return LogLevels.info;
1953
- }
1954
- __name(_getDefaultLogLevel, "_getDefaultLogLevel");
1955
- var consola = createConsola2();
1956
-
1957
- // ../../node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs
1958
- function toArray(val) {
1959
- if (Array.isArray(val)) {
1960
- return val;
1961
- }
1962
- return val === void 0 ? [] : [val];
1963
- }
1964
- __name(toArray, "toArray");
1965
- function formatLineColumns(lines, linePrefix = "") {
1966
- const maxLengh = [];
1967
- for (const line of lines) {
1968
- for (const [i2, element] of line.entries()) {
1969
- maxLengh[i2] = Math.max(maxLengh[i2] || 0, element.length);
1970
- }
1971
- }
1972
- return lines.map(
1973
- (l2) => l2.map(
1974
- (c3, i2) => linePrefix + c3[i2 === 0 ? "padStart" : "padEnd"](maxLengh[i2])
1975
- ).join(" ")
1976
- ).join("\n");
1977
- }
1978
- __name(formatLineColumns, "formatLineColumns");
1979
- function resolveValue(input) {
1980
- return typeof input === "function" ? input() : input;
1981
- }
1982
- __name(resolveValue, "resolveValue");
1983
- var CLIError = class extends Error {
1984
- static {
1985
- __name(this, "CLIError");
1986
- }
1987
- constructor(message, code) {
1988
- super(message);
1989
- this.code = code;
1990
- this.name = "CLIError";
1991
- }
1992
- };
1993
- var NUMBER_CHAR_RE = /\d/;
1994
- var STR_SPLITTERS = ["-", "_", "/", "."];
1995
- function isUppercase(char = "") {
1996
- if (NUMBER_CHAR_RE.test(char)) {
1997
- return void 0;
1998
- }
1999
- return char !== char.toLowerCase();
2000
- }
2001
- __name(isUppercase, "isUppercase");
2002
- function splitByCase(str, separators) {
2003
- const splitters = separators ?? STR_SPLITTERS;
2004
- const parts = [];
2005
- if (!str || typeof str !== "string") {
2006
- return parts;
2007
- }
2008
- let buff = "";
2009
- let previousUpper;
2010
- let previousSplitter;
2011
- for (const char of str) {
2012
- const isSplitter = splitters.includes(char);
2013
- if (isSplitter === true) {
2014
- parts.push(buff);
2015
- buff = "";
2016
- previousUpper = void 0;
2017
- continue;
2018
- }
2019
- const isUpper = isUppercase(char);
2020
- if (previousSplitter === false) {
2021
- if (previousUpper === false && isUpper === true) {
2022
- parts.push(buff);
2023
- buff = char;
2024
- previousUpper = isUpper;
2025
- continue;
2026
- }
2027
- if (previousUpper === true && isUpper === false && buff.length > 1) {
2028
- const lastChar = buff.at(-1);
2029
- parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
2030
- buff = lastChar + char;
2031
- previousUpper = isUpper;
2032
- continue;
2033
- }
2034
- }
2035
- buff += char;
2036
- previousUpper = isUpper;
2037
- previousSplitter = isSplitter;
2038
- }
2039
- parts.push(buff);
2040
- return parts;
2041
- }
2042
- __name(splitByCase, "splitByCase");
2043
- function upperFirst(str) {
2044
- return str ? str[0].toUpperCase() + str.slice(1) : "";
2045
- }
2046
- __name(upperFirst, "upperFirst");
2047
- function lowerFirst(str) {
2048
- return str ? str[0].toLowerCase() + str.slice(1) : "";
2049
- }
2050
- __name(lowerFirst, "lowerFirst");
2051
- function pascalCase(str, opts) {
2052
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
2053
- }
2054
- __name(pascalCase, "pascalCase");
2055
- function camelCase(str, opts) {
2056
- return lowerFirst(pascalCase(str || "", opts));
2057
- }
2058
- __name(camelCase, "camelCase");
2059
- function kebabCase(str, joiner) {
2060
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
2061
- }
2062
- __name(kebabCase, "kebabCase");
2063
- function toArr(any) {
2064
- return any == void 0 ? [] : Array.isArray(any) ? any : [any];
2065
- }
2066
- __name(toArr, "toArr");
2067
- function toVal(out, key, val, opts) {
2068
- let x2;
2069
- const old = out[key];
2070
- 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((x2 = +val, x2 * 0 === 0) ? x2 : val), !!val) : (x2 = +val, x2 * 0 === 0) ? x2 : val;
2071
- out[key] = old == void 0 ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
2072
- }
2073
- __name(toVal, "toVal");
2074
- function parseRawArgs(args = [], opts = {}) {
2075
- let k2;
2076
- let arr;
2077
- let arg;
2078
- let name;
2079
- let val;
2080
- const out = { _: [] };
2081
- let i2 = 0;
2082
- let j = 0;
2083
- let idx = 0;
2084
- const len = args.length;
2085
- const alibi = opts.alias !== void 0;
2086
- const strict = opts.unknown !== void 0;
2087
- const defaults = opts.default !== void 0;
2088
- opts.alias = opts.alias || {};
2089
- opts.string = toArr(opts.string);
2090
- opts.boolean = toArr(opts.boolean);
2091
- if (alibi) {
2092
- for (k2 in opts.alias) {
2093
- arr = opts.alias[k2] = toArr(opts.alias[k2]);
2094
- for (i2 = 0; i2 < arr.length; i2++) {
2095
- (opts.alias[arr[i2]] = arr.concat(k2)).splice(i2, 1);
2096
- }
2097
- }
2098
- }
2099
- for (i2 = opts.boolean.length; i2-- > 0; ) {
2100
- arr = opts.alias[opts.boolean[i2]] || [];
2101
- for (j = arr.length; j-- > 0; ) {
2102
- opts.boolean.push(arr[j]);
2103
- }
2104
- }
2105
- for (i2 = opts.string.length; i2-- > 0; ) {
2106
- arr = opts.alias[opts.string[i2]] || [];
2107
- for (j = arr.length; j-- > 0; ) {
2108
- opts.string.push(arr[j]);
2109
- }
2110
- }
2111
- if (defaults) {
2112
- for (k2 in opts.default) {
2113
- name = typeof opts.default[k2];
2114
- arr = opts.alias[k2] = opts.alias[k2] || [];
2115
- if (opts[name] !== void 0) {
2116
- opts[name].push(k2);
2117
- for (i2 = 0; i2 < arr.length; i2++) {
2118
- opts[name].push(arr[i2]);
2119
- }
2120
- }
2121
- }
2122
- }
2123
- const keys = strict ? Object.keys(opts.alias) : [];
2124
- for (i2 = 0; i2 < len; i2++) {
2125
- arg = args[i2];
2126
- if (arg === "--") {
2127
- out._ = out._.concat(args.slice(++i2));
2128
- break;
2129
- }
2130
- for (j = 0; j < arg.length; j++) {
2131
- if (arg.charCodeAt(j) !== 45) {
2132
- break;
2133
- }
2134
- }
2135
- if (j === 0) {
2136
- out._.push(arg);
2137
- } else if (arg.substring(j, j + 3) === "no-") {
2138
- name = arg.slice(Math.max(0, j + 3));
2139
- if (strict && !~keys.indexOf(name)) {
2140
- return opts.unknown(arg);
2141
- }
2142
- out[name] = false;
2143
- } else {
2144
- for (idx = j + 1; idx < arg.length; idx++) {
2145
- if (arg.charCodeAt(idx) === 61) {
2146
- break;
2147
- }
2148
- }
2149
- name = arg.substring(j, idx);
2150
- val = arg.slice(Math.max(0, ++idx)) || i2 + 1 === len || ("" + args[i2 + 1]).charCodeAt(0) === 45 || args[++i2];
2151
- arr = j === 2 ? [name] : name;
2152
- for (idx = 0; idx < arr.length; idx++) {
2153
- name = arr[idx];
2154
- if (strict && !~keys.indexOf(name)) {
2155
- return opts.unknown("-".repeat(j) + name);
2156
- }
2157
- toVal(out, name, idx + 1 < arr.length || val, opts);
2158
- }
2159
- }
2160
- }
2161
- if (defaults) {
2162
- for (k2 in opts.default) {
2163
- if (out[k2] === void 0) {
2164
- out[k2] = opts.default[k2];
2165
- }
2166
- }
2167
- }
2168
- if (alibi) {
2169
- for (k2 in out) {
2170
- arr = opts.alias[k2] || [];
2171
- while (arr.length > 0) {
2172
- out[arr.shift()] = out[k2];
2173
- }
2174
- }
2175
- }
2176
- return out;
2177
- }
2178
- __name(parseRawArgs, "parseRawArgs");
2179
- function parseArgs(rawArgs, argsDef) {
2180
- const parseOptions = {
2181
- boolean: [],
2182
- string: [],
2183
- mixed: [],
2184
- alias: {},
2185
- default: {}
2186
- };
2187
- const args = resolveArgs(argsDef);
2188
- for (const arg of args) {
2189
- if (arg.type === "positional") {
2190
- continue;
2191
- }
2192
- if (arg.type === "string") {
2193
- parseOptions.string.push(arg.name);
2194
- } else if (arg.type === "boolean") {
2195
- parseOptions.boolean.push(arg.name);
2196
- }
2197
- if (arg.default !== void 0) {
2198
- parseOptions.default[arg.name] = arg.default;
2199
- }
2200
- if (arg.alias) {
2201
- parseOptions.alias[arg.name] = arg.alias;
2202
- }
2203
- }
2204
- const parsed = parseRawArgs(rawArgs, parseOptions);
2205
- const [...positionalArguments] = parsed._;
2206
- const parsedArgsProxy = new Proxy(parsed, {
2207
- get(target, prop) {
2208
- return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
2209
- }
2210
- });
2211
- for (const [, arg] of args.entries()) {
2212
- if (arg.type === "positional") {
2213
- const nextPositionalArgument = positionalArguments.shift();
2214
- if (nextPositionalArgument !== void 0) {
2215
- parsedArgsProxy[arg.name] = nextPositionalArgument;
2216
- } else if (arg.default === void 0 && arg.required !== false) {
2217
- throw new CLIError(
2218
- `Missing required positional argument: ${arg.name.toUpperCase()}`,
2219
- "EARG"
2220
- );
2221
- } else {
2222
- parsedArgsProxy[arg.name] = arg.default;
2223
- }
2224
- } else if (arg.required && parsedArgsProxy[arg.name] === void 0) {
2225
- throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
2226
- }
2227
- }
2228
- return parsedArgsProxy;
2229
- }
2230
- __name(parseArgs, "parseArgs");
2231
- function resolveArgs(argsDef) {
2232
- const args = [];
2233
- for (const [name, argDef] of Object.entries(argsDef || {})) {
2234
- args.push({
2235
- ...argDef,
2236
- name,
2237
- alias: toArray(argDef.alias)
2238
- });
2239
- }
2240
- return args;
2241
- }
2242
- __name(resolveArgs, "resolveArgs");
2243
- function defineCommand(def) {
2244
- return def;
2245
- }
2246
- __name(defineCommand, "defineCommand");
2247
- async function runCommand(cmd, opts) {
2248
- const cmdArgs = await resolveValue(cmd.args || {});
2249
- const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
2250
- const context = {
2251
- rawArgs: opts.rawArgs,
2252
- args: parsedArgs,
2253
- data: opts.data,
2254
- cmd
2255
- };
2256
- if (typeof cmd.setup === "function") {
2257
- await cmd.setup(context);
2258
- }
2259
- let result;
2260
- try {
2261
- const subCommands = await resolveValue(cmd.subCommands);
2262
- if (subCommands && Object.keys(subCommands).length > 0) {
2263
- const subCommandArgIndex = opts.rawArgs.findIndex(
2264
- (arg) => !arg.startsWith("-")
2265
- );
2266
- const subCommandName = opts.rawArgs[subCommandArgIndex];
2267
- if (subCommandName) {
2268
- if (!subCommands[subCommandName]) {
2269
- throw new CLIError(
2270
- `Unknown command \`${subCommandName}\``,
2271
- "E_UNKNOWN_COMMAND"
2272
- );
2273
- }
2274
- const subCommand = await resolveValue(subCommands[subCommandName]);
2275
- if (subCommand) {
2276
- await runCommand(subCommand, {
2277
- rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
2278
- });
2279
- }
2280
- } else if (!cmd.run) {
2281
- throw new CLIError(`No command specified.`, "E_NO_COMMAND");
2282
- }
2283
- }
2284
- if (typeof cmd.run === "function") {
2285
- result = await cmd.run(context);
2286
- }
2287
- } finally {
2288
- if (typeof cmd.cleanup === "function") {
2289
- await cmd.cleanup(context);
2290
- }
2291
- }
2292
- return { result };
2293
- }
2294
- __name(runCommand, "runCommand");
2295
- async function resolveSubCommand(cmd, rawArgs, parent) {
2296
- const subCommands = await resolveValue(cmd.subCommands);
2297
- if (subCommands && Object.keys(subCommands).length > 0) {
2298
- const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
2299
- const subCommandName = rawArgs[subCommandArgIndex];
2300
- const subCommand = await resolveValue(subCommands[subCommandName]);
2301
- if (subCommand) {
2302
- return resolveSubCommand(
2303
- subCommand,
2304
- rawArgs.slice(subCommandArgIndex + 1),
2305
- cmd
2306
- );
2307
- }
2308
- }
2309
- return [cmd, parent];
2310
- }
2311
- __name(resolveSubCommand, "resolveSubCommand");
2312
- async function showUsage(cmd, parent) {
2313
- try {
2314
- consola.log(await renderUsage(cmd, parent) + "\n");
2315
- } catch (error) {
2316
- consola.error(error);
2317
- }
2318
- }
2319
- __name(showUsage, "showUsage");
2320
- async function renderUsage(cmd, parent) {
2321
- const cmdMeta = await resolveValue(cmd.meta || {});
2322
- const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
2323
- const parentMeta = await resolveValue(parent?.meta || {});
2324
- const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
2325
- const argLines = [];
2326
- const posLines = [];
2327
- const commandsLines = [];
2328
- const usageLine = [];
2329
- for (const arg of cmdArgs) {
2330
- if (arg.type === "positional") {
2331
- const name = arg.name.toUpperCase();
2332
- const isRequired = arg.required !== false && arg.default === void 0;
2333
- const defaultHint = arg.default ? `="${arg.default}"` : "";
2334
- posLines.push([
2335
- "`" + name + defaultHint + "`",
2336
- arg.description || "",
2337
- arg.valueHint ? `<${arg.valueHint}>` : ""
2338
- ]);
2339
- usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
2340
- } else {
2341
- const isRequired = arg.required === true && arg.default === void 0;
2342
- const argStr = (arg.type === "boolean" && arg.default === true ? [
2343
- ...(arg.alias || []).map((a2) => `--no-${a2}`),
2344
- `--no-${arg.name}`
2345
- ].join(", ") : [...(arg.alias || []).map((a2) => `-${a2}`), `--${arg.name}`].join(
2346
- ", "
2347
- )) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
2348
- argLines.push([
2349
- "`" + argStr + (isRequired ? " (required)" : "") + "`",
2350
- arg.description || ""
2351
- ]);
2352
- if (isRequired) {
2353
- usageLine.push(argStr);
2354
- }
2355
- }
2356
- }
2357
- if (cmd.subCommands) {
2358
- const commandNames = [];
2359
- const subCommands = await resolveValue(cmd.subCommands);
2360
- for (const [name, sub] of Object.entries(subCommands)) {
2361
- const subCmd = await resolveValue(sub);
2362
- const meta = await resolveValue(subCmd?.meta);
2363
- commandsLines.push([`\`${name}\``, meta?.description || ""]);
2364
- commandNames.push(name);
2365
- }
2366
- usageLine.push(commandNames.join("|"));
2367
- }
2368
- const usageLines = [];
2369
- const version = cmdMeta.version || parentMeta.version;
2370
- usageLines.push(
2371
- colors.gray(
2372
- `${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`
2373
- ),
2374
- ""
2375
- );
2376
- const hasOptions = argLines.length > 0 || posLines.length > 0;
2377
- usageLines.push(
2378
- `${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``,
2379
- ""
2380
- );
2381
- if (posLines.length > 0) {
2382
- usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
2383
- usageLines.push(formatLineColumns(posLines, " "));
2384
- usageLines.push("");
2385
- }
2386
- if (argLines.length > 0) {
2387
- usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
2388
- usageLines.push(formatLineColumns(argLines, " "));
2389
- usageLines.push("");
2390
- }
2391
- if (commandsLines.length > 0) {
2392
- usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
2393
- usageLines.push(formatLineColumns(commandsLines, " "));
2394
- usageLines.push(
2395
- "",
2396
- `Use \`${commandName} <command> --help\` for more information about a command.`
2397
- );
2398
- }
2399
- return usageLines.filter((l2) => typeof l2 === "string").join("\n");
2400
- }
2401
- __name(renderUsage, "renderUsage");
2402
- async function runMain(cmd, opts = {}) {
2403
- const rawArgs = opts.rawArgs || process.argv.slice(2);
2404
- const showUsage$1 = opts.showUsage || showUsage;
2405
- try {
2406
- if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
2407
- await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2408
- process.exit(0);
2409
- } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
2410
- const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
2411
- if (!meta?.version) {
2412
- throw new CLIError("No version specified", "E_NO_VERSION");
2413
- }
2414
- consola.log(meta.version);
2415
- } else {
2416
- await runCommand(cmd, { rawArgs });
2417
- }
2418
- } catch (error) {
2419
- const isCLIError = error instanceof CLIError;
2420
- if (!isCLIError) {
2421
- consola.error(error, "\n");
2422
- }
2423
- if (isCLIError) {
2424
- await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2425
- }
2426
- consola.error(error.message);
2427
- process.exit(1);
2428
- }
2429
- }
2430
- __name(runMain, "runMain");
2431
-
2432
- // src/cli/init.ts
2433
12
  var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('init.js', document.baseURI).href)));
2434
13
  var __dirname$1 = path.dirname(__filename$1);
2435
- var main = defineCommand({
14
+ var main = citty.defineCommand({
2436
15
  meta: {
2437
16
  name: "nestjs-ssr",
2438
17
  description: "Initialize @nestjs-ssr/react in your NestJS project",
@@ -2458,77 +37,59 @@ var main = defineCommand({
2458
37
  async run({ args }) {
2459
38
  const cwd = process.cwd();
2460
39
  const viewsDir = args.views;
2461
- consola.box("@nestjs-ssr/react initialization");
2462
- consola.start("Setting up your NestJS SSR React project...\n");
40
+ consola.consola.box("@nestjs-ssr/react initialization");
41
+ consola.consola.start("Setting up your NestJS SSR React project...\n");
2463
42
  const templateLocations = [
2464
43
  path.resolve(__dirname$1, "../../src/templates"),
2465
44
  path.resolve(__dirname$1, "../templates")
2466
45
  ];
2467
46
  const templateDir = templateLocations.find((loc) => fs.existsSync(path.join(loc, "entry-client.tsx")));
2468
47
  if (!templateDir) {
2469
- consola.error("Failed to locate template files");
2470
- consola.info("Searched:", templateLocations);
2471
- process.exit(1);
2472
- }
2473
- const globalTypesLocations = [
2474
- path.resolve(__dirname$1, "../../src/global.d.ts"),
2475
- path.resolve(__dirname$1, "../global.d.ts")
2476
- ];
2477
- const globalTypesSrc = globalTypesLocations.find((loc) => fs.existsSync(loc));
2478
- if (!globalTypesSrc) {
2479
- consola.error("Failed to locate global.d.ts");
2480
- consola.info("Searched:", globalTypesLocations);
48
+ consola.consola.error("Failed to locate template files");
49
+ consola.consola.info("Searched:", templateLocations);
2481
50
  process.exit(1);
2482
51
  }
2483
52
  const tsconfigPath = path.join(cwd, "tsconfig.json");
2484
53
  if (!fs.existsSync(tsconfigPath)) {
2485
- consola.error("No tsconfig.json found in project root");
2486
- consola.info("Please create a tsconfig.json file first");
54
+ consola.consola.error("No tsconfig.json found in project root");
55
+ consola.consola.info("Please create a tsconfig.json file first");
2487
56
  process.exit(1);
2488
57
  }
2489
- consola.start("Creating entry-client.tsx...");
58
+ consola.consola.start("Creating entry-client.tsx...");
2490
59
  const entryClientSrc = path.join(templateDir, "entry-client.tsx");
2491
60
  const entryClientDest = path.join(cwd, viewsDir, "entry-client.tsx");
2492
61
  fs.mkdirSync(path.join(cwd, viewsDir), {
2493
62
  recursive: true
2494
63
  });
2495
64
  if (fs.existsSync(entryClientDest) && !args.force) {
2496
- consola.warn(`${viewsDir}/entry-client.tsx already exists (use --force to overwrite)`);
65
+ consola.consola.warn(`${viewsDir}/entry-client.tsx already exists (use --force to overwrite)`);
2497
66
  } else {
2498
67
  fs.copyFileSync(entryClientSrc, entryClientDest);
2499
- consola.success(`Created ${viewsDir}/entry-client.tsx`);
68
+ consola.consola.success(`Created ${viewsDir}/entry-client.tsx`);
2500
69
  }
2501
- consola.start("Creating entry-server.tsx...");
70
+ consola.consola.start("Creating entry-server.tsx...");
2502
71
  const entryServerSrc = path.join(templateDir, "entry-server.tsx");
2503
72
  const entryServerDest = path.join(cwd, viewsDir, "entry-server.tsx");
2504
73
  if (fs.existsSync(entryServerDest) && !args.force) {
2505
- consola.warn(`${viewsDir}/entry-server.tsx already exists (use --force to overwrite)`);
74
+ consola.consola.warn(`${viewsDir}/entry-server.tsx already exists (use --force to overwrite)`);
2506
75
  } else {
2507
76
  fs.copyFileSync(entryServerSrc, entryServerDest);
2508
- consola.success(`Created ${viewsDir}/entry-server.tsx`);
77
+ consola.consola.success(`Created ${viewsDir}/entry-server.tsx`);
2509
78
  }
2510
- consola.start("Creating global.d.ts...");
2511
- const globalTypesDest = path.join(cwd, "src/global.d.ts");
2512
- if (fs.existsSync(globalTypesDest) && !args.force) {
2513
- consola.warn("src/global.d.ts already exists (use --force to overwrite)");
2514
- } else {
2515
- fs.copyFileSync(globalTypesSrc, globalTypesDest);
2516
- consola.success("Created src/global.d.ts");
2517
- }
2518
- consola.start("Configuring vite.config.js...");
79
+ consola.consola.start("Configuring vite.config.js...");
2519
80
  const viteConfigPath = path.join(cwd, "vite.config.js");
2520
81
  const viteConfigTs = path.join(cwd, "vite.config.ts");
2521
82
  const useTypeScript = fs.existsSync(viteConfigTs);
2522
83
  const configPath = useTypeScript ? viteConfigTs : viteConfigPath;
2523
84
  if (fs.existsSync(configPath)) {
2524
- consola.warn(`${useTypeScript ? "vite.config.ts" : "vite.config.js"} already exists`);
2525
- consola.info("Please manually add to your Vite config:");
2526
- consola.log(" import { resolve } from 'path';");
2527
- consola.log(" build: {");
2528
- consola.log(" rollupOptions: {");
2529
- consola.log(` input: { client: resolve(__dirname, '${viewsDir}/entry-client.tsx') }`);
2530
- consola.log(" }");
2531
- consola.log(" }");
85
+ consola.consola.warn(`${useTypeScript ? "vite.config.ts" : "vite.config.js"} already exists`);
86
+ consola.consola.info("Please manually add to your Vite config:");
87
+ consola.consola.log(" import { resolve } from 'path';");
88
+ consola.consola.log(" build: {");
89
+ consola.consola.log(" rollupOptions: {");
90
+ consola.consola.log(` input: { client: resolve(__dirname, '${viewsDir}/entry-client.tsx') }`);
91
+ consola.consola.log(" }");
92
+ consola.consola.log(" }");
2532
93
  } else {
2533
94
  const viteConfig = `import { defineConfig } from 'vite';
2534
95
  import react from '@vitejs/plugin-react';
@@ -2558,9 +119,9 @@ export default defineConfig({
2558
119
  });
2559
120
  `;
2560
121
  fs.writeFileSync(viteConfigPath, viteConfig);
2561
- consola.success("Created vite.config.js");
122
+ consola.consola.success("Created vite.config.js");
2562
123
  }
2563
- consola.start("Configuring tsconfig.json...");
124
+ consola.consola.start("Configuring tsconfig.json...");
2564
125
  try {
2565
126
  const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, "utf-8"));
2566
127
  let updated = false;
@@ -2580,58 +141,133 @@ export default defineConfig({
2580
141
  ];
2581
142
  updated = true;
2582
143
  }
2583
- if (!tsconfig.compilerOptions.types) {
2584
- tsconfig.compilerOptions.types = [];
144
+ if (!tsconfig.include) {
145
+ tsconfig.include = [];
146
+ }
147
+ const hasTsx = tsconfig.include.some((pattern) => pattern.includes("**/*.tsx"));
148
+ if (!hasTsx) {
149
+ if (!tsconfig.include.includes("src/**/*.tsx")) {
150
+ tsconfig.include.push("src/**/*.tsx");
151
+ updated = true;
152
+ }
153
+ }
154
+ if (!tsconfig.exclude) {
155
+ tsconfig.exclude = [];
2585
156
  }
2586
- if (!tsconfig.compilerOptions.types.includes("vite/client")) {
2587
- tsconfig.compilerOptions.types.push("vite/client");
157
+ const hasEntryClientExclude = tsconfig.exclude.some((pattern) => pattern.includes("entry-client.tsx"));
158
+ if (!hasEntryClientExclude) {
159
+ tsconfig.exclude.push("src/views/entry-client.tsx");
2588
160
  updated = true;
2589
161
  }
2590
162
  if (updated) {
2591
163
  fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2));
2592
- consola.success("Updated tsconfig.json");
164
+ consola.consola.success("Updated tsconfig.json");
2593
165
  } else {
2594
- consola.info("tsconfig.json already configured");
166
+ consola.consola.info("tsconfig.json already configured");
2595
167
  }
2596
168
  } catch (error) {
2597
- consola.error("Failed to update tsconfig.json:", error);
169
+ consola.consola.error("Failed to update tsconfig.json:", error);
2598
170
  }
2599
- consola.start("Configuring build scripts...");
171
+ consola.consola.start("Configuring tsconfig.build.json...");
172
+ const tsconfigBuildPath = path.join(cwd, "tsconfig.build.json");
173
+ try {
174
+ let tsconfigBuild;
175
+ let buildUpdated = false;
176
+ if (fs.existsSync(tsconfigBuildPath)) {
177
+ tsconfigBuild = JSON.parse(fs.readFileSync(tsconfigBuildPath, "utf-8"));
178
+ } else {
179
+ tsconfigBuild = {
180
+ extends: "./tsconfig.json",
181
+ exclude: [
182
+ "node_modules",
183
+ "test",
184
+ "dist",
185
+ "**/*spec.ts"
186
+ ]
187
+ };
188
+ buildUpdated = true;
189
+ }
190
+ if (!tsconfigBuild.exclude) {
191
+ tsconfigBuild.exclude = [];
192
+ }
193
+ const hasEntryClientExclude = tsconfigBuild.exclude.some((pattern) => pattern.includes("entry-client.tsx"));
194
+ if (!hasEntryClientExclude) {
195
+ tsconfigBuild.exclude.push("src/views/entry-client.tsx");
196
+ buildUpdated = true;
197
+ }
198
+ if (buildUpdated) {
199
+ fs.writeFileSync(tsconfigBuildPath, JSON.stringify(tsconfigBuild, null, 2));
200
+ consola.consola.success("Updated tsconfig.build.json");
201
+ } else {
202
+ consola.consola.info("tsconfig.build.json already configured");
203
+ }
204
+ } catch (error) {
205
+ consola.consola.error("Failed to update tsconfig.build.json:", error);
206
+ }
207
+ consola.consola.start("Configuring nest-cli.json...");
208
+ const nestCliPath = path.join(cwd, "nest-cli.json");
209
+ try {
210
+ if (fs.existsSync(nestCliPath)) {
211
+ const nestCli = JSON.parse(fs.readFileSync(nestCliPath, "utf-8"));
212
+ let nestUpdated = false;
213
+ if (!nestCli.exclude) {
214
+ nestCli.exclude = [];
215
+ }
216
+ const hasEntryClientExclude = nestCli.exclude.some((pattern) => pattern.includes("entry-client.tsx"));
217
+ if (!hasEntryClientExclude) {
218
+ nestCli.exclude.push("**/entry-client.tsx");
219
+ nestUpdated = true;
220
+ }
221
+ if (nestUpdated) {
222
+ fs.writeFileSync(nestCliPath, JSON.stringify(nestCli, null, 2));
223
+ consola.consola.success("Updated nest-cli.json");
224
+ } else {
225
+ consola.consola.info("nest-cli.json already configured");
226
+ }
227
+ } else {
228
+ consola.consola.info("No nest-cli.json found, skipping");
229
+ }
230
+ } catch (error) {
231
+ consola.consola.error("Failed to update nest-cli.json:", error);
232
+ }
233
+ consola.consola.start("Configuring build scripts...");
2600
234
  const packageJsonPath = path.join(cwd, "package.json");
2601
235
  if (!fs.existsSync(packageJsonPath)) {
2602
- consola.warn("No package.json found, skipping build script setup");
236
+ consola.consola.warn("No package.json found, skipping build script setup");
2603
237
  } else {
2604
238
  try {
2605
239
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
2606
240
  if (!packageJson.scripts) {
2607
241
  packageJson.scripts = {};
2608
242
  }
2609
- const existingBuild = packageJson.scripts.build;
2610
- const defaultNestBuild = "nest build";
2611
- const ssrBuildPrefix = "vite build && ";
2612
243
  let shouldUpdate = false;
2613
- let newBuildScript = "";
2614
- if (!existingBuild) {
2615
- newBuildScript = `${ssrBuildPrefix}${defaultNestBuild}`;
244
+ if (!packageJson.scripts["build:client"]) {
245
+ packageJson.scripts["build:client"] = "vite build --ssrManifest --outDir dist/client";
2616
246
  shouldUpdate = true;
2617
- } else if (existingBuild.includes("vite build")) {
2618
- consola.info("Build script already includes vite build");
2619
- } else if (existingBuild === defaultNestBuild) {
2620
- newBuildScript = `${ssrBuildPrefix}${existingBuild}`;
247
+ }
248
+ if (!packageJson.scripts["build:server"]) {
249
+ packageJson.scripts["build:server"] = `vite build --ssr ${viewsDir}/entry-server.tsx --outDir dist/server`;
250
+ shouldUpdate = true;
251
+ }
252
+ const existingBuild = packageJson.scripts.build;
253
+ const recommendedBuild = "pnpm build:client && pnpm build:server && nest build";
254
+ if (!existingBuild) {
255
+ packageJson.scripts.build = recommendedBuild;
2621
256
  shouldUpdate = true;
257
+ } else if (!existingBuild.includes("build:client") || !existingBuild.includes("build:server")) {
258
+ consola.consola.warn(`Found existing build script: "${existingBuild}"`);
259
+ consola.consola.info("SSR requires building client and server bundles");
260
+ consola.consola.info(`Recommended: ${recommendedBuild}`);
261
+ consola.consola.info("Please manually update your build script in package.json");
2622
262
  } else {
2623
- consola.warn(`Found custom build script: "${existingBuild}"`);
2624
- consola.info('SSR requires running "vite build" before your build command');
2625
- consola.info(`Recommended: ${ssrBuildPrefix}${existingBuild}`);
2626
- consola.info("Please manually update your build script in package.json");
263
+ consola.consola.info("Build scripts already configured");
2627
264
  }
2628
265
  if (shouldUpdate) {
2629
- packageJson.scripts.build = newBuildScript;
2630
266
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
2631
- consola.success(`Updated build script to: "${newBuildScript}"`);
267
+ consola.consola.success("Updated build scripts in package.json");
2632
268
  }
2633
269
  if (!args["skip-install"]) {
2634
- consola.start("Checking dependencies...");
270
+ consola.consola.start("Checking dependencies...");
2635
271
  const requiredDeps = {
2636
272
  "react": "^19.0.0",
2637
273
  "react-dom": "^19.0.0",
@@ -2649,37 +285,35 @@ export default defineConfig({
2649
285
  }
2650
286
  }
2651
287
  if (missingDeps.length > 0) {
2652
- consola.info(`Missing dependencies: ${missingDeps.join(", ")}`);
288
+ consola.consola.info(`Missing dependencies: ${missingDeps.join(", ")}`);
2653
289
  let packageManager = "npm";
2654
290
  if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) packageManager = "pnpm";
2655
291
  else if (fs.existsSync(path.join(cwd, "yarn.lock"))) packageManager = "yarn";
2656
292
  const installCmd = packageManager === "npm" ? `npm install ${missingDeps.join(" ")}` : `${packageManager} add ${missingDeps.join(" ")}`;
2657
293
  try {
2658
- consola.start(`Installing dependencies with ${packageManager}...`);
294
+ consola.consola.start(`Installing dependencies with ${packageManager}...`);
2659
295
  child_process.execSync(installCmd, {
2660
296
  cwd,
2661
297
  stdio: "inherit"
2662
298
  });
2663
- consola.success("Dependencies installed!");
299
+ consola.consola.success("Dependencies installed!");
2664
300
  } catch (error) {
2665
- consola.error("Failed to install dependencies:", error);
2666
- consola.info(`Please manually run: ${installCmd}`);
301
+ consola.consola.error("Failed to install dependencies:", error);
302
+ consola.consola.info(`Please manually run: ${installCmd}`);
2667
303
  }
2668
304
  } else {
2669
- consola.success("All required dependencies are already installed");
305
+ consola.consola.success("All required dependencies are already installed");
2670
306
  }
2671
307
  }
2672
308
  } catch (error) {
2673
- consola.error("Failed to update package.json:", error);
309
+ consola.consola.error("Failed to update package.json:", error);
2674
310
  }
2675
311
  }
2676
- consola.success("\nInitialization complete!");
2677
- consola.box("Next steps");
2678
- consola.info(`1. Create your first view component in ${viewsDir}/`);
2679
- consola.info("2. Render it from a NestJS controller using render.render()");
2680
- consola.info("3. Run your dev server with: pnpm start:dev");
312
+ consola.consola.success("\nInitialization complete!");
313
+ consola.consola.box("Next steps");
314
+ consola.consola.info(`1. Create your first view component in ${viewsDir}/`);
315
+ consola.consola.info("2. Render it from a NestJS controller using render.render()");
316
+ consola.consola.info("3. Run your dev server with: pnpm start:dev");
2681
317
  }
2682
318
  });
2683
- runMain(main);
2684
- //# sourceMappingURL=init.js.map
2685
- //# sourceMappingURL=init.js.map
319
+ citty.runMain(main);