@laoyuehanni/dsh-token-usage 0.4.1 → 0.4.2

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.
Files changed (69) hide show
  1. package/README.md +2 -10
  2. package/README.zh.md +2 -10
  3. package/docs/pricing.md +3 -13
  4. package/lib/client/PricingDialog.d.ts +51 -0
  5. package/lib/client/PricingDialog.d.ts.map +1 -0
  6. package/lib/client/PricingDialog.js +127 -0
  7. package/lib/client/PricingDialog.js.map +1 -0
  8. package/lib/client/PricingOverviewDialog.d.ts +76 -0
  9. package/lib/client/PricingOverviewDialog.d.ts.map +1 -0
  10. package/lib/client/PricingOverviewDialog.js +361 -0
  11. package/lib/client/PricingOverviewDialog.js.map +1 -0
  12. package/lib/client/SessionTable.d.ts +39 -0
  13. package/lib/client/SessionTable.d.ts.map +1 -0
  14. package/lib/client/SessionTable.js +181 -0
  15. package/lib/client/SessionTable.js.map +1 -0
  16. package/lib/client/TokenUsageSection.d.ts +16 -9
  17. package/lib/client/TokenUsageSection.d.ts.map +1 -1
  18. package/lib/client/TokenUsageSection.js +66 -128
  19. package/lib/client/TokenUsageSection.js.map +1 -1
  20. package/lib/client/index.d.ts +3 -2
  21. package/lib/client/index.d.ts.map +1 -1
  22. package/lib/client/index.js +23 -3
  23. package/lib/client/index.js.map +1 -1
  24. package/lib/client/locales.d.ts +25 -0
  25. package/lib/client/locales.d.ts.map +1 -1
  26. package/lib/client/locales.js +50 -0
  27. package/lib/client/locales.js.map +1 -1
  28. package/lib/client.js +1386 -293
  29. package/lib/client.js.map +1 -1
  30. package/lib/index.d.ts.map +1 -1
  31. package/lib/index.js +47 -10
  32. package/lib/index.js.map +1 -1
  33. package/lib/migrate.d.ts +3 -2
  34. package/lib/migrate.d.ts.map +1 -1
  35. package/lib/migrate.js +4 -2
  36. package/lib/migrate.js.map +1 -1
  37. package/lib/pricing.d.ts +29 -23
  38. package/lib/pricing.d.ts.map +1 -1
  39. package/lib/pricing.js +38 -50
  40. package/lib/pricing.js.map +1 -1
  41. package/lib/rollup.d.ts +7 -1
  42. package/lib/rollup.d.ts.map +1 -1
  43. package/lib/rollup.js +15 -0
  44. package/lib/rollup.js.map +1 -1
  45. package/lib/session-meta.d.ts +68 -0
  46. package/lib/session-meta.d.ts.map +1 -0
  47. package/lib/session-meta.js +174 -0
  48. package/lib/session-meta.js.map +1 -0
  49. package/lib/stats-route.d.ts +22 -0
  50. package/lib/stats-route.d.ts.map +1 -1
  51. package/lib/stats-route.js +85 -6
  52. package/lib/stats-route.js.map +1 -1
  53. package/lib/stats.d.ts +35 -3
  54. package/lib/stats.d.ts.map +1 -1
  55. package/lib/stats.js +185 -6
  56. package/lib/stats.js.map +1 -1
  57. package/lib/sync-state.d.ts +42 -10
  58. package/lib/sync-state.d.ts.map +1 -1
  59. package/lib/sync-state.js +61 -19
  60. package/lib/sync-state.js.map +1 -1
  61. package/lib/sync.d.ts +55 -9
  62. package/lib/sync.d.ts.map +1 -1
  63. package/lib/sync.js +55 -10
  64. package/lib/sync.js.map +1 -1
  65. package/lib/wire.d.ts +114 -10
  66. package/lib/wire.d.ts.map +1 -1
  67. package/lib/wire.js +3 -0
  68. package/lib/wire.js.map +1 -1
  69. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -10,6 +10,9 @@ window.__ModuleLoader__.load({
10
10
  //#region src/wire.ts
11
11
  /** The stats endpoint path, served by the host half's webServer route. */
12
12
  const STATS_PATH = "/token-usage/stats";
13
+ /** The pricing-overview endpoint path: the full cloud-mirror model list,
14
+ * filter-free by design — the overview is not a filtered usage view. */
15
+ const PRICING_PATH = "/token-usage/pricing";
13
16
  /** Encode one repeated query key (`sessionId=a&sessionId=b`). Empty list yields ''. */
14
17
  function encodeRepeatedParam(key, values) {
15
18
  return values.map((value) => `${key}=${encodeURIComponent(value)}`).join("&");
@@ -541,13 +544,13 @@ window.__ModuleLoader__.load({
541
544
  }
542
545
  //#endregion
543
546
  //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\QuotaButton.module.css.mjs
544
- const css$9 = ".jYASuG_root{flex:none;display:inline-flex;position:relative}.jYASuG_trigger{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;padding:0;display:grid}.jYASuG_trigger svg{display:block}.jYASuG_trigger:hover,.jYASuG_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jYASuG_trigger.jYASuG_icon-ok:hover,.jYASuG_trigger.jYASuG_icon-ok[aria-expanded=true]{color:var(--dsw-alias-state-success-primary)}.jYASuG_trigger.jYASuG_icon-warn:hover,.jYASuG_trigger.jYASuG_icon-warn[aria-expanded=true]{color:var(--dsw-alias-state-warn-primary)}.jYASuG_trigger.jYASuG_icon-exhausted:hover,.jYASuG_trigger.jYASuG_icon-exhausted[aria-expanded=true]{color:var(--dsw-alias-state-error-primary)}.jYASuG_icon-ok{color:var(--dsw-alias-state-success-primary)}.jYASuG_icon-warn{color:var(--dsw-alias-state-warn-primary)}.jYASuG_icon-exhausted{color:var(--dsw-alias-state-error-primary)}.jYASuG_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);width:320px;max-width:calc(100vw - 32px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-secondary);text-align:left;cursor:default;border-radius:12px;padding:12px;font-size:12px;line-height:20px;position:absolute;bottom:calc(100% + 8px)}.jYASuG_header{justify-content:space-between;align-items:baseline;gap:8px;margin-bottom:10px;display:flex}.jYASuG_title{color:var(--dsw-alias-label-primary);white-space:nowrap;text-overflow:ellipsis;font-size:13px;font-weight:500;overflow:hidden}.jYASuG_plan{color:var(--dsw-alias-label-tertiary);font-weight:400}.jYASuG_updated{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.jYASuG_grid{grid-template-columns:repeat(var(--cols,3), 1fr);gap:14px;display:grid}.jYASuG_col{min-width:0}.jYASuG_label{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;margin-bottom:2px;font-size:11px;line-height:16px;overflow:hidden}.jYASuG_value{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;white-space:nowrap;margin-bottom:6px;font-size:13px;font-weight:600;line-height:18px}.jYASuG_meta{color:var(--dsw-alias-label-tertiary);font-size:11px;font-weight:400}.jYASuG_bar{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:4px;overflow:hidden}.jYASuG_fill{border-radius:999px;height:100%;transition:width .3s}.jYASuG_ok{background:var(--dsw-alias-state-success-primary)}.jYASuG_warn{background:var(--dsw-alias-state-warn-primary)}.jYASuG_exhausted{background:var(--dsw-alias-state-error-primary)}.jYASuG_aux{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;white-space:nowrap;margin-top:4px;font-size:11px;line-height:14px}.jYASuG_dot{vertical-align:middle;border-radius:50%;width:5px;height:5px;margin-right:3px;display:inline-block}.jYASuG_error{flex-direction:column;gap:8px;display:flex}.jYASuG_errorText{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;font-size:12px;line-height:18px}.jYASuG_retry{color:var(--dsw-alias-label-primary);cursor:pointer;text-underline-offset:2px;background:0 0;border:none;align-self:flex-start;padding:0;font-size:12px;text-decoration:underline}.jYASuG_retry:hover{color:var(--dsw-alias-brand-primary)}";
545
- const tagId$9 = "@laoyuehanni/dsh-token-usage/QuotaButton.module.css";
546
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$9) + "]") === null) {
547
+ const css$12 = ".jYASuG_root{flex:none;display:inline-flex;position:relative}.jYASuG_trigger{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;padding:0;display:grid}.jYASuG_trigger svg{display:block}.jYASuG_trigger:hover,.jYASuG_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jYASuG_trigger.jYASuG_icon-ok:hover,.jYASuG_trigger.jYASuG_icon-ok[aria-expanded=true]{color:var(--dsw-alias-state-success-primary)}.jYASuG_trigger.jYASuG_icon-warn:hover,.jYASuG_trigger.jYASuG_icon-warn[aria-expanded=true]{color:var(--dsw-alias-state-warn-primary)}.jYASuG_trigger.jYASuG_icon-exhausted:hover,.jYASuG_trigger.jYASuG_icon-exhausted[aria-expanded=true]{color:var(--dsw-alias-state-error-primary)}.jYASuG_icon-ok{color:var(--dsw-alias-state-success-primary)}.jYASuG_icon-warn{color:var(--dsw-alias-state-warn-primary)}.jYASuG_icon-exhausted{color:var(--dsw-alias-state-error-primary)}.jYASuG_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);width:320px;max-width:calc(100vw - 32px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-secondary);text-align:left;cursor:default;border-radius:12px;padding:12px;font-size:12px;line-height:20px;position:absolute;bottom:calc(100% + 8px)}.jYASuG_header{justify-content:space-between;align-items:baseline;gap:8px;margin-bottom:10px;display:flex}.jYASuG_title{color:var(--dsw-alias-label-primary);white-space:nowrap;text-overflow:ellipsis;font-size:13px;font-weight:500;overflow:hidden}.jYASuG_plan{color:var(--dsw-alias-label-tertiary);font-weight:400}.jYASuG_updated{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.jYASuG_grid{grid-template-columns:repeat(var(--cols,3), 1fr);gap:14px;display:grid}.jYASuG_col{min-width:0}.jYASuG_label{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;margin-bottom:2px;font-size:11px;line-height:16px;overflow:hidden}.jYASuG_value{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;white-space:nowrap;margin-bottom:6px;font-size:13px;font-weight:600;line-height:18px}.jYASuG_meta{color:var(--dsw-alias-label-tertiary);font-size:11px;font-weight:400}.jYASuG_bar{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:4px;overflow:hidden}.jYASuG_fill{border-radius:999px;height:100%;transition:width .3s}.jYASuG_ok{background:var(--dsw-alias-state-success-primary)}.jYASuG_warn{background:var(--dsw-alias-state-warn-primary)}.jYASuG_exhausted{background:var(--dsw-alias-state-error-primary)}.jYASuG_aux{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;white-space:nowrap;margin-top:4px;font-size:11px;line-height:14px}.jYASuG_dot{vertical-align:middle;border-radius:50%;width:5px;height:5px;margin-right:3px;display:inline-block}.jYASuG_error{flex-direction:column;gap:8px;display:flex}.jYASuG_errorText{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;font-size:12px;line-height:18px}.jYASuG_retry{color:var(--dsw-alias-label-primary);cursor:pointer;text-underline-offset:2px;background:0 0;border:none;align-self:flex-start;padding:0;font-size:12px;text-decoration:underline}.jYASuG_retry:hover{color:var(--dsw-alias-brand-primary)}";
548
+ const tagId$12 = "@laoyuehanni/dsh-token-usage/QuotaButton.module.css";
549
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$12) + "]") === null) {
547
550
  const tag = document.createElement("style");
548
551
  tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
549
- tag.dataset.pluginCss = tagId$9;
550
- tag.textContent = css$9;
552
+ tag.dataset.pluginCss = tagId$12;
553
+ tag.textContent = css$12;
551
554
  document.head.appendChild(tag);
552
555
  }
553
556
  var QuotaButton_module_css_default = {
@@ -1227,13 +1230,13 @@ window.__ModuleLoader__.load({
1227
1230
  }
1228
1231
  //#endregion
1229
1232
  //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\hit-rate-band.module.css.mjs
1230
- const css$8 = ".t6JM8a_band_critical{color:var(--dsw-alias-state-error-primary,#dc2626)}.t6JM8a_band_amber{color:#f59e0b}.t6JM8a_band_lime{color:#84cc16}.t6JM8a_band_healthy{color:var(--dsw-alias-state-success-primary,#16a34a)}";
1231
- const tagId$8 = "@laoyuehanni/dsh-token-usage/hit-rate-band.module.css";
1232
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$8) + "]") === null) {
1233
+ const css$11 = ".t6JM8a_band_critical{color:var(--dsw-alias-state-error-primary,#dc2626)}.t6JM8a_band_amber{color:#f59e0b}.t6JM8a_band_lime{color:#84cc16}.t6JM8a_band_healthy{color:var(--dsw-alias-state-success-primary,#16a34a)}";
1234
+ const tagId$11 = "@laoyuehanni/dsh-token-usage/hit-rate-band.module.css";
1235
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$11) + "]") === null) {
1233
1236
  const tag = document.createElement("style");
1234
1237
  tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
1235
- tag.dataset.pluginCss = tagId$8;
1236
- tag.textContent = css$8;
1238
+ tag.dataset.pluginCss = tagId$11;
1239
+ tag.textContent = css$11;
1237
1240
  document.head.appendChild(tag);
1238
1241
  }
1239
1242
  var hit_rate_band_module_css_default = {
@@ -1453,13 +1456,13 @@ window.__ModuleLoader__.load({
1453
1456
  }
1454
1457
  //#endregion
1455
1458
  //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\SessionStatsChip.module.css.mjs
1456
- const css$7 = ".d5ISLa_strip{border:1px solid var(--dsw-alias-border-l2);font-variant-numeric:tabular-nums;background:0 0;border-radius:14px;flex:none;align-items:stretch;min-width:0;height:28px;font-size:12px;line-height:18px;display:inline-flex;overflow:hidden}.d5ISLa_stripFlyOverflow{z-index:2;position:relative;overflow:visible}.d5ISLa_cell{color:var(--dsw-alias-label-primary);white-space:nowrap;align-items:center;padding:0 10px;display:inline-flex}.d5ISLa_cell+.d5ISLa_cell{border-left:1px solid var(--dsw-alias-border-l1)}.d5ISLa_cellHit{font-weight:500}.d5ISLa_costCell{z-index:1;position:relative;overflow:visible}.d5ISLa_costInner{transform-origin:50%;z-index:2;justify-content:center;align-items:center;display:inline-flex;position:relative}.d5ISLa_deltaLayer{pointer-events:none;z-index:3;position:absolute;inset:0;overflow:visible}.d5ISLa_deltaFly{color:var(--dsw-alias-state-warn-primary);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;text-shadow:0 0 8px color-mix(in srgb, var(--dsw-alias-state-warn-primary) 35%, transparent);font-size:11px;font-weight:600;position:absolute;top:0;left:50%;transform:translate(-50%,-100%)}@media (prefers-reduced-motion:reduce){.d5ISLa_deltaFly{display:none}}@media (width<=560px){.d5ISLa_strip{font-size:11px}.d5ISLa_cell{padding:0 7px}}";
1457
- const tagId$7 = "@laoyuehanni/dsh-token-usage/SessionStatsChip.module.css";
1458
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$7) + "]") === null) {
1459
+ const css$10 = ".d5ISLa_strip{border:1px solid var(--dsw-alias-border-l2);font-variant-numeric:tabular-nums;background:0 0;border-radius:14px;flex:none;align-items:stretch;min-width:0;height:28px;font-size:12px;line-height:18px;display:inline-flex;overflow:hidden}.d5ISLa_stripFlyOverflow{z-index:2;position:relative;overflow:visible}.d5ISLa_cell{color:var(--dsw-alias-label-primary);white-space:nowrap;align-items:center;padding:0 10px;display:inline-flex}.d5ISLa_cell+.d5ISLa_cell{border-left:1px solid var(--dsw-alias-border-l1)}.d5ISLa_cellHit{font-weight:500}.d5ISLa_costCell{z-index:1;position:relative;overflow:visible}.d5ISLa_costInner{transform-origin:50%;z-index:2;justify-content:center;align-items:center;display:inline-flex;position:relative}.d5ISLa_deltaLayer{pointer-events:none;z-index:3;position:absolute;inset:0;overflow:visible}.d5ISLa_deltaFly{color:var(--dsw-alias-state-warn-primary);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;text-shadow:0 0 8px color-mix(in srgb, var(--dsw-alias-state-warn-primary) 35%, transparent);font-size:11px;font-weight:600;position:absolute;top:0;left:50%;transform:translate(-50%,-100%)}@media (prefers-reduced-motion:reduce){.d5ISLa_deltaFly{display:none}}@media (width<=560px){.d5ISLa_strip{font-size:11px}.d5ISLa_cell{padding:0 7px}}";
1460
+ const tagId$10 = "@laoyuehanni/dsh-token-usage/SessionStatsChip.module.css";
1461
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$10) + "]") === null) {
1459
1462
  const tag = document.createElement("style");
1460
1463
  tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
1461
- tag.dataset.pluginCss = tagId$7;
1462
- tag.textContent = css$7;
1464
+ tag.dataset.pluginCss = tagId$10;
1465
+ tag.textContent = css$10;
1463
1466
  document.head.appendChild(tag);
1464
1467
  }
1465
1468
  var SessionStatsChip_module_css_default = {
@@ -1795,13 +1798,13 @@ window.__ModuleLoader__.load({
1795
1798
  }
1796
1799
  //#endregion
1797
1800
  //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\TokenUsageCard.module.css.mjs
1798
- const css$6 = "._1bMeTa_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}._1bMeTa_card:hover{border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}._1bMeTa_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}._1bMeTa_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}._1bMeTa_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}._1bMeTa_description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}._1bMeTa_pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}._1bMeTa_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}._1bMeTa_chevronOpen{transform:rotate(180deg)}._1bMeTa_body{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;gap:10px;margin:0 16px;padding:12px 0 8px;display:flex}._1bMeTa_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}._1bMeTa_field{flex-direction:column;gap:4px;display:flex}._1bMeTa_fieldLabel{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5}._1bMeTa_input{box-sizing:border-box;width:100%;font:inherit;color:var(--dsw-alias-label-primary);background-color:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);appearance:none;border-radius:6px;padding:4px 8px;font-size:13px;line-height:20px}._1bMeTa_input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}._1bMeTa_input:disabled{opacity:.6}._1bMeTa_inputRow{align-items:center;gap:6px;display:flex}._1bMeTa_inputRow ._1bMeTa_input{flex:1;min-width:0}._1bMeTa_browse{appearance:none;border:1px solid var(--dsw-alias-border-l2);font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border-radius:6px;flex:none;padding:4px 10px;font-size:13px;line-height:20px}._1bMeTa_browse:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_browse:disabled{opacity:.4;cursor:default}._1bMeTa_browse:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._1bMeTa_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}._1bMeTa_migration{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:6px;flex-direction:column;gap:4px;padding:8px 10px;display:flex}._1bMeTa_migrationLabel{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:12px;line-height:1.5}._1bMeTa_migrationBar{background:var(--dsw-alias-bg-multi-select);border-radius:2px;height:4px;display:block;overflow:hidden}._1bMeTa_migrationFill{background:var(--dsw-alias-brand-primary);border-radius:2px;height:100%;transition:width .2s;display:block}._1bMeTa_footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:8px 0 4px;display:flex}._1bMeTa_failed{min-width:0;color:var(--dsw-alias-label-error);flex:1;margin:0;font-size:12px;line-height:1.5}._1bMeTa_discard,._1bMeTa_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}._1bMeTa_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}._1bMeTa_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}._1bMeTa_discard:disabled,._1bMeTa_save:disabled{opacity:.4;cursor:default}._1bMeTa_discard:focus-visible,._1bMeTa_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._1bMeTa_fullSync{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:8px;flex-direction:column;gap:8px;padding:10px 12px;display:flex}._1bMeTa_fullSyncHeader{flex-direction:column;gap:2px;display:flex}._1bMeTa_fullSyncTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:1.4}._1bMeTa_fullSyncHint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.5}._1bMeTa_fullSyncButton{appearance:none;border:1px solid var(--dsw-alias-border-l2);font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border-radius:6px;align-self:flex-start;padding:4px 12px;font-size:13px;line-height:20px}._1bMeTa_fullSyncButton:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_fullSyncButton:disabled{opacity:.5;cursor:default}._1bMeTa_fullSyncButton:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._1bMeTa_fullSyncProgress{flex-direction:column;gap:4px;display:flex}._1bMeTa_fullSyncProgressLabel{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:12px;line-height:1.5}._1bMeTa_fullSyncBar{background:var(--dsw-alias-bg-multi-select);border-radius:2px;height:4px;display:block;overflow:hidden}._1bMeTa_fullSyncFill{background:var(--dsw-alias-brand-primary);border-radius:2px;height:100%;transition:width .2s;display:block}._1bMeTa_fullSyncResult{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;margin:0;font-size:12px;line-height:1.5}._1bMeTa_fullSyncError{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}";
1799
- const tagId$6 = "@laoyuehanni/dsh-token-usage/TokenUsageCard.module.css";
1800
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
1801
+ const css$9 = "._1bMeTa_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}._1bMeTa_card:hover{border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}._1bMeTa_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}._1bMeTa_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}._1bMeTa_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}._1bMeTa_description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}._1bMeTa_pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}._1bMeTa_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}._1bMeTa_chevronOpen{transform:rotate(180deg)}._1bMeTa_body{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;gap:10px;margin:0 16px;padding:12px 0 8px;display:flex}._1bMeTa_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}._1bMeTa_field{flex-direction:column;gap:4px;display:flex}._1bMeTa_fieldLabel{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5}._1bMeTa_input{box-sizing:border-box;width:100%;font:inherit;color:var(--dsw-alias-label-primary);background-color:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);appearance:none;border-radius:6px;padding:4px 8px;font-size:13px;line-height:20px}._1bMeTa_input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}._1bMeTa_input:disabled{opacity:.6}._1bMeTa_inputRow{align-items:center;gap:6px;display:flex}._1bMeTa_inputRow ._1bMeTa_input{flex:1;min-width:0}._1bMeTa_browse{appearance:none;border:1px solid var(--dsw-alias-border-l2);font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border-radius:6px;flex:none;padding:4px 10px;font-size:13px;line-height:20px}._1bMeTa_browse:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_browse:disabled{opacity:.4;cursor:default}._1bMeTa_browse:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._1bMeTa_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}._1bMeTa_migration{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:6px;flex-direction:column;gap:4px;padding:8px 10px;display:flex}._1bMeTa_migrationLabel{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:12px;line-height:1.5}._1bMeTa_migrationBar{background:var(--dsw-alias-bg-multi-select);border-radius:2px;height:4px;display:block;overflow:hidden}._1bMeTa_migrationFill{background:var(--dsw-alias-brand-primary);border-radius:2px;height:100%;transition:width .2s;display:block}._1bMeTa_footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:8px 0 4px;display:flex}._1bMeTa_failed{min-width:0;color:var(--dsw-alias-label-error);flex:1;margin:0;font-size:12px;line-height:1.5}._1bMeTa_discard,._1bMeTa_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}._1bMeTa_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}._1bMeTa_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}._1bMeTa_discard:disabled,._1bMeTa_save:disabled{opacity:.4;cursor:default}._1bMeTa_discard:focus-visible,._1bMeTa_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._1bMeTa_fullSync{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:8px;flex-direction:column;gap:8px;padding:10px 12px;display:flex}._1bMeTa_fullSyncHeader{flex-direction:column;gap:2px;display:flex}._1bMeTa_fullSyncTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:1.4}._1bMeTa_fullSyncHint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.5}._1bMeTa_fullSyncButton{appearance:none;border:1px solid var(--dsw-alias-border-l2);font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border-radius:6px;align-self:flex-start;padding:4px 12px;font-size:13px;line-height:20px}._1bMeTa_fullSyncButton:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}._1bMeTa_fullSyncButton:disabled{opacity:.5;cursor:default}._1bMeTa_fullSyncButton:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._1bMeTa_fullSyncProgress{flex-direction:column;gap:4px;display:flex}._1bMeTa_fullSyncProgressLabel{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:12px;line-height:1.5}._1bMeTa_fullSyncBar{background:var(--dsw-alias-bg-multi-select);border-radius:2px;height:4px;display:block;overflow:hidden}._1bMeTa_fullSyncFill{background:var(--dsw-alias-brand-primary);border-radius:2px;height:100%;transition:width .2s;display:block}._1bMeTa_fullSyncResult{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;margin:0;font-size:12px;line-height:1.5}._1bMeTa_fullSyncError{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}";
1802
+ const tagId$9 = "@laoyuehanni/dsh-token-usage/TokenUsageCard.module.css";
1803
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$9) + "]") === null) {
1801
1804
  const tag = document.createElement("style");
1802
1805
  tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
1803
- tag.dataset.pluginCss = tagId$6;
1804
- tag.textContent = css$6;
1806
+ tag.dataset.pluginCss = tagId$9;
1807
+ tag.textContent = css$9;
1805
1808
  document.head.appendChild(tag);
1806
1809
  }
1807
1810
  var TokenUsageCard_module_css_default = {
@@ -2168,13 +2171,13 @@ window.__ModuleLoader__.load({
2168
2171
  }
2169
2172
  //#endregion
2170
2173
  //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\DateRangePicker.module.css.mjs
2171
- const css$5 = ".aSiNOq_wrapper{flex:none;display:inline-flex;position:relative}.aSiNOq_trigger{box-sizing:border-box;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);background-color:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;white-space:nowrap;border-radius:6px;flex:none;padding:4px 10px;font-size:13px;line-height:20px}.aSiNOq_trigger:hover,.aSiNOq_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.aSiNOq_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);width:266px;max-width:calc(100vw - 32px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-secondary);text-align:left;cursor:default;border-radius:12px;padding:10px;font-size:12px;line-height:20px;position:absolute;top:calc(100% + 6px);left:0}.aSiNOq_head{justify-content:space-between;align-items:center;gap:4px;margin-bottom:6px;display:flex}.aSiNOq_nav{width:24px;height:24px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:0;font-size:14px;line-height:1}.aSiNOq_nav:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.aSiNOq_monthTitle{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:13px;font-weight:500}.aSiNOq_weekdays,.aSiNOq_grid{grid-template-columns:repeat(7,1fr);gap:2px;display:grid}.aSiNOq_weekday{text-align:center;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.aSiNOq_blank{visibility:hidden;height:26px}.aSiNOq_day{font-variant-numeric:tabular-nums;text-align:center;height:26px;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:0;font-size:12px;line-height:26px}.aSiNOq_day:hover{background:var(--dsw-alias-interactive-bg-hover)}.aSiNOq_dayToday{box-shadow:inset 0 0 0 1px var(--dsw-alias-border-l2)}.aSiNOq_dayAnchor,.aSiNOq_daySelected{color:var(--dsw-alias-brand-primary);box-shadow:inset 0 0 0 1px var(--dsw-alias-brand-primary);font-weight:600}.aSiNOq_dayInRange{background:var(--dsw-alias-interactive-bg-hover);border-radius:0}.aSiNOq_foot{border-top:1px solid var(--dsw-alias-border-l1);justify-content:flex-end;margin-top:8px;padding-top:8px;display:flex}.aSiNOq_clear{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:2px 8px;font-size:12px;line-height:18px}.aSiNOq_clear:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}";
2172
- const tagId$5 = "@laoyuehanni/dsh-token-usage/DateRangePicker.module.css";
2173
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$5) + "]") === null) {
2174
+ const css$8 = ".aSiNOq_wrapper{flex:none;display:inline-flex;position:relative}.aSiNOq_trigger{box-sizing:border-box;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);background-color:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;white-space:nowrap;border-radius:6px;flex:none;padding:4px 10px;font-size:13px;line-height:20px}.aSiNOq_trigger:hover,.aSiNOq_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.aSiNOq_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);width:266px;max-width:calc(100vw - 32px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-secondary);text-align:left;cursor:default;border-radius:12px;padding:10px;font-size:12px;line-height:20px;position:absolute;top:calc(100% + 6px);left:0}.aSiNOq_head{justify-content:space-between;align-items:center;gap:4px;margin-bottom:6px;display:flex}.aSiNOq_nav{width:24px;height:24px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:0;font-size:14px;line-height:1}.aSiNOq_nav:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.aSiNOq_monthTitle{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:13px;font-weight:500}.aSiNOq_weekdays,.aSiNOq_grid{grid-template-columns:repeat(7,1fr);gap:2px;display:grid}.aSiNOq_weekday{text-align:center;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.aSiNOq_blank{visibility:hidden;height:26px}.aSiNOq_day{font-variant-numeric:tabular-nums;text-align:center;height:26px;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:0;font-size:12px;line-height:26px}.aSiNOq_day:hover{background:var(--dsw-alias-interactive-bg-hover)}.aSiNOq_dayToday{box-shadow:inset 0 0 0 1px var(--dsw-alias-border-l2)}.aSiNOq_dayAnchor,.aSiNOq_daySelected{color:var(--dsw-alias-brand-primary);box-shadow:inset 0 0 0 1px var(--dsw-alias-brand-primary);font-weight:600}.aSiNOq_dayInRange{background:var(--dsw-alias-interactive-bg-hover);border-radius:0}.aSiNOq_foot{border-top:1px solid var(--dsw-alias-border-l1);justify-content:flex-end;margin-top:8px;padding-top:8px;display:flex}.aSiNOq_clear{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:2px 8px;font-size:12px;line-height:18px}.aSiNOq_clear:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}";
2175
+ const tagId$8 = "@laoyuehanni/dsh-token-usage/DateRangePicker.module.css";
2176
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$8) + "]") === null) {
2174
2177
  const tag = document.createElement("style");
2175
2178
  tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
2176
- tag.dataset.pluginCss = tagId$5;
2177
- tag.textContent = css$5;
2179
+ tag.dataset.pluginCss = tagId$8;
2180
+ tag.textContent = css$8;
2178
2181
  document.head.appendChild(tag);
2179
2182
  }
2180
2183
  var DateRangePicker_module_css_default = {
@@ -2398,13 +2401,13 @@ window.__ModuleLoader__.load({
2398
2401
  }
2399
2402
  //#endregion
2400
2403
  //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\MenuSelect.module.css.mjs
2401
- const css$4 = ".KUIXpG_wrapper{display:inline-flex;position:relative}.KUIXpG_trigger{box-sizing:border-box;color:var(--dsw-alias-label-primary);background-color:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;white-space:nowrap;text-overflow:ellipsis;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E/%3C/svg%3E\");background-position:right 6px center;background-repeat:no-repeat;background-size:12px 12px;border-radius:6px;flex:none;padding:4px 24px 4px 8px;font-size:13px;line-height:20px;overflow:hidden}.KUIXpG_trigger:hover,.KUIXpG_trigger[aria-expanded=true]{background-color:var(--dsw-alias-interactive-bg-hover)}.KUIXpG_grow{flex:0 auto;min-width:0;max-width:220px}.KUIXpG_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);min-width:100%;max-width:260px;max-height:240px;box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-secondary);text-align:left;cursor:default;border-radius:12px;padding:6px;font-size:13px;line-height:20px;position:absolute;top:calc(100% + 6px);left:0;overflow-y:auto}.KUIXpG_option{width:100%;color:var(--dsw-alias-label-primary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;justify-content:space-between;align-items:center;gap:12px;padding:4px 8px;font-size:13px;line-height:20px;display:flex}.KUIXpG_option:hover{background:var(--dsw-alias-interactive-bg-hover)}.KUIXpG_optionLabel{text-overflow:ellipsis;overflow:hidden}.KUIXpG_optionSelected{color:var(--dsw-alias-brand-primary)}.KUIXpG_check{color:var(--dsw-alias-brand-primary);flex:none}";
2402
- const tagId$4 = "@laoyuehanni/dsh-token-usage/MenuSelect.module.css";
2403
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
2404
+ const css$7 = ".KUIXpG_wrapper{display:inline-flex;position:relative}.KUIXpG_trigger{box-sizing:border-box;color:var(--dsw-alias-label-primary);background-color:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;white-space:nowrap;text-overflow:ellipsis;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E/%3C/svg%3E\");background-position:right 6px center;background-repeat:no-repeat;background-size:12px 12px;border-radius:6px;flex:none;padding:4px 24px 4px 8px;font-size:13px;line-height:20px;overflow:hidden}.KUIXpG_trigger:hover,.KUIXpG_trigger[aria-expanded=true]{background-color:var(--dsw-alias-interactive-bg-hover)}.KUIXpG_grow{flex:0 auto;min-width:0;max-width:220px}.KUIXpG_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);min-width:100%;max-width:260px;max-height:240px;box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-secondary);text-align:left;cursor:default;border-radius:12px;padding:6px;font-size:13px;line-height:20px;position:absolute;top:calc(100% + 6px);left:0;overflow-y:auto}.KUIXpG_option{width:100%;color:var(--dsw-alias-label-primary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;justify-content:space-between;align-items:center;gap:12px;padding:4px 8px;font-size:13px;line-height:20px;display:flex}.KUIXpG_option:hover{background:var(--dsw-alias-interactive-bg-hover)}.KUIXpG_optionLabel{text-overflow:ellipsis;overflow:hidden}.KUIXpG_optionSelected{color:var(--dsw-alias-brand-primary)}.KUIXpG_check{color:var(--dsw-alias-brand-primary);flex:none}";
2405
+ const tagId$7 = "@laoyuehanni/dsh-token-usage/MenuSelect.module.css";
2406
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$7) + "]") === null) {
2404
2407
  const tag = document.createElement("style");
2405
2408
  tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
2406
- tag.dataset.pluginCss = tagId$4;
2407
- tag.textContent = css$4;
2409
+ tag.dataset.pluginCss = tagId$7;
2410
+ tag.textContent = css$7;
2408
2411
  document.head.appendChild(tag);
2409
2412
  }
2410
2413
  var MenuSelect_module_css_default = {
@@ -2572,111 +2575,975 @@ window.__ModuleLoader__.load({
2572
2575
  });
2573
2576
  }
2574
2577
  //#endregion
2575
- //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\StatCard.module.css.mjs
2576
- const css$3 = ".F2LbNW_card{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;flex-direction:column;gap:2px;min-width:0;padding:10px 12px;display:flex}.F2LbNW_cardLabel{color:var(--dsw-alias-label-secondary);white-space:nowrap;text-overflow:ellipsis;font-size:11px;overflow:hidden}.F2LbNW_cardValue{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);flex-wrap:wrap;align-items:baseline;gap:4px 8px;min-width:0;font-size:18px;font-weight:600;display:flex}.F2LbNW_cardValueMain{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.F2LbNW_pillWrap{flex-shrink:0;display:inline-flex}.F2LbNW_pillWrap [role=tooltip]{white-space:pre;width:max-content;min-width:max-content;max-width:none;font-size:12px;font-weight:400;line-height:1.4}.F2LbNW_split{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:baseline;column-gap:4px;width:100%;display:grid}.F2LbNW_splitOk{text-align:right;min-width:0}.F2LbNW_splitSep{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary))}.F2LbNW_splitFailHead{text-align:left;min-width:0}.F2LbNW_splitFail{text-align:left;min-width:0;color:var(--dsw-alias-state-error-primary);display:block}.F2LbNW_split>.F2LbNW_pillWrap{justify-self:stretch;min-width:0;display:block}.F2LbNW_pill{font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 12%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 28%, transparent);border-radius:999px;flex-shrink:0;padding:1px 7px;font-size:12px;font-weight:400;line-height:1.4}";
2577
- const tagId$3 = "@laoyuehanni/dsh-token-usage/StatCard.module.css";
2578
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
2578
+ //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\PricingDialog.module.css.mjs
2579
+ const css$6 = ".gh1SLa_dialog{width:min(600px,100vw - 48px);max-height:calc(100vh - 48px);color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;padding:14px 16px;overflow-y:auto}.gh1SLa_dialog::backdrop{background:#0006}.gh1SLa_dialogHead{justify-content:space-between;align-items:center;gap:12px;margin-bottom:8px;display:flex}.gh1SLa_dialogTitle{text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums;font-size:14px;font-weight:600;overflow:hidden}.gh1SLa_dialogClose{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 8px;font-size:12px;line-height:18px}.gh1SLa_dialogClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-interactive-bg-hover)}.gh1SLa_rateNote{color:var(--dsw-alias-label-secondary);margin:6px 0 0;font-size:12px}.gh1SLa_tableWrap{max-height:420px;overflow:auto}.gh1SLa_table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;min-width:420px;font-size:12px}.gh1SLa_table th,.gh1SLa_table td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:4px 6px}.gh1SLa_table th{color:var(--dsw-alias-label-secondary);z-index:1;background:var(--dsw-alias-bg-layer-2);font-weight:500;position:sticky;top:0}.gh1SLa_table td{color:var(--dsw-alias-label-primary)}th.gh1SLa_conditionHead,td.gh1SLa_conditionCell{text-align:left;white-space:normal;min-width:200px}td.gh1SLa_conditionCell{color:var(--dsw-alias-label-secondary);padding-left:20px}.gh1SLa_groupRow>td{text-align:left;white-space:normal;color:var(--dsw-alias-label-secondary);border-bottom:none;padding-top:8px;font-size:11px;font-weight:600}.gh1SLa_groupRow:not(:first-child)>td{border-top:1px solid var(--dsw-alias-border-l1)}";
2580
+ const tagId$6 = "@laoyuehanni/dsh-token-usage/PricingDialog.module.css";
2581
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
2579
2582
  const tag = document.createElement("style");
2580
2583
  tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
2581
- tag.dataset.pluginCss = tagId$3;
2582
- tag.textContent = css$3;
2584
+ tag.dataset.pluginCss = tagId$6;
2585
+ tag.textContent = css$6;
2583
2586
  document.head.appendChild(tag);
2584
2587
  }
2585
- var StatCard_module_css_default = {
2586
- "card": "F2LbNW_card",
2587
- "cardLabel": "F2LbNW_cardLabel",
2588
- "cardValue": "F2LbNW_cardValue",
2589
- "cardValueMain": "F2LbNW_cardValueMain",
2590
- "pill": "F2LbNW_pill",
2591
- "pillWrap": "F2LbNW_pillWrap",
2592
- "split": "F2LbNW_split",
2593
- "splitFail": "F2LbNW_splitFail",
2594
- "splitFailHead": "F2LbNW_splitFailHead",
2595
- "splitOk": "F2LbNW_splitOk",
2596
- "splitSep": "F2LbNW_splitSep"
2588
+ var PricingDialog_module_css_default = {
2589
+ "conditionCell": "gh1SLa_conditionCell",
2590
+ "conditionHead": "gh1SLa_conditionHead",
2591
+ "dialog": "gh1SLa_dialog",
2592
+ "dialogClose": "gh1SLa_dialogClose",
2593
+ "dialogHead": "gh1SLa_dialogHead",
2594
+ "dialogTitle": "gh1SLa_dialogTitle",
2595
+ "groupRow": "gh1SLa_groupRow",
2596
+ "rateNote": "gh1SLa_rateNote",
2597
+ "table": "gh1SLa_table",
2598
+ "tableWrap": "gh1SLa_tableWrap"
2597
2599
  };
2598
2600
  //#endregion
2599
- //#region src/client/StatCard.tsx
2601
+ //#region src/client/PricingDialog.tsx
2600
2602
  /**
2601
- * Render one stat card. The value uses the standard label-primary color.
2602
- * The label clamps to one line and ellipsizes if the column is squeezed.
2603
+ * The pricing dialog of one model: a native `<dialog>` (Esc closes, focus
2604
+ * is trapped, the backdrop dims, and the top layer renders it above the
2605
+ * table's scroll shell) holding that model's full price table — billing
2606
+ * conditions (default / context tiers / peak slots / time rules) × the four
2607
+ * per-million rates, converted for a USD view. Shared by the settings
2608
+ * page's per-model “定价” affordance and the pricing-overview dialog's
2609
+ * drill-in rows; a native showModal naturally stacks a second instance
2610
+ * above the overview.
2611
+ *
2612
+ * @module token-usage/client/PricingDialog
2603
2613
  */
2604
- function StatCard({ label, value }) {
2605
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2606
- className: StatCard_module_css_default["card"],
2607
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2608
- className: StatCard_module_css_default["cardLabel"],
2609
- children: label
2610
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2611
- className: StatCard_module_css_default["cardValue"],
2612
- children: value
2613
- })]
2614
+ /** The four base rates of one model as display text (symbol included,
2615
+ * converted for a USD view); a missing cache rate bills at the input rate. */
2616
+ function billedRates(rates, view) {
2617
+ return {
2618
+ input: formatRateWithSymbol(rates.inputPerMillion, view),
2619
+ output: formatRateWithSymbol(rates.outputPerMillion, view),
2620
+ cacheRead: formatRateWithSymbol(rates.cacheReadPerMillion ?? rates.inputPerMillion, view),
2621
+ cacheWrite: formatRateWithSymbol(rates.cacheWritePerMillion ?? rates.inputPerMillion, view)
2622
+ };
2623
+ }
2624
+ /** `HH:MM-HH:MM` of one peak window (half-open, local minutes). */
2625
+ function windowText(window) {
2626
+ const clock = (minute) => `${String(Math.floor(minute / 60)).padStart(2, "0")}:${String(minute % 60).padStart(2, "0")}`;
2627
+ return `${clock(window.startMinute)}-${clock(window.endMinute)}`;
2628
+ }
2629
+ /** The when-it-applies text of one peak slot: its label plus its windows. */
2630
+ function slotCondition(slot, t) {
2631
+ return `${slot.label ?? t("pricing.peak")} ${slot.windows.map(windowText).join(t("pricing.windowSep"))}`;
2632
+ }
2633
+ /**
2634
+ * The price rows of one rate node (a time rule's or the model root's): the
2635
+ * node's own base rates, then its peak slots, then its context tiers
2636
+ * (ascending), each tier followed by the peak slots hanging on that tier —
2637
+ * mirroring {@link resolveRate}'s node chain, where a matching tier's slots
2638
+ * replace the node's and peak rates replace the node's rates wholesale.
2639
+ */
2640
+ function nodePriceRows(node, t) {
2641
+ const rows = [{
2642
+ condition: t("pricing.default"),
2643
+ rates: node.rates
2644
+ }];
2645
+ const tiers = [...node.tiers ?? []].sort((a, b) => a.threshold - b.threshold);
2646
+ for (const tier of tiers) {
2647
+ const tierCondition = t("pricing.tier", { threshold: formatTokens(tier.threshold) });
2648
+ rows.push({
2649
+ condition: tierCondition,
2650
+ rates: tier.rates
2651
+ });
2652
+ for (const slot of tier.dailySlots ?? []) rows.push({
2653
+ condition: `${tierCondition} · ${slotCondition(slot, t)}`,
2654
+ rates: slot.rates
2655
+ });
2656
+ }
2657
+ for (const slot of node.slots ?? []) rows.push({
2658
+ condition: slotCondition(slot, t),
2659
+ rates: slot.rates
2614
2660
  });
2661
+ return rows;
2615
2662
  }
2616
2663
  /**
2617
- * Compact "失败 n" chip for the requests **card** only. Hovering or focusing
2618
- * it lists `限流 ×count` per class. Zero failures render nothing. Per-model
2619
- * tables do not use this — they print `A/B` via {@link RequestsCell}.
2664
+ * One model's price table: rows are billing conditions — grouped into the
2665
+ * model root (“常规”, omitted when it is the only group) and one group per
2666
+ * time rule with its date window — so tier, peak, and time-rule pricing
2667
+ * each show when they apply and what they bill. The structure mirrors
2668
+ * {@link resolveRate}'s node chain.
2620
2669
  */
2621
- function FailurePill({ failures, failuresByCode, t }) {
2622
- if (failures === 0) return null;
2623
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2624
- className: StatCard_module_css_default["pillWrap"],
2625
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
2626
- label: failuresTooltip(failuresByCode, t),
2627
- side: "bottom",
2628
- delayMs: 200,
2629
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2630
- className: StatCard_module_css_default["pill"],
2631
- tabIndex: 0,
2632
- children: t("stat.failuresPill", { count: failures.toLocaleString() })
2633
- })
2634
- })
2670
+ function ModelPriceTable({ rules, view, t }) {
2671
+ const groups = [{
2672
+ title: rules.timeRules.length > 0 ? t("pricing.regular") : null,
2673
+ rows: nodePriceRows({
2674
+ rates: rules.base,
2675
+ tiers: rules.contextTiers,
2676
+ slots: rules.dailySlots
2677
+ }, t)
2678
+ }, ...[...rules.timeRules].sort((a, b) => b.endTime - a.endTime).map((rule) => ({
2679
+ title: `${rule.label !== void 0 ? `${rule.label} ` : ""}${rule.startTime > 0 ? `${dayKeyOf(/* @__PURE__ */ new Date(rule.startTime * 1e3))} ~ ` : "~ "}${dayKeyOf(/* @__PURE__ */ new Date(rule.endTime * 1e3))}`,
2680
+ rows: nodePriceRows({
2681
+ rates: rule.rates,
2682
+ tiers: rule.contextTiers,
2683
+ slots: rule.dailySlots
2684
+ }, t)
2685
+ }))];
2686
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2687
+ className: PricingDialog_module_css_default["tableWrap"],
2688
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
2689
+ className: PricingDialog_module_css_default["table"],
2690
+ "aria-label": t("pricing.title"),
2691
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
2692
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
2693
+ className: PricingDialog_module_css_default["conditionHead"],
2694
+ children: t("pricing.condition")
2695
+ }),
2696
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.input"), t("pricing.perMillion")] }),
2697
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.output"), t("pricing.perMillion")] }),
2698
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.cacheRead"), t("pricing.perMillion")] }),
2699
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.cacheWrite"), t("pricing.perMillion")] })
2700
+ ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: groups.flatMap((group) => [...group.title !== null ? [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
2701
+ className: PricingDialog_module_css_default["groupRow"],
2702
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
2703
+ colSpan: 5,
2704
+ children: group.title
2705
+ })
2706
+ }, group.title)] : [], ...group.rows.map((row, index) => {
2707
+ const billed = billedRates(row.rates, view);
2708
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
2709
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
2710
+ className: PricingDialog_module_css_default["conditionCell"],
2711
+ children: row.condition
2712
+ }),
2713
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.input }),
2714
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.output }),
2715
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.cacheRead }),
2716
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.cacheWrite })
2717
+ ] }, `${group.title ?? ""}-${index}-${row.condition}`);
2718
+ })]) })]
2719
+ }), view.symbol === "$" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2720
+ className: PricingDialog_module_css_default["rateNote"],
2721
+ children: t("pricing.exchangeRateNote", { rate: formatRate(view.rate) })
2722
+ }) : null]
2635
2723
  });
2636
2724
  }
2637
2725
  /**
2638
- * The requests tile both dashboards share: hero figure is the successful
2639
- * count; a compact pill to its right carries the failure count.
2726
+ * The pricing dialog of one model. Mounts only while a model is selected;
2727
+ * every close path funnels through the dialog's `close` event, which clears
2728
+ * the selection and unmounts it.
2640
2729
  */
2641
- function RequestsStatCard({ requests, failures, failuresByCode, t }) {
2642
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatCard, {
2643
- label: t("stat.requests"),
2644
- value: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2645
- className: StatCard_module_css_default["cardValueMain"],
2646
- children: requests.toLocaleString()
2647
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailurePill, {
2648
- failures,
2649
- failuresByCode,
2730
+ function PricingDialog({ model, rules, view, onClose, t }) {
2731
+ const dialogRef = (0, react.useRef)(null);
2732
+ const backdropPress = (0, react.useRef)(false);
2733
+ (0, react.useEffect)(() => {
2734
+ const dialog = dialogRef.current;
2735
+ if (dialog !== null && !dialog.open) dialog.showModal();
2736
+ }, []);
2737
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dialog", {
2738
+ ref: dialogRef,
2739
+ className: PricingDialog_module_css_default["dialog"],
2740
+ "aria-label": t("pricing.title"),
2741
+ onClose,
2742
+ onMouseDown: (event) => {
2743
+ backdropPress.current = event.target === dialogRef.current;
2744
+ },
2745
+ onClick: (event) => {
2746
+ if (event.target === dialogRef.current && backdropPress.current) dialogRef.current?.close();
2747
+ },
2748
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2749
+ className: PricingDialog_module_css_default["dialogHead"],
2750
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2751
+ className: PricingDialog_module_css_default["dialogTitle"],
2752
+ children: model
2753
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2754
+ type: "button",
2755
+ className: PricingDialog_module_css_default["dialogClose"],
2756
+ "aria-label": t("pricing.close"),
2757
+ onClick: () => dialogRef.current?.close(),
2758
+ children: "✕"
2759
+ })]
2760
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelPriceTable, {
2761
+ rules,
2762
+ view,
2650
2763
  t
2651
- })] })
2764
+ })]
2652
2765
  });
2653
2766
  }
2654
- /** Column header for the per-model success/fail split: same 3-track
2655
- * grid as {@link RequestsCell} so the slash sits on the column midline. */
2656
- function RequestsSplitHead({ t }) {
2657
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2658
- className: StatCard_module_css_default["split"],
2659
- children: [
2660
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2661
- className: StatCard_module_css_default["splitOk"],
2662
- children: t("stat.ok")
2663
- }),
2664
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2665
- className: StatCard_module_css_default["splitSep"],
2666
- "aria-hidden": true,
2667
- children: "/"
2668
- }),
2669
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2670
- className: StatCard_module_css_default["splitFailHead"],
2671
- children: t("stat.fail")
2672
- })
2673
- ]
2767
+ //#endregion
2768
+ //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\PricingOverviewDialog.module.css.mjs
2769
+ const css$5 = ".bVRC-q_overview{width:min(720px,100vw - 48px)}.bVRC-q_note{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.bVRC-q_failRow{align-items:center;gap:8px;display:flex}.bVRC-q_retryButton{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;flex:none;padding:2px 12px;font-size:12px;line-height:18px}.bVRC-q_retryButton:hover{background:var(--dsw-interactive-bg-hover)}.bVRC-q_search{width:100%;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;margin-bottom:8px;padding:4px 8px;font-size:13px}.bVRC-q_buckets{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:6px;flex-wrap:nowrap;align-items:stretch;margin-bottom:8px;padding:4px;display:flex}.bVRC-q_bucket{flex:1 1 0;align-items:center;gap:4px;min-width:0;padding:0 10px;display:flex}.bVRC-q_bucket+.bVRC-q_bucket{border-left:1px solid var(--dsw-alias-border-l1)}.bVRC-q_bucketLabel{color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none;font-size:11px;line-height:14px}.bVRC-q_unitGroup{flex:none;display:flex}.bVRC-q_unit{color:var(--dsw-alias-label-secondary);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;background:0 0;padding:0 5px;font-size:10px;line-height:14px}.bVRC-q_unit:first-child{border-radius:3px 0 0 3px}.bVRC-q_unit:last-child{border-radius:0 3px 3px 0}.bVRC-q_unit+.bVRC-q_unit{border-left:none}.bVRC-q_unit:hover{background:var(--dsw-interactive-bg-hover)}.bVRC-q_unit[aria-pressed=true]{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);font-weight:600}.bVRC-q_bucketInput{width:100%;min-width:0;color:var(--dsw-alias-label-primary);box-shadow:inset 0 0 0 1px var(--dsw-alias-border-l2);font-variant-numeric:tabular-nums;background:0 0;border:none;border-radius:4px;flex:1 1 0;padding:2px 18px 2px 6px;font-size:12px}.bVRC-q_bucketInput::-webkit-outer-spin-button,.bVRC-q_bucketInput::-webkit-inner-spin-button{opacity:1;cursor:pointer;height:100%}.bVRC-q_bucketInput:focus{background:var(--dsw-alias-bg-layer-3);outline:none}.bVRC-q_scenarios{flex-wrap:wrap;gap:6px;margin-bottom:8px;display:flex}.bVRC-q_scenario{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;padding:4px 12px;font-size:12px;line-height:18px}.bVRC-q_scenario:hover{background:var(--dsw-interactive-bg-hover)}.bVRC-q_scenario[aria-pressed=true]{border-color:var(--dsw-alias-label-primary)}.bVRC-q_tableWrap{height:min(60vh,520px);overflow:auto}.bVRC-q_table{table-layout:fixed;border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;min-width:560px;font-size:12px}.bVRC-q_table th,.bVRC-q_table td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:4px 6px}.bVRC-q_table th{color:var(--dsw-alias-label-secondary);z-index:1;background:var(--dsw-alias-bg-layer-2);font-weight:500;position:sticky;top:0}.bVRC-q_table td{color:var(--dsw-alias-label-primary)}th.bVRC-q_modelHead,td.bVRC-q_modelCell{text-align:left}th.bVRC-q_modelHead{width:40%}.bVRC-q_sortHead{font:inherit;font-weight:inherit;color:inherit;cursor:pointer;white-space:nowrap;background:0 0;border:none;padding:0}.bVRC-q_sortHead:hover{text-decoration:underline}.bVRC-q_sortArrow{font-size:10px}.bVRC-q_sortArrowIdle{opacity:.5}.bVRC-q_modelRow{cursor:pointer}.bVRC-q_modelRow:hover>td{background:var(--dsw-interactive-bg-hover)}.bVRC-q_cellInner{align-items:center;gap:6px;max-width:100%;display:inline-flex}.bVRC-q_modelName{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;font-weight:500;overflow:hidden}.bVRC-q_usedTag{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-3);border-radius:8px;flex:none;padding:0 6px;font-size:10px;line-height:16px}.bVRC-q_expandArrow{width:16px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;flex:none;padding:0;font-size:10px;line-height:16px}.bVRC-q_expandArrow:hover{color:var(--dsw-alias-label-primary)}.bVRC-q_arrowGap{flex:none;width:16px}.bVRC-q_expansionRow>td{padding:0 6px 4px}.bVRC-q_specialRows{flex-direction:column;gap:2px;display:flex}.bVRC-q_specialRow{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;grid-template-columns:3.2fr 1fr 1fr 1fr 1fr 1fr;gap:4px;padding:1px 0 1px 28px;font-size:11px;display:grid}.bVRC-q_specialLabel{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;text-align:left;overflow:hidden}.bVRC-q_specialRate{text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}";
2770
+ const tagId$5 = "@laoyuehanni/dsh-token-usage/PricingOverviewDialog.module.css";
2771
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$5) + "]") === null) {
2772
+ const tag = document.createElement("style");
2773
+ tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
2774
+ tag.dataset.pluginCss = tagId$5;
2775
+ tag.textContent = css$5;
2776
+ document.head.appendChild(tag);
2777
+ }
2778
+ var PricingOverviewDialog_module_css_default = {
2779
+ "arrowGap": "bVRC-q_arrowGap",
2780
+ "bucket": "bVRC-q_bucket",
2781
+ "bucketInput": "bVRC-q_bucketInput",
2782
+ "bucketLabel": "bVRC-q_bucketLabel",
2783
+ "buckets": "bVRC-q_buckets",
2784
+ "cellInner": "bVRC-q_cellInner",
2785
+ "expandArrow": "bVRC-q_expandArrow",
2786
+ "expansionRow": "bVRC-q_expansionRow",
2787
+ "failRow": "bVRC-q_failRow",
2788
+ "modelCell": "bVRC-q_modelCell",
2789
+ "modelHead": "bVRC-q_modelHead",
2790
+ "modelName": "bVRC-q_modelName",
2791
+ "modelRow": "bVRC-q_modelRow",
2792
+ "note": "bVRC-q_note",
2793
+ "overview": "bVRC-q_overview",
2794
+ "retryButton": "bVRC-q_retryButton",
2795
+ "scenario": "bVRC-q_scenario",
2796
+ "scenarios": "bVRC-q_scenarios",
2797
+ "search": "bVRC-q_search",
2798
+ "sortArrow": "bVRC-q_sortArrow",
2799
+ "sortArrowIdle": "bVRC-q_sortArrowIdle",
2800
+ "sortHead": "bVRC-q_sortHead",
2801
+ "specialLabel": "bVRC-q_specialLabel",
2802
+ "specialRate": "bVRC-q_specialRate",
2803
+ "specialRow": "bVRC-q_specialRow",
2804
+ "specialRows": "bVRC-q_specialRows",
2805
+ "table": "bVRC-q_table",
2806
+ "tableWrap": "bVRC-q_tableWrap",
2807
+ "unit": "bVRC-q_unit",
2808
+ "unitGroup": "bVRC-q_unitGroup",
2809
+ "usedTag": "bVRC-q_usedTag"
2810
+ };
2811
+ //#endregion
2812
+ //#region src/client/PricingOverviewDialog.tsx
2813
+ /**
2814
+ * The pricing-overview dialog of the settings page: the full cloud-mirror
2815
+ * model list served by the filter-free `/token-usage/pricing` route — one
2816
+ * flat row per model, sorted by the feed's upstream `family` field (zero
2817
+ * client-side mapping) then by modelId, each row's four base rates in the
2818
+ * page's display currency. Families drive order and search only — there is
2819
+ * no grouping UI, every row is directly visible. Rows the page's filters
2820
+ * have used carry a “已用” tag; clicking a row opens that model's full
2821
+ * price table as a second native dialog stacked above.
2822
+ *
2823
+ * Above the table, four token-bucket inputs drive a simulated-cost column:
2824
+ * what the buckets would bill at each model's base rates. Each bucket is
2825
+ * an amount under a picked K/M/B unit — switching converts the amount, the
2826
+ * token count stands still. Preset case buttons (「案例1」, hover-titled
2827
+ * with the workload picture) refill the buckets compact in one click; the
2828
+ * first case is prefilled on open, and the pressed highlight tracks exact
2829
+ * token matches, so a manual edit un-presses. The column sorts by a
2830
+ * three-state header cycle (family order → cost desc → cost asc → family);
2831
+ * the header's glyph never disappears: a dim ⇅ in the default family
2832
+ * order, then ▾ desc and ▴ asc.
2833
+ *
2834
+ * Aliases never render — they stay a search dimension only (a hit on an
2835
+ * alias surfaces the model, whose id then reads as the result).
2836
+ *
2837
+ * @module token-usage/client/PricingOverviewDialog
2838
+ */
2839
+ /** The family a model row without a feed `family` lands in; the feed
2840
+ * itself already uses this value for uncategorized rows. */
2841
+ const OTHER_FAMILY = "other";
2842
+ /** The family of one row (absent → `other`): the sort key's first half
2843
+ * and one of the search dimensions. */
2844
+ function familyOf(model) {
2845
+ return model.family ?? OTHER_FAMILY;
2846
+ }
2847
+ /**
2848
+ * Sort models by family (alphabetical, absent → `other`), then by modelId —
2849
+ * the feed's own classification drives the browsing order so same-family
2850
+ * models stay adjacent, with zero client-side mapping.
2851
+ */
2852
+ function sortPricingModels(models) {
2853
+ return [...models].sort((a, b) => {
2854
+ const familyA = familyOf(a);
2855
+ const familyB = familyOf(b);
2856
+ if (familyA !== familyB) return familyA < familyB ? -1 : 1;
2857
+ return a.modelId < b.modelId ? -1 : a.modelId > b.modelId ? 1 : 0;
2674
2858
  });
2675
2859
  }
2676
- /** One table cell: successful count, and when failures > 0 a slash on
2677
- * the column midline plus the failure count in the error color.
2678
- * Zero failures print only A (same left track, so the figure still
2679
- * lines up with rows that have a B). Hovering B lists the per-code
2860
+ /**
2861
+ * Whether one model row matches the search: a case-insensitive substring
2862
+ * hit on the modelId, any alias, or the family. An empty query
2863
+ * matches everything.
2864
+ */
2865
+ function matchesPricingSearch(model, query) {
2866
+ if (query === "") return true;
2867
+ const needle = query.toLowerCase();
2868
+ if (model.modelId.toLowerCase().includes(needle)) return true;
2869
+ if (familyOf(model).toLowerCase().includes(needle)) return true;
2870
+ return model.aliases.some((alias) => alias.toLowerCase().includes(needle));
2871
+ }
2872
+ /** The preset cases the buttons fill the inputs with (maintainer-curated
2873
+ * classic workloads). The first prefills the inputs on open. */
2874
+ const SIM_SCENARIOS = [
2875
+ {
2876
+ inputTokens: 2e6,
2877
+ cacheReadTokens: 98e6,
2878
+ outputTokens: 457e3,
2879
+ cacheWriteTokens: 0
2880
+ },
2881
+ {
2882
+ inputTokens: 5e6,
2883
+ cacheReadTokens: 95e6,
2884
+ outputTokens: 6e5,
2885
+ cacheWriteTokens: 0
2886
+ },
2887
+ {
2888
+ inputTokens: 1e8,
2889
+ cacheReadTokens: 0,
2890
+ outputTokens: 1e8,
2891
+ cacheWriteTokens: 0
2892
+ }
2893
+ ];
2894
+ /** The units a bucket's amount can carry. */
2895
+ const BUCKET_UNITS = [
2896
+ "K",
2897
+ "M",
2898
+ "B"
2899
+ ];
2900
+ const UNIT_MULT = {
2901
+ K: 1e3,
2902
+ M: 1e6,
2903
+ B: 1e9
2904
+ };
2905
+ /** The whole-token count a bucket stands for: amount × unit, float fuzz
2906
+ * rounded off; empty, negative, or non-numeric amounts read as zero. */
2907
+ function tokensOf(bucket) {
2908
+ const parsed = Number(bucket.amount);
2909
+ if (!Number.isFinite(parsed) || parsed <= 0) return 0;
2910
+ return Math.round(parsed * UNIT_MULT[bucket.unit]);
2911
+ }
2912
+ /** The amount string for the same tokens under a new unit — converting so
2913
+ * the token count stands still (98M reads 98000K). Trims float fuzz to
2914
+ * six decimals so 0.457M ↔ 457K round-trips cleanly. */
2915
+ function convertBucketAmount(bucket, unit) {
2916
+ const parsed = Number(bucket.amount);
2917
+ if (!Number.isFinite(parsed)) return "";
2918
+ const converted = parsed * UNIT_MULT[bucket.unit] / UNIT_MULT[unit];
2919
+ return String(Math.round(converted * 1e6) / 1e6);
2920
+ }
2921
+ /** The compact refill shape of one token count: a short amount under the
2922
+ * fitting unit (98M, 457K), K as the floor for the sub-1K tail. */
2923
+ function compactBucket(tokens) {
2924
+ if (tokens >= UNIT_MULT.B) return {
2925
+ amount: String(tokens / UNIT_MULT.B),
2926
+ unit: "B"
2927
+ };
2928
+ if (tokens >= UNIT_MULT.M) return {
2929
+ amount: String(tokens / UNIT_MULT.M),
2930
+ unit: "M"
2931
+ };
2932
+ return {
2933
+ amount: String(tokens / UNIT_MULT.K),
2934
+ unit: "K"
2935
+ };
2936
+ }
2937
+ /** The refill shape of a whole case: every bucket compact. */
2938
+ function bucketsOfCase(scenario) {
2939
+ return {
2940
+ inputTokens: compactBucket(scenario.inputTokens),
2941
+ cacheReadTokens: compactBucket(scenario.cacheReadTokens),
2942
+ outputTokens: compactBucket(scenario.outputTokens),
2943
+ cacheWriteTokens: compactBucket(scenario.cacheWriteTokens)
2944
+ };
2945
+ }
2946
+ /**
2947
+ * The simulated cost (¥) of one scenario under a model's base rates —
2948
+ * the same arithmetic as the host half's `costOf` (a missing cache rate
2949
+ * bills at the input rate), re-implemented here because pricing.ts lives
2950
+ * on the node side of the bundle boundary.
2951
+ */
2952
+ function simCostOf(scenario, rates) {
2953
+ const M = 1e6;
2954
+ const cacheRead = rates.cacheReadPerMillion ?? rates.inputPerMillion;
2955
+ const cacheWrite = rates.cacheWritePerMillion ?? rates.inputPerMillion;
2956
+ return (scenario.inputTokens * rates.inputPerMillion + scenario.outputTokens * rates.outputPerMillion + scenario.cacheReadTokens * cacheRead + scenario.cacheWriteTokens * cacheWrite) / M;
2957
+ }
2958
+ /** The largest tier whose threshold the context clears. */
2959
+ function hitTier(tiers, ctxTokens) {
2960
+ let hit;
2961
+ for (const tier of tiers) if (ctxTokens >= tier.threshold && (hit === void 0 || tier.threshold > hit.threshold)) hit = tier;
2962
+ return hit;
2963
+ }
2964
+ function hitNodeOf(rules, ctxTokens, nowMs) {
2965
+ const nowSec = Math.floor(nowMs / 1e3);
2966
+ const rule = rules.timeRules.find((candidate) => candidate.startTime <= nowSec && nowSec <= candidate.endTime);
2967
+ if (rule !== void 0) return {
2968
+ baseRates: rule.rates,
2969
+ slots: rule.dailySlots ?? [],
2970
+ tier: hitTier(rule.contextTiers ?? [], ctxTokens)
2971
+ };
2972
+ return {
2973
+ baseRates: rules.base,
2974
+ slots: rules.dailySlots,
2975
+ tier: hitTier(rules.contextTiers, ctxTokens)
2976
+ };
2977
+ }
2978
+ /** The workload picture of one case — the input line (input-side total
2979
+ * with its cache-hit share) and the output line — joined into the case
2980
+ * button's hover title. */
2981
+ function scenarioLabel(scenario, t) {
2982
+ const total = scenario.inputTokens + scenario.cacheReadTokens;
2983
+ const pct = Math.round(scenario.cacheReadTokens / total * 100);
2984
+ return {
2985
+ inputLine: `${t("pricing.simInput", { tokens: formatTokens(total) })}${t("pricing.simCache", { pct: String(pct) })}`,
2986
+ outputLine: t("pricing.simOutput", { tokens: formatTokens(scenario.outputTokens) })
2987
+ };
2988
+ }
2989
+ /** One bucket's K/M/B unit segment. Switching converts the amount so the
2990
+ * token count stands still. */
2991
+ function UnitPicker({ t, bucket, unit, onPick }) {
2992
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2993
+ className: PricingOverviewDialog_module_css_default["unitGroup"],
2994
+ children: BUCKET_UNITS.map((candidate) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2995
+ type: "button",
2996
+ className: PricingOverviewDialog_module_css_default["unit"],
2997
+ "aria-pressed": candidate === unit,
2998
+ "aria-label": t("pricing.simUnitOf", {
2999
+ bucket,
3000
+ unit: candidate
3001
+ }),
3002
+ onClick: () => {
3003
+ if (candidate !== unit) onPick(candidate);
3004
+ },
3005
+ children: candidate
3006
+ }, candidate))
3007
+ });
3008
+ }
3009
+ /**
3010
+ * Fetch the pricing overview from the local route — deliberately without
3011
+ * any query parameters: the overview is not a filtered view, so changing
3012
+ * the page's filters never changes what this dialog shows. An empty model
3013
+ * list (a first startup whose sync has not landed a mirror yet) reads as
3014
+ * the same failure the fetch error does: nothing to show, retry offered.
3015
+ */
3016
+ function fetchPricingOverview(signal) {
3017
+ return fetch(PRICING_PATH, { signal }).then((response) => {
3018
+ if (!response.ok) throw new Error(`HTTP ${String(response.status)}`);
3019
+ return response.json();
3020
+ }).then((value) => {
3021
+ if (typeof value !== "object" || value === null || !Array.isArray(value.models)) throw new Error("unexpected pricing response");
3022
+ if (value.models.length === 0) throw new Error("pricing mirror is empty");
3023
+ return value;
3024
+ });
3025
+ }
3026
+ /**
3027
+ * The pricing-overview dialog. `usedModels` is the open-time snapshot of
3028
+ * the page's filtered model selection (the modal's backdrop covers the
3029
+ * filter row, so it cannot change while the dialog is open); `view` is the
3030
+ * page's display currency. Mounts only while open; every close path
3031
+ * funnels through the dialog's `close` event, which unmounts it.
3032
+ */
3033
+ function PricingOverviewDialog({ usedModels, view, onClose, t }) {
3034
+ const dialogRef = (0, react.useRef)(null);
3035
+ const backdropPress = (0, react.useRef)(false);
3036
+ (0, react.useEffect)(() => {
3037
+ const dialog = dialogRef.current;
3038
+ if (dialog !== null && !dialog.open) dialog.showModal();
3039
+ }, []);
3040
+ const [state, retry] = useAsyncResource(fetchPricingOverview, [], { retryToken: 0 });
3041
+ const [search, setSearch] = (0, react.useState)("");
3042
+ const [buckets, setBuckets] = (0, react.useState)(() => bucketsOfCase(SIM_SCENARIOS[0]));
3043
+ const [sortMode, setSortMode] = (0, react.useState)("family");
3044
+ const [detail, setDetail] = (0, react.useState)(null);
3045
+ const [nowMs] = (0, react.useState)(() => Date.now());
3046
+ const [expandedId, setExpandedId] = (0, react.useState)(null);
3047
+ const sorted = (0, react.useMemo)(() => sortPricingModels(state.status === "ready" ? state.value.models : []), [state]);
3048
+ const scenario = (0, react.useMemo)(() => ({
3049
+ inputTokens: tokensOf(buckets.inputTokens),
3050
+ cacheReadTokens: tokensOf(buckets.cacheReadTokens),
3051
+ outputTokens: tokensOf(buckets.outputTokens),
3052
+ cacheWriteTokens: tokensOf(buckets.cacheWriteTokens)
3053
+ }), [buckets]);
3054
+ const ctxTokens = scenario.inputTokens + scenario.cacheReadTokens;
3055
+ const pressedCase = SIM_SCENARIOS.find((candidate) => candidate.inputTokens === scenario.inputTokens && candidate.cacheReadTokens === scenario.cacheReadTokens && candidate.outputTokens === scenario.outputTokens && candidate.cacheWriteTokens === scenario.cacheWriteTokens);
3056
+ const query = search.trim();
3057
+ const rows = (0, react.useMemo)(() => {
3058
+ const withCost = sorted.map((model) => {
3059
+ const node = hitNodeOf(model.rules, ctxTokens, nowMs);
3060
+ return {
3061
+ model,
3062
+ node,
3063
+ cost: simCostOf(scenario, node.baseRates),
3064
+ specials: [...node.tier !== void 0 ? [{
3065
+ kind: "tier",
3066
+ tier: node.tier,
3067
+ slot: void 0,
3068
+ cost: simCostOf(scenario, node.tier.rates)
3069
+ }] : [], ...node.slots.map((slot) => ({
3070
+ kind: "slot",
3071
+ tier: void 0,
3072
+ slot,
3073
+ cost: simCostOf(scenario, slot.rates)
3074
+ }))]
3075
+ };
3076
+ }).filter(({ model }) => query === "" || matchesPricingSearch(model, query));
3077
+ if (sortMode === "family") return withCost;
3078
+ return [...withCost].sort((a, b) => sortMode === "cost-desc" ? b.cost - a.cost : a.cost - b.cost);
3079
+ }, [
3080
+ sorted,
3081
+ scenario,
3082
+ query,
3083
+ sortMode,
3084
+ ctxTokens,
3085
+ nowMs
3086
+ ]);
3087
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dialog", {
3088
+ ref: dialogRef,
3089
+ className: `${PricingDialog_module_css_default["dialog"]} ${PricingOverviewDialog_module_css_default["overview"]}`,
3090
+ "aria-label": t("pricing.table"),
3091
+ onClose: (event) => {
3092
+ if (event.target === dialogRef.current) onClose();
3093
+ },
3094
+ onMouseDown: (event) => {
3095
+ backdropPress.current = event.target === dialogRef.current;
3096
+ },
3097
+ onClick: (event) => {
3098
+ if (event.target === dialogRef.current && backdropPress.current) dialogRef.current?.close();
3099
+ },
3100
+ children: [
3101
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3102
+ className: PricingDialog_module_css_default["dialogHead"],
3103
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3104
+ className: PricingDialog_module_css_default["dialogTitle"],
3105
+ children: t("pricing.table")
3106
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3107
+ type: "button",
3108
+ className: PricingDialog_module_css_default["dialogClose"],
3109
+ "aria-label": t("pricing.close"),
3110
+ onClick: () => dialogRef.current?.close(),
3111
+ children: "✕"
3112
+ })]
3113
+ }),
3114
+ state.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3115
+ className: PricingOverviewDialog_module_css_default["note"],
3116
+ children: t("loading")
3117
+ }) : null,
3118
+ state.status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3119
+ className: PricingOverviewDialog_module_css_default["failRow"],
3120
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3121
+ className: PricingOverviewDialog_module_css_default["note"],
3122
+ children: t("pricing.overviewFailed")
3123
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3124
+ type: "button",
3125
+ className: PricingOverviewDialog_module_css_default["retryButton"],
3126
+ onClick: retry,
3127
+ children: t("retry")
3128
+ })]
3129
+ }) : null,
3130
+ state.status === "ready" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3131
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3132
+ type: "search",
3133
+ className: PricingOverviewDialog_module_css_default["search"],
3134
+ placeholder: t("pricing.search"),
3135
+ "aria-label": t("pricing.search"),
3136
+ value: search,
3137
+ onChange: (event) => setSearch(event.target.value)
3138
+ }),
3139
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3140
+ className: PricingOverviewDialog_module_css_default["buckets"],
3141
+ children: [
3142
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3143
+ className: PricingOverviewDialog_module_css_default["bucket"],
3144
+ children: [
3145
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3146
+ className: PricingOverviewDialog_module_css_default["bucketLabel"],
3147
+ children: t("pricing.simBucketInput")
3148
+ }),
3149
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3150
+ type: "number",
3151
+ min: 0,
3152
+ step: "any",
3153
+ className: PricingOverviewDialog_module_css_default["bucketInput"],
3154
+ "aria-label": t("pricing.simBucketInput"),
3155
+ value: buckets.inputTokens.amount,
3156
+ onChange: (event) => setBuckets((previous) => ({
3157
+ ...previous,
3158
+ inputTokens: {
3159
+ ...previous.inputTokens,
3160
+ amount: event.target.value
3161
+ }
3162
+ }))
3163
+ }),
3164
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnitPicker, {
3165
+ t,
3166
+ bucket: t("pricing.simBucketInput"),
3167
+ unit: buckets.inputTokens.unit,
3168
+ onPick: (unit) => setBuckets((previous) => ({
3169
+ ...previous,
3170
+ inputTokens: {
3171
+ amount: convertBucketAmount(previous.inputTokens, unit),
3172
+ unit
3173
+ }
3174
+ }))
3175
+ })
3176
+ ]
3177
+ }),
3178
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3179
+ className: PricingOverviewDialog_module_css_default["bucket"],
3180
+ children: [
3181
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3182
+ className: PricingOverviewDialog_module_css_default["bucketLabel"],
3183
+ children: t("pricing.simBucketCacheRead")
3184
+ }),
3185
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3186
+ type: "number",
3187
+ min: 0,
3188
+ step: "any",
3189
+ className: PricingOverviewDialog_module_css_default["bucketInput"],
3190
+ "aria-label": t("pricing.simBucketCacheRead"),
3191
+ value: buckets.cacheReadTokens.amount,
3192
+ onChange: (event) => setBuckets((previous) => ({
3193
+ ...previous,
3194
+ cacheReadTokens: {
3195
+ ...previous.cacheReadTokens,
3196
+ amount: event.target.value
3197
+ }
3198
+ }))
3199
+ }),
3200
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnitPicker, {
3201
+ t,
3202
+ bucket: t("pricing.simBucketCacheRead"),
3203
+ unit: buckets.cacheReadTokens.unit,
3204
+ onPick: (unit) => setBuckets((previous) => ({
3205
+ ...previous,
3206
+ cacheReadTokens: {
3207
+ amount: convertBucketAmount(previous.cacheReadTokens, unit),
3208
+ unit
3209
+ }
3210
+ }))
3211
+ })
3212
+ ]
3213
+ }),
3214
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3215
+ className: PricingOverviewDialog_module_css_default["bucket"],
3216
+ children: [
3217
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3218
+ className: PricingOverviewDialog_module_css_default["bucketLabel"],
3219
+ children: t("pricing.simBucketOutput")
3220
+ }),
3221
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3222
+ type: "number",
3223
+ min: 0,
3224
+ step: "any",
3225
+ className: PricingOverviewDialog_module_css_default["bucketInput"],
3226
+ "aria-label": t("pricing.simBucketOutput"),
3227
+ value: buckets.outputTokens.amount,
3228
+ onChange: (event) => setBuckets((previous) => ({
3229
+ ...previous,
3230
+ outputTokens: {
3231
+ ...previous.outputTokens,
3232
+ amount: event.target.value
3233
+ }
3234
+ }))
3235
+ }),
3236
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnitPicker, {
3237
+ t,
3238
+ bucket: t("pricing.simBucketOutput"),
3239
+ unit: buckets.outputTokens.unit,
3240
+ onPick: (unit) => setBuckets((previous) => ({
3241
+ ...previous,
3242
+ outputTokens: {
3243
+ amount: convertBucketAmount(previous.outputTokens, unit),
3244
+ unit
3245
+ }
3246
+ }))
3247
+ })
3248
+ ]
3249
+ }),
3250
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3251
+ className: PricingOverviewDialog_module_css_default["bucket"],
3252
+ children: [
3253
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3254
+ className: PricingOverviewDialog_module_css_default["bucketLabel"],
3255
+ children: t("pricing.simBucketCacheWrite")
3256
+ }),
3257
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3258
+ type: "number",
3259
+ min: 0,
3260
+ step: "any",
3261
+ className: PricingOverviewDialog_module_css_default["bucketInput"],
3262
+ "aria-label": t("pricing.simBucketCacheWrite"),
3263
+ value: buckets.cacheWriteTokens.amount,
3264
+ onChange: (event) => setBuckets((previous) => ({
3265
+ ...previous,
3266
+ cacheWriteTokens: {
3267
+ ...previous.cacheWriteTokens,
3268
+ amount: event.target.value
3269
+ }
3270
+ }))
3271
+ }),
3272
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnitPicker, {
3273
+ t,
3274
+ bucket: t("pricing.simBucketCacheWrite"),
3275
+ unit: buckets.cacheWriteTokens.unit,
3276
+ onPick: (unit) => setBuckets((previous) => ({
3277
+ ...previous,
3278
+ cacheWriteTokens: {
3279
+ amount: convertBucketAmount(previous.cacheWriteTokens, unit),
3280
+ unit
3281
+ }
3282
+ }))
3283
+ })
3284
+ ]
3285
+ })
3286
+ ]
3287
+ }),
3288
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3289
+ className: PricingOverviewDialog_module_css_default["scenarios"],
3290
+ children: SIM_SCENARIOS.map((candidate, index) => {
3291
+ const label = scenarioLabel(candidate, t);
3292
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3293
+ type: "button",
3294
+ className: PricingOverviewDialog_module_css_default["scenario"],
3295
+ "aria-pressed": pressedCase === candidate,
3296
+ title: `${label.inputLine} ${label.outputLine}`,
3297
+ onClick: () => {
3298
+ setBuckets(bucketsOfCase(candidate));
3299
+ },
3300
+ children: t("pricing.simCase", { index: String(index + 1) })
3301
+ }, index);
3302
+ })
3303
+ }),
3304
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3305
+ className: PricingOverviewDialog_module_css_default["tableWrap"],
3306
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
3307
+ className: PricingOverviewDialog_module_css_default["table"],
3308
+ "aria-label": t("pricing.table"),
3309
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
3310
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
3311
+ className: PricingOverviewDialog_module_css_default["modelHead"],
3312
+ children: t("filter.model")
3313
+ }),
3314
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.input"), t("pricing.perMillion")] }),
3315
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.output"), t("pricing.perMillion")] }),
3316
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.cacheRead"), t("pricing.perMillion")] }),
3317
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.cacheWrite"), t("pricing.perMillion")] }),
3318
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3319
+ type: "button",
3320
+ className: PricingOverviewDialog_module_css_default["sortHead"],
3321
+ onClick: () => {
3322
+ setSortMode((previous) => previous === "family" ? "cost-desc" : previous === "cost-desc" ? "cost-asc" : "family");
3323
+ },
3324
+ children: [t("pricing.simCost"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3325
+ className: sortMode === "family" ? `${PricingOverviewDialog_module_css_default["sortArrow"]} ${PricingOverviewDialog_module_css_default["sortArrowIdle"]}` : PricingOverviewDialog_module_css_default["sortArrow"],
3326
+ "aria-hidden": true,
3327
+ children: sortMode === "family" ? " ⇅" : sortMode === "cost-desc" ? " ▾" : " ▴"
3328
+ })]
3329
+ }) })
3330
+ ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: rows.map(({ model, node, cost, specials }) => {
3331
+ const billed = billedRates(node.baseRates, view);
3332
+ const expanded = expandedId === model.modelId;
3333
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", {
3334
+ className: PricingOverviewDialog_module_css_default["modelRow"],
3335
+ role: "button",
3336
+ tabIndex: 0,
3337
+ "aria-label": t("pricing.view", { model: model.modelId }),
3338
+ onClick: () => setDetail(model),
3339
+ onKeyDown: (event) => {
3340
+ if (event.key === "Enter" || event.key === " ") {
3341
+ event.preventDefault();
3342
+ setDetail(model);
3343
+ }
3344
+ },
3345
+ children: [
3346
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
3347
+ className: PricingOverviewDialog_module_css_default["modelCell"],
3348
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3349
+ className: PricingOverviewDialog_module_css_default["cellInner"],
3350
+ children: [
3351
+ specials.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3352
+ type: "button",
3353
+ className: PricingOverviewDialog_module_css_default["expandArrow"],
3354
+ "aria-expanded": expanded,
3355
+ "aria-label": t("pricing.expand"),
3356
+ onClick: (event) => {
3357
+ event.stopPropagation();
3358
+ setExpandedId((previous) => previous === model.modelId ? null : model.modelId);
3359
+ },
3360
+ children: expanded ? "▾" : "▸"
3361
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3362
+ className: PricingOverviewDialog_module_css_default["arrowGap"],
3363
+ "aria-hidden": true
3364
+ }),
3365
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3366
+ className: PricingOverviewDialog_module_css_default["modelName"],
3367
+ children: model.modelId
3368
+ }),
3369
+ usedModels.has(model.modelId) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3370
+ className: PricingOverviewDialog_module_css_default["usedTag"],
3371
+ children: t("pricing.used")
3372
+ }) : null
3373
+ ]
3374
+ })
3375
+ }),
3376
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.input }),
3377
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.output }),
3378
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.cacheRead }),
3379
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.cacheWrite }),
3380
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: formatCost(cost, view) })
3381
+ ]
3382
+ }), expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
3383
+ className: PricingOverviewDialog_module_css_default["expansionRow"],
3384
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
3385
+ colSpan: 6,
3386
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3387
+ className: PricingOverviewDialog_module_css_default["specialRows"],
3388
+ children: specials.map((special, index) => {
3389
+ const specialBilled = billedRates(special.tier?.rates ?? special.slot.rates, view);
3390
+ const label = special.kind === "tier" ? t("pricing.tier", { threshold: formatTokens(special.tier.threshold) }) : `${special.slot.label ?? t("pricing.peak")} ${special.slot.windows.map(windowText).join(t("pricing.windowSep"))}`;
3391
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3392
+ className: PricingOverviewDialog_module_css_default["specialRow"],
3393
+ children: [
3394
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3395
+ className: PricingOverviewDialog_module_css_default["specialLabel"],
3396
+ children: label
3397
+ }),
3398
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3399
+ className: PricingOverviewDialog_module_css_default["specialRate"],
3400
+ children: specialBilled.input
3401
+ }),
3402
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3403
+ className: PricingOverviewDialog_module_css_default["specialRate"],
3404
+ children: specialBilled.output
3405
+ }),
3406
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3407
+ className: PricingOverviewDialog_module_css_default["specialRate"],
3408
+ children: specialBilled.cacheRead
3409
+ }),
3410
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3411
+ className: PricingOverviewDialog_module_css_default["specialRate"],
3412
+ children: specialBilled.cacheWrite
3413
+ }),
3414
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3415
+ className: PricingOverviewDialog_module_css_default["specialRate"],
3416
+ children: formatCost(special.cost, view)
3417
+ })
3418
+ ]
3419
+ }, index);
3420
+ })
3421
+ })
3422
+ })
3423
+ }) : null] }, model.modelId);
3424
+ }) })]
3425
+ }), view.symbol === "$" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3426
+ className: PricingDialog_module_css_default["rateNote"],
3427
+ children: t("pricing.exchangeRateNote", { rate: formatRate(view.rate) })
3428
+ }) : null]
3429
+ })
3430
+ ] }) : null,
3431
+ detail !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PricingDialog, {
3432
+ model: detail.modelId,
3433
+ rules: detail.rules,
3434
+ view,
3435
+ onClose: () => setDetail(null),
3436
+ t
3437
+ }) : null
3438
+ ]
3439
+ });
3440
+ }
3441
+ //#endregion
3442
+ //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\StatCard.module.css.mjs
3443
+ const css$4 = ".F2LbNW_card{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;flex-direction:column;gap:2px;min-width:0;padding:10px 12px;display:flex}.F2LbNW_cardLabel{color:var(--dsw-alias-label-secondary);white-space:nowrap;text-overflow:ellipsis;font-size:11px;overflow:hidden}.F2LbNW_cardValue{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);flex-wrap:wrap;align-items:baseline;gap:4px 8px;min-width:0;font-size:18px;font-weight:600;display:flex}.F2LbNW_cardValueMain{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.F2LbNW_pillWrap{flex-shrink:0;display:inline-flex}.F2LbNW_pillWrap [role=tooltip]{white-space:pre;width:max-content;min-width:max-content;max-width:none;font-size:12px;font-weight:400;line-height:1.4}.F2LbNW_split{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:baseline;column-gap:4px;width:100%;display:grid}.F2LbNW_splitOk{text-align:right;min-width:0}.F2LbNW_splitSep{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary))}.F2LbNW_splitFailHead{text-align:left;min-width:0}.F2LbNW_splitFail{text-align:left;min-width:0;color:var(--dsw-alias-state-error-primary);display:block}.F2LbNW_split>.F2LbNW_pillWrap{justify-self:stretch;min-width:0;display:block}.F2LbNW_pill{font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 12%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 28%, transparent);border-radius:999px;flex-shrink:0;padding:1px 7px;font-size:12px;font-weight:400;line-height:1.4}";
3444
+ const tagId$4 = "@laoyuehanni/dsh-token-usage/StatCard.module.css";
3445
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
3446
+ const tag = document.createElement("style");
3447
+ tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
3448
+ tag.dataset.pluginCss = tagId$4;
3449
+ tag.textContent = css$4;
3450
+ document.head.appendChild(tag);
3451
+ }
3452
+ var StatCard_module_css_default = {
3453
+ "card": "F2LbNW_card",
3454
+ "cardLabel": "F2LbNW_cardLabel",
3455
+ "cardValue": "F2LbNW_cardValue",
3456
+ "cardValueMain": "F2LbNW_cardValueMain",
3457
+ "pill": "F2LbNW_pill",
3458
+ "pillWrap": "F2LbNW_pillWrap",
3459
+ "split": "F2LbNW_split",
3460
+ "splitFail": "F2LbNW_splitFail",
3461
+ "splitFailHead": "F2LbNW_splitFailHead",
3462
+ "splitOk": "F2LbNW_splitOk",
3463
+ "splitSep": "F2LbNW_splitSep"
3464
+ };
3465
+ //#endregion
3466
+ //#region src/client/StatCard.tsx
3467
+ /**
3468
+ * Render one stat card. The value uses the standard label-primary color.
3469
+ * The label clamps to one line and ellipsizes if the column is squeezed.
3470
+ */
3471
+ function StatCard({ label, value }) {
3472
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3473
+ className: StatCard_module_css_default["card"],
3474
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3475
+ className: StatCard_module_css_default["cardLabel"],
3476
+ children: label
3477
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3478
+ className: StatCard_module_css_default["cardValue"],
3479
+ children: value
3480
+ })]
3481
+ });
3482
+ }
3483
+ /**
3484
+ * Compact "失败 n" chip for the requests **card** only. Hovering or focusing
3485
+ * it lists `限流 ×count` per class. Zero failures render nothing. Per-model
3486
+ * tables do not use this — they print `A/B` via {@link RequestsCell}.
3487
+ */
3488
+ function FailurePill({ failures, failuresByCode, t }) {
3489
+ if (failures === 0) return null;
3490
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3491
+ className: StatCard_module_css_default["pillWrap"],
3492
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
3493
+ label: failuresTooltip(failuresByCode, t),
3494
+ side: "bottom",
3495
+ delayMs: 200,
3496
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3497
+ className: StatCard_module_css_default["pill"],
3498
+ tabIndex: 0,
3499
+ children: t("stat.failuresPill", { count: failures.toLocaleString() })
3500
+ })
3501
+ })
3502
+ });
3503
+ }
3504
+ /**
3505
+ * The requests tile both dashboards share: hero figure is the successful
3506
+ * count; a compact pill to its right carries the failure count.
3507
+ */
3508
+ function RequestsStatCard({ requests, failures, failuresByCode, t }) {
3509
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatCard, {
3510
+ label: t("stat.requests"),
3511
+ value: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3512
+ className: StatCard_module_css_default["cardValueMain"],
3513
+ children: requests.toLocaleString()
3514
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailurePill, {
3515
+ failures,
3516
+ failuresByCode,
3517
+ t
3518
+ })] })
3519
+ });
3520
+ }
3521
+ /** Column header for the per-model success/fail split: same 3-track
3522
+ * grid as {@link RequestsCell} so the slash sits on the column midline. */
3523
+ function RequestsSplitHead({ t }) {
3524
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3525
+ className: StatCard_module_css_default["split"],
3526
+ children: [
3527
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3528
+ className: StatCard_module_css_default["splitOk"],
3529
+ children: t("stat.ok")
3530
+ }),
3531
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3532
+ className: StatCard_module_css_default["splitSep"],
3533
+ "aria-hidden": true,
3534
+ children: "/"
3535
+ }),
3536
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3537
+ className: StatCard_module_css_default["splitFailHead"],
3538
+ children: t("stat.fail")
3539
+ })
3540
+ ]
3541
+ });
3542
+ }
3543
+ /** One table cell: successful count, and when failures > 0 a slash on
3544
+ * the column midline plus the failure count in the error color.
3545
+ * Zero failures print only A (same left track, so the figure still
3546
+ * lines up with rows that have a B). Hovering B lists the per-code
2680
3547
  * breakdown. */
2681
3548
  function RequestsCell({ requests, failures, failuresByCode, t }) {
2682
3549
  const ok = requests.toLocaleString();
@@ -2716,6 +3583,272 @@ window.__ModuleLoader__.load({
2716
3583
  });
2717
3584
  }
2718
3585
  //#endregion
3586
+ //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\SessionTable.module.css.mjs
3587
+ const css$3 = ".DW1kVq_head{justify-content:flex-start;align-items:center;gap:8px;display:flex}.DW1kVq_segmented{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;align-items:stretch;gap:2px;padding:2px;display:inline-flex}.DW1kVq_segBtn{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 12px;font-size:12px;font-weight:500}.DW1kVq_segBtn:hover:not(.DW1kVq_segActive){color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}.DW1kVq_segBtn:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:1px}.DW1kVq_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}.DW1kVq_tableWrap{max-height:420px;overflow:auto}.DW1kVq_table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;min-width:480px;font-size:12px}.DW1kVq_table th,.DW1kVq_table td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:4px 6px}.DW1kVq_table th.DW1kVq_sessionHead,.DW1kVq_table td.DW1kVq_sessionCol{text-align:left;width:220px;max-width:220px}.DW1kVq_table td.DW1kVq_sessionIndent{padding-left:18px}.DW1kVq_table th{color:var(--dsw-alias-label-secondary);z-index:1;background:var(--dsw-alias-bg-layer-2);font-weight:500;position:sticky;top:0}.DW1kVq_table td{color:var(--dsw-alias-label-primary)}.DW1kVq_sortBtn{font:inherit;color:inherit;cursor:pointer;white-space:nowrap;background:0 0;border:none;padding:0;font-weight:500}.DW1kVq_sortBtn:hover{color:var(--dsw-alias-label-primary)}.DW1kVq_sortMark{margin-left:3px;font-size:9px}.DW1kVq_sessionCell{align-items:baseline;gap:4px;max-width:208px;display:inline-flex}.DW1kVq_sessionName{text-overflow:ellipsis;white-space:nowrap;font:inherit;color:inherit;text-align:left;background:0 0;border:none;max-width:100%;padding:0;overflow:hidden}.DW1kVq_jumpable{cursor:pointer;text-decoration:underline dashed;text-decoration-color:var(--dsw-alias-label-tertiary);text-underline-offset:3px}.DW1kVq_badge{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:10px}.DW1kVq_dirTail{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;font-size:10px;display:block;overflow:hidden}.DW1kVq_table td.DW1kVq_groupRow{border-bottom:none;padding-top:8px}.DW1kVq_table td.DW1kVq_groupHead{color:var(--dsw-alias-label-secondary);text-align:left;white-space:nowrap;font-size:11px;font-weight:600}.DW1kVq_groupCount{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;margin-left:6px}";
3588
+ const tagId$3 = "@laoyuehanni/dsh-token-usage/SessionTable.module.css";
3589
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
3590
+ const tag = document.createElement("style");
3591
+ tag.dataset.plugin = "@laoyuehanni/dsh-token-usage";
3592
+ tag.dataset.pluginCss = tagId$3;
3593
+ tag.textContent = css$3;
3594
+ document.head.appendChild(tag);
3595
+ }
3596
+ var SessionTable_module_css_default = {
3597
+ "badge": "DW1kVq_badge",
3598
+ "dirTail": "DW1kVq_dirTail",
3599
+ "groupCount": "DW1kVq_groupCount",
3600
+ "groupHead": "DW1kVq_groupHead",
3601
+ "groupRow": "DW1kVq_groupRow",
3602
+ "head": "DW1kVq_head",
3603
+ "jumpable": "DW1kVq_jumpable",
3604
+ "segActive": "DW1kVq_segActive",
3605
+ "segBtn": "DW1kVq_segBtn",
3606
+ "segmented": "DW1kVq_segmented",
3607
+ "sessionCell": "DW1kVq_sessionCell",
3608
+ "sessionCol": "DW1kVq_sessionCol",
3609
+ "sessionHead": "DW1kVq_sessionHead",
3610
+ "sessionIndent": "DW1kVq_sessionIndent",
3611
+ "sessionName": "DW1kVq_sessionName",
3612
+ "sortBtn": "DW1kVq_sortBtn",
3613
+ "sortMark": "DW1kVq_sortMark",
3614
+ "table": "DW1kVq_table",
3615
+ "tableWrap": "DW1kVq_tableWrap"
3616
+ };
3617
+ //#endregion
3618
+ //#region src/client/SessionTable.tsx
3619
+ /**
3620
+ * The settings page's per-session detail table (browser half): the "by
3621
+ * session" mode of the detail-table block. Rows arrive FINAL from the host
3622
+ * route — folded over subagent subtrees (a subagent's only visibility here
3623
+ * is the row's child-count badge; the conversation view's subagent table
3624
+ * owns the per-child drill-down), cost-sorted, top-N truncated, with the
3625
+ * metadata index's titles and directories attached — so this component only
3626
+ * re-organizes presentation: the optional directory grouping (default on,
3627
+ * session-local, no request; grouped rows indent under their directory
3628
+ * head) and the identity fallback for titleless sessions (short id + time
3629
+ * span; the plugin never fabricates a title). Rows carry no click behavior,
3630
+ * matching the per-model table.
3631
+ *
3632
+ * @module token-usage/client/SessionTable
3633
+ */
3634
+ /** The last path segment of a directory, on either separator. */
3635
+ function dirTailOf(cwd) {
3636
+ const parts = cwd.split(/[\\/]/u).filter((part) => part !== "");
3637
+ return parts[parts.length - 1] ?? cwd;
3638
+ }
3639
+ /** A short session-id fallback: the leading chunk is usually enough to
3640
+ * tell sessions apart when no title ever landed. */
3641
+ function shortIdOf(sessionId) {
3642
+ return sessionId.length > 8 ? `${sessionId.slice(0, 8)}…` : sessionId;
3643
+ }
3644
+ /** Browser-level grouping preference: localStorage, not per-component state —
3645
+ * a filter change unmounts this table (the section flips to its loading
3646
+ * branch), and the choice must survive that remount as well as reloads. */
3647
+ const SESSION_GROUPED_KEY = "dsh.token-usage.sessionGrouped";
3648
+ function readGroupedPreference() {
3649
+ if (typeof localStorage === "undefined") return true;
3650
+ try {
3651
+ return localStorage.getItem(SESSION_GROUPED_KEY) !== "0";
3652
+ } catch {
3653
+ return true;
3654
+ }
3655
+ }
3656
+ function writeGroupedPreference(grouped) {
3657
+ try {
3658
+ if (grouped) localStorage.removeItem(SESSION_GROUPED_KEY);
3659
+ else localStorage.setItem(SESSION_GROUPED_KEY, "0");
3660
+ } catch {}
3661
+ }
3662
+ function sortValueOf(row, key) {
3663
+ if (key === "tokens") return totalTokens(row.totals);
3664
+ if (key === "cost") return row.cost;
3665
+ return row.lastTime;
3666
+ }
3667
+ function nextSort(current, key) {
3668
+ if (current?.key !== key) return {
3669
+ key,
3670
+ dir: "desc"
3671
+ };
3672
+ if (current.dir === "desc") return {
3673
+ key,
3674
+ dir: "asc"
3675
+ };
3676
+ return null;
3677
+ }
3678
+ /**
3679
+ * Render the session table: the grouping switch above the table, optional
3680
+ * directory groups (rows indent under their group head), one row per
3681
+ * served session. The token / cost / last-active headers sort the rows
3682
+ * client-side within the served set (groups keep their directory order;
3683
+ * rows reorder inside each group). Holding Ctrl over a session title draws
3684
+ * a dashed underline and a click jumps to that session (the parent closes
3685
+ * the settings panel; the conversation view lands on the session's last
3686
+ * used tab) — rows the session controller does not list never invite it.
3687
+ * @param props - the served rows, the currency view, the session jump
3688
+ * seats (absent on tests / hosts without the controller), locale.
3689
+ */
3690
+ function SessionTable({ rows, view, t, sessionListed, openSession }) {
3691
+ const [grouped, setGrouped] = (0, react.useState)(readGroupedPreference);
3692
+ const toggleGrouped = (next) => {
3693
+ setGrouped(next);
3694
+ writeGroupedPreference(next);
3695
+ };
3696
+ const [sort, setSort] = (0, react.useState)(null);
3697
+ const [ctrlHeld, setCtrlHeld] = (0, react.useState)(false);
3698
+ (0, react.useEffect)(() => {
3699
+ const down = (event) => {
3700
+ if (event.key === "Control") setCtrlHeld(true);
3701
+ };
3702
+ const up = (event) => {
3703
+ if (event.key === "Control") setCtrlHeld(false);
3704
+ };
3705
+ const blur = () => setCtrlHeld(false);
3706
+ window.addEventListener("keydown", down);
3707
+ window.addEventListener("keyup", up);
3708
+ window.addEventListener("blur", blur);
3709
+ return () => {
3710
+ window.removeEventListener("keydown", down);
3711
+ window.removeEventListener("keyup", up);
3712
+ window.removeEventListener("blur", blur);
3713
+ };
3714
+ }, []);
3715
+ const jumpable = (id) => ctrlHeld && sessionListed !== void 0 && openSession !== void 0 && sessionListed(id);
3716
+ const sorted = (0, react.useMemo)(() => {
3717
+ if (sort === null) return rows;
3718
+ const factor = sort.dir === "desc" ? -1 : 1;
3719
+ return [...rows].sort((left, right) => factor * (sortValueOf(left, sort.key) - sortValueOf(right, sort.key)) || (left.sessionId < right.sessionId ? -1 : 1));
3720
+ }, [rows, sort]);
3721
+ const groups = (0, react.useMemo)(() => {
3722
+ if (!grouped) return null;
3723
+ const map = /* @__PURE__ */ new Map();
3724
+ for (const row of sorted) {
3725
+ const key = row.cwd ?? "";
3726
+ const bucket = map.get(key) ?? [];
3727
+ bucket.push(row);
3728
+ map.set(key, bucket);
3729
+ }
3730
+ return [...map.entries()].sort((left, right) => {
3731
+ if (left[0] === "") return 1;
3732
+ if (right[0] === "") return -1;
3733
+ return left[0].localeCompare(right[0]);
3734
+ });
3735
+ }, [sorted, grouped]);
3736
+ /** One sortable header cell: the column name as the toggle, the current
3737
+ * direction marked and announced via aria-sort. */
3738
+ const sortHead = (key, label) => {
3739
+ const active = sort?.key === key;
3740
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
3741
+ ...active ? { "aria-sort": sort.dir === "desc" ? "descending" : "ascending" } : {},
3742
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3743
+ type: "button",
3744
+ className: SessionTable_module_css_default["sortBtn"],
3745
+ onClick: () => setSort((previous) => nextSort(previous, key)),
3746
+ children: [label, active ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3747
+ className: SessionTable_module_css_default["sortMark"],
3748
+ children: sort.dir === "desc" ? "▼" : "▲"
3749
+ }) : null]
3750
+ })
3751
+ });
3752
+ };
3753
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3754
+ className: SessionTable_module_css_default["head"],
3755
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3756
+ className: SessionTable_module_css_default["segmented"],
3757
+ role: "group",
3758
+ "aria-label": t("session.group.label"),
3759
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3760
+ type: "button",
3761
+ className: grouped ? `${SessionTable_module_css_default["segBtn"]} ${SessionTable_module_css_default["segActive"]}` : SessionTable_module_css_default["segBtn"],
3762
+ "aria-pressed": grouped,
3763
+ onClick: () => toggleGrouped(true),
3764
+ children: t("session.group.on")
3765
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3766
+ type: "button",
3767
+ className: !grouped ? `${SessionTable_module_css_default["segBtn"]} ${SessionTable_module_css_default["segActive"]}` : SessionTable_module_css_default["segBtn"],
3768
+ "aria-pressed": !grouped,
3769
+ onClick: () => toggleGrouped(false),
3770
+ children: t("session.group.off")
3771
+ })]
3772
+ })
3773
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3774
+ className: SessionTable_module_css_default["tableWrap"],
3775
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
3776
+ className: SessionTable_module_css_default["table"],
3777
+ "aria-label": t("bySession.title"),
3778
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
3779
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
3780
+ className: SessionTable_module_css_default["sessionHead"],
3781
+ children: t("session.titleCol")
3782
+ }),
3783
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
3784
+ "aria-label": t("stat.successFail"),
3785
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequestsSplitHead, { t })
3786
+ }),
3787
+ sortHead("tokens", t("stat.totalTokens")),
3788
+ sortHead("cost", t("stat.cost")),
3789
+ sortHead("lastTime", t("session.lastActive"))
3790
+ ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: groups === null ? sorted.map((row) => renderRow(row, false)) : groups.map(([cwd, groupRows]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FragmentGroup, {
3791
+ cwd,
3792
+ count: groupRows.length,
3793
+ t,
3794
+ children: groupRows.map((row) => renderRow(row, true))
3795
+ }, cwd === "" ? "\0" : cwd)) })]
3796
+ })
3797
+ })] });
3798
+ function renderRow(row, indented) {
3799
+ const jump = jumpable(row.sessionId);
3800
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
3801
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", {
3802
+ className: indented ? `${SessionTable_module_css_default["sessionCol"]} ${SessionTable_module_css_default["sessionIndent"]}` : SessionTable_module_css_default["sessionCol"],
3803
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3804
+ className: SessionTable_module_css_default["sessionCell"],
3805
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3806
+ type: "button",
3807
+ className: jump ? `${SessionTable_module_css_default["sessionName"]} ${SessionTable_module_css_default["jumpable"]}` : SessionTable_module_css_default["sessionName"],
3808
+ title: jump ? t("session.openHint") : void 0,
3809
+ onClick: jump ? (event) => {
3810
+ event.preventDefault();
3811
+ openSession?.(row.sessionId);
3812
+ } : void 0,
3813
+ children: row.title !== void 0 ? row.title : `${shortIdOf(row.sessionId)} · ${dayKeyOf(new Date(row.firstTime))} – ${dayKeyOf(new Date(row.lastTime))}`
3814
+ }), row.childCount !== void 0 && row.childCount > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3815
+ className: SessionTable_module_css_default["badge"],
3816
+ "aria-label": t("view.subagents.nested", { count: String(row.childCount) }),
3817
+ children: t("view.subagents.nested", { count: String(row.childCount) })
3818
+ }) : null]
3819
+ }), !indented && row.cwd !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3820
+ className: SessionTable_module_css_default["dirTail"],
3821
+ children: dirTailOf(row.cwd)
3822
+ }) : null]
3823
+ }),
3824
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequestsCell, {
3825
+ requests: row.totals.requests,
3826
+ failures: row.totals.failures ?? 0,
3827
+ failuresByCode: row.totals.failuresByCode,
3828
+ t
3829
+ }) }),
3830
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: formatTokens(totalTokens(row.totals)) }),
3831
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: formatCost(row.cost, view) }),
3832
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: dayKeyOf(new Date(row.lastTime)) })
3833
+ ] }, row.sessionId);
3834
+ }
3835
+ }
3836
+ /** One directory group: a full-width head row with the directory tail, then
3837
+ * the group's rows (a keyed fragment keeps `<tr>`s table-legal). */
3838
+ function FragmentGroup({ cwd, count, t, children }) {
3839
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
3840
+ className: SessionTable_module_css_default["groupRow"],
3841
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", {
3842
+ colSpan: 5,
3843
+ className: SessionTable_module_css_default["groupHead"],
3844
+ children: [cwd === "" ? t("session.untitledDir") : dirTailOf(cwd), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3845
+ className: SessionTable_module_css_default["groupCount"],
3846
+ children: String(count)
3847
+ })]
3848
+ })
3849
+ }), children] });
3850
+ }
3851
+ //#endregion
2719
3852
  //#region src/client/trend-chart/axis.ts
2720
3853
  /**
2721
3854
  * Trend-chart axis helpers: the roundest step from 1/2/2.5/5 × 10ⁿ not
@@ -3313,7 +4446,7 @@ window.__ModuleLoader__.load({
3313
4446
  }
3314
4447
  //#endregion
3315
4448
  //#region \0dsh-css:D:\Code\dsh-token-usage\src\client\TokenUsageSection.module.css.mjs
3316
- const css$1 = ".RbkiSa_section{flex-direction:column;gap:16px;width:100%;display:flex}.RbkiSa_head{justify-content:space-between;align-items:center;gap:12px;display:flex}.RbkiSa_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:600}.RbkiSa_muted{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.RbkiSa_rateNote{color:var(--dsw-alias-label-secondary);margin:6px 0 0;font-size:12px}.RbkiSa_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px}.RbkiSa_subtitle{color:var(--dsw-alias-label-secondary);margin:0;font-size:14px;font-weight:600}.RbkiSa_tableWrap{max-height:420px;overflow:auto}.RbkiSa_table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;min-width:500px;font-size:12px}.RbkiSa_table th,.RbkiSa_table td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:4px 6px}.RbkiSa_table th.RbkiSa_modelHead,.RbkiSa_table td.RbkiSa_modelCol{text-align:left;width:150px;max-width:150px}.RbkiSa_table th{color:var(--dsw-alias-label-secondary);z-index:1;background:var(--dsw-alias-bg-layer-2);font-weight:500;position:sticky;top:0}.RbkiSa_table td{color:var(--dsw-alias-label-primary)}.RbkiSa_empty{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.RbkiSa_button{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;padding:4px 12px;font-size:13px;line-height:20px}.RbkiSa_button:hover{background:var(--dsw-interactive-bg-hover)}.RbkiSa_filters{flex-wrap:nowrap;align-items:center;gap:8px;display:flex}.RbkiSa_cards{grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px;display:grid}.RbkiSa_warning{color:var(--dsw-alias-state-warn-label);background:var(--dsw-alias-state-warn-tertiary);border-radius:6px;margin:0;padding:6px 10px;font-size:12px}.RbkiSa_modelCell{align-items:center;gap:4px;max-width:138px;display:inline-flex;position:relative}.RbkiSa_modelName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.RbkiSa_unpricedTag{color:var(--dsw-alias-state-warn-label);background:var(--dsw-alias-state-warn-tertiary);border-radius:8px;flex:none;padding:0 6px;font-size:10px;line-height:16px}.RbkiSa_pricingButton{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:8px;flex:none;padding:0 6px;font-size:10px;line-height:16px}.RbkiSa_pricingButton:hover{color:var(--dsw-alias-state-warn-primary);background:var(--dsw-alias-state-warn-tertiary);border-color:var(--dsw-alias-state-warn-primary)}.RbkiSa_dialog{width:min(600px,100vw - 48px);max-height:calc(100vh - 48px);color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;padding:14px 16px;overflow-y:auto}.RbkiSa_dialog::backdrop{background:#0006}.RbkiSa_dialogHead{justify-content:space-between;align-items:center;gap:12px;margin-bottom:8px;display:flex}.RbkiSa_dialogTitle{text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums;font-size:14px;font-weight:600;overflow:hidden}.RbkiSa_dialogClose{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 8px;font-size:12px;line-height:18px}.RbkiSa_dialogClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-interactive-bg-hover)}th.RbkiSa_conditionHead,td.RbkiSa_conditionCell{text-align:left;white-space:normal;min-width:200px}td.RbkiSa_conditionCell{color:var(--dsw-alias-label-secondary);padding-left:20px}.RbkiSa_groupRow>td{text-align:left;white-space:normal;color:var(--dsw-alias-label-secondary);border-bottom:none;padding-top:8px;font-size:11px;font-weight:600}.RbkiSa_groupRow:not(:first-child)>td{border-top:1px solid var(--dsw-alias-border-l1)}";
4449
+ const css$1 = ".RbkiSa_section{flex-direction:column;gap:16px;width:100%;display:flex}.RbkiSa_head{justify-content:space-between;align-items:center;gap:12px;display:flex}.RbkiSa_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:600}.RbkiSa_muted{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.RbkiSa_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px}.RbkiSa_subtitle{color:var(--dsw-alias-label-secondary);margin:0;font-size:14px;font-weight:600}.RbkiSa_segmented{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;align-items:stretch;gap:2px;padding:2px;display:inline-flex}.RbkiSa_segBtn{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 12px;font-size:12px;font-weight:500}.RbkiSa_segBtn:hover:not(.RbkiSa_segActive){color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}.RbkiSa_segBtn:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:1px}.RbkiSa_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}.RbkiSa_tableWrap{max-height:420px;overflow:auto}.RbkiSa_table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;min-width:500px;font-size:12px}.RbkiSa_table th,.RbkiSa_table td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:4px 6px}.RbkiSa_table th.RbkiSa_modelHead,.RbkiSa_table td.RbkiSa_modelCol{text-align:left;width:150px;max-width:150px}.RbkiSa_table th{color:var(--dsw-alias-label-secondary);z-index:1;background:var(--dsw-alias-bg-layer-2);font-weight:500;position:sticky;top:0}.RbkiSa_table td{color:var(--dsw-alias-label-primary)}.RbkiSa_empty{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.RbkiSa_button{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;padding:4px 12px;font-size:13px;line-height:20px}.RbkiSa_button:hover{background:var(--dsw-interactive-bg-hover)}.RbkiSa_filters{flex-wrap:nowrap;align-items:center;gap:8px;display:flex}.RbkiSa_cards{grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px;display:grid}.RbkiSa_warning{color:var(--dsw-alias-state-warn-label);background:var(--dsw-alias-state-warn-tertiary);border-radius:6px;margin:0;padding:6px 10px;font-size:12px}.RbkiSa_modelCell{align-items:center;gap:4px;max-width:138px;display:inline-flex;position:relative}.RbkiSa_modelName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.RbkiSa_unpricedTag{color:var(--dsw-alias-state-warn-label);background:var(--dsw-alias-state-warn-tertiary);border-radius:8px;flex:none;padding:0 6px;font-size:10px;line-height:16px}.RbkiSa_pricingButton{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:8px;flex:none;padding:0 6px;font-size:10px;line-height:16px}.RbkiSa_pricingButton:hover{color:var(--dsw-alias-state-warn-primary);background:var(--dsw-alias-state-warn-tertiary);border-color:var(--dsw-alias-state-warn-primary)}.RbkiSa_pricingLink{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary));cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;flex:none;margin-left:auto;padding:4px 8px;font-size:13px;line-height:20px}.RbkiSa_pricingLink:hover{background:var(--dsw-interactive-bg-hover)}";
3317
4450
  const tagId$1 = "@laoyuehanni/dsh-token-usage/TokenUsageSection.module.css";
3318
4451
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
3319
4452
  const tag = document.createElement("style");
@@ -3325,16 +4458,9 @@ window.__ModuleLoader__.load({
3325
4458
  var TokenUsageSection_module_css_default = {
3326
4459
  "button": "RbkiSa_button",
3327
4460
  "cards": "RbkiSa_cards",
3328
- "conditionCell": "RbkiSa_conditionCell",
3329
- "conditionHead": "RbkiSa_conditionHead",
3330
- "dialog": "RbkiSa_dialog",
3331
- "dialogClose": "RbkiSa_dialogClose",
3332
- "dialogHead": "RbkiSa_dialogHead",
3333
- "dialogTitle": "RbkiSa_dialogTitle",
3334
4461
  "empty": "RbkiSa_empty",
3335
4462
  "error": "RbkiSa_error",
3336
4463
  "filters": "RbkiSa_filters",
3337
- "groupRow": "RbkiSa_groupRow",
3338
4464
  "head": "RbkiSa_head",
3339
4465
  "modelCell": "RbkiSa_modelCell",
3340
4466
  "modelCol": "RbkiSa_modelCol",
@@ -3342,8 +4468,11 @@ window.__ModuleLoader__.load({
3342
4468
  "modelName": "RbkiSa_modelName",
3343
4469
  "muted": "RbkiSa_muted",
3344
4470
  "pricingButton": "RbkiSa_pricingButton",
3345
- "rateNote": "RbkiSa_rateNote",
4471
+ "pricingLink": "RbkiSa_pricingLink",
3346
4472
  "section": "RbkiSa_section",
4473
+ "segActive": "RbkiSa_segActive",
4474
+ "segBtn": "RbkiSa_segBtn",
4475
+ "segmented": "RbkiSa_segmented",
3347
4476
  "subtitle": "RbkiSa_subtitle",
3348
4477
  "table": "RbkiSa_table",
3349
4478
  "tableWrap": "RbkiSa_tableWrap",
@@ -3357,12 +4486,13 @@ window.__ModuleLoader__.load({
3357
4486
  * Token-usage settings page (browser half): fetches the stats summary from
3358
4487
  * the host route and renders the filter bar (inclusive day range, model
3359
4488
  * select, 1d/7d/30d quick ranges where 1d spans today 00:00–23:59), the
3360
- * total-usage strip, the daily-token trend chart, the per-model detail
3361
- * table with the hit rate last, and — opened by each priced model row's
3362
- * “定价” affordance — a dialog with that model's full price table — all
3363
- * following the active filters. There is no refresh button: entering the
3364
- * page or changing a filter refetches (the route answers no-store); only
3365
- * the error state keeps a retry.
4489
+ * total-usage strip, the daily-token trend chart, and the per-model detail
4490
+ * table with the hit rate last — all following the active filters. Each
4491
+ * priced model row's “定价” affordance opens that model's price dialog
4492
+ * (PricingDialog.tsx); the filter row's tail link opens the filter-free
4493
+ * pricing-overview dialog (PricingOverviewDialog.tsx). There is no refresh
4494
+ * button: entering the page or changing a filter refetches (the route
4495
+ * answers no-store); only the error state keeps a retry.
3366
4496
  *
3367
4497
  * @module token-usage/client/TokenUsageSection
3368
4498
  */
@@ -3405,157 +4535,6 @@ window.__ModuleLoader__.load({
3405
4535
  const range = quickRange(days);
3406
4536
  return filters.from === range.from && filters.to === range.to;
3407
4537
  }
3408
- /** The four base rates of one model as display text (symbol included,
3409
- * converted for a USD view); a missing cache rate bills at the input rate. */
3410
- function billedRates(rates, view) {
3411
- return {
3412
- input: formatRateWithSymbol(rates.inputPerMillion, view),
3413
- output: formatRateWithSymbol(rates.outputPerMillion, view),
3414
- cacheRead: formatRateWithSymbol(rates.cacheReadPerMillion ?? rates.inputPerMillion, view),
3415
- cacheWrite: formatRateWithSymbol(rates.cacheWritePerMillion ?? rates.inputPerMillion, view)
3416
- };
3417
- }
3418
- /** `HH:MM-HH:MM` of one peak window (half-open, local minutes). */
3419
- function windowText(window) {
3420
- const clock = (minute) => `${String(Math.floor(minute / 60)).padStart(2, "0")}:${String(minute % 60).padStart(2, "0")}`;
3421
- return `${clock(window.startMinute)}-${clock(window.endMinute)}`;
3422
- }
3423
- /** The when-it-applies text of one peak slot: its label plus its windows. */
3424
- function slotCondition(slot, t) {
3425
- return `${slot.label ?? t("pricing.peak")} ${slot.windows.map(windowText).join(t("pricing.windowSep"))}`;
3426
- }
3427
- /**
3428
- * The price rows of one rate node (a time rule's or the model root's): the
3429
- * node's own base rates, then its peak slots, then its context tiers
3430
- * (ascending), each tier followed by the peak slots hanging on that tier —
3431
- * mirroring {@link resolveRate}'s node chain, where a matching tier's slots
3432
- * replace the node's and peak rates replace the node's rates wholesale.
3433
- */
3434
- function nodePriceRows(node, t) {
3435
- const rows = [{
3436
- condition: t("pricing.default"),
3437
- rates: node.rates
3438
- }];
3439
- const tiers = [...node.tiers ?? []].sort((a, b) => a.threshold - b.threshold);
3440
- for (const tier of tiers) {
3441
- const tierCondition = t("pricing.tier", { threshold: formatTokens(tier.threshold) });
3442
- rows.push({
3443
- condition: tierCondition,
3444
- rates: tier.rates
3445
- });
3446
- for (const slot of tier.dailySlots ?? []) rows.push({
3447
- condition: `${tierCondition} · ${slotCondition(slot, t)}`,
3448
- rates: slot.rates
3449
- });
3450
- }
3451
- for (const slot of node.slots ?? []) rows.push({
3452
- condition: slotCondition(slot, t),
3453
- rates: slot.rates
3454
- });
3455
- return rows;
3456
- }
3457
- /**
3458
- * One model's price table: rows are billing conditions — grouped into the
3459
- * model root (“常规”, omitted when it is the only group) and one group per
3460
- * time rule with its date window — so tier, peak, and time-rule pricing
3461
- * each show when they apply and what they bill. Shared by the pricing
3462
- * dialog; the structure mirrors {@link resolveRate}'s node chain.
3463
- */
3464
- function ModelPriceTable({ rules, view, t }) {
3465
- const groups = [{
3466
- title: rules.timeRules.length > 0 ? t("pricing.regular") : null,
3467
- rows: nodePriceRows({
3468
- rates: rules.base,
3469
- tiers: rules.contextTiers,
3470
- slots: rules.dailySlots
3471
- }, t)
3472
- }, ...[...rules.timeRules].sort((a, b) => b.endTime - a.endTime).map((rule) => ({
3473
- title: `${rule.label !== void 0 ? `${rule.label} ` : ""}${rule.startTime > 0 ? `${dayKeyOf(/* @__PURE__ */ new Date(rule.startTime * 1e3))} ~ ` : "~ "}${dayKeyOf(/* @__PURE__ */ new Date(rule.endTime * 1e3))}`,
3474
- rows: nodePriceRows({
3475
- rates: rule.rates,
3476
- tiers: rule.contextTiers,
3477
- slots: rule.dailySlots
3478
- }, t)
3479
- }))];
3480
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3481
- className: TokenUsageSection_module_css_default["tableWrap"],
3482
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
3483
- className: TokenUsageSection_module_css_default["table"],
3484
- "aria-label": t("pricing.title"),
3485
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
3486
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
3487
- className: TokenUsageSection_module_css_default["conditionHead"],
3488
- children: t("pricing.condition")
3489
- }),
3490
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.input"), t("pricing.perMillion")] }),
3491
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.output"), t("pricing.perMillion")] }),
3492
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.cacheRead"), t("pricing.perMillion")] }),
3493
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", { children: [t("pricing.cacheWrite"), t("pricing.perMillion")] })
3494
- ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: groups.flatMap((group) => [...group.title !== null ? [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
3495
- className: TokenUsageSection_module_css_default["groupRow"],
3496
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
3497
- colSpan: 5,
3498
- children: group.title
3499
- })
3500
- }, group.title)] : [], ...group.rows.map((row, index) => {
3501
- const billed = billedRates(row.rates, view);
3502
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
3503
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
3504
- className: TokenUsageSection_module_css_default["conditionCell"],
3505
- children: row.condition
3506
- }),
3507
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.input }),
3508
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.output }),
3509
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.cacheRead }),
3510
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: billed.cacheWrite })
3511
- ] }, `${group.title ?? ""}-${index}-${row.condition}`);
3512
- })]) })]
3513
- }), view.symbol === "$" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3514
- className: TokenUsageSection_module_css_default["rateNote"],
3515
- children: t("pricing.exchangeRateNote", { rate: formatRate(view.rate) })
3516
- }) : null]
3517
- });
3518
- }
3519
- /**
3520
- * The pricing dialog of one model: a native `<dialog>` (Esc closes, focus
3521
- * is trapped, the backdrop dims, and the top layer renders it above the
3522
- * table's scroll shell) opened by the “定价” affordance in a model row.
3523
- * Mounts only while a model is selected; every close path funnels through
3524
- * the dialog's `close` event, which clears the selection and unmounts it.
3525
- */
3526
- function PricingDialog({ model, rules, view, onClose, t }) {
3527
- const dialogRef = (0, react.useRef)(null);
3528
- (0, react.useEffect)(() => {
3529
- const dialog = dialogRef.current;
3530
- if (dialog !== null && !dialog.open) dialog.showModal();
3531
- }, []);
3532
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dialog", {
3533
- ref: dialogRef,
3534
- className: TokenUsageSection_module_css_default["dialog"],
3535
- "aria-label": t("pricing.title"),
3536
- onClose,
3537
- onClick: (event) => {
3538
- if (event.target === dialogRef.current) dialogRef.current?.close();
3539
- },
3540
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3541
- className: TokenUsageSection_module_css_default["dialogHead"],
3542
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3543
- className: TokenUsageSection_module_css_default["dialogTitle"],
3544
- children: model
3545
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3546
- type: "button",
3547
- className: TokenUsageSection_module_css_default["dialogClose"],
3548
- "aria-label": t("pricing.close"),
3549
- onClick: () => dialogRef.current?.close(),
3550
- children: "✕"
3551
- })]
3552
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelPriceTable, {
3553
- rules,
3554
- view,
3555
- t
3556
- })]
3557
- });
3558
- }
3559
4538
  /** Quick-range menu entries (labels are locale-free day counts). */
3560
4539
  const QUICK_OPTIONS = [
3561
4540
  {
@@ -3572,8 +4551,9 @@ window.__ModuleLoader__.load({
3572
4551
  }
3573
4552
  ];
3574
4553
  /** The filter bar: quick range menu, day-range picker popover, model
3575
- * menu — one row, one popover language. */
3576
- function FilterBar({ filters, models, onChange, t }) {
4554
+ * menu — one row, one popover language. The row's tail link is an action,
4555
+ * not a selector: it opens the filter-free pricing overview. */
4556
+ function FilterBar({ filters, models, onChange, onPricingTable, t }) {
3577
4557
  const quickValue = QUICK_OPTIONS.find((option) => isQuickActive(Number(option.value), filters))?.value ?? (filters.from === "" && filters.to === "" ? "all" : "custom");
3578
4558
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3579
4559
  className: TokenUsageSection_module_css_default["filters"],
@@ -3629,6 +4609,12 @@ window.__ModuleLoader__.load({
3629
4609
  ...filters,
3630
4610
  model
3631
4611
  })
4612
+ }),
4613
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4614
+ type: "button",
4615
+ className: TokenUsageSection_module_css_default["pricingLink"],
4616
+ onClick: onPricingTable,
4617
+ children: t("pricing.table")
3632
4618
  })
3633
4619
  ]
3634
4620
  });
@@ -3636,19 +4622,26 @@ window.__ModuleLoader__.load({
3636
4622
  /**
3637
4623
  * Render the Token Usage section content column. The `t` seat arrives from
3638
4624
  * the registration's `locale:` declaration and follows the active locale.
3639
- * @param props - the settings shell's owner share (close is unused: the nav
3640
- * rail owns leaving the panel) plus the framework-injected translate seat.
4625
+ * The session jump seats (`sessionListed` / `openSession`) come from the
4626
+ * registration's `inject:` — the session table's Ctrl+click affordance
4627
+ * reads the controller's list and opens the target session.
4628
+ * @param props - the settings shell's owner share (close rides along to the
4629
+ * session jump: the jump closes the panel) plus the injected jump seats and
4630
+ * the framework-injected translate seat.
3641
4631
  * @returns the section, one of loading / error / ready.
3642
4632
  */
3643
- function TokenUsageSection({ t }) {
4633
+ function TokenUsageSection({ t, close, sessionListed, openSession }) {
3644
4634
  const rootRef = (0, react.useRef)(null);
3645
4635
  useColorSchemeMirror(rootRef);
3646
4636
  const [filters, setFilters] = (0, react.useState)(() => ({
3647
4637
  model: "",
3648
4638
  ...quickRange(1)
3649
4639
  }));
4640
+ const [detailMode, setDetailMode] = (0, react.useState)("model");
3650
4641
  const [models, setModels] = (0, react.useState)([]);
3651
4642
  const [detailModel, setDetailModel] = (0, react.useState)(null);
4643
+ const [pricingTableOpen, setPricingTableOpen] = (0, react.useState)(false);
4644
+ const [usedSnapshot, setUsedSnapshot] = (0, react.useState)(() => /* @__PURE__ */ new Set());
3652
4645
  const [retryToken, setRetryToken] = (0, react.useState)(0);
3653
4646
  const retry = (0, react.useCallback)(() => {
3654
4647
  setRetryToken((previous) => previous + 1);
@@ -3720,8 +4713,18 @@ window.__ModuleLoader__.load({
3720
4713
  filters,
3721
4714
  models,
3722
4715
  onChange: setFilters,
4716
+ onPricingTable: () => {
4717
+ setUsedSnapshot(new Set(state.value.byModel.map((row) => row.model)));
4718
+ setPricingTableOpen(true);
4719
+ },
3723
4720
  t
3724
4721
  }),
4722
+ pricingTableOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PricingOverviewDialog, {
4723
+ usedModels: usedSnapshot,
4724
+ view,
4725
+ onClose: () => setPricingTableOpen(false),
4726
+ t
4727
+ }) : null,
3725
4728
  total.requests === 0 && (total.failures ?? 0) === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3726
4729
  className: TokenUsageSection_module_css_default["empty"],
3727
4730
  children: t("empty")
@@ -3786,10 +4789,24 @@ window.__ModuleLoader__.load({
3786
4789
  ...filters.to !== "" ? { to: filters.to } : {},
3787
4790
  ...filters.from !== "" && filters.from === filters.to ? { hours: state.value.byHour } : {}
3788
4791
  }),
3789
- state.value.byModel.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
3790
- className: TokenUsageSection_module_css_default["subtitle"],
3791
- children: t("byModel.title")
3792
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4792
+ state.value.byModel.length > 0 || (state.value.sessionRows?.length ?? 0) > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4793
+ className: TokenUsageSection_module_css_default["segmented"],
4794
+ role: "group",
4795
+ "aria-label": t("detail.switch.label"),
4796
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4797
+ type: "button",
4798
+ className: detailMode === "model" ? `${TokenUsageSection_module_css_default["segBtn"]} ${TokenUsageSection_module_css_default["segActive"]}` : TokenUsageSection_module_css_default["segBtn"],
4799
+ "aria-pressed": detailMode === "model",
4800
+ onClick: () => setDetailMode("model"),
4801
+ children: t("byModel.title")
4802
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4803
+ type: "button",
4804
+ className: detailMode === "session" ? `${TokenUsageSection_module_css_default["segBtn"]} ${TokenUsageSection_module_css_default["segActive"]}` : TokenUsageSection_module_css_default["segBtn"],
4805
+ "aria-pressed": detailMode === "session",
4806
+ onClick: () => setDetailMode("session"),
4807
+ children: t("bySession.title")
4808
+ })]
4809
+ }), detailMode === "model" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3793
4810
  className: TokenUsageSection_module_css_default["tableWrap"],
3794
4811
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
3795
4812
  className: TokenUsageSection_module_css_default["table"],
@@ -3848,6 +4865,19 @@ window.__ModuleLoader__.load({
3848
4865
  ] }, row.model);
3849
4866
  }) })]
3850
4867
  })
4868
+ }) : (state.value.sessionRows?.length ?? 0) > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionTable, {
4869
+ rows: state.value.sessionRows ?? [],
4870
+ view,
4871
+ t,
4872
+ ...sessionListed !== void 0 && openSession !== void 0 ? {
4873
+ sessionListed,
4874
+ openSession: (id) => {
4875
+ if (openSession(id)) close();
4876
+ }
4877
+ } : {}
4878
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4879
+ className: TokenUsageSection_module_css_default["muted"],
4880
+ children: t("chart.empty")
3851
4881
  })] }) : null,
3852
4882
  detailModel !== null && state.value.pricing[detailModel] !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PricingDialog, {
3853
4883
  model: detailModel,
@@ -4367,6 +5397,16 @@ window.__ModuleLoader__.load({
4367
5397
  "stat.cacheRead": "缓",
4368
5398
  "stat.cacheWrite": "写",
4369
5399
  "byModel.title": "按模型",
5400
+ "bySession.title": "按会话",
5401
+ "detail.switch.label": "明细维度",
5402
+ "session.titleCol": "会话",
5403
+ "session.group.label": "目录分组",
5404
+ "session.group.on": "分组",
5405
+ "session.group.off": "列表",
5406
+ "session.untitledDir": "未指定目录",
5407
+ "session.subagentBadge": "子会话",
5408
+ "session.lastActive": "最近活跃",
5409
+ "session.openHint": "按住 Ctrl 点击打开该会话(用量页签跟随该会话上次的选择)",
4370
5410
  "pricing.title": "模型定价",
4371
5411
  "pricing.view": "查看 {model} 定价",
4372
5412
  "pricing.viewShort": "定价",
@@ -4384,6 +5424,21 @@ window.__ModuleLoader__.load({
4384
5424
  "pricing.exchangeRateNote": "按 1 USD = {rate} CNY 换算",
4385
5425
  "pricing.unpriced": "未定价",
4386
5426
  "pricing.windowSep": "、",
5427
+ "pricing.table": "定价表",
5428
+ "pricing.search": "搜索模型",
5429
+ "pricing.used": "已用",
5430
+ "pricing.overviewFailed": "模型定价获取失败",
5431
+ "pricing.simCost": "模拟费用",
5432
+ "pricing.simInput": "输入 {tokens}",
5433
+ "pricing.simCache": "(缓存 {pct}%)",
5434
+ "pricing.simOutput": "输出 {tokens}",
5435
+ "pricing.simBucketInput": "输入",
5436
+ "pricing.simBucketCacheRead": "缓存读",
5437
+ "pricing.simBucketOutput": "输出",
5438
+ "pricing.simBucketCacheWrite": "缓存写",
5439
+ "pricing.simCase": "案例{index}",
5440
+ "pricing.simUnitOf": "{bucket}({unit})",
5441
+ "pricing.expand": "展开定价条件",
4387
5442
  "unpriced.warning": "{count} 个模型未定价:{models}(费用按 {zero} 计)",
4388
5443
  "dataDir": "数据目录:{path}",
4389
5444
  "card.title": "Token 用量",
@@ -4507,6 +5562,16 @@ window.__ModuleLoader__.load({
4507
5562
  "stat.cacheRead": "Cache",
4508
5563
  "stat.cacheWrite": "Write",
4509
5564
  "byModel.title": "By model",
5565
+ "bySession.title": "By session",
5566
+ "detail.switch.label": "Detail dimension",
5567
+ "session.titleCol": "Session",
5568
+ "session.group.label": "Directory grouping",
5569
+ "session.group.on": "Grouped",
5570
+ "session.group.off": "List",
5571
+ "session.untitledDir": "No directory",
5572
+ "session.subagentBadge": "Subagent",
5573
+ "session.lastActive": "Last active",
5574
+ "session.openHint": "Ctrl+click to open this session (the usage tab follows its last selection)",
4510
5575
  "pricing.title": "Model pricing",
4511
5576
  "pricing.view": "View rates for {model}",
4512
5577
  "pricing.viewShort": "Rates",
@@ -4524,6 +5589,21 @@ window.__ModuleLoader__.load({
4524
5589
  "pricing.exchangeRateNote": "Converted at 1 USD = {rate} CNY",
4525
5590
  "pricing.unpriced": "Unpriced",
4526
5591
  "pricing.windowSep": ", ",
5592
+ "pricing.table": "Pricing",
5593
+ "pricing.search": "Search models",
5594
+ "pricing.used": "Used",
5595
+ "pricing.overviewFailed": "Failed to load model pricing",
5596
+ "pricing.simCost": "Est. cost",
5597
+ "pricing.simInput": "In {tokens}",
5598
+ "pricing.simCache": " (cache {pct}%)",
5599
+ "pricing.simOutput": "Out {tokens}",
5600
+ "pricing.simBucketInput": "Input",
5601
+ "pricing.simBucketCacheRead": "Cache read",
5602
+ "pricing.simBucketOutput": "Output",
5603
+ "pricing.simBucketCacheWrite": "Cache write",
5604
+ "pricing.simCase": "Case {index}",
5605
+ "pricing.simUnitOf": "{bucket} ({unit})",
5606
+ "pricing.expand": "Show rate conditions",
4527
5607
  "unpriced.warning": "{count} models unpriced: {models} (cost counts as {zero})",
4528
5608
  "dataDir": "Data directory: {path}",
4529
5609
  "card.title": "Token Usage",
@@ -4612,15 +5692,17 @@ window.__ModuleLoader__.load({
4612
5692
  */
4613
5693
  const TOKEN_USAGE_NS = "token-usage";
4614
5694
  /** Required services: the slot registry, the locale dictionaries, the
4615
- * settings scope, and the workspace navigation service (its native
4616
- * directory picker backs the card's browse button). */
5695
+ * settings scope, the workspace navigation service (its native directory
5696
+ * picker backs the card's browse button), and the session controller (the
5697
+ * stats page's Ctrl+click session jump reads the list and opens the target). */
4617
5698
  const inject = [
4618
5699
  "slots",
4619
5700
  "locale",
4620
5701
  "connection",
4621
5702
  "remote",
4622
5703
  "settingsScope",
4623
- "uiWorkspace"
5704
+ "uiWorkspace",
5705
+ "sessions"
4624
5706
  ];
4625
5707
  /**
4626
5708
  * Register the dictionary pair, then the settings page and the plugin
@@ -4633,12 +5715,23 @@ window.__ModuleLoader__.load({
4633
5715
  en
4634
5716
  }), "token-usage: dictionaries");
4635
5717
  const t = ctx.locale.bind(NS);
5718
+ const clientSessions = ctx.sessions;
5719
+ const sessionListed = (id) => clientSessions.list.getSnapshot().byId[id] !== void 0;
5720
+ const openSession = (id) => {
5721
+ if (!sessionListed(id)) return false;
5722
+ clientSessions.open(id);
5723
+ return true;
5724
+ };
4636
5725
  ctx.slots.inject("settings.section", () => ctx.slots.register({
4637
5726
  name: "settings.section",
4638
5727
  id: "token-usage",
4639
5728
  order: 50,
4640
5729
  label: () => t("nav.label"),
4641
- locale: NS
5730
+ locale: NS,
5731
+ inject: () => ({
5732
+ sessionListed,
5733
+ openSession
5734
+ })
4642
5735
  }, TokenUsageSection));
4643
5736
  ctx.slots.inject("conversation.view", () => ctx.slots.register({
4644
5737
  name: "conversation.view",