@learnosity/lib-qti-converter 0.10.4 → 0.12.0
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 +110 -23
- package/docs/DIAGNOSTICS.md +43 -24
- package/docs/EXAMPLES.md +84 -34
- package/docs/FAQ.md +6 -6
- package/docs/GETTING_STARTED.md +91 -6
- package/docs/LEARNOSITY_BUNDLE_FORMAT.md +61 -86
- package/docs/LEARNOSITY_SECTIONS.md +27 -16
- package/docs/QTI_METADATA_TO_TAGS.md +19 -6
- package/docs/QTI_STRUCTURE.md +67 -18
- package/docs/SUPPORTED_INTERACTIONS.md +90 -5
- package/docs/_sidebar.md +0 -1
- package/node.d.ts +2 -0
- package/node.js +9 -0
- package/package.json +31 -28
- package/packages/cli/dist/batchProcessors-B8EQvMbH.js +2550 -0
- package/packages/cli/dist/batchProcessors-B8EQvMbH.js.map +1 -0
- package/packages/cli/dist/batchWorker.d.ts +1 -0
- package/packages/cli/dist/batchWorker.js +26 -0
- package/packages/cli/dist/batchWorker.js.map +1 -0
- package/packages/cli/dist/main.d.ts +1 -0
- package/packages/cli/dist/main.js +28254 -33706
- package/packages/cli/dist/main.js.map +1 -0
- package/packages/core/dist/index.d.ts +1022 -1071
- package/packages/core/dist/index.js +18678 -19178
- package/packages/core/dist/node.d.ts +2909 -0
- package/packages/core/dist/node.js +33011 -0
- package/docs/ROADMAP.md +0 -232
|
@@ -0,0 +1,2550 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import process$1 from "node:process";
|
|
3
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import { buildPackageFromActivity, convertActivity, convertQtiPackageToLearnosityBundle, ensureUniqueFolderName, loadLearnosityBundle, loadPackageDirectory, mergeActivityPackage, nodeFileAccess, sanitizeFolderName, saveQtiContentPackage, writeLearnosityBundle } from "@learnosity/converter-core/node";
|
|
7
|
+
import tty from "node:tty";
|
|
8
|
+
//#region \0rolldown/runtime.js
|
|
9
|
+
var __create = Object.create;
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
16
|
+
var __exportAll = (all, no_symbols) => {
|
|
17
|
+
let target = {};
|
|
18
|
+
for (var name in all) __defProp(target, name, {
|
|
19
|
+
get: all[name],
|
|
20
|
+
enumerable: true
|
|
21
|
+
});
|
|
22
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
23
|
+
return target;
|
|
24
|
+
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
27
|
+
key = keys[i];
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
29
|
+
get: ((k) => from[k]).bind(null, key),
|
|
30
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
36
|
+
value: mod,
|
|
37
|
+
enumerable: true
|
|
38
|
+
}) : target, mod));
|
|
39
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ../core/src/diagnostics/formatDiagnosticsReport.ts
|
|
42
|
+
/**
|
|
43
|
+
* Format diagnostics array into structured report with metadata
|
|
44
|
+
*/
|
|
45
|
+
function formatDiagnosticsReport(diagnostics, options) {
|
|
46
|
+
const { inputPath, outputPath, totalItemsFound, totalActivitiesFound = 0, convertedFiles, failedFiles, convertedActivities = [], failedActivities = [] } = options;
|
|
47
|
+
const infoIssues = diagnostics.filter((d) => d.level === "info").map((d) => ({
|
|
48
|
+
code: d.code,
|
|
49
|
+
message: d.message,
|
|
50
|
+
file: d.file
|
|
51
|
+
}));
|
|
52
|
+
const warningIssues = diagnostics.filter((d) => d.level === "warning").map((d) => ({
|
|
53
|
+
code: d.code,
|
|
54
|
+
message: d.message,
|
|
55
|
+
file: d.file
|
|
56
|
+
}));
|
|
57
|
+
const seenErrorFiles = /* @__PURE__ */ new Set();
|
|
58
|
+
const errorIssues = diagnostics.filter((d) => d.level === "error").reduce((acc, d) => {
|
|
59
|
+
if (!seenErrorFiles.has(d.file)) {
|
|
60
|
+
seenErrorFiles.add(d.file);
|
|
61
|
+
acc.push({
|
|
62
|
+
code: d.code,
|
|
63
|
+
message: d.message,
|
|
64
|
+
file: d.file
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return acc;
|
|
68
|
+
}, []);
|
|
69
|
+
return {
|
|
70
|
+
directory_input: inputPath,
|
|
71
|
+
directory_output: outputPath,
|
|
72
|
+
total_items_found: totalItemsFound,
|
|
73
|
+
total_items_processed: convertedFiles.length + failedFiles.length,
|
|
74
|
+
total_items_converted: convertedFiles.length,
|
|
75
|
+
total_items_failed: failedFiles.length,
|
|
76
|
+
total_activities_found: totalActivitiesFound,
|
|
77
|
+
total_activities_converted: convertedActivities.length,
|
|
78
|
+
total_activities_failed: failedActivities.length,
|
|
79
|
+
converted_items: convertedFiles,
|
|
80
|
+
failed_items: failedFiles,
|
|
81
|
+
converted_activities: convertedActivities,
|
|
82
|
+
failed_activities: failedActivities,
|
|
83
|
+
issues: {
|
|
84
|
+
errors: errorIssues,
|
|
85
|
+
info: infoIssues,
|
|
86
|
+
warnings: warningIssues
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/io/writeDiagnostics.ts
|
|
92
|
+
function formatDiagnosticsJson(diagnostics, options) {
|
|
93
|
+
if (options) {
|
|
94
|
+
const report = formatDiagnosticsReport(diagnostics, options);
|
|
95
|
+
return JSON.stringify(report, null, 2);
|
|
96
|
+
}
|
|
97
|
+
return JSON.stringify(diagnostics, null, 2);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Write diagnostics to file and/or stderr
|
|
101
|
+
* @param diagnostics - Diagnostics to write
|
|
102
|
+
* @param diagnosticsMode - Where to write diagnostics
|
|
103
|
+
* @param explicitPath - Explicit diagnostics file path (if user provided one)
|
|
104
|
+
* @param outputPath - Output file path (used to derive diagnostics path if no explicit path)
|
|
105
|
+
* @param verbose - Include verbose output
|
|
106
|
+
* @param options - Options for formatting the diagnostics report
|
|
107
|
+
*/
|
|
108
|
+
async function writeDiagnostics(diagnostics, diagnosticsMode, explicitPath, outputPath, verbose, options) {
|
|
109
|
+
const shouldWriteFile = diagnosticsMode === "file" || diagnosticsMode === "both";
|
|
110
|
+
const shouldWriteStderr = diagnosticsMode === "stderr" || diagnosticsMode === "both";
|
|
111
|
+
const json = formatDiagnosticsJson(diagnostics, options);
|
|
112
|
+
if (shouldWriteFile) {
|
|
113
|
+
const diagnosticsPath = explicitPath ?? getDiagnosticsPath(outputPath);
|
|
114
|
+
await mkdir(dirname(diagnosticsPath), { recursive: true });
|
|
115
|
+
await writeFile(diagnosticsPath, json, "utf-8");
|
|
116
|
+
}
|
|
117
|
+
if (shouldWriteStderr && verbose) {
|
|
118
|
+
process.stderr.write("\n--- Diagnostics JSON ---\n");
|
|
119
|
+
process.stderr.write(json);
|
|
120
|
+
process.stderr.write("\n");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get the path for diagnostics file
|
|
125
|
+
*/
|
|
126
|
+
function getDiagnosticsPath(outputPath) {
|
|
127
|
+
if (outputPath === "-") return join(process.cwd(), "diagnostics.json");
|
|
128
|
+
const dir = dirname(outputPath);
|
|
129
|
+
return join(dir, "diagnostics.json");
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region ../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js
|
|
133
|
+
var require_ansi_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
134
|
+
module.exports = ({ onlyFirst = false } = {}) => {
|
|
135
|
+
const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
|
|
136
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
137
|
+
};
|
|
138
|
+
}));
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region ../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js
|
|
141
|
+
var require_strip_ansi = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
142
|
+
const ansiRegex = require_ansi_regex();
|
|
143
|
+
module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
|
|
144
|
+
}));
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region ../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js
|
|
147
|
+
var require_is_fullwidth_code_point = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
148
|
+
const isFullwidthCodePoint = (codePoint) => {
|
|
149
|
+
if (Number.isNaN(codePoint)) return false;
|
|
150
|
+
if (codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || 12880 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65131 || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 262141)) return true;
|
|
151
|
+
return false;
|
|
152
|
+
};
|
|
153
|
+
module.exports = isFullwidthCodePoint;
|
|
154
|
+
module.exports.default = isFullwidthCodePoint;
|
|
155
|
+
}));
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region ../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js
|
|
158
|
+
var require_emoji_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
159
|
+
module.exports = function() {
|
|
160
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
161
|
+
};
|
|
162
|
+
}));
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region ../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js
|
|
165
|
+
var require_string_width = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
166
|
+
const stripAnsi = require_strip_ansi();
|
|
167
|
+
const isFullwidthCodePoint = require_is_fullwidth_code_point();
|
|
168
|
+
const emojiRegex = require_emoji_regex();
|
|
169
|
+
const stringWidth = (string) => {
|
|
170
|
+
if (typeof string !== "string" || string.length === 0) return 0;
|
|
171
|
+
string = stripAnsi(string);
|
|
172
|
+
if (string.length === 0) return 0;
|
|
173
|
+
string = string.replace(emojiRegex(), " ");
|
|
174
|
+
let width = 0;
|
|
175
|
+
for (let i = 0; i < string.length; i++) {
|
|
176
|
+
const code = string.codePointAt(i);
|
|
177
|
+
if (code <= 31 || code >= 127 && code <= 159) continue;
|
|
178
|
+
if (code >= 768 && code <= 879) continue;
|
|
179
|
+
if (code > 65535) i++;
|
|
180
|
+
width += isFullwidthCodePoint(code) ? 2 : 1;
|
|
181
|
+
}
|
|
182
|
+
return width;
|
|
183
|
+
};
|
|
184
|
+
module.exports = stringWidth;
|
|
185
|
+
module.exports.default = stringWidth;
|
|
186
|
+
}));
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/utilities.js
|
|
189
|
+
function stringReplaceAll(string, substring, postfix) {
|
|
190
|
+
let index = string.indexOf(substring);
|
|
191
|
+
if (index === -1) return string;
|
|
192
|
+
const substringLength = substring.length;
|
|
193
|
+
let endIndex = 0;
|
|
194
|
+
let returnValue = "";
|
|
195
|
+
do {
|
|
196
|
+
returnValue += string.slice(endIndex, index) + substring + postfix;
|
|
197
|
+
endIndex = index + substringLength;
|
|
198
|
+
index = string.indexOf(substring, endIndex);
|
|
199
|
+
} while (index !== -1);
|
|
200
|
+
returnValue += string.slice(endIndex);
|
|
201
|
+
return returnValue;
|
|
202
|
+
}
|
|
203
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
204
|
+
let endIndex = 0;
|
|
205
|
+
let returnValue = "";
|
|
206
|
+
do {
|
|
207
|
+
const isGotCR = string[index - 1] === "\r";
|
|
208
|
+
returnValue += string.slice(endIndex, isGotCR ? index - 1 : index) + prefix + (isGotCR ? "\r\n" : "\n") + postfix;
|
|
209
|
+
endIndex = index + 1;
|
|
210
|
+
index = string.indexOf("\n", endIndex);
|
|
211
|
+
} while (index !== -1);
|
|
212
|
+
returnValue += string.slice(endIndex);
|
|
213
|
+
return returnValue;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
217
|
+
const ANSI_BACKGROUND_OFFSET = 10;
|
|
218
|
+
const ANSI_UNDERLINE_OFFSET = 20;
|
|
219
|
+
const wrapAnsi16 = (offset = 0) => (code) => `\u{1B}[${code + offset}m`;
|
|
220
|
+
const wrapAnsi256 = (offset = 0) => (code) => `\u{1B}[${38 + offset};5;${code}m`;
|
|
221
|
+
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u{1B}[${38 + offset};2;${red};${green};${blue}m`;
|
|
222
|
+
const wrapUnderlineAnsi = (code) => `\u{1B}[58;5;${code < 90 ? code - 30 : code - 90 + 8}m`;
|
|
223
|
+
const styles$1 = {
|
|
224
|
+
modifier: {
|
|
225
|
+
reset: [0, 0],
|
|
226
|
+
bold: [1, 22],
|
|
227
|
+
dim: [2, 22],
|
|
228
|
+
italic: [3, 23],
|
|
229
|
+
underline: [4, 24],
|
|
230
|
+
underlineDouble: ["4:2", 24],
|
|
231
|
+
underlineCurly: ["4:3", 24],
|
|
232
|
+
underlineDotted: ["4:4", 24],
|
|
233
|
+
underlineDashed: ["4:5", 24],
|
|
234
|
+
overline: [53, 55],
|
|
235
|
+
inverse: [7, 27],
|
|
236
|
+
hidden: [8, 28],
|
|
237
|
+
strikethrough: [9, 29]
|
|
238
|
+
},
|
|
239
|
+
color: {
|
|
240
|
+
black: [30, 39],
|
|
241
|
+
red: [31, 39],
|
|
242
|
+
green: [32, 39],
|
|
243
|
+
yellow: [33, 39],
|
|
244
|
+
blue: [34, 39],
|
|
245
|
+
magenta: [35, 39],
|
|
246
|
+
cyan: [36, 39],
|
|
247
|
+
white: [37, 39],
|
|
248
|
+
blackBright: [90, 39],
|
|
249
|
+
gray: [90, 39],
|
|
250
|
+
grey: [90, 39],
|
|
251
|
+
redBright: [91, 39],
|
|
252
|
+
greenBright: [92, 39],
|
|
253
|
+
yellowBright: [93, 39],
|
|
254
|
+
blueBright: [94, 39],
|
|
255
|
+
magentaBright: [95, 39],
|
|
256
|
+
cyanBright: [96, 39],
|
|
257
|
+
whiteBright: [97, 39]
|
|
258
|
+
},
|
|
259
|
+
bgColor: {
|
|
260
|
+
bgBlack: [40, 49],
|
|
261
|
+
bgRed: [41, 49],
|
|
262
|
+
bgGreen: [42, 49],
|
|
263
|
+
bgYellow: [43, 49],
|
|
264
|
+
bgBlue: [44, 49],
|
|
265
|
+
bgMagenta: [45, 49],
|
|
266
|
+
bgCyan: [46, 49],
|
|
267
|
+
bgWhite: [47, 49],
|
|
268
|
+
bgBlackBright: [100, 49],
|
|
269
|
+
bgGray: [100, 49],
|
|
270
|
+
bgGrey: [100, 49],
|
|
271
|
+
bgRedBright: [101, 49],
|
|
272
|
+
bgGreenBright: [102, 49],
|
|
273
|
+
bgYellowBright: [103, 49],
|
|
274
|
+
bgBlueBright: [104, 49],
|
|
275
|
+
bgMagentaBright: [105, 49],
|
|
276
|
+
bgCyanBright: [106, 49],
|
|
277
|
+
bgWhiteBright: [107, 49]
|
|
278
|
+
},
|
|
279
|
+
underlineColor: {
|
|
280
|
+
underlineBlack: ["58;5;0", 59],
|
|
281
|
+
underlineRed: ["58;5;1", 59],
|
|
282
|
+
underlineGreen: ["58;5;2", 59],
|
|
283
|
+
underlineYellow: ["58;5;3", 59],
|
|
284
|
+
underlineBlue: ["58;5;4", 59],
|
|
285
|
+
underlineMagenta: ["58;5;5", 59],
|
|
286
|
+
underlineCyan: ["58;5;6", 59],
|
|
287
|
+
underlineWhite: ["58;5;7", 59],
|
|
288
|
+
underlineBlackBright: ["58;5;8", 59],
|
|
289
|
+
underlineGray: ["58;5;8", 59],
|
|
290
|
+
underlineGrey: ["58;5;8", 59],
|
|
291
|
+
underlineRedBright: ["58;5;9", 59],
|
|
292
|
+
underlineGreenBright: ["58;5;10", 59],
|
|
293
|
+
underlineYellowBright: ["58;5;11", 59],
|
|
294
|
+
underlineBlueBright: ["58;5;12", 59],
|
|
295
|
+
underlineMagentaBright: ["58;5;13", 59],
|
|
296
|
+
underlineCyanBright: ["58;5;14", 59],
|
|
297
|
+
underlineWhiteBright: ["58;5;15", 59]
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
Object.keys(styles$1.modifier);
|
|
301
|
+
const foregroundColorNames = Object.keys(styles$1.color);
|
|
302
|
+
const backgroundColorNames = Object.keys(styles$1.bgColor);
|
|
303
|
+
Object.keys(styles$1.underlineColor);
|
|
304
|
+
[...foregroundColorNames, ...backgroundColorNames];
|
|
305
|
+
function assembleStyles() {
|
|
306
|
+
const codes = /* @__PURE__ */ new Map();
|
|
307
|
+
for (const [groupName, group] of Object.entries(styles$1)) {
|
|
308
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
309
|
+
styles$1[styleName] = {
|
|
310
|
+
open: `\u{1B}[${style[0]}m`,
|
|
311
|
+
close: `\u{1B}[${style[1]}m`
|
|
312
|
+
};
|
|
313
|
+
group[styleName] = styles$1[styleName];
|
|
314
|
+
codes.set(Number.parseInt(style[0], 10), style[1]);
|
|
315
|
+
}
|
|
316
|
+
Object.defineProperty(styles$1, groupName, {
|
|
317
|
+
value: group,
|
|
318
|
+
enumerable: false
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
Object.defineProperty(styles$1, "codes", {
|
|
322
|
+
value: codes,
|
|
323
|
+
enumerable: false
|
|
324
|
+
});
|
|
325
|
+
styles$1.color.close = "\x1B[39m";
|
|
326
|
+
styles$1.bgColor.close = "\x1B[49m";
|
|
327
|
+
styles$1.underlineColor.close = "\x1B[59m";
|
|
328
|
+
styles$1.color.ansi = wrapAnsi16();
|
|
329
|
+
styles$1.color.ansi256 = wrapAnsi256();
|
|
330
|
+
styles$1.color.ansi16m = wrapAnsi16m();
|
|
331
|
+
styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
332
|
+
styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
333
|
+
styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
334
|
+
styles$1.underlineColor.ansi = wrapUnderlineAnsi;
|
|
335
|
+
styles$1.underlineColor.ansi256 = wrapAnsi256(ANSI_UNDERLINE_OFFSET);
|
|
336
|
+
styles$1.underlineColor.ansi16m = wrapAnsi16m(ANSI_UNDERLINE_OFFSET);
|
|
337
|
+
Object.defineProperties(styles$1, {
|
|
338
|
+
rgbToAnsi256: {
|
|
339
|
+
value(red, green, blue) {
|
|
340
|
+
if (red === green && green === blue) {
|
|
341
|
+
if (red < 8) return 16;
|
|
342
|
+
if (red > 248) return 231;
|
|
343
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
344
|
+
}
|
|
345
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
346
|
+
},
|
|
347
|
+
enumerable: false
|
|
348
|
+
},
|
|
349
|
+
hexToRgb: {
|
|
350
|
+
value(hex) {
|
|
351
|
+
const matches = /[\da-f]{6}|[\da-f]{3}/i.exec(hex.toString(16));
|
|
352
|
+
if (!matches) return [
|
|
353
|
+
0,
|
|
354
|
+
0,
|
|
355
|
+
0
|
|
356
|
+
];
|
|
357
|
+
let [colorString] = matches;
|
|
358
|
+
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
359
|
+
const integer = Number.parseInt(colorString, 16);
|
|
360
|
+
return [
|
|
361
|
+
integer >> 16 & 255,
|
|
362
|
+
integer >> 8 & 255,
|
|
363
|
+
integer & 255
|
|
364
|
+
];
|
|
365
|
+
},
|
|
366
|
+
enumerable: false
|
|
367
|
+
},
|
|
368
|
+
hexToAnsi256: {
|
|
369
|
+
value: (hex) => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
|
|
370
|
+
enumerable: false
|
|
371
|
+
},
|
|
372
|
+
ansi256ToAnsi: {
|
|
373
|
+
value(code) {
|
|
374
|
+
if (code < 8) return 30 + code;
|
|
375
|
+
if (code < 16) return 90 + (code - 8);
|
|
376
|
+
let red;
|
|
377
|
+
let green;
|
|
378
|
+
let blue;
|
|
379
|
+
if (code >= 232) {
|
|
380
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
381
|
+
green = red;
|
|
382
|
+
blue = red;
|
|
383
|
+
} else {
|
|
384
|
+
code -= 16;
|
|
385
|
+
const remainder = code % 36;
|
|
386
|
+
red = Math.floor(code / 36) / 5;
|
|
387
|
+
green = Math.floor(remainder / 6) / 5;
|
|
388
|
+
blue = remainder % 6 / 5;
|
|
389
|
+
}
|
|
390
|
+
const value = Math.max(red, green, blue) * 2;
|
|
391
|
+
if (value === 0) return 30;
|
|
392
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
393
|
+
if (value === 2) result += 60;
|
|
394
|
+
return result;
|
|
395
|
+
},
|
|
396
|
+
enumerable: false
|
|
397
|
+
},
|
|
398
|
+
rgbToAnsi: {
|
|
399
|
+
value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
|
|
400
|
+
enumerable: false
|
|
401
|
+
},
|
|
402
|
+
hexToAnsi: {
|
|
403
|
+
value: (hex) => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
|
|
404
|
+
enumerable: false
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
return styles$1;
|
|
408
|
+
}
|
|
409
|
+
const ansiStyles = assembleStyles();
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
412
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
|
|
413
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
414
|
+
const position = argv.indexOf(prefix + flag);
|
|
415
|
+
const terminatorPosition = argv.indexOf("--");
|
|
416
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
417
|
+
}
|
|
418
|
+
const { env } = process$1;
|
|
419
|
+
let flagForceColor;
|
|
420
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
421
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
422
|
+
function hasNumericForceColor() {
|
|
423
|
+
return /^\d+$/.test(env.FORCE_COLOR);
|
|
424
|
+
}
|
|
425
|
+
function envForceColor() {
|
|
426
|
+
if (!("FORCE_COLOR" in env)) return;
|
|
427
|
+
if (env.FORCE_COLOR === "false") return 0;
|
|
428
|
+
if (env.FORCE_COLOR === "true" || env.FORCE_COLOR.length === 0) return 1;
|
|
429
|
+
if (!hasNumericForceColor()) return;
|
|
430
|
+
return Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
431
|
+
}
|
|
432
|
+
function translateLevel(level) {
|
|
433
|
+
if (level === 0) return false;
|
|
434
|
+
return {
|
|
435
|
+
level,
|
|
436
|
+
hasBasic: true,
|
|
437
|
+
has256: level >= 2,
|
|
438
|
+
has16m: level >= 3
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
442
|
+
const noFlagForceColor = envForceColor();
|
|
443
|
+
if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
|
|
444
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
445
|
+
if (forceColor === 0) return 0;
|
|
446
|
+
if (sniffFlags) {
|
|
447
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
448
|
+
if (hasFlag("color=256")) return 2;
|
|
449
|
+
}
|
|
450
|
+
if (forceColor !== void 0 && hasNumericForceColor()) return forceColor;
|
|
451
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
|
|
452
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
453
|
+
const min = forceColor || 0;
|
|
454
|
+
if (env.TERM === "dumb") return min;
|
|
455
|
+
if (process$1.platform === "win32") {
|
|
456
|
+
const osRelease = os.release().split(".");
|
|
457
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
458
|
+
return 1;
|
|
459
|
+
}
|
|
460
|
+
if ("CI" in env) {
|
|
461
|
+
if ([
|
|
462
|
+
"GITHUB_ACTIONS",
|
|
463
|
+
"GITEA_ACTIONS",
|
|
464
|
+
"CIRCLECI"
|
|
465
|
+
].some((key) => key in env)) return 3;
|
|
466
|
+
if ([
|
|
467
|
+
"TRAVIS",
|
|
468
|
+
"APPVEYOR",
|
|
469
|
+
"GITLAB_CI",
|
|
470
|
+
"BUILDKITE",
|
|
471
|
+
"DRONE"
|
|
472
|
+
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
473
|
+
return min;
|
|
474
|
+
}
|
|
475
|
+
if ("TEAMCITY_VERSION" in env) return /^(?:9\.0*[1-9]\d*\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
476
|
+
if (env.COLORTERM === "truecolor") return 3;
|
|
477
|
+
if (env.TERM === "xterm-kitty") return 3;
|
|
478
|
+
if (env.TERM === "xterm-ghostty") return 3;
|
|
479
|
+
if (env.TERM === "wezterm") return 3;
|
|
480
|
+
if ("TERM_PROGRAM" in env) {
|
|
481
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".", 1)[0], 10);
|
|
482
|
+
switch (env.TERM_PROGRAM) {
|
|
483
|
+
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
484
|
+
case "Apple_Terminal": return 2;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
if (/-256(?:color)?$/i.test(env.TERM)) return 2;
|
|
488
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
489
|
+
if ("COLORTERM" in env) return 1;
|
|
490
|
+
return min;
|
|
491
|
+
}
|
|
492
|
+
function createSupportsColor(stream, options = {}) {
|
|
493
|
+
return translateLevel(_supportsColor(stream, {
|
|
494
|
+
streamIsTTY: stream && stream.isTTY,
|
|
495
|
+
...options
|
|
496
|
+
}));
|
|
497
|
+
}
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/index.js
|
|
500
|
+
const { stdout: stdoutColor, stderr: stderrColor } = {
|
|
501
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
502
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
503
|
+
};
|
|
504
|
+
const GENERATOR = Symbol("GENERATOR");
|
|
505
|
+
const STYLER = Symbol("STYLER");
|
|
506
|
+
const IS_EMPTY = Symbol("IS_EMPTY");
|
|
507
|
+
const LEVEL = Symbol("LEVEL");
|
|
508
|
+
const styles = Object.create(null);
|
|
509
|
+
const assertValidLevel = (level) => {
|
|
510
|
+
if (!Number.isSafeInteger(level) || level < 0 || level > 3) throw new Error("The `level` should be an integer from 0 to 3");
|
|
511
|
+
};
|
|
512
|
+
const levelDescriptor = {
|
|
513
|
+
enumerable: true,
|
|
514
|
+
get() {
|
|
515
|
+
return this[LEVEL];
|
|
516
|
+
},
|
|
517
|
+
set(level) {
|
|
518
|
+
assertValidLevel(level);
|
|
519
|
+
this[LEVEL] = level;
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
const applyOptions = (object, options = {}) => {
|
|
523
|
+
if (options.level !== void 0) assertValidLevel(options.level);
|
|
524
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
525
|
+
object[LEVEL] = options.level === void 0 ? colorLevel : options.level;
|
|
526
|
+
};
|
|
527
|
+
const chalkFactory = (options) => {
|
|
528
|
+
const chalk = (...strings) => strings.join(" ");
|
|
529
|
+
applyOptions(chalk, options);
|
|
530
|
+
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
531
|
+
return chalk;
|
|
532
|
+
};
|
|
533
|
+
function createChalk(options) {
|
|
534
|
+
return chalkFactory(options);
|
|
535
|
+
}
|
|
536
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
537
|
+
for (const [styleName, style] of Object.entries(ansiStyles)) styles[styleName] = { get() {
|
|
538
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
539
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
540
|
+
return builder;
|
|
541
|
+
} };
|
|
542
|
+
styles.visible = { get() {
|
|
543
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
544
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
545
|
+
return builder;
|
|
546
|
+
} };
|
|
547
|
+
const createModelConverters = (model, type) => {
|
|
548
|
+
const style = ansiStyles[type];
|
|
549
|
+
if (model === "rgb") {
|
|
550
|
+
const ansi = (red, green, blue) => style.ansi(ansiStyles.rgbToAnsi(red, green, blue));
|
|
551
|
+
const ansi256 = (red, green, blue) => style.ansi256(ansiStyles.rgbToAnsi256(red, green, blue));
|
|
552
|
+
return [
|
|
553
|
+
ansi,
|
|
554
|
+
ansi,
|
|
555
|
+
ansi256,
|
|
556
|
+
style.ansi16m
|
|
557
|
+
];
|
|
558
|
+
}
|
|
559
|
+
if (model === "hex") {
|
|
560
|
+
const ansi = (hex) => style.ansi(ansiStyles.hexToAnsi(hex));
|
|
561
|
+
const ansi256 = (hex) => style.ansi256(ansiStyles.hexToAnsi256(hex));
|
|
562
|
+
return [
|
|
563
|
+
ansi,
|
|
564
|
+
ansi,
|
|
565
|
+
ansi256,
|
|
566
|
+
(hex) => style.ansi16m(...ansiStyles.hexToRgb(hex))
|
|
567
|
+
];
|
|
568
|
+
}
|
|
569
|
+
const ansi = (code) => style.ansi(ansiStyles.ansi256ToAnsi(code));
|
|
570
|
+
return [
|
|
571
|
+
ansi,
|
|
572
|
+
ansi,
|
|
573
|
+
style.ansi256,
|
|
574
|
+
style.ansi256
|
|
575
|
+
];
|
|
576
|
+
};
|
|
577
|
+
for (const model of [
|
|
578
|
+
"rgb",
|
|
579
|
+
"hex",
|
|
580
|
+
"ansi256"
|
|
581
|
+
]) {
|
|
582
|
+
const capitalizedModel = model[0].toUpperCase() + model.slice(1);
|
|
583
|
+
for (const [styleName, type] of [
|
|
584
|
+
[model, "color"],
|
|
585
|
+
["bg" + capitalizedModel, "bgColor"],
|
|
586
|
+
["underline" + capitalizedModel, "underlineColor"]
|
|
587
|
+
]) {
|
|
588
|
+
const { close } = ansiStyles[type];
|
|
589
|
+
const converters = createModelConverters(model, type);
|
|
590
|
+
styles[styleName] = { get() {
|
|
591
|
+
const styleFunction = function(first, second, third) {
|
|
592
|
+
const open = converters[this.level](first, second, third);
|
|
593
|
+
return createBuilder(this, createStyler(open, close, this[STYLER]), this[IS_EMPTY]);
|
|
594
|
+
};
|
|
595
|
+
Object.defineProperty(this, styleName, { value: styleFunction });
|
|
596
|
+
return styleFunction;
|
|
597
|
+
} };
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
const proto = Object.defineProperties(() => {}, {
|
|
601
|
+
...styles,
|
|
602
|
+
level: {
|
|
603
|
+
enumerable: true,
|
|
604
|
+
get() {
|
|
605
|
+
return this[GENERATOR].level;
|
|
606
|
+
},
|
|
607
|
+
set(level) {
|
|
608
|
+
this[GENERATOR].level = level;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
const createStyler = (open, close, parent) => {
|
|
613
|
+
let openAll;
|
|
614
|
+
let closeAll;
|
|
615
|
+
if (parent === void 0) {
|
|
616
|
+
openAll = open;
|
|
617
|
+
closeAll = close;
|
|
618
|
+
} else {
|
|
619
|
+
openAll = parent.openAll + open;
|
|
620
|
+
closeAll = close + parent.closeAll;
|
|
621
|
+
}
|
|
622
|
+
return {
|
|
623
|
+
open,
|
|
624
|
+
close,
|
|
625
|
+
openAll,
|
|
626
|
+
closeAll,
|
|
627
|
+
parent
|
|
628
|
+
};
|
|
629
|
+
};
|
|
630
|
+
const createBuilder = (self, _styler, _isEmpty) => {
|
|
631
|
+
const builder = (...arguments_) => {
|
|
632
|
+
if (arguments_.length === 1) return applyStyle(builder, "" + arguments_[0]);
|
|
633
|
+
if (arguments_.length === 2) return applyStyle(builder, arguments_[0] + " " + arguments_[1]);
|
|
634
|
+
return applyStyle(builder, arguments_.join(" "));
|
|
635
|
+
};
|
|
636
|
+
Object.setPrototypeOf(builder, proto);
|
|
637
|
+
builder[GENERATOR] = self[GENERATOR] ?? self;
|
|
638
|
+
builder[STYLER] = _styler;
|
|
639
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
640
|
+
return builder;
|
|
641
|
+
};
|
|
642
|
+
const applyStyle = (self, string) => {
|
|
643
|
+
if (self[GENERATOR][LEVEL] <= 0 || !string) return self[IS_EMPTY] ? "" : string;
|
|
644
|
+
let styler = self[STYLER];
|
|
645
|
+
if (styler === void 0) return string;
|
|
646
|
+
const { openAll, closeAll } = styler;
|
|
647
|
+
if (string.includes("\x1B")) while (styler !== void 0) {
|
|
648
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
649
|
+
styler = styler.parent;
|
|
650
|
+
}
|
|
651
|
+
const lfIndex = string.indexOf("\n");
|
|
652
|
+
if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
653
|
+
return openAll + string + closeAll;
|
|
654
|
+
};
|
|
655
|
+
Object.defineProperties(createChalk.prototype, {
|
|
656
|
+
...styles,
|
|
657
|
+
level: levelDescriptor
|
|
658
|
+
});
|
|
659
|
+
const chalk = createChalk();
|
|
660
|
+
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
661
|
+
//#endregion
|
|
662
|
+
//#region ../../node_modules/.pnpm/cli-table3@0.6.5/node_modules/cli-table3/src/debug.js
|
|
663
|
+
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
664
|
+
let messages = [];
|
|
665
|
+
let level = 0;
|
|
666
|
+
const debug = (msg, min) => {
|
|
667
|
+
if (level >= min) messages.push(msg);
|
|
668
|
+
};
|
|
669
|
+
debug.WARN = 1;
|
|
670
|
+
debug.INFO = 2;
|
|
671
|
+
debug.DEBUG = 3;
|
|
672
|
+
debug.reset = () => {
|
|
673
|
+
messages = [];
|
|
674
|
+
};
|
|
675
|
+
debug.setDebugLevel = (v) => {
|
|
676
|
+
level = v;
|
|
677
|
+
};
|
|
678
|
+
debug.warn = (msg) => debug(msg, debug.WARN);
|
|
679
|
+
debug.info = (msg) => debug(msg, debug.INFO);
|
|
680
|
+
debug.debug = (msg) => debug(msg, debug.DEBUG);
|
|
681
|
+
debug.debugMessages = () => messages;
|
|
682
|
+
module.exports = debug;
|
|
683
|
+
}));
|
|
684
|
+
//#endregion
|
|
685
|
+
//#region ../../node_modules/.pnpm/cli-table3@0.6.5/node_modules/cli-table3/src/utils.js
|
|
686
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
687
|
+
const stringWidth = require_string_width();
|
|
688
|
+
function codeRegex(capture) {
|
|
689
|
+
return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g;
|
|
690
|
+
}
|
|
691
|
+
function strlen(str) {
|
|
692
|
+
let code = codeRegex();
|
|
693
|
+
return ("" + str).replace(code, "").split("\n").reduce(function(memo, s) {
|
|
694
|
+
return stringWidth(s) > memo ? stringWidth(s) : memo;
|
|
695
|
+
}, 0);
|
|
696
|
+
}
|
|
697
|
+
function repeat(str, times) {
|
|
698
|
+
return Array(times + 1).join(str);
|
|
699
|
+
}
|
|
700
|
+
function pad(str, len, pad, dir) {
|
|
701
|
+
let length = strlen(str);
|
|
702
|
+
if (len + 1 >= length) {
|
|
703
|
+
let padlen = len - length;
|
|
704
|
+
switch (dir) {
|
|
705
|
+
case "right":
|
|
706
|
+
str = repeat(pad, padlen) + str;
|
|
707
|
+
break;
|
|
708
|
+
case "center": {
|
|
709
|
+
let right = Math.ceil(padlen / 2);
|
|
710
|
+
str = repeat(pad, padlen - right) + str + repeat(pad, right);
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
default: str = str + repeat(pad, padlen);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
return str;
|
|
717
|
+
}
|
|
718
|
+
let codeCache = {};
|
|
719
|
+
function addToCodeCache(name, on, off) {
|
|
720
|
+
on = "\x1B[" + on + "m";
|
|
721
|
+
off = "\x1B[" + off + "m";
|
|
722
|
+
codeCache[on] = {
|
|
723
|
+
set: name,
|
|
724
|
+
to: true
|
|
725
|
+
};
|
|
726
|
+
codeCache[off] = {
|
|
727
|
+
set: name,
|
|
728
|
+
to: false
|
|
729
|
+
};
|
|
730
|
+
codeCache[name] = {
|
|
731
|
+
on,
|
|
732
|
+
off
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
addToCodeCache("bold", 1, 22);
|
|
736
|
+
addToCodeCache("italics", 3, 23);
|
|
737
|
+
addToCodeCache("underline", 4, 24);
|
|
738
|
+
addToCodeCache("inverse", 7, 27);
|
|
739
|
+
addToCodeCache("strikethrough", 9, 29);
|
|
740
|
+
function updateState(state, controlChars) {
|
|
741
|
+
let controlCode = controlChars[1] ? parseInt(controlChars[1].split(";")[0]) : 0;
|
|
742
|
+
if (controlCode >= 30 && controlCode <= 39 || controlCode >= 90 && controlCode <= 97) {
|
|
743
|
+
state.lastForegroundAdded = controlChars[0];
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
if (controlCode >= 40 && controlCode <= 49 || controlCode >= 100 && controlCode <= 107) {
|
|
747
|
+
state.lastBackgroundAdded = controlChars[0];
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
if (controlCode === 0) {
|
|
751
|
+
for (let i in state)
|
|
752
|
+
/* istanbul ignore else */
|
|
753
|
+
if (Object.prototype.hasOwnProperty.call(state, i)) delete state[i];
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
let info = codeCache[controlChars[0]];
|
|
757
|
+
if (info) state[info.set] = info.to;
|
|
758
|
+
}
|
|
759
|
+
function readState(line) {
|
|
760
|
+
let code = codeRegex(true);
|
|
761
|
+
let controlChars = code.exec(line);
|
|
762
|
+
let state = {};
|
|
763
|
+
while (controlChars !== null) {
|
|
764
|
+
updateState(state, controlChars);
|
|
765
|
+
controlChars = code.exec(line);
|
|
766
|
+
}
|
|
767
|
+
return state;
|
|
768
|
+
}
|
|
769
|
+
function unwindState(state, ret) {
|
|
770
|
+
let lastBackgroundAdded = state.lastBackgroundAdded;
|
|
771
|
+
let lastForegroundAdded = state.lastForegroundAdded;
|
|
772
|
+
delete state.lastBackgroundAdded;
|
|
773
|
+
delete state.lastForegroundAdded;
|
|
774
|
+
Object.keys(state).forEach(function(key) {
|
|
775
|
+
if (state[key]) ret += codeCache[key].off;
|
|
776
|
+
});
|
|
777
|
+
if (lastBackgroundAdded && lastBackgroundAdded != "\x1B[49m") ret += "\x1B[49m";
|
|
778
|
+
if (lastForegroundAdded && lastForegroundAdded != "\x1B[39m") ret += "\x1B[39m";
|
|
779
|
+
return ret;
|
|
780
|
+
}
|
|
781
|
+
function rewindState(state, ret) {
|
|
782
|
+
let lastBackgroundAdded = state.lastBackgroundAdded;
|
|
783
|
+
let lastForegroundAdded = state.lastForegroundAdded;
|
|
784
|
+
delete state.lastBackgroundAdded;
|
|
785
|
+
delete state.lastForegroundAdded;
|
|
786
|
+
Object.keys(state).forEach(function(key) {
|
|
787
|
+
if (state[key]) ret = codeCache[key].on + ret;
|
|
788
|
+
});
|
|
789
|
+
if (lastBackgroundAdded && lastBackgroundAdded != "\x1B[49m") ret = lastBackgroundAdded + ret;
|
|
790
|
+
if (lastForegroundAdded && lastForegroundAdded != "\x1B[39m") ret = lastForegroundAdded + ret;
|
|
791
|
+
return ret;
|
|
792
|
+
}
|
|
793
|
+
function truncateWidth(str, desiredLength) {
|
|
794
|
+
if (str.length === strlen(str)) return str.substr(0, desiredLength);
|
|
795
|
+
while (strlen(str) > desiredLength) str = str.slice(0, -1);
|
|
796
|
+
return str;
|
|
797
|
+
}
|
|
798
|
+
function truncateWidthWithAnsi(str, desiredLength) {
|
|
799
|
+
let code = codeRegex(true);
|
|
800
|
+
let split = str.split(codeRegex());
|
|
801
|
+
let splitIndex = 0;
|
|
802
|
+
let retLen = 0;
|
|
803
|
+
let ret = "";
|
|
804
|
+
let myArray;
|
|
805
|
+
let state = {};
|
|
806
|
+
while (retLen < desiredLength) {
|
|
807
|
+
myArray = code.exec(str);
|
|
808
|
+
let toAdd = split[splitIndex];
|
|
809
|
+
splitIndex++;
|
|
810
|
+
if (retLen + strlen(toAdd) > desiredLength) toAdd = truncateWidth(toAdd, desiredLength - retLen);
|
|
811
|
+
ret += toAdd;
|
|
812
|
+
retLen += strlen(toAdd);
|
|
813
|
+
if (retLen < desiredLength) {
|
|
814
|
+
if (!myArray) break;
|
|
815
|
+
ret += myArray[0];
|
|
816
|
+
updateState(state, myArray);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
return unwindState(state, ret);
|
|
820
|
+
}
|
|
821
|
+
function truncate(str, desiredLength, truncateChar) {
|
|
822
|
+
truncateChar = truncateChar || "…";
|
|
823
|
+
if (strlen(str) <= desiredLength) return str;
|
|
824
|
+
desiredLength -= strlen(truncateChar);
|
|
825
|
+
let ret = truncateWidthWithAnsi(str, desiredLength);
|
|
826
|
+
ret += truncateChar;
|
|
827
|
+
const hrefTag = "\x1B]8;;\x07";
|
|
828
|
+
if (str.includes(hrefTag) && !ret.includes(hrefTag)) ret += hrefTag;
|
|
829
|
+
return ret;
|
|
830
|
+
}
|
|
831
|
+
function defaultOptions() {
|
|
832
|
+
return {
|
|
833
|
+
chars: {
|
|
834
|
+
top: "─",
|
|
835
|
+
"top-mid": "┬",
|
|
836
|
+
"top-left": "┌",
|
|
837
|
+
"top-right": "┐",
|
|
838
|
+
bottom: "─",
|
|
839
|
+
"bottom-mid": "┴",
|
|
840
|
+
"bottom-left": "└",
|
|
841
|
+
"bottom-right": "┘",
|
|
842
|
+
left: "│",
|
|
843
|
+
"left-mid": "├",
|
|
844
|
+
mid: "─",
|
|
845
|
+
"mid-mid": "┼",
|
|
846
|
+
right: "│",
|
|
847
|
+
"right-mid": "┤",
|
|
848
|
+
middle: "│"
|
|
849
|
+
},
|
|
850
|
+
truncate: "…",
|
|
851
|
+
colWidths: [],
|
|
852
|
+
rowHeights: [],
|
|
853
|
+
colAligns: [],
|
|
854
|
+
rowAligns: [],
|
|
855
|
+
style: {
|
|
856
|
+
"padding-left": 1,
|
|
857
|
+
"padding-right": 1,
|
|
858
|
+
head: ["red"],
|
|
859
|
+
border: ["grey"],
|
|
860
|
+
compact: false
|
|
861
|
+
},
|
|
862
|
+
head: []
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
function mergeOptions(options, defaults) {
|
|
866
|
+
options = options || {};
|
|
867
|
+
defaults = defaults || defaultOptions();
|
|
868
|
+
let ret = Object.assign({}, defaults, options);
|
|
869
|
+
ret.chars = Object.assign({}, defaults.chars, options.chars);
|
|
870
|
+
ret.style = Object.assign({}, defaults.style, options.style);
|
|
871
|
+
return ret;
|
|
872
|
+
}
|
|
873
|
+
function wordWrap(maxLength, input) {
|
|
874
|
+
let lines = [];
|
|
875
|
+
let split = input.split(/(\s+)/g);
|
|
876
|
+
let line = [];
|
|
877
|
+
let lineLength = 0;
|
|
878
|
+
let whitespace;
|
|
879
|
+
for (let i = 0; i < split.length; i += 2) {
|
|
880
|
+
let word = split[i];
|
|
881
|
+
let newLength = lineLength + strlen(word);
|
|
882
|
+
if (lineLength > 0 && whitespace) newLength += whitespace.length;
|
|
883
|
+
if (newLength > maxLength) {
|
|
884
|
+
if (lineLength !== 0) lines.push(line.join(""));
|
|
885
|
+
line = [word];
|
|
886
|
+
lineLength = strlen(word);
|
|
887
|
+
} else {
|
|
888
|
+
line.push(whitespace || "", word);
|
|
889
|
+
lineLength = newLength;
|
|
890
|
+
}
|
|
891
|
+
whitespace = split[i + 1];
|
|
892
|
+
}
|
|
893
|
+
if (lineLength) lines.push(line.join(""));
|
|
894
|
+
return lines;
|
|
895
|
+
}
|
|
896
|
+
function textWrap(maxLength, input) {
|
|
897
|
+
let lines = [];
|
|
898
|
+
let line = "";
|
|
899
|
+
function pushLine(str, ws) {
|
|
900
|
+
if (line.length && ws) line += ws;
|
|
901
|
+
line += str;
|
|
902
|
+
while (line.length > maxLength) {
|
|
903
|
+
lines.push(line.slice(0, maxLength));
|
|
904
|
+
line = line.slice(maxLength);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
let split = input.split(/(\s+)/g);
|
|
908
|
+
for (let i = 0; i < split.length; i += 2) pushLine(split[i], i && split[i - 1]);
|
|
909
|
+
if (line.length) lines.push(line);
|
|
910
|
+
return lines;
|
|
911
|
+
}
|
|
912
|
+
function multiLineWordWrap(maxLength, input, wrapOnWordBoundary = true) {
|
|
913
|
+
let output = [];
|
|
914
|
+
input = input.split("\n");
|
|
915
|
+
const handler = wrapOnWordBoundary ? wordWrap : textWrap;
|
|
916
|
+
for (let i = 0; i < input.length; i++) output.push.apply(output, handler(maxLength, input[i]));
|
|
917
|
+
return output;
|
|
918
|
+
}
|
|
919
|
+
function colorizeLines(input) {
|
|
920
|
+
let state = {};
|
|
921
|
+
let output = [];
|
|
922
|
+
for (let i = 0; i < input.length; i++) {
|
|
923
|
+
let line = rewindState(state, input[i]);
|
|
924
|
+
state = readState(line);
|
|
925
|
+
let temp = Object.assign({}, state);
|
|
926
|
+
output.push(unwindState(temp, line));
|
|
927
|
+
}
|
|
928
|
+
return output;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Credit: Matheus Sampaio https://github.com/matheussampaio
|
|
932
|
+
*/
|
|
933
|
+
function hyperlink(url, text) {
|
|
934
|
+
const OSC = "\x1B]";
|
|
935
|
+
const BEL = "\x07";
|
|
936
|
+
const SEP = ";";
|
|
937
|
+
return [
|
|
938
|
+
OSC,
|
|
939
|
+
"8",
|
|
940
|
+
SEP,
|
|
941
|
+
SEP,
|
|
942
|
+
url || text,
|
|
943
|
+
BEL,
|
|
944
|
+
text,
|
|
945
|
+
OSC,
|
|
946
|
+
"8",
|
|
947
|
+
SEP,
|
|
948
|
+
SEP,
|
|
949
|
+
BEL
|
|
950
|
+
].join("");
|
|
951
|
+
}
|
|
952
|
+
module.exports = {
|
|
953
|
+
strlen,
|
|
954
|
+
repeat,
|
|
955
|
+
pad,
|
|
956
|
+
truncate,
|
|
957
|
+
mergeOptions,
|
|
958
|
+
wordWrap: multiLineWordWrap,
|
|
959
|
+
colorizeLines,
|
|
960
|
+
hyperlink
|
|
961
|
+
};
|
|
962
|
+
}));
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/styles.js
|
|
965
|
+
var require_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
966
|
+
var styles = {};
|
|
967
|
+
module["exports"] = styles;
|
|
968
|
+
var codes = {
|
|
969
|
+
reset: [0, 0],
|
|
970
|
+
bold: [1, 22],
|
|
971
|
+
dim: [2, 22],
|
|
972
|
+
italic: [3, 23],
|
|
973
|
+
underline: [4, 24],
|
|
974
|
+
inverse: [7, 27],
|
|
975
|
+
hidden: [8, 28],
|
|
976
|
+
strikethrough: [9, 29],
|
|
977
|
+
black: [30, 39],
|
|
978
|
+
red: [31, 39],
|
|
979
|
+
green: [32, 39],
|
|
980
|
+
yellow: [33, 39],
|
|
981
|
+
blue: [34, 39],
|
|
982
|
+
magenta: [35, 39],
|
|
983
|
+
cyan: [36, 39],
|
|
984
|
+
white: [37, 39],
|
|
985
|
+
gray: [90, 39],
|
|
986
|
+
grey: [90, 39],
|
|
987
|
+
brightRed: [91, 39],
|
|
988
|
+
brightGreen: [92, 39],
|
|
989
|
+
brightYellow: [93, 39],
|
|
990
|
+
brightBlue: [94, 39],
|
|
991
|
+
brightMagenta: [95, 39],
|
|
992
|
+
brightCyan: [96, 39],
|
|
993
|
+
brightWhite: [97, 39],
|
|
994
|
+
bgBlack: [40, 49],
|
|
995
|
+
bgRed: [41, 49],
|
|
996
|
+
bgGreen: [42, 49],
|
|
997
|
+
bgYellow: [43, 49],
|
|
998
|
+
bgBlue: [44, 49],
|
|
999
|
+
bgMagenta: [45, 49],
|
|
1000
|
+
bgCyan: [46, 49],
|
|
1001
|
+
bgWhite: [47, 49],
|
|
1002
|
+
bgGray: [100, 49],
|
|
1003
|
+
bgGrey: [100, 49],
|
|
1004
|
+
bgBrightRed: [101, 49],
|
|
1005
|
+
bgBrightGreen: [102, 49],
|
|
1006
|
+
bgBrightYellow: [103, 49],
|
|
1007
|
+
bgBrightBlue: [104, 49],
|
|
1008
|
+
bgBrightMagenta: [105, 49],
|
|
1009
|
+
bgBrightCyan: [106, 49],
|
|
1010
|
+
bgBrightWhite: [107, 49],
|
|
1011
|
+
blackBG: [40, 49],
|
|
1012
|
+
redBG: [41, 49],
|
|
1013
|
+
greenBG: [42, 49],
|
|
1014
|
+
yellowBG: [43, 49],
|
|
1015
|
+
blueBG: [44, 49],
|
|
1016
|
+
magentaBG: [45, 49],
|
|
1017
|
+
cyanBG: [46, 49],
|
|
1018
|
+
whiteBG: [47, 49]
|
|
1019
|
+
};
|
|
1020
|
+
Object.keys(codes).forEach(function(key) {
|
|
1021
|
+
var val = codes[key];
|
|
1022
|
+
var style = styles[key] = [];
|
|
1023
|
+
style.open = "\x1B[" + val[0] + "m";
|
|
1024
|
+
style.close = "\x1B[" + val[1] + "m";
|
|
1025
|
+
});
|
|
1026
|
+
}));
|
|
1027
|
+
//#endregion
|
|
1028
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/has-flag.js
|
|
1029
|
+
var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1030
|
+
module.exports = function(flag, argv) {
|
|
1031
|
+
argv = argv || process.argv;
|
|
1032
|
+
var terminatorPos = argv.indexOf("--");
|
|
1033
|
+
var prefix = /^-{1,2}/.test(flag) ? "" : "--";
|
|
1034
|
+
var pos = argv.indexOf(prefix + flag);
|
|
1035
|
+
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
|
1036
|
+
};
|
|
1037
|
+
}));
|
|
1038
|
+
//#endregion
|
|
1039
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/supports-colors.js
|
|
1040
|
+
var require_supports_colors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1041
|
+
var os$1 = __require("os");
|
|
1042
|
+
var hasFlag = require_has_flag();
|
|
1043
|
+
var env = process.env;
|
|
1044
|
+
var forceColor = void 0;
|
|
1045
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) forceColor = false;
|
|
1046
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = true;
|
|
1047
|
+
if ("FORCE_COLOR" in env) forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
|
|
1048
|
+
function translateLevel(level) {
|
|
1049
|
+
if (level === 0) return false;
|
|
1050
|
+
return {
|
|
1051
|
+
level,
|
|
1052
|
+
hasBasic: true,
|
|
1053
|
+
has256: level >= 2,
|
|
1054
|
+
has16m: level >= 3
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
function supportsColor(stream) {
|
|
1058
|
+
if (forceColor === false) return 0;
|
|
1059
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
1060
|
+
if (hasFlag("color=256")) return 2;
|
|
1061
|
+
if (stream && !stream.isTTY && forceColor !== true) return 0;
|
|
1062
|
+
var min = forceColor ? 1 : 0;
|
|
1063
|
+
if (process.platform === "win32") {
|
|
1064
|
+
var osRelease = os$1.release().split(".");
|
|
1065
|
+
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1066
|
+
return 1;
|
|
1067
|
+
}
|
|
1068
|
+
if ("CI" in env) {
|
|
1069
|
+
if ([
|
|
1070
|
+
"TRAVIS",
|
|
1071
|
+
"CIRCLECI",
|
|
1072
|
+
"APPVEYOR",
|
|
1073
|
+
"GITLAB_CI"
|
|
1074
|
+
].some(function(sign) {
|
|
1075
|
+
return sign in env;
|
|
1076
|
+
}) || env.CI_NAME === "codeship") return 1;
|
|
1077
|
+
return min;
|
|
1078
|
+
}
|
|
1079
|
+
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1080
|
+
if ("TERM_PROGRAM" in env) {
|
|
1081
|
+
var version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
1082
|
+
switch (env.TERM_PROGRAM) {
|
|
1083
|
+
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
1084
|
+
case "Hyper": return 3;
|
|
1085
|
+
case "Apple_Terminal": return 2;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
1089
|
+
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
1090
|
+
if ("COLORTERM" in env) return 1;
|
|
1091
|
+
if (env.TERM === "dumb") return min;
|
|
1092
|
+
return min;
|
|
1093
|
+
}
|
|
1094
|
+
function getSupportLevel(stream) {
|
|
1095
|
+
return translateLevel(supportsColor(stream));
|
|
1096
|
+
}
|
|
1097
|
+
module.exports = {
|
|
1098
|
+
supportsColor: getSupportLevel,
|
|
1099
|
+
stdout: getSupportLevel(process.stdout),
|
|
1100
|
+
stderr: getSupportLevel(process.stderr)
|
|
1101
|
+
};
|
|
1102
|
+
}));
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/trap.js
|
|
1105
|
+
var require_trap = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1106
|
+
module["exports"] = function runTheTrap(text, options) {
|
|
1107
|
+
var result = "";
|
|
1108
|
+
text = text || "Run the trap, drop the bass";
|
|
1109
|
+
text = text.split("");
|
|
1110
|
+
var trap = {
|
|
1111
|
+
a: [
|
|
1112
|
+
"@",
|
|
1113
|
+
"Ą",
|
|
1114
|
+
"Ⱥ",
|
|
1115
|
+
"Ʌ",
|
|
1116
|
+
"Δ",
|
|
1117
|
+
"Λ",
|
|
1118
|
+
"Д"
|
|
1119
|
+
],
|
|
1120
|
+
b: [
|
|
1121
|
+
"ß",
|
|
1122
|
+
"Ɓ",
|
|
1123
|
+
"Ƀ",
|
|
1124
|
+
"ɮ",
|
|
1125
|
+
"β",
|
|
1126
|
+
"฿"
|
|
1127
|
+
],
|
|
1128
|
+
c: [
|
|
1129
|
+
"©",
|
|
1130
|
+
"Ȼ",
|
|
1131
|
+
"Ͼ"
|
|
1132
|
+
],
|
|
1133
|
+
d: [
|
|
1134
|
+
"Ð",
|
|
1135
|
+
"Ɗ",
|
|
1136
|
+
"Ԁ",
|
|
1137
|
+
"ԁ",
|
|
1138
|
+
"Ԃ",
|
|
1139
|
+
"ԃ"
|
|
1140
|
+
],
|
|
1141
|
+
e: [
|
|
1142
|
+
"Ë",
|
|
1143
|
+
"ĕ",
|
|
1144
|
+
"Ǝ",
|
|
1145
|
+
"ɘ",
|
|
1146
|
+
"Σ",
|
|
1147
|
+
"ξ",
|
|
1148
|
+
"Ҽ",
|
|
1149
|
+
"੬"
|
|
1150
|
+
],
|
|
1151
|
+
f: ["Ӻ"],
|
|
1152
|
+
g: ["ɢ"],
|
|
1153
|
+
h: [
|
|
1154
|
+
"Ħ",
|
|
1155
|
+
"ƕ",
|
|
1156
|
+
"Ң",
|
|
1157
|
+
"Һ",
|
|
1158
|
+
"Ӈ",
|
|
1159
|
+
"Ԋ"
|
|
1160
|
+
],
|
|
1161
|
+
i: ["༏"],
|
|
1162
|
+
j: ["Ĵ"],
|
|
1163
|
+
k: [
|
|
1164
|
+
"ĸ",
|
|
1165
|
+
"Ҡ",
|
|
1166
|
+
"Ӄ",
|
|
1167
|
+
"Ԟ"
|
|
1168
|
+
],
|
|
1169
|
+
l: ["Ĺ"],
|
|
1170
|
+
m: [
|
|
1171
|
+
"ʍ",
|
|
1172
|
+
"Ӎ",
|
|
1173
|
+
"ӎ",
|
|
1174
|
+
"Ԡ",
|
|
1175
|
+
"ԡ",
|
|
1176
|
+
"൩"
|
|
1177
|
+
],
|
|
1178
|
+
n: [
|
|
1179
|
+
"Ñ",
|
|
1180
|
+
"ŋ",
|
|
1181
|
+
"Ɲ",
|
|
1182
|
+
"Ͷ",
|
|
1183
|
+
"Π",
|
|
1184
|
+
"Ҋ"
|
|
1185
|
+
],
|
|
1186
|
+
o: [
|
|
1187
|
+
"Ø",
|
|
1188
|
+
"õ",
|
|
1189
|
+
"ø",
|
|
1190
|
+
"Ǿ",
|
|
1191
|
+
"ʘ",
|
|
1192
|
+
"Ѻ",
|
|
1193
|
+
"ם",
|
|
1194
|
+
"",
|
|
1195
|
+
"๏"
|
|
1196
|
+
],
|
|
1197
|
+
p: ["Ƿ", "Ҏ"],
|
|
1198
|
+
q: ["্"],
|
|
1199
|
+
r: [
|
|
1200
|
+
"®",
|
|
1201
|
+
"Ʀ",
|
|
1202
|
+
"Ȑ",
|
|
1203
|
+
"Ɍ",
|
|
1204
|
+
"ʀ",
|
|
1205
|
+
"Я"
|
|
1206
|
+
],
|
|
1207
|
+
s: [
|
|
1208
|
+
"§",
|
|
1209
|
+
"Ϟ",
|
|
1210
|
+
"ϟ",
|
|
1211
|
+
"Ϩ"
|
|
1212
|
+
],
|
|
1213
|
+
t: [
|
|
1214
|
+
"Ł",
|
|
1215
|
+
"Ŧ",
|
|
1216
|
+
"ͳ"
|
|
1217
|
+
],
|
|
1218
|
+
u: ["Ʊ", "Ս"],
|
|
1219
|
+
v: ["ט"],
|
|
1220
|
+
w: [
|
|
1221
|
+
"Ш",
|
|
1222
|
+
"Ѡ",
|
|
1223
|
+
"Ѽ",
|
|
1224
|
+
"൰"
|
|
1225
|
+
],
|
|
1226
|
+
x: [
|
|
1227
|
+
"Ҳ",
|
|
1228
|
+
"Ӿ",
|
|
1229
|
+
"Ӽ",
|
|
1230
|
+
"ӽ"
|
|
1231
|
+
],
|
|
1232
|
+
y: [
|
|
1233
|
+
"¥",
|
|
1234
|
+
"Ұ",
|
|
1235
|
+
"Ӌ"
|
|
1236
|
+
],
|
|
1237
|
+
z: ["Ƶ", "ɀ"]
|
|
1238
|
+
};
|
|
1239
|
+
text.forEach(function(c) {
|
|
1240
|
+
c = c.toLowerCase();
|
|
1241
|
+
var chars = trap[c] || [" "];
|
|
1242
|
+
var rand = Math.floor(Math.random() * chars.length);
|
|
1243
|
+
if (typeof trap[c] !== "undefined") result += trap[c][rand];
|
|
1244
|
+
else result += c;
|
|
1245
|
+
});
|
|
1246
|
+
return result;
|
|
1247
|
+
};
|
|
1248
|
+
}));
|
|
1249
|
+
//#endregion
|
|
1250
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/zalgo.js
|
|
1251
|
+
var require_zalgo = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1252
|
+
module["exports"] = function zalgo(text, options) {
|
|
1253
|
+
text = text || " he is here ";
|
|
1254
|
+
var soul = {
|
|
1255
|
+
"up": [
|
|
1256
|
+
"̍",
|
|
1257
|
+
"̎",
|
|
1258
|
+
"̄",
|
|
1259
|
+
"̅",
|
|
1260
|
+
"̿",
|
|
1261
|
+
"̑",
|
|
1262
|
+
"̆",
|
|
1263
|
+
"̐",
|
|
1264
|
+
"͒",
|
|
1265
|
+
"͗",
|
|
1266
|
+
"͑",
|
|
1267
|
+
"̇",
|
|
1268
|
+
"̈",
|
|
1269
|
+
"̊",
|
|
1270
|
+
"͂",
|
|
1271
|
+
"̓",
|
|
1272
|
+
"̈",
|
|
1273
|
+
"͊",
|
|
1274
|
+
"͋",
|
|
1275
|
+
"͌",
|
|
1276
|
+
"̃",
|
|
1277
|
+
"̂",
|
|
1278
|
+
"̌",
|
|
1279
|
+
"͐",
|
|
1280
|
+
"̀",
|
|
1281
|
+
"́",
|
|
1282
|
+
"̋",
|
|
1283
|
+
"̏",
|
|
1284
|
+
"̒",
|
|
1285
|
+
"̓",
|
|
1286
|
+
"̔",
|
|
1287
|
+
"̽",
|
|
1288
|
+
"̉",
|
|
1289
|
+
"ͣ",
|
|
1290
|
+
"ͤ",
|
|
1291
|
+
"ͥ",
|
|
1292
|
+
"ͦ",
|
|
1293
|
+
"ͧ",
|
|
1294
|
+
"ͨ",
|
|
1295
|
+
"ͩ",
|
|
1296
|
+
"ͪ",
|
|
1297
|
+
"ͫ",
|
|
1298
|
+
"ͬ",
|
|
1299
|
+
"ͭ",
|
|
1300
|
+
"ͮ",
|
|
1301
|
+
"ͯ",
|
|
1302
|
+
"̾",
|
|
1303
|
+
"͛",
|
|
1304
|
+
"͆",
|
|
1305
|
+
"̚"
|
|
1306
|
+
],
|
|
1307
|
+
"down": [
|
|
1308
|
+
"̖",
|
|
1309
|
+
"̗",
|
|
1310
|
+
"̘",
|
|
1311
|
+
"̙",
|
|
1312
|
+
"̜",
|
|
1313
|
+
"̝",
|
|
1314
|
+
"̞",
|
|
1315
|
+
"̟",
|
|
1316
|
+
"̠",
|
|
1317
|
+
"̤",
|
|
1318
|
+
"̥",
|
|
1319
|
+
"̦",
|
|
1320
|
+
"̩",
|
|
1321
|
+
"̪",
|
|
1322
|
+
"̫",
|
|
1323
|
+
"̬",
|
|
1324
|
+
"̭",
|
|
1325
|
+
"̮",
|
|
1326
|
+
"̯",
|
|
1327
|
+
"̰",
|
|
1328
|
+
"̱",
|
|
1329
|
+
"̲",
|
|
1330
|
+
"̳",
|
|
1331
|
+
"̹",
|
|
1332
|
+
"̺",
|
|
1333
|
+
"̻",
|
|
1334
|
+
"̼",
|
|
1335
|
+
"ͅ",
|
|
1336
|
+
"͇",
|
|
1337
|
+
"͈",
|
|
1338
|
+
"͉",
|
|
1339
|
+
"͍",
|
|
1340
|
+
"͎",
|
|
1341
|
+
"͓",
|
|
1342
|
+
"͔",
|
|
1343
|
+
"͕",
|
|
1344
|
+
"͖",
|
|
1345
|
+
"͙",
|
|
1346
|
+
"͚",
|
|
1347
|
+
"̣"
|
|
1348
|
+
],
|
|
1349
|
+
"mid": [
|
|
1350
|
+
"̕",
|
|
1351
|
+
"̛",
|
|
1352
|
+
"̀",
|
|
1353
|
+
"́",
|
|
1354
|
+
"͘",
|
|
1355
|
+
"̡",
|
|
1356
|
+
"̢",
|
|
1357
|
+
"̧",
|
|
1358
|
+
"̨",
|
|
1359
|
+
"̴",
|
|
1360
|
+
"̵",
|
|
1361
|
+
"̶",
|
|
1362
|
+
"͜",
|
|
1363
|
+
"͝",
|
|
1364
|
+
"͞",
|
|
1365
|
+
"͟",
|
|
1366
|
+
"͠",
|
|
1367
|
+
"͢",
|
|
1368
|
+
"̸",
|
|
1369
|
+
"̷",
|
|
1370
|
+
"͡",
|
|
1371
|
+
" ҉"
|
|
1372
|
+
]
|
|
1373
|
+
};
|
|
1374
|
+
var all = [].concat(soul.up, soul.down, soul.mid);
|
|
1375
|
+
function randomNumber(range) {
|
|
1376
|
+
return Math.floor(Math.random() * range);
|
|
1377
|
+
}
|
|
1378
|
+
function isChar(character) {
|
|
1379
|
+
var bool = false;
|
|
1380
|
+
all.filter(function(i) {
|
|
1381
|
+
bool = i === character;
|
|
1382
|
+
});
|
|
1383
|
+
return bool;
|
|
1384
|
+
}
|
|
1385
|
+
function heComes(text, options) {
|
|
1386
|
+
var result = "";
|
|
1387
|
+
var counts;
|
|
1388
|
+
var l;
|
|
1389
|
+
options = options || {};
|
|
1390
|
+
options["up"] = typeof options["up"] !== "undefined" ? options["up"] : true;
|
|
1391
|
+
options["mid"] = typeof options["mid"] !== "undefined" ? options["mid"] : true;
|
|
1392
|
+
options["down"] = typeof options["down"] !== "undefined" ? options["down"] : true;
|
|
1393
|
+
options["size"] = typeof options["size"] !== "undefined" ? options["size"] : "maxi";
|
|
1394
|
+
text = text.split("");
|
|
1395
|
+
for (l in text) {
|
|
1396
|
+
if (isChar(l)) continue;
|
|
1397
|
+
result = result + text[l];
|
|
1398
|
+
counts = {
|
|
1399
|
+
"up": 0,
|
|
1400
|
+
"down": 0,
|
|
1401
|
+
"mid": 0
|
|
1402
|
+
};
|
|
1403
|
+
switch (options.size) {
|
|
1404
|
+
case "mini":
|
|
1405
|
+
counts.up = randomNumber(8);
|
|
1406
|
+
counts.mid = randomNumber(2);
|
|
1407
|
+
counts.down = randomNumber(8);
|
|
1408
|
+
break;
|
|
1409
|
+
case "maxi":
|
|
1410
|
+
counts.up = randomNumber(16) + 3;
|
|
1411
|
+
counts.mid = randomNumber(4) + 1;
|
|
1412
|
+
counts.down = randomNumber(64) + 3;
|
|
1413
|
+
break;
|
|
1414
|
+
default:
|
|
1415
|
+
counts.up = randomNumber(8) + 1;
|
|
1416
|
+
counts.mid = randomNumber(6) / 2;
|
|
1417
|
+
counts.down = randomNumber(8) + 1;
|
|
1418
|
+
}
|
|
1419
|
+
var arr = [
|
|
1420
|
+
"up",
|
|
1421
|
+
"mid",
|
|
1422
|
+
"down"
|
|
1423
|
+
];
|
|
1424
|
+
for (var d in arr) {
|
|
1425
|
+
var index = arr[d];
|
|
1426
|
+
for (var i = 0; i <= counts[index]; i++) if (options[index]) result = result + soul[index][randomNumber(soul[index].length)];
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
return result;
|
|
1430
|
+
}
|
|
1431
|
+
return heComes(text, options);
|
|
1432
|
+
};
|
|
1433
|
+
}));
|
|
1434
|
+
//#endregion
|
|
1435
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/america.js
|
|
1436
|
+
var require_america = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1437
|
+
module["exports"] = function(colors) {
|
|
1438
|
+
return function(letter, i, exploded) {
|
|
1439
|
+
if (letter === " ") return letter;
|
|
1440
|
+
switch (i % 3) {
|
|
1441
|
+
case 0: return colors.red(letter);
|
|
1442
|
+
case 1: return colors.white(letter);
|
|
1443
|
+
case 2: return colors.blue(letter);
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
};
|
|
1447
|
+
}));
|
|
1448
|
+
//#endregion
|
|
1449
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/zebra.js
|
|
1450
|
+
var require_zebra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1451
|
+
module["exports"] = function(colors) {
|
|
1452
|
+
return function(letter, i, exploded) {
|
|
1453
|
+
return i % 2 === 0 ? letter : colors.inverse(letter);
|
|
1454
|
+
};
|
|
1455
|
+
};
|
|
1456
|
+
}));
|
|
1457
|
+
//#endregion
|
|
1458
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/rainbow.js
|
|
1459
|
+
var require_rainbow = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1460
|
+
module["exports"] = function(colors) {
|
|
1461
|
+
var rainbowColors = [
|
|
1462
|
+
"red",
|
|
1463
|
+
"yellow",
|
|
1464
|
+
"green",
|
|
1465
|
+
"blue",
|
|
1466
|
+
"magenta"
|
|
1467
|
+
];
|
|
1468
|
+
return function(letter, i, exploded) {
|
|
1469
|
+
if (letter === " ") return letter;
|
|
1470
|
+
else return colors[rainbowColors[i++ % rainbowColors.length]](letter);
|
|
1471
|
+
};
|
|
1472
|
+
};
|
|
1473
|
+
}));
|
|
1474
|
+
//#endregion
|
|
1475
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/random.js
|
|
1476
|
+
var require_random = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1477
|
+
module["exports"] = function(colors) {
|
|
1478
|
+
var available = [
|
|
1479
|
+
"underline",
|
|
1480
|
+
"inverse",
|
|
1481
|
+
"grey",
|
|
1482
|
+
"yellow",
|
|
1483
|
+
"red",
|
|
1484
|
+
"green",
|
|
1485
|
+
"blue",
|
|
1486
|
+
"white",
|
|
1487
|
+
"cyan",
|
|
1488
|
+
"magenta",
|
|
1489
|
+
"brightYellow",
|
|
1490
|
+
"brightRed",
|
|
1491
|
+
"brightGreen",
|
|
1492
|
+
"brightBlue",
|
|
1493
|
+
"brightWhite",
|
|
1494
|
+
"brightCyan",
|
|
1495
|
+
"brightMagenta"
|
|
1496
|
+
];
|
|
1497
|
+
return function(letter, i, exploded) {
|
|
1498
|
+
return letter === " " ? letter : colors[available[Math.round(Math.random() * (available.length - 2))]](letter);
|
|
1499
|
+
};
|
|
1500
|
+
};
|
|
1501
|
+
}));
|
|
1502
|
+
//#endregion
|
|
1503
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/colors.js
|
|
1504
|
+
var require_colors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1505
|
+
var colors = {};
|
|
1506
|
+
module["exports"] = colors;
|
|
1507
|
+
colors.themes = {};
|
|
1508
|
+
var util = __require("util");
|
|
1509
|
+
var ansiStyles = colors.styles = require_styles();
|
|
1510
|
+
var defineProps = Object.defineProperties;
|
|
1511
|
+
var newLineRegex = /* @__PURE__ */ new RegExp(/[\r\n]+/g);
|
|
1512
|
+
colors.supportsColor = require_supports_colors().supportsColor;
|
|
1513
|
+
if (typeof colors.enabled === "undefined") colors.enabled = colors.supportsColor() !== false;
|
|
1514
|
+
colors.enable = function() {
|
|
1515
|
+
colors.enabled = true;
|
|
1516
|
+
};
|
|
1517
|
+
colors.disable = function() {
|
|
1518
|
+
colors.enabled = false;
|
|
1519
|
+
};
|
|
1520
|
+
colors.stripColors = colors.strip = function(str) {
|
|
1521
|
+
return ("" + str).replace(/\x1B\[\d+m/g, "");
|
|
1522
|
+
};
|
|
1523
|
+
colors.stylize = function stylize(str, style) {
|
|
1524
|
+
if (!colors.enabled) return str + "";
|
|
1525
|
+
var styleMap = ansiStyles[style];
|
|
1526
|
+
if (!styleMap && style in colors) return colors[style](str);
|
|
1527
|
+
return styleMap.open + str + styleMap.close;
|
|
1528
|
+
};
|
|
1529
|
+
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
|
1530
|
+
var escapeStringRegexp = function(str) {
|
|
1531
|
+
if (typeof str !== "string") throw new TypeError("Expected a string");
|
|
1532
|
+
return str.replace(matchOperatorsRe, "\\$&");
|
|
1533
|
+
};
|
|
1534
|
+
function build(_styles) {
|
|
1535
|
+
var builder = function builder() {
|
|
1536
|
+
return applyStyle.apply(builder, arguments);
|
|
1537
|
+
};
|
|
1538
|
+
builder._styles = _styles;
|
|
1539
|
+
builder.__proto__ = proto;
|
|
1540
|
+
return builder;
|
|
1541
|
+
}
|
|
1542
|
+
var styles = (function() {
|
|
1543
|
+
var ret = {};
|
|
1544
|
+
ansiStyles.grey = ansiStyles.gray;
|
|
1545
|
+
Object.keys(ansiStyles).forEach(function(key) {
|
|
1546
|
+
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), "g");
|
|
1547
|
+
ret[key] = { get: function() {
|
|
1548
|
+
return build(this._styles.concat(key));
|
|
1549
|
+
} };
|
|
1550
|
+
});
|
|
1551
|
+
return ret;
|
|
1552
|
+
})();
|
|
1553
|
+
var proto = defineProps(function colors() {}, styles);
|
|
1554
|
+
function applyStyle() {
|
|
1555
|
+
var str = Array.prototype.slice.call(arguments).map(function(arg) {
|
|
1556
|
+
if (arg != null && arg.constructor === String) return arg;
|
|
1557
|
+
else return util.inspect(arg);
|
|
1558
|
+
}).join(" ");
|
|
1559
|
+
if (!colors.enabled || !str) return str;
|
|
1560
|
+
var newLinesPresent = str.indexOf("\n") != -1;
|
|
1561
|
+
var nestedStyles = this._styles;
|
|
1562
|
+
var i = nestedStyles.length;
|
|
1563
|
+
while (i--) {
|
|
1564
|
+
var code = ansiStyles[nestedStyles[i]];
|
|
1565
|
+
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
|
1566
|
+
if (newLinesPresent) str = str.replace(newLineRegex, function(match) {
|
|
1567
|
+
return code.close + match + code.open;
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
return str;
|
|
1571
|
+
}
|
|
1572
|
+
colors.setTheme = function(theme) {
|
|
1573
|
+
if (typeof theme === "string") {
|
|
1574
|
+
console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
for (var style in theme) (function(style) {
|
|
1578
|
+
colors[style] = function(str) {
|
|
1579
|
+
if (typeof theme[style] === "object") {
|
|
1580
|
+
var out = str;
|
|
1581
|
+
for (var i in theme[style]) out = colors[theme[style][i]](out);
|
|
1582
|
+
return out;
|
|
1583
|
+
}
|
|
1584
|
+
return colors[theme[style]](str);
|
|
1585
|
+
};
|
|
1586
|
+
})(style);
|
|
1587
|
+
};
|
|
1588
|
+
function init() {
|
|
1589
|
+
var ret = {};
|
|
1590
|
+
Object.keys(styles).forEach(function(name) {
|
|
1591
|
+
ret[name] = { get: function() {
|
|
1592
|
+
return build([name]);
|
|
1593
|
+
} };
|
|
1594
|
+
});
|
|
1595
|
+
return ret;
|
|
1596
|
+
}
|
|
1597
|
+
var sequencer = function sequencer(map, str) {
|
|
1598
|
+
var exploded = str.split("");
|
|
1599
|
+
exploded = exploded.map(map);
|
|
1600
|
+
return exploded.join("");
|
|
1601
|
+
};
|
|
1602
|
+
colors.trap = require_trap();
|
|
1603
|
+
colors.zalgo = require_zalgo();
|
|
1604
|
+
colors.maps = {};
|
|
1605
|
+
colors.maps.america = require_america()(colors);
|
|
1606
|
+
colors.maps.zebra = require_zebra()(colors);
|
|
1607
|
+
colors.maps.rainbow = require_rainbow()(colors);
|
|
1608
|
+
colors.maps.random = require_random()(colors);
|
|
1609
|
+
for (var map in colors.maps) (function(map) {
|
|
1610
|
+
colors[map] = function(str) {
|
|
1611
|
+
return sequencer(colors.maps[map], str);
|
|
1612
|
+
};
|
|
1613
|
+
})(map);
|
|
1614
|
+
defineProps(colors, init());
|
|
1615
|
+
}));
|
|
1616
|
+
//#endregion
|
|
1617
|
+
//#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/safe.js
|
|
1618
|
+
var require_safe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1619
|
+
module["exports"] = require_colors();
|
|
1620
|
+
}));
|
|
1621
|
+
//#endregion
|
|
1622
|
+
//#region ../../node_modules/.pnpm/cli-table3@0.6.5/node_modules/cli-table3/src/cell.js
|
|
1623
|
+
var require_cell = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1624
|
+
const { info, debug } = require_debug();
|
|
1625
|
+
const utils = require_utils();
|
|
1626
|
+
var Cell = class Cell {
|
|
1627
|
+
/**
|
|
1628
|
+
* A representation of a cell within the table.
|
|
1629
|
+
* Implementations must have `init` and `draw` methods,
|
|
1630
|
+
* as well as `colSpan`, `rowSpan`, `desiredHeight` and `desiredWidth` properties.
|
|
1631
|
+
* @param options
|
|
1632
|
+
* @constructor
|
|
1633
|
+
*/
|
|
1634
|
+
constructor(options) {
|
|
1635
|
+
this.setOptions(options);
|
|
1636
|
+
/**
|
|
1637
|
+
* Each cell will have it's `x` and `y` values set by the `layout-manager` prior to
|
|
1638
|
+
* `init` being called;
|
|
1639
|
+
* @type {Number}
|
|
1640
|
+
*/
|
|
1641
|
+
this.x = null;
|
|
1642
|
+
this.y = null;
|
|
1643
|
+
}
|
|
1644
|
+
setOptions(options) {
|
|
1645
|
+
if ([
|
|
1646
|
+
"boolean",
|
|
1647
|
+
"number",
|
|
1648
|
+
"bigint",
|
|
1649
|
+
"string"
|
|
1650
|
+
].indexOf(typeof options) !== -1) options = { content: "" + options };
|
|
1651
|
+
options = options || {};
|
|
1652
|
+
this.options = options;
|
|
1653
|
+
let content = options.content;
|
|
1654
|
+
if ([
|
|
1655
|
+
"boolean",
|
|
1656
|
+
"number",
|
|
1657
|
+
"bigint",
|
|
1658
|
+
"string"
|
|
1659
|
+
].indexOf(typeof content) !== -1) this.content = String(content);
|
|
1660
|
+
else if (!content) this.content = this.options.href || "";
|
|
1661
|
+
else throw new Error("Content needs to be a primitive, got: " + typeof content);
|
|
1662
|
+
this.colSpan = options.colSpan || 1;
|
|
1663
|
+
this.rowSpan = options.rowSpan || 1;
|
|
1664
|
+
if (this.options.href) Object.defineProperty(this, "href", { get() {
|
|
1665
|
+
return this.options.href;
|
|
1666
|
+
} });
|
|
1667
|
+
}
|
|
1668
|
+
mergeTableOptions(tableOptions, cells) {
|
|
1669
|
+
this.cells = cells;
|
|
1670
|
+
let optionsChars = this.options.chars || {};
|
|
1671
|
+
let tableChars = tableOptions.chars;
|
|
1672
|
+
let chars = this.chars = {};
|
|
1673
|
+
CHAR_NAMES.forEach(function(name) {
|
|
1674
|
+
setOption(optionsChars, tableChars, name, chars);
|
|
1675
|
+
});
|
|
1676
|
+
this.truncate = this.options.truncate || tableOptions.truncate;
|
|
1677
|
+
let style = this.options.style = this.options.style || {};
|
|
1678
|
+
let tableStyle = tableOptions.style;
|
|
1679
|
+
setOption(style, tableStyle, "padding-left", this);
|
|
1680
|
+
setOption(style, tableStyle, "padding-right", this);
|
|
1681
|
+
this.head = style.head || tableStyle.head;
|
|
1682
|
+
this.border = style.border || tableStyle.border;
|
|
1683
|
+
this.fixedWidth = tableOptions.colWidths[this.x];
|
|
1684
|
+
this.lines = this.computeLines(tableOptions);
|
|
1685
|
+
this.desiredWidth = utils.strlen(this.content) + this.paddingLeft + this.paddingRight;
|
|
1686
|
+
this.desiredHeight = this.lines.length;
|
|
1687
|
+
}
|
|
1688
|
+
computeLines(tableOptions) {
|
|
1689
|
+
const tableWordWrap = tableOptions.wordWrap || tableOptions.textWrap;
|
|
1690
|
+
const { wordWrap = tableWordWrap } = this.options;
|
|
1691
|
+
if (this.fixedWidth && wordWrap) {
|
|
1692
|
+
this.fixedWidth -= this.paddingLeft + this.paddingRight;
|
|
1693
|
+
if (this.colSpan) {
|
|
1694
|
+
let i = 1;
|
|
1695
|
+
while (i < this.colSpan) {
|
|
1696
|
+
this.fixedWidth += tableOptions.colWidths[this.x + i];
|
|
1697
|
+
i++;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
const { wrapOnWordBoundary: tableWrapOnWordBoundary = true } = tableOptions;
|
|
1701
|
+
const { wrapOnWordBoundary = tableWrapOnWordBoundary } = this.options;
|
|
1702
|
+
return this.wrapLines(utils.wordWrap(this.fixedWidth, this.content, wrapOnWordBoundary));
|
|
1703
|
+
}
|
|
1704
|
+
return this.wrapLines(this.content.split("\n"));
|
|
1705
|
+
}
|
|
1706
|
+
wrapLines(computedLines) {
|
|
1707
|
+
const lines = utils.colorizeLines(computedLines);
|
|
1708
|
+
if (this.href) return lines.map((line) => utils.hyperlink(this.href, line));
|
|
1709
|
+
return lines;
|
|
1710
|
+
}
|
|
1711
|
+
/**
|
|
1712
|
+
* Initializes the Cells data structure.
|
|
1713
|
+
*
|
|
1714
|
+
* @param tableOptions - A fully populated set of tableOptions.
|
|
1715
|
+
* In addition to the standard default values, tableOptions must have fully populated the
|
|
1716
|
+
* `colWidths` and `rowWidths` arrays. Those arrays must have lengths equal to the number
|
|
1717
|
+
* of columns or rows (respectively) in this table, and each array item must be a Number.
|
|
1718
|
+
*
|
|
1719
|
+
*/
|
|
1720
|
+
init(tableOptions) {
|
|
1721
|
+
let x = this.x;
|
|
1722
|
+
let y = this.y;
|
|
1723
|
+
this.widths = tableOptions.colWidths.slice(x, x + this.colSpan);
|
|
1724
|
+
this.heights = tableOptions.rowHeights.slice(y, y + this.rowSpan);
|
|
1725
|
+
this.width = this.widths.reduce(sumPlusOne, -1);
|
|
1726
|
+
this.height = this.heights.reduce(sumPlusOne, -1);
|
|
1727
|
+
this.hAlign = this.options.hAlign || tableOptions.colAligns[x];
|
|
1728
|
+
this.vAlign = this.options.vAlign || tableOptions.rowAligns[y];
|
|
1729
|
+
this.drawRight = x + this.colSpan == tableOptions.colWidths.length;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Draws the given line of the cell.
|
|
1733
|
+
* This default implementation defers to methods `drawTop`, `drawBottom`, `drawLine` and `drawEmpty`.
|
|
1734
|
+
* @param lineNum - can be `top`, `bottom` or a numerical line number.
|
|
1735
|
+
* @param spanningCell - will be a number if being called from a RowSpanCell, and will represent how
|
|
1736
|
+
* many rows below it's being called from. Otherwise it's undefined.
|
|
1737
|
+
* @returns {String} The representation of this line.
|
|
1738
|
+
*/
|
|
1739
|
+
draw(lineNum, spanningCell) {
|
|
1740
|
+
if (lineNum == "top") return this.drawTop(this.drawRight);
|
|
1741
|
+
if (lineNum == "bottom") return this.drawBottom(this.drawRight);
|
|
1742
|
+
let content = utils.truncate(this.content, 10, this.truncate);
|
|
1743
|
+
if (!lineNum) info(`${this.y}-${this.x}: ${this.rowSpan - lineNum}x${this.colSpan} Cell ${content}`);
|
|
1744
|
+
let padLen = Math.max(this.height - this.lines.length, 0);
|
|
1745
|
+
let padTop;
|
|
1746
|
+
switch (this.vAlign) {
|
|
1747
|
+
case "center":
|
|
1748
|
+
padTop = Math.ceil(padLen / 2);
|
|
1749
|
+
break;
|
|
1750
|
+
case "bottom":
|
|
1751
|
+
padTop = padLen;
|
|
1752
|
+
break;
|
|
1753
|
+
default: padTop = 0;
|
|
1754
|
+
}
|
|
1755
|
+
if (lineNum < padTop || lineNum >= padTop + this.lines.length) return this.drawEmpty(this.drawRight, spanningCell);
|
|
1756
|
+
let forceTruncation = this.lines.length > this.height && lineNum + 1 >= this.height;
|
|
1757
|
+
return this.drawLine(lineNum - padTop, this.drawRight, forceTruncation, spanningCell);
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Renders the top line of the cell.
|
|
1761
|
+
* @param drawRight - true if this method should render the right edge of the cell.
|
|
1762
|
+
* @returns {String}
|
|
1763
|
+
*/
|
|
1764
|
+
drawTop(drawRight) {
|
|
1765
|
+
let content = [];
|
|
1766
|
+
if (this.cells) this.widths.forEach(function(width, index) {
|
|
1767
|
+
content.push(this._topLeftChar(index));
|
|
1768
|
+
content.push(utils.repeat(this.chars[this.y == 0 ? "top" : "mid"], width));
|
|
1769
|
+
}, this);
|
|
1770
|
+
else {
|
|
1771
|
+
content.push(this._topLeftChar(0));
|
|
1772
|
+
content.push(utils.repeat(this.chars[this.y == 0 ? "top" : "mid"], this.width));
|
|
1773
|
+
}
|
|
1774
|
+
if (drawRight) content.push(this.chars[this.y == 0 ? "topRight" : "rightMid"]);
|
|
1775
|
+
return this.wrapWithStyleColors("border", content.join(""));
|
|
1776
|
+
}
|
|
1777
|
+
_topLeftChar(offset) {
|
|
1778
|
+
let x = this.x + offset;
|
|
1779
|
+
let leftChar;
|
|
1780
|
+
if (this.y == 0) leftChar = x == 0 ? "topLeft" : offset == 0 ? "topMid" : "top";
|
|
1781
|
+
else if (x == 0) leftChar = "leftMid";
|
|
1782
|
+
else {
|
|
1783
|
+
leftChar = offset == 0 ? "midMid" : "bottomMid";
|
|
1784
|
+
if (this.cells) {
|
|
1785
|
+
if (this.cells[this.y - 1][x] instanceof Cell.ColSpanCell) leftChar = offset == 0 ? "topMid" : "mid";
|
|
1786
|
+
if (offset == 0) {
|
|
1787
|
+
let i = 1;
|
|
1788
|
+
while (this.cells[this.y][x - i] instanceof Cell.ColSpanCell) i++;
|
|
1789
|
+
if (this.cells[this.y][x - i] instanceof Cell.RowSpanCell) leftChar = "leftMid";
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
return this.chars[leftChar];
|
|
1794
|
+
}
|
|
1795
|
+
wrapWithStyleColors(styleProperty, content) {
|
|
1796
|
+
if (this[styleProperty] && this[styleProperty].length) try {
|
|
1797
|
+
let colors = require_safe();
|
|
1798
|
+
for (let i = this[styleProperty].length - 1; i >= 0; i--) colors = colors[this[styleProperty][i]];
|
|
1799
|
+
return colors(content);
|
|
1800
|
+
} catch (e) {
|
|
1801
|
+
return content;
|
|
1802
|
+
}
|
|
1803
|
+
else return content;
|
|
1804
|
+
}
|
|
1805
|
+
/**
|
|
1806
|
+
* Renders a line of text.
|
|
1807
|
+
* @param lineNum - Which line of text to render. This is not necessarily the line within the cell.
|
|
1808
|
+
* There may be top-padding above the first line of text.
|
|
1809
|
+
* @param drawRight - true if this method should render the right edge of the cell.
|
|
1810
|
+
* @param forceTruncationSymbol - `true` if the rendered text should end with the truncation symbol even
|
|
1811
|
+
* if the text fits. This is used when the cell is vertically truncated. If `false` the text should
|
|
1812
|
+
* only include the truncation symbol if the text will not fit horizontally within the cell width.
|
|
1813
|
+
* @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined.
|
|
1814
|
+
* @returns {String}
|
|
1815
|
+
*/
|
|
1816
|
+
drawLine(lineNum, drawRight, forceTruncationSymbol, spanningCell) {
|
|
1817
|
+
let left = this.chars[this.x == 0 ? "left" : "middle"];
|
|
1818
|
+
if (this.x && spanningCell && this.cells) {
|
|
1819
|
+
let cellLeft = this.cells[this.y + spanningCell][this.x - 1];
|
|
1820
|
+
while (cellLeft instanceof ColSpanCell) cellLeft = this.cells[cellLeft.y][cellLeft.x - 1];
|
|
1821
|
+
if (!(cellLeft instanceof RowSpanCell)) left = this.chars["rightMid"];
|
|
1822
|
+
}
|
|
1823
|
+
let leftPadding = utils.repeat(" ", this.paddingLeft);
|
|
1824
|
+
let right = drawRight ? this.chars["right"] : "";
|
|
1825
|
+
let rightPadding = utils.repeat(" ", this.paddingRight);
|
|
1826
|
+
let line = this.lines[lineNum];
|
|
1827
|
+
let len = this.width - (this.paddingLeft + this.paddingRight);
|
|
1828
|
+
if (forceTruncationSymbol) line += this.truncate || "…";
|
|
1829
|
+
let content = utils.truncate(line, len, this.truncate);
|
|
1830
|
+
content = utils.pad(content, len, " ", this.hAlign);
|
|
1831
|
+
content = leftPadding + content + rightPadding;
|
|
1832
|
+
return this.stylizeLine(left, content, right);
|
|
1833
|
+
}
|
|
1834
|
+
stylizeLine(left, content, right) {
|
|
1835
|
+
left = this.wrapWithStyleColors("border", left);
|
|
1836
|
+
right = this.wrapWithStyleColors("border", right);
|
|
1837
|
+
if (this.y === 0) content = this.wrapWithStyleColors("head", content);
|
|
1838
|
+
return left + content + right;
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* Renders the bottom line of the cell.
|
|
1842
|
+
* @param drawRight - true if this method should render the right edge of the cell.
|
|
1843
|
+
* @returns {String}
|
|
1844
|
+
*/
|
|
1845
|
+
drawBottom(drawRight) {
|
|
1846
|
+
let left = this.chars[this.x == 0 ? "bottomLeft" : "bottomMid"];
|
|
1847
|
+
let content = utils.repeat(this.chars.bottom, this.width);
|
|
1848
|
+
let right = drawRight ? this.chars["bottomRight"] : "";
|
|
1849
|
+
return this.wrapWithStyleColors("border", left + content + right);
|
|
1850
|
+
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Renders a blank line of text within the cell. Used for top and/or bottom padding.
|
|
1853
|
+
* @param drawRight - true if this method should render the right edge of the cell.
|
|
1854
|
+
* @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined.
|
|
1855
|
+
* @returns {String}
|
|
1856
|
+
*/
|
|
1857
|
+
drawEmpty(drawRight, spanningCell) {
|
|
1858
|
+
let left = this.chars[this.x == 0 ? "left" : "middle"];
|
|
1859
|
+
if (this.x && spanningCell && this.cells) {
|
|
1860
|
+
let cellLeft = this.cells[this.y + spanningCell][this.x - 1];
|
|
1861
|
+
while (cellLeft instanceof ColSpanCell) cellLeft = this.cells[cellLeft.y][cellLeft.x - 1];
|
|
1862
|
+
if (!(cellLeft instanceof RowSpanCell)) left = this.chars["rightMid"];
|
|
1863
|
+
}
|
|
1864
|
+
let right = drawRight ? this.chars["right"] : "";
|
|
1865
|
+
let content = utils.repeat(" ", this.width);
|
|
1866
|
+
return this.stylizeLine(left, content, right);
|
|
1867
|
+
}
|
|
1868
|
+
};
|
|
1869
|
+
var ColSpanCell = class {
|
|
1870
|
+
/**
|
|
1871
|
+
* A Cell that doesn't do anything. It just draws empty lines.
|
|
1872
|
+
* Used as a placeholder in column spanning.
|
|
1873
|
+
* @constructor
|
|
1874
|
+
*/
|
|
1875
|
+
constructor() {}
|
|
1876
|
+
draw(lineNum) {
|
|
1877
|
+
if (typeof lineNum === "number") debug(`${this.y}-${this.x}: 1x1 ColSpanCell`);
|
|
1878
|
+
return "";
|
|
1879
|
+
}
|
|
1880
|
+
init() {}
|
|
1881
|
+
mergeTableOptions() {}
|
|
1882
|
+
};
|
|
1883
|
+
var RowSpanCell = class {
|
|
1884
|
+
/**
|
|
1885
|
+
* A placeholder Cell for a Cell that spans multiple rows.
|
|
1886
|
+
* It delegates rendering to the original cell, but adds the appropriate offset.
|
|
1887
|
+
* @param originalCell
|
|
1888
|
+
* @constructor
|
|
1889
|
+
*/
|
|
1890
|
+
constructor(originalCell) {
|
|
1891
|
+
this.originalCell = originalCell;
|
|
1892
|
+
}
|
|
1893
|
+
init(tableOptions) {
|
|
1894
|
+
let y = this.y;
|
|
1895
|
+
let originalY = this.originalCell.y;
|
|
1896
|
+
this.cellOffset = y - originalY;
|
|
1897
|
+
this.offset = findDimension(tableOptions.rowHeights, originalY, this.cellOffset);
|
|
1898
|
+
}
|
|
1899
|
+
draw(lineNum) {
|
|
1900
|
+
if (lineNum == "top") return this.originalCell.draw(this.offset, this.cellOffset);
|
|
1901
|
+
if (lineNum == "bottom") return this.originalCell.draw("bottom");
|
|
1902
|
+
debug(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`);
|
|
1903
|
+
return this.originalCell.draw(this.offset + 1 + lineNum);
|
|
1904
|
+
}
|
|
1905
|
+
mergeTableOptions() {}
|
|
1906
|
+
};
|
|
1907
|
+
function firstDefined(...args) {
|
|
1908
|
+
return args.filter((v) => v !== void 0 && v !== null).shift();
|
|
1909
|
+
}
|
|
1910
|
+
function setOption(objA, objB, nameB, targetObj) {
|
|
1911
|
+
let nameA = nameB.split("-");
|
|
1912
|
+
if (nameA.length > 1) {
|
|
1913
|
+
nameA[1] = nameA[1].charAt(0).toUpperCase() + nameA[1].substr(1);
|
|
1914
|
+
nameA = nameA.join("");
|
|
1915
|
+
targetObj[nameA] = firstDefined(objA[nameA], objA[nameB], objB[nameA], objB[nameB]);
|
|
1916
|
+
} else targetObj[nameB] = firstDefined(objA[nameB], objB[nameB]);
|
|
1917
|
+
}
|
|
1918
|
+
function findDimension(dimensionTable, startingIndex, span) {
|
|
1919
|
+
let ret = dimensionTable[startingIndex];
|
|
1920
|
+
for (let i = 1; i < span; i++) ret += 1 + dimensionTable[startingIndex + i];
|
|
1921
|
+
return ret;
|
|
1922
|
+
}
|
|
1923
|
+
function sumPlusOne(a, b) {
|
|
1924
|
+
return a + b + 1;
|
|
1925
|
+
}
|
|
1926
|
+
let CHAR_NAMES = [
|
|
1927
|
+
"top",
|
|
1928
|
+
"top-mid",
|
|
1929
|
+
"top-left",
|
|
1930
|
+
"top-right",
|
|
1931
|
+
"bottom",
|
|
1932
|
+
"bottom-mid",
|
|
1933
|
+
"bottom-left",
|
|
1934
|
+
"bottom-right",
|
|
1935
|
+
"left",
|
|
1936
|
+
"left-mid",
|
|
1937
|
+
"mid",
|
|
1938
|
+
"mid-mid",
|
|
1939
|
+
"right",
|
|
1940
|
+
"right-mid",
|
|
1941
|
+
"middle"
|
|
1942
|
+
];
|
|
1943
|
+
module.exports = Cell;
|
|
1944
|
+
module.exports.ColSpanCell = ColSpanCell;
|
|
1945
|
+
module.exports.RowSpanCell = RowSpanCell;
|
|
1946
|
+
}));
|
|
1947
|
+
//#endregion
|
|
1948
|
+
//#region ../../node_modules/.pnpm/cli-table3@0.6.5/node_modules/cli-table3/src/layout-manager.js
|
|
1949
|
+
var require_layout_manager = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1950
|
+
const { warn, debug } = require_debug();
|
|
1951
|
+
const Cell = require_cell();
|
|
1952
|
+
const { ColSpanCell, RowSpanCell } = Cell;
|
|
1953
|
+
(function() {
|
|
1954
|
+
function next(alloc, col) {
|
|
1955
|
+
if (alloc[col] > 0) return next(alloc, col + 1);
|
|
1956
|
+
return col;
|
|
1957
|
+
}
|
|
1958
|
+
function layoutTable(table) {
|
|
1959
|
+
let alloc = {};
|
|
1960
|
+
table.forEach(function(row, rowIndex) {
|
|
1961
|
+
let col = 0;
|
|
1962
|
+
row.forEach(function(cell) {
|
|
1963
|
+
cell.y = rowIndex;
|
|
1964
|
+
cell.x = rowIndex ? next(alloc, col) : col;
|
|
1965
|
+
const rowSpan = cell.rowSpan || 1;
|
|
1966
|
+
const colSpan = cell.colSpan || 1;
|
|
1967
|
+
if (rowSpan > 1) for (let cs = 0; cs < colSpan; cs++) alloc[cell.x + cs] = rowSpan;
|
|
1968
|
+
col = cell.x + colSpan;
|
|
1969
|
+
});
|
|
1970
|
+
Object.keys(alloc).forEach((idx) => {
|
|
1971
|
+
alloc[idx]--;
|
|
1972
|
+
if (alloc[idx] < 1) delete alloc[idx];
|
|
1973
|
+
});
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
function maxWidth(table) {
|
|
1977
|
+
let mw = 0;
|
|
1978
|
+
table.forEach(function(row) {
|
|
1979
|
+
row.forEach(function(cell) {
|
|
1980
|
+
mw = Math.max(mw, cell.x + (cell.colSpan || 1));
|
|
1981
|
+
});
|
|
1982
|
+
});
|
|
1983
|
+
return mw;
|
|
1984
|
+
}
|
|
1985
|
+
function maxHeight(table) {
|
|
1986
|
+
return table.length;
|
|
1987
|
+
}
|
|
1988
|
+
function cellsConflict(cell1, cell2) {
|
|
1989
|
+
let yMin1 = cell1.y;
|
|
1990
|
+
let yMax1 = cell1.y - 1 + (cell1.rowSpan || 1);
|
|
1991
|
+
let yMin2 = cell2.y;
|
|
1992
|
+
let yConflict = !(yMin1 > cell2.y - 1 + (cell2.rowSpan || 1) || yMin2 > yMax1);
|
|
1993
|
+
let xMin1 = cell1.x;
|
|
1994
|
+
let xMax1 = cell1.x - 1 + (cell1.colSpan || 1);
|
|
1995
|
+
let xMin2 = cell2.x;
|
|
1996
|
+
let xConflict = !(xMin1 > cell2.x - 1 + (cell2.colSpan || 1) || xMin2 > xMax1);
|
|
1997
|
+
return yConflict && xConflict;
|
|
1998
|
+
}
|
|
1999
|
+
function conflictExists(rows, x, y) {
|
|
2000
|
+
let i_max = Math.min(rows.length - 1, y);
|
|
2001
|
+
let cell = {
|
|
2002
|
+
x,
|
|
2003
|
+
y
|
|
2004
|
+
};
|
|
2005
|
+
for (let i = 0; i <= i_max; i++) {
|
|
2006
|
+
let row = rows[i];
|
|
2007
|
+
for (let j = 0; j < row.length; j++) if (cellsConflict(cell, row[j])) return true;
|
|
2008
|
+
}
|
|
2009
|
+
return false;
|
|
2010
|
+
}
|
|
2011
|
+
function allBlank(rows, y, xMin, xMax) {
|
|
2012
|
+
for (let x = xMin; x < xMax; x++) if (conflictExists(rows, x, y)) return false;
|
|
2013
|
+
return true;
|
|
2014
|
+
}
|
|
2015
|
+
function addRowSpanCells(table) {
|
|
2016
|
+
table.forEach(function(row, rowIndex) {
|
|
2017
|
+
row.forEach(function(cell) {
|
|
2018
|
+
for (let i = 1; i < cell.rowSpan; i++) {
|
|
2019
|
+
let rowSpanCell = new RowSpanCell(cell);
|
|
2020
|
+
rowSpanCell.x = cell.x;
|
|
2021
|
+
rowSpanCell.y = cell.y + i;
|
|
2022
|
+
rowSpanCell.colSpan = cell.colSpan;
|
|
2023
|
+
insertCell(rowSpanCell, table[rowIndex + i]);
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
function addColSpanCells(cellRows) {
|
|
2029
|
+
for (let rowIndex = cellRows.length - 1; rowIndex >= 0; rowIndex--) {
|
|
2030
|
+
let cellColumns = cellRows[rowIndex];
|
|
2031
|
+
for (let columnIndex = 0; columnIndex < cellColumns.length; columnIndex++) {
|
|
2032
|
+
let cell = cellColumns[columnIndex];
|
|
2033
|
+
for (let k = 1; k < cell.colSpan; k++) {
|
|
2034
|
+
let colSpanCell = new ColSpanCell();
|
|
2035
|
+
colSpanCell.x = cell.x + k;
|
|
2036
|
+
colSpanCell.y = cell.y;
|
|
2037
|
+
cellColumns.splice(columnIndex + 1, 0, colSpanCell);
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
function insertCell(cell, row) {
|
|
2043
|
+
let x = 0;
|
|
2044
|
+
while (x < row.length && row[x].x < cell.x) x++;
|
|
2045
|
+
row.splice(x, 0, cell);
|
|
2046
|
+
}
|
|
2047
|
+
function fillInTable(table) {
|
|
2048
|
+
let h_max = maxHeight(table);
|
|
2049
|
+
let w_max = maxWidth(table);
|
|
2050
|
+
debug(`Max rows: ${h_max}; Max cols: ${w_max}`);
|
|
2051
|
+
for (let y = 0; y < h_max; y++) for (let x = 0; x < w_max; x++) if (!conflictExists(table, x, y)) {
|
|
2052
|
+
let opts = {
|
|
2053
|
+
x,
|
|
2054
|
+
y,
|
|
2055
|
+
colSpan: 1,
|
|
2056
|
+
rowSpan: 1
|
|
2057
|
+
};
|
|
2058
|
+
x++;
|
|
2059
|
+
while (x < w_max && !conflictExists(table, x, y)) {
|
|
2060
|
+
opts.colSpan++;
|
|
2061
|
+
x++;
|
|
2062
|
+
}
|
|
2063
|
+
let y2 = y + 1;
|
|
2064
|
+
while (y2 < h_max && allBlank(table, y2, opts.x, opts.x + opts.colSpan)) {
|
|
2065
|
+
opts.rowSpan++;
|
|
2066
|
+
y2++;
|
|
2067
|
+
}
|
|
2068
|
+
let cell = new Cell(opts);
|
|
2069
|
+
cell.x = opts.x;
|
|
2070
|
+
cell.y = opts.y;
|
|
2071
|
+
warn(`Missing cell at ${cell.y}-${cell.x}.`);
|
|
2072
|
+
insertCell(cell, table[y]);
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
function generateCells(rows) {
|
|
2076
|
+
return rows.map(function(row) {
|
|
2077
|
+
if (!Array.isArray(row)) {
|
|
2078
|
+
let key = Object.keys(row)[0];
|
|
2079
|
+
row = row[key];
|
|
2080
|
+
if (Array.isArray(row)) {
|
|
2081
|
+
row = row.slice();
|
|
2082
|
+
row.unshift(key);
|
|
2083
|
+
} else row = [key, row];
|
|
2084
|
+
}
|
|
2085
|
+
return row.map(function(cell) {
|
|
2086
|
+
return new Cell(cell);
|
|
2087
|
+
});
|
|
2088
|
+
});
|
|
2089
|
+
}
|
|
2090
|
+
function makeTableLayout(rows) {
|
|
2091
|
+
let cellRows = generateCells(rows);
|
|
2092
|
+
layoutTable(cellRows);
|
|
2093
|
+
fillInTable(cellRows);
|
|
2094
|
+
addRowSpanCells(cellRows);
|
|
2095
|
+
addColSpanCells(cellRows);
|
|
2096
|
+
return cellRows;
|
|
2097
|
+
}
|
|
2098
|
+
module.exports = {
|
|
2099
|
+
makeTableLayout,
|
|
2100
|
+
layoutTable,
|
|
2101
|
+
addRowSpanCells,
|
|
2102
|
+
maxWidth,
|
|
2103
|
+
fillInTable,
|
|
2104
|
+
computeWidths: makeComputeWidths("colSpan", "desiredWidth", "x", 1),
|
|
2105
|
+
computeHeights: makeComputeWidths("rowSpan", "desiredHeight", "y", 1)
|
|
2106
|
+
};
|
|
2107
|
+
})();
|
|
2108
|
+
function makeComputeWidths(colSpan, desiredWidth, x, forcedMin) {
|
|
2109
|
+
return function(vals, table) {
|
|
2110
|
+
let result = [];
|
|
2111
|
+
let spanners = [];
|
|
2112
|
+
let auto = {};
|
|
2113
|
+
table.forEach(function(row) {
|
|
2114
|
+
row.forEach(function(cell) {
|
|
2115
|
+
if ((cell[colSpan] || 1) > 1) spanners.push(cell);
|
|
2116
|
+
else result[cell[x]] = Math.max(result[cell[x]] || 0, cell[desiredWidth] || 0, forcedMin);
|
|
2117
|
+
});
|
|
2118
|
+
});
|
|
2119
|
+
vals.forEach(function(val, index) {
|
|
2120
|
+
if (typeof val === "number") result[index] = val;
|
|
2121
|
+
});
|
|
2122
|
+
for (let k = spanners.length - 1; k >= 0; k--) {
|
|
2123
|
+
let cell = spanners[k];
|
|
2124
|
+
let span = cell[colSpan];
|
|
2125
|
+
let col = cell[x];
|
|
2126
|
+
let existingWidth = result[col];
|
|
2127
|
+
let editableCols = typeof vals[col] === "number" ? 0 : 1;
|
|
2128
|
+
if (typeof existingWidth === "number") for (let i = 1; i < span; i++) {
|
|
2129
|
+
existingWidth += 1 + result[col + i];
|
|
2130
|
+
if (typeof vals[col + i] !== "number") editableCols++;
|
|
2131
|
+
}
|
|
2132
|
+
else {
|
|
2133
|
+
existingWidth = desiredWidth === "desiredWidth" ? cell.desiredWidth - 1 : 1;
|
|
2134
|
+
if (!auto[col] || auto[col] < existingWidth) auto[col] = existingWidth;
|
|
2135
|
+
}
|
|
2136
|
+
if (cell[desiredWidth] > existingWidth) {
|
|
2137
|
+
let i = 0;
|
|
2138
|
+
while (editableCols > 0 && cell[desiredWidth] > existingWidth) {
|
|
2139
|
+
if (typeof vals[col + i] !== "number") {
|
|
2140
|
+
let dif = Math.round((cell[desiredWidth] - existingWidth) / editableCols);
|
|
2141
|
+
existingWidth += dif;
|
|
2142
|
+
result[col + i] += dif;
|
|
2143
|
+
editableCols--;
|
|
2144
|
+
}
|
|
2145
|
+
i++;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
Object.assign(vals, result, auto);
|
|
2150
|
+
for (let j = 0; j < vals.length; j++) vals[j] = Math.max(forcedMin, vals[j] || 0);
|
|
2151
|
+
};
|
|
2152
|
+
}
|
|
2153
|
+
}));
|
|
2154
|
+
//#endregion
|
|
2155
|
+
//#region ../../node_modules/.pnpm/cli-table3@0.6.5/node_modules/cli-table3/src/table.js
|
|
2156
|
+
var require_table = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2157
|
+
const debug = require_debug();
|
|
2158
|
+
const utils = require_utils();
|
|
2159
|
+
const tableLayout = require_layout_manager();
|
|
2160
|
+
var Table = class extends Array {
|
|
2161
|
+
constructor(opts) {
|
|
2162
|
+
super();
|
|
2163
|
+
const options = utils.mergeOptions(opts);
|
|
2164
|
+
Object.defineProperty(this, "options", {
|
|
2165
|
+
value: options,
|
|
2166
|
+
enumerable: options.debug
|
|
2167
|
+
});
|
|
2168
|
+
if (options.debug) {
|
|
2169
|
+
switch (typeof options.debug) {
|
|
2170
|
+
case "boolean":
|
|
2171
|
+
debug.setDebugLevel(debug.WARN);
|
|
2172
|
+
break;
|
|
2173
|
+
case "number":
|
|
2174
|
+
debug.setDebugLevel(options.debug);
|
|
2175
|
+
break;
|
|
2176
|
+
case "string":
|
|
2177
|
+
debug.setDebugLevel(parseInt(options.debug, 10));
|
|
2178
|
+
break;
|
|
2179
|
+
default:
|
|
2180
|
+
debug.setDebugLevel(debug.WARN);
|
|
2181
|
+
debug.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof options.debug}`);
|
|
2182
|
+
}
|
|
2183
|
+
Object.defineProperty(this, "messages", { get() {
|
|
2184
|
+
return debug.debugMessages();
|
|
2185
|
+
} });
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
toString() {
|
|
2189
|
+
let array = this;
|
|
2190
|
+
let headersPresent = this.options.head && this.options.head.length;
|
|
2191
|
+
if (headersPresent) {
|
|
2192
|
+
array = [this.options.head];
|
|
2193
|
+
if (this.length) array.push.apply(array, this);
|
|
2194
|
+
} else this.options.style.head = [];
|
|
2195
|
+
let cells = tableLayout.makeTableLayout(array);
|
|
2196
|
+
cells.forEach(function(row) {
|
|
2197
|
+
row.forEach(function(cell) {
|
|
2198
|
+
cell.mergeTableOptions(this.options, cells);
|
|
2199
|
+
}, this);
|
|
2200
|
+
}, this);
|
|
2201
|
+
tableLayout.computeWidths(this.options.colWidths, cells);
|
|
2202
|
+
tableLayout.computeHeights(this.options.rowHeights, cells);
|
|
2203
|
+
cells.forEach(function(row) {
|
|
2204
|
+
row.forEach(function(cell) {
|
|
2205
|
+
cell.init(this.options);
|
|
2206
|
+
}, this);
|
|
2207
|
+
}, this);
|
|
2208
|
+
let result = [];
|
|
2209
|
+
for (let rowIndex = 0; rowIndex < cells.length; rowIndex++) {
|
|
2210
|
+
let row = cells[rowIndex];
|
|
2211
|
+
let heightOfRow = this.options.rowHeights[rowIndex];
|
|
2212
|
+
if (rowIndex === 0 || !this.options.style.compact || rowIndex == 1 && headersPresent) doDraw(row, "top", result);
|
|
2213
|
+
for (let lineNum = 0; lineNum < heightOfRow; lineNum++) doDraw(row, lineNum, result);
|
|
2214
|
+
if (rowIndex + 1 == cells.length) doDraw(row, "bottom", result);
|
|
2215
|
+
}
|
|
2216
|
+
return result.join("\n");
|
|
2217
|
+
}
|
|
2218
|
+
get width() {
|
|
2219
|
+
return this.toString().split("\n")[0].length;
|
|
2220
|
+
}
|
|
2221
|
+
};
|
|
2222
|
+
Table.reset = () => debug.reset();
|
|
2223
|
+
function doDraw(row, lineNum, result) {
|
|
2224
|
+
let line = [];
|
|
2225
|
+
row.forEach(function(cell) {
|
|
2226
|
+
line.push(cell.draw(lineNum));
|
|
2227
|
+
});
|
|
2228
|
+
let str = line.join("");
|
|
2229
|
+
if (str.length) result.push(str);
|
|
2230
|
+
}
|
|
2231
|
+
module.exports = Table;
|
|
2232
|
+
}));
|
|
2233
|
+
//#endregion
|
|
2234
|
+
//#region ../../node_modules/.pnpm/cli-table3@0.6.5/node_modules/cli-table3/index.js
|
|
2235
|
+
var require_cli_table3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2236
|
+
module.exports = require_table();
|
|
2237
|
+
}));
|
|
2238
|
+
//#endregion
|
|
2239
|
+
//#region src/ux/table.ts
|
|
2240
|
+
var import_cli_table3 = /* @__PURE__ */ __toESM(require_cli_table3(), 1);
|
|
2241
|
+
/**
|
|
2242
|
+
* Format diagnostics as a table
|
|
2243
|
+
* @param diagnostics - Diagnostics to format
|
|
2244
|
+
* @param verbose - If false, hide INFO level diagnostics (default: false)
|
|
2245
|
+
*/
|
|
2246
|
+
function formatDiagnosticsTable(diagnostics, verbose = false) {
|
|
2247
|
+
const filteredDiagnostics = verbose ? diagnostics : diagnostics.filter((d) => d.level !== "info");
|
|
2248
|
+
if (filteredDiagnostics.length === 0) return "";
|
|
2249
|
+
const table = new import_cli_table3.default({
|
|
2250
|
+
head: [
|
|
2251
|
+
chalk.bold("Level"),
|
|
2252
|
+
chalk.bold("Code"),
|
|
2253
|
+
chalk.bold("Message"),
|
|
2254
|
+
chalk.bold("File")
|
|
2255
|
+
],
|
|
2256
|
+
colWidths: [
|
|
2257
|
+
9,
|
|
2258
|
+
35,
|
|
2259
|
+
60,
|
|
2260
|
+
30
|
|
2261
|
+
],
|
|
2262
|
+
style: {
|
|
2263
|
+
head: [],
|
|
2264
|
+
border: []
|
|
2265
|
+
},
|
|
2266
|
+
wordWrap: true
|
|
2267
|
+
});
|
|
2268
|
+
for (const diagnostic of filteredDiagnostics) {
|
|
2269
|
+
const level = formatLevel(diagnostic.level);
|
|
2270
|
+
const file = extractFilename(diagnostic.file || "-");
|
|
2271
|
+
table.push([
|
|
2272
|
+
level,
|
|
2273
|
+
diagnostic.code,
|
|
2274
|
+
diagnostic.message,
|
|
2275
|
+
file
|
|
2276
|
+
]);
|
|
2277
|
+
}
|
|
2278
|
+
return table.toString();
|
|
2279
|
+
}
|
|
2280
|
+
/**
|
|
2281
|
+
* Extract filename from path for display
|
|
2282
|
+
*/
|
|
2283
|
+
function extractFilename(path) {
|
|
2284
|
+
if (path === "-" || !path) return "-";
|
|
2285
|
+
const parts = path.split(" > ")[0].split("/");
|
|
2286
|
+
const filename = parts[parts.length - 1];
|
|
2287
|
+
if (filename.length <= 28) return filename;
|
|
2288
|
+
return "..." + filename.slice(-25);
|
|
2289
|
+
}
|
|
2290
|
+
/**
|
|
2291
|
+
* Format diagnostic level with color
|
|
2292
|
+
*/
|
|
2293
|
+
function formatLevel(level) {
|
|
2294
|
+
switch (level) {
|
|
2295
|
+
case "error": return chalk.red("ERROR");
|
|
2296
|
+
case "warning": return chalk.yellow("WARNING");
|
|
2297
|
+
case "info": return chalk.blue("INFO");
|
|
2298
|
+
default: return level.toUpperCase();
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
/**
|
|
2302
|
+
* Count error diagnostics
|
|
2303
|
+
*/
|
|
2304
|
+
function countErrors(diagnostics) {
|
|
2305
|
+
return diagnostics.filter((d) => d.level === "error").length;
|
|
2306
|
+
}
|
|
2307
|
+
/**
|
|
2308
|
+
* Count warning diagnostics
|
|
2309
|
+
*/
|
|
2310
|
+
function countWarnings(diagnostics) {
|
|
2311
|
+
return diagnostics.filter((d) => d.level === "warning").length;
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Count info diagnostics
|
|
2315
|
+
*/
|
|
2316
|
+
function countInfo(diagnostics) {
|
|
2317
|
+
return diagnostics.filter((d) => d.level === "info").length;
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Format a condensed diagnostics summary table showing counts by level
|
|
2321
|
+
* Used for batch processing to show per-package diagnostic summary
|
|
2322
|
+
*/
|
|
2323
|
+
function formatDiagnosticsSummaryTable(diagnostics) {
|
|
2324
|
+
const errorCount = countErrors(diagnostics);
|
|
2325
|
+
const warningCount = countWarnings(diagnostics);
|
|
2326
|
+
const infoCount = countInfo(diagnostics);
|
|
2327
|
+
const table = new import_cli_table3.default({
|
|
2328
|
+
head: [chalk.bold("Level"), chalk.bold("Count")],
|
|
2329
|
+
style: {
|
|
2330
|
+
head: [],
|
|
2331
|
+
border: []
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
table.push([chalk.red("ERROR"), errorCount.toString()], [chalk.yellow("WARNING"), warningCount.toString()], [chalk.blue("INFO"), infoCount.toString()]);
|
|
2335
|
+
return table.toString();
|
|
2336
|
+
}
|
|
2337
|
+
//#endregion
|
|
2338
|
+
//#region src/utils/batchProcessors.ts
|
|
2339
|
+
/**
|
|
2340
|
+
* Per-package conversion tasks, shared by the serial batch path
|
|
2341
|
+
* (`processBatch`) and the parallel worker path (`processBatchParallel` via
|
|
2342
|
+
* `batchWorker`). Extracting them here keeps a single implementation per
|
|
2343
|
+
* direction — the same code runs inline or inside a worker thread.
|
|
2344
|
+
*/
|
|
2345
|
+
/** Run one batch task in-process (used by the worker and directly in tests). */
|
|
2346
|
+
async function runBatchTask(task, quiet = true) {
|
|
2347
|
+
if (task.direction === "qti-to-learnosity") return processQtiPackageToLearnosity(task.pkg, task.packageOutputPath, task.options, quiet);
|
|
2348
|
+
return processLearnosityToQtiPackage(task.pkg, task.packageOutputPath, task.options, quiet);
|
|
2349
|
+
}
|
|
2350
|
+
function displayDiagnosticsSummary(diagnostics, quiet) {
|
|
2351
|
+
if (quiet) return;
|
|
2352
|
+
const summaryTable = formatDiagnosticsSummaryTable(diagnostics);
|
|
2353
|
+
if (summaryTable) {
|
|
2354
|
+
console.log(" Diagnostics:");
|
|
2355
|
+
console.log(summaryTable.split("\n").map((line) => " " + line).join("\n"));
|
|
2356
|
+
console.log("");
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
/** Convert one QTI Content Package directory to a Learnosity bundle on disk. */
|
|
2360
|
+
async function processQtiPackageToLearnosity(pkg, packageOutputPath, options, quiet) {
|
|
2361
|
+
const loaded = loadPackageDirectory(pkg.path);
|
|
2362
|
+
const convertResult = loaded.entries ? convertQtiPackageToLearnosityBundle({ entries: loaded.entries }, {
|
|
2363
|
+
organisationId: options.organisationId,
|
|
2364
|
+
mediaVault: options.mediaVault,
|
|
2365
|
+
customAssetUrl: options.customAssetUrl,
|
|
2366
|
+
itemReferenceSource: options.itemReferenceSource,
|
|
2367
|
+
itemFilenameSource: options.itemFilenameSource,
|
|
2368
|
+
truncateTags: options.truncateTags,
|
|
2369
|
+
packageVersion: options.version,
|
|
2370
|
+
sourceDir: pkg.path,
|
|
2371
|
+
fileAccess: nodeFileAccess
|
|
2372
|
+
}) : { diagnostics: loaded.diagnostics };
|
|
2373
|
+
const errors = convertResult.diagnostics.filter((d) => d.level === "error");
|
|
2374
|
+
const warnings = convertResult.diagnostics.filter((d) => d.level === "warning");
|
|
2375
|
+
const hasValidBundle = convertResult.bundle && convertResult.bundle.items.size > 0;
|
|
2376
|
+
const convertedFiles = convertResult.convertedSourceFiles || [];
|
|
2377
|
+
const failedFiles = convertResult.failedSourceFiles || [];
|
|
2378
|
+
const filesWithErrors = /* @__PURE__ */ new Set();
|
|
2379
|
+
for (const d of convertResult.diagnostics) if (d.level === "error" && d.file) filesWithErrors.add(d.file);
|
|
2380
|
+
const convertedWithErrors = convertedFiles.filter((f) => filesWithErrors.has(f)).length;
|
|
2381
|
+
const erroredItemCount = failedFiles.length + convertedWithErrors;
|
|
2382
|
+
const cleanItemCount = convertedFiles.length - convertedWithErrors;
|
|
2383
|
+
if (errors.length > 0 && !hasValidBundle) return {
|
|
2384
|
+
success: false,
|
|
2385
|
+
errorCount: errors.length,
|
|
2386
|
+
warningCount: warnings.length,
|
|
2387
|
+
convertedItemCount: cleanItemCount,
|
|
2388
|
+
failedItemCount: erroredItemCount,
|
|
2389
|
+
message: "Conversion failed"
|
|
2390
|
+
};
|
|
2391
|
+
const writeResult = await writeLearnosityBundle(convertResult.bundle, {
|
|
2392
|
+
outDir: packageOutputPath,
|
|
2393
|
+
isZipOutput: false
|
|
2394
|
+
});
|
|
2395
|
+
const writeErrors = writeResult.diagnostics.filter((d) => d.level === "error");
|
|
2396
|
+
if (writeErrors.length > 0) return {
|
|
2397
|
+
success: false,
|
|
2398
|
+
errorCount: errors.length + writeErrors.length,
|
|
2399
|
+
warningCount: warnings.length,
|
|
2400
|
+
convertedItemCount: cleanItemCount,
|
|
2401
|
+
failedItemCount: erroredItemCount,
|
|
2402
|
+
message: "Write failed"
|
|
2403
|
+
};
|
|
2404
|
+
const diagnosticsPath = `${packageOutputPath}/diagnostics.json`;
|
|
2405
|
+
const allDiagnostics = [...convertResult.diagnostics, ...writeResult.diagnostics];
|
|
2406
|
+
const convertedActivityFiles = convertResult.convertedActivityFiles || [];
|
|
2407
|
+
await writeDiagnostics(allDiagnostics, "file", diagnosticsPath, packageOutputPath, false, {
|
|
2408
|
+
inputPath: pkg.path,
|
|
2409
|
+
outputPath: packageOutputPath,
|
|
2410
|
+
totalItemsFound: convertedFiles.length + failedFiles.length,
|
|
2411
|
+
totalActivitiesFound: convertedActivityFiles.length,
|
|
2412
|
+
convertedFiles,
|
|
2413
|
+
failedFiles,
|
|
2414
|
+
convertedActivities: convertedActivityFiles
|
|
2415
|
+
});
|
|
2416
|
+
if (!quiet) {
|
|
2417
|
+
const summaryTable = formatDiagnosticsSummaryTable(allDiagnostics);
|
|
2418
|
+
if (summaryTable) {
|
|
2419
|
+
console.log(" Diagnostics:");
|
|
2420
|
+
console.log(summaryTable.split("\n").map((line) => " " + line).join("\n"));
|
|
2421
|
+
console.log("");
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
return {
|
|
2425
|
+
success: true,
|
|
2426
|
+
errorCount: errors.length,
|
|
2427
|
+
warningCount: warnings.length,
|
|
2428
|
+
convertedItemCount: cleanItemCount,
|
|
2429
|
+
failedItemCount: erroredItemCount
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
/** Convert one Learnosity bundle directory to a QTI Content Package on disk. */
|
|
2433
|
+
async function processLearnosityToQtiPackage(pkg, packageOutputPath, options, quiet) {
|
|
2434
|
+
const loadResult = loadLearnosityBundle(pkg.path);
|
|
2435
|
+
if (!loadResult.bundle) {
|
|
2436
|
+
const errorCount = loadResult.diagnostics.filter((d) => d.level === "error").length;
|
|
2437
|
+
displayDiagnosticsSummary(loadResult.diagnostics, quiet);
|
|
2438
|
+
return {
|
|
2439
|
+
success: false,
|
|
2440
|
+
errorCount,
|
|
2441
|
+
warningCount: 0,
|
|
2442
|
+
message: "Bundle load error"
|
|
2443
|
+
};
|
|
2444
|
+
}
|
|
2445
|
+
const bundle = loadResult.bundle;
|
|
2446
|
+
const allDiagnostics = [...loadResult.diagnostics];
|
|
2447
|
+
const allConvertedActivities = [];
|
|
2448
|
+
const usedFolderNames = /* @__PURE__ */ new Set();
|
|
2449
|
+
const convertedItemRefs = /* @__PURE__ */ new Set();
|
|
2450
|
+
const failedItemRefs = /* @__PURE__ */ new Set();
|
|
2451
|
+
for (const activityRef of bundle.activityRefs) {
|
|
2452
|
+
const convertResult = convertActivity(bundle, activityRef, {
|
|
2453
|
+
pretty: options.pretty,
|
|
2454
|
+
version: options.qtiVersion
|
|
2455
|
+
});
|
|
2456
|
+
allDiagnostics.push(...convertResult.diagnostics);
|
|
2457
|
+
const itemRefs = bundle.activityItemRefs.get(activityRef) ?? [];
|
|
2458
|
+
const successfulItemRefs = new Set(convertResult.items.map((item) => item.reference));
|
|
2459
|
+
for (const itemRef of itemRefs) if (successfulItemRefs.has(itemRef)) convertedItemRefs.add(itemRef);
|
|
2460
|
+
else failedItemRefs.add(itemRef);
|
|
2461
|
+
if (convertResult.items.length > 0) {
|
|
2462
|
+
const sanitizedName = sanitizeFolderName(activityRef, `activity_${allConvertedActivities.length + 1}`);
|
|
2463
|
+
const folderName = ensureUniqueFolderName(sanitizedName, usedFolderNames);
|
|
2464
|
+
allConvertedActivities.push({
|
|
2465
|
+
activityRef,
|
|
2466
|
+
folderName,
|
|
2467
|
+
conversion: convertResult
|
|
2468
|
+
});
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
for (const itemRef of convertedItemRefs) failedItemRefs.delete(itemRef);
|
|
2472
|
+
const convertedFiles = itemRefsToFilenames(bundle, convertedItemRefs);
|
|
2473
|
+
const failedFiles = itemRefsToFilenames(bundle, failedItemRefs);
|
|
2474
|
+
const convertedActivityFiles = allConvertedActivities.map(({ activityRef }) => `activities/${activityRef}.json`);
|
|
2475
|
+
const failedActivityFiles = bundle.activityRefs.filter((ref) => !allConvertedActivities.some((a) => a.activityRef === ref)).map((ref) => `activities/${ref}.json`);
|
|
2476
|
+
const totalItemsConverted = convertedItemRefs.size;
|
|
2477
|
+
const totalItemsFailed = failedItemRefs.size;
|
|
2478
|
+
const writePackageDiagnostics = () => writeDiagnostics(allDiagnostics, "file", `${packageOutputPath}/diagnostics.json`, packageOutputPath, false, {
|
|
2479
|
+
inputPath: pkg.path,
|
|
2480
|
+
outputPath: packageOutputPath,
|
|
2481
|
+
totalItemsFound: totalItemsConverted + totalItemsFailed,
|
|
2482
|
+
totalActivitiesFound: bundle.activityRefs.length,
|
|
2483
|
+
convertedFiles,
|
|
2484
|
+
failedFiles,
|
|
2485
|
+
convertedActivities: convertedActivityFiles,
|
|
2486
|
+
failedActivities: failedActivityFiles
|
|
2487
|
+
});
|
|
2488
|
+
if (allConvertedActivities.length === 0) {
|
|
2489
|
+
const errorCount = allDiagnostics.filter((d) => d.level === "error").length;
|
|
2490
|
+
await writePackageDiagnostics();
|
|
2491
|
+
return {
|
|
2492
|
+
success: false,
|
|
2493
|
+
errorCount,
|
|
2494
|
+
warningCount: allDiagnostics.filter((d) => d.level === "warning").length,
|
|
2495
|
+
convertedItemCount: 0,
|
|
2496
|
+
failedItemCount: totalItemsFailed,
|
|
2497
|
+
message: "No activities converted"
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
const pkgData = {
|
|
2501
|
+
zipPath: "",
|
|
2502
|
+
resources: [],
|
|
2503
|
+
entries: /* @__PURE__ */ new Map(),
|
|
2504
|
+
items: [],
|
|
2505
|
+
assets: []
|
|
2506
|
+
};
|
|
2507
|
+
const addedResourceIds = /* @__PURE__ */ new Set();
|
|
2508
|
+
for (const { activityRef, folderName, conversion } of allConvertedActivities) {
|
|
2509
|
+
const packageResult = buildPackageFromActivity(conversion, {
|
|
2510
|
+
bundleDir: pkg.path,
|
|
2511
|
+
activityRef,
|
|
2512
|
+
version: options.qtiVersion
|
|
2513
|
+
});
|
|
2514
|
+
allDiagnostics.push(...packageResult.diagnostics);
|
|
2515
|
+
mergeActivityPackage(pkgData, folderName, packageResult, addedResourceIds);
|
|
2516
|
+
}
|
|
2517
|
+
const saveResult = saveQtiContentPackage(pkgData, packageOutputPath);
|
|
2518
|
+
allDiagnostics.push(...saveResult.diagnostics);
|
|
2519
|
+
const errors = allDiagnostics.filter((d) => d.level === "error");
|
|
2520
|
+
const warnings = allDiagnostics.filter((d) => d.level === "warning");
|
|
2521
|
+
await writePackageDiagnostics();
|
|
2522
|
+
displayDiagnosticsSummary(allDiagnostics, quiet);
|
|
2523
|
+
if (errors.length > 0) return {
|
|
2524
|
+
success: false,
|
|
2525
|
+
errorCount: errors.length,
|
|
2526
|
+
warningCount: warnings.length,
|
|
2527
|
+
convertedItemCount: totalItemsConverted,
|
|
2528
|
+
failedItemCount: totalItemsFailed,
|
|
2529
|
+
message: "Conversion failed"
|
|
2530
|
+
};
|
|
2531
|
+
return {
|
|
2532
|
+
success: true,
|
|
2533
|
+
errorCount: 0,
|
|
2534
|
+
warningCount: warnings.length,
|
|
2535
|
+
convertedItemCount: totalItemsConverted,
|
|
2536
|
+
failedItemCount: totalItemsFailed
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Map item references to the filenames they were loaded from, for the
|
|
2541
|
+
* diagnostics report. Falls back to the reference when the bundle has no
|
|
2542
|
+
* filename recorded, so counts always match the listed items.
|
|
2543
|
+
*/
|
|
2544
|
+
function itemRefsToFilenames(bundle, itemRefs) {
|
|
2545
|
+
return [...itemRefs].map((itemRef) => bundle.itemRefToFilename.get(itemRef) ?? itemRef);
|
|
2546
|
+
}
|
|
2547
|
+
//#endregion
|
|
2548
|
+
export { formatDiagnosticsSummaryTable as a, chalk as c, __commonJSMin as d, __exportAll as f, countErrors as i, require_string_width as l, __toESM as m, processQtiPackageToLearnosity as n, formatDiagnosticsTable as o, __require as p, runBatchTask as r, require_cli_table3 as s, processLearnosityToQtiPackage as t, writeDiagnostics as u };
|
|
2549
|
+
|
|
2550
|
+
//# sourceMappingURL=batchProcessors-B8EQvMbH.js.map
|