@nestjs-ssr/react 0.1.8 → 0.1.10

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.mjs CHANGED
@@ -1,2408 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { formatWithOptions } from 'util';
3
- import g, { stdin, stdout } from 'process';
4
- import f from 'readline';
5
- import * as tty from 'tty';
6
- import { WriteStream } from 'tty';
7
2
  import { existsSync, mkdirSync, copyFileSync, writeFileSync, readFileSync } from 'fs';
8
- import { dirname, sep, resolve, join } from 'path';
3
+ import { dirname, resolve, join } from 'path';
9
4
  import { fileURLToPath } from 'url';
5
+ import { execSync } from 'child_process';
6
+ import { consola } from 'consola';
7
+ import { defineCommand, runMain } from 'citty';
10
8
 
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
14
- var __esm = (fn, res) => function __init() {
15
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
- };
17
- var __export = (target, all) => {
18
- for (var name in all)
19
- __defProp(target, name, { get: all[name], enumerable: true });
20
- };
21
-
22
- // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
23
- var prompt_exports = {};
24
- __export(prompt_exports, {
25
- kCancel: () => kCancel,
26
- prompt: () => prompt
27
- });
28
- function getDefaultExportFromCjs(x2) {
29
- return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
30
- }
31
- function requireSrc() {
32
- if (hasRequiredSrc) return src;
33
- hasRequiredSrc = 1;
34
- const ESC = "\x1B";
35
- const CSI = `${ESC}[`;
36
- const beep = "\x07";
37
- const cursor = {
38
- to(x2, y3) {
39
- if (!y3) return `${CSI}${x2 + 1}G`;
40
- return `${CSI}${y3 + 1};${x2 + 1}H`;
41
- },
42
- move(x2, y3) {
43
- let ret = "";
44
- if (x2 < 0) ret += `${CSI}${-x2}D`;
45
- else if (x2 > 0) ret += `${CSI}${x2}C`;
46
- if (y3 < 0) ret += `${CSI}${-y3}A`;
47
- else if (y3 > 0) ret += `${CSI}${y3}B`;
48
- return ret;
49
- },
50
- up: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}A`, "up"),
51
- down: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}B`, "down"),
52
- forward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}C`, "forward"),
53
- backward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}D`, "backward"),
54
- nextLine: /* @__PURE__ */ __name((count = 1) => `${CSI}E`.repeat(count), "nextLine"),
55
- prevLine: /* @__PURE__ */ __name((count = 1) => `${CSI}F`.repeat(count), "prevLine"),
56
- left: `${CSI}G`,
57
- hide: `${CSI}?25l`,
58
- show: `${CSI}?25h`,
59
- save: `${ESC}7`,
60
- restore: `${ESC}8`
61
- };
62
- const scroll = {
63
- up: /* @__PURE__ */ __name((count = 1) => `${CSI}S`.repeat(count), "up"),
64
- down: /* @__PURE__ */ __name((count = 1) => `${CSI}T`.repeat(count), "down")
65
- };
66
- const erase = {
67
- screen: `${CSI}2J`,
68
- up: /* @__PURE__ */ __name((count = 1) => `${CSI}1J`.repeat(count), "up"),
69
- down: /* @__PURE__ */ __name((count = 1) => `${CSI}J`.repeat(count), "down"),
70
- line: `${CSI}2K`,
71
- lineEnd: `${CSI}K`,
72
- lineStart: `${CSI}1K`,
73
- lines(count) {
74
- let clear = "";
75
- for (let i2 = 0; i2 < count; i2++)
76
- clear += this.line + (i2 < count - 1 ? cursor.up() : "");
77
- if (count)
78
- clear += cursor.left;
79
- return clear;
80
- }
81
- };
82
- src = { cursor, scroll, erase, beep };
83
- return src;
84
- }
85
- function requirePicocolors() {
86
- if (hasRequiredPicocolors) return picocolors.exports;
87
- hasRequiredPicocolors = 1;
88
- let p = process || {}, argv2 = p.argv || [], env2 = p.env || {};
89
- 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);
90
- let formatter = /* @__PURE__ */ __name((open, close, replace = open) => (input) => {
91
- let string = "" + input, index = string.indexOf(close, open.length);
92
- return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
93
- }, "formatter");
94
- let replaceClose2 = /* @__PURE__ */ __name((string, close, replace, index) => {
95
- let result = "", cursor = 0;
96
- do {
97
- result += string.substring(cursor, index) + replace;
98
- cursor = index + close.length;
99
- index = string.indexOf(close, cursor);
100
- } while (~index);
101
- return result + string.substring(cursor);
102
- }, "replaceClose");
103
- let createColors2 = /* @__PURE__ */ __name((enabled = isColorSupported2) => {
104
- let f3 = enabled ? formatter : () => String;
105
- return {
106
- isColorSupported: enabled,
107
- reset: f3("\x1B[0m", "\x1B[0m"),
108
- bold: f3("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
109
- dim: f3("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
110
- italic: f3("\x1B[3m", "\x1B[23m"),
111
- underline: f3("\x1B[4m", "\x1B[24m"),
112
- inverse: f3("\x1B[7m", "\x1B[27m"),
113
- hidden: f3("\x1B[8m", "\x1B[28m"),
114
- strikethrough: f3("\x1B[9m", "\x1B[29m"),
115
- black: f3("\x1B[30m", "\x1B[39m"),
116
- red: f3("\x1B[31m", "\x1B[39m"),
117
- green: f3("\x1B[32m", "\x1B[39m"),
118
- yellow: f3("\x1B[33m", "\x1B[39m"),
119
- blue: f3("\x1B[34m", "\x1B[39m"),
120
- magenta: f3("\x1B[35m", "\x1B[39m"),
121
- cyan: f3("\x1B[36m", "\x1B[39m"),
122
- white: f3("\x1B[37m", "\x1B[39m"),
123
- gray: f3("\x1B[90m", "\x1B[39m"),
124
- bgBlack: f3("\x1B[40m", "\x1B[49m"),
125
- bgRed: f3("\x1B[41m", "\x1B[49m"),
126
- bgGreen: f3("\x1B[42m", "\x1B[49m"),
127
- bgYellow: f3("\x1B[43m", "\x1B[49m"),
128
- bgBlue: f3("\x1B[44m", "\x1B[49m"),
129
- bgMagenta: f3("\x1B[45m", "\x1B[49m"),
130
- bgCyan: f3("\x1B[46m", "\x1B[49m"),
131
- bgWhite: f3("\x1B[47m", "\x1B[49m"),
132
- blackBright: f3("\x1B[90m", "\x1B[39m"),
133
- redBright: f3("\x1B[91m", "\x1B[39m"),
134
- greenBright: f3("\x1B[92m", "\x1B[39m"),
135
- yellowBright: f3("\x1B[93m", "\x1B[39m"),
136
- blueBright: f3("\x1B[94m", "\x1B[39m"),
137
- magentaBright: f3("\x1B[95m", "\x1B[39m"),
138
- cyanBright: f3("\x1B[96m", "\x1B[39m"),
139
- whiteBright: f3("\x1B[97m", "\x1B[39m"),
140
- bgBlackBright: f3("\x1B[100m", "\x1B[49m"),
141
- bgRedBright: f3("\x1B[101m", "\x1B[49m"),
142
- bgGreenBright: f3("\x1B[102m", "\x1B[49m"),
143
- bgYellowBright: f3("\x1B[103m", "\x1B[49m"),
144
- bgBlueBright: f3("\x1B[104m", "\x1B[49m"),
145
- bgMagentaBright: f3("\x1B[105m", "\x1B[49m"),
146
- bgCyanBright: f3("\x1B[106m", "\x1B[49m"),
147
- bgWhiteBright: f3("\x1B[107m", "\x1B[49m")
148
- };
149
- }, "createColors");
150
- picocolors.exports = createColors2();
151
- picocolors.exports.createColors = createColors2;
152
- return picocolors.exports;
153
- }
154
- function J({ onlyFirst: t2 = false } = {}) {
155
- 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("|");
156
- return new RegExp(F3, t2 ? void 0 : "g");
157
- }
158
- function T$1(t2) {
159
- if (typeof t2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t2}\``);
160
- return t2.replace(Q, "");
161
- }
162
- function O(t2) {
163
- return t2 && t2.__esModule && Object.prototype.hasOwnProperty.call(t2, "default") ? t2.default : t2;
164
- }
165
- function A$1(t2, u3 = {}) {
166
- if (typeof t2 != "string" || t2.length === 0 || (u3 = { ambiguousIsNarrow: true, ...u3 }, t2 = T$1(t2), t2.length === 0)) return 0;
167
- t2 = t2.replace(FD(), " ");
168
- const F3 = u3.ambiguousIsNarrow ? 1 : 2;
169
- let e2 = 0;
170
- for (const s2 of t2) {
171
- const i2 = s2.codePointAt(0);
172
- if (i2 <= 31 || i2 >= 127 && i2 <= 159 || i2 >= 768 && i2 <= 879) continue;
173
- switch (DD.eastAsianWidth(s2)) {
174
- case "F":
175
- case "W":
176
- e2 += 2;
177
- break;
178
- case "A":
179
- e2 += F3;
180
- break;
181
- default:
182
- e2 += 1;
183
- }
184
- }
185
- return e2;
186
- }
187
- function sD() {
188
- const t2 = /* @__PURE__ */ new Map();
189
- for (const [u3, F3] of Object.entries(r)) {
190
- 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]);
191
- Object.defineProperty(r, u3, { value: F3, enumerable: false });
192
- }
193
- 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) => {
194
- const F3 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u3.toString(16));
195
- if (!F3) return [0, 0, 0];
196
- let [e2] = F3;
197
- e2.length === 3 && (e2 = [...e2].map((i2) => i2 + i2).join(""));
198
- const s2 = Number.parseInt(e2, 16);
199
- return [s2 >> 16 & 255, s2 >> 8 & 255, s2 & 255];
200
- }, "value"), enumerable: false }, hexToAnsi256: { value: /* @__PURE__ */ __name((u3) => r.rgbToAnsi256(...r.hexToRgb(u3)), "value"), enumerable: false }, ansi256ToAnsi: { value: /* @__PURE__ */ __name((u3) => {
201
- if (u3 < 8) return 30 + u3;
202
- if (u3 < 16) return 90 + (u3 - 8);
203
- let F3, e2, s2;
204
- if (u3 >= 232) F3 = ((u3 - 232) * 10 + 8) / 255, e2 = F3, s2 = F3;
205
- else {
206
- u3 -= 16;
207
- const C3 = u3 % 36;
208
- F3 = Math.floor(u3 / 36) / 5, e2 = Math.floor(C3 / 6) / 5, s2 = C3 % 6 / 5;
209
- }
210
- const i2 = Math.max(F3, e2, s2) * 2;
211
- if (i2 === 0) return 30;
212
- let D2 = 30 + (Math.round(s2) << 2 | Math.round(e2) << 1 | Math.round(F3));
213
- return i2 === 2 && (D2 += 60), D2;
214
- }, "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;
215
- }
216
- function G(t2, u3, F3) {
217
- return String(t2).normalize().replace(/\r\n/g, `
218
- `).split(`
219
- `).map((e2) => oD(e2, u3, F3)).join(`
220
- `);
221
- }
222
- function k$1(t2, u3) {
223
- if (typeof t2 == "string") return c.aliases.get(t2) === u3;
224
- for (const F3 of t2) if (F3 !== void 0 && k$1(F3, u3)) return true;
225
- return false;
226
- }
227
- function lD(t2, u3) {
228
- if (t2 === u3) return;
229
- const F3 = t2.split(`
230
- `), e2 = u3.split(`
231
- `), s2 = [];
232
- for (let i2 = 0; i2 < Math.max(F3.length, e2.length); i2++) F3[i2] !== e2[i2] && s2.push(i2);
233
- return s2;
234
- }
235
- function d$1(t2, u3) {
236
- const F3 = t2;
237
- F3.isTTY && F3.setRawMode(u3);
238
- }
239
- function ce() {
240
- return g.platform !== "win32" ? g.env.TERM !== "linux" : !!g.env.CI || !!g.env.WT_SESSION || !!g.env.TERMINUS_SUBLIME || g.env.ConEmuTask === "{cmd::Cmder}" || g.env.TERM_PROGRAM === "Terminus-Sublime" || g.env.TERM_PROGRAM === "vscode" || g.env.TERM === "xterm-256color" || g.env.TERM === "alacritty" || g.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
241
- }
242
- async function prompt(message, opts = {}) {
243
- const handleCancel = /* @__PURE__ */ __name((value) => {
244
- if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") {
245
- return value;
246
- }
247
- switch (opts.cancel) {
248
- case "reject": {
249
- const error = new Error("Prompt cancelled.");
250
- error.name = "ConsolaPromptCancelledError";
251
- if (Error.captureStackTrace) {
252
- Error.captureStackTrace(error, prompt);
253
- }
254
- throw error;
255
- }
256
- case "undefined": {
257
- return void 0;
258
- }
259
- case "null": {
260
- return null;
261
- }
262
- case "symbol": {
263
- return kCancel;
264
- }
265
- default:
266
- case "default": {
267
- return opts.default ?? opts.initial;
268
- }
269
- }
270
- }, "handleCancel");
271
- if (!opts.type || opts.type === "text") {
272
- return await he({
273
- message,
274
- defaultValue: opts.default,
275
- placeholder: opts.placeholder,
276
- initialValue: opts.initial
277
- }).then(handleCancel);
278
- }
279
- if (opts.type === "confirm") {
280
- return await ye({
281
- message,
282
- initialValue: opts.initial
283
- }).then(handleCancel);
284
- }
285
- if (opts.type === "select") {
286
- return await ve({
287
- message,
288
- options: opts.options.map(
289
- (o3) => typeof o3 === "string" ? { value: o3, label: o3 } : o3
290
- ),
291
- initialValue: opts.initial
292
- }).then(handleCancel);
293
- }
294
- if (opts.type === "multiselect") {
295
- return await fe({
296
- message,
297
- options: opts.options.map(
298
- (o3) => typeof o3 === "string" ? { value: o3, label: o3 } : o3
299
- ),
300
- required: opts.required,
301
- initialValues: opts.initial
302
- }).then(handleCancel);
303
- }
304
- throw new Error(`Unknown prompt type: ${opts.type}`);
305
- }
306
- 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;
307
- var init_prompt = __esm({
308
- "../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs"() {
309
- __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
310
- __name(requireSrc, "requireSrc");
311
- srcExports = requireSrc();
312
- picocolors = { exports: {} };
313
- __name(requirePicocolors, "requirePicocolors");
314
- picocolorsExports = /* @__PURE__ */ requirePicocolors();
315
- e = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
316
- __name(J, "J");
317
- Q = J();
318
- __name(T$1, "T$1");
319
- __name(O, "O");
320
- P$1 = { exports: {} };
321
- (function(t2) {
322
- var u3 = {};
323
- t2.exports = u3, u3.eastAsianWidth = function(e2) {
324
- var s2 = e2.charCodeAt(0), i2 = e2.length == 2 ? e2.charCodeAt(1) : 0, D2 = s2;
325
- 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";
326
- }, u3.characterLength = function(e2) {
327
- var s2 = this.eastAsianWidth(e2);
328
- return s2 == "F" || s2 == "W" || s2 == "A" ? 2 : 1;
329
- };
330
- function F3(e2) {
331
- return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
332
- }
333
- __name(F3, "F");
334
- u3.length = function(e2) {
335
- for (var s2 = F3(e2), i2 = 0, D2 = 0; D2 < s2.length; D2++) i2 = i2 + this.characterLength(s2[D2]);
336
- return i2;
337
- }, u3.slice = function(e2, s2, i2) {
338
- textLen = u3.length(e2), s2 = s2 || 0, i2 = i2 || 1, s2 < 0 && (s2 = textLen + s2), i2 < 0 && (i2 = textLen + i2);
339
- for (var D2 = "", C3 = 0, o3 = F3(e2), E = 0; E < o3.length; E++) {
340
- var a2 = o3[E], n2 = u3.length(a2);
341
- if (C3 >= s2 - (n2 == 2 ? 1 : 0)) if (C3 + n2 <= i2) D2 += a2;
342
- else break;
343
- C3 += n2;
344
- }
345
- return D2;
346
- };
347
- })(P$1);
348
- X = P$1.exports;
349
- DD = O(X);
350
- uD = /* @__PURE__ */ __name(function() {
351
- 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;
352
- }, "uD");
353
- FD = O(uD);
354
- __name(A$1, "A$1");
355
- m = 10;
356
- L$1 = /* @__PURE__ */ __name((t2 = 0) => (u3) => `\x1B[${u3 + t2}m`, "L$1");
357
- N = /* @__PURE__ */ __name((t2 = 0) => (u3) => `\x1B[${38 + t2};5;${u3}m`, "N");
358
- I = /* @__PURE__ */ __name((t2 = 0) => (u3, F3, e2) => `\x1B[${38 + t2};2;${u3};${F3};${e2}m`, "I");
359
- 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] } };
360
- Object.keys(r.modifier);
361
- tD = Object.keys(r.color);
362
- eD = Object.keys(r.bgColor);
363
- [...tD, ...eD];
364
- __name(sD, "sD");
365
- iD = sD();
366
- v = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
367
- CD = 39;
368
- w$1 = "\x07";
369
- W$1 = "[";
370
- rD = "]";
371
- R = "m";
372
- y = `${rD}8;;`;
373
- V$1 = /* @__PURE__ */ __name((t2) => `${v.values().next().value}${W$1}${t2}${R}`, "V$1");
374
- z = /* @__PURE__ */ __name((t2) => `${v.values().next().value}${y}${t2}${w$1}`, "z");
375
- ED = /* @__PURE__ */ __name((t2) => t2.split(" ").map((u3) => A$1(u3)), "ED");
376
- _ = /* @__PURE__ */ __name((t2, u3, F3) => {
377
- const e2 = [...u3];
378
- let s2 = false, i2 = false, D2 = A$1(T$1(t2[t2.length - 1]));
379
- for (const [C3, o3] of e2.entries()) {
380
- const E = A$1(o3);
381
- 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) {
382
- i2 ? o3 === w$1 && (s2 = false, i2 = false) : o3 === R && (s2 = false);
383
- continue;
384
- }
385
- D2 += E, D2 === F3 && C3 < e2.length - 1 && (t2.push(""), D2 = 0);
386
- }
387
- !D2 && t2[t2.length - 1].length > 0 && t2.length > 1 && (t2[t2.length - 2] += t2.pop());
388
- }, "_");
389
- nD = /* @__PURE__ */ __name((t2) => {
390
- const u3 = t2.split(" ");
391
- let F3 = u3.length;
392
- for (; F3 > 0 && !(A$1(u3[F3 - 1]) > 0); ) F3--;
393
- return F3 === u3.length ? t2 : u3.slice(0, F3).join(" ") + u3.slice(F3).join("");
394
- }, "nD");
395
- oD = /* @__PURE__ */ __name((t2, u3, F3 = {}) => {
396
- if (F3.trim !== false && t2.trim() === "") return "";
397
- let e2 = "", s2, i2;
398
- const D2 = ED(t2);
399
- let C3 = [""];
400
- for (const [E, a2] of t2.split(" ").entries()) {
401
- F3.trim !== false && (C3[C3.length - 1] = C3[C3.length - 1].trimStart());
402
- let n2 = A$1(C3[C3.length - 1]);
403
- 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) {
404
- const B2 = u3 - n2, p = 1 + Math.floor((D2[E] - B2 - 1) / u3);
405
- Math.floor((D2[E] - 1) / u3) < p && C3.push(""), _(C3, a2, u3);
406
- continue;
407
- }
408
- if (n2 + D2[E] > u3 && n2 > 0 && D2[E] > 0) {
409
- if (F3.wordWrap === false && n2 < u3) {
410
- _(C3, a2, u3);
411
- continue;
412
- }
413
- C3.push("");
414
- }
415
- if (n2 + D2[E] > u3 && F3.wordWrap === false) {
416
- _(C3, a2, u3);
417
- continue;
418
- }
419
- C3[C3.length - 1] += a2;
420
- }
421
- F3.trim !== false && (C3 = C3.map((E) => nD(E)));
422
- const o3 = [...C3.join(`
423
- `)];
424
- for (const [E, a2] of o3.entries()) {
425
- if (e2 += a2, v.has(a2)) {
426
- const { groups: B2 } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o3.slice(E).join("")) || { groups: {} };
427
- if (B2.code !== void 0) {
428
- const p = Number.parseFloat(B2.code);
429
- s2 = p === CD ? void 0 : p;
430
- } else B2.uri !== void 0 && (i2 = B2.uri.length === 0 ? void 0 : B2.uri);
431
- }
432
- const n2 = iD.codes.get(Number(s2));
433
- o3[E + 1] === `
434
- ` ? (i2 && (e2 += z("")), s2 && n2 && (e2 += V$1(n2))) : a2 === `
435
- ` && (s2 && n2 && (e2 += V$1(s2)), i2 && (e2 += z(i2)));
436
- }
437
- return e2;
438
- }, "oD");
439
- __name(G, "G");
440
- aD = ["up", "down", "left", "right", "space", "enter", "cancel"];
441
- c = { actions: new Set(aD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
442
- __name(k$1, "k$1");
443
- __name(lD, "lD");
444
- globalThis.process.platform.startsWith("win");
445
- S = Symbol("clack:cancel");
446
- __name(d$1, "d$1");
447
- AD = Object.defineProperty;
448
- pD = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? AD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "pD");
449
- h = /* @__PURE__ */ __name((t2, u3, F3) => (pD(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "h");
450
- x = class {
451
- static {
452
- __name(this, "x");
453
- }
454
- constructor(u3, F3 = true) {
455
- 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");
456
- const { input: e2 = stdin, output: s2 = stdout, render: i2, signal: D2, ...C3 } = u3;
457
- 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;
458
- }
459
- unsubscribe() {
460
- this._subscribers.clear();
461
- }
462
- setSubscriber(u3, F3) {
463
- const e2 = this._subscribers.get(u3) ?? [];
464
- e2.push(F3), this._subscribers.set(u3, e2);
465
- }
466
- on(u3, F3) {
467
- this.setSubscriber(u3, { cb: F3 });
468
- }
469
- once(u3, F3) {
470
- this.setSubscriber(u3, { cb: F3, once: true });
471
- }
472
- emit(u3, ...F3) {
473
- const e2 = this._subscribers.get(u3) ?? [], s2 = [];
474
- for (const i2 of e2) i2.cb(...F3), i2.once && s2.push(() => e2.splice(e2.indexOf(i2), 1));
475
- for (const i2 of s2) i2();
476
- }
477
- prompt() {
478
- return new Promise((u3, F3) => {
479
- if (this._abortSignal) {
480
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u3(S);
481
- this._abortSignal.addEventListener("abort", () => {
482
- this.state = "cancel", this.close();
483
- }, { once: true });
484
- }
485
- const e2 = new WriteStream(0);
486
- e2._write = (s2, i2, D2) => {
487
- this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
488
- }, this.input.pipe(e2), this.rl = f.createInterface({ input: this.input, output: e2, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), f.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", () => {
489
- this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u3(this.value);
490
- }), this.once("cancel", () => {
491
- this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u3(S);
492
- });
493
- });
494
- }
495
- onKeypress(u3, F3) {
496
- 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") {
497
- if (this.opts.validate) {
498
- const e2 = this.opts.validate(this.value);
499
- e2 && (this.error = e2 instanceof Error ? e2.message : e2, this.state = "error", this.rl?.write(this.value));
500
- }
501
- this.state !== "error" && (this.state = "submit");
502
- }
503
- 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();
504
- }
505
- close() {
506
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
507
- `), d$1(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
508
- }
509
- restoreCursor() {
510
- const u3 = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
511
- `).length - 1;
512
- this.output.write(srcExports.cursor.move(-999, u3 * -1));
513
- }
514
- render() {
515
- const u3 = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
516
- if (u3 !== this._prevFrame) {
517
- if (this.state === "initial") this.output.write(srcExports.cursor.hide);
518
- else {
519
- const F3 = lD(this._prevFrame, u3);
520
- if (this.restoreCursor(), F3 && F3?.length === 1) {
521
- const e2 = F3[0];
522
- this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.lines(1));
523
- const s2 = u3.split(`
524
- `);
525
- this.output.write(s2[e2]), this._prevFrame = u3, this.output.write(srcExports.cursor.move(0, s2.length - e2 - 1));
526
- return;
527
- }
528
- if (F3 && F3?.length > 1) {
529
- const e2 = F3[0];
530
- this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.down());
531
- const s2 = u3.split(`
532
- `).slice(e2);
533
- this.output.write(s2.join(`
534
- `)), this._prevFrame = u3;
535
- return;
536
- }
537
- this.output.write(srcExports.erase.down());
538
- }
539
- this.output.write(u3), this.state === "initial" && (this.state = "active"), this._prevFrame = u3;
540
- }
541
- }
542
- };
543
- fD = class extends x {
544
- static {
545
- __name(this, "fD");
546
- }
547
- get cursor() {
548
- return this.value ? 0 : 1;
549
- }
550
- get _value() {
551
- return this.cursor === 0;
552
- }
553
- constructor(u3) {
554
- super(u3, false), this.value = !!u3.initialValue, this.on("value", () => {
555
- this.value = this._value;
556
- }), this.on("confirm", (F3) => {
557
- this.output.write(srcExports.cursor.move(0, -1)), this.value = F3, this.state = "submit", this.close();
558
- }), this.on("cursor", () => {
559
- this.value = !this.value;
560
- });
561
- }
562
- };
563
- bD = Object.defineProperty;
564
- mD = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? bD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "mD");
565
- Y = /* @__PURE__ */ __name((t2, u3, F3) => (mD(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "Y");
566
- wD = class extends x {
567
- static {
568
- __name(this, "wD");
569
- }
570
- constructor(u3) {
571
- 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) => {
572
- F3 === "a" && this.toggleAll();
573
- }), this.on("cursor", (F3) => {
574
- switch (F3) {
575
- case "left":
576
- case "up":
577
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
578
- break;
579
- case "down":
580
- case "right":
581
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
582
- break;
583
- case "space":
584
- this.toggleValue();
585
- break;
586
- }
587
- });
588
- }
589
- get _value() {
590
- return this.options[this.cursor].value;
591
- }
592
- toggleAll() {
593
- const u3 = this.value.length === this.options.length;
594
- this.value = u3 ? [] : this.options.map((F3) => F3.value);
595
- }
596
- toggleValue() {
597
- const u3 = this.value.includes(this._value);
598
- this.value = u3 ? this.value.filter((F3) => F3 !== this._value) : [...this.value, this._value];
599
- }
600
- };
601
- SD = Object.defineProperty;
602
- $D = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? SD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "$D");
603
- q = /* @__PURE__ */ __name((t2, u3, F3) => ($D(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "q");
604
- jD = class extends x {
605
- static {
606
- __name(this, "jD");
607
- }
608
- constructor(u3) {
609
- 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) => {
610
- switch (F3) {
611
- case "left":
612
- case "up":
613
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
614
- break;
615
- case "down":
616
- case "right":
617
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
618
- break;
619
- }
620
- this.changeValue();
621
- });
622
- }
623
- get _value() {
624
- return this.options[this.cursor];
625
- }
626
- changeValue() {
627
- this.value = this._value.value;
628
- }
629
- };
630
- PD = class extends x {
631
- static {
632
- __name(this, "PD");
633
- }
634
- get valueWithCursor() {
635
- if (this.state === "submit") return this.value;
636
- if (this.cursor >= this.value.length) return `${this.value}\u2588`;
637
- const u3 = this.value.slice(0, this.cursor), [F3, ...e$1] = this.value.slice(this.cursor);
638
- return `${u3}${e.inverse(F3)}${e$1.join("")}`;
639
- }
640
- get cursor() {
641
- return this._cursor;
642
- }
643
- constructor(u3) {
644
- super(u3), this.on("finalize", () => {
645
- this.value || (this.value = u3.defaultValue);
646
- });
647
- }
648
- };
649
- __name(ce, "ce");
650
- V = ce();
651
- u = /* @__PURE__ */ __name((t2, n2) => V ? t2 : n2, "u");
652
- le = u("\u276F", ">");
653
- L = u("\u25A0", "x");
654
- W = u("\u25B2", "x");
655
- C = u("\u2714", "\u221A");
656
- o = u("");
657
- d = u("");
658
- k = u("\u25CF", ">");
659
- P = u("\u25CB", " ");
660
- A = u("\u25FB", "[\u2022]");
661
- T = u("\u25FC", "[+]");
662
- F = u("\u25FB", "[ ]");
663
- w = /* @__PURE__ */ __name((t2) => {
664
- switch (t2) {
665
- case "initial":
666
- case "active":
667
- return e.cyan(le);
668
- case "cancel":
669
- return e.red(L);
670
- case "error":
671
- return e.yellow(W);
672
- case "submit":
673
- return e.green(C);
674
- }
675
- }, "w");
676
- B = /* @__PURE__ */ __name((t2) => {
677
- 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));
678
- let l2 = 0;
679
- 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));
680
- const $ = c3 < s2.length && l2 > 0, p = c3 < s2.length && l2 + c3 < s2.length;
681
- return s2.slice(l2, l2 + c3).map((M, v2, x2) => {
682
- const j = v2 === 0 && $, E = v2 === x2.length - 1 && p;
683
- return j || E ? e.dim("...") : r3(M, v2 + l2 === n2);
684
- });
685
- }, "B");
686
- he = /* @__PURE__ */ __name((t2) => new PD({ validate: t2.validate, placeholder: t2.placeholder, defaultValue: t2.defaultValue, initialValue: t2.initialValue, render() {
687
- const n2 = `${e.gray(o)}
688
- ${w(this.state)} ${t2.message}
689
- `, s2 = t2.placeholder ? e.inverse(t2.placeholder[0]) + e.dim(t2.placeholder.slice(1)) : e.inverse(e.hidden("_")), r3 = this.value ? this.valueWithCursor : s2;
690
- switch (this.state) {
691
- case "error":
692
- return `${n2.trim()}
693
- ${e.yellow(o)} ${r3}
694
- ${e.yellow(d)} ${e.yellow(this.error)}
695
- `;
696
- case "submit":
697
- return `${n2}${e.gray(o)} ${e.dim(this.value || t2.placeholder)}`;
698
- case "cancel":
699
- return `${n2}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
700
- ${e.gray(o)}` : ""}`;
701
- default:
702
- return `${n2}${e.cyan(o)} ${r3}
703
- ${e.cyan(d)}
704
- `;
705
- }
706
- } }).prompt(), "he");
707
- ye = /* @__PURE__ */ __name((t2) => {
708
- const n2 = t2.active ?? "Yes", s2 = t2.inactive ?? "No";
709
- return new fD({ active: n2, inactive: s2, initialValue: t2.initialValue ?? true, render() {
710
- const r3 = `${e.gray(o)}
711
- ${w(this.state)} ${t2.message}
712
- `, i2 = this.value ? n2 : s2;
713
- switch (this.state) {
714
- case "submit":
715
- return `${r3}${e.gray(o)} ${e.dim(i2)}`;
716
- case "cancel":
717
- return `${r3}${e.gray(o)} ${e.strikethrough(e.dim(i2))}
718
- ${e.gray(o)}`;
719
- default:
720
- 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}`}
721
- ${e.cyan(d)}
722
- `;
723
- }
724
- } }).prompt();
725
- }, "ye");
726
- ve = /* @__PURE__ */ __name((t2) => {
727
- const n2 = /* @__PURE__ */ __name((s2, r3) => {
728
- const i2 = s2.label ?? String(s2.value);
729
- switch (r3) {
730
- case "selected":
731
- return `${e.dim(i2)}`;
732
- case "active":
733
- return `${e.green(k)} ${i2} ${s2.hint ? e.dim(`(${s2.hint})`) : ""}`;
734
- case "cancelled":
735
- return `${e.strikethrough(e.dim(i2))}`;
736
- default:
737
- return `${e.dim(P)} ${e.dim(i2)}`;
738
- }
739
- }, "n");
740
- return new jD({ options: t2.options, initialValue: t2.initialValue, render() {
741
- const s2 = `${e.gray(o)}
742
- ${w(this.state)} ${t2.message}
743
- `;
744
- switch (this.state) {
745
- case "submit":
746
- return `${s2}${e.gray(o)} ${n2(this.options[this.cursor], "selected")}`;
747
- case "cancel":
748
- return `${s2}${e.gray(o)} ${n2(this.options[this.cursor], "cancelled")}
749
- ${e.gray(o)}`;
750
- default:
751
- 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(`
752
- ${e.cyan(o)} `)}
753
- ${e.cyan(d)}
754
- `;
755
- }
756
- } }).prompt();
757
- }, "ve");
758
- fe = /* @__PURE__ */ __name((t2) => {
759
- const n2 = /* @__PURE__ */ __name((s2, r3) => {
760
- const i2 = s2.label ?? String(s2.value);
761
- 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)}`;
762
- }, "n");
763
- return new wD({ options: t2.options, initialValues: t2.initialValues, required: t2.required ?? true, cursorAt: t2.cursorAt, validate(s2) {
764
- if (this.required && s2.length === 0) return `Please select at least one option.
765
- ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
766
- }, render() {
767
- const s2 = `${e.gray(o)}
768
- ${w(this.state)} ${t2.message}
769
- `, r3 = /* @__PURE__ */ __name((i2, a2) => {
770
- const c3 = this.value.includes(i2.value);
771
- return a2 && c3 ? n2(i2, "active-selected") : c3 ? n2(i2, "selected") : n2(i2, a2 ? "active" : "inactive");
772
- }, "r");
773
- switch (this.state) {
774
- case "submit":
775
- 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")}`;
776
- case "cancel": {
777
- const i2 = this.options.filter(({ value: a2 }) => this.value.includes(a2)).map((a2) => n2(a2, "cancelled")).join(e.dim(", "));
778
- return `${s2}${e.gray(o)} ${i2.trim() ? `${i2}
779
- ${e.gray(o)}` : ""}`;
780
- }
781
- case "error": {
782
- const i2 = this.error.split(`
783
- `).map((a2, c3) => c3 === 0 ? `${e.yellow(d)} ${e.yellow(a2)}` : ` ${a2}`).join(`
784
- `);
785
- return `${s2 + e.yellow(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t2.maxItems, style: r3 }).join(`
786
- ${e.yellow(o)} `)}
787
- ${i2}
788
- `;
789
- }
790
- default:
791
- return `${s2}${e.cyan(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t2.maxItems, style: r3 }).join(`
792
- ${e.cyan(o)} `)}
793
- ${e.cyan(d)}
794
- `;
795
- }
796
- } }).prompt();
797
- }, "fe");
798
- `${e.gray(o)} `;
799
- kCancel = Symbol.for("cancel");
800
- __name(prompt, "prompt");
801
- }
802
- });
803
-
804
- // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
805
- var LogLevels = {
806
- fatal: 0,
807
- error: 0,
808
- warn: 1,
809
- log: 2,
810
- info: 3,
811
- success: 3,
812
- fail: 3,
813
- debug: 4,
814
- trace: 5,
815
- verbose: Number.POSITIVE_INFINITY
816
- };
817
- var LogTypes = {
818
- // Silent
819
- silent: {
820
- level: -1
821
- },
822
- // Level 0
823
- fatal: {
824
- level: LogLevels.fatal
825
- },
826
- error: {
827
- level: LogLevels.error
828
- },
829
- // Level 1
830
- warn: {
831
- level: LogLevels.warn
832
- },
833
- // Level 2
834
- log: {
835
- level: LogLevels.log
836
- },
837
- // Level 3
838
- info: {
839
- level: LogLevels.info
840
- },
841
- success: {
842
- level: LogLevels.success
843
- },
844
- fail: {
845
- level: LogLevels.fail
846
- },
847
- ready: {
848
- level: LogLevels.info
849
- },
850
- start: {
851
- level: LogLevels.info
852
- },
853
- box: {
854
- level: LogLevels.info
855
- },
856
- // Level 4
857
- debug: {
858
- level: LogLevels.debug
859
- },
860
- // Level 5
861
- trace: {
862
- level: LogLevels.trace
863
- },
864
- // Verbose
865
- verbose: {
866
- level: LogLevels.verbose
867
- }
868
- };
869
- function isPlainObject$1(value) {
870
- if (value === null || typeof value !== "object") {
871
- return false;
872
- }
873
- const prototype = Object.getPrototypeOf(value);
874
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
875
- return false;
876
- }
877
- if (Symbol.iterator in value) {
878
- return false;
879
- }
880
- if (Symbol.toStringTag in value) {
881
- return Object.prototype.toString.call(value) === "[object Module]";
882
- }
883
- return true;
884
- }
885
- __name(isPlainObject$1, "isPlainObject$1");
886
- function _defu(baseObject, defaults, namespace = ".", merger) {
887
- if (!isPlainObject$1(defaults)) {
888
- return _defu(baseObject, {}, namespace, merger);
889
- }
890
- const object = Object.assign({}, defaults);
891
- for (const key in baseObject) {
892
- if (key === "__proto__" || key === "constructor") {
893
- continue;
894
- }
895
- const value = baseObject[key];
896
- if (value === null || value === void 0) {
897
- continue;
898
- }
899
- if (merger && merger(object, key, value, namespace)) {
900
- continue;
901
- }
902
- if (Array.isArray(value) && Array.isArray(object[key])) {
903
- object[key] = [...value, ...object[key]];
904
- } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
905
- object[key] = _defu(
906
- value,
907
- object[key],
908
- (namespace ? `${namespace}.` : "") + key.toString(),
909
- merger
910
- );
911
- } else {
912
- object[key] = value;
913
- }
914
- }
915
- return object;
916
- }
917
- __name(_defu, "_defu");
918
- function createDefu(merger) {
919
- return (...arguments_) => (
920
- // eslint-disable-next-line unicorn/no-array-reduce
921
- arguments_.reduce((p, c3) => _defu(p, c3, "", merger), {})
922
- );
923
- }
924
- __name(createDefu, "createDefu");
925
- var defu = createDefu();
926
- function isPlainObject(obj) {
927
- return Object.prototype.toString.call(obj) === "[object Object]";
928
- }
929
- __name(isPlainObject, "isPlainObject");
930
- function isLogObj(arg) {
931
- if (!isPlainObject(arg)) {
932
- return false;
933
- }
934
- if (!arg.message && !arg.args) {
935
- return false;
936
- }
937
- if (arg.stack) {
938
- return false;
939
- }
940
- return true;
941
- }
942
- __name(isLogObj, "isLogObj");
943
- var paused = false;
944
- var queue = [];
945
- var Consola = class _Consola {
946
- static {
947
- __name(this, "Consola");
948
- }
949
- options;
950
- _lastLog;
951
- _mockFn;
952
- /**
953
- * Creates an instance of Consola with specified options or defaults.
954
- *
955
- * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
956
- */
957
- constructor(options = {}) {
958
- const types = options.types || LogTypes;
959
- this.options = defu(
960
- {
961
- ...options,
962
- defaults: { ...options.defaults },
963
- level: _normalizeLogLevel(options.level, types),
964
- reporters: [...options.reporters || []]
965
- },
966
- {
967
- types: LogTypes,
968
- throttle: 1e3,
969
- throttleMin: 5,
970
- formatOptions: {
971
- date: true,
972
- colors: false,
973
- compact: true
974
- }
975
- }
976
- );
977
- for (const type in types) {
978
- const defaults = {
979
- type,
980
- ...this.options.defaults,
981
- ...types[type]
982
- };
983
- this[type] = this._wrapLogFn(defaults);
984
- this[type].raw = this._wrapLogFn(
985
- defaults,
986
- true
987
- );
988
- }
989
- if (this.options.mockFn) {
990
- this.mockTypes();
991
- }
992
- this._lastLog = {};
993
- }
994
- /**
995
- * Gets the current log level of the Consola instance.
996
- *
997
- * @returns {number} The current log level.
998
- */
999
- get level() {
1000
- return this.options.level;
1001
- }
1002
- /**
1003
- * Sets the minimum log level that will be output by the instance.
1004
- *
1005
- * @param {number} level - The new log level to set.
1006
- */
1007
- set level(level) {
1008
- this.options.level = _normalizeLogLevel(
1009
- level,
1010
- this.options.types,
1011
- this.options.level
1012
- );
1013
- }
1014
- /**
1015
- * Displays a prompt to the user and returns the response.
1016
- * Throw an error if `prompt` is not supported by the current configuration.
1017
- *
1018
- * @template T
1019
- * @param {string} message - The message to display in the prompt.
1020
- * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
1021
- * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
1022
- */
1023
- prompt(message, opts) {
1024
- if (!this.options.prompt) {
1025
- throw new Error("prompt is not supported!");
1026
- }
1027
- return this.options.prompt(message, opts);
1028
- }
1029
- /**
1030
- * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
1031
- *
1032
- * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
1033
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1034
- */
1035
- create(options) {
1036
- const instance = new _Consola({
1037
- ...this.options,
1038
- ...options
1039
- });
1040
- if (this._mockFn) {
1041
- instance.mockTypes(this._mockFn);
1042
- }
1043
- return instance;
1044
- }
1045
- /**
1046
- * Creates a new Consola instance with the specified default log object properties.
1047
- *
1048
- * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
1049
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1050
- */
1051
- withDefaults(defaults) {
1052
- return this.create({
1053
- ...this.options,
1054
- defaults: {
1055
- ...this.options.defaults,
1056
- ...defaults
1057
- }
1058
- });
1059
- }
1060
- /**
1061
- * Creates a new Consola instance with a specified tag, which will be included in every log.
1062
- *
1063
- * @param {string} tag - The tag to include in each log of the new instance.
1064
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1065
- */
1066
- withTag(tag) {
1067
- return this.withDefaults({
1068
- tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
1069
- });
1070
- }
1071
- /**
1072
- * Adds a custom reporter to the Consola instance.
1073
- * Reporters will be called for each log message, depending on their implementation and log level.
1074
- *
1075
- * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
1076
- * @returns {Consola} The current Consola instance.
1077
- */
1078
- addReporter(reporter) {
1079
- this.options.reporters.push(reporter);
1080
- return this;
1081
- }
1082
- /**
1083
- * Removes a custom reporter from the Consola instance.
1084
- * If no reporter is specified, all reporters will be removed.
1085
- *
1086
- * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
1087
- * @returns {Consola} The current Consola instance.
1088
- */
1089
- removeReporter(reporter) {
1090
- if (reporter) {
1091
- const i2 = this.options.reporters.indexOf(reporter);
1092
- if (i2 !== -1) {
1093
- return this.options.reporters.splice(i2, 1);
1094
- }
1095
- } else {
1096
- this.options.reporters.splice(0);
1097
- }
1098
- return this;
1099
- }
1100
- /**
1101
- * Replaces all reporters of the Consola instance with the specified array of reporters.
1102
- *
1103
- * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
1104
- * @returns {Consola} The current Consola instance.
1105
- */
1106
- setReporters(reporters) {
1107
- this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
1108
- return this;
1109
- }
1110
- wrapAll() {
1111
- this.wrapConsole();
1112
- this.wrapStd();
1113
- }
1114
- restoreAll() {
1115
- this.restoreConsole();
1116
- this.restoreStd();
1117
- }
1118
- /**
1119
- * Overrides console methods with Consola logging methods for consistent logging.
1120
- */
1121
- wrapConsole() {
1122
- for (const type in this.options.types) {
1123
- if (!console["__" + type]) {
1124
- console["__" + type] = console[type];
1125
- }
1126
- console[type] = this[type].raw;
1127
- }
1128
- }
1129
- /**
1130
- * Restores the original console methods, removing Consola overrides.
1131
- */
1132
- restoreConsole() {
1133
- for (const type in this.options.types) {
1134
- if (console["__" + type]) {
1135
- console[type] = console["__" + type];
1136
- delete console["__" + type];
1137
- }
1138
- }
1139
- }
1140
- /**
1141
- * Overrides standard output and error streams to redirect them through Consola.
1142
- */
1143
- wrapStd() {
1144
- this._wrapStream(this.options.stdout, "log");
1145
- this._wrapStream(this.options.stderr, "log");
1146
- }
1147
- _wrapStream(stream, type) {
1148
- if (!stream) {
1149
- return;
1150
- }
1151
- if (!stream.__write) {
1152
- stream.__write = stream.write;
1153
- }
1154
- stream.write = (data) => {
1155
- this[type].raw(String(data).trim());
1156
- };
1157
- }
1158
- /**
1159
- * Restores the original standard output and error streams, removing the Consola redirection.
1160
- */
1161
- restoreStd() {
1162
- this._restoreStream(this.options.stdout);
1163
- this._restoreStream(this.options.stderr);
1164
- }
1165
- _restoreStream(stream) {
1166
- if (!stream) {
1167
- return;
1168
- }
1169
- if (stream.__write) {
1170
- stream.write = stream.__write;
1171
- delete stream.__write;
1172
- }
1173
- }
1174
- /**
1175
- * Pauses logging, queues incoming logs until resumed.
1176
- */
1177
- pauseLogs() {
1178
- paused = true;
1179
- }
1180
- /**
1181
- * Resumes logging, processing any queued logs.
1182
- */
1183
- resumeLogs() {
1184
- paused = false;
1185
- const _queue = queue.splice(0);
1186
- for (const item of _queue) {
1187
- item[0]._logFn(item[1], item[2]);
1188
- }
1189
- }
1190
- /**
1191
- * Replaces logging methods with mocks if a mock function is provided.
1192
- *
1193
- * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
1194
- */
1195
- mockTypes(mockFn) {
1196
- const _mockFn = mockFn || this.options.mockFn;
1197
- this._mockFn = _mockFn;
1198
- if (typeof _mockFn !== "function") {
1199
- return;
1200
- }
1201
- for (const type in this.options.types) {
1202
- this[type] = _mockFn(type, this.options.types[type]) || this[type];
1203
- this[type].raw = this[type];
1204
- }
1205
- }
1206
- _wrapLogFn(defaults, isRaw) {
1207
- return (...args) => {
1208
- if (paused) {
1209
- queue.push([this, defaults, args, isRaw]);
1210
- return;
1211
- }
1212
- return this._logFn(defaults, args, isRaw);
1213
- };
1214
- }
1215
- _logFn(defaults, args, isRaw) {
1216
- if ((defaults.level || 0) > this.level) {
1217
- return false;
1218
- }
1219
- const logObj = {
1220
- date: /* @__PURE__ */ new Date(),
1221
- args: [],
1222
- ...defaults,
1223
- level: _normalizeLogLevel(defaults.level, this.options.types)
1224
- };
1225
- if (!isRaw && args.length === 1 && isLogObj(args[0])) {
1226
- Object.assign(logObj, args[0]);
1227
- } else {
1228
- logObj.args = [...args];
1229
- }
1230
- if (logObj.message) {
1231
- logObj.args.unshift(logObj.message);
1232
- delete logObj.message;
1233
- }
1234
- if (logObj.additional) {
1235
- if (!Array.isArray(logObj.additional)) {
1236
- logObj.additional = logObj.additional.split("\n");
1237
- }
1238
- logObj.args.push("\n" + logObj.additional.join("\n"));
1239
- delete logObj.additional;
1240
- }
1241
- logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
1242
- logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
1243
- const resolveLog = /* @__PURE__ */ __name((newLog = false) => {
1244
- const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
1245
- if (this._lastLog.object && repeated > 0) {
1246
- const args2 = [...this._lastLog.object.args];
1247
- if (repeated > 1) {
1248
- args2.push(`(repeated ${repeated} times)`);
1249
- }
1250
- this._log({ ...this._lastLog.object, args: args2 });
1251
- this._lastLog.count = 1;
1252
- }
1253
- if (newLog) {
1254
- this._lastLog.object = logObj;
1255
- this._log(logObj);
1256
- }
1257
- }, "resolveLog");
1258
- clearTimeout(this._lastLog.timeout);
1259
- const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
1260
- this._lastLog.time = logObj.date;
1261
- if (diffTime < this.options.throttle) {
1262
- try {
1263
- const serializedLog = JSON.stringify([
1264
- logObj.type,
1265
- logObj.tag,
1266
- logObj.args
1267
- ]);
1268
- const isSameLog = this._lastLog.serialized === serializedLog;
1269
- this._lastLog.serialized = serializedLog;
1270
- if (isSameLog) {
1271
- this._lastLog.count = (this._lastLog.count || 0) + 1;
1272
- if (this._lastLog.count > this.options.throttleMin) {
1273
- this._lastLog.timeout = setTimeout(
1274
- resolveLog,
1275
- this.options.throttle
1276
- );
1277
- return;
1278
- }
1279
- }
1280
- } catch {
1281
- }
1282
- }
1283
- resolveLog(true);
1284
- }
1285
- _log(logObj) {
1286
- for (const reporter of this.options.reporters) {
1287
- reporter.log(logObj, {
1288
- options: this.options
1289
- });
1290
- }
1291
- }
1292
- };
1293
- function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
1294
- if (input === void 0) {
1295
- return defaultLevel;
1296
- }
1297
- if (typeof input === "number") {
1298
- return input;
1299
- }
1300
- if (types[input] && types[input].level !== void 0) {
1301
- return types[input].level;
1302
- }
1303
- return defaultLevel;
1304
- }
1305
- __name(_normalizeLogLevel, "_normalizeLogLevel");
1306
- Consola.prototype.add = Consola.prototype.addReporter;
1307
- Consola.prototype.remove = Consola.prototype.removeReporter;
1308
- Consola.prototype.clear = Consola.prototype.removeReporter;
1309
- Consola.prototype.withScope = Consola.prototype.withTag;
1310
- Consola.prototype.mock = Consola.prototype.mockTypes;
1311
- Consola.prototype.pause = Consola.prototype.pauseLogs;
1312
- Consola.prototype.resume = Consola.prototype.resumeLogs;
1313
- function createConsola(options = {}) {
1314
- return new Consola(options);
1315
- }
1316
- __name(createConsola, "createConsola");
1317
- function parseStack(stack, message) {
1318
- const cwd = process.cwd() + sep;
1319
- const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
1320
- return lines;
1321
- }
1322
- __name(parseStack, "parseStack");
1323
- function writeStream(data, stream) {
1324
- const write = stream.__write || stream.write;
1325
- return write.call(stream, data);
1326
- }
1327
- __name(writeStream, "writeStream");
1328
- var bracket = /* @__PURE__ */ __name((x2) => x2 ? `[${x2}]` : "", "bracket");
1329
- var BasicReporter = class {
1330
- static {
1331
- __name(this, "BasicReporter");
1332
- }
1333
- formatStack(stack, message, opts) {
1334
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1335
- return indent + parseStack(stack, message).join(`
1336
- ${indent}`);
1337
- }
1338
- formatError(err, opts) {
1339
- const message = err.message ?? formatWithOptions(opts, err);
1340
- const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
1341
- const level = opts?.errorLevel || 0;
1342
- const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
1343
- const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
1344
- return causedPrefix + message + "\n" + stack + causedError;
1345
- }
1346
- formatArgs(args, opts) {
1347
- const _args = args.map((arg) => {
1348
- if (arg && typeof arg.stack === "string") {
1349
- return this.formatError(arg, opts);
1350
- }
1351
- return arg;
1352
- });
1353
- return formatWithOptions(opts, ..._args);
1354
- }
1355
- formatDate(date, opts) {
1356
- return opts.date ? date.toLocaleTimeString() : "";
1357
- }
1358
- filterAndJoin(arr) {
1359
- return arr.filter(Boolean).join(" ");
1360
- }
1361
- formatLogObj(logObj, opts) {
1362
- const message = this.formatArgs(logObj.args, opts);
1363
- if (logObj.type === "box") {
1364
- return "\n" + [
1365
- bracket(logObj.tag),
1366
- logObj.title && logObj.title,
1367
- ...message.split("\n")
1368
- ].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
1369
- }
1370
- return this.filterAndJoin([
1371
- bracket(logObj.type),
1372
- bracket(logObj.tag),
1373
- message
1374
- ]);
1375
- }
1376
- log(logObj, ctx) {
1377
- const line = this.formatLogObj(logObj, {
1378
- columns: ctx.options.stdout.columns || 0,
1379
- ...ctx.options.formatOptions
1380
- });
1381
- return writeStream(
1382
- line + "\n",
1383
- logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
1384
- );
1385
- }
1386
- };
1387
- var {
1388
- env = {},
1389
- argv = [],
1390
- platform = ""
1391
- } = typeof process === "undefined" ? {} : process;
1392
- var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
1393
- var isForced = "FORCE_COLOR" in env || argv.includes("--color");
1394
- var isWindows = platform === "win32";
1395
- var isDumbTerminal = env.TERM === "dumb";
1396
- var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
1397
- var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
1398
- var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
1399
- 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)) {
1400
- return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
1401
- }
1402
- __name(replaceClose, "replaceClose");
1403
- function clearBleed(index, string, open, close, replace) {
1404
- return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
1405
- }
1406
- __name(clearBleed, "clearBleed");
1407
- function filterEmpty(open, close, replace = open, at = open.length + 1) {
1408
- return (string) => string || !(string === "" || string === void 0) ? clearBleed(
1409
- ("" + string).indexOf(close, at),
1410
- string,
1411
- open,
1412
- close,
1413
- replace
1414
- ) : "";
1415
- }
1416
- __name(filterEmpty, "filterEmpty");
1417
- function init(open, close, replace) {
1418
- return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
1419
- }
1420
- __name(init, "init");
1421
- var colorDefs = {
1422
- reset: init(0, 0),
1423
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
1424
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
1425
- italic: init(3, 23),
1426
- underline: init(4, 24),
1427
- inverse: init(7, 27),
1428
- hidden: init(8, 28),
1429
- strikethrough: init(9, 29),
1430
- black: init(30, 39),
1431
- red: init(31, 39),
1432
- green: init(32, 39),
1433
- yellow: init(33, 39),
1434
- blue: init(34, 39),
1435
- magenta: init(35, 39),
1436
- cyan: init(36, 39),
1437
- white: init(37, 39),
1438
- gray: init(90, 39),
1439
- bgBlack: init(40, 49),
1440
- bgRed: init(41, 49),
1441
- bgGreen: init(42, 49),
1442
- bgYellow: init(43, 49),
1443
- bgBlue: init(44, 49),
1444
- bgMagenta: init(45, 49),
1445
- bgCyan: init(46, 49),
1446
- bgWhite: init(47, 49),
1447
- blackBright: init(90, 39),
1448
- redBright: init(91, 39),
1449
- greenBright: init(92, 39),
1450
- yellowBright: init(93, 39),
1451
- blueBright: init(94, 39),
1452
- magentaBright: init(95, 39),
1453
- cyanBright: init(96, 39),
1454
- whiteBright: init(97, 39),
1455
- bgBlackBright: init(100, 49),
1456
- bgRedBright: init(101, 49),
1457
- bgGreenBright: init(102, 49),
1458
- bgYellowBright: init(103, 49),
1459
- bgBlueBright: init(104, 49),
1460
- bgMagentaBright: init(105, 49),
1461
- bgCyanBright: init(106, 49),
1462
- bgWhiteBright: init(107, 49)
1463
- };
1464
- function createColors(useColor = isColorSupported) {
1465
- return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
1466
- }
1467
- __name(createColors, "createColors");
1468
- var colors = createColors();
1469
- function getColor(color, fallback = "reset") {
1470
- return colors[color] || colors[fallback];
1471
- }
1472
- __name(getColor, "getColor");
1473
- var ansiRegex = [
1474
- String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
1475
- String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
1476
- ].join("|");
1477
- function stripAnsi(text) {
1478
- return text.replace(new RegExp(ansiRegex, "g"), "");
1479
- }
1480
- __name(stripAnsi, "stripAnsi");
1481
- var boxStylePresets = {
1482
- solid: {
1483
- tl: "\u250C",
1484
- tr: "\u2510",
1485
- bl: "\u2514",
1486
- br: "\u2518",
1487
- h: "\u2500",
1488
- v: "\u2502"
1489
- },
1490
- double: {
1491
- tl: "\u2554",
1492
- tr: "\u2557",
1493
- bl: "\u255A",
1494
- br: "\u255D",
1495
- h: "\u2550",
1496
- v: "\u2551"
1497
- },
1498
- doubleSingle: {
1499
- tl: "\u2553",
1500
- tr: "\u2556",
1501
- bl: "\u2559",
1502
- br: "\u255C",
1503
- h: "\u2500",
1504
- v: "\u2551"
1505
- },
1506
- doubleSingleRounded: {
1507
- tl: "\u256D",
1508
- tr: "\u256E",
1509
- bl: "\u2570",
1510
- br: "\u256F",
1511
- h: "\u2500",
1512
- v: "\u2551"
1513
- },
1514
- singleThick: {
1515
- tl: "\u250F",
1516
- tr: "\u2513",
1517
- bl: "\u2517",
1518
- br: "\u251B",
1519
- h: "\u2501",
1520
- v: "\u2503"
1521
- },
1522
- singleDouble: {
1523
- tl: "\u2552",
1524
- tr: "\u2555",
1525
- bl: "\u2558",
1526
- br: "\u255B",
1527
- h: "\u2550",
1528
- v: "\u2502"
1529
- },
1530
- singleDoubleRounded: {
1531
- tl: "\u256D",
1532
- tr: "\u256E",
1533
- bl: "\u2570",
1534
- br: "\u256F",
1535
- h: "\u2550",
1536
- v: "\u2502"
1537
- },
1538
- rounded: {
1539
- tl: "\u256D",
1540
- tr: "\u256E",
1541
- bl: "\u2570",
1542
- br: "\u256F",
1543
- h: "\u2500",
1544
- v: "\u2502"
1545
- }
1546
- };
1547
- var defaultStyle = {
1548
- borderColor: "white",
1549
- borderStyle: "rounded",
1550
- valign: "center",
1551
- padding: 2,
1552
- marginLeft: 1,
1553
- marginTop: 1,
1554
- marginBottom: 1
1555
- };
1556
- function box(text, _opts = {}) {
1557
- const opts = {
1558
- ..._opts,
1559
- style: {
1560
- ...defaultStyle,
1561
- ..._opts.style
1562
- }
1563
- };
1564
- const textLines = text.split("\n");
1565
- const boxLines = [];
1566
- const _color = getColor(opts.style.borderColor);
1567
- const borderStyle = {
1568
- ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
1569
- };
1570
- if (_color) {
1571
- for (const key in borderStyle) {
1572
- borderStyle[key] = _color(
1573
- borderStyle[key]
1574
- );
1575
- }
1576
- }
1577
- const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
1578
- const height = textLines.length + paddingOffset;
1579
- const width = Math.max(
1580
- ...textLines.map((line) => stripAnsi(line).length),
1581
- opts.title ? stripAnsi(opts.title).length : 0
1582
- ) + paddingOffset;
1583
- const widthOffset = width + paddingOffset;
1584
- const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
1585
- if (opts.style.marginTop > 0) {
1586
- boxLines.push("".repeat(opts.style.marginTop));
1587
- }
1588
- if (opts.title) {
1589
- const title = _color ? _color(opts.title) : opts.title;
1590
- const left = borderStyle.h.repeat(
1591
- Math.floor((width - stripAnsi(opts.title).length) / 2)
1592
- );
1593
- const right = borderStyle.h.repeat(
1594
- width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
1595
- );
1596
- boxLines.push(
1597
- `${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
1598
- );
1599
- } else {
1600
- boxLines.push(
1601
- `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
1602
- );
1603
- }
1604
- const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
1605
- for (let i2 = 0; i2 < height; i2++) {
1606
- if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
1607
- boxLines.push(
1608
- `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
1609
- );
1610
- } else {
1611
- const line = textLines[i2 - valignOffset];
1612
- const left = " ".repeat(paddingOffset);
1613
- const right = " ".repeat(width - stripAnsi(line).length);
1614
- boxLines.push(
1615
- `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
1616
- );
1617
- }
1618
- }
1619
- boxLines.push(
1620
- `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
1621
- );
1622
- if (opts.style.marginBottom > 0) {
1623
- boxLines.push("".repeat(opts.style.marginBottom));
1624
- }
1625
- return boxLines.join("\n");
1626
- }
1627
- __name(box, "box");
1628
- var r2 = /* @__PURE__ */ Object.create(null);
1629
- var i = /* @__PURE__ */ __name((e2) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e2 ? r2 : globalThis), "i");
1630
- var o2 = new Proxy(r2, { get(e2, s2) {
1631
- return i()[s2] ?? r2[s2];
1632
- }, has(e2, s2) {
1633
- const E = i();
1634
- return s2 in E || s2 in r2;
1635
- }, set(e2, s2, E) {
1636
- const B2 = i(true);
1637
- return B2[s2] = E, true;
1638
- }, deleteProperty(e2, s2) {
1639
- if (!s2) return false;
1640
- const E = i(true);
1641
- return delete E[s2], true;
1642
- }, ownKeys() {
1643
- const e2 = i(true);
1644
- return Object.keys(e2);
1645
- } });
1646
- var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
1647
- 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 }]];
1648
- function b() {
1649
- if (globalThis.process?.env) for (const e2 of f2) {
1650
- const s2 = e2[1] || e2[0];
1651
- if (globalThis.process?.env[s2]) return { name: e2[0].toLowerCase(), ...e2[2] };
1652
- }
1653
- return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
1654
- }
1655
- __name(b, "b");
1656
- var l = b();
1657
- l.name;
1658
- function n(e2) {
1659
- return e2 ? e2 !== "false" : false;
1660
- }
1661
- __name(n, "n");
1662
- var I2 = globalThis.process?.platform || "";
1663
- var T2 = n(o2.CI) || l.ci !== false;
1664
- var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
1665
- var g2 = n(o2.DEBUG);
1666
- var R2 = t === "test" || n(o2.TEST);
1667
- n(o2.MINIMAL) || T2 || R2 || !a;
1668
- var A2 = /^win/i.test(I2);
1669
- !n(o2.NO_COLOR) && (n(o2.FORCE_COLOR) || (a || A2) && o2.TERM !== "dumb" || T2);
1670
- var C2 = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
1671
- Number(C2?.split(".")[0]) || null;
1672
- var y2 = globalThis.process || /* @__PURE__ */ Object.create(null);
1673
- var _2 = { versions: {} };
1674
- new Proxy(y2, { get(e2, s2) {
1675
- if (s2 === "env") return o2;
1676
- if (s2 in e2) return e2[s2];
1677
- if (s2 in _2) return _2[s2];
1678
- } });
1679
- var c2 = globalThis.process?.release?.name === "node";
1680
- var O2 = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
1681
- var D = !!globalThis.Deno;
1682
- var L2 = !!globalThis.fastly;
1683
- var S2 = !!globalThis.Netlify;
1684
- var u2 = !!globalThis.EdgeRuntime;
1685
- var N2 = globalThis.navigator?.userAgent === "Cloudflare-Workers";
1686
- var F2 = [[S2, "netlify"], [u2, "edge-light"], [N2, "workerd"], [L2, "fastly"], [D, "deno"], [O2, "bun"], [c2, "node"]];
1687
- function G2() {
1688
- const e2 = F2.find((s2) => s2[0]);
1689
- if (e2) return { name: e2[1] };
1690
- }
1691
- __name(G2, "G");
1692
- var P2 = G2();
1693
- P2?.name || "";
1694
- function ansiRegex2({ onlyFirst = false } = {}) {
1695
- const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
1696
- const pattern = [
1697
- `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
1698
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
1699
- ].join("|");
1700
- return new RegExp(pattern, onlyFirst ? void 0 : "g");
1701
- }
1702
- __name(ansiRegex2, "ansiRegex");
1703
- var regex = ansiRegex2();
1704
- function stripAnsi2(string) {
1705
- if (typeof string !== "string") {
1706
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
1707
- }
1708
- return string.replace(regex, "");
1709
- }
1710
- __name(stripAnsi2, "stripAnsi");
1711
- function isAmbiguous(x2) {
1712
- 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;
1713
- }
1714
- __name(isAmbiguous, "isAmbiguous");
1715
- function isFullWidth(x2) {
1716
- return x2 === 12288 || x2 >= 65281 && x2 <= 65376 || x2 >= 65504 && x2 <= 65510;
1717
- }
1718
- __name(isFullWidth, "isFullWidth");
1719
- function isWide(x2) {
1720
- 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;
1721
- }
1722
- __name(isWide, "isWide");
1723
- function validate(codePoint) {
1724
- if (!Number.isSafeInteger(codePoint)) {
1725
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
1726
- }
1727
- }
1728
- __name(validate, "validate");
1729
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
1730
- validate(codePoint);
1731
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
1732
- return 2;
1733
- }
1734
- return 1;
1735
- }
1736
- __name(eastAsianWidth, "eastAsianWidth");
1737
- var emojiRegex = /* @__PURE__ */ __name(() => {
1738
- 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;
1739
- }, "emojiRegex");
1740
- var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: /* @__PURE__ */ __name((str) => str.split(""), "segment") };
1741
- var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
1742
- function stringWidth$1(string, options = {}) {
1743
- if (typeof string !== "string" || string.length === 0) {
1744
- return 0;
1745
- }
1746
- const {
1747
- ambiguousIsNarrow = true,
1748
- countAnsiEscapeCodes = false
1749
- } = options;
1750
- if (!countAnsiEscapeCodes) {
1751
- string = stripAnsi2(string);
1752
- }
1753
- if (string.length === 0) {
1754
- return 0;
1755
- }
1756
- let width = 0;
1757
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
1758
- for (const { segment: character } of segmenter.segment(string)) {
1759
- const codePoint = character.codePointAt(0);
1760
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
1761
- continue;
1762
- }
1763
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
1764
- continue;
1765
- }
1766
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
1767
- continue;
1768
- }
1769
- if (codePoint >= 55296 && codePoint <= 57343) {
1770
- continue;
1771
- }
1772
- if (codePoint >= 65024 && codePoint <= 65039) {
1773
- continue;
1774
- }
1775
- if (defaultIgnorableCodePointRegex.test(character)) {
1776
- continue;
1777
- }
1778
- if (emojiRegex().test(character)) {
1779
- width += 2;
1780
- continue;
1781
- }
1782
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
1783
- }
1784
- return width;
1785
- }
1786
- __name(stringWidth$1, "stringWidth$1");
1787
- function isUnicodeSupported() {
1788
- const { env: env2 } = g;
1789
- const { TERM, TERM_PROGRAM } = env2;
1790
- if (g.platform !== "win32") {
1791
- return TERM !== "linux";
1792
- }
1793
- 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";
1794
- }
1795
- __name(isUnicodeSupported, "isUnicodeSupported");
1796
- var TYPE_COLOR_MAP = {
1797
- info: "cyan",
1798
- fail: "red",
1799
- success: "green",
1800
- ready: "green",
1801
- start: "magenta"
1802
- };
1803
- var LEVEL_COLOR_MAP = {
1804
- 0: "red",
1805
- 1: "yellow"
1806
- };
1807
- var unicode = isUnicodeSupported();
1808
- var s = /* @__PURE__ */ __name((c3, fallback) => unicode ? c3 : fallback, "s");
1809
- var TYPE_ICONS = {
1810
- error: s("\u2716", "\xD7"),
1811
- fatal: s("\u2716", "\xD7"),
1812
- ready: s("\u2714", "\u221A"),
1813
- warn: s("\u26A0", "\u203C"),
1814
- info: s("\u2139", "i"),
1815
- success: s("\u2714", "\u221A"),
1816
- debug: s("\u2699", "D"),
1817
- trace: s("\u2192", "\u2192"),
1818
- fail: s("\u2716", "\xD7"),
1819
- start: s("\u25D0", "o"),
1820
- log: ""
1821
- };
1822
- function stringWidth(str) {
1823
- const hasICU = typeof Intl === "object";
1824
- if (!hasICU || !Intl.Segmenter) {
1825
- return stripAnsi(str).length;
1826
- }
1827
- return stringWidth$1(str);
1828
- }
1829
- __name(stringWidth, "stringWidth");
1830
- var FancyReporter = class extends BasicReporter {
1831
- static {
1832
- __name(this, "FancyReporter");
1833
- }
1834
- formatStack(stack, message, opts) {
1835
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1836
- return `
1837
- ${indent}` + parseStack(stack, message).map(
1838
- (line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_3, m2) => `(${colors.cyan(m2)})`)
1839
- ).join(`
1840
- ${indent}`);
1841
- }
1842
- formatType(logObj, isBadge, opts) {
1843
- const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
1844
- if (isBadge) {
1845
- return getBgColor(typeColor)(
1846
- colors.black(` ${logObj.type.toUpperCase()} `)
1847
- );
1848
- }
1849
- const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
1850
- return _type ? getColor2(typeColor)(_type) : "";
1851
- }
1852
- formatLogObj(logObj, opts) {
1853
- const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
1854
- "\n"
1855
- );
1856
- if (logObj.type === "box") {
1857
- return box(
1858
- characterFormat(
1859
- message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
1860
- ),
1861
- {
1862
- title: logObj.title ? characterFormat(logObj.title) : void 0,
1863
- style: logObj.style
1864
- }
1865
- );
1866
- }
1867
- const date = this.formatDate(logObj.date, opts);
1868
- const coloredDate = date && colors.gray(date);
1869
- const isBadge = logObj.badge ?? logObj.level < 2;
1870
- const type = this.formatType(logObj, isBadge, opts);
1871
- const tag = logObj.tag ? colors.gray(logObj.tag) : "";
1872
- let line;
1873
- const left = this.filterAndJoin([type, characterFormat(message)]);
1874
- const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
1875
- const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
1876
- line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
1877
- line += characterFormat(
1878
- additional.length > 0 ? "\n" + additional.join("\n") : ""
1879
- );
1880
- if (logObj.type === "trace") {
1881
- const _err = new Error("Trace: " + logObj.message);
1882
- line += this.formatStack(_err.stack || "", _err.message);
1883
- }
1884
- return isBadge ? "\n" + line + "\n" : line;
1885
- }
1886
- };
1887
- function characterFormat(str) {
1888
- return str.replace(/`([^`]+)`/gm, (_3, m2) => colors.cyan(m2)).replace(/\s+_([^_]+)_\s+/gm, (_3, m2) => ` ${colors.underline(m2)} `);
1889
- }
1890
- __name(characterFormat, "characterFormat");
1891
- function getColor2(color = "white") {
1892
- return colors[color] || colors.white;
1893
- }
1894
- __name(getColor2, "getColor");
1895
- function getBgColor(color = "bgWhite") {
1896
- return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
1897
- }
1898
- __name(getBgColor, "getBgColor");
1899
- function createConsola2(options = {}) {
1900
- let level = _getDefaultLogLevel();
1901
- if (process.env.CONSOLA_LEVEL) {
1902
- level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
1903
- }
1904
- const consola2 = createConsola({
1905
- level,
1906
- defaults: { level },
1907
- stdout: process.stdout,
1908
- stderr: process.stderr,
1909
- prompt: /* @__PURE__ */ __name((...args) => Promise.resolve().then(() => (init_prompt(), prompt_exports)).then((m2) => m2.prompt(...args)), "prompt"),
1910
- reporters: options.reporters || [
1911
- options.fancy ?? !(T2 || R2) ? new FancyReporter() : new BasicReporter()
1912
- ],
1913
- ...options
1914
- });
1915
- return consola2;
1916
- }
1917
- __name(createConsola2, "createConsola");
1918
- function _getDefaultLogLevel() {
1919
- if (g2) {
1920
- return LogLevels.debug;
1921
- }
1922
- if (R2) {
1923
- return LogLevels.warn;
1924
- }
1925
- return LogLevels.info;
1926
- }
1927
- __name(_getDefaultLogLevel, "_getDefaultLogLevel");
1928
- var consola = createConsola2();
1929
-
1930
- // ../../node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs
1931
- function toArray(val) {
1932
- if (Array.isArray(val)) {
1933
- return val;
1934
- }
1935
- return val === void 0 ? [] : [val];
1936
- }
1937
- __name(toArray, "toArray");
1938
- function formatLineColumns(lines, linePrefix = "") {
1939
- const maxLengh = [];
1940
- for (const line of lines) {
1941
- for (const [i2, element] of line.entries()) {
1942
- maxLengh[i2] = Math.max(maxLengh[i2] || 0, element.length);
1943
- }
1944
- }
1945
- return lines.map(
1946
- (l2) => l2.map(
1947
- (c3, i2) => linePrefix + c3[i2 === 0 ? "padStart" : "padEnd"](maxLengh[i2])
1948
- ).join(" ")
1949
- ).join("\n");
1950
- }
1951
- __name(formatLineColumns, "formatLineColumns");
1952
- function resolveValue(input) {
1953
- return typeof input === "function" ? input() : input;
1954
- }
1955
- __name(resolveValue, "resolveValue");
1956
- var CLIError = class extends Error {
1957
- static {
1958
- __name(this, "CLIError");
1959
- }
1960
- constructor(message, code) {
1961
- super(message);
1962
- this.code = code;
1963
- this.name = "CLIError";
1964
- }
1965
- };
1966
- var NUMBER_CHAR_RE = /\d/;
1967
- var STR_SPLITTERS = ["-", "_", "/", "."];
1968
- function isUppercase(char = "") {
1969
- if (NUMBER_CHAR_RE.test(char)) {
1970
- return void 0;
1971
- }
1972
- return char !== char.toLowerCase();
1973
- }
1974
- __name(isUppercase, "isUppercase");
1975
- function splitByCase(str, separators) {
1976
- const splitters = separators ?? STR_SPLITTERS;
1977
- const parts = [];
1978
- if (!str || typeof str !== "string") {
1979
- return parts;
1980
- }
1981
- let buff = "";
1982
- let previousUpper;
1983
- let previousSplitter;
1984
- for (const char of str) {
1985
- const isSplitter = splitters.includes(char);
1986
- if (isSplitter === true) {
1987
- parts.push(buff);
1988
- buff = "";
1989
- previousUpper = void 0;
1990
- continue;
1991
- }
1992
- const isUpper = isUppercase(char);
1993
- if (previousSplitter === false) {
1994
- if (previousUpper === false && isUpper === true) {
1995
- parts.push(buff);
1996
- buff = char;
1997
- previousUpper = isUpper;
1998
- continue;
1999
- }
2000
- if (previousUpper === true && isUpper === false && buff.length > 1) {
2001
- const lastChar = buff.at(-1);
2002
- parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
2003
- buff = lastChar + char;
2004
- previousUpper = isUpper;
2005
- continue;
2006
- }
2007
- }
2008
- buff += char;
2009
- previousUpper = isUpper;
2010
- previousSplitter = isSplitter;
2011
- }
2012
- parts.push(buff);
2013
- return parts;
2014
- }
2015
- __name(splitByCase, "splitByCase");
2016
- function upperFirst(str) {
2017
- return str ? str[0].toUpperCase() + str.slice(1) : "";
2018
- }
2019
- __name(upperFirst, "upperFirst");
2020
- function lowerFirst(str) {
2021
- return str ? str[0].toLowerCase() + str.slice(1) : "";
2022
- }
2023
- __name(lowerFirst, "lowerFirst");
2024
- function pascalCase(str, opts) {
2025
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
2026
- }
2027
- __name(pascalCase, "pascalCase");
2028
- function camelCase(str, opts) {
2029
- return lowerFirst(pascalCase(str || "", opts));
2030
- }
2031
- __name(camelCase, "camelCase");
2032
- function kebabCase(str, joiner) {
2033
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
2034
- }
2035
- __name(kebabCase, "kebabCase");
2036
- function toArr(any) {
2037
- return any == void 0 ? [] : Array.isArray(any) ? any : [any];
2038
- }
2039
- __name(toArr, "toArr");
2040
- function toVal(out, key, val, opts) {
2041
- let x2;
2042
- const old = out[key];
2043
- 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;
2044
- out[key] = old == void 0 ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
2045
- }
2046
- __name(toVal, "toVal");
2047
- function parseRawArgs(args = [], opts = {}) {
2048
- let k2;
2049
- let arr;
2050
- let arg;
2051
- let name;
2052
- let val;
2053
- const out = { _: [] };
2054
- let i2 = 0;
2055
- let j = 0;
2056
- let idx = 0;
2057
- const len = args.length;
2058
- const alibi = opts.alias !== void 0;
2059
- const strict = opts.unknown !== void 0;
2060
- const defaults = opts.default !== void 0;
2061
- opts.alias = opts.alias || {};
2062
- opts.string = toArr(opts.string);
2063
- opts.boolean = toArr(opts.boolean);
2064
- if (alibi) {
2065
- for (k2 in opts.alias) {
2066
- arr = opts.alias[k2] = toArr(opts.alias[k2]);
2067
- for (i2 = 0; i2 < arr.length; i2++) {
2068
- (opts.alias[arr[i2]] = arr.concat(k2)).splice(i2, 1);
2069
- }
2070
- }
2071
- }
2072
- for (i2 = opts.boolean.length; i2-- > 0; ) {
2073
- arr = opts.alias[opts.boolean[i2]] || [];
2074
- for (j = arr.length; j-- > 0; ) {
2075
- opts.boolean.push(arr[j]);
2076
- }
2077
- }
2078
- for (i2 = opts.string.length; i2-- > 0; ) {
2079
- arr = opts.alias[opts.string[i2]] || [];
2080
- for (j = arr.length; j-- > 0; ) {
2081
- opts.string.push(arr[j]);
2082
- }
2083
- }
2084
- if (defaults) {
2085
- for (k2 in opts.default) {
2086
- name = typeof opts.default[k2];
2087
- arr = opts.alias[k2] = opts.alias[k2] || [];
2088
- if (opts[name] !== void 0) {
2089
- opts[name].push(k2);
2090
- for (i2 = 0; i2 < arr.length; i2++) {
2091
- opts[name].push(arr[i2]);
2092
- }
2093
- }
2094
- }
2095
- }
2096
- const keys = strict ? Object.keys(opts.alias) : [];
2097
- for (i2 = 0; i2 < len; i2++) {
2098
- arg = args[i2];
2099
- if (arg === "--") {
2100
- out._ = out._.concat(args.slice(++i2));
2101
- break;
2102
- }
2103
- for (j = 0; j < arg.length; j++) {
2104
- if (arg.charCodeAt(j) !== 45) {
2105
- break;
2106
- }
2107
- }
2108
- if (j === 0) {
2109
- out._.push(arg);
2110
- } else if (arg.substring(j, j + 3) === "no-") {
2111
- name = arg.slice(Math.max(0, j + 3));
2112
- if (strict && !~keys.indexOf(name)) {
2113
- return opts.unknown(arg);
2114
- }
2115
- out[name] = false;
2116
- } else {
2117
- for (idx = j + 1; idx < arg.length; idx++) {
2118
- if (arg.charCodeAt(idx) === 61) {
2119
- break;
2120
- }
2121
- }
2122
- name = arg.substring(j, idx);
2123
- val = arg.slice(Math.max(0, ++idx)) || i2 + 1 === len || ("" + args[i2 + 1]).charCodeAt(0) === 45 || args[++i2];
2124
- arr = j === 2 ? [name] : name;
2125
- for (idx = 0; idx < arr.length; idx++) {
2126
- name = arr[idx];
2127
- if (strict && !~keys.indexOf(name)) {
2128
- return opts.unknown("-".repeat(j) + name);
2129
- }
2130
- toVal(out, name, idx + 1 < arr.length || val, opts);
2131
- }
2132
- }
2133
- }
2134
- if (defaults) {
2135
- for (k2 in opts.default) {
2136
- if (out[k2] === void 0) {
2137
- out[k2] = opts.default[k2];
2138
- }
2139
- }
2140
- }
2141
- if (alibi) {
2142
- for (k2 in out) {
2143
- arr = opts.alias[k2] || [];
2144
- while (arr.length > 0) {
2145
- out[arr.shift()] = out[k2];
2146
- }
2147
- }
2148
- }
2149
- return out;
2150
- }
2151
- __name(parseRawArgs, "parseRawArgs");
2152
- function parseArgs(rawArgs, argsDef) {
2153
- const parseOptions = {
2154
- boolean: [],
2155
- string: [],
2156
- mixed: [],
2157
- alias: {},
2158
- default: {}
2159
- };
2160
- const args = resolveArgs(argsDef);
2161
- for (const arg of args) {
2162
- if (arg.type === "positional") {
2163
- continue;
2164
- }
2165
- if (arg.type === "string") {
2166
- parseOptions.string.push(arg.name);
2167
- } else if (arg.type === "boolean") {
2168
- parseOptions.boolean.push(arg.name);
2169
- }
2170
- if (arg.default !== void 0) {
2171
- parseOptions.default[arg.name] = arg.default;
2172
- }
2173
- if (arg.alias) {
2174
- parseOptions.alias[arg.name] = arg.alias;
2175
- }
2176
- }
2177
- const parsed = parseRawArgs(rawArgs, parseOptions);
2178
- const [...positionalArguments] = parsed._;
2179
- const parsedArgsProxy = new Proxy(parsed, {
2180
- get(target, prop) {
2181
- return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
2182
- }
2183
- });
2184
- for (const [, arg] of args.entries()) {
2185
- if (arg.type === "positional") {
2186
- const nextPositionalArgument = positionalArguments.shift();
2187
- if (nextPositionalArgument !== void 0) {
2188
- parsedArgsProxy[arg.name] = nextPositionalArgument;
2189
- } else if (arg.default === void 0 && arg.required !== false) {
2190
- throw new CLIError(
2191
- `Missing required positional argument: ${arg.name.toUpperCase()}`,
2192
- "EARG"
2193
- );
2194
- } else {
2195
- parsedArgsProxy[arg.name] = arg.default;
2196
- }
2197
- } else if (arg.required && parsedArgsProxy[arg.name] === void 0) {
2198
- throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
2199
- }
2200
- }
2201
- return parsedArgsProxy;
2202
- }
2203
- __name(parseArgs, "parseArgs");
2204
- function resolveArgs(argsDef) {
2205
- const args = [];
2206
- for (const [name, argDef] of Object.entries(argsDef || {})) {
2207
- args.push({
2208
- ...argDef,
2209
- name,
2210
- alias: toArray(argDef.alias)
2211
- });
2212
- }
2213
- return args;
2214
- }
2215
- __name(resolveArgs, "resolveArgs");
2216
- function defineCommand(def) {
2217
- return def;
2218
- }
2219
- __name(defineCommand, "defineCommand");
2220
- async function runCommand(cmd, opts) {
2221
- const cmdArgs = await resolveValue(cmd.args || {});
2222
- const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
2223
- const context = {
2224
- rawArgs: opts.rawArgs,
2225
- args: parsedArgs,
2226
- data: opts.data,
2227
- cmd
2228
- };
2229
- if (typeof cmd.setup === "function") {
2230
- await cmd.setup(context);
2231
- }
2232
- let result;
2233
- try {
2234
- const subCommands = await resolveValue(cmd.subCommands);
2235
- if (subCommands && Object.keys(subCommands).length > 0) {
2236
- const subCommandArgIndex = opts.rawArgs.findIndex(
2237
- (arg) => !arg.startsWith("-")
2238
- );
2239
- const subCommandName = opts.rawArgs[subCommandArgIndex];
2240
- if (subCommandName) {
2241
- if (!subCommands[subCommandName]) {
2242
- throw new CLIError(
2243
- `Unknown command \`${subCommandName}\``,
2244
- "E_UNKNOWN_COMMAND"
2245
- );
2246
- }
2247
- const subCommand = await resolveValue(subCommands[subCommandName]);
2248
- if (subCommand) {
2249
- await runCommand(subCommand, {
2250
- rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
2251
- });
2252
- }
2253
- } else if (!cmd.run) {
2254
- throw new CLIError(`No command specified.`, "E_NO_COMMAND");
2255
- }
2256
- }
2257
- if (typeof cmd.run === "function") {
2258
- result = await cmd.run(context);
2259
- }
2260
- } finally {
2261
- if (typeof cmd.cleanup === "function") {
2262
- await cmd.cleanup(context);
2263
- }
2264
- }
2265
- return { result };
2266
- }
2267
- __name(runCommand, "runCommand");
2268
- async function resolveSubCommand(cmd, rawArgs, parent) {
2269
- const subCommands = await resolveValue(cmd.subCommands);
2270
- if (subCommands && Object.keys(subCommands).length > 0) {
2271
- const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
2272
- const subCommandName = rawArgs[subCommandArgIndex];
2273
- const subCommand = await resolveValue(subCommands[subCommandName]);
2274
- if (subCommand) {
2275
- return resolveSubCommand(
2276
- subCommand,
2277
- rawArgs.slice(subCommandArgIndex + 1),
2278
- cmd
2279
- );
2280
- }
2281
- }
2282
- return [cmd, parent];
2283
- }
2284
- __name(resolveSubCommand, "resolveSubCommand");
2285
- async function showUsage(cmd, parent) {
2286
- try {
2287
- consola.log(await renderUsage(cmd, parent) + "\n");
2288
- } catch (error) {
2289
- consola.error(error);
2290
- }
2291
- }
2292
- __name(showUsage, "showUsage");
2293
- async function renderUsage(cmd, parent) {
2294
- const cmdMeta = await resolveValue(cmd.meta || {});
2295
- const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
2296
- const parentMeta = await resolveValue(parent?.meta || {});
2297
- const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
2298
- const argLines = [];
2299
- const posLines = [];
2300
- const commandsLines = [];
2301
- const usageLine = [];
2302
- for (const arg of cmdArgs) {
2303
- if (arg.type === "positional") {
2304
- const name = arg.name.toUpperCase();
2305
- const isRequired = arg.required !== false && arg.default === void 0;
2306
- const defaultHint = arg.default ? `="${arg.default}"` : "";
2307
- posLines.push([
2308
- "`" + name + defaultHint + "`",
2309
- arg.description || "",
2310
- arg.valueHint ? `<${arg.valueHint}>` : ""
2311
- ]);
2312
- usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
2313
- } else {
2314
- const isRequired = arg.required === true && arg.default === void 0;
2315
- const argStr = (arg.type === "boolean" && arg.default === true ? [
2316
- ...(arg.alias || []).map((a2) => `--no-${a2}`),
2317
- `--no-${arg.name}`
2318
- ].join(", ") : [...(arg.alias || []).map((a2) => `-${a2}`), `--${arg.name}`].join(
2319
- ", "
2320
- )) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
2321
- argLines.push([
2322
- "`" + argStr + (isRequired ? " (required)" : "") + "`",
2323
- arg.description || ""
2324
- ]);
2325
- if (isRequired) {
2326
- usageLine.push(argStr);
2327
- }
2328
- }
2329
- }
2330
- if (cmd.subCommands) {
2331
- const commandNames = [];
2332
- const subCommands = await resolveValue(cmd.subCommands);
2333
- for (const [name, sub] of Object.entries(subCommands)) {
2334
- const subCmd = await resolveValue(sub);
2335
- const meta = await resolveValue(subCmd?.meta);
2336
- commandsLines.push([`\`${name}\``, meta?.description || ""]);
2337
- commandNames.push(name);
2338
- }
2339
- usageLine.push(commandNames.join("|"));
2340
- }
2341
- const usageLines = [];
2342
- const version = cmdMeta.version || parentMeta.version;
2343
- usageLines.push(
2344
- colors.gray(
2345
- `${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`
2346
- ),
2347
- ""
2348
- );
2349
- const hasOptions = argLines.length > 0 || posLines.length > 0;
2350
- usageLines.push(
2351
- `${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``,
2352
- ""
2353
- );
2354
- if (posLines.length > 0) {
2355
- usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
2356
- usageLines.push(formatLineColumns(posLines, " "));
2357
- usageLines.push("");
2358
- }
2359
- if (argLines.length > 0) {
2360
- usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
2361
- usageLines.push(formatLineColumns(argLines, " "));
2362
- usageLines.push("");
2363
- }
2364
- if (commandsLines.length > 0) {
2365
- usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
2366
- usageLines.push(formatLineColumns(commandsLines, " "));
2367
- usageLines.push(
2368
- "",
2369
- `Use \`${commandName} <command> --help\` for more information about a command.`
2370
- );
2371
- }
2372
- return usageLines.filter((l2) => typeof l2 === "string").join("\n");
2373
- }
2374
- __name(renderUsage, "renderUsage");
2375
- async function runMain(cmd, opts = {}) {
2376
- const rawArgs = opts.rawArgs || process.argv.slice(2);
2377
- const showUsage$1 = opts.showUsage || showUsage;
2378
- try {
2379
- if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
2380
- await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2381
- process.exit(0);
2382
- } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
2383
- const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
2384
- if (!meta?.version) {
2385
- throw new CLIError("No version specified", "E_NO_VERSION");
2386
- }
2387
- consola.log(meta.version);
2388
- } else {
2389
- await runCommand(cmd, { rawArgs });
2390
- }
2391
- } catch (error) {
2392
- const isCLIError = error instanceof CLIError;
2393
- if (!isCLIError) {
2394
- consola.error(error, "\n");
2395
- }
2396
- if (isCLIError) {
2397
- await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2398
- }
2399
- consola.error(error.message);
2400
- process.exit(1);
2401
- }
2402
- }
2403
- __name(runMain, "runMain");
2404
-
2405
- // src/cli/init.ts
2406
9
  var __filename$1 = fileURLToPath(import.meta.url);
2407
10
  var __dirname$1 = dirname(__filename$1);
2408
11
  var main = defineCommand({
@@ -2421,6 +24,11 @@ var main = defineCommand({
2421
24
  type: "string",
2422
25
  description: "Views directory path",
2423
26
  default: "src/views"
27
+ },
28
+ "skip-install": {
29
+ type: "boolean",
30
+ description: "Skip automatic dependency installation",
31
+ default: false
2424
32
  }
2425
33
  },
2426
34
  async run({ args }) {
@@ -2438,16 +46,6 @@ var main = defineCommand({
2438
46
  consola.info("Searched:", templateLocations);
2439
47
  process.exit(1);
2440
48
  }
2441
- const globalTypesLocations = [
2442
- resolve(__dirname$1, "../../src/global.d.ts"),
2443
- resolve(__dirname$1, "../global.d.ts")
2444
- ];
2445
- const globalTypesSrc = globalTypesLocations.find((loc) => existsSync(loc));
2446
- if (!globalTypesSrc) {
2447
- consola.error("Failed to locate global.d.ts");
2448
- consola.info("Searched:", globalTypesLocations);
2449
- process.exit(1);
2450
- }
2451
49
  const tsconfigPath = join(cwd, "tsconfig.json");
2452
50
  if (!existsSync(tsconfigPath)) {
2453
51
  consola.error("No tsconfig.json found in project root");
@@ -2475,14 +73,6 @@ var main = defineCommand({
2475
73
  copyFileSync(entryServerSrc, entryServerDest);
2476
74
  consola.success(`Created ${viewsDir}/entry-server.tsx`);
2477
75
  }
2478
- consola.start("Creating global.d.ts...");
2479
- const globalTypesDest = join(cwd, "src/global.d.ts");
2480
- if (existsSync(globalTypesDest) && !args.force) {
2481
- consola.warn("src/global.d.ts already exists (use --force to overwrite)");
2482
- } else {
2483
- copyFileSync(globalTypesSrc, globalTypesDest);
2484
- consola.success("Created src/global.d.ts");
2485
- }
2486
76
  consola.start("Configuring vite.config.js...");
2487
77
  const viteConfigPath = join(cwd, "vite.config.js");
2488
78
  const viteConfigTs = join(cwd, "vite.config.ts");
@@ -2548,11 +138,22 @@ export default defineConfig({
2548
138
  ];
2549
139
  updated = true;
2550
140
  }
2551
- if (!tsconfig.compilerOptions.types) {
2552
- tsconfig.compilerOptions.types = [];
141
+ if (!tsconfig.include) {
142
+ tsconfig.include = [];
143
+ }
144
+ const hasTsx = tsconfig.include.some((pattern) => pattern.includes("**/*.tsx"));
145
+ if (!hasTsx) {
146
+ if (!tsconfig.include.includes("src/**/*.tsx")) {
147
+ tsconfig.include.push("src/**/*.tsx");
148
+ updated = true;
149
+ }
150
+ }
151
+ if (!tsconfig.exclude) {
152
+ tsconfig.exclude = [];
2553
153
  }
2554
- if (!tsconfig.compilerOptions.types.includes("vite/client")) {
2555
- tsconfig.compilerOptions.types.push("vite/client");
154
+ const hasEntryClientExclude = tsconfig.exclude.some((pattern) => pattern.includes("entry-client.tsx"));
155
+ if (!hasEntryClientExclude) {
156
+ tsconfig.exclude.push("src/views/entry-client.tsx");
2556
157
  updated = true;
2557
158
  }
2558
159
  if (updated) {
@@ -2564,6 +165,68 @@ export default defineConfig({
2564
165
  } catch (error) {
2565
166
  consola.error("Failed to update tsconfig.json:", error);
2566
167
  }
168
+ consola.start("Configuring tsconfig.build.json...");
169
+ const tsconfigBuildPath = join(cwd, "tsconfig.build.json");
170
+ try {
171
+ let tsconfigBuild;
172
+ let buildUpdated = false;
173
+ if (existsSync(tsconfigBuildPath)) {
174
+ tsconfigBuild = JSON.parse(readFileSync(tsconfigBuildPath, "utf-8"));
175
+ } else {
176
+ tsconfigBuild = {
177
+ extends: "./tsconfig.json",
178
+ exclude: [
179
+ "node_modules",
180
+ "test",
181
+ "dist",
182
+ "**/*spec.ts"
183
+ ]
184
+ };
185
+ buildUpdated = true;
186
+ }
187
+ if (!tsconfigBuild.exclude) {
188
+ tsconfigBuild.exclude = [];
189
+ }
190
+ const hasEntryClientExclude = tsconfigBuild.exclude.some((pattern) => pattern.includes("entry-client.tsx"));
191
+ if (!hasEntryClientExclude) {
192
+ tsconfigBuild.exclude.push("src/views/entry-client.tsx");
193
+ buildUpdated = true;
194
+ }
195
+ if (buildUpdated) {
196
+ writeFileSync(tsconfigBuildPath, JSON.stringify(tsconfigBuild, null, 2));
197
+ consola.success("Updated tsconfig.build.json");
198
+ } else {
199
+ consola.info("tsconfig.build.json already configured");
200
+ }
201
+ } catch (error) {
202
+ consola.error("Failed to update tsconfig.build.json:", error);
203
+ }
204
+ consola.start("Configuring nest-cli.json...");
205
+ const nestCliPath = join(cwd, "nest-cli.json");
206
+ try {
207
+ if (existsSync(nestCliPath)) {
208
+ const nestCli = JSON.parse(readFileSync(nestCliPath, "utf-8"));
209
+ let nestUpdated = false;
210
+ if (!nestCli.exclude) {
211
+ nestCli.exclude = [];
212
+ }
213
+ const hasEntryClientExclude = nestCli.exclude.some((pattern) => pattern.includes("entry-client.tsx"));
214
+ if (!hasEntryClientExclude) {
215
+ nestCli.exclude.push("**/entry-client.tsx");
216
+ nestUpdated = true;
217
+ }
218
+ if (nestUpdated) {
219
+ writeFileSync(nestCliPath, JSON.stringify(nestCli, null, 2));
220
+ consola.success("Updated nest-cli.json");
221
+ } else {
222
+ consola.info("nest-cli.json already configured");
223
+ }
224
+ } else {
225
+ consola.info("No nest-cli.json found, skipping");
226
+ }
227
+ } catch (error) {
228
+ consola.error("Failed to update nest-cli.json:", error);
229
+ }
2567
230
  consola.start("Configuring build scripts...");
2568
231
  const packageJsonPath = join(cwd, "package.json");
2569
232
  if (!existsSync(packageJsonPath)) {
@@ -2574,29 +237,70 @@ export default defineConfig({
2574
237
  if (!packageJson.scripts) {
2575
238
  packageJson.scripts = {};
2576
239
  }
2577
- const existingBuild = packageJson.scripts.build;
2578
- const defaultNestBuild = "nest build";
2579
- const ssrBuildPrefix = "vite build && ";
2580
240
  let shouldUpdate = false;
2581
- let newBuildScript = "";
2582
- if (!existingBuild) {
2583
- newBuildScript = `${ssrBuildPrefix}${defaultNestBuild}`;
241
+ if (!packageJson.scripts["build:client"]) {
242
+ packageJson.scripts["build:client"] = "vite build --ssrManifest --outDir dist/client";
243
+ shouldUpdate = true;
244
+ }
245
+ if (!packageJson.scripts["build:server"]) {
246
+ packageJson.scripts["build:server"] = `vite build --ssr ${viewsDir}/entry-server.tsx --outDir dist/server`;
2584
247
  shouldUpdate = true;
2585
- } else if (existingBuild.includes("vite build")) {
2586
- consola.info("Build script already includes vite build");
2587
- } else if (existingBuild === defaultNestBuild) {
2588
- newBuildScript = `${ssrBuildPrefix}${existingBuild}`;
248
+ }
249
+ const existingBuild = packageJson.scripts.build;
250
+ const recommendedBuild = "pnpm build:client && pnpm build:server && nest build";
251
+ if (!existingBuild) {
252
+ packageJson.scripts.build = recommendedBuild;
2589
253
  shouldUpdate = true;
2590
- } else {
2591
- consola.warn(`Found custom build script: "${existingBuild}"`);
2592
- consola.info('SSR requires running "vite build" before your build command');
2593
- consola.info(`Recommended: ${ssrBuildPrefix}${existingBuild}`);
254
+ } else if (!existingBuild.includes("build:client") || !existingBuild.includes("build:server")) {
255
+ consola.warn(`Found existing build script: "${existingBuild}"`);
256
+ consola.info("SSR requires building client and server bundles");
257
+ consola.info(`Recommended: ${recommendedBuild}`);
2594
258
  consola.info("Please manually update your build script in package.json");
259
+ } else {
260
+ consola.info("Build scripts already configured");
2595
261
  }
2596
262
  if (shouldUpdate) {
2597
- packageJson.scripts.build = newBuildScript;
2598
263
  writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
2599
- consola.success(`Updated build script to: "${newBuildScript}"`);
264
+ consola.success("Updated build scripts in package.json");
265
+ }
266
+ if (!args["skip-install"]) {
267
+ consola.start("Checking dependencies...");
268
+ const requiredDeps = {
269
+ "react": "^19.0.0",
270
+ "react-dom": "^19.0.0",
271
+ "vite": "^7.0.0",
272
+ "@vitejs/plugin-react": "^4.0.0"
273
+ };
274
+ const missingDeps = [];
275
+ const allDeps = {
276
+ ...packageJson.dependencies,
277
+ ...packageJson.devDependencies
278
+ };
279
+ for (const [dep, version] of Object.entries(requiredDeps)) {
280
+ if (!allDeps[dep]) {
281
+ missingDeps.push(`${dep}@${version}`);
282
+ }
283
+ }
284
+ if (missingDeps.length > 0) {
285
+ consola.info(`Missing dependencies: ${missingDeps.join(", ")}`);
286
+ let packageManager = "npm";
287
+ if (existsSync(join(cwd, "pnpm-lock.yaml"))) packageManager = "pnpm";
288
+ else if (existsSync(join(cwd, "yarn.lock"))) packageManager = "yarn";
289
+ const installCmd = packageManager === "npm" ? `npm install ${missingDeps.join(" ")}` : `${packageManager} add ${missingDeps.join(" ")}`;
290
+ try {
291
+ consola.start(`Installing dependencies with ${packageManager}...`);
292
+ execSync(installCmd, {
293
+ cwd,
294
+ stdio: "inherit"
295
+ });
296
+ consola.success("Dependencies installed!");
297
+ } catch (error) {
298
+ consola.error("Failed to install dependencies:", error);
299
+ consola.info(`Please manually run: ${installCmd}`);
300
+ }
301
+ } else {
302
+ consola.success("All required dependencies are already installed");
303
+ }
2600
304
  }
2601
305
  } catch (error) {
2602
306
  consola.error("Failed to update package.json:", error);
@@ -2610,5 +314,3 @@ export default defineConfig({
2610
314
  }
2611
315
  });
2612
316
  runMain(main);
2613
- //# sourceMappingURL=init.mjs.map
2614
- //# sourceMappingURL=init.mjs.map