ccusage 0.3.1 → 0.4.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 +29 -0
- package/dist/calculate-cost.d.ts +1 -18
- package/dist/data-loader-D1LHcGfa.d.ts +1563 -0
- package/dist/{data-loader-Dh4y6ICb.js → data-loader-DlG6jpnf.js} +1683 -160
- package/dist/data-loader.d.ts +2 -2
- package/dist/data-loader.js +2 -2
- package/dist/index.js +419 -1222
- package/package.json +2 -10
- package/dist/data-loader-Ds_vUoR2.d.ts +0 -49
package/dist/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { __commonJS, __require, __toESM, getDefaultClaudePath, loadSessionData, loadUsageData } from "./data-loader-
|
|
2
|
+
import { UsageDataSchema, __commonJS, __require, __toESM, boolean, calculateCostFromTokens, description, fetchModelPricing, getDefaultClaudePath, getModelPricing, glob, loadSessionData, loadUsageData, log, logger, name, number, object, optional, pipe, record, regex, safeParse, string, union, version } from "./data-loader-DlG6jpnf.js";
|
|
3
3
|
import { calculateTotals, createTotalsObject, getTotalTokens } from "./calculate-cost-DMC4FhU4.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
7
|
import process$1 from "node:process";
|
|
8
|
-
import { formatWithOptions } from "node:util";
|
|
9
|
-
import * as tty from "node:tty";
|
|
10
8
|
|
|
11
9
|
//#region node_modules/gunshi/lib/utils-B_QNzw5q.js
|
|
12
10
|
/**
|
|
@@ -170,7 +168,7 @@ var DefaultTranslation = class {
|
|
|
170
168
|
let message = this.getMessage(locale, key);
|
|
171
169
|
if (message === void 0 && locale !== this.#options.fallbackLocale) message = this.getMessage(this.#options.fallbackLocale, key);
|
|
172
170
|
if (message === void 0) return;
|
|
173
|
-
return message.replaceAll(/\{\{(\w+)\}\}/g, (_
|
|
171
|
+
return message.replaceAll(/\{\{(\w+)\}\}/g, (_, name$1) => {
|
|
174
172
|
return values[name$1] == null ? "" : values[name$1].toString();
|
|
175
173
|
});
|
|
176
174
|
}
|
|
@@ -181,7 +179,7 @@ const BUILT_IN_PREFIX_CODE = BUILT_IN_PREFIX.codePointAt(0);
|
|
|
181
179
|
* @param param A {@link CommandContextParams | parameters} to create a {@link CommandContext | command context}
|
|
182
180
|
* @returns A {@link CommandContext | command context}, which is readonly
|
|
183
181
|
*/
|
|
184
|
-
async function createCommandContext({ args, values, positionals, rest, argv: argv$
|
|
182
|
+
async function createCommandContext({ args, values, positionals, rest, argv: argv$1, tokens, command, cliOptions, callMode = "entry", omitted = false }) {
|
|
185
183
|
/**
|
|
186
184
|
* normailize the options schema and values, to avoid prototype pollution
|
|
187
185
|
*/
|
|
@@ -192,7 +190,7 @@ async function createCommandContext({ args, values, positionals, rest, argv: arg
|
|
|
192
190
|
/**
|
|
193
191
|
* setup the environment
|
|
194
192
|
*/
|
|
195
|
-
const env$
|
|
193
|
+
const env$2 = Object.assign(create(), COMMAND_OPTIONS_DEFAULT, cliOptions);
|
|
196
194
|
const locale = resolveLocale(cliOptions.locale);
|
|
197
195
|
const localeStr = locale.toString();
|
|
198
196
|
const translationAdapterFactory = cliOptions.translationAdapterFactory || createTranslationAdapter;
|
|
@@ -239,12 +237,12 @@ async function createCommandContext({ args, values, positionals, rest, argv: arg
|
|
|
239
237
|
omitted,
|
|
240
238
|
callMode,
|
|
241
239
|
locale,
|
|
242
|
-
env: env$
|
|
240
|
+
env: env$2,
|
|
243
241
|
args: _args,
|
|
244
242
|
values,
|
|
245
243
|
positionals,
|
|
246
244
|
rest,
|
|
247
|
-
_: argv$
|
|
245
|
+
_: argv$1,
|
|
248
246
|
tokens,
|
|
249
247
|
toKebab: command.toKebab,
|
|
250
248
|
log: cliOptions.usageSilent ? NOOP : log$1,
|
|
@@ -540,7 +538,7 @@ function resolveDisplayValue(ctx, key) {
|
|
|
540
538
|
* @returns Generated options usage
|
|
541
539
|
*/
|
|
542
540
|
async function generateOptionalArgsUsage(ctx, optionsPairs) {
|
|
543
|
-
const optionsMaxLength = Math.max(...Object.entries(optionsPairs).map(([_
|
|
541
|
+
const optionsMaxLength = Math.max(...Object.entries(optionsPairs).map(([_, value]) => value.length));
|
|
544
542
|
const optionSchemaMaxLength = ctx.env.usageOptionType ? Math.max(...Object.entries(optionsPairs).map(([key]) => resolveNegatableType(key, ctx).length)) : 0;
|
|
545
543
|
const usages = await Promise.all(Object.entries(optionsPairs).map(([key, value]) => {
|
|
546
544
|
let rawDesc = ctx.translate(resolveArgKey(key));
|
|
@@ -559,7 +557,7 @@ async function generateOptionalArgsUsage(ctx, optionsPairs) {
|
|
|
559
557
|
return usages.join("\n");
|
|
560
558
|
}
|
|
561
559
|
function getPositionalArgs(ctx) {
|
|
562
|
-
return Object.entries(ctx.args).filter(([_
|
|
560
|
+
return Object.entries(ctx.args).filter(([_, schema]) => schema.type === "positional");
|
|
563
561
|
}
|
|
564
562
|
async function generatePositionalArgsUsage(ctx) {
|
|
565
563
|
const positionals = getPositionalArgs(ctx);
|
|
@@ -679,8 +677,8 @@ function parseArgs(args, options = {}) {
|
|
|
679
677
|
if (isShortOptionGroup(arg)) {
|
|
680
678
|
const expanded = [];
|
|
681
679
|
let shortValue = "";
|
|
682
|
-
for (let i
|
|
683
|
-
const shortableOption = arg.charAt(i
|
|
680
|
+
for (let i = 1; i < arg.length; i++) {
|
|
681
|
+
const shortableOption = arg.charAt(i);
|
|
684
682
|
if (hasShortValueSeparator) shortValue += shortableOption;
|
|
685
683
|
else if (!allowCompatible && shortableOption.codePointAt(0) === EQUAL_CODE) hasShortValueSeparator = true;
|
|
686
684
|
else expanded.push(`${SHORT_OPTION_PREFIX}${shortableOption}`);
|
|
@@ -825,8 +823,8 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
|
|
|
825
823
|
*/
|
|
826
824
|
const schemas = Object.values(args);
|
|
827
825
|
let terminated = false;
|
|
828
|
-
for (let i
|
|
829
|
-
const token = tokens[i
|
|
826
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
827
|
+
const token = tokens[i];
|
|
830
828
|
if (token.kind === "positional") {
|
|
831
829
|
if (terminated && token.value) {
|
|
832
830
|
rest.push(token.value);
|
|
@@ -914,8 +912,8 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
|
|
|
914
912
|
positionalsCount++;
|
|
915
913
|
continue;
|
|
916
914
|
}
|
|
917
|
-
for (let i
|
|
918
|
-
const token = optionTokens[i
|
|
915
|
+
for (let i = 0; i < optionTokens.length; i++) {
|
|
916
|
+
const token = optionTokens[i];
|
|
919
917
|
if (checkTokenName(arg, schema, token) && token.rawName != void 0 && hasLongOptionPrefix(token.rawName) || schema.short === token.name && token.rawName != void 0 && isShortOption(token.rawName)) {
|
|
920
918
|
const invalid = validateRequire(token, arg, schema);
|
|
921
919
|
if (invalid) {
|
|
@@ -949,7 +947,7 @@ function parse(token, option, schema) {
|
|
|
949
947
|
return token.value ? [+token.value, void 0] : [+(schema.default || ""), void 0];
|
|
950
948
|
}
|
|
951
949
|
case "enum": {
|
|
952
|
-
if (schema.choices && !schema.choices.includes(token.value)) return [void 0, new ArgResolveError(`Optional argument '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}should be chosen from '${schema.type}' [${schema.choices.map((c
|
|
950
|
+
if (schema.choices && !schema.choices.includes(token.value)) return [void 0, new ArgResolveError(`Optional argument '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}should be chosen from '${schema.type}' [${schema.choices.map((c) => JSON.stringify(c)).join(", ")}] values`, option, "type", schema)];
|
|
953
951
|
return [token.value || schema.default, void 0];
|
|
954
952
|
}
|
|
955
953
|
case "custom": {
|
|
@@ -1001,9 +999,9 @@ function createTypeError(option, schema) {
|
|
|
1001
999
|
* @param options A {@link CliOptions | CLI options}
|
|
1002
1000
|
* @returns A rendered usage or undefined. if you will use {@link CliOptions.usageSilent} option, it will return rendered usage string.
|
|
1003
1001
|
*/
|
|
1004
|
-
async function cli(argv$
|
|
1002
|
+
async function cli(argv$1, entry, options = {}) {
|
|
1005
1003
|
const cliOptions = resolveCliOptions(options, entry);
|
|
1006
|
-
const tokens = parseArgs(argv$
|
|
1004
|
+
const tokens = parseArgs(argv$1);
|
|
1007
1005
|
const subCommand = getSubCommand(tokens);
|
|
1008
1006
|
const { commandName: name$1, command, callMode } = await resolveCommand(subCommand, entry, cliOptions);
|
|
1009
1007
|
if (!command) throw new Error(`Command not found: ${name$1 || ""}`);
|
|
@@ -1019,7 +1017,7 @@ async function cli(argv$2, entry, options = {}) {
|
|
|
1019
1017
|
values,
|
|
1020
1018
|
positionals,
|
|
1021
1019
|
rest,
|
|
1022
|
-
argv: argv$
|
|
1020
|
+
argv: argv$1,
|
|
1023
1021
|
tokens,
|
|
1024
1022
|
omitted,
|
|
1025
1023
|
callMode,
|
|
@@ -1147,8 +1145,8 @@ var require_debug = __commonJS({ "node_modules/cli-table3/src/debug.js"(exports,
|
|
|
1147
1145
|
debug$3.reset = () => {
|
|
1148
1146
|
messages = [];
|
|
1149
1147
|
};
|
|
1150
|
-
debug$3.setDebugLevel = (v
|
|
1151
|
-
level = v
|
|
1148
|
+
debug$3.setDebugLevel = (v) => {
|
|
1149
|
+
level = v;
|
|
1152
1150
|
};
|
|
1153
1151
|
debug$3.warn = (msg) => debug$3(msg, debug$3.WARN);
|
|
1154
1152
|
debug$3.info = (msg) => debug$3(msg, debug$3.INFO);
|
|
@@ -1169,8 +1167,8 @@ var require_ansi_regex = __commonJS({ "node_modules/ansi-regex/index.js"(exports
|
|
|
1169
1167
|
//#endregion
|
|
1170
1168
|
//#region node_modules/strip-ansi/index.js
|
|
1171
1169
|
var require_strip_ansi = __commonJS({ "node_modules/strip-ansi/index.js"(exports, module) {
|
|
1172
|
-
const ansiRegex
|
|
1173
|
-
module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex
|
|
1170
|
+
const ansiRegex = require_ansi_regex();
|
|
1171
|
+
module.exports = (string$1) => typeof string$1 === "string" ? string$1.replace(ansiRegex(), "") : string$1;
|
|
1174
1172
|
} });
|
|
1175
1173
|
|
|
1176
1174
|
//#endregion
|
|
@@ -1196,32 +1194,32 @@ var require_emoji_regex = __commonJS({ "node_modules/emoji-regex/index.js"(expor
|
|
|
1196
1194
|
//#endregion
|
|
1197
1195
|
//#region node_modules/string-width/index.js
|
|
1198
1196
|
var require_string_width = __commonJS({ "node_modules/string-width/index.js"(exports, module) {
|
|
1199
|
-
const stripAnsi
|
|
1197
|
+
const stripAnsi = require_strip_ansi();
|
|
1200
1198
|
const isFullwidthCodePoint = require_is_fullwidth_code_point();
|
|
1201
|
-
const emojiRegex
|
|
1202
|
-
const stringWidth$
|
|
1203
|
-
if (typeof string !== "string" || string.length === 0) return 0;
|
|
1204
|
-
string = stripAnsi
|
|
1205
|
-
if (string.length === 0) return 0;
|
|
1206
|
-
string = string.replace(emojiRegex
|
|
1199
|
+
const emojiRegex = require_emoji_regex();
|
|
1200
|
+
const stringWidth$1 = (string$1) => {
|
|
1201
|
+
if (typeof string$1 !== "string" || string$1.length === 0) return 0;
|
|
1202
|
+
string$1 = stripAnsi(string$1);
|
|
1203
|
+
if (string$1.length === 0) return 0;
|
|
1204
|
+
string$1 = string$1.replace(emojiRegex(), " ");
|
|
1207
1205
|
let width = 0;
|
|
1208
|
-
for (let i
|
|
1209
|
-
const code = string.codePointAt(i
|
|
1206
|
+
for (let i = 0; i < string$1.length; i++) {
|
|
1207
|
+
const code = string$1.codePointAt(i);
|
|
1210
1208
|
if (code <= 31 || code >= 127 && code <= 159) continue;
|
|
1211
1209
|
if (code >= 768 && code <= 879) continue;
|
|
1212
|
-
if (code > 65535) i
|
|
1210
|
+
if (code > 65535) i++;
|
|
1213
1211
|
width += isFullwidthCodePoint(code) ? 2 : 1;
|
|
1214
1212
|
}
|
|
1215
1213
|
return width;
|
|
1216
1214
|
};
|
|
1217
|
-
module.exports = stringWidth$
|
|
1218
|
-
module.exports.default = stringWidth$
|
|
1215
|
+
module.exports = stringWidth$1;
|
|
1216
|
+
module.exports.default = stringWidth$1;
|
|
1219
1217
|
} });
|
|
1220
1218
|
|
|
1221
1219
|
//#endregion
|
|
1222
1220
|
//#region node_modules/cli-table3/src/utils.js
|
|
1223
1221
|
var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports, module) {
|
|
1224
|
-
const stringWidth
|
|
1222
|
+
const stringWidth = require_string_width();
|
|
1225
1223
|
function codeRegex(capture) {
|
|
1226
1224
|
return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g;
|
|
1227
1225
|
}
|
|
@@ -1229,8 +1227,8 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
|
|
|
1229
1227
|
let code = codeRegex();
|
|
1230
1228
|
let stripped = ("" + str).replace(code, "");
|
|
1231
1229
|
let split = stripped.split("\n");
|
|
1232
|
-
return split.reduce(function(memo, s
|
|
1233
|
-
return stringWidth
|
|
1230
|
+
return split.reduce(function(memo, s) {
|
|
1231
|
+
return stringWidth(s) > memo ? stringWidth(s) : memo;
|
|
1234
1232
|
}, 0);
|
|
1235
1233
|
}
|
|
1236
1234
|
function repeat(str, times) {
|
|
@@ -1292,9 +1290,9 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
|
|
|
1292
1290
|
return;
|
|
1293
1291
|
}
|
|
1294
1292
|
if (controlCode === 0) {
|
|
1295
|
-
for (let i
|
|
1293
|
+
for (let i in state)
|
|
1296
1294
|
/* istanbul ignore else */
|
|
1297
|
-
if (Object.prototype.hasOwnProperty.call(state, i
|
|
1295
|
+
if (Object.prototype.hasOwnProperty.call(state, i)) delete state[i];
|
|
1298
1296
|
return;
|
|
1299
1297
|
}
|
|
1300
1298
|
let info$1 = codeCache[controlChars[0]];
|
|
@@ -1421,8 +1419,8 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
|
|
|
1421
1419
|
let line = [];
|
|
1422
1420
|
let lineLength = 0;
|
|
1423
1421
|
let whitespace;
|
|
1424
|
-
for (let i
|
|
1425
|
-
let word = split[i
|
|
1422
|
+
for (let i = 0; i < split.length; i += 2) {
|
|
1423
|
+
let word = split[i];
|
|
1426
1424
|
let newLength = lineLength + strlen(word);
|
|
1427
1425
|
if (lineLength > 0 && whitespace) newLength += whitespace.length;
|
|
1428
1426
|
if (newLength > maxLength) {
|
|
@@ -1433,7 +1431,7 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
|
|
|
1433
1431
|
line.push(whitespace || "", word);
|
|
1434
1432
|
lineLength = newLength;
|
|
1435
1433
|
}
|
|
1436
|
-
whitespace = split[i
|
|
1434
|
+
whitespace = split[i + 1];
|
|
1437
1435
|
}
|
|
1438
1436
|
if (lineLength) lines.push(line.join(""));
|
|
1439
1437
|
return lines;
|
|
@@ -1450,7 +1448,7 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
|
|
|
1450
1448
|
}
|
|
1451
1449
|
}
|
|
1452
1450
|
let split = input.split(/(\s+)/g);
|
|
1453
|
-
for (let i
|
|
1451
|
+
for (let i = 0; i < split.length; i += 2) pushLine(split[i], i && split[i - 1]);
|
|
1454
1452
|
if (line.length) lines.push(line);
|
|
1455
1453
|
return lines;
|
|
1456
1454
|
}
|
|
@@ -1458,14 +1456,14 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
|
|
|
1458
1456
|
let output = [];
|
|
1459
1457
|
input = input.split("\n");
|
|
1460
1458
|
const handler = wrapOnWordBoundary ? wordWrap : textWrap;
|
|
1461
|
-
for (let i
|
|
1459
|
+
for (let i = 0; i < input.length; i++) output.push.apply(output, handler(maxLength, input[i]));
|
|
1462
1460
|
return output;
|
|
1463
1461
|
}
|
|
1464
1462
|
function colorizeLines(input) {
|
|
1465
1463
|
let state = {};
|
|
1466
1464
|
let output = [];
|
|
1467
|
-
for (let i
|
|
1468
|
-
let line = rewindState(state, input[i
|
|
1465
|
+
for (let i = 0; i < input.length; i++) {
|
|
1466
|
+
let line = rewindState(state, input[i]);
|
|
1469
1467
|
state = readState(line);
|
|
1470
1468
|
let temp = Object.assign({}, state);
|
|
1471
1469
|
output.push(unwindState(temp, line));
|
|
@@ -1574,11 +1572,11 @@ var require_styles = __commonJS({ "node_modules/@colors/colors/lib/styles.js"(ex
|
|
|
1574
1572
|
//#endregion
|
|
1575
1573
|
//#region node_modules/@colors/colors/lib/system/has-flag.js
|
|
1576
1574
|
var require_has_flag = __commonJS({ "node_modules/@colors/colors/lib/system/has-flag.js"(exports, module) {
|
|
1577
|
-
module.exports = function(flag, argv$
|
|
1578
|
-
argv$
|
|
1579
|
-
var terminatorPos = argv$
|
|
1575
|
+
module.exports = function(flag, argv$1) {
|
|
1576
|
+
argv$1 = argv$1 || process.argv;
|
|
1577
|
+
var terminatorPos = argv$1.indexOf("--");
|
|
1580
1578
|
var prefix = /^-{1,2}/.test(flag) ? "" : "--";
|
|
1581
|
-
var pos = argv$
|
|
1579
|
+
var pos = argv$1.indexOf(prefix + flag);
|
|
1582
1580
|
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
|
1583
1581
|
};
|
|
1584
1582
|
} });
|
|
@@ -1588,11 +1586,11 @@ var require_has_flag = __commonJS({ "node_modules/@colors/colors/lib/system/has-
|
|
|
1588
1586
|
var require_supports_colors = __commonJS({ "node_modules/@colors/colors/lib/system/supports-colors.js"(exports, module) {
|
|
1589
1587
|
var os = __require("os");
|
|
1590
1588
|
var hasFlag = require_has_flag();
|
|
1591
|
-
var env$
|
|
1589
|
+
var env$1 = process.env;
|
|
1592
1590
|
var forceColor = void 0;
|
|
1593
1591
|
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) forceColor = false;
|
|
1594
1592
|
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = true;
|
|
1595
|
-
if ("FORCE_COLOR" in env$
|
|
1593
|
+
if ("FORCE_COLOR" in env$1) forceColor = env$1.FORCE_COLOR.length === 0 || parseInt(env$1.FORCE_COLOR, 10) !== 0;
|
|
1596
1594
|
function translateLevel(level$1) {
|
|
1597
1595
|
if (level$1 === 0) return false;
|
|
1598
1596
|
return {
|
|
@@ -1613,30 +1611,30 @@ var require_supports_colors = __commonJS({ "node_modules/@colors/colors/lib/syst
|
|
|
1613
1611
|
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1614
1612
|
return 1;
|
|
1615
1613
|
}
|
|
1616
|
-
if ("CI" in env$
|
|
1614
|
+
if ("CI" in env$1) {
|
|
1617
1615
|
if ([
|
|
1618
1616
|
"TRAVIS",
|
|
1619
1617
|
"CIRCLECI",
|
|
1620
1618
|
"APPVEYOR",
|
|
1621
1619
|
"GITLAB_CI"
|
|
1622
1620
|
].some(function(sign) {
|
|
1623
|
-
return sign in env$
|
|
1624
|
-
}) || env$
|
|
1621
|
+
return sign in env$1;
|
|
1622
|
+
}) || env$1.CI_NAME === "codeship") return 1;
|
|
1625
1623
|
return min;
|
|
1626
1624
|
}
|
|
1627
|
-
if ("TEAMCITY_VERSION" in env$
|
|
1628
|
-
if ("TERM_PROGRAM" in env$
|
|
1629
|
-
var version$2 = parseInt((env$
|
|
1630
|
-
switch (env$
|
|
1625
|
+
if ("TEAMCITY_VERSION" in env$1) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
|
|
1626
|
+
if ("TERM_PROGRAM" in env$1) {
|
|
1627
|
+
var version$2 = parseInt((env$1.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
1628
|
+
switch (env$1.TERM_PROGRAM) {
|
|
1631
1629
|
case "iTerm.app": return version$2 >= 3 ? 3 : 2;
|
|
1632
1630
|
case "Hyper": return 3;
|
|
1633
1631
|
case "Apple_Terminal": return 2;
|
|
1634
1632
|
}
|
|
1635
1633
|
}
|
|
1636
|
-
if (/-256(color)?$/i.test(env$
|
|
1637
|
-
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env$
|
|
1638
|
-
if ("COLORTERM" in env$
|
|
1639
|
-
if (env$
|
|
1634
|
+
if (/-256(color)?$/i.test(env$1.TERM)) return 2;
|
|
1635
|
+
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) return 1;
|
|
1636
|
+
if ("COLORTERM" in env$1) return 1;
|
|
1637
|
+
if (env$1.TERM === "dumb") return min;
|
|
1640
1638
|
return min;
|
|
1641
1639
|
}
|
|
1642
1640
|
function getSupportLevel(stream) {
|
|
@@ -1786,12 +1784,12 @@ var require_trap = __commonJS({ "node_modules/@colors/colors/lib/custom/trap.js"
|
|
|
1786
1784
|
],
|
|
1787
1785
|
z: ["Ƶ", "ɀ"]
|
|
1788
1786
|
};
|
|
1789
|
-
text.forEach(function(c
|
|
1790
|
-
c
|
|
1791
|
-
var chars = trap[c
|
|
1787
|
+
text.forEach(function(c) {
|
|
1788
|
+
c = c.toLowerCase();
|
|
1789
|
+
var chars = trap[c] || [" "];
|
|
1792
1790
|
var rand = Math.floor(Math.random() * chars.length);
|
|
1793
|
-
if (typeof trap[c
|
|
1794
|
-
else result += c
|
|
1791
|
+
if (typeof trap[c] !== "undefined") result += trap[c][rand];
|
|
1792
|
+
else result += c;
|
|
1795
1793
|
});
|
|
1796
1794
|
return result;
|
|
1797
1795
|
};
|
|
@@ -1924,29 +1922,29 @@ var require_zalgo = __commonJS({ "node_modules/@colors/colors/lib/custom/zalgo.j
|
|
|
1924
1922
|
};
|
|
1925
1923
|
var all = [].concat(soul.up, soul.down, soul.mid);
|
|
1926
1924
|
function randomNumber(range) {
|
|
1927
|
-
var r
|
|
1928
|
-
return r
|
|
1925
|
+
var r = Math.floor(Math.random() * range);
|
|
1926
|
+
return r;
|
|
1929
1927
|
}
|
|
1930
1928
|
function isChar(character) {
|
|
1931
1929
|
var bool = false;
|
|
1932
|
-
all.filter(function(i
|
|
1933
|
-
bool = i
|
|
1930
|
+
all.filter(function(i) {
|
|
1931
|
+
bool = i === character;
|
|
1934
1932
|
});
|
|
1935
1933
|
return bool;
|
|
1936
1934
|
}
|
|
1937
1935
|
function heComes(text$1, options$1) {
|
|
1938
1936
|
var result = "";
|
|
1939
1937
|
var counts;
|
|
1940
|
-
var l
|
|
1938
|
+
var l;
|
|
1941
1939
|
options$1 = options$1 || {};
|
|
1942
1940
|
options$1["up"] = typeof options$1["up"] !== "undefined" ? options$1["up"] : true;
|
|
1943
1941
|
options$1["mid"] = typeof options$1["mid"] !== "undefined" ? options$1["mid"] : true;
|
|
1944
1942
|
options$1["down"] = typeof options$1["down"] !== "undefined" ? options$1["down"] : true;
|
|
1945
1943
|
options$1["size"] = typeof options$1["size"] !== "undefined" ? options$1["size"] : "maxi";
|
|
1946
1944
|
text$1 = text$1.split("");
|
|
1947
|
-
for (l
|
|
1948
|
-
if (isChar(l
|
|
1949
|
-
result = result + text$1[l
|
|
1945
|
+
for (l in text$1) {
|
|
1946
|
+
if (isChar(l)) continue;
|
|
1947
|
+
result = result + text$1[l];
|
|
1950
1948
|
counts = {
|
|
1951
1949
|
"up": 0,
|
|
1952
1950
|
"down": 0,
|
|
@@ -1976,7 +1974,7 @@ var require_zalgo = __commonJS({ "node_modules/@colors/colors/lib/custom/zalgo.j
|
|
|
1976
1974
|
];
|
|
1977
1975
|
for (var d in arr) {
|
|
1978
1976
|
var index = arr[d];
|
|
1979
|
-
for (var i
|
|
1977
|
+
for (var i = 0; i <= counts[index]; i++) if (options$1[index]) result = result + soul[index][randomNumber(soul[index].length)];
|
|
1980
1978
|
}
|
|
1981
1979
|
}
|
|
1982
1980
|
return result;
|
|
@@ -1988,13 +1986,13 @@ var require_zalgo = __commonJS({ "node_modules/@colors/colors/lib/custom/zalgo.j
|
|
|
1988
1986
|
//#endregion
|
|
1989
1987
|
//#region node_modules/@colors/colors/lib/maps/america.js
|
|
1990
1988
|
var require_america = __commonJS({ "node_modules/@colors/colors/lib/maps/america.js"(exports, module) {
|
|
1991
|
-
module["exports"] = function(colors$
|
|
1992
|
-
return function(letter, i
|
|
1989
|
+
module["exports"] = function(colors$2) {
|
|
1990
|
+
return function(letter, i, exploded) {
|
|
1993
1991
|
if (letter === " ") return letter;
|
|
1994
|
-
switch (i
|
|
1995
|
-
case 0: return colors$
|
|
1996
|
-
case 1: return colors$
|
|
1997
|
-
case 2: return colors$
|
|
1992
|
+
switch (i % 3) {
|
|
1993
|
+
case 0: return colors$2.red(letter);
|
|
1994
|
+
case 1: return colors$2.white(letter);
|
|
1995
|
+
case 2: return colors$2.blue(letter);
|
|
1998
1996
|
}
|
|
1999
1997
|
};
|
|
2000
1998
|
};
|
|
@@ -2003,9 +2001,9 @@ var require_america = __commonJS({ "node_modules/@colors/colors/lib/maps/america
|
|
|
2003
2001
|
//#endregion
|
|
2004
2002
|
//#region node_modules/@colors/colors/lib/maps/zebra.js
|
|
2005
2003
|
var require_zebra = __commonJS({ "node_modules/@colors/colors/lib/maps/zebra.js"(exports, module) {
|
|
2006
|
-
module["exports"] = function(colors$
|
|
2007
|
-
return function(letter, i
|
|
2008
|
-
return i
|
|
2004
|
+
module["exports"] = function(colors$2) {
|
|
2005
|
+
return function(letter, i, exploded) {
|
|
2006
|
+
return i % 2 === 0 ? letter : colors$2.inverse(letter);
|
|
2009
2007
|
};
|
|
2010
2008
|
};
|
|
2011
2009
|
} });
|
|
@@ -2013,7 +2011,7 @@ var require_zebra = __commonJS({ "node_modules/@colors/colors/lib/maps/zebra.js"
|
|
|
2013
2011
|
//#endregion
|
|
2014
2012
|
//#region node_modules/@colors/colors/lib/maps/rainbow.js
|
|
2015
2013
|
var require_rainbow = __commonJS({ "node_modules/@colors/colors/lib/maps/rainbow.js"(exports, module) {
|
|
2016
|
-
module["exports"] = function(colors$
|
|
2014
|
+
module["exports"] = function(colors$2) {
|
|
2017
2015
|
var rainbowColors = [
|
|
2018
2016
|
"red",
|
|
2019
2017
|
"yellow",
|
|
@@ -2021,9 +2019,9 @@ var require_rainbow = __commonJS({ "node_modules/@colors/colors/lib/maps/rainbow
|
|
|
2021
2019
|
"blue",
|
|
2022
2020
|
"magenta"
|
|
2023
2021
|
];
|
|
2024
|
-
return function(letter, i
|
|
2022
|
+
return function(letter, i, exploded) {
|
|
2025
2023
|
if (letter === " ") return letter;
|
|
2026
|
-
else return colors$
|
|
2024
|
+
else return colors$2[rainbowColors[i++ % rainbowColors.length]](letter);
|
|
2027
2025
|
};
|
|
2028
2026
|
};
|
|
2029
2027
|
} });
|
|
@@ -2031,7 +2029,7 @@ var require_rainbow = __commonJS({ "node_modules/@colors/colors/lib/maps/rainbow
|
|
|
2031
2029
|
//#endregion
|
|
2032
2030
|
//#region node_modules/@colors/colors/lib/maps/random.js
|
|
2033
2031
|
var require_random = __commonJS({ "node_modules/@colors/colors/lib/maps/random.js"(exports, module) {
|
|
2034
|
-
module["exports"] = function(colors$
|
|
2032
|
+
module["exports"] = function(colors$2) {
|
|
2035
2033
|
var available = [
|
|
2036
2034
|
"underline",
|
|
2037
2035
|
"inverse",
|
|
@@ -2051,8 +2049,8 @@ var require_random = __commonJS({ "node_modules/@colors/colors/lib/maps/random.j
|
|
|
2051
2049
|
"brightCyan",
|
|
2052
2050
|
"brightMagenta"
|
|
2053
2051
|
];
|
|
2054
|
-
return function(letter, i
|
|
2055
|
-
return letter === " " ? letter : colors$
|
|
2052
|
+
return function(letter, i, exploded) {
|
|
2053
|
+
return letter === " " ? letter : colors$2[available[Math.round(Math.random() * (available.length - 2))]](letter);
|
|
2056
2054
|
};
|
|
2057
2055
|
};
|
|
2058
2056
|
} });
|
|
@@ -2060,28 +2058,28 @@ var require_random = __commonJS({ "node_modules/@colors/colors/lib/maps/random.j
|
|
|
2060
2058
|
//#endregion
|
|
2061
2059
|
//#region node_modules/@colors/colors/lib/colors.js
|
|
2062
2060
|
var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(exports, module) {
|
|
2063
|
-
var colors$
|
|
2064
|
-
module["exports"] = colors$
|
|
2065
|
-
colors$
|
|
2061
|
+
var colors$1 = {};
|
|
2062
|
+
module["exports"] = colors$1;
|
|
2063
|
+
colors$1.themes = {};
|
|
2066
2064
|
var util = __require("util");
|
|
2067
|
-
var ansiStyles = colors$
|
|
2065
|
+
var ansiStyles = colors$1.styles = require_styles();
|
|
2068
2066
|
var defineProps = Object.defineProperties;
|
|
2069
2067
|
var newLineRegex = new RegExp(/[\r\n]+/g);
|
|
2070
|
-
colors$
|
|
2071
|
-
if (typeof colors$
|
|
2072
|
-
colors$
|
|
2073
|
-
colors$
|
|
2068
|
+
colors$1.supportsColor = require_supports_colors().supportsColor;
|
|
2069
|
+
if (typeof colors$1.enabled === "undefined") colors$1.enabled = colors$1.supportsColor() !== false;
|
|
2070
|
+
colors$1.enable = function() {
|
|
2071
|
+
colors$1.enabled = true;
|
|
2074
2072
|
};
|
|
2075
|
-
colors$
|
|
2076
|
-
colors$
|
|
2073
|
+
colors$1.disable = function() {
|
|
2074
|
+
colors$1.enabled = false;
|
|
2077
2075
|
};
|
|
2078
|
-
colors$
|
|
2076
|
+
colors$1.stripColors = colors$1.strip = function(str) {
|
|
2079
2077
|
return ("" + str).replace(/\x1B\[\d+m/g, "");
|
|
2080
2078
|
};
|
|
2081
|
-
var stylize = colors$
|
|
2082
|
-
if (!colors$
|
|
2079
|
+
var stylize = colors$1.stylize = function stylize$1(str, style) {
|
|
2080
|
+
if (!colors$1.enabled) return str + "";
|
|
2083
2081
|
var styleMap = ansiStyles[style];
|
|
2084
|
-
if (!styleMap && style in colors$
|
|
2082
|
+
if (!styleMap && style in colors$1) return colors$1[style](str);
|
|
2085
2083
|
return styleMap.open + str + styleMap.close;
|
|
2086
2084
|
};
|
|
2087
2085
|
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
|
@@ -2108,19 +2106,19 @@ var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(ex
|
|
|
2108
2106
|
});
|
|
2109
2107
|
return ret;
|
|
2110
2108
|
}();
|
|
2111
|
-
var proto = defineProps(function colors$
|
|
2109
|
+
var proto = defineProps(function colors$2() {}, styles);
|
|
2112
2110
|
function applyStyle() {
|
|
2113
2111
|
var args = Array.prototype.slice.call(arguments);
|
|
2114
2112
|
var str = args.map(function(arg) {
|
|
2115
2113
|
if (arg != null && arg.constructor === String) return arg;
|
|
2116
2114
|
else return util.inspect(arg);
|
|
2117
2115
|
}).join(" ");
|
|
2118
|
-
if (!colors$
|
|
2116
|
+
if (!colors$1.enabled || !str) return str;
|
|
2119
2117
|
var newLinesPresent = str.indexOf("\n") != -1;
|
|
2120
2118
|
var nestedStyles = this._styles;
|
|
2121
|
-
var i
|
|
2122
|
-
while (i
|
|
2123
|
-
var code = ansiStyles[nestedStyles[i
|
|
2119
|
+
var i = nestedStyles.length;
|
|
2120
|
+
while (i--) {
|
|
2121
|
+
var code = ansiStyles[nestedStyles[i]];
|
|
2124
2122
|
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
|
2125
2123
|
if (newLinesPresent) str = str.replace(newLineRegex, function(match) {
|
|
2126
2124
|
return code.close + match + code.open;
|
|
@@ -2128,23 +2126,23 @@ var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(ex
|
|
|
2128
2126
|
}
|
|
2129
2127
|
return str;
|
|
2130
2128
|
}
|
|
2131
|
-
colors$
|
|
2129
|
+
colors$1.setTheme = function(theme) {
|
|
2132
2130
|
if (typeof theme === "string") {
|
|
2133
2131
|
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'));");
|
|
2134
2132
|
return;
|
|
2135
2133
|
}
|
|
2136
2134
|
for (var style in theme) (function(style$1) {
|
|
2137
|
-
colors$
|
|
2135
|
+
colors$1[style$1] = function(str) {
|
|
2138
2136
|
if (typeof theme[style$1] === "object") {
|
|
2139
2137
|
var out = str;
|
|
2140
|
-
for (var i
|
|
2138
|
+
for (var i in theme[style$1]) out = colors$1[theme[style$1][i]](out);
|
|
2141
2139
|
return out;
|
|
2142
2140
|
}
|
|
2143
|
-
return colors$
|
|
2141
|
+
return colors$1[theme[style$1]](str);
|
|
2144
2142
|
};
|
|
2145
2143
|
})(style);
|
|
2146
2144
|
};
|
|
2147
|
-
function init
|
|
2145
|
+
function init() {
|
|
2148
2146
|
var ret = {};
|
|
2149
2147
|
Object.keys(styles).forEach(function(name$1) {
|
|
2150
2148
|
ret[name$1] = { get: function() {
|
|
@@ -2158,26 +2156,26 @@ var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(ex
|
|
|
2158
2156
|
exploded = exploded.map(map$1);
|
|
2159
2157
|
return exploded.join("");
|
|
2160
2158
|
};
|
|
2161
|
-
colors$
|
|
2162
|
-
colors$
|
|
2163
|
-
colors$
|
|
2164
|
-
colors$
|
|
2165
|
-
colors$
|
|
2166
|
-
colors$
|
|
2167
|
-
colors$
|
|
2168
|
-
for (var map in colors$
|
|
2169
|
-
colors$
|
|
2170
|
-
return sequencer(colors$
|
|
2159
|
+
colors$1.trap = require_trap();
|
|
2160
|
+
colors$1.zalgo = require_zalgo();
|
|
2161
|
+
colors$1.maps = {};
|
|
2162
|
+
colors$1.maps.america = require_america()(colors$1);
|
|
2163
|
+
colors$1.maps.zebra = require_zebra()(colors$1);
|
|
2164
|
+
colors$1.maps.rainbow = require_rainbow()(colors$1);
|
|
2165
|
+
colors$1.maps.random = require_random()(colors$1);
|
|
2166
|
+
for (var map in colors$1.maps) (function(map$1) {
|
|
2167
|
+
colors$1[map$1] = function(str) {
|
|
2168
|
+
return sequencer(colors$1.maps[map$1], str);
|
|
2171
2169
|
};
|
|
2172
2170
|
})(map);
|
|
2173
|
-
defineProps(colors$
|
|
2171
|
+
defineProps(colors$1, init());
|
|
2174
2172
|
} });
|
|
2175
2173
|
|
|
2176
2174
|
//#endregion
|
|
2177
2175
|
//#region node_modules/@colors/colors/safe.js
|
|
2178
2176
|
var require_safe = __commonJS({ "node_modules/@colors/colors/safe.js"(exports, module) {
|
|
2179
|
-
var colors
|
|
2180
|
-
module["exports"] = colors
|
|
2177
|
+
var colors = require_colors();
|
|
2178
|
+
module["exports"] = colors;
|
|
2181
2179
|
} });
|
|
2182
2180
|
|
|
2183
2181
|
//#endregion
|
|
@@ -2253,10 +2251,10 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
|
|
|
2253
2251
|
if (this.fixedWidth && wordWrap$1) {
|
|
2254
2252
|
this.fixedWidth -= this.paddingLeft + this.paddingRight;
|
|
2255
2253
|
if (this.colSpan) {
|
|
2256
|
-
let i
|
|
2257
|
-
while (i
|
|
2258
|
-
this.fixedWidth += tableOptions.colWidths[this.x + i
|
|
2259
|
-
i
|
|
2254
|
+
let i = 1;
|
|
2255
|
+
while (i < this.colSpan) {
|
|
2256
|
+
this.fixedWidth += tableOptions.colWidths[this.x + i];
|
|
2257
|
+
i++;
|
|
2260
2258
|
}
|
|
2261
2259
|
}
|
|
2262
2260
|
const { wrapOnWordBoundary: tableWrapOnWordBoundary = true } = tableOptions;
|
|
@@ -2281,13 +2279,13 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
|
|
|
2281
2279
|
*/
|
|
2282
2280
|
init(tableOptions) {
|
|
2283
2281
|
let x = this.x;
|
|
2284
|
-
let y
|
|
2282
|
+
let y = this.y;
|
|
2285
2283
|
this.widths = tableOptions.colWidths.slice(x, x + this.colSpan);
|
|
2286
|
-
this.heights = tableOptions.rowHeights.slice(y
|
|
2284
|
+
this.heights = tableOptions.rowHeights.slice(y, y + this.rowSpan);
|
|
2287
2285
|
this.width = this.widths.reduce(sumPlusOne, -1);
|
|
2288
2286
|
this.height = this.heights.reduce(sumPlusOne, -1);
|
|
2289
2287
|
this.hAlign = this.options.hAlign || tableOptions.colAligns[x];
|
|
2290
|
-
this.vAlign = this.options.vAlign || tableOptions.rowAligns[y
|
|
2288
|
+
this.vAlign = this.options.vAlign || tableOptions.rowAligns[y];
|
|
2291
2289
|
this.drawRight = x + this.colSpan == tableOptions.colWidths.length;
|
|
2292
2290
|
}
|
|
2293
2291
|
/**
|
|
@@ -2347,9 +2345,9 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
|
|
|
2347
2345
|
let spanAbove = this.cells[this.y - 1][x] instanceof Cell$1.ColSpanCell;
|
|
2348
2346
|
if (spanAbove) leftChar = offset == 0 ? "topMid" : "mid";
|
|
2349
2347
|
if (offset == 0) {
|
|
2350
|
-
let i
|
|
2351
|
-
while (this.cells[this.y][x - i
|
|
2352
|
-
if (this.cells[this.y][x - i
|
|
2348
|
+
let i = 1;
|
|
2349
|
+
while (this.cells[this.y][x - i] instanceof Cell$1.ColSpanCell) i++;
|
|
2350
|
+
if (this.cells[this.y][x - i] instanceof Cell$1.RowSpanCell) leftChar = "leftMid";
|
|
2353
2351
|
}
|
|
2354
2352
|
}
|
|
2355
2353
|
}
|
|
@@ -2357,9 +2355,9 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
|
|
|
2357
2355
|
}
|
|
2358
2356
|
wrapWithStyleColors(styleProperty, content) {
|
|
2359
2357
|
if (this[styleProperty] && this[styleProperty].length) try {
|
|
2360
|
-
let colors$
|
|
2361
|
-
for (let i
|
|
2362
|
-
return colors$
|
|
2358
|
+
let colors$2 = require_safe();
|
|
2359
|
+
for (let i = this[styleProperty].length - 1; i >= 0; i--) colors$2 = colors$2[this[styleProperty][i]];
|
|
2360
|
+
return colors$2(content);
|
|
2363
2361
|
} catch (e) {
|
|
2364
2362
|
return content;
|
|
2365
2363
|
}
|
|
@@ -2454,9 +2452,9 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
|
|
|
2454
2452
|
this.originalCell = originalCell;
|
|
2455
2453
|
}
|
|
2456
2454
|
init(tableOptions) {
|
|
2457
|
-
let y
|
|
2455
|
+
let y = this.y;
|
|
2458
2456
|
let originalY = this.originalCell.y;
|
|
2459
|
-
this.cellOffset = y
|
|
2457
|
+
this.cellOffset = y - originalY;
|
|
2460
2458
|
this.offset = findDimension(tableOptions.rowHeights, originalY, this.cellOffset);
|
|
2461
2459
|
}
|
|
2462
2460
|
draw(lineNum) {
|
|
@@ -2468,7 +2466,7 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
|
|
|
2468
2466
|
mergeTableOptions() {}
|
|
2469
2467
|
};
|
|
2470
2468
|
function firstDefined(...args) {
|
|
2471
|
-
return args.filter((v
|
|
2469
|
+
return args.filter((v) => v !== void 0 && v !== null).shift();
|
|
2472
2470
|
}
|
|
2473
2471
|
function setOption(objA, objB, nameB, targetObj) {
|
|
2474
2472
|
let nameA = nameB.split("-");
|
|
@@ -2480,11 +2478,11 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
|
|
|
2480
2478
|
}
|
|
2481
2479
|
function findDimension(dimensionTable, startingIndex, span) {
|
|
2482
2480
|
let ret = dimensionTable[startingIndex];
|
|
2483
|
-
for (let i
|
|
2481
|
+
for (let i = 1; i < span; i++) ret += 1 + dimensionTable[startingIndex + i];
|
|
2484
2482
|
return ret;
|
|
2485
2483
|
}
|
|
2486
|
-
function sumPlusOne(a
|
|
2487
|
-
return a
|
|
2484
|
+
function sumPlusOne(a, b) {
|
|
2485
|
+
return a + b + 1;
|
|
2488
2486
|
}
|
|
2489
2487
|
let CHAR_NAMES = [
|
|
2490
2488
|
"top",
|
|
@@ -2562,31 +2560,31 @@ var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-ma
|
|
|
2562
2560
|
let xConflict = !(xMin1 > xMax2 || xMin2 > xMax1);
|
|
2563
2561
|
return yConflict && xConflict;
|
|
2564
2562
|
}
|
|
2565
|
-
function conflictExists(rows, x, y
|
|
2566
|
-
let i_max = Math.min(rows.length - 1, y
|
|
2563
|
+
function conflictExists(rows, x, y) {
|
|
2564
|
+
let i_max = Math.min(rows.length - 1, y);
|
|
2567
2565
|
let cell = {
|
|
2568
2566
|
x,
|
|
2569
|
-
y
|
|
2567
|
+
y
|
|
2570
2568
|
};
|
|
2571
|
-
for (let i
|
|
2572
|
-
let row = rows[i
|
|
2569
|
+
for (let i = 0; i <= i_max; i++) {
|
|
2570
|
+
let row = rows[i];
|
|
2573
2571
|
for (let j = 0; j < row.length; j++) if (cellsConflict(cell, row[j])) return true;
|
|
2574
2572
|
}
|
|
2575
2573
|
return false;
|
|
2576
2574
|
}
|
|
2577
|
-
function allBlank(rows, y
|
|
2578
|
-
for (let x = xMin; x < xMax; x++) if (conflictExists(rows, x, y
|
|
2575
|
+
function allBlank(rows, y, xMin, xMax) {
|
|
2576
|
+
for (let x = xMin; x < xMax; x++) if (conflictExists(rows, x, y)) return false;
|
|
2579
2577
|
return true;
|
|
2580
2578
|
}
|
|
2581
2579
|
function addRowSpanCells(table) {
|
|
2582
2580
|
table.forEach(function(row, rowIndex) {
|
|
2583
2581
|
row.forEach(function(cell) {
|
|
2584
|
-
for (let i
|
|
2582
|
+
for (let i = 1; i < cell.rowSpan; i++) {
|
|
2585
2583
|
let rowSpanCell = new RowSpanCell(cell);
|
|
2586
2584
|
rowSpanCell.x = cell.x;
|
|
2587
|
-
rowSpanCell.y = cell.y + i
|
|
2585
|
+
rowSpanCell.y = cell.y + i;
|
|
2588
2586
|
rowSpanCell.colSpan = cell.colSpan;
|
|
2589
|
-
insertCell(rowSpanCell, table[rowIndex + i
|
|
2587
|
+
insertCell(rowSpanCell, table[rowIndex + i]);
|
|
2590
2588
|
}
|
|
2591
2589
|
});
|
|
2592
2590
|
});
|
|
@@ -2614,19 +2612,19 @@ var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-ma
|
|
|
2614
2612
|
let h_max = maxHeight(table);
|
|
2615
2613
|
let w_max = maxWidth(table);
|
|
2616
2614
|
debug$1(`Max rows: ${h_max}; Max cols: ${w_max}`);
|
|
2617
|
-
for (let y
|
|
2615
|
+
for (let y = 0; y < h_max; y++) for (let x = 0; x < w_max; x++) if (!conflictExists(table, x, y)) {
|
|
2618
2616
|
let opts = {
|
|
2619
2617
|
x,
|
|
2620
|
-
y
|
|
2618
|
+
y,
|
|
2621
2619
|
colSpan: 1,
|
|
2622
2620
|
rowSpan: 1
|
|
2623
2621
|
};
|
|
2624
2622
|
x++;
|
|
2625
|
-
while (x < w_max && !conflictExists(table, x, y
|
|
2623
|
+
while (x < w_max && !conflictExists(table, x, y)) {
|
|
2626
2624
|
opts.colSpan++;
|
|
2627
2625
|
x++;
|
|
2628
2626
|
}
|
|
2629
|
-
let y2 = y
|
|
2627
|
+
let y2 = y + 1;
|
|
2630
2628
|
while (y2 < h_max && allBlank(table, y2, opts.x, opts.x + opts.colSpan)) {
|
|
2631
2629
|
opts.rowSpan++;
|
|
2632
2630
|
y2++;
|
|
@@ -2635,7 +2633,7 @@ var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-ma
|
|
|
2635
2633
|
cell.x = opts.x;
|
|
2636
2634
|
cell.y = opts.y;
|
|
2637
2635
|
warn(`Missing cell at ${cell.y}-${cell.x}.`);
|
|
2638
|
-
insertCell(cell, table[y
|
|
2636
|
+
insertCell(cell, table[y]);
|
|
2639
2637
|
}
|
|
2640
2638
|
}
|
|
2641
2639
|
function generateCells(rows) {
|
|
@@ -2691,24 +2689,24 @@ var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-ma
|
|
|
2691
2689
|
let col = cell[x];
|
|
2692
2690
|
let existingWidth = result[col];
|
|
2693
2691
|
let editableCols = typeof vals[col] === "number" ? 0 : 1;
|
|
2694
|
-
if (typeof existingWidth === "number") for (let i
|
|
2695
|
-
existingWidth += 1 + result[col + i
|
|
2696
|
-
if (typeof vals[col + i
|
|
2692
|
+
if (typeof existingWidth === "number") for (let i = 1; i < span; i++) {
|
|
2693
|
+
existingWidth += 1 + result[col + i];
|
|
2694
|
+
if (typeof vals[col + i] !== "number") editableCols++;
|
|
2697
2695
|
}
|
|
2698
2696
|
else {
|
|
2699
2697
|
existingWidth = desiredWidth === "desiredWidth" ? cell.desiredWidth - 1 : 1;
|
|
2700
2698
|
if (!auto[col] || auto[col] < existingWidth) auto[col] = existingWidth;
|
|
2701
2699
|
}
|
|
2702
2700
|
if (cell[desiredWidth] > existingWidth) {
|
|
2703
|
-
let i
|
|
2701
|
+
let i = 0;
|
|
2704
2702
|
while (editableCols > 0 && cell[desiredWidth] > existingWidth) {
|
|
2705
|
-
if (typeof vals[col + i
|
|
2703
|
+
if (typeof vals[col + i] !== "number") {
|
|
2706
2704
|
let dif = Math.round((cell[desiredWidth] - existingWidth) / editableCols);
|
|
2707
2705
|
existingWidth += dif;
|
|
2708
|
-
result[col + i
|
|
2706
|
+
result[col + i] += dif;
|
|
2709
2707
|
editableCols--;
|
|
2710
2708
|
}
|
|
2711
|
-
i
|
|
2709
|
+
i++;
|
|
2712
2710
|
}
|
|
2713
2711
|
}
|
|
2714
2712
|
}
|
|
@@ -2808,1080 +2806,247 @@ var require_cli_table3 = __commonJS({ "node_modules/cli-table3/index.js"(exports
|
|
|
2808
2806
|
//#endregion
|
|
2809
2807
|
//#region node_modules/picocolors/picocolors.js
|
|
2810
2808
|
var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(exports, module) {
|
|
2811
|
-
let p = process || {}, argv
|
|
2812
|
-
let isColorSupported
|
|
2809
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
2810
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
2813
2811
|
let formatter = (open, close, replace = open) => (input) => {
|
|
2814
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
2815
|
-
return ~index ? open + replaceClose$1
|
|
2812
|
+
let string$1 = "" + input, index = string$1.indexOf(close, open.length);
|
|
2813
|
+
return ~index ? open + replaceClose(string$1, close, replace, index) + close : open + string$1 + close;
|
|
2816
2814
|
};
|
|
2817
|
-
let replaceClose
|
|
2815
|
+
let replaceClose = (string$1, close, replace, index) => {
|
|
2818
2816
|
let result = "", cursor = 0;
|
|
2819
2817
|
do {
|
|
2820
|
-
result += string.substring(cursor, index) + replace;
|
|
2818
|
+
result += string$1.substring(cursor, index) + replace;
|
|
2821
2819
|
cursor = index + close.length;
|
|
2822
|
-
index = string.indexOf(close, cursor);
|
|
2820
|
+
index = string$1.indexOf(close, cursor);
|
|
2823
2821
|
} while (~index);
|
|
2824
|
-
return result + string.substring(cursor);
|
|
2822
|
+
return result + string$1.substring(cursor);
|
|
2825
2823
|
};
|
|
2826
|
-
let createColors
|
|
2827
|
-
let f
|
|
2824
|
+
let createColors = (enabled = isColorSupported) => {
|
|
2825
|
+
let f = enabled ? formatter : () => String;
|
|
2828
2826
|
return {
|
|
2829
2827
|
isColorSupported: enabled,
|
|
2830
|
-
reset: f
|
|
2831
|
-
bold: f
|
|
2832
|
-
dim: f
|
|
2833
|
-
italic: f
|
|
2834
|
-
underline: f
|
|
2835
|
-
inverse: f
|
|
2836
|
-
hidden: f
|
|
2837
|
-
strikethrough: f
|
|
2838
|
-
black: f
|
|
2839
|
-
red: f
|
|
2840
|
-
green: f
|
|
2841
|
-
yellow: f
|
|
2842
|
-
blue: f
|
|
2843
|
-
magenta: f
|
|
2844
|
-
cyan: f
|
|
2845
|
-
white: f
|
|
2846
|
-
gray: f
|
|
2847
|
-
bgBlack: f
|
|
2848
|
-
bgRed: f
|
|
2849
|
-
bgGreen: f
|
|
2850
|
-
bgYellow: f
|
|
2851
|
-
bgBlue: f
|
|
2852
|
-
bgMagenta: f
|
|
2853
|
-
bgCyan: f
|
|
2854
|
-
bgWhite: f
|
|
2855
|
-
blackBright: f
|
|
2856
|
-
redBright: f
|
|
2857
|
-
greenBright: f
|
|
2858
|
-
yellowBright: f
|
|
2859
|
-
blueBright: f
|
|
2860
|
-
magentaBright: f
|
|
2861
|
-
cyanBright: f
|
|
2862
|
-
whiteBright: f
|
|
2863
|
-
bgBlackBright: f
|
|
2864
|
-
bgRedBright: f
|
|
2865
|
-
bgGreenBright: f
|
|
2866
|
-
bgYellowBright: f
|
|
2867
|
-
bgBlueBright: f
|
|
2868
|
-
bgMagentaBright: f
|
|
2869
|
-
bgCyanBright: f
|
|
2870
|
-
bgWhiteBright: f
|
|
2828
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
2829
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
2830
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
2831
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
2832
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
2833
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
2834
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
2835
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
2836
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
2837
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
2838
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
2839
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
2840
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
2841
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
2842
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
2843
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
2844
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
2845
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
2846
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
2847
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
2848
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
2849
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
2850
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
2851
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
2852
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
2853
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
2854
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
2855
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
2856
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
2857
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
2858
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
2859
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
2860
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
2861
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
2862
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
2863
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
2864
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
2865
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
2866
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
2867
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
2868
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
2871
2869
|
};
|
|
2872
2870
|
};
|
|
2873
|
-
module.exports = createColors
|
|
2874
|
-
module.exports.createColors = createColors
|
|
2871
|
+
module.exports = createColors();
|
|
2872
|
+
module.exports.createColors = createColors;
|
|
2875
2873
|
} });
|
|
2876
2874
|
|
|
2877
2875
|
//#endregion
|
|
2878
|
-
//#region
|
|
2879
|
-
const
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
}
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
/**
|
|
2953
|
-
* Creates an instance of Consola with specified options or defaults.
|
|
2954
|
-
*
|
|
2955
|
-
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
2956
|
-
*/
|
|
2957
|
-
constructor(options = {}) {
|
|
2958
|
-
const types = options.types || LogTypes;
|
|
2959
|
-
this.options = defu({
|
|
2960
|
-
...options,
|
|
2961
|
-
defaults: { ...options.defaults },
|
|
2962
|
-
level: _normalizeLogLevel(options.level, types),
|
|
2963
|
-
reporters: [...options.reporters || []]
|
|
2964
|
-
}, {
|
|
2965
|
-
types: LogTypes,
|
|
2966
|
-
throttle: 1e3,
|
|
2967
|
-
throttleMin: 5,
|
|
2968
|
-
formatOptions: {
|
|
2969
|
-
date: true,
|
|
2970
|
-
colors: false,
|
|
2971
|
-
compact: true
|
|
2972
|
-
}
|
|
2973
|
-
});
|
|
2974
|
-
for (const type in types) {
|
|
2975
|
-
const defaults = {
|
|
2976
|
-
type,
|
|
2977
|
-
...this.options.defaults,
|
|
2978
|
-
...types[type]
|
|
2979
|
-
};
|
|
2980
|
-
this[type] = this._wrapLogFn(defaults);
|
|
2981
|
-
this[type].raw = this._wrapLogFn(defaults, true);
|
|
2982
|
-
}
|
|
2983
|
-
if (this.options.mockFn) this.mockTypes();
|
|
2984
|
-
this._lastLog = {};
|
|
2985
|
-
}
|
|
2986
|
-
/**
|
|
2987
|
-
* Gets the current log level of the Consola instance.
|
|
2988
|
-
*
|
|
2989
|
-
* @returns {number} The current log level.
|
|
2990
|
-
*/
|
|
2991
|
-
get level() {
|
|
2992
|
-
return this.options.level;
|
|
2993
|
-
}
|
|
2994
|
-
/**
|
|
2995
|
-
* Sets the minimum log level that will be output by the instance.
|
|
2996
|
-
*
|
|
2997
|
-
* @param {number} level - The new log level to set.
|
|
2998
|
-
*/
|
|
2999
|
-
set level(level$1) {
|
|
3000
|
-
this.options.level = _normalizeLogLevel(level$1, this.options.types, this.options.level);
|
|
3001
|
-
}
|
|
3002
|
-
/**
|
|
3003
|
-
* Displays a prompt to the user and returns the response.
|
|
3004
|
-
* Throw an error if `prompt` is not supported by the current configuration.
|
|
3005
|
-
*
|
|
3006
|
-
* @template T
|
|
3007
|
-
* @param {string} message - The message to display in the prompt.
|
|
3008
|
-
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
3009
|
-
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
3010
|
-
*/
|
|
3011
|
-
prompt(message, opts) {
|
|
3012
|
-
if (!this.options.prompt) throw new Error("prompt is not supported!");
|
|
3013
|
-
return this.options.prompt(message, opts);
|
|
3014
|
-
}
|
|
3015
|
-
/**
|
|
3016
|
-
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
3017
|
-
*
|
|
3018
|
-
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
3019
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
3020
|
-
*/
|
|
3021
|
-
create(options) {
|
|
3022
|
-
const instance = new Consola({
|
|
3023
|
-
...this.options,
|
|
3024
|
-
...options
|
|
3025
|
-
});
|
|
3026
|
-
if (this._mockFn) instance.mockTypes(this._mockFn);
|
|
3027
|
-
return instance;
|
|
3028
|
-
}
|
|
3029
|
-
/**
|
|
3030
|
-
* Creates a new Consola instance with the specified default log object properties.
|
|
3031
|
-
*
|
|
3032
|
-
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
3033
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
3034
|
-
*/
|
|
3035
|
-
withDefaults(defaults) {
|
|
3036
|
-
return this.create({
|
|
3037
|
-
...this.options,
|
|
3038
|
-
defaults: {
|
|
3039
|
-
...this.options.defaults,
|
|
3040
|
-
...defaults
|
|
3041
|
-
}
|
|
3042
|
-
});
|
|
3043
|
-
}
|
|
3044
|
-
/**
|
|
3045
|
-
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
3046
|
-
*
|
|
3047
|
-
* @param {string} tag - The tag to include in each log of the new instance.
|
|
3048
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
3049
|
-
*/
|
|
3050
|
-
withTag(tag) {
|
|
3051
|
-
return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
|
|
3052
|
-
}
|
|
3053
|
-
/**
|
|
3054
|
-
* Adds a custom reporter to the Consola instance.
|
|
3055
|
-
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
3056
|
-
*
|
|
3057
|
-
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
3058
|
-
* @returns {Consola} The current Consola instance.
|
|
3059
|
-
*/
|
|
3060
|
-
addReporter(reporter) {
|
|
3061
|
-
this.options.reporters.push(reporter);
|
|
3062
|
-
return this;
|
|
3063
|
-
}
|
|
3064
|
-
/**
|
|
3065
|
-
* Removes a custom reporter from the Consola instance.
|
|
3066
|
-
* If no reporter is specified, all reporters will be removed.
|
|
3067
|
-
*
|
|
3068
|
-
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
3069
|
-
* @returns {Consola} The current Consola instance.
|
|
3070
|
-
*/
|
|
3071
|
-
removeReporter(reporter) {
|
|
3072
|
-
if (reporter) {
|
|
3073
|
-
const i$1 = this.options.reporters.indexOf(reporter);
|
|
3074
|
-
if (i$1 !== -1) return this.options.reporters.splice(i$1, 1);
|
|
3075
|
-
} else this.options.reporters.splice(0);
|
|
3076
|
-
return this;
|
|
3077
|
-
}
|
|
3078
|
-
/**
|
|
3079
|
-
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
3080
|
-
*
|
|
3081
|
-
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
3082
|
-
* @returns {Consola} The current Consola instance.
|
|
3083
|
-
*/
|
|
3084
|
-
setReporters(reporters) {
|
|
3085
|
-
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
3086
|
-
return this;
|
|
3087
|
-
}
|
|
3088
|
-
wrapAll() {
|
|
3089
|
-
this.wrapConsole();
|
|
3090
|
-
this.wrapStd();
|
|
3091
|
-
}
|
|
3092
|
-
restoreAll() {
|
|
3093
|
-
this.restoreConsole();
|
|
3094
|
-
this.restoreStd();
|
|
3095
|
-
}
|
|
3096
|
-
/**
|
|
3097
|
-
* Overrides console methods with Consola logging methods for consistent logging.
|
|
3098
|
-
*/
|
|
3099
|
-
wrapConsole() {
|
|
3100
|
-
for (const type in this.options.types) {
|
|
3101
|
-
if (!console["__" + type]) console["__" + type] = console[type];
|
|
3102
|
-
console[type] = this[type].raw;
|
|
3103
|
-
}
|
|
3104
|
-
}
|
|
3105
|
-
/**
|
|
3106
|
-
* Restores the original console methods, removing Consola overrides.
|
|
3107
|
-
*/
|
|
3108
|
-
restoreConsole() {
|
|
3109
|
-
for (const type in this.options.types) if (console["__" + type]) {
|
|
3110
|
-
console[type] = console["__" + type];
|
|
3111
|
-
delete console["__" + type];
|
|
3112
|
-
}
|
|
3113
|
-
}
|
|
3114
|
-
/**
|
|
3115
|
-
* Overrides standard output and error streams to redirect them through Consola.
|
|
3116
|
-
*/
|
|
3117
|
-
wrapStd() {
|
|
3118
|
-
this._wrapStream(this.options.stdout, "log");
|
|
3119
|
-
this._wrapStream(this.options.stderr, "log");
|
|
3120
|
-
}
|
|
3121
|
-
_wrapStream(stream, type) {
|
|
3122
|
-
if (!stream) return;
|
|
3123
|
-
if (!stream.__write) stream.__write = stream.write;
|
|
3124
|
-
stream.write = (data) => {
|
|
3125
|
-
this[type].raw(String(data).trim());
|
|
3126
|
-
};
|
|
3127
|
-
}
|
|
3128
|
-
/**
|
|
3129
|
-
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
3130
|
-
*/
|
|
3131
|
-
restoreStd() {
|
|
3132
|
-
this._restoreStream(this.options.stdout);
|
|
3133
|
-
this._restoreStream(this.options.stderr);
|
|
3134
|
-
}
|
|
3135
|
-
_restoreStream(stream) {
|
|
3136
|
-
if (!stream) return;
|
|
3137
|
-
if (stream.__write) {
|
|
3138
|
-
stream.write = stream.__write;
|
|
3139
|
-
delete stream.__write;
|
|
3140
|
-
}
|
|
3141
|
-
}
|
|
3142
|
-
/**
|
|
3143
|
-
* Pauses logging, queues incoming logs until resumed.
|
|
3144
|
-
*/
|
|
3145
|
-
pauseLogs() {
|
|
3146
|
-
paused = true;
|
|
3147
|
-
}
|
|
3148
|
-
/**
|
|
3149
|
-
* Resumes logging, processing any queued logs.
|
|
3150
|
-
*/
|
|
3151
|
-
resumeLogs() {
|
|
3152
|
-
paused = false;
|
|
3153
|
-
const _queue = queue.splice(0);
|
|
3154
|
-
for (const item of _queue) item[0]._logFn(item[1], item[2]);
|
|
3155
|
-
}
|
|
3156
|
-
/**
|
|
3157
|
-
* Replaces logging methods with mocks if a mock function is provided.
|
|
3158
|
-
*
|
|
3159
|
-
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
3160
|
-
*/
|
|
3161
|
-
mockTypes(mockFn) {
|
|
3162
|
-
const _mockFn = mockFn || this.options.mockFn;
|
|
3163
|
-
this._mockFn = _mockFn;
|
|
3164
|
-
if (typeof _mockFn !== "function") return;
|
|
3165
|
-
for (const type in this.options.types) {
|
|
3166
|
-
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
3167
|
-
this[type].raw = this[type];
|
|
3168
|
-
}
|
|
3169
|
-
}
|
|
3170
|
-
_wrapLogFn(defaults, isRaw) {
|
|
3171
|
-
return (...args) => {
|
|
3172
|
-
if (paused) {
|
|
3173
|
-
queue.push([
|
|
3174
|
-
this,
|
|
3175
|
-
defaults,
|
|
3176
|
-
args,
|
|
3177
|
-
isRaw
|
|
3178
|
-
]);
|
|
3179
|
-
return;
|
|
3180
|
-
}
|
|
3181
|
-
return this._logFn(defaults, args, isRaw);
|
|
3182
|
-
};
|
|
3183
|
-
}
|
|
3184
|
-
_logFn(defaults, args, isRaw) {
|
|
3185
|
-
if ((defaults.level || 0) > this.level) return false;
|
|
3186
|
-
const logObj = {
|
|
3187
|
-
date: /* @__PURE__ */ new Date(),
|
|
3188
|
-
args: [],
|
|
3189
|
-
...defaults,
|
|
3190
|
-
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
3191
|
-
};
|
|
3192
|
-
if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
|
|
3193
|
-
else logObj.args = [...args];
|
|
3194
|
-
if (logObj.message) {
|
|
3195
|
-
logObj.args.unshift(logObj.message);
|
|
3196
|
-
delete logObj.message;
|
|
3197
|
-
}
|
|
3198
|
-
if (logObj.additional) {
|
|
3199
|
-
if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
|
|
3200
|
-
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
3201
|
-
delete logObj.additional;
|
|
3202
|
-
}
|
|
3203
|
-
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
3204
|
-
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
3205
|
-
const resolveLog = (newLog = false) => {
|
|
3206
|
-
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
3207
|
-
if (this._lastLog.object && repeated > 0) {
|
|
3208
|
-
const args2 = [...this._lastLog.object.args];
|
|
3209
|
-
if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
|
|
3210
|
-
this._log({
|
|
3211
|
-
...this._lastLog.object,
|
|
3212
|
-
args: args2
|
|
3213
|
-
});
|
|
3214
|
-
this._lastLog.count = 1;
|
|
3215
|
-
}
|
|
3216
|
-
if (newLog) {
|
|
3217
|
-
this._lastLog.object = logObj;
|
|
3218
|
-
this._log(logObj);
|
|
3219
|
-
}
|
|
3220
|
-
};
|
|
3221
|
-
clearTimeout(this._lastLog.timeout);
|
|
3222
|
-
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
3223
|
-
this._lastLog.time = logObj.date;
|
|
3224
|
-
if (diffTime < this.options.throttle) try {
|
|
3225
|
-
const serializedLog = JSON.stringify([
|
|
3226
|
-
logObj.type,
|
|
3227
|
-
logObj.tag,
|
|
3228
|
-
logObj.args
|
|
3229
|
-
]);
|
|
3230
|
-
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
3231
|
-
this._lastLog.serialized = serializedLog;
|
|
3232
|
-
if (isSameLog) {
|
|
3233
|
-
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
3234
|
-
if (this._lastLog.count > this.options.throttleMin) {
|
|
3235
|
-
this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
|
|
3236
|
-
return;
|
|
2876
|
+
//#region debug.ts
|
|
2877
|
+
const MATCH_THRESHOLD_PERCENT = .1;
|
|
2878
|
+
async function detectMismatches(claudePath) {
|
|
2879
|
+
const claudeDir = claudePath || path.join(homedir(), ".claude", "projects");
|
|
2880
|
+
const files = await glob(["**/*.jsonl"], {
|
|
2881
|
+
cwd: claudeDir,
|
|
2882
|
+
absolute: true
|
|
2883
|
+
});
|
|
2884
|
+
const modelPricing = await fetchModelPricing();
|
|
2885
|
+
const stats = {
|
|
2886
|
+
totalEntries: 0,
|
|
2887
|
+
entriesWithBoth: 0,
|
|
2888
|
+
matches: 0,
|
|
2889
|
+
mismatches: 0,
|
|
2890
|
+
discrepancies: [],
|
|
2891
|
+
modelStats: new Map(),
|
|
2892
|
+
versionStats: new Map()
|
|
2893
|
+
};
|
|
2894
|
+
for (const file of files) {
|
|
2895
|
+
const content = await readFile(file, "utf-8");
|
|
2896
|
+
const lines = content.trim().split("\n").filter((line) => line.length > 0);
|
|
2897
|
+
for (const line of lines) try {
|
|
2898
|
+
const parsed = JSON.parse(line);
|
|
2899
|
+
const result = safeParse(UsageDataSchema, parsed);
|
|
2900
|
+
if (!result.success) continue;
|
|
2901
|
+
const data = result.output;
|
|
2902
|
+
stats.totalEntries++;
|
|
2903
|
+
if (data.costUSD !== void 0 && data.message.model && data.message.model !== "<synthetic>") {
|
|
2904
|
+
stats.entriesWithBoth++;
|
|
2905
|
+
const model = data.message.model;
|
|
2906
|
+
const pricing = getModelPricing(model, modelPricing);
|
|
2907
|
+
if (pricing) {
|
|
2908
|
+
const calculatedCost = calculateCostFromTokens(data.message.usage, pricing);
|
|
2909
|
+
const difference = Math.abs(data.costUSD - calculatedCost);
|
|
2910
|
+
const percentDiff = data.costUSD > 0 ? difference / data.costUSD * 100 : 0;
|
|
2911
|
+
const modelStat = stats.modelStats.get(model) || {
|
|
2912
|
+
total: 0,
|
|
2913
|
+
matches: 0,
|
|
2914
|
+
mismatches: 0,
|
|
2915
|
+
avgPercentDiff: 0
|
|
2916
|
+
};
|
|
2917
|
+
modelStat.total++;
|
|
2918
|
+
if (data.version) {
|
|
2919
|
+
const versionStat = stats.versionStats.get(data.version) || {
|
|
2920
|
+
total: 0,
|
|
2921
|
+
matches: 0,
|
|
2922
|
+
mismatches: 0,
|
|
2923
|
+
avgPercentDiff: 0
|
|
2924
|
+
};
|
|
2925
|
+
versionStat.total++;
|
|
2926
|
+
if (percentDiff < MATCH_THRESHOLD_PERCENT) versionStat.matches++;
|
|
2927
|
+
else versionStat.mismatches++;
|
|
2928
|
+
versionStat.avgPercentDiff = (versionStat.avgPercentDiff * (versionStat.total - 1) + percentDiff) / versionStat.total;
|
|
2929
|
+
stats.versionStats.set(data.version, versionStat);
|
|
2930
|
+
}
|
|
2931
|
+
if (percentDiff < .1) {
|
|
2932
|
+
stats.matches++;
|
|
2933
|
+
modelStat.matches++;
|
|
2934
|
+
} else {
|
|
2935
|
+
stats.mismatches++;
|
|
2936
|
+
modelStat.mismatches++;
|
|
2937
|
+
stats.discrepancies.push({
|
|
2938
|
+
file: path.basename(file),
|
|
2939
|
+
timestamp: data.timestamp,
|
|
2940
|
+
model,
|
|
2941
|
+
originalCost: data.costUSD,
|
|
2942
|
+
calculatedCost,
|
|
2943
|
+
difference,
|
|
2944
|
+
percentDiff,
|
|
2945
|
+
usage: data.message.usage
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
modelStat.avgPercentDiff = (modelStat.avgPercentDiff * (modelStat.total - 1) + percentDiff) / modelStat.total;
|
|
2949
|
+
stats.modelStats.set(model, modelStat);
|
|
3237
2950
|
}
|
|
3238
2951
|
}
|
|
3239
|
-
} catch {}
|
|
3240
|
-
resolveLog(true);
|
|
3241
|
-
}
|
|
3242
|
-
_log(logObj) {
|
|
3243
|
-
for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
|
|
3244
|
-
}
|
|
3245
|
-
};
|
|
3246
|
-
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
3247
|
-
if (input === void 0) return defaultLevel;
|
|
3248
|
-
if (typeof input === "number") return input;
|
|
3249
|
-
if (types[input] && types[input].level !== void 0) return types[input].level;
|
|
3250
|
-
return defaultLevel;
|
|
3251
|
-
}
|
|
3252
|
-
Consola.prototype.add = Consola.prototype.addReporter;
|
|
3253
|
-
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
3254
|
-
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
3255
|
-
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
3256
|
-
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
3257
|
-
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
3258
|
-
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
3259
|
-
function createConsola$1(options = {}) {
|
|
3260
|
-
return new Consola(options);
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
|
-
//#endregion
|
|
3264
|
-
//#region node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
|
|
3265
|
-
function parseStack(stack, message) {
|
|
3266
|
-
const cwd = process.cwd() + sep;
|
|
3267
|
-
const lines = stack.split("\n").splice(message.split("\n").length).map((l$1) => l$1.trim().replace("file://", "").replace(cwd, ""));
|
|
3268
|
-
return lines;
|
|
3269
|
-
}
|
|
3270
|
-
function writeStream(data, stream) {
|
|
3271
|
-
const write = stream.__write || stream.write;
|
|
3272
|
-
return write.call(stream, data);
|
|
3273
|
-
}
|
|
3274
|
-
const bracket = (x) => x ? `[${x}]` : "";
|
|
3275
|
-
var BasicReporter = class {
|
|
3276
|
-
formatStack(stack, message, opts) {
|
|
3277
|
-
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
3278
|
-
return indent + parseStack(stack, message).join(`
|
|
3279
|
-
${indent}`);
|
|
3280
|
-
}
|
|
3281
|
-
formatError(err, opts) {
|
|
3282
|
-
const message = err.message ?? formatWithOptions(opts, err);
|
|
3283
|
-
const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
|
|
3284
|
-
const level$1 = opts?.errorLevel || 0;
|
|
3285
|
-
const causedPrefix = level$1 > 0 ? `${" ".repeat(level$1)}[cause]: ` : "";
|
|
3286
|
-
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
|
|
3287
|
-
...opts,
|
|
3288
|
-
errorLevel: level$1 + 1
|
|
3289
|
-
}) : "";
|
|
3290
|
-
return causedPrefix + message + "\n" + stack + causedError;
|
|
3291
|
-
}
|
|
3292
|
-
formatArgs(args, opts) {
|
|
3293
|
-
const _args = args.map((arg) => {
|
|
3294
|
-
if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
|
|
3295
|
-
return arg;
|
|
3296
|
-
});
|
|
3297
|
-
return formatWithOptions(opts, ..._args);
|
|
3298
|
-
}
|
|
3299
|
-
formatDate(date, opts) {
|
|
3300
|
-
return opts.date ? date.toLocaleTimeString() : "";
|
|
3301
|
-
}
|
|
3302
|
-
filterAndJoin(arr) {
|
|
3303
|
-
return arr.filter(Boolean).join(" ");
|
|
3304
|
-
}
|
|
3305
|
-
formatLogObj(logObj, opts) {
|
|
3306
|
-
const message = this.formatArgs(logObj.args, opts);
|
|
3307
|
-
if (logObj.type === "box") return "\n" + [
|
|
3308
|
-
bracket(logObj.tag),
|
|
3309
|
-
logObj.title && logObj.title,
|
|
3310
|
-
...message.split("\n")
|
|
3311
|
-
].filter(Boolean).map((l$1) => " > " + l$1).join("\n") + "\n";
|
|
3312
|
-
return this.filterAndJoin([
|
|
3313
|
-
bracket(logObj.type),
|
|
3314
|
-
bracket(logObj.tag),
|
|
3315
|
-
message
|
|
3316
|
-
]);
|
|
3317
|
-
}
|
|
3318
|
-
log(logObj, ctx) {
|
|
3319
|
-
const line = this.formatLogObj(logObj, {
|
|
3320
|
-
columns: ctx.options.stdout.columns || 0,
|
|
3321
|
-
...ctx.options.formatOptions
|
|
3322
|
-
});
|
|
3323
|
-
return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
3324
|
-
}
|
|
3325
|
-
};
|
|
3326
|
-
|
|
3327
|
-
//#endregion
|
|
3328
|
-
//#region node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
|
|
3329
|
-
const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
|
|
3330
|
-
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
3331
|
-
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
3332
|
-
const isWindows = platform === "win32";
|
|
3333
|
-
const isDumbTerminal = env.TERM === "dumb";
|
|
3334
|
-
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
3335
|
-
const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
3336
|
-
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
3337
|
-
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
3338
|
-
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
3339
|
-
}
|
|
3340
|
-
function clearBleed(index, string, open, close, replace) {
|
|
3341
|
-
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
3342
|
-
}
|
|
3343
|
-
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
3344
|
-
return (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
3345
|
-
}
|
|
3346
|
-
function init(open, close, replace) {
|
|
3347
|
-
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
3348
|
-
}
|
|
3349
|
-
const colorDefs = {
|
|
3350
|
-
reset: init(0, 0),
|
|
3351
|
-
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
3352
|
-
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
3353
|
-
italic: init(3, 23),
|
|
3354
|
-
underline: init(4, 24),
|
|
3355
|
-
inverse: init(7, 27),
|
|
3356
|
-
hidden: init(8, 28),
|
|
3357
|
-
strikethrough: init(9, 29),
|
|
3358
|
-
black: init(30, 39),
|
|
3359
|
-
red: init(31, 39),
|
|
3360
|
-
green: init(32, 39),
|
|
3361
|
-
yellow: init(33, 39),
|
|
3362
|
-
blue: init(34, 39),
|
|
3363
|
-
magenta: init(35, 39),
|
|
3364
|
-
cyan: init(36, 39),
|
|
3365
|
-
white: init(37, 39),
|
|
3366
|
-
gray: init(90, 39),
|
|
3367
|
-
bgBlack: init(40, 49),
|
|
3368
|
-
bgRed: init(41, 49),
|
|
3369
|
-
bgGreen: init(42, 49),
|
|
3370
|
-
bgYellow: init(43, 49),
|
|
3371
|
-
bgBlue: init(44, 49),
|
|
3372
|
-
bgMagenta: init(45, 49),
|
|
3373
|
-
bgCyan: init(46, 49),
|
|
3374
|
-
bgWhite: init(47, 49),
|
|
3375
|
-
blackBright: init(90, 39),
|
|
3376
|
-
redBright: init(91, 39),
|
|
3377
|
-
greenBright: init(92, 39),
|
|
3378
|
-
yellowBright: init(93, 39),
|
|
3379
|
-
blueBright: init(94, 39),
|
|
3380
|
-
magentaBright: init(95, 39),
|
|
3381
|
-
cyanBright: init(96, 39),
|
|
3382
|
-
whiteBright: init(97, 39),
|
|
3383
|
-
bgBlackBright: init(100, 49),
|
|
3384
|
-
bgRedBright: init(101, 49),
|
|
3385
|
-
bgGreenBright: init(102, 49),
|
|
3386
|
-
bgYellowBright: init(103, 49),
|
|
3387
|
-
bgBlueBright: init(104, 49),
|
|
3388
|
-
bgMagentaBright: init(105, 49),
|
|
3389
|
-
bgCyanBright: init(106, 49),
|
|
3390
|
-
bgWhiteBright: init(107, 49)
|
|
3391
|
-
};
|
|
3392
|
-
function createColors(useColor = isColorSupported) {
|
|
3393
|
-
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
3394
|
-
}
|
|
3395
|
-
const colors = createColors();
|
|
3396
|
-
function getColor$1(color, fallback = "reset") {
|
|
3397
|
-
return colors[color] || colors[fallback];
|
|
3398
|
-
}
|
|
3399
|
-
const ansiRegex$1 = [String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`, String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");
|
|
3400
|
-
function stripAnsi$1(text) {
|
|
3401
|
-
return text.replace(new RegExp(ansiRegex$1, "g"), "");
|
|
3402
|
-
}
|
|
3403
|
-
const boxStylePresets = {
|
|
3404
|
-
solid: {
|
|
3405
|
-
tl: "┌",
|
|
3406
|
-
tr: "┐",
|
|
3407
|
-
bl: "└",
|
|
3408
|
-
br: "┘",
|
|
3409
|
-
h: "─",
|
|
3410
|
-
v: "│"
|
|
3411
|
-
},
|
|
3412
|
-
double: {
|
|
3413
|
-
tl: "╔",
|
|
3414
|
-
tr: "╗",
|
|
3415
|
-
bl: "╚",
|
|
3416
|
-
br: "╝",
|
|
3417
|
-
h: "═",
|
|
3418
|
-
v: "║"
|
|
3419
|
-
},
|
|
3420
|
-
doubleSingle: {
|
|
3421
|
-
tl: "╓",
|
|
3422
|
-
tr: "╖",
|
|
3423
|
-
bl: "╙",
|
|
3424
|
-
br: "╜",
|
|
3425
|
-
h: "─",
|
|
3426
|
-
v: "║"
|
|
3427
|
-
},
|
|
3428
|
-
doubleSingleRounded: {
|
|
3429
|
-
tl: "╭",
|
|
3430
|
-
tr: "╮",
|
|
3431
|
-
bl: "╰",
|
|
3432
|
-
br: "╯",
|
|
3433
|
-
h: "─",
|
|
3434
|
-
v: "║"
|
|
3435
|
-
},
|
|
3436
|
-
singleThick: {
|
|
3437
|
-
tl: "┏",
|
|
3438
|
-
tr: "┓",
|
|
3439
|
-
bl: "┗",
|
|
3440
|
-
br: "┛",
|
|
3441
|
-
h: "━",
|
|
3442
|
-
v: "┃"
|
|
3443
|
-
},
|
|
3444
|
-
singleDouble: {
|
|
3445
|
-
tl: "╒",
|
|
3446
|
-
tr: "╕",
|
|
3447
|
-
bl: "╘",
|
|
3448
|
-
br: "╛",
|
|
3449
|
-
h: "═",
|
|
3450
|
-
v: "│"
|
|
3451
|
-
},
|
|
3452
|
-
singleDoubleRounded: {
|
|
3453
|
-
tl: "╭",
|
|
3454
|
-
tr: "╮",
|
|
3455
|
-
bl: "╰",
|
|
3456
|
-
br: "╯",
|
|
3457
|
-
h: "═",
|
|
3458
|
-
v: "│"
|
|
3459
|
-
},
|
|
3460
|
-
rounded: {
|
|
3461
|
-
tl: "╭",
|
|
3462
|
-
tr: "╮",
|
|
3463
|
-
bl: "╰",
|
|
3464
|
-
br: "╯",
|
|
3465
|
-
h: "─",
|
|
3466
|
-
v: "│"
|
|
3467
|
-
}
|
|
3468
|
-
};
|
|
3469
|
-
const defaultStyle = {
|
|
3470
|
-
borderColor: "white",
|
|
3471
|
-
borderStyle: "rounded",
|
|
3472
|
-
valign: "center",
|
|
3473
|
-
padding: 2,
|
|
3474
|
-
marginLeft: 1,
|
|
3475
|
-
marginTop: 1,
|
|
3476
|
-
marginBottom: 1
|
|
3477
|
-
};
|
|
3478
|
-
function box(text, _opts = {}) {
|
|
3479
|
-
const opts = {
|
|
3480
|
-
..._opts,
|
|
3481
|
-
style: {
|
|
3482
|
-
...defaultStyle,
|
|
3483
|
-
..._opts.style
|
|
3484
|
-
}
|
|
3485
|
-
};
|
|
3486
|
-
const textLines = text.split("\n");
|
|
3487
|
-
const boxLines = [];
|
|
3488
|
-
const _color = getColor$1(opts.style.borderColor);
|
|
3489
|
-
const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
|
|
3490
|
-
if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
|
|
3491
|
-
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
3492
|
-
const height = textLines.length + paddingOffset;
|
|
3493
|
-
const width = Math.max(...textLines.map((line) => stripAnsi$1(line).length), opts.title ? stripAnsi$1(opts.title).length : 0) + paddingOffset;
|
|
3494
|
-
const widthOffset = width + paddingOffset;
|
|
3495
|
-
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
3496
|
-
if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
|
|
3497
|
-
if (opts.title) {
|
|
3498
|
-
const title = _color ? _color(opts.title) : opts.title;
|
|
3499
|
-
const left = borderStyle.h.repeat(Math.floor((width - stripAnsi$1(opts.title).length) / 2));
|
|
3500
|
-
const right = borderStyle.h.repeat(width - stripAnsi$1(opts.title).length - stripAnsi$1(left).length + paddingOffset);
|
|
3501
|
-
boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
|
|
3502
|
-
} else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
|
|
3503
|
-
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
3504
|
-
for (let i$1 = 0; i$1 < height; i$1++) if (i$1 < valignOffset || i$1 >= valignOffset + textLines.length) boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
|
|
3505
|
-
else {
|
|
3506
|
-
const line = textLines[i$1 - valignOffset];
|
|
3507
|
-
const left = " ".repeat(paddingOffset);
|
|
3508
|
-
const right = " ".repeat(width - stripAnsi$1(line).length);
|
|
3509
|
-
boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
|
|
3510
|
-
}
|
|
3511
|
-
boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
|
|
3512
|
-
if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
|
|
3513
|
-
return boxLines.join("\n");
|
|
3514
|
-
}
|
|
3515
|
-
|
|
3516
|
-
//#endregion
|
|
3517
|
-
//#region node_modules/consola/dist/index.mjs
|
|
3518
|
-
const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis), o = new Proxy(r, {
|
|
3519
|
-
get(e, s$1) {
|
|
3520
|
-
return i()[s$1] ?? r[s$1];
|
|
3521
|
-
},
|
|
3522
|
-
has(e, s$1) {
|
|
3523
|
-
const E = i();
|
|
3524
|
-
return s$1 in E || s$1 in r;
|
|
3525
|
-
},
|
|
3526
|
-
set(e, s$1, E) {
|
|
3527
|
-
const B = i(true);
|
|
3528
|
-
return B[s$1] = E, true;
|
|
3529
|
-
},
|
|
3530
|
-
deleteProperty(e, s$1) {
|
|
3531
|
-
if (!s$1) return false;
|
|
3532
|
-
const E = i(true);
|
|
3533
|
-
return delete E[s$1], true;
|
|
3534
|
-
},
|
|
3535
|
-
ownKeys() {
|
|
3536
|
-
const e = i(true);
|
|
3537
|
-
return Object.keys(e);
|
|
3538
|
-
}
|
|
3539
|
-
}), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
|
|
3540
|
-
["APPVEYOR"],
|
|
3541
|
-
[
|
|
3542
|
-
"AWS_AMPLIFY",
|
|
3543
|
-
"AWS_APP_ID",
|
|
3544
|
-
{ ci: true }
|
|
3545
|
-
],
|
|
3546
|
-
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
|
3547
|
-
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
|
3548
|
-
["APPCIRCLE", "AC_APPCIRCLE"],
|
|
3549
|
-
["BAMBOO", "bamboo_planKey"],
|
|
3550
|
-
["BITBUCKET", "BITBUCKET_COMMIT"],
|
|
3551
|
-
["BITRISE", "BITRISE_IO"],
|
|
3552
|
-
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
|
3553
|
-
["BUILDKITE"],
|
|
3554
|
-
["CIRCLE", "CIRCLECI"],
|
|
3555
|
-
["CIRRUS", "CIRRUS_CI"],
|
|
3556
|
-
[
|
|
3557
|
-
"CLOUDFLARE_PAGES",
|
|
3558
|
-
"CF_PAGES",
|
|
3559
|
-
{ ci: true }
|
|
3560
|
-
],
|
|
3561
|
-
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
|
3562
|
-
["CODEFRESH", "CF_BUILD_ID"],
|
|
3563
|
-
["DRONE"],
|
|
3564
|
-
["DRONE", "DRONE_BUILD_EVENT"],
|
|
3565
|
-
["DSARI"],
|
|
3566
|
-
["GITHUB_ACTIONS"],
|
|
3567
|
-
["GITLAB", "GITLAB_CI"],
|
|
3568
|
-
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
|
3569
|
-
["GOCD", "GO_PIPELINE_LABEL"],
|
|
3570
|
-
["LAYERCI"],
|
|
3571
|
-
["HUDSON", "HUDSON_URL"],
|
|
3572
|
-
["JENKINS", "JENKINS_URL"],
|
|
3573
|
-
["MAGNUM"],
|
|
3574
|
-
["NETLIFY"],
|
|
3575
|
-
[
|
|
3576
|
-
"NETLIFY",
|
|
3577
|
-
"NETLIFY_LOCAL",
|
|
3578
|
-
{ ci: false }
|
|
3579
|
-
],
|
|
3580
|
-
["NEVERCODE"],
|
|
3581
|
-
["RENDER"],
|
|
3582
|
-
["SAIL", "SAILCI"],
|
|
3583
|
-
["SEMAPHORE"],
|
|
3584
|
-
["SCREWDRIVER"],
|
|
3585
|
-
["SHIPPABLE"],
|
|
3586
|
-
["SOLANO", "TDDIUM"],
|
|
3587
|
-
["STRIDER"],
|
|
3588
|
-
["TEAMCITY", "TEAMCITY_VERSION"],
|
|
3589
|
-
["TRAVIS"],
|
|
3590
|
-
["VERCEL", "NOW_BUILDER"],
|
|
3591
|
-
[
|
|
3592
|
-
"VERCEL",
|
|
3593
|
-
"VERCEL",
|
|
3594
|
-
{ ci: false }
|
|
3595
|
-
],
|
|
3596
|
-
[
|
|
3597
|
-
"VERCEL",
|
|
3598
|
-
"VERCEL_ENV",
|
|
3599
|
-
{ ci: false }
|
|
3600
|
-
],
|
|
3601
|
-
["APPCENTER", "APPCENTER_BUILD_ID"],
|
|
3602
|
-
[
|
|
3603
|
-
"CODESANDBOX",
|
|
3604
|
-
"CODESANDBOX_SSE",
|
|
3605
|
-
{ ci: false }
|
|
3606
|
-
],
|
|
3607
|
-
[
|
|
3608
|
-
"CODESANDBOX",
|
|
3609
|
-
"CODESANDBOX_HOST",
|
|
3610
|
-
{ ci: false }
|
|
3611
|
-
],
|
|
3612
|
-
["STACKBLITZ"],
|
|
3613
|
-
["STORMKIT"],
|
|
3614
|
-
["CLEAVR"],
|
|
3615
|
-
["ZEABUR"],
|
|
3616
|
-
[
|
|
3617
|
-
"CODESPHERE",
|
|
3618
|
-
"CODESPHERE_APP_ID",
|
|
3619
|
-
{ ci: true }
|
|
3620
|
-
],
|
|
3621
|
-
["RAILWAY", "RAILWAY_PROJECT_ID"],
|
|
3622
|
-
["RAILWAY", "RAILWAY_SERVICE_ID"],
|
|
3623
|
-
["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
|
|
3624
|
-
[
|
|
3625
|
-
"FIREBASE_APP_HOSTING",
|
|
3626
|
-
"FIREBASE_APP_HOSTING",
|
|
3627
|
-
{ ci: true }
|
|
3628
|
-
]
|
|
3629
|
-
];
|
|
3630
|
-
function b() {
|
|
3631
|
-
if (globalThis.process?.env) for (const e of f) {
|
|
3632
|
-
const s$1 = e[1] || e[0];
|
|
3633
|
-
if (globalThis.process?.env[s$1]) return {
|
|
3634
|
-
name: e[0].toLowerCase(),
|
|
3635
|
-
...e[2]
|
|
3636
|
-
};
|
|
3637
|
-
}
|
|
3638
|
-
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
|
|
3639
|
-
name: "stackblitz",
|
|
3640
|
-
ci: false
|
|
3641
|
-
} : {
|
|
3642
|
-
name: "",
|
|
3643
|
-
ci: false
|
|
3644
|
-
};
|
|
3645
|
-
}
|
|
3646
|
-
const l = b();
|
|
3647
|
-
l.name;
|
|
3648
|
-
function n(e) {
|
|
3649
|
-
return e ? e !== "false" : false;
|
|
3650
|
-
}
|
|
3651
|
-
const I = globalThis.process?.platform || "", T = n(o.CI) || l.ci !== false, a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), g = n(o.DEBUG), R = t === "test" || n(o.TEST);
|
|
3652
|
-
n(o.MINIMAL);
|
|
3653
|
-
const A = /^win/i.test(I);
|
|
3654
|
-
!n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
|
|
3655
|
-
const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
3656
|
-
Number(C?.split(".")[0]);
|
|
3657
|
-
const y = globalThis.process || Object.create(null), _ = { versions: {} };
|
|
3658
|
-
new Proxy(y, { get(e, s$1) {
|
|
3659
|
-
if (s$1 === "env") return o;
|
|
3660
|
-
if (s$1 in e) return e[s$1];
|
|
3661
|
-
if (s$1 in _) return _[s$1];
|
|
3662
|
-
} });
|
|
3663
|
-
const c = globalThis.process?.release?.name === "node", O = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, L = !!globalThis.fastly, S = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
|
|
3664
|
-
[S, "netlify"],
|
|
3665
|
-
[u, "edge-light"],
|
|
3666
|
-
[N, "workerd"],
|
|
3667
|
-
[L, "fastly"],
|
|
3668
|
-
[D, "deno"],
|
|
3669
|
-
[O, "bun"],
|
|
3670
|
-
[c, "node"]
|
|
3671
|
-
];
|
|
3672
|
-
function G() {
|
|
3673
|
-
const e = F.find((s$1) => s$1[0]);
|
|
3674
|
-
if (e) return { name: e[1] };
|
|
3675
|
-
}
|
|
3676
|
-
const P = G();
|
|
3677
|
-
P?.name;
|
|
3678
|
-
function ansiRegex({ onlyFirst = false } = {}) {
|
|
3679
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
3680
|
-
const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
3681
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
3682
|
-
}
|
|
3683
|
-
const regex = ansiRegex();
|
|
3684
|
-
function stripAnsi(string) {
|
|
3685
|
-
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
3686
|
-
return string.replace(regex, "");
|
|
3687
|
-
}
|
|
3688
|
-
function isAmbiguous(x) {
|
|
3689
|
-
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
3690
|
-
}
|
|
3691
|
-
function isFullWidth(x) {
|
|
3692
|
-
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
3693
|
-
}
|
|
3694
|
-
function isWide(x) {
|
|
3695
|
-
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
3696
|
-
}
|
|
3697
|
-
function validate(codePoint) {
|
|
3698
|
-
if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
3699
|
-
}
|
|
3700
|
-
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
3701
|
-
validate(codePoint);
|
|
3702
|
-
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
|
|
3703
|
-
return 1;
|
|
3704
|
-
}
|
|
3705
|
-
const emojiRegex = () => {
|
|
3706
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
3707
|
-
};
|
|
3708
|
-
const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
|
|
3709
|
-
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
3710
|
-
function stringWidth$1(string, options = {}) {
|
|
3711
|
-
if (typeof string !== "string" || string.length === 0) return 0;
|
|
3712
|
-
const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
|
|
3713
|
-
if (!countAnsiEscapeCodes) string = stripAnsi(string);
|
|
3714
|
-
if (string.length === 0) return 0;
|
|
3715
|
-
let width = 0;
|
|
3716
|
-
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
3717
|
-
for (const { segment: character } of segmenter.segment(string)) {
|
|
3718
|
-
const codePoint = character.codePointAt(0);
|
|
3719
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
|
|
3720
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
|
|
3721
|
-
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
|
|
3722
|
-
if (codePoint >= 55296 && codePoint <= 57343) continue;
|
|
3723
|
-
if (codePoint >= 65024 && codePoint <= 65039) continue;
|
|
3724
|
-
if (defaultIgnorableCodePointRegex.test(character)) continue;
|
|
3725
|
-
if (emojiRegex().test(character)) {
|
|
3726
|
-
width += 2;
|
|
3727
|
-
continue;
|
|
3728
|
-
}
|
|
3729
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
2952
|
+
} catch (e) {}
|
|
3730
2953
|
}
|
|
3731
|
-
return
|
|
3732
|
-
}
|
|
3733
|
-
function isUnicodeSupported() {
|
|
3734
|
-
const { env: env$3 } = process$1;
|
|
3735
|
-
const { TERM, TERM_PROGRAM } = env$3;
|
|
3736
|
-
if (process$1.platform !== "win32") return TERM !== "linux";
|
|
3737
|
-
return Boolean(env$3.WT_SESSION) || Boolean(env$3.TERMINUS_SUBLIME) || env$3.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env$3.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
3738
|
-
}
|
|
3739
|
-
const TYPE_COLOR_MAP = {
|
|
3740
|
-
info: "cyan",
|
|
3741
|
-
fail: "red",
|
|
3742
|
-
success: "green",
|
|
3743
|
-
ready: "green",
|
|
3744
|
-
start: "magenta"
|
|
3745
|
-
};
|
|
3746
|
-
const LEVEL_COLOR_MAP = {
|
|
3747
|
-
0: "red",
|
|
3748
|
-
1: "yellow"
|
|
3749
|
-
};
|
|
3750
|
-
const unicode = isUnicodeSupported();
|
|
3751
|
-
const s = (c$1, fallback) => unicode ? c$1 : fallback;
|
|
3752
|
-
const TYPE_ICONS = {
|
|
3753
|
-
error: s("✖", "×"),
|
|
3754
|
-
fatal: s("✖", "×"),
|
|
3755
|
-
ready: s("✔", "√"),
|
|
3756
|
-
warn: s("⚠", "‼"),
|
|
3757
|
-
info: s("ℹ", "i"),
|
|
3758
|
-
success: s("✔", "√"),
|
|
3759
|
-
debug: s("⚙", "D"),
|
|
3760
|
-
trace: s("→", "→"),
|
|
3761
|
-
fail: s("✖", "×"),
|
|
3762
|
-
start: s("◐", "o"),
|
|
3763
|
-
log: ""
|
|
3764
|
-
};
|
|
3765
|
-
function stringWidth(str) {
|
|
3766
|
-
const hasICU = typeof Intl === "object";
|
|
3767
|
-
if (!hasICU || !Intl.Segmenter) return stripAnsi$1(str).length;
|
|
3768
|
-
return stringWidth$1(str);
|
|
2954
|
+
return stats;
|
|
3769
2955
|
}
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
return
|
|
3774
|
-
${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_$1, m) => `(${colors.cyan(m)})`)).join(`
|
|
3775
|
-
${indent}`);
|
|
3776
|
-
}
|
|
3777
|
-
formatType(logObj, isBadge, opts) {
|
|
3778
|
-
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
3779
|
-
if (isBadge) return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
|
|
3780
|
-
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
3781
|
-
return _type ? getColor(typeColor)(_type) : "";
|
|
2956
|
+
function printMismatchReport(stats, sampleCount = 5) {
|
|
2957
|
+
if (stats.entriesWithBoth === 0) {
|
|
2958
|
+
logger.info("No pricing data found to analyze.");
|
|
2959
|
+
return;
|
|
3782
2960
|
}
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
const
|
|
3793
|
-
const
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
2961
|
+
const matchRate = stats.matches / stats.entriesWithBoth * 100;
|
|
2962
|
+
logger.info("\n=== Pricing Mismatch Debug Report ===");
|
|
2963
|
+
logger.info(`Total entries processed: ${stats.totalEntries.toLocaleString()}`);
|
|
2964
|
+
logger.info(`Entries with both costUSD and model: ${stats.entriesWithBoth.toLocaleString()}`);
|
|
2965
|
+
logger.info(`Matches (within 0.1%): ${stats.matches.toLocaleString()}`);
|
|
2966
|
+
logger.info(`Mismatches: ${stats.mismatches.toLocaleString()}`);
|
|
2967
|
+
logger.info(`Match rate: ${matchRate.toFixed(2)}%`);
|
|
2968
|
+
if (stats.mismatches > 0 && stats.modelStats.size > 0) {
|
|
2969
|
+
logger.info("\n=== Model Statistics ===");
|
|
2970
|
+
const sortedModels = Array.from(stats.modelStats.entries()).sort((a, b) => b[1].mismatches - a[1].mismatches);
|
|
2971
|
+
for (const [model, modelStat] of sortedModels) if (modelStat.mismatches > 0) {
|
|
2972
|
+
const modelMatchRate = modelStat.matches / modelStat.total * 100;
|
|
2973
|
+
logger.info(`${model}:`);
|
|
2974
|
+
logger.info(` Total entries: ${modelStat.total.toLocaleString()}`);
|
|
2975
|
+
logger.info(` Matches: ${modelStat.matches.toLocaleString()} (${modelMatchRate.toFixed(1)}%)`);
|
|
2976
|
+
logger.info(` Mismatches: ${modelStat.mismatches.toLocaleString()}`);
|
|
2977
|
+
logger.info(` Avg % difference: ${modelStat.avgPercentDiff.toFixed(1)}%`);
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
if (stats.mismatches > 0 && stats.versionStats.size > 0) {
|
|
2981
|
+
logger.info("\n=== Version Statistics ===");
|
|
2982
|
+
const sortedVersions = Array.from(stats.versionStats.entries()).filter(([_, versionStat]) => versionStat.mismatches > 0).sort((a, b) => b[1].mismatches - a[1].mismatches);
|
|
2983
|
+
for (const [version$2, versionStat] of sortedVersions) {
|
|
2984
|
+
const versionMatchRate = versionStat.matches / versionStat.total * 100;
|
|
2985
|
+
logger.info(`${version$2}:`);
|
|
2986
|
+
logger.info(` Total entries: ${versionStat.total.toLocaleString()}`);
|
|
2987
|
+
logger.info(` Matches: ${versionStat.matches.toLocaleString()} (${versionMatchRate.toFixed(1)}%)`);
|
|
2988
|
+
logger.info(` Mismatches: ${versionStat.mismatches.toLocaleString()}`);
|
|
2989
|
+
logger.info(` Avg % difference: ${versionStat.avgPercentDiff.toFixed(1)}%`);
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
if (stats.discrepancies.length > 0 && sampleCount > 0) {
|
|
2993
|
+
logger.info(`\n=== Sample Discrepancies (first ${sampleCount}) ===`);
|
|
2994
|
+
const samples = stats.discrepancies.slice(0, sampleCount);
|
|
2995
|
+
for (const disc of samples) {
|
|
2996
|
+
logger.info(`File: ${disc.file}`);
|
|
2997
|
+
logger.info(`Timestamp: ${disc.timestamp}`);
|
|
2998
|
+
logger.info(`Model: ${disc.model}`);
|
|
2999
|
+
logger.info(`Original cost: $${disc.originalCost.toFixed(6)}`);
|
|
3000
|
+
logger.info(`Calculated cost: $${disc.calculatedCost.toFixed(6)}`);
|
|
3001
|
+
logger.info(`Difference: $${disc.difference.toFixed(6)} (${disc.percentDiff.toFixed(2)}%)`);
|
|
3002
|
+
logger.info(`Tokens: ${JSON.stringify(disc.usage)}`);
|
|
3003
|
+
logger.info("---");
|
|
3803
3004
|
}
|
|
3804
|
-
return isBadge ? "\n" + line + "\n" : line;
|
|
3805
3005
|
}
|
|
3806
|
-
};
|
|
3807
|
-
function characterFormat(str) {
|
|
3808
|
-
return str.replace(/`([^`]+)`/gm, (_$1, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_$1, m) => ` ${colors.underline(m)} `);
|
|
3809
3006
|
}
|
|
3810
|
-
function getColor(color = "white") {
|
|
3811
|
-
return colors[color] || colors.white;
|
|
3812
|
-
}
|
|
3813
|
-
function getBgColor(color = "bgWhite") {
|
|
3814
|
-
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
3815
|
-
}
|
|
3816
|
-
function createConsola(options = {}) {
|
|
3817
|
-
let level$1 = _getDefaultLogLevel();
|
|
3818
|
-
if (process.env.CONSOLA_LEVEL) level$1 = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level$1;
|
|
3819
|
-
const consola2 = createConsola$1({
|
|
3820
|
-
level: level$1,
|
|
3821
|
-
defaults: { level: level$1 },
|
|
3822
|
-
stdout: process.stdout,
|
|
3823
|
-
stderr: process.stderr,
|
|
3824
|
-
prompt: (...args) => import("./prompt-_w55ddDU.js").then((m) => m.prompt(...args)),
|
|
3825
|
-
reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
3826
|
-
...options
|
|
3827
|
-
});
|
|
3828
|
-
return consola2;
|
|
3829
|
-
}
|
|
3830
|
-
function _getDefaultLogLevel() {
|
|
3831
|
-
if (g) return LogLevels.debug;
|
|
3832
|
-
if (R) return LogLevels.warn;
|
|
3833
|
-
return LogLevels.info;
|
|
3834
|
-
}
|
|
3835
|
-
const consola = createConsola();
|
|
3836
|
-
|
|
3837
|
-
//#endregion
|
|
3838
|
-
//#region package.json
|
|
3839
|
-
var name = "ccusage";
|
|
3840
|
-
var version = "0.3.1";
|
|
3841
|
-
var description = "Usage analysis tool for Claude Code";
|
|
3842
|
-
|
|
3843
|
-
//#endregion
|
|
3844
|
-
//#region logger.ts
|
|
3845
|
-
const logger = consola.withTag(name);
|
|
3846
|
-
const log = (...args) => console.log(...args);
|
|
3847
3007
|
|
|
3848
3008
|
//#endregion
|
|
3849
3009
|
//#region types.ts
|
|
3850
|
-
const ModelSpecSchema =
|
|
3851
|
-
max_tokens:
|
|
3852
|
-
max_input_tokens:
|
|
3853
|
-
max_output_tokens:
|
|
3854
|
-
input_cost_per_token:
|
|
3855
|
-
output_cost_per_token:
|
|
3856
|
-
output_cost_per_reasoning_token:
|
|
3857
|
-
cache_creation_input_token_cost:
|
|
3858
|
-
cache_read_input_token_cost:
|
|
3859
|
-
litellm_provider:
|
|
3860
|
-
mode:
|
|
3861
|
-
supports_function_calling:
|
|
3862
|
-
supports_parallel_function_calling:
|
|
3863
|
-
supports_vision:
|
|
3864
|
-
supports_audio_input:
|
|
3865
|
-
supports_audio_output:
|
|
3866
|
-
supports_prompt_caching:
|
|
3867
|
-
supports_response_schema:
|
|
3868
|
-
supports_system_messages:
|
|
3869
|
-
supports_reasoning:
|
|
3870
|
-
supports_web_search:
|
|
3871
|
-
search_context_cost_per_query:
|
|
3872
|
-
search_context_size_low:
|
|
3873
|
-
search_context_size_medium:
|
|
3874
|
-
search_context_size_high:
|
|
3010
|
+
const ModelSpecSchema = object({
|
|
3011
|
+
max_tokens: optional(union([number(), string()])),
|
|
3012
|
+
max_input_tokens: optional(union([number(), string()])),
|
|
3013
|
+
max_output_tokens: optional(union([number(), string()])),
|
|
3014
|
+
input_cost_per_token: optional(number()),
|
|
3015
|
+
output_cost_per_token: optional(number()),
|
|
3016
|
+
output_cost_per_reasoning_token: optional(number()),
|
|
3017
|
+
cache_creation_input_token_cost: optional(number()),
|
|
3018
|
+
cache_read_input_token_cost: optional(number()),
|
|
3019
|
+
litellm_provider: optional(string()),
|
|
3020
|
+
mode: optional(string()),
|
|
3021
|
+
supports_function_calling: optional(boolean()),
|
|
3022
|
+
supports_parallel_function_calling: optional(boolean()),
|
|
3023
|
+
supports_vision: optional(boolean()),
|
|
3024
|
+
supports_audio_input: optional(boolean()),
|
|
3025
|
+
supports_audio_output: optional(boolean()),
|
|
3026
|
+
supports_prompt_caching: optional(boolean()),
|
|
3027
|
+
supports_response_schema: optional(boolean()),
|
|
3028
|
+
supports_system_messages: optional(boolean()),
|
|
3029
|
+
supports_reasoning: optional(boolean()),
|
|
3030
|
+
supports_web_search: optional(boolean()),
|
|
3031
|
+
search_context_cost_per_query: optional(object({
|
|
3032
|
+
search_context_size_low: number(),
|
|
3033
|
+
search_context_size_medium: number(),
|
|
3034
|
+
search_context_size_high: number()
|
|
3875
3035
|
})),
|
|
3876
|
-
deprecation_date:
|
|
3036
|
+
deprecation_date: optional(string())
|
|
3877
3037
|
});
|
|
3878
|
-
const LiteLLMModelPricesSchema =
|
|
3879
|
-
const dateSchema =
|
|
3038
|
+
const LiteLLMModelPricesSchema = record(string(), ModelSpecSchema);
|
|
3039
|
+
const dateSchema = pipe(string(), regex(/^\d{8}$/, "Date must be in YYYYMMDD format"));
|
|
3040
|
+
const CostModes = [
|
|
3041
|
+
"auto",
|
|
3042
|
+
"calculate",
|
|
3043
|
+
"display"
|
|
3044
|
+
];
|
|
3880
3045
|
|
|
3881
3046
|
//#endregion
|
|
3882
3047
|
//#region shared-args.ts
|
|
3883
3048
|
const parseDateArg = (value) => {
|
|
3884
|
-
const result =
|
|
3049
|
+
const result = safeParse(dateSchema, value);
|
|
3885
3050
|
if (!result.success) throw new TypeError(result.issues[0].message);
|
|
3886
3051
|
return result.output;
|
|
3887
3052
|
};
|
|
@@ -3909,8 +3074,30 @@ const sharedArgs = {
|
|
|
3909
3074
|
short: "j",
|
|
3910
3075
|
description: "Output in JSON format",
|
|
3911
3076
|
default: false
|
|
3077
|
+
},
|
|
3078
|
+
mode: {
|
|
3079
|
+
type: "enum",
|
|
3080
|
+
short: "m",
|
|
3081
|
+
description: "Cost calculation mode: auto (use costUSD if exists, otherwise calculate), calculate (always calculate), display (always use costUSD)",
|
|
3082
|
+
default: "auto",
|
|
3083
|
+
choices: CostModes
|
|
3084
|
+
},
|
|
3085
|
+
debug: {
|
|
3086
|
+
type: "boolean",
|
|
3087
|
+
short: "d",
|
|
3088
|
+
description: "Show pricing mismatch information for debugging",
|
|
3089
|
+
default: false
|
|
3090
|
+
},
|
|
3091
|
+
debugSamples: {
|
|
3092
|
+
type: "number",
|
|
3093
|
+
description: "Number of sample discrepancies to show in debug output (default: 5)",
|
|
3094
|
+
default: 5
|
|
3912
3095
|
}
|
|
3913
3096
|
};
|
|
3097
|
+
const sharedCommandConfig = {
|
|
3098
|
+
args: sharedArgs,
|
|
3099
|
+
toKebab: true
|
|
3100
|
+
};
|
|
3914
3101
|
|
|
3915
3102
|
//#endregion
|
|
3916
3103
|
//#region utils.ts
|
|
@@ -3928,12 +3115,13 @@ var import_picocolors$1 = __toESM(require_picocolors(), 1);
|
|
|
3928
3115
|
const dailyCommand = define({
|
|
3929
3116
|
name: "daily",
|
|
3930
3117
|
description: "Show usage report grouped by date",
|
|
3931
|
-
|
|
3118
|
+
...sharedCommandConfig,
|
|
3932
3119
|
async run(ctx) {
|
|
3933
3120
|
const options = {
|
|
3934
3121
|
since: ctx.values.since,
|
|
3935
3122
|
until: ctx.values.until,
|
|
3936
|
-
claudePath: ctx.values.path
|
|
3123
|
+
claudePath: ctx.values.path,
|
|
3124
|
+
mode: ctx.values.mode
|
|
3937
3125
|
};
|
|
3938
3126
|
const dailyData = await loadUsageData(options);
|
|
3939
3127
|
if (dailyData.length === 0) {
|
|
@@ -3942,6 +3130,10 @@ const dailyCommand = define({
|
|
|
3942
3130
|
process$1.exit(0);
|
|
3943
3131
|
}
|
|
3944
3132
|
const totals = calculateTotals(dailyData);
|
|
3133
|
+
if (ctx.values.debug && !ctx.values.json) {
|
|
3134
|
+
const mismatchStats = await detectMismatches(ctx.values.path);
|
|
3135
|
+
printMismatchReport(mismatchStats, ctx.values.debugSamples);
|
|
3136
|
+
}
|
|
3945
3137
|
if (ctx.values.json) {
|
|
3946
3138
|
const jsonOutput = {
|
|
3947
3139
|
daily: dailyData.map((data) => ({
|
|
@@ -4018,12 +3210,13 @@ var import_picocolors = __toESM(require_picocolors(), 1);
|
|
|
4018
3210
|
const sessionCommand = define({
|
|
4019
3211
|
name: "session",
|
|
4020
3212
|
description: "Show usage report grouped by conversation session",
|
|
4021
|
-
|
|
3213
|
+
...sharedCommandConfig,
|
|
4022
3214
|
async run(ctx) {
|
|
4023
3215
|
const options = {
|
|
4024
3216
|
since: ctx.values.since,
|
|
4025
3217
|
until: ctx.values.until,
|
|
4026
|
-
claudePath: ctx.values.path
|
|
3218
|
+
claudePath: ctx.values.path,
|
|
3219
|
+
mode: ctx.values.mode
|
|
4027
3220
|
};
|
|
4028
3221
|
const sessionData = await loadSessionData(options);
|
|
4029
3222
|
if (sessionData.length === 0) {
|
|
@@ -4032,6 +3225,10 @@ const sessionCommand = define({
|
|
|
4032
3225
|
process$1.exit(0);
|
|
4033
3226
|
}
|
|
4034
3227
|
const totals = calculateTotals(sessionData);
|
|
3228
|
+
if (ctx.values.debug && !ctx.values.json) {
|
|
3229
|
+
const mismatchStats = await detectMismatches(ctx.values.path);
|
|
3230
|
+
printMismatchReport(mismatchStats, ctx.values.debugSamples);
|
|
3231
|
+
}
|
|
4035
3232
|
if (ctx.values.json) {
|
|
4036
3233
|
const jsonOutput = {
|
|
4037
3234
|
sessions: sessionData.map((data) => ({
|