ccusage 0.3.2 → 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/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { __commonJS, __require, __toESM, boolean, getDefaultClaudePath, loadSessionData, loadUsageData, number, object, optional, pipe, record, regex, safeParse, string, union } from "./data-loader-D64xoJ7s.js";
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 { sep } from "node:path";
4
+ import { readFile } from "node:fs/promises";
5
+ import { homedir } from "node:os";
6
+ import path from "node:path";
5
7
  import process$1 from "node:process";
6
- import { formatWithOptions } from "node:util";
7
- import * as tty from "node:tty";
8
8
 
9
9
  //#region node_modules/gunshi/lib/utils-B_QNzw5q.js
10
10
  /**
@@ -168,7 +168,7 @@ var DefaultTranslation = class {
168
168
  let message = this.getMessage(locale, key);
169
169
  if (message === void 0 && locale !== this.#options.fallbackLocale) message = this.getMessage(this.#options.fallbackLocale, key);
170
170
  if (message === void 0) return;
171
- return message.replaceAll(/\{\{(\w+)\}\}/g, (_$1, name$1) => {
171
+ return message.replaceAll(/\{\{(\w+)\}\}/g, (_, name$1) => {
172
172
  return values[name$1] == null ? "" : values[name$1].toString();
173
173
  });
174
174
  }
@@ -179,7 +179,7 @@ const BUILT_IN_PREFIX_CODE = BUILT_IN_PREFIX.codePointAt(0);
179
179
  * @param param A {@link CommandContextParams | parameters} to create a {@link CommandContext | command context}
180
180
  * @returns A {@link CommandContext | command context}, which is readonly
181
181
  */
182
- async function createCommandContext({ args, values, positionals, rest, argv: argv$2, tokens, command, cliOptions, callMode = "entry", omitted = false }) {
182
+ async function createCommandContext({ args, values, positionals, rest, argv: argv$1, tokens, command, cliOptions, callMode = "entry", omitted = false }) {
183
183
  /**
184
184
  * normailize the options schema and values, to avoid prototype pollution
185
185
  */
@@ -190,7 +190,7 @@ async function createCommandContext({ args, values, positionals, rest, argv: arg
190
190
  /**
191
191
  * setup the environment
192
192
  */
193
- const env$3 = Object.assign(create(), COMMAND_OPTIONS_DEFAULT, cliOptions);
193
+ const env$2 = Object.assign(create(), COMMAND_OPTIONS_DEFAULT, cliOptions);
194
194
  const locale = resolveLocale(cliOptions.locale);
195
195
  const localeStr = locale.toString();
196
196
  const translationAdapterFactory = cliOptions.translationAdapterFactory || createTranslationAdapter;
@@ -237,12 +237,12 @@ async function createCommandContext({ args, values, positionals, rest, argv: arg
237
237
  omitted,
238
238
  callMode,
239
239
  locale,
240
- env: env$3,
240
+ env: env$2,
241
241
  args: _args,
242
242
  values,
243
243
  positionals,
244
244
  rest,
245
- _: argv$2,
245
+ _: argv$1,
246
246
  tokens,
247
247
  toKebab: command.toKebab,
248
248
  log: cliOptions.usageSilent ? NOOP : log$1,
@@ -538,7 +538,7 @@ function resolveDisplayValue(ctx, key) {
538
538
  * @returns Generated options usage
539
539
  */
540
540
  async function generateOptionalArgsUsage(ctx, optionsPairs) {
541
- const optionsMaxLength = Math.max(...Object.entries(optionsPairs).map(([_$1, value]) => value.length));
541
+ const optionsMaxLength = Math.max(...Object.entries(optionsPairs).map(([_, value]) => value.length));
542
542
  const optionSchemaMaxLength = ctx.env.usageOptionType ? Math.max(...Object.entries(optionsPairs).map(([key]) => resolveNegatableType(key, ctx).length)) : 0;
543
543
  const usages = await Promise.all(Object.entries(optionsPairs).map(([key, value]) => {
544
544
  let rawDesc = ctx.translate(resolveArgKey(key));
@@ -557,7 +557,7 @@ async function generateOptionalArgsUsage(ctx, optionsPairs) {
557
557
  return usages.join("\n");
558
558
  }
559
559
  function getPositionalArgs(ctx) {
560
- return Object.entries(ctx.args).filter(([_$1, schema]) => schema.type === "positional");
560
+ return Object.entries(ctx.args).filter(([_, schema]) => schema.type === "positional");
561
561
  }
562
562
  async function generatePositionalArgsUsage(ctx) {
563
563
  const positionals = getPositionalArgs(ctx);
@@ -677,8 +677,8 @@ function parseArgs(args, options = {}) {
677
677
  if (isShortOptionGroup(arg)) {
678
678
  const expanded = [];
679
679
  let shortValue = "";
680
- for (let i$1 = 1; i$1 < arg.length; i$1++) {
681
- const shortableOption = arg.charAt(i$1);
680
+ for (let i = 1; i < arg.length; i++) {
681
+ const shortableOption = arg.charAt(i);
682
682
  if (hasShortValueSeparator) shortValue += shortableOption;
683
683
  else if (!allowCompatible && shortableOption.codePointAt(0) === EQUAL_CODE) hasShortValueSeparator = true;
684
684
  else expanded.push(`${SHORT_OPTION_PREFIX}${shortableOption}`);
@@ -823,8 +823,8 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
823
823
  */
824
824
  const schemas = Object.values(args);
825
825
  let terminated = false;
826
- for (let i$1 = 0; i$1 < tokens.length; i$1++) {
827
- const token = tokens[i$1];
826
+ for (let i = 0; i < tokens.length; i++) {
827
+ const token = tokens[i];
828
828
  if (token.kind === "positional") {
829
829
  if (terminated && token.value) {
830
830
  rest.push(token.value);
@@ -912,8 +912,8 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
912
912
  positionalsCount++;
913
913
  continue;
914
914
  }
915
- for (let i$1 = 0; i$1 < optionTokens.length; i$1++) {
916
- const token = optionTokens[i$1];
915
+ for (let i = 0; i < optionTokens.length; i++) {
916
+ const token = optionTokens[i];
917
917
  if (checkTokenName(arg, schema, token) && token.rawName != void 0 && hasLongOptionPrefix(token.rawName) || schema.short === token.name && token.rawName != void 0 && isShortOption(token.rawName)) {
918
918
  const invalid = validateRequire(token, arg, schema);
919
919
  if (invalid) {
@@ -947,7 +947,7 @@ function parse(token, option, schema) {
947
947
  return token.value ? [+token.value, void 0] : [+(schema.default || ""), void 0];
948
948
  }
949
949
  case "enum": {
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$1) => JSON.stringify(c$1)).join(", ")}] values`, option, "type", schema)];
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)];
951
951
  return [token.value || schema.default, void 0];
952
952
  }
953
953
  case "custom": {
@@ -999,9 +999,9 @@ function createTypeError(option, schema) {
999
999
  * @param options A {@link CliOptions | CLI options}
1000
1000
  * @returns A rendered usage or undefined. if you will use {@link CliOptions.usageSilent} option, it will return rendered usage string.
1001
1001
  */
1002
- async function cli(argv$2, entry, options = {}) {
1002
+ async function cli(argv$1, entry, options = {}) {
1003
1003
  const cliOptions = resolveCliOptions(options, entry);
1004
- const tokens = parseArgs(argv$2);
1004
+ const tokens = parseArgs(argv$1);
1005
1005
  const subCommand = getSubCommand(tokens);
1006
1006
  const { commandName: name$1, command, callMode } = await resolveCommand(subCommand, entry, cliOptions);
1007
1007
  if (!command) throw new Error(`Command not found: ${name$1 || ""}`);
@@ -1017,7 +1017,7 @@ async function cli(argv$2, entry, options = {}) {
1017
1017
  values,
1018
1018
  positionals,
1019
1019
  rest,
1020
- argv: argv$2,
1020
+ argv: argv$1,
1021
1021
  tokens,
1022
1022
  omitted,
1023
1023
  callMode,
@@ -1167,8 +1167,8 @@ var require_ansi_regex = __commonJS({ "node_modules/ansi-regex/index.js"(exports
1167
1167
  //#endregion
1168
1168
  //#region node_modules/strip-ansi/index.js
1169
1169
  var require_strip_ansi = __commonJS({ "node_modules/strip-ansi/index.js"(exports, module) {
1170
- const ansiRegex$2 = require_ansi_regex();
1171
- module.exports = (string$1) => typeof string$1 === "string" ? string$1.replace(ansiRegex$2(), "") : string$1;
1170
+ const ansiRegex = require_ansi_regex();
1171
+ module.exports = (string$1) => typeof string$1 === "string" ? string$1.replace(ansiRegex(), "") : string$1;
1172
1172
  } });
1173
1173
 
1174
1174
  //#endregion
@@ -1194,32 +1194,32 @@ var require_emoji_regex = __commonJS({ "node_modules/emoji-regex/index.js"(expor
1194
1194
  //#endregion
1195
1195
  //#region node_modules/string-width/index.js
1196
1196
  var require_string_width = __commonJS({ "node_modules/string-width/index.js"(exports, module) {
1197
- const stripAnsi$2 = require_strip_ansi();
1197
+ const stripAnsi = require_strip_ansi();
1198
1198
  const isFullwidthCodePoint = require_is_fullwidth_code_point();
1199
- const emojiRegex$1 = require_emoji_regex();
1200
- const stringWidth$3 = (string$1) => {
1199
+ const emojiRegex = require_emoji_regex();
1200
+ const stringWidth$1 = (string$1) => {
1201
1201
  if (typeof string$1 !== "string" || string$1.length === 0) return 0;
1202
- string$1 = stripAnsi$2(string$1);
1202
+ string$1 = stripAnsi(string$1);
1203
1203
  if (string$1.length === 0) return 0;
1204
- string$1 = string$1.replace(emojiRegex$1(), " ");
1204
+ string$1 = string$1.replace(emojiRegex(), " ");
1205
1205
  let width = 0;
1206
- for (let i$1 = 0; i$1 < string$1.length; i$1++) {
1207
- const code = string$1.codePointAt(i$1);
1206
+ for (let i = 0; i < string$1.length; i++) {
1207
+ const code = string$1.codePointAt(i);
1208
1208
  if (code <= 31 || code >= 127 && code <= 159) continue;
1209
1209
  if (code >= 768 && code <= 879) continue;
1210
- if (code > 65535) i$1++;
1210
+ if (code > 65535) i++;
1211
1211
  width += isFullwidthCodePoint(code) ? 2 : 1;
1212
1212
  }
1213
1213
  return width;
1214
1214
  };
1215
- module.exports = stringWidth$3;
1216
- module.exports.default = stringWidth$3;
1215
+ module.exports = stringWidth$1;
1216
+ module.exports.default = stringWidth$1;
1217
1217
  } });
1218
1218
 
1219
1219
  //#endregion
1220
1220
  //#region node_modules/cli-table3/src/utils.js
1221
1221
  var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports, module) {
1222
- const stringWidth$2 = require_string_width();
1222
+ const stringWidth = require_string_width();
1223
1223
  function codeRegex(capture) {
1224
1224
  return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g;
1225
1225
  }
@@ -1227,8 +1227,8 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
1227
1227
  let code = codeRegex();
1228
1228
  let stripped = ("" + str).replace(code, "");
1229
1229
  let split = stripped.split("\n");
1230
- return split.reduce(function(memo, s$1) {
1231
- return stringWidth$2(s$1) > memo ? stringWidth$2(s$1) : memo;
1230
+ return split.reduce(function(memo, s) {
1231
+ return stringWidth(s) > memo ? stringWidth(s) : memo;
1232
1232
  }, 0);
1233
1233
  }
1234
1234
  function repeat(str, times) {
@@ -1290,9 +1290,9 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
1290
1290
  return;
1291
1291
  }
1292
1292
  if (controlCode === 0) {
1293
- for (let i$1 in state)
1293
+ for (let i in state)
1294
1294
  /* istanbul ignore else */
1295
- if (Object.prototype.hasOwnProperty.call(state, i$1)) delete state[i$1];
1295
+ if (Object.prototype.hasOwnProperty.call(state, i)) delete state[i];
1296
1296
  return;
1297
1297
  }
1298
1298
  let info$1 = codeCache[controlChars[0]];
@@ -1419,8 +1419,8 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
1419
1419
  let line = [];
1420
1420
  let lineLength = 0;
1421
1421
  let whitespace;
1422
- for (let i$1 = 0; i$1 < split.length; i$1 += 2) {
1423
- let word = split[i$1];
1422
+ for (let i = 0; i < split.length; i += 2) {
1423
+ let word = split[i];
1424
1424
  let newLength = lineLength + strlen(word);
1425
1425
  if (lineLength > 0 && whitespace) newLength += whitespace.length;
1426
1426
  if (newLength > maxLength) {
@@ -1431,7 +1431,7 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
1431
1431
  line.push(whitespace || "", word);
1432
1432
  lineLength = newLength;
1433
1433
  }
1434
- whitespace = split[i$1 + 1];
1434
+ whitespace = split[i + 1];
1435
1435
  }
1436
1436
  if (lineLength) lines.push(line.join(""));
1437
1437
  return lines;
@@ -1448,7 +1448,7 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
1448
1448
  }
1449
1449
  }
1450
1450
  let split = input.split(/(\s+)/g);
1451
- for (let i$1 = 0; i$1 < split.length; i$1 += 2) pushLine(split[i$1], i$1 && split[i$1 - 1]);
1451
+ for (let i = 0; i < split.length; i += 2) pushLine(split[i], i && split[i - 1]);
1452
1452
  if (line.length) lines.push(line);
1453
1453
  return lines;
1454
1454
  }
@@ -1456,14 +1456,14 @@ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports,
1456
1456
  let output = [];
1457
1457
  input = input.split("\n");
1458
1458
  const handler = wrapOnWordBoundary ? wordWrap : textWrap;
1459
- for (let i$1 = 0; i$1 < input.length; i$1++) output.push.apply(output, handler(maxLength, input[i$1]));
1459
+ for (let i = 0; i < input.length; i++) output.push.apply(output, handler(maxLength, input[i]));
1460
1460
  return output;
1461
1461
  }
1462
1462
  function colorizeLines(input) {
1463
1463
  let state = {};
1464
1464
  let output = [];
1465
- for (let i$1 = 0; i$1 < input.length; i$1++) {
1466
- let line = rewindState(state, input[i$1]);
1465
+ for (let i = 0; i < input.length; i++) {
1466
+ let line = rewindState(state, input[i]);
1467
1467
  state = readState(line);
1468
1468
  let temp = Object.assign({}, state);
1469
1469
  output.push(unwindState(temp, line));
@@ -1572,11 +1572,11 @@ var require_styles = __commonJS({ "node_modules/@colors/colors/lib/styles.js"(ex
1572
1572
  //#endregion
1573
1573
  //#region node_modules/@colors/colors/lib/system/has-flag.js
1574
1574
  var require_has_flag = __commonJS({ "node_modules/@colors/colors/lib/system/has-flag.js"(exports, module) {
1575
- module.exports = function(flag, argv$2) {
1576
- argv$2 = argv$2 || process.argv;
1577
- var terminatorPos = argv$2.indexOf("--");
1575
+ module.exports = function(flag, argv$1) {
1576
+ argv$1 = argv$1 || process.argv;
1577
+ var terminatorPos = argv$1.indexOf("--");
1578
1578
  var prefix = /^-{1,2}/.test(flag) ? "" : "--";
1579
- var pos = argv$2.indexOf(prefix + flag);
1579
+ var pos = argv$1.indexOf(prefix + flag);
1580
1580
  return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
1581
1581
  };
1582
1582
  } });
@@ -1586,11 +1586,11 @@ var require_has_flag = __commonJS({ "node_modules/@colors/colors/lib/system/has-
1586
1586
  var require_supports_colors = __commonJS({ "node_modules/@colors/colors/lib/system/supports-colors.js"(exports, module) {
1587
1587
  var os = __require("os");
1588
1588
  var hasFlag = require_has_flag();
1589
- var env$2 = process.env;
1589
+ var env$1 = process.env;
1590
1590
  var forceColor = void 0;
1591
1591
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) forceColor = false;
1592
1592
  else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = true;
1593
- if ("FORCE_COLOR" in env$2) forceColor = env$2.FORCE_COLOR.length === 0 || parseInt(env$2.FORCE_COLOR, 10) !== 0;
1593
+ if ("FORCE_COLOR" in env$1) forceColor = env$1.FORCE_COLOR.length === 0 || parseInt(env$1.FORCE_COLOR, 10) !== 0;
1594
1594
  function translateLevel(level$1) {
1595
1595
  if (level$1 === 0) return false;
1596
1596
  return {
@@ -1611,30 +1611,30 @@ var require_supports_colors = __commonJS({ "node_modules/@colors/colors/lib/syst
1611
1611
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
1612
1612
  return 1;
1613
1613
  }
1614
- if ("CI" in env$2) {
1614
+ if ("CI" in env$1) {
1615
1615
  if ([
1616
1616
  "TRAVIS",
1617
1617
  "CIRCLECI",
1618
1618
  "APPVEYOR",
1619
1619
  "GITLAB_CI"
1620
1620
  ].some(function(sign) {
1621
- return sign in env$2;
1622
- }) || env$2.CI_NAME === "codeship") return 1;
1621
+ return sign in env$1;
1622
+ }) || env$1.CI_NAME === "codeship") return 1;
1623
1623
  return min;
1624
1624
  }
1625
- if ("TEAMCITY_VERSION" in env$2) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$2.TEAMCITY_VERSION) ? 1 : 0;
1626
- if ("TERM_PROGRAM" in env$2) {
1627
- var version$2 = parseInt((env$2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1628
- switch (env$2.TERM_PROGRAM) {
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) {
1629
1629
  case "iTerm.app": return version$2 >= 3 ? 3 : 2;
1630
1630
  case "Hyper": return 3;
1631
1631
  case "Apple_Terminal": return 2;
1632
1632
  }
1633
1633
  }
1634
- if (/-256(color)?$/i.test(env$2.TERM)) return 2;
1635
- if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env$2.TERM)) return 1;
1636
- if ("COLORTERM" in env$2) return 1;
1637
- if (env$2.TERM === "dumb") return min;
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;
1638
1638
  return min;
1639
1639
  }
1640
1640
  function getSupportLevel(stream) {
@@ -1784,12 +1784,12 @@ var require_trap = __commonJS({ "node_modules/@colors/colors/lib/custom/trap.js"
1784
1784
  ],
1785
1785
  z: ["Ƶ", "ɀ"]
1786
1786
  };
1787
- text.forEach(function(c$1) {
1788
- c$1 = c$1.toLowerCase();
1789
- var chars = trap[c$1] || [" "];
1787
+ text.forEach(function(c) {
1788
+ c = c.toLowerCase();
1789
+ var chars = trap[c] || [" "];
1790
1790
  var rand = Math.floor(Math.random() * chars.length);
1791
- if (typeof trap[c$1] !== "undefined") result += trap[c$1][rand];
1792
- else result += c$1;
1791
+ if (typeof trap[c] !== "undefined") result += trap[c][rand];
1792
+ else result += c;
1793
1793
  });
1794
1794
  return result;
1795
1795
  };
@@ -1922,29 +1922,29 @@ var require_zalgo = __commonJS({ "node_modules/@colors/colors/lib/custom/zalgo.j
1922
1922
  };
1923
1923
  var all = [].concat(soul.up, soul.down, soul.mid);
1924
1924
  function randomNumber(range) {
1925
- var r$1 = Math.floor(Math.random() * range);
1926
- return r$1;
1925
+ var r = Math.floor(Math.random() * range);
1926
+ return r;
1927
1927
  }
1928
1928
  function isChar(character) {
1929
1929
  var bool = false;
1930
- all.filter(function(i$1) {
1931
- bool = i$1 === character;
1930
+ all.filter(function(i) {
1931
+ bool = i === character;
1932
1932
  });
1933
1933
  return bool;
1934
1934
  }
1935
1935
  function heComes(text$1, options$1) {
1936
1936
  var result = "";
1937
1937
  var counts;
1938
- var l$1;
1938
+ var l;
1939
1939
  options$1 = options$1 || {};
1940
1940
  options$1["up"] = typeof options$1["up"] !== "undefined" ? options$1["up"] : true;
1941
1941
  options$1["mid"] = typeof options$1["mid"] !== "undefined" ? options$1["mid"] : true;
1942
1942
  options$1["down"] = typeof options$1["down"] !== "undefined" ? options$1["down"] : true;
1943
1943
  options$1["size"] = typeof options$1["size"] !== "undefined" ? options$1["size"] : "maxi";
1944
1944
  text$1 = text$1.split("");
1945
- for (l$1 in text$1) {
1946
- if (isChar(l$1)) continue;
1947
- result = result + text$1[l$1];
1945
+ for (l in text$1) {
1946
+ if (isChar(l)) continue;
1947
+ result = result + text$1[l];
1948
1948
  counts = {
1949
1949
  "up": 0,
1950
1950
  "down": 0,
@@ -1974,7 +1974,7 @@ var require_zalgo = __commonJS({ "node_modules/@colors/colors/lib/custom/zalgo.j
1974
1974
  ];
1975
1975
  for (var d in arr) {
1976
1976
  var index = arr[d];
1977
- for (var i$1 = 0; i$1 <= counts[index]; i$1++) if (options$1[index]) result = result + soul[index][randomNumber(soul[index].length)];
1977
+ for (var i = 0; i <= counts[index]; i++) if (options$1[index]) result = result + soul[index][randomNumber(soul[index].length)];
1978
1978
  }
1979
1979
  }
1980
1980
  return result;
@@ -1986,13 +1986,13 @@ var require_zalgo = __commonJS({ "node_modules/@colors/colors/lib/custom/zalgo.j
1986
1986
  //#endregion
1987
1987
  //#region node_modules/@colors/colors/lib/maps/america.js
1988
1988
  var require_america = __commonJS({ "node_modules/@colors/colors/lib/maps/america.js"(exports, module) {
1989
- module["exports"] = function(colors$3) {
1990
- return function(letter, i$1, exploded) {
1989
+ module["exports"] = function(colors$2) {
1990
+ return function(letter, i, exploded) {
1991
1991
  if (letter === " ") return letter;
1992
- switch (i$1 % 3) {
1993
- case 0: return colors$3.red(letter);
1994
- case 1: return colors$3.white(letter);
1995
- case 2: return colors$3.blue(letter);
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);
1996
1996
  }
1997
1997
  };
1998
1998
  };
@@ -2001,9 +2001,9 @@ var require_america = __commonJS({ "node_modules/@colors/colors/lib/maps/america
2001
2001
  //#endregion
2002
2002
  //#region node_modules/@colors/colors/lib/maps/zebra.js
2003
2003
  var require_zebra = __commonJS({ "node_modules/@colors/colors/lib/maps/zebra.js"(exports, module) {
2004
- module["exports"] = function(colors$3) {
2005
- return function(letter, i$1, exploded) {
2006
- return i$1 % 2 === 0 ? letter : colors$3.inverse(letter);
2004
+ module["exports"] = function(colors$2) {
2005
+ return function(letter, i, exploded) {
2006
+ return i % 2 === 0 ? letter : colors$2.inverse(letter);
2007
2007
  };
2008
2008
  };
2009
2009
  } });
@@ -2011,7 +2011,7 @@ var require_zebra = __commonJS({ "node_modules/@colors/colors/lib/maps/zebra.js"
2011
2011
  //#endregion
2012
2012
  //#region node_modules/@colors/colors/lib/maps/rainbow.js
2013
2013
  var require_rainbow = __commonJS({ "node_modules/@colors/colors/lib/maps/rainbow.js"(exports, module) {
2014
- module["exports"] = function(colors$3) {
2014
+ module["exports"] = function(colors$2) {
2015
2015
  var rainbowColors = [
2016
2016
  "red",
2017
2017
  "yellow",
@@ -2019,9 +2019,9 @@ var require_rainbow = __commonJS({ "node_modules/@colors/colors/lib/maps/rainbow
2019
2019
  "blue",
2020
2020
  "magenta"
2021
2021
  ];
2022
- return function(letter, i$1, exploded) {
2022
+ return function(letter, i, exploded) {
2023
2023
  if (letter === " ") return letter;
2024
- else return colors$3[rainbowColors[i$1++ % rainbowColors.length]](letter);
2024
+ else return colors$2[rainbowColors[i++ % rainbowColors.length]](letter);
2025
2025
  };
2026
2026
  };
2027
2027
  } });
@@ -2029,7 +2029,7 @@ var require_rainbow = __commonJS({ "node_modules/@colors/colors/lib/maps/rainbow
2029
2029
  //#endregion
2030
2030
  //#region node_modules/@colors/colors/lib/maps/random.js
2031
2031
  var require_random = __commonJS({ "node_modules/@colors/colors/lib/maps/random.js"(exports, module) {
2032
- module["exports"] = function(colors$3) {
2032
+ module["exports"] = function(colors$2) {
2033
2033
  var available = [
2034
2034
  "underline",
2035
2035
  "inverse",
@@ -2049,8 +2049,8 @@ var require_random = __commonJS({ "node_modules/@colors/colors/lib/maps/random.j
2049
2049
  "brightCyan",
2050
2050
  "brightMagenta"
2051
2051
  ];
2052
- return function(letter, i$1, exploded) {
2053
- return letter === " " ? letter : colors$3[available[Math.round(Math.random() * (available.length - 2))]](letter);
2052
+ return function(letter, i, exploded) {
2053
+ return letter === " " ? letter : colors$2[available[Math.round(Math.random() * (available.length - 2))]](letter);
2054
2054
  };
2055
2055
  };
2056
2056
  } });
@@ -2058,28 +2058,28 @@ var require_random = __commonJS({ "node_modules/@colors/colors/lib/maps/random.j
2058
2058
  //#endregion
2059
2059
  //#region node_modules/@colors/colors/lib/colors.js
2060
2060
  var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(exports, module) {
2061
- var colors$2 = {};
2062
- module["exports"] = colors$2;
2063
- colors$2.themes = {};
2061
+ var colors$1 = {};
2062
+ module["exports"] = colors$1;
2063
+ colors$1.themes = {};
2064
2064
  var util = __require("util");
2065
- var ansiStyles = colors$2.styles = require_styles();
2065
+ var ansiStyles = colors$1.styles = require_styles();
2066
2066
  var defineProps = Object.defineProperties;
2067
2067
  var newLineRegex = new RegExp(/[\r\n]+/g);
2068
- colors$2.supportsColor = require_supports_colors().supportsColor;
2069
- if (typeof colors$2.enabled === "undefined") colors$2.enabled = colors$2.supportsColor() !== false;
2070
- colors$2.enable = function() {
2071
- colors$2.enabled = true;
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;
2072
2072
  };
2073
- colors$2.disable = function() {
2074
- colors$2.enabled = false;
2073
+ colors$1.disable = function() {
2074
+ colors$1.enabled = false;
2075
2075
  };
2076
- colors$2.stripColors = colors$2.strip = function(str) {
2076
+ colors$1.stripColors = colors$1.strip = function(str) {
2077
2077
  return ("" + str).replace(/\x1B\[\d+m/g, "");
2078
2078
  };
2079
- var stylize = colors$2.stylize = function stylize$1(str, style) {
2080
- if (!colors$2.enabled) return str + "";
2079
+ var stylize = colors$1.stylize = function stylize$1(str, style) {
2080
+ if (!colors$1.enabled) return str + "";
2081
2081
  var styleMap = ansiStyles[style];
2082
- if (!styleMap && style in colors$2) return colors$2[style](str);
2082
+ if (!styleMap && style in colors$1) return colors$1[style](str);
2083
2083
  return styleMap.open + str + styleMap.close;
2084
2084
  };
2085
2085
  var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
@@ -2106,19 +2106,19 @@ var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(ex
2106
2106
  });
2107
2107
  return ret;
2108
2108
  }();
2109
- var proto = defineProps(function colors$3() {}, styles);
2109
+ var proto = defineProps(function colors$2() {}, styles);
2110
2110
  function applyStyle() {
2111
2111
  var args = Array.prototype.slice.call(arguments);
2112
2112
  var str = args.map(function(arg) {
2113
2113
  if (arg != null && arg.constructor === String) return arg;
2114
2114
  else return util.inspect(arg);
2115
2115
  }).join(" ");
2116
- if (!colors$2.enabled || !str) return str;
2116
+ if (!colors$1.enabled || !str) return str;
2117
2117
  var newLinesPresent = str.indexOf("\n") != -1;
2118
2118
  var nestedStyles = this._styles;
2119
- var i$1 = nestedStyles.length;
2120
- while (i$1--) {
2121
- var code = ansiStyles[nestedStyles[i$1]];
2119
+ var i = nestedStyles.length;
2120
+ while (i--) {
2121
+ var code = ansiStyles[nestedStyles[i]];
2122
2122
  str = code.open + str.replace(code.closeRe, code.open) + code.close;
2123
2123
  if (newLinesPresent) str = str.replace(newLineRegex, function(match) {
2124
2124
  return code.close + match + code.open;
@@ -2126,23 +2126,23 @@ var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(ex
2126
2126
  }
2127
2127
  return str;
2128
2128
  }
2129
- colors$2.setTheme = function(theme) {
2129
+ colors$1.setTheme = function(theme) {
2130
2130
  if (typeof theme === "string") {
2131
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'));");
2132
2132
  return;
2133
2133
  }
2134
2134
  for (var style in theme) (function(style$1) {
2135
- colors$2[style$1] = function(str) {
2135
+ colors$1[style$1] = function(str) {
2136
2136
  if (typeof theme[style$1] === "object") {
2137
2137
  var out = str;
2138
- for (var i$1 in theme[style$1]) out = colors$2[theme[style$1][i$1]](out);
2138
+ for (var i in theme[style$1]) out = colors$1[theme[style$1][i]](out);
2139
2139
  return out;
2140
2140
  }
2141
- return colors$2[theme[style$1]](str);
2141
+ return colors$1[theme[style$1]](str);
2142
2142
  };
2143
2143
  })(style);
2144
2144
  };
2145
- function init$1() {
2145
+ function init() {
2146
2146
  var ret = {};
2147
2147
  Object.keys(styles).forEach(function(name$1) {
2148
2148
  ret[name$1] = { get: function() {
@@ -2156,26 +2156,26 @@ var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(ex
2156
2156
  exploded = exploded.map(map$1);
2157
2157
  return exploded.join("");
2158
2158
  };
2159
- colors$2.trap = require_trap();
2160
- colors$2.zalgo = require_zalgo();
2161
- colors$2.maps = {};
2162
- colors$2.maps.america = require_america()(colors$2);
2163
- colors$2.maps.zebra = require_zebra()(colors$2);
2164
- colors$2.maps.rainbow = require_rainbow()(colors$2);
2165
- colors$2.maps.random = require_random()(colors$2);
2166
- for (var map in colors$2.maps) (function(map$1) {
2167
- colors$2[map$1] = function(str) {
2168
- return sequencer(colors$2.maps[map$1], str);
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);
2169
2169
  };
2170
2170
  })(map);
2171
- defineProps(colors$2, init$1());
2171
+ defineProps(colors$1, init());
2172
2172
  } });
2173
2173
 
2174
2174
  //#endregion
2175
2175
  //#region node_modules/@colors/colors/safe.js
2176
2176
  var require_safe = __commonJS({ "node_modules/@colors/colors/safe.js"(exports, module) {
2177
- var colors$1 = require_colors();
2178
- module["exports"] = colors$1;
2177
+ var colors = require_colors();
2178
+ module["exports"] = colors;
2179
2179
  } });
2180
2180
 
2181
2181
  //#endregion
@@ -2251,10 +2251,10 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2251
2251
  if (this.fixedWidth && wordWrap$1) {
2252
2252
  this.fixedWidth -= this.paddingLeft + this.paddingRight;
2253
2253
  if (this.colSpan) {
2254
- let i$1 = 1;
2255
- while (i$1 < this.colSpan) {
2256
- this.fixedWidth += tableOptions.colWidths[this.x + i$1];
2257
- i$1++;
2254
+ let i = 1;
2255
+ while (i < this.colSpan) {
2256
+ this.fixedWidth += tableOptions.colWidths[this.x + i];
2257
+ i++;
2258
2258
  }
2259
2259
  }
2260
2260
  const { wrapOnWordBoundary: tableWrapOnWordBoundary = true } = tableOptions;
@@ -2279,13 +2279,13 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2279
2279
  */
2280
2280
  init(tableOptions) {
2281
2281
  let x = this.x;
2282
- let y$1 = this.y;
2282
+ let y = this.y;
2283
2283
  this.widths = tableOptions.colWidths.slice(x, x + this.colSpan);
2284
- this.heights = tableOptions.rowHeights.slice(y$1, y$1 + this.rowSpan);
2284
+ this.heights = tableOptions.rowHeights.slice(y, y + this.rowSpan);
2285
2285
  this.width = this.widths.reduce(sumPlusOne, -1);
2286
2286
  this.height = this.heights.reduce(sumPlusOne, -1);
2287
2287
  this.hAlign = this.options.hAlign || tableOptions.colAligns[x];
2288
- this.vAlign = this.options.vAlign || tableOptions.rowAligns[y$1];
2288
+ this.vAlign = this.options.vAlign || tableOptions.rowAligns[y];
2289
2289
  this.drawRight = x + this.colSpan == tableOptions.colWidths.length;
2290
2290
  }
2291
2291
  /**
@@ -2345,9 +2345,9 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2345
2345
  let spanAbove = this.cells[this.y - 1][x] instanceof Cell$1.ColSpanCell;
2346
2346
  if (spanAbove) leftChar = offset == 0 ? "topMid" : "mid";
2347
2347
  if (offset == 0) {
2348
- let i$1 = 1;
2349
- while (this.cells[this.y][x - i$1] instanceof Cell$1.ColSpanCell) i$1++;
2350
- if (this.cells[this.y][x - i$1] instanceof Cell$1.RowSpanCell) leftChar = "leftMid";
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";
2351
2351
  }
2352
2352
  }
2353
2353
  }
@@ -2355,9 +2355,9 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2355
2355
  }
2356
2356
  wrapWithStyleColors(styleProperty, content) {
2357
2357
  if (this[styleProperty] && this[styleProperty].length) try {
2358
- let colors$3 = require_safe();
2359
- for (let i$1 = this[styleProperty].length - 1; i$1 >= 0; i$1--) colors$3 = colors$3[this[styleProperty][i$1]];
2360
- return colors$3(content);
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);
2361
2361
  } catch (e) {
2362
2362
  return content;
2363
2363
  }
@@ -2452,9 +2452,9 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2452
2452
  this.originalCell = originalCell;
2453
2453
  }
2454
2454
  init(tableOptions) {
2455
- let y$1 = this.y;
2455
+ let y = this.y;
2456
2456
  let originalY = this.originalCell.y;
2457
- this.cellOffset = y$1 - originalY;
2457
+ this.cellOffset = y - originalY;
2458
2458
  this.offset = findDimension(tableOptions.rowHeights, originalY, this.cellOffset);
2459
2459
  }
2460
2460
  draw(lineNum) {
@@ -2478,11 +2478,11 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2478
2478
  }
2479
2479
  function findDimension(dimensionTable, startingIndex, span) {
2480
2480
  let ret = dimensionTable[startingIndex];
2481
- for (let i$1 = 1; i$1 < span; i$1++) ret += 1 + dimensionTable[startingIndex + i$1];
2481
+ for (let i = 1; i < span; i++) ret += 1 + dimensionTable[startingIndex + i];
2482
2482
  return ret;
2483
2483
  }
2484
- function sumPlusOne(a$1, b$1) {
2485
- return a$1 + b$1 + 1;
2484
+ function sumPlusOne(a, b) {
2485
+ return a + b + 1;
2486
2486
  }
2487
2487
  let CHAR_NAMES = [
2488
2488
  "top",
@@ -2560,31 +2560,31 @@ var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-ma
2560
2560
  let xConflict = !(xMin1 > xMax2 || xMin2 > xMax1);
2561
2561
  return yConflict && xConflict;
2562
2562
  }
2563
- function conflictExists(rows, x, y$1) {
2564
- let i_max = Math.min(rows.length - 1, y$1);
2563
+ function conflictExists(rows, x, y) {
2564
+ let i_max = Math.min(rows.length - 1, y);
2565
2565
  let cell = {
2566
2566
  x,
2567
- y: y$1
2567
+ y
2568
2568
  };
2569
- for (let i$1 = 0; i$1 <= i_max; i$1++) {
2570
- let row = rows[i$1];
2569
+ for (let i = 0; i <= i_max; i++) {
2570
+ let row = rows[i];
2571
2571
  for (let j = 0; j < row.length; j++) if (cellsConflict(cell, row[j])) return true;
2572
2572
  }
2573
2573
  return false;
2574
2574
  }
2575
- function allBlank(rows, y$1, xMin, xMax) {
2576
- for (let x = xMin; x < xMax; x++) if (conflictExists(rows, x, y$1)) return false;
2575
+ function allBlank(rows, y, xMin, xMax) {
2576
+ for (let x = xMin; x < xMax; x++) if (conflictExists(rows, x, y)) return false;
2577
2577
  return true;
2578
2578
  }
2579
2579
  function addRowSpanCells(table) {
2580
2580
  table.forEach(function(row, rowIndex) {
2581
2581
  row.forEach(function(cell) {
2582
- for (let i$1 = 1; i$1 < cell.rowSpan; i$1++) {
2582
+ for (let i = 1; i < cell.rowSpan; i++) {
2583
2583
  let rowSpanCell = new RowSpanCell(cell);
2584
2584
  rowSpanCell.x = cell.x;
2585
- rowSpanCell.y = cell.y + i$1;
2585
+ rowSpanCell.y = cell.y + i;
2586
2586
  rowSpanCell.colSpan = cell.colSpan;
2587
- insertCell(rowSpanCell, table[rowIndex + i$1]);
2587
+ insertCell(rowSpanCell, table[rowIndex + i]);
2588
2588
  }
2589
2589
  });
2590
2590
  });
@@ -2612,19 +2612,19 @@ var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-ma
2612
2612
  let h_max = maxHeight(table);
2613
2613
  let w_max = maxWidth(table);
2614
2614
  debug$1(`Max rows: ${h_max}; Max cols: ${w_max}`);
2615
- for (let y$1 = 0; y$1 < h_max; y$1++) for (let x = 0; x < w_max; x++) if (!conflictExists(table, x, y$1)) {
2615
+ for (let y = 0; y < h_max; y++) for (let x = 0; x < w_max; x++) if (!conflictExists(table, x, y)) {
2616
2616
  let opts = {
2617
2617
  x,
2618
- y: y$1,
2618
+ y,
2619
2619
  colSpan: 1,
2620
2620
  rowSpan: 1
2621
2621
  };
2622
2622
  x++;
2623
- while (x < w_max && !conflictExists(table, x, y$1)) {
2623
+ while (x < w_max && !conflictExists(table, x, y)) {
2624
2624
  opts.colSpan++;
2625
2625
  x++;
2626
2626
  }
2627
- let y2 = y$1 + 1;
2627
+ let y2 = y + 1;
2628
2628
  while (y2 < h_max && allBlank(table, y2, opts.x, opts.x + opts.colSpan)) {
2629
2629
  opts.rowSpan++;
2630
2630
  y2++;
@@ -2633,7 +2633,7 @@ var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-ma
2633
2633
  cell.x = opts.x;
2634
2634
  cell.y = opts.y;
2635
2635
  warn(`Missing cell at ${cell.y}-${cell.x}.`);
2636
- insertCell(cell, table[y$1]);
2636
+ insertCell(cell, table[y]);
2637
2637
  }
2638
2638
  }
2639
2639
  function generateCells(rows) {
@@ -2689,24 +2689,24 @@ var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-ma
2689
2689
  let col = cell[x];
2690
2690
  let existingWidth = result[col];
2691
2691
  let editableCols = typeof vals[col] === "number" ? 0 : 1;
2692
- if (typeof existingWidth === "number") for (let i$1 = 1; i$1 < span; i$1++) {
2693
- existingWidth += 1 + result[col + i$1];
2694
- if (typeof vals[col + i$1] !== "number") editableCols++;
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++;
2695
2695
  }
2696
2696
  else {
2697
2697
  existingWidth = desiredWidth === "desiredWidth" ? cell.desiredWidth - 1 : 1;
2698
2698
  if (!auto[col] || auto[col] < existingWidth) auto[col] = existingWidth;
2699
2699
  }
2700
2700
  if (cell[desiredWidth] > existingWidth) {
2701
- let i$1 = 0;
2701
+ let i = 0;
2702
2702
  while (editableCols > 0 && cell[desiredWidth] > existingWidth) {
2703
- if (typeof vals[col + i$1] !== "number") {
2703
+ if (typeof vals[col + i] !== "number") {
2704
2704
  let dif = Math.round((cell[desiredWidth] - existingWidth) / editableCols);
2705
2705
  existingWidth += dif;
2706
- result[col + i$1] += dif;
2706
+ result[col + i] += dif;
2707
2707
  editableCols--;
2708
2708
  }
2709
- i$1++;
2709
+ i++;
2710
2710
  }
2711
2711
  }
2712
2712
  }
@@ -2806,13 +2806,13 @@ var require_cli_table3 = __commonJS({ "node_modules/cli-table3/index.js"(exports
2806
2806
  //#endregion
2807
2807
  //#region node_modules/picocolors/picocolors.js
2808
2808
  var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(exports, module) {
2809
- let p = process || {}, argv$1 = p.argv || [], env$1 = p.env || {};
2810
- let isColorSupported$1 = !(!!env$1.NO_COLOR || argv$1.includes("--no-color")) && (!!env$1.FORCE_COLOR || argv$1.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env$1.TERM !== "dumb" || !!env$1.CI);
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);
2811
2811
  let formatter = (open, close, replace = open) => (input) => {
2812
2812
  let string$1 = "" + input, index = string$1.indexOf(close, open.length);
2813
- return ~index ? open + replaceClose$1(string$1, close, replace, index) + close : open + string$1 + close;
2813
+ return ~index ? open + replaceClose(string$1, close, replace, index) + close : open + string$1 + close;
2814
2814
  };
2815
- let replaceClose$1 = (string$1, close, replace, index) => {
2815
+ let replaceClose = (string$1, close, replace, index) => {
2816
2816
  let result = "", cursor = 0;
2817
2817
  do {
2818
2818
  result += string$1.substring(cursor, index) + replace;
@@ -2821,1027 +2821,189 @@ var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(ex
2821
2821
  } while (~index);
2822
2822
  return result + string$1.substring(cursor);
2823
2823
  };
2824
- let createColors$1 = (enabled = isColorSupported$1) => {
2825
- let f$1 = enabled ? formatter : () => String;
2824
+ let createColors = (enabled = isColorSupported) => {
2825
+ let f = enabled ? formatter : () => String;
2826
2826
  return {
2827
2827
  isColorSupported: enabled,
2828
- reset: f$1("\x1B[0m", "\x1B[0m"),
2829
- bold: f$1("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
2830
- dim: f$1("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
2831
- italic: f$1("\x1B[3m", "\x1B[23m"),
2832
- underline: f$1("\x1B[4m", "\x1B[24m"),
2833
- inverse: f$1("\x1B[7m", "\x1B[27m"),
2834
- hidden: f$1("\x1B[8m", "\x1B[28m"),
2835
- strikethrough: f$1("\x1B[9m", "\x1B[29m"),
2836
- black: f$1("\x1B[30m", "\x1B[39m"),
2837
- red: f$1("\x1B[31m", "\x1B[39m"),
2838
- green: f$1("\x1B[32m", "\x1B[39m"),
2839
- yellow: f$1("\x1B[33m", "\x1B[39m"),
2840
- blue: f$1("\x1B[34m", "\x1B[39m"),
2841
- magenta: f$1("\x1B[35m", "\x1B[39m"),
2842
- cyan: f$1("\x1B[36m", "\x1B[39m"),
2843
- white: f$1("\x1B[37m", "\x1B[39m"),
2844
- gray: f$1("\x1B[90m", "\x1B[39m"),
2845
- bgBlack: f$1("\x1B[40m", "\x1B[49m"),
2846
- bgRed: f$1("\x1B[41m", "\x1B[49m"),
2847
- bgGreen: f$1("\x1B[42m", "\x1B[49m"),
2848
- bgYellow: f$1("\x1B[43m", "\x1B[49m"),
2849
- bgBlue: f$1("\x1B[44m", "\x1B[49m"),
2850
- bgMagenta: f$1("\x1B[45m", "\x1B[49m"),
2851
- bgCyan: f$1("\x1B[46m", "\x1B[49m"),
2852
- bgWhite: f$1("\x1B[47m", "\x1B[49m"),
2853
- blackBright: f$1("\x1B[90m", "\x1B[39m"),
2854
- redBright: f$1("\x1B[91m", "\x1B[39m"),
2855
- greenBright: f$1("\x1B[92m", "\x1B[39m"),
2856
- yellowBright: f$1("\x1B[93m", "\x1B[39m"),
2857
- blueBright: f$1("\x1B[94m", "\x1B[39m"),
2858
- magentaBright: f$1("\x1B[95m", "\x1B[39m"),
2859
- cyanBright: f$1("\x1B[96m", "\x1B[39m"),
2860
- whiteBright: f$1("\x1B[97m", "\x1B[39m"),
2861
- bgBlackBright: f$1("\x1B[100m", "\x1B[49m"),
2862
- bgRedBright: f$1("\x1B[101m", "\x1B[49m"),
2863
- bgGreenBright: f$1("\x1B[102m", "\x1B[49m"),
2864
- bgYellowBright: f$1("\x1B[103m", "\x1B[49m"),
2865
- bgBlueBright: f$1("\x1B[104m", "\x1B[49m"),
2866
- bgMagentaBright: f$1("\x1B[105m", "\x1B[49m"),
2867
- bgCyanBright: f$1("\x1B[106m", "\x1B[49m"),
2868
- bgWhiteBright: f$1("\x1B[107m", "\x1B[49m")
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")
2869
2869
  };
2870
2870
  };
2871
- module.exports = createColors$1();
2872
- module.exports.createColors = createColors$1;
2871
+ module.exports = createColors();
2872
+ module.exports.createColors = createColors;
2873
2873
  } });
2874
2874
 
2875
2875
  //#endregion
2876
- //#region node_modules/consola/dist/core.mjs
2877
- const LogLevels = {
2878
- silent: Number.NEGATIVE_INFINITY,
2879
- fatal: 0,
2880
- error: 0,
2881
- warn: 1,
2882
- log: 2,
2883
- info: 3,
2884
- success: 3,
2885
- fail: 3,
2886
- ready: 3,
2887
- start: 3,
2888
- box: 3,
2889
- debug: 4,
2890
- trace: 5,
2891
- verbose: Number.POSITIVE_INFINITY
2892
- };
2893
- const LogTypes = {
2894
- silent: { level: -1 },
2895
- fatal: { level: LogLevels.fatal },
2896
- error: { level: LogLevels.error },
2897
- warn: { level: LogLevels.warn },
2898
- log: { level: LogLevels.log },
2899
- info: { level: LogLevels.info },
2900
- success: { level: LogLevels.success },
2901
- fail: { level: LogLevels.fail },
2902
- ready: { level: LogLevels.info },
2903
- start: { level: LogLevels.info },
2904
- box: { level: LogLevels.info },
2905
- debug: { level: LogLevels.debug },
2906
- trace: { level: LogLevels.trace },
2907
- verbose: { level: LogLevels.verbose }
2908
- };
2909
- function isPlainObject$1(value) {
2910
- if (value === null || typeof value !== "object") return false;
2911
- const prototype = Object.getPrototypeOf(value);
2912
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
2913
- if (Symbol.iterator in value) return false;
2914
- if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
2915
- return true;
2916
- }
2917
- function _defu(baseObject, defaults, namespace = ".", merger) {
2918
- if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
2919
- const object$1 = Object.assign({}, defaults);
2920
- for (const key in baseObject) {
2921
- if (key === "__proto__" || key === "constructor") continue;
2922
- const value = baseObject[key];
2923
- if (value === null || value === void 0) continue;
2924
- if (merger && merger(object$1, key, value, namespace)) continue;
2925
- if (Array.isArray(value) && Array.isArray(object$1[key])) object$1[key] = [...value, ...object$1[key]];
2926
- else if (isPlainObject$1(value) && isPlainObject$1(object$1[key])) object$1[key] = _defu(value, object$1[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
2927
- else object$1[key] = value;
2928
- }
2929
- return object$1;
2930
- }
2931
- function createDefu(merger) {
2932
- return (...arguments_) => arguments_.reduce((p$1, c$1) => _defu(p$1, c$1, "", merger), {});
2933
- }
2934
- const defu = createDefu();
2935
- function isPlainObject(obj) {
2936
- return Object.prototype.toString.call(obj) === "[object Object]";
2937
- }
2938
- function isLogObj(arg) {
2939
- if (!isPlainObject(arg)) return false;
2940
- if (!arg.message && !arg.args) return false;
2941
- if (arg.stack) return false;
2942
- return true;
2943
- }
2944
- let paused = false;
2945
- const queue = [];
2946
- var Consola = class Consola {
2947
- options;
2948
- _lastLog;
2949
- _mockFn;
2950
- /**
2951
- * Creates an instance of Consola with specified options or defaults.
2952
- *
2953
- * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
2954
- */
2955
- constructor(options = {}) {
2956
- const types = options.types || LogTypes;
2957
- this.options = defu({
2958
- ...options,
2959
- defaults: { ...options.defaults },
2960
- level: _normalizeLogLevel(options.level, types),
2961
- reporters: [...options.reporters || []]
2962
- }, {
2963
- types: LogTypes,
2964
- throttle: 1e3,
2965
- throttleMin: 5,
2966
- formatOptions: {
2967
- date: true,
2968
- colors: false,
2969
- compact: true
2970
- }
2971
- });
2972
- for (const type in types) {
2973
- const defaults = {
2974
- type,
2975
- ...this.options.defaults,
2976
- ...types[type]
2977
- };
2978
- this[type] = this._wrapLogFn(defaults);
2979
- this[type].raw = this._wrapLogFn(defaults, true);
2980
- }
2981
- if (this.options.mockFn) this.mockTypes();
2982
- this._lastLog = {};
2983
- }
2984
- /**
2985
- * Gets the current log level of the Consola instance.
2986
- *
2987
- * @returns {number} The current log level.
2988
- */
2989
- get level() {
2990
- return this.options.level;
2991
- }
2992
- /**
2993
- * Sets the minimum log level that will be output by the instance.
2994
- *
2995
- * @param {number} level - The new log level to set.
2996
- */
2997
- set level(level$1) {
2998
- this.options.level = _normalizeLogLevel(level$1, this.options.types, this.options.level);
2999
- }
3000
- /**
3001
- * Displays a prompt to the user and returns the response.
3002
- * Throw an error if `prompt` is not supported by the current configuration.
3003
- *
3004
- * @template T
3005
- * @param {string} message - The message to display in the prompt.
3006
- * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
3007
- * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
3008
- */
3009
- prompt(message, opts) {
3010
- if (!this.options.prompt) throw new Error("prompt is not supported!");
3011
- return this.options.prompt(message, opts);
3012
- }
3013
- /**
3014
- * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
3015
- *
3016
- * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
3017
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
3018
- */
3019
- create(options) {
3020
- const instance = new Consola({
3021
- ...this.options,
3022
- ...options
3023
- });
3024
- if (this._mockFn) instance.mockTypes(this._mockFn);
3025
- return instance;
3026
- }
3027
- /**
3028
- * Creates a new Consola instance with the specified default log object properties.
3029
- *
3030
- * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
3031
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
3032
- */
3033
- withDefaults(defaults) {
3034
- return this.create({
3035
- ...this.options,
3036
- defaults: {
3037
- ...this.options.defaults,
3038
- ...defaults
3039
- }
3040
- });
3041
- }
3042
- /**
3043
- * Creates a new Consola instance with a specified tag, which will be included in every log.
3044
- *
3045
- * @param {string} tag - The tag to include in each log of the new instance.
3046
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
3047
- */
3048
- withTag(tag) {
3049
- return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
3050
- }
3051
- /**
3052
- * Adds a custom reporter to the Consola instance.
3053
- * Reporters will be called for each log message, depending on their implementation and log level.
3054
- *
3055
- * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
3056
- * @returns {Consola} The current Consola instance.
3057
- */
3058
- addReporter(reporter) {
3059
- this.options.reporters.push(reporter);
3060
- return this;
3061
- }
3062
- /**
3063
- * Removes a custom reporter from the Consola instance.
3064
- * If no reporter is specified, all reporters will be removed.
3065
- *
3066
- * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
3067
- * @returns {Consola} The current Consola instance.
3068
- */
3069
- removeReporter(reporter) {
3070
- if (reporter) {
3071
- const i$1 = this.options.reporters.indexOf(reporter);
3072
- if (i$1 !== -1) return this.options.reporters.splice(i$1, 1);
3073
- } else this.options.reporters.splice(0);
3074
- return this;
3075
- }
3076
- /**
3077
- * Replaces all reporters of the Consola instance with the specified array of reporters.
3078
- *
3079
- * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
3080
- * @returns {Consola} The current Consola instance.
3081
- */
3082
- setReporters(reporters) {
3083
- this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
3084
- return this;
3085
- }
3086
- wrapAll() {
3087
- this.wrapConsole();
3088
- this.wrapStd();
3089
- }
3090
- restoreAll() {
3091
- this.restoreConsole();
3092
- this.restoreStd();
3093
- }
3094
- /**
3095
- * Overrides console methods with Consola logging methods for consistent logging.
3096
- */
3097
- wrapConsole() {
3098
- for (const type in this.options.types) {
3099
- if (!console["__" + type]) console["__" + type] = console[type];
3100
- console[type] = this[type].raw;
3101
- }
3102
- }
3103
- /**
3104
- * Restores the original console methods, removing Consola overrides.
3105
- */
3106
- restoreConsole() {
3107
- for (const type in this.options.types) if (console["__" + type]) {
3108
- console[type] = console["__" + type];
3109
- delete console["__" + type];
3110
- }
3111
- }
3112
- /**
3113
- * Overrides standard output and error streams to redirect them through Consola.
3114
- */
3115
- wrapStd() {
3116
- this._wrapStream(this.options.stdout, "log");
3117
- this._wrapStream(this.options.stderr, "log");
3118
- }
3119
- _wrapStream(stream, type) {
3120
- if (!stream) return;
3121
- if (!stream.__write) stream.__write = stream.write;
3122
- stream.write = (data) => {
3123
- this[type].raw(String(data).trim());
3124
- };
3125
- }
3126
- /**
3127
- * Restores the original standard output and error streams, removing the Consola redirection.
3128
- */
3129
- restoreStd() {
3130
- this._restoreStream(this.options.stdout);
3131
- this._restoreStream(this.options.stderr);
3132
- }
3133
- _restoreStream(stream) {
3134
- if (!stream) return;
3135
- if (stream.__write) {
3136
- stream.write = stream.__write;
3137
- delete stream.__write;
3138
- }
3139
- }
3140
- /**
3141
- * Pauses logging, queues incoming logs until resumed.
3142
- */
3143
- pauseLogs() {
3144
- paused = true;
3145
- }
3146
- /**
3147
- * Resumes logging, processing any queued logs.
3148
- */
3149
- resumeLogs() {
3150
- paused = false;
3151
- const _queue = queue.splice(0);
3152
- for (const item of _queue) item[0]._logFn(item[1], item[2]);
3153
- }
3154
- /**
3155
- * Replaces logging methods with mocks if a mock function is provided.
3156
- *
3157
- * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
3158
- */
3159
- mockTypes(mockFn) {
3160
- const _mockFn = mockFn || this.options.mockFn;
3161
- this._mockFn = _mockFn;
3162
- if (typeof _mockFn !== "function") return;
3163
- for (const type in this.options.types) {
3164
- this[type] = _mockFn(type, this.options.types[type]) || this[type];
3165
- this[type].raw = this[type];
3166
- }
3167
- }
3168
- _wrapLogFn(defaults, isRaw) {
3169
- return (...args) => {
3170
- if (paused) {
3171
- queue.push([
3172
- this,
3173
- defaults,
3174
- args,
3175
- isRaw
3176
- ]);
3177
- return;
3178
- }
3179
- return this._logFn(defaults, args, isRaw);
3180
- };
3181
- }
3182
- _logFn(defaults, args, isRaw) {
3183
- if ((defaults.level || 0) > this.level) return false;
3184
- const logObj = {
3185
- date: /* @__PURE__ */ new Date(),
3186
- args: [],
3187
- ...defaults,
3188
- level: _normalizeLogLevel(defaults.level, this.options.types)
3189
- };
3190
- if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
3191
- else logObj.args = [...args];
3192
- if (logObj.message) {
3193
- logObj.args.unshift(logObj.message);
3194
- delete logObj.message;
3195
- }
3196
- if (logObj.additional) {
3197
- if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
3198
- logObj.args.push("\n" + logObj.additional.join("\n"));
3199
- delete logObj.additional;
3200
- }
3201
- logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
3202
- logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
3203
- const resolveLog = (newLog = false) => {
3204
- const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
3205
- if (this._lastLog.object && repeated > 0) {
3206
- const args2 = [...this._lastLog.object.args];
3207
- if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
3208
- this._log({
3209
- ...this._lastLog.object,
3210
- args: args2
3211
- });
3212
- this._lastLog.count = 1;
3213
- }
3214
- if (newLog) {
3215
- this._lastLog.object = logObj;
3216
- this._log(logObj);
3217
- }
3218
- };
3219
- clearTimeout(this._lastLog.timeout);
3220
- const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
3221
- this._lastLog.time = logObj.date;
3222
- if (diffTime < this.options.throttle) try {
3223
- const serializedLog = JSON.stringify([
3224
- logObj.type,
3225
- logObj.tag,
3226
- logObj.args
3227
- ]);
3228
- const isSameLog = this._lastLog.serialized === serializedLog;
3229
- this._lastLog.serialized = serializedLog;
3230
- if (isSameLog) {
3231
- this._lastLog.count = (this._lastLog.count || 0) + 1;
3232
- if (this._lastLog.count > this.options.throttleMin) {
3233
- this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
3234
- 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);
3235
2950
  }
3236
2951
  }
3237
- } catch {}
3238
- resolveLog(true);
3239
- }
3240
- _log(logObj) {
3241
- for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
3242
- }
3243
- };
3244
- function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
3245
- if (input === void 0) return defaultLevel;
3246
- if (typeof input === "number") return input;
3247
- if (types[input] && types[input].level !== void 0) return types[input].level;
3248
- return defaultLevel;
3249
- }
3250
- Consola.prototype.add = Consola.prototype.addReporter;
3251
- Consola.prototype.remove = Consola.prototype.removeReporter;
3252
- Consola.prototype.clear = Consola.prototype.removeReporter;
3253
- Consola.prototype.withScope = Consola.prototype.withTag;
3254
- Consola.prototype.mock = Consola.prototype.mockTypes;
3255
- Consola.prototype.pause = Consola.prototype.pauseLogs;
3256
- Consola.prototype.resume = Consola.prototype.resumeLogs;
3257
- function createConsola$1(options = {}) {
3258
- return new Consola(options);
3259
- }
3260
-
3261
- //#endregion
3262
- //#region node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
3263
- function parseStack(stack, message) {
3264
- const cwd = process.cwd() + sep;
3265
- const lines = stack.split("\n").splice(message.split("\n").length).map((l$1) => l$1.trim().replace("file://", "").replace(cwd, ""));
3266
- return lines;
3267
- }
3268
- function writeStream(data, stream) {
3269
- const write = stream.__write || stream.write;
3270
- return write.call(stream, data);
3271
- }
3272
- const bracket = (x) => x ? `[${x}]` : "";
3273
- var BasicReporter = class {
3274
- formatStack(stack, message, opts) {
3275
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
3276
- return indent + parseStack(stack, message).join(`
3277
- ${indent}`);
3278
- }
3279
- formatError(err, opts) {
3280
- const message = err.message ?? formatWithOptions(opts, err);
3281
- const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
3282
- const level$1 = opts?.errorLevel || 0;
3283
- const causedPrefix = level$1 > 0 ? `${" ".repeat(level$1)}[cause]: ` : "";
3284
- const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
3285
- ...opts,
3286
- errorLevel: level$1 + 1
3287
- }) : "";
3288
- return causedPrefix + message + "\n" + stack + causedError;
3289
- }
3290
- formatArgs(args, opts) {
3291
- const _args = args.map((arg) => {
3292
- if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
3293
- return arg;
3294
- });
3295
- return formatWithOptions(opts, ..._args);
3296
- }
3297
- formatDate(date, opts) {
3298
- return opts.date ? date.toLocaleTimeString() : "";
3299
- }
3300
- filterAndJoin(arr) {
3301
- return arr.filter(Boolean).join(" ");
3302
- }
3303
- formatLogObj(logObj, opts) {
3304
- const message = this.formatArgs(logObj.args, opts);
3305
- if (logObj.type === "box") return "\n" + [
3306
- bracket(logObj.tag),
3307
- logObj.title && logObj.title,
3308
- ...message.split("\n")
3309
- ].filter(Boolean).map((l$1) => " > " + l$1).join("\n") + "\n";
3310
- return this.filterAndJoin([
3311
- bracket(logObj.type),
3312
- bracket(logObj.tag),
3313
- message
3314
- ]);
3315
- }
3316
- log(logObj, ctx) {
3317
- const line = this.formatLogObj(logObj, {
3318
- columns: ctx.options.stdout.columns || 0,
3319
- ...ctx.options.formatOptions
3320
- });
3321
- return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
3322
- }
3323
- };
3324
-
3325
- //#endregion
3326
- //#region node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
3327
- const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
3328
- const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
3329
- const isForced = "FORCE_COLOR" in env || argv.includes("--color");
3330
- const isWindows = platform === "win32";
3331
- const isDumbTerminal = env.TERM === "dumb";
3332
- const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
3333
- const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
3334
- const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
3335
- function replaceClose(index, string$1, close, replace, head = string$1.slice(0, Math.max(0, index)) + replace, tail = string$1.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
3336
- return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
3337
- }
3338
- function clearBleed(index, string$1, open, close, replace) {
3339
- return index < 0 ? open + string$1 + close : open + replaceClose(index, string$1, close, replace) + close;
3340
- }
3341
- function filterEmpty(open, close, replace = open, at = open.length + 1) {
3342
- return (string$1) => string$1 || !(string$1 === "" || string$1 === void 0) ? clearBleed(("" + string$1).indexOf(close, at), string$1, open, close, replace) : "";
3343
- }
3344
- function init(open, close, replace) {
3345
- return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
3346
- }
3347
- const colorDefs = {
3348
- reset: init(0, 0),
3349
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
3350
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
3351
- italic: init(3, 23),
3352
- underline: init(4, 24),
3353
- inverse: init(7, 27),
3354
- hidden: init(8, 28),
3355
- strikethrough: init(9, 29),
3356
- black: init(30, 39),
3357
- red: init(31, 39),
3358
- green: init(32, 39),
3359
- yellow: init(33, 39),
3360
- blue: init(34, 39),
3361
- magenta: init(35, 39),
3362
- cyan: init(36, 39),
3363
- white: init(37, 39),
3364
- gray: init(90, 39),
3365
- bgBlack: init(40, 49),
3366
- bgRed: init(41, 49),
3367
- bgGreen: init(42, 49),
3368
- bgYellow: init(43, 49),
3369
- bgBlue: init(44, 49),
3370
- bgMagenta: init(45, 49),
3371
- bgCyan: init(46, 49),
3372
- bgWhite: init(47, 49),
3373
- blackBright: init(90, 39),
3374
- redBright: init(91, 39),
3375
- greenBright: init(92, 39),
3376
- yellowBright: init(93, 39),
3377
- blueBright: init(94, 39),
3378
- magentaBright: init(95, 39),
3379
- cyanBright: init(96, 39),
3380
- whiteBright: init(97, 39),
3381
- bgBlackBright: init(100, 49),
3382
- bgRedBright: init(101, 49),
3383
- bgGreenBright: init(102, 49),
3384
- bgYellowBright: init(103, 49),
3385
- bgBlueBright: init(104, 49),
3386
- bgMagentaBright: init(105, 49),
3387
- bgCyanBright: init(106, 49),
3388
- bgWhiteBright: init(107, 49)
3389
- };
3390
- function createColors(useColor = isColorSupported) {
3391
- return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
3392
- }
3393
- const colors = createColors();
3394
- function getColor$1(color, fallback = "reset") {
3395
- return colors[color] || colors[fallback];
3396
- }
3397
- 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("|");
3398
- function stripAnsi$1(text) {
3399
- return text.replace(new RegExp(ansiRegex$1, "g"), "");
3400
- }
3401
- const boxStylePresets = {
3402
- solid: {
3403
- tl: "┌",
3404
- tr: "┐",
3405
- bl: "└",
3406
- br: "┘",
3407
- h: "─",
3408
- v: "│"
3409
- },
3410
- double: {
3411
- tl: "╔",
3412
- tr: "╗",
3413
- bl: "╚",
3414
- br: "╝",
3415
- h: "═",
3416
- v: "║"
3417
- },
3418
- doubleSingle: {
3419
- tl: "╓",
3420
- tr: "╖",
3421
- bl: "╙",
3422
- br: "╜",
3423
- h: "─",
3424
- v: "║"
3425
- },
3426
- doubleSingleRounded: {
3427
- tl: "╭",
3428
- tr: "╮",
3429
- bl: "╰",
3430
- br: "╯",
3431
- h: "─",
3432
- v: "║"
3433
- },
3434
- singleThick: {
3435
- tl: "┏",
3436
- tr: "┓",
3437
- bl: "┗",
3438
- br: "┛",
3439
- h: "━",
3440
- v: "┃"
3441
- },
3442
- singleDouble: {
3443
- tl: "╒",
3444
- tr: "╕",
3445
- bl: "╘",
3446
- br: "╛",
3447
- h: "═",
3448
- v: "│"
3449
- },
3450
- singleDoubleRounded: {
3451
- tl: "╭",
3452
- tr: "╮",
3453
- bl: "╰",
3454
- br: "╯",
3455
- h: "═",
3456
- v: "│"
3457
- },
3458
- rounded: {
3459
- tl: "╭",
3460
- tr: "╮",
3461
- bl: "╰",
3462
- br: "╯",
3463
- h: "─",
3464
- v: "│"
3465
- }
3466
- };
3467
- const defaultStyle = {
3468
- borderColor: "white",
3469
- borderStyle: "rounded",
3470
- valign: "center",
3471
- padding: 2,
3472
- marginLeft: 1,
3473
- marginTop: 1,
3474
- marginBottom: 1
3475
- };
3476
- function box(text, _opts = {}) {
3477
- const opts = {
3478
- ..._opts,
3479
- style: {
3480
- ...defaultStyle,
3481
- ..._opts.style
3482
- }
3483
- };
3484
- const textLines = text.split("\n");
3485
- const boxLines = [];
3486
- const _color = getColor$1(opts.style.borderColor);
3487
- const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
3488
- if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
3489
- const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
3490
- const height = textLines.length + paddingOffset;
3491
- const width = Math.max(...textLines.map((line) => stripAnsi$1(line).length), opts.title ? stripAnsi$1(opts.title).length : 0) + paddingOffset;
3492
- const widthOffset = width + paddingOffset;
3493
- const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
3494
- if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
3495
- if (opts.title) {
3496
- const title = _color ? _color(opts.title) : opts.title;
3497
- const left = borderStyle.h.repeat(Math.floor((width - stripAnsi$1(opts.title).length) / 2));
3498
- const right = borderStyle.h.repeat(width - stripAnsi$1(opts.title).length - stripAnsi$1(left).length + paddingOffset);
3499
- boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
3500
- } else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
3501
- const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
3502
- 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}`);
3503
- else {
3504
- const line = textLines[i$1 - valignOffset];
3505
- const left = " ".repeat(paddingOffset);
3506
- const right = " ".repeat(width - stripAnsi$1(line).length);
3507
- boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
3508
- }
3509
- boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
3510
- if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
3511
- return boxLines.join("\n");
3512
- }
3513
-
3514
- //#endregion
3515
- //#region node_modules/consola/dist/index.mjs
3516
- 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, {
3517
- get(e, s$1) {
3518
- return i()[s$1] ?? r[s$1];
3519
- },
3520
- has(e, s$1) {
3521
- const E = i();
3522
- return s$1 in E || s$1 in r;
3523
- },
3524
- set(e, s$1, E) {
3525
- const B = i(true);
3526
- return B[s$1] = E, true;
3527
- },
3528
- deleteProperty(e, s$1) {
3529
- if (!s$1) return false;
3530
- const E = i(true);
3531
- return delete E[s$1], true;
3532
- },
3533
- ownKeys() {
3534
- const e = i(true);
3535
- return Object.keys(e);
3536
- }
3537
- }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
3538
- ["APPVEYOR"],
3539
- [
3540
- "AWS_AMPLIFY",
3541
- "AWS_APP_ID",
3542
- { ci: true }
3543
- ],
3544
- ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
3545
- ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
3546
- ["APPCIRCLE", "AC_APPCIRCLE"],
3547
- ["BAMBOO", "bamboo_planKey"],
3548
- ["BITBUCKET", "BITBUCKET_COMMIT"],
3549
- ["BITRISE", "BITRISE_IO"],
3550
- ["BUDDY", "BUDDY_WORKSPACE_ID"],
3551
- ["BUILDKITE"],
3552
- ["CIRCLE", "CIRCLECI"],
3553
- ["CIRRUS", "CIRRUS_CI"],
3554
- [
3555
- "CLOUDFLARE_PAGES",
3556
- "CF_PAGES",
3557
- { ci: true }
3558
- ],
3559
- ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
3560
- ["CODEFRESH", "CF_BUILD_ID"],
3561
- ["DRONE"],
3562
- ["DRONE", "DRONE_BUILD_EVENT"],
3563
- ["DSARI"],
3564
- ["GITHUB_ACTIONS"],
3565
- ["GITLAB", "GITLAB_CI"],
3566
- ["GITLAB", "CI_MERGE_REQUEST_ID"],
3567
- ["GOCD", "GO_PIPELINE_LABEL"],
3568
- ["LAYERCI"],
3569
- ["HUDSON", "HUDSON_URL"],
3570
- ["JENKINS", "JENKINS_URL"],
3571
- ["MAGNUM"],
3572
- ["NETLIFY"],
3573
- [
3574
- "NETLIFY",
3575
- "NETLIFY_LOCAL",
3576
- { ci: false }
3577
- ],
3578
- ["NEVERCODE"],
3579
- ["RENDER"],
3580
- ["SAIL", "SAILCI"],
3581
- ["SEMAPHORE"],
3582
- ["SCREWDRIVER"],
3583
- ["SHIPPABLE"],
3584
- ["SOLANO", "TDDIUM"],
3585
- ["STRIDER"],
3586
- ["TEAMCITY", "TEAMCITY_VERSION"],
3587
- ["TRAVIS"],
3588
- ["VERCEL", "NOW_BUILDER"],
3589
- [
3590
- "VERCEL",
3591
- "VERCEL",
3592
- { ci: false }
3593
- ],
3594
- [
3595
- "VERCEL",
3596
- "VERCEL_ENV",
3597
- { ci: false }
3598
- ],
3599
- ["APPCENTER", "APPCENTER_BUILD_ID"],
3600
- [
3601
- "CODESANDBOX",
3602
- "CODESANDBOX_SSE",
3603
- { ci: false }
3604
- ],
3605
- [
3606
- "CODESANDBOX",
3607
- "CODESANDBOX_HOST",
3608
- { ci: false }
3609
- ],
3610
- ["STACKBLITZ"],
3611
- ["STORMKIT"],
3612
- ["CLEAVR"],
3613
- ["ZEABUR"],
3614
- [
3615
- "CODESPHERE",
3616
- "CODESPHERE_APP_ID",
3617
- { ci: true }
3618
- ],
3619
- ["RAILWAY", "RAILWAY_PROJECT_ID"],
3620
- ["RAILWAY", "RAILWAY_SERVICE_ID"],
3621
- ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
3622
- [
3623
- "FIREBASE_APP_HOSTING",
3624
- "FIREBASE_APP_HOSTING",
3625
- { ci: true }
3626
- ]
3627
- ];
3628
- function b() {
3629
- if (globalThis.process?.env) for (const e of f) {
3630
- const s$1 = e[1] || e[0];
3631
- if (globalThis.process?.env[s$1]) return {
3632
- name: e[0].toLowerCase(),
3633
- ...e[2]
3634
- };
3635
- }
3636
- return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
3637
- name: "stackblitz",
3638
- ci: false
3639
- } : {
3640
- name: "",
3641
- ci: false
3642
- };
3643
- }
3644
- const l = b();
3645
- l.name;
3646
- function n(e) {
3647
- return e ? e !== "false" : false;
3648
- }
3649
- 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);
3650
- n(o.MINIMAL);
3651
- const A = /^win/i.test(I);
3652
- !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
3653
- const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
3654
- Number(C?.split(".")[0]);
3655
- const y = globalThis.process || Object.create(null), _ = { versions: {} };
3656
- new Proxy(y, { get(e, s$1) {
3657
- if (s$1 === "env") return o;
3658
- if (s$1 in e) return e[s$1];
3659
- if (s$1 in _) return _[s$1];
3660
- } });
3661
- 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 = [
3662
- [S, "netlify"],
3663
- [u, "edge-light"],
3664
- [N, "workerd"],
3665
- [L, "fastly"],
3666
- [D, "deno"],
3667
- [O, "bun"],
3668
- [c, "node"]
3669
- ];
3670
- function G() {
3671
- const e = F.find((s$1) => s$1[0]);
3672
- if (e) return { name: e[1] };
3673
- }
3674
- const P = G();
3675
- P?.name;
3676
- function ansiRegex({ onlyFirst = false } = {}) {
3677
- const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
3678
- 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("|");
3679
- return new RegExp(pattern, onlyFirst ? void 0 : "g");
3680
- }
3681
- const regex$1 = ansiRegex();
3682
- function stripAnsi(string$1) {
3683
- if (typeof string$1 !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string$1}\``);
3684
- return string$1.replace(regex$1, "");
3685
- }
3686
- function isAmbiguous(x) {
3687
- 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;
3688
- }
3689
- function isFullWidth(x) {
3690
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
3691
- }
3692
- function isWide(x) {
3693
- 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;
3694
- }
3695
- function validate(codePoint) {
3696
- if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
3697
- }
3698
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
3699
- validate(codePoint);
3700
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
3701
- return 1;
3702
- }
3703
- const emojiRegex = () => {
3704
- 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;
3705
- };
3706
- const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
3707
- const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
3708
- function stringWidth$1(string$1, options = {}) {
3709
- if (typeof string$1 !== "string" || string$1.length === 0) return 0;
3710
- const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
3711
- if (!countAnsiEscapeCodes) string$1 = stripAnsi(string$1);
3712
- if (string$1.length === 0) return 0;
3713
- let width = 0;
3714
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
3715
- for (const { segment: character } of segmenter.segment(string$1)) {
3716
- const codePoint = character.codePointAt(0);
3717
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
3718
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
3719
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
3720
- if (codePoint >= 55296 && codePoint <= 57343) continue;
3721
- if (codePoint >= 65024 && codePoint <= 65039) continue;
3722
- if (defaultIgnorableCodePointRegex.test(character)) continue;
3723
- if (emojiRegex().test(character)) {
3724
- width += 2;
3725
- continue;
3726
- }
3727
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
2952
+ } catch (e) {}
3728
2953
  }
3729
- return width;
3730
- }
3731
- function isUnicodeSupported() {
3732
- const { env: env$3 } = process$1;
3733
- const { TERM, TERM_PROGRAM } = env$3;
3734
- if (process$1.platform !== "win32") return TERM !== "linux";
3735
- 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";
3736
- }
3737
- const TYPE_COLOR_MAP = {
3738
- info: "cyan",
3739
- fail: "red",
3740
- success: "green",
3741
- ready: "green",
3742
- start: "magenta"
3743
- };
3744
- const LEVEL_COLOR_MAP = {
3745
- 0: "red",
3746
- 1: "yellow"
3747
- };
3748
- const unicode = isUnicodeSupported();
3749
- const s = (c$1, fallback) => unicode ? c$1 : fallback;
3750
- const TYPE_ICONS = {
3751
- error: s("✖", "×"),
3752
- fatal: s("✖", "×"),
3753
- ready: s("✔", "√"),
3754
- warn: s("⚠", "‼"),
3755
- info: s("ℹ", "i"),
3756
- success: s("✔", "√"),
3757
- debug: s("⚙", "D"),
3758
- trace: s("→", "→"),
3759
- fail: s("✖", "×"),
3760
- start: s("◐", "o"),
3761
- log: ""
3762
- };
3763
- function stringWidth(str) {
3764
- const hasICU = typeof Intl === "object";
3765
- if (!hasICU || !Intl.Segmenter) return stripAnsi$1(str).length;
3766
- return stringWidth$1(str);
2954
+ return stats;
3767
2955
  }
3768
- var FancyReporter = class extends BasicReporter {
3769
- formatStack(stack, message, opts) {
3770
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
3771
- return `
3772
- ${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_$1, m) => `(${colors.cyan(m)})`)).join(`
3773
- ${indent}`);
3774
- }
3775
- formatType(logObj, isBadge, opts) {
3776
- const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
3777
- if (isBadge) return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
3778
- const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
3779
- 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;
3780
2960
  }
3781
- formatLogObj(logObj, opts) {
3782
- const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
3783
- if (logObj.type === "box") return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
3784
- title: logObj.title ? characterFormat(logObj.title) : void 0,
3785
- style: logObj.style
3786
- });
3787
- const date = this.formatDate(logObj.date, opts);
3788
- const coloredDate = date && colors.gray(date);
3789
- const isBadge = logObj.badge ?? logObj.level < 2;
3790
- const type = this.formatType(logObj, isBadge, opts);
3791
- const tag = logObj.tag ? colors.gray(logObj.tag) : "";
3792
- let line;
3793
- const left = this.filterAndJoin([type, characterFormat(message)]);
3794
- const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
3795
- const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
3796
- line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
3797
- line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
3798
- if (logObj.type === "trace") {
3799
- const _err = new Error("Trace: " + logObj.message);
3800
- line += this.formatStack(_err.stack || "", _err.message);
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("---");
3801
3004
  }
3802
- return isBadge ? "\n" + line + "\n" : line;
3803
3005
  }
3804
- };
3805
- function characterFormat(str) {
3806
- return str.replace(/`([^`]+)`/gm, (_$1, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_$1, m) => ` ${colors.underline(m)} `);
3807
3006
  }
3808
- function getColor(color = "white") {
3809
- return colors[color] || colors.white;
3810
- }
3811
- function getBgColor(color = "bgWhite") {
3812
- return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
3813
- }
3814
- function createConsola(options = {}) {
3815
- let level$1 = _getDefaultLogLevel();
3816
- if (process.env.CONSOLA_LEVEL) level$1 = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level$1;
3817
- const consola2 = createConsola$1({
3818
- level: level$1,
3819
- defaults: { level: level$1 },
3820
- stdout: process.stdout,
3821
- stderr: process.stderr,
3822
- prompt: (...args) => import("./prompt-_w55ddDU.js").then((m) => m.prompt(...args)),
3823
- reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
3824
- ...options
3825
- });
3826
- return consola2;
3827
- }
3828
- function _getDefaultLogLevel() {
3829
- if (g) return LogLevels.debug;
3830
- if (R) return LogLevels.warn;
3831
- return LogLevels.info;
3832
- }
3833
- const consola = createConsola();
3834
-
3835
- //#endregion
3836
- //#region package.json
3837
- var name = "ccusage";
3838
- var version = "0.3.2";
3839
- var description = "Usage analysis tool for Claude Code";
3840
-
3841
- //#endregion
3842
- //#region logger.ts
3843
- const logger = consola.withTag(name);
3844
- const log = (...args) => console.log(...args);
3845
3007
 
3846
3008
  //#endregion
3847
3009
  //#region types.ts
@@ -3875,6 +3037,11 @@ const ModelSpecSchema = object({
3875
3037
  });
3876
3038
  const LiteLLMModelPricesSchema = record(string(), ModelSpecSchema);
3877
3039
  const dateSchema = pipe(string(), regex(/^\d{8}$/, "Date must be in YYYYMMDD format"));
3040
+ const CostModes = [
3041
+ "auto",
3042
+ "calculate",
3043
+ "display"
3044
+ ];
3878
3045
 
3879
3046
  //#endregion
3880
3047
  //#region shared-args.ts
@@ -3907,8 +3074,30 @@ const sharedArgs = {
3907
3074
  short: "j",
3908
3075
  description: "Output in JSON format",
3909
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
3910
3095
  }
3911
3096
  };
3097
+ const sharedCommandConfig = {
3098
+ args: sharedArgs,
3099
+ toKebab: true
3100
+ };
3912
3101
 
3913
3102
  //#endregion
3914
3103
  //#region utils.ts
@@ -3926,12 +3115,13 @@ var import_picocolors$1 = __toESM(require_picocolors(), 1);
3926
3115
  const dailyCommand = define({
3927
3116
  name: "daily",
3928
3117
  description: "Show usage report grouped by date",
3929
- args: sharedArgs,
3118
+ ...sharedCommandConfig,
3930
3119
  async run(ctx) {
3931
3120
  const options = {
3932
3121
  since: ctx.values.since,
3933
3122
  until: ctx.values.until,
3934
- claudePath: ctx.values.path
3123
+ claudePath: ctx.values.path,
3124
+ mode: ctx.values.mode
3935
3125
  };
3936
3126
  const dailyData = await loadUsageData(options);
3937
3127
  if (dailyData.length === 0) {
@@ -3940,6 +3130,10 @@ const dailyCommand = define({
3940
3130
  process$1.exit(0);
3941
3131
  }
3942
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
+ }
3943
3137
  if (ctx.values.json) {
3944
3138
  const jsonOutput = {
3945
3139
  daily: dailyData.map((data) => ({
@@ -4016,12 +3210,13 @@ var import_picocolors = __toESM(require_picocolors(), 1);
4016
3210
  const sessionCommand = define({
4017
3211
  name: "session",
4018
3212
  description: "Show usage report grouped by conversation session",
4019
- args: sharedArgs,
3213
+ ...sharedCommandConfig,
4020
3214
  async run(ctx) {
4021
3215
  const options = {
4022
3216
  since: ctx.values.since,
4023
3217
  until: ctx.values.until,
4024
- claudePath: ctx.values.path
3218
+ claudePath: ctx.values.path,
3219
+ mode: ctx.values.mode
4025
3220
  };
4026
3221
  const sessionData = await loadSessionData(options);
4027
3222
  if (sessionData.length === 0) {
@@ -4030,6 +3225,10 @@ const sessionCommand = define({
4030
3225
  process$1.exit(0);
4031
3226
  }
4032
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
+ }
4033
3232
  if (ctx.values.json) {
4034
3233
  const jsonOutput = {
4035
3234
  sessions: sessionData.map((data) => ({