fleetlens 0.9.0 → 0.10.1

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 (167) hide show
  1. package/app/apps/web/.next/BUILD_ID +1 -1
  2. package/app/apps/web/.next/build-manifest.json +3 -3
  3. package/app/apps/web/.next/prerender-manifest.json +3 -3
  4. package/app/apps/web/.next/server/app/_global-error.html +1 -1
  5. package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
  6. package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/app/apps/web/.next/server/app/_not-found/page.js +2 -2
  12. package/app/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  13. package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/app/apps/web/.next/server/app/api/ask/route.js +4 -3
  15. package/app/apps/web/.next/server/app/api/ask/route.js.nft.json +1 -1
  16. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js +2 -3
  17. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js.nft.json +1 -1
  18. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js +2 -3
  19. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js.nft.json +1 -1
  20. package/app/apps/web/.next/server/app/api/digest/month-index/route.js +3 -3
  21. package/app/apps/web/.next/server/app/api/digest/month-index/route.js.nft.json +1 -1
  22. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js +2 -3
  23. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js.nft.json +1 -1
  24. package/app/apps/web/.next/server/app/api/digest/week-index/route.js +3 -3
  25. package/app/apps/web/.next/server/app/api/digest/week-index/route.js.nft.json +1 -1
  26. package/app/apps/web/.next/server/app/api/events/route.js +2 -3
  27. package/app/apps/web/.next/server/app/api/events/route.js.nft.json +1 -1
  28. package/app/apps/web/.next/server/app/api/jobs/route.js +1 -1
  29. package/app/apps/web/.next/server/app/api/jobs/route.js.nft.json +1 -1
  30. package/app/apps/web/.next/server/app/api/runs/[runId]/route.js +1 -1
  31. package/app/apps/web/.next/server/app/api/runs/[runId]/route.js.nft.json +1 -1
  32. package/app/apps/web/.next/server/app/api/runs/[runId]/stream/route.js +1 -1
  33. package/app/apps/web/.next/server/app/api/runs/[runId]/stream/route.js.nft.json +1 -1
  34. package/app/apps/web/.next/server/app/api/runs/route.js +1 -1
  35. package/app/apps/web/.next/server/app/api/runs/route.js.nft.json +1 -1
  36. package/app/apps/web/.next/server/app/api/settings/route.js +3 -4
  37. package/app/apps/web/.next/server/app/api/settings/route.js.nft.json +1 -1
  38. package/app/apps/web/.next/server/app/changelog/page.js +2 -2
  39. package/app/apps/web/.next/server/app/changelog/page.js.nft.json +1 -1
  40. package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  41. package/app/apps/web/.next/server/app/day/[date]/page.js +2 -2
  42. package/app/apps/web/.next/server/app/day/[date]/page.js.nft.json +1 -1
  43. package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
  44. package/app/apps/web/.next/server/app/day/page.js +2 -2
  45. package/app/apps/web/.next/server/app/day/page.js.nft.json +1 -1
  46. package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
  47. package/app/apps/web/.next/server/app/digest/[date]/page.js +2 -2
  48. package/app/apps/web/.next/server/app/digest/[date]/page.js.nft.json +1 -1
  49. package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
  50. package/app/apps/web/.next/server/app/digest/page.js +2 -2
  51. package/app/apps/web/.next/server/app/digest/page.js.nft.json +1 -1
  52. package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
  53. package/app/apps/web/.next/server/app/insights/[key]/page.js +2 -2
  54. package/app/apps/web/.next/server/app/insights/[key]/page.js.nft.json +1 -1
  55. package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
  56. package/app/apps/web/.next/server/app/insights/page.js +2 -2
  57. package/app/apps/web/.next/server/app/insights/page.js.nft.json +1 -1
  58. package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
  59. package/app/apps/web/.next/server/app/page.js +2 -2
  60. package/app/apps/web/.next/server/app/page.js.nft.json +1 -1
  61. package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  62. package/app/apps/web/.next/server/app/parallelism/page.js +2 -2
  63. package/app/apps/web/.next/server/app/parallelism/page.js.nft.json +1 -1
  64. package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
  65. package/app/apps/web/.next/server/app/projects/[slug]/page.js +2 -2
  66. package/app/apps/web/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
  67. package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  68. package/app/apps/web/.next/server/app/projects/page.js +2 -2
  69. package/app/apps/web/.next/server/app/projects/page.js.nft.json +1 -1
  70. package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  71. package/app/apps/web/.next/server/app/runs/page.js +2 -2
  72. package/app/apps/web/.next/server/app/runs/page.js.nft.json +1 -1
  73. package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  74. package/app/apps/web/.next/server/app/sessions/[id]/page.js +2 -2
  75. package/app/apps/web/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
  76. package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  77. package/app/apps/web/.next/server/app/sessions/page.js +2 -2
  78. package/app/apps/web/.next/server/app/sessions/page.js.nft.json +1 -1
  79. package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  80. package/app/apps/web/.next/server/app/settings/page.js +2 -2
  81. package/app/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
  82. package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  83. package/app/apps/web/.next/server/app/usage/page.js +2 -2
  84. package/app/apps/web/.next/server/app/usage/page.js.nft.json +1 -1
  85. package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  86. package/app/apps/web/.next/server/chunks/[externals]__09v47rg._.js +3 -0
  87. package/app/apps/web/.next/server/chunks/{[externals]__0fpbr8-._.js → [externals]__0o43ejh._.js} +2 -2
  88. package/app/apps/web/.next/server/chunks/[root-of-the-server]__00n3f9y._.js +1 -1
  89. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02px2mk._.js +3 -0
  90. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02zukjw._.js +1 -1
  91. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0455vu3._.js +5 -0
  92. package/app/apps/web/.next/server/chunks/[root-of-the-server]__067~im1._.js +2 -2
  93. package/app/apps/web/.next/server/chunks/[root-of-the-server]__06b4cj-._.js +1 -1
  94. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0e8n_x4._.js → [root-of-the-server]__08agijy._.js} +2 -2
  95. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0_8zh-i._.js +3 -3
  96. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0ej_p3s._.js +2 -2
  97. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0-vgrh1._.js → [root-of-the-server]__0i06ito._.js} +2 -2
  98. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0jprdks._.js +2 -2
  99. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0vm_41a._.js +3 -0
  100. package/app/apps/web/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0ck.78s.js +4 -4
  101. package/app/apps/web/.next/server/chunks/packages_0c-sz9n._.js +3 -0
  102. package/app/apps/web/.next/server/chunks/packages_0wywuu.._.js +3 -0
  103. package/app/apps/web/.next/server/chunks/packages_entries_dist_node_0bckr7-.js +27 -13
  104. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0d~2~le._.js +1 -1
  105. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0r4tks8._.js +1 -1
  106. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0s4dg1y._.js +3 -0
  107. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0tejjy_._.js +1 -1
  108. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0w52fbc._.js +3 -3
  109. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0yv0m0q._.js +3 -0
  110. package/app/apps/web/.next/server/chunks/ssr/_0jw2sm7._.js +1 -1
  111. package/app/apps/web/.next/server/chunks/ssr/_0xu2pvc._.js +1 -1
  112. package/app/apps/web/.next/server/chunks/ssr/apps_web_components_0ly1xes._.js +1 -1
  113. package/app/apps/web/.next/server/chunks/ssr/apps_web_components_0txtsv5._.js +2 -2
  114. package/app/apps/web/.next/server/chunks/ssr/apps_web_components_usage-charts-dashboard_tsx_0bgr_uv._.js +1 -1
  115. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_0m67-xi._.js +1 -1
  116. package/app/apps/web/.next/server/chunks/ssr/packages_entries_dist_node_0_271yr.js +1 -1
  117. package/app/apps/web/.next/server/chunks/ssr/packages_parser_dist_12.endt._.js +3 -0
  118. package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
  119. package/app/apps/web/.next/server/pages/500.html +1 -1
  120. package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
  121. package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
  122. package/app/apps/web/.next/static/chunks/04a36uhu~p_z-.css +1 -0
  123. package/app/apps/web/.next/static/chunks/{0q2vd~aj.1hpz.js → 0g8ujtb0lp._9.js} +3 -3
  124. package/app/apps/web/.next/static/chunks/0l3ck.awv~4t7.js +1 -0
  125. package/app/apps/web/.next/static/chunks/{171za22fv684..js → 0lxuac2v0_gdl.js} +2 -2
  126. package/app/apps/web/.next/static/chunks/0n0n.0279ot6c.js +1 -0
  127. package/app/apps/web/.next/static/chunks/0uev~g~qvbjv9.js +4 -0
  128. package/app/apps/web/.next/static/chunks/0~n2a9f52wju9.js +14 -0
  129. package/app/apps/web/app/api/ask/route.ts +124 -111
  130. package/app/apps/web/app/api/events/route.ts +3 -4
  131. package/app/apps/web/app/api/runs/[runId]/route.ts +2 -2
  132. package/app/apps/web/app/api/runs/[runId]/stream/route.ts +3 -2
  133. package/app/apps/web/app/api/runs/route.ts +8 -4
  134. package/app/apps/web/app/sessions/[id]/session-view.tsx +31 -0
  135. package/app/apps/web/components/job-queue-widget.tsx +11 -8
  136. package/app/apps/web/components/previous-cycles-trend.tsx +26 -11
  137. package/app/apps/web/components/usage-chart.tsx +35 -37
  138. package/app/apps/web/components/usage-gauges.tsx +18 -12
  139. package/app/apps/web/components/usage-sidebar.tsx +23 -12
  140. package/app/apps/web/lib/calibration-data.ts +2 -4
  141. package/app/apps/web/lib/changelog-data.generated.ts +1 -1
  142. package/app/apps/web/lib/entries-index.ts +2 -2
  143. package/app/apps/web/lib/jobs.ts +3 -5
  144. package/app/apps/web/lib/usage-data.ts +3 -4
  145. package/app/apps/web/lib/utilization-tone.ts +74 -0
  146. package/app/apps/web/package.json +1 -1
  147. package/app/apps/web/tsconfig.tsbuildinfo +1 -1
  148. package/dist/daemon-worker.js +609 -110
  149. package/dist/index.js +5312 -4802
  150. package/package.json +1 -1
  151. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0.z48ue._.js +0 -3
  152. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0dctov1._.js +0 -5
  153. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0op9af~._.js +0 -3
  154. package/app/apps/web/.next/server/chunks/packages_09hmrqx._.js +0 -3
  155. package/app/apps/web/.next/server/chunks/packages_118y1lp._.js +0 -3
  156. package/app/apps/web/.next/server/chunks/packages_parser_dist_fs_122oe0-.js +0 -3
  157. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0sp6.jt._.js +0 -3
  158. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0ytdqxt._.js +0 -3
  159. package/app/apps/web/.next/server/chunks/ssr/packages_parser_dist_10_oegc._.js +0 -3
  160. package/app/apps/web/.next/static/chunks/05m.oz3kmf1p7.js +0 -1
  161. package/app/apps/web/.next/static/chunks/07-fq4im3pmjp.js +0 -4
  162. package/app/apps/web/.next/static/chunks/0cxyt4-24..b7.js +0 -14
  163. package/app/apps/web/.next/static/chunks/0o9ayt8sknubd.js +0 -1
  164. package/app/apps/web/.next/static/chunks/0wfbj5zr~az.z.css +0 -1
  165. /package/app/apps/web/.next/static/{u6-8f8u1tspYCacGAz53R → sxcMbKfZ5XgVXYN4QHOHd}/_buildManifest.js +0 -0
  166. /package/app/apps/web/.next/static/{u6-8f8u1tspYCacGAz53R → sxcMbKfZ5XgVXYN4QHOHd}/_clientMiddlewareManifest.js +0 -0
  167. /package/app/apps/web/.next/static/{u6-8f8u1tspYCacGAz53R → sxcMbKfZ5XgVXYN4QHOHd}/_ssgManifest.js +0 -0
@@ -1,9 +1,9 @@
1
- module.exports=[44422,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(50944),e=a.i(72131),f=a.i(70106);let g=(0,f.default)("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),h=(0,f.default)("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),i=(0,f.default)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),j=(0,f.default)("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),k=(0,f.default)("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);var l=a.i(87532);let m=(0,f.default)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),n=(0,f.default)("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var o=a.i(69439),p=a.i(71727);let q=(0,f.default)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),r=(0,f.default)("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);var s=a.i(3444);let t=(0,f.default)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),u=(0,f.default)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);function v(a){if("u">typeof document){document.documentElement.setAttribute("data-theme",a);try{document.cookie=`claude-lens-theme=${a};path=/;max-age=31536000;samesite=lax`}catch{}}}function w(){let[a,c]=(0,e.useState)("dark"),[d,f]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{let a=document.documentElement.getAttribute("data-theme");if("light"===a||"dark"===a)c(a);else{let a="dark";c(a),v(a)}f(!0)},[]),(0,b.jsx)("button",{type:"button",onClick:()=>{let b="dark"===a?"light":"dark";c(b),v(b);try{window.localStorage.setItem("claude-lens:theme",b)}catch{}},"aria-label":"dark"===a?"Switch to light mode":"Switch to dark mode",title:"dark"===a?"Switch to light mode":"Switch to dark mode",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:6,background:"transparent",border:"1px solid var(--af-border-subtle)",color:"var(--af-text-secondary)",cursor:"pointer",transition:"all 0.12s"},onMouseEnter:a=>{a.currentTarget.style.background="var(--af-surface-hover)",a.currentTarget.style.color="var(--af-text)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent",a.currentTarget.style.color="var(--af-text-secondary)"},children:d?"dark"===a?(0,b.jsx)(u,{size:14}):(0,b.jsx)(t,{size:14}):null})}var x=a.i(2591);function y({snapshot:a}){let d,e,[f,,g]=(0,x.usePersistentBoolean)("cclens:usage:show-sonnet",!1);if(!a)return(0,b.jsxs)("div",{style:{padding:"10px 16px 12px",borderTop:"1px solid var(--af-border-subtle)",fontSize:10,color:"var(--af-text-tertiary)",lineHeight:1.4},children:[(0,b.jsx)("div",{style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,marginBottom:4},children:"Usage"}),(0,b.jsxs)("div",{children:["Run ",(0,b.jsx)("code",{style:{fontFamily:"var(--font-mono)"},children:"cclens daemon start"})," to collect metrics."]})]});let h=[{label:"5h",window:a.five_hour},{label:"7d",window:a.seven_day}];return g&&f&&h.push({label:"Sonnet 7d",window:a.seven_day_sonnet}),(0,b.jsxs)(c.default,{href:"/usage",style:{display:"block",padding:"10px 16px 12px",borderTop:"1px solid var(--af-border-subtle)",textDecoration:"none",color:"inherit"},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:10,fontWeight:600,color:"var(--af-text-tertiary)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:8},children:[(0,b.jsx)("span",{children:"Current usage"}),(0,b.jsx)("span",{suppressHydrationWarning:!0,style:{fontWeight:500,textTransform:"none",letterSpacing:0},children:(d=new Date(a.captured_at).getTime(),(e=Math.round((Date.now()-d)/1e3))<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${Math.floor(e/3600)}h ago`:`${Math.floor(e/86400)}d ago`)})]}),(0,b.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:h.map(a=>(0,b.jsx)(z,{...a},a.label))})]})}function z({label:a,window:c}){let d=c?.utilization??null,e=null!==d,f=e?Math.max(0,Math.min(100,d)):0,g=f>=90?"var(--af-danger)":f>=70?"var(--af-warning)":"var(--af-success)";return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6,fontSize:10,color:"var(--af-text-secondary)",marginBottom:2,fontVariantNumeric:"tabular-nums"},children:[(0,b.jsx)("span",{children:a}),c?.resets_at&&(0,b.jsxs)("span",{suppressHydrationWarning:!0,style:{fontSize:9,color:"var(--af-text-tertiary)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["resets ",function(a){let b,c=Math.round((new Date(a).getTime()-Date.now())/1e3),d=Math.abs(c);if(d<60)b=`${d}s`;else if(d<3600)b=`${Math.floor(d/60)}m`;else if(d<86400){let a=Math.floor(d/3600),c=Math.floor(d%3600/60);b=c>0?`${a}h${c}m`:`${a}h`}else{let a=Math.floor(d/86400),c=Math.floor(d%86400/3600);b=c>0?`${a}d${c}h`:`${a}d`}return c<0?`${b} ago`:`in ${b}`}(c.resets_at)]}),(0,b.jsx)("span",{style:{fontWeight:600,color:"var(--af-text)",marginLeft:"auto"},children:e?`${f.toFixed(0)}%`:"—"})]}),(0,b.jsx)("div",{style:{height:4,background:"var(--af-border-subtle)",borderRadius:999,overflow:"hidden"},children:(0,b.jsx)("div",{style:{height:"100%",width:e?`${f}%`:"0%",background:g,borderRadius:999,transition:"width 0.24s ease"}})})]})}let A=(0,f.default)("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);var B=a.i(2913);function C({latestVersion:a,active:d}){let[f,g]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{if(!a)return void g(!1);try{let b=window.localStorage.getItem(B.STORAGE_KEY);g(b!==a)}catch{g(!1)}},[a]),(0,b.jsxs)(c.default,{href:"/changelog","aria-label":f?"Changelog (new entries)":"Changelog",title:f?`What's new in v${a}`:"Changelog",style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:6,color:d?"var(--af-text)":"var(--af-text-tertiary)",background:d?"var(--af-surface-hover)":"transparent",textDecoration:"none"},children:[(0,b.jsx)(A,{size:14}),f&&(0,b.jsx)("span",{"aria-hidden":!0,style:{position:"absolute",top:3,right:3,width:7,height:7,borderRadius:"50%",background:"#ef4444",border:"1.5px solid var(--af-surface)"}})]})}function D({href:a,active:d,icon:e,trailing:f,children:g}){return(0,b.jsxs)(c.default,{href:a,style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderRadius:7,fontSize:13,fontWeight:500,color:d?"var(--af-accent)":"var(--af-text-secondary)",background:d?"var(--af-accent-subtle)":"transparent",transition:"all 0.12s"},children:[e,(0,b.jsx)("span",{style:{flex:1},children:g}),f&&(0,b.jsx)("span",{style:{fontSize:10,color:d?"var(--af-accent)":"var(--af-text-tertiary)",fontFamily:"var(--font-mono)"},children:f})]})}function E({label:a,items:d,pathname:e,isPinned:f,onTogglePin:g}){return 0===d.length?null:(0,b.jsxs)("div",{style:{marginTop:10},children:[(0,b.jsx)("div",{style:{fontSize:10,color:"var(--af-text-tertiary)",textTransform:"uppercase",letterSpacing:"0.06em",padding:"0 10px 6px",fontWeight:600},children:a}),(0,b.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:d.map(a=>{let d=`/projects/${encodeURIComponent(a.projectDir)}`,h=e===d,i=(0,s.prettyProjectName)(a.projectName);return(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"5px 6px 5px 10px",borderRadius:6,background:h?"var(--af-accent-subtle)":"transparent",color:h?"var(--af-accent)":"var(--af-text-secondary)"},children:[(0,b.jsxs)(c.default,{href:d,style:{flex:1,minWidth:0,fontSize:12,color:"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:5},title:(a.worktreeCount??0)>0?`${a.projectName} — ${a.worktreeCount} worktree${1===a.worktreeCount?"":"s"}`:a.projectName,children:[(0,b.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:i}),(a.worktreeCount??0)>0&&(0,b.jsxs)("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:100,background:"rgba(167, 139, 250, 0.15)",color:"rgba(167, 139, 250, 1)",flexShrink:0},children:["+",a.worktreeCount," wt"]})]}),(0,b.jsx)("span",{style:{fontSize:10,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)",marginLeft:4},children:a.sessionCount}),(0,b.jsx)("button",{type:"button",onClick:b=>{b.preventDefault(),b.stopPropagation(),g(a.projectDir)},"aria-label":f(a.projectDir)?"Unpin project":"Pin project",title:f(a.projectDir)?"Unpin":"Pin",style:{background:"transparent",border:"none",padding:3,borderRadius:4,color:f(a.projectDir)?"var(--af-accent)":"var(--af-text-tertiary)",display:"flex",alignItems:"center"},children:f(a.projectDir)?(0,b.jsx)(k,{size:12}):(0,b.jsx)(j,{size:12})}),a.lastActiveMs&&(0,b.jsx)("span",{style:{fontSize:9,color:"var(--af-text-tertiary)",marginLeft:2,minWidth:32,textAlign:"right"},title:new Date(a.lastActiveMs).toISOString(),suppressHydrationWarning:!0,children:(0,s.formatRelative)(new Date(a.lastActiveMs).toISOString())})]},a.projectDir)})})]})}a.s(["Sidebar",0,function({projects:a,totalSessions:f,currentUsage:j,version:k,latestChangelogVersion:s}){let t=(0,d.usePathname)(),[u,v]=(0,e.useState)(new Set),[x,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)("");(0,e.useEffect)(()=>{v(new Set),z(!0)},[]);let F=a=>{v(b=>{let c=new Set(b);c.has(a)?c.delete(a):c.add(a);try{window.localStorage.setItem("claude-lens:pinned-projects:v1",JSON.stringify(Array.from(c)))}catch{}return c})},G=(0,e.useMemo)(()=>{if(!A.trim())return a;let b=A.toLowerCase();return a.filter(a=>a.projectName.toLowerCase().includes(b))},[a,A]),H=G.filter(a=>u.has(a.projectDir)),I=G.filter(a=>!u.has(a.projectDir));return(0,b.jsxs)("aside",{style:{width:260,flexShrink:0,borderRight:"1px solid var(--af-border-subtle)",background:"var(--af-surface)",display:"flex",flexDirection:"column",position:"sticky",top:0,height:"100vh"},children:[(0,b.jsx)("div",{style:{padding:"18px 20px 12px",borderBottom:"1px solid var(--af-border-subtle)"},children:(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[(0,b.jsx)("div",{style:{width:28,height:28,borderRadius:7,background:"var(--af-accent-subtle)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--af-accent)"},children:(0,b.jsx)(m,{size:16,strokeWidth:2.25})}),(0,b.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,b.jsx)("span",{style:{fontSize:14,fontWeight:700,letterSpacing:"-0.01em"},children:"Fleetlens"}),(0,b.jsxs)("span",{style:{fontSize:10,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)",fontWeight:500},title:`fleetlens ${k}`,children:["v",k]})]}),(0,b.jsx)("div",{style:{fontSize:11,color:"var(--af-text-tertiary)"},children:"Multi-agent fleet analytics"})]})]})}),(0,b.jsxs)("nav",{style:{padding:"10px 10px 6px",display:"flex",flexDirection:"column",gap:2},children:[(0,b.jsx)(D,{href:"/",active:"/"===t,icon:(0,b.jsx)(g,{size:15}),children:"Overview"}),(0,b.jsx)(D,{href:"/sessions",active:"/sessions"===t||t.startsWith("/sessions/"),icon:(0,b.jsx)(h,{size:15}),trailing:f>0?String(f):void 0,children:"All sessions"}),(0,b.jsx)(D,{href:"/projects",active:"/projects"===t,icon:(0,b.jsx)(i,{size:15}),trailing:a.length>0?String(a.length):void 0,children:"Projects"}),(0,b.jsx)(D,{href:"/day",active:"/day"===t||t.startsWith("/day/")||"/digest"===t||t.startsWith("/digest/")||"/parallelism"===t,icon:(0,b.jsx)(r,{size:15}),children:"Day"}),(0,b.jsx)(D,{href:"/usage",active:"/usage"===t,icon:(0,b.jsx)(n,{size:15}),children:"Usage"}),(0,b.jsx)(D,{href:"/insights",active:"/insights"===t,icon:(0,b.jsx)(o.Lightbulb,{size:15}),children:"Insights"}),(0,b.jsx)(D,{href:"/runs",active:"/runs"===t||t.startsWith("/runs/"),icon:(0,b.jsx)(p.Radio,{size:15}),children:"Runs"})]}),(0,b.jsxs)("div",{style:{margin:"0 14px",padding:"8px 0",borderTop:"1px solid var(--af-border-subtle)",borderBottom:"1px solid var(--af-border-subtle)",display:"flex",alignItems:"center",gap:6},children:[(0,b.jsx)(l.Search,{size:13,color:"var(--af-text-tertiary)"}),(0,b.jsx)("input",{type:"text",placeholder:"Search projects",value:A,onChange:a=>B(a.target.value),style:{flex:1,background:"transparent",border:"none",padding:"4px 0",fontSize:12,color:"var(--af-text)"}})]}),(0,b.jsxs)("div",{style:{flex:1,overflow:"auto",padding:"4px 8px 20px"},children:[x&&H.length>0&&(0,b.jsx)(E,{label:"Pinned",items:H,pathname:t,isPinned:a=>u.has(a),onTogglePin:F}),(0,b.jsx)(E,{label:"Projects",items:I,pathname:t,isPinned:a=>u.has(a),onTogglePin:F})]}),(0,b.jsx)(y,{snapshot:j}),(0,b.jsxs)("div",{style:{padding:"10px 16px 10px 20px",fontSize:10,color:"var(--af-text-tertiary)",borderTop:"1px solid var(--af-border-subtle)",display:"flex",alignItems:"center",gap:8},children:[(0,b.jsxs)("span",{style:{flex:1,minWidth:0},children:[f," sessions · ",a.length," projects"]}),(0,b.jsx)(C,{latestVersion:s,active:"/changelog"===t}),(0,b.jsx)(c.default,{href:"/settings","aria-label":"Settings",title:"Settings",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:6,color:"/settings"===t?"var(--af-text)":"var(--af-text-tertiary)",background:"/settings"===t?"var(--af-surface-hover)":"transparent",textDecoration:"none"},children:(0,b.jsx)(q,{size:14})}),(0,b.jsx)(w,{})]})]})}],44422)},46069,a=>{"use strict";var b=a.i(50944),c=a.i(72131);a.s(["LiveRefresher",0,function(){let a,d=(0,b.useRouter)(),e=(a=(0,b.usePathname)(),a?.includes("/insights/print/")??!1),f=(0,c.useRef)(null),g=(0,c.useRef)({session:0,usage:0});return!function(a,b={}){let{enabled:d=!0}=b,e=(0,c.useRef)(a);(0,c.useEffect)(()=>{e.current=a},[a]),(0,c.useEffect)(()=>{if(!d)return;let a=new EventSource("/api/events");return a.onmessage=a=>{try{let b=JSON.parse(a.data);("session-updated"===b.type||"usage-updated"===b.type)&&e.current(b)}catch{}},a.onerror=()=>{},()=>{a.close()}},[d])}((0,c.useCallback)(a=>{let b="usage-updated"===a.type?"usage":"session";a.mtimeMs<=(g.current[b]??0)||(g.current[b]=a.mtimeMs,f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{d.refresh()},400))},[d]),{enabled:!e}),(0,c.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]),null}],46069)},1568,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(50944),e=a.i(38246),f=a.i(3444),g=a.i(76285),h=a.i(99309),i=a.i(44220);let j="cclens-live-widget-expanded";a.s(["LiveSessionsWidget",0,function({sessions:a,entrySummaries:k={}}){let l=(0,d.usePathname)(),[m,n]=(0,c.useState)(()=>Date.now()),[o,p]=(0,c.useState)(!1);if((0,c.useEffect)(()=>{try{let a=localStorage.getItem(j);null!==a&&p("true"===a)}catch{}},[]),(0,c.useEffect)(()=>{let a=setInterval(()=>n(Date.now()),1e4);return()=>clearInterval(a)},[]),l&&/^\/sessions\/[^/]+$/.test(l))return null;let q=a.filter(a=>{if(!a.lastTimestamp)return!1;let b=Date.parse(a.lastTimestamp);return!Number.isNaN(b)&&m-b<=45e3}).slice().sort((a,b)=>{let c=a.firstTimestamp?Date.parse(a.firstTimestamp):0;return(b.firstTimestamp?Date.parse(b.firstTimestamp):0)-c});if(0===q.length)return null;let r=o?q.slice(0,5):[],s=o?q.length-r.length:0;return(0,b.jsxs)("div",{style:{position:"fixed",right:20,bottom:20,zIndex:100,display:"flex",flexDirection:"column-reverse",gap:6,maxWidth:320,pointerEvents:"auto"},children:[(0,b.jsxs)("button",{type:"button",onClick:()=>{var a;return a=a=>!a,void p(b=>{let c=a(b);try{localStorage.setItem(j,String(c))}catch{}return c})},style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 11px 5px 9px",background:"rgba(239, 68, 68, 0.14)",border:"1px solid rgba(239, 68, 68, 0.4)",borderRadius:100,fontSize:10,fontWeight:700,color:"#ef4444",letterSpacing:"0.06em",textTransform:"uppercase",alignSelf:"flex-end",cursor:"pointer",userSelect:"none",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",boxShadow:"0 2px 10px rgba(239, 68, 68, 0.15)"},title:o?"Collapse":`Show ${q.length} live session${1===q.length?"":"s"}`,children:[(0,b.jsx)("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:"#ef4444",animation:"cs-live-pulse 1.6s ease-in-out infinite"}}),"Live · ",q.length]}),o&&s>0&&(0,b.jsxs)("div",{style:{fontSize:10,color:"var(--af-text-tertiary)",padding:"0 4px",textAlign:"right"},children:["+",s," more live"]}),r.map(a=>{let c=k[a.id];return(0,b.jsxs)(e.default,{href:`/sessions/${a.id}`,style:{display:"block",padding:"10px 12px",background:"var(--af-surface-elevated)",border:"1px solid var(--af-border-subtle)",borderLeft:"2px solid #ef4444",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",textDecoration:"none",color:"var(--af-text)",fontSize:11,lineHeight:1.35,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},title:(a.lastUserPreview||a.firstUserPreview||a.lastAgentPreview)??(0,f.prettyProjectName)(a.projectName),children:[c&&(0,b.jsx)("div",{onClick:a=>a.stopPropagation(),style:{marginBottom:4},children:c.outcome?(0,b.jsx)(i.OutcomePill,{outcome:c.outcome,size:"sm",label:"text",agent:a.agent}):"skipped_trivial"!==c.enrichmentStatus?(0,b.jsx)(i.OutcomePill,{outcome:null,pending:!0,sessionId:a.id,localDay:c.localDay,size:"sm",agent:a.agent}):null}),(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:500,color:"var(--af-text)",minWidth:0},children:[(0,b.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:a.lastUserPreview||a.firstUserPreview||(0,b.jsx)("em",{style:{color:"var(--af-text-tertiary)"},children:"(no user message)"})}),(0,b.jsx)(g.TeamBadge,{session:a,linkable:!1}),(0,b.jsx)(h.AgentBadge,{agent:a.agent})]}),(0,b.jsx)("div",{style:{fontSize:10,color:"var(--af-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:3,fontStyle:"italic"},children:a.lastAgentPreview?(0,b.jsxs)(b.Fragment,{children:["↳ ",a.lastAgentPreview]}):(0,b.jsx)("em",{style:{color:"var(--af-text-tertiary)"},children:"waiting…"})}),(0,b.jsx)("div",{style:{fontSize:9,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(0,f.prettyProjectName)(a.projectName)})]},a.id)}),(0,b.jsx)("style",{children:`
1
+ module.exports=[44422,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(50944),e=a.i(72131),f=a.i(70106);let g=(0,f.default)("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),h=(0,f.default)("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),i=(0,f.default)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),j=(0,f.default)("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),k=(0,f.default)("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);var l=a.i(87532);let m=(0,f.default)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),n=(0,f.default)("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var o=a.i(69439),p=a.i(71727);let q=(0,f.default)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),r=(0,f.default)("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);var s=a.i(3444);let t=(0,f.default)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),u=(0,f.default)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);function v(a){if("u">typeof document){document.documentElement.setAttribute("data-theme",a);try{document.cookie=`claude-lens-theme=${a};path=/;max-age=31536000;samesite=lax`}catch{}}}function w(){let[a,c]=(0,e.useState)("dark"),[d,f]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{let a=document.documentElement.getAttribute("data-theme");if("light"===a||"dark"===a)c(a);else{let a="dark";c(a),v(a)}f(!0)},[]),(0,b.jsx)("button",{type:"button",onClick:()=>{let b="dark"===a?"light":"dark";c(b),v(b);try{window.localStorage.setItem("claude-lens:theme",b)}catch{}},"aria-label":"dark"===a?"Switch to light mode":"Switch to dark mode",title:"dark"===a?"Switch to light mode":"Switch to dark mode",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:6,background:"transparent",border:"1px solid var(--af-border-subtle)",color:"var(--af-text-secondary)",cursor:"pointer",transition:"all 0.12s"},onMouseEnter:a=>{a.currentTarget.style.background="var(--af-surface-hover)",a.currentTarget.style.color="var(--af-text)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent",a.currentTarget.style.color="var(--af-text-secondary)"},children:d?"dark"===a?(0,b.jsx)(u,{size:14}):(0,b.jsx)(t,{size:14}):null})}var x=a.i(2591),y=a.i(55555);function z({snapshot:a}){let d,e,[f,,g]=(0,x.usePersistentBoolean)("cclens:usage:show-sonnet",!1);if(!a)return(0,b.jsxs)("div",{style:{padding:"10px 16px 12px",borderTop:"1px solid var(--af-border-subtle)",fontSize:10,color:"var(--af-text-tertiary)",lineHeight:1.4},children:[(0,b.jsx)("div",{style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,marginBottom:4},children:"Usage"}),(0,b.jsxs)("div",{children:["Run ",(0,b.jsx)("code",{style:{fontFamily:"var(--font-mono)"},children:"cclens daemon start"})," to collect metrics."]})]});let h=[{label:"5h",window:a.five_hour,windowMs:18e6},{label:"7d",window:a.seven_day,windowMs:6048e5}];return g&&f&&h.push({label:"Sonnet 7d",window:a.seven_day_sonnet,windowMs:6048e5}),(0,b.jsxs)(c.default,{href:"/usage",style:{display:"block",padding:"10px 16px 12px",borderTop:"1px solid var(--af-border-subtle)",textDecoration:"none",color:"inherit"},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:10,fontWeight:600,color:"var(--af-text-tertiary)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:8},children:[(0,b.jsx)("span",{children:"Current usage"}),(0,b.jsx)("span",{suppressHydrationWarning:!0,style:{fontWeight:500,textTransform:"none",letterSpacing:0},children:(d=new Date(a.captured_at).getTime(),(e=Math.round((Date.now()-d)/1e3))<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${Math.floor(e/3600)}h ago`:`${Math.floor(e/86400)}d ago`)})]}),(0,b.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:h.map(a=>(0,b.jsx)(A,{...a},a.label))})]})}function A({label:a,window:c,windowMs:d}){let e=c?.utilization??null,f=null!==e,g=f?Math.max(0,Math.min(100,e)):0,h=c?.resets_at?new Date(c.resets_at).getTime():null,i=f&&h?(0,y.toneVar)((0,y.paceToneForCycle)(g,h,d)):"var(--af-border-subtle)";return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6,fontSize:10,color:"var(--af-text-secondary)",marginBottom:2,fontVariantNumeric:"tabular-nums"},children:[(0,b.jsx)("span",{children:a}),c?.resets_at&&(0,b.jsxs)("span",{suppressHydrationWarning:!0,style:{fontSize:9,color:"var(--af-text-tertiary)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["resets ",function(a){let b,c=Math.round((new Date(a).getTime()-Date.now())/1e3),d=Math.abs(c);if(d<60)b=`${d}s`;else if(d<3600)b=`${Math.floor(d/60)}m`;else if(d<86400){let a=Math.floor(d/3600),c=Math.floor(d%3600/60);b=c>0?`${a}h${c}m`:`${a}h`}else{let a=Math.floor(d/86400),c=Math.floor(d%86400/3600);b=c>0?`${a}d${c}h`:`${a}d`}return c<0?`${b} ago`:`in ${b}`}(c.resets_at)]}),(0,b.jsx)("span",{style:{fontWeight:600,color:"var(--af-text)",marginLeft:"auto"},children:f?`${g.toFixed(0)}%`:"—"})]}),(0,b.jsx)("div",{style:{height:4,background:"var(--af-border-subtle)",borderRadius:999,overflow:"hidden"},children:(0,b.jsx)("div",{style:{height:"100%",width:f?`${g}%`:"0%",background:i,borderRadius:999,transition:"width 0.24s ease"}})})]})}let B=(0,f.default)("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);var C=a.i(2913);function D({latestVersion:a,active:d}){let[f,g]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{if(!a)return void g(!1);try{let b=window.localStorage.getItem(C.STORAGE_KEY);g(b!==a)}catch{g(!1)}},[a]),(0,b.jsxs)(c.default,{href:"/changelog","aria-label":f?"Changelog (new entries)":"Changelog",title:f?`What's new in v${a}`:"Changelog",style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:6,color:d?"var(--af-text)":"var(--af-text-tertiary)",background:d?"var(--af-surface-hover)":"transparent",textDecoration:"none"},children:[(0,b.jsx)(B,{size:14}),f&&(0,b.jsx)("span",{"aria-hidden":!0,style:{position:"absolute",top:3,right:3,width:7,height:7,borderRadius:"50%",background:"#ef4444",border:"1.5px solid var(--af-surface)"}})]})}function E({href:a,active:d,icon:e,trailing:f,children:g}){return(0,b.jsxs)(c.default,{href:a,style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderRadius:7,fontSize:13,fontWeight:500,color:d?"var(--af-accent)":"var(--af-text-secondary)",background:d?"var(--af-accent-subtle)":"transparent",transition:"all 0.12s"},children:[e,(0,b.jsx)("span",{style:{flex:1},children:g}),f&&(0,b.jsx)("span",{style:{fontSize:10,color:d?"var(--af-accent)":"var(--af-text-tertiary)",fontFamily:"var(--font-mono)"},children:f})]})}function F({label:a,items:d,pathname:e,isPinned:f,onTogglePin:g}){return 0===d.length?null:(0,b.jsxs)("div",{style:{marginTop:10},children:[(0,b.jsx)("div",{style:{fontSize:10,color:"var(--af-text-tertiary)",textTransform:"uppercase",letterSpacing:"0.06em",padding:"0 10px 6px",fontWeight:600},children:a}),(0,b.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:d.map(a=>{let d=`/projects/${encodeURIComponent(a.projectDir)}`,h=e===d,i=(0,s.prettyProjectName)(a.projectName);return(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"5px 6px 5px 10px",borderRadius:6,background:h?"var(--af-accent-subtle)":"transparent",color:h?"var(--af-accent)":"var(--af-text-secondary)"},children:[(0,b.jsxs)(c.default,{href:d,style:{flex:1,minWidth:0,fontSize:12,color:"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:5},title:(a.worktreeCount??0)>0?`${a.projectName} — ${a.worktreeCount} worktree${1===a.worktreeCount?"":"s"}`:a.projectName,children:[(0,b.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:i}),(a.worktreeCount??0)>0&&(0,b.jsxs)("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:100,background:"rgba(167, 139, 250, 0.15)",color:"rgba(167, 139, 250, 1)",flexShrink:0},children:["+",a.worktreeCount," wt"]})]}),(0,b.jsx)("span",{style:{fontSize:10,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)",marginLeft:4},children:a.sessionCount}),(0,b.jsx)("button",{type:"button",onClick:b=>{b.preventDefault(),b.stopPropagation(),g(a.projectDir)},"aria-label":f(a.projectDir)?"Unpin project":"Pin project",title:f(a.projectDir)?"Unpin":"Pin",style:{background:"transparent",border:"none",padding:3,borderRadius:4,color:f(a.projectDir)?"var(--af-accent)":"var(--af-text-tertiary)",display:"flex",alignItems:"center"},children:f(a.projectDir)?(0,b.jsx)(k,{size:12}):(0,b.jsx)(j,{size:12})}),a.lastActiveMs&&(0,b.jsx)("span",{style:{fontSize:9,color:"var(--af-text-tertiary)",marginLeft:2,minWidth:32,textAlign:"right"},title:new Date(a.lastActiveMs).toISOString(),suppressHydrationWarning:!0,children:(0,s.formatRelative)(new Date(a.lastActiveMs).toISOString())})]},a.projectDir)})})]})}a.s(["Sidebar",0,function({projects:a,totalSessions:f,currentUsage:j,version:k,latestChangelogVersion:s}){let t=(0,d.usePathname)(),[u,v]=(0,e.useState)(new Set),[x,y]=(0,e.useState)(!1),[A,B]=(0,e.useState)("");(0,e.useEffect)(()=>{v(new Set),y(!0)},[]);let C=a=>{v(b=>{let c=new Set(b);c.has(a)?c.delete(a):c.add(a);try{window.localStorage.setItem("claude-lens:pinned-projects:v1",JSON.stringify(Array.from(c)))}catch{}return c})},G=(0,e.useMemo)(()=>{if(!A.trim())return a;let b=A.toLowerCase();return a.filter(a=>a.projectName.toLowerCase().includes(b))},[a,A]),H=G.filter(a=>u.has(a.projectDir)),I=G.filter(a=>!u.has(a.projectDir));return(0,b.jsxs)("aside",{style:{width:260,flexShrink:0,borderRight:"1px solid var(--af-border-subtle)",background:"var(--af-surface)",display:"flex",flexDirection:"column",position:"sticky",top:0,height:"100vh"},children:[(0,b.jsx)("div",{style:{padding:"18px 20px 12px",borderBottom:"1px solid var(--af-border-subtle)"},children:(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[(0,b.jsx)("div",{style:{width:28,height:28,borderRadius:7,background:"var(--af-accent-subtle)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--af-accent)"},children:(0,b.jsx)(m,{size:16,strokeWidth:2.25})}),(0,b.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,b.jsx)("span",{style:{fontSize:14,fontWeight:700,letterSpacing:"-0.01em"},children:"Fleetlens"}),(0,b.jsxs)("span",{style:{fontSize:10,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)",fontWeight:500},title:`fleetlens ${k}`,children:["v",k]})]}),(0,b.jsx)("div",{style:{fontSize:11,color:"var(--af-text-tertiary)"},children:"Multi-agent fleet analytics"})]})]})}),(0,b.jsxs)("nav",{style:{padding:"10px 10px 6px",display:"flex",flexDirection:"column",gap:2},children:[(0,b.jsx)(E,{href:"/",active:"/"===t,icon:(0,b.jsx)(g,{size:15}),children:"Overview"}),(0,b.jsx)(E,{href:"/sessions",active:"/sessions"===t||t.startsWith("/sessions/"),icon:(0,b.jsx)(h,{size:15}),trailing:f>0?String(f):void 0,children:"All sessions"}),(0,b.jsx)(E,{href:"/projects",active:"/projects"===t,icon:(0,b.jsx)(i,{size:15}),trailing:a.length>0?String(a.length):void 0,children:"Projects"}),(0,b.jsx)(E,{href:"/day",active:"/day"===t||t.startsWith("/day/")||"/digest"===t||t.startsWith("/digest/")||"/parallelism"===t,icon:(0,b.jsx)(r,{size:15}),children:"Day"}),(0,b.jsx)(E,{href:"/usage",active:"/usage"===t,icon:(0,b.jsx)(n,{size:15}),children:"Usage"}),(0,b.jsx)(E,{href:"/insights",active:"/insights"===t,icon:(0,b.jsx)(o.Lightbulb,{size:15}),children:"Insights"}),(0,b.jsx)(E,{href:"/runs",active:"/runs"===t||t.startsWith("/runs/"),icon:(0,b.jsx)(p.Radio,{size:15}),children:"Runs"})]}),(0,b.jsxs)("div",{style:{margin:"0 14px",padding:"8px 0",borderTop:"1px solid var(--af-border-subtle)",borderBottom:"1px solid var(--af-border-subtle)",display:"flex",alignItems:"center",gap:6},children:[(0,b.jsx)(l.Search,{size:13,color:"var(--af-text-tertiary)"}),(0,b.jsx)("input",{type:"text",placeholder:"Search projects",value:A,onChange:a=>B(a.target.value),style:{flex:1,background:"transparent",border:"none",padding:"4px 0",fontSize:12,color:"var(--af-text)"}})]}),(0,b.jsxs)("div",{style:{flex:1,overflow:"auto",padding:"4px 8px 20px"},children:[x&&H.length>0&&(0,b.jsx)(F,{label:"Pinned",items:H,pathname:t,isPinned:a=>u.has(a),onTogglePin:C}),(0,b.jsx)(F,{label:"Projects",items:I,pathname:t,isPinned:a=>u.has(a),onTogglePin:C})]}),(0,b.jsx)(z,{snapshot:j}),(0,b.jsxs)("div",{style:{padding:"10px 16px 10px 20px",fontSize:10,color:"var(--af-text-tertiary)",borderTop:"1px solid var(--af-border-subtle)",display:"flex",alignItems:"center",gap:8},children:[(0,b.jsxs)("span",{style:{flex:1,minWidth:0},children:[f," sessions · ",a.length," projects"]}),(0,b.jsx)(D,{latestVersion:s,active:"/changelog"===t}),(0,b.jsx)(c.default,{href:"/settings","aria-label":"Settings",title:"Settings",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:6,color:"/settings"===t?"var(--af-text)":"var(--af-text-tertiary)",background:"/settings"===t?"var(--af-surface-hover)":"transparent",textDecoration:"none"},children:(0,b.jsx)(q,{size:14})}),(0,b.jsx)(w,{})]})]})}],44422)},46069,a=>{"use strict";var b=a.i(50944),c=a.i(72131);a.s(["LiveRefresher",0,function(){let a,d=(0,b.useRouter)(),e=(a=(0,b.usePathname)(),a?.includes("/insights/print/")??!1),f=(0,c.useRef)(null),g=(0,c.useRef)({session:0,usage:0});return!function(a,b={}){let{enabled:d=!0}=b,e=(0,c.useRef)(a);(0,c.useEffect)(()=>{e.current=a},[a]),(0,c.useEffect)(()=>{if(!d)return;let a=new EventSource("/api/events");return a.onmessage=a=>{try{let b=JSON.parse(a.data);("session-updated"===b.type||"usage-updated"===b.type)&&e.current(b)}catch{}},a.onerror=()=>{},()=>{a.close()}},[d])}((0,c.useCallback)(a=>{let b="usage-updated"===a.type?"usage":"session";a.mtimeMs<=(g.current[b]??0)||(g.current[b]=a.mtimeMs,f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{d.refresh()},400))},[d]),{enabled:!e}),(0,c.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]),null}],46069)},1568,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(50944),e=a.i(38246),f=a.i(3444),g=a.i(76285),h=a.i(99309),i=a.i(44220);let j="cclens-live-widget-expanded";a.s(["LiveSessionsWidget",0,function({sessions:a,entrySummaries:k={}}){let l=(0,d.usePathname)(),[m,n]=(0,c.useState)(()=>Date.now()),[o,p]=(0,c.useState)(!1);if((0,c.useEffect)(()=>{try{let a=localStorage.getItem(j);null!==a&&p("true"===a)}catch{}},[]),(0,c.useEffect)(()=>{let a=setInterval(()=>n(Date.now()),1e4);return()=>clearInterval(a)},[]),l&&/^\/sessions\/[^/]+$/.test(l))return null;let q=a.filter(a=>{if(!a.lastTimestamp)return!1;let b=Date.parse(a.lastTimestamp);return!Number.isNaN(b)&&m-b<=45e3}).slice().sort((a,b)=>{let c=a.firstTimestamp?Date.parse(a.firstTimestamp):0;return(b.firstTimestamp?Date.parse(b.firstTimestamp):0)-c});if(0===q.length)return null;let r=o?q.slice(0,5):[],s=o?q.length-r.length:0;return(0,b.jsxs)("div",{style:{position:"fixed",right:20,bottom:20,zIndex:100,display:"flex",flexDirection:"column-reverse",gap:6,maxWidth:320,pointerEvents:"auto"},children:[(0,b.jsxs)("button",{type:"button",onClick:()=>{var a;return a=a=>!a,void p(b=>{let c=a(b);try{localStorage.setItem(j,String(c))}catch{}return c})},style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 11px 5px 9px",background:"rgba(239, 68, 68, 0.14)",border:"1px solid rgba(239, 68, 68, 0.4)",borderRadius:100,fontSize:10,fontWeight:700,color:"#ef4444",letterSpacing:"0.06em",textTransform:"uppercase",alignSelf:"flex-end",cursor:"pointer",userSelect:"none",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",boxShadow:"0 2px 10px rgba(239, 68, 68, 0.15)"},title:o?"Collapse":`Show ${q.length} live session${1===q.length?"":"s"}`,children:[(0,b.jsx)("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:"#ef4444",animation:"cs-live-pulse 1.6s ease-in-out infinite"}}),"Live · ",q.length]}),o&&s>0&&(0,b.jsxs)("div",{style:{fontSize:10,color:"var(--af-text-tertiary)",padding:"0 4px",textAlign:"right"},children:["+",s," more live"]}),r.map(a=>{let c=k[a.id];return(0,b.jsxs)(e.default,{href:`/sessions/${a.id}`,style:{display:"block",padding:"10px 12px",background:"var(--af-surface-elevated)",border:"1px solid var(--af-border-subtle)",borderLeft:"2px solid #ef4444",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",textDecoration:"none",color:"var(--af-text)",fontSize:11,lineHeight:1.35,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},title:(a.lastUserPreview||a.firstUserPreview||a.lastAgentPreview)??(0,f.prettyProjectName)(a.projectName),children:[c&&(0,b.jsx)("div",{onClick:a=>a.stopPropagation(),style:{marginBottom:4},children:c.outcome?(0,b.jsx)(i.OutcomePill,{outcome:c.outcome,size:"sm",label:"text",agent:a.agent}):"skipped_trivial"!==c.enrichmentStatus?(0,b.jsx)(i.OutcomePill,{outcome:null,pending:!0,sessionId:a.id,localDay:c.localDay,size:"sm",agent:a.agent}):null}),(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:500,color:"var(--af-text)",minWidth:0},children:[(0,b.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:a.lastUserPreview||a.firstUserPreview||(0,b.jsx)("em",{style:{color:"var(--af-text-tertiary)"},children:"(no user message)"})}),(0,b.jsx)(g.TeamBadge,{session:a,linkable:!1}),(0,b.jsx)(h.AgentBadge,{agent:a.agent})]}),(0,b.jsx)("div",{style:{fontSize:10,color:"var(--af-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:3,fontStyle:"italic"},children:a.lastAgentPreview?(0,b.jsxs)(b.Fragment,{children:["↳ ",a.lastAgentPreview]}):(0,b.jsx)("em",{style:{color:"var(--af-text-tertiary)"},children:"waiting…"})}),(0,b.jsx)("div",{style:{fontSize:9,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(0,f.prettyProjectName)(a.projectName)})]},a.id)}),(0,b.jsx)("style",{children:`
2
2
  @keyframes cs-live-pulse {
3
3
  0%, 100% { opacity: 1; transform: scale(1); }
4
4
  50% { opacity: 0.4; transform: scale(0.85); }
5
5
  }
6
- `})]})}])},22309,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(33441);let e=(0,a.i(70106).default)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);var f=a.i(96221),g=a.i(41710),h=a.i(38246);let i="cclens-jobs-widget-expanded";function j({children:a}){return(0,b.jsx)("div",{style:{padding:"6px 14px",fontSize:9,color:"var(--af-text-tertiary)",textTransform:"uppercase",letterSpacing:"0.08em",fontWeight:700,background:"var(--af-surface)"},children:a})}function k({job:a}){let c="running"===a.status?f.Loader2:"queued"===a.status?g.Clock:"error"===a.status?e:d.Check,i="running"===a.status?"#4299e1":"queued"===a.status?"var(--af-text-tertiary)":"error"===a.status?"#f56565":"#48bb78",j=a.resultUrl&&("done"===a.status||"running"===a.status),l=j?h.default:"div",m=j?{href:a.resultUrl}:{};return(0,b.jsxs)(l,{...m,style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 14px",borderBottom:"1px solid var(--af-border-subtle)",textDecoration:"none",color:"var(--af-text)",fontSize:11.5,cursor:j?"pointer":"default"},children:[(0,b.jsx)(c,{size:13,className:"running"===a.status?"cs-job-spin":"",style:{color:i,marginTop:2,flexShrink:0}}),(0,b.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,b.jsx)("div",{style:{fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.label}),a.progress&&(0,b.jsx)("div",{style:{fontSize:10,color:"var(--af-text-tertiary)",marginTop:2,fontFamily:"var(--font-mono)"},children:function(a){if(void 0!==a.index&&void 0!==a.total)return`${a.phase} ${a.index}/${a.total}`;if(void 0!==a.bytes){let b=(a.bytes/1024).toFixed(1);return`${a.phase} \xb7 ${b}k`}return a.text?`${a.phase} \xb7 ${a.text}`:a.phase}(a.progress)}),"error"===a.status&&a.error&&(0,b.jsx)("div",{style:{fontSize:10,color:"#f56565",marginTop:2},children:a.error.length>60?a.error.slice(0,60)+"…":a.error}),"done"===a.status&&a.resultUrl&&(0,b.jsx)("div",{style:{fontSize:10,color:"var(--af-accent)",marginTop:2},children:"View →"})]})]})}a.s(["JobQueueWidget",0,function(){let[a,d]=(0,c.useState)([]),[e,g]=(0,c.useState)(!1);(0,c.useEffect)(()=>{try{let a=localStorage.getItem(i);null!==a&&g("true"===a)}catch{}},[]),(0,c.useEffect)(()=>{let b=!0,c=null,e=async()=>{try{let a=await fetch("/api/jobs",{cache:"no-store"});if(!a.ok)return;let c=await a.json();b&&d(c.jobs)}catch{}},f=()=>{b&&(c=setTimeout(async()=>{await e(),f()},a.some(a=>"running"===a.status||"queued"===a.status)?1500:6e3))};return e(),f(),()=>{b=!1,c&&clearTimeout(c)}},[a]);let h=a.filter(a=>"running"===a.status||"queued"===a.status),l=a.filter(a=>"done"===a.status||"error"===a.status||"cancelled"===a.status).slice(0,8);return 0===h.length?null:(0,b.jsxs)("div",{style:{position:"fixed",right:140,bottom:20,zIndex:99,display:"flex",flexDirection:"column-reverse",gap:6,maxWidth:320,alignItems:"flex-end"},children:[(0,b.jsxs)("button",{type:"button",onClick:()=>{var a;return a=a=>!a,void g(b=>{let c=a(b);try{localStorage.setItem(i,String(c))}catch{}return c})},title:`${h.length} job${1===h.length?"":"s"} running — click to ${e?"collapse":"expand"}`,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 11px 5px 9px",background:"rgba(66, 153, 225, 0.14)",border:"1px solid rgba(66, 153, 225, 0.4)",borderRadius:100,fontSize:10,fontWeight:700,color:"#4299e1",letterSpacing:"0.06em",textTransform:"uppercase",cursor:"pointer",userSelect:"none",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",boxShadow:"0 2px 10px rgba(66, 153, 225, 0.15)",alignSelf:"flex-end"},children:[(0,b.jsx)(f.Loader2,{size:11,className:"cs-job-spin",style:{flexShrink:0}}),"Jobs · ",h.length]}),e&&(0,b.jsxs)("div",{style:{width:320,maxHeight:360,overflowY:"auto",background:"var(--af-surface-elevated)",border:"1px solid var(--af-border-subtle)",borderRadius:10,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[h.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)(j,{children:"Running"}),h.map(a=>(0,b.jsx)(k,{job:a},a.id))]}),l.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)(j,{children:"Recent"}),l.map(a=>(0,b.jsx)(k,{job:a},a.id))]})]}),(0,b.jsx)("style",{children:`
6
+ `})]})}])},22309,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(33441);let e=(0,a.i(70106).default)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);var f=a.i(96221),g=a.i(41710),h=a.i(38246);let i="cclens-jobs-widget-expanded";function j({children:a}){return(0,b.jsx)("div",{style:{padding:"6px 14px",fontSize:9,color:"var(--af-text-tertiary)",textTransform:"uppercase",letterSpacing:"0.08em",fontWeight:700,background:"var(--af-surface)"},children:a})}function k({job:a}){let c="running"===a.status?f.Loader2:"queued"===a.status?g.Clock:"error"===a.status?e:d.Check,i="running"===a.status?"#4299e1":"queued"===a.status?"var(--af-text-tertiary)":"error"===a.status?"#f56565":"#48bb78",j=a.resultUrl&&("done"===a.status||"running"===a.status),l=j?h.default:"div",m=j?{href:a.resultUrl}:{};return(0,b.jsxs)(l,{...m,style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 14px",borderBottom:"1px solid var(--af-border-subtle)",textDecoration:"none",color:"var(--af-text)",fontSize:11.5,cursor:j?"pointer":"default"},children:[(0,b.jsx)(c,{size:13,className:"running"===a.status?"cs-job-spin":"",style:{color:i,marginTop:2,flexShrink:0}}),(0,b.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,b.jsx)("div",{style:{fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.label}),a.progress&&(0,b.jsx)("div",{style:{fontSize:10,color:"var(--af-text-tertiary)",marginTop:2,fontFamily:"var(--font-mono)"},children:function(a){if(void 0!==a.index&&void 0!==a.total)return`${a.phase} ${a.index}/${a.total}`;if(void 0!==a.bytes){let b=(a.bytes/1024).toFixed(1);return`${a.phase} \xb7 ${b}k`}return a.text?`${a.phase} \xb7 ${a.text}`:a.phase}(a.progress)}),"error"===a.status&&a.error&&(0,b.jsx)("div",{style:{fontSize:10,color:"#f56565",marginTop:2},children:a.error.length>60?a.error.slice(0,60)+"…":a.error}),"done"===a.status&&a.resultUrl&&(0,b.jsx)("div",{style:{fontSize:10,color:"var(--af-accent)",marginTop:2},children:"View →"})]})]})}a.s(["JobQueueWidget",0,function(){let[a,d]=(0,c.useState)([]),[e,g]=(0,c.useState)(!1);(0,c.useEffect)(()=>{try{let a=localStorage.getItem(i);null!==a&&g("true"===a)}catch{}},[]),(0,c.useEffect)(()=>{let a=!0,b=null,c=!1,e=async()=>{try{let b=await fetch("/api/jobs",{cache:"no-store"});if(!b.ok)return;let e=await b.json();if(!a)return;d(e.jobs),c=e.jobs.some(a=>"running"===a.status||"queued"===a.status)}catch{}},f=()=>{a&&(b=setTimeout(async()=>{await e(),f()},c?1500:6e3))};return e().then(f),()=>{a=!1,b&&clearTimeout(b)}},[]);let h=a.filter(a=>"running"===a.status||"queued"===a.status),l=a.filter(a=>"done"===a.status||"error"===a.status||"cancelled"===a.status).slice(0,8);return 0===h.length?null:(0,b.jsxs)("div",{style:{position:"fixed",right:140,bottom:20,zIndex:99,display:"flex",flexDirection:"column-reverse",gap:6,maxWidth:320,alignItems:"flex-end"},children:[(0,b.jsxs)("button",{type:"button",onClick:()=>{var a;return a=a=>!a,void g(b=>{let c=a(b);try{localStorage.setItem(i,String(c))}catch{}return c})},title:`${h.length} job${1===h.length?"":"s"} running — click to ${e?"collapse":"expand"}`,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 11px 5px 9px",background:"rgba(66, 153, 225, 0.14)",border:"1px solid rgba(66, 153, 225, 0.4)",borderRadius:100,fontSize:10,fontWeight:700,color:"#4299e1",letterSpacing:"0.06em",textTransform:"uppercase",cursor:"pointer",userSelect:"none",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",boxShadow:"0 2px 10px rgba(66, 153, 225, 0.15)",alignSelf:"flex-end"},children:[(0,b.jsx)(f.Loader2,{size:11,className:"cs-job-spin",style:{flexShrink:0}}),"Jobs · ",h.length]}),e&&(0,b.jsxs)("div",{style:{width:320,maxHeight:360,overflowY:"auto",background:"var(--af-surface-elevated)",border:"1px solid var(--af-border-subtle)",borderRadius:10,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[h.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)(j,{children:"Running"}),h.map(a=>(0,b.jsx)(k,{job:a},a.id))]}),l.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)(j,{children:"Recent"}),l.map(a=>(0,b.jsx)(k,{job:a},a.id))]})]}),(0,b.jsx)("style",{children:`
7
7
  @keyframes cs-job-spin {
8
8
  from { transform: rotate(0deg); }
9
9
  to { transform: rotate(360deg); }
@@ -1,3 +1,3 @@
1
- module.exports=[64405,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(33508);let e=(0,a.i(70106).default)("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);function f({snapshots:a,seriesKey:d,windowMs:i,colorVar:j,predictedSeries:k,onExpand:l}){let m=(0,c.useMemo)(()=>{let b=a.map(a=>({capturedAt:new Date(a.captured_at).getTime(),window:a[d]})).filter(a=>null!==a.window&&null!==a.window.utilization);if(0===b.length)return null;let c=b[b.length-1],e=c.window.resets_at?new Date(c.window.resets_at).getTime():null;if(!e)return null;let f=e-i,g=Date.now(),h=100-(c.window.utilization??0);return{points:b.filter(a=>a.capturedAt>=f&&a.capturedAt<=e).map(a=>[a.capturedAt,100-(a.window.utilization??0)]),predicted:(k??[]).filter(a=>a.capturedAt>=f&&a.capturedAt<=e).map(a=>[a.capturedAt,100-Math.max(0,Math.min(100,a.util))]).sort((a,b)=>a[0]-b[0]),windowStart:f,windowEnd:e,now:g,currentRemaining:h,latest:c}},[a,d,i,k]),n=1190,o=148,[p,q]=(0,c.useState)(null);if(!m)return(0,b.jsx)("div",{className:"af-card",style:{padding:"14px 18px",textAlign:"center",fontSize:12,color:"var(--af-text-tertiary)"},children:"No data for this window yet."});let{points:r,predicted:s,windowStart:t,windowEnd:u,now:v,currentRemaining:w,latest:x}=m,y=a=>64+(a-t)/(u-t)*n,z=a=>20+o-a/100*o,A=a=>Math.max(0,Math.min(100,100-(a-t)/(u-t)*100)),B=w-A(v),C=B<-10?"var(--af-danger)":B<0?"var(--af-warning)":"var(--af-success)",D=B<-10?"behind schedule":B<0?"slightly behind":"on track",E=r.length>0?r.map(([a,b],c)=>`${0===c?"M":"L"} ${y(a).toFixed(1)} ${z(b).toFixed(1)}`).join(" "):"",F=s.length>1?s.map(([a,b],c)=>`${0===c?"M":"L"} ${y(a).toFixed(1)} ${z(b).toFixed(1)}`).join(" "):"",G=r.length>0?`${E} L ${y(r[r.length-1][0]).toFixed(1)} ${z(0).toFixed(1)} L ${y(r[0][0]).toFixed(1)} ${z(0).toFixed(1)} Z`:"";return(0,b.jsxs)("div",{className:"af-card",style:{padding:"14px 18px"},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:14,flexWrap:"wrap",marginBottom:8},children:[(0,b.jsxs)("div",{style:{fontSize:18,fontWeight:700,letterSpacing:"-0.01em",color:j,fontVariantNumeric:"tabular-nums"},children:[w.toFixed(1),"%",(0,b.jsx)("span",{style:{fontSize:11,fontWeight:500,color:"var(--af-text-tertiary)",marginLeft:4,letterSpacing:0},children:"remaining"})]}),(0,b.jsxs)("div",{style:{fontSize:11,color:C,fontWeight:500},children:[D," (",B>=0?"+":"",B.toFixed(1),"%)"]}),(0,b.jsxs)("div",{suppressHydrationWarning:!0,style:{fontSize:11,color:"var(--af-text-tertiary)",marginLeft:"auto"},children:[function(a){let b=a/36e5;if(b<24)return`${b} hour${1===b?"":"s"}`;let c=b/24;return`${c} day${1===c?"":"s"}`}(i)," · resets"," ",h(new Date(u).toISOString())]}),l&&(0,b.jsx)("button",{type:"button",onClick:l,"aria-label":"Expand chart",title:"Expand",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:5,background:"transparent",border:"1px solid var(--af-border-subtle)",color:"var(--af-text-tertiary)",cursor:"pointer",marginLeft:4},children:(0,b.jsx)(e,{size:12})})]}),(0,b.jsxs)("div",{style:{position:"relative"},children:[(0,b.jsxs)("svg",{viewBox:"0 0 1280 200",style:{width:"100%",aspectRatio:"1280 / 200",display:"block"},onMouseMove:a=>{let b=a.currentTarget.getBoundingClientRect(),c=(a.clientX-b.left)/b.width*1280;if(c<64||c>1254)return void q(null);let d=t+(c-64)/n*(u-t),e=r[0],f=Math.abs(e[0]-d);for(let a of r){let b=Math.abs(a[0]-d);b<f&&(e=a,f=b)}let g=null;if(s.length>0){let a=s[0],b=Math.abs(a[0]-e[0]);for(let c of s){let d=Math.abs(c[0]-e[0]);d<b&&(a=c,b=d)}g=a[1]}q({x:y(e[0]),t:e[0],actual:e[1],ideal:A(e[0]),predicted:g})},onMouseLeave:()=>q(null),children:[[0,25,50,75,100].map(a=>{let c=z(a);return(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:64,x2:1254,y1:c,y2:c,stroke:"var(--af-border-subtle)",strokeWidth:"1"}),(0,b.jsxs)("text",{x:56,y:c+4,textAnchor:"end",fontSize:"13",fill:"var(--af-text-tertiary)",children:[a,"%"]})]},a)}),(0,b.jsx)("text",{x:14,y:20+o/2,textAnchor:"middle",transform:`rotate(-90, 14, ${20+o/2})`,fontSize:"12",fill:"var(--af-text-tertiary)",children:"Remaining budget (%)"}),(0,b.jsx)("text",{x:64,y:180,textAnchor:"start",fontSize:"12",fill:"var(--af-text-tertiary)",suppressHydrationWarning:!0,children:g(t)}),(0,b.jsx)("text",{x:1254,y:180,textAnchor:"end",fontSize:"12",fill:"var(--af-text-tertiary)",suppressHydrationWarning:!0,children:g(u)}),(0,b.jsx)("rect",{x:64,y:z(10),width:n,height:z(0)-z(10),fill:"var(--af-danger)",fillOpacity:"0.07"}),(0,b.jsx)("rect",{x:64,y:z(30),width:n,height:z(10)-z(30),fill:"var(--af-warning)",fillOpacity:"0.05"}),(0,b.jsx)("path",{d:G,fill:j,fillOpacity:"0.1"}),(0,b.jsx)("line",{x1:y(t),y1:z(100),x2:y(u),y2:z(0),stroke:"var(--af-text-tertiary)",strokeOpacity:"0.5",strokeWidth:"1.5",strokeDasharray:"4 3"}),v>=t&&v<=u&&(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:y(v),y1:20,x2:y(v),y2:20+o,stroke:"var(--af-text-secondary)",strokeOpacity:"0.5",strokeWidth:"1"}),(0,b.jsx)("text",{x:y(v),y:14,textAnchor:"middle",fontSize:"12",fontWeight:"600",fill:"var(--af-text-secondary)",children:"now"})]}),(0,b.jsx)("path",{d:E,fill:"none",stroke:j,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),r.map(([a,c],d)=>(0,b.jsx)("circle",{cx:y(a),cy:z(c),r:"3",fill:j},d)),F&&(0,b.jsx)("path",{d:F,fill:"none",stroke:"#ff7a00",strokeOpacity:"0.9",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"}),p&&(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:p.x,y1:20,x2:p.x,y2:20+o,stroke:"var(--af-text-secondary)",strokeOpacity:"0.7",strokeWidth:"1",strokeDasharray:"2 2"}),(0,b.jsx)("circle",{cx:p.x,cy:z(p.actual),r:"5",fill:j,stroke:"var(--af-surface)",strokeWidth:"1.5"})]})]}),p&&(0,b.jsxs)("div",{style:{pointerEvents:"none",position:"absolute",left:`${p.x/1280*100}%`,top:4,transform:"translateX(-50%)",background:"var(--af-surface-elevated)",border:"1px solid var(--af-border-subtle)",borderRadius:8,padding:"8px 12px",fontSize:11,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.24)",whiteSpace:"nowrap",color:"var(--af-text)"},children:[(0,b.jsx)("div",{style:{fontWeight:600},children:new Date(p.t).toLocaleString()}),(0,b.jsxs)("div",{style:{marginTop:4,display:"flex",gap:12},children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Actual"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:j},children:[p.actual.toFixed(1),"%"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Ideal"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums"},children:[p.ideal.toFixed(1),"%"]})]}),null!==p.predicted&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Estimated"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:"#b58400"},children:[p.predicted.toFixed(1),"%"]})]})]}),(0,b.jsxs)("div",{style:{marginTop:2,color:"var(--af-text-tertiary)"},children:["Δ ",p.actual-p.ideal>=0?"+":"",(p.actual-p.ideal).toFixed(1),"%",null!==p.predicted&&(0,b.jsxs)("span",{style:{marginLeft:8},children:["· estimate ",p.predicted>=p.actual?"+":"",(p.predicted-p.actual).toFixed(1),"pp vs actual"]})]})]})]}),(0,b.jsxs)("div",{style:{marginTop:4,fontSize:9,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)",textAlign:"right"},suppressHydrationWarning:!0,children:[r.length," snapshot",1===r.length?"":"s"," · last"," ",h(new Date(x.capturedAt).toISOString()),s.length>0&&(0,b.jsxs)("span",{style:{marginLeft:8,color:"#ff7a00"},children:["· ",s.length," estimate",1===s.length?"":"s"," overlaid"]})]})]})}function g(a){return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function h(a){let b,c=Math.round((new Date(a).getTime()-Date.now())/1e3),d=Math.abs(c);if(d<60)b=`${d}s`;else if(d<3600)b=`${Math.floor(d/60)}m`;else if(d<86400){let a=Math.floor(d/3600),c=Math.floor(d%3600/60);b=c>0?`${a}h${c}m`:`${a}h`}else{let a=Math.floor(d/86400),c=Math.floor(d%86400/3600);b=c>0?`${a}d${c}h`:`${a}d`}return c<0?`${b} ago`:`in ${b}`}function i({snapshots:a,seriesKey:d,startMs:e,endMs:f,windowMs:g,colorVar:h,predictedSeries:l}){var m,n;let o,p,q,r,s=(0,c.useMemo)(()=>{let b=[];for(let c of a){let a=new Date(c.captured_at).getTime(),e=c[d];e&&null!==e.utilization&&b.push({t:a,u:e.utilization,resetsAt:e.resets_at})}if(0===b.length)return null;let c=new Map;for(let a of b){if(!a.resetsAt)continue;let b=new Date(a.resetsAt).getTime();if(Number.isNaN(b))continue;let d=36e5*Math.round(b/36e5),e=c.get(d);e||(e=[],c.set(d,e)),e.push(a)}let h=[];for(let[a,b]of c){let c=a-g;b.sort((a,b)=>a.t-b.t);let d=b.map(a=>({t:a.t,u:a.u,remaining:100-a.u})),e=0;for(let a=1;a<d.length;a++)d[a].u>d[e].u&&(e=a);h.push({resetsAtMs:a,startMs:c,points:d,peak:d[e].u,peakT:d[e].t})}let i=h.filter(a=>a.resetsAtMs>=e&&a.startMs<=f).sort((a,b)=>a.resetsAtMs-b.resetsAtMs);if(0===i.length)return null;let j=i.flatMap(a=>a.points),k=Math.max(...j.map(a=>a.u)),l=i.filter(a=>a.resetsAtMs<=f&&a.resetsAtMs<Date.now()).length,m=i.length>0?i.reduce((a,b)=>a+b.peak,0)/i.length:0;return{cycles:i,allPoints:j,peakOverall:k,avgPeak:m,completeCycles:l}},[a,d,e,f,g]),[t,u]=(0,c.useState)(null);if(!s)return(0,b.jsx)("div",{className:"af-card",style:{padding:"40px 32px",textAlign:"center",fontSize:12,color:"var(--af-text-tertiary)"},children:"No usage data in the selected range."});let{cycles:v,allPoints:w,peakOverall:x,avgPeak:y,completeCycles:z}=s,A=1188,B=252,C=a=>60+(a-e)/(f-e)*A,D=a=>24+B-a/100*B,E=a=>e+(a-60)/A*(f-e),F=a=>{let b=C(a);return b<60?60:b>1248?1248:b};return(0,b.jsxs)("div",{className:"af-card",style:{padding:"14px 18px",display:"flex",flexDirection:"column",gap:10},children:[(0,b.jsx)("div",{suppressHydrationWarning:!0,style:{fontSize:11,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)"},children:(m=e,n=f,p=new Date(m).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),q=new Date(n).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),o=(r=n-m)<36e5?`${Math.round(r/6e4)}m`:r<864e5?`${(r/36e5).toFixed(1).replace(/\.0$/,"")}h`:`${(r/864e5).toFixed(1).replace(/\.0$/,"")}d`,`${p} → ${q} (${o})`)}),(0,b.jsxs)("div",{style:{display:"flex",gap:28,fontSize:11,color:"var(--af-text-tertiary)",flexWrap:"wrap"},children:[(0,b.jsx)(j,{label:"Peak utilization",value:`${x.toFixed(1)}%`,color:h}),(0,b.jsx)(j,{label:"Avg peak / cycle",value:v.length>0?`${y.toFixed(1)}%`:"—",color:h}),(0,b.jsx)(j,{label:"Complete cycles",value:String(z),color:"var(--af-text)"}),(0,b.jsx)(j,{label:"Data points",value:String(w.length),color:"var(--af-text)"})]}),(0,b.jsxs)("div",{style:{position:"relative"},children:[(0,b.jsxs)("svg",{viewBox:"0 0 1280 320",style:{width:"100%",aspectRatio:"1280 / 320",display:"block"},onMouseMove:a=>{let b=a.currentTarget.getBoundingClientRect(),c=(a.clientX-b.left)/b.width*1280;if(c<60||c>1248)return void u(null);let d=E(c),e=w[0],f=Math.abs(e.t-d);for(let a of w){let b=Math.abs(a.t-d);b<f&&(e=a,f=b)}u({x:C(e.t),t:e.t,u:e.u,remaining:e.remaining})},onMouseLeave:()=>u(null),children:[[0,25,50,75,100].map(a=>{let c=D(a);return(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:60,x2:1248,y1:c,y2:c,stroke:"var(--af-border-subtle)",strokeWidth:"1"}),(0,b.jsxs)("text",{x:50,y:c+4,textAnchor:"end",fontSize:"12",fill:"var(--af-text-tertiary)",children:[a,"%"]})]},a)}),(0,b.jsx)("text",{x:16,y:24+B/2,textAnchor:"middle",transform:`rotate(-90, 16, ${24+B/2})`,fontSize:"12",fill:"var(--af-text-tertiary)",children:"Remaining budget (%)"}),(0,b.jsx)("rect",{x:60,y:D(10),width:A,height:D(0)-D(10),fill:"var(--af-danger)",fillOpacity:"0.07"}),(0,b.jsx)("rect",{x:60,y:D(30),width:A,height:D(10)-D(30),fill:"var(--af-warning)",fillOpacity:"0.05"}),v.map((a,c)=>{let d=F(a.startMs),i=F(a.resetsAtMs),j=D(100-100*(E(d)-a.startMs)/g),k=D(100-100*(E(i)-a.startMs)/g),l=a.points.filter(a=>a.t>=e&&a.t<=f),m=function(a,b,c){if(0===a.length)return"";let d=[],e=!1;for(let f=0;f<a.length;f++){let g=a[f],h=f>0?a[f-1]:null,i=!!h&&g.t-h.t>9e5,j=!e||i?"M":"L";d.push(`${j} ${b(g.t).toFixed(1)} ${c(g.remaining).toFixed(1)}`),e=!0}return d.join(" ")}(l,C,D),n=a.resetsAtMs>=e&&a.resetsAtMs<=f&&a.resetsAtMs<=Date.now();return(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:d,y1:j,x2:i,y2:k,stroke:"var(--af-text-tertiary)",strokeOpacity:"0.35",strokeWidth:"1",strokeDasharray:"3 3"}),m&&(0,b.jsx)("path",{d:m,fill:"none",stroke:h,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),l.map((a,d)=>(0,b.jsx)("circle",{cx:C(a.t),cy:D(a.remaining),r:"1.8",fill:h,fillOpacity:"0.9"},`${c}-${d}`)),a.peakT>=e&&a.peakT<=f&&(0,b.jsx)("circle",{cx:C(a.peakT),cy:D(100-a.peak),r:"3",fill:h,stroke:"var(--background)",strokeWidth:"1.5"}),n&&(0,b.jsx)("line",{x1:C(a.resetsAtMs),y1:24,x2:C(a.resetsAtMs),y2:24+B,stroke:"var(--af-text-tertiary)",strokeOpacity:"0.25",strokeWidth:"1",strokeDasharray:"1 3"})]},`cycle-${c}`)}),(()=>{let a=(l??[]).filter(a=>a.capturedAt>=e&&a.capturedAt<=f).sort((a,b)=>a.capturedAt-b.capturedAt);if(a.length<2)return null;let c=[],d=!1,g=a[0].util;for(let b=0;b<a.length;b++){let e=a[b],f=Math.max(0,Math.min(100,e.util)),h=100-f,i=g-f,j=b>0&&i>=50,k=b>0&&e.capturedAt-a[b-1].capturedAt>36e5,l=!d||j||k?"M":"L";c.push(`${l} ${C(e.capturedAt).toFixed(1)} ${D(h).toFixed(1)}`),d=!0,g=f}return(0,b.jsx)("path",{d:c.join(" "),fill:"none",stroke:"#ff7a00",strokeOpacity:"0.85",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"})})(),Date.now()>=e&&Date.now()<=f&&(0,b.jsx)("line",{x1:C(Date.now()),y1:24,x2:C(Date.now()),y2:24+B,stroke:"var(--af-text-secondary)",strokeOpacity:"0.5",strokeWidth:"1"}),t&&(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:t.x,y1:24,x2:t.x,y2:24+B,stroke:"var(--af-text-secondary)",strokeOpacity:"0.6",strokeWidth:"1",strokeDasharray:"2 2"}),(0,b.jsx)("circle",{cx:t.x,cy:D(t.remaining),r:"5",fill:h,stroke:"var(--background)",strokeWidth:"2"})]}),(0,b.jsx)("text",{x:60,y:300,textAnchor:"start",fontSize:"11",fill:"var(--af-text-tertiary)",suppressHydrationWarning:!0,children:k(e,f-e)}),(0,b.jsx)("text",{x:1248,y:300,textAnchor:"end",fontSize:"11",fill:"var(--af-text-tertiary)",suppressHydrationWarning:!0,children:k(f,f-e)}),(0,b.jsxs)("text",{x:60+A/2,y:314,textAnchor:"middle",fontSize:"11",fill:"var(--af-text-tertiary)",children:["Time · ",v.length," cycle",1===v.length?"":"s"," in view"]})]}),t&&(0,b.jsxs)("div",{suppressHydrationWarning:!0,style:{pointerEvents:"none",position:"absolute",left:`${t.x/1280*100}%`,top:6,transform:"translateX(-50%)",background:"var(--af-surface-elevated)",border:"1px solid var(--af-border-subtle)",borderRadius:8,padding:"8px 12px",fontSize:11,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.24)",whiteSpace:"nowrap",color:"var(--af-text)"},children:[(0,b.jsx)("div",{style:{fontWeight:600},children:new Date(t.t).toLocaleString()}),(0,b.jsxs)("div",{style:{marginTop:2,display:"flex",gap:10},children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Remaining"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:h},children:[t.remaining.toFixed(1),"%"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Used"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums"},children:[t.u.toFixed(1),"%"]})]})]})]})]})]})}function j({label:a,value:c,color:d}){return(0,b.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[(0,b.jsx)("span",{style:{fontSize:9,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--af-text-tertiary)",fontWeight:600},children:a}),(0,b.jsx)("span",{style:{fontSize:18,fontWeight:700,letterSpacing:"-0.01em",color:d,fontVariantNumeric:"tabular-nums"},children:c})]})}function k(a,b){let c=new Date(a);return b<=12096e5?c.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):c.toLocaleDateString(void 0,{month:"short",day:"numeric"})}var l=a.i(5784),m=a.i(50522),n=a.i(2591);function o({storageKey:a,label:c,children:d}){let[e,f,g]=(0,n.usePersistentBoolean)(a,!1);return(0,b.jsxs)("div",{children:[(0,b.jsxs)("button",{type:"button",onClick:()=>f(!e),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",marginBottom:12*!!e,background:"transparent",border:"1px solid var(--af-border-subtle)",borderRadius:6,fontSize:11,fontWeight:600,color:"var(--af-text-secondary)",textTransform:"uppercase",letterSpacing:"0.04em",cursor:"pointer",transition:"background 0.12s, border-color 0.12s"},children:[e?(0,b.jsx)(l.ChevronDown,{size:12}):(0,b.jsx)(m.ChevronRight,{size:12}),e?`Hide ${c}`:`Show ${c}`]}),g&&e&&d]})}let p=[{key:"current",label:"Current cycle"},{key:"24h",label:"24H"},{key:"7d",label:"7D"},{key:"30d",label:"30D"},{key:"90d",label:"90D"},{key:"custom",label:"Custom"}];function q({value:a,onChange:d,windowType:e="short"}){let f="long"===e?p.filter(a=>"24h"!==a.key):p,[g,h]=(0,c.useState)(()=>s(a.startMs??Date.now()-6048e5)),[i,j]=(0,c.useState)(()=>s(a.endMs??Date.now()));return(0,c.useEffect)(()=>{if("custom"!==a.preset)return;let b=t(g),c=t(i);Number.isNaN(b)||Number.isNaN(c)||b>=c||(b!==a.startMs||c!==a.endMs)&&d({preset:"custom",startMs:b,endMs:c})},[g,i,a.preset]),(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[(0,b.jsx)("div",{style:{display:"inline-flex",borderRadius:6,border:"1px solid var(--af-border-subtle)",overflow:"hidden"},children:f.map((c,e)=>(0,b.jsx)("button",{type:"button",onClick:()=>{var a;"custom"===(a=c.key)?d({preset:a,startMs:t(g),endMs:t(i)}):d({preset:a})},style:{padding:"6px 12px",fontSize:11,fontWeight:500,background:a.preset===c.key?"var(--af-accent-subtle)":"transparent",color:a.preset===c.key?"var(--af-accent)":"var(--af-text-secondary)",border:"none",borderRight:e<f.length-1?"1px solid var(--af-border-subtle)":"none",cursor:"pointer",letterSpacing:"0.02em"},children:c.label},c.key))}),"custom"===a.preset&&(0,b.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,b.jsx)("input",{type:"datetime-local",value:g,onChange:a=>h(a.target.value),style:r}),(0,b.jsx)("span",{style:{fontSize:11,color:"var(--af-text-tertiary)"},children:"→"}),(0,b.jsx)("input",{type:"datetime-local",value:i,onChange:a=>j(a.target.value),style:r})]})]})}let r={padding:"5px 8px",fontSize:11,background:"var(--background)",color:"var(--af-text)",border:"1px solid var(--af-border-subtle)",borderRadius:5,fontFamily:"var(--font-mono)"};function s(a){let b=new Date(a),c=b.getFullYear(),d=String(b.getMonth()+1).padStart(2,"0"),e=String(b.getDate()).padStart(2,"0"),f=String(b.getHours()).padStart(2,"0"),g=String(b.getMinutes()).padStart(2,"0");return`${c}-${d}-${e}T${f}:${g}`}function t(a){return new Date(a).getTime()}let u=[{key:"seven_day",label:"7d utilization",windowMs:6048e5,colorVar:"var(--af-accent)"},{key:"five_hour",label:"5h utilization",windowMs:18e6,colorVar:"var(--af-success)"}],v={key:"seven_day_sonnet",label:"7d utilization (Sonnet)",windowMs:6048e5,colorVar:"var(--af-warning)"};function w({config:a,snapshots:e,predictedSeries:f,onClose:g}){let[h,j]=(0,c.useState)({preset:"current"}),k=(0,c.useMemo)(()=>{for(let b=e.length-1;b>=0;b--){let c=e[b][a.key];if(c&&c.resets_at){let b=new Date(c.resets_at).getTime();return{startMs:b-a.windowMs,endMs:b}}}return null},[e,a.key,a.windowMs]),l=function(a){let b=Date.now();switch(a.preset){case"current":return{};case"24h":return{startMs:b-864e5,endMs:b};case"7d":return{startMs:b-6048e5,endMs:b};case"30d":return{startMs:b-2592e6,endMs:b};case"90d":return{startMs:b-7776e6,endMs:b};case"custom":return{startMs:a.startMs,endMs:a.endMs}}}(h),m="current"===h.preset&&k?k:l;return(0,b.jsx)("div",{onClick:g,style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.55)",backdropFilter:"blur(4px)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:32},children:(0,b.jsxs)("div",{onClick:a=>a.stopPropagation(),style:{width:"100%",maxWidth:1600,maxHeight:"calc(100vh - 64px)",background:"var(--background)",border:"1px solid var(--af-border-subtle)",borderRadius:12,boxShadow:"0 24px 64px rgba(0, 0, 0, 0.4)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,padding:"14px 20px",borderBottom:"1px solid var(--af-border-subtle)",flexWrap:"wrap"},children:[(0,b.jsx)("div",{style:{fontSize:14,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--af-text)"},children:a.label}),(0,b.jsx)(q,{value:h,onChange:j,windowType:a.windowMs>=864e5?"long":"short"}),(0,b.jsx)("button",{type:"button",onClick:g,"aria-label":"Close",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:6,background:"transparent",border:"1px solid var(--af-border-subtle)",color:"var(--af-text-secondary)",cursor:"pointer"},children:(0,b.jsx)(d.X,{size:14})})]}),(0,b.jsx)("div",{style:{padding:20,overflow:"auto",flex:1},children:m.startMs&&m.endMs?(0,b.jsx)(i,{snapshots:e,seriesKey:a.key,startMs:m.startMs,endMs:m.endMs,windowMs:a.windowMs,colorVar:a.colorVar,predictedSeries:f}):(0,b.jsx)("div",{className:"af-card",style:{padding:"40px 32px",textAlign:"center",fontSize:12,color:"var(--af-text-tertiary)"},children:"No data available for this window."})})]})})}function x({children:a}){return(0,b.jsx)("div",{style:{fontSize:11,fontWeight:600,color:"var(--af-text)",textTransform:"uppercase",letterSpacing:"0.04em"},children:a})}a.s(["UsageChartsDashboard",0,function({snapshots:a,predicted:d}){let[e,g]=(0,c.useState)(null),h=d??{five_hour:[],seven_day:[],seven_day_sonnet:[]};return(0,c.useEffect)(()=>{if(!e)return;let a=a=>{"Escape"===a.key&&g(null)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e]),(0,c.useEffect)(()=>{if(!e)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[e]),(0,b.jsxs)(b.Fragment,{children:[u.map(c=>(0,b.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,b.jsx)(x,{children:c.label}),(0,b.jsx)(f,{snapshots:a,seriesKey:c.key,windowMs:c.windowMs,colorVar:c.colorVar,predictedSeries:h[c.key],onExpand:()=>g(c)})]},c.key)),(0,b.jsx)(o,{storageKey:"cclens:usage:show-sonnet",label:"Sonnet 7d utilization",children:(0,b.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,b.jsx)(x,{children:v.label}),(0,b.jsx)(f,{snapshots:a,seriesKey:v.key,windowMs:v.windowMs,colorVar:v.colorVar,predictedSeries:h[v.key],onExpand:()=>g(v)})]})}),e&&(0,b.jsx)(w,{config:e,snapshots:a,predictedSeries:h[e.key],onClose:()=>g(null)})]})}],64405)}];
1
+ module.exports=[64405,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(33508);let e=(0,a.i(70106).default)("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);var f=a.i(55555);function g({snapshots:a,seriesKey:d,windowMs:j,colorVar:k,predictedSeries:l,onExpand:m}){let n=(0,c.useMemo)(()=>{let b=a.map(a=>({capturedAt:new Date(a.captured_at).getTime(),window:a[d]})).filter(a=>null!==a.window&&null!==a.window.utilization);if(0===b.length)return null;let c=b[b.length-1],e=c.window.resets_at?new Date(c.window.resets_at).getTime():null;if(!e)return null;let f=e-j,g=Date.now(),h=100-(c.window.utilization??0);return{points:b.filter(a=>a.capturedAt>=f&&a.capturedAt<=e).map(a=>[a.capturedAt,100-(a.window.utilization??0)]),predicted:(l??[]).filter(a=>a.capturedAt>=f&&a.capturedAt<=e).map(a=>[a.capturedAt,100-Math.max(0,Math.min(100,a.util))]).sort((a,b)=>a[0]-b[0]),windowStart:f,windowEnd:e,now:g,currentRemaining:h,latest:c}},[a,d,j,l]),o=1190,p=148,[q,r]=(0,c.useState)(null),[s,t]=(0,c.useState)(!1);if((0,c.useEffect)(()=>t(!0),[]),!n)return(0,b.jsx)("div",{className:"af-card",style:{padding:"14px 18px",textAlign:"center",fontSize:12,color:"var(--af-text-tertiary)"},children:"No data for this window yet."});let{points:u,predicted:v,windowStart:w,windowEnd:x,now:y,currentRemaining:z,latest:A}=n,B=a=>64+(a-w)/(x-w)*o,C=a=>20+p-a/100*p,D=a=>Math.max(0,Math.min(100,100-(a-w)/(x-w)*100)),E=z-D(y),F=(0,f.paceLabel)(E),G=(0,f.toneVar)(F.tone),H=F.label,I=u.length>0?u.map(([a,b],c)=>`${0===c?"M":"L"} ${B(a).toFixed(1)} ${C(b).toFixed(1)}`).join(" "):"",J=v.length>1?v.map(([a,b],c)=>`${0===c?"M":"L"} ${B(a).toFixed(1)} ${C(b).toFixed(1)}`).join(" "):"",K=u.length>0?`${I} L ${B(u[u.length-1][0]).toFixed(1)} ${C(0).toFixed(1)} L ${B(u[0][0]).toFixed(1)} ${C(0).toFixed(1)} Z`:"";return(0,b.jsxs)("div",{className:"af-card",style:{padding:"14px 18px"},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:14,flexWrap:"wrap",marginBottom:8},children:[(0,b.jsxs)("div",{style:{fontSize:18,fontWeight:700,letterSpacing:"-0.01em",color:k,fontVariantNumeric:"tabular-nums"},children:[z.toFixed(1),"%",(0,b.jsx)("span",{style:{fontSize:11,fontWeight:500,color:"var(--af-text-tertiary)",marginLeft:4,letterSpacing:0},children:"remaining"})]}),(0,b.jsx)("div",{suppressHydrationWarning:!0,style:{fontSize:11,color:G,fontWeight:500},children:s&&(0,b.jsxs)(b.Fragment,{children:[H," (",E>=0?"+":"",E.toFixed(1),"pp)"]})}),(0,b.jsxs)("div",{suppressHydrationWarning:!0,style:{fontSize:11,color:"var(--af-text-tertiary)",marginLeft:"auto"},children:[function(a){let b=a/36e5;if(b<24)return`${b} hour${1===b?"":"s"}`;let c=b/24;return`${c} day${1===c?"":"s"}`}(j)," · resets"," ",i(new Date(x).toISOString())]}),m&&(0,b.jsx)("button",{type:"button",onClick:m,"aria-label":"Expand chart",title:"Expand",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:5,background:"transparent",border:"1px solid var(--af-border-subtle)",color:"var(--af-text-tertiary)",cursor:"pointer",marginLeft:4},children:(0,b.jsx)(e,{size:12})})]}),(0,b.jsxs)("div",{style:{position:"relative"},children:[(0,b.jsxs)("svg",{viewBox:"0 0 1280 200",style:{width:"100%",aspectRatio:"1280 / 200",display:"block"},onMouseMove:a=>{let b=a.currentTarget.getBoundingClientRect(),c=(a.clientX-b.left)/b.width*1280;if(c<64||c>1254)return void r(null);let d=w+(c-64)/o*(x-w),e=u[0],f=Math.abs(e[0]-d);for(let a of u){let b=Math.abs(a[0]-d);b<f&&(e=a,f=b)}let g=null;if(v.length>0){let a=v[0],b=Math.abs(a[0]-e[0]);for(let c of v){let d=Math.abs(c[0]-e[0]);d<b&&(a=c,b=d)}g=a[1]}r({x:B(e[0]),t:e[0],actual:e[1],ideal:D(e[0]),predicted:g})},onMouseLeave:()=>r(null),children:[[0,25,50,75,100].map(a=>{let c=C(a);return(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:64,x2:1254,y1:c,y2:c,stroke:"var(--af-border-subtle)",strokeWidth:"1"}),(0,b.jsxs)("text",{x:56,y:c+4,textAnchor:"end",fontSize:"13",fill:"var(--af-text-tertiary)",children:[a,"%"]})]},a)}),(0,b.jsx)("text",{x:14,y:20+p/2,textAnchor:"middle",transform:`rotate(-90, 14, ${20+p/2})`,fontSize:"12",fill:"var(--af-text-tertiary)",children:"Remaining budget (%)"}),(0,b.jsx)("text",{x:64,y:180,textAnchor:"start",fontSize:"12",fill:"var(--af-text-tertiary)",suppressHydrationWarning:!0,children:h(w)}),(0,b.jsx)("text",{x:1254,y:180,textAnchor:"end",fontSize:"12",fill:"var(--af-text-tertiary)",suppressHydrationWarning:!0,children:h(x)}),(0,b.jsx)("path",{d:K,fill:k,fillOpacity:"0.1"}),(0,b.jsx)("line",{x1:B(w),y1:C(100),x2:B(x),y2:C(0),stroke:"var(--af-text-tertiary)",strokeOpacity:"0.5",strokeWidth:"1.5",strokeDasharray:"4 3"}),s&&y>=w&&y<=x&&(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:B(y),y1:20,x2:B(y),y2:20+p,stroke:"var(--af-text-secondary)",strokeOpacity:"0.5",strokeWidth:"1"}),(0,b.jsx)("text",{x:B(y),y:14,textAnchor:"middle",fontSize:"12",fontWeight:"600",fill:"var(--af-text-secondary)",children:"now"})]}),(0,b.jsx)("path",{d:I,fill:"none",stroke:k,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.map(([a,c],d)=>(0,b.jsx)("circle",{cx:B(a),cy:C(c),r:"3",fill:k},d)),J&&(0,b.jsx)("path",{d:J,fill:"none",stroke:"#ff7a00",strokeOpacity:"0.9",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"}),q&&(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:q.x,y1:20,x2:q.x,y2:20+p,stroke:"var(--af-text-secondary)",strokeOpacity:"0.7",strokeWidth:"1",strokeDasharray:"2 2"}),(0,b.jsx)("circle",{cx:q.x,cy:C(q.actual),r:"5",fill:k,stroke:"var(--af-surface)",strokeWidth:"1.5"})]})]}),q&&(0,b.jsxs)("div",{style:{pointerEvents:"none",position:"absolute",left:`${q.x/1280*100}%`,top:4,transform:"translateX(-50%)",background:"var(--af-surface-elevated)",border:"1px solid var(--af-border-subtle)",borderRadius:8,padding:"8px 12px",fontSize:11,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.24)",whiteSpace:"nowrap",color:"var(--af-text)"},children:[(0,b.jsx)("div",{style:{fontWeight:600},children:new Date(q.t).toLocaleString()}),(0,b.jsxs)("div",{style:{marginTop:4,display:"flex",gap:12},children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Actual"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:k},children:[q.actual.toFixed(1),"%"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Ideal"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums"},children:[q.ideal.toFixed(1),"%"]})]}),null!==q.predicted&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Estimated"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:"#b58400"},children:[q.predicted.toFixed(1),"%"]})]})]}),(0,b.jsxs)("div",{style:{marginTop:2,color:"var(--af-text-tertiary)"},children:["Δ ",q.actual-q.ideal>=0?"+":"",(q.actual-q.ideal).toFixed(1),"%",null!==q.predicted&&(0,b.jsxs)("span",{style:{marginLeft:8},children:["· estimate ",q.predicted>=q.actual?"+":"",(q.predicted-q.actual).toFixed(1),"pp vs actual"]})]})]})]}),(0,b.jsxs)("div",{style:{marginTop:4,fontSize:9,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)",textAlign:"right"},suppressHydrationWarning:!0,children:[u.length," snapshot",1===u.length?"":"s"," · last"," ",i(new Date(A.capturedAt).toISOString()),v.length>0&&(0,b.jsxs)("span",{style:{marginLeft:8,color:"#ff7a00"},children:["· ",v.length," estimate",1===v.length?"":"s"," overlaid"]})]})]})}function h(a){return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function i(a){let b,c=Math.round((new Date(a).getTime()-Date.now())/1e3),d=Math.abs(c);if(d<60)b=`${d}s`;else if(d<3600)b=`${Math.floor(d/60)}m`;else if(d<86400){let a=Math.floor(d/3600),c=Math.floor(d%3600/60);b=c>0?`${a}h${c}m`:`${a}h`}else{let a=Math.floor(d/86400),c=Math.floor(d%86400/3600);b=c>0?`${a}d${c}h`:`${a}d`}return c<0?`${b} ago`:`in ${b}`}function j({snapshots:a,seriesKey:d,startMs:e,endMs:f,windowMs:g,colorVar:h,predictedSeries:i}){var m,n;let o,p,q,r,s=(0,c.useMemo)(()=>{let b=[];for(let c of a){let a=new Date(c.captured_at).getTime(),e=c[d];e&&null!==e.utilization&&b.push({t:a,u:e.utilization,resetsAt:e.resets_at})}if(0===b.length)return null;let c=new Map;for(let a of b){if(!a.resetsAt)continue;let b=new Date(a.resetsAt).getTime();if(Number.isNaN(b))continue;let d=36e5*Math.round(b/36e5),e=c.get(d);e||(e=[],c.set(d,e)),e.push(a)}let h=[];for(let[a,b]of c){let c=a-g;b.sort((a,b)=>a.t-b.t);let d=b.map(a=>({t:a.t,u:a.u,remaining:100-a.u})),e=0;for(let a=1;a<d.length;a++)d[a].u>d[e].u&&(e=a);h.push({resetsAtMs:a,startMs:c,points:d,peak:d[e].u,peakT:d[e].t})}let i=h.filter(a=>a.resetsAtMs>=e&&a.startMs<=f).sort((a,b)=>a.resetsAtMs-b.resetsAtMs);if(0===i.length)return null;let j=i.flatMap(a=>a.points),k=Math.max(...j.map(a=>a.u)),l=i.filter(a=>a.resetsAtMs<=f&&a.resetsAtMs<Date.now()).length,m=i.length>0?i.reduce((a,b)=>a+b.peak,0)/i.length:0;return{cycles:i,allPoints:j,peakOverall:k,avgPeak:m,completeCycles:l}},[a,d,e,f,g]),[t,u]=(0,c.useState)(null);if(!s)return(0,b.jsx)("div",{className:"af-card",style:{padding:"40px 32px",textAlign:"center",fontSize:12,color:"var(--af-text-tertiary)"},children:"No usage data in the selected range."});let{cycles:v,allPoints:w,peakOverall:x,avgPeak:y,completeCycles:z}=s,A=1188,B=252,C=a=>60+(a-e)/(f-e)*A,D=a=>24+B-a/100*B,E=a=>e+(a-60)/A*(f-e),F=a=>{let b=C(a);return b<60?60:b>1248?1248:b};return(0,b.jsxs)("div",{className:"af-card",style:{padding:"14px 18px",display:"flex",flexDirection:"column",gap:10},children:[(0,b.jsx)("div",{suppressHydrationWarning:!0,style:{fontSize:11,color:"var(--af-text-tertiary)",fontFamily:"var(--font-mono)"},children:(m=e,n=f,p=new Date(m).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),q=new Date(n).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),o=(r=n-m)<36e5?`${Math.round(r/6e4)}m`:r<864e5?`${(r/36e5).toFixed(1).replace(/\.0$/,"")}h`:`${(r/864e5).toFixed(1).replace(/\.0$/,"")}d`,`${p} → ${q} (${o})`)}),(0,b.jsxs)("div",{style:{display:"flex",gap:28,fontSize:11,color:"var(--af-text-tertiary)",flexWrap:"wrap"},children:[(0,b.jsx)(k,{label:"Peak utilization",value:`${x.toFixed(1)}%`,color:h}),(0,b.jsx)(k,{label:"Avg peak / cycle",value:v.length>0?`${y.toFixed(1)}%`:"—",color:h}),(0,b.jsx)(k,{label:"Complete cycles",value:String(z),color:"var(--af-text)"}),(0,b.jsx)(k,{label:"Data points",value:String(w.length),color:"var(--af-text)"})]}),(0,b.jsxs)("div",{style:{position:"relative"},children:[(0,b.jsxs)("svg",{viewBox:"0 0 1280 320",style:{width:"100%",aspectRatio:"1280 / 320",display:"block"},onMouseMove:a=>{let b=a.currentTarget.getBoundingClientRect(),c=(a.clientX-b.left)/b.width*1280;if(c<60||c>1248)return void u(null);let d=E(c),e=w[0],f=Math.abs(e.t-d);for(let a of w){let b=Math.abs(a.t-d);b<f&&(e=a,f=b)}u({x:C(e.t),t:e.t,u:e.u,remaining:e.remaining})},onMouseLeave:()=>u(null),children:[[0,25,50,75,100].map(a=>{let c=D(a);return(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:60,x2:1248,y1:c,y2:c,stroke:"var(--af-border-subtle)",strokeWidth:"1"}),(0,b.jsxs)("text",{x:50,y:c+4,textAnchor:"end",fontSize:"12",fill:"var(--af-text-tertiary)",children:[a,"%"]})]},a)}),(0,b.jsx)("text",{x:16,y:24+B/2,textAnchor:"middle",transform:`rotate(-90, 16, ${24+B/2})`,fontSize:"12",fill:"var(--af-text-tertiary)",children:"Remaining budget (%)"}),(0,b.jsx)("rect",{x:60,y:D(10),width:A,height:D(0)-D(10),fill:"var(--af-danger)",fillOpacity:"0.07"}),(0,b.jsx)("rect",{x:60,y:D(30),width:A,height:D(10)-D(30),fill:"var(--af-warning)",fillOpacity:"0.05"}),v.map((a,c)=>{let d=F(a.startMs),i=F(a.resetsAtMs),j=D(100-100*(E(d)-a.startMs)/g),k=D(100-100*(E(i)-a.startMs)/g),l=a.points.filter(a=>a.t>=e&&a.t<=f),m=function(a,b,c){if(0===a.length)return"";let d=[],e=!1;for(let f=0;f<a.length;f++){let g=a[f],h=f>0?a[f-1]:null,i=!!h&&g.t-h.t>9e5,j=!e||i?"M":"L";d.push(`${j} ${b(g.t).toFixed(1)} ${c(g.remaining).toFixed(1)}`),e=!0}return d.join(" ")}(l,C,D),n=a.resetsAtMs>=e&&a.resetsAtMs<=f&&a.resetsAtMs<=Date.now();return(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:d,y1:j,x2:i,y2:k,stroke:"var(--af-text-tertiary)",strokeOpacity:"0.35",strokeWidth:"1",strokeDasharray:"3 3"}),m&&(0,b.jsx)("path",{d:m,fill:"none",stroke:h,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),l.map((a,d)=>(0,b.jsx)("circle",{cx:C(a.t),cy:D(a.remaining),r:"1.8",fill:h,fillOpacity:"0.9"},`${c}-${d}`)),a.peakT>=e&&a.peakT<=f&&(0,b.jsx)("circle",{cx:C(a.peakT),cy:D(100-a.peak),r:"3",fill:h,stroke:"var(--background)",strokeWidth:"1.5"}),n&&(0,b.jsx)("line",{x1:C(a.resetsAtMs),y1:24,x2:C(a.resetsAtMs),y2:24+B,stroke:"var(--af-text-tertiary)",strokeOpacity:"0.25",strokeWidth:"1",strokeDasharray:"1 3"})]},`cycle-${c}`)}),(()=>{let a=(i??[]).filter(a=>a.capturedAt>=e&&a.capturedAt<=f).sort((a,b)=>a.capturedAt-b.capturedAt);if(a.length<2)return null;let c=[],d=!1,g=a[0].util;for(let b=0;b<a.length;b++){let e=a[b],f=Math.max(0,Math.min(100,e.util)),h=100-f,i=g-f,j=b>0&&i>=50,k=b>0&&e.capturedAt-a[b-1].capturedAt>36e5,l=!d||j||k?"M":"L";c.push(`${l} ${C(e.capturedAt).toFixed(1)} ${D(h).toFixed(1)}`),d=!0,g=f}return(0,b.jsx)("path",{d:c.join(" "),fill:"none",stroke:"#ff7a00",strokeOpacity:"0.85",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"5 4"})})(),Date.now()>=e&&Date.now()<=f&&(0,b.jsx)("line",{x1:C(Date.now()),y1:24,x2:C(Date.now()),y2:24+B,stroke:"var(--af-text-secondary)",strokeOpacity:"0.5",strokeWidth:"1"}),t&&(0,b.jsxs)("g",{children:[(0,b.jsx)("line",{x1:t.x,y1:24,x2:t.x,y2:24+B,stroke:"var(--af-text-secondary)",strokeOpacity:"0.6",strokeWidth:"1",strokeDasharray:"2 2"}),(0,b.jsx)("circle",{cx:t.x,cy:D(t.remaining),r:"5",fill:h,stroke:"var(--background)",strokeWidth:"2"})]}),(0,b.jsx)("text",{x:60,y:300,textAnchor:"start",fontSize:"11",fill:"var(--af-text-tertiary)",suppressHydrationWarning:!0,children:l(e,f-e)}),(0,b.jsx)("text",{x:1248,y:300,textAnchor:"end",fontSize:"11",fill:"var(--af-text-tertiary)",suppressHydrationWarning:!0,children:l(f,f-e)}),(0,b.jsxs)("text",{x:60+A/2,y:314,textAnchor:"middle",fontSize:"11",fill:"var(--af-text-tertiary)",children:["Time · ",v.length," cycle",1===v.length?"":"s"," in view"]})]}),t&&(0,b.jsxs)("div",{suppressHydrationWarning:!0,style:{pointerEvents:"none",position:"absolute",left:`${t.x/1280*100}%`,top:6,transform:"translateX(-50%)",background:"var(--af-surface-elevated)",border:"1px solid var(--af-border-subtle)",borderRadius:8,padding:"8px 12px",fontSize:11,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.24)",whiteSpace:"nowrap",color:"var(--af-text)"},children:[(0,b.jsx)("div",{style:{fontWeight:600},children:new Date(t.t).toLocaleString()}),(0,b.jsxs)("div",{style:{marginTop:2,display:"flex",gap:10},children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Remaining"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:h},children:[t.remaining.toFixed(1),"%"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{style:{color:"var(--af-text-tertiary)"},children:"Used"})," ",(0,b.jsxs)("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums"},children:[t.u.toFixed(1),"%"]})]})]})]})]})]})}function k({label:a,value:c,color:d}){return(0,b.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[(0,b.jsx)("span",{style:{fontSize:9,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--af-text-tertiary)",fontWeight:600},children:a}),(0,b.jsx)("span",{style:{fontSize:18,fontWeight:700,letterSpacing:"-0.01em",color:d,fontVariantNumeric:"tabular-nums"},children:c})]})}function l(a,b){let c=new Date(a);return b<=12096e5?c.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):c.toLocaleDateString(void 0,{month:"short",day:"numeric"})}var m=a.i(5784),n=a.i(50522),o=a.i(2591);function p({storageKey:a,label:c,children:d}){let[e,f,g]=(0,o.usePersistentBoolean)(a,!1);return(0,b.jsxs)("div",{children:[(0,b.jsxs)("button",{type:"button",onClick:()=>f(!e),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",marginBottom:12*!!e,background:"transparent",border:"1px solid var(--af-border-subtle)",borderRadius:6,fontSize:11,fontWeight:600,color:"var(--af-text-secondary)",textTransform:"uppercase",letterSpacing:"0.04em",cursor:"pointer",transition:"background 0.12s, border-color 0.12s"},children:[e?(0,b.jsx)(m.ChevronDown,{size:12}):(0,b.jsx)(n.ChevronRight,{size:12}),e?`Hide ${c}`:`Show ${c}`]}),g&&e&&d]})}let q=[{key:"current",label:"Current cycle"},{key:"24h",label:"24H"},{key:"7d",label:"7D"},{key:"30d",label:"30D"},{key:"90d",label:"90D"},{key:"custom",label:"Custom"}];function r({value:a,onChange:d,windowType:e="short"}){let f="long"===e?q.filter(a=>"24h"!==a.key):q,[g,h]=(0,c.useState)(()=>t(a.startMs??Date.now()-6048e5)),[i,j]=(0,c.useState)(()=>t(a.endMs??Date.now()));return(0,c.useEffect)(()=>{if("custom"!==a.preset)return;let b=u(g),c=u(i);Number.isNaN(b)||Number.isNaN(c)||b>=c||(b!==a.startMs||c!==a.endMs)&&d({preset:"custom",startMs:b,endMs:c})},[g,i,a.preset]),(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[(0,b.jsx)("div",{style:{display:"inline-flex",borderRadius:6,border:"1px solid var(--af-border-subtle)",overflow:"hidden"},children:f.map((c,e)=>(0,b.jsx)("button",{type:"button",onClick:()=>{var a;"custom"===(a=c.key)?d({preset:a,startMs:u(g),endMs:u(i)}):d({preset:a})},style:{padding:"6px 12px",fontSize:11,fontWeight:500,background:a.preset===c.key?"var(--af-accent-subtle)":"transparent",color:a.preset===c.key?"var(--af-accent)":"var(--af-text-secondary)",border:"none",borderRight:e<f.length-1?"1px solid var(--af-border-subtle)":"none",cursor:"pointer",letterSpacing:"0.02em"},children:c.label},c.key))}),"custom"===a.preset&&(0,b.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,b.jsx)("input",{type:"datetime-local",value:g,onChange:a=>h(a.target.value),style:s}),(0,b.jsx)("span",{style:{fontSize:11,color:"var(--af-text-tertiary)"},children:"→"}),(0,b.jsx)("input",{type:"datetime-local",value:i,onChange:a=>j(a.target.value),style:s})]})]})}let s={padding:"5px 8px",fontSize:11,background:"var(--background)",color:"var(--af-text)",border:"1px solid var(--af-border-subtle)",borderRadius:5,fontFamily:"var(--font-mono)"};function t(a){let b=new Date(a),c=b.getFullYear(),d=String(b.getMonth()+1).padStart(2,"0"),e=String(b.getDate()).padStart(2,"0"),f=String(b.getHours()).padStart(2,"0"),g=String(b.getMinutes()).padStart(2,"0");return`${c}-${d}-${e}T${f}:${g}`}function u(a){return new Date(a).getTime()}let v=[{key:"seven_day",label:"7d utilization",windowMs:6048e5,colorVar:"var(--af-accent)"},{key:"five_hour",label:"5h utilization",windowMs:18e6,colorVar:"var(--af-success)"}],w={key:"seven_day_sonnet",label:"7d utilization (Sonnet)",windowMs:6048e5,colorVar:"var(--af-warning)"};function x({config:a,snapshots:e,predictedSeries:f,onClose:g}){let[h,i]=(0,c.useState)({preset:"current"}),k=(0,c.useMemo)(()=>{for(let b=e.length-1;b>=0;b--){let c=e[b][a.key];if(c&&c.resets_at){let b=new Date(c.resets_at).getTime();return{startMs:b-a.windowMs,endMs:b}}}return null},[e,a.key,a.windowMs]),l=function(a){let b=Date.now();switch(a.preset){case"current":return{};case"24h":return{startMs:b-864e5,endMs:b};case"7d":return{startMs:b-6048e5,endMs:b};case"30d":return{startMs:b-2592e6,endMs:b};case"90d":return{startMs:b-7776e6,endMs:b};case"custom":return{startMs:a.startMs,endMs:a.endMs}}}(h),m="current"===h.preset&&k?k:l;return(0,b.jsx)("div",{onClick:g,style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.55)",backdropFilter:"blur(4px)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:32},children:(0,b.jsxs)("div",{onClick:a=>a.stopPropagation(),style:{width:"100%",maxWidth:1600,maxHeight:"calc(100vh - 64px)",background:"var(--background)",border:"1px solid var(--af-border-subtle)",borderRadius:12,boxShadow:"0 24px 64px rgba(0, 0, 0, 0.4)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,padding:"14px 20px",borderBottom:"1px solid var(--af-border-subtle)",flexWrap:"wrap"},children:[(0,b.jsx)("div",{style:{fontSize:14,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--af-text)"},children:a.label}),(0,b.jsx)(r,{value:h,onChange:i,windowType:a.windowMs>=864e5?"long":"short"}),(0,b.jsx)("button",{type:"button",onClick:g,"aria-label":"Close",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:6,background:"transparent",border:"1px solid var(--af-border-subtle)",color:"var(--af-text-secondary)",cursor:"pointer"},children:(0,b.jsx)(d.X,{size:14})})]}),(0,b.jsx)("div",{style:{padding:20,overflow:"auto",flex:1},children:m.startMs&&m.endMs?(0,b.jsx)(j,{snapshots:e,seriesKey:a.key,startMs:m.startMs,endMs:m.endMs,windowMs:a.windowMs,colorVar:a.colorVar,predictedSeries:f}):(0,b.jsx)("div",{className:"af-card",style:{padding:"40px 32px",textAlign:"center",fontSize:12,color:"var(--af-text-tertiary)"},children:"No data available for this window."})})]})})}function y({children:a}){return(0,b.jsx)("div",{style:{fontSize:11,fontWeight:600,color:"var(--af-text)",textTransform:"uppercase",letterSpacing:"0.04em"},children:a})}a.s(["UsageChartsDashboard",0,function({snapshots:a,predicted:d}){let[e,f]=(0,c.useState)(null),h=d??{five_hour:[],seven_day:[],seven_day_sonnet:[]};return(0,c.useEffect)(()=>{if(!e)return;let a=a=>{"Escape"===a.key&&f(null)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e]),(0,c.useEffect)(()=>{if(!e)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[e]),(0,b.jsxs)(b.Fragment,{children:[v.map(c=>(0,b.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,b.jsx)(y,{children:c.label}),(0,b.jsx)(g,{snapshots:a,seriesKey:c.key,windowMs:c.windowMs,colorVar:c.colorVar,predictedSeries:h[c.key],onExpand:()=>f(c)})]},c.key)),(0,b.jsx)(p,{storageKey:"cclens:usage:show-sonnet",label:"Sonnet 7d utilization",children:(0,b.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,b.jsx)(y,{children:w.label}),(0,b.jsx)(g,{snapshots:a,seriesKey:w.key,windowMs:w.windowMs,colorVar:w.colorVar,predictedSeries:h[w.key],onExpand:()=>f(w)})]})}),e&&(0,b.jsx)(x,{config:e,snapshots:a,predictedSeries:h[e.key],onClose:()=>f(null)})]})}],64405)}];
2
2
 
3
3
  //# sourceMappingURL=apps_web_components_usage-charts-dashboard_tsx_0bgr_uv._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[70709,a=>{"use strict";var b=a.i(717),c=a.i(2157),d=a.i(50227),e=a.i(60526);let f=(0,b.cache)(()=>{let a=process.env.CCLENS_USAGE_LOG||(0,d.join)((0,e.homedir)(),".cclens","usage.jsonl");if(!(0,c.existsSync)(a))return[];let b=(0,c.readFileSync)(a,"utf8"),f=[];for(let a of b.split("\n"))if(a.trim())try{f.push(JSON.parse(a))}catch{}return f}),g=(0,b.cache)(()=>{let a=f().filter(a=>(a.agent??"claude-code")==="claude-code");return a.length>0?a[a.length-1]:null}),h=(0,b.cache)(a=>{let b=f().filter(b=>(b.agent??"claude-code")===a);return b.length>0?b[b.length-1]:null}),i=(0,b.cache)(a=>f().filter(b=>(b.agent??"claude-code")===a)),j=(0,b.cache)(()=>{let a=process.env.CCLENS_PROFILE_CACHE||(0,d.join)((0,e.homedir)(),".cclens","profile.json");if(!(0,c.existsSync)(a))return null;try{let b=JSON.parse((0,c.readFileSync)(a,"utf8"));if(!b.profile?.planTier)return null;return{planTier:b.profile.planTier,rateLimitTier:b.profile.rateLimitTier??null,organizationType:b.profile.organizationType??null,fetchedAtMs:"number"==typeof b.fetchedAtMs?b.fetchedAtMs:0}}catch{return null}});a.s(["PLAN_TIER_LABELS",0,{pro:{label:"Claude Pro",monthlyPriceUsd:20},"pro-max":{label:"Claude Pro Max",monthlyPriceUsd:100},"pro-max-20x":{label:"Claude Pro Max 20x",monthlyPriceUsd:200},custom:{label:"Custom plan",monthlyPriceUsd:0}},"latestUsageSnapshot",0,g,"latestUsageSnapshotByAgent",0,h,"readCachedPlanTier",0,j,"readUsageSnapshots",0,f,"readUsageSnapshotsByAgent",0,i])},40095,a=>{"use strict";let b=/^##\s+\[([^\]]+)\](?:\s+[—\-–]\s+(\S+))?\s*$/,c=/^###\s+(.+?)\s*$/,d=/^[-*]\s+(.+?)\s*$/,e=function(a){let e=a.split(/\r?\n/),f=[],g=null,h=null,i=[];function j(){h&&i.length>0&&(h.bullets.push(i.join(" ").trim()),i=[])}for(let a of e){let e=b.exec(a);if(e){j(),h=null,g={version:e[1].trim(),date:e[2]?.trim()??null,sections:[]},f.push(g);continue}if(!g)continue;let k=c.exec(a);if(k){j(),h={kind:k[1].trim(),bullets:[]},g.sections.push(h);continue}let l=d.exec(a);if(l){j(),i=[l[1]];continue}i.length>0&&a.trim().length>0&&i.push(a.trim())}return j(),f}("# Changelog\n\nAll notable user-facing changes to the Fleetlens CLI (`fleetlens` on npm) are\nrecorded here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).\nThe team-server has its own log at `packages/team-server/CHANGELOG.md`.\n\n## [0.9.0] — 2026-05-07\n\n### Added\n- **Gemini CLI** as the third agent source. Sessions written to `~/.gemini/tmp/<slug>/chats/session-*.jsonl` are now read, parsed, and rendered alongside Claude Code and Codex. Tool calls (`read_file`, `list_directory`, `glob`, `run_shell_command`, `update_topic`, …) and their results show in the session timeline; thinking blocks, multi-write status replay, `$set` / `$rewindTo` semantics, and the legacy single-JSON file shape all handled. Slug → cwd inversion via `~/.gemini/projects.json`. `✺` glyph + purple accent in the UI.\n\n### Changed\n- Session detail timeline drops in-turn idle hatching. Within a turn, every wait — model loading, tool execution, network — is the agent's active time. Only between-turn idle (user reading + composing the next message) renders as hatched.\n- Gemini parser anchors `firstTimestamp`, `lastTimestamp`, and `activeSegments` on conversational events only. Login/OAuth `info` records and `metadata.startTime` (file-creation moment) no longer stretch the session bar back to before the first user message.\n\n## [0.7.1] — 2026-05-07\n\n### Fixed\n- Cycle-peaks trend no longer renders two bars labeled the same day. When Anthropic's rolling 7-day window slid its anchor between consecutive polls, the daemon's bucketer (hour-rounded) recorded both reset boundaries as distinct cycles. They're now merged within a 12 h tolerance — same fix in `apps/web/lib/cycle-peaks.ts` (used by `/usage`) and in `packages/cli/src/team/sync.ts` (the daemon's team-server push), so both the personal `/usage` chart and the team-server's plan-utilization view stay consistent. 5-hour cycles keep no merge tolerance (their anchor is stable; merging would collapse legitimate distinct cycles).\n\n## [0.6.4] — 2026-05-04\n\n### Fixed\n- Cached calibration events per-file so `/usage` warm renders complete in well under a second on large session histories.\n\n## [0.6.3] — 2026-05-04\n\n### Fixed\n- Dropped poisoned auto-week locks left behind by interrupted runs; backfill now gates on the live pipeline lock instead.\n\n## [0.6.2] — 2026-05-04\n\n### Added\n- Last week's digest auto-generates on launch when AI features are on. Disable in Settings → AI features.\n\n## [0.6.1] — 2026-05-04\n\n### Changed\n- Smaller install size — published bundle no longer drags in unused workspace metadata.\n\n## [0.6.0] — 2026-04-30\n\n### Added\n- V2 perception layer. Daily, weekly, and monthly digests synthesized from per-session entries via a strict hierarchical pipeline (entry → day → week → month). Past-period digests are immutable on disk; current-period digests use a 10-min in-memory TTL.\n- `/insights` route with on-demand week and month digest generation, picker history, and force-regen.\n- `fleetlens digest day | week | month [--json]` — CLI surface that reproduces the same digests served at `/insights`.\n- `fleetlens entries [--day | --session | --all] [--json]` — inspect the per-session entry primitive.\n\n### Changed\n- Renamed \"active time\" to \"agent time\" across the dashboard and CLI for clarity.\n\n## [0.4.1] — 2026-04-23\n\n### Added\n- Concurrency view on `/parallelism` page. Bursts colored teal for same-project and purple for cross-project (the genuinely interesting fleet-work signal).\n- Plan utilization sparkline on the sidebar, fed by the usage daemon's 5-min snapshots.\n\n### Fixed\n- Auto-update no longer leaves a zombie web server on the old binary; both server and daemon are torn down before re-exec.\n\n## [0.4.0] — 2026-04-18\n\n### Added\n- Usage daemon (`fleetlens daemon …`) polls `/api/oauth/usage` every 5 min and appends snapshots to `~/.cclens/usage.jsonl`. `fleetlens start` and `fleetlens stop` manage server + daemon together.\n- `fleetlens usage --history` for inspecting past plan utilization.\n\n## [0.3.0] — 2026-04-10\n\n### Added\n- Project rollups with worktree aggregation. Sessions inside `<project>/.worktrees/<name>` roll up under their parent canonical project with a `+N wt` badge.\n- Pinned projects in the sidebar (per-browser via localStorage).\n\n## [0.2.0] — 2026-04-01\n\n### Changed\n- Active-segment computation now uses all timestamped events (system + summary + sidechain + conversational) instead of conversational-only. Earlier filter undercounted by up to 100x on tool-heavy sessions.\n\n## [0.1.0] — 2026-03-15\n\n### Added\n- Initial release. Local-only dashboard for Claude Code sessions: timeline, projects, daily activity bucketing, parallelism detection, per-model cost estimation. Reads JSONL transcripts from `~/.claude/projects/`.\n"),f=e[0]?.version??null;a.s(["ENTRIES",0,e,"LATEST_VERSION",0,f],40095)}];
1
+ module.exports=[70709,a=>{"use strict";var b=a.i(717),c=a.i(2157),d=a.i(23895);let e=(0,b.cache)(()=>{let a=process.env.CCLENS_USAGE_LOG||(0,d.cclensPath)("usage.jsonl");if(!(0,c.existsSync)(a))return[];let b=(0,c.readFileSync)(a,"utf8"),e=[];for(let a of b.split("\n"))if(a.trim())try{e.push(JSON.parse(a))}catch{}return e}),f=(0,b.cache)(()=>{let a=e().filter(a=>(a.agent??"claude-code")==="claude-code");return a.length>0?a[a.length-1]:null}),g=(0,b.cache)(a=>{let b=e().filter(b=>(b.agent??"claude-code")===a);return b.length>0?b[b.length-1]:null}),h=(0,b.cache)(a=>e().filter(b=>(b.agent??"claude-code")===a)),i=(0,b.cache)(()=>{let a=process.env.CCLENS_PROFILE_CACHE||(0,d.cclensPath)("profile.json");if(!(0,c.existsSync)(a))return null;try{let b=JSON.parse((0,c.readFileSync)(a,"utf8"));if(!b.profile?.planTier)return null;return{planTier:b.profile.planTier,rateLimitTier:b.profile.rateLimitTier??null,organizationType:b.profile.organizationType??null,fetchedAtMs:"number"==typeof b.fetchedAtMs?b.fetchedAtMs:0}}catch{return null}});a.s(["PLAN_TIER_LABELS",0,{pro:{label:"Claude Pro",monthlyPriceUsd:20},"pro-max":{label:"Claude Pro Max",monthlyPriceUsd:100},"pro-max-20x":{label:"Claude Pro Max 20x",monthlyPriceUsd:200},custom:{label:"Custom plan",monthlyPriceUsd:0}},"latestUsageSnapshot",0,f,"latestUsageSnapshotByAgent",0,g,"readCachedPlanTier",0,i,"readUsageSnapshots",0,e,"readUsageSnapshotsByAgent",0,h])},40095,a=>{"use strict";let b=/^##\s+\[([^\]]+)\](?:\s+[—\-–]\s+(\S+))?\s*$/,c=/^###\s+(.+?)\s*$/,d=/^[-*]\s+(.+?)\s*$/,e=function(a){let e=a.split(/\r?\n/),f=[],g=null,h=null,i=[];function j(){h&&i.length>0&&(h.bullets.push(i.join(" ").trim()),i=[])}for(let a of e){let e=b.exec(a);if(e){j(),h=null,g={version:e[1].trim(),date:e[2]?.trim()??null,sections:[]},f.push(g);continue}if(!g)continue;let k=c.exec(a);if(k){j(),h={kind:k[1].trim(),bullets:[]},g.sections.push(h);continue}let l=d.exec(a);if(l){j(),i=[l[1]];continue}i.length>0&&a.trim().length>0&&i.push(a.trim())}return j(),f}('# Changelog\n\nAll notable user-facing changes to the Fleetlens CLI (`fleetlens` on npm) are\nrecorded here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).\nThe team-server has its own log at `packages/team-server/CHANGELOG.md`.\n\n## [0.10.1] — 2026-05-14\n\n### Added\n- **Alternative claude runtime via tmux.** When `tmux` is on PATH, both the LLM pipeline (digest synth, entry enrichment, top-session perception) and the `/ask` feature now drive `claude` through a detached tmux session instead of `claude -p`. Sessions produced this way carry `entrypoint: cli` in their JSONL, which is also extracted by the parser and surfaced as a small badge on `/sessions/<id>` next to the model chip — green for `cli` / `claude-desktop`, amber for `sdk-*`. The path falls back to `claude -p` whenever tmux is unavailable or the run errors; set `FLEETLENS_FORCE_PRINT_MODE=1` to disable the tmux path entirely.\n- **`CCLENS_HOME` env override.** All `~/.cclens/` state (pid file, daemon log, perception state, usage snapshot log, llm-runs traces) is now reached through a shared `cclensHome()` helper that honors `CCLENS_HOME`. Lets multiple installs / workspaces run side-by-side without stomping on each other\'s state.\n\n### Fixed\n- `/api/runs` rendered every successful tmux-driven run as `status=error`. Tmux runs have no subprocess exit code (the session is killed by cleanup), and the runs viewer was treating a missing code as failure. End records now stamp `exit_code: 0` on success and the active-process filter no longer requires the literal `claude -p` flag, so tmux-driven processes also show up in the "active" panel while they\'re running.\n- `JobQueueWidget`\'s `/api/jobs` polling effect listed `jobs` in its deps, so each tick re-armed the effect on the freshly-set state ref — effective cadence collapsed to a 1–4 ms refetch loop. Now tracks `hasActive` in a closure-local var and runs the effect once on mount.\n\n### Conductor\n- New `conductor.json` + `scripts/conductor-{setup,run,archive}.sh` so each Conductor workspace allocates its own 3-port band (web / team-server / postgres) and boots its own `fleetlens-<workspace>` Compose stack against `.harness/cclens-state`. Replaces ~30 hard-coded `join(homedir(), ".cclens", …)` call sites with the shared `cclensHome()/cclensPath()` helper so a second workspace can boot without colliding with the user\'s primary install.\n\n## [0.10.0] — 2026-05-08\n\n### Changed\n- **Plan utilization reframed.** High utilization is now "getting plan value" (green); low utilization is "paying for unused headroom" (red). Mirrors how an operator actually looks at the dashboard: the wasteful outcome is paying for a plan and barely touching it, not running near the cap. Applied across `/usage` burndown, gauges, sidebar, and previous-cycles strip.\n- **In-progress cycles colored by pace, not peak.** A 50% peak halfway through a 7-day cycle reads on-pace green, not amber — the chart no longer cries wolf on a fresh cycle that just hasn\'t burnt yet. Completed cycles still use peak tone.\n- **Pace label ±15pp band.** "On pace" now covers a ±15pp window around ideal; outside that, label is "below pace" (under-burning) or "may exhaust early" (over-burning). The previous +5/-50 thresholds flipped amber every time the user took a night off.\n- **Pace label collapses to three states.** "May exhaust early" / "below pace" / "on pace" — same color tones, one fewer qualifier to read.\n- **Wording softened across the utilization views** to describe the pattern rather than judge the user. "Behind schedule" → "below pace"; "on track (+x%)" → "on pace (+xpp vs ideal)".\n\n### Added\n- **Conductor multi-agent workspace support.** Sessions inside Conductor\'s worktree-style agent workspaces (`~/conductor/workspaces/<repo>/<agent>/...`) now group correctly under their parent project, with each agent shown as a separate worktree. Mirrors the existing `.worktrees/` handling.\n\n### Fixed\n- Hydration mismatch on `/usage` when pace labels rendered before client mount.\n\n### Notes for operators\n- The CLI\'s team push now ships **only Claude Code usage snapshots** to the team server. Codex snapshots stay local until `plan_utilization` gets a per-agent partition — without one, the team-server\'s "latest snapshot" pick flips between agents and miscolors the in-progress cycle. Existing rows in `plan_utilization` stay; new pushes are claude-code only.\n\n## [0.9.0] — 2026-05-07\n\n### Added\n- **Gemini CLI** as the third agent source. Sessions written to `~/.gemini/tmp/<slug>/chats/session-*.jsonl` are now read, parsed, and rendered alongside Claude Code and Codex. Tool calls (`read_file`, `list_directory`, `glob`, `run_shell_command`, `update_topic`, …) and their results show in the session timeline; thinking blocks, multi-write status replay, `$set` / `$rewindTo` semantics, and the legacy single-JSON file shape all handled. Slug → cwd inversion via `~/.gemini/projects.json`. `✺` glyph + purple accent in the UI.\n\n### Changed\n- Session detail timeline drops in-turn idle hatching. Within a turn, every wait — model loading, tool execution, network — is the agent\'s active time. Only between-turn idle (user reading + composing the next message) renders as hatched.\n- Gemini parser anchors `firstTimestamp`, `lastTimestamp`, and `activeSegments` on conversational events only. Login/OAuth `info` records and `metadata.startTime` (file-creation moment) no longer stretch the session bar back to before the first user message.\n\n## [0.7.1] — 2026-05-07\n\n### Fixed\n- Cycle-peaks trend no longer renders two bars labeled the same day. When Anthropic\'s rolling 7-day window slid its anchor between consecutive polls, the daemon\'s bucketer (hour-rounded) recorded both reset boundaries as distinct cycles. They\'re now merged within a 12 h tolerance — same fix in `apps/web/lib/cycle-peaks.ts` (used by `/usage`) and in `packages/cli/src/team/sync.ts` (the daemon\'s team-server push), so both the personal `/usage` chart and the team-server\'s plan-utilization view stay consistent. 5-hour cycles keep no merge tolerance (their anchor is stable; merging would collapse legitimate distinct cycles).\n\n## [0.6.4] — 2026-05-04\n\n### Fixed\n- Cached calibration events per-file so `/usage` warm renders complete in well under a second on large session histories.\n\n## [0.6.3] — 2026-05-04\n\n### Fixed\n- Dropped poisoned auto-week locks left behind by interrupted runs; backfill now gates on the live pipeline lock instead.\n\n## [0.6.2] — 2026-05-04\n\n### Added\n- Last week\'s digest auto-generates on launch when AI features are on. Disable in Settings → AI features.\n\n## [0.6.1] — 2026-05-04\n\n### Changed\n- Smaller install size — published bundle no longer drags in unused workspace metadata.\n\n## [0.6.0] — 2026-04-30\n\n### Added\n- V2 perception layer. Daily, weekly, and monthly digests synthesized from per-session entries via a strict hierarchical pipeline (entry → day → week → month). Past-period digests are immutable on disk; current-period digests use a 10-min in-memory TTL.\n- `/insights` route with on-demand week and month digest generation, picker history, and force-regen.\n- `fleetlens digest day | week | month [--json]` — CLI surface that reproduces the same digests served at `/insights`.\n- `fleetlens entries [--day | --session | --all] [--json]` — inspect the per-session entry primitive.\n\n### Changed\n- Renamed "active time" to "agent time" across the dashboard and CLI for clarity.\n\n## [0.4.1] — 2026-04-23\n\n### Added\n- Concurrency view on `/parallelism` page. Bursts colored teal for same-project and purple for cross-project (the genuinely interesting fleet-work signal).\n- Plan utilization sparkline on the sidebar, fed by the usage daemon\'s 5-min snapshots.\n\n### Fixed\n- Auto-update no longer leaves a zombie web server on the old binary; both server and daemon are torn down before re-exec.\n\n## [0.4.0] — 2026-04-18\n\n### Added\n- Usage daemon (`fleetlens daemon …`) polls `/api/oauth/usage` every 5 min and appends snapshots to `~/.cclens/usage.jsonl`. `fleetlens start` and `fleetlens stop` manage server + daemon together.\n- `fleetlens usage --history` for inspecting past plan utilization.\n\n## [0.3.0] — 2026-04-10\n\n### Added\n- Project rollups with worktree aggregation. Sessions inside `<project>/.worktrees/<name>` roll up under their parent canonical project with a `+N wt` badge.\n- Pinned projects in the sidebar (per-browser via localStorage).\n\n## [0.2.0] — 2026-04-01\n\n### Changed\n- Active-segment computation now uses all timestamped events (system + summary + sidechain + conversational) instead of conversational-only. Earlier filter undercounted by up to 100x on tool-heavy sessions.\n\n## [0.1.0] — 2026-03-15\n\n### Added\n- Initial release. Local-only dashboard for Claude Code sessions: timeline, projects, daily activity bucketing, parallelism detection, per-model cost estimation. Reads JSONL transcripts from `~/.claude/projects/`.\n'),f=e[0]?.version??null;a.s(["ENTRIES",0,e,"LATEST_VERSION",0,f],40095)}];
2
2
 
3
3
  //# sourceMappingURL=apps_web_lib_0m67-xi._.js.map