ccstatusline 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31861,671 +31861,2118 @@ var require_jsx_dev_runtime = __commonJS((exports, module) => {
31861
31861
  }
31862
31862
  });
31863
31863
 
31864
- // node_modules/chalk/source/vendor/ansi-styles/index.js
31865
- var ANSI_BACKGROUND_OFFSET = 10;
31866
- var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
31867
- var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
31868
- var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
31869
- var styles = {
31870
- modifier: {
31871
- reset: [0, 0],
31872
- bold: [1, 22],
31873
- dim: [2, 22],
31874
- italic: [3, 23],
31875
- underline: [4, 24],
31876
- overline: [53, 55],
31877
- inverse: [7, 27],
31878
- hidden: [8, 28],
31879
- strikethrough: [9, 29]
31880
- },
31881
- color: {
31882
- black: [30, 39],
31883
- red: [31, 39],
31884
- green: [32, 39],
31885
- yellow: [33, 39],
31886
- blue: [34, 39],
31887
- magenta: [35, 39],
31888
- cyan: [36, 39],
31889
- white: [37, 39],
31890
- blackBright: [90, 39],
31891
- gray: [90, 39],
31892
- grey: [90, 39],
31893
- redBright: [91, 39],
31894
- greenBright: [92, 39],
31895
- yellowBright: [93, 39],
31896
- blueBright: [94, 39],
31897
- magentaBright: [95, 39],
31898
- cyanBright: [96, 39],
31899
- whiteBright: [97, 39]
31900
- },
31901
- bgColor: {
31902
- bgBlack: [40, 49],
31903
- bgRed: [41, 49],
31904
- bgGreen: [42, 49],
31905
- bgYellow: [43, 49],
31906
- bgBlue: [44, 49],
31907
- bgMagenta: [45, 49],
31908
- bgCyan: [46, 49],
31909
- bgWhite: [47, 49],
31910
- bgBlackBright: [100, 49],
31911
- bgGray: [100, 49],
31912
- bgGrey: [100, 49],
31913
- bgRedBright: [101, 49],
31914
- bgGreenBright: [102, 49],
31915
- bgYellowBright: [103, 49],
31916
- bgBlueBright: [104, 49],
31917
- bgMagentaBright: [105, 49],
31918
- bgCyanBright: [106, 49],
31919
- bgWhiteBright: [107, 49]
31920
- }
31921
- };
31922
- var modifierNames = Object.keys(styles.modifier);
31923
- var foregroundColorNames = Object.keys(styles.color);
31924
- var backgroundColorNames = Object.keys(styles.bgColor);
31925
- var colorNames = [...foregroundColorNames, ...backgroundColorNames];
31926
- function assembleStyles() {
31927
- const codes = new Map;
31928
- for (const [groupName, group] of Object.entries(styles)) {
31929
- for (const [styleName, style] of Object.entries(group)) {
31930
- styles[styleName] = {
31931
- open: `\x1B[${style[0]}m`,
31932
- close: `\x1B[${style[1]}m`
31864
+ // node_modules/picomatch/lib/constants.js
31865
+ var require_constants3 = __commonJS((exports, module) => {
31866
+ var WIN_SLASH = "\\\\/";
31867
+ var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
31868
+ var DOT_LITERAL = "\\.";
31869
+ var PLUS_LITERAL = "\\+";
31870
+ var QMARK_LITERAL = "\\?";
31871
+ var SLASH_LITERAL = "\\/";
31872
+ var ONE_CHAR = "(?=.)";
31873
+ var QMARK = "[^/]";
31874
+ var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
31875
+ var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
31876
+ var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
31877
+ var NO_DOT = `(?!${DOT_LITERAL})`;
31878
+ var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
31879
+ var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
31880
+ var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
31881
+ var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
31882
+ var STAR = `${QMARK}*?`;
31883
+ var SEP2 = "/";
31884
+ var POSIX_CHARS = {
31885
+ DOT_LITERAL,
31886
+ PLUS_LITERAL,
31887
+ QMARK_LITERAL,
31888
+ SLASH_LITERAL,
31889
+ ONE_CHAR,
31890
+ QMARK,
31891
+ END_ANCHOR,
31892
+ DOTS_SLASH,
31893
+ NO_DOT,
31894
+ NO_DOTS,
31895
+ NO_DOT_SLASH,
31896
+ NO_DOTS_SLASH,
31897
+ QMARK_NO_DOT,
31898
+ STAR,
31899
+ START_ANCHOR,
31900
+ SEP: SEP2
31901
+ };
31902
+ var WINDOWS_CHARS = {
31903
+ ...POSIX_CHARS,
31904
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
31905
+ QMARK: WIN_NO_SLASH,
31906
+ STAR: `${WIN_NO_SLASH}*?`,
31907
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
31908
+ NO_DOT: `(?!${DOT_LITERAL})`,
31909
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
31910
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
31911
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
31912
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
31913
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
31914
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
31915
+ SEP: "\\"
31916
+ };
31917
+ var POSIX_REGEX_SOURCE = {
31918
+ alnum: "a-zA-Z0-9",
31919
+ alpha: "a-zA-Z",
31920
+ ascii: "\\x00-\\x7F",
31921
+ blank: " \\t",
31922
+ cntrl: "\\x00-\\x1F\\x7F",
31923
+ digit: "0-9",
31924
+ graph: "\\x21-\\x7E",
31925
+ lower: "a-z",
31926
+ print: "\\x20-\\x7E ",
31927
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
31928
+ space: " \\t\\r\\n\\v\\f",
31929
+ upper: "A-Z",
31930
+ word: "A-Za-z0-9_",
31931
+ xdigit: "A-Fa-f0-9"
31932
+ };
31933
+ module.exports = {
31934
+ MAX_LENGTH: 1024 * 64,
31935
+ POSIX_REGEX_SOURCE,
31936
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
31937
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
31938
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
31939
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
31940
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
31941
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
31942
+ REPLACEMENTS: {
31943
+ __proto__: null,
31944
+ "***": "*",
31945
+ "**/**": "**",
31946
+ "**/**/**": "**"
31947
+ },
31948
+ CHAR_0: 48,
31949
+ CHAR_9: 57,
31950
+ CHAR_UPPERCASE_A: 65,
31951
+ CHAR_LOWERCASE_A: 97,
31952
+ CHAR_UPPERCASE_Z: 90,
31953
+ CHAR_LOWERCASE_Z: 122,
31954
+ CHAR_LEFT_PARENTHESES: 40,
31955
+ CHAR_RIGHT_PARENTHESES: 41,
31956
+ CHAR_ASTERISK: 42,
31957
+ CHAR_AMPERSAND: 38,
31958
+ CHAR_AT: 64,
31959
+ CHAR_BACKWARD_SLASH: 92,
31960
+ CHAR_CARRIAGE_RETURN: 13,
31961
+ CHAR_CIRCUMFLEX_ACCENT: 94,
31962
+ CHAR_COLON: 58,
31963
+ CHAR_COMMA: 44,
31964
+ CHAR_DOT: 46,
31965
+ CHAR_DOUBLE_QUOTE: 34,
31966
+ CHAR_EQUAL: 61,
31967
+ CHAR_EXCLAMATION_MARK: 33,
31968
+ CHAR_FORM_FEED: 12,
31969
+ CHAR_FORWARD_SLASH: 47,
31970
+ CHAR_GRAVE_ACCENT: 96,
31971
+ CHAR_HASH: 35,
31972
+ CHAR_HYPHEN_MINUS: 45,
31973
+ CHAR_LEFT_ANGLE_BRACKET: 60,
31974
+ CHAR_LEFT_CURLY_BRACE: 123,
31975
+ CHAR_LEFT_SQUARE_BRACKET: 91,
31976
+ CHAR_LINE_FEED: 10,
31977
+ CHAR_NO_BREAK_SPACE: 160,
31978
+ CHAR_PERCENT: 37,
31979
+ CHAR_PLUS: 43,
31980
+ CHAR_QUESTION_MARK: 63,
31981
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
31982
+ CHAR_RIGHT_CURLY_BRACE: 125,
31983
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
31984
+ CHAR_SEMICOLON: 59,
31985
+ CHAR_SINGLE_QUOTE: 39,
31986
+ CHAR_SPACE: 32,
31987
+ CHAR_TAB: 9,
31988
+ CHAR_UNDERSCORE: 95,
31989
+ CHAR_VERTICAL_LINE: 124,
31990
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
31991
+ extglobChars(chars) {
31992
+ return {
31993
+ "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
31994
+ "?": { type: "qmark", open: "(?:", close: ")?" },
31995
+ "+": { type: "plus", open: "(?:", close: ")+" },
31996
+ "*": { type: "star", open: "(?:", close: ")*" },
31997
+ "@": { type: "at", open: "(?:", close: ")" }
31933
31998
  };
31934
- group[styleName] = styles[styleName];
31935
- codes.set(style[0], style[1]);
31999
+ },
32000
+ globChars(win32) {
32001
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
31936
32002
  }
31937
- Object.defineProperty(styles, groupName, {
31938
- value: group,
31939
- enumerable: false
32003
+ };
32004
+ });
32005
+
32006
+ // node_modules/picomatch/lib/utils.js
32007
+ var require_utils = __commonJS((exports) => {
32008
+ var {
32009
+ REGEX_BACKSLASH,
32010
+ REGEX_REMOVE_BACKSLASH,
32011
+ REGEX_SPECIAL_CHARS,
32012
+ REGEX_SPECIAL_CHARS_GLOBAL
32013
+ } = require_constants3();
32014
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
32015
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
32016
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
32017
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
32018
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
32019
+ exports.isWindows = () => {
32020
+ if (typeof navigator !== "undefined" && navigator.platform) {
32021
+ const platform4 = navigator.platform.toLowerCase();
32022
+ return platform4 === "win32" || platform4 === "windows";
32023
+ }
32024
+ if (typeof process !== "undefined" && process.platform) {
32025
+ return process.platform === "win32";
32026
+ }
32027
+ return false;
32028
+ };
32029
+ exports.removeBackslashes = (str) => {
32030
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
32031
+ return match === "\\" ? "" : match;
31940
32032
  });
31941
- }
31942
- Object.defineProperty(styles, "codes", {
31943
- value: codes,
31944
- enumerable: false
31945
- });
31946
- styles.color.close = "\x1B[39m";
31947
- styles.bgColor.close = "\x1B[49m";
31948
- styles.color.ansi = wrapAnsi16();
31949
- styles.color.ansi256 = wrapAnsi256();
31950
- styles.color.ansi16m = wrapAnsi16m();
31951
- styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
31952
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
31953
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
31954
- Object.defineProperties(styles, {
31955
- rgbToAnsi256: {
31956
- value(red, green, blue) {
31957
- if (red === green && green === blue) {
31958
- if (red < 8) {
31959
- return 16;
32033
+ };
32034
+ exports.escapeLast = (input, char, lastIdx) => {
32035
+ const idx = input.lastIndexOf(char, lastIdx);
32036
+ if (idx === -1)
32037
+ return input;
32038
+ if (input[idx - 1] === "\\")
32039
+ return exports.escapeLast(input, char, idx - 1);
32040
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
32041
+ };
32042
+ exports.removePrefix = (input, state = {}) => {
32043
+ let output = input;
32044
+ if (output.startsWith("./")) {
32045
+ output = output.slice(2);
32046
+ state.prefix = "./";
32047
+ }
32048
+ return output;
32049
+ };
32050
+ exports.wrapOutput = (input, state = {}, options = {}) => {
32051
+ const prepend = options.contains ? "" : "^";
32052
+ const append = options.contains ? "" : "$";
32053
+ let output = `${prepend}(?:${input})${append}`;
32054
+ if (state.negated === true) {
32055
+ output = `(?:^(?!${output}).*$)`;
32056
+ }
32057
+ return output;
32058
+ };
32059
+ exports.basename = (path5, { windows } = {}) => {
32060
+ const segs = path5.split(windows ? /[\\/]/ : "/");
32061
+ const last = segs[segs.length - 1];
32062
+ if (last === "") {
32063
+ return segs[segs.length - 2];
32064
+ }
32065
+ return last;
32066
+ };
32067
+ });
32068
+
32069
+ // node_modules/picomatch/lib/scan.js
32070
+ var require_scan = __commonJS((exports, module) => {
32071
+ var utils = require_utils();
32072
+ var {
32073
+ CHAR_ASTERISK,
32074
+ CHAR_AT,
32075
+ CHAR_BACKWARD_SLASH,
32076
+ CHAR_COMMA,
32077
+ CHAR_DOT,
32078
+ CHAR_EXCLAMATION_MARK,
32079
+ CHAR_FORWARD_SLASH,
32080
+ CHAR_LEFT_CURLY_BRACE,
32081
+ CHAR_LEFT_PARENTHESES,
32082
+ CHAR_LEFT_SQUARE_BRACKET,
32083
+ CHAR_PLUS,
32084
+ CHAR_QUESTION_MARK,
32085
+ CHAR_RIGHT_CURLY_BRACE,
32086
+ CHAR_RIGHT_PARENTHESES,
32087
+ CHAR_RIGHT_SQUARE_BRACKET
32088
+ } = require_constants3();
32089
+ var isPathSeparator = (code) => {
32090
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
32091
+ };
32092
+ var depth = (token) => {
32093
+ if (token.isPrefix !== true) {
32094
+ token.depth = token.isGlobstar ? Infinity : 1;
32095
+ }
32096
+ };
32097
+ var scan = (input, options) => {
32098
+ const opts = options || {};
32099
+ const length = input.length - 1;
32100
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
32101
+ const slashes = [];
32102
+ const tokens = [];
32103
+ const parts = [];
32104
+ let str = input;
32105
+ let index = -1;
32106
+ let start = 0;
32107
+ let lastIndex = 0;
32108
+ let isBrace = false;
32109
+ let isBracket = false;
32110
+ let isGlob = false;
32111
+ let isExtglob = false;
32112
+ let isGlobstar = false;
32113
+ let braceEscaped = false;
32114
+ let backslashes = false;
32115
+ let negated = false;
32116
+ let negatedExtglob = false;
32117
+ let finished = false;
32118
+ let braces = 0;
32119
+ let prev;
32120
+ let code;
32121
+ let token = { value: "", depth: 0, isGlob: false };
32122
+ const eos = () => index >= length;
32123
+ const peek = () => str.charCodeAt(index + 1);
32124
+ const advance = () => {
32125
+ prev = code;
32126
+ return str.charCodeAt(++index);
32127
+ };
32128
+ while (index < length) {
32129
+ code = advance();
32130
+ let next;
32131
+ if (code === CHAR_BACKWARD_SLASH) {
32132
+ backslashes = token.backslashes = true;
32133
+ code = advance();
32134
+ if (code === CHAR_LEFT_CURLY_BRACE) {
32135
+ braceEscaped = true;
32136
+ }
32137
+ continue;
32138
+ }
32139
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
32140
+ braces++;
32141
+ while (eos() !== true && (code = advance())) {
32142
+ if (code === CHAR_BACKWARD_SLASH) {
32143
+ backslashes = token.backslashes = true;
32144
+ advance();
32145
+ continue;
31960
32146
  }
31961
- if (red > 248) {
31962
- return 231;
32147
+ if (code === CHAR_LEFT_CURLY_BRACE) {
32148
+ braces++;
32149
+ continue;
32150
+ }
32151
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
32152
+ isBrace = token.isBrace = true;
32153
+ isGlob = token.isGlob = true;
32154
+ finished = true;
32155
+ if (scanToEnd === true) {
32156
+ continue;
32157
+ }
32158
+ break;
32159
+ }
32160
+ if (braceEscaped !== true && code === CHAR_COMMA) {
32161
+ isBrace = token.isBrace = true;
32162
+ isGlob = token.isGlob = true;
32163
+ finished = true;
32164
+ if (scanToEnd === true) {
32165
+ continue;
32166
+ }
32167
+ break;
32168
+ }
32169
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
32170
+ braces--;
32171
+ if (braces === 0) {
32172
+ braceEscaped = false;
32173
+ isBrace = token.isBrace = true;
32174
+ finished = true;
32175
+ break;
32176
+ }
31963
32177
  }
31964
- return Math.round((red - 8) / 247 * 24) + 232;
31965
32178
  }
31966
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
31967
- },
31968
- enumerable: false
31969
- },
31970
- hexToRgb: {
31971
- value(hex) {
31972
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
31973
- if (!matches) {
31974
- return [0, 0, 0];
32179
+ if (scanToEnd === true) {
32180
+ continue;
31975
32181
  }
31976
- let [colorString] = matches;
31977
- if (colorString.length === 3) {
31978
- colorString = [...colorString].map((character) => character + character).join("");
32182
+ break;
32183
+ }
32184
+ if (code === CHAR_FORWARD_SLASH) {
32185
+ slashes.push(index);
32186
+ tokens.push(token);
32187
+ token = { value: "", depth: 0, isGlob: false };
32188
+ if (finished === true)
32189
+ continue;
32190
+ if (prev === CHAR_DOT && index === start + 1) {
32191
+ start += 2;
32192
+ continue;
31979
32193
  }
31980
- const integer = Number.parseInt(colorString, 16);
31981
- return [
31982
- integer >> 16 & 255,
31983
- integer >> 8 & 255,
31984
- integer & 255
31985
- ];
31986
- },
31987
- enumerable: false
31988
- },
31989
- hexToAnsi256: {
31990
- value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
31991
- enumerable: false
31992
- },
31993
- ansi256ToAnsi: {
31994
- value(code) {
31995
- if (code < 8) {
31996
- return 30 + code;
32194
+ lastIndex = index + 1;
32195
+ continue;
32196
+ }
32197
+ if (opts.noext !== true) {
32198
+ const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
32199
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
32200
+ isGlob = token.isGlob = true;
32201
+ isExtglob = token.isExtglob = true;
32202
+ finished = true;
32203
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
32204
+ negatedExtglob = true;
32205
+ }
32206
+ if (scanToEnd === true) {
32207
+ while (eos() !== true && (code = advance())) {
32208
+ if (code === CHAR_BACKWARD_SLASH) {
32209
+ backslashes = token.backslashes = true;
32210
+ code = advance();
32211
+ continue;
32212
+ }
32213
+ if (code === CHAR_RIGHT_PARENTHESES) {
32214
+ isGlob = token.isGlob = true;
32215
+ finished = true;
32216
+ break;
32217
+ }
32218
+ }
32219
+ continue;
32220
+ }
32221
+ break;
31997
32222
  }
31998
- if (code < 16) {
31999
- return 90 + (code - 8);
32223
+ }
32224
+ if (code === CHAR_ASTERISK) {
32225
+ if (prev === CHAR_ASTERISK)
32226
+ isGlobstar = token.isGlobstar = true;
32227
+ isGlob = token.isGlob = true;
32228
+ finished = true;
32229
+ if (scanToEnd === true) {
32230
+ continue;
32000
32231
  }
32001
- let red;
32002
- let green;
32003
- let blue;
32004
- if (code >= 232) {
32005
- red = ((code - 232) * 10 + 8) / 255;
32006
- green = red;
32007
- blue = red;
32008
- } else {
32009
- code -= 16;
32010
- const remainder = code % 36;
32011
- red = Math.floor(code / 36) / 5;
32012
- green = Math.floor(remainder / 6) / 5;
32013
- blue = remainder % 6 / 5;
32232
+ break;
32233
+ }
32234
+ if (code === CHAR_QUESTION_MARK) {
32235
+ isGlob = token.isGlob = true;
32236
+ finished = true;
32237
+ if (scanToEnd === true) {
32238
+ continue;
32014
32239
  }
32015
- const value = Math.max(red, green, blue) * 2;
32016
- if (value === 0) {
32017
- return 30;
32240
+ break;
32241
+ }
32242
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
32243
+ while (eos() !== true && (next = advance())) {
32244
+ if (next === CHAR_BACKWARD_SLASH) {
32245
+ backslashes = token.backslashes = true;
32246
+ advance();
32247
+ continue;
32248
+ }
32249
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
32250
+ isBracket = token.isBracket = true;
32251
+ isGlob = token.isGlob = true;
32252
+ finished = true;
32253
+ break;
32254
+ }
32018
32255
  }
32019
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
32020
- if (value === 2) {
32021
- result += 60;
32256
+ if (scanToEnd === true) {
32257
+ continue;
32022
32258
  }
32023
- return result;
32024
- },
32025
- enumerable: false
32026
- },
32027
- rgbToAnsi: {
32028
- value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
32029
- enumerable: false
32030
- },
32031
- hexToAnsi: {
32032
- value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
32033
- enumerable: false
32259
+ break;
32260
+ }
32261
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
32262
+ negated = token.negated = true;
32263
+ start++;
32264
+ continue;
32265
+ }
32266
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
32267
+ isGlob = token.isGlob = true;
32268
+ if (scanToEnd === true) {
32269
+ while (eos() !== true && (code = advance())) {
32270
+ if (code === CHAR_LEFT_PARENTHESES) {
32271
+ backslashes = token.backslashes = true;
32272
+ code = advance();
32273
+ continue;
32274
+ }
32275
+ if (code === CHAR_RIGHT_PARENTHESES) {
32276
+ finished = true;
32277
+ break;
32278
+ }
32279
+ }
32280
+ continue;
32281
+ }
32282
+ break;
32283
+ }
32284
+ if (isGlob === true) {
32285
+ finished = true;
32286
+ if (scanToEnd === true) {
32287
+ continue;
32288
+ }
32289
+ break;
32290
+ }
32034
32291
  }
32035
- });
32036
- return styles;
32037
- }
32038
- var ansiStyles = assembleStyles();
32039
- var ansi_styles_default = ansiStyles;
32040
-
32041
- // node_modules/chalk/source/vendor/supports-color/index.js
32042
- import process2 from "node:process";
32043
- import os from "node:os";
32044
- import tty from "node:tty";
32045
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
32046
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
32047
- const position = argv.indexOf(prefix + flag);
32048
- const terminatorPosition = argv.indexOf("--");
32049
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
32050
- }
32051
- var { env } = process2;
32052
- var flagForceColor;
32053
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
32054
- flagForceColor = 0;
32055
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
32056
- flagForceColor = 1;
32057
- }
32058
- function envForceColor() {
32059
- if ("FORCE_COLOR" in env) {
32060
- if (env.FORCE_COLOR === "true") {
32061
- return 1;
32062
- }
32063
- if (env.FORCE_COLOR === "false") {
32064
- return 0;
32065
- }
32066
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
32067
- }
32068
- }
32069
- function translateLevel(level) {
32070
- if (level === 0) {
32071
- return false;
32072
- }
32073
- return {
32074
- level,
32075
- hasBasic: true,
32076
- has256: level >= 2,
32077
- has16m: level >= 3
32078
- };
32079
- }
32080
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
32081
- const noFlagForceColor = envForceColor();
32082
- if (noFlagForceColor !== undefined) {
32083
- flagForceColor = noFlagForceColor;
32084
- }
32085
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
32086
- if (forceColor === 0) {
32087
- return 0;
32088
- }
32089
- if (sniffFlags) {
32090
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
32091
- return 3;
32092
- }
32093
- if (hasFlag("color=256")) {
32094
- return 2;
32095
- }
32096
- }
32097
- if ("TF_BUILD" in env && "AGENT_NAME" in env) {
32098
- return 1;
32099
- }
32100
- if (haveStream && !streamIsTTY && forceColor === undefined) {
32101
- return 0;
32102
- }
32103
- const min = forceColor || 0;
32104
- if (env.TERM === "dumb") {
32105
- return min;
32106
- }
32107
- if (process2.platform === "win32") {
32108
- const osRelease = os.release().split(".");
32109
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
32110
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
32292
+ if (opts.noext === true) {
32293
+ isExtglob = false;
32294
+ isGlob = false;
32295
+ }
32296
+ let base2 = str;
32297
+ let prefix = "";
32298
+ let glob = "";
32299
+ if (start > 0) {
32300
+ prefix = str.slice(0, start);
32301
+ str = str.slice(start);
32302
+ lastIndex -= start;
32303
+ }
32304
+ if (base2 && isGlob === true && lastIndex > 0) {
32305
+ base2 = str.slice(0, lastIndex);
32306
+ glob = str.slice(lastIndex);
32307
+ } else if (isGlob === true) {
32308
+ base2 = "";
32309
+ glob = str;
32310
+ } else {
32311
+ base2 = str;
32111
32312
  }
32112
- return 1;
32113
- }
32114
- if ("CI" in env) {
32115
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env))) {
32116
- return 3;
32313
+ if (base2 && base2 !== "" && base2 !== "/" && base2 !== str) {
32314
+ if (isPathSeparator(base2.charCodeAt(base2.length - 1))) {
32315
+ base2 = base2.slice(0, -1);
32316
+ }
32117
32317
  }
32118
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
32119
- return 1;
32318
+ if (opts.unescape === true) {
32319
+ if (glob)
32320
+ glob = utils.removeBackslashes(glob);
32321
+ if (base2 && backslashes === true) {
32322
+ base2 = utils.removeBackslashes(base2);
32323
+ }
32120
32324
  }
32121
- return min;
32122
- }
32123
- if ("TEAMCITY_VERSION" in env) {
32124
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
32125
- }
32126
- if (env.COLORTERM === "truecolor") {
32127
- return 3;
32128
- }
32129
- if (env.TERM === "xterm-kitty") {
32130
- return 3;
32131
- }
32132
- if (env.TERM === "xterm-ghostty") {
32133
- return 3;
32134
- }
32135
- if ("TERM_PROGRAM" in env) {
32136
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
32137
- switch (env.TERM_PROGRAM) {
32138
- case "iTerm.app": {
32139
- return version >= 3 ? 3 : 2;
32325
+ const state = {
32326
+ prefix,
32327
+ input,
32328
+ start,
32329
+ base: base2,
32330
+ glob,
32331
+ isBrace,
32332
+ isBracket,
32333
+ isGlob,
32334
+ isExtglob,
32335
+ isGlobstar,
32336
+ negated,
32337
+ negatedExtglob
32338
+ };
32339
+ if (opts.tokens === true) {
32340
+ state.maxDepth = 0;
32341
+ if (!isPathSeparator(code)) {
32342
+ tokens.push(token);
32343
+ }
32344
+ state.tokens = tokens;
32345
+ }
32346
+ if (opts.parts === true || opts.tokens === true) {
32347
+ let prevIndex;
32348
+ for (let idx = 0;idx < slashes.length; idx++) {
32349
+ const n = prevIndex ? prevIndex + 1 : start;
32350
+ const i = slashes[idx];
32351
+ const value = input.slice(n, i);
32352
+ if (opts.tokens) {
32353
+ if (idx === 0 && start !== 0) {
32354
+ tokens[idx].isPrefix = true;
32355
+ tokens[idx].value = prefix;
32356
+ } else {
32357
+ tokens[idx].value = value;
32358
+ }
32359
+ depth(tokens[idx]);
32360
+ state.maxDepth += tokens[idx].depth;
32361
+ }
32362
+ if (idx !== 0 || value !== "") {
32363
+ parts.push(value);
32364
+ }
32365
+ prevIndex = i;
32140
32366
  }
32141
- case "Apple_Terminal": {
32142
- return 2;
32367
+ if (prevIndex && prevIndex + 1 < input.length) {
32368
+ const value = input.slice(prevIndex + 1);
32369
+ parts.push(value);
32370
+ if (opts.tokens) {
32371
+ tokens[tokens.length - 1].value = value;
32372
+ depth(tokens[tokens.length - 1]);
32373
+ state.maxDepth += tokens[tokens.length - 1].depth;
32374
+ }
32143
32375
  }
32376
+ state.slashes = slashes;
32377
+ state.parts = parts;
32144
32378
  }
32145
- }
32146
- if (/-256(color)?$/i.test(env.TERM)) {
32147
- return 2;
32148
- }
32149
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
32150
- return 1;
32151
- }
32152
- if ("COLORTERM" in env) {
32153
- return 1;
32154
- }
32155
- return min;
32156
- }
32157
- function createSupportsColor(stream, options = {}) {
32158
- const level = _supportsColor(stream, {
32159
- streamIsTTY: stream && stream.isTTY,
32160
- ...options
32161
- });
32162
- return translateLevel(level);
32163
- }
32164
- var supportsColor = {
32165
- stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
32166
- stderr: createSupportsColor({ isTTY: tty.isatty(2) })
32167
- };
32168
- var supports_color_default = supportsColor;
32169
-
32170
- // node_modules/chalk/source/utilities.js
32171
- function stringReplaceAll(string, substring, replacer) {
32172
- let index = string.indexOf(substring);
32173
- if (index === -1) {
32174
- return string;
32175
- }
32176
- const substringLength = substring.length;
32177
- let endIndex = 0;
32178
- let returnValue = "";
32179
- do {
32180
- returnValue += string.slice(endIndex, index) + substring + replacer;
32181
- endIndex = index + substringLength;
32182
- index = string.indexOf(substring, endIndex);
32183
- } while (index !== -1);
32184
- returnValue += string.slice(endIndex);
32185
- return returnValue;
32186
- }
32187
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
32188
- let endIndex = 0;
32189
- let returnValue = "";
32190
- do {
32191
- const gotCR = string[index - 1] === "\r";
32192
- returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
32193
- ` : `
32194
- `) + postfix;
32195
- endIndex = index + 1;
32196
- index = string.indexOf(`
32197
- `, endIndex);
32198
- } while (index !== -1);
32199
- returnValue += string.slice(endIndex);
32200
- return returnValue;
32201
- }
32379
+ return state;
32380
+ };
32381
+ module.exports = scan;
32382
+ });
32202
32383
 
32203
- // node_modules/chalk/source/index.js
32204
- var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
32205
- var GENERATOR = Symbol("GENERATOR");
32206
- var STYLER = Symbol("STYLER");
32207
- var IS_EMPTY = Symbol("IS_EMPTY");
32208
- var levelMapping = [
32209
- "ansi",
32210
- "ansi",
32211
- "ansi256",
32212
- "ansi16m"
32213
- ];
32214
- var styles2 = Object.create(null);
32215
- var applyOptions = (object, options = {}) => {
32216
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
32217
- throw new Error("The `level` option should be an integer from 0 to 3");
32218
- }
32219
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
32220
- object.level = options.level === undefined ? colorLevel : options.level;
32221
- };
32222
- var chalkFactory = (options) => {
32223
- const chalk = (...strings) => strings.join(" ");
32224
- applyOptions(chalk, options);
32225
- Object.setPrototypeOf(chalk, createChalk.prototype);
32226
- return chalk;
32227
- };
32228
- function createChalk(options) {
32229
- return chalkFactory(options);
32230
- }
32231
- Object.setPrototypeOf(createChalk.prototype, Function.prototype);
32232
- for (const [styleName, style] of Object.entries(ansi_styles_default)) {
32233
- styles2[styleName] = {
32234
- get() {
32235
- const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
32236
- Object.defineProperty(this, styleName, { value: builder });
32237
- return builder;
32384
+ // node_modules/picomatch/lib/parse.js
32385
+ var require_parse = __commonJS((exports, module) => {
32386
+ var constants2 = require_constants3();
32387
+ var utils = require_utils();
32388
+ var {
32389
+ MAX_LENGTH,
32390
+ POSIX_REGEX_SOURCE,
32391
+ REGEX_NON_SPECIAL_CHARS,
32392
+ REGEX_SPECIAL_CHARS_BACKREF,
32393
+ REPLACEMENTS
32394
+ } = constants2;
32395
+ var expandRange = (args, options) => {
32396
+ if (typeof options.expandRange === "function") {
32397
+ return options.expandRange(...args, options);
32398
+ }
32399
+ args.sort();
32400
+ const value = `[${args.join("-")}]`;
32401
+ try {
32402
+ new RegExp(value);
32403
+ } catch (ex) {
32404
+ return args.map((v) => utils.escapeRegex(v)).join("..");
32238
32405
  }
32406
+ return value;
32239
32407
  };
32240
- }
32241
- styles2.visible = {
32242
- get() {
32243
- const builder = createBuilder(this, this[STYLER], true);
32244
- Object.defineProperty(this, "visible", { value: builder });
32245
- return builder;
32246
- }
32247
- };
32248
- var getModelAnsi = (model, level, type, ...arguments_) => {
32249
- if (model === "rgb") {
32250
- if (level === "ansi16m") {
32251
- return ansi_styles_default[type].ansi16m(...arguments_);
32252
- }
32253
- if (level === "ansi256") {
32254
- return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
32255
- }
32256
- return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
32257
- }
32258
- if (model === "hex") {
32259
- return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
32260
- }
32261
- return ansi_styles_default[type][model](...arguments_);
32262
- };
32263
- var usedModels = ["rgb", "hex", "ansi256"];
32264
- for (const model of usedModels) {
32265
- styles2[model] = {
32266
- get() {
32267
- const { level } = this;
32268
- return function(...arguments_) {
32269
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
32270
- return createBuilder(this, styler, this[IS_EMPTY]);
32271
- };
32272
- }
32408
+ var syntaxError = (type, char) => {
32409
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
32273
32410
  };
32274
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
32275
- styles2[bgModel] = {
32276
- get() {
32277
- const { level } = this;
32278
- return function(...arguments_) {
32279
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
32280
- return createBuilder(this, styler, this[IS_EMPTY]);
32281
- };
32411
+ var parse5 = (input, options) => {
32412
+ if (typeof input !== "string") {
32413
+ throw new TypeError("Expected a string");
32282
32414
  }
32283
- };
32284
- }
32285
- var proto = Object.defineProperties(() => {}, {
32286
- ...styles2,
32287
- level: {
32288
- enumerable: true,
32289
- get() {
32290
- return this[GENERATOR].level;
32291
- },
32292
- set(level) {
32293
- this[GENERATOR].level = level;
32415
+ input = REPLACEMENTS[input] || input;
32416
+ const opts = { ...options };
32417
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
32418
+ let len = input.length;
32419
+ if (len > max) {
32420
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
32421
+ }
32422
+ const bos = { type: "bos", value: "", output: opts.prepend || "" };
32423
+ const tokens = [bos];
32424
+ const capture = opts.capture ? "" : "?:";
32425
+ const PLATFORM_CHARS = constants2.globChars(opts.windows);
32426
+ const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
32427
+ const {
32428
+ DOT_LITERAL,
32429
+ PLUS_LITERAL,
32430
+ SLASH_LITERAL,
32431
+ ONE_CHAR,
32432
+ DOTS_SLASH,
32433
+ NO_DOT,
32434
+ NO_DOT_SLASH,
32435
+ NO_DOTS_SLASH,
32436
+ QMARK,
32437
+ QMARK_NO_DOT,
32438
+ STAR,
32439
+ START_ANCHOR
32440
+ } = PLATFORM_CHARS;
32441
+ const globstar = (opts2) => {
32442
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
32443
+ };
32444
+ const nodot = opts.dot ? "" : NO_DOT;
32445
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
32446
+ let star = opts.bash === true ? globstar(opts) : STAR;
32447
+ if (opts.capture) {
32448
+ star = `(${star})`;
32294
32449
  }
32295
- }
32296
- });
32297
- var createStyler = (open, close, parent) => {
32298
- let openAll;
32299
- let closeAll;
32300
- if (parent === undefined) {
32301
- openAll = open;
32302
- closeAll = close;
32303
- } else {
32304
- openAll = parent.openAll + open;
32305
- closeAll = close + parent.closeAll;
32306
- }
32307
- return {
32308
- open,
32309
- close,
32310
- openAll,
32311
- closeAll,
32312
- parent
32313
- };
32314
- };
32315
- var createBuilder = (self2, _styler, _isEmpty) => {
32316
- const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
32317
- Object.setPrototypeOf(builder, proto);
32318
- builder[GENERATOR] = self2;
32319
- builder[STYLER] = _styler;
32320
- builder[IS_EMPTY] = _isEmpty;
32321
- return builder;
32322
- };
32323
- var applyStyle = (self2, string) => {
32324
- if (self2.level <= 0 || !string) {
32325
- return self2[IS_EMPTY] ? "" : string;
32326
- }
32327
- let styler = self2[STYLER];
32328
- if (styler === undefined) {
32329
- return string;
32330
- }
32331
- const { openAll, closeAll } = styler;
32332
- if (string.includes("\x1B")) {
32333
- while (styler !== undefined) {
32334
- string = stringReplaceAll(string, styler.close, styler.open);
32335
- styler = styler.parent;
32336
- }
32337
- }
32338
- const lfIndex = string.indexOf(`
32339
- `);
32340
- if (lfIndex !== -1) {
32341
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
32342
- }
32343
- return openAll + string + closeAll;
32344
- };
32345
- Object.defineProperties(createChalk.prototype, styles2);
32346
- var chalk = createChalk();
32347
- var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
32348
- var source_default = chalk;
32349
-
32350
- // node_modules/ink/build/render.js
32351
- import { Stream } from "node:stream";
32352
- import process12 from "node:process";
32353
-
32354
- // node_modules/ink/build/ink.js
32355
- var import_react13 = __toESM(require_react(), 1);
32356
- import process11 from "node:process";
32357
-
32358
- // node_modules/es-toolkit/dist/function/debounce.mjs
32359
- function debounce(func, debounceMs, { signal, edges } = {}) {
32360
- let pendingThis = undefined;
32361
- let pendingArgs = null;
32362
- const leading = edges != null && edges.includes("leading");
32363
- const trailing = edges == null || edges.includes("trailing");
32364
- const invoke = () => {
32365
- if (pendingArgs !== null) {
32366
- func.apply(pendingThis, pendingArgs);
32367
- pendingThis = undefined;
32368
- pendingArgs = null;
32369
- }
32370
- };
32371
- const onTimerEnd = () => {
32372
- if (trailing) {
32373
- invoke();
32374
- }
32375
- cancel();
32376
- };
32377
- let timeoutId = null;
32378
- const schedule = () => {
32379
- if (timeoutId != null) {
32380
- clearTimeout(timeoutId);
32381
- }
32382
- timeoutId = setTimeout(() => {
32383
- timeoutId = null;
32384
- onTimerEnd();
32385
- }, debounceMs);
32386
- };
32387
- const cancelTimer = () => {
32388
- if (timeoutId !== null) {
32389
- clearTimeout(timeoutId);
32390
- timeoutId = null;
32391
- }
32392
- };
32393
- const cancel = () => {
32394
- cancelTimer();
32395
- pendingThis = undefined;
32396
- pendingArgs = null;
32397
- };
32398
- const flush = () => {
32399
- invoke();
32400
- };
32401
- const debounced = function(...args) {
32402
- if (signal?.aborted) {
32403
- return;
32404
- }
32405
- pendingThis = this;
32406
- pendingArgs = args;
32407
- const isFirstCall = timeoutId == null;
32408
- schedule();
32409
- if (leading && isFirstCall) {
32410
- invoke();
32450
+ if (typeof opts.noext === "boolean") {
32451
+ opts.noextglob = opts.noext;
32411
32452
  }
32412
- };
32413
- debounced.schedule = schedule;
32414
- debounced.cancel = cancel;
32415
- debounced.flush = flush;
32416
- signal?.addEventListener("abort", cancel, { once: true });
32417
- return debounced;
32418
- }
32419
-
32420
- // node_modules/es-toolkit/dist/compat/function/debounce.mjs
32421
- function debounce2(func, debounceMs = 0, options = {}) {
32422
- if (typeof options !== "object") {
32423
- options = {};
32424
- }
32425
- const { leading = false, trailing = true, maxWait } = options;
32426
- const edges = Array(2);
32427
- if (leading) {
32428
- edges[0] = "leading";
32429
- }
32430
- if (trailing) {
32431
- edges[1] = "trailing";
32432
- }
32433
- let result = undefined;
32434
- let pendingAt = null;
32435
- const _debounced = debounce(function(...args) {
32436
- result = func.apply(this, args);
32437
- pendingAt = null;
32438
- }, debounceMs, { edges });
32439
- const debounced = function(...args) {
32440
- if (maxWait != null) {
32441
- if (pendingAt === null) {
32442
- pendingAt = Date.now();
32453
+ const state = {
32454
+ input,
32455
+ index: -1,
32456
+ start: 0,
32457
+ dot: opts.dot === true,
32458
+ consumed: "",
32459
+ output: "",
32460
+ prefix: "",
32461
+ backtrack: false,
32462
+ negated: false,
32463
+ brackets: 0,
32464
+ braces: 0,
32465
+ parens: 0,
32466
+ quotes: 0,
32467
+ globstar: false,
32468
+ tokens
32469
+ };
32470
+ input = utils.removePrefix(input, state);
32471
+ len = input.length;
32472
+ const extglobs = [];
32473
+ const braces = [];
32474
+ const stack = [];
32475
+ let prev = bos;
32476
+ let value;
32477
+ const eos = () => state.index === len - 1;
32478
+ const peek = state.peek = (n = 1) => input[state.index + n];
32479
+ const advance = state.advance = () => input[++state.index] || "";
32480
+ const remaining = () => input.slice(state.index + 1);
32481
+ const consume = (value2 = "", num = 0) => {
32482
+ state.consumed += value2;
32483
+ state.index += num;
32484
+ };
32485
+ const append = (token) => {
32486
+ state.output += token.output != null ? token.output : token.value;
32487
+ consume(token.value);
32488
+ };
32489
+ const negate = () => {
32490
+ let count = 1;
32491
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
32492
+ advance();
32493
+ state.start++;
32494
+ count++;
32495
+ }
32496
+ if (count % 2 === 0) {
32497
+ return false;
32443
32498
  }
32444
- if (Date.now() - pendingAt >= maxWait) {
32445
- result = func.apply(this, args);
32446
- pendingAt = Date.now();
32447
- _debounced.cancel();
32448
- _debounced.schedule();
32449
- return result;
32499
+ state.negated = true;
32500
+ state.start++;
32501
+ return true;
32502
+ };
32503
+ const increment = (type) => {
32504
+ state[type]++;
32505
+ stack.push(type);
32506
+ };
32507
+ const decrement = (type) => {
32508
+ state[type]--;
32509
+ stack.pop();
32510
+ };
32511
+ const push = (tok) => {
32512
+ if (prev.type === "globstar") {
32513
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
32514
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
32515
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
32516
+ state.output = state.output.slice(0, -prev.output.length);
32517
+ prev.type = "star";
32518
+ prev.value = "*";
32519
+ prev.output = star;
32520
+ state.output += prev.output;
32521
+ }
32522
+ }
32523
+ if (extglobs.length && tok.type !== "paren") {
32524
+ extglobs[extglobs.length - 1].inner += tok.value;
32525
+ }
32526
+ if (tok.value || tok.output)
32527
+ append(tok);
32528
+ if (prev && prev.type === "text" && tok.type === "text") {
32529
+ prev.output = (prev.output || prev.value) + tok.value;
32530
+ prev.value += tok.value;
32531
+ return;
32532
+ }
32533
+ tok.prev = prev;
32534
+ tokens.push(tok);
32535
+ prev = tok;
32536
+ };
32537
+ const extglobOpen = (type, value2) => {
32538
+ const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
32539
+ token.prev = prev;
32540
+ token.parens = state.parens;
32541
+ token.output = state.output;
32542
+ const output = (opts.capture ? "(" : "") + token.open;
32543
+ increment("parens");
32544
+ push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
32545
+ push({ type: "paren", extglob: true, value: advance(), output });
32546
+ extglobs.push(token);
32547
+ };
32548
+ const extglobClose = (token) => {
32549
+ let output = token.close + (opts.capture ? ")" : "");
32550
+ let rest;
32551
+ if (token.type === "negate") {
32552
+ let extglobStar = star;
32553
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
32554
+ extglobStar = globstar(opts);
32555
+ }
32556
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
32557
+ output = token.close = `)$))${extglobStar}`;
32558
+ }
32559
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
32560
+ const expression = parse5(rest, { ...options, fastpaths: false }).output;
32561
+ output = token.close = `)${expression})${extglobStar})`;
32562
+ }
32563
+ if (token.prev.type === "bos") {
32564
+ state.negatedExtglob = true;
32565
+ }
32566
+ }
32567
+ push({ type: "paren", extglob: true, value, output });
32568
+ decrement("parens");
32569
+ };
32570
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
32571
+ let backslashes = false;
32572
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc2, chars, first, rest, index) => {
32573
+ if (first === "\\") {
32574
+ backslashes = true;
32575
+ return m;
32576
+ }
32577
+ if (first === "?") {
32578
+ if (esc2) {
32579
+ return esc2 + first + (rest ? QMARK.repeat(rest.length) : "");
32580
+ }
32581
+ if (index === 0) {
32582
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
32583
+ }
32584
+ return QMARK.repeat(chars.length);
32585
+ }
32586
+ if (first === ".") {
32587
+ return DOT_LITERAL.repeat(chars.length);
32588
+ }
32589
+ if (first === "*") {
32590
+ if (esc2) {
32591
+ return esc2 + first + (rest ? star : "");
32592
+ }
32593
+ return star;
32594
+ }
32595
+ return esc2 ? m : `\\${m}`;
32596
+ });
32597
+ if (backslashes === true) {
32598
+ if (opts.unescape === true) {
32599
+ output = output.replace(/\\/g, "");
32600
+ } else {
32601
+ output = output.replace(/\\+/g, (m) => {
32602
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
32603
+ });
32604
+ }
32450
32605
  }
32606
+ if (output === input && opts.contains === true) {
32607
+ state.output = input;
32608
+ return state;
32609
+ }
32610
+ state.output = utils.wrapOutput(output, state, options);
32611
+ return state;
32451
32612
  }
32452
- _debounced.apply(this, args);
32453
- return result;
32454
- };
32455
- const flush = () => {
32456
- _debounced.flush();
32457
- return result;
32458
- };
32459
- debounced.cancel = _debounced.cancel;
32460
- debounced.flush = flush;
32461
- return debounced;
32462
- }
32463
-
32464
- // node_modules/es-toolkit/dist/compat/function/throttle.mjs
32465
- function throttle(func, throttleMs = 0, options = {}) {
32466
- const { leading = true, trailing = true } = options;
32467
- return debounce2(func, throttleMs, {
32468
- leading,
32469
- maxWait: throttleMs,
32470
- trailing
32471
- });
32472
- }
32473
- // node_modules/ansi-escapes/base.js
32474
- var exports_base = {};
32475
- __export(exports_base, {
32476
- scrollUp: () => scrollUp,
32477
- scrollDown: () => scrollDown,
32478
- link: () => link,
32479
- image: () => image,
32480
- iTerm: () => iTerm,
32481
- exitAlternativeScreen: () => exitAlternativeScreen,
32482
- eraseUp: () => eraseUp,
32483
- eraseStartLine: () => eraseStartLine,
32484
- eraseScreen: () => eraseScreen,
32485
- eraseLines: () => eraseLines,
32486
- eraseLine: () => eraseLine,
32487
- eraseEndLine: () => eraseEndLine,
32488
- eraseDown: () => eraseDown,
32489
- enterAlternativeScreen: () => enterAlternativeScreen,
32490
- cursorUp: () => cursorUp,
32491
- cursorTo: () => cursorTo,
32492
- cursorShow: () => cursorShow,
32493
- cursorSavePosition: () => cursorSavePosition,
32494
- cursorRestorePosition: () => cursorRestorePosition,
32495
- cursorPrevLine: () => cursorPrevLine,
32496
- cursorNextLine: () => cursorNextLine,
32497
- cursorMove: () => cursorMove,
32498
- cursorLeft: () => cursorLeft,
32499
- cursorHide: () => cursorHide,
32500
- cursorGetPosition: () => cursorGetPosition,
32501
- cursorForward: () => cursorForward,
32502
- cursorDown: () => cursorDown,
32503
- cursorBackward: () => cursorBackward,
32504
- clearTerminal: () => clearTerminal,
32505
- clearScreen: () => clearScreen,
32506
- beep: () => beep
32507
- });
32508
- import process3 from "node:process";
32509
-
32510
- // node_modules/environment/index.js
32511
- var isBrowser = globalThis.window?.document !== undefined;
32512
- var isNode = globalThis.process?.versions?.node !== undefined;
32513
- var isBun = globalThis.process?.versions?.bun !== undefined;
32514
- var isDeno = globalThis.Deno?.version?.deno !== undefined;
32515
- var isElectron = globalThis.process?.versions?.electron !== undefined;
32516
- var isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
32517
- var isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
32518
- var isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
32519
- var isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
32520
- var isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
32521
- var platform = globalThis.navigator?.userAgentData?.platform;
32522
- var isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
32523
- var isWindows = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
32524
- var isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
32525
- var isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
32526
- var isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
32527
-
32528
- // node_modules/ansi-escapes/base.js
32613
+ while (!eos()) {
32614
+ value = advance();
32615
+ if (value === "\x00") {
32616
+ continue;
32617
+ }
32618
+ if (value === "\\") {
32619
+ const next = peek();
32620
+ if (next === "/" && opts.bash !== true) {
32621
+ continue;
32622
+ }
32623
+ if (next === "." || next === ";") {
32624
+ continue;
32625
+ }
32626
+ if (!next) {
32627
+ value += "\\";
32628
+ push({ type: "text", value });
32629
+ continue;
32630
+ }
32631
+ const match = /^\\+/.exec(remaining());
32632
+ let slashes = 0;
32633
+ if (match && match[0].length > 2) {
32634
+ slashes = match[0].length;
32635
+ state.index += slashes;
32636
+ if (slashes % 2 !== 0) {
32637
+ value += "\\";
32638
+ }
32639
+ }
32640
+ if (opts.unescape === true) {
32641
+ value = advance();
32642
+ } else {
32643
+ value += advance();
32644
+ }
32645
+ if (state.brackets === 0) {
32646
+ push({ type: "text", value });
32647
+ continue;
32648
+ }
32649
+ }
32650
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
32651
+ if (opts.posix !== false && value === ":") {
32652
+ const inner = prev.value.slice(1);
32653
+ if (inner.includes("[")) {
32654
+ prev.posix = true;
32655
+ if (inner.includes(":")) {
32656
+ const idx = prev.value.lastIndexOf("[");
32657
+ const pre = prev.value.slice(0, idx);
32658
+ const rest2 = prev.value.slice(idx + 2);
32659
+ const posix = POSIX_REGEX_SOURCE[rest2];
32660
+ if (posix) {
32661
+ prev.value = pre + posix;
32662
+ state.backtrack = true;
32663
+ advance();
32664
+ if (!bos.output && tokens.indexOf(prev) === 1) {
32665
+ bos.output = ONE_CHAR;
32666
+ }
32667
+ continue;
32668
+ }
32669
+ }
32670
+ }
32671
+ }
32672
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
32673
+ value = `\\${value}`;
32674
+ }
32675
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
32676
+ value = `\\${value}`;
32677
+ }
32678
+ if (opts.posix === true && value === "!" && prev.value === "[") {
32679
+ value = "^";
32680
+ }
32681
+ prev.value += value;
32682
+ append({ value });
32683
+ continue;
32684
+ }
32685
+ if (state.quotes === 1 && value !== '"') {
32686
+ value = utils.escapeRegex(value);
32687
+ prev.value += value;
32688
+ append({ value });
32689
+ continue;
32690
+ }
32691
+ if (value === '"') {
32692
+ state.quotes = state.quotes === 1 ? 0 : 1;
32693
+ if (opts.keepQuotes === true) {
32694
+ push({ type: "text", value });
32695
+ }
32696
+ continue;
32697
+ }
32698
+ if (value === "(") {
32699
+ increment("parens");
32700
+ push({ type: "paren", value });
32701
+ continue;
32702
+ }
32703
+ if (value === ")") {
32704
+ if (state.parens === 0 && opts.strictBrackets === true) {
32705
+ throw new SyntaxError(syntaxError("opening", "("));
32706
+ }
32707
+ const extglob = extglobs[extglobs.length - 1];
32708
+ if (extglob && state.parens === extglob.parens + 1) {
32709
+ extglobClose(extglobs.pop());
32710
+ continue;
32711
+ }
32712
+ push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
32713
+ decrement("parens");
32714
+ continue;
32715
+ }
32716
+ if (value === "[") {
32717
+ if (opts.nobracket === true || !remaining().includes("]")) {
32718
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
32719
+ throw new SyntaxError(syntaxError("closing", "]"));
32720
+ }
32721
+ value = `\\${value}`;
32722
+ } else {
32723
+ increment("brackets");
32724
+ }
32725
+ push({ type: "bracket", value });
32726
+ continue;
32727
+ }
32728
+ if (value === "]") {
32729
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
32730
+ push({ type: "text", value, output: `\\${value}` });
32731
+ continue;
32732
+ }
32733
+ if (state.brackets === 0) {
32734
+ if (opts.strictBrackets === true) {
32735
+ throw new SyntaxError(syntaxError("opening", "["));
32736
+ }
32737
+ push({ type: "text", value, output: `\\${value}` });
32738
+ continue;
32739
+ }
32740
+ decrement("brackets");
32741
+ const prevValue = prev.value.slice(1);
32742
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
32743
+ value = `/${value}`;
32744
+ }
32745
+ prev.value += value;
32746
+ append({ value });
32747
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
32748
+ continue;
32749
+ }
32750
+ const escaped = utils.escapeRegex(prev.value);
32751
+ state.output = state.output.slice(0, -prev.value.length);
32752
+ if (opts.literalBrackets === true) {
32753
+ state.output += escaped;
32754
+ prev.value = escaped;
32755
+ continue;
32756
+ }
32757
+ prev.value = `(${capture}${escaped}|${prev.value})`;
32758
+ state.output += prev.value;
32759
+ continue;
32760
+ }
32761
+ if (value === "{" && opts.nobrace !== true) {
32762
+ increment("braces");
32763
+ const open = {
32764
+ type: "brace",
32765
+ value,
32766
+ output: "(",
32767
+ outputIndex: state.output.length,
32768
+ tokensIndex: state.tokens.length
32769
+ };
32770
+ braces.push(open);
32771
+ push(open);
32772
+ continue;
32773
+ }
32774
+ if (value === "}") {
32775
+ const brace = braces[braces.length - 1];
32776
+ if (opts.nobrace === true || !brace) {
32777
+ push({ type: "text", value, output: value });
32778
+ continue;
32779
+ }
32780
+ let output = ")";
32781
+ if (brace.dots === true) {
32782
+ const arr = tokens.slice();
32783
+ const range = [];
32784
+ for (let i = arr.length - 1;i >= 0; i--) {
32785
+ tokens.pop();
32786
+ if (arr[i].type === "brace") {
32787
+ break;
32788
+ }
32789
+ if (arr[i].type !== "dots") {
32790
+ range.unshift(arr[i].value);
32791
+ }
32792
+ }
32793
+ output = expandRange(range, opts);
32794
+ state.backtrack = true;
32795
+ }
32796
+ if (brace.comma !== true && brace.dots !== true) {
32797
+ const out = state.output.slice(0, brace.outputIndex);
32798
+ const toks = state.tokens.slice(brace.tokensIndex);
32799
+ brace.value = brace.output = "\\{";
32800
+ value = output = "\\}";
32801
+ state.output = out;
32802
+ for (const t of toks) {
32803
+ state.output += t.output || t.value;
32804
+ }
32805
+ }
32806
+ push({ type: "brace", value, output });
32807
+ decrement("braces");
32808
+ braces.pop();
32809
+ continue;
32810
+ }
32811
+ if (value === "|") {
32812
+ if (extglobs.length > 0) {
32813
+ extglobs[extglobs.length - 1].conditions++;
32814
+ }
32815
+ push({ type: "text", value });
32816
+ continue;
32817
+ }
32818
+ if (value === ",") {
32819
+ let output = value;
32820
+ const brace = braces[braces.length - 1];
32821
+ if (brace && stack[stack.length - 1] === "braces") {
32822
+ brace.comma = true;
32823
+ output = "|";
32824
+ }
32825
+ push({ type: "comma", value, output });
32826
+ continue;
32827
+ }
32828
+ if (value === "/") {
32829
+ if (prev.type === "dot" && state.index === state.start + 1) {
32830
+ state.start = state.index + 1;
32831
+ state.consumed = "";
32832
+ state.output = "";
32833
+ tokens.pop();
32834
+ prev = bos;
32835
+ continue;
32836
+ }
32837
+ push({ type: "slash", value, output: SLASH_LITERAL });
32838
+ continue;
32839
+ }
32840
+ if (value === ".") {
32841
+ if (state.braces > 0 && prev.type === "dot") {
32842
+ if (prev.value === ".")
32843
+ prev.output = DOT_LITERAL;
32844
+ const brace = braces[braces.length - 1];
32845
+ prev.type = "dots";
32846
+ prev.output += value;
32847
+ prev.value += value;
32848
+ brace.dots = true;
32849
+ continue;
32850
+ }
32851
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
32852
+ push({ type: "text", value, output: DOT_LITERAL });
32853
+ continue;
32854
+ }
32855
+ push({ type: "dot", value, output: DOT_LITERAL });
32856
+ continue;
32857
+ }
32858
+ if (value === "?") {
32859
+ const isGroup = prev && prev.value === "(";
32860
+ if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
32861
+ extglobOpen("qmark", value);
32862
+ continue;
32863
+ }
32864
+ if (prev && prev.type === "paren") {
32865
+ const next = peek();
32866
+ let output = value;
32867
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
32868
+ output = `\\${value}`;
32869
+ }
32870
+ push({ type: "text", value, output });
32871
+ continue;
32872
+ }
32873
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
32874
+ push({ type: "qmark", value, output: QMARK_NO_DOT });
32875
+ continue;
32876
+ }
32877
+ push({ type: "qmark", value, output: QMARK });
32878
+ continue;
32879
+ }
32880
+ if (value === "!") {
32881
+ if (opts.noextglob !== true && peek() === "(") {
32882
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
32883
+ extglobOpen("negate", value);
32884
+ continue;
32885
+ }
32886
+ }
32887
+ if (opts.nonegate !== true && state.index === 0) {
32888
+ negate();
32889
+ continue;
32890
+ }
32891
+ }
32892
+ if (value === "+") {
32893
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
32894
+ extglobOpen("plus", value);
32895
+ continue;
32896
+ }
32897
+ if (prev && prev.value === "(" || opts.regex === false) {
32898
+ push({ type: "plus", value, output: PLUS_LITERAL });
32899
+ continue;
32900
+ }
32901
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
32902
+ push({ type: "plus", value });
32903
+ continue;
32904
+ }
32905
+ push({ type: "plus", value: PLUS_LITERAL });
32906
+ continue;
32907
+ }
32908
+ if (value === "@") {
32909
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
32910
+ push({ type: "at", extglob: true, value, output: "" });
32911
+ continue;
32912
+ }
32913
+ push({ type: "text", value });
32914
+ continue;
32915
+ }
32916
+ if (value !== "*") {
32917
+ if (value === "$" || value === "^") {
32918
+ value = `\\${value}`;
32919
+ }
32920
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
32921
+ if (match) {
32922
+ value += match[0];
32923
+ state.index += match[0].length;
32924
+ }
32925
+ push({ type: "text", value });
32926
+ continue;
32927
+ }
32928
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
32929
+ prev.type = "star";
32930
+ prev.star = true;
32931
+ prev.value += value;
32932
+ prev.output = star;
32933
+ state.backtrack = true;
32934
+ state.globstar = true;
32935
+ consume(value);
32936
+ continue;
32937
+ }
32938
+ let rest = remaining();
32939
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
32940
+ extglobOpen("star", value);
32941
+ continue;
32942
+ }
32943
+ if (prev.type === "star") {
32944
+ if (opts.noglobstar === true) {
32945
+ consume(value);
32946
+ continue;
32947
+ }
32948
+ const prior = prev.prev;
32949
+ const before = prior.prev;
32950
+ const isStart = prior.type === "slash" || prior.type === "bos";
32951
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
32952
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
32953
+ push({ type: "star", value, output: "" });
32954
+ continue;
32955
+ }
32956
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
32957
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
32958
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
32959
+ push({ type: "star", value, output: "" });
32960
+ continue;
32961
+ }
32962
+ while (rest.slice(0, 3) === "/**") {
32963
+ const after = input[state.index + 4];
32964
+ if (after && after !== "/") {
32965
+ break;
32966
+ }
32967
+ rest = rest.slice(3);
32968
+ consume("/**", 3);
32969
+ }
32970
+ if (prior.type === "bos" && eos()) {
32971
+ prev.type = "globstar";
32972
+ prev.value += value;
32973
+ prev.output = globstar(opts);
32974
+ state.output = prev.output;
32975
+ state.globstar = true;
32976
+ consume(value);
32977
+ continue;
32978
+ }
32979
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
32980
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
32981
+ prior.output = `(?:${prior.output}`;
32982
+ prev.type = "globstar";
32983
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
32984
+ prev.value += value;
32985
+ state.globstar = true;
32986
+ state.output += prior.output + prev.output;
32987
+ consume(value);
32988
+ continue;
32989
+ }
32990
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
32991
+ const end = rest[1] !== undefined ? "|$" : "";
32992
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
32993
+ prior.output = `(?:${prior.output}`;
32994
+ prev.type = "globstar";
32995
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
32996
+ prev.value += value;
32997
+ state.output += prior.output + prev.output;
32998
+ state.globstar = true;
32999
+ consume(value + advance());
33000
+ push({ type: "slash", value: "/", output: "" });
33001
+ continue;
33002
+ }
33003
+ if (prior.type === "bos" && rest[0] === "/") {
33004
+ prev.type = "globstar";
33005
+ prev.value += value;
33006
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
33007
+ state.output = prev.output;
33008
+ state.globstar = true;
33009
+ consume(value + advance());
33010
+ push({ type: "slash", value: "/", output: "" });
33011
+ continue;
33012
+ }
33013
+ state.output = state.output.slice(0, -prev.output.length);
33014
+ prev.type = "globstar";
33015
+ prev.output = globstar(opts);
33016
+ prev.value += value;
33017
+ state.output += prev.output;
33018
+ state.globstar = true;
33019
+ consume(value);
33020
+ continue;
33021
+ }
33022
+ const token = { type: "star", value, output: star };
33023
+ if (opts.bash === true) {
33024
+ token.output = ".*?";
33025
+ if (prev.type === "bos" || prev.type === "slash") {
33026
+ token.output = nodot + token.output;
33027
+ }
33028
+ push(token);
33029
+ continue;
33030
+ }
33031
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
33032
+ token.output = value;
33033
+ push(token);
33034
+ continue;
33035
+ }
33036
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
33037
+ if (prev.type === "dot") {
33038
+ state.output += NO_DOT_SLASH;
33039
+ prev.output += NO_DOT_SLASH;
33040
+ } else if (opts.dot === true) {
33041
+ state.output += NO_DOTS_SLASH;
33042
+ prev.output += NO_DOTS_SLASH;
33043
+ } else {
33044
+ state.output += nodot;
33045
+ prev.output += nodot;
33046
+ }
33047
+ if (peek() !== "*") {
33048
+ state.output += ONE_CHAR;
33049
+ prev.output += ONE_CHAR;
33050
+ }
33051
+ }
33052
+ push(token);
33053
+ }
33054
+ while (state.brackets > 0) {
33055
+ if (opts.strictBrackets === true)
33056
+ throw new SyntaxError(syntaxError("closing", "]"));
33057
+ state.output = utils.escapeLast(state.output, "[");
33058
+ decrement("brackets");
33059
+ }
33060
+ while (state.parens > 0) {
33061
+ if (opts.strictBrackets === true)
33062
+ throw new SyntaxError(syntaxError("closing", ")"));
33063
+ state.output = utils.escapeLast(state.output, "(");
33064
+ decrement("parens");
33065
+ }
33066
+ while (state.braces > 0) {
33067
+ if (opts.strictBrackets === true)
33068
+ throw new SyntaxError(syntaxError("closing", "}"));
33069
+ state.output = utils.escapeLast(state.output, "{");
33070
+ decrement("braces");
33071
+ }
33072
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
33073
+ push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
33074
+ }
33075
+ if (state.backtrack === true) {
33076
+ state.output = "";
33077
+ for (const token of state.tokens) {
33078
+ state.output += token.output != null ? token.output : token.value;
33079
+ if (token.suffix) {
33080
+ state.output += token.suffix;
33081
+ }
33082
+ }
33083
+ }
33084
+ return state;
33085
+ };
33086
+ parse5.fastpaths = (input, options) => {
33087
+ const opts = { ...options };
33088
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
33089
+ const len = input.length;
33090
+ if (len > max) {
33091
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
33092
+ }
33093
+ input = REPLACEMENTS[input] || input;
33094
+ const {
33095
+ DOT_LITERAL,
33096
+ SLASH_LITERAL,
33097
+ ONE_CHAR,
33098
+ DOTS_SLASH,
33099
+ NO_DOT,
33100
+ NO_DOTS,
33101
+ NO_DOTS_SLASH,
33102
+ STAR,
33103
+ START_ANCHOR
33104
+ } = constants2.globChars(opts.windows);
33105
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
33106
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
33107
+ const capture = opts.capture ? "" : "?:";
33108
+ const state = { negated: false, prefix: "" };
33109
+ let star = opts.bash === true ? ".*?" : STAR;
33110
+ if (opts.capture) {
33111
+ star = `(${star})`;
33112
+ }
33113
+ const globstar = (opts2) => {
33114
+ if (opts2.noglobstar === true)
33115
+ return star;
33116
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
33117
+ };
33118
+ const create2 = (str) => {
33119
+ switch (str) {
33120
+ case "*":
33121
+ return `${nodot}${ONE_CHAR}${star}`;
33122
+ case ".*":
33123
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
33124
+ case "*.*":
33125
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
33126
+ case "*/*":
33127
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
33128
+ case "**":
33129
+ return nodot + globstar(opts);
33130
+ case "**/*":
33131
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
33132
+ case "**/*.*":
33133
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
33134
+ case "**/.*":
33135
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
33136
+ default: {
33137
+ const match = /^(.*?)\.(\w+)$/.exec(str);
33138
+ if (!match)
33139
+ return;
33140
+ const source2 = create2(match[1]);
33141
+ if (!source2)
33142
+ return;
33143
+ return source2 + DOT_LITERAL + match[2];
33144
+ }
33145
+ }
33146
+ };
33147
+ const output = utils.removePrefix(input, state);
33148
+ let source = create2(output);
33149
+ if (source && opts.strictSlashes !== true) {
33150
+ source += `${SLASH_LITERAL}?`;
33151
+ }
33152
+ return source;
33153
+ };
33154
+ module.exports = parse5;
33155
+ });
33156
+
33157
+ // node_modules/picomatch/lib/picomatch.js
33158
+ var require_picomatch = __commonJS((exports, module) => {
33159
+ var scan = require_scan();
33160
+ var parse5 = require_parse();
33161
+ var utils = require_utils();
33162
+ var constants2 = require_constants3();
33163
+ var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val);
33164
+ var picomatch = (glob, options, returnState = false) => {
33165
+ if (Array.isArray(glob)) {
33166
+ const fns = glob.map((input) => picomatch(input, options, returnState));
33167
+ const arrayMatcher = (str) => {
33168
+ for (const isMatch of fns) {
33169
+ const state2 = isMatch(str);
33170
+ if (state2)
33171
+ return state2;
33172
+ }
33173
+ return false;
33174
+ };
33175
+ return arrayMatcher;
33176
+ }
33177
+ const isState = isObject2(glob) && glob.tokens && glob.input;
33178
+ if (glob === "" || typeof glob !== "string" && !isState) {
33179
+ throw new TypeError("Expected pattern to be a non-empty string");
33180
+ }
33181
+ const opts = options || {};
33182
+ const posix = opts.windows;
33183
+ const regex2 = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
33184
+ const state = regex2.state;
33185
+ delete regex2.state;
33186
+ let isIgnored = () => false;
33187
+ if (opts.ignore) {
33188
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
33189
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
33190
+ }
33191
+ const matcher = (input, returnObject = false) => {
33192
+ const { isMatch, match, output } = picomatch.test(input, regex2, options, { glob, posix });
33193
+ const result = { glob, state, regex: regex2, posix, input, output, match, isMatch };
33194
+ if (typeof opts.onResult === "function") {
33195
+ opts.onResult(result);
33196
+ }
33197
+ if (isMatch === false) {
33198
+ result.isMatch = false;
33199
+ return returnObject ? result : false;
33200
+ }
33201
+ if (isIgnored(input)) {
33202
+ if (typeof opts.onIgnore === "function") {
33203
+ opts.onIgnore(result);
33204
+ }
33205
+ result.isMatch = false;
33206
+ return returnObject ? result : false;
33207
+ }
33208
+ if (typeof opts.onMatch === "function") {
33209
+ opts.onMatch(result);
33210
+ }
33211
+ return returnObject ? result : true;
33212
+ };
33213
+ if (returnState) {
33214
+ matcher.state = state;
33215
+ }
33216
+ return matcher;
33217
+ };
33218
+ picomatch.test = (input, regex2, options, { glob, posix } = {}) => {
33219
+ if (typeof input !== "string") {
33220
+ throw new TypeError("Expected input to be a string");
33221
+ }
33222
+ if (input === "") {
33223
+ return { isMatch: false, output: "" };
33224
+ }
33225
+ const opts = options || {};
33226
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
33227
+ let match = input === glob;
33228
+ let output = match && format ? format(input) : input;
33229
+ if (match === false) {
33230
+ output = format ? format(input) : input;
33231
+ match = output === glob;
33232
+ }
33233
+ if (match === false || opts.capture === true) {
33234
+ if (opts.matchBase === true || opts.basename === true) {
33235
+ match = picomatch.matchBase(input, regex2, options, posix);
33236
+ } else {
33237
+ match = regex2.exec(output);
33238
+ }
33239
+ }
33240
+ return { isMatch: Boolean(match), match, output };
33241
+ };
33242
+ picomatch.matchBase = (input, glob, options) => {
33243
+ const regex2 = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
33244
+ return regex2.test(utils.basename(input));
33245
+ };
33246
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
33247
+ picomatch.parse = (pattern, options) => {
33248
+ if (Array.isArray(pattern))
33249
+ return pattern.map((p) => picomatch.parse(p, options));
33250
+ return parse5(pattern, { ...options, fastpaths: false });
33251
+ };
33252
+ picomatch.scan = (input, options) => scan(input, options);
33253
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
33254
+ if (returnOutput === true) {
33255
+ return state.output;
33256
+ }
33257
+ const opts = options || {};
33258
+ const prepend = opts.contains ? "" : "^";
33259
+ const append = opts.contains ? "" : "$";
33260
+ let source = `${prepend}(?:${state.output})${append}`;
33261
+ if (state && state.negated === true) {
33262
+ source = `^(?!${source}).*$`;
33263
+ }
33264
+ const regex2 = picomatch.toRegex(source, options);
33265
+ if (returnState === true) {
33266
+ regex2.state = state;
33267
+ }
33268
+ return regex2;
33269
+ };
33270
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
33271
+ if (!input || typeof input !== "string") {
33272
+ throw new TypeError("Expected a non-empty string");
33273
+ }
33274
+ let parsed = { negated: false, fastpaths: true };
33275
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
33276
+ parsed.output = parse5.fastpaths(input, options);
33277
+ }
33278
+ if (!parsed.output) {
33279
+ parsed = parse5(input, options);
33280
+ }
33281
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
33282
+ };
33283
+ picomatch.toRegex = (source, options) => {
33284
+ try {
33285
+ const opts = options || {};
33286
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
33287
+ } catch (err) {
33288
+ if (options && options.debug === true)
33289
+ throw err;
33290
+ return /$^/;
33291
+ }
33292
+ };
33293
+ picomatch.constants = constants2;
33294
+ module.exports = picomatch;
33295
+ });
33296
+
33297
+ // node_modules/picomatch/index.js
33298
+ var require_picomatch2 = __commonJS((exports, module) => {
33299
+ var pico = require_picomatch();
33300
+ var utils = require_utils();
33301
+ function picomatch(glob, options, returnState = false) {
33302
+ if (options && (options.windows === null || options.windows === undefined)) {
33303
+ options = { ...options, windows: utils.isWindows() };
33304
+ }
33305
+ return pico(glob, options, returnState);
33306
+ }
33307
+ Object.assign(picomatch, pico);
33308
+ module.exports = picomatch;
33309
+ });
33310
+
33311
+ // node_modules/chalk/source/vendor/ansi-styles/index.js
33312
+ var ANSI_BACKGROUND_OFFSET = 10;
33313
+ var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
33314
+ var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
33315
+ var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
33316
+ var styles = {
33317
+ modifier: {
33318
+ reset: [0, 0],
33319
+ bold: [1, 22],
33320
+ dim: [2, 22],
33321
+ italic: [3, 23],
33322
+ underline: [4, 24],
33323
+ overline: [53, 55],
33324
+ inverse: [7, 27],
33325
+ hidden: [8, 28],
33326
+ strikethrough: [9, 29]
33327
+ },
33328
+ color: {
33329
+ black: [30, 39],
33330
+ red: [31, 39],
33331
+ green: [32, 39],
33332
+ yellow: [33, 39],
33333
+ blue: [34, 39],
33334
+ magenta: [35, 39],
33335
+ cyan: [36, 39],
33336
+ white: [37, 39],
33337
+ blackBright: [90, 39],
33338
+ gray: [90, 39],
33339
+ grey: [90, 39],
33340
+ redBright: [91, 39],
33341
+ greenBright: [92, 39],
33342
+ yellowBright: [93, 39],
33343
+ blueBright: [94, 39],
33344
+ magentaBright: [95, 39],
33345
+ cyanBright: [96, 39],
33346
+ whiteBright: [97, 39]
33347
+ },
33348
+ bgColor: {
33349
+ bgBlack: [40, 49],
33350
+ bgRed: [41, 49],
33351
+ bgGreen: [42, 49],
33352
+ bgYellow: [43, 49],
33353
+ bgBlue: [44, 49],
33354
+ bgMagenta: [45, 49],
33355
+ bgCyan: [46, 49],
33356
+ bgWhite: [47, 49],
33357
+ bgBlackBright: [100, 49],
33358
+ bgGray: [100, 49],
33359
+ bgGrey: [100, 49],
33360
+ bgRedBright: [101, 49],
33361
+ bgGreenBright: [102, 49],
33362
+ bgYellowBright: [103, 49],
33363
+ bgBlueBright: [104, 49],
33364
+ bgMagentaBright: [105, 49],
33365
+ bgCyanBright: [106, 49],
33366
+ bgWhiteBright: [107, 49]
33367
+ }
33368
+ };
33369
+ var modifierNames = Object.keys(styles.modifier);
33370
+ var foregroundColorNames = Object.keys(styles.color);
33371
+ var backgroundColorNames = Object.keys(styles.bgColor);
33372
+ var colorNames = [...foregroundColorNames, ...backgroundColorNames];
33373
+ function assembleStyles() {
33374
+ const codes = new Map;
33375
+ for (const [groupName, group] of Object.entries(styles)) {
33376
+ for (const [styleName, style] of Object.entries(group)) {
33377
+ styles[styleName] = {
33378
+ open: `\x1B[${style[0]}m`,
33379
+ close: `\x1B[${style[1]}m`
33380
+ };
33381
+ group[styleName] = styles[styleName];
33382
+ codes.set(style[0], style[1]);
33383
+ }
33384
+ Object.defineProperty(styles, groupName, {
33385
+ value: group,
33386
+ enumerable: false
33387
+ });
33388
+ }
33389
+ Object.defineProperty(styles, "codes", {
33390
+ value: codes,
33391
+ enumerable: false
33392
+ });
33393
+ styles.color.close = "\x1B[39m";
33394
+ styles.bgColor.close = "\x1B[49m";
33395
+ styles.color.ansi = wrapAnsi16();
33396
+ styles.color.ansi256 = wrapAnsi256();
33397
+ styles.color.ansi16m = wrapAnsi16m();
33398
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
33399
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
33400
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
33401
+ Object.defineProperties(styles, {
33402
+ rgbToAnsi256: {
33403
+ value(red, green, blue) {
33404
+ if (red === green && green === blue) {
33405
+ if (red < 8) {
33406
+ return 16;
33407
+ }
33408
+ if (red > 248) {
33409
+ return 231;
33410
+ }
33411
+ return Math.round((red - 8) / 247 * 24) + 232;
33412
+ }
33413
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
33414
+ },
33415
+ enumerable: false
33416
+ },
33417
+ hexToRgb: {
33418
+ value(hex) {
33419
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
33420
+ if (!matches) {
33421
+ return [0, 0, 0];
33422
+ }
33423
+ let [colorString] = matches;
33424
+ if (colorString.length === 3) {
33425
+ colorString = [...colorString].map((character) => character + character).join("");
33426
+ }
33427
+ const integer = Number.parseInt(colorString, 16);
33428
+ return [
33429
+ integer >> 16 & 255,
33430
+ integer >> 8 & 255,
33431
+ integer & 255
33432
+ ];
33433
+ },
33434
+ enumerable: false
33435
+ },
33436
+ hexToAnsi256: {
33437
+ value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
33438
+ enumerable: false
33439
+ },
33440
+ ansi256ToAnsi: {
33441
+ value(code) {
33442
+ if (code < 8) {
33443
+ return 30 + code;
33444
+ }
33445
+ if (code < 16) {
33446
+ return 90 + (code - 8);
33447
+ }
33448
+ let red;
33449
+ let green;
33450
+ let blue;
33451
+ if (code >= 232) {
33452
+ red = ((code - 232) * 10 + 8) / 255;
33453
+ green = red;
33454
+ blue = red;
33455
+ } else {
33456
+ code -= 16;
33457
+ const remainder = code % 36;
33458
+ red = Math.floor(code / 36) / 5;
33459
+ green = Math.floor(remainder / 6) / 5;
33460
+ blue = remainder % 6 / 5;
33461
+ }
33462
+ const value = Math.max(red, green, blue) * 2;
33463
+ if (value === 0) {
33464
+ return 30;
33465
+ }
33466
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
33467
+ if (value === 2) {
33468
+ result += 60;
33469
+ }
33470
+ return result;
33471
+ },
33472
+ enumerable: false
33473
+ },
33474
+ rgbToAnsi: {
33475
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
33476
+ enumerable: false
33477
+ },
33478
+ hexToAnsi: {
33479
+ value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
33480
+ enumerable: false
33481
+ }
33482
+ });
33483
+ return styles;
33484
+ }
33485
+ var ansiStyles = assembleStyles();
33486
+ var ansi_styles_default = ansiStyles;
33487
+
33488
+ // node_modules/chalk/source/vendor/supports-color/index.js
33489
+ import process2 from "node:process";
33490
+ import os from "node:os";
33491
+ import tty from "node:tty";
33492
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
33493
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
33494
+ const position = argv.indexOf(prefix + flag);
33495
+ const terminatorPosition = argv.indexOf("--");
33496
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
33497
+ }
33498
+ var { env } = process2;
33499
+ var flagForceColor;
33500
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
33501
+ flagForceColor = 0;
33502
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
33503
+ flagForceColor = 1;
33504
+ }
33505
+ function envForceColor() {
33506
+ if ("FORCE_COLOR" in env) {
33507
+ if (env.FORCE_COLOR === "true") {
33508
+ return 1;
33509
+ }
33510
+ if (env.FORCE_COLOR === "false") {
33511
+ return 0;
33512
+ }
33513
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
33514
+ }
33515
+ }
33516
+ function translateLevel(level) {
33517
+ if (level === 0) {
33518
+ return false;
33519
+ }
33520
+ return {
33521
+ level,
33522
+ hasBasic: true,
33523
+ has256: level >= 2,
33524
+ has16m: level >= 3
33525
+ };
33526
+ }
33527
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
33528
+ const noFlagForceColor = envForceColor();
33529
+ if (noFlagForceColor !== undefined) {
33530
+ flagForceColor = noFlagForceColor;
33531
+ }
33532
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
33533
+ if (forceColor === 0) {
33534
+ return 0;
33535
+ }
33536
+ if (sniffFlags) {
33537
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
33538
+ return 3;
33539
+ }
33540
+ if (hasFlag("color=256")) {
33541
+ return 2;
33542
+ }
33543
+ }
33544
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
33545
+ return 1;
33546
+ }
33547
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
33548
+ return 0;
33549
+ }
33550
+ const min = forceColor || 0;
33551
+ if (env.TERM === "dumb") {
33552
+ return min;
33553
+ }
33554
+ if (process2.platform === "win32") {
33555
+ const osRelease = os.release().split(".");
33556
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
33557
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
33558
+ }
33559
+ return 1;
33560
+ }
33561
+ if ("CI" in env) {
33562
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env))) {
33563
+ return 3;
33564
+ }
33565
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
33566
+ return 1;
33567
+ }
33568
+ return min;
33569
+ }
33570
+ if ("TEAMCITY_VERSION" in env) {
33571
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
33572
+ }
33573
+ if (env.COLORTERM === "truecolor") {
33574
+ return 3;
33575
+ }
33576
+ if (env.TERM === "xterm-kitty") {
33577
+ return 3;
33578
+ }
33579
+ if (env.TERM === "xterm-ghostty") {
33580
+ return 3;
33581
+ }
33582
+ if ("TERM_PROGRAM" in env) {
33583
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
33584
+ switch (env.TERM_PROGRAM) {
33585
+ case "iTerm.app": {
33586
+ return version >= 3 ? 3 : 2;
33587
+ }
33588
+ case "Apple_Terminal": {
33589
+ return 2;
33590
+ }
33591
+ }
33592
+ }
33593
+ if (/-256(color)?$/i.test(env.TERM)) {
33594
+ return 2;
33595
+ }
33596
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
33597
+ return 1;
33598
+ }
33599
+ if ("COLORTERM" in env) {
33600
+ return 1;
33601
+ }
33602
+ return min;
33603
+ }
33604
+ function createSupportsColor(stream, options = {}) {
33605
+ const level = _supportsColor(stream, {
33606
+ streamIsTTY: stream && stream.isTTY,
33607
+ ...options
33608
+ });
33609
+ return translateLevel(level);
33610
+ }
33611
+ var supportsColor = {
33612
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
33613
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
33614
+ };
33615
+ var supports_color_default = supportsColor;
33616
+
33617
+ // node_modules/chalk/source/utilities.js
33618
+ function stringReplaceAll(string, substring, replacer) {
33619
+ let index = string.indexOf(substring);
33620
+ if (index === -1) {
33621
+ return string;
33622
+ }
33623
+ const substringLength = substring.length;
33624
+ let endIndex = 0;
33625
+ let returnValue = "";
33626
+ do {
33627
+ returnValue += string.slice(endIndex, index) + substring + replacer;
33628
+ endIndex = index + substringLength;
33629
+ index = string.indexOf(substring, endIndex);
33630
+ } while (index !== -1);
33631
+ returnValue += string.slice(endIndex);
33632
+ return returnValue;
33633
+ }
33634
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
33635
+ let endIndex = 0;
33636
+ let returnValue = "";
33637
+ do {
33638
+ const gotCR = string[index - 1] === "\r";
33639
+ returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
33640
+ ` : `
33641
+ `) + postfix;
33642
+ endIndex = index + 1;
33643
+ index = string.indexOf(`
33644
+ `, endIndex);
33645
+ } while (index !== -1);
33646
+ returnValue += string.slice(endIndex);
33647
+ return returnValue;
33648
+ }
33649
+
33650
+ // node_modules/chalk/source/index.js
33651
+ var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
33652
+ var GENERATOR = Symbol("GENERATOR");
33653
+ var STYLER = Symbol("STYLER");
33654
+ var IS_EMPTY = Symbol("IS_EMPTY");
33655
+ var levelMapping = [
33656
+ "ansi",
33657
+ "ansi",
33658
+ "ansi256",
33659
+ "ansi16m"
33660
+ ];
33661
+ var styles2 = Object.create(null);
33662
+ var applyOptions = (object, options = {}) => {
33663
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
33664
+ throw new Error("The `level` option should be an integer from 0 to 3");
33665
+ }
33666
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
33667
+ object.level = options.level === undefined ? colorLevel : options.level;
33668
+ };
33669
+ var chalkFactory = (options) => {
33670
+ const chalk = (...strings) => strings.join(" ");
33671
+ applyOptions(chalk, options);
33672
+ Object.setPrototypeOf(chalk, createChalk.prototype);
33673
+ return chalk;
33674
+ };
33675
+ function createChalk(options) {
33676
+ return chalkFactory(options);
33677
+ }
33678
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
33679
+ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
33680
+ styles2[styleName] = {
33681
+ get() {
33682
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
33683
+ Object.defineProperty(this, styleName, { value: builder });
33684
+ return builder;
33685
+ }
33686
+ };
33687
+ }
33688
+ styles2.visible = {
33689
+ get() {
33690
+ const builder = createBuilder(this, this[STYLER], true);
33691
+ Object.defineProperty(this, "visible", { value: builder });
33692
+ return builder;
33693
+ }
33694
+ };
33695
+ var getModelAnsi = (model, level, type, ...arguments_) => {
33696
+ if (model === "rgb") {
33697
+ if (level === "ansi16m") {
33698
+ return ansi_styles_default[type].ansi16m(...arguments_);
33699
+ }
33700
+ if (level === "ansi256") {
33701
+ return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
33702
+ }
33703
+ return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
33704
+ }
33705
+ if (model === "hex") {
33706
+ return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
33707
+ }
33708
+ return ansi_styles_default[type][model](...arguments_);
33709
+ };
33710
+ var usedModels = ["rgb", "hex", "ansi256"];
33711
+ for (const model of usedModels) {
33712
+ styles2[model] = {
33713
+ get() {
33714
+ const { level } = this;
33715
+ return function(...arguments_) {
33716
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
33717
+ return createBuilder(this, styler, this[IS_EMPTY]);
33718
+ };
33719
+ }
33720
+ };
33721
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
33722
+ styles2[bgModel] = {
33723
+ get() {
33724
+ const { level } = this;
33725
+ return function(...arguments_) {
33726
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
33727
+ return createBuilder(this, styler, this[IS_EMPTY]);
33728
+ };
33729
+ }
33730
+ };
33731
+ }
33732
+ var proto = Object.defineProperties(() => {}, {
33733
+ ...styles2,
33734
+ level: {
33735
+ enumerable: true,
33736
+ get() {
33737
+ return this[GENERATOR].level;
33738
+ },
33739
+ set(level) {
33740
+ this[GENERATOR].level = level;
33741
+ }
33742
+ }
33743
+ });
33744
+ var createStyler = (open, close, parent) => {
33745
+ let openAll;
33746
+ let closeAll;
33747
+ if (parent === undefined) {
33748
+ openAll = open;
33749
+ closeAll = close;
33750
+ } else {
33751
+ openAll = parent.openAll + open;
33752
+ closeAll = close + parent.closeAll;
33753
+ }
33754
+ return {
33755
+ open,
33756
+ close,
33757
+ openAll,
33758
+ closeAll,
33759
+ parent
33760
+ };
33761
+ };
33762
+ var createBuilder = (self2, _styler, _isEmpty) => {
33763
+ const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
33764
+ Object.setPrototypeOf(builder, proto);
33765
+ builder[GENERATOR] = self2;
33766
+ builder[STYLER] = _styler;
33767
+ builder[IS_EMPTY] = _isEmpty;
33768
+ return builder;
33769
+ };
33770
+ var applyStyle = (self2, string) => {
33771
+ if (self2.level <= 0 || !string) {
33772
+ return self2[IS_EMPTY] ? "" : string;
33773
+ }
33774
+ let styler = self2[STYLER];
33775
+ if (styler === undefined) {
33776
+ return string;
33777
+ }
33778
+ const { openAll, closeAll } = styler;
33779
+ if (string.includes("\x1B")) {
33780
+ while (styler !== undefined) {
33781
+ string = stringReplaceAll(string, styler.close, styler.open);
33782
+ styler = styler.parent;
33783
+ }
33784
+ }
33785
+ const lfIndex = string.indexOf(`
33786
+ `);
33787
+ if (lfIndex !== -1) {
33788
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
33789
+ }
33790
+ return openAll + string + closeAll;
33791
+ };
33792
+ Object.defineProperties(createChalk.prototype, styles2);
33793
+ var chalk = createChalk();
33794
+ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
33795
+ var source_default = chalk;
33796
+
33797
+ // node_modules/ink/build/render.js
33798
+ import { Stream } from "node:stream";
33799
+ import process12 from "node:process";
33800
+
33801
+ // node_modules/ink/build/ink.js
33802
+ var import_react13 = __toESM(require_react(), 1);
33803
+ import process11 from "node:process";
33804
+
33805
+ // node_modules/es-toolkit/dist/function/debounce.mjs
33806
+ function debounce(func, debounceMs, { signal, edges } = {}) {
33807
+ let pendingThis = undefined;
33808
+ let pendingArgs = null;
33809
+ const leading = edges != null && edges.includes("leading");
33810
+ const trailing = edges == null || edges.includes("trailing");
33811
+ const invoke = () => {
33812
+ if (pendingArgs !== null) {
33813
+ func.apply(pendingThis, pendingArgs);
33814
+ pendingThis = undefined;
33815
+ pendingArgs = null;
33816
+ }
33817
+ };
33818
+ const onTimerEnd = () => {
33819
+ if (trailing) {
33820
+ invoke();
33821
+ }
33822
+ cancel();
33823
+ };
33824
+ let timeoutId = null;
33825
+ const schedule = () => {
33826
+ if (timeoutId != null) {
33827
+ clearTimeout(timeoutId);
33828
+ }
33829
+ timeoutId = setTimeout(() => {
33830
+ timeoutId = null;
33831
+ onTimerEnd();
33832
+ }, debounceMs);
33833
+ };
33834
+ const cancelTimer = () => {
33835
+ if (timeoutId !== null) {
33836
+ clearTimeout(timeoutId);
33837
+ timeoutId = null;
33838
+ }
33839
+ };
33840
+ const cancel = () => {
33841
+ cancelTimer();
33842
+ pendingThis = undefined;
33843
+ pendingArgs = null;
33844
+ };
33845
+ const flush = () => {
33846
+ invoke();
33847
+ };
33848
+ const debounced = function(...args) {
33849
+ if (signal?.aborted) {
33850
+ return;
33851
+ }
33852
+ pendingThis = this;
33853
+ pendingArgs = args;
33854
+ const isFirstCall = timeoutId == null;
33855
+ schedule();
33856
+ if (leading && isFirstCall) {
33857
+ invoke();
33858
+ }
33859
+ };
33860
+ debounced.schedule = schedule;
33861
+ debounced.cancel = cancel;
33862
+ debounced.flush = flush;
33863
+ signal?.addEventListener("abort", cancel, { once: true });
33864
+ return debounced;
33865
+ }
33866
+
33867
+ // node_modules/es-toolkit/dist/compat/function/debounce.mjs
33868
+ function debounce2(func, debounceMs = 0, options = {}) {
33869
+ if (typeof options !== "object") {
33870
+ options = {};
33871
+ }
33872
+ const { leading = false, trailing = true, maxWait } = options;
33873
+ const edges = Array(2);
33874
+ if (leading) {
33875
+ edges[0] = "leading";
33876
+ }
33877
+ if (trailing) {
33878
+ edges[1] = "trailing";
33879
+ }
33880
+ let result = undefined;
33881
+ let pendingAt = null;
33882
+ const _debounced = debounce(function(...args) {
33883
+ result = func.apply(this, args);
33884
+ pendingAt = null;
33885
+ }, debounceMs, { edges });
33886
+ const debounced = function(...args) {
33887
+ if (maxWait != null) {
33888
+ if (pendingAt === null) {
33889
+ pendingAt = Date.now();
33890
+ }
33891
+ if (Date.now() - pendingAt >= maxWait) {
33892
+ result = func.apply(this, args);
33893
+ pendingAt = Date.now();
33894
+ _debounced.cancel();
33895
+ _debounced.schedule();
33896
+ return result;
33897
+ }
33898
+ }
33899
+ _debounced.apply(this, args);
33900
+ return result;
33901
+ };
33902
+ const flush = () => {
33903
+ _debounced.flush();
33904
+ return result;
33905
+ };
33906
+ debounced.cancel = _debounced.cancel;
33907
+ debounced.flush = flush;
33908
+ return debounced;
33909
+ }
33910
+
33911
+ // node_modules/es-toolkit/dist/compat/function/throttle.mjs
33912
+ function throttle(func, throttleMs = 0, options = {}) {
33913
+ const { leading = true, trailing = true } = options;
33914
+ return debounce2(func, throttleMs, {
33915
+ leading,
33916
+ maxWait: throttleMs,
33917
+ trailing
33918
+ });
33919
+ }
33920
+ // node_modules/ansi-escapes/base.js
33921
+ var exports_base = {};
33922
+ __export(exports_base, {
33923
+ scrollUp: () => scrollUp,
33924
+ scrollDown: () => scrollDown,
33925
+ link: () => link,
33926
+ image: () => image,
33927
+ iTerm: () => iTerm,
33928
+ exitAlternativeScreen: () => exitAlternativeScreen,
33929
+ eraseUp: () => eraseUp,
33930
+ eraseStartLine: () => eraseStartLine,
33931
+ eraseScreen: () => eraseScreen,
33932
+ eraseLines: () => eraseLines,
33933
+ eraseLine: () => eraseLine,
33934
+ eraseEndLine: () => eraseEndLine,
33935
+ eraseDown: () => eraseDown,
33936
+ enterAlternativeScreen: () => enterAlternativeScreen,
33937
+ cursorUp: () => cursorUp,
33938
+ cursorTo: () => cursorTo,
33939
+ cursorShow: () => cursorShow,
33940
+ cursorSavePosition: () => cursorSavePosition,
33941
+ cursorRestorePosition: () => cursorRestorePosition,
33942
+ cursorPrevLine: () => cursorPrevLine,
33943
+ cursorNextLine: () => cursorNextLine,
33944
+ cursorMove: () => cursorMove,
33945
+ cursorLeft: () => cursorLeft,
33946
+ cursorHide: () => cursorHide,
33947
+ cursorGetPosition: () => cursorGetPosition,
33948
+ cursorForward: () => cursorForward,
33949
+ cursorDown: () => cursorDown,
33950
+ cursorBackward: () => cursorBackward,
33951
+ clearTerminal: () => clearTerminal,
33952
+ clearScreen: () => clearScreen,
33953
+ beep: () => beep
33954
+ });
33955
+ import process3 from "node:process";
33956
+
33957
+ // node_modules/environment/index.js
33958
+ var isBrowser = globalThis.window?.document !== undefined;
33959
+ var isNode = globalThis.process?.versions?.node !== undefined;
33960
+ var isBun = globalThis.process?.versions?.bun !== undefined;
33961
+ var isDeno = globalThis.Deno?.version?.deno !== undefined;
33962
+ var isElectron = globalThis.process?.versions?.electron !== undefined;
33963
+ var isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
33964
+ var isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
33965
+ var isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
33966
+ var isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
33967
+ var isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
33968
+ var platform = globalThis.navigator?.userAgentData?.platform;
33969
+ var isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
33970
+ var isWindows = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
33971
+ var isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
33972
+ var isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
33973
+ var isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
33974
+
33975
+ // node_modules/ansi-escapes/base.js
32529
33976
  var ESC = "\x1B[";
32530
33977
  var OSC = "\x1B]";
32531
33978
  var BEL = "\x07";
@@ -49105,11 +50552,12 @@ var WidgetItemSchema = exports_external.object({
49105
50552
  maxWidth: exports_external.number().optional(),
49106
50553
  preserveColors: exports_external.boolean().optional(),
49107
50554
  timeout: exports_external.number().optional(),
49108
- merge: exports_external.union([exports_external.boolean(), exports_external.literal("no-padding")]).optional()
50555
+ merge: exports_external.union([exports_external.boolean(), exports_external.literal("no-padding")]).optional(),
50556
+ metadata: exports_external.record(exports_external.string(), exports_external.string()).optional()
49109
50557
  });
49110
50558
 
49111
50559
  // src/types/Settings.ts
49112
- var CURRENT_VERSION = 2;
50560
+ var CURRENT_VERSION = 3;
49113
50561
  var SettingsSchema_v1 = exports_external.object({
49114
50562
  lines: exports_external.array(exports_external.array(WidgetItemSchema)).optional(),
49115
50563
  flexMode: FlexModeSchema.optional(),
@@ -49232,6 +50680,20 @@ var migrations = [
49232
50680
  };
49233
50681
  return migrated;
49234
50682
  }
50683
+ },
50684
+ {
50685
+ fromVersion: 2,
50686
+ toVersion: 3,
50687
+ description: "Migrate from v2 to v3",
50688
+ migrate: (data) => {
50689
+ const migrated = { ...data };
50690
+ migrated.version = 3;
50691
+ migrated.updatemessage = {
50692
+ message: "ccstatusline updated to v2.0.2, 5hr block timer widget added",
50693
+ remaining: 12
50694
+ };
50695
+ return migrated;
50696
+ }
49235
50697
  }
49236
50698
  ];
49237
50699
  function detectVersion(data) {
@@ -49573,7 +51035,7 @@ import { execSync as execSync3 } from "child_process";
49573
51035
  import * as fs5 from "fs";
49574
51036
  import * as path4 from "path";
49575
51037
  var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils";
49576
- var PACKAGE_VERSION = "2.0.1";
51038
+ var PACKAGE_VERSION = "2.0.3";
49577
51039
  function getPackageVersion() {
49578
51040
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
49579
51041
  return PACKAGE_VERSION;
@@ -50407,6 +51869,9 @@ class ModelWidget {
50407
51869
  getDefaultColor() {
50408
51870
  return "cyan";
50409
51871
  }
51872
+ getDescription() {
51873
+ return "Displays the Claude model name (e.g., Claude 3.5 Sonnet)";
51874
+ }
50410
51875
  getDisplayName() {
50411
51876
  return "Model";
50412
51877
  }
@@ -50433,6 +51898,9 @@ class OutputStyleWidget {
50433
51898
  getDefaultColor() {
50434
51899
  return "cyan";
50435
51900
  }
51901
+ getDescription() {
51902
+ return "Shows the current Claude Code output style";
51903
+ }
50436
51904
  getDisplayName() {
50437
51905
  return "Output Style";
50438
51906
  }
@@ -50461,6 +51929,9 @@ class GitBranchWidget {
50461
51929
  getDefaultColor() {
50462
51930
  return "magenta";
50463
51931
  }
51932
+ getDescription() {
51933
+ return "Shows the current git branch name";
51934
+ }
50464
51935
  getDisplayName() {
50465
51936
  return "Git Branch";
50466
51937
  }
@@ -50501,6 +51972,9 @@ class GitChangesWidget {
50501
51972
  getDefaultColor() {
50502
51973
  return "yellow";
50503
51974
  }
51975
+ getDescription() {
51976
+ return "Shows git changes count (+insertions, -deletions)";
51977
+ }
50504
51978
  getDisplayName() {
50505
51979
  return "Git Changes";
50506
51980
  }
@@ -50554,10 +52028,7 @@ class GitChangesWidget {
50554
52028
  }
50555
52029
  }
50556
52030
  // src/utils/renderer.ts
50557
- import * as fs6 from "fs";
50558
- import { promisify } from "util";
50559
52031
  var ANSI_REGEX = new RegExp(`\\x1b\\[[0-9;]*m`, "g");
50560
- var readFile4 = promisify(fs6.readFile);
50561
52032
  function formatTokens(count) {
50562
52033
  if (count >= 1e6)
50563
52034
  return `${(count / 1e6).toFixed(1)}M`;
@@ -50565,100 +52036,6 @@ function formatTokens(count) {
50565
52036
  return `${(count / 1000).toFixed(1)}k`;
50566
52037
  return count.toString();
50567
52038
  }
50568
- async function getSessionDuration(transcriptPath) {
50569
- try {
50570
- if (!fs6.existsSync(transcriptPath)) {
50571
- return null;
50572
- }
50573
- const content = await readFile4(transcriptPath, "utf-8");
50574
- const lines = content.trim().split(`
50575
- `).filter((line) => line.trim());
50576
- if (lines.length === 0) {
50577
- return null;
50578
- }
50579
- let firstTimestamp = null;
50580
- let lastTimestamp = null;
50581
- for (const line of lines) {
50582
- try {
50583
- const data = JSON.parse(line);
50584
- if (data.timestamp) {
50585
- firstTimestamp = new Date(data.timestamp);
50586
- break;
50587
- }
50588
- } catch {}
50589
- }
50590
- for (let i = lines.length - 1;i >= 0; i--) {
50591
- try {
50592
- const data = JSON.parse(lines[i] ?? "");
50593
- if (data.timestamp) {
50594
- lastTimestamp = new Date(data.timestamp);
50595
- break;
50596
- }
50597
- } catch {}
50598
- }
50599
- if (!firstTimestamp || !lastTimestamp) {
50600
- return null;
50601
- }
50602
- const durationMs = lastTimestamp.getTime() - firstTimestamp.getTime();
50603
- const totalMinutes = Math.floor(durationMs / (1000 * 60));
50604
- if (totalMinutes < 1) {
50605
- return "<1m";
50606
- }
50607
- const hours = Math.floor(totalMinutes / 60);
50608
- const minutes = totalMinutes % 60;
50609
- if (hours === 0) {
50610
- return `${minutes}m`;
50611
- } else if (minutes === 0) {
50612
- return `${hours}hr`;
50613
- } else {
50614
- return `${hours}hr ${minutes}m`;
50615
- }
50616
- } catch {
50617
- return null;
50618
- }
50619
- }
50620
- async function getTokenMetrics(transcriptPath) {
50621
- try {
50622
- if (!fs6.existsSync(transcriptPath)) {
50623
- return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
50624
- }
50625
- const content = await readFile4(transcriptPath, "utf-8");
50626
- const lines = content.trim().split(`
50627
- `);
50628
- let inputTokens = 0;
50629
- let outputTokens = 0;
50630
- let cachedTokens = 0;
50631
- let contextLength = 0;
50632
- let mostRecentMainChainEntry = null;
50633
- let mostRecentTimestamp = null;
50634
- for (const line of lines) {
50635
- try {
50636
- const data = JSON.parse(line);
50637
- if (data.message?.usage) {
50638
- inputTokens += data.message.usage.input_tokens || 0;
50639
- outputTokens += data.message.usage.output_tokens || 0;
50640
- cachedTokens += data.message.usage.cache_read_input_tokens ?? 0;
50641
- cachedTokens += data.message.usage.cache_creation_input_tokens ?? 0;
50642
- if (data.isSidechain !== true && data.timestamp) {
50643
- const entryTime = new Date(data.timestamp);
50644
- if (!mostRecentTimestamp || entryTime > mostRecentTimestamp) {
50645
- mostRecentTimestamp = entryTime;
50646
- mostRecentMainChainEntry = data;
50647
- }
50648
- }
50649
- }
50650
- } catch {}
50651
- }
50652
- if (mostRecentMainChainEntry?.message?.usage) {
50653
- const usage = mostRecentMainChainEntry.message.usage;
50654
- contextLength = (usage.input_tokens || 0) + (usage.cache_read_input_tokens ?? 0) + (usage.cache_creation_input_tokens ?? 0);
50655
- }
50656
- const totalTokens = inputTokens + outputTokens + cachedTokens;
50657
- return { inputTokens, outputTokens, cachedTokens, totalTokens, contextLength };
50658
- } catch {
50659
- return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
50660
- }
50661
- }
50662
52039
  function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, globalSeparatorOffset = 0) {
50663
52040
  const powerlineConfig = settings.powerline;
50664
52041
  const config2 = powerlineConfig ?? {};
@@ -51198,6 +52575,9 @@ class TokensInputWidget {
51198
52575
  getDefaultColor() {
51199
52576
  return "blue";
51200
52577
  }
52578
+ getDescription() {
52579
+ return "Shows input token count for the current session";
52580
+ }
51201
52581
  getDisplayName() {
51202
52582
  return "Tokens Input";
51203
52583
  }
@@ -51224,6 +52604,9 @@ class TokensOutputWidget {
51224
52604
  getDefaultColor() {
51225
52605
  return "white";
51226
52606
  }
52607
+ getDescription() {
52608
+ return "Shows output token count for the current session";
52609
+ }
51227
52610
  getDisplayName() {
51228
52611
  return "Tokens Output";
51229
52612
  }
@@ -51250,6 +52633,9 @@ class TokensCachedWidget {
51250
52633
  getDefaultColor() {
51251
52634
  return "cyan";
51252
52635
  }
52636
+ getDescription() {
52637
+ return "Shows cached token count for the current session";
52638
+ }
51253
52639
  getDisplayName() {
51254
52640
  return "Tokens Cached";
51255
52641
  }
@@ -51276,6 +52662,9 @@ class TokensTotalWidget {
51276
52662
  getDefaultColor() {
51277
52663
  return "cyan";
51278
52664
  }
52665
+ getDescription() {
52666
+ return "Shows total token count (input + output + cache) for the current session";
52667
+ }
51279
52668
  getDisplayName() {
51280
52669
  return "Tokens Total";
51281
52670
  }
@@ -51302,6 +52691,9 @@ class ContextLengthWidget {
51302
52691
  getDefaultColor() {
51303
52692
  return "brightBlack";
51304
52693
  }
52694
+ getDescription() {
52695
+ return "Shows the current context window size in tokens";
52696
+ }
51305
52697
  getDisplayName() {
51306
52698
  return "Context Length";
51307
52699
  }
@@ -51328,6 +52720,9 @@ class ContextPercentageWidget {
51328
52720
  getDefaultColor() {
51329
52721
  return "blue";
51330
52722
  }
52723
+ getDescription() {
52724
+ return "Shows percentage of context window used (of 200k tokens)";
52725
+ }
51331
52726
  getDisplayName() {
51332
52727
  return "Context %";
51333
52728
  }
@@ -51355,6 +52750,9 @@ class ContextPercentageUsableWidget {
51355
52750
  getDefaultColor() {
51356
52751
  return "green";
51357
52752
  }
52753
+ getDescription() {
52754
+ return "Shows percentage of usable context window used (of 160k tokens before auto-compact)";
52755
+ }
51358
52756
  getDisplayName() {
51359
52757
  return "Context % (usable)";
51360
52758
  }
@@ -51382,6 +52780,9 @@ class SessionClockWidget {
51382
52780
  getDefaultColor() {
51383
52781
  return "yellow";
51384
52782
  }
52783
+ getDescription() {
52784
+ return "Shows elapsed time since current session started";
52785
+ }
51385
52786
  getDisplayName() {
51386
52787
  return "Session Clock";
51387
52788
  }
@@ -51408,6 +52809,9 @@ class TerminalWidthWidget {
51408
52809
  getDefaultColor() {
51409
52810
  return "gray";
51410
52811
  }
52812
+ getDescription() {
52813
+ return "Shows current terminal width in columns";
52814
+ }
51411
52815
  getDisplayName() {
51412
52816
  return "Terminal Width";
51413
52817
  }
@@ -51436,6 +52840,9 @@ class VersionWidget {
51436
52840
  getDefaultColor() {
51437
52841
  return "gray";
51438
52842
  }
52843
+ getDescription() {
52844
+ return "Shows Claude Code CLI version number";
52845
+ }
51439
52846
  getDisplayName() {
51440
52847
  return "Version";
51441
52848
  }
@@ -51465,6 +52872,9 @@ class CustomTextWidget {
51465
52872
  getDefaultColor() {
51466
52873
  return "white";
51467
52874
  }
52875
+ getDescription() {
52876
+ return "Displays user-defined custom text";
52877
+ }
51468
52878
  getDisplayName() {
51469
52879
  return "Custom Text";
51470
52880
  }
@@ -51553,10 +52963,12 @@ var import_react30 = __toESM(require_react(), 1);
51553
52963
  var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
51554
52964
 
51555
52965
  class CustomCommandWidget {
51556
- currentAction = "edit-command";
51557
52966
  getDefaultColor() {
51558
52967
  return "white";
51559
52968
  }
52969
+ getDescription() {
52970
+ return "Executes a custom shell command and displays output";
52971
+ }
51560
52972
  getDisplayName() {
51561
52973
  return "Custom Command";
51562
52974
  }
@@ -51579,8 +52991,11 @@ class CustomCommandWidget {
51579
52991
  modifierText: modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined
51580
52992
  };
51581
52993
  }
51582
- setEditorAction(action) {
51583
- this.currentAction = action;
52994
+ handleEditorAction(action, item) {
52995
+ if (action === "toggle-preserve") {
52996
+ return { ...item, preserveColors: !item.preserveColors };
52997
+ }
52998
+ return null;
51584
52999
  }
51585
53000
  render(item, context, settings) {
51586
53001
  if (context.isPreview) {
@@ -51633,8 +53048,7 @@ class CustomCommandWidget {
51633
53048
  }
51634
53049
  renderEditor(props) {
51635
53050
  return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(CustomCommandEditor, {
51636
- ...props,
51637
- action: this.currentAction
53051
+ ...props
51638
53052
  }, undefined, false, undefined, this);
51639
53053
  }
51640
53054
  supportsRawValue() {
@@ -51781,6 +53195,108 @@ var CustomCommandEditor = ({ widget, onComplete, onCancel, action }) => {
51781
53195
  children: "Unknown editor mode"
51782
53196
  }, undefined, false, undefined, this);
51783
53197
  };
53198
+ // src/widgets/BlockTimer.ts
53199
+ class BlockTimerWidget {
53200
+ getDefaultColor() {
53201
+ return "yellow";
53202
+ }
53203
+ getDescription() {
53204
+ return "Shows elapsed time since beginning of current 5hr block";
53205
+ }
53206
+ getDisplayName() {
53207
+ return "Block Timer";
53208
+ }
53209
+ getEditorDisplay(item) {
53210
+ const mode = item.metadata?.display ?? "time";
53211
+ const modifiers = [];
53212
+ if (mode === "progress") {
53213
+ modifiers.push("progress bar");
53214
+ } else if (mode === "progress-short") {
53215
+ modifiers.push("short bar");
53216
+ }
53217
+ return {
53218
+ displayText: this.getDisplayName(),
53219
+ modifierText: modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined
53220
+ };
53221
+ }
53222
+ handleEditorAction(action, item) {
53223
+ if (action === "toggle-progress") {
53224
+ const currentMode = item.metadata?.display ?? "time";
53225
+ let nextMode;
53226
+ if (currentMode === "time") {
53227
+ nextMode = "progress";
53228
+ } else if (currentMode === "progress") {
53229
+ nextMode = "progress-short";
53230
+ } else {
53231
+ nextMode = "time";
53232
+ }
53233
+ return {
53234
+ ...item,
53235
+ metadata: {
53236
+ ...item.metadata,
53237
+ display: nextMode
53238
+ }
53239
+ };
53240
+ }
53241
+ return null;
53242
+ }
53243
+ render(item, context, settings) {
53244
+ const displayMode = item.metadata?.display ?? "time";
53245
+ if (context.isPreview) {
53246
+ if (displayMode === "progress") {
53247
+ return "Block [██████████████████████░░░░░░░░] 73.9%";
53248
+ } else if (displayMode === "progress-short") {
53249
+ return "Block [███████░░░░░░░░] 73.9%";
53250
+ }
53251
+ return item.rawValue ? "3hr 45m" : "Block: 3hr 45m";
53252
+ }
53253
+ const blockInfo = context.blockMetrics;
53254
+ if (!blockInfo) {
53255
+ return null;
53256
+ }
53257
+ try {
53258
+ const now = new Date;
53259
+ const elapsedMs = now.getTime() - blockInfo.startTime.getTime();
53260
+ const sessionDurationMs = 5 * 60 * 60 * 1000;
53261
+ const progress = Math.min(elapsedMs / sessionDurationMs, 1);
53262
+ const percentage = (progress * 100).toFixed(1);
53263
+ if (displayMode === "progress" || displayMode === "progress-short") {
53264
+ const barWidth = displayMode === "progress" ? 32 : 16;
53265
+ const filledWidth = Math.floor(progress * barWidth);
53266
+ const emptyWidth = barWidth - filledWidth;
53267
+ const progressBar = "█".repeat(filledWidth) + "░".repeat(emptyWidth);
53268
+ if (item.rawValue) {
53269
+ return `[${progressBar}] ${percentage}%`;
53270
+ } else {
53271
+ return `Block [${progressBar}] ${percentage}%`;
53272
+ }
53273
+ } else {
53274
+ const elapsedHours = Math.floor(elapsedMs / (1000 * 60 * 60));
53275
+ const elapsedMinutes = Math.floor(elapsedMs % (1000 * 60 * 60) / (1000 * 60));
53276
+ let timeString;
53277
+ if (elapsedMinutes === 0) {
53278
+ timeString = `${elapsedHours}hr`;
53279
+ } else {
53280
+ timeString = `${elapsedHours}hr ${elapsedMinutes}m`;
53281
+ }
53282
+ return item.rawValue ? timeString : `Block: ${timeString}`;
53283
+ }
53284
+ } catch {
53285
+ return null;
53286
+ }
53287
+ }
53288
+ getCustomKeybinds() {
53289
+ return [
53290
+ { key: "p", label: "(p)rogress toggle", action: "toggle-progress" }
53291
+ ];
53292
+ }
53293
+ supportsRawValue() {
53294
+ return true;
53295
+ }
53296
+ supportsColors(item) {
53297
+ return true;
53298
+ }
53299
+ }
51784
53300
  // src/utils/widgets.ts
51785
53301
  var widgetRegistry = new Map([
51786
53302
  ["model", new ModelWidget],
@@ -51795,6 +53311,7 @@ var widgetRegistry = new Map([
51795
53311
  ["context-percentage", new ContextPercentageWidget],
51796
53312
  ["context-percentage-usable", new ContextPercentageUsableWidget],
51797
53313
  ["session-clock", new SessionClockWidget],
53314
+ ["block-timer", new BlockTimerWidget],
51798
53315
  ["terminal-width", new TerminalWidthWidget],
51799
53316
  ["version", new VersionWidget],
51800
53317
  ["custom-text", new CustomTextWidget],
@@ -53101,7 +54618,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
53101
54618
  nextMergeState = undefined;
53102
54619
  }
53103
54620
  if (nextMergeState === undefined) {
53104
- const { merge: _merge, ...rest } = currentWidget2;
54621
+ const { merge: merge2, ...rest } = currentWidget2;
53105
54622
  newWidgets[selectedIndex] = rest;
53106
54623
  } else {
53107
54624
  newWidgets[selectedIndex] = { ...currentWidget2, merge: nextMergeState };
@@ -53119,15 +54636,17 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
53119
54636
  const customKeybinds2 = widgetImpl.getCustomKeybinds();
53120
54637
  const matchedKeybind = customKeybinds2.find((kb) => kb.key === input);
53121
54638
  if (matchedKeybind) {
53122
- if (matchedKeybind.action === "toggle-preserve") {
53123
- const newWidgets = [...widgets];
53124
- newWidgets[selectedIndex] = { ...currentWidget2, preserveColors: !currentWidget2.preserveColors };
53125
- onUpdate(newWidgets);
53126
- } else if (widgetImpl.renderEditor) {
53127
- if (widgetImpl.setEditorAction) {
53128
- widgetImpl.setEditorAction(matchedKeybind.action);
54639
+ if (widgetImpl.handleEditorAction) {
54640
+ const updatedWidget = widgetImpl.handleEditorAction(matchedKeybind.action, currentWidget2);
54641
+ if (updatedWidget) {
54642
+ const newWidgets = [...widgets];
54643
+ newWidgets[selectedIndex] = updatedWidget;
54644
+ onUpdate(newWidgets);
54645
+ } else if (widgetImpl.renderEditor) {
54646
+ setCustomEditorWidget({ widget: currentWidget2, impl: widgetImpl, action: matchedKeybind.action });
53129
54647
  }
53130
- setCustomEditorWidget({ widget: currentWidget2, impl: widgetImpl });
54648
+ } else if (widgetImpl.renderEditor) {
54649
+ setCustomEditorWidget({ widget: currentWidget2, impl: widgetImpl, action: matchedKeybind.action });
53131
54650
  }
53132
54651
  }
53133
54652
  }
@@ -53185,7 +54704,8 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
53185
54704
  return customEditorWidget.impl.renderEditor({
53186
54705
  widget: customEditorWidget.widget,
53187
54706
  onComplete: handleEditorComplete,
53188
- onCancel: handleEditorCancel
54707
+ onCancel: handleEditorCancel,
54708
+ action: customEditorWidget.action
53189
54709
  });
53190
54710
  }
53191
54711
  return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
@@ -53219,9 +54739,13 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
53219
54739
  }, undefined, false, undefined, this)
53220
54740
  ]
53221
54741
  }, undefined, true, undefined, this),
53222
- moveMode ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
53223
- dimColor: true,
53224
- children: "↑↓ to move item, ESC or Enter to exit move mode"
54742
+ moveMode ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
54743
+ flexDirection: "column",
54744
+ marginBottom: 1,
54745
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
54746
+ dimColor: true,
54747
+ children: "↑↓ to move item, ESC or Enter to exit move mode"
54748
+ }, undefined, false, undefined, this)
53225
54749
  }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
53226
54750
  flexDirection: "column",
53227
54751
  children: [
@@ -53254,43 +54778,72 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
53254
54778
  children: widgets.length === 0 ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
53255
54779
  dimColor: true,
53256
54780
  children: "No items. Press 'a' to add one."
53257
- }, undefined, false, undefined, this) : widgets.map((widget, index) => {
53258
- const isSelected = index === selectedIndex;
53259
- const widgetImpl = widget.type !== "separator" && widget.type !== "flex-separator" ? getWidget(widget.type) : null;
53260
- const { displayText, modifierText } = widgetImpl?.getEditorDisplay(widget) ?? { displayText: getWidgetDisplay(widget) };
53261
- return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
53262
- children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
53263
- children: [
53264
- /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
53265
- color: isSelected ? moveMode ? "blue" : "green" : undefined,
53266
- children: [
53267
- isSelected ? moveMode ? "◆ " : "▶ " : " ",
53268
- ` ${index + 1}. ${displayText || getWidgetDisplay(widget)}`
53269
- ]
53270
- }, undefined, true, undefined, this),
53271
- modifierText && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
53272
- dimColor: true,
53273
- children: [
53274
- " ",
53275
- modifierText
53276
- ]
53277
- }, undefined, true, undefined, this),
53278
- widget.rawValue && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
53279
- dimColor: true,
53280
- children: " (raw value)"
53281
- }, undefined, false, undefined, this),
53282
- widget.merge === true && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
53283
- dimColor: true,
53284
- children: " (merged→)"
53285
- }, undefined, false, undefined, this),
53286
- widget.merge === "no-padding" && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
53287
- dimColor: true,
53288
- children: " (merged-no-pad→)"
53289
- }, undefined, false, undefined, this)
53290
- ]
53291
- }, undefined, true, undefined, this)
53292
- }, widget.id, false, undefined, this);
53293
- })
54781
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
54782
+ children: [
54783
+ widgets.map((widget, index) => {
54784
+ const isSelected = index === selectedIndex;
54785
+ const widgetImpl = widget.type !== "separator" && widget.type !== "flex-separator" ? getWidget(widget.type) : null;
54786
+ const { displayText, modifierText } = widgetImpl?.getEditorDisplay(widget) ?? { displayText: getWidgetDisplay(widget) };
54787
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
54788
+ flexDirection: "row",
54789
+ flexWrap: "nowrap",
54790
+ children: [
54791
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
54792
+ width: 3,
54793
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
54794
+ color: isSelected ? moveMode ? "blue" : "green" : undefined,
54795
+ children: isSelected ? moveMode ? "◆ " : "▶ " : " "
54796
+ }, undefined, false, undefined, this)
54797
+ }, undefined, false, undefined, this),
54798
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
54799
+ color: isSelected ? moveMode ? "blue" : "green" : undefined,
54800
+ children: `${index + 1}. ${displayText || getWidgetDisplay(widget)}`
54801
+ }, undefined, false, undefined, this),
54802
+ modifierText && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
54803
+ dimColor: true,
54804
+ children: [
54805
+ " ",
54806
+ modifierText
54807
+ ]
54808
+ }, undefined, true, undefined, this),
54809
+ widget.rawValue && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
54810
+ dimColor: true,
54811
+ children: " (raw value)"
54812
+ }, undefined, false, undefined, this),
54813
+ widget.merge === true && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
54814
+ dimColor: true,
54815
+ children: " (merged→)"
54816
+ }, undefined, false, undefined, this),
54817
+ widget.merge === "no-padding" && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
54818
+ dimColor: true,
54819
+ children: " (merged-no-pad→)"
54820
+ }, undefined, false, undefined, this)
54821
+ ]
54822
+ }, widget.id, true, undefined, this);
54823
+ }),
54824
+ currentWidget && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
54825
+ marginTop: 1,
54826
+ paddingLeft: 2,
54827
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
54828
+ dimColor: true,
54829
+ children: (() => {
54830
+ if (currentWidget.type === "separator") {
54831
+ return "A separator character between status line items";
54832
+ } else if (currentWidget.type === "flex-separator") {
54833
+ return "Expands to fill available terminal width";
54834
+ } else {
54835
+ try {
54836
+ const widgetImpl = getWidget(currentWidget.type);
54837
+ return widgetImpl.getDescription();
54838
+ } catch {
54839
+ return "Widget description not available";
54840
+ }
54841
+ }
54842
+ })()
54843
+ }, undefined, false, undefined, this)
54844
+ }, undefined, false, undefined, this)
54845
+ ]
54846
+ }, undefined, true, undefined, this)
53294
54847
  }, undefined, false, undefined, this)
53295
54848
  ]
53296
54849
  }, undefined, true, undefined, this);
@@ -55355,83 +56908,1073 @@ Continue?`;
55355
56908
  if (existing && !isAlreadyInstalled) {
55356
56909
  message = `This will modify ~/.claude/settings.json
55357
56910
 
55358
- A status line is already configured: "${existing}"
55359
- Replace it with bunx -y ccstatusline@latest?`;
55360
- } else if (isAlreadyInstalled) {
55361
- message = `ccstatusline is already installed in ~/.claude/settings.json
55362
- Update it with bunx -y ccstatusline@latest?`;
55363
- } else {
55364
- message = `This will modify ~/.claude/settings.json to add ccstatusline with bunx.
55365
- Continue?`;
55366
- }
55367
- setConfirmDialog({
55368
- message,
55369
- action: async () => {
55370
- await installStatusLine(true);
55371
- setIsClaudeInstalled(true);
55372
- setExistingStatusLine("bunx -y ccstatusline@latest");
55373
- setScreen("main");
55374
- setConfirmDialog(null);
55375
- }
55376
- });
55377
- setScreen("confirm");
55378
- });
55379
- },
55380
- onCancel: () => {
55381
- setScreen("main");
55382
- }
55383
- }, undefined, false, undefined, this),
55384
- screen === "powerline" && /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(PowerlineSetup, {
55385
- settings,
55386
- powerlineFontStatus,
55387
- onUpdate: (updatedSettings) => {
55388
- setSettings(updatedSettings);
55389
- },
55390
- onBack: () => {
55391
- setScreen("main");
55392
- },
55393
- onInstallFonts: () => {
55394
- setInstallingFonts(true);
55395
- installPowerlineFonts().then((result) => {
55396
- setInstallingFonts(false);
55397
- setFontInstallMessage(result.message);
55398
- checkPowerlineFontsAsync().then((asyncStatus) => {
55399
- setPowerlineFontStatus(asyncStatus);
55400
- });
55401
- });
55402
- },
55403
- installingFonts,
55404
- fontInstallMessage,
55405
- onClearMessage: () => {
55406
- setFontInstallMessage(null);
56911
+ A status line is already configured: "${existing}"
56912
+ Replace it with bunx -y ccstatusline@latest?`;
56913
+ } else if (isAlreadyInstalled) {
56914
+ message = `ccstatusline is already installed in ~/.claude/settings.json
56915
+ Update it with bunx -y ccstatusline@latest?`;
56916
+ } else {
56917
+ message = `This will modify ~/.claude/settings.json to add ccstatusline with bunx.
56918
+ Continue?`;
56919
+ }
56920
+ setConfirmDialog({
56921
+ message,
56922
+ action: async () => {
56923
+ await installStatusLine(true);
56924
+ setIsClaudeInstalled(true);
56925
+ setExistingStatusLine("bunx -y ccstatusline@latest");
56926
+ setScreen("main");
56927
+ setConfirmDialog(null);
56928
+ }
56929
+ });
56930
+ setScreen("confirm");
56931
+ });
56932
+ },
56933
+ onCancel: () => {
56934
+ setScreen("main");
56935
+ }
56936
+ }, undefined, false, undefined, this),
56937
+ screen === "powerline" && /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(PowerlineSetup, {
56938
+ settings,
56939
+ powerlineFontStatus,
56940
+ onUpdate: (updatedSettings) => {
56941
+ setSettings(updatedSettings);
56942
+ },
56943
+ onBack: () => {
56944
+ setScreen("main");
56945
+ },
56946
+ onInstallFonts: () => {
56947
+ setInstallingFonts(true);
56948
+ installPowerlineFonts().then((result) => {
56949
+ setInstallingFonts(false);
56950
+ setFontInstallMessage(result.message);
56951
+ checkPowerlineFontsAsync().then((asyncStatus) => {
56952
+ setPowerlineFontStatus(asyncStatus);
56953
+ });
56954
+ });
56955
+ },
56956
+ installingFonts,
56957
+ fontInstallMessage,
56958
+ onClearMessage: () => {
56959
+ setFontInstallMessage(null);
56960
+ }
56961
+ }, undefined, false, undefined, this)
56962
+ ]
56963
+ }, undefined, true, undefined, this)
56964
+ ]
56965
+ }, undefined, true, undefined, this);
56966
+ };
56967
+ function runTUI() {
56968
+ process.stdout.write("\x1B[2J\x1B[H");
56969
+ render_default(/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(App2, {}, undefined, false, undefined, this));
56970
+ }
56971
+ // src/types/StatusJSON.ts
56972
+ var StatusJSONSchema = exports_external.looseObject({
56973
+ hook_event_name: exports_external.string().optional(),
56974
+ session_id: exports_external.string().optional(),
56975
+ transcript_path: exports_external.string().optional(),
56976
+ cwd: exports_external.string().optional(),
56977
+ model: exports_external.object({
56978
+ id: exports_external.string().optional(),
56979
+ display_name: exports_external.string().optional()
56980
+ }).optional(),
56981
+ workspace: exports_external.object({
56982
+ current_dir: exports_external.string().optional(),
56983
+ project_dir: exports_external.string().optional()
56984
+ }).optional(),
56985
+ version: exports_external.string().optional(),
56986
+ output_style: exports_external.object({ name: exports_external.string().optional() }).optional()
56987
+ });
56988
+
56989
+ // src/utils/jsonl.ts
56990
+ import * as fs6 from "fs";
56991
+ import path6 from "node:path";
56992
+
56993
+ // node_modules/tinyglobby/dist/index.mjs
56994
+ import path5, { posix } from "path";
56995
+
56996
+ // node_modules/fdir/dist/index.mjs
56997
+ import { createRequire as createRequire2 } from "module";
56998
+ import { basename as basename2, dirname as dirname2, normalize, relative, resolve, sep } from "path";
56999
+ import * as nativeFs from "fs";
57000
+ var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
57001
+ function cleanPath(path5) {
57002
+ let normalized = normalize(path5);
57003
+ if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
57004
+ normalized = normalized.substring(0, normalized.length - 1);
57005
+ return normalized;
57006
+ }
57007
+ var SLASHES_REGEX = /[\\/]/g;
57008
+ function convertSlashes(path5, separator) {
57009
+ return path5.replace(SLASHES_REGEX, separator);
57010
+ }
57011
+ var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
57012
+ function isRootDirectory(path5) {
57013
+ return path5 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path5);
57014
+ }
57015
+ function normalizePath(path5, options) {
57016
+ const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
57017
+ const pathNeedsCleaning = process.platform === "win32" && path5.includes("/") || path5.startsWith(".");
57018
+ if (resolvePaths)
57019
+ path5 = resolve(path5);
57020
+ if (normalizePath$1 || pathNeedsCleaning)
57021
+ path5 = cleanPath(path5);
57022
+ if (path5 === ".")
57023
+ return "";
57024
+ const needsSeperator = path5[path5.length - 1] !== pathSeparator;
57025
+ return convertSlashes(needsSeperator ? path5 + pathSeparator : path5, pathSeparator);
57026
+ }
57027
+ function joinPathWithBasePath(filename, directoryPath) {
57028
+ return directoryPath + filename;
57029
+ }
57030
+ function joinPathWithRelativePath(root, options) {
57031
+ return function(filename, directoryPath) {
57032
+ const sameRoot = directoryPath.startsWith(root);
57033
+ if (sameRoot)
57034
+ return directoryPath.slice(root.length) + filename;
57035
+ else
57036
+ return convertSlashes(relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
57037
+ };
57038
+ }
57039
+ function joinPath(filename) {
57040
+ return filename;
57041
+ }
57042
+ function joinDirectoryPath(filename, directoryPath, separator) {
57043
+ return directoryPath + filename + separator;
57044
+ }
57045
+ function build$7(root, options) {
57046
+ const { relativePaths, includeBasePath } = options;
57047
+ return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
57048
+ }
57049
+ function pushDirectoryWithRelativePath(root) {
57050
+ return function(directoryPath, paths) {
57051
+ paths.push(directoryPath.substring(root.length) || ".");
57052
+ };
57053
+ }
57054
+ function pushDirectoryFilterWithRelativePath(root) {
57055
+ return function(directoryPath, paths, filters) {
57056
+ const relativePath = directoryPath.substring(root.length) || ".";
57057
+ if (filters.every((filter) => filter(relativePath, true)))
57058
+ paths.push(relativePath);
57059
+ };
57060
+ }
57061
+ var pushDirectory = (directoryPath, paths) => {
57062
+ paths.push(directoryPath || ".");
57063
+ };
57064
+ var pushDirectoryFilter = (directoryPath, paths, filters) => {
57065
+ const path5 = directoryPath || ".";
57066
+ if (filters.every((filter) => filter(path5, true)))
57067
+ paths.push(path5);
57068
+ };
57069
+ var empty$2 = () => {};
57070
+ function build$6(root, options) {
57071
+ const { includeDirs, filters, relativePaths } = options;
57072
+ if (!includeDirs)
57073
+ return empty$2;
57074
+ if (relativePaths)
57075
+ return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
57076
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory;
57077
+ }
57078
+ var pushFileFilterAndCount = (filename, _paths, counts, filters) => {
57079
+ if (filters.every((filter) => filter(filename, false)))
57080
+ counts.files++;
57081
+ };
57082
+ var pushFileFilter = (filename, paths, _counts, filters) => {
57083
+ if (filters.every((filter) => filter(filename, false)))
57084
+ paths.push(filename);
57085
+ };
57086
+ var pushFileCount = (_filename, _paths, counts, _filters) => {
57087
+ counts.files++;
57088
+ };
57089
+ var pushFile = (filename, paths) => {
57090
+ paths.push(filename);
57091
+ };
57092
+ var empty$1 = () => {};
57093
+ function build$5(options) {
57094
+ const { excludeFiles, filters, onlyCounts } = options;
57095
+ if (excludeFiles)
57096
+ return empty$1;
57097
+ if (filters && filters.length)
57098
+ return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
57099
+ else if (onlyCounts)
57100
+ return pushFileCount;
57101
+ else
57102
+ return pushFile;
57103
+ }
57104
+ var getArray = (paths) => {
57105
+ return paths;
57106
+ };
57107
+ var getArrayGroup = () => {
57108
+ return [""].slice(0, 0);
57109
+ };
57110
+ function build$4(options) {
57111
+ return options.group ? getArrayGroup : getArray;
57112
+ }
57113
+ var groupFiles = (groups, directory, files) => {
57114
+ groups.push({
57115
+ directory,
57116
+ files,
57117
+ dir: directory
57118
+ });
57119
+ };
57120
+ var empty = () => {};
57121
+ function build$3(options) {
57122
+ return options.group ? groupFiles : empty;
57123
+ }
57124
+ var resolveSymlinksAsync = function(path5, state, callback$1) {
57125
+ const { queue, fs: fs6, options: { suppressErrors } } = state;
57126
+ queue.enqueue();
57127
+ fs6.realpath(path5, (error43, resolvedPath) => {
57128
+ if (error43)
57129
+ return queue.dequeue(suppressErrors ? null : error43, state);
57130
+ fs6.stat(resolvedPath, (error$1, stat) => {
57131
+ if (error$1)
57132
+ return queue.dequeue(suppressErrors ? null : error$1, state);
57133
+ if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
57134
+ return queue.dequeue(null, state);
57135
+ callback$1(stat, resolvedPath);
57136
+ queue.dequeue(null, state);
57137
+ });
57138
+ });
57139
+ };
57140
+ var resolveSymlinks = function(path5, state, callback$1) {
57141
+ const { queue, fs: fs6, options: { suppressErrors } } = state;
57142
+ queue.enqueue();
57143
+ try {
57144
+ const resolvedPath = fs6.realpathSync(path5);
57145
+ const stat = fs6.statSync(resolvedPath);
57146
+ if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
57147
+ return;
57148
+ callback$1(stat, resolvedPath);
57149
+ } catch (e) {
57150
+ if (!suppressErrors)
57151
+ throw e;
57152
+ }
57153
+ };
57154
+ function build$2(options, isSynchronous) {
57155
+ if (!options.resolveSymlinks || options.excludeSymlinks)
57156
+ return null;
57157
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
57158
+ }
57159
+ function isRecursive(path5, resolved, state) {
57160
+ if (state.options.useRealPaths)
57161
+ return isRecursiveUsingRealPaths(resolved, state);
57162
+ let parent = dirname2(path5);
57163
+ let depth = 1;
57164
+ while (parent !== state.root && depth < 2) {
57165
+ const resolvedPath = state.symlinks.get(parent);
57166
+ const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
57167
+ if (isSameRoot)
57168
+ depth++;
57169
+ else
57170
+ parent = dirname2(parent);
57171
+ }
57172
+ state.symlinks.set(path5, resolved);
57173
+ return depth > 1;
57174
+ }
57175
+ function isRecursiveUsingRealPaths(resolved, state) {
57176
+ return state.visited.includes(resolved + state.options.pathSeparator);
57177
+ }
57178
+ var onlyCountsSync = (state) => {
57179
+ return state.counts;
57180
+ };
57181
+ var groupsSync = (state) => {
57182
+ return state.groups;
57183
+ };
57184
+ var defaultSync = (state) => {
57185
+ return state.paths;
57186
+ };
57187
+ var limitFilesSync = (state) => {
57188
+ return state.paths.slice(0, state.options.maxFiles);
57189
+ };
57190
+ var onlyCountsAsync = (state, error43, callback$1) => {
57191
+ report(error43, callback$1, state.counts, state.options.suppressErrors);
57192
+ return null;
57193
+ };
57194
+ var defaultAsync = (state, error43, callback$1) => {
57195
+ report(error43, callback$1, state.paths, state.options.suppressErrors);
57196
+ return null;
57197
+ };
57198
+ var limitFilesAsync = (state, error43, callback$1) => {
57199
+ report(error43, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
57200
+ return null;
57201
+ };
57202
+ var groupsAsync = (state, error43, callback$1) => {
57203
+ report(error43, callback$1, state.groups, state.options.suppressErrors);
57204
+ return null;
57205
+ };
57206
+ function report(error43, callback$1, output, suppressErrors) {
57207
+ if (error43 && !suppressErrors)
57208
+ callback$1(error43, output);
57209
+ else
57210
+ callback$1(null, output);
57211
+ }
57212
+ function build$1(options, isSynchronous) {
57213
+ const { onlyCounts, group, maxFiles } = options;
57214
+ if (onlyCounts)
57215
+ return isSynchronous ? onlyCountsSync : onlyCountsAsync;
57216
+ else if (group)
57217
+ return isSynchronous ? groupsSync : groupsAsync;
57218
+ else if (maxFiles)
57219
+ return isSynchronous ? limitFilesSync : limitFilesAsync;
57220
+ else
57221
+ return isSynchronous ? defaultSync : defaultAsync;
57222
+ }
57223
+ var readdirOpts = { withFileTypes: true };
57224
+ var walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
57225
+ state.queue.enqueue();
57226
+ if (currentDepth < 0)
57227
+ return state.queue.dequeue(null, state);
57228
+ const { fs: fs6 } = state;
57229
+ state.visited.push(crawlPath);
57230
+ state.counts.directories++;
57231
+ fs6.readdir(crawlPath || ".", readdirOpts, (error43, entries = []) => {
57232
+ callback$1(entries, directoryPath, currentDepth);
57233
+ state.queue.dequeue(state.options.suppressErrors ? null : error43, state);
57234
+ });
57235
+ };
57236
+ var walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
57237
+ const { fs: fs6 } = state;
57238
+ if (currentDepth < 0)
57239
+ return;
57240
+ state.visited.push(crawlPath);
57241
+ state.counts.directories++;
57242
+ let entries = [];
57243
+ try {
57244
+ entries = fs6.readdirSync(crawlPath || ".", readdirOpts);
57245
+ } catch (e) {
57246
+ if (!state.options.suppressErrors)
57247
+ throw e;
57248
+ }
57249
+ callback$1(entries, directoryPath, currentDepth);
57250
+ };
57251
+ function build(isSynchronous) {
57252
+ return isSynchronous ? walkSync : walkAsync;
57253
+ }
57254
+ var Queue = class {
57255
+ count = 0;
57256
+ constructor(onQueueEmpty) {
57257
+ this.onQueueEmpty = onQueueEmpty;
57258
+ }
57259
+ enqueue() {
57260
+ this.count++;
57261
+ return this.count;
57262
+ }
57263
+ dequeue(error43, output) {
57264
+ if (this.onQueueEmpty && (--this.count <= 0 || error43)) {
57265
+ this.onQueueEmpty(error43, output);
57266
+ if (error43) {
57267
+ output.controller.abort();
57268
+ this.onQueueEmpty = undefined;
57269
+ }
57270
+ }
57271
+ }
57272
+ };
57273
+ var Counter = class {
57274
+ _files = 0;
57275
+ _directories = 0;
57276
+ set files(num) {
57277
+ this._files = num;
57278
+ }
57279
+ get files() {
57280
+ return this._files;
57281
+ }
57282
+ set directories(num) {
57283
+ this._directories = num;
57284
+ }
57285
+ get directories() {
57286
+ return this._directories;
57287
+ }
57288
+ get dirs() {
57289
+ return this._directories;
57290
+ }
57291
+ };
57292
+ var Aborter = class {
57293
+ aborted = false;
57294
+ abort() {
57295
+ this.aborted = true;
57296
+ }
57297
+ };
57298
+ var Walker = class {
57299
+ root;
57300
+ isSynchronous;
57301
+ state;
57302
+ joinPath;
57303
+ pushDirectory;
57304
+ pushFile;
57305
+ getArray;
57306
+ groupFiles;
57307
+ resolveSymlink;
57308
+ walkDirectory;
57309
+ callbackInvoker;
57310
+ constructor(root, options, callback$1) {
57311
+ this.isSynchronous = !callback$1;
57312
+ this.callbackInvoker = build$1(options, this.isSynchronous);
57313
+ this.root = normalizePath(root, options);
57314
+ this.state = {
57315
+ root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
57316
+ paths: [""].slice(0, 0),
57317
+ groups: [],
57318
+ counts: new Counter,
57319
+ options,
57320
+ queue: new Queue((error43, state) => this.callbackInvoker(state, error43, callback$1)),
57321
+ symlinks: /* @__PURE__ */ new Map,
57322
+ visited: [""].slice(0, 0),
57323
+ controller: new Aborter,
57324
+ fs: options.fs || nativeFs
57325
+ };
57326
+ this.joinPath = build$7(this.root, options);
57327
+ this.pushDirectory = build$6(this.root, options);
57328
+ this.pushFile = build$5(options);
57329
+ this.getArray = build$4(options);
57330
+ this.groupFiles = build$3(options);
57331
+ this.resolveSymlink = build$2(options, this.isSynchronous);
57332
+ this.walkDirectory = build(this.isSynchronous);
57333
+ }
57334
+ start() {
57335
+ this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
57336
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
57337
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
57338
+ }
57339
+ walk = (entries, directoryPath, depth) => {
57340
+ const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
57341
+ if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles)
57342
+ return;
57343
+ const files = this.getArray(this.state.paths);
57344
+ for (let i = 0;i < entries.length; ++i) {
57345
+ const entry = entries[i];
57346
+ if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
57347
+ const filename = this.joinPath(entry.name, directoryPath);
57348
+ this.pushFile(filename, files, this.state.counts, filters);
57349
+ } else if (entry.isDirectory()) {
57350
+ let path5 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
57351
+ if (exclude && exclude(entry.name, path5))
57352
+ continue;
57353
+ this.pushDirectory(path5, paths, filters);
57354
+ this.walkDirectory(this.state, path5, path5, depth - 1, this.walk);
57355
+ } else if (this.resolveSymlink && entry.isSymbolicLink()) {
57356
+ let path5 = joinPathWithBasePath(entry.name, directoryPath);
57357
+ this.resolveSymlink(path5, this.state, (stat, resolvedPath) => {
57358
+ if (stat.isDirectory()) {
57359
+ resolvedPath = normalizePath(resolvedPath, this.state.options);
57360
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path5 + pathSeparator))
57361
+ return;
57362
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path5 + pathSeparator, depth - 1, this.walk);
57363
+ } else {
57364
+ resolvedPath = useRealPaths ? resolvedPath : path5;
57365
+ const filename = basename2(resolvedPath);
57366
+ const directoryPath$1 = normalizePath(dirname2(resolvedPath), this.state.options);
57367
+ resolvedPath = this.joinPath(filename, directoryPath$1);
57368
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
57369
+ }
57370
+ });
57371
+ }
57372
+ }
57373
+ this.groupFiles(this.state.groups, directoryPath, files);
57374
+ };
57375
+ };
57376
+ function promise2(root, options) {
57377
+ return new Promise((resolve$1, reject) => {
57378
+ callback(root, options, (err, output) => {
57379
+ if (err)
57380
+ return reject(err);
57381
+ resolve$1(output);
57382
+ });
57383
+ });
57384
+ }
57385
+ function callback(root, options, callback$1) {
57386
+ let walker = new Walker(root, options, callback$1);
57387
+ walker.start();
57388
+ }
57389
+ function sync(root, options) {
57390
+ const walker = new Walker(root, options);
57391
+ return walker.start();
57392
+ }
57393
+ var APIBuilder = class {
57394
+ constructor(root, options) {
57395
+ this.root = root;
57396
+ this.options = options;
57397
+ }
57398
+ withPromise() {
57399
+ return promise2(this.root, this.options);
57400
+ }
57401
+ withCallback(cb) {
57402
+ callback(this.root, this.options, cb);
57403
+ }
57404
+ sync() {
57405
+ return sync(this.root, this.options);
57406
+ }
57407
+ };
57408
+ var pm = null;
57409
+ try {
57410
+ __require2.resolve("picomatch");
57411
+ pm = __require2("picomatch");
57412
+ } catch {}
57413
+ var Builder = class {
57414
+ globCache = {};
57415
+ options = {
57416
+ maxDepth: Infinity,
57417
+ suppressErrors: true,
57418
+ pathSeparator: sep,
57419
+ filters: []
57420
+ };
57421
+ globFunction;
57422
+ constructor(options) {
57423
+ this.options = {
57424
+ ...this.options,
57425
+ ...options
57426
+ };
57427
+ this.globFunction = this.options.globFunction;
57428
+ }
57429
+ group() {
57430
+ this.options.group = true;
57431
+ return this;
57432
+ }
57433
+ withPathSeparator(separator) {
57434
+ this.options.pathSeparator = separator;
57435
+ return this;
57436
+ }
57437
+ withBasePath() {
57438
+ this.options.includeBasePath = true;
57439
+ return this;
57440
+ }
57441
+ withRelativePaths() {
57442
+ this.options.relativePaths = true;
57443
+ return this;
57444
+ }
57445
+ withDirs() {
57446
+ this.options.includeDirs = true;
57447
+ return this;
57448
+ }
57449
+ withMaxDepth(depth) {
57450
+ this.options.maxDepth = depth;
57451
+ return this;
57452
+ }
57453
+ withMaxFiles(limit) {
57454
+ this.options.maxFiles = limit;
57455
+ return this;
57456
+ }
57457
+ withFullPaths() {
57458
+ this.options.resolvePaths = true;
57459
+ this.options.includeBasePath = true;
57460
+ return this;
57461
+ }
57462
+ withErrors() {
57463
+ this.options.suppressErrors = false;
57464
+ return this;
57465
+ }
57466
+ withSymlinks({ resolvePaths = true } = {}) {
57467
+ this.options.resolveSymlinks = true;
57468
+ this.options.useRealPaths = resolvePaths;
57469
+ return this.withFullPaths();
57470
+ }
57471
+ withAbortSignal(signal) {
57472
+ this.options.signal = signal;
57473
+ return this;
57474
+ }
57475
+ normalize() {
57476
+ this.options.normalizePath = true;
57477
+ return this;
57478
+ }
57479
+ filter(predicate) {
57480
+ this.options.filters.push(predicate);
57481
+ return this;
57482
+ }
57483
+ onlyDirs() {
57484
+ this.options.excludeFiles = true;
57485
+ this.options.includeDirs = true;
57486
+ return this;
57487
+ }
57488
+ exclude(predicate) {
57489
+ this.options.exclude = predicate;
57490
+ return this;
57491
+ }
57492
+ onlyCounts() {
57493
+ this.options.onlyCounts = true;
57494
+ return this;
57495
+ }
57496
+ crawl(root) {
57497
+ return new APIBuilder(root || ".", this.options);
57498
+ }
57499
+ withGlobFunction(fn) {
57500
+ this.globFunction = fn;
57501
+ return this;
57502
+ }
57503
+ crawlWithOptions(root, options) {
57504
+ this.options = {
57505
+ ...this.options,
57506
+ ...options
57507
+ };
57508
+ return new APIBuilder(root || ".", this.options);
57509
+ }
57510
+ glob(...patterns) {
57511
+ if (this.globFunction)
57512
+ return this.globWithOptions(patterns);
57513
+ return this.globWithOptions(patterns, ...[{ dot: true }]);
57514
+ }
57515
+ globWithOptions(patterns, ...options) {
57516
+ const globFn = this.globFunction || pm;
57517
+ if (!globFn)
57518
+ throw new Error("Please specify a glob function to use glob matching.");
57519
+ var isMatch = this.globCache[patterns.join("\x00")];
57520
+ if (!isMatch) {
57521
+ isMatch = globFn(patterns, ...options);
57522
+ this.globCache[patterns.join("\x00")] = isMatch;
57523
+ }
57524
+ this.options.filters.push((path5) => isMatch(path5));
57525
+ return this;
57526
+ }
57527
+ };
57528
+
57529
+ // node_modules/tinyglobby/dist/index.mjs
57530
+ var import_picomatch = __toESM(require_picomatch2(), 1);
57531
+ var ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
57532
+ function getPartialMatcher(patterns, options) {
57533
+ const patternsCount = patterns.length;
57534
+ const patternsParts = Array(patternsCount);
57535
+ const regexes = Array(patternsCount);
57536
+ for (let i = 0;i < patternsCount; i++) {
57537
+ const parts = splitPattern(patterns[i]);
57538
+ patternsParts[i] = parts;
57539
+ const partsCount = parts.length;
57540
+ const partRegexes = Array(partsCount);
57541
+ for (let j = 0;j < partsCount; j++)
57542
+ partRegexes[j] = import_picomatch.default.makeRe(parts[j], options);
57543
+ regexes[i] = partRegexes;
57544
+ }
57545
+ return (input) => {
57546
+ const inputParts = input.split("/");
57547
+ if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input))
57548
+ return true;
57549
+ for (let i = 0;i < patterns.length; i++) {
57550
+ const patternParts = patternsParts[i];
57551
+ const regex2 = regexes[i];
57552
+ const inputPatternCount = inputParts.length;
57553
+ const minParts = Math.min(inputPatternCount, patternParts.length);
57554
+ let j = 0;
57555
+ while (j < minParts) {
57556
+ const part = patternParts[j];
57557
+ if (part.includes("/"))
57558
+ return true;
57559
+ const match = regex2[j].test(inputParts[j]);
57560
+ if (!match)
57561
+ break;
57562
+ if (part === "**")
57563
+ return true;
57564
+ j++;
57565
+ }
57566
+ if (j === inputPatternCount)
57567
+ return true;
57568
+ }
57569
+ return false;
57570
+ };
57571
+ }
57572
+ var splitPatternOptions = { parts: true };
57573
+ function splitPattern(path$1) {
57574
+ var _result$parts;
57575
+ const result = import_picomatch.default.scan(path$1, splitPatternOptions);
57576
+ return ((_result$parts = result.parts) === null || _result$parts === undefined ? undefined : _result$parts.length) ? result.parts : [path$1];
57577
+ }
57578
+ var isWin = process.platform === "win32";
57579
+ var POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
57580
+ var WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
57581
+ var escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
57582
+ var escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
57583
+ var escapePath = isWin ? escapeWin32Path : escapePosixPath;
57584
+ function isDynamicPattern(pattern, options) {
57585
+ if ((options === null || options === undefined ? undefined : options.caseSensitiveMatch) === false)
57586
+ return true;
57587
+ const scan = import_picomatch.default.scan(pattern);
57588
+ return scan.isGlob || scan.negated;
57589
+ }
57590
+ function log(...tasks) {
57591
+ console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`, ...tasks);
57592
+ }
57593
+ var PARENT_DIRECTORY = /^(\/?\.\.)+/;
57594
+ var ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
57595
+ var BACKSLASHES = /\\/g;
57596
+ function normalizePattern(pattern, expandDirectories, cwd2, props, isIgnore) {
57597
+ let result = pattern;
57598
+ if (pattern.endsWith("/"))
57599
+ result = pattern.slice(0, -1);
57600
+ if (!result.endsWith("*") && expandDirectories)
57601
+ result += "/**";
57602
+ const escapedCwd = escapePath(cwd2);
57603
+ if (path5.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")))
57604
+ result = posix.relative(escapedCwd, result);
57605
+ else
57606
+ result = posix.normalize(result);
57607
+ const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
57608
+ const parts = splitPattern(result);
57609
+ if (parentDirectoryMatch === null || parentDirectoryMatch === undefined ? undefined : parentDirectoryMatch[0]) {
57610
+ const n = (parentDirectoryMatch[0].length + 1) / 3;
57611
+ let i = 0;
57612
+ const cwdParts = escapedCwd.split("/");
57613
+ while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
57614
+ result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
57615
+ i++;
57616
+ }
57617
+ const potentialRoot = posix.join(cwd2, parentDirectoryMatch[0].slice(i * 3));
57618
+ if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
57619
+ props.root = potentialRoot;
57620
+ props.depthOffset = -n + i;
57621
+ }
57622
+ }
57623
+ if (!isIgnore && props.depthOffset >= 0) {
57624
+ var _props$commonPath;
57625
+ (_props$commonPath = props.commonPath) !== null && _props$commonPath !== undefined || (props.commonPath = parts);
57626
+ const newCommonPath = [];
57627
+ const length = Math.min(props.commonPath.length, parts.length);
57628
+ for (let i = 0;i < length; i++) {
57629
+ const part = parts[i];
57630
+ if (part === "**" && !parts[i + 1]) {
57631
+ newCommonPath.pop();
57632
+ break;
57633
+ }
57634
+ if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1)
57635
+ break;
57636
+ newCommonPath.push(part);
57637
+ }
57638
+ props.depthOffset = newCommonPath.length;
57639
+ props.commonPath = newCommonPath;
57640
+ props.root = newCommonPath.length > 0 ? path5.posix.join(cwd2, ...newCommonPath) : cwd2;
57641
+ }
57642
+ return result;
57643
+ }
57644
+ function processPatterns({ patterns, ignore = [], expandDirectories = true }, cwd2, props) {
57645
+ if (typeof patterns === "string")
57646
+ patterns = [patterns];
57647
+ else if (!patterns)
57648
+ patterns = ["**/*"];
57649
+ if (typeof ignore === "string")
57650
+ ignore = [ignore];
57651
+ const matchPatterns = [];
57652
+ const ignorePatterns = [];
57653
+ for (const pattern of ignore) {
57654
+ if (!pattern)
57655
+ continue;
57656
+ if (pattern[0] !== "!" || pattern[1] === "(")
57657
+ ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd2, props, true));
57658
+ }
57659
+ for (const pattern of patterns) {
57660
+ if (!pattern)
57661
+ continue;
57662
+ if (pattern[0] !== "!" || pattern[1] === "(")
57663
+ matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd2, props, false));
57664
+ else if (pattern[1] !== "!" || pattern[2] === "(")
57665
+ ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd2, props, true));
57666
+ }
57667
+ return {
57668
+ match: matchPatterns,
57669
+ ignore: ignorePatterns
57670
+ };
57671
+ }
57672
+ function getRelativePath(path$1, cwd2, root) {
57673
+ return posix.relative(cwd2, `${root}/${path$1}`) || ".";
57674
+ }
57675
+ function processPath(path$1, cwd2, root, isDirectory, absolute) {
57676
+ const relativePath = absolute ? path$1.slice(root === "/" ? 1 : root.length + 1) || "." : path$1;
57677
+ if (root === cwd2)
57678
+ return isDirectory && relativePath !== "." ? relativePath.slice(0, -1) : relativePath;
57679
+ return getRelativePath(relativePath, cwd2, root);
57680
+ }
57681
+ function formatPaths(paths, cwd2, root) {
57682
+ for (let i = paths.length - 1;i >= 0; i--) {
57683
+ const path$1 = paths[i];
57684
+ paths[i] = getRelativePath(path$1, cwd2, root) + (!path$1 || path$1.endsWith("/") ? "/" : "");
57685
+ }
57686
+ return paths;
57687
+ }
57688
+ function crawl(options, cwd2, sync2) {
57689
+ if (process.env.TINYGLOBBY_DEBUG)
57690
+ options.debug = true;
57691
+ if (options.debug)
57692
+ log("globbing with options:", options, "cwd:", cwd2);
57693
+ if (Array.isArray(options.patterns) && options.patterns.length === 0)
57694
+ return sync2 ? [] : Promise.resolve([]);
57695
+ const props = {
57696
+ root: cwd2,
57697
+ commonPath: null,
57698
+ depthOffset: 0
57699
+ };
57700
+ const processed = processPatterns(options, cwd2, props);
57701
+ const nocase = options.caseSensitiveMatch === false;
57702
+ if (options.debug)
57703
+ log("internal processing patterns:", processed);
57704
+ const matcher = import_picomatch.default(processed.match, {
57705
+ dot: options.dot,
57706
+ nocase,
57707
+ ignore: processed.ignore
57708
+ });
57709
+ const ignore = import_picomatch.default(processed.ignore, {
57710
+ dot: options.dot,
57711
+ nocase
57712
+ });
57713
+ const partialMatcher = getPartialMatcher(processed.match, {
57714
+ dot: options.dot,
57715
+ nocase
57716
+ });
57717
+ const fdirOptions = {
57718
+ filters: [options.debug ? (p, isDirectory) => {
57719
+ const path$1 = processPath(p, cwd2, props.root, isDirectory, options.absolute);
57720
+ const matches = matcher(path$1);
57721
+ if (matches)
57722
+ log(`matched ${path$1}`);
57723
+ return matches;
57724
+ } : (p, isDirectory) => matcher(processPath(p, cwd2, props.root, isDirectory, options.absolute))],
57725
+ exclude: options.debug ? (_, p) => {
57726
+ const relativePath = processPath(p, cwd2, props.root, true, true);
57727
+ const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
57728
+ if (skipped)
57729
+ log(`skipped ${p}`);
57730
+ else
57731
+ log(`crawling ${p}`);
57732
+ return skipped;
57733
+ } : (_, p) => {
57734
+ const relativePath = processPath(p, cwd2, props.root, true, true);
57735
+ return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
57736
+ },
57737
+ pathSeparator: "/",
57738
+ relativePaths: true,
57739
+ resolveSymlinks: true
57740
+ };
57741
+ if (options.deep !== undefined)
57742
+ fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
57743
+ if (options.absolute) {
57744
+ fdirOptions.relativePaths = false;
57745
+ fdirOptions.resolvePaths = true;
57746
+ fdirOptions.includeBasePath = true;
57747
+ }
57748
+ if (options.followSymbolicLinks === false) {
57749
+ fdirOptions.resolveSymlinks = false;
57750
+ fdirOptions.excludeSymlinks = true;
57751
+ }
57752
+ if (options.onlyDirectories) {
57753
+ fdirOptions.excludeFiles = true;
57754
+ fdirOptions.includeDirs = true;
57755
+ } else if (options.onlyFiles === false)
57756
+ fdirOptions.includeDirs = true;
57757
+ props.root = props.root.replace(BACKSLASHES, "");
57758
+ const root = props.root;
57759
+ if (options.debug)
57760
+ log("internal properties:", props);
57761
+ const api2 = new Builder(fdirOptions).crawl(root);
57762
+ if (cwd2 === root || options.absolute)
57763
+ return sync2 ? api2.sync() : api2.withPromise();
57764
+ return sync2 ? formatPaths(api2.sync(), cwd2, root) : api2.withPromise().then((paths) => formatPaths(paths, cwd2, root));
57765
+ }
57766
+ function globSync(patternsOrOptions, options) {
57767
+ if (patternsOrOptions && (options === null || options === undefined ? undefined : options.patterns))
57768
+ throw new Error("Cannot pass patterns as both an argument and an option");
57769
+ const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? {
57770
+ ...options,
57771
+ patterns: patternsOrOptions
57772
+ } : patternsOrOptions;
57773
+ const cwd2 = opts.cwd ? path5.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
57774
+ return crawl(opts, cwd2, true);
57775
+ }
57776
+
57777
+ // src/utils/jsonl.ts
57778
+ import { promisify } from "util";
57779
+ var readFile4 = promisify(fs6.readFile);
57780
+ var readFileSync4 = fs6.readFileSync;
57781
+ var statSync3 = fs6.statSync;
57782
+ async function getSessionDuration(transcriptPath) {
57783
+ try {
57784
+ if (!fs6.existsSync(transcriptPath)) {
57785
+ return null;
57786
+ }
57787
+ const content = await readFile4(transcriptPath, "utf-8");
57788
+ const lines = content.trim().split(`
57789
+ `).filter((line) => line.trim());
57790
+ if (lines.length === 0) {
57791
+ return null;
57792
+ }
57793
+ let firstTimestamp = null;
57794
+ let lastTimestamp = null;
57795
+ for (const line of lines) {
57796
+ try {
57797
+ const data = JSON.parse(line);
57798
+ if (data.timestamp) {
57799
+ firstTimestamp = new Date(data.timestamp);
57800
+ break;
57801
+ }
57802
+ } catch {}
57803
+ }
57804
+ for (let i = lines.length - 1;i >= 0; i--) {
57805
+ try {
57806
+ const data = JSON.parse(lines[i] ?? "");
57807
+ if (data.timestamp) {
57808
+ lastTimestamp = new Date(data.timestamp);
57809
+ break;
57810
+ }
57811
+ } catch {}
57812
+ }
57813
+ if (!firstTimestamp || !lastTimestamp) {
57814
+ return null;
57815
+ }
57816
+ const durationMs = lastTimestamp.getTime() - firstTimestamp.getTime();
57817
+ const totalMinutes = Math.floor(durationMs / (1000 * 60));
57818
+ if (totalMinutes < 1) {
57819
+ return "<1m";
57820
+ }
57821
+ const hours = Math.floor(totalMinutes / 60);
57822
+ const minutes = totalMinutes % 60;
57823
+ if (hours === 0) {
57824
+ return `${minutes}m`;
57825
+ } else if (minutes === 0) {
57826
+ return `${hours}hr`;
57827
+ } else {
57828
+ return `${hours}hr ${minutes}m`;
57829
+ }
57830
+ } catch {
57831
+ return null;
57832
+ }
57833
+ }
57834
+ async function getTokenMetrics(transcriptPath) {
57835
+ try {
57836
+ if (!fs6.existsSync(transcriptPath)) {
57837
+ return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
57838
+ }
57839
+ const content = await readFile4(transcriptPath, "utf-8");
57840
+ const lines = content.trim().split(`
57841
+ `);
57842
+ let inputTokens = 0;
57843
+ let outputTokens = 0;
57844
+ let cachedTokens = 0;
57845
+ let contextLength = 0;
57846
+ let mostRecentMainChainEntry = null;
57847
+ let mostRecentTimestamp = null;
57848
+ for (const line of lines) {
57849
+ try {
57850
+ const data = JSON.parse(line);
57851
+ if (data.message?.usage) {
57852
+ inputTokens += data.message.usage.input_tokens || 0;
57853
+ outputTokens += data.message.usage.output_tokens || 0;
57854
+ cachedTokens += data.message.usage.cache_read_input_tokens ?? 0;
57855
+ cachedTokens += data.message.usage.cache_creation_input_tokens ?? 0;
57856
+ if (data.isSidechain !== true && data.timestamp) {
57857
+ const entryTime = new Date(data.timestamp);
57858
+ if (!mostRecentTimestamp || entryTime > mostRecentTimestamp) {
57859
+ mostRecentTimestamp = entryTime;
57860
+ mostRecentMainChainEntry = data;
55407
57861
  }
55408
- }, undefined, false, undefined, this)
55409
- ]
55410
- }, undefined, true, undefined, this)
55411
- ]
55412
- }, undefined, true, undefined, this);
55413
- };
55414
- function runTUI() {
55415
- process.stdout.write("\x1B[2J\x1B[H");
55416
- render_default(/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(App2, {}, undefined, false, undefined, this));
57862
+ }
57863
+ }
57864
+ } catch {}
57865
+ }
57866
+ if (mostRecentMainChainEntry?.message?.usage) {
57867
+ const usage = mostRecentMainChainEntry.message.usage;
57868
+ contextLength = (usage.input_tokens || 0) + (usage.cache_read_input_tokens ?? 0) + (usage.cache_creation_input_tokens ?? 0);
57869
+ }
57870
+ const totalTokens = inputTokens + outputTokens + cachedTokens;
57871
+ return { inputTokens, outputTokens, cachedTokens, totalTokens, contextLength };
57872
+ } catch {
57873
+ return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
57874
+ }
57875
+ }
57876
+ function getBlockMetrics(transcriptPath) {
57877
+ if (!transcriptPath || typeof transcriptPath !== "string") {
57878
+ return null;
57879
+ }
57880
+ let currentPath = path6.dirname(transcriptPath);
57881
+ let claudePath = null;
57882
+ while (currentPath && currentPath !== path6.dirname(currentPath)) {
57883
+ const baseName = path6.basename(currentPath);
57884
+ if (baseName === ".claude") {
57885
+ claudePath = currentPath;
57886
+ break;
57887
+ }
57888
+ currentPath = path6.dirname(currentPath);
57889
+ }
57890
+ if (!claudePath) {
57891
+ return null;
57892
+ }
57893
+ try {
57894
+ return findMostRecentBlockStartTime(claudePath);
57895
+ } catch {
57896
+ return null;
57897
+ }
57898
+ }
57899
+ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
57900
+ const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
57901
+ const now = new Date;
57902
+ const pattern = path6.join(rootDir, "projects", "**", "*.jsonl").replace(/\\/g, "/");
57903
+ const files = globSync([pattern]);
57904
+ if (files.length === 0) {
57905
+ return null;
57906
+ }
57907
+ const filesWithStats = files.map((file2) => {
57908
+ const stats = statSync3(file2);
57909
+ return { file: file2, mtime: stats.mtime };
57910
+ });
57911
+ filesWithStats.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
57912
+ const timestamps = [];
57913
+ const cutoffTime = new Date(now.getTime() - 20 * 60 * 60 * 1000);
57914
+ for (const { file: file2, mtime } of filesWithStats) {
57915
+ if (mtime.getTime() < cutoffTime.getTime()) {
57916
+ break;
57917
+ }
57918
+ const fileTimestamps = getAllTimestampsFromFile(file2);
57919
+ timestamps.push(...fileTimestamps);
57920
+ }
57921
+ if (timestamps.length === 0) {
57922
+ return null;
57923
+ }
57924
+ timestamps.sort((a, b) => b.getTime() - a.getTime());
57925
+ const mostRecentTimestamp = timestamps[0];
57926
+ if (!mostRecentTimestamp) {
57927
+ return null;
57928
+ }
57929
+ let actualStartTimestamp = mostRecentTimestamp;
57930
+ for (let i = 1;i < timestamps.length; i++) {
57931
+ const currentTimestamp = timestamps[i];
57932
+ const previousTimestamp = timestamps[i - 1];
57933
+ if (!currentTimestamp || !previousTimestamp) {
57934
+ continue;
57935
+ }
57936
+ const gap = previousTimestamp.getTime() - currentTimestamp.getTime();
57937
+ if (gap > sessionDurationMs) {
57938
+ break;
57939
+ }
57940
+ actualStartTimestamp = currentTimestamp;
57941
+ }
57942
+ const elapsedSinceStart = now.getTime() - actualStartTimestamp.getTime();
57943
+ const timeInCurrentBlock = elapsedSinceStart % sessionDurationMs;
57944
+ const blockStart = new Date(now.getTime() - timeInCurrentBlock);
57945
+ const timeSinceActivity = now.getTime() - mostRecentTimestamp.getTime();
57946
+ const blockEnd = new Date(blockStart.getTime() + sessionDurationMs);
57947
+ const isActive = timeSinceActivity < sessionDurationMs && now < blockEnd;
57948
+ return {
57949
+ startTime: blockStart,
57950
+ lastActivity: mostRecentTimestamp,
57951
+ isActive
57952
+ };
57953
+ }
57954
+ function getAllTimestampsFromFile(filePath) {
57955
+ const timestamps = [];
57956
+ try {
57957
+ const content = readFileSync4(filePath, "utf-8");
57958
+ const lines = content.trim().split(`
57959
+ `).filter((line) => line.length > 0);
57960
+ for (const line of lines) {
57961
+ try {
57962
+ const json2 = JSON.parse(line);
57963
+ if (json2.timestamp && typeof json2.timestamp === "string") {
57964
+ const date5 = new Date(json2.timestamp);
57965
+ if (!Number.isNaN(date5.getTime())) {
57966
+ timestamps.push(date5);
57967
+ }
57968
+ }
57969
+ } catch {
57970
+ continue;
57971
+ }
57972
+ }
57973
+ return timestamps;
57974
+ } catch {
57975
+ return [];
57976
+ }
55417
57977
  }
55418
- // src/types/StatusJSON.ts
55419
- var StatusJSONSchema = exports_external.looseObject({
55420
- hook_event_name: exports_external.string().optional(),
55421
- session_id: exports_external.string().optional(),
55422
- transcript_path: exports_external.string().optional(),
55423
- cwd: exports_external.string().optional(),
55424
- model: exports_external.object({
55425
- id: exports_external.string().optional(),
55426
- display_name: exports_external.string().optional()
55427
- }).optional(),
55428
- workspace: exports_external.object({
55429
- current_dir: exports_external.string().optional(),
55430
- project_dir: exports_external.string().optional()
55431
- }).optional(),
55432
- version: exports_external.string().optional(),
55433
- output_style: exports_external.object({ name: exports_external.string().optional() }).optional()
55434
- });
55435
57978
 
55436
57979
  // src/ccstatusline.ts
55437
57980
  async function readStdin() {
@@ -55463,16 +58006,21 @@ async function renderMultipleLines(data) {
55463
58006
  const lines = settings.lines;
55464
58007
  const hasTokenItems = lines.some((line) => line.some((item) => ["tokens-input", "tokens-output", "tokens-cached", "tokens-total", "context-length", "context-percentage", "context-percentage-usable"].includes(item.type)));
55465
58008
  const hasSessionClock = lines.some((line) => line.some((item) => item.type === "session-clock"));
58009
+ const hasBlockTimer = lines.some((line) => line.some((item) => item.type === "block-timer"));
55466
58010
  let tokenMetrics = null;
55467
58011
  if (hasTokenItems && data.transcript_path)
55468
58012
  tokenMetrics = await getTokenMetrics(data.transcript_path);
55469
58013
  let sessionDuration = null;
55470
58014
  if (hasSessionClock && data.transcript_path)
55471
58015
  sessionDuration = await getSessionDuration(data.transcript_path);
58016
+ let blockMetrics = null;
58017
+ if (hasBlockTimer && data.transcript_path)
58018
+ blockMetrics = getBlockMetrics(data.transcript_path);
55472
58019
  const context = {
55473
58020
  data,
55474
58021
  tokenMetrics,
55475
58022
  sessionDuration,
58023
+ blockMetrics,
55476
58024
  isPreview: false
55477
58025
  };
55478
58026
  let globalSeparatorIndex = 0;