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