ccstatusline-zh 2.2.19 → 2.2.20

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.
@@ -1355,7 +1355,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
1355
1355
  exports.useTransition = function() {
1356
1356
  return resolveDispatcher().useTransition();
1357
1357
  };
1358
- exports.version = "19.2.6";
1358
+ exports.version = "19.2.7";
1359
1359
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1360
1360
  })();
1361
1361
  });
@@ -9713,7 +9713,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
9713
9713
  offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
9714
9714
  offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden;
9715
9715
  commitReconciliationEffects(finishedWork);
9716
- if (flags & 8192 && (root = finishedWork.stateNode, root._visibility = hoistableRoot ? root._visibility & -2 : root._visibility | 1, hoistableRoot && (current2 === null || wasHidden || offscreenSubtreeIsHidden || offscreenSubtreeWasHidden || recursivelyTraverseDisappearLayoutEffects(finishedWork)), supportsMutation))
9716
+ if (flags & 8192 && (root = finishedWork.stateNode, root._visibility = hoistableRoot ? root._visibility & -2 : root._visibility | 1, hoistableRoot && (current2 === null || wasHidden || offscreenSubtreeIsHidden || offscreenSubtreeWasHidden || recursivelyTraverseDisappearLayoutEffects(finishedWork)), supportsMutation)) {
9717
9717
  a:
9718
9718
  if (current2 = null, supportsMutation)
9719
9719
  for (root = finishedWork;; ) {
@@ -9753,6 +9753,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
9753
9753
  root.sibling.return = root.return;
9754
9754
  root = root.sibling;
9755
9755
  }
9756
+ }
9756
9757
  flags & 4 && (flags = finishedWork.updateQueue, flags !== null && (current2 = flags.retryQueue, current2 !== null && (flags.retryQueue = null, attachSuspenseRetryListeners(finishedWork, current2))));
9757
9758
  break;
9758
9759
  case 19:
@@ -18054,7 +18055,7 @@ var require_backend = __commonJS((exports, module) => {
18054
18055
  987: (module2, __unused_webpack_exports, __webpack_require__2) => {
18055
18056
  if (true) {
18056
18057
  module2.exports = __webpack_require__2(786);
18057
- } else {}
18058
+ }
18058
18059
  },
18059
18060
  126: (__unused_webpack_module, exports2, __webpack_require__2) => {
18060
18061
  var process4 = __webpack_require__2(169);
@@ -18504,7 +18505,7 @@ var require_backend = __commonJS((exports, module) => {
18504
18505
  189: (module2, __unused_webpack_exports, __webpack_require__2) => {
18505
18506
  if (true) {
18506
18507
  module2.exports = __webpack_require__2(126);
18507
- } else {}
18508
+ }
18508
18509
  },
18509
18510
  206: function(module2, exports2, __webpack_require__2) {
18510
18511
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
@@ -18519,7 +18520,7 @@ var require_backend = __commonJS((exports, module) => {
18519
18520
  (function(root, factory) {
18520
18521
  if (true) {
18521
18522
  __WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__2(430)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports2, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module2.exports = __WEBPACK_AMD_DEFINE_RESULT__);
18522
- } else {}
18523
+ }
18523
18524
  })(this, function ErrorStackParser(StackFrame) {
18524
18525
  var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
18525
18526
  var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
@@ -19215,7 +19216,7 @@ var require_backend = __commonJS((exports, module) => {
19215
19216
  (function(root, factory) {
19216
19217
  if (true) {
19217
19218
  __WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports2, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module2.exports = __WEBPACK_AMD_DEFINE_RESULT__);
19218
- } else {}
19219
+ }
19219
19220
  })(this, function() {
19220
19221
  function _isNumber(n) {
19221
19222
  return !isNaN(parseFloat(n)) && isFinite(n);
@@ -24589,7 +24590,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24589
24590
  var suffix = "";
24590
24591
  if (true) {
24591
24592
  suffix = " (<anonymous>)";
24592
- } else {}
24593
+ }
24593
24594
  return `
24594
24595
  ` + prefix + name + suffix;
24595
24596
  }
@@ -27318,7 +27319,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
27318
27319
  hasChanges = true;
27319
27320
  updateMostRecentlyInspectedElementIfNecessary(devtoolsInstance.id);
27320
27321
  }
27321
- } else {}
27322
+ }
27322
27323
  }
27323
27324
  } catch (err) {
27324
27325
  _iterator2.e(err);
@@ -29097,7 +29098,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29097
29098
  if (contentFiber === null) {
29098
29099
  throw new Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");
29099
29100
  }
29100
- } else {}
29101
+ }
29101
29102
  var _isTimedOut = fiber.memoizedState !== null;
29102
29103
  if (!_isTimedOut) {
29103
29104
  newSuspenseNode.rects = measureInstance(newInstance);
@@ -29131,7 +29132,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29131
29132
  if (_contentFiber === null) {
29132
29133
  throw new Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");
29133
29134
  }
29134
- } else {}
29135
+ }
29135
29136
  var suspenseState = fiber.memoizedState;
29136
29137
  var _isTimedOut3 = suspenseState !== null;
29137
29138
  if (!_isTimedOut3) {
@@ -29231,7 +29232,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29231
29232
  trackThrownPromisesFromRetryCache(newSuspenseNode, fiber.stateNode);
29232
29233
  mountSuspenseChildrenRecursively(_contentFiber2, traceNearestHostComponentUpdate, stashedSuspenseParent, stashedSuspensePrevious, stashedSuspenseRemaining);
29233
29234
  shouldPopSuspenseNode = false;
29234
- } else {}
29235
+ }
29235
29236
  } else {
29236
29237
  if (fiber.child !== null) {
29237
29238
  mountChildrenRecursively(fiber.child, traceNearestHostComponentUpdate);
@@ -29817,7 +29818,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29817
29818
  shouldPopSuspenseNode = false;
29818
29819
  } else if (previousHydrated && !nextHydrated) {
29819
29820
  throw new Error("Encountered a dehydrated Suspense boundary that was previously hydrated.");
29820
- } else {}
29821
+ }
29821
29822
  } else {
29822
29823
  if (nextFiber.child !== prevFiber.child) {
29823
29824
  updateFlags |= updateChildrenRecursively(nextFiber.child, prevFiber.child, traceNearestHostComponentUpdate);
@@ -29863,8 +29864,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29863
29864
  recordResetChildren(fiberInstance);
29864
29865
  }
29865
29866
  updateFlags &= ~ShouldResetChildren;
29866
- } else {}
29867
- } else {}
29867
+ }
29868
+ }
29868
29869
  if ((updateFlags & ShouldResetSuspenseChildren) !== NoUpdate) {
29869
29870
  if (fiberInstance !== null && fiberInstance.kind === FIBER_INSTANCE) {
29870
29871
  var _suspenseNode3 = fiberInstance.suspenseNode;
@@ -29872,7 +29873,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29872
29873
  recordResetSuspenseChildren(_suspenseNode3);
29873
29874
  updateFlags &= ~ShouldResetSuspenseChildren;
29874
29875
  }
29875
- } else {}
29876
+ }
29876
29877
  }
29877
29878
  if ((updateFlags & ShouldResetParentSuspenseChildren) !== NoUpdate) {
29878
29879
  if (fiberInstance !== null && fiberInstance.kind === FIBER_INSTANCE) {
@@ -29881,7 +29882,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29881
29882
  updateFlags &= ~ShouldResetParentSuspenseChildren;
29882
29883
  updateFlags |= ShouldResetSuspenseChildren;
29883
29884
  }
29884
- } else {}
29885
+ }
29885
29886
  }
29886
29887
  return updateFlags;
29887
29888
  } finally {
@@ -32945,7 +32946,7 @@ The error thrown in the component is:
32945
32946
  rendererInterface = renderer_attach(hook, id, renderer, global2, shouldStartProfilingNow, profilingSettings);
32946
32947
  } else if (renderer.ComponentTree) {
32947
32948
  rendererInterface = legacy_renderer_attach(hook, id, renderer, global2);
32948
- } else {}
32949
+ }
32949
32950
  }
32950
32951
  return rendererInterface;
32951
32952
  }
@@ -49536,7 +49537,7 @@ function finalize(ctx, schema) {
49536
49537
  result2.$schema = "http://json-schema.org/draft-07/schema#";
49537
49538
  } else if (ctx.target === "draft-04") {
49538
49539
  result2.$schema = "http://json-schema.org/draft-04/schema#";
49539
- } else if (ctx.target === "openapi-3.0") {} else {}
49540
+ } else if (ctx.target === "openapi-3.0") {}
49540
49541
  if (ctx.external?.uri) {
49541
49542
  const id = ctx.external.registry.get(schema)?.id;
49542
49543
  if (!id)
@@ -49797,7 +49798,7 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
49797
49798
  if (val === undefined) {
49798
49799
  if (ctx.unrepresentable === "throw") {
49799
49800
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
49800
- } else {}
49801
+ }
49801
49802
  } else if (typeof val === "bigint") {
49802
49803
  if (ctx.unrepresentable === "throw") {
49803
49804
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -54705,35 +54706,70 @@ function getOriginUrl(cwd2, deps) {
54705
54706
  const url2 = runGitForCache(["remote", "get-url", "--", "origin"], cwd2, deps);
54706
54707
  return url2.length > 0 ? url2 : null;
54707
54708
  }
54709
+ function isSshRemoteUrl(url2) {
54710
+ const trimmed = url2.trim().toLowerCase();
54711
+ return trimmed.startsWith("ssh://") || !trimmed.includes("://");
54712
+ }
54713
+ function resolveSshHostAlias(host, deps) {
54714
+ try {
54715
+ const output = deps.execFileSync("ssh", ["-G", host], {
54716
+ encoding: "utf8",
54717
+ stdio: ["pipe", "pipe", "ignore"],
54718
+ timeout: CLI_TIMEOUT,
54719
+ windowsHide: true
54720
+ }).trim();
54721
+ for (const line of output.split(/\r?\n/)) {
54722
+ const match = /^hostname\s+(.+)$/i.exec(line.trim());
54723
+ if (match?.[1]) {
54724
+ return match[1].toLowerCase();
54725
+ }
54726
+ }
54727
+ } catch {}
54728
+ return host.toLowerCase();
54729
+ }
54730
+ function getNamedForgeProvider(host) {
54731
+ if (host.includes("github")) {
54732
+ return "gh";
54733
+ }
54734
+ if (host.includes("gitlab")) {
54735
+ return "glab";
54736
+ }
54737
+ return null;
54738
+ }
54739
+ function getEffectiveRemoteHost(url2, host, deps) {
54740
+ const normalizedHost = host.toLowerCase();
54741
+ if (!isSshRemoteUrl(url2) || getNamedForgeProvider(normalizedHost)) {
54742
+ return normalizedHost;
54743
+ }
54744
+ return resolveSshHostAlias(normalizedHost, deps);
54745
+ }
54708
54746
  function getOriginHost(cwd2, deps) {
54709
54747
  const url2 = getOriginUrl(cwd2, deps);
54710
54748
  if (!url2) {
54711
54749
  return null;
54712
54750
  }
54713
54751
  const parsed = parseRemoteUrl(url2);
54714
- return parsed ? parsed.host.toLowerCase() : null;
54752
+ return parsed ? getEffectiveRemoteHost(url2, parsed.host, deps) : null;
54715
54753
  }
54716
- function toHttpsRepoRef(url2) {
54754
+ function toHttpsRepoRef(url2, deps) {
54717
54755
  const parsed = parseRemoteUrl(url2);
54718
54756
  if (!parsed) {
54719
54757
  return null;
54720
54758
  }
54721
- return `https://${parsed.host}/${parsed.owner}/${parsed.repo}`;
54759
+ return `https://${getEffectiveRemoteHost(url2, parsed.host, deps)}/${parsed.owner}/${parsed.repo}`;
54722
54760
  }
54723
54761
  function getOriginRepoRef(cwd2, deps) {
54724
54762
  const url2 = getOriginUrl(cwd2, deps);
54725
- return url2 ? toHttpsRepoRef(url2) : null;
54763
+ return url2 ? toHttpsRepoRef(url2, deps) : null;
54726
54764
  }
54727
54765
  function getProviderCandidates(cwd2, deps) {
54728
54766
  const host = getOriginHost(cwd2, deps);
54729
54767
  if (!host) {
54730
54768
  return ["gh", "glab"];
54731
54769
  }
54732
- if (host.includes("github")) {
54733
- return ["gh"];
54734
- }
54735
- if (host.includes("gitlab")) {
54736
- return ["glab"];
54770
+ const namedForgeProvider = getNamedForgeProvider(host);
54771
+ if (namedForgeProvider) {
54772
+ return [namedForgeProvider];
54737
54773
  }
54738
54774
  const authed = [];
54739
54775
  if (isCliAuthedForHost("glab", host, deps)) {
@@ -56098,6 +56134,278 @@ function getContextWindowSize(data) {
56098
56134
  return getContextWindowMetrics(data).windowSize;
56099
56135
  }
56100
56136
 
56137
+ // src/utils/gradient.ts
56138
+ function isGradientSpec(value) {
56139
+ return value?.startsWith(GRADIENT_PREFIX) ?? false;
56140
+ }
56141
+ function parseGradientSpec(value) {
56142
+ if (!value?.startsWith(GRADIENT_PREFIX)) {
56143
+ return null;
56144
+ }
56145
+ const body = value.slice(GRADIENT_PREFIX.length).trim();
56146
+ if (!body) {
56147
+ return null;
56148
+ }
56149
+ const preset = GRADIENT_PRESETS[body.toLowerCase()];
56150
+ const rawStops = preset ?? body.split(body.includes(",") ? "," : "-");
56151
+ const stops = rawStops.map((stop) => stop.trim()).filter((stop) => stop.length > 0).map(resolveStopToRgb).filter((rgb) => rgb !== null);
56152
+ return stops.length >= 2 ? stops : null;
56153
+ }
56154
+ function hexToRgb(hex3) {
56155
+ if (!HEX_PATTERN.test(hex3)) {
56156
+ return null;
56157
+ }
56158
+ return {
56159
+ r: parseInt(hex3.slice(0, 2), 16),
56160
+ g: parseInt(hex3.slice(2, 4), 16),
56161
+ b: parseInt(hex3.slice(4, 6), 16)
56162
+ };
56163
+ }
56164
+ function resolveStopToRgb(stop) {
56165
+ if (stop.startsWith("hex:")) {
56166
+ return hexToRgb(stop.slice(4));
56167
+ }
56168
+ if (stop.startsWith("#")) {
56169
+ return hexToRgb(stop.slice(1));
56170
+ }
56171
+ return hexToRgb(stop);
56172
+ }
56173
+ function srgbToLinear(channel) {
56174
+ const normalized = channel / 255;
56175
+ return normalized <= 0.04045 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
56176
+ }
56177
+ function linearToSrgb(channel) {
56178
+ const value = channel <= 0.0031308 ? 12.92 * channel : 1.055 * channel ** (1 / 2.4) - 0.055;
56179
+ return Math.round(Math.min(1, Math.max(0, value)) * 255);
56180
+ }
56181
+ function rgbToOklab(rgb) {
56182
+ const lr = srgbToLinear(rgb.r);
56183
+ const lg = srgbToLinear(rgb.g);
56184
+ const lb = srgbToLinear(rgb.b);
56185
+ const l = 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb;
56186
+ const m = 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb;
56187
+ const s = 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb;
56188
+ const lCbrt = Math.cbrt(l);
56189
+ const mCbrt = Math.cbrt(m);
56190
+ const sCbrt = Math.cbrt(s);
56191
+ return {
56192
+ L: 0.2104542553 * lCbrt + 0.793617785 * mCbrt - 0.0040720468 * sCbrt,
56193
+ a: 1.9779984951 * lCbrt - 2.428592205 * mCbrt + 0.4505937099 * sCbrt,
56194
+ b: 0.0259040371 * lCbrt + 0.7827717662 * mCbrt - 0.808675766 * sCbrt
56195
+ };
56196
+ }
56197
+ function oklabToRgb(lab) {
56198
+ const lCbrt = lab.L + 0.3963377774 * lab.a + 0.2158037573 * lab.b;
56199
+ const mCbrt = lab.L - 0.1055613458 * lab.a - 0.0638541728 * lab.b;
56200
+ const sCbrt = lab.L - 0.0894841775 * lab.a - 1.291485548 * lab.b;
56201
+ const l = lCbrt ** 3;
56202
+ const m = mCbrt ** 3;
56203
+ const s = sCbrt ** 3;
56204
+ return {
56205
+ r: linearToSrgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
56206
+ g: linearToSrgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
56207
+ b: linearToSrgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s)
56208
+ };
56209
+ }
56210
+ function sampleGradient(stops, t) {
56211
+ const first = stops[0];
56212
+ if (first === undefined) {
56213
+ return { r: 0, g: 0, b: 0 };
56214
+ }
56215
+ if (stops.length === 1) {
56216
+ return first;
56217
+ }
56218
+ const clamped = Math.min(1, Math.max(0, t));
56219
+ const scaled = clamped * (stops.length - 1);
56220
+ const lowerIndex = Math.min(stops.length - 2, Math.floor(scaled));
56221
+ const lower = stops[lowerIndex];
56222
+ const upper = stops[lowerIndex + 1];
56223
+ if (lower === undefined || upper === undefined) {
56224
+ return first;
56225
+ }
56226
+ const fraction = scaled - lowerIndex;
56227
+ const labLower = rgbToOklab(lower);
56228
+ const labUpper = rgbToOklab(upper);
56229
+ return oklabToRgb({
56230
+ L: labLower.L + (labUpper.L - labLower.L) * fraction,
56231
+ a: labLower.a + (labUpper.a - labLower.a) * fraction,
56232
+ b: labLower.b + (labUpper.b - labLower.b) * fraction
56233
+ });
56234
+ }
56235
+ function rgbToAnsi256(rgb) {
56236
+ if (rgb.r === rgb.g && rgb.g === rgb.b) {
56237
+ if (rgb.r < 8) {
56238
+ return 16;
56239
+ }
56240
+ if (rgb.r > 248) {
56241
+ return 231;
56242
+ }
56243
+ return Math.round((rgb.r - 8) / 247 * 24) + 232;
56244
+ }
56245
+ return 16 + 36 * Math.round(rgb.r / 255 * 5) + 6 * Math.round(rgb.g / 255 * 5) + Math.round(rgb.b / 255 * 5);
56246
+ }
56247
+ function gradientCodeAt(stops, t, colorLevel) {
56248
+ const rgb = sampleGradient(stops, t);
56249
+ if (colorLevel === "truecolor") {
56250
+ return `\x1B[38;2;${rgb.r};${rgb.g};${rgb.b}m`;
56251
+ }
56252
+ return `\x1B[38;5;${rgbToAnsi256(rgb)}m`;
56253
+ }
56254
+ function isCsiFinalByte(codePoint) {
56255
+ return codePoint >= 64 && codePoint <= 126;
56256
+ }
56257
+ function consumeCsi(input, start, bodyStart) {
56258
+ let index = bodyStart;
56259
+ while (index < input.length) {
56260
+ const codePoint = input.charCodeAt(index);
56261
+ if (isCsiFinalByte(codePoint)) {
56262
+ const end = index + 1;
56263
+ return {
56264
+ nextIndex: end,
56265
+ sequence: input.slice(start, end)
56266
+ };
56267
+ }
56268
+ index++;
56269
+ }
56270
+ return {
56271
+ nextIndex: input.length,
56272
+ sequence: input.slice(start)
56273
+ };
56274
+ }
56275
+ function consumeOsc(input, start, bodyStart) {
56276
+ let index = bodyStart;
56277
+ while (index < input.length) {
56278
+ const current = input[index];
56279
+ if (!current) {
56280
+ break;
56281
+ }
56282
+ if (current === BEL2 || current === ST) {
56283
+ const end = index + 1;
56284
+ return {
56285
+ nextIndex: end,
56286
+ sequence: input.slice(start, end)
56287
+ };
56288
+ }
56289
+ if (current === ESC2 && input[index + 1] === "\\") {
56290
+ const end = index + 2;
56291
+ return {
56292
+ nextIndex: end,
56293
+ sequence: input.slice(start, end)
56294
+ };
56295
+ }
56296
+ index++;
56297
+ }
56298
+ return {
56299
+ nextIndex: input.length,
56300
+ sequence: input.slice(start)
56301
+ };
56302
+ }
56303
+ function consumeEscapeSequence(input, index) {
56304
+ const current = input[index];
56305
+ if (!current) {
56306
+ return null;
56307
+ }
56308
+ if (current === ESC2) {
56309
+ const next = input[index + 1];
56310
+ if (next === "[") {
56311
+ return consumeCsi(input, index, index + 2);
56312
+ }
56313
+ if (next === "]") {
56314
+ return consumeOsc(input, index, index + 2);
56315
+ }
56316
+ if (next) {
56317
+ return {
56318
+ nextIndex: index + 2,
56319
+ sequence: input.slice(index, index + 2)
56320
+ };
56321
+ }
56322
+ return {
56323
+ nextIndex: input.length,
56324
+ sequence: current
56325
+ };
56326
+ }
56327
+ if (current === C1_CSI) {
56328
+ return consumeCsi(input, index, index + 1);
56329
+ }
56330
+ if (current === C1_OSC) {
56331
+ return consumeOsc(input, index, index + 1);
56332
+ }
56333
+ return null;
56334
+ }
56335
+ function applyGradientToText(text, stops, colorLevel) {
56336
+ if (colorLevel === "ansi16" || text.length === 0) {
56337
+ return text;
56338
+ }
56339
+ let visibleCount = 0;
56340
+ let scanIndex = 0;
56341
+ while (scanIndex < text.length) {
56342
+ const escape3 = consumeEscapeSequence(text, scanIndex);
56343
+ if (escape3) {
56344
+ scanIndex = escape3.nextIndex;
56345
+ continue;
56346
+ }
56347
+ const codePoint = text.codePointAt(scanIndex);
56348
+ if (codePoint === undefined) {
56349
+ break;
56350
+ }
56351
+ const ch = String.fromCodePoint(codePoint);
56352
+ if (!WHITESPACE.test(ch)) {
56353
+ visibleCount++;
56354
+ }
56355
+ scanIndex += ch.length;
56356
+ }
56357
+ if (visibleCount === 0) {
56358
+ return text;
56359
+ }
56360
+ const denominator = Math.max(1, visibleCount - 1);
56361
+ let result2 = "";
56362
+ let index = 0;
56363
+ let textIndex = 0;
56364
+ while (textIndex < text.length) {
56365
+ const escape3 = consumeEscapeSequence(text, textIndex);
56366
+ if (escape3) {
56367
+ result2 += escape3.sequence;
56368
+ textIndex = escape3.nextIndex;
56369
+ continue;
56370
+ }
56371
+ const codePoint = text.codePointAt(textIndex);
56372
+ if (codePoint === undefined) {
56373
+ break;
56374
+ }
56375
+ const ch = String.fromCodePoint(codePoint);
56376
+ if (WHITESPACE.test(ch)) {
56377
+ result2 += ch;
56378
+ textIndex += ch.length;
56379
+ continue;
56380
+ }
56381
+ result2 += gradientCodeAt(stops, index / denominator, colorLevel) + ch;
56382
+ index++;
56383
+ textIndex += ch.length;
56384
+ }
56385
+ return result2;
56386
+ }
56387
+ var GRADIENT_PREFIX = "gradient:", HEX_PATTERN, ESC2 = "\x1B", BEL2 = "\x07", C1_CSI = "›", C1_OSC = "", ST = "œ", GRADIENT_PRESETS, GRADIENT_PRESET_NAMES, WHITESPACE;
56388
+ var init_gradient = __esm(() => {
56389
+ HEX_PATTERN = /^[0-9A-Fa-f]{6}$/;
56390
+ GRADIENT_PRESETS = {
56391
+ atlas: ["#feac5e", "#c779d0", "#4bc0c8"],
56392
+ cristal: ["#bdfff3", "#4ac29a"],
56393
+ teen: ["#77a1d3", "#79cbca", "#e684ae"],
56394
+ mind: ["#473b7b", "#3584a7", "#30d2be"],
56395
+ morning: ["#ff5f6d", "#ffc371"],
56396
+ vice: ["#5ee7df", "#b490ca"],
56397
+ passion: ["#f43b47", "#453a94"],
56398
+ fruit: ["#ff4e50", "#f9d423"],
56399
+ instagram: ["#833ab4", "#fd1d1d", "#fcb045"],
56400
+ retro: ["#3f51b1", "#5a55ae", "#7b5fac", "#8f6aae", "#a86aa4", "#cc6b8e", "#f18271", "#f3a469", "#f7c978"],
56401
+ summer: ["#fdbb2d", "#22c1c3"],
56402
+ rainbow: ["#ff0000", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff", "#ff0000"],
56403
+ pastel: ["#aee9d8", "#cdeeb0", "#f6f0a8", "#f7c8a8", "#f3aecb", "#c3b6f0", "#aee9d8"]
56404
+ };
56405
+ GRADIENT_PRESET_NAMES = Object.keys(GRADIENT_PRESETS);
56406
+ WHITESPACE = /\s/;
56407
+ });
56408
+
56101
56409
  // src/utils/ansi.ts
56102
56410
  function createUnicodePropertyRegex(pattern) {
56103
56411
  try {
@@ -56216,14 +56524,14 @@ function getTextDisplayWidth(text) {
56216
56524
  }
56217
56525
  return width;
56218
56526
  }
56219
- function isCsiFinalByte(codePoint) {
56527
+ function isCsiFinalByte2(codePoint) {
56220
56528
  return codePoint >= 64 && codePoint <= 126;
56221
56529
  }
56222
56530
  function parseCsi(input, start, bodyStart) {
56223
56531
  let index = bodyStart;
56224
56532
  while (index < input.length) {
56225
56533
  const codePoint = input.charCodeAt(index);
56226
- if (isCsiFinalByte(codePoint)) {
56534
+ if (isCsiFinalByte2(codePoint)) {
56227
56535
  const end = index + 1;
56228
56536
  return {
56229
56537
  nextIndex: end,
@@ -56255,7 +56563,7 @@ function parseOsc(input, start, bodyStart) {
56255
56563
  if (!current) {
56256
56564
  break;
56257
56565
  }
56258
- if (current === BEL2) {
56566
+ if (current === BEL3) {
56259
56567
  const end = index + 1;
56260
56568
  const body = input.slice(bodyStart, index);
56261
56569
  return {
@@ -56265,7 +56573,7 @@ function parseOsc(input, start, bodyStart) {
56265
56573
  osc8Terminator: "bel"
56266
56574
  };
56267
56575
  }
56268
- if (current === ST) {
56576
+ if (current === ST2) {
56269
56577
  const end = index + 1;
56270
56578
  const body = input.slice(bodyStart, index);
56271
56579
  return {
@@ -56275,7 +56583,7 @@ function parseOsc(input, start, bodyStart) {
56275
56583
  osc8Terminator: "st"
56276
56584
  };
56277
56585
  }
56278
- if (current === ESC2 && input[index + 1] === "\\") {
56586
+ if (current === ESC3 && input[index + 1] === "\\") {
56279
56587
  const end = index + 2;
56280
56588
  const body = input.slice(bodyStart, index);
56281
56589
  return {
@@ -56297,7 +56605,7 @@ function parseEscapeSequence(input, index) {
56297
56605
  if (!current) {
56298
56606
  return null;
56299
56607
  }
56300
- if (current === ESC2) {
56608
+ if (current === ESC3) {
56301
56609
  const next = input[index + 1];
56302
56610
  if (next === "[") {
56303
56611
  return parseCsi(input, index, index + 2);
@@ -56316,19 +56624,19 @@ function parseEscapeSequence(input, index) {
56316
56624
  sequence: current
56317
56625
  };
56318
56626
  }
56319
- if (current === C1_CSI) {
56627
+ if (current === C1_CSI2) {
56320
56628
  return parseCsi(input, index, index + 1);
56321
56629
  }
56322
- if (current === C1_OSC) {
56630
+ if (current === C1_OSC2) {
56323
56631
  return parseOsc(input, index, index + 1);
56324
56632
  }
56325
56633
  return null;
56326
56634
  }
56327
56635
  function getOsc8CloseSequence(terminator) {
56328
56636
  if (terminator === "bel") {
56329
- return `${ESC2}]8;;${BEL2}`;
56637
+ return `${ESC3}]8;;${BEL3}`;
56330
56638
  }
56331
- return `${ESC2}]8;;${ESC2}\\`;
56639
+ return `${ESC3}]8;;${ESC3}\\`;
56332
56640
  }
56333
56641
  function stripSgrCodes(text) {
56334
56642
  return text.replace(SGR_REGEX, "");
@@ -56339,7 +56647,7 @@ function stripOscCodes(text) {
56339
56647
  while (index < text.length) {
56340
56648
  const escape3 = parseEscapeSequence(text, index);
56341
56649
  if (escape3) {
56342
- const isOsc = escape3.sequence.startsWith(`${ESC2}]`) || escape3.sequence.startsWith(C1_OSC);
56650
+ const isOsc = escape3.sequence.startsWith(`${ESC3}]`) || escape3.sequence.startsWith(C1_OSC2);
56343
56651
  if (!isOsc) {
56344
56652
  result2 += escape3.sequence;
56345
56653
  }
@@ -56439,9 +56747,56 @@ function truncateStyledText(text, maxWidth, options = {}) {
56439
56747
  }
56440
56748
  return output + ellipsis;
56441
56749
  }
56442
- var ESC2 = "\x1B", BEL2 = "\x07", C1_CSI = "›", C1_OSC = "", ST = "œ", ZERO_WIDTH_JOINER = 8205, COMBINING_ENCLOSING_KEYCAP = 8419, VARIATION_SELECTOR_START = 65024, VARIATION_SELECTOR_END = 65039, VARIATION_SELECTOR_SUPPLEMENT_START = 917760, VARIATION_SELECTOR_SUPPLEMENT_END = 917999, REGIONAL_INDICATOR_START = 127462, REGIONAL_INDICATOR_END = 127487, SGR_REGEX, EXTENDED_PICTOGRAPHIC_REGEX, EMOJI_PRESENTATION_REGEX, EMOJI_MODIFIER_REGEX, COMBINING_MARK_REGEX;
56750
+ function applyLineGradientSegment(text, stops, colorLevel, startColumn, totalWidth) {
56751
+ const visibleWidth = getVisibleWidth(text);
56752
+ if (stops.length === 0 || colorLevel === "ansi16") {
56753
+ return {
56754
+ text,
56755
+ nextColumn: startColumn + visibleWidth
56756
+ };
56757
+ }
56758
+ if (totalWidth <= 1) {
56759
+ return {
56760
+ text,
56761
+ nextColumn: startColumn + visibleWidth
56762
+ };
56763
+ }
56764
+ const denominator = totalWidth - 1;
56765
+ let output = "";
56766
+ let column = startColumn;
56767
+ let index = 0;
56768
+ while (index < text.length) {
56769
+ const escape3 = parseEscapeSequence(text, index);
56770
+ if (escape3) {
56771
+ output += escape3.sequence;
56772
+ index = escape3.nextIndex;
56773
+ continue;
56774
+ }
56775
+ const cluster = consumeDisplayCluster(text, index);
56776
+ if (!cluster) {
56777
+ break;
56778
+ }
56779
+ output += gradientCodeAt(stops, column / denominator, colorLevel) + cluster.text;
56780
+ column += getClusterWidth(cluster.text);
56781
+ index = cluster.nextIndex;
56782
+ }
56783
+ return {
56784
+ text: output,
56785
+ nextColumn: column
56786
+ };
56787
+ }
56788
+ function applyLineGradient(text, stops, colorLevel) {
56789
+ const totalWidth = getVisibleWidth(text);
56790
+ const result2 = applyLineGradientSegment(text, stops, colorLevel, 0, totalWidth);
56791
+ if (result2.text === text) {
56792
+ return text;
56793
+ }
56794
+ return `${result2.text}\x1B[39m`;
56795
+ }
56796
+ var ESC3 = "\x1B", BEL3 = "\x07", C1_CSI2 = "›", C1_OSC2 = "", ST2 = "œ", ZERO_WIDTH_JOINER = 8205, COMBINING_ENCLOSING_KEYCAP = 8419, VARIATION_SELECTOR_START = 65024, VARIATION_SELECTOR_END = 65039, VARIATION_SELECTOR_SUPPLEMENT_START = 917760, VARIATION_SELECTOR_SUPPLEMENT_END = 917999, REGIONAL_INDICATOR_START = 127462, REGIONAL_INDICATOR_END = 127487, SGR_REGEX, EXTENDED_PICTOGRAPHIC_REGEX, EMOJI_PRESENTATION_REGEX, EMOJI_MODIFIER_REGEX, COMBINING_MARK_REGEX;
56443
56797
  var init_ansi = __esm(() => {
56444
56798
  init_string_width();
56799
+ init_gradient();
56445
56800
  SGR_REGEX = /\x1b\[[0-9;]*m/g;
56446
56801
  EXTENDED_PICTOGRAPHIC_REGEX = createUnicodePropertyRegex("\\p{Extended_Pictographic}");
56447
56802
  EMOJI_PRESENTATION_REGEX = createUnicodePropertyRegex("\\p{Emoji_Presentation}");
@@ -56553,6 +56908,10 @@ function applyColors(text, foregroundColor, backgroundColor, bold, colorLevel =
56553
56908
  }
56554
56909
  }
56555
56910
  if (foregroundColor) {
56911
+ const gradientStops = parseGradientSpec(foregroundColor);
56912
+ if (gradientStops && colorLevel !== "ansi16") {
56913
+ return prefix + applyGradientToText(text, gradientStops, colorLevel) + "\x1B[39m" + suffix;
56914
+ }
56556
56915
  const fgCode = getColorAnsiCode(foregroundColor, colorLevel, false);
56557
56916
  if (fgCode) {
56558
56917
  prefix += fgCode;
@@ -56564,6 +56923,20 @@ function applyColors(text, foregroundColor, backgroundColor, bold, colorLevel =
56564
56923
  function getColorAnsiCode(colorName, colorLevel = "ansi16", isBackground = false) {
56565
56924
  if (!colorName)
56566
56925
  return "";
56926
+ if (isGradientSpec(colorName)) {
56927
+ const stops = parseGradientSpec(colorName);
56928
+ const first = stops?.[0];
56929
+ if (!first)
56930
+ return "";
56931
+ if (colorLevel === "ansi16") {
56932
+ return "";
56933
+ }
56934
+ if (colorLevel === "ansi256") {
56935
+ const code = rgbToAnsi256(first);
56936
+ return isBackground ? `\x1B[48;5;${code}m` : `\x1B[38;5;${code}m`;
56937
+ }
56938
+ return isBackground ? `\x1B[48;2;${first.r};${first.g};${first.b}m` : `\x1B[38;2;${first.r};${first.g};${first.b}m`;
56939
+ }
56567
56940
  if (colorName.startsWith("ansi256:")) {
56568
56941
  const code = parseInt(colorName.substring(8), 10);
56569
56942
  if (!isNaN(code) && code >= 0 && code <= 255) {
@@ -56633,6 +57006,7 @@ function getDefaultPowerlineTheme() {
56633
57006
  var COLOR_MAP, POWERLINE_THEMES;
56634
57007
  var init_colors = __esm(() => {
56635
57008
  init_source();
57009
+ init_gradient();
56636
57010
  COLOR_MAP = createColorMap();
56637
57011
  POWERLINE_THEMES = {
56638
57012
  custom: {
@@ -57026,7 +57400,7 @@ function getTerminalWidth() {
57026
57400
  function canDetectTerminalWidth() {
57027
57401
  return probeTerminalWidth() !== null;
57028
57402
  }
57029
- var __dirname = "/Users/bytedance/Documents/code/ai/ccstatusline-zh/src/utils", PACKAGE_VERSION = "2.2.19";
57403
+ var __dirname = "/home/runner/work/ccstatusline-zh/ccstatusline-zh/src/utils", PACKAGE_VERSION = "2.2.20";
57030
57404
  var init_terminal = () => {};
57031
57405
 
57032
57406
  // src/utils/renderer.ts
@@ -57037,6 +57411,10 @@ function formatTokens(count) {
57037
57411
  return `${(count / 1000).toFixed(1)}k`;
57038
57412
  return count.toString();
57039
57413
  }
57414
+ function maybeApplyForegroundGradient(line, settings, colorLevel) {
57415
+ const stops = parseGradientSpec(settings.overrideForegroundColor);
57416
+ return stops ? applyLineGradient(line, stops, colorLevel) : line;
57417
+ }
57040
57418
  function resolveEffectiveTerminalWidth(detectedWidth, settings, context) {
57041
57419
  if (!detectedWidth) {
57042
57420
  return null;
@@ -57089,6 +57467,7 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
57089
57467
  }
57090
57468
  }
57091
57469
  const colorLevel = getColorLevelString(settings.colorLevel);
57470
+ const overrideForegroundGradientStops = parseGradientSpec(settings.overrideForegroundColor);
57092
57471
  const filteredWidgets = widgets.filter((widget) => widget.type !== "separator" && widget.type !== "flex-separator");
57093
57472
  if (filteredWidgets.length === 0)
57094
57473
  return "";
@@ -57145,7 +57524,7 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
57145
57524
  widgetColorIndex++;
57146
57525
  }
57147
57526
  }
57148
- if (settings.overrideForegroundColor && settings.overrideForegroundColor !== "none") {
57527
+ if (settings.overrideForegroundColor && settings.overrideForegroundColor !== "none" && !isGradientSpec(settings.overrideForegroundColor)) {
57149
57528
  fgColor = settings.overrideForegroundColor;
57150
57529
  }
57151
57530
  widgetElements.push({
@@ -57192,6 +57571,11 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
57192
57571
  }
57193
57572
  }
57194
57573
  }
57574
+ const powerlineGradientWidth = overrideForegroundGradientStops && colorLevel !== "ansi16" ? widgetElements.reduce((sum2, element) => {
57575
+ const isPreserveColors = element.widget.type === "custom-command" && element.widget.preserveColors;
57576
+ return isPreserveColors ? sum2 : sum2 + getVisibleWidth(element.content);
57577
+ }, 0) : 0;
57578
+ let powerlineGradientColumn = 0;
57195
57579
  let result2 = "";
57196
57580
  if (startCap && widgetElements.length > 0) {
57197
57581
  const firstWidget = widgetElements[0];
@@ -57215,13 +57599,20 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
57215
57599
  if (shouldBold && !isPreserveColors) {
57216
57600
  widgetContent += "\x1B[1m";
57217
57601
  }
57218
- if (widget.fgColor && !isPreserveColors) {
57602
+ const textGradientStops = !isPreserveColors && powerlineGradientWidth > 1 ? overrideForegroundGradientStops : null;
57603
+ if (widget.fgColor && !isPreserveColors && !textGradientStops) {
57219
57604
  widgetContent += getColorAnsiCode(widget.fgColor, colorLevel, false);
57220
57605
  }
57221
57606
  if (widget.bgColor) {
57222
57607
  widgetContent += getColorAnsiCode(widget.bgColor, colorLevel, true);
57223
57608
  }
57224
- widgetContent += widget.content;
57609
+ if (textGradientStops) {
57610
+ const gradientResult = applyLineGradientSegment(widget.content, textGradientStops, colorLevel, powerlineGradientColumn, powerlineGradientWidth);
57611
+ widgetContent += gradientResult.text;
57612
+ powerlineGradientColumn = gradientResult.nextColumn;
57613
+ } else {
57614
+ widgetContent += widget.content;
57615
+ }
57225
57616
  if (isPreserveColors) {
57226
57617
  widgetContent += "\x1B[0m";
57227
57618
  } else {
@@ -57398,7 +57789,7 @@ function calculateMaxWidthsFromPreRendered(preRenderedLines, settings) {
57398
57789
  }
57399
57790
  function renderStatusLineWithInfo(widgets, settings, context, preRenderedWidgets, preCalculatedMaxWidths) {
57400
57791
  const line = renderStatusLine(widgets, settings, context, preRenderedWidgets, preCalculatedMaxWidths);
57401
- const wasTruncated = line.includes("...");
57792
+ const wasTruncated = getVisibleText(line).includes("...");
57402
57793
  return { line, wasTruncated };
57403
57794
  }
57404
57795
  function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCalculatedMaxWidths) {
@@ -57409,8 +57800,13 @@ function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCal
57409
57800
  return renderPowerlineStatusLine(widgets, settings, context, context.lineIndex ?? 0, context.globalSeparatorIndex ?? 0, context.globalPowerlineThemeIndex ?? 0, preRenderedWidgets, preCalculatedMaxWidths);
57410
57801
  const applyColorsWithOverride = (text, foregroundColor, backgroundColor, bold) => {
57411
57802
  let fgColor = foregroundColor;
57412
- if (settings.overrideForegroundColor && settings.overrideForegroundColor !== "none") {
57413
- fgColor = settings.overrideForegroundColor;
57803
+ const fgOverride = settings.overrideForegroundColor;
57804
+ if (fgOverride && fgOverride !== "none") {
57805
+ if (!isGradientSpec(fgOverride)) {
57806
+ fgColor = fgOverride;
57807
+ } else if (colorLevel !== "ansi16") {
57808
+ fgColor = undefined;
57809
+ }
57414
57810
  }
57415
57811
  let bgColor = backgroundColor;
57416
57812
  if (settings.overrideBackgroundColor && settings.overrideBackgroundColor !== "none") {
@@ -57599,6 +57995,7 @@ function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCal
57599
57995
  statusLine = truncateStyledText(statusLine, maxWidth, { ellipsis: true });
57600
57996
  }
57601
57997
  }
57998
+ statusLine = maybeApplyForegroundGradient(statusLine, settings, colorLevel);
57602
57999
  return statusLine;
57603
58000
  }
57604
58001
  var init_renderer2 = __esm(async () => {
@@ -57607,6 +58004,7 @@ var init_renderer2 = __esm(async () => {
57607
58004
  init_ansi();
57608
58005
  init_colors();
57609
58006
  init_context_percentage();
58007
+ init_gradient();
57610
58008
  init_terminal();
57611
58009
  await init_widgets2();
57612
58010
  });
@@ -57637,13 +58035,13 @@ class TokensInputWidget {
57637
58035
  if (context.isPreview) {
57638
58036
  return formatRawOrLabeledValue(item, "输入: ", "15.2k");
57639
58037
  }
58038
+ if (context.tokenMetrics) {
58039
+ return formatRawOrLabeledValue(item, "输入: ", formatTokens(context.tokenMetrics.inputTokens));
58040
+ }
57640
58041
  const inputTotalTokens = getContextWindowInputTotalTokens(context.data);
57641
58042
  if (inputTotalTokens !== null) {
57642
58043
  return formatRawOrLabeledValue(item, "输入: ", formatTokens(inputTotalTokens));
57643
58044
  }
57644
- if (context.tokenMetrics) {
57645
- return formatRawOrLabeledValue(item, "输入: ", formatTokens(context.tokenMetrics.inputTokens));
57646
- }
57647
58045
  return null;
57648
58046
  }
57649
58047
  supportsRawValue() {
@@ -57678,13 +58076,13 @@ class TokensOutputWidget {
57678
58076
  if (context.isPreview) {
57679
58077
  return formatRawOrLabeledValue(item, "输出: ", "3.4k");
57680
58078
  }
58079
+ if (context.tokenMetrics) {
58080
+ return formatRawOrLabeledValue(item, "输出: ", formatTokens(context.tokenMetrics.outputTokens));
58081
+ }
57681
58082
  const outputTotalTokens = getContextWindowOutputTotalTokens(context.data);
57682
58083
  if (outputTotalTokens !== null) {
57683
58084
  return formatRawOrLabeledValue(item, "输出: ", formatTokens(outputTotalTokens));
57684
58085
  }
57685
- if (context.tokenMetrics) {
57686
- return formatRawOrLabeledValue(item, "输出: ", formatTokens(context.tokenMetrics.outputTokens));
57687
- }
57688
58086
  return null;
57689
58087
  }
57690
58088
  supportsRawValue() {
@@ -58104,6 +58502,12 @@ function toggleUsageDateMode(item) {
58104
58502
  function toggleUsageHourFormat(item) {
58105
58503
  return toggleMetadataFlag(item, "hour12");
58106
58504
  }
58505
+ function isUsageWeekdayEnabled(item) {
58506
+ return isMetadataFlagEnabled(item, "weekday");
58507
+ }
58508
+ function toggleUsageWeekday(item) {
58509
+ return toggleMetadataFlag(item, "weekday");
58510
+ }
58107
58511
  function getUsageDisplayModifierText(item, options = {}) {
58108
58512
  const mode = getUsageDisplayMode(item);
58109
58513
  const modifiers = [];
@@ -58190,6 +58594,9 @@ function getUsageTimerCustomKeybinds(item, options = {}) {
58190
58594
  if (options.includeHourFormat) {
58191
58595
  keybinds.push(HOUR_FORMAT_TOGGLE_KEYBIND);
58192
58596
  }
58597
+ if (options.includeWeekday) {
58598
+ keybinds.push(WEEKDAY_TOGGLE_KEYBIND);
58599
+ }
58193
58600
  if (options.includeTimezone) {
58194
58601
  keybinds.push(TIMEZONE_KEYBIND);
58195
58602
  }
@@ -58199,7 +58606,7 @@ function getUsageTimerCustomKeybinds(item, options = {}) {
58199
58606
  }
58200
58607
  return keybinds;
58201
58608
  }
58202
- var SLIDER_WIDTH = 10, PROGRESS_TOGGLE_KEYBIND, INVERT_TOGGLE_KEYBIND, COMPACT_TOGGLE_KEYBIND, CURSOR_TOGGLE_KEYBIND, DATE_TOGGLE_KEYBIND, HOUR_FORMAT_TOGGLE_KEYBIND, TIMEZONE_KEYBIND, LOCALE_KEYBIND;
58609
+ var SLIDER_WIDTH = 10, PROGRESS_TOGGLE_KEYBIND, INVERT_TOGGLE_KEYBIND, COMPACT_TOGGLE_KEYBIND, CURSOR_TOGGLE_KEYBIND, DATE_TOGGLE_KEYBIND, HOUR_FORMAT_TOGGLE_KEYBIND, WEEKDAY_TOGGLE_KEYBIND, TIMEZONE_KEYBIND, LOCALE_KEYBIND;
58203
58610
  var init_usage_display = __esm(() => {
58204
58611
  init_locales2();
58205
58612
  PROGRESS_TOGGLE_KEYBIND = { key: "p", label: "(p)进度条切换", action: "toggle-progress" };
@@ -58208,6 +58615,7 @@ var init_usage_display = __esm(() => {
58208
58615
  CURSOR_TOGGLE_KEYBIND = { key: "t", label: "(t)时间游标", action: "toggle-cursor" };
58209
58616
  DATE_TOGGLE_KEYBIND = { key: "t", label: "(t)时间戳", action: "toggle-date" };
58210
58617
  HOUR_FORMAT_TOGGLE_KEYBIND = { key: "h", label: "12/24 小时(h)", action: "toggle-hour-format" };
58618
+ WEEKDAY_TOGGLE_KEYBIND = { key: "w", label: "(w)星期", action: "toggle-weekday" };
58211
58619
  TIMEZONE_KEYBIND = { key: "z", label: "时区(z)", action: "edit-timezone" };
58212
58620
  LOCALE_KEYBIND = { key: "l", label: "(l)地区", action: "edit-locale" };
58213
58621
  });
@@ -60478,7 +60886,7 @@ function hasRequiredUsageField(data, field) {
60478
60886
  if (data[field] !== undefined) {
60479
60887
  return true;
60480
60888
  }
60481
- return data.extraUsageEnabled === false && EXTRA_USAGE_DETAIL_FIELDS.has(field);
60889
+ return data.extraUsageEnabled !== undefined && EXTRA_USAGE_DETAIL_FIELDS.has(field);
60482
60890
  }
60483
60891
  function hasRequiredUsageFields(data, requiredFields = []) {
60484
60892
  return requiredFields.every((field) => hasRequiredUsageField(data, field));
@@ -63110,6 +63518,9 @@ function buildRelative(cwd2, root) {
63110
63518
  return p[p.length - 1] === "/" && result2 !== "" ? `${result2}/` : result2 || ".";
63111
63519
  };
63112
63520
  }
63521
+ function ensureNonDriveRelativePath(path5) {
63522
+ return path5.replace(DRIVE_RELATIVE_PATH, (match) => `${match}/`);
63523
+ }
63113
63524
  function splitPattern(path5) {
63114
63525
  var _result$parts;
63115
63526
  const result2 = import_picomatch.default.scan(path5, splitPatternOptions);
@@ -63149,7 +63560,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
63149
63560
  }
63150
63561
  const potentialRoot = posix.join(cwd2, parentDir.slice(i * 3));
63151
63562
  if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
63152
- props.root = potentialRoot;
63563
+ props.root = ensureNonDriveRelativePath(potentialRoot);
63153
63564
  props.depthOffset = -n + i;
63154
63565
  }
63155
63566
  }
@@ -63170,7 +63581,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
63170
63581
  }
63171
63582
  props.depthOffset = newCommonPath.length;
63172
63583
  props.commonPath = newCommonPath;
63173
- props.root = newCommonPath.length > 0 ? posix.join(cwd2, ...newCommonPath) : cwd2;
63584
+ props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? posix.join(cwd2, ...newCommonPath) : cwd2);
63174
63585
  }
63175
63586
  return result2;
63176
63587
  }
@@ -63269,11 +63680,11 @@ function formatPaths(paths, mapper) {
63269
63680
  return paths;
63270
63681
  }
63271
63682
  function getOptions2(options) {
63272
- const opts = {
63273
- ...defaultOptions,
63274
- ...options
63275
- };
63276
- opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve3(opts.cwd)).replace(BACKSLASHES, "/");
63683
+ const opts = Object.assign({}, options);
63684
+ for (const key in defaultOptions)
63685
+ if (opts[key] === undefined)
63686
+ Object.assign(opts, { [key]: defaultOptions[key] });
63687
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve3(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
63277
63688
  opts.ignore = ensureStringArray(opts.ignore);
63278
63689
  opts.fs && (opts.fs = {
63279
63690
  readdir: opts.fs.readdir || readdir,
@@ -63300,12 +63711,13 @@ function globSync(globInput, options) {
63300
63711
  const [crawler, relative2] = getCrawler(globInput, options);
63301
63712
  return crawler ? formatPaths(crawler.sync(), relative2) : [];
63302
63713
  }
63303
- var import_picomatch, isReadonlyArray, BACKSLASHES, isWin, ONLY_PARENT_DIRECTORIES, WIN32_ROOT_DIR, isRoot, splitPatternOptions, POSIX_UNESCAPED_GLOB_SYMBOLS, WIN32_UNESCAPED_GLOB_SYMBOLS, escapePosixPath = (path5) => path5.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapeWin32Path = (path5) => path5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapePath, PARENT_DIRECTORY, ESCAPING_BACKSLASHES, defaultOptions;
63714
+ var import_picomatch, isReadonlyArray, BACKSLASHES, DRIVE_RELATIVE_PATH, isWin, ONLY_PARENT_DIRECTORIES, WIN32_ROOT_DIR, isRoot, splitPatternOptions, POSIX_UNESCAPED_GLOB_SYMBOLS, WIN32_UNESCAPED_GLOB_SYMBOLS, escapePosixPath = (path5) => path5.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapeWin32Path = (path5) => path5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapePath, PARENT_DIRECTORY, ESCAPING_BACKSLASHES, defaultOptions;
63304
63715
  var init_dist7 = __esm(() => {
63305
63716
  init_dist6();
63306
63717
  import_picomatch = __toESM(require_picomatch2(), 1);
63307
63718
  isReadonlyArray = Array.isArray;
63308
63719
  BACKSLASHES = /\\/g;
63720
+ DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
63309
63721
  isWin = process.platform === "win32";
63310
63722
  ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
63311
63723
  WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
@@ -63318,7 +63730,6 @@ var init_dist7 = __esm(() => {
63318
63730
  ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
63319
63731
  defaultOptions = {
63320
63732
  caseSensitiveMatch: true,
63321
- cwd: process.cwd(),
63322
63733
  debug: !!process.env.TINYGLOBBY_DEBUG,
63323
63734
  expandDirectories: true,
63324
63735
  followSymbolicLinks: true,
@@ -64132,44 +64543,69 @@ function formatUsageDuration(durationMs, compact2 = false, useDays = true) {
64132
64543
  function pad2(value) {
64133
64544
  return value.toString().padStart(2, "0");
64134
64545
  }
64135
- function formatResetAtUtc(date5, compact2, hour12) {
64546
+ function formatResetAtUtc(date5, compact2, hour12, weekday = false) {
64136
64547
  const year = date5.getUTCFullYear();
64137
64548
  const month = pad2(date5.getUTCMonth() + 1);
64138
64549
  const day = pad2(date5.getUTCDate());
64139
64550
  const hours = pad2(date5.getUTCHours());
64140
64551
  const minutes = pad2(date5.getUTCMinutes());
64552
+ const weekdayName = weekday ? UTC_WEEKDAY_NAMES[date5.getUTCDay()] : "";
64141
64553
  if (hour12) {
64142
64554
  const hour = date5.getUTCHours();
64143
64555
  const displayHour = hour % 12 || 12;
64144
64556
  const period = hour >= 12 ? "PM" : "AM";
64557
+ if (weekday) {
64558
+ return compact2 ? `${weekdayName} ${displayHour}:${minutes} ${period}Z` : `${weekdayName} ${displayHour}:${minutes} ${period} UTC`;
64559
+ }
64145
64560
  return compact2 ? `${month}-${day} ${displayHour}:${minutes} ${period}Z` : `${year}-${month}-${day} ${displayHour}:${minutes} ${period} UTC`;
64146
64561
  }
64562
+ if (weekday) {
64563
+ return compact2 ? `${weekdayName} ${hours}:${minutes}Z` : `${weekdayName} ${hours}:${minutes} UTC`;
64564
+ }
64147
64565
  return compact2 ? `${month}-${day} ${hours}:${minutes}Z` : `${year}-${month}-${day} ${hours}:${minutes} UTC`;
64148
64566
  }
64149
64567
  function normalizeDayPeriod(dayPeriod) {
64150
64568
  return dayPeriod.replace(/\./g, "").toUpperCase();
64151
64569
  }
64152
- function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12) {
64570
+ function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12, weekday = false) {
64153
64571
  try {
64154
- const formatter = new Intl.DateTimeFormat(locale, {
64572
+ const options = {
64155
64573
  timeZone: timezone,
64156
- year: "numeric",
64157
- month: "2-digit",
64158
- day: "2-digit",
64159
64574
  hour: "2-digit",
64160
64575
  minute: "2-digit",
64161
64576
  hour12,
64162
64577
  timeZoneName: "short"
64163
- });
64578
+ };
64579
+ if (weekday) {
64580
+ options.weekday = "short";
64581
+ } else {
64582
+ options.year = "numeric";
64583
+ options.month = "2-digit";
64584
+ options.day = "2-digit";
64585
+ }
64586
+ const formatter = new Intl.DateTimeFormat(locale, options);
64164
64587
  const parts = formatter.formatToParts(date5);
64165
64588
  const get2 = (type) => parts.find((p) => p.type === type)?.value ?? "";
64166
- const year = get2("year");
64167
- const month = get2("month");
64168
- const day = get2("day");
64169
64589
  const hour = get2("hour");
64170
64590
  const minute = get2("minute");
64171
64591
  const dayPeriod = get2("dayPeriod");
64172
64592
  const tzName = get2("timeZoneName");
64593
+ if (weekday) {
64594
+ const weekdayName = get2("weekday");
64595
+ if (!weekdayName || !hour || !minute) {
64596
+ return null;
64597
+ }
64598
+ if (hour12) {
64599
+ const displayHour = hour.startsWith("0") ? hour.slice(1) : hour;
64600
+ const normalizedDayPeriod = dayPeriod ? normalizeDayPeriod(dayPeriod) : "";
64601
+ const time3 = `${displayHour}:${minute}${normalizedDayPeriod ? ` ${normalizedDayPeriod}` : ""}`;
64602
+ return compact2 ? `${weekdayName} ${time3}` : `${weekdayName} ${time3} ${tzName}`;
64603
+ }
64604
+ return compact2 ? `${weekdayName} ${hour}:${minute}` : `${weekdayName} ${hour}:${minute} ${tzName}`;
64605
+ }
64606
+ const year = get2("year");
64607
+ const month = get2("month");
64608
+ const day = get2("day");
64173
64609
  if (!year || !month || !day || !hour || !minute) {
64174
64610
  return null;
64175
64611
  }
@@ -64184,7 +64620,7 @@ function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12) {
64184
64620
  return null;
64185
64621
  }
64186
64622
  }
64187
- function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12, hour12Arg = false) {
64623
+ function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12, hour12Arg = false, weekday = false) {
64188
64624
  if (!resetAt) {
64189
64625
  return null;
64190
64626
  }
@@ -64196,21 +64632,21 @@ function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12,
64196
64632
  const locale = typeof localeOrHour12 === "string" ? localeOrHour12 : undefined;
64197
64633
  const hour12 = typeof localeOrHour12 === "boolean" ? localeOrHour12 : hour12Arg;
64198
64634
  if (!timezone || timezone === "UTC") {
64199
- return formatResetAtUtc(date5, compact2, hour12);
64635
+ return formatResetAtUtc(date5, compact2, hour12, weekday);
64200
64636
  }
64201
64637
  const resolvedTimezone = timezone === "local" ? undefined : timezone;
64202
64638
  const resolvedLocale = locale && locale.length > 0 ? locale : DEFAULT_TZ_LOCALE;
64203
- const localized = formatResetAtInTimezone(date5, compact2, resolvedTimezone, resolvedLocale, hour12);
64639
+ const localized = formatResetAtInTimezone(date5, compact2, resolvedTimezone, resolvedLocale, hour12, weekday);
64204
64640
  if (localized) {
64205
64641
  return localized;
64206
64642
  }
64207
64643
  if (resolvedLocale !== DEFAULT_TZ_LOCALE) {
64208
- const fallback = formatResetAtInTimezone(date5, compact2, resolvedTimezone, DEFAULT_TZ_LOCALE, hour12);
64644
+ const fallback = formatResetAtInTimezone(date5, compact2, resolvedTimezone, DEFAULT_TZ_LOCALE, hour12, weekday);
64209
64645
  if (fallback) {
64210
64646
  return fallback;
64211
64647
  }
64212
64648
  }
64213
- return formatResetAtUtc(date5, compact2, hour12);
64649
+ return formatResetAtUtc(date5, compact2, hour12, weekday);
64214
64650
  }
64215
64651
  function getUsageErrorMessage(error51) {
64216
64652
  switch (error51) {
@@ -64231,10 +64667,11 @@ function makeUsageProgressBar(percent, width = 15) {
64231
64667
  const empty2 = width - filled;
64232
64668
  return "[" + "█".repeat(filled) + "░".repeat(empty2) + "]";
64233
64669
  }
64234
- var DEFAULT_TZ_LOCALE = "en-US";
64670
+ var UTC_WEEKDAY_NAMES, DEFAULT_TZ_LOCALE = "en-US";
64235
64671
  var init_usage_windows = __esm(async () => {
64236
64672
  init_usage_types();
64237
64673
  await init_jsonl();
64674
+ UTC_WEEKDAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
64238
64675
  });
64239
64676
 
64240
64677
  // src/utils/usage.ts
@@ -66082,7 +66519,7 @@ class ExtraUsageUtilizationWidget {
66082
66519
  return getUsageErrorMessage(data.error);
66083
66520
  return null;
66084
66521
  }
66085
- const percent = Math.max(0, Math.min(100, data.extraUsageUtilization * 100));
66522
+ const percent = Math.max(0, Math.min(100, data.extraUsageUtilization));
66086
66523
  const renderedPercent = inverted ? 100 - percent : percent;
66087
66524
  if (isUsageProgressMode(displayMode)) {
66088
66525
  const width = getUsageProgressBarWidth(displayMode);
@@ -66149,7 +66586,8 @@ class ExtraUsageRemainingWidget {
66149
66586
  return null;
66150
66587
  }
66151
66588
  const limitDollars = data.extraUsageLimit / 100;
66152
- const remaining = Math.max(0, limitDollars - data.extraUsageUsed);
66589
+ const usedDollars = data.extraUsageUsed / 100;
66590
+ const remaining = Math.max(0, limitDollars - usedDollars);
66153
66591
  const formatted = `$${remaining.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
66154
66592
  return formatRawOrLabeledValue(item, "超额剩余: ", formatted);
66155
66593
  }
@@ -67103,6 +67541,9 @@ function getWeeklyResetModifierText(item) {
67103
67541
  if (isUsage12HourClock(item)) {
67104
67542
  modifiers.push("12 时制");
67105
67543
  }
67544
+ if (isUsageWeekdayEnabled(item)) {
67545
+ modifiers.push("星期");
67546
+ }
67106
67547
  } else if (isWeeklyResetHoursOnly(item)) {
67107
67548
  modifiers.push("仅小时");
67108
67549
  }
@@ -67153,6 +67594,9 @@ class WeeklyResetTimerWidget {
67153
67594
  if (action === "toggle-hour-format") {
67154
67595
  return toggleUsageHourFormat(item);
67155
67596
  }
67597
+ if (action === "toggle-weekday") {
67598
+ return toggleUsageWeekday(item);
67599
+ }
67156
67600
  if (action === "toggle-hours") {
67157
67601
  return toggleWeeklyResetHoursOnly(item);
67158
67602
  }
@@ -67172,8 +67616,10 @@ class WeeklyResetTimerWidget {
67172
67616
  return formatRawOrLabeledValue(item, "周重置 ", `[${progressBar}] ${previewPercent.toFixed(1)}%`);
67173
67617
  }
67174
67618
  if (dateMode) {
67175
- const resetAt = formatUsageResetAt(WEEKLY_RESET_PREVIEW_AT, compact2, getUsageTimezone(item), getUsageLocale(item), isUsage12HourClock(item));
67176
- return formatRawOrLabeledValue(item, "周重置: ", resetAt ?? (compact2 ? "03-15 08:30Z" : "2026-03-15 08:30 UTC"));
67619
+ const weekday = isUsageWeekdayEnabled(item);
67620
+ const resetAt = formatUsageResetAt(WEEKLY_RESET_PREVIEW_AT, compact2, getUsageTimezone(item), getUsageLocale(item), isUsage12HourClock(item), weekday);
67621
+ const fallback = weekday ? compact2 ? "Sun 08:30Z" : "Sun 08:30 UTC" : compact2 ? "03-15 08:30Z" : "2026-03-15 08:30 UTC";
67622
+ return formatRawOrLabeledValue(item, "周重置: ", resetAt ?? fallback);
67177
67623
  }
67178
67624
  return formatRawOrLabeledValue(item, "周重置: ", formatUsageDuration(WEEKLY_PREVIEW_DURATION_MS, compact2, useDays));
67179
67625
  }
@@ -67195,7 +67641,7 @@ class WeeklyResetTimerWidget {
67195
67641
  if (dateMode) {
67196
67642
  const timezone = getUsageTimezone(item);
67197
67643
  const locale = getUsageLocale(item);
67198
- const resetAt = formatUsageResetAt(usageData.weeklyResetAt, compact2, timezone, locale, isUsage12HourClock(item));
67644
+ const resetAt = formatUsageResetAt(usageData.weeklyResetAt, compact2, timezone, locale, isUsage12HourClock(item), isUsageWeekdayEnabled(item));
67199
67645
  if (resetAt) {
67200
67646
  return formatRawOrLabeledValue(item, "周重置: ", resetAt);
67201
67647
  }
@@ -67207,6 +67653,7 @@ class WeeklyResetTimerWidget {
67207
67653
  const keybinds = getUsageTimerCustomKeybinds(item, {
67208
67654
  includeDate: true,
67209
67655
  includeHourFormat: true,
67656
+ includeWeekday: true,
67210
67657
  includeLocale: true,
67211
67658
  includeTimezone: true
67212
67659
  });
@@ -68205,6 +68652,137 @@ var init_CompactionCounter = __esm(() => {
68205
68652
  FORMATS3 = ["icon-space-number", "text-and-number", "number"];
68206
68653
  });
68207
68654
 
68655
+ // src/widgets/RemoteControlStatus.ts
68656
+ function getFormat4(item) {
68657
+ const f = item.metadata?.format;
68658
+ return FORMATS4.includes(f ?? "") ? f : DEFAULT_FORMAT4;
68659
+ }
68660
+ function setFormat4(item, format) {
68661
+ if (format === DEFAULT_FORMAT4) {
68662
+ const { format: removedFormat, ...restMetadata } = item.metadata ?? {};
68663
+ return {
68664
+ ...item,
68665
+ metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
68666
+ };
68667
+ }
68668
+ return {
68669
+ ...item,
68670
+ metadata: {
68671
+ ...item.metadata ?? {},
68672
+ format
68673
+ }
68674
+ };
68675
+ }
68676
+ function isNerdFontEnabled4(item) {
68677
+ return item.metadata?.[NERD_FONT_METADATA_KEY4] === "true";
68678
+ }
68679
+ function toggleNerdFont4(item) {
68680
+ if (!isNerdFontEnabled4(item)) {
68681
+ return {
68682
+ ...item,
68683
+ metadata: {
68684
+ ...item.metadata ?? {},
68685
+ [NERD_FONT_METADATA_KEY4]: "true"
68686
+ }
68687
+ };
68688
+ }
68689
+ const { [NERD_FONT_METADATA_KEY4]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
68690
+ return {
68691
+ ...item,
68692
+ metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
68693
+ };
68694
+ }
68695
+ function formatStatus2(enabled, format, nerdFont) {
68696
+ const stateText = enabled ? "启用" : "关闭";
68697
+ const stateDot = enabled ? STATE_DOT_ON2 : STATE_DOT_OFF2;
68698
+ const icon = nerdFont ? enabled ? SATELLITE_NERD_FONT : SATELLITE_SLASH_NERD_FONT : SATELLITE_EMOJI;
68699
+ switch (format) {
68700
+ case "icon":
68701
+ return nerdFont ? icon : `${icon} ${stateDot}`;
68702
+ case "icon-text":
68703
+ return `${icon} ${stateText}`;
68704
+ case "text":
68705
+ return stateText;
68706
+ case "word":
68707
+ return `远程 ${stateText}`;
68708
+ case "label-check":
68709
+ return `远程 ${enabled ? CHECK_EMOJI : CROSS_EMOJI}`;
68710
+ case "label-mark":
68711
+ return `远程 ${enabled ? CHECK_MARK : CROSS_MARK}`;
68712
+ }
68713
+ }
68714
+
68715
+ class RemoteControlStatusWidget {
68716
+ getDefaultColor() {
68717
+ return "blue";
68718
+ }
68719
+ getDescription() {
68720
+ return "显示 Claude Code 远程控制是否已连接到当前会话";
68721
+ }
68722
+ getDisplayName() {
68723
+ return "远程控制状态";
68724
+ }
68725
+ getCategory() {
68726
+ return "核心";
68727
+ }
68728
+ getEditorDisplay(item) {
68729
+ const modifiers = [getFormat4(item)];
68730
+ if (isNerdFontEnabled4(item)) {
68731
+ modifiers.push("Nerd 字体");
68732
+ }
68733
+ return {
68734
+ displayText: this.getDisplayName(),
68735
+ modifierText: `(${modifiers.join(", ")})`
68736
+ };
68737
+ }
68738
+ handleEditorAction(action, item) {
68739
+ if (action === CYCLE_FORMAT_ACTION4) {
68740
+ const currentFormat = getFormat4(item);
68741
+ const nextFormat = FORMATS4[(FORMATS4.indexOf(currentFormat) + 1) % FORMATS4.length] ?? DEFAULT_FORMAT4;
68742
+ return setFormat4(item, nextFormat);
68743
+ }
68744
+ if (action === TOGGLE_NERD_FONT_ACTION4) {
68745
+ return toggleNerdFont4(item);
68746
+ }
68747
+ return null;
68748
+ }
68749
+ render(item, context, _settings) {
68750
+ const format = getFormat4(item);
68751
+ const nerdFont = isNerdFontEnabled4(item);
68752
+ if (context.isPreview) {
68753
+ if (item.rawValue) {
68754
+ return "on";
68755
+ }
68756
+ return formatStatus2(true, format, nerdFont);
68757
+ }
68758
+ const status = getRemoteControlStatus(context.data?.session_id);
68759
+ if (status === null) {
68760
+ return null;
68761
+ }
68762
+ if (item.rawValue) {
68763
+ return status.enabled ? "on" : "off";
68764
+ }
68765
+ return formatStatus2(status.enabled, format, nerdFont);
68766
+ }
68767
+ getCustomKeybinds() {
68768
+ return [
68769
+ { key: "f", label: "(f)显示格式", action: CYCLE_FORMAT_ACTION4 },
68770
+ { key: "n", label: "(n)erd 字体", action: TOGGLE_NERD_FONT_ACTION4 }
68771
+ ];
68772
+ }
68773
+ supportsRawValue() {
68774
+ return true;
68775
+ }
68776
+ supportsColors(_item) {
68777
+ return true;
68778
+ }
68779
+ }
68780
+ var SATELLITE_EMOJI = "\uD83D\uDCE1", SATELLITE_NERD_FONT = "", SATELLITE_SLASH_NERD_FONT = "", STATE_DOT_OFF2 = "○", STATE_DOT_ON2 = "◉", FORMATS4, CHECK_EMOJI = "✅", CROSS_EMOJI = "❌", CHECK_MARK = "✓", CROSS_MARK = "✗", DEFAULT_FORMAT4 = "icon", CYCLE_FORMAT_ACTION4 = "cycle-format", TOGGLE_NERD_FONT_ACTION4 = "toggle-nerd-font", NERD_FONT_METADATA_KEY4 = "nerdFont";
68781
+ var init_RemoteControlStatus = __esm(async () => {
68782
+ await init_claude_settings();
68783
+ FORMATS4 = ["icon", "icon-text", "text", "word", "label-check", "label-mark"];
68784
+ });
68785
+
68208
68786
  // src/widgets/index.ts
68209
68787
  var init_widgets = __esm(async () => {
68210
68788
  init_GitBranch();
@@ -68275,7 +68853,8 @@ var init_widgets = __esm(async () => {
68275
68853
  init_ContextBar(),
68276
68854
  init_Link(),
68277
68855
  init_Skills(),
68278
- init_ThinkingEffort()
68856
+ init_ThinkingEffort(),
68857
+ init_RemoteControlStatus()
68279
68858
  ]);
68280
68859
  });
68281
68860
 
@@ -68357,6 +68936,7 @@ var init_widget_manifest = __esm(async () => {
68357
68936
  { type: "thinking-effort", create: () => new ThinkingEffortWidget },
68358
68937
  { type: "vim-mode", create: () => new VimModeWidget },
68359
68938
  { type: "voice-status", create: () => new VoiceStatusWidget },
68939
+ { type: "remote-control-status", create: () => new RemoteControlStatusWidget },
68360
68940
  { type: "worktree-mode", create: () => new GitWorktreeModeWidget },
68361
68941
  { type: "worktree-name", create: () => new GitWorktreeNameWidget },
68362
68942
  { type: "worktree-branch", create: () => new GitWorktreeBranchWidget },
@@ -69058,7 +69638,43 @@ function getVoiceConfig(cwd2 = process.cwd()) {
69058
69638
  }
69059
69639
  return anyFileExisted ? { enabled: false } : null;
69060
69640
  }
69061
- var readFile4, writeFile2, mkdir2, CCSTATUSLINE_COMMANDS, PINNED_INSTALL_COMMANDS, VoiceConfigSchema;
69641
+ function getRemoteControlStatus(sessionId) {
69642
+ if (!sessionId) {
69643
+ return null;
69644
+ }
69645
+ const sessionsDir = path9.join(getClaudeConfigDir(), "sessions");
69646
+ let entries;
69647
+ try {
69648
+ entries = fs12.readdirSync(sessionsDir);
69649
+ } catch {
69650
+ return null;
69651
+ }
69652
+ for (const entry of entries) {
69653
+ if (!entry.endsWith(".json")) {
69654
+ continue;
69655
+ }
69656
+ let content;
69657
+ try {
69658
+ content = fs12.readFileSync(path9.join(sessionsDir, entry), "utf-8");
69659
+ } catch {
69660
+ continue;
69661
+ }
69662
+ let parsed;
69663
+ try {
69664
+ parsed = JSON.parse(content);
69665
+ } catch {
69666
+ continue;
69667
+ }
69668
+ const result2 = RemoteSessionFileSchema.safeParse(parsed);
69669
+ if (!result2.success || result2.data.sessionId !== sessionId) {
69670
+ continue;
69671
+ }
69672
+ const bridge = result2.data.bridgeSessionId;
69673
+ return { enabled: typeof bridge === "string" && bridge.length > 0 };
69674
+ }
69675
+ return null;
69676
+ }
69677
+ var readFile4, writeFile2, mkdir2, CCSTATUSLINE_COMMANDS, PINNED_INSTALL_COMMANDS, VoiceConfigSchema, RemoteSessionFileSchema;
69062
69678
  var init_claude_settings = __esm(async () => {
69063
69679
  init_zod();
69064
69680
  init_Settings();
@@ -69079,6 +69695,10 @@ var init_claude_settings = __esm(async () => {
69079
69695
  BUN: (version2) => `bun add -g ccstatusline-zh@${version2}`
69080
69696
  };
69081
69697
  VoiceConfigSchema = exports_external.object({ enabled: exports_external.boolean().optional() });
69698
+ RemoteSessionFileSchema = exports_external.object({
69699
+ sessionId: exports_external.string().optional(),
69700
+ bridgeSessionId: exports_external.string().nullable().optional()
69701
+ });
69082
69702
  });
69083
69703
 
69084
69704
  // node_modules/pluralize/pluralize.js
@@ -69670,6 +70290,9 @@ import { execFileSync as execFileSync5 } from "child_process";
69670
70290
  import * as path10 from "path";
69671
70291
 
69672
70292
  // src/utils/package-manager-executable.ts
70293
+ function getPackageManagerShellOptions(executable, platform2 = process.platform) {
70294
+ return platform2 === "win32" && /\.(?:cmd|bat)$/i.test(executable) ? { shell: true } : {};
70295
+ }
69673
70296
  function getPackageManagerExecutable(packageManager, platform2 = process.platform) {
69674
70297
  return packageManager === "npm" && platform2 === "win32" ? "npm.cmd" : packageManager;
69675
70298
  }
@@ -69714,10 +70337,12 @@ function getCommandResolutionPaths(command, { platform: platform2 = process.plat
69714
70337
  }
69715
70338
  function getNpmGlobalBinDir(platform2) {
69716
70339
  try {
69717
- const prefix = execFileSync5(getPackageManagerExecutable("npm", platform2), ["prefix", "-g"], {
70340
+ const executable = getPackageManagerExecutable("npm", platform2);
70341
+ const prefix = execFileSync5(executable, ["prefix", "-g"], {
69718
70342
  encoding: "utf-8",
69719
70343
  timeout: COMMAND_LOOKUP_TIMEOUT_MS,
69720
- windowsHide: true
70344
+ windowsHide: true,
70345
+ ...getPackageManagerShellOptions(executable, platform2)
69721
70346
  }).trim();
69722
70347
  if (!prefix) {
69723
70348
  return null;
@@ -69921,10 +70546,12 @@ function readPackageVersion(packageJsonPath) {
69921
70546
  }
69922
70547
  function getNpmGlobalPackageVersion(platform2) {
69923
70548
  try {
69924
- const rootDir = execFileSync6(getPackageManagerExecutable("npm", platform2), ["root", "-g"], {
70549
+ const executable = getPackageManagerExecutable("npm", platform2);
70550
+ const rootDir = execFileSync6(executable, ["root", "-g"], {
69925
70551
  encoding: "utf-8",
69926
70552
  timeout: VERSION_LOOKUP_TIMEOUT_MS,
69927
- windowsHide: true
70553
+ windowsHide: true,
70554
+ ...getPackageManagerShellOptions(executable, platform2)
69928
70555
  }).trim();
69929
70556
  return rootDir ? readPackageVersion(appendPathSegment(appendPathSegment(rootDir, "ccstatusline-zh"), "package.json")) : null;
69930
70557
  } catch {
@@ -70031,7 +70658,11 @@ function runGlobalPackageUninstall(packageManager, { platform: platform2 = proce
70031
70658
  const executable = getPackageManagerExecutable(packageManager, platform2);
70032
70659
  const args = packageManager === "npm" ? ["uninstall", "-g", "ccstatusline-zh"] : ["remove", "-g", "ccstatusline-zh"];
70033
70660
  return new Promise((resolve6, reject2) => {
70034
- execFile(executable, args, { timeout: GLOBAL_PACKAGE_TIMEOUT_MS, windowsHide: true }, (error51) => {
70661
+ execFile(executable, args, {
70662
+ timeout: GLOBAL_PACKAGE_TIMEOUT_MS,
70663
+ windowsHide: true,
70664
+ ...getPackageManagerShellOptions(executable, platform2)
70665
+ }, (error51) => {
70035
70666
  if (error51) {
70036
70667
  reject2(error51 instanceof Error ? error51 : new Error("全局卸载命令执行失败"));
70037
70668
  return;
@@ -70549,7 +71180,11 @@ function runGlobalPackageInstall(packageManager, version2, { platform: platform4
70549
71180
  const executable = getPackageManagerExecutable(packageManager, platform4);
70550
71181
  const args = packageManager === "npm" ? ["install", "-g", `ccstatusline-zh@${version2}`] : ["add", "-g", `ccstatusline-zh@${version2}`];
70551
71182
  return new Promise((resolve6, reject2) => {
70552
- execFile2(executable, args, { timeout: GLOBAL_UPDATE_TIMEOUT_MS, windowsHide: true }, (error51) => {
71183
+ execFile2(executable, args, {
71184
+ timeout: GLOBAL_UPDATE_TIMEOUT_MS,
71185
+ windowsHide: true,
71186
+ ...getPackageManagerShellOptions(executable, platform4)
71187
+ }, (error51) => {
70553
71188
  if (error51) {
70554
71189
  reject2(error51 instanceof Error ? error51 : new Error("全局更新命令执行失败"));
70555
71190
  return;
@@ -70988,6 +71623,7 @@ var SelectInput_default = SelectInput;
70988
71623
  // src/tui/components/ColorMenu.tsx
70989
71624
  init_ColorLevel();
70990
71625
  init_colors();
71626
+ init_gradient();
70991
71627
  init_input_guards();
70992
71628
  await init_widgets2();
70993
71629
  var import_react39 = __toESM(require_react(), 1);
@@ -71292,6 +71928,11 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71292
71928
  const [ansi256InputMode, setAnsi256InputMode] = import_react39.useState(false);
71293
71929
  const [ansi256Input, setAnsi256Input] = import_react39.useState("");
71294
71930
  const [showClearConfirm, setShowClearConfirm] = import_react39.useState(false);
71931
+ const [gradientMode, setGradientMode] = import_react39.useState(false);
71932
+ const [gradientIndex, setGradientIndex] = import_react39.useState(0);
71933
+ const [gradientCustomStep, setGradientCustomStep] = import_react39.useState(null);
71934
+ const [gradientStartHex, setGradientStartHex] = import_react39.useState("");
71935
+ const [gradientHexInput, setGradientHexInput] = import_react39.useState("");
71295
71936
  const powerlineEnabled = settings.powerline.enabled;
71296
71937
  const colorableWidgets = widgets.filter((widget) => {
71297
71938
  if (widget.type === "separator") {
@@ -71371,6 +72012,62 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71371
72012
  }
71372
72013
  return;
71373
72014
  }
72015
+ if (gradientMode) {
72016
+ const exitGradient = () => {
72017
+ setGradientMode(false);
72018
+ setGradientCustomStep(null);
72019
+ setGradientStartHex("");
72020
+ setGradientHexInput("");
72021
+ };
72022
+ const applyGradientValue = (value) => {
72023
+ const selectedWidget2 = colorableWidgets.find((widget) => widget.id === highlightedItemId);
72024
+ if (selectedWidget2) {
72025
+ onUpdate(setWidgetColor(widgets, selectedWidget2.id, value, false));
72026
+ }
72027
+ exitGradient();
72028
+ };
72029
+ if (gradientCustomStep) {
72030
+ if (key.escape) {
72031
+ setGradientCustomStep(null);
72032
+ setGradientHexInput("");
72033
+ } else if (key.return) {
72034
+ if (gradientHexInput.length === 6) {
72035
+ if (gradientCustomStep === "start") {
72036
+ setGradientStartHex(gradientHexInput);
72037
+ setGradientHexInput("");
72038
+ setGradientCustomStep("end");
72039
+ } else {
72040
+ applyGradientValue(`gradient:${gradientStartHex}-${gradientHexInput}`);
72041
+ }
72042
+ }
72043
+ } else if (key.backspace || key.delete) {
72044
+ setGradientHexInput(gradientHexInput.slice(0, -1));
72045
+ } else if (shouldInsertInput(input, key) && gradientHexInput.length < 6) {
72046
+ const upperInput = input.toUpperCase();
72047
+ if (/^[0-9A-F]$/.test(upperInput)) {
72048
+ setGradientHexInput(gradientHexInput + upperInput);
72049
+ }
72050
+ }
72051
+ return;
72052
+ }
72053
+ const total = GRADIENT_PRESET_NAMES.length + 1;
72054
+ if (key.escape) {
72055
+ exitGradient();
72056
+ } else if (key.upArrow) {
72057
+ setGradientIndex((gradientIndex - 1 + total) % total);
72058
+ } else if (key.downArrow) {
72059
+ setGradientIndex((gradientIndex + 1) % total);
72060
+ } else if (key.return) {
72061
+ if (gradientIndex < GRADIENT_PRESET_NAMES.length) {
72062
+ applyGradientValue(`gradient:${GRADIENT_PRESET_NAMES[gradientIndex]}`);
72063
+ } else {
72064
+ setGradientStartHex("");
72065
+ setGradientHexInput("");
72066
+ setGradientCustomStep("start");
72067
+ }
72068
+ }
72069
+ return;
72070
+ }
71374
72071
  if (input && /^[0-9]$/.test(input)) {
71375
72072
  return;
71376
72073
  }
@@ -71390,6 +72087,14 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71390
72087
  setAnsi256InputMode(true);
71391
72088
  setAnsi256Input("");
71392
72089
  }
72090
+ } else if (input === "g" || input === "G") {
72091
+ if (highlightedItemId && highlightedItemId !== "back" && !editingBackground && settings.colorLevel >= 2) {
72092
+ setGradientMode(true);
72093
+ setGradientIndex(0);
72094
+ setGradientCustomStep(null);
72095
+ setGradientStartHex("");
72096
+ setGradientHexInput("");
72097
+ }
71393
72098
  } else if ((input === "s" || input === "S") && !key.ctrl) {
71394
72099
  if (!settings.powerline.enabled && !settings.defaultSeparator) {
71395
72100
  setShowSeparators(!showSeparators);
@@ -71541,6 +72246,13 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71541
72246
  displayName = `ANSI ${currentColor.substring(8)}`;
71542
72247
  } else if (currentColor.startsWith("hex:")) {
71543
72248
  displayName = `#${currentColor.substring(4)}`;
72249
+ } else if (currentColor.startsWith("gradient:")) {
72250
+ const body = currentColor.substring(9);
72251
+ if (GRADIENT_PRESET_NAMES.includes(body.toLowerCase())) {
72252
+ displayName = `Gradient: ${body.toLowerCase()}`;
72253
+ } else {
72254
+ displayName = `Gradient: ${body}`;
72255
+ }
71544
72256
  } else {
71545
72257
  const colorOption = colorOptions.find((c) => c.value === currentColor);
71546
72258
  displayName = colorOption ? colorOption.name : currentColor;
@@ -71549,6 +72261,94 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71549
72261
  colorDisplay = applyColors(displayName, currentColor, undefined, false, level);
71550
72262
  }
71551
72263
  }
72264
+ if (gradientMode) {
72265
+ const level = getColorLevelString(settings.colorLevel);
72266
+ const widgetName = selectedWidget ? getItemLabel(selectedWidget) : "";
72267
+ if (gradientCustomStep) {
72268
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72269
+ flexDirection: "column",
72270
+ children: [
72271
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72272
+ bold: true,
72273
+ children: [
72274
+ "Custom Gradient",
72275
+ widgetName ? ` - ${widgetName}` : ""
72276
+ ]
72277
+ }, undefined, true, undefined, this),
72278
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72279
+ marginTop: 1,
72280
+ flexDirection: "column",
72281
+ children: [
72282
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72283
+ children: gradientCustomStep === "start" ? "Enter START hex color (without #):" : "Enter END hex color (without #):"
72284
+ }, undefined, false, undefined, this),
72285
+ gradientCustomStep === "end" && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72286
+ dimColor: true,
72287
+ children: [
72288
+ "Start: #",
72289
+ gradientStartHex
72290
+ ]
72291
+ }, undefined, true, undefined, this),
72292
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72293
+ children: [
72294
+ "#",
72295
+ gradientHexInput,
72296
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72297
+ dimColor: true,
72298
+ children: gradientHexInput.length < 6 ? "_".repeat(6 - gradientHexInput.length) : ""
72299
+ }, undefined, false, undefined, this)
72300
+ ]
72301
+ }, undefined, true, undefined, this),
72302
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72303
+ children: " "
72304
+ }, undefined, false, undefined, this),
72305
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72306
+ dimColor: true,
72307
+ children: "Press Enter when done, ESC to go back"
72308
+ }, undefined, false, undefined, this)
72309
+ ]
72310
+ }, undefined, true, undefined, this)
72311
+ ]
72312
+ }, undefined, true, undefined, this);
72313
+ }
72314
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72315
+ flexDirection: "column",
72316
+ children: [
72317
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72318
+ bold: true,
72319
+ children: [
72320
+ "Select Gradient",
72321
+ widgetName ? ` - ${widgetName}` : ""
72322
+ ]
72323
+ }, undefined, true, undefined, this),
72324
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72325
+ marginTop: 1,
72326
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72327
+ dimColor: true,
72328
+ children: "↑↓ to select, Enter to apply, ESC to cancel"
72329
+ }, undefined, false, undefined, this)
72330
+ }, undefined, false, undefined, this),
72331
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
72332
+ marginTop: 1,
72333
+ flexDirection: "column",
72334
+ children: [
72335
+ GRADIENT_PRESET_NAMES.map((name, idx) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72336
+ children: [
72337
+ idx === gradientIndex ? "▶ " : " ",
72338
+ applyColors(name, `gradient:${name}`, undefined, idx === gradientIndex, level)
72339
+ ]
72340
+ }, name, true, undefined, this)),
72341
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
72342
+ children: [
72343
+ gradientIndex === GRADIENT_PRESET_NAMES.length ? "▶ " : " ",
72344
+ "Custom (enter two hex stops)"
72345
+ ]
72346
+ }, "custom", true, undefined, this)
72347
+ ]
72348
+ }, undefined, true, undefined, this)
72349
+ ]
72350
+ }, undefined, true, undefined, this);
72351
+ }
71552
72352
  if (showClearConfirm) {
71553
72353
  return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
71554
72354
  flexDirection: "column",
@@ -71677,6 +72477,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71677
72477
  editingBackground ? "背景色" : "前景色",
71678
72478
  ",(f) 前景/背景切换,(b)加粗,",
71679
72479
  settings.colorLevel === 3 ? " (h)十六进制," : settings.colorLevel === 2 ? " (a)nsi256," : "",
72480
+ !editingBackground && settings.colorLevel >= 2 ? " (g)渐变色," : "",
71680
72481
  " ",
71681
72482
  "(r)重置,(c)清除全部,ESC 返回"
71682
72483
  ]
@@ -71756,7 +72557,9 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
71756
72557
  }, undefined, true, undefined, this);
71757
72558
  };
71758
72559
  // src/tui/components/GlobalOverridesMenu.tsx
72560
+ init_ColorLevel();
71759
72561
  init_colors();
72562
+ init_gradient();
71760
72563
  init_input_guards();
71761
72564
  await init_build2();
71762
72565
  var import_react40 = __toESM(require_react(), 1);
@@ -71770,6 +72573,11 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71770
72573
  const [inheritColors, setInheritColors] = import_react40.useState(settings.inheritSeparatorColors);
71771
72574
  const [globalBold, setGlobalBold] = import_react40.useState(settings.globalBold);
71772
72575
  const [minimalistMode, setMinimalistMode] = import_react40.useState(settings.minimalistMode);
72576
+ const [gradientMode, setGradientMode] = import_react40.useState(false);
72577
+ const [gradientIndex, setGradientIndex] = import_react40.useState(0);
72578
+ const [gradientCustomStep, setGradientCustomStep] = import_react40.useState(null);
72579
+ const [gradientStartHex, setGradientStartHex] = import_react40.useState("");
72580
+ const [gradientHexInput, setGradientHexInput] = import_react40.useState("");
71773
72581
  const isPowerlineEnabled = settings.powerline.enabled;
71774
72582
  const hasManualSeparators = settings.lines.some((line) => line.some((item) => item.type === "separator"));
71775
72583
  const bgColors = ["none", ...COLOR_MAP.filter((c) => c.isBackground).map((c) => c.name)];
@@ -71817,6 +72625,60 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71817
72625
  }
71818
72626
  } else if (confirmingSeparator) {
71819
72627
  return;
72628
+ } else if (gradientMode) {
72629
+ const exitGradient = () => {
72630
+ setGradientMode(false);
72631
+ setGradientCustomStep(null);
72632
+ setGradientStartHex("");
72633
+ setGradientHexInput("");
72634
+ };
72635
+ const applyGradientValue = (value) => {
72636
+ onUpdate({
72637
+ ...settings,
72638
+ overrideForegroundColor: value
72639
+ });
72640
+ exitGradient();
72641
+ };
72642
+ if (gradientCustomStep) {
72643
+ if (key.escape) {
72644
+ setGradientCustomStep(null);
72645
+ setGradientHexInput("");
72646
+ } else if (key.return) {
72647
+ if (gradientHexInput.length === 6) {
72648
+ if (gradientCustomStep === "start") {
72649
+ setGradientStartHex(gradientHexInput);
72650
+ setGradientHexInput("");
72651
+ setGradientCustomStep("end");
72652
+ } else {
72653
+ applyGradientValue(`gradient:${gradientStartHex}-${gradientHexInput}`);
72654
+ }
72655
+ }
72656
+ } else if (key.backspace || key.delete) {
72657
+ setGradientHexInput(gradientHexInput.slice(0, -1));
72658
+ } else if (shouldInsertInput(input, key) && gradientHexInput.length < 6) {
72659
+ const upperInput = input.toUpperCase();
72660
+ if (/^[0-9A-F]$/.test(upperInput)) {
72661
+ setGradientHexInput(gradientHexInput + upperInput);
72662
+ }
72663
+ }
72664
+ return;
72665
+ }
72666
+ const total = GRADIENT_PRESET_NAMES.length + 1;
72667
+ if (key.escape) {
72668
+ exitGradient();
72669
+ } else if (key.upArrow) {
72670
+ setGradientIndex((gradientIndex - 1 + total) % total);
72671
+ } else if (key.downArrow) {
72672
+ setGradientIndex((gradientIndex + 1) % total);
72673
+ } else if (key.return) {
72674
+ if (gradientIndex < GRADIENT_PRESET_NAMES.length) {
72675
+ applyGradientValue(`gradient:${GRADIENT_PRESET_NAMES[gradientIndex]}`);
72676
+ } else {
72677
+ setGradientStartHex("");
72678
+ setGradientHexInput("");
72679
+ setGradientCustomStep("start");
72680
+ }
72681
+ }
71820
72682
  } else {
71821
72683
  if (key.escape) {
71822
72684
  onBack();
@@ -71871,6 +72733,12 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71871
72733
  };
71872
72734
  onUpdate(updatedSettings);
71873
72735
  } else if (input === "g" || input === "G") {
72736
+ setGradientMode(true);
72737
+ setGradientIndex(0);
72738
+ setGradientCustomStep(null);
72739
+ setGradientStartHex("");
72740
+ setGradientHexInput("");
72741
+ } else if (input === "x" || input === "X") {
71874
72742
  const updatedSettings = {
71875
72743
  ...settings,
71876
72744
  overrideForegroundColor: undefined
@@ -71879,6 +72747,87 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
71879
72747
  }
71880
72748
  }
71881
72749
  });
72750
+ if (gradientMode) {
72751
+ const level = getColorLevelString(settings.colorLevel);
72752
+ if (gradientCustomStep) {
72753
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72754
+ flexDirection: "column",
72755
+ children: [
72756
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72757
+ bold: true,
72758
+ children: "Custom Gradient - Override FG Color"
72759
+ }, undefined, false, undefined, this),
72760
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72761
+ marginTop: 1,
72762
+ flexDirection: "column",
72763
+ children: [
72764
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72765
+ children: gradientCustomStep === "start" ? "Enter START hex color (without #):" : "Enter END hex color (without #):"
72766
+ }, undefined, false, undefined, this),
72767
+ gradientCustomStep === "end" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72768
+ dimColor: true,
72769
+ children: [
72770
+ "Start: #",
72771
+ gradientStartHex
72772
+ ]
72773
+ }, undefined, true, undefined, this),
72774
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72775
+ children: [
72776
+ "#",
72777
+ gradientHexInput,
72778
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72779
+ dimColor: true,
72780
+ children: gradientHexInput.length < 6 ? "_".repeat(6 - gradientHexInput.length) : ""
72781
+ }, undefined, false, undefined, this)
72782
+ ]
72783
+ }, undefined, true, undefined, this),
72784
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72785
+ children: " "
72786
+ }, undefined, false, undefined, this),
72787
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72788
+ dimColor: true,
72789
+ children: "Press Enter when done, ESC to go back"
72790
+ }, undefined, false, undefined, this)
72791
+ ]
72792
+ }, undefined, true, undefined, this)
72793
+ ]
72794
+ }, undefined, true, undefined, this);
72795
+ }
72796
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72797
+ flexDirection: "column",
72798
+ children: [
72799
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72800
+ bold: true,
72801
+ children: "Select Gradient - Override FG Color"
72802
+ }, undefined, false, undefined, this),
72803
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72804
+ marginTop: 1,
72805
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72806
+ dimColor: true,
72807
+ children: "↑↓ to select, Enter to apply, ESC to cancel"
72808
+ }, undefined, false, undefined, this)
72809
+ }, undefined, false, undefined, this),
72810
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
72811
+ marginTop: 1,
72812
+ flexDirection: "column",
72813
+ children: [
72814
+ GRADIENT_PRESET_NAMES.map((name, idx) => /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72815
+ children: [
72816
+ idx === gradientIndex ? "▶ " : " ",
72817
+ applyColors(name, `gradient:${name}`, undefined, idx === gradientIndex, level)
72818
+ ]
72819
+ }, name, true, undefined, this)),
72820
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72821
+ children: [
72822
+ gradientIndex === GRADIENT_PRESET_NAMES.length ? "▶ " : " ",
72823
+ "Custom (enter two hex stops)"
72824
+ ]
72825
+ }, "custom", true, undefined, this)
72826
+ ]
72827
+ }, undefined, true, undefined, this)
72828
+ ]
72829
+ }, undefined, true, undefined, this);
72830
+ }
71882
72831
  return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
71883
72832
  flexDirection: "column",
71884
72833
  children: [
@@ -72044,6 +72993,13 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
72044
72993
  color: "gray",
72045
72994
  children: "(none)"
72046
72995
  }, undefined, false, undefined, this);
72996
+ } else if (fgColor.startsWith("gradient:")) {
72997
+ const body = fgColor.substring(9);
72998
+ const displayName = GRADIENT_PRESET_NAMES.includes(body.toLowerCase()) ? `Gradient: ${body.toLowerCase()}` : `Gradient: ${body}`;
72999
+ const level = getColorLevelString(settings.colorLevel);
73000
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
73001
+ children: applyColors(displayName, fgColor, undefined, false, level)
73002
+ }, undefined, false, undefined, this);
72047
73003
  } else {
72048
73004
  const displayName = getColorDisplayName(fgColor);
72049
73005
  const fgChalk = getChalkColor(fgColor, "ansi16", false);
@@ -72055,7 +73011,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
72055
73011
  })(),
72056
73012
  /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
72057
73013
  dimColor: true,
72058
- children: " - (f) 切换,(g) 清除"
73014
+ children: " - (f) 切换,(g) 渐变色,(x) 清除"
72059
73015
  }, undefined, false, undefined, this)
72060
73016
  ]
72061
73017
  }, undefined, true, undefined, this),
@@ -74537,6 +75493,8 @@ var PowerlineSetup = ({
74537
75493
  const [confirmingEnable, setConfirmingEnable] = import_react46.useState(false);
74538
75494
  const [confirmingFontInstall, setConfirmingFontInstall] = import_react46.useState(false);
74539
75495
  const hasSeparatorItems = settings.lines.some((line) => line.some((item) => item.type === "separator" || item.type === "flex-separator"));
75496
+ const hasGlobalFgOverride = Boolean(settings.overrideForegroundColor && settings.overrideForegroundColor !== "none");
75497
+ const globalOverrideMessage = hasGlobalFgOverride ? "⚠ 前景色全局覆盖已激活" : null;
74540
75498
  use_input_default((input, key) => {
74541
75499
  if (fontInstallMessage || installingFonts) {
74542
75500
  if (fontInstallMessage && !key.escape) {
@@ -74629,10 +75587,22 @@ var PowerlineSetup = ({
74629
75587
  return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
74630
75588
  flexDirection: "column",
74631
75589
  children: [
74632
- !confirmingFontInstall && !installingFonts && !fontInstallMessage && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
74633
- bold: true,
74634
- children: "Powerline 设置"
74635
- }, undefined, false, undefined, this),
75590
+ !confirmingFontInstall && !installingFonts && !fontInstallMessage && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
75591
+ children: [
75592
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
75593
+ bold: true,
75594
+ children: "Powerline 设置"
75595
+ }, undefined, false, undefined, this),
75596
+ globalOverrideMessage && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
75597
+ color: "yellow",
75598
+ dimColor: true,
75599
+ children: [
75600
+ ". ",
75601
+ globalOverrideMessage
75602
+ ]
75603
+ }, undefined, true, undefined, this)
75604
+ ]
75605
+ }, undefined, true, undefined, this),
74636
75606
  confirmingFontInstall ? /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
74637
75607
  flexDirection: "column",
74638
75608
  children: [
@@ -74918,7 +75888,7 @@ var PowerlineSetup = ({
74918
75888
  children: [
74919
75889
  /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
74920
75890
  dimColor: true,
74921
- children: "启用后,全局覆盖将被禁用,并使用 Powerline 分隔符"
75891
+ children: "Powerline 模式使用独立的分隔符系统"
74922
75892
  }, undefined, false, undefined, this),
74923
75893
  /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
74924
75894
  dimColor: true,
@@ -75932,7 +76902,7 @@ function getPinnedMismatchItems(mismatch, canRunPackageManager) {
75932
76902
  value: "update",
75933
76903
  disabled: !canRunPackageManager,
75934
76904
  sublabel: canRunPackageManager ? undefined : `(${mismatch.packageManager} not installed)`,
75935
- description: `Runs ${mismatch.packageManager === "npm" ? `npm install -g ccstatusline@${mismatch.runningVersion}` : `bun add -g ccstatusline@${mismatch.runningVersion}`}`
76905
+ description: `Runs ${mismatch.packageManager === "npm" ? `npm install -g ccstatusline-zh@${mismatch.runningVersion}` : `bun add -g ccstatusline-zh@${mismatch.runningVersion}`}`
75936
76906
  });
75937
76907
  }
75938
76908
  items.push({
@@ -75967,7 +76937,7 @@ var PinnedVersionMismatchScreen = ({
75967
76937
  /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
75968
76938
  color: "yellow",
75969
76939
  children: [
75970
- "Claude Code is pinned to ccstatusline v",
76940
+ "Claude Code is pinned to ccstatusline-zh v",
75971
76941
  mismatch.installedVersion,
75972
76942
  ", but this TUI is v",
75973
76943
  mismatch.runningVersion,
@@ -76011,11 +76981,11 @@ var PinnedVersionMismatchScreen = ({
76011
76981
  }, undefined, true, undefined, this);
76012
76982
  };
76013
76983
  function getGlobalUninstallCommand(packageManager) {
76014
- return packageManager === "npm" ? "npm uninstall -g ccstatusline" : "bun remove -g ccstatusline";
76984
+ return packageManager === "npm" ? "npm uninstall -g ccstatusline-zh" : "bun remove -g ccstatusline-zh";
76015
76985
  }
76016
76986
  function buildUninstallConfirmMessage(selection) {
76017
76987
  if (selection.packageManagers.length === 0) {
76018
- return `This will remove ccstatusline from ${getClaudeSettingsPath()}. Continue?`;
76988
+ return `This will remove ccstatusline-zh from ${getClaudeSettingsPath()}. Continue?`;
76019
76989
  }
76020
76990
  const commands = selection.packageManagers.map((packageManager) => getGlobalUninstallCommand(packageManager)).join(`
76021
76991
  `);
@@ -76940,6 +77910,7 @@ import * as fs15 from "fs";
76940
77910
  import * as os14 from "os";
76941
77911
  import * as path12 from "path";
76942
77912
  var DEFAULT_DROP_THRESHOLD = 2;
77913
+ var MIN_CTX_PCT = 1;
76943
77914
  var FRESH_PREV_CTX_PCT = -1;
76944
77915
  var MAX_CACHE_FILE_BYTES = 4096;
76945
77916
  var SESSION_ID_HASH_HEX_LEN = 32;
@@ -76963,7 +77934,7 @@ function normalizeOptions(options) {
76963
77934
  return { dropThreshold, windowSize: options.windowSize ?? null };
76964
77935
  }
76965
77936
  function detectCompaction(currentCtxPct, state, options = DEFAULT_DROP_THRESHOLD) {
76966
- if (!Number.isFinite(currentCtxPct) || currentCtxPct < 0) {
77937
+ if (!Number.isFinite(currentCtxPct) || currentCtxPct < MIN_CTX_PCT) {
76967
77938
  return state;
76968
77939
  }
76969
77940
  const { dropThreshold, windowSize } = normalizeOptions(options);