@learnosity/lib-qti-converter 0.16.0 → 0.16.2
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/package.json +10 -10
- package/packages/cli/dist/{batchProcessors-C7czhqX0.js → batchProcessors-BGdELwug.js} +75 -102
- package/packages/cli/dist/batchProcessors-BGdELwug.js.map +1 -0
- package/packages/cli/dist/batchWorker.js +2 -3
- package/packages/cli/dist/{configOutput-FwkFyQmk.js → configOutput-DYPwNQf7.js} +5 -9
- package/packages/cli/dist/{configOutput-FwkFyQmk.js.map → configOutput-DYPwNQf7.js.map} +1 -1
- package/packages/cli/dist/{create-prompt-dWckcotJ.js → create-prompt-C3XKo-s3.js} +95 -71
- package/packages/cli/dist/create-prompt-C3XKo-s3.js.map +1 -0
- package/packages/cli/dist/{dist-DXDR2peT.js → dist-D7b9-VIt.js} +8 -11
- package/packages/cli/dist/dist-D7b9-VIt.js.map +1 -0
- package/packages/cli/dist/{learnosityToQti-D4ddrXaz.js → learnosityToQti-CN6KKSmF.js} +5 -6
- package/packages/cli/dist/{learnosityToQti-D4ddrXaz.js.map → learnosityToQti-CN6KKSmF.js.map} +1 -1
- package/packages/cli/dist/{learnosityToQtiPackage-Bwzm-uLX.js → learnosityToQtiPackage-CMOQRiCV.js} +29 -21
- package/packages/cli/dist/learnosityToQtiPackage-CMOQRiCV.js.map +1 -0
- package/packages/cli/dist/main.js +22 -29
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/dist/{nodeFileAccess-BhCoGDOi.js → nodeFileAccess-_jRCd340.js} +6 -10
- package/packages/cli/dist/{nodeFileAccess-BhCoGDOi.js.map → nodeFileAccess-_jRCd340.js.map} +1 -1
- package/packages/cli/dist/pathUtils-I2bRHUwu.js +2922 -0
- package/packages/cli/dist/pathUtils-I2bRHUwu.js.map +1 -0
- package/packages/cli/dist/{qtiPackageToLearnosity-CX9htPId.js → qtiPackageToLearnosity-JRb3TTyC.js} +7 -8
- package/packages/cli/dist/{qtiPackageToLearnosity-CX9htPId.js.map → qtiPackageToLearnosity-JRb3TTyC.js.map} +1 -1
- package/packages/cli/dist/{qtiToLearnosity-JQYOkNbM.js → qtiToLearnosity-C-jQYKqR.js} +6 -7
- package/packages/cli/dist/{qtiToLearnosity-JQYOkNbM.js.map → qtiToLearnosity-C-jQYKqR.js.map} +1 -1
- package/packages/cli/dist/{resolveOptions-BuNN2KMA.js → resolveOptions-ikupjaRQ.js} +322 -359
- package/packages/cli/dist/resolveOptions-ikupjaRQ.js.map +1 -0
- package/packages/cli/dist/{rolldown-runtime-DktXgydw.js → rolldown-runtime-BuRBZLzk.js} +13 -12
- package/packages/cli/dist/{table-DsKq-B4-.js → table-6SiZD7aK.js} +9944 -2294
- package/packages/cli/dist/table-6SiZD7aK.js.map +1 -0
- package/packages/core/dist/index.d.ts +8 -58
- package/packages/core/dist/index.js +9923 -2267
- package/packages/core/dist/node.d.ts +10 -80
- package/packages/core/dist/node.js +9951 -2311
- package/packages/cli/dist/batchProcessors-C7czhqX0.js.map +0 -1
- package/packages/cli/dist/create-prompt-dWckcotJ.js.map +0 -1
- package/packages/cli/dist/dist-DXDR2peT.js.map +0 -1
- package/packages/cli/dist/learnosityToQtiPackage-Bwzm-uLX.js.map +0 -1
- package/packages/cli/dist/pathUtils-D_VsVde8.js +0 -2272
- package/packages/cli/dist/pathUtils-D_VsVde8.js.map +0 -1
- package/packages/cli/dist/resolveOptions-BuNN2KMA.js.map +0 -1
- package/packages/cli/dist/table-DsKq-B4-.js.map +0 -1
|
@@ -1,2272 +0,0 @@
|
|
|
1
|
-
import { i as __toESM, t as __commonJSMin } from "./rolldown-runtime-DktXgydw.js";
|
|
2
|
-
import { _ as isEnterKey, b as isTabKey, c as usePrefix, d as useEffect, f as useState, h as isBackspaceKey, l as makeTheme, o as useKeypress, t as createPrompt } from "./create-prompt-dWckcotJ.js";
|
|
3
|
-
import { O as DiagnosticCode, i as chalk$1, o as require_string_width } from "./table-DsKq-B4-.js";
|
|
4
|
-
import process$1 from "node:process";
|
|
5
|
-
import { access, readFile } from "fs/promises";
|
|
6
|
-
import { resolve } from "path";
|
|
7
|
-
import os from "node:os";
|
|
8
|
-
import { homedir } from "os";
|
|
9
|
-
import tty from "node:tty";
|
|
10
|
-
//#region ../../node_modules/.pnpm/@inquirer+input@5.1.7_@types+node@26.6.5/node_modules/@inquirer/input/dist/index.js
|
|
11
|
-
const inputTheme = { validationFailureMode: "keep" };
|
|
12
|
-
var dist_default = createPrompt((config, done) => {
|
|
13
|
-
const { prefill = "tab" } = config;
|
|
14
|
-
const theme = makeTheme(inputTheme, config.theme);
|
|
15
|
-
const [status, setStatus] = useState("idle");
|
|
16
|
-
const [defaultValue, setDefaultValue] = useState(String(config.default ?? ""));
|
|
17
|
-
const [errorMsg, setError] = useState();
|
|
18
|
-
const [value, setValue] = useState("");
|
|
19
|
-
const prefix = usePrefix({
|
|
20
|
-
status,
|
|
21
|
-
theme
|
|
22
|
-
});
|
|
23
|
-
async function validate(value) {
|
|
24
|
-
const { required, pattern, patternError = "Invalid input" } = config;
|
|
25
|
-
if (required && !value) return "You must provide a value";
|
|
26
|
-
if (pattern && !pattern.test(value)) return patternError;
|
|
27
|
-
if (typeof config.validate === "function") return await config.validate(value) || "You must provide a valid value";
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
useKeypress(async (key, rl) => {
|
|
31
|
-
if (status !== "idle") return;
|
|
32
|
-
if (isEnterKey(key)) {
|
|
33
|
-
const answer = value || defaultValue;
|
|
34
|
-
setStatus("loading");
|
|
35
|
-
const isValid = await validate(answer);
|
|
36
|
-
if (isValid === true) {
|
|
37
|
-
setValue(answer);
|
|
38
|
-
setStatus("done");
|
|
39
|
-
done(answer);
|
|
40
|
-
} else {
|
|
41
|
-
if (theme.validationFailureMode === "clear") setValue("");
|
|
42
|
-
else rl.write(value);
|
|
43
|
-
setError(isValid);
|
|
44
|
-
setStatus("idle");
|
|
45
|
-
}
|
|
46
|
-
} else if (isBackspaceKey(key) && !value) setDefaultValue("");
|
|
47
|
-
else if (isTabKey(key) && !value) {
|
|
48
|
-
setDefaultValue("");
|
|
49
|
-
rl.clearLine(0);
|
|
50
|
-
rl.write(defaultValue);
|
|
51
|
-
setValue(defaultValue);
|
|
52
|
-
} else {
|
|
53
|
-
setValue(rl.line);
|
|
54
|
-
setError(void 0);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
useEffect((rl) => {
|
|
58
|
-
if (prefill === "editable" && defaultValue) {
|
|
59
|
-
rl.write(defaultValue);
|
|
60
|
-
setValue(defaultValue);
|
|
61
|
-
}
|
|
62
|
-
}, []);
|
|
63
|
-
const message = theme.style.message(config.message, status);
|
|
64
|
-
let formattedValue = value;
|
|
65
|
-
if (typeof config.transformer === "function") formattedValue = config.transformer(value, { isFinal: status === "done" });
|
|
66
|
-
else if (status === "done") formattedValue = theme.style.answer(value);
|
|
67
|
-
let defaultStr;
|
|
68
|
-
if (defaultValue && status !== "done" && !value) defaultStr = theme.style.defaultAnswer(defaultValue);
|
|
69
|
-
let error = "";
|
|
70
|
-
if (errorMsg) error = theme.style.error(errorMsg);
|
|
71
|
-
return [[
|
|
72
|
-
prefix,
|
|
73
|
-
message,
|
|
74
|
-
defaultStr,
|
|
75
|
-
formattedValue
|
|
76
|
-
].filter((v) => v !== void 0).join(" "), error];
|
|
77
|
-
});
|
|
78
|
-
//#endregion
|
|
79
|
-
//#region ../../node_modules/.pnpm/ansi-regex@6.4.0/node_modules/ansi-regex/index.js
|
|
80
|
-
function ansiRegex({ onlyFirst = false } = {}) {
|
|
81
|
-
return new RegExp(`(?:(?:\\u001B\\]|\\u009D)[^\\u0007\\u001B\\u009C\\u009D]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
|
|
82
|
-
}
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region ../../node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.js
|
|
85
|
-
const regex = ansiRegex();
|
|
86
|
-
function stripAnsi(string) {
|
|
87
|
-
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
88
|
-
if (!string.includes("\x1B") && !string.includes("")) return string;
|
|
89
|
-
return string.replace(regex, "");
|
|
90
|
-
}
|
|
91
|
-
const ambiguousRanges = [
|
|
92
|
-
161,
|
|
93
|
-
161,
|
|
94
|
-
164,
|
|
95
|
-
164,
|
|
96
|
-
167,
|
|
97
|
-
168,
|
|
98
|
-
170,
|
|
99
|
-
170,
|
|
100
|
-
173,
|
|
101
|
-
174,
|
|
102
|
-
176,
|
|
103
|
-
180,
|
|
104
|
-
182,
|
|
105
|
-
186,
|
|
106
|
-
188,
|
|
107
|
-
191,
|
|
108
|
-
198,
|
|
109
|
-
198,
|
|
110
|
-
208,
|
|
111
|
-
208,
|
|
112
|
-
215,
|
|
113
|
-
216,
|
|
114
|
-
222,
|
|
115
|
-
225,
|
|
116
|
-
230,
|
|
117
|
-
230,
|
|
118
|
-
232,
|
|
119
|
-
234,
|
|
120
|
-
236,
|
|
121
|
-
237,
|
|
122
|
-
240,
|
|
123
|
-
240,
|
|
124
|
-
242,
|
|
125
|
-
243,
|
|
126
|
-
247,
|
|
127
|
-
250,
|
|
128
|
-
252,
|
|
129
|
-
252,
|
|
130
|
-
254,
|
|
131
|
-
254,
|
|
132
|
-
257,
|
|
133
|
-
257,
|
|
134
|
-
273,
|
|
135
|
-
273,
|
|
136
|
-
275,
|
|
137
|
-
275,
|
|
138
|
-
283,
|
|
139
|
-
283,
|
|
140
|
-
294,
|
|
141
|
-
295,
|
|
142
|
-
299,
|
|
143
|
-
299,
|
|
144
|
-
305,
|
|
145
|
-
307,
|
|
146
|
-
312,
|
|
147
|
-
312,
|
|
148
|
-
319,
|
|
149
|
-
322,
|
|
150
|
-
324,
|
|
151
|
-
324,
|
|
152
|
-
328,
|
|
153
|
-
331,
|
|
154
|
-
333,
|
|
155
|
-
333,
|
|
156
|
-
338,
|
|
157
|
-
339,
|
|
158
|
-
358,
|
|
159
|
-
359,
|
|
160
|
-
363,
|
|
161
|
-
363,
|
|
162
|
-
462,
|
|
163
|
-
462,
|
|
164
|
-
464,
|
|
165
|
-
464,
|
|
166
|
-
466,
|
|
167
|
-
466,
|
|
168
|
-
468,
|
|
169
|
-
468,
|
|
170
|
-
470,
|
|
171
|
-
470,
|
|
172
|
-
472,
|
|
173
|
-
472,
|
|
174
|
-
474,
|
|
175
|
-
474,
|
|
176
|
-
476,
|
|
177
|
-
476,
|
|
178
|
-
593,
|
|
179
|
-
593,
|
|
180
|
-
609,
|
|
181
|
-
609,
|
|
182
|
-
708,
|
|
183
|
-
708,
|
|
184
|
-
711,
|
|
185
|
-
711,
|
|
186
|
-
713,
|
|
187
|
-
715,
|
|
188
|
-
717,
|
|
189
|
-
717,
|
|
190
|
-
720,
|
|
191
|
-
720,
|
|
192
|
-
728,
|
|
193
|
-
731,
|
|
194
|
-
733,
|
|
195
|
-
733,
|
|
196
|
-
735,
|
|
197
|
-
735,
|
|
198
|
-
768,
|
|
199
|
-
879,
|
|
200
|
-
913,
|
|
201
|
-
929,
|
|
202
|
-
931,
|
|
203
|
-
937,
|
|
204
|
-
945,
|
|
205
|
-
961,
|
|
206
|
-
963,
|
|
207
|
-
969,
|
|
208
|
-
1025,
|
|
209
|
-
1025,
|
|
210
|
-
1040,
|
|
211
|
-
1103,
|
|
212
|
-
1105,
|
|
213
|
-
1105,
|
|
214
|
-
8208,
|
|
215
|
-
8208,
|
|
216
|
-
8211,
|
|
217
|
-
8214,
|
|
218
|
-
8216,
|
|
219
|
-
8217,
|
|
220
|
-
8220,
|
|
221
|
-
8221,
|
|
222
|
-
8224,
|
|
223
|
-
8226,
|
|
224
|
-
8228,
|
|
225
|
-
8231,
|
|
226
|
-
8240,
|
|
227
|
-
8240,
|
|
228
|
-
8242,
|
|
229
|
-
8243,
|
|
230
|
-
8245,
|
|
231
|
-
8245,
|
|
232
|
-
8251,
|
|
233
|
-
8251,
|
|
234
|
-
8254,
|
|
235
|
-
8254,
|
|
236
|
-
8308,
|
|
237
|
-
8308,
|
|
238
|
-
8319,
|
|
239
|
-
8319,
|
|
240
|
-
8321,
|
|
241
|
-
8324,
|
|
242
|
-
8364,
|
|
243
|
-
8364,
|
|
244
|
-
8451,
|
|
245
|
-
8451,
|
|
246
|
-
8453,
|
|
247
|
-
8453,
|
|
248
|
-
8457,
|
|
249
|
-
8457,
|
|
250
|
-
8467,
|
|
251
|
-
8467,
|
|
252
|
-
8470,
|
|
253
|
-
8470,
|
|
254
|
-
8481,
|
|
255
|
-
8482,
|
|
256
|
-
8486,
|
|
257
|
-
8486,
|
|
258
|
-
8491,
|
|
259
|
-
8491,
|
|
260
|
-
8531,
|
|
261
|
-
8532,
|
|
262
|
-
8539,
|
|
263
|
-
8542,
|
|
264
|
-
8544,
|
|
265
|
-
8555,
|
|
266
|
-
8560,
|
|
267
|
-
8569,
|
|
268
|
-
8585,
|
|
269
|
-
8585,
|
|
270
|
-
8592,
|
|
271
|
-
8601,
|
|
272
|
-
8632,
|
|
273
|
-
8633,
|
|
274
|
-
8658,
|
|
275
|
-
8658,
|
|
276
|
-
8660,
|
|
277
|
-
8660,
|
|
278
|
-
8679,
|
|
279
|
-
8679,
|
|
280
|
-
8704,
|
|
281
|
-
8704,
|
|
282
|
-
8706,
|
|
283
|
-
8707,
|
|
284
|
-
8711,
|
|
285
|
-
8712,
|
|
286
|
-
8715,
|
|
287
|
-
8715,
|
|
288
|
-
8719,
|
|
289
|
-
8719,
|
|
290
|
-
8721,
|
|
291
|
-
8721,
|
|
292
|
-
8725,
|
|
293
|
-
8725,
|
|
294
|
-
8730,
|
|
295
|
-
8730,
|
|
296
|
-
8733,
|
|
297
|
-
8736,
|
|
298
|
-
8739,
|
|
299
|
-
8739,
|
|
300
|
-
8741,
|
|
301
|
-
8741,
|
|
302
|
-
8743,
|
|
303
|
-
8748,
|
|
304
|
-
8750,
|
|
305
|
-
8750,
|
|
306
|
-
8756,
|
|
307
|
-
8759,
|
|
308
|
-
8764,
|
|
309
|
-
8765,
|
|
310
|
-
8776,
|
|
311
|
-
8776,
|
|
312
|
-
8780,
|
|
313
|
-
8780,
|
|
314
|
-
8786,
|
|
315
|
-
8786,
|
|
316
|
-
8800,
|
|
317
|
-
8801,
|
|
318
|
-
8804,
|
|
319
|
-
8807,
|
|
320
|
-
8810,
|
|
321
|
-
8811,
|
|
322
|
-
8814,
|
|
323
|
-
8815,
|
|
324
|
-
8834,
|
|
325
|
-
8835,
|
|
326
|
-
8838,
|
|
327
|
-
8839,
|
|
328
|
-
8853,
|
|
329
|
-
8853,
|
|
330
|
-
8857,
|
|
331
|
-
8857,
|
|
332
|
-
8869,
|
|
333
|
-
8869,
|
|
334
|
-
8895,
|
|
335
|
-
8895,
|
|
336
|
-
8978,
|
|
337
|
-
8978,
|
|
338
|
-
9312,
|
|
339
|
-
9449,
|
|
340
|
-
9451,
|
|
341
|
-
9547,
|
|
342
|
-
9552,
|
|
343
|
-
9587,
|
|
344
|
-
9600,
|
|
345
|
-
9615,
|
|
346
|
-
9618,
|
|
347
|
-
9621,
|
|
348
|
-
9632,
|
|
349
|
-
9633,
|
|
350
|
-
9635,
|
|
351
|
-
9641,
|
|
352
|
-
9650,
|
|
353
|
-
9651,
|
|
354
|
-
9654,
|
|
355
|
-
9655,
|
|
356
|
-
9660,
|
|
357
|
-
9661,
|
|
358
|
-
9664,
|
|
359
|
-
9665,
|
|
360
|
-
9670,
|
|
361
|
-
9672,
|
|
362
|
-
9675,
|
|
363
|
-
9675,
|
|
364
|
-
9678,
|
|
365
|
-
9681,
|
|
366
|
-
9698,
|
|
367
|
-
9701,
|
|
368
|
-
9711,
|
|
369
|
-
9711,
|
|
370
|
-
9733,
|
|
371
|
-
9734,
|
|
372
|
-
9737,
|
|
373
|
-
9737,
|
|
374
|
-
9742,
|
|
375
|
-
9743,
|
|
376
|
-
9756,
|
|
377
|
-
9756,
|
|
378
|
-
9758,
|
|
379
|
-
9758,
|
|
380
|
-
9792,
|
|
381
|
-
9792,
|
|
382
|
-
9794,
|
|
383
|
-
9794,
|
|
384
|
-
9824,
|
|
385
|
-
9825,
|
|
386
|
-
9827,
|
|
387
|
-
9829,
|
|
388
|
-
9831,
|
|
389
|
-
9834,
|
|
390
|
-
9836,
|
|
391
|
-
9837,
|
|
392
|
-
9839,
|
|
393
|
-
9839,
|
|
394
|
-
9886,
|
|
395
|
-
9887,
|
|
396
|
-
9919,
|
|
397
|
-
9919,
|
|
398
|
-
9926,
|
|
399
|
-
9933,
|
|
400
|
-
9935,
|
|
401
|
-
9939,
|
|
402
|
-
9941,
|
|
403
|
-
9953,
|
|
404
|
-
9955,
|
|
405
|
-
9955,
|
|
406
|
-
9960,
|
|
407
|
-
9961,
|
|
408
|
-
9963,
|
|
409
|
-
9969,
|
|
410
|
-
9972,
|
|
411
|
-
9972,
|
|
412
|
-
9974,
|
|
413
|
-
9977,
|
|
414
|
-
9979,
|
|
415
|
-
9980,
|
|
416
|
-
9982,
|
|
417
|
-
9983,
|
|
418
|
-
10045,
|
|
419
|
-
10045,
|
|
420
|
-
10102,
|
|
421
|
-
10111,
|
|
422
|
-
11094,
|
|
423
|
-
11097,
|
|
424
|
-
12872,
|
|
425
|
-
12879,
|
|
426
|
-
57344,
|
|
427
|
-
63743,
|
|
428
|
-
65024,
|
|
429
|
-
65039,
|
|
430
|
-
65533,
|
|
431
|
-
65533,
|
|
432
|
-
127232,
|
|
433
|
-
127242,
|
|
434
|
-
127248,
|
|
435
|
-
127277,
|
|
436
|
-
127280,
|
|
437
|
-
127337,
|
|
438
|
-
127344,
|
|
439
|
-
127373,
|
|
440
|
-
127375,
|
|
441
|
-
127376,
|
|
442
|
-
127387,
|
|
443
|
-
127404,
|
|
444
|
-
917760,
|
|
445
|
-
917999,
|
|
446
|
-
983040,
|
|
447
|
-
1048573,
|
|
448
|
-
1048576,
|
|
449
|
-
1114109
|
|
450
|
-
];
|
|
451
|
-
const fullwidthRanges = [
|
|
452
|
-
12288,
|
|
453
|
-
12288,
|
|
454
|
-
65281,
|
|
455
|
-
65376,
|
|
456
|
-
65504,
|
|
457
|
-
65510
|
|
458
|
-
];
|
|
459
|
-
const wideRanges = [
|
|
460
|
-
4352,
|
|
461
|
-
4447,
|
|
462
|
-
8986,
|
|
463
|
-
8987,
|
|
464
|
-
9001,
|
|
465
|
-
9002,
|
|
466
|
-
9193,
|
|
467
|
-
9196,
|
|
468
|
-
9200,
|
|
469
|
-
9200,
|
|
470
|
-
9203,
|
|
471
|
-
9203,
|
|
472
|
-
9725,
|
|
473
|
-
9726,
|
|
474
|
-
9748,
|
|
475
|
-
9749,
|
|
476
|
-
9776,
|
|
477
|
-
9783,
|
|
478
|
-
9800,
|
|
479
|
-
9811,
|
|
480
|
-
9855,
|
|
481
|
-
9855,
|
|
482
|
-
9866,
|
|
483
|
-
9871,
|
|
484
|
-
9875,
|
|
485
|
-
9875,
|
|
486
|
-
9889,
|
|
487
|
-
9889,
|
|
488
|
-
9898,
|
|
489
|
-
9899,
|
|
490
|
-
9917,
|
|
491
|
-
9918,
|
|
492
|
-
9924,
|
|
493
|
-
9925,
|
|
494
|
-
9934,
|
|
495
|
-
9934,
|
|
496
|
-
9940,
|
|
497
|
-
9940,
|
|
498
|
-
9962,
|
|
499
|
-
9962,
|
|
500
|
-
9970,
|
|
501
|
-
9971,
|
|
502
|
-
9973,
|
|
503
|
-
9973,
|
|
504
|
-
9978,
|
|
505
|
-
9978,
|
|
506
|
-
9981,
|
|
507
|
-
9981,
|
|
508
|
-
9989,
|
|
509
|
-
9989,
|
|
510
|
-
9994,
|
|
511
|
-
9995,
|
|
512
|
-
10024,
|
|
513
|
-
10024,
|
|
514
|
-
10060,
|
|
515
|
-
10060,
|
|
516
|
-
10062,
|
|
517
|
-
10062,
|
|
518
|
-
10067,
|
|
519
|
-
10069,
|
|
520
|
-
10071,
|
|
521
|
-
10071,
|
|
522
|
-
10133,
|
|
523
|
-
10135,
|
|
524
|
-
10160,
|
|
525
|
-
10160,
|
|
526
|
-
10175,
|
|
527
|
-
10175,
|
|
528
|
-
11035,
|
|
529
|
-
11036,
|
|
530
|
-
11088,
|
|
531
|
-
11088,
|
|
532
|
-
11093,
|
|
533
|
-
11093,
|
|
534
|
-
11904,
|
|
535
|
-
11929,
|
|
536
|
-
11931,
|
|
537
|
-
12019,
|
|
538
|
-
12032,
|
|
539
|
-
12245,
|
|
540
|
-
12272,
|
|
541
|
-
12287,
|
|
542
|
-
12289,
|
|
543
|
-
12350,
|
|
544
|
-
12353,
|
|
545
|
-
12438,
|
|
546
|
-
12441,
|
|
547
|
-
12543,
|
|
548
|
-
12549,
|
|
549
|
-
12591,
|
|
550
|
-
12593,
|
|
551
|
-
12686,
|
|
552
|
-
12688,
|
|
553
|
-
12773,
|
|
554
|
-
12783,
|
|
555
|
-
12830,
|
|
556
|
-
12832,
|
|
557
|
-
12871,
|
|
558
|
-
12880,
|
|
559
|
-
42124,
|
|
560
|
-
42128,
|
|
561
|
-
42182,
|
|
562
|
-
43360,
|
|
563
|
-
43388,
|
|
564
|
-
44032,
|
|
565
|
-
55203,
|
|
566
|
-
63744,
|
|
567
|
-
64255,
|
|
568
|
-
65040,
|
|
569
|
-
65049,
|
|
570
|
-
65072,
|
|
571
|
-
65106,
|
|
572
|
-
65108,
|
|
573
|
-
65126,
|
|
574
|
-
65128,
|
|
575
|
-
65131,
|
|
576
|
-
94176,
|
|
577
|
-
94180,
|
|
578
|
-
94192,
|
|
579
|
-
94198,
|
|
580
|
-
94208,
|
|
581
|
-
101594,
|
|
582
|
-
101631,
|
|
583
|
-
101664,
|
|
584
|
-
101760,
|
|
585
|
-
101874,
|
|
586
|
-
101888,
|
|
587
|
-
102801,
|
|
588
|
-
102816,
|
|
589
|
-
102866,
|
|
590
|
-
110576,
|
|
591
|
-
110579,
|
|
592
|
-
110581,
|
|
593
|
-
110587,
|
|
594
|
-
110589,
|
|
595
|
-
110590,
|
|
596
|
-
110592,
|
|
597
|
-
110888,
|
|
598
|
-
110898,
|
|
599
|
-
110898,
|
|
600
|
-
110928,
|
|
601
|
-
110930,
|
|
602
|
-
110933,
|
|
603
|
-
110933,
|
|
604
|
-
110948,
|
|
605
|
-
110952,
|
|
606
|
-
110960,
|
|
607
|
-
111355,
|
|
608
|
-
119552,
|
|
609
|
-
119638,
|
|
610
|
-
119648,
|
|
611
|
-
119670,
|
|
612
|
-
126980,
|
|
613
|
-
126980,
|
|
614
|
-
127183,
|
|
615
|
-
127183,
|
|
616
|
-
127374,
|
|
617
|
-
127374,
|
|
618
|
-
127377,
|
|
619
|
-
127386,
|
|
620
|
-
127406,
|
|
621
|
-
127406,
|
|
622
|
-
127488,
|
|
623
|
-
127490,
|
|
624
|
-
127504,
|
|
625
|
-
127547,
|
|
626
|
-
127552,
|
|
627
|
-
127560,
|
|
628
|
-
127568,
|
|
629
|
-
127569,
|
|
630
|
-
127584,
|
|
631
|
-
127589,
|
|
632
|
-
127744,
|
|
633
|
-
127776,
|
|
634
|
-
127789,
|
|
635
|
-
127797,
|
|
636
|
-
127799,
|
|
637
|
-
127868,
|
|
638
|
-
127870,
|
|
639
|
-
127891,
|
|
640
|
-
127904,
|
|
641
|
-
127946,
|
|
642
|
-
127951,
|
|
643
|
-
127955,
|
|
644
|
-
127968,
|
|
645
|
-
127984,
|
|
646
|
-
127988,
|
|
647
|
-
127988,
|
|
648
|
-
127992,
|
|
649
|
-
128062,
|
|
650
|
-
128064,
|
|
651
|
-
128064,
|
|
652
|
-
128066,
|
|
653
|
-
128252,
|
|
654
|
-
128255,
|
|
655
|
-
128317,
|
|
656
|
-
128331,
|
|
657
|
-
128334,
|
|
658
|
-
128336,
|
|
659
|
-
128359,
|
|
660
|
-
128378,
|
|
661
|
-
128378,
|
|
662
|
-
128405,
|
|
663
|
-
128406,
|
|
664
|
-
128420,
|
|
665
|
-
128420,
|
|
666
|
-
128507,
|
|
667
|
-
128591,
|
|
668
|
-
128640,
|
|
669
|
-
128709,
|
|
670
|
-
128716,
|
|
671
|
-
128716,
|
|
672
|
-
128720,
|
|
673
|
-
128722,
|
|
674
|
-
128725,
|
|
675
|
-
128729,
|
|
676
|
-
128732,
|
|
677
|
-
128735,
|
|
678
|
-
128747,
|
|
679
|
-
128748,
|
|
680
|
-
128756,
|
|
681
|
-
128764,
|
|
682
|
-
128986,
|
|
683
|
-
128986,
|
|
684
|
-
128992,
|
|
685
|
-
129003,
|
|
686
|
-
129008,
|
|
687
|
-
129008,
|
|
688
|
-
129292,
|
|
689
|
-
129338,
|
|
690
|
-
129340,
|
|
691
|
-
129349,
|
|
692
|
-
129351,
|
|
693
|
-
129535,
|
|
694
|
-
129648,
|
|
695
|
-
129660,
|
|
696
|
-
129664,
|
|
697
|
-
129734,
|
|
698
|
-
129736,
|
|
699
|
-
129736,
|
|
700
|
-
129740,
|
|
701
|
-
129757,
|
|
702
|
-
129759,
|
|
703
|
-
129771,
|
|
704
|
-
129775,
|
|
705
|
-
129786,
|
|
706
|
-
131072,
|
|
707
|
-
196605,
|
|
708
|
-
196608,
|
|
709
|
-
262141
|
|
710
|
-
];
|
|
711
|
-
//#endregion
|
|
712
|
-
//#region ../../node_modules/.pnpm/get-east-asian-width@1.7.0/node_modules/get-east-asian-width/utilities.js
|
|
713
|
-
/**
|
|
714
|
-
Binary search on a sorted flat array of [start, end] pairs.
|
|
715
|
-
|
|
716
|
-
@param {number[]} ranges - Flat array of inclusive [start, end] range pairs, e.g. [0, 5, 10, 20].
|
|
717
|
-
@param {number} codePoint - The value to search for.
|
|
718
|
-
@returns {boolean} Whether the value falls within any of the ranges.
|
|
719
|
-
*/
|
|
720
|
-
const isInRange = (ranges, codePoint) => {
|
|
721
|
-
let low = 0;
|
|
722
|
-
let high = Math.floor(ranges.length / 2) - 1;
|
|
723
|
-
while (low <= high) {
|
|
724
|
-
const mid = Math.floor((low + high) / 2);
|
|
725
|
-
const i = mid * 2;
|
|
726
|
-
if (codePoint < ranges[i]) high = mid - 1;
|
|
727
|
-
else if (codePoint > ranges[i + 1]) low = mid + 1;
|
|
728
|
-
else return true;
|
|
729
|
-
}
|
|
730
|
-
return false;
|
|
731
|
-
};
|
|
732
|
-
//#endregion
|
|
733
|
-
//#region ../../node_modules/.pnpm/get-east-asian-width@1.7.0/node_modules/get-east-asian-width/lookup.js
|
|
734
|
-
const commonCjkCodePoint = 19968;
|
|
735
|
-
const [wideFastPathStart, wideFastPathEnd] = /* #__PURE__ */ findWideFastPathRange(wideRanges);
|
|
736
|
-
function findWideFastPathRange(ranges) {
|
|
737
|
-
let fastPathStart = ranges[0];
|
|
738
|
-
let fastPathEnd = ranges[1];
|
|
739
|
-
for (let index = 0; index < ranges.length; index += 2) {
|
|
740
|
-
const start = ranges[index];
|
|
741
|
-
const end = ranges[index + 1];
|
|
742
|
-
if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) return [start, end];
|
|
743
|
-
if (end - start > fastPathEnd - fastPathStart) {
|
|
744
|
-
fastPathStart = start;
|
|
745
|
-
fastPathEnd = end;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
return [fastPathStart, fastPathEnd];
|
|
749
|
-
}
|
|
750
|
-
const isAmbiguous = (codePoint) => {
|
|
751
|
-
if (codePoint < 161 || codePoint > 1114109) return false;
|
|
752
|
-
return isInRange(ambiguousRanges, codePoint);
|
|
753
|
-
};
|
|
754
|
-
const isFullwidth = (codePoint) => {
|
|
755
|
-
if (codePoint < 12288 || codePoint > 65510) return false;
|
|
756
|
-
return isInRange(fullwidthRanges, codePoint);
|
|
757
|
-
};
|
|
758
|
-
const isWide = (codePoint) => {
|
|
759
|
-
if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) return true;
|
|
760
|
-
if (codePoint < 4352 || codePoint > 262141) return false;
|
|
761
|
-
return isInRange(wideRanges, codePoint);
|
|
762
|
-
};
|
|
763
|
-
//#endregion
|
|
764
|
-
//#region ../../node_modules/.pnpm/get-east-asian-width@1.7.0/node_modules/get-east-asian-width/index.js
|
|
765
|
-
function validate(codePoint) {
|
|
766
|
-
if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
767
|
-
}
|
|
768
|
-
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
769
|
-
validate(codePoint);
|
|
770
|
-
if (isFullwidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
|
|
771
|
-
return 1;
|
|
772
|
-
}
|
|
773
|
-
//#endregion
|
|
774
|
-
//#region ../../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
|
|
775
|
-
var import_emoji_regex = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
776
|
-
module.exports = () => {
|
|
777
|
-
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-\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-\uDED8\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\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\uDD3C-\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-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\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\uDE70]|\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\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;
|
|
778
|
-
};
|
|
779
|
-
})))(), 1);
|
|
780
|
-
const segmenter = new Intl.Segmenter();
|
|
781
|
-
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
782
|
-
function stringWidth(string, options = {}) {
|
|
783
|
-
if (typeof string !== "string" || string.length === 0) return 0;
|
|
784
|
-
const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
|
|
785
|
-
if (!countAnsiEscapeCodes) string = stripAnsi(string);
|
|
786
|
-
if (string.length === 0) return 0;
|
|
787
|
-
let width = 0;
|
|
788
|
-
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
789
|
-
for (const { segment: character } of segmenter.segment(string)) {
|
|
790
|
-
const codePoint = character.codePointAt(0);
|
|
791
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
|
|
792
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
|
|
793
|
-
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
|
|
794
|
-
if (codePoint >= 55296 && codePoint <= 57343) continue;
|
|
795
|
-
if (codePoint >= 65024 && codePoint <= 65039) continue;
|
|
796
|
-
if (defaultIgnorableCodePointRegex.test(character)) continue;
|
|
797
|
-
if ((0, import_emoji_regex.default)().test(character)) {
|
|
798
|
-
width += 2;
|
|
799
|
-
continue;
|
|
800
|
-
}
|
|
801
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
802
|
-
}
|
|
803
|
-
return width;
|
|
804
|
-
}
|
|
805
|
-
//#endregion
|
|
806
|
-
//#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
807
|
-
const ANSI_BACKGROUND_OFFSET$1 = 10;
|
|
808
|
-
const wrapAnsi16$1 = (offset = 0) => (code) => `\u001B[${code + offset}m`;
|
|
809
|
-
const wrapAnsi256$1 = (offset = 0) => (code) => `\u001B[${38 + offset};5;${code}m`;
|
|
810
|
-
const wrapAnsi16m$1 = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
811
|
-
const styles$2 = {
|
|
812
|
-
modifier: {
|
|
813
|
-
reset: [0, 0],
|
|
814
|
-
bold: [1, 22],
|
|
815
|
-
dim: [2, 22],
|
|
816
|
-
italic: [3, 23],
|
|
817
|
-
underline: [4, 24],
|
|
818
|
-
overline: [53, 55],
|
|
819
|
-
inverse: [7, 27],
|
|
820
|
-
hidden: [8, 28],
|
|
821
|
-
strikethrough: [9, 29]
|
|
822
|
-
},
|
|
823
|
-
color: {
|
|
824
|
-
black: [30, 39],
|
|
825
|
-
red: [31, 39],
|
|
826
|
-
green: [32, 39],
|
|
827
|
-
yellow: [33, 39],
|
|
828
|
-
blue: [34, 39],
|
|
829
|
-
magenta: [35, 39],
|
|
830
|
-
cyan: [36, 39],
|
|
831
|
-
white: [37, 39],
|
|
832
|
-
blackBright: [90, 39],
|
|
833
|
-
gray: [90, 39],
|
|
834
|
-
grey: [90, 39],
|
|
835
|
-
redBright: [91, 39],
|
|
836
|
-
greenBright: [92, 39],
|
|
837
|
-
yellowBright: [93, 39],
|
|
838
|
-
blueBright: [94, 39],
|
|
839
|
-
magentaBright: [95, 39],
|
|
840
|
-
cyanBright: [96, 39],
|
|
841
|
-
whiteBright: [97, 39]
|
|
842
|
-
},
|
|
843
|
-
bgColor: {
|
|
844
|
-
bgBlack: [40, 49],
|
|
845
|
-
bgRed: [41, 49],
|
|
846
|
-
bgGreen: [42, 49],
|
|
847
|
-
bgYellow: [43, 49],
|
|
848
|
-
bgBlue: [44, 49],
|
|
849
|
-
bgMagenta: [45, 49],
|
|
850
|
-
bgCyan: [46, 49],
|
|
851
|
-
bgWhite: [47, 49],
|
|
852
|
-
bgBlackBright: [100, 49],
|
|
853
|
-
bgGray: [100, 49],
|
|
854
|
-
bgGrey: [100, 49],
|
|
855
|
-
bgRedBright: [101, 49],
|
|
856
|
-
bgGreenBright: [102, 49],
|
|
857
|
-
bgYellowBright: [103, 49],
|
|
858
|
-
bgBlueBright: [104, 49],
|
|
859
|
-
bgMagentaBright: [105, 49],
|
|
860
|
-
bgCyanBright: [106, 49],
|
|
861
|
-
bgWhiteBright: [107, 49]
|
|
862
|
-
}
|
|
863
|
-
};
|
|
864
|
-
Object.keys(styles$2.modifier);
|
|
865
|
-
const foregroundColorNames$1 = Object.keys(styles$2.color);
|
|
866
|
-
const backgroundColorNames$1 = Object.keys(styles$2.bgColor);
|
|
867
|
-
[...foregroundColorNames$1, ...backgroundColorNames$1];
|
|
868
|
-
function assembleStyles$1() {
|
|
869
|
-
const codes = /* @__PURE__ */ new Map();
|
|
870
|
-
for (const [groupName, group] of Object.entries(styles$2)) {
|
|
871
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
872
|
-
styles$2[styleName] = {
|
|
873
|
-
open: `\u001B[${style[0]}m`,
|
|
874
|
-
close: `\u001B[${style[1]}m`
|
|
875
|
-
};
|
|
876
|
-
group[styleName] = styles$2[styleName];
|
|
877
|
-
codes.set(style[0], style[1]);
|
|
878
|
-
}
|
|
879
|
-
Object.defineProperty(styles$2, groupName, {
|
|
880
|
-
value: group,
|
|
881
|
-
enumerable: false
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
Object.defineProperty(styles$2, "codes", {
|
|
885
|
-
value: codes,
|
|
886
|
-
enumerable: false
|
|
887
|
-
});
|
|
888
|
-
styles$2.color.close = "\x1B[39m";
|
|
889
|
-
styles$2.bgColor.close = "\x1B[49m";
|
|
890
|
-
styles$2.color.ansi = wrapAnsi16$1();
|
|
891
|
-
styles$2.color.ansi256 = wrapAnsi256$1();
|
|
892
|
-
styles$2.color.ansi16m = wrapAnsi16m$1();
|
|
893
|
-
styles$2.bgColor.ansi = wrapAnsi16$1(ANSI_BACKGROUND_OFFSET$1);
|
|
894
|
-
styles$2.bgColor.ansi256 = wrapAnsi256$1(ANSI_BACKGROUND_OFFSET$1);
|
|
895
|
-
styles$2.bgColor.ansi16m = wrapAnsi16m$1(ANSI_BACKGROUND_OFFSET$1);
|
|
896
|
-
Object.defineProperties(styles$2, {
|
|
897
|
-
rgbToAnsi256: {
|
|
898
|
-
value(red, green, blue) {
|
|
899
|
-
if (red === green && green === blue) {
|
|
900
|
-
if (red < 8) return 16;
|
|
901
|
-
if (red > 248) return 231;
|
|
902
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
903
|
-
}
|
|
904
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
905
|
-
},
|
|
906
|
-
enumerable: false
|
|
907
|
-
},
|
|
908
|
-
hexToRgb: {
|
|
909
|
-
value(hex) {
|
|
910
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
911
|
-
if (!matches) return [
|
|
912
|
-
0,
|
|
913
|
-
0,
|
|
914
|
-
0
|
|
915
|
-
];
|
|
916
|
-
let [colorString] = matches;
|
|
917
|
-
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
918
|
-
const integer = Number.parseInt(colorString, 16);
|
|
919
|
-
return [
|
|
920
|
-
integer >> 16 & 255,
|
|
921
|
-
integer >> 8 & 255,
|
|
922
|
-
integer & 255
|
|
923
|
-
];
|
|
924
|
-
},
|
|
925
|
-
enumerable: false
|
|
926
|
-
},
|
|
927
|
-
hexToAnsi256: {
|
|
928
|
-
value: (hex) => styles$2.rgbToAnsi256(...styles$2.hexToRgb(hex)),
|
|
929
|
-
enumerable: false
|
|
930
|
-
},
|
|
931
|
-
ansi256ToAnsi: {
|
|
932
|
-
value(code) {
|
|
933
|
-
if (code < 8) return 30 + code;
|
|
934
|
-
if (code < 16) return 90 + (code - 8);
|
|
935
|
-
let red;
|
|
936
|
-
let green;
|
|
937
|
-
let blue;
|
|
938
|
-
if (code >= 232) {
|
|
939
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
940
|
-
green = red;
|
|
941
|
-
blue = red;
|
|
942
|
-
} else {
|
|
943
|
-
code -= 16;
|
|
944
|
-
const remainder = code % 36;
|
|
945
|
-
red = Math.floor(code / 36) / 5;
|
|
946
|
-
green = Math.floor(remainder / 6) / 5;
|
|
947
|
-
blue = remainder % 6 / 5;
|
|
948
|
-
}
|
|
949
|
-
const value = Math.max(red, green, blue) * 2;
|
|
950
|
-
if (value === 0) return 30;
|
|
951
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
952
|
-
if (value === 2) result += 60;
|
|
953
|
-
return result;
|
|
954
|
-
},
|
|
955
|
-
enumerable: false
|
|
956
|
-
},
|
|
957
|
-
rgbToAnsi: {
|
|
958
|
-
value: (red, green, blue) => styles$2.ansi256ToAnsi(styles$2.rgbToAnsi256(red, green, blue)),
|
|
959
|
-
enumerable: false
|
|
960
|
-
},
|
|
961
|
-
hexToAnsi: {
|
|
962
|
-
value: (hex) => styles$2.ansi256ToAnsi(styles$2.hexToAnsi256(hex)),
|
|
963
|
-
enumerable: false
|
|
964
|
-
}
|
|
965
|
-
});
|
|
966
|
-
return styles$2;
|
|
967
|
-
}
|
|
968
|
-
const ansiStyles$1 = assembleStyles$1();
|
|
969
|
-
//#endregion
|
|
970
|
-
//#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
971
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
|
|
972
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
973
|
-
const position = argv.indexOf(prefix + flag);
|
|
974
|
-
const terminatorPosition = argv.indexOf("--");
|
|
975
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
976
|
-
}
|
|
977
|
-
const { env } = process$1;
|
|
978
|
-
let flagForceColor;
|
|
979
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
980
|
-
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
981
|
-
function envForceColor() {
|
|
982
|
-
if ("FORCE_COLOR" in env) {
|
|
983
|
-
if (env.FORCE_COLOR === "true") return 1;
|
|
984
|
-
if (env.FORCE_COLOR === "false") return 0;
|
|
985
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
function translateLevel(level) {
|
|
989
|
-
if (level === 0) return false;
|
|
990
|
-
return {
|
|
991
|
-
level,
|
|
992
|
-
hasBasic: true,
|
|
993
|
-
has256: level >= 2,
|
|
994
|
-
has16m: level >= 3
|
|
995
|
-
};
|
|
996
|
-
}
|
|
997
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
998
|
-
const noFlagForceColor = envForceColor();
|
|
999
|
-
if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
|
|
1000
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
1001
|
-
if (forceColor === 0) return 0;
|
|
1002
|
-
if (sniffFlags) {
|
|
1003
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
1004
|
-
if (hasFlag("color=256")) return 2;
|
|
1005
|
-
}
|
|
1006
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
|
|
1007
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
1008
|
-
const min = forceColor || 0;
|
|
1009
|
-
if (env.TERM === "dumb") return min;
|
|
1010
|
-
if (process$1.platform === "win32") {
|
|
1011
|
-
const osRelease = os.release().split(".");
|
|
1012
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1013
|
-
return 1;
|
|
1014
|
-
}
|
|
1015
|
-
if ("CI" in env) {
|
|
1016
|
-
if ([
|
|
1017
|
-
"GITHUB_ACTIONS",
|
|
1018
|
-
"GITEA_ACTIONS",
|
|
1019
|
-
"CIRCLECI"
|
|
1020
|
-
].some((key) => key in env)) return 3;
|
|
1021
|
-
if ([
|
|
1022
|
-
"TRAVIS",
|
|
1023
|
-
"APPVEYOR",
|
|
1024
|
-
"GITLAB_CI",
|
|
1025
|
-
"BUILDKITE",
|
|
1026
|
-
"DRONE"
|
|
1027
|
-
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
1028
|
-
return min;
|
|
1029
|
-
}
|
|
1030
|
-
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1031
|
-
if (env.COLORTERM === "truecolor") return 3;
|
|
1032
|
-
if (env.TERM === "xterm-kitty") return 3;
|
|
1033
|
-
if (env.TERM === "xterm-ghostty") return 3;
|
|
1034
|
-
if (env.TERM === "wezterm") return 3;
|
|
1035
|
-
if ("TERM_PROGRAM" in env) {
|
|
1036
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
1037
|
-
switch (env.TERM_PROGRAM) {
|
|
1038
|
-
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
1039
|
-
case "Apple_Terminal": return 2;
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
1043
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
1044
|
-
if ("COLORTERM" in env) return 1;
|
|
1045
|
-
return min;
|
|
1046
|
-
}
|
|
1047
|
-
function createSupportsColor(stream, options = {}) {
|
|
1048
|
-
return translateLevel(_supportsColor(stream, {
|
|
1049
|
-
streamIsTTY: stream && stream.isTTY,
|
|
1050
|
-
...options
|
|
1051
|
-
}));
|
|
1052
|
-
}
|
|
1053
|
-
const supportsColor = {
|
|
1054
|
-
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
1055
|
-
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
1056
|
-
};
|
|
1057
|
-
//#endregion
|
|
1058
|
-
//#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
1059
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
1060
|
-
let index = string.indexOf(substring);
|
|
1061
|
-
if (index === -1) return string;
|
|
1062
|
-
const substringLength = substring.length;
|
|
1063
|
-
let endIndex = 0;
|
|
1064
|
-
let returnValue = "";
|
|
1065
|
-
do {
|
|
1066
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
1067
|
-
endIndex = index + substringLength;
|
|
1068
|
-
index = string.indexOf(substring, endIndex);
|
|
1069
|
-
} while (index !== -1);
|
|
1070
|
-
returnValue += string.slice(endIndex);
|
|
1071
|
-
return returnValue;
|
|
1072
|
-
}
|
|
1073
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
1074
|
-
let endIndex = 0;
|
|
1075
|
-
let returnValue = "";
|
|
1076
|
-
do {
|
|
1077
|
-
const gotCR = string[index - 1] === "\r";
|
|
1078
|
-
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
1079
|
-
endIndex = index + 1;
|
|
1080
|
-
index = string.indexOf("\n", endIndex);
|
|
1081
|
-
} while (index !== -1);
|
|
1082
|
-
returnValue += string.slice(endIndex);
|
|
1083
|
-
return returnValue;
|
|
1084
|
-
}
|
|
1085
|
-
//#endregion
|
|
1086
|
-
//#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
1087
|
-
const { stdout: stdoutColor, stderr: stderrColor } = supportsColor;
|
|
1088
|
-
const GENERATOR = Symbol("GENERATOR");
|
|
1089
|
-
const STYLER = Symbol("STYLER");
|
|
1090
|
-
const IS_EMPTY = Symbol("IS_EMPTY");
|
|
1091
|
-
const levelMapping = [
|
|
1092
|
-
"ansi",
|
|
1093
|
-
"ansi",
|
|
1094
|
-
"ansi256",
|
|
1095
|
-
"ansi16m"
|
|
1096
|
-
];
|
|
1097
|
-
const styles$1 = Object.create(null);
|
|
1098
|
-
const applyOptions = (object, options = {}) => {
|
|
1099
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) throw new Error("The `level` option should be an integer from 0 to 3");
|
|
1100
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
1101
|
-
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
1102
|
-
};
|
|
1103
|
-
const chalkFactory = (options) => {
|
|
1104
|
-
const chalk = (...strings) => strings.join(" ");
|
|
1105
|
-
applyOptions(chalk, options);
|
|
1106
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
1107
|
-
return chalk;
|
|
1108
|
-
};
|
|
1109
|
-
function createChalk(options) {
|
|
1110
|
-
return chalkFactory(options);
|
|
1111
|
-
}
|
|
1112
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
1113
|
-
for (const [styleName, style] of Object.entries(ansiStyles$1)) styles$1[styleName] = { get() {
|
|
1114
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
1115
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
1116
|
-
return builder;
|
|
1117
|
-
} };
|
|
1118
|
-
styles$1.visible = { get() {
|
|
1119
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
1120
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
1121
|
-
return builder;
|
|
1122
|
-
} };
|
|
1123
|
-
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
1124
|
-
if (model === "rgb") {
|
|
1125
|
-
if (level === "ansi16m") return ansiStyles$1[type].ansi16m(...arguments_);
|
|
1126
|
-
if (level === "ansi256") return ansiStyles$1[type].ansi256(ansiStyles$1.rgbToAnsi256(...arguments_));
|
|
1127
|
-
return ansiStyles$1[type].ansi(ansiStyles$1.rgbToAnsi(...arguments_));
|
|
1128
|
-
}
|
|
1129
|
-
if (model === "hex") return getModelAnsi("rgb", level, type, ...ansiStyles$1.hexToRgb(...arguments_));
|
|
1130
|
-
return ansiStyles$1[type][model](...arguments_);
|
|
1131
|
-
};
|
|
1132
|
-
for (const model of [
|
|
1133
|
-
"rgb",
|
|
1134
|
-
"hex",
|
|
1135
|
-
"ansi256"
|
|
1136
|
-
]) {
|
|
1137
|
-
styles$1[model] = { get() {
|
|
1138
|
-
const { level } = this;
|
|
1139
|
-
return function(...arguments_) {
|
|
1140
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansiStyles$1.color.close, this[STYLER]);
|
|
1141
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
1142
|
-
};
|
|
1143
|
-
} };
|
|
1144
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
1145
|
-
styles$1[bgModel] = { get() {
|
|
1146
|
-
const { level } = this;
|
|
1147
|
-
return function(...arguments_) {
|
|
1148
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansiStyles$1.bgColor.close, this[STYLER]);
|
|
1149
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
1150
|
-
};
|
|
1151
|
-
} };
|
|
1152
|
-
}
|
|
1153
|
-
const proto = Object.defineProperties(() => {}, {
|
|
1154
|
-
...styles$1,
|
|
1155
|
-
level: {
|
|
1156
|
-
enumerable: true,
|
|
1157
|
-
get() {
|
|
1158
|
-
return this[GENERATOR].level;
|
|
1159
|
-
},
|
|
1160
|
-
set(level) {
|
|
1161
|
-
this[GENERATOR].level = level;
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
});
|
|
1165
|
-
const createStyler = (open, close, parent) => {
|
|
1166
|
-
let openAll;
|
|
1167
|
-
let closeAll;
|
|
1168
|
-
if (parent === void 0) {
|
|
1169
|
-
openAll = open;
|
|
1170
|
-
closeAll = close;
|
|
1171
|
-
} else {
|
|
1172
|
-
openAll = parent.openAll + open;
|
|
1173
|
-
closeAll = close + parent.closeAll;
|
|
1174
|
-
}
|
|
1175
|
-
return {
|
|
1176
|
-
open,
|
|
1177
|
-
close,
|
|
1178
|
-
openAll,
|
|
1179
|
-
closeAll,
|
|
1180
|
-
parent
|
|
1181
|
-
};
|
|
1182
|
-
};
|
|
1183
|
-
const createBuilder = (self, _styler, _isEmpty) => {
|
|
1184
|
-
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
1185
|
-
Object.setPrototypeOf(builder, proto);
|
|
1186
|
-
builder[GENERATOR] = self;
|
|
1187
|
-
builder[STYLER] = _styler;
|
|
1188
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
1189
|
-
return builder;
|
|
1190
|
-
};
|
|
1191
|
-
const applyStyle = (self, string) => {
|
|
1192
|
-
if (self.level <= 0 || !string) return self[IS_EMPTY] ? "" : string;
|
|
1193
|
-
let styler = self[STYLER];
|
|
1194
|
-
if (styler === void 0) return string;
|
|
1195
|
-
const { openAll, closeAll } = styler;
|
|
1196
|
-
if (string.includes("\x1B")) while (styler !== void 0) {
|
|
1197
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
1198
|
-
styler = styler.parent;
|
|
1199
|
-
}
|
|
1200
|
-
const lfIndex = string.indexOf("\n");
|
|
1201
|
-
if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
1202
|
-
return openAll + string + closeAll;
|
|
1203
|
-
};
|
|
1204
|
-
Object.defineProperties(createChalk.prototype, styles$1);
|
|
1205
|
-
const chalk = createChalk();
|
|
1206
|
-
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
1207
|
-
//#endregion
|
|
1208
|
-
//#region ../../node_modules/.pnpm/widest-line@5.0.0/node_modules/widest-line/index.js
|
|
1209
|
-
function widestLine(string) {
|
|
1210
|
-
let lineWidth = 0;
|
|
1211
|
-
for (const line of string.split("\n")) lineWidth = Math.max(lineWidth, stringWidth(line));
|
|
1212
|
-
return lineWidth;
|
|
1213
|
-
}
|
|
1214
|
-
//#endregion
|
|
1215
|
-
//#region ../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/boxes.json
|
|
1216
|
-
var require_boxes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1217
|
-
module.exports = {
|
|
1218
|
-
"single": {
|
|
1219
|
-
"topLeft": "┌",
|
|
1220
|
-
"top": "─",
|
|
1221
|
-
"topRight": "┐",
|
|
1222
|
-
"right": "│",
|
|
1223
|
-
"bottomRight": "┘",
|
|
1224
|
-
"bottom": "─",
|
|
1225
|
-
"bottomLeft": "└",
|
|
1226
|
-
"left": "│"
|
|
1227
|
-
},
|
|
1228
|
-
"double": {
|
|
1229
|
-
"topLeft": "╔",
|
|
1230
|
-
"top": "═",
|
|
1231
|
-
"topRight": "╗",
|
|
1232
|
-
"right": "║",
|
|
1233
|
-
"bottomRight": "╝",
|
|
1234
|
-
"bottom": "═",
|
|
1235
|
-
"bottomLeft": "╚",
|
|
1236
|
-
"left": "║"
|
|
1237
|
-
},
|
|
1238
|
-
"round": {
|
|
1239
|
-
"topLeft": "╭",
|
|
1240
|
-
"top": "─",
|
|
1241
|
-
"topRight": "╮",
|
|
1242
|
-
"right": "│",
|
|
1243
|
-
"bottomRight": "╯",
|
|
1244
|
-
"bottom": "─",
|
|
1245
|
-
"bottomLeft": "╰",
|
|
1246
|
-
"left": "│"
|
|
1247
|
-
},
|
|
1248
|
-
"bold": {
|
|
1249
|
-
"topLeft": "┏",
|
|
1250
|
-
"top": "━",
|
|
1251
|
-
"topRight": "┓",
|
|
1252
|
-
"right": "┃",
|
|
1253
|
-
"bottomRight": "┛",
|
|
1254
|
-
"bottom": "━",
|
|
1255
|
-
"bottomLeft": "┗",
|
|
1256
|
-
"left": "┃"
|
|
1257
|
-
},
|
|
1258
|
-
"singleDouble": {
|
|
1259
|
-
"topLeft": "╓",
|
|
1260
|
-
"top": "─",
|
|
1261
|
-
"topRight": "╖",
|
|
1262
|
-
"right": "║",
|
|
1263
|
-
"bottomRight": "╜",
|
|
1264
|
-
"bottom": "─",
|
|
1265
|
-
"bottomLeft": "╙",
|
|
1266
|
-
"left": "║"
|
|
1267
|
-
},
|
|
1268
|
-
"doubleSingle": {
|
|
1269
|
-
"topLeft": "╒",
|
|
1270
|
-
"top": "═",
|
|
1271
|
-
"topRight": "╕",
|
|
1272
|
-
"right": "│",
|
|
1273
|
-
"bottomRight": "╛",
|
|
1274
|
-
"bottom": "═",
|
|
1275
|
-
"bottomLeft": "╘",
|
|
1276
|
-
"left": "│"
|
|
1277
|
-
},
|
|
1278
|
-
"classic": {
|
|
1279
|
-
"topLeft": "+",
|
|
1280
|
-
"top": "-",
|
|
1281
|
-
"topRight": "+",
|
|
1282
|
-
"right": "|",
|
|
1283
|
-
"bottomRight": "+",
|
|
1284
|
-
"bottom": "-",
|
|
1285
|
-
"bottomLeft": "+",
|
|
1286
|
-
"left": "|"
|
|
1287
|
-
},
|
|
1288
|
-
"arrow": {
|
|
1289
|
-
"topLeft": "↘",
|
|
1290
|
-
"top": "↓",
|
|
1291
|
-
"topRight": "↙",
|
|
1292
|
-
"right": "←",
|
|
1293
|
-
"bottomRight": "↖",
|
|
1294
|
-
"bottom": "↑",
|
|
1295
|
-
"bottomLeft": "↗",
|
|
1296
|
-
"left": "→"
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
}));
|
|
1300
|
-
//#endregion
|
|
1301
|
-
//#region ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
|
|
1302
|
-
var import_cli_boxes = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1303
|
-
const cliBoxes = require_boxes();
|
|
1304
|
-
module.exports = cliBoxes;
|
|
1305
|
-
module.exports.default = cliBoxes;
|
|
1306
|
-
})))(), 1);
|
|
1307
|
-
const UPPERCASE = /[\p{Lu}]/u;
|
|
1308
|
-
const LOWERCASE = /[\p{Ll}]/u;
|
|
1309
|
-
const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
1310
|
-
const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
1311
|
-
const SEPARATORS = /[_.\- ]+/;
|
|
1312
|
-
const LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
1313
|
-
const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
1314
|
-
const NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
1315
|
-
const preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase) => {
|
|
1316
|
-
let isLastCharLower = false;
|
|
1317
|
-
let isLastCharUpper = false;
|
|
1318
|
-
let isLastLastCharUpper = false;
|
|
1319
|
-
let isLastLastCharPreserved = false;
|
|
1320
|
-
for (let index = 0; index < string.length; index++) {
|
|
1321
|
-
const character = string[index];
|
|
1322
|
-
isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
|
|
1323
|
-
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
1324
|
-
string = string.slice(0, index) + "-" + string.slice(index);
|
|
1325
|
-
isLastCharLower = false;
|
|
1326
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
1327
|
-
isLastCharUpper = true;
|
|
1328
|
-
index++;
|
|
1329
|
-
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase)) {
|
|
1330
|
-
string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
|
|
1331
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
1332
|
-
isLastCharUpper = false;
|
|
1333
|
-
isLastCharLower = true;
|
|
1334
|
-
} else {
|
|
1335
|
-
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
1336
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
1337
|
-
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
return string;
|
|
1341
|
-
};
|
|
1342
|
-
const preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
1343
|
-
LEADING_CAPITAL.lastIndex = 0;
|
|
1344
|
-
return input.replaceAll(LEADING_CAPITAL, (match) => toLowerCase(match));
|
|
1345
|
-
};
|
|
1346
|
-
const postProcess = (input, toUpperCase) => {
|
|
1347
|
-
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
1348
|
-
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
1349
|
-
return input.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
|
|
1350
|
-
};
|
|
1351
|
-
function camelCase(input, options) {
|
|
1352
|
-
if (!(typeof input === "string" || Array.isArray(input))) throw new TypeError("Expected the input to be `string | string[]`");
|
|
1353
|
-
options = {
|
|
1354
|
-
pascalCase: false,
|
|
1355
|
-
preserveConsecutiveUppercase: false,
|
|
1356
|
-
...options
|
|
1357
|
-
};
|
|
1358
|
-
if (Array.isArray(input)) input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
1359
|
-
else input = input.trim();
|
|
1360
|
-
if (input.length === 0) return "";
|
|
1361
|
-
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
|
1362
|
-
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
|
1363
|
-
if (input.length === 1) {
|
|
1364
|
-
if (SEPARATORS.test(input)) return "";
|
|
1365
|
-
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
1366
|
-
}
|
|
1367
|
-
if (input !== toLowerCase(input)) input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
|
1368
|
-
input = input.replace(LEADING_SEPARATORS, "");
|
|
1369
|
-
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
1370
|
-
if (options.pascalCase) input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
1371
|
-
return postProcess(input, toUpperCase);
|
|
1372
|
-
}
|
|
1373
|
-
//#endregion
|
|
1374
|
-
//#region ../../node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js
|
|
1375
|
-
var import_ansi_align = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1376
|
-
const stringWidth = require_string_width();
|
|
1377
|
-
function ansiAlign(text, opts) {
|
|
1378
|
-
if (!text) return text;
|
|
1379
|
-
opts = opts || {};
|
|
1380
|
-
const align = opts.align || "center";
|
|
1381
|
-
if (align === "left") return text;
|
|
1382
|
-
const split = opts.split || "\n";
|
|
1383
|
-
const pad = opts.pad || " ";
|
|
1384
|
-
const widthDiffFn = align !== "right" ? halfDiff : fullDiff;
|
|
1385
|
-
let returnString = false;
|
|
1386
|
-
if (!Array.isArray(text)) {
|
|
1387
|
-
returnString = true;
|
|
1388
|
-
text = String(text).split(split);
|
|
1389
|
-
}
|
|
1390
|
-
let width;
|
|
1391
|
-
let maxWidth = 0;
|
|
1392
|
-
text = text.map(function(str) {
|
|
1393
|
-
str = String(str);
|
|
1394
|
-
width = stringWidth(str);
|
|
1395
|
-
maxWidth = Math.max(width, maxWidth);
|
|
1396
|
-
return {
|
|
1397
|
-
str,
|
|
1398
|
-
width
|
|
1399
|
-
};
|
|
1400
|
-
}).map(function(obj) {
|
|
1401
|
-
return new Array(widthDiffFn(maxWidth, obj.width) + 1).join(pad) + obj.str;
|
|
1402
|
-
});
|
|
1403
|
-
return returnString ? text.join(split) : text;
|
|
1404
|
-
}
|
|
1405
|
-
ansiAlign.left = function left(text) {
|
|
1406
|
-
return ansiAlign(text, { align: "left" });
|
|
1407
|
-
};
|
|
1408
|
-
ansiAlign.center = function center(text) {
|
|
1409
|
-
return ansiAlign(text, { align: "center" });
|
|
1410
|
-
};
|
|
1411
|
-
ansiAlign.right = function right(text) {
|
|
1412
|
-
return ansiAlign(text, { align: "right" });
|
|
1413
|
-
};
|
|
1414
|
-
module.exports = ansiAlign;
|
|
1415
|
-
function halfDiff(maxWidth, curWidth) {
|
|
1416
|
-
return Math.floor((maxWidth - curWidth) / 2);
|
|
1417
|
-
}
|
|
1418
|
-
function fullDiff(maxWidth, curWidth) {
|
|
1419
|
-
return maxWidth - curWidth;
|
|
1420
|
-
}
|
|
1421
|
-
})))(), 1);
|
|
1422
|
-
const ANSI_BACKGROUND_OFFSET = 10;
|
|
1423
|
-
const wrapAnsi16 = (offset = 0) => (code) => `\u001B[${code + offset}m`;
|
|
1424
|
-
const wrapAnsi256 = (offset = 0) => (code) => `\u001B[${38 + offset};5;${code}m`;
|
|
1425
|
-
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
1426
|
-
const styles = {
|
|
1427
|
-
modifier: {
|
|
1428
|
-
reset: [0, 0],
|
|
1429
|
-
bold: [1, 22],
|
|
1430
|
-
dim: [2, 22],
|
|
1431
|
-
italic: [3, 23],
|
|
1432
|
-
underline: [4, 24],
|
|
1433
|
-
overline: [53, 55],
|
|
1434
|
-
inverse: [7, 27],
|
|
1435
|
-
hidden: [8, 28],
|
|
1436
|
-
strikethrough: [9, 29]
|
|
1437
|
-
},
|
|
1438
|
-
color: {
|
|
1439
|
-
black: [30, 39],
|
|
1440
|
-
red: [31, 39],
|
|
1441
|
-
green: [32, 39],
|
|
1442
|
-
yellow: [33, 39],
|
|
1443
|
-
blue: [34, 39],
|
|
1444
|
-
magenta: [35, 39],
|
|
1445
|
-
cyan: [36, 39],
|
|
1446
|
-
white: [37, 39],
|
|
1447
|
-
blackBright: [90, 39],
|
|
1448
|
-
gray: [90, 39],
|
|
1449
|
-
grey: [90, 39],
|
|
1450
|
-
redBright: [91, 39],
|
|
1451
|
-
greenBright: [92, 39],
|
|
1452
|
-
yellowBright: [93, 39],
|
|
1453
|
-
blueBright: [94, 39],
|
|
1454
|
-
magentaBright: [95, 39],
|
|
1455
|
-
cyanBright: [96, 39],
|
|
1456
|
-
whiteBright: [97, 39]
|
|
1457
|
-
},
|
|
1458
|
-
bgColor: {
|
|
1459
|
-
bgBlack: [40, 49],
|
|
1460
|
-
bgRed: [41, 49],
|
|
1461
|
-
bgGreen: [42, 49],
|
|
1462
|
-
bgYellow: [43, 49],
|
|
1463
|
-
bgBlue: [44, 49],
|
|
1464
|
-
bgMagenta: [45, 49],
|
|
1465
|
-
bgCyan: [46, 49],
|
|
1466
|
-
bgWhite: [47, 49],
|
|
1467
|
-
bgBlackBright: [100, 49],
|
|
1468
|
-
bgGray: [100, 49],
|
|
1469
|
-
bgGrey: [100, 49],
|
|
1470
|
-
bgRedBright: [101, 49],
|
|
1471
|
-
bgGreenBright: [102, 49],
|
|
1472
|
-
bgYellowBright: [103, 49],
|
|
1473
|
-
bgBlueBright: [104, 49],
|
|
1474
|
-
bgMagentaBright: [105, 49],
|
|
1475
|
-
bgCyanBright: [106, 49],
|
|
1476
|
-
bgWhiteBright: [107, 49]
|
|
1477
|
-
}
|
|
1478
|
-
};
|
|
1479
|
-
Object.keys(styles.modifier);
|
|
1480
|
-
const foregroundColorNames = Object.keys(styles.color);
|
|
1481
|
-
const backgroundColorNames = Object.keys(styles.bgColor);
|
|
1482
|
-
[...foregroundColorNames, ...backgroundColorNames];
|
|
1483
|
-
function assembleStyles() {
|
|
1484
|
-
const codes = /* @__PURE__ */ new Map();
|
|
1485
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
1486
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
1487
|
-
styles[styleName] = {
|
|
1488
|
-
open: `\u001B[${style[0]}m`,
|
|
1489
|
-
close: `\u001B[${style[1]}m`
|
|
1490
|
-
};
|
|
1491
|
-
group[styleName] = styles[styleName];
|
|
1492
|
-
codes.set(style[0], style[1]);
|
|
1493
|
-
}
|
|
1494
|
-
Object.defineProperty(styles, groupName, {
|
|
1495
|
-
value: group,
|
|
1496
|
-
enumerable: false
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
Object.defineProperty(styles, "codes", {
|
|
1500
|
-
value: codes,
|
|
1501
|
-
enumerable: false
|
|
1502
|
-
});
|
|
1503
|
-
styles.color.close = "\x1B[39m";
|
|
1504
|
-
styles.bgColor.close = "\x1B[49m";
|
|
1505
|
-
styles.color.ansi = wrapAnsi16();
|
|
1506
|
-
styles.color.ansi256 = wrapAnsi256();
|
|
1507
|
-
styles.color.ansi16m = wrapAnsi16m();
|
|
1508
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
1509
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
1510
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
1511
|
-
Object.defineProperties(styles, {
|
|
1512
|
-
rgbToAnsi256: {
|
|
1513
|
-
value(red, green, blue) {
|
|
1514
|
-
if (red === green && green === blue) {
|
|
1515
|
-
if (red < 8) return 16;
|
|
1516
|
-
if (red > 248) return 231;
|
|
1517
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
1518
|
-
}
|
|
1519
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
1520
|
-
},
|
|
1521
|
-
enumerable: false
|
|
1522
|
-
},
|
|
1523
|
-
hexToRgb: {
|
|
1524
|
-
value(hex) {
|
|
1525
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
1526
|
-
if (!matches) return [
|
|
1527
|
-
0,
|
|
1528
|
-
0,
|
|
1529
|
-
0
|
|
1530
|
-
];
|
|
1531
|
-
let [colorString] = matches;
|
|
1532
|
-
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
1533
|
-
const integer = Number.parseInt(colorString, 16);
|
|
1534
|
-
return [
|
|
1535
|
-
integer >> 16 & 255,
|
|
1536
|
-
integer >> 8 & 255,
|
|
1537
|
-
integer & 255
|
|
1538
|
-
];
|
|
1539
|
-
},
|
|
1540
|
-
enumerable: false
|
|
1541
|
-
},
|
|
1542
|
-
hexToAnsi256: {
|
|
1543
|
-
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
1544
|
-
enumerable: false
|
|
1545
|
-
},
|
|
1546
|
-
ansi256ToAnsi: {
|
|
1547
|
-
value(code) {
|
|
1548
|
-
if (code < 8) return 30 + code;
|
|
1549
|
-
if (code < 16) return 90 + (code - 8);
|
|
1550
|
-
let red;
|
|
1551
|
-
let green;
|
|
1552
|
-
let blue;
|
|
1553
|
-
if (code >= 232) {
|
|
1554
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
1555
|
-
green = red;
|
|
1556
|
-
blue = red;
|
|
1557
|
-
} else {
|
|
1558
|
-
code -= 16;
|
|
1559
|
-
const remainder = code % 36;
|
|
1560
|
-
red = Math.floor(code / 36) / 5;
|
|
1561
|
-
green = Math.floor(remainder / 6) / 5;
|
|
1562
|
-
blue = remainder % 6 / 5;
|
|
1563
|
-
}
|
|
1564
|
-
const value = Math.max(red, green, blue) * 2;
|
|
1565
|
-
if (value === 0) return 30;
|
|
1566
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
1567
|
-
if (value === 2) result += 60;
|
|
1568
|
-
return result;
|
|
1569
|
-
},
|
|
1570
|
-
enumerable: false
|
|
1571
|
-
},
|
|
1572
|
-
rgbToAnsi: {
|
|
1573
|
-
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
1574
|
-
enumerable: false
|
|
1575
|
-
},
|
|
1576
|
-
hexToAnsi: {
|
|
1577
|
-
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
1578
|
-
enumerable: false
|
|
1579
|
-
}
|
|
1580
|
-
});
|
|
1581
|
-
return styles;
|
|
1582
|
-
}
|
|
1583
|
-
const ansiStyles = assembleStyles();
|
|
1584
|
-
//#endregion
|
|
1585
|
-
//#region ../../node_modules/.pnpm/wrap-ansi@9.0.2/node_modules/wrap-ansi/index.js
|
|
1586
|
-
const ESCAPES = /* @__PURE__ */ new Set(["\x1B", ""]);
|
|
1587
|
-
const END_CODE = 39;
|
|
1588
|
-
const ANSI_ESCAPE_BELL = "\x07";
|
|
1589
|
-
const ANSI_CSI = "[";
|
|
1590
|
-
const ANSI_OSC = "]";
|
|
1591
|
-
const ANSI_SGR_TERMINATOR = "m";
|
|
1592
|
-
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
1593
|
-
const wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
1594
|
-
const wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
1595
|
-
const wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
|
|
1596
|
-
const wrapWord = (rows, word, columns) => {
|
|
1597
|
-
const characters = [...word];
|
|
1598
|
-
let isInsideEscape = false;
|
|
1599
|
-
let isInsideLinkEscape = false;
|
|
1600
|
-
let visible = stringWidth(stripAnsi(rows.at(-1)));
|
|
1601
|
-
for (const [index, character] of characters.entries()) {
|
|
1602
|
-
const characterLength = stringWidth(character);
|
|
1603
|
-
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
1604
|
-
else {
|
|
1605
|
-
rows.push(character);
|
|
1606
|
-
visible = 0;
|
|
1607
|
-
}
|
|
1608
|
-
if (ESCAPES.has(character)) {
|
|
1609
|
-
isInsideEscape = true;
|
|
1610
|
-
isInsideLinkEscape = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("") === ANSI_ESCAPE_LINK;
|
|
1611
|
-
}
|
|
1612
|
-
if (isInsideEscape) {
|
|
1613
|
-
if (isInsideLinkEscape) {
|
|
1614
|
-
if (character === ANSI_ESCAPE_BELL) {
|
|
1615
|
-
isInsideEscape = false;
|
|
1616
|
-
isInsideLinkEscape = false;
|
|
1617
|
-
}
|
|
1618
|
-
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
1619
|
-
continue;
|
|
1620
|
-
}
|
|
1621
|
-
visible += characterLength;
|
|
1622
|
-
if (visible === columns && index < characters.length - 1) {
|
|
1623
|
-
rows.push("");
|
|
1624
|
-
visible = 0;
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
if (!visible && rows.at(-1).length > 0 && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
1628
|
-
};
|
|
1629
|
-
const stringVisibleTrimSpacesRight = (string) => {
|
|
1630
|
-
const words = string.split(" ");
|
|
1631
|
-
let last = words.length;
|
|
1632
|
-
while (last > 0) {
|
|
1633
|
-
if (stringWidth(words[last - 1]) > 0) break;
|
|
1634
|
-
last--;
|
|
1635
|
-
}
|
|
1636
|
-
if (last === words.length) return string;
|
|
1637
|
-
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
1638
|
-
};
|
|
1639
|
-
const exec = (string, columns, options = {}) => {
|
|
1640
|
-
if (options.trim !== false && string.trim() === "") return "";
|
|
1641
|
-
let returnValue = "";
|
|
1642
|
-
let escapeCode;
|
|
1643
|
-
let escapeUrl;
|
|
1644
|
-
const lengths = wordLengths(string);
|
|
1645
|
-
let rows = [""];
|
|
1646
|
-
for (const [index, word] of string.split(" ").entries()) {
|
|
1647
|
-
if (options.trim !== false) rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
1648
|
-
let rowLength = stringWidth(rows.at(-1));
|
|
1649
|
-
if (index !== 0) {
|
|
1650
|
-
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
1651
|
-
rows.push("");
|
|
1652
|
-
rowLength = 0;
|
|
1653
|
-
}
|
|
1654
|
-
if (rowLength > 0 || options.trim === false) {
|
|
1655
|
-
rows[rows.length - 1] += " ";
|
|
1656
|
-
rowLength++;
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
if (options.hard && lengths[index] > columns) {
|
|
1660
|
-
const remainingColumns = columns - rowLength;
|
|
1661
|
-
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
1662
|
-
if (Math.floor((lengths[index] - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
1663
|
-
wrapWord(rows, word, columns);
|
|
1664
|
-
continue;
|
|
1665
|
-
}
|
|
1666
|
-
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
1667
|
-
if (options.wordWrap === false && rowLength < columns) {
|
|
1668
|
-
wrapWord(rows, word, columns);
|
|
1669
|
-
continue;
|
|
1670
|
-
}
|
|
1671
|
-
rows.push("");
|
|
1672
|
-
}
|
|
1673
|
-
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
1674
|
-
wrapWord(rows, word, columns);
|
|
1675
|
-
continue;
|
|
1676
|
-
}
|
|
1677
|
-
rows[rows.length - 1] += word;
|
|
1678
|
-
}
|
|
1679
|
-
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
1680
|
-
const preString = rows.join("\n");
|
|
1681
|
-
const pre = [...preString];
|
|
1682
|
-
let preStringIndex = 0;
|
|
1683
|
-
for (const [index, character] of pre.entries()) {
|
|
1684
|
-
returnValue += character;
|
|
1685
|
-
if (ESCAPES.has(character)) {
|
|
1686
|
-
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
1687
|
-
if (groups.code !== void 0) {
|
|
1688
|
-
const code = Number.parseFloat(groups.code);
|
|
1689
|
-
escapeCode = code === END_CODE ? void 0 : code;
|
|
1690
|
-
} else if (groups.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
1691
|
-
}
|
|
1692
|
-
const code = ansiStyles.codes.get(Number(escapeCode));
|
|
1693
|
-
if (pre[index + 1] === "\n") {
|
|
1694
|
-
if (escapeUrl) returnValue += wrapAnsiHyperlink("");
|
|
1695
|
-
if (escapeCode && code) returnValue += wrapAnsiCode(code);
|
|
1696
|
-
} else if (character === "\n") {
|
|
1697
|
-
if (escapeCode && code) returnValue += wrapAnsiCode(escapeCode);
|
|
1698
|
-
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
1699
|
-
}
|
|
1700
|
-
preStringIndex += character.length;
|
|
1701
|
-
}
|
|
1702
|
-
return returnValue;
|
|
1703
|
-
};
|
|
1704
|
-
function wrapAnsi(string, columns, options) {
|
|
1705
|
-
return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
|
|
1706
|
-
}
|
|
1707
|
-
//#endregion
|
|
1708
|
-
//#region ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1709
|
-
const NEWLINE = "\n";
|
|
1710
|
-
const PAD = " ";
|
|
1711
|
-
const NONE = "none";
|
|
1712
|
-
const terminalColumns = () => {
|
|
1713
|
-
const { env, stdout, stderr } = process$1;
|
|
1714
|
-
if (stdout?.columns) return stdout.columns;
|
|
1715
|
-
if (stderr?.columns) return stderr.columns;
|
|
1716
|
-
if (env.COLUMNS) return Number.parseInt(env.COLUMNS, 10);
|
|
1717
|
-
return 80;
|
|
1718
|
-
};
|
|
1719
|
-
const getObject = (detail) => typeof detail === "number" ? {
|
|
1720
|
-
top: detail,
|
|
1721
|
-
right: detail * 3,
|
|
1722
|
-
bottom: detail,
|
|
1723
|
-
left: detail * 3
|
|
1724
|
-
} : {
|
|
1725
|
-
top: 0,
|
|
1726
|
-
right: 0,
|
|
1727
|
-
bottom: 0,
|
|
1728
|
-
left: 0,
|
|
1729
|
-
...detail
|
|
1730
|
-
};
|
|
1731
|
-
const getBorderWidth = (borderStyle) => borderStyle === NONE ? 0 : 2;
|
|
1732
|
-
const getBorderChars = (borderStyle) => {
|
|
1733
|
-
const sides = [
|
|
1734
|
-
"topLeft",
|
|
1735
|
-
"topRight",
|
|
1736
|
-
"bottomRight",
|
|
1737
|
-
"bottomLeft",
|
|
1738
|
-
"left",
|
|
1739
|
-
"right",
|
|
1740
|
-
"top",
|
|
1741
|
-
"bottom"
|
|
1742
|
-
];
|
|
1743
|
-
let characters;
|
|
1744
|
-
if (borderStyle === NONE) {
|
|
1745
|
-
borderStyle = {};
|
|
1746
|
-
for (const side of sides) borderStyle[side] = "";
|
|
1747
|
-
}
|
|
1748
|
-
if (typeof borderStyle === "string") {
|
|
1749
|
-
characters = import_cli_boxes.default[borderStyle];
|
|
1750
|
-
if (!characters) throw new TypeError(`Invalid border style: ${borderStyle}`);
|
|
1751
|
-
} else {
|
|
1752
|
-
if (typeof borderStyle?.vertical === "string") {
|
|
1753
|
-
borderStyle.left = borderStyle.vertical;
|
|
1754
|
-
borderStyle.right = borderStyle.vertical;
|
|
1755
|
-
}
|
|
1756
|
-
if (typeof borderStyle?.horizontal === "string") {
|
|
1757
|
-
borderStyle.top = borderStyle.horizontal;
|
|
1758
|
-
borderStyle.bottom = borderStyle.horizontal;
|
|
1759
|
-
}
|
|
1760
|
-
for (const side of sides) if (borderStyle[side] === null || typeof borderStyle[side] !== "string") throw new TypeError(`Invalid border style: ${side}`);
|
|
1761
|
-
characters = borderStyle;
|
|
1762
|
-
}
|
|
1763
|
-
return characters;
|
|
1764
|
-
};
|
|
1765
|
-
const makeTitle = (text, horizontal, alignment) => {
|
|
1766
|
-
let title = "";
|
|
1767
|
-
const textWidth = stringWidth(text);
|
|
1768
|
-
switch (alignment) {
|
|
1769
|
-
case "left":
|
|
1770
|
-
title = text + horizontal.slice(textWidth);
|
|
1771
|
-
break;
|
|
1772
|
-
case "right":
|
|
1773
|
-
title = horizontal.slice(textWidth) + text;
|
|
1774
|
-
break;
|
|
1775
|
-
default:
|
|
1776
|
-
horizontal = horizontal.slice(textWidth);
|
|
1777
|
-
if (horizontal.length % 2 === 1) {
|
|
1778
|
-
horizontal = horizontal.slice(Math.floor(horizontal.length / 2));
|
|
1779
|
-
title = horizontal.slice(1) + text + horizontal;
|
|
1780
|
-
} else {
|
|
1781
|
-
horizontal = horizontal.slice(horizontal.length / 2);
|
|
1782
|
-
title = horizontal + text + horizontal;
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
return title;
|
|
1786
|
-
};
|
|
1787
|
-
const makeContentText = (text, { padding, width, textAlignment, height }) => {
|
|
1788
|
-
text = (0, import_ansi_align.default)(text, { align: textAlignment });
|
|
1789
|
-
let lines = text.split(NEWLINE);
|
|
1790
|
-
const textWidth = widestLine(text);
|
|
1791
|
-
const max = width - padding.left - padding.right;
|
|
1792
|
-
if (textWidth > max) {
|
|
1793
|
-
const newLines = [];
|
|
1794
|
-
for (const line of lines) {
|
|
1795
|
-
const createdLines = wrapAnsi(line, max, { hard: true });
|
|
1796
|
-
const alignedLinesArray = (0, import_ansi_align.default)(createdLines, { align: textAlignment }).split("\n");
|
|
1797
|
-
const longestLength = Math.max(...alignedLinesArray.map((s) => stringWidth(s)));
|
|
1798
|
-
for (const alignedLine of alignedLinesArray) {
|
|
1799
|
-
let paddedLine;
|
|
1800
|
-
switch (textAlignment) {
|
|
1801
|
-
case "center":
|
|
1802
|
-
paddedLine = PAD.repeat((max - longestLength) / 2) + alignedLine;
|
|
1803
|
-
break;
|
|
1804
|
-
case "right":
|
|
1805
|
-
paddedLine = PAD.repeat(max - longestLength) + alignedLine;
|
|
1806
|
-
break;
|
|
1807
|
-
default: paddedLine = alignedLine;
|
|
1808
|
-
}
|
|
1809
|
-
newLines.push(paddedLine);
|
|
1810
|
-
}
|
|
1811
|
-
}
|
|
1812
|
-
lines = newLines;
|
|
1813
|
-
}
|
|
1814
|
-
if (textAlignment === "center" && textWidth < max) lines = lines.map((line) => PAD.repeat((max - textWidth) / 2) + line);
|
|
1815
|
-
else if (textAlignment === "right" && textWidth < max) lines = lines.map((line) => PAD.repeat(max - textWidth) + line);
|
|
1816
|
-
const paddingLeft = PAD.repeat(padding.left);
|
|
1817
|
-
const paddingRight = PAD.repeat(padding.right);
|
|
1818
|
-
lines = lines.map((line) => {
|
|
1819
|
-
const newLine = paddingLeft + line + paddingRight;
|
|
1820
|
-
return newLine + PAD.repeat(width - stringWidth(newLine));
|
|
1821
|
-
});
|
|
1822
|
-
if (padding.top > 0) lines = [...Array.from({ length: padding.top }).fill(PAD.repeat(width)), ...lines];
|
|
1823
|
-
if (padding.bottom > 0) lines = [...lines, ...Array.from({ length: padding.bottom }).fill(PAD.repeat(width))];
|
|
1824
|
-
if (height && lines.length > height) lines = lines.slice(0, height);
|
|
1825
|
-
else if (height && lines.length < height) lines = [...lines, ...Array.from({ length: height - lines.length }).fill(PAD.repeat(width))];
|
|
1826
|
-
return lines.join(NEWLINE);
|
|
1827
|
-
};
|
|
1828
|
-
const boxContent = (content, contentWidth, options) => {
|
|
1829
|
-
const colorizeBorder = (border) => {
|
|
1830
|
-
const newBorder = options.borderColor ? getColorFunction(options.borderColor)(border) : border;
|
|
1831
|
-
return options.dimBorder ? chalk.dim(newBorder) : newBorder;
|
|
1832
|
-
};
|
|
1833
|
-
const colorizeContent = (content) => options.backgroundColor ? getBGColorFunction(options.backgroundColor)(content) : content;
|
|
1834
|
-
const chars = getBorderChars(options.borderStyle);
|
|
1835
|
-
const columns = terminalColumns();
|
|
1836
|
-
let marginLeft = PAD.repeat(options.margin.left);
|
|
1837
|
-
if (options.float === "center") {
|
|
1838
|
-
const marginWidth = Math.max((columns - contentWidth - getBorderWidth(options.borderStyle)) / 2, 0);
|
|
1839
|
-
marginLeft = PAD.repeat(marginWidth);
|
|
1840
|
-
} else if (options.float === "right") {
|
|
1841
|
-
const marginWidth = Math.max(columns - contentWidth - options.margin.right - getBorderWidth(options.borderStyle), 0);
|
|
1842
|
-
marginLeft = PAD.repeat(marginWidth);
|
|
1843
|
-
}
|
|
1844
|
-
let result = "";
|
|
1845
|
-
if (options.margin.top) result += NEWLINE.repeat(options.margin.top);
|
|
1846
|
-
if (options.borderStyle !== NONE || options.title) result += colorizeBorder(marginLeft + chars.topLeft + (options.title ? makeTitle(options.title, chars.top.repeat(contentWidth), options.titleAlignment) : chars.top.repeat(contentWidth)) + chars.topRight) + NEWLINE;
|
|
1847
|
-
const lines = content.split(NEWLINE);
|
|
1848
|
-
result += lines.map((line) => marginLeft + colorizeBorder(chars.left) + colorizeContent(line) + colorizeBorder(chars.right)).join(NEWLINE);
|
|
1849
|
-
if (options.borderStyle !== NONE) result += NEWLINE + colorizeBorder(marginLeft + chars.bottomLeft + chars.bottom.repeat(contentWidth) + chars.bottomRight);
|
|
1850
|
-
if (options.margin.bottom) result += NEWLINE.repeat(options.margin.bottom);
|
|
1851
|
-
return result;
|
|
1852
|
-
};
|
|
1853
|
-
const sanitizeOptions = (options) => {
|
|
1854
|
-
if (options.fullscreen && process$1?.stdout) {
|
|
1855
|
-
let newDimensions = [process$1.stdout.columns, process$1.stdout.rows];
|
|
1856
|
-
if (typeof options.fullscreen === "function") newDimensions = options.fullscreen(...newDimensions);
|
|
1857
|
-
options.width ||= newDimensions[0];
|
|
1858
|
-
options.height ||= newDimensions[1];
|
|
1859
|
-
}
|
|
1860
|
-
options.width &&= Math.max(1, options.width - getBorderWidth(options.borderStyle));
|
|
1861
|
-
options.height &&= Math.max(1, options.height - getBorderWidth(options.borderStyle));
|
|
1862
|
-
return options;
|
|
1863
|
-
};
|
|
1864
|
-
const formatTitle = (title, borderStyle) => borderStyle === NONE ? title : ` ${title} `;
|
|
1865
|
-
const determineDimensions = (text, options) => {
|
|
1866
|
-
options = sanitizeOptions(options);
|
|
1867
|
-
const widthOverride = options.width !== void 0;
|
|
1868
|
-
const columns = terminalColumns();
|
|
1869
|
-
const borderWidth = getBorderWidth(options.borderStyle);
|
|
1870
|
-
const maxWidth = columns - options.margin.left - options.margin.right - borderWidth;
|
|
1871
|
-
const widest = widestLine(wrapAnsi(text, columns - borderWidth, {
|
|
1872
|
-
hard: true,
|
|
1873
|
-
trim: false
|
|
1874
|
-
})) + options.padding.left + options.padding.right;
|
|
1875
|
-
if (options.title && widthOverride) {
|
|
1876
|
-
options.title = options.title.slice(0, Math.max(0, options.width - 2));
|
|
1877
|
-
options.title &&= formatTitle(options.title, options.borderStyle);
|
|
1878
|
-
} else if (options.title) {
|
|
1879
|
-
options.title = options.title.slice(0, Math.max(0, maxWidth - 2));
|
|
1880
|
-
if (options.title) {
|
|
1881
|
-
options.title = formatTitle(options.title, options.borderStyle);
|
|
1882
|
-
if (stringWidth(options.title) > widest) options.width = stringWidth(options.title);
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
options.width ||= widest;
|
|
1886
|
-
if (!widthOverride) {
|
|
1887
|
-
if (options.margin.left && options.margin.right && options.width > maxWidth) {
|
|
1888
|
-
const multiplier = (columns - options.width - borderWidth) / (options.margin.left + options.margin.right);
|
|
1889
|
-
options.margin.left = Math.max(0, Math.floor(options.margin.left * multiplier));
|
|
1890
|
-
options.margin.right = Math.max(0, Math.floor(options.margin.right * multiplier));
|
|
1891
|
-
}
|
|
1892
|
-
options.width = Math.min(options.width, columns - borderWidth - options.margin.left - options.margin.right);
|
|
1893
|
-
}
|
|
1894
|
-
if (options.width - (options.padding.left + options.padding.right) <= 0) {
|
|
1895
|
-
options.padding.left = 0;
|
|
1896
|
-
options.padding.right = 0;
|
|
1897
|
-
}
|
|
1898
|
-
if (options.height && options.height - (options.padding.top + options.padding.bottom) <= 0) {
|
|
1899
|
-
options.padding.top = 0;
|
|
1900
|
-
options.padding.bottom = 0;
|
|
1901
|
-
}
|
|
1902
|
-
return options;
|
|
1903
|
-
};
|
|
1904
|
-
const isHex = (color) => color.match(/^#(?:[0-f]{3}){1,2}$/i);
|
|
1905
|
-
const isColorValid = (color) => typeof color === "string" && (chalk[color] ?? isHex(color));
|
|
1906
|
-
const getColorFunction = (color) => isHex(color) ? chalk.hex(color) : chalk[color];
|
|
1907
|
-
const getBGColorFunction = (color) => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(["bg", color])];
|
|
1908
|
-
function boxen(text, options) {
|
|
1909
|
-
options = {
|
|
1910
|
-
padding: 0,
|
|
1911
|
-
borderStyle: "single",
|
|
1912
|
-
dimBorder: false,
|
|
1913
|
-
textAlignment: "left",
|
|
1914
|
-
float: "left",
|
|
1915
|
-
titleAlignment: "left",
|
|
1916
|
-
...options
|
|
1917
|
-
};
|
|
1918
|
-
if (options.align) options.textAlignment = options.align;
|
|
1919
|
-
if (options.borderColor && !isColorValid(options.borderColor)) throw new Error(`${options.borderColor} is not a valid borderColor`);
|
|
1920
|
-
if (options.backgroundColor && !isColorValid(options.backgroundColor)) throw new Error(`${options.backgroundColor} is not a valid backgroundColor`);
|
|
1921
|
-
options.padding = getObject(options.padding);
|
|
1922
|
-
options.margin = getObject(options.margin);
|
|
1923
|
-
options = determineDimensions(text, options);
|
|
1924
|
-
text = makeContentText(text, options);
|
|
1925
|
-
return boxContent(text, options.width, options);
|
|
1926
|
-
}
|
|
1927
|
-
//#endregion
|
|
1928
|
-
//#region src/ux/banner.ts
|
|
1929
|
-
/**
|
|
1930
|
-
* Display the tool banner
|
|
1931
|
-
*/
|
|
1932
|
-
function showBanner(command, version, quiet = false) {
|
|
1933
|
-
if (quiet) return;
|
|
1934
|
-
const banner = boxen(`${chalk$1.bold.cyan("QTI <-> Learnosity Converter")}\n${chalk$1.dim("Version:")} ${version}\n${chalk$1.dim("Command:")} ${command}`, {
|
|
1935
|
-
padding: 1,
|
|
1936
|
-
margin: 1,
|
|
1937
|
-
borderStyle: "round",
|
|
1938
|
-
borderColor: "cyan"
|
|
1939
|
-
});
|
|
1940
|
-
console.log(banner);
|
|
1941
|
-
}
|
|
1942
|
-
//#endregion
|
|
1943
|
-
//#region src/options/schema.ts
|
|
1944
|
-
const VALID_QTI_VERSIONS = ["2.1", "2.2"];
|
|
1945
|
-
const VALID_OUTPUT_FORMATS = [
|
|
1946
|
-
"dir",
|
|
1947
|
-
"zip",
|
|
1948
|
-
"stdout"
|
|
1949
|
-
];
|
|
1950
|
-
const VALID_DIAGNOSTICS_OUTPUTS = [
|
|
1951
|
-
"stderr",
|
|
1952
|
-
"file",
|
|
1953
|
-
"both",
|
|
1954
|
-
"none"
|
|
1955
|
-
];
|
|
1956
|
-
const VALID_ITEM_REFERENCE_SOURCES = [
|
|
1957
|
-
"itemIdentifier",
|
|
1958
|
-
"qti",
|
|
1959
|
-
"sourceFilename",
|
|
1960
|
-
"uuid"
|
|
1961
|
-
];
|
|
1962
|
-
const VALID_ITEM_FILENAME_SOURCES = [
|
|
1963
|
-
"itemIdentifier",
|
|
1964
|
-
"qti",
|
|
1965
|
-
"sourceFilename"
|
|
1966
|
-
];
|
|
1967
|
-
const KNOWN_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
1968
|
-
"qtiVersion",
|
|
1969
|
-
"outputFormat",
|
|
1970
|
-
"diagnostics",
|
|
1971
|
-
"pretty",
|
|
1972
|
-
"verbose",
|
|
1973
|
-
"output",
|
|
1974
|
-
"organisationId",
|
|
1975
|
-
"mediaVault",
|
|
1976
|
-
"customAssetUrl",
|
|
1977
|
-
"preserveAssetFilenames",
|
|
1978
|
-
"itemReferenceSource",
|
|
1979
|
-
"itemFilenameSource",
|
|
1980
|
-
"truncateTags",
|
|
1981
|
-
"splitCsvTags"
|
|
1982
|
-
]);
|
|
1983
|
-
/**
|
|
1984
|
-
* Validate config object and return diagnostics
|
|
1985
|
-
*/
|
|
1986
|
-
function validateConfig(config) {
|
|
1987
|
-
const diagnostics = [];
|
|
1988
|
-
const valid = {};
|
|
1989
|
-
for (const key of Object.keys(config)) if (!KNOWN_CONFIG_KEYS.has(key)) diagnostics.push({
|
|
1990
|
-
level: "warning",
|
|
1991
|
-
code: DiagnosticCode.CONFIG_UNKNOWN_KEY,
|
|
1992
|
-
message: `Unknown config key: "${key}"`,
|
|
1993
|
-
file: "",
|
|
1994
|
-
context: { key }
|
|
1995
|
-
});
|
|
1996
|
-
if ("qtiVersion" in config) {
|
|
1997
|
-
if (typeof config.qtiVersion === "string" && VALID_QTI_VERSIONS.includes(config.qtiVersion)) valid.qtiVersion = config.qtiVersion;
|
|
1998
|
-
else diagnostics.push({
|
|
1999
|
-
level: "error",
|
|
2000
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2001
|
-
message: `Invalid qtiVersion: "${config.qtiVersion}". Must be "2.1" or "2.2".`,
|
|
2002
|
-
file: "qtiVersion"
|
|
2003
|
-
});
|
|
2004
|
-
}
|
|
2005
|
-
if ("outputFormat" in config) {
|
|
2006
|
-
if (typeof config.outputFormat === "string" && VALID_OUTPUT_FORMATS.includes(config.outputFormat)) valid.outputFormat = config.outputFormat;
|
|
2007
|
-
else diagnostics.push({
|
|
2008
|
-
level: "error",
|
|
2009
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2010
|
-
message: `Invalid outputFormat: "${config.outputFormat}". Must be "dir", "zip", or "stdout".`,
|
|
2011
|
-
file: "outputFormat"
|
|
2012
|
-
});
|
|
2013
|
-
}
|
|
2014
|
-
if ("diagnostics" in config) {
|
|
2015
|
-
if (typeof config.diagnostics === "string" && VALID_DIAGNOSTICS_OUTPUTS.includes(config.diagnostics)) valid.diagnostics = config.diagnostics;
|
|
2016
|
-
else diagnostics.push({
|
|
2017
|
-
level: "error",
|
|
2018
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2019
|
-
message: `Invalid diagnostics: "${config.diagnostics}". Must be "stderr", "file", "both", or "none".`,
|
|
2020
|
-
file: "diagnostics"
|
|
2021
|
-
});
|
|
2022
|
-
}
|
|
2023
|
-
if ("pretty" in config) {
|
|
2024
|
-
if (typeof config.pretty === "boolean") valid.pretty = config.pretty;
|
|
2025
|
-
else diagnostics.push({
|
|
2026
|
-
level: "error",
|
|
2027
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2028
|
-
message: `Invalid pretty: "${config.pretty}". Must be boolean.`,
|
|
2029
|
-
file: "pretty"
|
|
2030
|
-
});
|
|
2031
|
-
}
|
|
2032
|
-
if ("verbose" in config) {
|
|
2033
|
-
if (typeof config.verbose === "boolean") valid.verbose = config.verbose;
|
|
2034
|
-
else diagnostics.push({
|
|
2035
|
-
level: "error",
|
|
2036
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2037
|
-
message: `Invalid verbose: "${config.verbose}". Must be boolean.`,
|
|
2038
|
-
file: "verbose"
|
|
2039
|
-
});
|
|
2040
|
-
}
|
|
2041
|
-
if ("output" in config) {
|
|
2042
|
-
if (typeof config.output === "string") valid.output = config.output;
|
|
2043
|
-
else diagnostics.push({
|
|
2044
|
-
level: "error",
|
|
2045
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2046
|
-
message: `Invalid output: "${config.output}". Must be string.`,
|
|
2047
|
-
file: "output"
|
|
2048
|
-
});
|
|
2049
|
-
}
|
|
2050
|
-
if ("organisationId" in config) {
|
|
2051
|
-
if (typeof config.organisationId === "number" && Number.isInteger(config.organisationId)) valid.organisationId = config.organisationId;
|
|
2052
|
-
else diagnostics.push({
|
|
2053
|
-
level: "error",
|
|
2054
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2055
|
-
message: `Invalid organisationId: "${config.organisationId}". Must be an integer.`,
|
|
2056
|
-
file: "organisationId"
|
|
2057
|
-
});
|
|
2058
|
-
}
|
|
2059
|
-
if ("mediaVault" in config) {
|
|
2060
|
-
if (typeof config.mediaVault === "boolean") valid.mediaVault = config.mediaVault;
|
|
2061
|
-
else diagnostics.push({
|
|
2062
|
-
level: "error",
|
|
2063
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2064
|
-
message: `Invalid mediaVault: "${config.mediaVault}". Must be boolean.`,
|
|
2065
|
-
file: "mediaVault"
|
|
2066
|
-
});
|
|
2067
|
-
}
|
|
2068
|
-
if ("customAssetUrl" in config) {
|
|
2069
|
-
if (typeof config.customAssetUrl === "string") valid.customAssetUrl = config.customAssetUrl;
|
|
2070
|
-
else diagnostics.push({
|
|
2071
|
-
level: "error",
|
|
2072
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2073
|
-
message: `Invalid customAssetUrl: "${config.customAssetUrl}". Must be string.`,
|
|
2074
|
-
file: "customAssetUrl"
|
|
2075
|
-
});
|
|
2076
|
-
}
|
|
2077
|
-
if ("preserveAssetFilenames" in config) {
|
|
2078
|
-
if (typeof config.preserveAssetFilenames === "boolean") valid.preserveAssetFilenames = config.preserveAssetFilenames;
|
|
2079
|
-
else diagnostics.push({
|
|
2080
|
-
level: "error",
|
|
2081
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2082
|
-
message: `Invalid preserveAssetFilenames: "${String(config.preserveAssetFilenames)}". Must be boolean.`,
|
|
2083
|
-
file: "preserveAssetFilenames"
|
|
2084
|
-
});
|
|
2085
|
-
}
|
|
2086
|
-
if ("itemReferenceSource" in config) {
|
|
2087
|
-
if (typeof config.itemReferenceSource === "string" && VALID_ITEM_REFERENCE_SOURCES.includes(config.itemReferenceSource)) valid.itemReferenceSource = config.itemReferenceSource;
|
|
2088
|
-
else diagnostics.push({
|
|
2089
|
-
level: "error",
|
|
2090
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2091
|
-
message: `Invalid itemReferenceSource: "${String(config.itemReferenceSource)}". Must be "itemIdentifier", "qti", "sourceFilename", or "uuid".`,
|
|
2092
|
-
file: "itemReferenceSource"
|
|
2093
|
-
});
|
|
2094
|
-
}
|
|
2095
|
-
if ("truncateTags" in config) {
|
|
2096
|
-
if (typeof config.truncateTags === "boolean") valid.truncateTags = config.truncateTags;
|
|
2097
|
-
else diagnostics.push({
|
|
2098
|
-
level: "error",
|
|
2099
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2100
|
-
message: `Invalid truncateTags: "${config.truncateTags}". Must be boolean.`,
|
|
2101
|
-
file: "truncateTags"
|
|
2102
|
-
});
|
|
2103
|
-
}
|
|
2104
|
-
if ("splitCsvTags" in config) {
|
|
2105
|
-
if (typeof config.splitCsvTags === "boolean") valid.splitCsvTags = config.splitCsvTags;
|
|
2106
|
-
else diagnostics.push({
|
|
2107
|
-
level: "error",
|
|
2108
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2109
|
-
message: `Invalid splitCsvTags: "${String(config.splitCsvTags)}". Must be boolean.`,
|
|
2110
|
-
file: "splitCsvTags"
|
|
2111
|
-
});
|
|
2112
|
-
}
|
|
2113
|
-
if ("itemFilenameSource" in config) {
|
|
2114
|
-
if (typeof config.itemFilenameSource === "string" && VALID_ITEM_FILENAME_SOURCES.includes(config.itemFilenameSource)) valid.itemFilenameSource = config.itemFilenameSource;
|
|
2115
|
-
else diagnostics.push({
|
|
2116
|
-
level: "error",
|
|
2117
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2118
|
-
message: `Invalid itemFilenameSource: "${String(config.itemFilenameSource)}". Must be "itemIdentifier", "qti", or "sourceFilename".`,
|
|
2119
|
-
file: "itemFilenameSource"
|
|
2120
|
-
});
|
|
2121
|
-
}
|
|
2122
|
-
return {
|
|
2123
|
-
valid,
|
|
2124
|
-
diagnostics
|
|
2125
|
-
};
|
|
2126
|
-
}
|
|
2127
|
-
//#endregion
|
|
2128
|
-
//#region src/options/loadConfig.ts
|
|
2129
|
-
/**
|
|
2130
|
-
* Load config from file path
|
|
2131
|
-
*/
|
|
2132
|
-
async function loadConfigFromPath(configPath) {
|
|
2133
|
-
const diagnostics = [];
|
|
2134
|
-
const absolutePath = resolve(configPath);
|
|
2135
|
-
try {
|
|
2136
|
-
await access(absolutePath);
|
|
2137
|
-
} catch {
|
|
2138
|
-
diagnostics.push({
|
|
2139
|
-
level: "error",
|
|
2140
|
-
code: DiagnosticCode.CONFIG_FILE_NOT_FOUND,
|
|
2141
|
-
message: `Config file not found: ${absolutePath}`,
|
|
2142
|
-
file: "",
|
|
2143
|
-
context: { configPath: absolutePath }
|
|
2144
|
-
});
|
|
2145
|
-
return {
|
|
2146
|
-
config: null,
|
|
2147
|
-
diagnostics,
|
|
2148
|
-
configPath: null
|
|
2149
|
-
};
|
|
2150
|
-
}
|
|
2151
|
-
let content;
|
|
2152
|
-
try {
|
|
2153
|
-
content = await readFile(absolutePath, "utf-8");
|
|
2154
|
-
} catch (error) {
|
|
2155
|
-
diagnostics.push({
|
|
2156
|
-
level: "error",
|
|
2157
|
-
code: DiagnosticCode.CONFIG_FILE_NOT_FOUND,
|
|
2158
|
-
message: `Failed to read config file: ${error instanceof Error ? error.message : "unknown error"}`,
|
|
2159
|
-
file: "",
|
|
2160
|
-
context: { configPath: absolutePath }
|
|
2161
|
-
});
|
|
2162
|
-
return {
|
|
2163
|
-
config: null,
|
|
2164
|
-
diagnostics,
|
|
2165
|
-
configPath: null
|
|
2166
|
-
};
|
|
2167
|
-
}
|
|
2168
|
-
let parsed;
|
|
2169
|
-
try {
|
|
2170
|
-
parsed = JSON.parse(content);
|
|
2171
|
-
} catch (error) {
|
|
2172
|
-
diagnostics.push({
|
|
2173
|
-
level: "error",
|
|
2174
|
-
code: DiagnosticCode.CONFIG_FILE_INVALID_JSON,
|
|
2175
|
-
message: `Invalid JSON in config file: ${error instanceof Error ? error.message : "unknown error"}`,
|
|
2176
|
-
file: "",
|
|
2177
|
-
context: { configPath: absolutePath }
|
|
2178
|
-
});
|
|
2179
|
-
return {
|
|
2180
|
-
config: null,
|
|
2181
|
-
diagnostics,
|
|
2182
|
-
configPath: null
|
|
2183
|
-
};
|
|
2184
|
-
}
|
|
2185
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
2186
|
-
diagnostics.push({
|
|
2187
|
-
level: "error",
|
|
2188
|
-
code: DiagnosticCode.CONFIG_SCHEMA_INVALID,
|
|
2189
|
-
message: "Config file must be a JSON object",
|
|
2190
|
-
file: "",
|
|
2191
|
-
context: { configPath: absolutePath }
|
|
2192
|
-
});
|
|
2193
|
-
return {
|
|
2194
|
-
config: null,
|
|
2195
|
-
diagnostics,
|
|
2196
|
-
configPath: null
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
const { valid, diagnostics: validationDiagnostics } = validateConfig(parsed);
|
|
2200
|
-
diagnostics.push(...validationDiagnostics);
|
|
2201
|
-
if (diagnostics.some((d) => d.level === "error")) return {
|
|
2202
|
-
config: null,
|
|
2203
|
-
diagnostics,
|
|
2204
|
-
configPath: null
|
|
2205
|
-
};
|
|
2206
|
-
diagnostics.push({
|
|
2207
|
-
level: "info",
|
|
2208
|
-
code: DiagnosticCode.CONFIG_LOADED,
|
|
2209
|
-
message: `Config loaded from ${absolutePath}`,
|
|
2210
|
-
file: "",
|
|
2211
|
-
context: { configPath: absolutePath }
|
|
2212
|
-
});
|
|
2213
|
-
return {
|
|
2214
|
-
config: valid,
|
|
2215
|
-
diagnostics,
|
|
2216
|
-
configPath: absolutePath
|
|
2217
|
-
};
|
|
2218
|
-
}
|
|
2219
|
-
/**
|
|
2220
|
-
* Load config with discovery (default path or explicit)
|
|
2221
|
-
*/
|
|
2222
|
-
async function loadConfig(explicitPath, noConfig) {
|
|
2223
|
-
const diagnostics = [];
|
|
2224
|
-
if (noConfig) {
|
|
2225
|
-
diagnostics.push({
|
|
2226
|
-
level: "info",
|
|
2227
|
-
code: DiagnosticCode.CONFIG_DISABLED,
|
|
2228
|
-
message: "Config loading disabled via --no-config",
|
|
2229
|
-
file: ""
|
|
2230
|
-
});
|
|
2231
|
-
return {
|
|
2232
|
-
config: null,
|
|
2233
|
-
diagnostics,
|
|
2234
|
-
configPath: null
|
|
2235
|
-
};
|
|
2236
|
-
}
|
|
2237
|
-
if (explicitPath) return loadConfigFromPath(explicitPath);
|
|
2238
|
-
const defaultPath = resolve(process.cwd(), "lrn-converter.config.json");
|
|
2239
|
-
try {
|
|
2240
|
-
await access(defaultPath);
|
|
2241
|
-
return loadConfigFromPath(defaultPath);
|
|
2242
|
-
} catch {
|
|
2243
|
-
return {
|
|
2244
|
-
config: null,
|
|
2245
|
-
diagnostics: [],
|
|
2246
|
-
configPath: null
|
|
2247
|
-
};
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
//#endregion
|
|
2251
|
-
//#region src/utils/pathUtils.ts
|
|
2252
|
-
/**
|
|
2253
|
-
* Expand tilde (~) to home directory in paths.
|
|
2254
|
-
*
|
|
2255
|
-
* Handles:
|
|
2256
|
-
* - `~/path` → `/home/user/path`
|
|
2257
|
-
* - `~` → `/home/user`
|
|
2258
|
-
*
|
|
2259
|
-
* Does NOT handle `~username/path` syntax (returns unchanged).
|
|
2260
|
-
*
|
|
2261
|
-
* @param filePath - The file path that may contain a tilde
|
|
2262
|
-
* @returns The path with tilde expanded to home directory
|
|
2263
|
-
*/
|
|
2264
|
-
function expandTilde(filePath) {
|
|
2265
|
-
if (filePath.startsWith("~/")) return filePath.replace("~", homedir());
|
|
2266
|
-
if (filePath === "~") return homedir();
|
|
2267
|
-
return filePath;
|
|
2268
|
-
}
|
|
2269
|
-
//#endregion
|
|
2270
|
-
export { chalk as a, dist_default as c, boxen as i, loadConfig as n, eastAsianWidth as o, showBanner as r, stripAnsi as s, expandTilde as t };
|
|
2271
|
-
|
|
2272
|
-
//# sourceMappingURL=pathUtils-D_VsVde8.js.map
|