@specship/specship-darwin-arm64 0.28.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/bin/specship +1 -1
  2. package/lib/dist/.claude-plugin/plugin.json +15 -3
  3. package/lib/dist/activation/cheatsheet.d.ts +10 -7
  4. package/lib/dist/activation/cheatsheet.d.ts.map +1 -1
  5. package/lib/dist/activation/cheatsheet.js +21 -5
  6. package/lib/dist/activation/cheatsheet.js.map +1 -1
  7. package/lib/dist/activation/hook-output.d.ts +75 -2
  8. package/lib/dist/activation/hook-output.d.ts.map +1 -1
  9. package/lib/dist/activation/hook-output.js +114 -3
  10. package/lib/dist/activation/hook-output.js.map +1 -1
  11. package/lib/dist/activation/search-intercept.d.ts +20 -7
  12. package/lib/dist/activation/search-intercept.d.ts.map +1 -1
  13. package/lib/dist/activation/search-intercept.js +27 -5
  14. package/lib/dist/activation/search-intercept.js.map +1 -1
  15. package/lib/dist/activation/steering.d.ts +7 -4
  16. package/lib/dist/activation/steering.d.ts.map +1 -1
  17. package/lib/dist/activation/steering.js +10 -8
  18. package/lib/dist/activation/steering.js.map +1 -1
  19. package/lib/dist/agents/detect.d.ts +32 -0
  20. package/lib/dist/agents/detect.d.ts.map +1 -0
  21. package/lib/dist/agents/detect.js +54 -0
  22. package/lib/dist/agents/detect.js.map +1 -0
  23. package/lib/dist/agents/recent-project.d.ts +18 -0
  24. package/lib/dist/agents/recent-project.d.ts.map +1 -0
  25. package/lib/dist/agents/recent-project.js +92 -0
  26. package/lib/dist/agents/recent-project.js.map +1 -0
  27. package/lib/dist/analytics/canonical-tools.d.ts +23 -0
  28. package/lib/dist/analytics/canonical-tools.d.ts.map +1 -0
  29. package/lib/dist/analytics/canonical-tools.js +36 -0
  30. package/lib/dist/analytics/canonical-tools.js.map +1 -0
  31. package/lib/dist/analytics/canonical-tools.json +16 -0
  32. package/lib/dist/analytics/specship-impact.d.ts +3 -2
  33. package/lib/dist/analytics/specship-impact.d.ts.map +1 -1
  34. package/lib/dist/analytics/specship-impact.js +6 -4
  35. package/lib/dist/analytics/specship-impact.js.map +1 -1
  36. package/lib/dist/bin/specship.js +252 -170
  37. package/lib/dist/bin/specship.js.map +1 -1
  38. package/lib/dist/bin/uninstall.js +2 -2
  39. package/lib/dist/bin/uninstall.js.map +1 -1
  40. package/lib/dist/claudemd/audit.d.ts +12 -3
  41. package/lib/dist/claudemd/audit.d.ts.map +1 -1
  42. package/lib/dist/claudemd/audit.js +65 -22
  43. package/lib/dist/claudemd/audit.js.map +1 -1
  44. package/lib/dist/commands/specship/spec.md +16 -1
  45. package/lib/dist/db/migrations.d.ts +1 -1
  46. package/lib/dist/db/migrations.d.ts.map +1 -1
  47. package/lib/dist/db/migrations.js +18 -4
  48. package/lib/dist/db/migrations.js.map +1 -1
  49. package/lib/dist/db/schema.sql +8 -0
  50. package/lib/dist/db/spec-queries.d.ts +13 -1
  51. package/lib/dist/db/spec-queries.d.ts.map +1 -1
  52. package/lib/dist/db/spec-queries.js +21 -0
  53. package/lib/dist/db/spec-queries.js.map +1 -1
  54. package/lib/dist/design-md/check.d.ts +51 -0
  55. package/lib/dist/design-md/check.d.ts.map +1 -0
  56. package/lib/dist/design-md/check.js +335 -0
  57. package/lib/dist/design-md/check.js.map +1 -0
  58. package/lib/dist/design-md/css.d.ts +40 -0
  59. package/lib/dist/design-md/css.d.ts.map +1 -0
  60. package/lib/dist/design-md/css.js +224 -0
  61. package/lib/dist/design-md/css.js.map +1 -0
  62. package/lib/dist/design-md/extract.d.ts +84 -0
  63. package/lib/dist/design-md/extract.d.ts.map +1 -0
  64. package/lib/dist/design-md/extract.js +595 -0
  65. package/lib/dist/design-md/extract.js.map +1 -0
  66. package/lib/dist/design-md/maintain.d.ts +45 -0
  67. package/lib/dist/design-md/maintain.d.ts.map +1 -0
  68. package/lib/dist/design-md/maintain.js +127 -0
  69. package/lib/dist/design-md/maintain.js.map +1 -0
  70. package/lib/dist/design-md/render.d.ts +28 -0
  71. package/lib/dist/design-md/render.d.ts.map +1 -0
  72. package/lib/dist/design-md/render.js +178 -0
  73. package/lib/dist/design-md/render.js.map +1 -0
  74. package/lib/dist/design-md/upkeep.d.ts +48 -0
  75. package/lib/dist/design-md/upkeep.d.ts.map +1 -0
  76. package/lib/dist/design-md/upkeep.js +169 -0
  77. package/lib/dist/design-md/upkeep.js.map +1 -0
  78. package/lib/dist/design-md/verify.d.ts +65 -0
  79. package/lib/dist/design-md/verify.d.ts.map +1 -0
  80. package/lib/dist/design-md/verify.js +311 -0
  81. package/lib/dist/design-md/verify.js.map +1 -0
  82. package/lib/dist/enforce/changed-files.d.ts +7 -0
  83. package/lib/dist/enforce/changed-files.d.ts.map +1 -1
  84. package/lib/dist/enforce/changed-files.js +17 -0
  85. package/lib/dist/enforce/changed-files.js.map +1 -1
  86. package/lib/dist/enforce/enforce.d.ts +35 -1
  87. package/lib/dist/enforce/enforce.d.ts.map +1 -1
  88. package/lib/dist/enforce/enforce.js +66 -2
  89. package/lib/dist/enforce/enforce.js.map +1 -1
  90. package/lib/dist/extraction/index.d.ts +50 -4
  91. package/lib/dist/extraction/index.d.ts.map +1 -1
  92. package/lib/dist/extraction/index.js +105 -13
  93. package/lib/dist/extraction/index.js.map +1 -1
  94. package/lib/dist/extraction/parse-warnings.d.ts +16 -0
  95. package/lib/dist/extraction/parse-warnings.d.ts.map +1 -0
  96. package/lib/dist/extraction/parse-warnings.js +30 -0
  97. package/lib/dist/extraction/parse-warnings.js.map +1 -0
  98. package/lib/dist/extraction/tree-sitter.d.ts +27 -0
  99. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  100. package/lib/dist/extraction/tree-sitter.js +168 -1
  101. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  102. package/lib/dist/health/smoke-check.js +1 -1
  103. package/lib/dist/health/smoke-check.js.map +1 -1
  104. package/lib/dist/hooks/hooks.json +16 -1
  105. package/lib/dist/index.d.ts +63 -3
  106. package/lib/dist/index.d.ts.map +1 -1
  107. package/lib/dist/index.js +235 -9
  108. package/lib/dist/index.js.map +1 -1
  109. package/lib/dist/installer/agent-record.d.ts +80 -0
  110. package/lib/dist/installer/agent-record.d.ts.map +1 -0
  111. package/lib/dist/installer/agent-record.js +351 -0
  112. package/lib/dist/installer/agent-record.js.map +1 -0
  113. package/lib/dist/installer/auto-migrate.d.ts +56 -0
  114. package/lib/dist/installer/auto-migrate.d.ts.map +1 -0
  115. package/lib/dist/installer/auto-migrate.js +328 -0
  116. package/lib/dist/installer/auto-migrate.js.map +1 -0
  117. package/lib/dist/installer/index.d.ts +37 -8
  118. package/lib/dist/installer/index.d.ts.map +1 -1
  119. package/lib/dist/installer/index.js +156 -46
  120. package/lib/dist/installer/index.js.map +1 -1
  121. package/lib/dist/installer/install-defaults.d.ts +4 -3
  122. package/lib/dist/installer/install-defaults.d.ts.map +1 -1
  123. package/lib/dist/installer/install-defaults.js +6 -5
  124. package/lib/dist/installer/install-defaults.js.map +1 -1
  125. package/lib/dist/installer/{config-writer.d.ts → targets/claude-config-writer.d.ts} +1 -1
  126. package/lib/dist/installer/targets/claude-config-writer.d.ts.map +1 -0
  127. package/lib/dist/installer/{config-writer.js → targets/claude-config-writer.js} +7 -6
  128. package/lib/dist/installer/targets/claude-config-writer.js.map +1 -0
  129. package/lib/dist/installer/targets/claude-projects.d.ts +9 -0
  130. package/lib/dist/installer/targets/claude-projects.d.ts.map +1 -0
  131. package/lib/dist/installer/targets/claude-projects.js +151 -0
  132. package/lib/dist/installer/targets/claude-projects.js.map +1 -0
  133. package/lib/dist/installer/targets/claude.d.ts +29 -2
  134. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  135. package/lib/dist/installer/targets/claude.js +44 -20
  136. package/lib/dist/installer/targets/claude.js.map +1 -1
  137. package/lib/dist/installer/targets/feature-parity.d.ts +28 -0
  138. package/lib/dist/installer/targets/feature-parity.d.ts.map +1 -0
  139. package/lib/dist/installer/targets/feature-parity.js +32 -0
  140. package/lib/dist/installer/targets/feature-parity.js.map +1 -0
  141. package/lib/dist/installer/{gemini-commands.d.ts → targets/gemini-commands.d.ts} +7 -3
  142. package/lib/dist/installer/targets/gemini-commands.d.ts.map +1 -0
  143. package/lib/dist/installer/{gemini-commands.js → targets/gemini-commands.js} +37 -9
  144. package/lib/dist/installer/targets/gemini-commands.js.map +1 -0
  145. package/lib/dist/installer/targets/gemini-projects.d.ts +11 -0
  146. package/lib/dist/installer/targets/gemini-projects.d.ts.map +1 -0
  147. package/lib/dist/installer/targets/gemini-projects.js +84 -0
  148. package/lib/dist/installer/targets/gemini-projects.js.map +1 -0
  149. package/lib/dist/installer/targets/gemini.d.ts +94 -8
  150. package/lib/dist/installer/targets/gemini.d.ts.map +1 -1
  151. package/lib/dist/installer/targets/gemini.js +392 -33
  152. package/lib/dist/installer/targets/gemini.js.map +1 -1
  153. package/lib/dist/installer/targets/registry.d.ts +8 -1
  154. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  155. package/lib/dist/installer/targets/registry.js +14 -5
  156. package/lib/dist/installer/targets/registry.js.map +1 -1
  157. package/lib/dist/installer/targets/shared.d.ts +44 -1
  158. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  159. package/lib/dist/installer/targets/shared.js +130 -3
  160. package/lib/dist/installer/targets/shared.js.map +1 -1
  161. package/lib/dist/installer/targets/types.d.ts +23 -1
  162. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  163. package/lib/dist/jira/auto-publish.d.ts +22 -2
  164. package/lib/dist/jira/auto-publish.d.ts.map +1 -1
  165. package/lib/dist/jira/auto-publish.js +54 -9
  166. package/lib/dist/jira/auto-publish.js.map +1 -1
  167. package/lib/dist/jira/board-first.d.ts +15 -2
  168. package/lib/dist/jira/board-first.d.ts.map +1 -1
  169. package/lib/dist/jira/board-first.js +16 -0
  170. package/lib/dist/jira/board-first.js.map +1 -1
  171. package/lib/dist/jira/ci-publish.d.ts +72 -0
  172. package/lib/dist/jira/ci-publish.d.ts.map +1 -0
  173. package/lib/dist/jira/ci-publish.js +162 -0
  174. package/lib/dist/jira/ci-publish.js.map +1 -0
  175. package/lib/dist/jira/publish.d.ts +23 -0
  176. package/lib/dist/jira/publish.d.ts.map +1 -1
  177. package/lib/dist/jira/publish.js +0 -0
  178. package/lib/dist/jira/publish.js.map +1 -1
  179. package/lib/dist/jira/regression-pack.d.ts.map +1 -1
  180. package/lib/dist/jira/regression-pack.js +7 -1
  181. package/lib/dist/jira/regression-pack.js.map +1 -1
  182. package/lib/dist/jira/repo-config.d.ts.map +1 -1
  183. package/lib/dist/jira/repo-config.js +8 -0
  184. package/lib/dist/jira/repo-config.js.map +1 -1
  185. package/lib/dist/jira/types.d.ts +8 -0
  186. package/lib/dist/jira/types.d.ts.map +1 -1
  187. package/lib/dist/jira/types.js.map +1 -1
  188. package/lib/dist/knowledge/enforce.d.ts.map +1 -1
  189. package/lib/dist/knowledge/enforce.js +6 -1
  190. package/lib/dist/knowledge/enforce.js.map +1 -1
  191. package/lib/dist/mcp/jira-tools.d.ts +5 -0
  192. package/lib/dist/mcp/jira-tools.d.ts.map +1 -1
  193. package/lib/dist/mcp/jira-tools.js +59 -4
  194. package/lib/dist/mcp/jira-tools.js.map +1 -1
  195. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  196. package/lib/dist/mcp/proxy.js +2 -1
  197. package/lib/dist/mcp/proxy.js.map +1 -1
  198. package/lib/dist/mcp/server-instructions.d.ts +16 -10
  199. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  200. package/lib/dist/mcp/server-instructions.js +69 -20
  201. package/lib/dist/mcp/server-instructions.js.map +1 -1
  202. package/lib/dist/mcp/session.d.ts +11 -0
  203. package/lib/dist/mcp/session.d.ts.map +1 -1
  204. package/lib/dist/mcp/session.js +43 -1
  205. package/lib/dist/mcp/session.js.map +1 -1
  206. package/lib/dist/mcp/tools.d.ts.map +1 -1
  207. package/lib/dist/mcp/tools.js +8 -0
  208. package/lib/dist/mcp/tools.js.map +1 -1
  209. package/lib/dist/reflect/apply.d.ts +2 -2
  210. package/lib/dist/reflect/apply.d.ts.map +1 -1
  211. package/lib/dist/reflect/apply.js +6 -5
  212. package/lib/dist/reflect/apply.js.map +1 -1
  213. package/lib/dist/reflect/miner.d.ts.map +1 -1
  214. package/lib/dist/reflect/miner.js +28 -15
  215. package/lib/dist/reflect/miner.js.map +1 -1
  216. package/lib/dist/reflect/session-outcomes.d.ts.map +1 -1
  217. package/lib/dist/reflect/session-outcomes.js +8 -3
  218. package/lib/dist/reflect/session-outcomes.js.map +1 -1
  219. package/lib/dist/reflect/targets.d.ts.map +1 -1
  220. package/lib/dist/reflect/targets.js +25 -5
  221. package/lib/dist/reflect/targets.js.map +1 -1
  222. package/lib/dist/reflect/types.d.ts +7 -0
  223. package/lib/dist/reflect/types.d.ts.map +1 -1
  224. package/lib/dist/resolution/spec-link-resolver.d.ts +14 -2
  225. package/lib/dist/resolution/spec-link-resolver.d.ts.map +1 -1
  226. package/lib/dist/resolution/spec-link-resolver.js +13 -3
  227. package/lib/dist/resolution/spec-link-resolver.js.map +1 -1
  228. package/lib/dist/server/canonical-tools.js +50 -0
  229. package/lib/dist/server/cli.js +2 -2
  230. package/lib/dist/server/host-profiles.js +39 -0
  231. package/lib/dist/server/ingest/index.js +2 -1
  232. package/lib/dist/server/ingest/ingestor.js +195 -76
  233. package/lib/dist/server/ingest/project-paths.js +8 -2
  234. package/lib/dist/server/ingest/recorded-projects.js +43 -0
  235. package/lib/dist/server/ingest/specship-classify.js +7 -2
  236. package/lib/dist/server/ingest/transcripts/claude-jsonl.js +54 -0
  237. package/lib/dist/server/ingest/transcripts/claude.js +64 -0
  238. package/lib/dist/server/ingest/transcripts/gemini.js +469 -0
  239. package/lib/dist/server/ingest/transcripts/index.js +14 -0
  240. package/lib/dist/server/ingest/{parser.js → transcripts/shared.js} +3 -49
  241. package/lib/dist/server/ingest/transcripts/types.js +4 -0
  242. package/lib/dist/server/ingest/watcher.js +31 -30
  243. package/lib/dist/server/routes/claude.js +27 -10
  244. package/lib/dist/server/routes/graph.js +64 -3
  245. package/lib/dist/server/routes/mcp.js +57 -15
  246. package/lib/dist/server/routes/memory.js +54 -35
  247. package/lib/dist/server/routes/projects.js +78 -7
  248. package/lib/dist/server/routes/spec.js +125 -0
  249. package/lib/dist/server/server.js +8 -2
  250. package/lib/dist/skills/design-md/SKILL.md +172 -0
  251. package/lib/dist/skills/design-md/references/authored-sections.md +90 -0
  252. package/lib/dist/skills/design-md/references/sources.md +71 -0
  253. package/lib/dist/skills/spec-author/SKILL.md +1 -1
  254. package/lib/dist/skills/spec-author/references/gap-questions.md +1 -1
  255. package/lib/dist/spec-lint/lint.d.ts +26 -1
  256. package/lib/dist/spec-lint/lint.d.ts.map +1 -1
  257. package/lib/dist/spec-lint/lint.js +96 -7
  258. package/lib/dist/spec-lint/lint.js.map +1 -1
  259. package/lib/dist/spec-quality/postcheck.d.ts +7 -1
  260. package/lib/dist/spec-quality/postcheck.d.ts.map +1 -1
  261. package/lib/dist/spec-quality/postcheck.js +31 -0
  262. package/lib/dist/spec-quality/postcheck.js.map +1 -1
  263. package/lib/dist/sync/worktree.d.ts +48 -0
  264. package/lib/dist/sync/worktree.d.ts.map +1 -1
  265. package/lib/dist/sync/worktree.js +109 -0
  266. package/lib/dist/sync/worktree.js.map +1 -1
  267. package/lib/dist/ui/assets/bricolage-latin-C23fTOVi.woff2 +0 -0
  268. package/lib/dist/ui/assets/bricolage-latin-ext-B82pxkPf.woff2 +0 -0
  269. package/lib/dist/ui/assets/index-54vorjyq.css +1 -0
  270. package/lib/dist/ui/assets/index-BZQonCVb.js +52 -0
  271. package/lib/dist/ui/assets/space-grotesk-latin-DPT1xrvW.woff2 +0 -0
  272. package/lib/dist/ui/assets/space-grotesk-latin-ext-wJGaI8U0.woff2 +0 -0
  273. package/lib/dist/ui/index.html +2 -2
  274. package/lib/dist/update/updater.d.ts +6 -0
  275. package/lib/dist/update/updater.d.ts.map +1 -1
  276. package/lib/dist/update/updater.js +13 -1
  277. package/lib/dist/update/updater.js.map +1 -1
  278. package/lib/dist/workflows/agents/claude.d.ts +9 -0
  279. package/lib/dist/workflows/agents/claude.d.ts.map +1 -1
  280. package/lib/dist/workflows/agents/claude.js +22 -3
  281. package/lib/dist/workflows/agents/claude.js.map +1 -1
  282. package/lib/dist/workflows/agents/gemini-version.d.ts +18 -0
  283. package/lib/dist/workflows/agents/gemini-version.d.ts.map +1 -0
  284. package/lib/dist/workflows/agents/gemini-version.js +81 -0
  285. package/lib/dist/workflows/agents/gemini-version.js.map +1 -0
  286. package/lib/dist/workflows/agents/gemini.d.ts +1 -1
  287. package/lib/dist/workflows/agents/gemini.d.ts.map +1 -1
  288. package/lib/dist/workflows/agents/gemini.js +12 -2
  289. package/lib/dist/workflows/agents/gemini.js.map +1 -1
  290. package/lib/dist/workflows/agents/index.d.ts +2 -0
  291. package/lib/dist/workflows/agents/index.d.ts.map +1 -1
  292. package/lib/dist/workflows/agents/index.js +5 -0
  293. package/lib/dist/workflows/agents/index.js.map +1 -1
  294. package/lib/dist/workflows/agents/types.d.ts +13 -0
  295. package/lib/dist/workflows/agents/types.d.ts.map +1 -1
  296. package/lib/dist/workflows/agents/types.js.map +1 -1
  297. package/lib/dist/workflows/condition-evaluator.d.ts +8 -0
  298. package/lib/dist/workflows/condition-evaluator.d.ts.map +1 -1
  299. package/lib/dist/workflows/condition-evaluator.js +7 -0
  300. package/lib/dist/workflows/condition-evaluator.js.map +1 -1
  301. package/lib/dist/workflows/defaults/claude-design-implement.yaml +44 -15
  302. package/lib/dist/workflows/defaults/spec-author.yaml +9 -9
  303. package/lib/dist/workflows/defaults/spec-fix.yaml +8 -8
  304. package/lib/dist/workflows/defaults/spec-implement.yaml +54 -23
  305. package/lib/dist/workflows/defaults/spec-relink.yaml +5 -5
  306. package/lib/dist/workflows/defaults/spec-verify.yaml +3 -3
  307. package/lib/dist/workflows/executor.d.ts +7 -0
  308. package/lib/dist/workflows/executor.d.ts.map +1 -1
  309. package/lib/dist/workflows/executor.js +22 -5
  310. package/lib/dist/workflows/executor.js.map +1 -1
  311. package/lib/node_modules/.package-lock.json +1 -1
  312. package/lib/package.json +3 -2
  313. package/package.json +1 -1
  314. package/lib/dist/installer/config-writer.d.ts.map +0 -1
  315. package/lib/dist/installer/config-writer.js.map +0 -1
  316. package/lib/dist/installer/gemini-commands.d.ts.map +0 -1
  317. package/lib/dist/installer/gemini-commands.js.map +0 -1
  318. package/lib/dist/ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  319. package/lib/dist/ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  320. package/lib/dist/ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  321. package/lib/dist/ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  322. package/lib/dist/ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  323. package/lib/dist/ui/assets/index-BzuUWUAE.js +0 -50
  324. package/lib/dist/ui/assets/index-ezwX2EfG.css +0 -1
@@ -1,50 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function Ip(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zc={exports:{}},al={},ed={exports:{}},W={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Br=Symbol.for("react.element"),Dp=Symbol.for("react.portal"),Ap=Symbol.for("react.fragment"),Op=Symbol.for("react.strict_mode"),Bp=Symbol.for("react.profiler"),Wp=Symbol.for("react.provider"),$p=Symbol.for("react.context"),Fp=Symbol.for("react.forward_ref"),Hp=Symbol.for("react.suspense"),Up=Symbol.for("react.memo"),Vp=Symbol.for("react.lazy"),wa=Symbol.iterator;function Kp(e){return e===null||typeof e!="object"?null:(e=wa&&e[wa]||e["@@iterator"],typeof e=="function"?e:null)}var td={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},nd=Object.assign,rd={};function qn(e,t,n){this.props=e,this.context=t,this.refs=rd,this.updater=n||td}qn.prototype.isReactComponent={};qn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};qn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function sd(){}sd.prototype=qn.prototype;function hi(e,t,n){this.props=e,this.context=t,this.refs=rd,this.updater=n||td}var mi=hi.prototype=new sd;mi.constructor=hi;nd(mi,qn.prototype);mi.isPureReactComponent=!0;var Sa=Array.isArray,ld=Object.prototype.hasOwnProperty,xi={current:null},od={key:!0,ref:!0,__self:!0,__source:!0};function id(e,t,n){var s,l={},o=null,i=null;if(t!=null)for(s in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)ld.call(t,s)&&!od.hasOwnProperty(s)&&(l[s]=t[s]);var c=arguments.length-2;if(c===1)l.children=n;else if(1<c){for(var a=Array(c),d=0;d<c;d++)a[d]=arguments[d+2];l.children=a}if(e&&e.defaultProps)for(s in c=e.defaultProps,c)l[s]===void 0&&(l[s]=c[s]);return{$$typeof:Br,type:e,key:o,ref:i,props:l,_owner:xi.current}}function Qp(e,t){return{$$typeof:Br,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function gi(e){return typeof e=="object"&&e!==null&&e.$$typeof===Br}function qp(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var ka=/\/+/g;function Ll(e,t){return typeof e=="object"&&e!==null&&e.key!=null?qp(""+e.key):t.toString(36)}function Ss(e,t,n,s,l){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Br:case Dp:i=!0}}if(i)return i=e,l=l(i),e=s===""?"."+Ll(i,0):s,Sa(l)?(n="",e!=null&&(n=e.replace(ka,"$&/")+"/"),Ss(l,t,n,"",function(d){return d})):l!=null&&(gi(l)&&(l=Qp(l,n+(!l.key||i&&i.key===l.key?"":(""+l.key).replace(ka,"$&/")+"/")+e)),t.push(l)),1;if(i=0,s=s===""?".":s+":",Sa(e))for(var c=0;c<e.length;c++){o=e[c];var a=s+Ll(o,c);i+=Ss(o,t,n,a,l)}else if(a=Kp(e),typeof a=="function")for(e=a.call(e),c=0;!(o=e.next()).done;)o=o.value,a=s+Ll(o,c++),i+=Ss(o,t,n,a,l);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function Qr(e,t,n){if(e==null)return e;var s=[],l=0;return Ss(e,s,"","",function(o){return t.call(n,o,l++)}),s}function Gp(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ce={current:null},ks={transition:null},Yp={ReactCurrentDispatcher:Ce,ReactCurrentBatchConfig:ks,ReactCurrentOwner:xi};function ad(){throw Error("act(...) is not supported in production builds of React.")}W.Children={map:Qr,forEach:function(e,t,n){Qr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Qr(e,function(){t++}),t},toArray:function(e){return Qr(e,function(t){return t})||[]},only:function(e){if(!gi(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};W.Component=qn;W.Fragment=Ap;W.Profiler=Bp;W.PureComponent=hi;W.StrictMode=Op;W.Suspense=Hp;W.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Yp;W.act=ad;W.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=nd({},e.props),l=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=xi.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(a in t)ld.call(t,a)&&!od.hasOwnProperty(a)&&(s[a]=t[a]===void 0&&c!==void 0?c[a]:t[a])}var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){c=Array(a);for(var d=0;d<a;d++)c[d]=arguments[d+2];s.children=c}return{$$typeof:Br,type:e.type,key:l,ref:o,props:s,_owner:i}};W.createContext=function(e){return e={$$typeof:$p,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Wp,_context:e},e.Consumer=e};W.createElement=id;W.createFactory=function(e){var t=id.bind(null,e);return t.type=e,t};W.createRef=function(){return{current:null}};W.forwardRef=function(e){return{$$typeof:Fp,render:e}};W.isValidElement=gi;W.lazy=function(e){return{$$typeof:Vp,_payload:{_status:-1,_result:e},_init:Gp}};W.memo=function(e,t){return{$$typeof:Up,type:e,compare:t===void 0?null:t}};W.startTransition=function(e){var t=ks.transition;ks.transition={};try{e()}finally{ks.transition=t}};W.unstable_act=ad;W.useCallback=function(e,t){return Ce.current.useCallback(e,t)};W.useContext=function(e){return Ce.current.useContext(e)};W.useDebugValue=function(){};W.useDeferredValue=function(e){return Ce.current.useDeferredValue(e)};W.useEffect=function(e,t){return Ce.current.useEffect(e,t)};W.useId=function(){return Ce.current.useId()};W.useImperativeHandle=function(e,t,n){return Ce.current.useImperativeHandle(e,t,n)};W.useInsertionEffect=function(e,t){return Ce.current.useInsertionEffect(e,t)};W.useLayoutEffect=function(e,t){return Ce.current.useLayoutEffect(e,t)};W.useMemo=function(e,t){return Ce.current.useMemo(e,t)};W.useReducer=function(e,t,n){return Ce.current.useReducer(e,t,n)};W.useRef=function(e){return Ce.current.useRef(e)};W.useState=function(e){return Ce.current.useState(e)};W.useSyncExternalStore=function(e,t,n){return Ce.current.useSyncExternalStore(e,t,n)};W.useTransition=function(){return Ce.current.useTransition()};W.version="18.3.1";ed.exports=W;var N=ed.exports;const Xp=Ip(N);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Jp=N,Zp=Symbol.for("react.element"),ef=Symbol.for("react.fragment"),tf=Object.prototype.hasOwnProperty,nf=Jp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,rf={key:!0,ref:!0,__self:!0,__source:!0};function cd(e,t,n){var s,l={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(s in t)tf.call(t,s)&&!rf.hasOwnProperty(s)&&(l[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)l[s]===void 0&&(l[s]=t[s]);return{$$typeof:Zp,type:e,key:o,ref:i,props:l,_owner:nf.current}}al.Fragment=ef;al.jsx=cd;al.jsxs=cd;Zc.exports=al;var r=Zc.exports,fo={},dd={exports:{}},$e={},ud={exports:{}},pd={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(k,z){var T=k.length;k.push(z);e:for(;0<T;){var L=T-1>>>1,B=k[L];if(0<l(B,z))k[L]=z,k[T]=B,T=L;else break e}}function n(k){return k.length===0?null:k[0]}function s(k){if(k.length===0)return null;var z=k[0],T=k.pop();if(T!==z){k[0]=T;e:for(var L=0,B=k.length,U=B>>>1;L<U;){var K=2*(L+1)-1,he=k[K],ve=K+1,_e=k[ve];if(0>l(he,T))ve<B&&0>l(_e,he)?(k[L]=_e,k[ve]=T,L=ve):(k[L]=he,k[K]=T,L=K);else if(ve<B&&0>l(_e,T))k[L]=_e,k[ve]=T,L=ve;else break e}}return z}function l(k,z){var T=k.sortIndex-z.sortIndex;return T!==0?T:k.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,c=i.now();e.unstable_now=function(){return i.now()-c}}var a=[],d=[],u=1,f=null,m=3,g=!1,y=!1,p=!1,w=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(k){for(var z=n(d);z!==null;){if(z.callback===null)s(d);else if(z.startTime<=k)s(d),z.sortIndex=z.expirationTime,t(a,z);else break;z=n(d)}}function j(k){if(p=!1,x(k),!y)if(n(a)!==null)y=!0,Xe(S);else{var z=n(d);z!==null&&Te(j,z.startTime-k)}}function S(k,z){y=!1,p&&(p=!1,v(R),R=-1),g=!0;var T=m;try{for(x(z),f=n(a);f!==null&&(!(f.expirationTime>z)||k&&!ne());){var L=f.callback;if(typeof L=="function"){f.callback=null,m=f.priorityLevel;var B=L(f.expirationTime<=z);z=e.unstable_now(),typeof B=="function"?f.callback=B:f===n(a)&&s(a),x(z)}else s(a);f=n(a)}if(f!==null)var U=!0;else{var K=n(d);K!==null&&Te(j,K.startTime-z),U=!1}return U}finally{f=null,m=T,g=!1}}var C=!1,E=null,R=-1,O=5,D=-1;function ne(){return!(e.unstable_now()-D<O)}function fe(){if(E!==null){var k=e.unstable_now();D=k;var z=!0;try{z=E(!0,k)}finally{z?ke():(C=!1,E=null)}}else C=!1}var ke;if(typeof h=="function")ke=function(){h(fe)};else if(typeof MessageChannel<"u"){var He=new MessageChannel,bt=He.port2;He.port1.onmessage=fe,ke=function(){bt.postMessage(null)}}else ke=function(){w(fe,0)};function Xe(k){E=k,C||(C=!0,ke())}function Te(k,z){R=w(function(){k(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(k){k.callback=null},e.unstable_continueExecution=function(){y||g||(y=!0,Xe(S))},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(a)},e.unstable_next=function(k){switch(m){case 1:case 2:case 3:var z=3;break;default:z=m}var T=m;m=z;try{return k()}finally{m=T}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(k,z){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var T=m;m=k;try{return z()}finally{m=T}},e.unstable_scheduleCallback=function(k,z,T){var L=e.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?L+T:L):T=L,k){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=T+B,k={id:u++,callback:z,priorityLevel:k,startTime:T,expirationTime:B,sortIndex:-1},T>L?(k.sortIndex=T,t(d,k),n(a)===null&&k===n(d)&&(p?(v(R),R=-1):p=!0,Te(j,T-L))):(k.sortIndex=B,t(a,k),y||g||(y=!0,Xe(S))),k},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(k){var z=m;return function(){var T=m;m=z;try{return k.apply(this,arguments)}finally{m=T}}}})(pd);ud.exports=pd;var sf=ud.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var lf=N,Be=sf;function _(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var fd=new Set,wr={};function fn(e,t){Bn(e,t),Bn(e+"Capture",t)}function Bn(e,t){for(wr[e]=t,e=0;e<t.length;e++)fd.add(t[e])}var vt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ho=Object.prototype.hasOwnProperty,of=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ba={},Na={};function af(e){return ho.call(Na,e)?!0:ho.call(ba,e)?!1:of.test(e)?Na[e]=!0:(ba[e]=!0,!1)}function cf(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function df(e,t,n,s){if(t===null||typeof t>"u"||cf(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ee(e,t,n,s,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var ge={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ge[e]=new Ee(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ge[t]=new Ee(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ge[e]=new Ee(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ge[e]=new Ee(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ge[e]=new Ee(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ge[e]=new Ee(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ge[e]=new Ee(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ge[e]=new Ee(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ge[e]=new Ee(e,5,!1,e.toLowerCase(),null,!1,!1)});var vi=/[\-:]([a-z])/g;function yi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vi,yi);ge[t]=new Ee(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vi,yi);ge[t]=new Ee(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vi,yi);ge[t]=new Ee(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ge[e]=new Ee(e,1,!1,e.toLowerCase(),null,!1,!1)});ge.xlinkHref=new Ee("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ge[e]=new Ee(e,1,!1,e.toLowerCase(),null,!0,!0)});function ji(e,t,n,s){var l=ge.hasOwnProperty(t)?ge[t]:null;(l!==null?l.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(df(t,n,l,s)&&(n=null),s||l===null?af(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):l.mustUseProperty?e[l.propertyName]=n===null?l.type===3?!1:"":n:(t=l.attributeName,s=l.attributeNamespace,n===null?e.removeAttribute(t):(l=l.type,n=l===3||l===4&&n===!0?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}var St=lf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,qr=Symbol.for("react.element"),jn=Symbol.for("react.portal"),wn=Symbol.for("react.fragment"),wi=Symbol.for("react.strict_mode"),mo=Symbol.for("react.profiler"),hd=Symbol.for("react.provider"),md=Symbol.for("react.context"),Si=Symbol.for("react.forward_ref"),xo=Symbol.for("react.suspense"),go=Symbol.for("react.suspense_list"),ki=Symbol.for("react.memo"),zt=Symbol.for("react.lazy"),xd=Symbol.for("react.offscreen"),za=Symbol.iterator;function Xn(e){return e===null||typeof e!="object"?null:(e=za&&e[za]||e["@@iterator"],typeof e=="function"?e:null)}var te=Object.assign,Il;function or(e){if(Il===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Il=t&&t[1]||""}return`
34
- `+Il+e}var Dl=!1;function Al(e,t){if(!e||Dl)return"";Dl=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var s=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){s=d}e.call(t.prototype)}else{try{throw Error()}catch(d){s=d}e()}}catch(d){if(d&&s&&typeof d.stack=="string"){for(var l=d.stack.split(`
35
- `),o=s.stack.split(`
36
- `),i=l.length-1,c=o.length-1;1<=i&&0<=c&&l[i]!==o[c];)c--;for(;1<=i&&0<=c;i--,c--)if(l[i]!==o[c]){if(i!==1||c!==1)do if(i--,c--,0>c||l[i]!==o[c]){var a=`
37
- `+l[i].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=i&&0<=c);break}}}finally{Dl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?or(e):""}function uf(e){switch(e.tag){case 5:return or(e.type);case 16:return or("Lazy");case 13:return or("Suspense");case 19:return or("SuspenseList");case 0:case 2:case 15:return e=Al(e.type,!1),e;case 11:return e=Al(e.type.render,!1),e;case 1:return e=Al(e.type,!0),e;default:return""}}function vo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case wn:return"Fragment";case jn:return"Portal";case mo:return"Profiler";case wi:return"StrictMode";case xo:return"Suspense";case go:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case md:return(e.displayName||"Context")+".Consumer";case hd:return(e._context.displayName||"Context")+".Provider";case Si:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ki:return t=e.displayName||null,t!==null?t:vo(e.type)||"Memo";case zt:t=e._payload,e=e._init;try{return vo(e(t))}catch{}}return null}function pf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return vo(t);case 8:return t===wi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ft(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ff(e){var t=gd(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){s=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(i){s=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Gr(e){e._valueTracker||(e._valueTracker=ff(e))}function vd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=gd(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ls(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function yo(e,t){var n=t.checked;return te({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ca(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=Ft(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function yd(e,t){t=t.checked,t!=null&&ji(e,"checked",t,!1)}function jo(e,t){yd(e,t);var n=Ft(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?wo(e,t.type,n):t.hasOwnProperty("defaultValue")&&wo(e,t.type,Ft(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ea(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function wo(e,t,n){(t!=="number"||Ls(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ir=Array.isArray;function Pn(e,t,n,s){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Ft(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,s&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function So(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(_(91));return te({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ta(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(_(92));if(ir(n)){if(1<n.length)throw Error(_(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ft(n)}}function jd(e,t){var n=Ft(t.value),s=Ft(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function _a(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function wd(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ko(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?wd(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Yr,Sd=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,l){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,l)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Yr=Yr||document.createElement("div"),Yr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Sr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ur={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},hf=["Webkit","ms","Moz","O"];Object.keys(ur).forEach(function(e){hf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ur[t]=ur[e]})});function kd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ur.hasOwnProperty(e)&&ur[e]?(""+t).trim():t+"px"}function bd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,l=kd(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,l):e[n]=l}}var mf=te({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function bo(e,t){if(t){if(mf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(_(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(_(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(_(61))}if(t.style!=null&&typeof t.style!="object")throw Error(_(62))}}function No(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var zo=null;function bi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Co=null,Ln=null,In=null;function Ra(e){if(e=Fr(e)){if(typeof Co!="function")throw Error(_(280));var t=e.stateNode;t&&(t=fl(t),Co(e.stateNode,e.type,t))}}function Nd(e){Ln?In?In.push(e):In=[e]:Ln=e}function zd(){if(Ln){var e=Ln,t=In;if(In=Ln=null,Ra(e),t)for(e=0;e<t.length;e++)Ra(t[e])}}function Cd(e,t){return e(t)}function Ed(){}var Ol=!1;function Td(e,t,n){if(Ol)return e(t,n);Ol=!0;try{return Cd(e,t,n)}finally{Ol=!1,(Ln!==null||In!==null)&&(Ed(),zd())}}function kr(e,t){var n=e.stateNode;if(n===null)return null;var s=fl(n);if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(_(231,t,typeof n));return n}var Eo=!1;if(vt)try{var Jn={};Object.defineProperty(Jn,"passive",{get:function(){Eo=!0}}),window.addEventListener("test",Jn,Jn),window.removeEventListener("test",Jn,Jn)}catch{Eo=!1}function xf(e,t,n,s,l,o,i,c,a){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var pr=!1,Is=null,Ds=!1,To=null,gf={onError:function(e){pr=!0,Is=e}};function vf(e,t,n,s,l,o,i,c,a){pr=!1,Is=null,xf.apply(gf,arguments)}function yf(e,t,n,s,l,o,i,c,a){if(vf.apply(this,arguments),pr){if(pr){var d=Is;pr=!1,Is=null}else throw Error(_(198));Ds||(Ds=!0,To=d)}}function hn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function _d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ma(e){if(hn(e)!==e)throw Error(_(188))}function jf(e){var t=e.alternate;if(!t){if(t=hn(e),t===null)throw Error(_(188));return t!==e?null:e}for(var n=e,s=t;;){var l=n.return;if(l===null)break;var o=l.alternate;if(o===null){if(s=l.return,s!==null){n=s;continue}break}if(l.child===o.child){for(o=l.child;o;){if(o===n)return Ma(l),e;if(o===s)return Ma(l),t;o=o.sibling}throw Error(_(188))}if(n.return!==s.return)n=l,s=o;else{for(var i=!1,c=l.child;c;){if(c===n){i=!0,n=l,s=o;break}if(c===s){i=!0,s=l,n=o;break}c=c.sibling}if(!i){for(c=o.child;c;){if(c===n){i=!0,n=o,s=l;break}if(c===s){i=!0,s=o,n=l;break}c=c.sibling}if(!i)throw Error(_(189))}}if(n.alternate!==s)throw Error(_(190))}if(n.tag!==3)throw Error(_(188));return n.stateNode.current===n?e:t}function Rd(e){return e=jf(e),e!==null?Md(e):null}function Md(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Md(e);if(t!==null)return t;e=e.sibling}return null}var Pd=Be.unstable_scheduleCallback,Pa=Be.unstable_cancelCallback,wf=Be.unstable_shouldYield,Sf=Be.unstable_requestPaint,le=Be.unstable_now,kf=Be.unstable_getCurrentPriorityLevel,Ni=Be.unstable_ImmediatePriority,Ld=Be.unstable_UserBlockingPriority,As=Be.unstable_NormalPriority,bf=Be.unstable_LowPriority,Id=Be.unstable_IdlePriority,cl=null,ut=null;function Nf(e){if(ut&&typeof ut.onCommitFiberRoot=="function")try{ut.onCommitFiberRoot(cl,e,void 0,(e.current.flags&128)===128)}catch{}}var rt=Math.clz32?Math.clz32:Ef,zf=Math.log,Cf=Math.LN2;function Ef(e){return e>>>=0,e===0?32:31-(zf(e)/Cf|0)|0}var Xr=64,Jr=4194304;function ar(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Os(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var c=i&~l;c!==0?s=ar(c):(o&=i,o!==0&&(s=ar(o)))}else i=n&~l,i!==0?s=ar(i):o!==0&&(s=ar(o));if(s===0)return 0;if(t!==0&&t!==s&&!(t&l)&&(l=s&-s,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-rt(t),l=1<<n,s|=e[n],t&=~l;return s}function Tf(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function _f(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,l=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-rt(o),c=1<<i,a=l[i];a===-1?(!(c&n)||c&s)&&(l[i]=Tf(c,t)):a<=t&&(e.expiredLanes|=c),o&=~c}}function _o(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Dd(){var e=Xr;return Xr<<=1,!(Xr&4194240)&&(Xr=64),e}function Bl(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Wr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-rt(t),e[t]=n}function Rf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var l=31-rt(n),o=1<<l;t[l]=0,s[l]=-1,e[l]=-1,n&=~o}}function zi(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-rt(n),l=1<<s;l&t|e[s]&t&&(e[s]|=t),n&=~l}}var V=0;function Ad(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Od,Ci,Bd,Wd,$d,Ro=!1,Zr=[],Lt=null,It=null,Dt=null,br=new Map,Nr=new Map,Et=[],Mf="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function La(e,t){switch(e){case"focusin":case"focusout":Lt=null;break;case"dragenter":case"dragleave":It=null;break;case"mouseover":case"mouseout":Dt=null;break;case"pointerover":case"pointerout":br.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nr.delete(t.pointerId)}}function Zn(e,t,n,s,l,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:o,targetContainers:[l]},t!==null&&(t=Fr(t),t!==null&&Ci(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function Pf(e,t,n,s,l){switch(t){case"focusin":return Lt=Zn(Lt,e,t,n,s,l),!0;case"dragenter":return It=Zn(It,e,t,n,s,l),!0;case"mouseover":return Dt=Zn(Dt,e,t,n,s,l),!0;case"pointerover":var o=l.pointerId;return br.set(o,Zn(br.get(o)||null,e,t,n,s,l)),!0;case"gotpointercapture":return o=l.pointerId,Nr.set(o,Zn(Nr.get(o)||null,e,t,n,s,l)),!0}return!1}function Fd(e){var t=tn(e.target);if(t!==null){var n=hn(t);if(n!==null){if(t=n.tag,t===13){if(t=_d(n),t!==null){e.blockedOn=t,$d(e.priority,function(){Bd(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function bs(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Mo(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);zo=s,n.target.dispatchEvent(s),zo=null}else return t=Fr(n),t!==null&&Ci(t),e.blockedOn=n,!1;t.shift()}return!0}function Ia(e,t,n){bs(e)&&n.delete(t)}function Lf(){Ro=!1,Lt!==null&&bs(Lt)&&(Lt=null),It!==null&&bs(It)&&(It=null),Dt!==null&&bs(Dt)&&(Dt=null),br.forEach(Ia),Nr.forEach(Ia)}function er(e,t){e.blockedOn===t&&(e.blockedOn=null,Ro||(Ro=!0,Be.unstable_scheduleCallback(Be.unstable_NormalPriority,Lf)))}function zr(e){function t(l){return er(l,e)}if(0<Zr.length){er(Zr[0],e);for(var n=1;n<Zr.length;n++){var s=Zr[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Lt!==null&&er(Lt,e),It!==null&&er(It,e),Dt!==null&&er(Dt,e),br.forEach(t),Nr.forEach(t),n=0;n<Et.length;n++)s=Et[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<Et.length&&(n=Et[0],n.blockedOn===null);)Fd(n),n.blockedOn===null&&Et.shift()}var Dn=St.ReactCurrentBatchConfig,Bs=!0;function If(e,t,n,s){var l=V,o=Dn.transition;Dn.transition=null;try{V=1,Ei(e,t,n,s)}finally{V=l,Dn.transition=o}}function Df(e,t,n,s){var l=V,o=Dn.transition;Dn.transition=null;try{V=4,Ei(e,t,n,s)}finally{V=l,Dn.transition=o}}function Ei(e,t,n,s){if(Bs){var l=Mo(e,t,n,s);if(l===null)Gl(e,t,s,Ws,n),La(e,s);else if(Pf(l,e,t,n,s))s.stopPropagation();else if(La(e,s),t&4&&-1<Mf.indexOf(e)){for(;l!==null;){var o=Fr(l);if(o!==null&&Od(o),o=Mo(e,t,n,s),o===null&&Gl(e,t,s,Ws,n),o===l)break;l=o}l!==null&&s.stopPropagation()}else Gl(e,t,s,null,n)}}var Ws=null;function Mo(e,t,n,s){if(Ws=null,e=bi(s),e=tn(e),e!==null)if(t=hn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=_d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ws=e,null}function Hd(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(kf()){case Ni:return 1;case Ld:return 4;case As:case bf:return 16;case Id:return 536870912;default:return 16}default:return 16}}var Rt=null,Ti=null,Ns=null;function Ud(){if(Ns)return Ns;var e,t=Ti,n=t.length,s,l="value"in Rt?Rt.value:Rt.textContent,o=l.length;for(e=0;e<n&&t[e]===l[e];e++);var i=n-e;for(s=1;s<=i&&t[n-s]===l[o-s];s++);return Ns=l.slice(e,1<s?1-s:void 0)}function zs(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function es(){return!0}function Da(){return!1}function Fe(e){function t(n,s,l,o,i){this._reactName=n,this._targetInst=l,this.type=s,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var c in e)e.hasOwnProperty(c)&&(n=e[c],this[c]=n?n(o):o[c]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?es:Da,this.isPropagationStopped=Da,this}return te(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=es)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=es)},persist:function(){},isPersistent:es}),t}var Gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_i=Fe(Gn),$r=te({},Gn,{view:0,detail:0}),Af=Fe($r),Wl,$l,tr,dl=te({},$r,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ri,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==tr&&(tr&&e.type==="mousemove"?(Wl=e.screenX-tr.screenX,$l=e.screenY-tr.screenY):$l=Wl=0,tr=e),Wl)},movementY:function(e){return"movementY"in e?e.movementY:$l}}),Aa=Fe(dl),Of=te({},dl,{dataTransfer:0}),Bf=Fe(Of),Wf=te({},$r,{relatedTarget:0}),Fl=Fe(Wf),$f=te({},Gn,{animationName:0,elapsedTime:0,pseudoElement:0}),Ff=Fe($f),Hf=te({},Gn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Uf=Fe(Hf),Vf=te({},Gn,{data:0}),Oa=Fe(Vf),Kf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qf={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},qf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gf(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=qf[e])?!!t[e]:!1}function Ri(){return Gf}var Yf=te({},$r,{key:function(e){if(e.key){var t=Kf[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=zs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Qf[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ri,charCode:function(e){return e.type==="keypress"?zs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?zs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Xf=Fe(Yf),Jf=te({},dl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ba=Fe(Jf),Zf=te({},$r,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ri}),eh=Fe(Zf),th=te({},Gn,{propertyName:0,elapsedTime:0,pseudoElement:0}),nh=Fe(th),rh=te({},dl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),sh=Fe(rh),lh=[9,13,27,32],Mi=vt&&"CompositionEvent"in window,fr=null;vt&&"documentMode"in document&&(fr=document.documentMode);var oh=vt&&"TextEvent"in window&&!fr,Vd=vt&&(!Mi||fr&&8<fr&&11>=fr),Wa=" ",$a=!1;function Kd(e,t){switch(e){case"keyup":return lh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Sn=!1;function ih(e,t){switch(e){case"compositionend":return Qd(t);case"keypress":return t.which!==32?null:($a=!0,Wa);case"textInput":return e=t.data,e===Wa&&$a?null:e;default:return null}}function ah(e,t){if(Sn)return e==="compositionend"||!Mi&&Kd(e,t)?(e=Ud(),Ns=Ti=Rt=null,Sn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Vd&&t.locale!=="ko"?null:t.data;default:return null}}var ch={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Fa(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ch[e.type]:t==="textarea"}function qd(e,t,n,s){Nd(s),t=$s(t,"onChange"),0<t.length&&(n=new _i("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var hr=null,Cr=null;function dh(e){lu(e,0)}function ul(e){var t=Nn(e);if(vd(t))return e}function uh(e,t){if(e==="change")return t}var Gd=!1;if(vt){var Hl;if(vt){var Ul="oninput"in document;if(!Ul){var Ha=document.createElement("div");Ha.setAttribute("oninput","return;"),Ul=typeof Ha.oninput=="function"}Hl=Ul}else Hl=!1;Gd=Hl&&(!document.documentMode||9<document.documentMode)}function Ua(){hr&&(hr.detachEvent("onpropertychange",Yd),Cr=hr=null)}function Yd(e){if(e.propertyName==="value"&&ul(Cr)){var t=[];qd(t,Cr,e,bi(e)),Td(dh,t)}}function ph(e,t,n){e==="focusin"?(Ua(),hr=t,Cr=n,hr.attachEvent("onpropertychange",Yd)):e==="focusout"&&Ua()}function fh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ul(Cr)}function hh(e,t){if(e==="click")return ul(t)}function mh(e,t){if(e==="input"||e==="change")return ul(t)}function xh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ot=typeof Object.is=="function"?Object.is:xh;function Er(e,t){if(ot(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var l=n[s];if(!ho.call(t,l)||!ot(e[l],t[l]))return!1}return!0}function Va(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ka(e,t){var n=Va(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Va(n)}}function Xd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Xd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Jd(){for(var e=window,t=Ls();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ls(e.document)}return t}function Pi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function gh(e){var t=Jd(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Xd(n.ownerDocument.documentElement,n)){if(s!==null&&Pi(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(s.start,l);s=s.end===void 0?o:Math.min(s.end,l),!e.extend&&o>s&&(l=s,s=o,o=l),l=Ka(n,o);var i=Ka(n,s);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>s?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var vh=vt&&"documentMode"in document&&11>=document.documentMode,kn=null,Po=null,mr=null,Lo=!1;function Qa(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Lo||kn==null||kn!==Ls(s)||(s=kn,"selectionStart"in s&&Pi(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),mr&&Er(mr,s)||(mr=s,s=$s(Po,"onSelect"),0<s.length&&(t=new _i("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=kn)))}function ts(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var bn={animationend:ts("Animation","AnimationEnd"),animationiteration:ts("Animation","AnimationIteration"),animationstart:ts("Animation","AnimationStart"),transitionend:ts("Transition","TransitionEnd")},Vl={},Zd={};vt&&(Zd=document.createElement("div").style,"AnimationEvent"in window||(delete bn.animationend.animation,delete bn.animationiteration.animation,delete bn.animationstart.animation),"TransitionEvent"in window||delete bn.transitionend.transition);function pl(e){if(Vl[e])return Vl[e];if(!bn[e])return e;var t=bn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Zd)return Vl[e]=t[n];return e}var eu=pl("animationend"),tu=pl("animationiteration"),nu=pl("animationstart"),ru=pl("transitionend"),su=new Map,qa="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Vt(e,t){su.set(e,t),fn(t,[e])}for(var Kl=0;Kl<qa.length;Kl++){var Ql=qa[Kl],yh=Ql.toLowerCase(),jh=Ql[0].toUpperCase()+Ql.slice(1);Vt(yh,"on"+jh)}Vt(eu,"onAnimationEnd");Vt(tu,"onAnimationIteration");Vt(nu,"onAnimationStart");Vt("dblclick","onDoubleClick");Vt("focusin","onFocus");Vt("focusout","onBlur");Vt(ru,"onTransitionEnd");Bn("onMouseEnter",["mouseout","mouseover"]);Bn("onMouseLeave",["mouseout","mouseover"]);Bn("onPointerEnter",["pointerout","pointerover"]);Bn("onPointerLeave",["pointerout","pointerover"]);fn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));fn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));fn("onBeforeInput",["compositionend","keypress","textInput","paste"]);fn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));fn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));fn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),wh=new Set("cancel close invalid load scroll toggle".split(" ").concat(cr));function Ga(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,yf(s,t,void 0,e),e.currentTarget=null}function lu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],l=s.event;s=s.listeners;e:{var o=void 0;if(t)for(var i=s.length-1;0<=i;i--){var c=s[i],a=c.instance,d=c.currentTarget;if(c=c.listener,a!==o&&l.isPropagationStopped())break e;Ga(l,c,d),o=a}else for(i=0;i<s.length;i++){if(c=s[i],a=c.instance,d=c.currentTarget,c=c.listener,a!==o&&l.isPropagationStopped())break e;Ga(l,c,d),o=a}}}if(Ds)throw e=To,Ds=!1,To=null,e}function G(e,t){var n=t[Bo];n===void 0&&(n=t[Bo]=new Set);var s=e+"__bubble";n.has(s)||(ou(t,e,2,!1),n.add(s))}function ql(e,t,n){var s=0;t&&(s|=4),ou(n,e,s,t)}var ns="_reactListening"+Math.random().toString(36).slice(2);function Tr(e){if(!e[ns]){e[ns]=!0,fd.forEach(function(n){n!=="selectionchange"&&(wh.has(n)||ql(n,!1,e),ql(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ns]||(t[ns]=!0,ql("selectionchange",!1,t))}}function ou(e,t,n,s){switch(Hd(t)){case 1:var l=If;break;case 4:l=Df;break;default:l=Ei}n=l.bind(null,t,n,e),l=void 0,!Eo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),s?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function Gl(e,t,n,s,l){var o=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var i=s.tag;if(i===3||i===4){var c=s.stateNode.containerInfo;if(c===l||c.nodeType===8&&c.parentNode===l)break;if(i===4)for(i=s.return;i!==null;){var a=i.tag;if((a===3||a===4)&&(a=i.stateNode.containerInfo,a===l||a.nodeType===8&&a.parentNode===l))return;i=i.return}for(;c!==null;){if(i=tn(c),i===null)return;if(a=i.tag,a===5||a===6){s=o=i;continue e}c=c.parentNode}}s=s.return}Td(function(){var d=o,u=bi(n),f=[];e:{var m=su.get(e);if(m!==void 0){var g=_i,y=e;switch(e){case"keypress":if(zs(n)===0)break e;case"keydown":case"keyup":g=Xf;break;case"focusin":y="focus",g=Fl;break;case"focusout":y="blur",g=Fl;break;case"beforeblur":case"afterblur":g=Fl;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=Aa;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=Bf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=eh;break;case eu:case tu:case nu:g=Ff;break;case ru:g=nh;break;case"scroll":g=Af;break;case"wheel":g=sh;break;case"copy":case"cut":case"paste":g=Uf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=Ba}var p=(t&4)!==0,w=!p&&e==="scroll",v=p?m!==null?m+"Capture":null:m;p=[];for(var h=d,x;h!==null;){x=h;var j=x.stateNode;if(x.tag===5&&j!==null&&(x=j,v!==null&&(j=kr(h,v),j!=null&&p.push(_r(h,j,x)))),w)break;h=h.return}0<p.length&&(m=new g(m,y,null,n,u),f.push({event:m,listeners:p}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",m&&n!==zo&&(y=n.relatedTarget||n.fromElement)&&(tn(y)||y[yt]))break e;if((g||m)&&(m=u.window===u?u:(m=u.ownerDocument)?m.defaultView||m.parentWindow:window,g?(y=n.relatedTarget||n.toElement,g=d,y=y?tn(y):null,y!==null&&(w=hn(y),y!==w||y.tag!==5&&y.tag!==6)&&(y=null)):(g=null,y=d),g!==y)){if(p=Aa,j="onMouseLeave",v="onMouseEnter",h="mouse",(e==="pointerout"||e==="pointerover")&&(p=Ba,j="onPointerLeave",v="onPointerEnter",h="pointer"),w=g==null?m:Nn(g),x=y==null?m:Nn(y),m=new p(j,h+"leave",g,n,u),m.target=w,m.relatedTarget=x,j=null,tn(u)===d&&(p=new p(v,h+"enter",y,n,u),p.target=x,p.relatedTarget=w,j=p),w=j,g&&y)t:{for(p=g,v=y,h=0,x=p;x;x=mn(x))h++;for(x=0,j=v;j;j=mn(j))x++;for(;0<h-x;)p=mn(p),h--;for(;0<x-h;)v=mn(v),x--;for(;h--;){if(p===v||v!==null&&p===v.alternate)break t;p=mn(p),v=mn(v)}p=null}else p=null;g!==null&&Ya(f,m,g,p,!1),y!==null&&w!==null&&Ya(f,w,y,p,!0)}}e:{if(m=d?Nn(d):window,g=m.nodeName&&m.nodeName.toLowerCase(),g==="select"||g==="input"&&m.type==="file")var S=uh;else if(Fa(m))if(Gd)S=mh;else{S=fh;var C=ph}else(g=m.nodeName)&&g.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(S=hh);if(S&&(S=S(e,d))){qd(f,S,n,u);break e}C&&C(e,m,d),e==="focusout"&&(C=m._wrapperState)&&C.controlled&&m.type==="number"&&wo(m,"number",m.value)}switch(C=d?Nn(d):window,e){case"focusin":(Fa(C)||C.contentEditable==="true")&&(kn=C,Po=d,mr=null);break;case"focusout":mr=Po=kn=null;break;case"mousedown":Lo=!0;break;case"contextmenu":case"mouseup":case"dragend":Lo=!1,Qa(f,n,u);break;case"selectionchange":if(vh)break;case"keydown":case"keyup":Qa(f,n,u)}var E;if(Mi)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else Sn?Kd(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(Vd&&n.locale!=="ko"&&(Sn||R!=="onCompositionStart"?R==="onCompositionEnd"&&Sn&&(E=Ud()):(Rt=u,Ti="value"in Rt?Rt.value:Rt.textContent,Sn=!0)),C=$s(d,R),0<C.length&&(R=new Oa(R,e,null,n,u),f.push({event:R,listeners:C}),E?R.data=E:(E=Qd(n),E!==null&&(R.data=E)))),(E=oh?ih(e,n):ah(e,n))&&(d=$s(d,"onBeforeInput"),0<d.length&&(u=new Oa("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:d}),u.data=E))}lu(f,t)})}function _r(e,t,n){return{instance:e,listener:t,currentTarget:n}}function $s(e,t){for(var n=t+"Capture",s=[];e!==null;){var l=e,o=l.stateNode;l.tag===5&&o!==null&&(l=o,o=kr(e,n),o!=null&&s.unshift(_r(e,o,l)),o=kr(e,t),o!=null&&s.push(_r(e,o,l))),e=e.return}return s}function mn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Ya(e,t,n,s,l){for(var o=t._reactName,i=[];n!==null&&n!==s;){var c=n,a=c.alternate,d=c.stateNode;if(a!==null&&a===s)break;c.tag===5&&d!==null&&(c=d,l?(a=kr(n,o),a!=null&&i.unshift(_r(n,a,c))):l||(a=kr(n,o),a!=null&&i.push(_r(n,a,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var Sh=/\r\n?/g,kh=/\u0000|\uFFFD/g;function Xa(e){return(typeof e=="string"?e:""+e).replace(Sh,`
38
- `).replace(kh,"")}function rs(e,t,n){if(t=Xa(t),Xa(e)!==t&&n)throw Error(_(425))}function Fs(){}var Io=null,Do=null;function Ao(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Oo=typeof setTimeout=="function"?setTimeout:void 0,bh=typeof clearTimeout=="function"?clearTimeout:void 0,Ja=typeof Promise=="function"?Promise:void 0,Nh=typeof queueMicrotask=="function"?queueMicrotask:typeof Ja<"u"?function(e){return Ja.resolve(null).then(e).catch(zh)}:Oo;function zh(e){setTimeout(function(){throw e})}function Yl(e,t){var n=t,s=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(s===0){e.removeChild(l),zr(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=l}while(n);zr(t)}function At(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Za(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Yn=Math.random().toString(36).slice(2),ct="__reactFiber$"+Yn,Rr="__reactProps$"+Yn,yt="__reactContainer$"+Yn,Bo="__reactEvents$"+Yn,Ch="__reactListeners$"+Yn,Eh="__reactHandles$"+Yn;function tn(e){var t=e[ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yt]||n[ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Za(e);e!==null;){if(n=e[ct])return n;e=Za(e)}return t}e=n,n=e.parentNode}return null}function Fr(e){return e=e[ct]||e[yt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Nn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(_(33))}function fl(e){return e[Rr]||null}var Wo=[],zn=-1;function Kt(e){return{current:e}}function X(e){0>zn||(e.current=Wo[zn],Wo[zn]=null,zn--)}function q(e,t){zn++,Wo[zn]=e.current,e.current=t}var Ht={},Se=Kt(Ht),Pe=Kt(!1),on=Ht;function Wn(e,t){var n=e.type.contextTypes;if(!n)return Ht;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Le(e){return e=e.childContextTypes,e!=null}function Hs(){X(Pe),X(Se)}function ec(e,t,n){if(Se.current!==Ht)throw Error(_(168));q(Se,t),q(Pe,n)}function iu(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var l in s)if(!(l in t))throw Error(_(108,pf(e)||"Unknown",l));return te({},n,s)}function Us(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ht,on=Se.current,q(Se,e),q(Pe,Pe.current),!0}function tc(e,t,n){var s=e.stateNode;if(!s)throw Error(_(169));n?(e=iu(e,t,on),s.__reactInternalMemoizedMergedChildContext=e,X(Pe),X(Se),q(Se,e)):X(Pe),q(Pe,n)}var ht=null,hl=!1,Xl=!1;function au(e){ht===null?ht=[e]:ht.push(e)}function Th(e){hl=!0,au(e)}function Qt(){if(!Xl&&ht!==null){Xl=!0;var e=0,t=V;try{var n=ht;for(V=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}ht=null,hl=!1}catch(l){throw ht!==null&&(ht=ht.slice(e+1)),Pd(Ni,Qt),l}finally{V=t,Xl=!1}}return null}var Cn=[],En=0,Vs=null,Ks=0,Ue=[],Ve=0,an=null,mt=1,xt="";function Jt(e,t){Cn[En++]=Ks,Cn[En++]=Vs,Vs=e,Ks=t}function cu(e,t,n){Ue[Ve++]=mt,Ue[Ve++]=xt,Ue[Ve++]=an,an=e;var s=mt;e=xt;var l=32-rt(s)-1;s&=~(1<<l),n+=1;var o=32-rt(t)+l;if(30<o){var i=l-l%5;o=(s&(1<<i)-1).toString(32),s>>=i,l-=i,mt=1<<32-rt(t)+l|n<<l|s,xt=o+e}else mt=1<<o|n<<l|s,xt=e}function Li(e){e.return!==null&&(Jt(e,1),cu(e,1,0))}function Ii(e){for(;e===Vs;)Vs=Cn[--En],Cn[En]=null,Ks=Cn[--En],Cn[En]=null;for(;e===an;)an=Ue[--Ve],Ue[Ve]=null,xt=Ue[--Ve],Ue[Ve]=null,mt=Ue[--Ve],Ue[Ve]=null}var Oe=null,Ae=null,J=!1,nt=null;function du(e,t){var n=Ke(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function nc(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Oe=e,Ae=At(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Oe=e,Ae=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=an!==null?{id:mt,overflow:xt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ke(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Oe=e,Ae=null,!0):!1;default:return!1}}function $o(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Fo(e){if(J){var t=Ae;if(t){var n=t;if(!nc(e,t)){if($o(e))throw Error(_(418));t=At(n.nextSibling);var s=Oe;t&&nc(e,t)?du(s,n):(e.flags=e.flags&-4097|2,J=!1,Oe=e)}}else{if($o(e))throw Error(_(418));e.flags=e.flags&-4097|2,J=!1,Oe=e}}}function rc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Oe=e}function ss(e){if(e!==Oe)return!1;if(!J)return rc(e),J=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ao(e.type,e.memoizedProps)),t&&(t=Ae)){if($o(e))throw uu(),Error(_(418));for(;t;)du(e,t),t=At(t.nextSibling)}if(rc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(_(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ae=At(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ae=null}}else Ae=Oe?At(e.stateNode.nextSibling):null;return!0}function uu(){for(var e=Ae;e;)e=At(e.nextSibling)}function $n(){Ae=Oe=null,J=!1}function Di(e){nt===null?nt=[e]:nt.push(e)}var _h=St.ReactCurrentBatchConfig;function nr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(_(309));var s=n.stateNode}if(!s)throw Error(_(147,e));var l=s,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(i){var c=l.refs;i===null?delete c[o]:c[o]=i},t._stringRef=o,t)}if(typeof e!="string")throw Error(_(284));if(!n._owner)throw Error(_(290,e))}return e}function ls(e,t){throw e=Object.prototype.toString.call(t),Error(_(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function sc(e){var t=e._init;return t(e._payload)}function pu(e){function t(v,h){if(e){var x=v.deletions;x===null?(v.deletions=[h],v.flags|=16):x.push(h)}}function n(v,h){if(!e)return null;for(;h!==null;)t(v,h),h=h.sibling;return null}function s(v,h){for(v=new Map;h!==null;)h.key!==null?v.set(h.key,h):v.set(h.index,h),h=h.sibling;return v}function l(v,h){return v=$t(v,h),v.index=0,v.sibling=null,v}function o(v,h,x){return v.index=x,e?(x=v.alternate,x!==null?(x=x.index,x<h?(v.flags|=2,h):x):(v.flags|=2,h)):(v.flags|=1048576,h)}function i(v){return e&&v.alternate===null&&(v.flags|=2),v}function c(v,h,x,j){return h===null||h.tag!==6?(h=so(x,v.mode,j),h.return=v,h):(h=l(h,x),h.return=v,h)}function a(v,h,x,j){var S=x.type;return S===wn?u(v,h,x.props.children,j,x.key):h!==null&&(h.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===zt&&sc(S)===h.type)?(j=l(h,x.props),j.ref=nr(v,h,x),j.return=v,j):(j=Ps(x.type,x.key,x.props,null,v.mode,j),j.ref=nr(v,h,x),j.return=v,j)}function d(v,h,x,j){return h===null||h.tag!==4||h.stateNode.containerInfo!==x.containerInfo||h.stateNode.implementation!==x.implementation?(h=lo(x,v.mode,j),h.return=v,h):(h=l(h,x.children||[]),h.return=v,h)}function u(v,h,x,j,S){return h===null||h.tag!==7?(h=ln(x,v.mode,j,S),h.return=v,h):(h=l(h,x),h.return=v,h)}function f(v,h,x){if(typeof h=="string"&&h!==""||typeof h=="number")return h=so(""+h,v.mode,x),h.return=v,h;if(typeof h=="object"&&h!==null){switch(h.$$typeof){case qr:return x=Ps(h.type,h.key,h.props,null,v.mode,x),x.ref=nr(v,null,h),x.return=v,x;case jn:return h=lo(h,v.mode,x),h.return=v,h;case zt:var j=h._init;return f(v,j(h._payload),x)}if(ir(h)||Xn(h))return h=ln(h,v.mode,x,null),h.return=v,h;ls(v,h)}return null}function m(v,h,x,j){var S=h!==null?h.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return S!==null?null:c(v,h,""+x,j);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case qr:return x.key===S?a(v,h,x,j):null;case jn:return x.key===S?d(v,h,x,j):null;case zt:return S=x._init,m(v,h,S(x._payload),j)}if(ir(x)||Xn(x))return S!==null?null:u(v,h,x,j,null);ls(v,x)}return null}function g(v,h,x,j,S){if(typeof j=="string"&&j!==""||typeof j=="number")return v=v.get(x)||null,c(h,v,""+j,S);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case qr:return v=v.get(j.key===null?x:j.key)||null,a(h,v,j,S);case jn:return v=v.get(j.key===null?x:j.key)||null,d(h,v,j,S);case zt:var C=j._init;return g(v,h,x,C(j._payload),S)}if(ir(j)||Xn(j))return v=v.get(x)||null,u(h,v,j,S,null);ls(h,j)}return null}function y(v,h,x,j){for(var S=null,C=null,E=h,R=h=0,O=null;E!==null&&R<x.length;R++){E.index>R?(O=E,E=null):O=E.sibling;var D=m(v,E,x[R],j);if(D===null){E===null&&(E=O);break}e&&E&&D.alternate===null&&t(v,E),h=o(D,h,R),C===null?S=D:C.sibling=D,C=D,E=O}if(R===x.length)return n(v,E),J&&Jt(v,R),S;if(E===null){for(;R<x.length;R++)E=f(v,x[R],j),E!==null&&(h=o(E,h,R),C===null?S=E:C.sibling=E,C=E);return J&&Jt(v,R),S}for(E=s(v,E);R<x.length;R++)O=g(E,v,R,x[R],j),O!==null&&(e&&O.alternate!==null&&E.delete(O.key===null?R:O.key),h=o(O,h,R),C===null?S=O:C.sibling=O,C=O);return e&&E.forEach(function(ne){return t(v,ne)}),J&&Jt(v,R),S}function p(v,h,x,j){var S=Xn(x);if(typeof S!="function")throw Error(_(150));if(x=S.call(x),x==null)throw Error(_(151));for(var C=S=null,E=h,R=h=0,O=null,D=x.next();E!==null&&!D.done;R++,D=x.next()){E.index>R?(O=E,E=null):O=E.sibling;var ne=m(v,E,D.value,j);if(ne===null){E===null&&(E=O);break}e&&E&&ne.alternate===null&&t(v,E),h=o(ne,h,R),C===null?S=ne:C.sibling=ne,C=ne,E=O}if(D.done)return n(v,E),J&&Jt(v,R),S;if(E===null){for(;!D.done;R++,D=x.next())D=f(v,D.value,j),D!==null&&(h=o(D,h,R),C===null?S=D:C.sibling=D,C=D);return J&&Jt(v,R),S}for(E=s(v,E);!D.done;R++,D=x.next())D=g(E,v,R,D.value,j),D!==null&&(e&&D.alternate!==null&&E.delete(D.key===null?R:D.key),h=o(D,h,R),C===null?S=D:C.sibling=D,C=D);return e&&E.forEach(function(fe){return t(v,fe)}),J&&Jt(v,R),S}function w(v,h,x,j){if(typeof x=="object"&&x!==null&&x.type===wn&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case qr:e:{for(var S=x.key,C=h;C!==null;){if(C.key===S){if(S=x.type,S===wn){if(C.tag===7){n(v,C.sibling),h=l(C,x.props.children),h.return=v,v=h;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===zt&&sc(S)===C.type){n(v,C.sibling),h=l(C,x.props),h.ref=nr(v,C,x),h.return=v,v=h;break e}n(v,C);break}else t(v,C);C=C.sibling}x.type===wn?(h=ln(x.props.children,v.mode,j,x.key),h.return=v,v=h):(j=Ps(x.type,x.key,x.props,null,v.mode,j),j.ref=nr(v,h,x),j.return=v,v=j)}return i(v);case jn:e:{for(C=x.key;h!==null;){if(h.key===C)if(h.tag===4&&h.stateNode.containerInfo===x.containerInfo&&h.stateNode.implementation===x.implementation){n(v,h.sibling),h=l(h,x.children||[]),h.return=v,v=h;break e}else{n(v,h);break}else t(v,h);h=h.sibling}h=lo(x,v.mode,j),h.return=v,v=h}return i(v);case zt:return C=x._init,w(v,h,C(x._payload),j)}if(ir(x))return y(v,h,x,j);if(Xn(x))return p(v,h,x,j);ls(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,h!==null&&h.tag===6?(n(v,h.sibling),h=l(h,x),h.return=v,v=h):(n(v,h),h=so(x,v.mode,j),h.return=v,v=h),i(v)):n(v,h)}return w}var Fn=pu(!0),fu=pu(!1),Qs=Kt(null),qs=null,Tn=null,Ai=null;function Oi(){Ai=Tn=qs=null}function Bi(e){var t=Qs.current;X(Qs),e._currentValue=t}function Ho(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function An(e,t){qs=e,Ai=Tn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Me=!0),e.firstContext=null)}function Ge(e){var t=e._currentValue;if(Ai!==e)if(e={context:e,memoizedValue:t,next:null},Tn===null){if(qs===null)throw Error(_(308));Tn=e,qs.dependencies={lanes:0,firstContext:e}}else Tn=Tn.next=e;return t}var nn=null;function Wi(e){nn===null?nn=[e]:nn.push(e)}function hu(e,t,n,s){var l=t.interleaved;return l===null?(n.next=n,Wi(t)):(n.next=l.next,l.next=n),t.interleaved=n,jt(e,s)}function jt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ct=!1;function $i(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function gt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ot(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,$&2){var l=s.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),s.pending=t,jt(e,n)}return l=s.interleaved,l===null?(t.next=t,Wi(s)):(t.next=l.next,l.next=t),s.interleaved=t,jt(e,n)}function Cs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,zi(e,n)}}function lc(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:s.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Gs(e,t,n,s){var l=e.updateQueue;Ct=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,c=l.shared.pending;if(c!==null){l.shared.pending=null;var a=c,d=a.next;a.next=null,i===null?o=d:i.next=d,i=a;var u=e.alternate;u!==null&&(u=u.updateQueue,c=u.lastBaseUpdate,c!==i&&(c===null?u.firstBaseUpdate=d:c.next=d,u.lastBaseUpdate=a))}if(o!==null){var f=l.baseState;i=0,u=d=a=null,c=o;do{var m=c.lane,g=c.eventTime;if((s&m)===m){u!==null&&(u=u.next={eventTime:g,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var y=e,p=c;switch(m=t,g=n,p.tag){case 1:if(y=p.payload,typeof y=="function"){f=y.call(g,f,m);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=p.payload,m=typeof y=="function"?y.call(g,f,m):y,m==null)break e;f=te({},f,m);break e;case 2:Ct=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,m=l.effects,m===null?l.effects=[c]:m.push(c))}else g={eventTime:g,lane:m,tag:c.tag,payload:c.payload,callback:c.callback,next:null},u===null?(d=u=g,a=f):u=u.next=g,i|=m;if(c=c.next,c===null){if(c=l.shared.pending,c===null)break;m=c,c=m.next,m.next=null,l.lastBaseUpdate=m,l.shared.pending=null}}while(!0);if(u===null&&(a=f),l.baseState=a,l.firstBaseUpdate=d,l.lastBaseUpdate=u,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);dn|=i,e.lanes=i,e.memoizedState=f}}function oc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],l=s.callback;if(l!==null){if(s.callback=null,s=n,typeof l!="function")throw Error(_(191,l));l.call(s)}}}var Hr={},pt=Kt(Hr),Mr=Kt(Hr),Pr=Kt(Hr);function rn(e){if(e===Hr)throw Error(_(174));return e}function Fi(e,t){switch(q(Pr,t),q(Mr,e),q(pt,Hr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ko(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ko(t,e)}X(pt),q(pt,t)}function Hn(){X(pt),X(Mr),X(Pr)}function xu(e){rn(Pr.current);var t=rn(pt.current),n=ko(t,e.type);t!==n&&(q(Mr,e),q(pt,n))}function Hi(e){Mr.current===e&&(X(pt),X(Mr))}var Z=Kt(0);function Ys(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Jl=[];function Ui(){for(var e=0;e<Jl.length;e++)Jl[e]._workInProgressVersionPrimary=null;Jl.length=0}var Es=St.ReactCurrentDispatcher,Zl=St.ReactCurrentBatchConfig,cn=0,ee=null,ce=null,ue=null,Xs=!1,xr=!1,Lr=0,Rh=0;function ye(){throw Error(_(321))}function Vi(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ot(e[n],t[n]))return!1;return!0}function Ki(e,t,n,s,l,o){if(cn=o,ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Es.current=e===null||e.memoizedState===null?Ih:Dh,e=n(s,l),xr){o=0;do{if(xr=!1,Lr=0,25<=o)throw Error(_(301));o+=1,ue=ce=null,t.updateQueue=null,Es.current=Ah,e=n(s,l)}while(xr)}if(Es.current=Js,t=ce!==null&&ce.next!==null,cn=0,ue=ce=ee=null,Xs=!1,t)throw Error(_(300));return e}function Qi(){var e=Lr!==0;return Lr=0,e}function at(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ue===null?ee.memoizedState=ue=e:ue=ue.next=e,ue}function Ye(){if(ce===null){var e=ee.alternate;e=e!==null?e.memoizedState:null}else e=ce.next;var t=ue===null?ee.memoizedState:ue.next;if(t!==null)ue=t,ce=e;else{if(e===null)throw Error(_(310));ce=e,e={memoizedState:ce.memoizedState,baseState:ce.baseState,baseQueue:ce.baseQueue,queue:ce.queue,next:null},ue===null?ee.memoizedState=ue=e:ue=ue.next=e}return ue}function Ir(e,t){return typeof t=="function"?t(e):t}function eo(e){var t=Ye(),n=t.queue;if(n===null)throw Error(_(311));n.lastRenderedReducer=e;var s=ce,l=s.baseQueue,o=n.pending;if(o!==null){if(l!==null){var i=l.next;l.next=o.next,o.next=i}s.baseQueue=l=o,n.pending=null}if(l!==null){o=l.next,s=s.baseState;var c=i=null,a=null,d=o;do{var u=d.lane;if((cn&u)===u)a!==null&&(a=a.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),s=d.hasEagerState?d.eagerState:e(s,d.action);else{var f={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};a===null?(c=a=f,i=s):a=a.next=f,ee.lanes|=u,dn|=u}d=d.next}while(d!==null&&d!==o);a===null?i=s:a.next=c,ot(s,t.memoizedState)||(Me=!0),t.memoizedState=s,t.baseState=i,t.baseQueue=a,n.lastRenderedState=s}if(e=n.interleaved,e!==null){l=e;do o=l.lane,ee.lanes|=o,dn|=o,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function to(e){var t=Ye(),n=t.queue;if(n===null)throw Error(_(311));n.lastRenderedReducer=e;var s=n.dispatch,l=n.pending,o=t.memoizedState;if(l!==null){n.pending=null;var i=l=l.next;do o=e(o,i.action),i=i.next;while(i!==l);ot(o,t.memoizedState)||(Me=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,s]}function gu(){}function vu(e,t){var n=ee,s=Ye(),l=t(),o=!ot(s.memoizedState,l);if(o&&(s.memoizedState=l,Me=!0),s=s.queue,qi(wu.bind(null,n,s,e),[e]),s.getSnapshot!==t||o||ue!==null&&ue.memoizedState.tag&1){if(n.flags|=2048,Dr(9,ju.bind(null,n,s,l,t),void 0,null),pe===null)throw Error(_(349));cn&30||yu(n,t,l)}return l}function yu(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ee.updateQueue,t===null?(t={lastEffect:null,stores:null},ee.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ju(e,t,n,s){t.value=n,t.getSnapshot=s,Su(t)&&ku(e)}function wu(e,t,n){return n(function(){Su(t)&&ku(e)})}function Su(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ot(e,n)}catch{return!0}}function ku(e){var t=jt(e,1);t!==null&&st(t,e,1,-1)}function ic(e){var t=at();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:e},t.queue=e,e=e.dispatch=Lh.bind(null,ee,e),[t.memoizedState,e]}function Dr(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=ee.updateQueue,t===null?(t={lastEffect:null,stores:null},ee.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function bu(){return Ye().memoizedState}function Ts(e,t,n,s){var l=at();ee.flags|=e,l.memoizedState=Dr(1|t,n,void 0,s===void 0?null:s)}function ml(e,t,n,s){var l=Ye();s=s===void 0?null:s;var o=void 0;if(ce!==null){var i=ce.memoizedState;if(o=i.destroy,s!==null&&Vi(s,i.deps)){l.memoizedState=Dr(t,n,o,s);return}}ee.flags|=e,l.memoizedState=Dr(1|t,n,o,s)}function ac(e,t){return Ts(8390656,8,e,t)}function qi(e,t){return ml(2048,8,e,t)}function Nu(e,t){return ml(4,2,e,t)}function zu(e,t){return ml(4,4,e,t)}function Cu(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Eu(e,t,n){return n=n!=null?n.concat([e]):null,ml(4,4,Cu.bind(null,t,e),n)}function Gi(){}function Tu(e,t){var n=Ye();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Vi(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function _u(e,t){var n=Ye();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Vi(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function Ru(e,t,n){return cn&21?(ot(n,t)||(n=Dd(),ee.lanes|=n,dn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Me=!0),e.memoizedState=n)}function Mh(e,t){var n=V;V=n!==0&&4>n?n:4,e(!0);var s=Zl.transition;Zl.transition={};try{e(!1),t()}finally{V=n,Zl.transition=s}}function Mu(){return Ye().memoizedState}function Ph(e,t,n){var s=Wt(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},Pu(e))Lu(t,n);else if(n=hu(e,t,n,s),n!==null){var l=Ne();st(n,e,s,l),Iu(n,t,s)}}function Lh(e,t,n){var s=Wt(e),l={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(Pu(e))Lu(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,c=o(i,n);if(l.hasEagerState=!0,l.eagerState=c,ot(c,i)){var a=t.interleaved;a===null?(l.next=l,Wi(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=hu(e,t,l,s),n!==null&&(l=Ne(),st(n,e,s,l),Iu(n,t,s))}}function Pu(e){var t=e.alternate;return e===ee||t!==null&&t===ee}function Lu(e,t){xr=Xs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Iu(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,zi(e,n)}}var Js={readContext:Ge,useCallback:ye,useContext:ye,useEffect:ye,useImperativeHandle:ye,useInsertionEffect:ye,useLayoutEffect:ye,useMemo:ye,useReducer:ye,useRef:ye,useState:ye,useDebugValue:ye,useDeferredValue:ye,useTransition:ye,useMutableSource:ye,useSyncExternalStore:ye,useId:ye,unstable_isNewReconciler:!1},Ih={readContext:Ge,useCallback:function(e,t){return at().memoizedState=[e,t===void 0?null:t],e},useContext:Ge,useEffect:ac,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ts(4194308,4,Cu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ts(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ts(4,2,e,t)},useMemo:function(e,t){var n=at();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=at();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=Ph.bind(null,ee,e),[s.memoizedState,e]},useRef:function(e){var t=at();return e={current:e},t.memoizedState=e},useState:ic,useDebugValue:Gi,useDeferredValue:function(e){return at().memoizedState=e},useTransition:function(){var e=ic(!1),t=e[0];return e=Mh.bind(null,e[1]),at().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=ee,l=at();if(J){if(n===void 0)throw Error(_(407));n=n()}else{if(n=t(),pe===null)throw Error(_(349));cn&30||yu(s,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,ac(wu.bind(null,s,o,e),[e]),s.flags|=2048,Dr(9,ju.bind(null,s,o,n,t),void 0,null),n},useId:function(){var e=at(),t=pe.identifierPrefix;if(J){var n=xt,s=mt;n=(s&~(1<<32-rt(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=Lr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Rh++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Dh={readContext:Ge,useCallback:Tu,useContext:Ge,useEffect:qi,useImperativeHandle:Eu,useInsertionEffect:Nu,useLayoutEffect:zu,useMemo:_u,useReducer:eo,useRef:bu,useState:function(){return eo(Ir)},useDebugValue:Gi,useDeferredValue:function(e){var t=Ye();return Ru(t,ce.memoizedState,e)},useTransition:function(){var e=eo(Ir)[0],t=Ye().memoizedState;return[e,t]},useMutableSource:gu,useSyncExternalStore:vu,useId:Mu,unstable_isNewReconciler:!1},Ah={readContext:Ge,useCallback:Tu,useContext:Ge,useEffect:qi,useImperativeHandle:Eu,useInsertionEffect:Nu,useLayoutEffect:zu,useMemo:_u,useReducer:to,useRef:bu,useState:function(){return to(Ir)},useDebugValue:Gi,useDeferredValue:function(e){var t=Ye();return ce===null?t.memoizedState=e:Ru(t,ce.memoizedState,e)},useTransition:function(){var e=to(Ir)[0],t=Ye().memoizedState;return[e,t]},useMutableSource:gu,useSyncExternalStore:vu,useId:Mu,unstable_isNewReconciler:!1};function et(e,t){if(e&&e.defaultProps){t=te({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Uo(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:te({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var xl={isMounted:function(e){return(e=e._reactInternals)?hn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Ne(),l=Wt(e),o=gt(s,l);o.payload=t,n!=null&&(o.callback=n),t=Ot(e,o,l),t!==null&&(st(t,e,l,s),Cs(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Ne(),l=Wt(e),o=gt(s,l);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Ot(e,o,l),t!==null&&(st(t,e,l,s),Cs(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ne(),s=Wt(e),l=gt(n,s);l.tag=2,t!=null&&(l.callback=t),t=Ot(e,l,s),t!==null&&(st(t,e,s,n),Cs(t,e,s))}};function cc(e,t,n,s,l,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,o,i):t.prototype&&t.prototype.isPureReactComponent?!Er(n,s)||!Er(l,o):!0}function Du(e,t,n){var s=!1,l=Ht,o=t.contextType;return typeof o=="object"&&o!==null?o=Ge(o):(l=Le(t)?on:Se.current,s=t.contextTypes,o=(s=s!=null)?Wn(e,l):Ht),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=xl,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=o),t}function dc(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&xl.enqueueReplaceState(t,t.state,null)}function Vo(e,t,n,s){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},$i(e);var o=t.contextType;typeof o=="object"&&o!==null?l.context=Ge(o):(o=Le(t)?on:Se.current,l.context=Wn(e,o)),l.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Uo(e,t,o,n),l.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(t=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),t!==l.state&&xl.enqueueReplaceState(l,l.state,null),Gs(e,n,l,s),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function Un(e,t){try{var n="",s=t;do n+=uf(s),s=s.return;while(s);var l=n}catch(o){l=`
39
- Error generating stack: `+o.message+`
40
- `+o.stack}return{value:e,source:t,stack:l,digest:null}}function no(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ko(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Oh=typeof WeakMap=="function"?WeakMap:Map;function Au(e,t,n){n=gt(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){el||(el=!0,ni=s),Ko(e,t)},n}function Ou(e,t,n){n=gt(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var l=t.value;n.payload=function(){return s(l)},n.callback=function(){Ko(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Ko(e,t),typeof s!="function"&&(Bt===null?Bt=new Set([this]):Bt.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function uc(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Oh;var l=new Set;s.set(t,l)}else l=s.get(t),l===void 0&&(l=new Set,s.set(t,l));l.has(n)||(l.add(n),e=Jh.bind(null,e,t,n),t.then(e,e))}function pc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function fc(e,t,n,s,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=gt(-1,1),t.tag=2,Ot(n,t,1))),n.lanes|=1),e)}var Bh=St.ReactCurrentOwner,Me=!1;function be(e,t,n,s){t.child=e===null?fu(t,null,n,s):Fn(t,e.child,n,s)}function hc(e,t,n,s,l){n=n.render;var o=t.ref;return An(t,l),s=Ki(e,t,n,s,o,l),n=Qi(),e!==null&&!Me?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,wt(e,t,l)):(J&&n&&Li(t),t.flags|=1,be(e,t,s,l),t.child)}function mc(e,t,n,s,l){if(e===null){var o=n.type;return typeof o=="function"&&!ra(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Bu(e,t,o,s,l)):(e=Ps(n.type,null,s,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&l)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:Er,n(i,s)&&e.ref===t.ref)return wt(e,t,l)}return t.flags|=1,e=$t(o,s),e.ref=t.ref,e.return=t,t.child=e}function Bu(e,t,n,s,l){if(e!==null){var o=e.memoizedProps;if(Er(o,s)&&e.ref===t.ref)if(Me=!1,t.pendingProps=s=o,(e.lanes&l)!==0)e.flags&131072&&(Me=!0);else return t.lanes=e.lanes,wt(e,t,l)}return Qo(e,t,n,s,l)}function Wu(e,t,n){var s=t.pendingProps,l=s.children,o=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},q(Rn,De),De|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,q(Rn,De),De|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=o!==null?o.baseLanes:n,q(Rn,De),De|=s}else o!==null?(s=o.baseLanes|n,t.memoizedState=null):s=n,q(Rn,De),De|=s;return be(e,t,l,n),t.child}function $u(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Qo(e,t,n,s,l){var o=Le(n)?on:Se.current;return o=Wn(t,o),An(t,l),n=Ki(e,t,n,s,o,l),s=Qi(),e!==null&&!Me?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,wt(e,t,l)):(J&&s&&Li(t),t.flags|=1,be(e,t,n,l),t.child)}function xc(e,t,n,s,l){if(Le(n)){var o=!0;Us(t)}else o=!1;if(An(t,l),t.stateNode===null)_s(e,t),Du(t,n,s),Vo(t,n,s,l),s=!0;else if(e===null){var i=t.stateNode,c=t.memoizedProps;i.props=c;var a=i.context,d=n.contextType;typeof d=="object"&&d!==null?d=Ge(d):(d=Le(n)?on:Se.current,d=Wn(t,d));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(c!==s||a!==d)&&dc(t,i,s,d),Ct=!1;var m=t.memoizedState;i.state=m,Gs(t,s,i,l),a=t.memoizedState,c!==s||m!==a||Pe.current||Ct?(typeof u=="function"&&(Uo(t,n,u,s),a=t.memoizedState),(c=Ct||cc(t,n,c,s,m,a,d))?(f||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=a),i.props=s,i.state=a,i.context=d,s=c):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{i=t.stateNode,mu(e,t),c=t.memoizedProps,d=t.type===t.elementType?c:et(t.type,c),i.props=d,f=t.pendingProps,m=i.context,a=n.contextType,typeof a=="object"&&a!==null?a=Ge(a):(a=Le(n)?on:Se.current,a=Wn(t,a));var g=n.getDerivedStateFromProps;(u=typeof g=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(c!==f||m!==a)&&dc(t,i,s,a),Ct=!1,m=t.memoizedState,i.state=m,Gs(t,s,i,l);var y=t.memoizedState;c!==f||m!==y||Pe.current||Ct?(typeof g=="function"&&(Uo(t,n,g,s),y=t.memoizedState),(d=Ct||cc(t,n,d,s,m,y,a)||!1)?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(s,y,a),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(s,y,a)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||c===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=y),i.props=s,i.state=y,i.context=a,s=d):(typeof i.componentDidUpdate!="function"||c===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),s=!1)}return qo(e,t,n,s,o,l)}function qo(e,t,n,s,l,o){$u(e,t);var i=(t.flags&128)!==0;if(!s&&!i)return l&&tc(t,n,!1),wt(e,t,o);s=t.stateNode,Bh.current=t;var c=i&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&i?(t.child=Fn(t,e.child,null,o),t.child=Fn(t,null,c,o)):be(e,t,c,o),t.memoizedState=s.state,l&&tc(t,n,!0),t.child}function Fu(e){var t=e.stateNode;t.pendingContext?ec(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ec(e,t.context,!1),Fi(e,t.containerInfo)}function gc(e,t,n,s,l){return $n(),Di(l),t.flags|=256,be(e,t,n,s),t.child}var Go={dehydrated:null,treeContext:null,retryLane:0};function Yo(e){return{baseLanes:e,cachePool:null,transitions:null}}function Hu(e,t,n){var s=t.pendingProps,l=Z.current,o=!1,i=(t.flags&128)!==0,c;if((c=i)||(c=e!==null&&e.memoizedState===null?!1:(l&2)!==0),c?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),q(Z,l&1),e===null)return Fo(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=s.children,e=s.fallback,o?(s=t.mode,o=t.child,i={mode:"hidden",children:i},!(s&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=yl(i,s,0,null),e=ln(e,s,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Yo(n),t.memoizedState=Go,e):Yi(t,i));if(l=e.memoizedState,l!==null&&(c=l.dehydrated,c!==null))return Wh(e,t,i,s,c,l,n);if(o){o=s.fallback,i=t.mode,l=e.child,c=l.sibling;var a={mode:"hidden",children:s.children};return!(i&1)&&t.child!==l?(s=t.child,s.childLanes=0,s.pendingProps=a,t.deletions=null):(s=$t(l,a),s.subtreeFlags=l.subtreeFlags&14680064),c!==null?o=$t(c,o):(o=ln(o,i,n,null),o.flags|=2),o.return=t,s.return=t,s.sibling=o,t.child=s,s=o,o=t.child,i=e.child.memoizedState,i=i===null?Yo(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=Go,s}return o=e.child,e=o.sibling,s=$t(o,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function Yi(e,t){return t=yl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function os(e,t,n,s){return s!==null&&Di(s),Fn(t,e.child,null,n),e=Yi(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Wh(e,t,n,s,l,o,i){if(n)return t.flags&256?(t.flags&=-257,s=no(Error(_(422))),os(e,t,i,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=s.fallback,l=t.mode,s=yl({mode:"visible",children:s.children},l,0,null),o=ln(o,l,i,null),o.flags|=2,s.return=t,o.return=t,s.sibling=o,t.child=s,t.mode&1&&Fn(t,e.child,null,i),t.child.memoizedState=Yo(i),t.memoizedState=Go,o);if(!(t.mode&1))return os(e,t,i,null);if(l.data==="$!"){if(s=l.nextSibling&&l.nextSibling.dataset,s)var c=s.dgst;return s=c,o=Error(_(419)),s=no(o,s,void 0),os(e,t,i,s)}if(c=(i&e.childLanes)!==0,Me||c){if(s=pe,s!==null){switch(i&-i){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(s.suspendedLanes|i)?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,jt(e,l),st(s,e,l,-1))}return na(),s=no(Error(_(421))),os(e,t,i,s)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Zh.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,Ae=At(l.nextSibling),Oe=t,J=!0,nt=null,e!==null&&(Ue[Ve++]=mt,Ue[Ve++]=xt,Ue[Ve++]=an,mt=e.id,xt=e.overflow,an=t),t=Yi(t,s.children),t.flags|=4096,t)}function vc(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Ho(e.return,t,n)}function ro(e,t,n,s,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=s,o.tail=n,o.tailMode=l)}function Uu(e,t,n){var s=t.pendingProps,l=s.revealOrder,o=s.tail;if(be(e,t,s.children,n),s=Z.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vc(e,n,t);else if(e.tag===19)vc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(q(Z,s),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Ys(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),ro(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Ys(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}ro(t,!0,n,null,o);break;case"together":ro(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function _s(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function wt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),dn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(_(153));if(t.child!==null){for(e=t.child,n=$t(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=$t(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function $h(e,t,n){switch(t.tag){case 3:Fu(t),$n();break;case 5:xu(t);break;case 1:Le(t.type)&&Us(t);break;case 4:Fi(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,l=t.memoizedProps.value;q(Qs,s._currentValue),s._currentValue=l;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(q(Z,Z.current&1),t.flags|=128,null):n&t.child.childLanes?Hu(e,t,n):(q(Z,Z.current&1),e=wt(e,t,n),e!==null?e.sibling:null);q(Z,Z.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Uu(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),q(Z,Z.current),s)break;return null;case 22:case 23:return t.lanes=0,Wu(e,t,n)}return wt(e,t,n)}var Vu,Xo,Ku,Qu;Vu=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Xo=function(){};Ku=function(e,t,n,s){var l=e.memoizedProps;if(l!==s){e=t.stateNode,rn(pt.current);var o=null;switch(n){case"input":l=yo(e,l),s=yo(e,s),o=[];break;case"select":l=te({},l,{value:void 0}),s=te({},s,{value:void 0}),o=[];break;case"textarea":l=So(e,l),s=So(e,s),o=[];break;default:typeof l.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Fs)}bo(n,s);var i;n=null;for(d in l)if(!s.hasOwnProperty(d)&&l.hasOwnProperty(d)&&l[d]!=null)if(d==="style"){var c=l[d];for(i in c)c.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(wr.hasOwnProperty(d)?o||(o=[]):(o=o||[]).push(d,null));for(d in s){var a=s[d];if(c=l?.[d],s.hasOwnProperty(d)&&a!==c&&(a!=null||c!=null))if(d==="style")if(c){for(i in c)!c.hasOwnProperty(i)||a&&a.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in a)a.hasOwnProperty(i)&&c[i]!==a[i]&&(n||(n={}),n[i]=a[i])}else n||(o||(o=[]),o.push(d,n)),n=a;else d==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,c=c?c.__html:void 0,a!=null&&c!==a&&(o=o||[]).push(d,a)):d==="children"?typeof a!="string"&&typeof a!="number"||(o=o||[]).push(d,""+a):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(wr.hasOwnProperty(d)?(a!=null&&d==="onScroll"&&G("scroll",e),o||c===a||(o=[])):(o=o||[]).push(d,a))}n&&(o=o||[]).push("style",n);var d=o;(t.updateQueue=d)&&(t.flags|=4)}};Qu=function(e,t,n,s){n!==s&&(t.flags|=4)};function rr(e,t){if(!J)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function je(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,s|=l.subtreeFlags&14680064,s|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,s|=l.subtreeFlags,s|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function Fh(e,t,n){var s=t.pendingProps;switch(Ii(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return je(t),null;case 1:return Le(t.type)&&Hs(),je(t),null;case 3:return s=t.stateNode,Hn(),X(Pe),X(Se),Ui(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(ss(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,nt!==null&&(li(nt),nt=null))),Xo(e,t),je(t),null;case 5:Hi(t);var l=rn(Pr.current);if(n=t.type,e!==null&&t.stateNode!=null)Ku(e,t,n,s,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(_(166));return je(t),null}if(e=rn(pt.current),ss(t)){s=t.stateNode,n=t.type;var o=t.memoizedProps;switch(s[ct]=t,s[Rr]=o,e=(t.mode&1)!==0,n){case"dialog":G("cancel",s),G("close",s);break;case"iframe":case"object":case"embed":G("load",s);break;case"video":case"audio":for(l=0;l<cr.length;l++)G(cr[l],s);break;case"source":G("error",s);break;case"img":case"image":case"link":G("error",s),G("load",s);break;case"details":G("toggle",s);break;case"input":Ca(s,o),G("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!o.multiple},G("invalid",s);break;case"textarea":Ta(s,o),G("invalid",s)}bo(n,o),l=null;for(var i in o)if(o.hasOwnProperty(i)){var c=o[i];i==="children"?typeof c=="string"?s.textContent!==c&&(o.suppressHydrationWarning!==!0&&rs(s.textContent,c,e),l=["children",c]):typeof c=="number"&&s.textContent!==""+c&&(o.suppressHydrationWarning!==!0&&rs(s.textContent,c,e),l=["children",""+c]):wr.hasOwnProperty(i)&&c!=null&&i==="onScroll"&&G("scroll",s)}switch(n){case"input":Gr(s),Ea(s,o,!0);break;case"textarea":Gr(s),_a(s);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(s.onclick=Fs)}s=l,t.updateQueue=s,s!==null&&(t.flags|=4)}else{i=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=wd(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=i.createElement(n,{is:s.is}):(e=i.createElement(n),n==="select"&&(i=e,s.multiple?i.multiple=!0:s.size&&(i.size=s.size))):e=i.createElementNS(e,n),e[ct]=t,e[Rr]=s,Vu(e,t,!1,!1),t.stateNode=e;e:{switch(i=No(n,s),n){case"dialog":G("cancel",e),G("close",e),l=s;break;case"iframe":case"object":case"embed":G("load",e),l=s;break;case"video":case"audio":for(l=0;l<cr.length;l++)G(cr[l],e);l=s;break;case"source":G("error",e),l=s;break;case"img":case"image":case"link":G("error",e),G("load",e),l=s;break;case"details":G("toggle",e),l=s;break;case"input":Ca(e,s),l=yo(e,s),G("invalid",e);break;case"option":l=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},l=te({},s,{value:void 0}),G("invalid",e);break;case"textarea":Ta(e,s),l=So(e,s),G("invalid",e);break;default:l=s}bo(n,l),c=l;for(o in c)if(c.hasOwnProperty(o)){var a=c[o];o==="style"?bd(e,a):o==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Sd(e,a)):o==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&Sr(e,a):typeof a=="number"&&Sr(e,""+a):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(wr.hasOwnProperty(o)?a!=null&&o==="onScroll"&&G("scroll",e):a!=null&&ji(e,o,a,i))}switch(n){case"input":Gr(e),Ea(e,s,!1);break;case"textarea":Gr(e),_a(e);break;case"option":s.value!=null&&e.setAttribute("value",""+Ft(s.value));break;case"select":e.multiple=!!s.multiple,o=s.value,o!=null?Pn(e,!!s.multiple,o,!1):s.defaultValue!=null&&Pn(e,!!s.multiple,s.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=Fs)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return je(t),null;case 6:if(e&&t.stateNode!=null)Qu(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(_(166));if(n=rn(Pr.current),rn(pt.current),ss(t)){if(s=t.stateNode,n=t.memoizedProps,s[ct]=t,(o=s.nodeValue!==n)&&(e=Oe,e!==null))switch(e.tag){case 3:rs(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&rs(s.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[ct]=t,t.stateNode=s}return je(t),null;case 13:if(X(Z),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(J&&Ae!==null&&t.mode&1&&!(t.flags&128))uu(),$n(),t.flags|=98560,o=!1;else if(o=ss(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(_(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(_(317));o[ct]=t}else $n(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;je(t),o=!1}else nt!==null&&(li(nt),nt=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||Z.current&1?de===0&&(de=3):na())),t.updateQueue!==null&&(t.flags|=4),je(t),null);case 4:return Hn(),Xo(e,t),e===null&&Tr(t.stateNode.containerInfo),je(t),null;case 10:return Bi(t.type._context),je(t),null;case 17:return Le(t.type)&&Hs(),je(t),null;case 19:if(X(Z),o=t.memoizedState,o===null)return je(t),null;if(s=(t.flags&128)!==0,i=o.rendering,i===null)if(s)rr(o,!1);else{if(de!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Ys(e),i!==null){for(t.flags|=128,rr(o,!1),s=i.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)o=n,e=s,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return q(Z,Z.current&1|2),t.child}e=e.sibling}o.tail!==null&&le()>Vn&&(t.flags|=128,s=!0,rr(o,!1),t.lanes=4194304)}else{if(!s)if(e=Ys(i),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),rr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!J)return je(t),null}else 2*le()-o.renderingStartTime>Vn&&n!==1073741824&&(t.flags|=128,s=!0,rr(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=le(),t.sibling=null,n=Z.current,q(Z,s?n&1|2:n&1),t):(je(t),null);case 22:case 23:return ta(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?De&1073741824&&(je(t),t.subtreeFlags&6&&(t.flags|=8192)):je(t),null;case 24:return null;case 25:return null}throw Error(_(156,t.tag))}function Hh(e,t){switch(Ii(t),t.tag){case 1:return Le(t.type)&&Hs(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hn(),X(Pe),X(Se),Ui(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Hi(t),null;case 13:if(X(Z),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(_(340));$n()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return X(Z),null;case 4:return Hn(),null;case 10:return Bi(t.type._context),null;case 22:case 23:return ta(),null;case 24:return null;default:return null}}var is=!1,we=!1,Uh=typeof WeakSet=="function"?WeakSet:Set,P=null;function _n(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){re(e,t,s)}else n.current=null}function Jo(e,t,n){try{n()}catch(s){re(e,t,s)}}var yc=!1;function Vh(e,t){if(Io=Bs,e=Jd(),Pi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var l=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,c=-1,a=-1,d=0,u=0,f=e,m=null;t:for(;;){for(var g;f!==n||l!==0&&f.nodeType!==3||(c=i+l),f!==o||s!==0&&f.nodeType!==3||(a=i+s),f.nodeType===3&&(i+=f.nodeValue.length),(g=f.firstChild)!==null;)m=f,f=g;for(;;){if(f===e)break t;if(m===n&&++d===l&&(c=i),m===o&&++u===s&&(a=i),(g=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=g}n=c===-1||a===-1?null:{start:c,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Do={focusedElem:e,selectionRange:n},Bs=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var p=y.memoizedProps,w=y.memoizedState,v=t.stateNode,h=v.getSnapshotBeforeUpdate(t.elementType===t.type?p:et(t.type,p),w);v.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(_(163))}}catch(j){re(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return y=yc,yc=!1,y}function gr(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Jo(t,n,o)}l=l.next}while(l!==s)}}function gl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function Zo(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function qu(e){var t=e.alternate;t!==null&&(e.alternate=null,qu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ct],delete t[Rr],delete t[Bo],delete t[Ch],delete t[Eh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Gu(e){return e.tag===5||e.tag===3||e.tag===4}function jc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gu(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ei(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Fs));else if(s!==4&&(e=e.child,e!==null))for(ei(e,t,n),e=e.sibling;e!==null;)ei(e,t,n),e=e.sibling}function ti(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(ti(e,t,n),e=e.sibling;e!==null;)ti(e,t,n),e=e.sibling}var me=null,tt=!1;function Nt(e,t,n){for(n=n.child;n!==null;)Yu(e,t,n),n=n.sibling}function Yu(e,t,n){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(cl,n)}catch{}switch(n.tag){case 5:we||_n(n,t);case 6:var s=me,l=tt;me=null,Nt(e,t,n),me=s,tt=l,me!==null&&(tt?(e=me,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):me.removeChild(n.stateNode));break;case 18:me!==null&&(tt?(e=me,n=n.stateNode,e.nodeType===8?Yl(e.parentNode,n):e.nodeType===1&&Yl(e,n),zr(e)):Yl(me,n.stateNode));break;case 4:s=me,l=tt,me=n.stateNode.containerInfo,tt=!0,Nt(e,t,n),me=s,tt=l;break;case 0:case 11:case 14:case 15:if(!we&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){l=s=s.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&Jo(n,t,i),l=l.next}while(l!==s)}Nt(e,t,n);break;case 1:if(!we&&(_n(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(c){re(n,t,c)}Nt(e,t,n);break;case 21:Nt(e,t,n);break;case 22:n.mode&1?(we=(s=we)||n.memoizedState!==null,Nt(e,t,n),we=s):Nt(e,t,n);break;default:Nt(e,t,n)}}function wc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Uh),t.forEach(function(s){var l=em.bind(null,e,s);n.has(s)||(n.add(s),s.then(l,l))})}}function Ze(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var l=n[s];try{var o=e,i=t,c=i;e:for(;c!==null;){switch(c.tag){case 5:me=c.stateNode,tt=!1;break e;case 3:me=c.stateNode.containerInfo,tt=!0;break e;case 4:me=c.stateNode.containerInfo,tt=!0;break e}c=c.return}if(me===null)throw Error(_(160));Yu(o,i,l),me=null,tt=!1;var a=l.alternate;a!==null&&(a.return=null),l.return=null}catch(d){re(l,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Xu(t,e),t=t.sibling}function Xu(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ze(t,e),it(e),s&4){try{gr(3,e,e.return),gl(3,e)}catch(p){re(e,e.return,p)}try{gr(5,e,e.return)}catch(p){re(e,e.return,p)}}break;case 1:Ze(t,e),it(e),s&512&&n!==null&&_n(n,n.return);break;case 5:if(Ze(t,e),it(e),s&512&&n!==null&&_n(n,n.return),e.flags&32){var l=e.stateNode;try{Sr(l,"")}catch(p){re(e,e.return,p)}}if(s&4&&(l=e.stateNode,l!=null)){var o=e.memoizedProps,i=n!==null?n.memoizedProps:o,c=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{c==="input"&&o.type==="radio"&&o.name!=null&&yd(l,o),No(c,i);var d=No(c,o);for(i=0;i<a.length;i+=2){var u=a[i],f=a[i+1];u==="style"?bd(l,f):u==="dangerouslySetInnerHTML"?Sd(l,f):u==="children"?Sr(l,f):ji(l,u,f,d)}switch(c){case"input":jo(l,o);break;case"textarea":jd(l,o);break;case"select":var m=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!o.multiple;var g=o.value;g!=null?Pn(l,!!o.multiple,g,!1):m!==!!o.multiple&&(o.defaultValue!=null?Pn(l,!!o.multiple,o.defaultValue,!0):Pn(l,!!o.multiple,o.multiple?[]:"",!1))}l[Rr]=o}catch(p){re(e,e.return,p)}}break;case 6:if(Ze(t,e),it(e),s&4){if(e.stateNode===null)throw Error(_(162));l=e.stateNode,o=e.memoizedProps;try{l.nodeValue=o}catch(p){re(e,e.return,p)}}break;case 3:if(Ze(t,e),it(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{zr(t.containerInfo)}catch(p){re(e,e.return,p)}break;case 4:Ze(t,e),it(e);break;case 13:Ze(t,e),it(e),l=e.child,l.flags&8192&&(o=l.memoizedState!==null,l.stateNode.isHidden=o,!o||l.alternate!==null&&l.alternate.memoizedState!==null||(Zi=le())),s&4&&wc(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(we=(d=we)||u,Ze(t,e),we=d):Ze(t,e),it(e),s&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(P=e,u=e.child;u!==null;){for(f=P=u;P!==null;){switch(m=P,g=m.child,m.tag){case 0:case 11:case 14:case 15:gr(4,m,m.return);break;case 1:_n(m,m.return);var y=m.stateNode;if(typeof y.componentWillUnmount=="function"){s=m,n=m.return;try{t=s,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(p){re(s,n,p)}}break;case 5:_n(m,m.return);break;case 22:if(m.memoizedState!==null){kc(f);continue}}g!==null?(g.return=m,P=g):kc(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{l=f.stateNode,d?(o=l.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(c=f.stateNode,a=f.memoizedProps.style,i=a!=null&&a.hasOwnProperty("display")?a.display:null,c.style.display=kd("display",i))}catch(p){re(e,e.return,p)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(p){re(e,e.return,p)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Ze(t,e),it(e),s&4&&wc(e);break;case 21:break;default:Ze(t,e),it(e)}}function it(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Gu(n)){var s=n;break e}n=n.return}throw Error(_(160))}switch(s.tag){case 5:var l=s.stateNode;s.flags&32&&(Sr(l,""),s.flags&=-33);var o=jc(e);ti(e,o,l);break;case 3:case 4:var i=s.stateNode.containerInfo,c=jc(e);ei(e,c,i);break;default:throw Error(_(161))}}catch(a){re(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Kh(e,t,n){P=e,Ju(e)}function Ju(e,t,n){for(var s=(e.mode&1)!==0;P!==null;){var l=P,o=l.child;if(l.tag===22&&s){var i=l.memoizedState!==null||is;if(!i){var c=l.alternate,a=c!==null&&c.memoizedState!==null||we;c=is;var d=we;if(is=i,(we=a)&&!d)for(P=l;P!==null;)i=P,a=i.child,i.tag===22&&i.memoizedState!==null?bc(l):a!==null?(a.return=i,P=a):bc(l);for(;o!==null;)P=o,Ju(o),o=o.sibling;P=l,is=c,we=d}Sc(e)}else l.subtreeFlags&8772&&o!==null?(o.return=l,P=o):Sc(e)}}function Sc(e){for(;P!==null;){var t=P;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:we||gl(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!we)if(n===null)s.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:et(t.type,n.memoizedProps);s.componentDidUpdate(l,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&oc(t,o,s);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}oc(t,i,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&zr(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(_(163))}we||t.flags&512&&Zo(t)}catch(m){re(t,t.return,m)}}if(t===e){P=null;break}if(n=t.sibling,n!==null){n.return=t.return,P=n;break}P=t.return}}function kc(e){for(;P!==null;){var t=P;if(t===e){P=null;break}var n=t.sibling;if(n!==null){n.return=t.return,P=n;break}P=t.return}}function bc(e){for(;P!==null;){var t=P;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{gl(4,t)}catch(a){re(t,n,a)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var l=t.return;try{s.componentDidMount()}catch(a){re(t,l,a)}}var o=t.return;try{Zo(t)}catch(a){re(t,o,a)}break;case 5:var i=t.return;try{Zo(t)}catch(a){re(t,i,a)}}}catch(a){re(t,t.return,a)}if(t===e){P=null;break}var c=t.sibling;if(c!==null){c.return=t.return,P=c;break}P=t.return}}var Qh=Math.ceil,Zs=St.ReactCurrentDispatcher,Xi=St.ReactCurrentOwner,Qe=St.ReactCurrentBatchConfig,$=0,pe=null,ae=null,xe=0,De=0,Rn=Kt(0),de=0,Ar=null,dn=0,vl=0,Ji=0,vr=null,Re=null,Zi=0,Vn=1/0,ft=null,el=!1,ni=null,Bt=null,as=!1,Mt=null,tl=0,yr=0,ri=null,Rs=-1,Ms=0;function Ne(){return $&6?le():Rs!==-1?Rs:Rs=le()}function Wt(e){return e.mode&1?$&2&&xe!==0?xe&-xe:_h.transition!==null?(Ms===0&&(Ms=Dd()),Ms):(e=V,e!==0||(e=window.event,e=e===void 0?16:Hd(e.type)),e):1}function st(e,t,n,s){if(50<yr)throw yr=0,ri=null,Error(_(185));Wr(e,n,s),(!($&2)||e!==pe)&&(e===pe&&(!($&2)&&(vl|=n),de===4&&Tt(e,xe)),Ie(e,s),n===1&&$===0&&!(t.mode&1)&&(Vn=le()+500,hl&&Qt()))}function Ie(e,t){var n=e.callbackNode;_f(e,t);var s=Os(e,e===pe?xe:0);if(s===0)n!==null&&Pa(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&Pa(n),t===1)e.tag===0?Th(Nc.bind(null,e)):au(Nc.bind(null,e)),Nh(function(){!($&6)&&Qt()}),n=null;else{switch(Ad(s)){case 1:n=Ni;break;case 4:n=Ld;break;case 16:n=As;break;case 536870912:n=Id;break;default:n=As}n=op(n,Zu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Zu(e,t){if(Rs=-1,Ms=0,$&6)throw Error(_(327));var n=e.callbackNode;if(On()&&e.callbackNode!==n)return null;var s=Os(e,e===pe?xe:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=nl(e,s);else{t=s;var l=$;$|=2;var o=tp();(pe!==e||xe!==t)&&(ft=null,Vn=le()+500,sn(e,t));do try{Yh();break}catch(c){ep(e,c)}while(!0);Oi(),Zs.current=o,$=l,ae!==null?t=0:(pe=null,xe=0,t=de)}if(t!==0){if(t===2&&(l=_o(e),l!==0&&(s=l,t=si(e,l))),t===1)throw n=Ar,sn(e,0),Tt(e,s),Ie(e,le()),n;if(t===6)Tt(e,s);else{if(l=e.current.alternate,!(s&30)&&!qh(l)&&(t=nl(e,s),t===2&&(o=_o(e),o!==0&&(s=o,t=si(e,o))),t===1))throw n=Ar,sn(e,0),Tt(e,s),Ie(e,le()),n;switch(e.finishedWork=l,e.finishedLanes=s,t){case 0:case 1:throw Error(_(345));case 2:Zt(e,Re,ft);break;case 3:if(Tt(e,s),(s&130023424)===s&&(t=Zi+500-le(),10<t)){if(Os(e,0)!==0)break;if(l=e.suspendedLanes,(l&s)!==s){Ne(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=Oo(Zt.bind(null,e,Re,ft),t);break}Zt(e,Re,ft);break;case 4:if(Tt(e,s),(s&4194240)===s)break;for(t=e.eventTimes,l=-1;0<s;){var i=31-rt(s);o=1<<i,i=t[i],i>l&&(l=i),s&=~o}if(s=l,s=le()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Qh(s/1960))-s,10<s){e.timeoutHandle=Oo(Zt.bind(null,e,Re,ft),s);break}Zt(e,Re,ft);break;case 5:Zt(e,Re,ft);break;default:throw Error(_(329))}}}return Ie(e,le()),e.callbackNode===n?Zu.bind(null,e):null}function si(e,t){var n=vr;return e.current.memoizedState.isDehydrated&&(sn(e,t).flags|=256),e=nl(e,t),e!==2&&(t=Re,Re=n,t!==null&&li(t)),e}function li(e){Re===null?Re=e:Re.push.apply(Re,e)}function qh(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var l=n[s],o=l.getSnapshot;l=l.value;try{if(!ot(o(),l))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Tt(e,t){for(t&=~Ji,t&=~vl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-rt(t),s=1<<n;e[n]=-1,t&=~s}}function Nc(e){if($&6)throw Error(_(327));On();var t=Os(e,0);if(!(t&1))return Ie(e,le()),null;var n=nl(e,t);if(e.tag!==0&&n===2){var s=_o(e);s!==0&&(t=s,n=si(e,s))}if(n===1)throw n=Ar,sn(e,0),Tt(e,t),Ie(e,le()),n;if(n===6)throw Error(_(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Zt(e,Re,ft),Ie(e,le()),null}function ea(e,t){var n=$;$|=1;try{return e(t)}finally{$=n,$===0&&(Vn=le()+500,hl&&Qt())}}function un(e){Mt!==null&&Mt.tag===0&&!($&6)&&On();var t=$;$|=1;var n=Qe.transition,s=V;try{if(Qe.transition=null,V=1,e)return e()}finally{V=s,Qe.transition=n,$=t,!($&6)&&Qt()}}function ta(){De=Rn.current,X(Rn)}function sn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,bh(n)),ae!==null)for(n=ae.return;n!==null;){var s=n;switch(Ii(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Hs();break;case 3:Hn(),X(Pe),X(Se),Ui();break;case 5:Hi(s);break;case 4:Hn();break;case 13:X(Z);break;case 19:X(Z);break;case 10:Bi(s.type._context);break;case 22:case 23:ta()}n=n.return}if(pe=e,ae=e=$t(e.current,null),xe=De=t,de=0,Ar=null,Ji=vl=dn=0,Re=vr=null,nn!==null){for(t=0;t<nn.length;t++)if(n=nn[t],s=n.interleaved,s!==null){n.interleaved=null;var l=s.next,o=n.pending;if(o!==null){var i=o.next;o.next=l,s.next=i}n.pending=s}nn=null}return e}function ep(e,t){do{var n=ae;try{if(Oi(),Es.current=Js,Xs){for(var s=ee.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}Xs=!1}if(cn=0,ue=ce=ee=null,xr=!1,Lr=0,Xi.current=null,n===null||n.return===null){de=1,Ar=t,ae=null;break}e:{var o=e,i=n.return,c=n,a=t;if(t=xe,c.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var d=a,u=c,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var m=u.alternate;m?(u.updateQueue=m.updateQueue,u.memoizedState=m.memoizedState,u.lanes=m.lanes):(u.updateQueue=null,u.memoizedState=null)}var g=pc(i);if(g!==null){g.flags&=-257,fc(g,i,c,o,t),g.mode&1&&uc(o,d,t),t=g,a=d;var y=t.updateQueue;if(y===null){var p=new Set;p.add(a),t.updateQueue=p}else y.add(a);break e}else{if(!(t&1)){uc(o,d,t),na();break e}a=Error(_(426))}}else if(J&&c.mode&1){var w=pc(i);if(w!==null){!(w.flags&65536)&&(w.flags|=256),fc(w,i,c,o,t),Di(Un(a,c));break e}}o=a=Un(a,c),de!==4&&(de=2),vr===null?vr=[o]:vr.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Au(o,a,t);lc(o,v);break e;case 1:c=a;var h=o.type,x=o.stateNode;if(!(o.flags&128)&&(typeof h.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Bt===null||!Bt.has(x)))){o.flags|=65536,t&=-t,o.lanes|=t;var j=Ou(o,c,t);lc(o,j);break e}}o=o.return}while(o!==null)}rp(n)}catch(S){t=S,ae===n&&n!==null&&(ae=n=n.return);continue}break}while(!0)}function tp(){var e=Zs.current;return Zs.current=Js,e===null?Js:e}function na(){(de===0||de===3||de===2)&&(de=4),pe===null||!(dn&268435455)&&!(vl&268435455)||Tt(pe,xe)}function nl(e,t){var n=$;$|=2;var s=tp();(pe!==e||xe!==t)&&(ft=null,sn(e,t));do try{Gh();break}catch(l){ep(e,l)}while(!0);if(Oi(),$=n,Zs.current=s,ae!==null)throw Error(_(261));return pe=null,xe=0,de}function Gh(){for(;ae!==null;)np(ae)}function Yh(){for(;ae!==null&&!wf();)np(ae)}function np(e){var t=lp(e.alternate,e,De);e.memoizedProps=e.pendingProps,t===null?rp(e):ae=t,Xi.current=null}function rp(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Hh(n,t),n!==null){n.flags&=32767,ae=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{de=6,ae=null;return}}else if(n=Fh(n,t,De),n!==null){ae=n;return}if(t=t.sibling,t!==null){ae=t;return}ae=t=e}while(t!==null);de===0&&(de=5)}function Zt(e,t,n){var s=V,l=Qe.transition;try{Qe.transition=null,V=1,Xh(e,t,n,s)}finally{Qe.transition=l,V=s}return null}function Xh(e,t,n,s){do On();while(Mt!==null);if($&6)throw Error(_(327));n=e.finishedWork;var l=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(_(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Rf(e,o),e===pe&&(ae=pe=null,xe=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||as||(as=!0,op(As,function(){return On(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Qe.transition,Qe.transition=null;var i=V;V=1;var c=$;$|=4,Xi.current=null,Vh(e,n),Xu(n,e),gh(Do),Bs=!!Io,Do=Io=null,e.current=n,Kh(n),Sf(),$=c,V=i,Qe.transition=o}else e.current=n;if(as&&(as=!1,Mt=e,tl=l),o=e.pendingLanes,o===0&&(Bt=null),Nf(n.stateNode),Ie(e,le()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)l=t[n],s(l.value,{componentStack:l.stack,digest:l.digest});if(el)throw el=!1,e=ni,ni=null,e;return tl&1&&e.tag!==0&&On(),o=e.pendingLanes,o&1?e===ri?yr++:(yr=0,ri=e):yr=0,Qt(),null}function On(){if(Mt!==null){var e=Ad(tl),t=Qe.transition,n=V;try{if(Qe.transition=null,V=16>e?16:e,Mt===null)var s=!1;else{if(e=Mt,Mt=null,tl=0,$&6)throw Error(_(331));var l=$;for($|=4,P=e.current;P!==null;){var o=P,i=o.child;if(P.flags&16){var c=o.deletions;if(c!==null){for(var a=0;a<c.length;a++){var d=c[a];for(P=d;P!==null;){var u=P;switch(u.tag){case 0:case 11:case 15:gr(8,u,o)}var f=u.child;if(f!==null)f.return=u,P=f;else for(;P!==null;){u=P;var m=u.sibling,g=u.return;if(qu(u),u===d){P=null;break}if(m!==null){m.return=g,P=m;break}P=g}}}var y=o.alternate;if(y!==null){var p=y.child;if(p!==null){y.child=null;do{var w=p.sibling;p.sibling=null,p=w}while(p!==null)}}P=o}}if(o.subtreeFlags&2064&&i!==null)i.return=o,P=i;else e:for(;P!==null;){if(o=P,o.flags&2048)switch(o.tag){case 0:case 11:case 15:gr(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,P=v;break e}P=o.return}}var h=e.current;for(P=h;P!==null;){i=P;var x=i.child;if(i.subtreeFlags&2064&&x!==null)x.return=i,P=x;else e:for(i=h;P!==null;){if(c=P,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:gl(9,c)}}catch(S){re(c,c.return,S)}if(c===i){P=null;break e}var j=c.sibling;if(j!==null){j.return=c.return,P=j;break e}P=c.return}}if($=l,Qt(),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(cl,e)}catch{}s=!0}return s}finally{V=n,Qe.transition=t}}return!1}function zc(e,t,n){t=Un(n,t),t=Au(e,t,1),e=Ot(e,t,1),t=Ne(),e!==null&&(Wr(e,1,t),Ie(e,t))}function re(e,t,n){if(e.tag===3)zc(e,e,n);else for(;t!==null;){if(t.tag===3){zc(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Bt===null||!Bt.has(s))){e=Un(n,e),e=Ou(t,e,1),t=Ot(t,e,1),e=Ne(),t!==null&&(Wr(t,1,e),Ie(t,e));break}}t=t.return}}function Jh(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=Ne(),e.pingedLanes|=e.suspendedLanes&n,pe===e&&(xe&n)===n&&(de===4||de===3&&(xe&130023424)===xe&&500>le()-Zi?sn(e,0):Ji|=n),Ie(e,t)}function sp(e,t){t===0&&(e.mode&1?(t=Jr,Jr<<=1,!(Jr&130023424)&&(Jr=4194304)):t=1);var n=Ne();e=jt(e,t),e!==null&&(Wr(e,t,n),Ie(e,n))}function Zh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),sp(e,n)}function em(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(_(314))}s!==null&&s.delete(t),sp(e,n)}var lp;lp=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Pe.current)Me=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Me=!1,$h(e,t,n);Me=!!(e.flags&131072)}else Me=!1,J&&t.flags&1048576&&cu(t,Ks,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;_s(e,t),e=t.pendingProps;var l=Wn(t,Se.current);An(t,n),l=Ki(null,t,s,e,l,n);var o=Qi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Le(s)?(o=!0,Us(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,$i(t),l.updater=xl,t.stateNode=l,l._reactInternals=t,Vo(t,s,e,n),t=qo(null,t,s,!0,o,n)):(t.tag=0,J&&o&&Li(t),be(null,t,l,n),t=t.child),t;case 16:s=t.elementType;e:{switch(_s(e,t),e=t.pendingProps,l=s._init,s=l(s._payload),t.type=s,l=t.tag=nm(s),e=et(s,e),l){case 0:t=Qo(null,t,s,e,n);break e;case 1:t=xc(null,t,s,e,n);break e;case 11:t=hc(null,t,s,e,n);break e;case 14:t=mc(null,t,s,et(s.type,e),n);break e}throw Error(_(306,s,""))}return t;case 0:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:et(s,l),Qo(e,t,s,l,n);case 1:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:et(s,l),xc(e,t,s,l,n);case 3:e:{if(Fu(t),e===null)throw Error(_(387));s=t.pendingProps,o=t.memoizedState,l=o.element,mu(e,t),Gs(t,s,null,n);var i=t.memoizedState;if(s=i.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Un(Error(_(423)),t),t=gc(e,t,s,n,l);break e}else if(s!==l){l=Un(Error(_(424)),t),t=gc(e,t,s,n,l);break e}else for(Ae=At(t.stateNode.containerInfo.firstChild),Oe=t,J=!0,nt=null,n=fu(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if($n(),s===l){t=wt(e,t,n);break e}be(e,t,s,n)}t=t.child}return t;case 5:return xu(t),e===null&&Fo(t),s=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Ao(s,l)?i=null:o!==null&&Ao(s,o)&&(t.flags|=32),$u(e,t),be(e,t,i,n),t.child;case 6:return e===null&&Fo(t),null;case 13:return Hu(e,t,n);case 4:return Fi(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Fn(t,null,s,n):be(e,t,s,n),t.child;case 11:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:et(s,l),hc(e,t,s,l,n);case 7:return be(e,t,t.pendingProps,n),t.child;case 8:return be(e,t,t.pendingProps.children,n),t.child;case 12:return be(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,q(Qs,s._currentValue),s._currentValue=i,o!==null)if(ot(o.value,i)){if(o.children===l.children&&!Pe.current){t=wt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){i=o.child;for(var a=c.firstContext;a!==null;){if(a.context===s){if(o.tag===1){a=gt(-1,n&-n),a.tag=2;var d=o.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?a.next=a:(a.next=u.next,u.next=a),d.pending=a}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Ho(o.return,n,t),c.lanes|=n;break}a=a.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(_(341));i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Ho(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}be(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,s=t.pendingProps.children,An(t,n),l=Ge(l),s=s(l),t.flags|=1,be(e,t,s,n),t.child;case 14:return s=t.type,l=et(s,t.pendingProps),l=et(s.type,l),mc(e,t,s,l,n);case 15:return Bu(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:et(s,l),_s(e,t),t.tag=1,Le(s)?(e=!0,Us(t)):e=!1,An(t,n),Du(t,s,l),Vo(t,s,l,n),qo(null,t,s,!0,e,n);case 19:return Uu(e,t,n);case 22:return Wu(e,t,n)}throw Error(_(156,t.tag))};function op(e,t){return Pd(e,t)}function tm(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ke(e,t,n,s){return new tm(e,t,n,s)}function ra(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nm(e){if(typeof e=="function")return ra(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Si)return 11;if(e===ki)return 14}return 2}function $t(e,t){var n=e.alternate;return n===null?(n=Ke(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ps(e,t,n,s,l,o){var i=2;if(s=e,typeof e=="function")ra(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case wn:return ln(n.children,l,o,t);case wi:i=8,l|=8;break;case mo:return e=Ke(12,n,t,l|2),e.elementType=mo,e.lanes=o,e;case xo:return e=Ke(13,n,t,l),e.elementType=xo,e.lanes=o,e;case go:return e=Ke(19,n,t,l),e.elementType=go,e.lanes=o,e;case xd:return yl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case hd:i=10;break e;case md:i=9;break e;case Si:i=11;break e;case ki:i=14;break e;case zt:i=16,s=null;break e}throw Error(_(130,e==null?e:typeof e,""))}return t=Ke(i,n,t,l),t.elementType=e,t.type=s,t.lanes=o,t}function ln(e,t,n,s){return e=Ke(7,e,s,t),e.lanes=n,e}function yl(e,t,n,s){return e=Ke(22,e,s,t),e.elementType=xd,e.lanes=n,e.stateNode={isHidden:!1},e}function so(e,t,n){return e=Ke(6,e,null,t),e.lanes=n,e}function lo(e,t,n){return t=Ke(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function rm(e,t,n,s,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bl(0),this.expirationTimes=Bl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bl(0),this.identifierPrefix=s,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function sa(e,t,n,s,l,o,i,c,a){return e=new rm(e,t,n,c,a),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Ke(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},$i(o),e}function sm(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:jn,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function ip(e){if(!e)return Ht;e=e._reactInternals;e:{if(hn(e)!==e||e.tag!==1)throw Error(_(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Le(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(_(171))}if(e.tag===1){var n=e.type;if(Le(n))return iu(e,n,t)}return t}function ap(e,t,n,s,l,o,i,c,a){return e=sa(n,s,!0,e,l,o,i,c,a),e.context=ip(null),n=e.current,s=Ne(),l=Wt(n),o=gt(s,l),o.callback=t??null,Ot(n,o,l),e.current.lanes=l,Wr(e,l,s),Ie(e,s),e}function jl(e,t,n,s){var l=t.current,o=Ne(),i=Wt(l);return n=ip(n),t.context===null?t.context=n:t.pendingContext=n,t=gt(o,i),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Ot(l,t,i),e!==null&&(st(e,l,i,o),Cs(e,l,i)),i}function rl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Cc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function la(e,t){Cc(e,t),(e=e.alternate)&&Cc(e,t)}function lm(){return null}var cp=typeof reportError=="function"?reportError:function(e){console.error(e)};function oa(e){this._internalRoot=e}wl.prototype.render=oa.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(_(409));jl(e,t,null,null)};wl.prototype.unmount=oa.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;un(function(){jl(null,e,null,null)}),t[yt]=null}};function wl(e){this._internalRoot=e}wl.prototype.unstable_scheduleHydration=function(e){if(e){var t=Wd();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Et.length&&t!==0&&t<Et[n].priority;n++);Et.splice(n,0,e),n===0&&Fd(e)}};function ia(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Sl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ec(){}function om(e,t,n,s,l){if(l){if(typeof s=="function"){var o=s;s=function(){var d=rl(i);o.call(d)}}var i=ap(t,s,e,0,null,!1,!1,"",Ec);return e._reactRootContainer=i,e[yt]=i.current,Tr(e.nodeType===8?e.parentNode:e),un(),i}for(;l=e.lastChild;)e.removeChild(l);if(typeof s=="function"){var c=s;s=function(){var d=rl(a);c.call(d)}}var a=sa(e,0,!1,null,null,!1,!1,"",Ec);return e._reactRootContainer=a,e[yt]=a.current,Tr(e.nodeType===8?e.parentNode:e),un(function(){jl(t,a,n,s)}),a}function kl(e,t,n,s,l){var o=n._reactRootContainer;if(o){var i=o;if(typeof l=="function"){var c=l;l=function(){var a=rl(i);c.call(a)}}jl(t,i,e,l)}else i=om(n,t,e,l,s);return rl(i)}Od=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ar(t.pendingLanes);n!==0&&(zi(t,n|1),Ie(t,le()),!($&6)&&(Vn=le()+500,Qt()))}break;case 13:un(function(){var s=jt(e,1);if(s!==null){var l=Ne();st(s,e,1,l)}}),la(e,1)}};Ci=function(e){if(e.tag===13){var t=jt(e,134217728);if(t!==null){var n=Ne();st(t,e,134217728,n)}la(e,134217728)}};Bd=function(e){if(e.tag===13){var t=Wt(e),n=jt(e,t);if(n!==null){var s=Ne();st(n,e,t,s)}la(e,t)}};Wd=function(){return V};$d=function(e,t){var n=V;try{return V=e,t()}finally{V=n}};Co=function(e,t,n){switch(t){case"input":if(jo(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var l=fl(s);if(!l)throw Error(_(90));vd(s),jo(s,l)}}}break;case"textarea":jd(e,n);break;case"select":t=n.value,t!=null&&Pn(e,!!n.multiple,t,!1)}};Cd=ea;Ed=un;var im={usingClientEntryPoint:!1,Events:[Fr,Nn,fl,Nd,zd,ea]},sr={findFiberByHostInstance:tn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},am={bundleType:sr.bundleType,version:sr.version,rendererPackageName:sr.rendererPackageName,rendererConfig:sr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:St.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Rd(e),e===null?null:e.stateNode},findFiberByHostInstance:sr.findFiberByHostInstance||lm,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cs.isDisabled&&cs.supportsFiber)try{cl=cs.inject(am),ut=cs}catch{}}$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=im;$e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ia(t))throw Error(_(200));return sm(e,t,null,n)};$e.createRoot=function(e,t){if(!ia(e))throw Error(_(299));var n=!1,s="",l=cp;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=sa(e,1,!1,null,null,n,!1,s,l),e[yt]=t.current,Tr(e.nodeType===8?e.parentNode:e),new oa(t)};$e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(_(188)):(e=Object.keys(e).join(","),Error(_(268,e)));return e=Rd(t),e=e===null?null:e.stateNode,e};$e.flushSync=function(e){return un(e)};$e.hydrate=function(e,t,n){if(!Sl(t))throw Error(_(200));return kl(null,e,t,!0,n)};$e.hydrateRoot=function(e,t,n){if(!ia(e))throw Error(_(405));var s=n!=null&&n.hydratedSources||null,l=!1,o="",i=cp;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=ap(t,null,e,1,n??null,l,!1,o,i),e[yt]=t.current,Tr(e),s)for(e=0;e<s.length;e++)n=s[e],l=n._getVersion,l=l(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,l]:t.mutableSourceEagerHydrationData.push(n,l);return new wl(t)};$e.render=function(e,t,n){if(!Sl(t))throw Error(_(200));return kl(null,e,t,!1,n)};$e.unmountComponentAtNode=function(e){if(!Sl(e))throw Error(_(40));return e._reactRootContainer?(un(function(){kl(null,null,e,!1,function(){e._reactRootContainer=null,e[yt]=null})}),!0):!1};$e.unstable_batchedUpdates=ea;$e.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!Sl(n))throw Error(_(200));if(e==null||e._reactInternals===void 0)throw Error(_(38));return kl(e,t,n,!1,s)};$e.version="18.3.1-next-f1338f8080-20240426";function dp(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(dp)}catch(e){console.error(e)}}dp(),dd.exports=$e;var cm=dd.exports,Tc=cm;fo.createRoot=Tc.createRoot,fo.hydrateRoot=Tc.hydrateRoot;class aa extends Error{constructor(t,n,s){super(s),this.status=t,this.code=n}}function kt(e){return e instanceof aa&&e.status===409&&e.code==="no_project"}async function bl(e,t){const n=await fetch(e,t);if(!n.ok){let s=null,l=`${n.status} ${n.statusText}`;try{const o=await n.json();o.code&&(s=o.code),o.error&&(l=o.error)}catch{}throw new aa(n.status,s,l)}return n.json()}const F=e=>bl(e),Yt=(e,t)=>bl(e,t===void 0?{method:"POST"}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),_c=(e,t)=>bl(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),dm=(e,t)=>bl(e,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});function Y(e,t){return t?e+(e.includes("?")?"&":"?")+"project="+encodeURIComponent(t):e}const M={status:e=>F(Y("/api/status",e)),refresh:e=>Yt(Y("/api/refresh",e)),graphFull:(e,t=250)=>F(Y(`/api/graph/full?limit=${t}`,e)),graphNode:(e,t)=>F(Y(`/api/graph/node?id=${encodeURIComponent(e)}`,t)),graphHealth:e=>F(Y("/api/graph/health",e)),specs:e=>F(Y("/api/specs",e)),spec:(e,t)=>F(Y(`/api/spec/${encodeURIComponent(e)}`,t)),specSave:(e,t,n)=>_c(Y(`/api/spec/${encodeURIComponent(e)}`,n),{content:t}),specFunnel:e=>F(Y("/api/spec/funnel",e)),specCoverage:(e,t)=>F(Y("/api/spec/coverage"+(e?`?spec=${encodeURIComponent(e)}`:""),t)),linkVerify:(e,t)=>Yt(Y("/api/spec/link-verify",t),e),drift:e=>F(Y("/api/drift",e)),runs:e=>F(Y("/api/workflows/runs",e)),workflows:e=>F(Y("/api/workflows",e)),launchRun:(e,t,n)=>Yt(Y("/api/workflows/runs",n),{workflowName:e,inputs:t}),run:(e,t)=>F(Y(`/api/workflows/runs/${encodeURIComponent(e)}`,t)),runArtifacts:(e,t)=>F(Y(`/api/workflows/runs/${encodeURIComponent(e)}/artifacts`,t)),runAction:(e,t,n,s)=>Yt(Y(`/api/workflows/runs/${encodeURIComponent(e)}/${t}`,s),n),projects:()=>F("/api/projects"),graphSearch:(e,t,n=10)=>F(Y(`/api/graph/search?q=${encodeURIComponent(e)}&limit=${n}`,t)),recentPrompts:(e,t=20)=>F(Y(`/api/claude/prompts/recent?limit=${t}`,e)),claudeStats:(e="week")=>F(`/api/claude/stats?range=${e}`),claudeCosts:(e="week",t,n)=>F(Y(`/api/claude/costs?range=${e}${n?`&model=${encodeURIComponent(n)}`:""}`,t)),claudeCache:(e="week")=>F(`/api/claude/cache?range=${e}`),claudeHeatmap:(e="week",t)=>F(Y(`/api/claude/heatmap?range=${e}`,t)),claudeHeatmapFile:(e,t="week")=>F(`/api/claude/heatmap/file?path=${encodeURIComponent(e)}&range=${t}`),claudeHeatmapTool:(e,t="week")=>F(`/api/claude/heatmap/tool?name=${encodeURIComponent(e)}&range=${t}`),claudeHeatmapSubagent:(e,t="week")=>F(`/api/claude/heatmap/subagent?type=${encodeURIComponent(e)}&range=${t}`),claudeTips:()=>F("/api/claude/tips"),setTipState:(e,t)=>Yt("/api/claude/tips/state",{id:e,state:t}),claudeSessions:(e,t=10,n="week",s)=>F(Y(`/api/claude/sessions?limit=${t}&range=${n}${s?`&model=${encodeURIComponent(s)}`:""}`,e)),claudeSession:e=>F(`/api/claude/session/${encodeURIComponent(e)}`),claudeSessionSummary:e=>F(`/api/claude/session/${encodeURIComponent(e)}/summary`),claudeProjects:()=>F("/api/claude/projects"),claudeCompare:()=>F("/api/claude/compare"),ingestNow:()=>Yt("/api/claude/ingest"),memory:e=>F(Y("/api/memory",e)),mcpServers:()=>F("/api/mcp/servers"),setMcpServerEnabled:(e,t)=>dm(`/api/mcp/servers/${encodeURIComponent(e)}`,{enabled:t}),addMcpServer:e=>Yt("/api/mcp/servers",e),config:{get:()=>F("/api/config"),set:e=>_c("/api/config",e)}};function um(e,t,n){const s=`/api/workflows/runs/${encodeURIComponent(e)}/events${t?`?since=${t}`:""}`;return Y(s,n)}const oi="ss-navigate";function Rc(){const e=location.pathname.split("/").filter(Boolean);return{route:e[0]||"dashboard",param:e.slice(1).join("/")||void 0,query:Object.fromEntries(new URLSearchParams(location.search))}}function A(e,t={}){let n="/"+e;t.param&&(n+="/"+t.param),t.query&&Object.keys(t.query).length&&(n+="?"+new URLSearchParams(t.query).toString()),n!==location.pathname+location.search&&history.pushState(null,"",n),window.dispatchEvent(new Event(oi))}function pm(){const[e,t]=N.useState(Rc);return N.useEffect(()=>{const n=()=>t(Rc());return window.addEventListener("popstate",n),window.addEventListener(oi,n),()=>{window.removeEventListener("popstate",n),window.removeEventListener(oi,n)}},[]),e}const fm={dashboard:'<rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/>',graph:'<circle cx="5" cy="6" r="2.5"/><circle cx="19" cy="6" r="2.5"/><circle cx="12" cy="18" r="2.5"/><path d="M7 7.5 10.5 16M16.5 7.5 13.5 16M7 6h10"/>',book:'<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/>',drift:'<path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h16.9a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/><path d="M12 9v4M12 17h.01"/>',workflow:'<rect x="3" y="3" width="6" height="6" rx="1"/><rect x="15" y="15" width="6" height="6" rx="1"/><path d="M6 9v3a3 3 0 0 0 3 3h6"/>',play:'<polygon points="6 3 20 12 6 21 6 3"/>',wrench:'<path d="M14.7 6.3a4 4 0 0 0-5.4 5.3L3 18v3h3l6.4-6.3a4 4 0 0 0 5.3-5.4l-2.9 2.9-2.1-2.1z"/>',database:'<ellipse cx="12" cy="5" rx="8" ry="3"/><path d="M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"/><path d="M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"/>',bot:'<rect x="4" y="8" width="16" height="12" rx="2"/><path d="M12 4v4M9 14h.01M15 14h.01M2 13h2M20 13h2"/>',folder:'<path d="M20 10V7a2 2 0 0 0-2-2h-6l-2-2H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h7"/><path d="M12 10v11M16 14l-4-4-4 4M21 19h-6"/>',chat:'<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>',sessions:'<path d="M3 3v18h18"/><path d="M7 14l3-4 3 3 4-6"/>',heatmap:'<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/>',dollar:'<line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>',compare:'<path d="M16 3h5v5M21 3l-7 7M8 21H3v-5M3 21l7-7"/>',tips:'<path d="M9 18h6M10 22h4M12 2a7 7 0 0 0-4 12.7c.6.5 1 1.3 1 2.1V18h6v-1.2c0-.8.4-1.6 1-2.1A7 7 0 0 0 12 2z"/>',settings:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.6 1.6 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.6 1.6 0 0 0-1.8-.3 1.6 1.6 0 0 0-1 1.5V21a2 2 0 0 1-4 0v-.1a1.6 1.6 0 0 0-1-1.5 1.6 1.6 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.6 1.6 0 0 0 .3-1.8 1.6 1.6 0 0 0-1.5-1H3a2 2 0 0 1 0-4h.1a1.6 1.6 0 0 0 1.5-1 1.6 1.6 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.6 1.6 0 0 0 1.8.3H9a1.6 1.6 0 0 0 1-1.5V3a2 2 0 0 1 4 0v.1a1.6 1.6 0 0 0 1 1.5 1.6 1.6 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.6 1.6 0 0 0-.3 1.8V9a1.6 1.6 0 0 0 1.5 1H21a2 2 0 0 1 0 4h-.1a1.6 1.6 0 0 0-1.5 1z"/>',box:'<path d="M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><path d="m3.3 7 8.7 5 8.7-5M12 22V12"/>',search:'<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.7" y2="16.7"/>',command:'<path d="M15 6a3 3 0 1 1 3 3h-3V6zM9 6a3 3 0 1 0-3 3h3V6zM15 18a3 3 0 1 0 3-3h-3v3zM9 18a3 3 0 1 1-3-3h3v3zM9 9h6v6H9z"/>',chevronRight:'<polyline points="9 6 15 12 9 18"/>',chevronDown:'<polyline points="6 9 12 15 18 9"/>',chevronLeft:'<polyline points="15 6 9 12 15 18"/>',x:'<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>',check:'<polyline points="20 6 9 17 4 12"/>',copy:'<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>',arrowRight:'<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/>',plus:'<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',grip:'<circle cx="9" cy="6" r="1.4"/><circle cx="15" cy="6" r="1.4"/><circle cx="9" cy="12" r="1.4"/><circle cx="15" cy="12" r="1.4"/><circle cx="9" cy="18" r="1.4"/><circle cx="15" cy="18" r="1.4"/>',trash:'<polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/>',minus:'<line x1="5" y1="12" x2="19" y2="12"/>',maximize:'<path d="M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M16 21h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/>',recenter:'<circle cx="12" cy="12" r="3"/><path d="M12 2v4M12 18v4M2 12h4M18 12h4"/>',refresh:'<path d="M21 2v6h-6M3 22v-6h6"/><path d="M3.5 9a9 9 0 0 1 14.8-3.4L21 8M21 15a9 9 0 0 1-14.8 3.4L3 16"/>',filter:'<polygon points="22 3 2 3 10 12.5 10 19 14 21 14 12.5 22 3"/>',pause:'<rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/>',external:'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/>',zap:'<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>',clock:'<circle cx="12" cy="12" r="9"/><polyline points="12 7 12 12 15 14"/>',trendUp:'<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/>',trendDown:'<polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/><polyline points="16 17 22 17 22 11"/>',circle:'<circle cx="12" cy="12" r="9"/>',dot:'<circle cx="12" cy="12" r="5"/>',reveal:'<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/>',sparkles:'<path d="M12 3v4M12 17v4M3 12h4M17 12h4"/><path d="m6 6 2.5 2.5M15.5 15.5 18 18M18 6l-2.5 2.5M8.5 15.5 6 18"/>',menu:'<line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/>',send:'<line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/>',paperclip:'<path d="M21.4 11.05 12.25 20.2a5 5 0 0 1-7.07-7.07l9.19-9.19a3 3 0 0 1 4.24 4.24l-9.2 9.19a1 1 0 0 1-1.41-1.41l8.48-8.49"/>',sortAsc:'<path d="M11 5h10M11 9h7M11 13h4M3 17l3 3 3-3M6 6v14"/>',flame:'<path d="M12 2c1 4 5 5 5 9a5 5 0 0 1-10 0c0-1.5.5-2.5 1.2-3.4C9 9 9.5 8 9.5 6.5c1 .5 2 1.5 2.5 2.5C13 7 12.5 4 12 2z"/>',coins:'<circle cx="8" cy="8" r="5"/><path d="M18.1 6.3a5 5 0 0 1 0 9.4M14.4 18.6a5 5 0 0 1-3.4 0"/>',cancel:'<circle cx="12" cy="12" r="9"/><line x1="9" y1="9" x2="15" y2="15"/><line x1="15" y1="9" x2="9" y2="15"/>',skip:'<polyline points="13 17 18 12 13 7"/><polyline points="6 17 11 12 6 7"/>',layers:'<polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 12 12 17 22 12"/><polyline points="2 17 12 22 22 17"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>',moon:'<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/>',monitor:'<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>',memory:'<rect x="4" y="6" width="16" height="12" rx="2"/><path d="M8 6V3M12 6V3M16 6V3M8 21v-3M12 21v-3M16 21v-3M2 10h2M2 14h2M20 10h2M20 14h2"/><rect x="8.5" y="10" width="7" height="4" rx="1"/>',lock:'<rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',plug:'<path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8z"/>',server:'<rect x="3" y="4" width="18" height="6" rx="2"/><rect x="3" y="14" width="18" height="6" rx="2"/><path d="M7 7h.01M7 17h.01"/>',matrix:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M9 3v18M15 3v18M3 9h18M3 15h18"/>'};function b({name:e,size:t=16,stroke:n=2,fill:s="none",style:l,className:o}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:s,stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round",style:l,className:o,dangerouslySetInnerHTML:{__html:fm[e]||""}})}function hm({size:e=24,tile:t=!0,glow:n=!0}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"none",style:{filter:n?"drop-shadow(0 0 9px rgba(91,147,242,0.35))":"none",flexShrink:0},children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"ssTile",x1:0,y1:0,x2:32,y2:32,gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#12161E"}),r.jsx("stop",{offset:1,stopColor:"#0B0D11"})]}),r.jsxs("linearGradient",{id:"ssLead",x1:18,y1:11,x2:26,y2:21,gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#6FA0F6"}),r.jsx("stop",{offset:1,stopColor:"#5B93F2"})]})]}),t&&r.jsx("rect",{width:32,height:32,rx:7.2,fill:"url(#ssTile)"}),t&&r.jsx("rect",{x:.5,y:.5,width:31,height:31,rx:6.7,fill:"none",stroke:"rgba(255,255,255,0.08)"}),r.jsxs("g",{transform:"translate(4.6 4.6) scale(0.715)",children:[r.jsx("path",{d:"M5 16 H11 M11 9 L23 16 L11 23",stroke:"rgba(150,165,200,0.5)",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),r.jsx("line",{x1:11,y1:9,x2:11,y2:23,stroke:"rgba(150,165,200,0.4)",strokeWidth:1.9,strokeLinecap:"round"}),r.jsx("circle",{cx:23,cy:16,r:3.6,fill:"url(#ssLead)"}),r.jsx("circle",{cx:11,cy:9,r:2.9,fill:"#A586F5"}),r.jsx("circle",{cx:11,cy:23,r:2.9,fill:"#46C26B"}),r.jsx("circle",{cx:5,cy:16,r:2.1,fill:"#29D2BE"})]})]})}const mm=8,xm=6,gm=6,vm=150,ym={page:"Page",node:"Node",spec:"Spec",prompt:"Prompt"},jm={fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:4,padding:"2px 6px"};function wm({open:e,onClose:t,pages:n,project:s=null}){const[l,o]=N.useState(""),[i,c]=N.useState(0),[a,d]=N.useState([]),[u,f]=N.useState([]),[m,g]=N.useState([]),y=N.useRef(null),p=N.useRef(0);N.useEffect(()=>{e&&(o(""),c(0),g([]),setTimeout(()=>y.current?.focus(),30))},[e]),N.useEffect(()=>{e&&(M.specs(s).then(S=>d(S.specs??[]),()=>d([])),M.recentPrompts(s).then(S=>f(S.prompts??[]),()=>f([])))},[e,s]),N.useEffect(()=>{if(!e)return;const S=l.trim(),C=++p.current;if(S.length<2){g([]);return}const E=setTimeout(()=>{M.graphSearch(S,s,mm).then(R=>{p.current===C&&g((R.results??[]).map(({node:O})=>({key:"node:"+O.id,label:O.name,sublabel:O.filePath,icon:"graph",type:"node",nav:()=>A("graph",{query:{focus:O.id}})})))},()=>{p.current===C&&g([])})},vm);return()=>clearTimeout(E)},[l,e,s]);const w=l.trim().toLowerCase(),v=(w?n.filter(S=>(S.label+" "+S.id).toLowerCase().includes(w)):n).map(S=>({key:"page:"+S.id,label:S.label,sublabel:"/"+S.id,icon:S.icon,type:"page",nav:()=>A(S.id)})),h=w?a.filter(S=>(S.id+" "+S.title).toLowerCase().includes(w)).slice(0,xm).map(S=>({key:"spec:"+S.id,label:S.id,sublabel:S.title,icon:"book",type:"spec",nav:()=>A("specs",{param:S.id})})):[],x=w?u.filter(S=>S.text.toLowerCase().includes(w)).slice(0,gm).map(S=>({key:"prompt:"+S.id,label:S.text,sublabel:new Date(S.ts).toLocaleString(),icon:"chat",type:"prompt",nav:()=>A("sessions",{param:S.session_id})})):[],j=[...v,...w?m:[],...h,...x];return N.useEffect(()=>{if(!e)return;const S=C=>{if(C.key==="ArrowDown")C.preventDefault(),c(E=>Math.min(j.length-1,E+1));else if(C.key==="ArrowUp")C.preventDefault(),c(E=>Math.max(0,E-1));else if(C.key==="Enter"){C.preventDefault();const E=j[i];E&&(E.nav(),t())}else C.key==="Escape"&&(C.preventDefault(),t())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[e,j,i,t]),e?r.jsx("div",{onMouseDown:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",backdropFilter:"blur(2px)",zIndex:100,display:"grid",placeItems:"start center",paddingTop:"12vh",animation:"fadeIn 100ms"},children:r.jsxs("div",{onMouseDown:S=>S.stopPropagation(),style:{width:560,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)",overflow:"hidden"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"12px 14px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(b,{name:"search",size:16,style:{color:"var(--text-muted)"}}),r.jsx("input",{ref:y,value:l,onChange:S=>{o(S.target.value),c(0)},placeholder:"Search pages, nodes, specs, prompts…",style:{flex:1,background:"transparent",border:"none",outline:"none",color:"var(--text-primary)",fontSize:15,fontFamily:"var(--font-ui)"}}),r.jsx("kbd",{style:jm,children:"esc"})]}),r.jsxs("div",{className:"scroll-y",role:"listbox",style:{maxHeight:380,padding:6},children:[j.length===0&&r.jsx("div",{className:"muted",style:{padding:24,textAlign:"center"},children:"No matches"}),j.map((S,C)=>r.jsxs("div",{role:"option","aria-selected":C===i,onMouseEnter:()=>c(C),onClick:()=>{S.nav(),t()},className:"row gap-10 list-row",style:{padding:"8px 10px",borderRadius:7,cursor:"pointer"},children:[r.jsx(b,{name:S.icon,size:15,style:{color:C===i?"var(--accent)":"var(--text-muted)",flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.label}),r.jsx("div",{className:"mono muted",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.sublabel})]}),r.jsx("span",{className:"pill",style:{fontSize:9.5,color:"var(--text-muted)",background:"rgba(255,255,255,0.05)",flexShrink:0},children:ym[S.type]})]},S.key))]})]})}):null}const oo=new Map,Sm=3e4;function I(e,t=[],n={}){const{cacheKey:s,ttlMs:l=Sm}=n,o=s?oo.get(s):void 0,[i,c]=N.useState(o?o.data:null),[a,d]=N.useState(null),[u,f]=N.useState(!o),m=N.useRef(0),g=N.useCallback(y=>{const p=++m.current;if(s){const w=oo.get(s);if(w){if(c(w.data),d(null),f(!1),!y&&Date.now()-w.ts<l)return}else f(!0)}else f(!0);e().then(w=>{s&&oo.set(s,{data:w,ts:Date.now()}),m.current===p&&(c(w),d(null),f(!1))},w=>{m.current===p&&(d(w),f(!1))})},t);return N.useEffect(()=>{g(!1)},[g]),{data:i,error:a,loading:u,reload:()=>g(!0)}}function km(){const e=I(()=>M.config.get(),[]),{reload:t}=e;return N.useEffect(()=>(window.addEventListener("specship-config",t),()=>window.removeEventListener("specship-config",t)),[t]),e}function Mc(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;if(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)return!0;const n=e.getAttribute("contenteditable");return n===""||n==="true"}const bm=1e3,Nm={g:"graph",s:"specs",d:"drift"};function zm({onTogglePalette:e,pageIds:t}){const n=N.useRef(!1),s=N.useRef(null);N.useEffect(()=>{const l=()=>{n.current=!1,s.current!==null&&(clearTimeout(s.current),s.current=null)},o=i=>{if((i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"){i.preventDefault(),e();return}if((i.metaKey||i.ctrlKey)&&!i.altKey&&/^[1-7]$/.test(i.key)){if(Mc(i.target))return;const c=t[parseInt(i.key,10)-1];c&&(i.preventDefault(),A(c));return}if(i.metaKey||i.ctrlKey||i.altKey){l();return}if(Mc(i.target)){l();return}if(n.current){l();const c=Nm[i.key.toLowerCase()];c&&(i.preventDefault(),A(c));return}i.key==="g"&&(n.current=!0,s.current=window.setTimeout(l,bm))};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),l()}},[e,t])}const up="specship-theme";function Nl(){try{const e=localStorage.getItem(up);if(e==="dark"||e==="light"||e==="system")return e}catch{}return"dark"}function Cm(e){return e==="system"?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":e}function zl(e){document.documentElement.setAttribute("data-theme",Cm(e));try{localStorage.setItem(up,e)}catch{}window.dispatchEvent(new Event("specship-theme"))}function Em(){window.matchMedia("(prefers-color-scheme: light)").addEventListener("change",()=>{Nl()==="system"&&zl("system")})}const ie={pending:{label:"Pending",color:"var(--text-muted)",bg:"rgba(255,255,255,0.05)"},running:{label:"Running",color:"var(--info)",bg:"var(--info-soft)"},paused:{label:"Paused",color:"var(--warn)",bg:"var(--warn-soft)"},completed:{label:"Completed",color:"var(--success)",bg:"var(--success-soft)"},failed:{label:"Failed",color:"var(--error)",bg:"var(--error-soft)"},cancelled:{label:"Cancelled",color:"var(--text-muted)",bg:"rgba(255,255,255,0.05)"},rejected:{label:"Rejected",color:"var(--warn)",bg:"var(--warn-soft)"},skipped:{label:"Skipped",color:"var(--text-muted)",bg:"rgba(255,255,255,0.05)"},drafted:{label:"Drafted",color:"var(--text-secondary)",bg:"rgba(255,255,255,0.05)"},implementing:{label:"Implementing",color:"var(--info)",bg:"var(--info-soft)"},implemented:{label:"Implemented",color:"var(--node-spec)",bg:"var(--node-spec-soft)"},verified:{label:"Verified",color:"var(--success)",bg:"var(--success-soft)"},drifted:{label:"Drifted",color:"var(--warn)",bg:"var(--warn-soft)"},broken:{label:"Broken",color:"var(--error)",bg:"var(--error-soft)"},orphaned:{label:"Orphaned",color:"var(--error)",bg:"var(--error-soft)"},success:{label:"Success",color:"var(--success)",bg:"var(--success-soft)"},warn:{label:"Warn",color:"var(--warn)",bg:"var(--warn-soft)"},error:{label:"Error",color:"var(--error)",bg:"var(--error-soft)"},info:{label:"Info",color:"var(--info)",bg:"var(--info-soft)"}},Tm={drifted:"drift",broken:"cancel",orphaned:"drift",failed:"cancel",verified:"check",completed:"check",paused:"pause",running:"circle"};function qe({state:e,pulse:t,withDot:n}){const s=ie[e]??ie.info,l=Tm[e];return r.jsxs("span",{className:"pill",style:{color:s.color,background:s.bg,animation:t?"pulsePill 600ms ease-out":void 0},children:[n&&r.jsx("span",{className:"pill-dot",style:{background:s.color}}),l&&!n&&r.jsx(b,{name:l,size:11}),s.label]})}function Q({children:e,color:t,bg:n,dot:s}){return r.jsxs("span",{className:"pill",style:{color:t||"var(--text-secondary)",background:n||"rgba(255,255,255,0.05)"},children:[s&&r.jsx("span",{className:"pill-dot",style:{background:t}}),e]})}function _m({title:e}){return r.jsx("span",{className:"pill","data-sample-badge":!0,title:e??"Illustrative reference data — not from your project",style:{color:"var(--warn)",background:"var(--warn-soft)",fontWeight:700,letterSpacing:"0.04em"},children:"SAMPLE"})}function lt({text:e,label:t,ariaLabel:n}){const[s,l]=N.useState(!1);return r.jsxs("button",{className:"btn btn-ghost btn-xs",title:"Copy","aria-label":n??(t?void 0:"Copy "+e),onClick:o=>{o.stopPropagation(),navigator.clipboard?.writeText(e),l(!0),setTimeout(()=>l(!1),1100)},style:{color:s?"var(--success)":void 0},children:[r.jsx(b,{name:s?"check":"copy",size:12}),t||""]})}function ca({value:e,suffix:t,invert:n}){if(e==null)return null;if(e===0)return r.jsxs("span",{className:"row gap-2 tabular muted",style:{fontSize:"var(--fs-xs)",fontWeight:600},children:[r.jsx(b,{name:"minus",size:12}),"no change"]});const s=e>=0,l=n?!s:s;return r.jsxs("span",{className:"row gap-2 tabular",style:{color:l?"var(--success)":"var(--error)",fontSize:"var(--fs-xs)",fontWeight:600},children:[r.jsx(b,{name:s?"trendUp":"trendDown",size:12}),(s?"+":"")+(Math.abs(e)<1&&e!==0?Math.round(e*100)+"%":e)+(t||"")]})}function ze({icon:e,title:t,sub:n,actions:s}){return r.jsxs("div",{className:"row",style:{gap:12,marginBottom:18,alignItems:"flex-start"},children:[e&&r.jsx("div",{style:{width:34,height:34,borderRadius:9,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",display:"grid",placeItems:"center",color:"var(--accent)",flexShrink:0},children:r.jsx(b,{name:e,size:18})}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:"var(--fs-title)",fontWeight:600,letterSpacing:"-0.01em"},children:t}),n&&r.jsx("div",{className:"secondary",style:{marginTop:2},children:n})]}),s&&r.jsx("div",{className:"row gap-8",children:s})]})}function se({icon:e,title:t,body:n,action:s}){return r.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%",minHeight:280,textAlign:"center",padding:40},children:r.jsxs("div",{style:{maxWidth:360},children:[r.jsx("div",{style:{width:52,height:52,borderRadius:14,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",display:"grid",placeItems:"center",color:"var(--text-muted)",margin:"0 auto 16px"},children:r.jsx(b,{name:e||"box",size:24})}),r.jsx("div",{style:{fontSize:15,fontWeight:600,marginBottom:6},children:t}),n&&r.jsx("div",{className:"secondary",style:{lineHeight:1.55},children:n}),s&&r.jsx("div",{style:{marginTop:16},children:s})]})})}function We({options:e,value:t,onChange:n,size:s,label:l,disabled:o}){const i=e.map(d=>typeof d=="string"?d:d.value),c=i.indexOf(t),a=(d,u)=>{const f=d.key==="ArrowRight"||d.key==="ArrowDown"?1:d.key==="ArrowLeft"||d.key==="ArrowUp"?-1:0;if(!f)return;d.preventDefault();const m=(u+f+i.length)%i.length;n(i[m]),d.currentTarget.parentElement?.children[m]?.focus()};return r.jsx("div",{className:"seg",role:"radiogroup","aria-label":l,children:e.map((d,u)=>{const f=typeof d=="string"?d:d.value,m=typeof d=="string"?d:d.label,g=f===t;return r.jsx("button",{role:"radio","aria-checked":g,tabIndex:g||c===-1&&u===0?0:-1,disabled:o,className:"seg-btn"+(s==="sm"?" sm":"")+(g?" active":""),onClick:()=>n(f),onKeyDown:y=>a(y,u),children:m},f)})})}function Cl({value:e,onChange:t}){return r.jsx(We,{options:[{value:"today",label:"Today"},{value:"week",label:"This week"},{value:"month",label:"This month"},{value:"all",label:"All time"}],value:e,onChange:t,size:"sm",label:"Time range"})}function Ur({frac:e,color:t,height:n}){return r.jsx("div",{style:{height:n||4,background:"rgba(255,255,255,0.06)",borderRadius:999,overflow:"hidden",width:"100%"},children:r.jsx("div",{style:{width:Math.max(2,e*100)+"%",height:"100%",background:t||"var(--accent)",borderRadius:999}})})}function pn(e){if(!e)return null;const t=Math.max(0,Math.floor((Date.now()-e)/1e3));return t<60?"now":t<3600?Math.floor(t/60)+"m":t<86400?Math.floor(t/3600)+"h":Math.floor(t/86400)+"d"}function Ut(e,t){return e==="spec"?t==="drifted"?"var(--warn)":t==="broken"||t==="orphaned"?"var(--error)":"var(--node-spec)":e==="test"?"var(--node-test)":e==="route"?"var(--node-route)":"var(--node-code)"}function Kn({onIngested:e}){const[t,n]=N.useState(!1),s=()=>{n(!0),M.ingestNow().catch(()=>{}).finally(()=>{n(!1),e?.()})};return r.jsx(se,{icon:"database",title:"No Claude Code data ingested yet",body:"This screen lights up once SpecShip ingests your transcripts from ~/.claude/projects. Turn on transcript ingest in Settings, or run a one-shot pass now.",action:r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:s,disabled:t,children:t?"Ingesting…":"Run ingest now"})})}function Vr(e){return e>=.7?"var(--success)":e>=.5?"var(--warn)":"var(--error)"}function pp(e){const t=(e.total_input_tokens??0)+(e.total_cache_creation_tokens??0)+(e.total_cache_read_tokens??0);return t>0?(e.total_cache_read_tokens??0)/t:0}function El(e){return e.replace(/^claude-/,"")}const Pc=["var(--node-spec)","var(--node-code)","var(--node-route)","var(--node-test)","var(--accent)","var(--warn)"];function ii(e){return Pc[e%Pc.length]}function da(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"—"}function fp(e){return e?new Date(e).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function Rm(e){const t=Math.round(e/1e3);if(t<60)return t+"s";const n=Math.floor(t/60);return n<60?n+"m":Math.floor(n/60)+"h "+n%60+"m"}function xn({label:e,value:t,color:n}){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono tabular",style:{fontSize:16,fontWeight:600,marginTop:2,color:n||"var(--text-primary)"},children:t})]})}function ua({data:e,color:t,w:n=80,h:s=24,fill:l}){if(!e||!e.length)return null;const o=Math.max(...e),i=Math.min(...e),c=o-i||1,d=e.map((f,m)=>[m/(e.length-1)*n,s-(f-i)/c*(s-4)-2]).map((f,m)=>(m?"L":"M")+f[0].toFixed(1)+" "+f[1].toFixed(1)).join(" "),u=d+` L${n} ${s} L0 ${s} Z`;return r.jsxs("svg",{width:n,height:s,style:{display:"block",overflow:"visible"},children:[l&&r.jsx("path",{d:u,fill:t,opacity:.12}),r.jsx("path",{d,fill:"none",stroke:t||"var(--accent)",strokeWidth:1.6,strokeLinejoin:"round",strokeLinecap:"round"})]})}function hp({series:e,w:t=640,h:n=200,color:s="var(--accent)",xTicks:l=6,onHover:o}){const[i,c]=N.useState(null),a={l:44,r:12,t:14,b:24},d=t-a.l-a.r,u=n-a.t-a.b,f=e.map(j=>j.cost),m=Math.max(...f)*1.12||1,g=0,y=j=>a.l+j/(e.length-1)*d,p=j=>a.t+u-(j-g)/(m-g)*u,w=e.map((j,S)=>(S?"L":"M")+y(S).toFixed(1)+" "+p(j.cost).toFixed(1)).join(" "),v=w+` L${y(e.length-1)} ${a.t+u} L${a.l} ${a.t+u} Z`,h=4,x=i!=null?e[i]:void 0;return r.jsxs("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,style:{display:"block"},onMouseLeave:()=>{c(null),o?.(null)},onMouseMove:j=>{const S=j.currentTarget.getBoundingClientRect(),C=(j.clientX-S.left)/S.width*t;let E=Math.round((C-a.l)/d*(e.length-1));E=Math.max(0,Math.min(e.length-1,E)),c(E),o?.(e[E]??null)},children:[Array.from({length:h+1}).map((j,S)=>{const C=m/h*S,E=p(C);return r.jsxs("g",{children:[r.jsx("line",{x1:a.l,x2:t-a.r,y1:E,y2:E,stroke:"rgba(255,255,255,0.05)"}),r.jsx("text",{x:a.l-8,y:E+3,textAnchor:"end",fontSize:10,fill:"var(--text-muted)",fontFamily:"var(--font-mono)",children:"$"+C.toFixed(0)})]},S)}),r.jsx("path",{d:v,fill:s,opacity:.1}),r.jsx("path",{d:w,fill:"none",stroke:s,strokeWidth:2,strokeLinejoin:"round"}),e.filter((j,S)=>S%Math.ceil(e.length/l)===0).map(j=>{const S=e.indexOf(j);return r.jsx("text",{x:y(S),y:n-6,textAnchor:"middle",fontSize:10,fill:"var(--text-muted)",fontFamily:"var(--font-mono)",children:j.day+"d"},S)}),i!=null&&x&&r.jsxs("g",{children:[r.jsx("line",{x1:y(i),x2:y(i),y1:a.t,y2:a.t+u,stroke:s,opacity:.4,strokeDasharray:"3 3"}),r.jsx("circle",{cx:y(i),cy:p(x.cost),r:4,fill:s,stroke:"var(--bg-canvas)",strokeWidth:2})]})]})}function mp({data:e,size:t=140,thickness:n=22,centerLabel:s,centerSub:l}){const o=e.reduce((f,m)=>f+m.cost,0)||1,i=(t-n)/2,c=t/2,a=t/2,d=2*Math.PI*i;let u=0;return r.jsxs("div",{style:{position:"relative",width:t,height:t},children:[r.jsxs("svg",{width:t,height:t,style:{transform:"rotate(-90deg)"},children:[r.jsx("circle",{cx:c,cy:a,r:i,fill:"none",stroke:"rgba(255,255,255,0.05)",strokeWidth:n}),e.map((f,m)=>{const y=f.cost/o*d,p=r.jsx("circle",{cx:c,cy:a,r:i,fill:"none",stroke:f.color,strokeWidth:n,strokeDasharray:`${y} ${d-y}`,strokeDashoffset:-u,strokeLinecap:"butt"},m);return u+=y,p})]}),s&&r.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",textAlign:"center"},children:r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums"},children:s}),l&&r.jsx("div",{className:"muted",style:{fontSize:10},children:l})]})})]})}function xp({rows:e,segments:t,fmt:n}){const s=Math.max(...e.map(l=>t.reduce((o,i)=>o+(l.values[i.key]||0),0)))||1;return r.jsx("div",{className:"col gap-10",children:e.map(l=>{const o=t.reduce((i,c)=>i+(l.values[c.key]||0),0);return r.jsxs("div",{className:"row gap-10",children:[r.jsx("div",{style:{width:110,fontSize:12,color:"var(--text-secondary)",textAlign:"right",flexShrink:0,fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.label}),r.jsx("div",{className:"row",style:{flex:1,height:18,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:t.map(i=>{const c=l.values[i.key]||0;return c?r.jsx("div",{title:`${i.label}: ${n?n(c):c}`,style:{width:c/s*100+"%",height:"100%",background:i.color}},i.key):null})}),r.jsx("div",{className:"tabular",style:{width:64,fontSize:12,textAlign:"right",flexShrink:0,fontFamily:"var(--font-mono)"},children:n?n(o):o})]},l.label)})})}function pa({items:e,max:t,color:n,fmt:s,labelKey:l="name",valueKey:o="calls",onItemClick:i,selectedKey:c}){const a=t||Math.max(...e.map(d=>Number(d[o])||0))||1;return r.jsx("div",{className:"col gap-6",children:e.map(d=>{const u=String(d[l]),f=Number(d[o])||0,m=c!=null&&u===c;return r.jsxs("div",{className:"row gap-10",onClick:i?()=>i(d):void 0,style:{cursor:i?"pointer":"default",borderRadius:5,padding:i?"2px 4px":0,margin:i?"0 -4px":0,background:m?"var(--accent-soft)":"transparent"},onMouseEnter:i?g=>{m||(g.currentTarget.style.background="var(--bg-hover)")}:void 0,onMouseLeave:i?g=>{m||(g.currentTarget.style.background="transparent")}:void 0,children:[r.jsx("div",{style:{width:116,fontSize:12,fontFamily:"var(--font-mono)",color:m?"var(--accent)":"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:0},children:u}),r.jsx("div",{className:"grow",style:{height:16,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:r.jsx("div",{style:{width:f/a*100+"%",height:"100%",background:typeof n=="function"?n(d):n||"var(--accent)",borderRadius:4}})}),r.jsx("div",{className:"tabular",style:{width:52,textAlign:"right",fontSize:12,fontFamily:"var(--font-mono)",flexShrink:0},children:s?s(f):f}),i&&r.jsx(b,{name:"chevronRight",size:12,style:{color:m?"var(--accent)":"var(--text-faint)",flexShrink:0}})]},u)})})}function Mm(e,t,n,s,l){const o=e.reduce((g,y)=>g+y.value,0)||1,i=e.map(g=>({d:g,area:g.value/o*(s*l)})),c=[];let a={x:t,y:n,w:s,h:l},d=[];const u=g=>g.reduce((y,p)=>y+p.area,0),f=(g,y)=>{if(!g.length)return 1/0;const p=u(g),w=Math.max(...g.map(h=>h.area)),v=Math.min(...g.map(h=>h.area));return Math.max(y*y*w/(p*p),p*p/(y*y*v))},m=()=>{const g=Math.min(a.w,a.h),p=u(d)/(g||1);let w=0;const v=a.w>=a.h;d.forEach(h=>{const x=h.area/(p||1);v?c.push({...h.d,x:a.x,y:a.y+w,w:p,h:x}):c.push({...h.d,x:a.x+w,y:a.y,w:x,h:p}),w+=x}),v?a={x:a.x+p,y:a.y,w:a.w-p,h:a.h}:a={x:a.x,y:a.y+p,w:a.w,h:a.h-p},d=[]};return i.forEach(g=>{const y=Math.min(a.w,a.h);d.length&&f([...d,g],y)>f(d,y)&&m(),d.push(g)}),d.length&&m(),c}function fa({items:e,height:t=120,onPick:n,selKey:s}){const l=N.useRef(null),[o,i]=N.useState(0);N.useEffect(()=>{if(!l.current||typeof ResizeObserver>"u")return;const u=new ResizeObserver(f=>i(f[0].contentRect.width));return u.observe(l.current),()=>u.disconnect()},[]);const c=o||600,a=[...e].sort((u,f)=>f.value-u.value),d=Mm(a,0,0,c,t);return r.jsx("div",{ref:l,style:{position:"relative",width:"100%",height:t,borderRadius:7,overflow:"hidden",background:"var(--bg-canvas)"},children:d.map(u=>{const f=Math.max(0,Math.min(1,u.intensity||0)),g=`color-mix(in srgb, ${f>.66?"var(--error)":f>.33?"var(--warn)":"var(--node-route)"} ${Math.round(20+f*58)}%, var(--bg-elevated))`,y=s===u.key,p=u.w>52&&u.h>26,w=u.w>36&&u.h>15,v={position:"absolute",left:u.x+1.5,top:u.y+1.5,width:Math.max(0,u.w-3),height:Math.max(0,u.h-3),background:g,borderRadius:4,cursor:n?"pointer":"default",overflow:"hidden",padding:p?"5px 7px":"0 5px",display:"flex",flexDirection:"column",justifyContent:p?"flex-start":"center",border:y?"1.5px solid var(--accent)":"1px solid rgba(0,0,0,0.26)"};return r.jsxs("div",{onClick:n?()=>n(u):void 0,title:u.title||u.label,style:v,children:[w&&r.jsx("span",{className:"mono",style:{fontSize:p?10:9,fontWeight:500,color:f>.45?"#fff":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.25},children:u.label}),p&&u.sub&&r.jsx("span",{className:"mono tabular",style:{fontSize:9,color:f>.45?"rgba(255,255,255,0.8)":"var(--text-muted)",marginTop:1},children:u.sub})]},u.key)})})}function Kr(e,t){return e==="route"?"route":/\.(test|spec)\.|__tests__\//.test(t)?"test":"code"}function gp(e){return e.map((t,n)=>{const s=46*Math.sqrt(n+.6),l=n*2.399963229728653;return{id:t.id,label:t.name,kind:Kr(t.kind,t.filePath),x:Math.round(s*Math.cos(l)*2.2),y:Math.round(s*Math.sin(l)),file:t.filePath}})}const Lc=120,Pm=600;function Lm(e,t){const n=gp(e),s=n.length;if(s<2)return n;const l=new Map;n.forEach((d,u)=>l.set(d.id,u));const o=n.map(d=>d.x),i=n.map(d=>d.y),c=110,a=s<=Pm;for(let d=0;d<Lc;d++){const f=3+26*(1-d/Lc),m=new Array(s).fill(0),g=new Array(s).fill(0);if(a)for(let y=0;y<s;y++)for(let p=y+1;p<s;p++){let w=o[y]-o[p],v=i[y]-i[p];if(w===0&&v===0){const j=(y*7+p)%12*(Math.PI/6);w=Math.cos(j),v=Math.sin(j)}const h=w*w+v*v,x=c*c/h;m[y]+=w*x,g[y]+=v*x,m[p]-=w*x,g[p]-=v*x}for(const y of t){const p=l.get(y.from),w=l.get(y.to);if(p===void 0||w===void 0||p===w)continue;const v=o[p]-o[w],h=i[p]-i[w],x=(Math.hypot(v,h)||1)/c;m[p]-=v*x,g[p]-=h*x,m[w]+=v*x,g[w]+=h*x}for(let y=0;y<s;y++){const p=Math.hypot(m[y],g[y]);if(!p)continue;const w=Math.min(p,f);o[y]+=m[y]/p*w,i[y]+=g[y]/p*w}}return n.map((d,u)=>({...d,x:Math.round(o[u]*1.35),y:Math.round(i[u])}))}function Im(e,t){const n=new Set(e.map(p=>p.id)),s=new Map,l=new Map;e.forEach(p=>{s.set(p.id,0),l.set(p.id,[])}),t.forEach(p=>{p.from===p.to||!n.has(p.from)||!n.has(p.to)||(l.get(p.from).push(p.to),s.set(p.to,(s.get(p.to)??0)+1))});const o=new Map,i=[];let c=0;const a=()=>{for(;c<i.length;){const p=i[c++],w=o.get(p);for(const v of l.get(p)??[])o.has(v)||(o.set(v,w+1),i.push(v))}};e.forEach(p=>{s.get(p.id)===0&&(o.set(p.id,0),i.push(p.id))}),a();for(const p of e)o.has(p.id)||(o.set(p.id,0),i.push(p.id),a());const d=new Map;e.forEach(p=>{const w=o.get(p.id);d.has(w)||d.set(w,[]),d.get(w).push(p.id)});const u=250,f=58,m=20,g=new Map;let y=0;for(const[,p]of[...d.entries()].sort((w,v)=>w[0]-v[0])){const w=Math.ceil(p.length/m),v=Math.ceil(p.length/w);p.forEach((h,x)=>{const j=Math.floor(x/v),S=x%v;g.set(h,{x:y+j*u,y:Math.round((S-(v-1)/2)*f)})}),y+=w*u+40}return e.map(p=>({id:p.id,label:p.name,kind:Kr(p.kind,p.filePath),x:g.get(p.id).x,y:g.get(p.id).y,file:p.filePath}))}function Dm(e,t,n){return n==="synth"?"synth":e.kind==="spec"||t.kind==="spec"?"implements":e.kind==="test"||t.kind==="test"?"tests":"calls"}const Ic={position:"absolute",top:34,left:"50%",transform:"translateX(-50%)",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:5,padding:"3px 7px",fontSize:10.5,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",whiteSpace:"nowrap",pointerEvents:"none",boxShadow:"var(--shadow-pop)",zIndex:5};function ha({nodes:e,edges:t,selectedId:n,onSelect:s,hiddenIds:l,hiddenEdgeKinds:o,height:i="100%",interactive:c=!0,fitKey:a,focusId:d,dotGrid:u=!0}){const[f,m]=N.useState(e),[g,y]=N.useState({tx:0,ty:0,k:1}),[p,w]=N.useState(null),[v,h]=N.useState({w:0,h:0}),x=N.useRef(null),j=N.useRef(null),S=N.useRef(!1);N.useEffect(()=>{const k=x.current;if(!k||typeof ResizeObserver>"u")return;const z=new ResizeObserver(T=>h({w:T[0].contentRect.width,h:T[0].contentRect.height}));return z.observe(k),()=>z.disconnect()},[]),N.useEffect(()=>{m(e),S.current=!1},[e]);const C=N.useCallback(()=>{const k=x.current;if(!k||!f.length)return;const z=k.clientWidth,T=k.clientHeight,L=f.map(Gt=>Gt.x),B=f.map(Gt=>Gt.y),U=Math.min(...L)-60,K=Math.max(...L)+140,he=Math.min(...B)-40,ve=Math.max(...B)+80,_e=K-U,qt=ve-he,Je=Math.min(z/_e,T/qt,1.4)*.92;y({k:Je,tx:(z-_e*Je)/2-U*Je,ty:(T-qt*Je)/2-he*Je})},[f]);N.useEffect(()=>{!S.current&&x.current&&(C(),S.current=!0)},[f,C]),N.useEffect(()=>{a!==void 0&&C()},[a]);const E=N.useRef(null);N.useEffect(()=>{if(!d){E.current=null;return}if(E.current===d)return;const k=f.find(K=>K.id===d),z=x.current;if(!k||!z)return;E.current=d;const{cx:T,cy:L}=Xe(k),B=z.clientWidth,U=z.clientHeight;y(K=>{const he=Math.min(1.4,Math.max(.6,K.k));return{k:he,tx:B/2-T*he,ty:U/2-L*he}})},[d,f]);const R=k=>{if(!c)return;k.preventDefault();const z=x.current.getBoundingClientRect(),T=k.clientX-z.left,L=k.clientY-z.top,B=-k.deltaY*.0016;y(U=>{const K=Math.min(2.4,Math.max(.25,U.k*(1+B))),he=K/U.k;return{k:K,tx:T-(T-U.tx)*he,ty:L-(L-U.ty)*he}})},O=k=>{c&&(k.target.closest("[data-node]")||(j.current={type:"pan",sx:k.clientX,sy:k.clientY,ox:g.tx,oy:g.ty},k.currentTarget.style.cursor="grabbing"))},D=(k,z)=>{c&&(k.stopPropagation(),j.current={type:"node",id:z.id,sx:k.clientX,sy:k.clientY,ox:z.x,oy:z.y,moved:!1})},ne=k=>{const z=j.current;if(z)if(z.type==="pan")y(T=>({...T,tx:z.ox+(k.clientX-z.sx),ty:z.oy+(k.clientY-z.sy)}));else{const T=(k.clientX-z.sx)/g.k,L=(k.clientY-z.sy)/g.k;Math.abs(k.clientX-z.sx)+Math.abs(k.clientY-z.sy)>3&&(z.moved=!0),m(B=>B.map(U=>U.id===z.id?{...U,x:z.ox+T,y:z.oy+L}:U))}},fe=()=>{const k=j.current;k&&k.type==="node"&&!k.moved&&s?.(k.id),x.current&&(x.current.style.cursor="grab"),j.current=null},ke={};f.forEach(k=>ke[k.id]=k);const He={};t.forEach(k=>{He[k.from]=(He[k.from]||0)+1,He[k.to]=(He[k.to]||0)+1});function bt(k){return k.kind==="route"?{w:18,h:18,shape:"dot"}:{w:Math.max(64,k.label.length*(k.kind==="spec"?7.6:7.2)+26),h:30,shape:k.kind==="spec"?"rect":"pill"}}function Xe(k){const z=bt(k);return{cx:k.x+z.w/2,cy:k.y+z.h/2,b:z}}const Te=new Set;return n&&t.forEach(k=>{k.from===n&&Te.add(k.to),k.to===n&&Te.add(k.from)}),r.jsxs("div",{ref:x,onWheel:R,onMouseDown:O,onMouseMove:ne,onMouseUp:fe,onMouseLeave:fe,style:{position:"relative",width:"100%",height:i,overflow:"hidden",cursor:"grab",background:u?"var(--bg-canvas-2)":"transparent",backgroundImage:u?"radial-gradient(circle, var(--dot-grid) 1px, transparent 1px)":"none",backgroundSize:`${22*g.k}px ${22*g.k}px`,backgroundPosition:`${g.tx}px ${g.ty}px`,userSelect:"none"},children:[r.jsxs("svg",{width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none"},children:[r.jsxs("defs",{children:[r.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:8,refY:5,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",children:r.jsx("path",{d:"M0 0 L10 5 L0 10 z",fill:"rgba(160,170,190,0.5)"})}),r.jsx("marker",{id:"arrowHi",viewBox:"0 0 10 10",refX:8,refY:5,markerWidth:7,markerHeight:7,orient:"auto-start-reverse",children:r.jsx("path",{d:"M0 0 L10 5 L0 10 z",fill:"var(--accent)"})})]}),r.jsx("g",{transform:`translate(${g.tx} ${g.ty}) scale(${g.k})`,children:t.map((k,z)=>{const T=ke[k.from],L=ke[k.to];if(!T||!L)return null;const B=Dm(T,L,k.kind);if(o?.has(B))return null;const U=Xe(T),K=Xe(L),he=l&&(l.has(k.from)||l.has(k.to)),ve=n&&(k.from===n||k.to===n),_e=B==="implements"?"var(--node-spec)":B==="tests"?"var(--node-test)":null,qt=_e?`color-mix(in srgb, ${_e} 62%, transparent)`:"rgba(150,160,180,0.32)",Je=(U.cx+K.cx)/2,Gt=`M ${U.cx} ${U.cy} C ${Je} ${U.cy}, ${Je} ${K.cy}, ${K.cx} ${K.cy}`;return r.jsx("path",{d:Gt,fill:"none",stroke:ve?"var(--accent)":qt,strokeWidth:ve?2:_e?1.5:1.2,opacity:he?.12:ve?.95:.72,strokeDasharray:k.kind==="synth"?"5 4":"none",markerEnd:ve?"url(#arrowHi)":"url(#arrow)"},z)})})]}),r.jsx("div",{style:{position:"absolute",inset:0,transform:`translate(${g.tx}px, ${g.ty}px) scale(${g.k})`,transformOrigin:"0 0",pointerEvents:"none"},children:f.map(k=>{const z=bt(k),T=Ut(k.kind,k.state),L=l&&l.has(k.id),B=k.id===n,U=Te.has(k.id),K=p===k.id,he=L?.2:n&&!B&&!U?.55:1,ve=He[k.id]||0,_e=1+Math.min(.24,ve*.045),qt={"data-node":k.id,onMouseDown:Gt=>D(Gt,k),onMouseEnter:()=>w(k.id),onMouseLeave:()=>w(null),style:{position:"absolute",left:k.x,top:k.y,pointerEvents:"auto",cursor:"pointer",opacity:he,transition:"opacity 120ms"}};if(z.shape==="dot")return r.jsxs("div",{...qt,children:[r.jsx("div",{style:{width:18,height:18,borderRadius:"50%",background:T,transform:`scale(${_e})`,boxShadow:B?`0 0 0 4px ${T}44, 0 0 14px ${T}`:K?`0 0 0 3px ${T}33`:`0 0 8px ${T}66`,border:"2px solid var(--bg-canvas-2)"}}),(K||B)&&r.jsx("div",{style:Ic,children:k.label})]},k.id);const Je=k.kind==="spec"&&(k.state==="drifted"||k.state==="broken"||k.state==="orphaned");return r.jsxs("div",{...qt,children:[r.jsxs("div",{style:{minWidth:z.w,height:z.h,padding:"0 12px",display:"flex",alignItems:"center",gap:7,borderRadius:z.shape==="rect"?7:999,transform:`scale(${_e})`,transformOrigin:"center",background:`color-mix(in srgb, ${T} 16%, var(--bg-panel))`,border:`1.5px solid ${B||Je?T:`color-mix(in srgb, ${T} 45%, transparent)`}`,color:"var(--node-text)",fontSize:12.5,fontWeight:500,whiteSpace:"nowrap",fontFamily:"var(--font-mono)",boxShadow:B?`0 0 0 4px ${T}33, 0 4px 16px ${T}44`:K?`0 0 0 3px ${T}22`:"0 2px 8px rgba(0,0,0,0.4)"},children:[r.jsx("span",{style:{width:7,height:7,borderRadius:z.shape==="rect"?2:"50%",background:T,flexShrink:0,boxShadow:`0 0 6px ${T}`}}),k.label,Je&&r.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:k.state==="drifted"?"var(--warn)":"var(--error)",marginLeft:2}})]}),K&&r.jsx("div",{style:{...Ic,top:-22},children:k.file||k.sub})]},k.id)})}),c&&r.jsxs("div",{style:{position:"absolute",right:14,bottom:14,display:"flex",flexDirection:"column",gap:6},children:[r.jsx(io,{icon:"plus",onClick:()=>y(k=>({...k,k:Math.min(2.4,k.k*1.2)}))}),r.jsx(io,{icon:"minus",onClick:()=>y(k=>({...k,k:Math.max(.25,k.k/1.2)}))}),r.jsx(io,{icon:"maximize",onClick:C,title:"Fit"})]}),c&&r.jsxs("div",{style:{position:"absolute",left:14,bottom:14,display:"flex",flexDirection:"column",gap:6},children:[r.jsx(Am,{nodes:f,view:g,size:v}),r.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"rgba(0,0,0,0.4)",padding:"2px 7px",borderRadius:5,alignSelf:"flex-start"},children:Math.round(g.k*100)+"%"})]})]})}function Am({nodes:e,view:t,size:n}){if(!e.length)return null;const s=138,l=88,o=6,i=e.map(E=>E.x),c=e.map(E=>E.y),a=Math.min(...i)-30,d=Math.max(...i)+120,u=Math.min(...c)-20,f=Math.max(...c)+50,m=d-a||1,g=f-u||1,y=Math.min((s-o*2)/m,(l-o*2)/g),p=o+(s-o*2-m*y)/2,w=o+(l-o*2-g*y)/2,v=E=>p+(E-a)*y,h=E=>w+(E-u)*y,x=-t.tx/t.k,j=-t.ty/t.k,S=n.w/t.k,C=n.h/t.k;return r.jsxs("svg",{width:s,height:l,style:{background:"color-mix(in srgb, var(--bg-canvas-2) 92%, transparent)",border:"1px solid var(--border-subtle)",borderRadius:7,boxShadow:"0 4px 12px rgba(0,0,0,0.4)",backdropFilter:"blur(4px)"},children:[e.map(E=>r.jsx("circle",{cx:v(E.x),cy:h(E.y),r:E.kind==="route"?1.6:2.1,fill:Ut(E.kind,E.state),opacity:.9},E.id)),n.w>0&&r.jsx("rect",{x:Math.max(0,v(x)),y:Math.max(0,h(j)),width:Math.min(s,S*y),height:Math.min(l,C*y),fill:"var(--accent)",fillOpacity:.12,stroke:"var(--accent)",strokeWidth:1,rx:2})]})}function io({icon:e,onClick:t,title:n}){return r.jsx("button",{onClick:t,title:n,className:"btn btn-secondary",style:{width:30,height:30,padding:0,justifyContent:"center",borderRadius:7},children:r.jsx(b,{name:e,size:15})})}const H=e=>e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e),Om=4,dt=e=>Math.round(e/Om),Bm=e=>e.split("/").filter(Boolean).slice(-2).join("/"),Tl=e=>e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();function oe({state:e,label:t,minHeight:n,children:s}){if(e.data==null&&e.loading)return r.jsx("div",{className:"skel",style:{minHeight:n,borderRadius:10},"aria-label":`Loading ${t}`});if(e.data==null&&e.error!=null){const l=e.error instanceof Error?e.error.message:String(e.error);return r.jsx("div",{className:"card card-pad",style:{minHeight:n,display:"grid",placeItems:"center"},children:r.jsxs("div",{style:{textAlign:"center",maxWidth:300},children:[r.jsxs("div",{className:"row gap-8",style:{justifyContent:"center",color:"var(--error)"},children:[r.jsx(b,{name:"cancel",size:14}),r.jsxs("span",{style:{fontSize:12.5,fontWeight:600},children:["Couldn't load ",t]})]}),r.jsx("div",{className:"muted",style:{fontSize:11.5,marginTop:4,overflowWrap:"anywhere"},children:l}),r.jsx("button",{className:"btn btn-secondary btn-xs",style:{marginTop:10},onClick:e.reload,children:"Retry"})]})})}return e.data==null?null:r.jsx(r.Fragment,{children:s(e.data)})}function _l({onIngested:e}){const[t,n]=N.useState(!1),s=()=>{n(!0),M.ingestNow().catch(()=>{}).finally(()=>{n(!1),e?.()})};return r.jsx("div",{style:{flex:1,display:"grid",placeItems:"center",padding:18,textAlign:"center"},children:r.jsxs("div",{style:{maxWidth:320},children:[r.jsx("div",{style:{color:"var(--text-muted)",marginBottom:8},children:r.jsx(b,{name:"database",size:18})}),r.jsx("div",{style:{fontSize:12.5,fontWeight:600,marginBottom:4},children:"No Claude Code data ingested yet"}),r.jsx("div",{className:"muted",style:{fontSize:11.5,lineHeight:1.5},children:"Usage modules light up once SpecShip ingests your transcripts from ~/.claude/projects — run an ingest pass now, or use Refresh in the status strip."}),r.jsx("button",{className:"btn btn-secondary btn-xs",style:{marginTop:10},onClick:s,disabled:t,children:t?"Ingesting…":"Run ingest now"})]})})}function Rl({label:e,page:t,arrow:n}){return r.jsxs("a",{href:"/"+t,className:"btn btn-ghost btn-xs",onClick:s=>{s.metaKey||s.ctrlKey||s.shiftKey||(s.preventDefault(),A(t))},children:[e,n&&r.jsx(b,{name:"arrowRight",size:11})]})}function ma({icon:e,iconColor:t,title:n,sub:s,action:l,pad:o}){return r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:o?"11px 13px":void 0,marginBottom:o?0:10,borderBottom:o?"1px solid var(--border-subtle)":void 0},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(b,{name:e,size:14,style:{color:t}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:n}),s&&r.jsx("span",{className:"muted",style:{fontSize:11},children:s})]}),l]})}function ds({icon:e,label:t,value:n,delta:s,deltaInvert:l,spark:o,sparkColor:i,color:c,note:a,onClick:d}){return r.jsxs("button",{onClick:d,className:"card card-btn",style:{textAlign:"left",padding:"11px 13px",display:"flex",flexDirection:"column",gap:6},children:[r.jsxs("div",{className:"row gap-8",style:{color:"var(--text-muted)"},children:[r.jsx(b,{name:e,size:13,style:{color:c||"var(--text-muted)"}}),r.jsx("span",{className:"eyebrow",style:{letterSpacing:"0.04em"},children:t})]}),r.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"flex-end",gap:8},children:[r.jsx("div",{className:"tabular",style:{fontSize:23,fontWeight:650,letterSpacing:"-0.02em",lineHeight:1},children:n}),o&&o.length>1&&r.jsx(ua,{data:o,color:i||c||"var(--accent)",fill:!0,w:64,h:22})]}),a?r.jsx("div",{className:"muted",style:{fontSize:10.5},children:a}):s!==void 0&&r.jsx(ca,{value:s,invert:l})]})}function Wm(e,t){if(!e.nodes.length)return{nodes:[],edges:[]};const n=12,s=[],l=new Set;for(const a of t){for(const d of e.nodes){if(s.length>=n)break;l.has(d.id)||(a.path===d.filePath||a.path.endsWith("/"+d.filePath))&&(s.push(d),l.add(d.id))}if(s.length>=n)break}const o=s.length>=3?s:e.nodes.slice(0,n),i=new Set(o.map(a=>a.id)),c=e.edges.filter(a=>i.has(a.from)&&i.has(a.to)).map(a=>({from:a.from,to:a.to,kind:a.provenance==="heuristic"?"synth":a.kind}));return{nodes:gp(o),edges:c}}function $m({graph:e,heatFiles:t}){const{nodes:n,edges:s}=N.useMemo(()=>Wm(e,t),[e,t]);return r.jsxs("div",{className:"card",style:{overflow:"hidden",height:340,display:"flex",flexDirection:"column"},children:[r.jsx(ma,{icon:"graph",iconColor:"var(--accent)",title:"Recent neighborhood",sub:"· last edited files",pad:!0,action:r.jsx(Rl,{label:"Open graph",page:"graph",arrow:!0})}),r.jsx("div",{style:{flex:1,minHeight:0},children:n.length?r.jsx(ha,{nodes:n,edges:s,onSelect:l=>A("graph",{query:{focus:l}}),interactive:!0}):r.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%"},children:r.jsx("div",{className:"muted",style:{fontSize:12},children:"Nothing indexed yet — run specship index."})})})]})}function Fm({tip:e,onApply:t,onDismiss:n}){const s=e.severity==="error"?"var(--error)":e.severity==="warn"?"var(--warn)":"var(--info)",l=e.state==="applied";return r.jsxs("div",{onClick:()=>A("tips",{query:{sel:e.id}}),title:"View in Tips",onAnimationEnd:o=>{o.currentTarget.style.animation="none"},style:{display:"flex",gap:10,padding:"10px 12px",borderRadius:8,background:"var(--bg-panel-2)",border:"1px solid var(--border-subtle)",borderLeft:`2.5px solid ${s}`,animation:"slideInRight 200ms ease",cursor:"pointer",opacity:l?.65:1},children:[r.jsx("div",{style:{color:s,flexShrink:0,marginTop:1},children:r.jsx(b,{name:e.icon,size:14})}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:12.5,fontWeight:550,lineHeight:1.35,textWrap:"pretty"},children:e.title}),r.jsxs("div",{className:"row gap-8",style:{marginTop:7},children:[r.jsx("code",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",background:"var(--bg-canvas)",padding:"2px 6px",borderRadius:4,border:"1px solid var(--border-subtle)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:220},children:e.fix}),r.jsx("span",{className:"grow"}),r.jsx("span",{className:"pill",style:{fontSize:10,color:s,background:"transparent"},children:e.saving})]})]}),r.jsxs("div",{className:"row gap-4",style:{flexShrink:0},children:[l?r.jsxs("span",{className:"pill",style:{color:"var(--success)",background:"var(--success-soft)"},children:[r.jsx(b,{name:"check",size:11}),"Applied"]}):r.jsx("button",{className:"btn btn-secondary btn-xs",onClick:o=>{o.stopPropagation(),t()},title:"Mark applied",children:"Apply"}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:o=>{o.stopPropagation(),n()},title:"Dismiss",children:r.jsx(b,{name:"x",size:12})})]})]})}function Hm({tips:e,onSetState:t,noIngest:n,onIngested:s}){const l=e.filter(o=>o.severity==="error"&&o.state!=="applied").length;return r.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",height:340},children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"11px 13px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(b,{name:"tips",size:14,style:{color:"var(--warn)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Tips"}),l>0&&r.jsxs("span",{className:"pill",style:{fontSize:10,background:"var(--error-soft)",color:"var(--error)"},children:[l," urgent"]})]}),r.jsx(Rl,{label:"All",page:"tips"})]}),n&&!e.length?r.jsx(_l,{onIngested:s}):r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:10,display:"flex",flexDirection:"column",gap:8},children:[e.slice(0,4).map(o=>r.jsx(Fm,{tip:o,onApply:()=>t(o.id,"applied"),onDismiss:()=>t(o.id,"dismissed")},o.id)),!e.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:8},children:"No tips — nothing wasteful in your recent sessions."})]})]})}function Um({files:e,noIngest:t,onIngested:n}){const s=e.slice(0,14).map(i=>{const c=dt(i.resultBytes??0);return{path:i.path,calls:i.calls,tokens:c,tpc:i.calls>0?c/i.calls:0}}),l=Math.max(...s.map(i=>i.tpc),0)||1,o=s.map(i=>({key:i.path,label:Bm(i.path),value:i.calls,intensity:i.tpc/l,sub:i.calls+" calls",title:`${i.path}
41
- ${i.calls} calls · ~${H(i.tokens)} est. tokens · ~${H(Math.round(i.tpc))}/call`}));return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column"},children:[r.jsx(ma,{icon:"flame",iconColor:"var(--warn)",title:"Tool-call heatmap",sub:"· area = calls, color = est. tokens / call",action:r.jsx(Rl,{label:"Open heatmap",page:"heatmap",arrow:!0})}),t||!o.length?t?r.jsx(_l,{onIngested:n}):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"18px 4px"},children:"No file-touching tool calls in this range."}):r.jsxs(r.Fragment,{children:[r.jsx(fa,{items:o,height:116,selKey:null,onPick:()=>A("heatmap")}),r.jsxs("div",{className:"row gap-10",style:{marginTop:9,alignItems:"center"},children:[r.jsx("span",{className:"muted",style:{fontSize:10},children:"est. tokens / call"}),r.jsx("div",{style:{width:96,height:6,borderRadius:999,background:"linear-gradient(90deg, var(--node-route), var(--warn), var(--error))"}}),r.jsx("span",{className:"muted",style:{fontSize:9.5},children:"efficient → wasteful"})]})]})]})}function Vm({p:e,max:t}){const n=e.input_tokens+e.output_tokens+e.cache_creation_tokens+e.cache_read_tokens,s=e.input_tokens+e.cache_creation_tokens+e.cache_read_tokens,l=s>0?e.cache_read_tokens/s:0,o=e.cost_usd/t;return r.jsxs("div",{onClick:()=>A("sessions",{query:{sel:e.session_id}}),role:"button",tabIndex:0,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),A("sessions",{query:{sel:e.session_id}}))},className:"row gap-10 list-row",style:{padding:"7px 4px",borderRadius:6,cursor:"pointer"},children:[r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[!!e.is_sidechain&&r.jsx(b,{name:"bot",size:11,style:{color:"var(--node-code)",marginRight:5,verticalAlign:"-1px"}}),Tl(e.text)]}),r.jsx("div",{style:{marginTop:4,width:"70%"},children:r.jsx(Ur,{frac:o,color:o>.7?"var(--error)":"var(--accent)"})})]}),r.jsxs("div",{style:{textAlign:"right",flexShrink:0},children:[r.jsxs("div",{className:"mono tabular",style:{fontSize:12,fontWeight:600,color:o>.7?"var(--error)":"var(--text-primary)"},children:["$",e.cost_usd.toFixed(2)]}),r.jsxs("div",{className:"mono muted",style:{fontSize:10},children:[H(n)," · ",Math.round(l*100),"%"]})]})]})}function Km({prompts:e,noIngest:t,onIngested:n}){const s=[...e].sort((o,i)=>i.ts-o.ts).slice(0,8),l=Math.max(...s.map(o=>o.cost_usd),0)||1;return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column"},children:[r.jsx(ma,{icon:"coins",iconColor:"var(--accent)",title:"Recent prompts",sub:"· by cost",action:r.jsx(Rl,{label:"Cost ranking",page:"costs"})}),t?r.jsx(_l,{onIngested:n}):r.jsxs("div",{className:"col",children:[s.map(o=>r.jsx(Vm,{p:o,max:l},o.id)),!s.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"10px 4px"},children:"No prompt spend in this range."})]})]})}function us(e,t,n,s){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono tabular",style:{fontSize:15,fontWeight:600,color:s||"var(--text-primary)"},children:t}),n&&r.jsx("div",{className:"mono muted",style:{fontSize:9.5},children:n})]})}const Qm={today:"Saved today",week:"Saved this week",month:"Saved this month",all:"Saved all time"};function vp({cache:e,range:t,noIngest:n,onIngested:s}){const l=Math.round(e.wowDelta*100);return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",gap:12},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(b,{name:"database",size:14,style:{color:"var(--node-route)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Cache analytics"})]}),n?r.jsx(_l,{onIngested:s}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{alignItems:"flex-end",gap:10},children:[r.jsxs("div",{className:"tabular",style:{fontSize:38,fontWeight:700,letterSpacing:"-0.03em",lineHeight:.9,color:"var(--node-route)"},children:[Math.round(e.readRate*100),"%"]}),r.jsxs("div",{style:{paddingBottom:3},children:[r.jsx("div",{className:"muted",style:{fontSize:11},children:"cache read rate"}),r.jsx(ca,{value:e.wowDelta})]})]}),r.jsx("div",{style:{height:1,background:"var(--border-subtle)"}}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px 14px"},children:[us("Creation tokens",H(e.creationTokens),"written to cache"),us("Read tokens",H(e.readTokens),"charged at ~10%"),us(Qm[t]??"Saved this week","$"+e.dollarsSaved.toFixed(0),"vs no cache — est.","var(--success)"),us("WoW",(l>=0?"+":"")+l+"%",l>=0?"more reuse":"less reuse",l>=0?"var(--success)":"var(--error)")]})]})]})}const ps=e=>{const t=e.name||e.path;return t.split("/").filter(Boolean).pop()??t},qm=e=>e==null?", drift not measured for this project":e>0?`, ${e} drifted links`:", no drifted links";function Gm(e){const t=I(()=>M.claudeStats(),[]),n=I(()=>M.claudeCompare(),[]),[s,l]=N.useState(new Set),o=t.data?.sessionCount===0,i=()=>{t.reload(),n.reload()},c=a=>l(d=>{const u=new Set(d);return u.has(a)?u.delete(a):u.add(a),u});return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(ze,{icon:"compare",title:"Compare projects",sub:"Which projects are cost-efficient vs hungry"}),o?r.jsx(Kn,{onIngested:i}):r.jsx(oe,{state:n,label:"project comparison",minHeight:280,children:a=>a.projects.length?r.jsx(Ym,{projects:a.projects,off:s,onToggle:c}):r.jsx(Kn,{onIngested:i})})]})}function Ym({projects:e,off:t,onToggle:n}){const s=e.filter(u=>!t.has(u.path)),l=[...s].sort((u,f)=>f.cacheHit-f.avgCost/100-(u.cacheHit-u.avgCost/100))[0],o=new Map;for(const u of s)for(const f of u.byModel)o.set(f.model,(o.get(f.model)??0)+f.cost);const i=[...o.entries()].sort((u,f)=>f[1]-u[1]).slice(0,5).map(([u],f)=>({key:u,label:El(u),color:ii(f)})),c=s.map(u=>({label:ps(u),values:Object.fromEntries(u.byModel.map(f=>[f.model,f.cost]))})),a=(u,f=70)=>r.jsx("span",{style:{width:f,textAlign:"right"},children:u}),d=(u,f=70)=>r.jsx("span",{className:"mono tabular",style:{width:f,textAlign:"right",fontSize:12},children:u});return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"row gap-6",style:{marginBottom:14,flexWrap:"wrap"},children:e.map(u=>{const f=!t.has(u.path);return r.jsx("button",{onClick:()=>n(u.path),"aria-pressed":f,title:u.path,style:{height:28,padding:"0 12px",borderRadius:999,fontSize:12,cursor:"pointer",fontFamily:"var(--font-mono)",border:"1px solid "+(f?"transparent":"var(--border-subtle)"),background:f?"var(--accent-soft)":"var(--bg-panel)",color:f?"var(--accent)":"var(--text-muted)"},children:ps(u)},u.path)})}),l&&r.jsxs("div",{className:"card card-pad",style:{marginBottom:14,borderColor:"rgba(70,194,107,0.3)",background:"var(--success-soft)",display:"flex",gap:12,alignItems:"center"},children:[r.jsx("div",{style:{color:"var(--success)"},children:r.jsx(b,{name:"sparkles",size:18})}),r.jsxs("div",{className:"grow",children:[r.jsx("span",{style:{fontWeight:600,fontSize:13},children:"Most efficient: "}),r.jsx("span",{className:"mono",style:{color:"var(--success)"},children:ps(l)}),r.jsxs("span",{className:"secondary",style:{fontSize:12.5},children:[" ","— ",Math.round(l.cacheHit*100),"% cache hit, $",l.avgCost.toFixed(2)," avg/session",qm(l.drift),"."]})]})]}),r.jsxs("div",{className:"card",style:{overflow:"hidden",marginBottom:14},children:[r.jsxs("div",{className:"row",style:{padding:"9px 14px",fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"grow",children:"Project"}),a("Cost"),a("Sessions"),a("Avg"),a("Cache"),r.jsx("span",{style:{width:60,textAlign:"right"},children:"Drift"}),r.jsx("span",{style:{width:150,textAlign:"right"},children:"Top tools"})]}),s.map(u=>r.jsxs("div",{className:"row",style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"mono grow",style:{fontSize:12.5,color:l&&u.path===l.path?"var(--success)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},title:u.path,children:ps(u)}),d("$"+u.cost.toFixed(0)),d(u.sessions),d("$"+u.avgCost.toFixed(2)),r.jsxs("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12,color:Vr(u.cacheHit)},children:[Math.round(u.cacheHit*100),"%"]}),r.jsx("span",{className:"mono tabular",title:u.drift==null?"Not measured — only the primary project has an indexed spec graph":void 0,style:{width:60,textAlign:"right",fontSize:12,color:u.drift==null?"var(--text-muted)":u.drift>10?"var(--warn)":"var(--text-secondary)"},children:u.drift??"—"}),r.jsx("span",{className:"row gap-4",style:{width:150,justifyContent:"flex-end",overflow:"hidden"},children:u.topTools.map(f=>r.jsx("code",{className:"mono",style:{fontSize:9.5,background:"var(--bg-canvas)",padding:"1px 5px",borderRadius:3,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:f},f))})]},u.path)),!s.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px"},children:"Every project is toggled off — pick at least one above."})]}),s.length>0&&i.length>0&&r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",marginBottom:14},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(b,{name:"dollar",size:14,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Cost by model per project"})]}),r.jsx("div",{className:"row gap-12",children:i.map(u=>r.jsxs("span",{className:"row gap-4 muted",style:{fontSize:10.5},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:3,background:u.color}}),u.label]},u.key))})]}),r.jsx(xp,{rows:c,segments:i,fmt:u=>"$"+u.toFixed(0)})]})]})}const Xm={today:"today",week:"7 days",month:"30 days",all:"all time"};function Jm(e){const[t,n]=N.useState("month"),[s,l]=N.useState(""),[o,i]=N.useState(null),c=I(()=>M.claudeStats(),[]),a=I(()=>M.claudeCosts(t,null,s||null),[t,s]),d=I(()=>M.claudeCache(t),[t]),[u,f]=N.useState([]);N.useEffect(()=>{s||!a.data||f(a.data.byModel.map(y=>y.model).filter(y=>!!y))},[s,a.data]);const m=c.data?.sessionCount===0,g=()=>{c.reload(),a.reload(),d.reload()};return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(ze,{icon:"dollar",title:"Costs",sub:"Where the money goes",actions:r.jsxs(r.Fragment,{children:[!m&&r.jsxs("select",{className:"input","aria-label":"Model filter",value:s,onChange:y=>l(y.target.value),style:{fontSize:12,padding:"4px 8px"},children:[r.jsx("option",{value:"",children:"All models"}),u.map(y=>r.jsx("option",{value:y,children:El(y)},y))]}),r.jsx(Cl,{value:t,onChange:n})]})}),m?r.jsx(Kn,{onIngested:g}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.3fr 1fr",gap:14,marginBottom:14},children:[r.jsx(oe,{state:a,label:"cost series",minHeight:280,children:y=>r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"flex-start",marginBottom:10},children:[r.jsxs("div",{children:[r.jsxs("div",{className:"tabular",style:{fontSize:34,fontWeight:700,letterSpacing:"-0.02em"},children:["$",y.total.toFixed(2)]}),r.jsxs("div",{className:"row gap-8",style:{marginTop:2},children:[r.jsxs("span",{className:"muted",style:{fontSize:11.5},children:["total · ",Xm[t]??t]}),r.jsx(ca,{value:y.wowDelta,invert:!0})]}),(y.unpricedSessions??0)>0&&r.jsxs("div",{style:{marginTop:4,fontSize:11,color:"var(--warn)"},title:"Sessions whose model has no pricing row — their cost is unknown and excluded from this total, not $0",children:["⚠ excludes ",y.unpricedSessions," unpriced session",y.unpricedSessions===1?"":"s"]})]}),o&&r.jsxs("div",{style:{textAlign:"right"},children:[r.jsxs("div",{className:"mono",style:{fontSize:13,fontWeight:600},children:["$",o.cost.toFixed(2)]}),r.jsxs("div",{className:"muted",style:{fontSize:10.5},children:[String(o.prompts??0)," prompts · ",o.day,"d ago"]})]})]}),r.jsx(hp,{series:y.series,color:"var(--accent)",onHover:i,h:200})]})}),r.jsx(oe,{state:a,label:"cost by model",minHeight:280,children:y=>r.jsx(Zm,{c:y})})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.4fr 1fr",gap:14},children:[r.jsx(oe,{state:a,label:"expensive prompts",minHeight:280,children:y=>r.jsx(ex,{prompts:y.topPrompts})}),r.jsx(oe,{state:d,label:"cache analytics",minHeight:280,children:y=>r.jsx(vp,{cache:y,range:t,noIngest:!1,onIngested:g})})]})]})]})}function Zm({c:e}){const t=e.byModel.reduce((s,l)=>s+(l.cost??0),0),n=e.byModel.map((s,l)=>({label:El(s.model??"unknown"),cost:s.cost??0,color:ii(l)}));return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[r.jsxs("div",{className:"row gap-8",style:{alignSelf:"flex-start",marginBottom:8},children:[r.jsx(b,{name:"layers",size:14,style:{color:"var(--node-code)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"By model"})]}),n.length?r.jsxs(r.Fragment,{children:[r.jsx(mp,{data:n,size:150,centerLabel:"$"+t.toFixed(0),centerSub:"in range"}),r.jsx("div",{className:"col gap-6",style:{marginTop:14,width:"100%"},children:n.map((s,l)=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{style:{width:9,height:9,borderRadius:3,background:ii(l),flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.label}),r.jsxs("span",{className:"mono tabular",style:{fontSize:11.5},children:["$",s.cost.toFixed(1)]}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5,width:38,textAlign:"right"},children:[t>0?Math.round(s.cost/t*100):0,"%"]})]},s.label))})]}):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"18px 0"},children:"No model-attributed spend in this range."})]})}function ex({prompts:e}){const t=e.slice(0,8),n=Math.max(...t.map(s=>s.cost_usd),0)||1;return r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(b,{name:"sortAsc",size:14,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Most expensive prompts"}),r.jsxs("span",{className:"muted",style:{fontSize:11},children:["· top ",t.length]})]}),t.map((s,l)=>{const o=s.input_tokens+s.output_tokens+s.cache_creation_tokens+s.cache_read_tokens,i=s.input_tokens+s.cache_creation_tokens+s.cache_read_tokens,c=i>0?s.cache_read_tokens/i:0,a=s.cost_usd/n;return r.jsxs("div",{className:"row gap-12 list-row",role:"button",tabIndex:0,onClick:()=>A("sessions",{query:{sel:s.session_id}}),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),A("sessions",{query:{sel:s.session_id}}))},style:{padding:"9px 0",borderTop:l?"1px solid var(--border-subtle)":"none",cursor:"pointer"},children:[r.jsx("span",{className:"mono muted tabular",style:{width:16,fontSize:11},children:l+1}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[!!s.is_sidechain&&r.jsx(b,{name:"bot",size:11,style:{color:"var(--node-code)",marginRight:5,verticalAlign:"-1px"}}),Tl(s.text)]}),r.jsx("div",{style:{marginTop:4,maxWidth:280},children:r.jsx(Ur,{frac:a,color:a>.66?"var(--error)":"var(--accent)"})})]}),r.jsx("span",{className:"mono muted",style:{fontSize:10.5,width:84,textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.model?El(s.model):"—"}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11,width:56,textAlign:"right"},children:H(o)}),r.jsxs("span",{className:"mono tabular",style:{fontSize:11,width:40,textAlign:"right",color:Vr(c)},children:[Math.round(c*100),"%"]}),r.jsxs("span",{className:"mono tabular",style:{fontSize:13,fontWeight:600,width:52,textAlign:"right"},children:["$",s.cost_usd.toFixed(2)]})]},s.id)}),!t.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"10px 0"},children:"No prompt spend in this range."})]})}const gn=e=>e.toLocaleString();function tx({project:e}){const[t,n]=N.useState("week"),s=e??"_",l=I(()=>M.status(e),[e],{cacheKey:`status:${s}`}),o=I(()=>M.claudeStats(t),[t],{cacheKey:`stats:${s}:${t}`}),i=I(()=>M.claudeCosts(t),[t],{cacheKey:`costs:${s}:${t}`}),c=I(()=>M.claudeCache(t),[t],{cacheKey:`cache:${s}:${t}`}),a=I(()=>M.claudeHeatmap(t),[t],{cacheKey:`heatmap:${s}:${t}`}),d=I(()=>M.claudeTips(),[],{cacheKey:`tips:${s}`}),u=I(()=>M.graphFull(e),[e],{cacheKey:`graphfull:${s}`});if(kt(l.error))return r.jsx(se,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const f=o.data?.sessionCount===0,m=()=>{o.reload(),i.reload(),c.reload(),a.reload(),d.reload()},g=(j,S)=>{M.setTipState(j,S).catch(()=>{}).finally(()=>d.reload())},y=l.data,p=y?y.projectPath.split("/").filter(Boolean).pop()??y.projectPath:"",w=!f&&o.data?(o.data.lastSessionCost.unpricedTokens??0)>0?" · last session unpriced ⚠":" · last session $"+o.data.lastSessionCost.value.toFixed(2):"",v=o.data?.ingest,h=!f&&v?` · ingest ${gn(v.linesParsed)}/${gn(v.linesParsed+v.linesSkipped)} parsed${v.linesSkipped>0?" ⚠":""}`:"",x=y?`${p} · ${gn(y.nodeCount)} nodes${w}${h}`:"Loading project status…";return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(ze,{icon:"dashboard",title:"Dashboard",sub:x,actions:r.jsx(Cl,{value:t,onChange:n})}),r.jsx("div",{style:{marginBottom:14},children:r.jsx(oe,{state:o,label:"usage stats",minHeight:86,children:j=>r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10},children:[r.jsx(ds,{icon:"coins",color:"var(--accent)",label:"Last session cost",value:f||(j.lastSessionCost.unpricedTokens??0)>0?"—":"$"+j.lastSessionCost.value.toFixed(2),delta:f||(j.lastSessionCost.unpricedTokens??0)>0?void 0:j.lastSessionCost.delta,deltaInvert:!0,spark:f?void 0:j.lastSessionCost.series,sparkColor:"var(--accent)",note:f?"no transcript data — enable ingest":(j.lastSessionCost.unpricedTokens??0)>0?`${gn(j.lastSessionCost.unpricedTokens)} unpriced tokens ⚠ — model has no pricing row`:void 0,onClick:()=>A("sessions")}),r.jsx(ds,{icon:"wrench",color:"var(--node-spec)",label:"Tool calls · 7d",value:f?"—":gn(j.toolCalls.value),delta:f?void 0:j.toolCalls.delta,deltaInvert:!0,spark:f?void 0:j.toolCalls.series,sparkColor:"var(--node-spec)",note:f?"no transcript data — enable ingest":void 0,onClick:()=>A("heatmap")}),r.jsx(ds,{icon:"bot",color:"var(--node-code)",label:"Subagent spend",value:f?"—":j.subagentPct.value+"%",delta:f?void 0:j.subagentPct.delta,deltaInvert:!0,spark:f?void 0:j.subagentPct.series,sparkColor:"var(--node-code)",note:f?"no transcript data — enable ingest":void 0,onClick:()=>A("heatmap")}),r.jsx(ds,{icon:"drift",color:"var(--warn)",label:"Drift queue",value:gn(j.drift.value),delta:j.drift.delta,deltaInvert:!0,sparkColor:"var(--warn)",onClick:()=>A("drift")})]})})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr",gap:12,marginBottom:14},children:[r.jsx(oe,{state:u,label:"recent neighborhood",minHeight:340,children:j=>r.jsx($m,{graph:j,heatFiles:a.data?.files??[]})}),r.jsx(oe,{state:d,label:"tips",minHeight:340,children:j=>r.jsx(Hm,{tips:j.tips,onSetState:g,noIngest:f,onIngested:m})})]}),r.jsx("div",{style:{marginBottom:14},children:r.jsx(oe,{state:a,label:"tool-call heatmap",minHeight:180,children:j=>r.jsx(Um,{files:j.files,noIngest:f,onIngested:m})})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.4fr 1fr",gap:12},children:[r.jsx(oe,{state:i,label:"recent prompts",minHeight:300,children:j=>r.jsx(Km,{prompts:j.topPrompts,noIngest:f,onIngested:m})}),r.jsx(oe,{state:c,label:"cache analytics",minHeight:300,children:j=>r.jsx(vp,{cache:j,range:t,noIngest:f,onIngested:m})})]})]})}const nx=[{name:"bg/canvas",varName:"--bg-canvas"},{name:"bg/panel",varName:"--bg-panel"},{name:"bg/elevated",varName:"--bg-elevated"},{name:"text/primary",varName:"--text-primary"},{name:"text/secondary",varName:"--text-secondary"},{name:"text/muted",varName:"--text-muted"},{name:"accent/primary",varName:"--accent"}],rx=[{name:"node/code",varName:"--node-code"},{name:"node/spec",varName:"--node-spec"},{name:"node/test",varName:"--node-test"},{name:"node/route",varName:"--node-route"}],sx=[{state:"success",varName:"--success",softVar:"--success-soft"},{state:"warn",varName:"--warn",softVar:"--warn-soft"},{state:"error",varName:"--error",softVar:"--error-soft"},{state:"info",varName:"--info",softVar:"--info-soft"}],lx=[{label:"Big number",varName:"--fs-big",sample:"$1,184.42"},{label:"Page title",varName:"--fs-title",sample:"Page title"},{label:"Body & labels",varName:"--fs-base",sample:"Body & labels — Geist"},{label:"Secondary",varName:"--fs-sm",sample:"Secondary text"},{label:"Caption / pills",varName:"--fs-xs",sample:"CAPTIONS & PILLS"},{label:"Mono",varName:"--fs-sm",sample:"validateSession()",mono:!0}],ox=[{label:"Primary",className:"btn-primary",states:["default","hover","disabled","loading"]},{label:"Secondary",className:"btn-secondary",states:["default","hover","pressed","disabled","loading"]},{label:"Ghost",className:"btn-ghost",states:["default","hover","pressed","disabled"]},{label:"Destructive",className:"btn-destructive",states:["default","hover","disabled"]}],ix={hover:"is-hover",pressed:"is-active"},ax=[{label:"Spec link states",states:["drafted","implementing","implemented","verified","drifted","broken","orphaned"]},{label:"Run states",states:["pending","running","paused","completed","failed","cancelled","skipped"]},{label:"Semantic",states:["success","warn","error","info"]}];function Xt({title:e,children:t,span:n}){return r.jsxs("div",{className:"card card-pad",style:n?{gridColumn:"1 / -1"}:void 0,children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:e}),t]})}function Dc({tok:e}){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:96},children:[r.jsx("div",{style:{height:40,borderRadius:8,background:`var(${e.varName})`,border:"1px solid var(--border-subtle)"}}),r.jsx("div",{style:{fontSize:11,fontWeight:500},children:e.name}),r.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]})}function cx(){return r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:12},children:[r.jsx(Xt,{title:"Surfaces & text",children:r.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:nx.map(e=>r.jsx(Dc,{tok:e},e.varName))})}),r.jsx(Xt,{title:"Node colors · distinct at 4px",children:r.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:rx.map(e=>r.jsx(Dc,{tok:e},e.varName))})}),r.jsx(Xt,{title:"Semantic states",children:r.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:sx.map(e=>r.jsxs("div",{style:{minWidth:96},children:[r.jsxs("div",{style:{display:"flex",gap:4},children:[r.jsx("div",{style:{flex:1,height:40,borderRadius:"8px 0 0 8px",background:`var(${e.varName})`}}),r.jsx("div",{style:{flex:1,height:40,borderRadius:"0 8px 8px 0",background:`var(${e.softVar})`}})]}),r.jsx("div",{style:{fontSize:11,fontWeight:500,marginTop:4},children:e.state}),r.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]},e.varName))})}),r.jsx(Xt,{title:"Typography",children:r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:lx.map(e=>r.jsxs("div",{children:[r.jsx("span",{className:e.mono?"mono":void 0,style:{fontSize:`var(${e.varName})`,fontWeight:500},children:e.sample}),r.jsx("span",{className:"muted",style:{fontSize:10.5,marginLeft:8},children:e.label})]},e.label+e.sample))})}),r.jsx(Xt,{title:"Buttons · every state",children:r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:ox.map(e=>r.jsx("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:e.states.map(t=>{const n=ix[t];return r.jsxs("button",{className:`btn ${e.className} btn-sm${n?" "+n:""}`,disabled:t==="disabled"||t==="loading","aria-busy":t==="loading","aria-label":`${e.label} ${t}`,children:[e.label," · ",t]},t)})},e.className))})}),ax.map(e=>r.jsx(Xt,{title:e.label,children:r.jsx("div",{className:"row gap-8",style:{flexWrap:"wrap"},children:e.states.map(t=>r.jsx(qe,{state:t},t))})},e.label)),r.jsx(Xt,{title:"Pills & badges",children:r.jsxs("div",{className:"row gap-8",style:{flexWrap:"wrap"},children:[r.jsx(Q,{color:"var(--accent)",bg:"var(--accent-soft)",dot:!0,children:"custom"}),r.jsx(Q,{color:"var(--node-code)",bg:"var(--node-code-soft)",children:"code"}),r.jsx(Q,{color:"var(--text-secondary)",bg:"var(--bg-elevated)",children:"neutral"})]})})]})}const dx=[4,6,5,8,7,10,9,12,11,14],ux=Array.from({length:14},(e,t)=>({day:t+1,cost:4+Math.sin(t/2)*2+t*.6})),px=[{label:"verified",cost:12,color:"var(--success)"},{label:"implemented",cost:7,color:"var(--node-spec)"},{label:"drifted",cost:2,color:"var(--warn)"}],fx=[{label:"specship",values:{a:14,b:6}},{label:"web-ng",values:{a:9,b:3}}],hx=[{key:"a",label:"Fable",color:"var(--accent)"},{key:"b",label:"Haiku",color:"var(--node-route)"}],mx=[{name:"specship_explore",calls:42},{name:"specship_node",calls:17},{name:"specship_search",calls:9}],xx=[{key:"a",label:"server.ts",value:42,intensity:.8,sub:"42 edits"},{key:"b",label:"tools.ts",value:28,intensity:.5,sub:"28 edits"},{key:"c",label:"index.ts",value:12,intensity:.2,sub:"12 edits"},{key:"d",label:"schema.sql",value:8,intensity:.1,sub:"8 edits"}],gx=[{id:"spec",label:"REQ-DESKTOP-017",kind:"spec",x:0,y:40},{id:"fn",label:"createServer",kind:"code",x:260,y:0},{id:"test",label:"ui-build-guard",kind:"test",x:260,y:90},{id:"route",label:"/api/status",kind:"route",x:520,y:40}],vx=[{from:"spec",to:"fn"},{from:"spec",to:"test"},{from:"fn",to:"route",kind:"synth"}];function yx(){const[e,t]=N.useState("week");return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-8",style:{margin:"20px 0 8px"},children:[r.jsx("div",{className:"eyebrow",children:"Chart & graph primitives"}),r.jsx(_m,{title:"Illustrative reference data — these primitives have no backend; every data screen binds to your live project."})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:12},children:[r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Segmented"}),r.jsx(We,{options:[{value:"today",label:"Today"},{value:"week",label:"This week"},{value:"month",label:"This month"}],value:e,onChange:t,size:"sm"})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Sparkline + line"}),r.jsx(ua,{data:dx,fill:!0}),r.jsx("div",{style:{marginTop:10},children:r.jsx(hp,{series:ux,h:140})})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Donut + stacked bars"}),r.jsxs("div",{className:"row gap-16",children:[r.jsx(mp,{data:px,centerLabel:"21",centerSub:"links"}),r.jsx("div",{className:"grow",children:r.jsx(xp,{rows:fx,segments:hx,fmt:n=>"$"+n.toFixed(0)})})]})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Bars + treemap"}),r.jsx(pa,{items:mx}),r.jsx("div",{style:{marginTop:12},children:r.jsx(fa,{items:xx,height:110})})]}),r.jsxs("div",{className:"card",style:{gridColumn:"1 / -1",overflow:"hidden"},children:[r.jsx("div",{className:"eyebrow",style:{padding:"12px 14px 0"},children:"Graph canvas"}),r.jsx("div",{style:{height:220},children:r.jsx(ha,{nodes:gx,edges:vx})})]})]})]})}function jx(){return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:22},children:[r.jsx(ze,{icon:"layers",title:"Design system",sub:"Tokens, components and states — rendered live in both themes, WCAG AA."}),["dark","light"].map(e=>r.jsxs("div",{"data-theme":e,style:{marginBottom:20,borderRadius:12,background:"var(--bg-canvas)",padding:16,border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"eyebrow","data-testid":`theme-${e}`,style:{marginBottom:12,color:"var(--text-secondary)"},children:[e," theme"]}),r.jsx(cx,{})]},e)),r.jsx(yx,{})]})}const wx=["drifted","broken","orphaned"],Sx={drifted:{label:"Fix",icon:"wrench",workflow:"spec-fix",withSpecId:!0,title:"Launch the spec-fix workflow for this spec"},broken:{label:"Re-verify",icon:"refresh",workflow:"spec-verify",withSpecId:!1,title:"Launch the spec-verify workflow"},orphaned:{label:"Re-attach",icon:"graph",workflow:"spec-relink",withSpecId:!0,title:"Launch the spec-relink workflow for this spec"}};function kx({project:e}){const t=I(()=>M.drift(e),[e]),[n,s]=N.useState(new Set);if(kt(t.error))return r.jsx(se,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const l=t.data?.links??[],o={};for(const a of l)o[a.state]=(o[a.state]??0)+1;const i=l.filter(a=>!n.has(a.state)),c=a=>s(d=>{const u=new Set(d);return u.has(a)?u.delete(a):u.add(a),u});return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(ze,{icon:"drift",title:"Drift queue",sub:t.data?`${l.length} links need attention`:"Loading drift…"})}),r.jsxs("div",{className:"row gap-8",style:{padding:"0 18px 12px",flexWrap:"wrap"},children:[r.jsx(b,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),wx.map(a=>{const d=!n.has(a),u=ie[a];return r.jsxs("button",{onClick:()=>c(a),className:"row gap-6",style:{height:26,padding:"0 10px",borderRadius:999,fontSize:11.5,fontWeight:500,cursor:"pointer",textTransform:"capitalize",border:"1px solid "+(d?"transparent":"var(--border-subtle)"),background:d?u.bg:"var(--bg-panel)",color:d?u.color:"var(--text-muted)"},children:[a,r.jsx("span",{className:"tabular",style:{opacity:.7},children:o[a]??0})]},a)})]}),t.data&&!l.length?r.jsx(se,{icon:"check",title:"Nothing drifted",body:"Every spec link is intact — the graph matches the specs."}):r.jsx("div",{className:"scroll-y",style:{flex:1,borderTop:"1px solid var(--border-subtle)"},children:i.map((a,d)=>r.jsx(bx,{link:a,project:e},a.id!=null?String(a.id):d))})]})}function lr(e,t){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono",style:{fontSize:12.5,marginTop:1},children:t})]})}function bx({link:e,project:t}){const[n,s]=N.useState(!1),[l,o]=N.useState(!1),[i,c]=N.useState(null),a=[e.targetFilePath,e.targetQualifiedName].filter(Boolean).join(":")||"—",d=e.provenance||"—",u=pn(e.updatedAt)??"—",f=Sx[e.state],m=()=>{!f||l||(o(!0),c(null),M.launchRun(f.workflow,f.withSpecId?{SPEC_ID:e.specId}:{},t).then(g=>A("runs",{param:g.runId}),g=>{c(g instanceof Error?g.message:String(g)),o(!1)}))};return r.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"row gap-10 list-row",role:"button","aria-expanded":n,tabIndex:0,onClick:()=>s(!n),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),s(!n))},style:{padding:"10px 14px",cursor:"pointer"},children:[r.jsx("div",{style:{width:92,flexShrink:0},children:r.jsx(qe,{state:e.state})}),r.jsx("span",{className:"mono",style:{fontSize:12,color:"var(--node-spec)",flexShrink:0,width:130,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.specId}),r.jsx("span",{className:"secondary",style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 220px"},children:e.specTitle}),r.jsx(b,{name:"arrowRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),e.driftAxis&&r.jsx(Q,{color:"var(--warn)",bg:"var(--warn-soft)",children:e.driftAxis}),r.jsx("span",{className:"mono muted",style:{fontSize:11,flexShrink:0,maxWidth:96,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"right"},children:e.provenance||""}),r.jsx("span",{className:"mono muted tabular",style:{fontSize:11,flexShrink:0,width:32,textAlign:"right"},children:u}),r.jsx(b,{name:n?"chevronDown":"chevronRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}})]}),n&&r.jsxs("div",{style:{padding:"0 14px 14px 36px",background:"var(--bg-canvas)"},children:[r.jsxs("div",{className:"row",style:{gap:22,padding:"10px 0",flexWrap:"wrap"},children:[lr("Spec",e.specId),lr("Target",a),lr("Provenance",d),lr("Drift axis",e.driftAxis??"—"),lr("Age",u)]}),r.jsxs("div",{className:"row gap-8",children:[f&&r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:l,title:f.title,onClick:m,children:[r.jsx(b,{name:f.icon,size:12}),l?"Launching…":f.label]}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("specs",{query:{sel:e.specId}}),children:"Open spec"}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("graph",{query:{focus:"spec:"+e.specId}}),children:"Show in graph"})]}),i&&r.jsxs("div",{className:"row gap-6",role:"alert",style:{marginTop:8,color:"var(--error)",fontSize:12},children:[r.jsx(b,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsxs("span",{children:["Couldn’t launch ",f?.workflow," — ",i]})]})]})]})}const ai={height:"100%",display:"flex",flexDirection:"column"},ci={gap:8,padding:"13px 14px",borderBottom:"1px solid var(--border-subtle)"},yp={flex:1,padding:14,display:"flex",flexDirection:"column",gap:16},Mn={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function sl({onClick:e,children:t,bordered:n}){return r.jsx("div",{onClick:e,role:e?"button":void 0,tabIndex:e?0:void 0,onKeyDown:e?s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),e())}:void 0,className:"row gap-8"+(e?" list-row":""),style:{padding:n?"6px 8px":"5px 8px",borderRadius:6,cursor:e?"pointer":"default",fontSize:12,border:n?"1px solid var(--border-subtle)":"none",marginBottom:n?5:0},children:t})}function _t({children:e}){return r.jsx("div",{className:"eyebrow",style:{marginBottom:6},children:e})}function Ac({n:e,onSelect:t}){const n=Kr(e.kind,e.filePath);return r.jsxs(sl,{onClick:()=>t(e.id),children:[r.jsx("span",{style:{width:7,height:7,borderRadius:n==="spec"?2:"50%",background:Ut(n),flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:12,...Mn},children:e.name}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5},children:[e.degree," edges"]}),r.jsx(b,{name:"chevronRight",size:12,style:{color:"var(--text-faint)"}})]})}function fs({color:e,label:t,count:n,dashed:s}){return r.jsxs("div",{className:"row gap-8",style:{padding:"4px 0"},children:[r.jsx("svg",{width:20,height:8,style:{flexShrink:0},children:r.jsx("line",{x1:0,y1:4,x2:20,y2:4,stroke:e,strokeWidth:1.8,strokeDasharray:s?"4 3":"none"})}),r.jsx("span",{className:"grow secondary",style:{fontSize:12},children:t}),n!=null&&r.jsx("span",{className:"mono tabular muted",style:{fontSize:11},children:n})]})}const Nx=[{kind:"code",label:"Code"},{kind:"spec",label:"Spec"},{kind:"test",label:"Test"},{kind:"route",label:"Route"}],Oc=["verified","drifted","broken"];function zx({project:e,counts:t,shown:n,onSelect:s}){const l=I(()=>M.graphHealth(e),[e]),o=l.data?.linkHealth??{},i=l.data?.edgeKinds??{},c={verified:o.verified??0,drifted:o.drifted??0,broken:(o.broken??0)+(o.orphaned??0)},a=Oc.some(d=>c[d]>0);return r.jsxs("div",{style:ai,children:[r.jsxs("div",{className:"row",style:ci,children:[r.jsx(b,{name:"graph",size:15,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:13.5},children:"Graph overview"}),r.jsx("span",{className:"grow"}),r.jsxs("span",{className:"mono muted",style:{fontSize:11},children:[n," shown"]})]}),r.jsxs("div",{className:"scroll-y",style:yp,children:[r.jsx("div",{className:"secondary",style:{fontSize:12,lineHeight:1.55},children:"Click any node to inspect its signature, links, callers and callees — without leaving this view."}),r.jsxs("div",{children:[r.jsx(_t,{children:"Nodes by kind"}),Nx.filter(d=>t[d.kind]).map(d=>r.jsxs("div",{className:"row gap-8",style:{padding:"5px 0"},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:d.kind==="spec"?2:"50%",background:Ut(d.kind),flexShrink:0,boxShadow:`0 0 6px ${Ut(d.kind)}`}}),r.jsx("span",{className:"grow",style:{fontSize:12.5},children:d.label}),r.jsx("span",{className:"mono tabular",style:{fontSize:12.5,fontWeight:600},children:t[d.kind]})]},d.kind))]}),r.jsxs("div",{children:[r.jsx(_t,{children:"Spec link health"}),a?r.jsx("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:Oc.filter(d=>c[d]>0).map(d=>r.jsxs("span",{className:"row gap-6",children:[r.jsx(qe,{state:d}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11,alignSelf:"center"},children:c[d]})]},d))}):r.jsx("div",{className:"muted",style:{fontSize:12},children:"No spec links yet"})]}),r.jsxs("div",{children:[r.jsx(_t,{children:"Edge types"}),r.jsx(fs,{color:"var(--text-muted)",label:"calls",count:i.calls??0}),r.jsx(fs,{color:"var(--node-spec)",label:"implements / documents",count:i.implements??0}),r.jsx(fs,{color:"var(--node-test)",label:"test evidence (links)",count:i.tests??0}),r.jsx(fs,{color:"var(--text-muted)",label:"synthesized (heuristic)",count:i.synth??0,dashed:!0})]}),r.jsxs("div",{children:[r.jsx(_t,{children:"Most connected"}),(l.data?.hubs??[]).map(d=>r.jsx(Ac,{n:d,onSelect:s},d.id)),l.data&&!l.data.hubs.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No connected nodes yet"})]}),r.jsxs("div",{children:[r.jsx(_t,{children:"Anchored"}),(l.data?.anchored??[]).map(d=>r.jsx(Ac,{n:d,onSelect:s},d.id)),l.data&&!l.data.anchored.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No spec-linked code yet"})]})]})]})}function Bc({title:e,items:t,empty:n,onSelect:s}){return r.jsxs("div",{children:[r.jsxs("div",{className:"eyebrow",style:{marginBottom:4},children:[e,r.jsx("span",{className:"muted",style:{marginLeft:6,fontWeight:400},children:t.length})]}),t.length?t.slice(0,10).map(l=>r.jsxs(sl,{onClick:()=>s(l.id),children:[r.jsx(b,{name:"box",size:12,style:{color:Ut(Kr(l.kind,l.filePath)),flexShrink:0}}),r.jsx("span",{className:"mono grow",style:Mn,children:l.name}),r.jsx("span",{className:"mono muted",style:{fontSize:10,flexShrink:0},children:l.filePath.split("/").pop()})]},l.id)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:n})]})}function Cx({id:e,project:t,onSelect:n,onClose:s}){const l=I(()=>M.graphNode(e,t),[e,t]),o=l.data?.matches[0];if(!o)return r.jsxs("div",{style:ai,children:[r.jsxs("div",{className:"row",style:ci,children:[r.jsx("span",{className:"grow",style:{fontWeight:600,fontSize:13.5},children:"Node"}),r.jsx("button",{className:"btn btn-ghost btn-xs","aria-label":"Close node detail",onClick:s,children:r.jsx(b,{name:"x",size:14})})]}),r.jsx("div",{className:"muted",style:{padding:14,fontSize:12},children:l.loading?"Loading node…":"Node not found — it may have been re-indexed away."})]});const i=Kr(o.kind,o.filePath),c=i==="spec"||o.kind==="spec",a=Ut(i);return r.jsxs("div",{style:ai,children:[r.jsxs("div",{className:"row",style:{...ci,padding:"12px 14px"},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:c?2:"50%",background:a,flexShrink:0,marginTop:5,boxShadow:`0 0 8px ${a}`,alignSelf:"flex-start"}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:14,fontWeight:600,...Mn},children:o.name}),r.jsx("div",{className:"row gap-6",style:{marginTop:3},children:r.jsx(Q,{color:a,bg:`color-mix(in srgb, ${a} 14%, transparent)`,children:o.kind})})]}),r.jsx("button",{className:"btn btn-ghost btn-xs","aria-label":"Close node detail",onClick:s,children:r.jsx(b,{name:"x",size:14})})]}),r.jsxs("div",{className:"scroll-y",style:yp,children:[r.jsxs("div",{className:"row gap-6",style:{fontSize:11.5},children:[r.jsx(b,{name:"folder",size:12,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono secondary",style:Mn,children:o.filePath}),r.jsx(lt,{text:o.filePath,ariaLabel:"Copy file path"})]}),!c&&o.signature&&r.jsxs("div",{children:[r.jsx(_t,{children:"Signature"}),r.jsx("pre",{className:"mono",style:{margin:0,fontSize:11.5,lineHeight:1.6,color:"var(--text-secondary)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:10,overflowX:"auto",whiteSpace:"pre-wrap"},children:o.signature})]}),!c&&r.jsxs("div",{children:[r.jsx(_t,{children:"Linked specs"}),o.linkedSpecs.length?o.linkedSpecs.map((d,u)=>r.jsxs(sl,{bordered:!0,onClick:()=>A("specs",{param:d.specId}),children:[r.jsx("span",{className:"mono grow",style:{fontSize:11.5,...Mn},children:d.specId}),r.jsx(qe,{state:d.state})]},u)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No linked specs"})]}),!c&&r.jsx(Bc,{title:"Callers",items:o.callers,empty:"No callers",onSelect:n}),!c&&r.jsx(Bc,{title:"Callees",items:o.callees,empty:"No callees",onSelect:n}),c&&r.jsxs("div",{children:[r.jsx(_t,{children:"Linked code"}),o.linkedSpecs.length?o.linkedSpecs.map((d,u)=>r.jsxs(sl,{bordered:!0,children:[r.jsx(qe,{state:d.state}),r.jsx("span",{className:"mono grow",style:{fontSize:11,...Mn},children:d.targetQualifiedName??d.targetFilePath})]},u)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:8,border:"1px dashed var(--border-subtle)",borderRadius:6,textAlign:"center"},children:"No linked code — orphaned"})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:12,borderTop:"1px solid var(--border-subtle)"},children:[r.jsxs("button",{className:"btn btn-primary btn-sm grow",style:{justifyContent:"center"},disabled:!0,title:"Run automatically by the implementation workflow once Drafted",children:[r.jsx(b,{name:"play",size:13}),"Implement"]}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("drift"),children:"View drift"})]})]})}function Wc({label:e,count:t,active:n,onClick:s,color:l}){return r.jsxs("button",{onClick:s,className:"row gap-6",style:{height:26,padding:"0 10px",borderRadius:999,fontSize:11.5,fontWeight:500,cursor:"pointer",border:"1px solid "+(n?"transparent":"var(--border-subtle)"),background:n?l?`color-mix(in srgb, ${l} 22%, var(--bg-panel))`:"var(--accent-soft)":"var(--bg-panel)",color:n?l||"var(--accent)":"var(--text-secondary)",transition:"background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast)"},children:[l&&r.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:l}}),e,t!=null&&r.jsx("span",{className:"tabular muted",style:{fontSize:10.5},children:t})]})}const Ex=[{kind:"code",label:"Code"},{kind:"spec",label:"Spec"},{kind:"test",label:"Test"},{kind:"route",label:"Route"}],Tx=[{key:"calls",label:"calls"},{key:"implements",label:"implements"},{key:"tests",label:"tests"},{key:"synth",label:"synth"}];function _x({project:e,query:t}){const n=I(()=>M.graphFull(e),[e]),s=t.focus??null,[l,o]=N.useState(s),[i,c]=N.useState("hierarchical"),[a,d]=N.useState(new Set),[u,f]=N.useState(new Set),[m,g]=N.useState(0);N.useEffect(()=>{s&&o(s)},[s]);const y=N.useMemo(()=>[...n.data?.nodes??[]].sort((j,S)=>S.degree-j.degree),[n.data]),p=N.useMemo(()=>(n.data?.edges??[]).map(j=>({from:j.from,to:j.to,kind:j.provenance==="heuristic"?"synth":j.kind})),[n.data]),w=N.useMemo(()=>i==="force"?Lm(y,p):Im(y,p),[y,p,i]),v=N.useMemo(()=>{const j={};return w.forEach(S=>{j[S.kind]=(j[S.kind]??0)+1}),j},[w]),h=N.useMemo(()=>{const j=new Set;return a.size&&w.forEach(S=>{a.has(S.kind)&&j.add(S.id)}),j},[w,a]),x=(j,S,C)=>{const E=new Set(j);E.has(S)?E.delete(S):E.add(S),C(E)};return kt(n.error)?r.jsx(se,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."}):r.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[r.jsxs("div",{className:"col",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},children:[r.jsxs("div",{className:"row",style:{gap:10,padding:"9px 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel-2)",flexWrap:"wrap"},children:[r.jsx(We,{size:"sm",value:i,onChange:j=>{c(j),g(S=>S+1)},options:[{value:"hierarchical",label:"Hierarchical"},{value:"force",label:"Force"}],label:"Graph layout"}),r.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)"}}),Ex.filter(j=>v[j.kind]).map(j=>r.jsx(Wc,{label:j.label,count:v[j.kind],color:Ut(j.kind),active:!a.has(j.kind),onClick:()=>x(a,j.kind,d)},j.kind)),r.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)"}}),Tx.map(j=>r.jsx(Wc,{label:j.label,active:!u.has(j.key),onClick:()=>x(u,j.key,f)},j.key)),r.jsx("div",{className:"grow"}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>g(j=>j+1),children:[r.jsx(b,{name:"recenter",size:13}),"Recenter"]})]}),r.jsxs("div",{style:{flex:1,minHeight:0,position:"relative"},children:[w.length>0&&r.jsx(ha,{nodes:w,edges:p,selectedId:l,onSelect:o,hiddenIds:h,hiddenEdgeKinds:u,fitKey:m,focusId:s}),n.data&&!w.length&&r.jsx(se,{icon:"graph",title:"Nothing indexed yet",body:"Run specship index to populate the graph."})]})]}),r.jsx("div",{style:{width:360,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",minHeight:0},children:l?r.jsx(Cx,{id:l,project:e,onSelect:o,onClose:()=>o(null)}):r.jsx(zx,{project:e,counts:v,shown:n.data?.shown??0,onSelect:o})})]})}const $c=e=>e.split("/").filter(Boolean).slice(-2).join("/"),jp=5e3,xa=2e3;function Rx(e){const[t,n]=N.useState("week"),[s,l]=N.useState("calls"),[o,i]=N.useState(null),c=I(()=>M.claudeStats(),[]),a=I(()=>M.claudeHeatmap(t),[t]),d=c.data?.sessionCount===0,u=()=>{c.reload(),a.reload()},f=(m,g)=>i(y=>y&&y.type===m&&y.key===g?null:{type:m,key:g});return d?r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(ze,{icon:"heatmap",title:"Heatmap",sub:"Where tool calls land — files, tools, subagents"}),r.jsx(Kn,{onIngested:u})]}):r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18,minWidth:0},children:[r.jsx(ze,{icon:"heatmap",title:"Heatmap",sub:"Where tool calls land — files, tools, subagents",actions:r.jsx(Cl,{value:t,onChange:n})}),r.jsx(oe,{state:a,label:"heatmap",minHeight:320,children:m=>r.jsx(Mx,{h:m,range:t,metric:s,onMetric:l,sel:o,pick:f})})]}),o?.type==="file"&&r.jsx("div",{style:co,children:r.jsx(Lx,{path:o.key,range:t,files:a.data?.files??[],onClose:()=>i(null)})}),o?.type==="tool"&&r.jsx("div",{style:co,children:r.jsx(Ix,{name:o.key,range:t,onClose:()=>i(null)})}),o?.type==="subagent"&&r.jsx("div",{style:co,children:r.jsx(Dx,{type:o.key,range:t,onClose:()=>i(null)})})]})}function Mx({h:e,range:t,metric:n,onMetric:s,sel:l,pick:o}){const i=e.tools.reduce((p,w)=>p+w.calls,0),c=dt(e.tools.reduce((p,w)=>p+(w.resultBytes??0),0));if(!i)return r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px 4px"},children:"No tool calls in this range."});const a=[...e.files].sort((p,w)=>w.calls-p.calls)[0],d=e.tools.map(p=>({name:p.name,calls:p.calls,tokens:dt(p.resultBytes??0)})).sort((p,w)=>w.tokens-p.tokens),u=d[0],f=Math.max(...d.map(p=>p.tokens),0)||1,m=e.files.map(p=>{const w=dt(p.resultBytes??0);return{...p,tokens:w,tpc:p.calls>0?w/p.calls:0}}),g=Math.max(...m.map(p=>p.tpc),0)||1,y=m.map(p=>({key:p.path,label:$c(p.path),value:n==="tokens"?p.tokens:p.calls,intensity:p.tpc/g,sub:n==="tokens"?"~"+H(p.tokens):p.calls+" calls",title:`${p.path}
42
- ${p.calls} calls · ~${H(p.tokens)} est. result tokens · ~${H(Math.round(p.tpc))}/call`}));return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10,marginBottom:14},children:[r.jsx(hs,{label:"Tool calls",value:i.toLocaleString(),icon:"wrench",color:"var(--node-spec)",sub:"this "+t}),r.jsx(hs,{label:"Result tokens (est.)",value:"~"+H(c),icon:"database",color:"var(--node-route)",sub:"returned to context, chars ÷ 4"}),r.jsx(hs,{label:"Busiest file",value:a?$c(a.path):"—",icon:"box",color:"var(--warn)",sub:a?a.calls+" calls":""}),r.jsx(hs,{label:"Heaviest tool",value:u?.name??"—",icon:"flame",color:"var(--error)",sub:u?"~"+H(u.tokens)+" est. tokens":""})]}),r.jsxs("div",{className:"card card-pad",style:{marginBottom:14},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(b,{name:"box",size:14,style:{color:"var(--warn)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Files"}),r.jsxs("span",{className:"muted",style:{fontSize:11},children:["· area = ",n==="tokens"?"est. result tokens":"tool calls",", color = est. tokens / call"]}),r.jsx("div",{className:"grow"}),r.jsx(We,{size:"sm",label:"Treemap metric",value:n,onChange:s,options:[{value:"calls",label:"Calls"},{value:"tokens",label:"Tokens"}]})]}),y.length?r.jsx(fa,{items:y,height:268,selKey:l?.type==="file"?l.key:null,onPick:p=>o("file",p.key)}):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px 4px"},children:"No file-touching tool calls in this range."}),r.jsxs("div",{className:"row gap-12",style:{marginTop:10,alignItems:"center"},children:[r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"est. tokens / call"}),r.jsx("div",{style:{width:120,height:7,borderRadius:999,overflow:"hidden",background:"linear-gradient(90deg, var(--node-route), var(--warn), var(--error))"}}),r.jsx("span",{className:"muted",style:{fontSize:10},children:"efficient → wasteful"}),r.jsx("div",{className:"grow"}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"click a tile to drill in"})]})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:4},children:[r.jsx(b,{name:"wrench",size:14,style:{color:"var(--node-code)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Tools"}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"· by est. result tokens, ranked"})]}),r.jsxs("div",{className:"row",style:{padding:"8px 0 4px",fontSize:9.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:[r.jsx("span",{style:{width:116},children:"Tool"}),r.jsx("span",{className:"grow",children:"Est. result tokens"}),r.jsx("span",{style:{width:36,textAlign:"right"},children:"Calls"}),r.jsx("span",{style:{width:64,textAlign:"right"},children:"Per call"}),r.jsx("span",{style:{width:48,textAlign:"right"},children:"Total"}),r.jsx("span",{style:{width:14}})]}),r.jsx("div",{className:"col gap-2",children:d.map(p=>r.jsx(Px,{name:p.name,calls:p.calls,tokens:p.tokens,maxTok:f,selected:l?.type==="tool"&&l.key===p.name,onClick:()=>o("tool",p.name)},p.name))}),r.jsxs("div",{className:"muted",style:{fontSize:10.5,marginTop:10,display:"flex",gap:12},children:[r.jsx(ao,{color:"var(--error)",label:`>${H(jp)} est. / call`}),r.jsx(ao,{color:"var(--warn)",label:`>${H(xa)}`}),r.jsx(ao,{color:"var(--success)",label:"lean"})]})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:14},children:[r.jsx(b,{name:"bot",size:14,style:{color:"var(--node-route)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Subagents"}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"· Task calls by subagent_type"})]}),e.subagentByName.length?r.jsx(pa,{items:e.subagentByName,valueKey:"calls",labelKey:"name",color:"var(--node-route)",onItemClick:p=>o("subagent",String(p.name)),selectedKey:l?.type==="subagent"?l.key:null}):r.jsx("div",{className:"muted",style:{fontSize:12},children:"No subagent invocations in this range."})]})]})]})}function hs({label:e,value:t,icon:n,color:s,sub:l}){return r.jsxs("div",{className:"card",style:{padding:"10px 13px",display:"flex",flexDirection:"column",gap:3},children:[r.jsxs("div",{className:"row gap-6",style:{color:"var(--text-muted)",whiteSpace:"nowrap"},children:[r.jsx(b,{name:n,size:12,style:{color:s,flexShrink:0}}),r.jsx("span",{className:"eyebrow",style:{letterSpacing:"0.03em",overflow:"hidden",textOverflow:"ellipsis"},children:e})]}),r.jsx("div",{className:"mono tabular",style:{fontSize:18,fontWeight:650,letterSpacing:"-0.01em",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),l&&r.jsx("div",{className:"mono muted",style:{fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]})}function Px({name:e,calls:t,tokens:n,maxTok:s,selected:l,onClick:o}){const i=n/Math.max(1,t),c=i>jp?"var(--error)":i>xa?"var(--warn)":"var(--success)";return r.jsxs("div",{onClick:o,role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),o())},className:"row gap-8 list-row",style:{padding:"6px 8px",margin:"0 -8px",borderRadius:6,cursor:"pointer",background:l?"var(--accent-soft)":void 0},children:[r.jsx("span",{className:"mono",style:{width:116,flexShrink:0,fontSize:11.5,color:l?"var(--accent)":"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),r.jsx("div",{className:"grow",style:{height:16,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:r.jsx("div",{style:{width:n/s*100+"%",height:"100%",background:c,borderRadius:4}})}),r.jsxs("span",{className:"mono tabular muted",style:{width:36,textAlign:"right",fontSize:10.5,flexShrink:0},children:["×",t]}),r.jsxs("span",{className:"mono tabular",style:{width:64,textAlign:"right",fontSize:10.5,color:c,flexShrink:0},children:["~",H(Math.round(i)),"/call"]}),r.jsxs("span",{className:"mono tabular",style:{width:48,textAlign:"right",fontSize:11.5,fontWeight:600,flexShrink:0},children:["~",H(n)]}),r.jsx(b,{name:"chevronRight",size:12,style:{color:"var(--text-faint)",flexShrink:0}})]})}function ao({color:e,label:t}){return r.jsxs("span",{className:"row gap-4",children:[r.jsx("span",{style:{width:8,height:8,borderRadius:2,background:e}}),t]})}const co={width:360,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",overflow:"hidden",display:"flex",flexDirection:"column",height:"100%"};function ga({icon:e,color:t,title:n,copy:s,onClose:l}){return r.jsxs("div",{className:"row gap-8",style:{padding:"12px 14px",borderBottom:"1px solid var(--border-subtle)",flexShrink:0},children:[r.jsx(b,{name:e,size:14,style:{color:t,flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:13,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),s&&r.jsx(lt,{text:s}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:l,"aria-label":"Close drill-down",children:r.jsx(b,{name:"x",size:14})})]})}function wp({id:e,meta:t}){return r.jsxs("div",{onClick:()=>A("sessions",{query:{sel:e}}),role:"button",tabIndex:0,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),A("sessions",{query:{sel:e}}))},className:"row gap-8 list-row",style:{padding:"7px 9px",borderRadius:7,border:"1px solid var(--border-subtle)",cursor:"pointer"},children:[r.jsx("span",{className:"mono",style:{fontSize:11.5,flexShrink:0},children:e.slice(0,8)}),r.jsx("span",{className:"muted grow",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),r.jsx(b,{name:"chevronRight",size:12,style:{color:"var(--text-muted)",flexShrink:0}})]})}function va({state:e,children:t}){return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:14},children:r.jsx(oe,{state:e,label:"drill-down",minHeight:120,children:t})})}function Lx({path:e,range:t,files:n,onClose:s}){const l=I(()=>M.claudeHeatmapFile(e,t),[e,t]),o=n.find(i=>i.path===e);return r.jsxs("div",{className:"col",style:{height:"100%"},children:[r.jsx(ga,{icon:"box",color:"var(--warn)",title:e,copy:e,onClose:s}),r.jsx(va,{state:l,children:i=>{const c=i.byTool.reduce((d,u)=>d+u.bytes,0)||1,a=i.byTool.find(d=>dt(d.bytes)>1e4);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{gap:20,marginBottom:16},children:[r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Tool calls"}),r.jsx("div",{className:"tabular",style:{fontSize:26,fontWeight:700,lineHeight:1},children:o?.calls??i.byTool.reduce((d,u)=>d+u.calls,0)})]}),o&&o.trend.some(d=>d>0)&&r.jsxs("div",{className:"grow",children:[r.jsx("div",{className:"muted",style:{fontSize:10.5,marginBottom:4},children:"7-day trend"}),r.jsx(ua,{data:o.trend,color:"var(--warn)",fill:!0,w:150,h:30})]})]}),a&&r.jsxs("div",{style:{background:"var(--warn-soft)",border:"1px solid rgba(229,165,10,0.25)",borderRadius:8,padding:"9px 11px",marginBottom:16,display:"flex",gap:9},children:[r.jsx(b,{name:"flame",size:14,style:{color:"var(--warn)",flexShrink:0,marginTop:1}}),r.jsxs("div",{style:{fontSize:11.5,lineHeight:1.5},children:[r.jsx("span",{className:"mono",style:{color:"var(--warn)"},children:a.name})," returned an estimated ",r.jsxs("span",{className:"mono",children:["~",H(dt(a.bytes))]})," tokens here. A structural query would cover it in a fraction."]})]}),r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Tool breakdown"}),r.jsxs("div",{className:"col gap-8",style:{marginBottom:18},children:[i.byTool.map(d=>r.jsxs("div",{className:"row gap-10",children:[r.jsx("span",{className:"mono",style:{fontSize:11.5,width:92,flexShrink:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),r.jsx("div",{className:"grow",children:r.jsx(Ur,{frac:d.bytes/c,color:d.bytes>4e4?"var(--error)":d.bytes>12e3?"var(--warn)":"var(--node-code)"})}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5,width:22,textAlign:"right"},children:["×",d.calls]}),r.jsxs("span",{className:"mono tabular",style:{fontSize:10.5,width:44,textAlign:"right"},children:["~",H(dt(d.bytes))]})]},d.name)),r.jsx("div",{className:"muted",style:{fontSize:10},children:"bar = est. result tokens · × = call count"})]}),r.jsxs("div",{className:"eyebrow",style:{marginBottom:8},children:["Touched in ",i.sessions.length," session",i.sessions.length===1?"":"s"]}),r.jsx("div",{className:"col gap-6",children:i.sessions.map(d=>r.jsx(wp,{id:d.session_id,meta:`${d.calls} calls · ~${H(dt(d.bytes))} est. tokens${d.last_model?" · "+d.last_model:""}`},d.session_id))})]})}})]})}function Ix({name:e,range:t,onClose:n}){const s=I(()=>M.claudeHeatmapTool(e,t),[e,t]);return r.jsxs("div",{className:"col",style:{height:"100%"},children:[r.jsx(ga,{icon:"wrench",color:"var(--node-code)",title:e,copy:e,onClose:n}),r.jsx(va,{state:s,children:l=>{const o=dt(l.totals.bytes),i=l.totals.calls>0?Math.round(o/l.totals.calls):0,c=Math.max(...l.inputs.map(a=>a.bytes),0)||1;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{gap:16,marginBottom:16},children:[r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Calls"}),r.jsx("div",{className:"tabular",style:{fontSize:24,fontWeight:700,lineHeight:1},children:l.totals.calls})]}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Result tokens (est.)"}),r.jsxs("div",{className:"tabular",style:{fontSize:24,fontWeight:700,lineHeight:1,color:o>25e4?"var(--error)":"var(--text-primary)"},children:["~",H(o)]})]}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Sessions"}),r.jsx("div",{className:"tabular",style:{fontSize:24,fontWeight:700,lineHeight:1},children:l.totals.sessions})]})]}),r.jsxs("div",{className:"row gap-8",style:{marginBottom:16},children:[r.jsx("span",{className:"muted",style:{fontSize:11},children:"avg per call"}),r.jsxs("span",{className:"mono tabular",style:{fontSize:12,color:i>7500?"var(--error)":i>xa?"var(--warn)":"var(--text-secondary)"},children:["~",H(i)," est. tokens"]})]}),r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Top inputs"}),r.jsxs("div",{className:"col gap-7",style:{marginBottom:18},children:[l.inputs.slice(0,8).map(a=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:11,width:150,flexShrink:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-secondary)"},title:a.input,children:a.input}),r.jsx("div",{className:"grow",children:r.jsx(Ur,{frac:a.bytes/c,color:a.bytes>4e4?"var(--error)":"var(--node-code)"})}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10,width:20,textAlign:"right"},children:["×",a.calls]}),r.jsxs("span",{className:"mono tabular",style:{fontSize:10,width:40,textAlign:"right"},children:["~",H(dt(a.bytes))]})]},a.input)),!l.inputs.length&&r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No recorded inputs."})]}),r.jsxs("div",{className:"eyebrow",style:{marginBottom:8},children:["Used in ",l.totals.sessions," session",l.totals.sessions===1?"":"s"]}),r.jsx("div",{className:"col gap-6",children:l.recentSessions.map(a=>r.jsx(wp,{id:a.session_id,meta:`${a.calls} calls${a.last_model?" · "+a.last_model:""}`},a.session_id))})]})}})]})}function Dx({type:e,range:t,onClose:n}){const s=I(()=>M.claudeHeatmapSubagent(e,t),[e,t]);return r.jsxs("div",{className:"col",style:{height:"100%"},children:[r.jsx(ga,{icon:"bot",color:"var(--node-route)",title:e,copy:e,onClose:n}),r.jsx(va,{state:s,children:l=>r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{gap:16,marginBottom:16},children:[r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Invocations"}),r.jsx("div",{className:"tabular",style:{fontSize:22,fontWeight:700,lineHeight:1},children:l.totals.calls})]}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Sessions"}),r.jsx("div",{className:"tabular",style:{fontSize:22,fontWeight:700,lineHeight:1},children:l.totals.sessions})]})]}),r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Recent invocations"}),r.jsxs("div",{className:"col gap-6",style:{marginBottom:16},children:[l.invocations.slice(0,12).map((o,i)=>r.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:7,padding:"8px 10px"},children:[r.jsx("div",{style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.description||o.prompt.slice(0,90)||"(no description)"}),r.jsxs("div",{className:"row gap-8",style:{marginTop:5},children:[r.jsx("button",{className:"btn btn-ghost btn-xs mono",onClick:()=>A("sessions",{query:{sel:o.session_id}}),children:o.session_id.slice(0,8)}),o.last_model&&r.jsx("span",{className:"mono muted",style:{fontSize:10},children:o.last_model})]})]},o.session_id+":"+o.ts+":"+i)),!l.invocations.length&&r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No invocations in this range."})]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",style:{width:"100%",justifyContent:"center"},onClick:()=>A("tips"),children:[r.jsx(b,{name:"tips",size:13}),"See related tips"]})]})})]})}const ya={active:{color:"var(--success)",label:"Active",dot:!0,pulse:!0},connected:{color:"var(--node-spec)",label:"Connected",dot:!0},idle:{color:"var(--text-muted)",label:"Idle",dot:!1},failed:{color:"var(--error)",label:"Failed",dot:!0},disabled:{color:"var(--text-muted)",label:"Disabled",dot:!1}},Or={user:{color:"var(--node-route)",label:"Global",hint:"~/.claude.json",icon:"database"},project:{color:"var(--accent)",label:"Project",hint:".mcp.json",icon:"folder"},unknown:{color:"var(--text-muted)",label:"Usage only",hint:"seen in transcripts, not configured",icon:"sessions"}},Ml=e=>`color-mix(in srgb, ${e} 14%, transparent)`;function Ax({state:e}){const t=ya[e];return r.jsxs("span",{className:"pill",style:{color:t.color,background:Ml(t.color),width:92,justifyContent:"center"},children:[t.dot&&r.jsx("span",{className:"pill-dot",style:{background:t.color,animation:t.pulse?"pulsePill 1.6s ease-out infinite":void 0}}),t.label]})}function Sp({scope:e}){const t=Or[e];return r.jsxs(Q,{color:t.color,bg:Ml(t.color),children:[r.jsx(b,{name:t.icon,size:10}),t.label]})}function Ox(e){return e.exampleCall?`${e.exampleCall.tool} ${JSON.stringify(e.exampleCall.args)}`:null}function Pt(e,t,n,s,l){return r.jsxs("div",{className:"card",style:{padding:"11px 13px",display:"flex",flexDirection:"column",gap:3},children:[r.jsxs("div",{className:"row gap-6",style:{color:"var(--text-muted)"},children:[r.jsx(b,{name:e,size:12,style:{color:l||"var(--accent)",flexShrink:0}}),r.jsx("span",{className:"eyebrow",style:{letterSpacing:"0.03em"},children:t})]}),r.jsx("div",{className:"mono tabular",style:{fontSize:19,fontWeight:650,letterSpacing:"-0.01em"},children:n}),r.jsx("div",{className:"mono muted",style:{fontSize:10},children:s})]})}function ms(e,t){return r.jsxs("div",{className:"row gap-6",style:{flexShrink:0},children:[r.jsx("span",{className:"muted",style:{fontSize:11},children:e}),r.jsx("span",{className:"mono tabular",style:{fontSize:12,color:"var(--text-secondary)"},children:t})]})}function Bx({srv:e,onOpen:t}){const n=ya[e.state];return r.jsxs("div",{onClick:()=>t(e.id),className:"card",style:{padding:"12px 14px",cursor:"pointer",display:"flex",alignItems:"center",gap:12,transition:"background var(--motion-fast), border-color var(--motion-fast)"},onMouseEnter:s=>{s.currentTarget.style.background="var(--bg-panel-2)",s.currentTarget.style.borderColor="var(--border-strong)"},onMouseLeave:s=>{s.currentTarget.style.background="var(--bg-panel)",s.currentTarget.style.borderColor="var(--border-subtle)"},children:[r.jsxs("div",{style:{position:"relative",width:36,height:36,borderRadius:9,background:Ml(Or[e.scope].color),color:Or[e.scope].color,display:"grid",placeItems:"center",flexShrink:0},children:[r.jsx(b,{name:"plug",size:18}),r.jsx("span",{style:{position:"absolute",right:-2,bottom:-2,width:11,height:11,borderRadius:"50%",background:n.color,border:"2px solid var(--bg-panel)",boxShadow:e.state==="active"?`0 0 6px ${n.color}`:"none"}})]}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:e.name}),r.jsx(Sp,{scope:e.scope})]}),r.jsx("div",{className:"mono muted",style:{fontSize:11,marginTop:3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.command||"no config entry — usage only"})]}),r.jsxs("div",{className:"row gap-16",style:{flexShrink:0},children:[r.jsxs("div",{style:{textAlign:"right",width:56},children:[r.jsx("div",{className:"mono tabular",style:{fontSize:14,fontWeight:600,color:e.calls?"var(--text-primary)":"var(--text-muted)"},children:e.calls.toLocaleString()}),r.jsx("div",{className:"muted",style:{fontSize:10},children:"calls"})]}),r.jsx(Ax,{state:e.state}),r.jsx(b,{name:"chevronRight",size:15,style:{color:"var(--text-muted)"}})]})]})}function Wx({servers:e,onOpen:t,onReload:n,onAdd:s}){const l=e.filter(a=>a.state==="active"||a.state==="connected").length,o=e.reduce((a,d)=>a+d.tools.length,0),i=e.filter(a=>a.state==="failed"),c=["user","project","unknown"].map(a=>[a,e.filter(d=>d.scope===a)]);return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(ze,{icon:"plug",title:"MCP servers",sub:"Model Context Protocol servers Claude Code is configured to load",actions:r.jsxs("div",{className:"row gap-6",children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:n,children:[r.jsx(b,{name:"refresh",size:13}),"Reload"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:s,children:[r.jsx(b,{name:"plus",size:13}),"Add server"]})]})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:10,marginBottom:18},children:[Pt("plug","Servers",String(e.length),"global + project"),Pt("circle","Connected",`${l} / ${e.length}`,"answering now","var(--success)"),Pt("wrench","Tools",String(o),"seen in transcripts","var(--node-code)"),Pt("drift","Needs attention",String(i.length),i.length?i.map(a=>a.name).join(", "):"all healthy",i.length?"var(--error)":"var(--success)")]}),c.map(([a,d])=>{if(!d.length)return null;const u=Or[a];return r.jsxs("div",{style:{marginBottom:18},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:9},children:[r.jsx(b,{name:u.icon,size:13,style:{color:u.color}}),r.jsx("span",{className:"eyebrow",children:u.label}),r.jsx("span",{className:"mono muted",style:{fontSize:11},children:u.hint}),r.jsxs("span",{className:"muted",style:{fontSize:11},children:["· ",d.length]})]}),r.jsx("div",{className:"col gap-8",children:d.map(f=>r.jsx(Bx,{srv:f,onOpen:t},f.id))})]},a)}),r.jsx("div",{style:{height:20}})]})}function $x({tool:e}){const t=e.calls?Math.round(e.resultBytes/e.calls):0;return r.jsxs("div",{className:"card row gap-10",style:{padding:"11px 13px"},children:[r.jsx("div",{style:{width:30,height:30,borderRadius:8,background:"var(--node-code-soft)",color:"var(--node-code)",display:"grid",placeItems:"center",flexShrink:0},children:r.jsx(b,{name:"wrench",size:15})}),r.jsx("span",{className:"mono grow",style:{fontSize:13,fontWeight:600,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),r.jsxs("div",{style:{textAlign:"right",flexShrink:0},children:[r.jsxs("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600},children:["×",e.calls.toLocaleString()]}),r.jsx("div",{className:"mono tabular muted",style:{fontSize:10},children:"calls"})]}),r.jsxs("div",{style:{textAlign:"right",width:64,flexShrink:0},children:[r.jsx("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600,color:t>8e3?"var(--warn)":"var(--success)"},children:H(t)}),r.jsx("div",{className:"mono tabular muted",style:{fontSize:10},children:"bytes / call"})]})]})}function Fx({srv:e,onBack:t,onChanged:n}){const[s,l]=N.useState(!1),o=ya[e.state],i=Or[e.scope],c=Ox(e),a=e.exampleCall?.synthesized===!0,d=e.lastUsed?Date.parse(e.lastUsed):0,u=e.entry?JSON.stringify({mcpServers:{[e.name]:e.entry}},null,2):null,f=e.configFile!=null;return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsxs("div",{className:"row gap-10",style:{marginBottom:14},children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:t,children:[r.jsx(b,{name:"chevronLeft",size:14}),"MCP servers"]}),r.jsx("span",{className:"mono",style:{fontSize:16,fontWeight:600},children:e.name}),r.jsx(Sp,{scope:e.scope}),e.configFile&&r.jsx("span",{className:"mono muted",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.configFile})]}),r.jsxs("div",{className:"card",style:{padding:0,overflow:"hidden",marginBottom:14,display:"flex"},children:[r.jsx("div",{style:{width:3,background:o.color,flexShrink:0}}),r.jsxs("div",{style:{flex:1,padding:"13px 16px"},children:[r.jsxs("div",{className:"row gap-16",style:{flexWrap:"wrap"},children:[r.jsxs("div",{className:"row gap-8",style:{flexShrink:0},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:o.color,boxShadow:e.state==="active"?`0 0 8px ${o.color}`:"none",animation:e.state==="active"?"pulsePill 1.6s ease-out infinite":void 0}}),r.jsx("span",{style:{fontWeight:600,fontSize:13.5},children:o.label})]}),ms("Transport",e.transport),ms("Calls",e.calls.toLocaleString()),ms("Last used",d?pn(d)??"—":"never"),ms("Tools",String(e.tools.length)),r.jsx("div",{className:"grow"}),e.command&&r.jsxs("div",{className:"row gap-8",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:"6px 10px",maxWidth:360},children:[r.jsx(b,{name:"command",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"mono",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.command}),r.jsx(lt,{text:e.command})]}),f&&r.jsxs("button",{className:e.disabled?"btn btn-primary btn-sm":"btn btn-secondary btn-sm",onClick:()=>l(!0),children:[r.jsx(b,{name:e.disabled?"play":"pause",size:12}),e.disabled?"Enable server":"Disable server"]})]}),e.state==="failed"&&r.jsxs("div",{className:"row gap-8",style:{marginTop:11,padding:"8px 11px",background:"var(--error-soft)",border:"1px solid rgba(242,85,90,0.25)",borderRadius:7},children:[r.jsx(b,{name:"drift",size:14,style:{color:"var(--error)",flexShrink:0}}),r.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)",flex:1},children:"The server didn't answer an MCP initialize — it may be crashing, unreachable, or mis-configured. Check the command and credentials, then reload."})]}),e.disabled&&r.jsxs("div",{className:"muted",style:{marginTop:11,fontSize:11.5},children:["Disabled in ",e.configFile," — Claude Code won't load this server until it's enabled again."]})]})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:10,marginBottom:16},children:[Pt("wrench","Tools",String(e.tools.length),"seen in transcripts"),Pt("plug","Calls",e.calls.toLocaleString(),"all time","var(--node-code)"),Pt("database","Result bytes",H(e.resultBytes),"returned to context","var(--node-route)"),Pt("clock","Last used",d?pn(d)??"—":"never",d?new Date(d).toLocaleString():"no calls recorded","var(--success)")]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:16,alignItems:"start"},children:[r.jsxs("div",{style:{minWidth:0,gridColumn:"1 / -1"},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:10},children:[r.jsxs("span",{className:"eyebrow",children:["Tools · ",e.tools.length]}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"call counts from ingested transcripts"})]}),e.tools.length?r.jsx("div",{className:"col gap-8",children:e.tools.map(m=>r.jsx($x,{tool:m},m.name))}):r.jsx("div",{className:"card card-pad muted",style:{fontSize:12},children:"No tool calls recorded yet — statistics appear after Claude Code uses this server."})]}),r.jsxs("div",{className:"card card-pad",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(b,{name:"command",size:14,style:{color:"var(--node-code)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Example call"}),c&&(a?r.jsx(Q,{color:"var(--warn)",bg:Ml("var(--warn)"),children:"synthesized"}):r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"latest recorded input"}))]}),c?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-8",style:{background:"var(--bg-canvas)",border:"1px solid "+(a?"rgba(229,165,10,0.35)":"var(--border-subtle)"),borderRadius:7,padding:"8px 11px"},children:[r.jsx("span",{className:"mono grow",style:{fontSize:11.5,color:a?"var(--text-secondary)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c}),r.jsx(lt,{text:c})]}),a&&r.jsx("div",{className:"muted",style:{fontSize:10.5,marginTop:7},children:"Constructed from this server's most-called tool — no arguments were recorded, so this is a shape, not a call that happened."})]}):r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No calls recorded yet."})]}),r.jsxs("div",{className:"card card-pad",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(b,{name:"settings",size:14,style:{color:"var(--accent)"}}),r.jsx("span",{className:"grow",style:{fontWeight:600,fontSize:12.5},children:"Configuration"}),r.jsx("span",{className:"mono muted",style:{fontSize:10.5},children:e.configFile??i.hint}),u&&r.jsx(lt,{text:u})]}),u?r.jsx("pre",{className:"mono scroll-y",style:{margin:0,fontSize:11.5,lineHeight:1.65,color:"var(--text-secondary)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"11px 13px",overflowX:"auto",whiteSpace:"pre"},children:u}):r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"This server appears in transcripts but isn't in any config file — it was likely removed, or belongs to another machine's setup."})]})]}),s&&r.jsx(Hx,{srv:e,onClose:()=>l(!1),onDone:()=>{l(!1),n()}}),r.jsx("div",{style:{height:24}})]})}function Hx({srv:e,onClose:t,onDone:n}){const s=e.disabled,[l,o]=N.useState(!1),[i,c]=N.useState(null),a=s?"Enable":"Disable",d=()=>{l||(o(!0),c(null),M.setMcpServerEnabled(e.name,s).then(()=>n(),u=>{c(u instanceof Error?u.message:String(u)),o(!1)}))};return r.jsx("div",{onMouseDown:t,role:"dialog","aria-label":`${a} ${e.name}`,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:90,display:"grid",placeItems:"center"},children:r.jsxs("div",{onMouseDown:u=>u.stopPropagation(),style:{width:440,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(b,{name:s?"play":"pause",size:16,style:{color:s?"var(--success)":"var(--warn)"}}),r.jsxs("span",{className:"grow",style:{fontWeight:600},children:[a," ",e.name,"?"]}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:t,"aria-label":"Close",children:r.jsx(b,{name:"x",size:14})})]}),r.jsxs("div",{style:{padding:16},children:[r.jsxs("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.55},children:["This writes to ",r.jsx("code",{className:"mono",style:{fontSize:11.5},children:e.configFile}),"."," ",s?"Claude Code loads the server again on its next start.":"Claude Code stops loading the server (and its tools) on its next start."]}),i&&r.jsxs("div",{className:"row gap-8",style:{marginTop:10,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[r.jsx(b,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:i})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:t,children:"Cancel"}),r.jsx("button",{className:"btn btn-primary btn-sm",onClick:d,disabled:l,children:l?`${a.slice(0,-1)}ing…`:`${a} server`})]})]})})}function Ux({onClose:e,onAdded:t}){const[n,s]=N.useState(""),[l,o]=N.useState("user"),[i,c]=N.useState("stdio"),[a,d]=N.useState(""),[u,f]=N.useState(""),[m,g]=N.useState(!1),[y,p]=N.useState(null),w=!!n.trim()&&!/\s/.test(n.trim()),v=i==="stdio"?!!a.trim():!!u.trim(),h=w&&v,x=()=>{if(m||!h)return;g(!0),p(null);const j={name:n.trim(),scope:l};if(i==="stdio"){const[S,...C]=a.trim().split(/\s+/);j.command=S,C.length&&(j.args=C)}else j.url=u.trim();M.addMcpServer(j).then(()=>t(),S=>{p(S instanceof Error?S.message:String(S)),g(!1)})};return r.jsx("div",{onMouseDown:e,role:"dialog","aria-label":"Add MCP server",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:90,display:"grid",placeItems:"center"},children:r.jsxs("div",{onMouseDown:j=>j.stopPropagation(),style:{width:460,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(b,{name:"plus",size:16,style:{color:"var(--accent)"}}),r.jsx("span",{className:"grow",style:{fontWeight:600},children:"Add MCP server"}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:e,"aria-label":"Close",children:r.jsx(b,{name:"x",size:14})})]}),r.jsxs("div",{style:{padding:16},children:[r.jsxs("div",{style:{marginBottom:12},children:[r.jsx("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"mcp-add-name",children:"Name"}),r.jsx("input",{id:"mcp-add-name",className:"input mono",style:{width:"100%"},placeholder:"github",value:n,onChange:j=>s(j.target.value),onKeyDown:j=>{j.key==="Enter"&&x()}})]}),r.jsxs("div",{style:{marginBottom:12},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:5},children:"Scope"}),r.jsx(We,{value:l,onChange:j=>o(j),size:"sm",label:"Server scope",options:[{value:"user",label:"Global · ~/.claude.json"},{value:"project",label:"Project · .mcp.json"}]})]}),r.jsxs("div",{style:{marginBottom:12},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:5},children:"Transport"}),r.jsx(We,{value:i,onChange:c,size:"sm",label:"Server transport",options:[{value:"stdio",label:"stdio · command"},{value:"http",label:"http · url"}]})]}),i==="stdio"?r.jsxs("div",{style:{marginBottom:4},children:[r.jsx("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"mcp-add-command",children:"Command"}),r.jsx("input",{id:"mcp-add-command",className:"input mono",style:{width:"100%"},placeholder:"npx -y @modelcontextprotocol/server-github",value:a,onChange:j=>d(j.target.value),onKeyDown:j=>{j.key==="Enter"&&x()}})]}):r.jsxs("div",{style:{marginBottom:4},children:[r.jsx("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"mcp-add-url",children:"URL"}),r.jsx("input",{id:"mcp-add-url",className:"input mono",style:{width:"100%"},placeholder:"https://<host>/sse",value:u,onChange:j=>f(j.target.value),onKeyDown:j=>{j.key==="Enter"&&x()}})]}),y&&r.jsxs("div",{className:"row gap-8",style:{marginTop:10,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[r.jsx(b,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:y})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:e,children:"Cancel"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:x,disabled:m||!h,children:[r.jsx(b,{name:"plus",size:13}),m?"Adding…":"Add server"]})]})]})})}function Vx({onAdd:e,onReload:t}){return r.jsx(se,{icon:"plug",title:"No MCP servers configured",body:r.jsxs(r.Fragment,{children:["Claude Code loads MCP servers from ",r.jsx("code",{className:"mono",children:"~/.claude.json"})," and the project's ",r.jsx("code",{className:"mono",children:".mcp.json"}),". Add one here, or run"," ",r.jsx("code",{className:"mono",children:"specship install"})," to register SpecShip's own server."]}),action:r.jsxs("div",{className:"row gap-8",style:{justifyContent:"center"},children:[r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:e,children:[r.jsx(b,{name:"plus",size:13}),"Add server"]}),r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:t,children:[r.jsx(b,{name:"refresh",size:13}),"Reload"]})]})})}function Kx({query:e}){const t=I(()=>M.mcpServers(),[]),[n,s]=N.useState(e?.server??null),[l,o]=N.useState(!1);return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx(oe,{state:t,label:"MCP servers",minHeight:320,children:i=>{const c=n?i.servers.find(a=>a.id===n):void 0;return c?r.jsx(Fx,{srv:c,onBack:()=>s(null),onChanged:t.reload}):i.servers.length?r.jsx(Wx,{servers:i.servers,onOpen:s,onReload:t.reload,onAdd:()=>o(!0)}):r.jsx(Vx,{onAdd:()=>o(!0),onReload:t.reload})}}),l&&r.jsx(Ux,{onClose:()=>o(!1),onAdded:()=>{o(!1),t.reload()}})]})}const Qn={enterprise:{label:"Managed",color:"#E5A50A",soft:"rgba(229,165,10,0.14)",desc:"Organization policy · cannot be overridden"},user:{label:"User",color:"#29D2BE",soft:"rgba(41,210,190,0.14)",desc:"Personal · applies to every project"},project:{label:"Project",color:"#5B93F2",soft:"rgba(91,147,242,0.14)",desc:"Team-shared · checked into the repo"},subdir:{label:"Directory",color:"#A586F5",soft:"rgba(165,134,245,0.14)",desc:"Scoped to a subtree · loaded when cwd is inside"},import:{label:"Import",color:"#7B8696",soft:"rgba(123,134,150,0.12)",desc:"Pulled in via @path reference"},note:{label:"Notes",color:"#46C26B",soft:"rgba(70,194,107,0.14)",desc:"Agent-written · memory tool"}},di={instruction:{label:"Instructions",color:"#5B93F2",soft:"rgba(91,147,242,0.14)",icon:"memory",desc:"Directives & rules from CLAUDE.md"},note:{label:"Notes",color:"#46C26B",soft:"rgba(70,194,107,0.14)",icon:"tips",desc:"Facts the agent saved via the memory tool"},import:{label:"Imports",color:"#29D2BE",soft:"rgba(41,210,190,0.14)",icon:"external",desc:"Files pulled in via @path"}};function kp(e){const t=l=>l.replace(/&/g,"&amp;").replace(/</g,"&lt;"),n=l=>t(l).replace(/\*\*(.+?)\*\*/g,"<strong style='color:var(--text-primary)'>$1</strong>").replace(/`(.+?)`/g,"<code class='mono' style='font-size:11.5px;background:var(--bg-canvas);padding:1px 5px;border-radius:4px;border:1px solid var(--border-subtle);color:var(--node-spec)'>$1</code>"),s=[];return e.split(`
43
- `).forEach(l=>{l.startsWith("## ")?s.push(`<div style='font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:0.06em;color:var(--text-muted);margin:14px 0 6px'>${n(l.slice(3))}</div>`):l.startsWith("# ")?s.push(`<div style='font-size:14px;font-weight:650;margin:0 0 8px'>${n(l.slice(2))}</div>`):l.startsWith("@")?s.push(`<div class='mono' style='font-size:12px;color:var(--node-route);background:var(--node-route-soft);display:block;width:fit-content;padding:2px 8px;border-radius:5px;margin:3px 0'>${t(l)}</div>`):/^\s*- /.test(l)?s.push(`<div style='display:flex;gap:8px;font-size:12.5px;line-height:1.6;color:var(--text-secondary);padding:1px 0'><span style='color:var(--text-faint)'>•</span><span>${n(l.replace(/^\s*- /,""))}</span></div>`):l.trim()===""?s.push("<div style='height:6px'></div>"):s.push(`<div style='font-size:12.5px;line-height:1.6;color:var(--text-secondary)'>${n(l)}</div>`)}),s.join("")}function bp({level:e}){const t=Qn[e];return r.jsx(Q,{color:t.color,bg:t.soft,children:t.label})}function Qx({type:e}){const t=di[e];return r.jsxs(Q,{color:t.color,bg:t.soft,children:[r.jsx(b,{name:t.icon,size:10}),t.label]})}function qx({text:e}){const[t,n]=N.useState(!1);return r.jsxs("button",{className:"btn btn-secondary btn-sm",title:"Copy file contents",onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1100)},style:{color:t?"var(--success)":void 0},children:[r.jsx(b,{name:t?"check":"copy",size:13}),t?"Copied":"Copy contents"]})}function Fc({file:e,selId:t,onSel:n,indent:s}){const l=t===e.id,o=e.level==="import"||e.level==="note",i=e.level==="import"?"external":e.level==="note"?"tips":"memory";return r.jsxs("div",{onClick:()=>n(e.id),className:"row gap-8",style:{padding:"8px 10px",paddingLeft:s?26:10,borderRadius:7,cursor:"pointer",background:l?"var(--accent-soft)":"transparent"},onMouseEnter:c=>{l||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{l||(c.currentTarget.style.background="transparent")},children:[r.jsx("span",{className:"pill-dot",style:{background:Qn[e.level].color,flexShrink:0}}),r.jsx(b,{name:i,size:13,style:{color:l?"var(--accent)":"var(--text-muted)",flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-6",children:[r.jsx("span",{className:"mono",style:{fontSize:12,color:l?"var(--accent)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o?e.name:e.scope}),e.readOnly&&r.jsx(b,{name:"lock",size:10,style:{color:"var(--warn)"}})]}),r.jsx("div",{className:"mono muted",style:{fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5,flexShrink:0},children:H(e.tokens)})]})}function xs(e,t){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600,marginTop:1,whiteSpace:"nowrap"},children:t})]})}function Gx({file:e,files:t}){const n=Qn[e.level],s=e.type==="note",l=(e.imports??[]).map(o=>t.find(i=>i.id===o)).filter(o=>!!o);return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:20},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:6},children:[r.jsx(Qx,{type:e.type}),r.jsx(bp,{level:e.level}),r.jsx("span",{className:"secondary",style:{fontSize:11.5},children:n.desc}),r.jsx("div",{className:"grow"}),e.readOnly&&r.jsxs(Q,{color:"var(--warn)",bg:"var(--warn-soft)",children:[r.jsx(b,{name:"lock",size:10}),"read-only"]})]}),r.jsxs("div",{className:"row gap-8",style:{marginBottom:14},children:[r.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:e.path}),r.jsx(lt,{text:e.path})]}),r.jsxs("div",{className:"row",style:{gap:22,padding:"10px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)",marginBottom:16,flexWrap:"wrap"},children:[xs("Tokens",H(e.tokens)),xs("Lines",String(e.lines)),xs("Scope",n.label),xs("Modified",e.modified),s&&e.session&&r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Saved in"}),r.jsx("button",{onClick:()=>A("sessions",{query:{sel:e.session}}),className:"mono",style:{fontSize:13,fontWeight:600,marginTop:1,color:"var(--accent)",background:"none",border:"none",padding:0,cursor:"pointer"},children:e.session})]})]}),s&&e.tags&&r.jsx("div",{className:"row gap-6",style:{marginBottom:14,flexWrap:"wrap"},children:e.tags.map(o=>r.jsxs("span",{className:"mono",style:{fontSize:10.5,color:"var(--node-test)",background:"var(--node-test-soft)",padding:"2px 8px",borderRadius:5,whiteSpace:"nowrap"},children:["#",o]},o))}),r.jsx("div",{className:"card card-pad",style:{background:"var(--bg-panel)",marginBottom:16},dangerouslySetInnerHTML:{__html:kp(e.body)}}),l.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"eyebrow",style:{marginBottom:8},children:["Imports · ",l.length]}),r.jsx("div",{className:"col gap-6",children:l.map(o=>r.jsxs("div",{className:"row gap-8",style:{padding:"7px 10px",borderRadius:7,border:"1px solid var(--border-subtle)"},children:[r.jsx(b,{name:"external",size:12,style:{color:"var(--node-route)"}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5},children:o.path}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5},children:H(o.tokens)})]},o.id))})]}),r.jsx("div",{className:"row gap-8",style:{marginTop:16},children:r.jsx(qx,{text:e.body})})]})}function Yx({files:e,typeF:t}){const n=e.filter(i=>i.type!=="note"&&(t==="all"||i.type===t)),s=e.filter(i=>i.type==="note"&&(t==="all"||t==="note")),l=[...n,...s].map(i=>i.body).join(`
44
-
45
- `),o=(i,c)=>{const a=Qn[i.level];return r.jsxs("div",{className:"card",style:{overflow:"hidden",display:"flex"},children:[r.jsx("div",{style:{width:3,background:a.color,flexShrink:0}}),r.jsxs("div",{style:{flex:1,minWidth:0,padding:"12px 14px"},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:8},children:[c!=null&&r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5,width:16},children:c+1}),r.jsx(bp,{level:i.level}),r.jsx("span",{className:"mono",style:{fontSize:11.5,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.path}),r.jsx("div",{className:"grow"}),i.readOnly&&r.jsx(b,{name:"lock",size:11,style:{color:"var(--warn)"}}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5},children:H(i.tokens)})]}),r.jsx("div",{style:{paddingLeft:c!=null?24:0},dangerouslySetInnerHTML:{__html:kp(i.body)}})]})]},i.id)};return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:20},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:6},children:[r.jsx(b,{name:"layers",size:15,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Effective memory"}),r.jsx("span",{className:"secondary",style:{fontSize:12},children:"· everything the agent loads"}),r.jsx("div",{className:"grow"}),r.jsx(lt,{text:l,label:"Copy all",ariaLabel:"Copy effective memory"})]}),r.jsx("div",{className:"secondary",style:{fontSize:12,lineHeight:1.55,marginBottom:16},children:"Instructions compose in load order — later files layer onto earlier ones, and @imports load with the file that references them. Saved notes are appended as retrieved context."}),n.length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Instructions · load order"}),r.jsx("div",{className:"col gap-10",children:n.map((i,c)=>o(i,c))})]}),s.length>0&&r.jsxs("div",{style:{marginTop:n.length?20:0},children:[r.jsxs("div",{className:"row gap-6",style:{marginBottom:8},children:[r.jsx("span",{className:"eyebrow",children:"Notes · memory tool"}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"retrieved facts, not precedence-ranked"})]}),r.jsx("div",{className:"col gap-10",children:s.map(i=>o(i,null))})]})]})}function gs(e,t,n,s){return r.jsxs("div",{className:"row gap-8",style:{padding:"8px 12px",background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",borderRadius:9,flexShrink:0},children:[r.jsx(b,{name:e,size:14,style:{color:s,flexShrink:0}}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10},children:t}),r.jsx("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600,whiteSpace:"nowrap"},children:n})]})]})}function Xx({onReload:e}){return r.jsx(se,{icon:"memory",title:"No memory files found",body:r.jsxs(r.Fragment,{children:["Claude Code reads ",r.jsx("code",{className:"mono",children:"~/.claude/CLAUDE.md"}),", a"," ",r.jsx("code",{className:"mono",children:"CLAUDE.md"})," at the project root (and one level of subdirectories), and saved notes under ",r.jsx("code",{className:"mono",children:"~/.claude/memory/"}),". Create one, then reload."]}),action:r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:e,children:[r.jsx(b,{name:"refresh",size:13}),"Reload memory"]})})}function Jx({data:e,view:t,typeF:n,onTypeF:s,sel:l,onSel:o,onReload:i}){const c=e.files,a=c.find(p=>p.id===l)??c.find(p=>p.level==="project")??c[0],d=p=>c.find(w=>w.id===p),u=p=>n==="all"||p.type===n,f=p=>(p.imports??[]).map(d).filter(w=>!!w&&u(w)),m=[{key:"enterprise",items:c.filter(p=>p.level==="enterprise")},{key:"user",items:c.filter(p=>p.level==="user")},{key:"project",items:c.filter(p=>p.level==="project"||p.level==="subdir")},{key:"note",items:c.filter(p=>p.level==="note")}],g=p=>p.items.some(w=>u(w)||f(w).length>0),y=(p,w)=>{const v=n===p,h=p==="all"?{label:"All",color:"var(--text-secondary)",soft:""}:di[p];return r.jsxs("button",{onClick:()=>s(p),className:"row gap-6",style:{height:26,padding:"0 11px",borderRadius:999,fontSize:11.5,fontWeight:500,cursor:"pointer",border:"1px solid "+(v?"transparent":"var(--border-subtle)"),background:v?p==="all"?"var(--bg-active)":h.soft:"var(--bg-panel)",color:v?p==="all"?"var(--text-primary)":h.color:"var(--text-muted)"},children:[p!=="all"&&r.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:h.color}}),h.label,w!=null&&r.jsx("span",{className:"tabular",style:{opacity:.7},children:w})]})};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-10",style:{padding:"0 18px 12px",flexWrap:"wrap"},children:[gs("memory","Loaded",H(e.totalTokens)+" tokens","var(--accent)"),gs("memory","Instructions",String(e.instructionCount),"var(--node-spec)"),gs("tips","Notes",String(e.noteCount),"var(--node-test)"),gs("external","Imports",String(e.importCount),"var(--node-route)"),r.jsx("div",{className:"grow"}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:i,title:"Re-read memory files from disk",children:[r.jsx(b,{name:"refresh",size:13}),"Reload memory"]})]}),r.jsxs("div",{className:"row gap-6",style:{padding:"0 18px 14px",flexWrap:"wrap"},children:[r.jsx(b,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),y("all"),y("instruction",e.instructionCount),y("note",e.noteCount),y("import",e.importCount),r.jsx("span",{className:"grow"}),r.jsx("span",{className:"muted",style:{fontSize:11},children:n!=="all"?di[n].desc:""})]}),t==="effective"?r.jsx(Yx,{files:c,typeF:n}):r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0,borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"col",style:{width:300,flexShrink:0,borderRight:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:r.jsx("div",{className:"scroll-y",style:{flex:1,padding:8},children:m.filter(g).map(p=>r.jsxs("div",{style:{marginBottom:10},children:[r.jsxs("div",{className:"row gap-6",style:{padding:"8px 8px 4px"},children:[r.jsx("span",{className:"eyebrow",children:Qn[p.key].label}),r.jsx("span",{className:"muted",style:{fontSize:10},children:Qn[p.key].desc})]}),p.items.filter(w=>u(w)||f(w).length>0).map(w=>r.jsxs(N.Fragment,{children:[u(w)&&r.jsx(Fc,{file:w,selId:a?.id??"",onSel:o}),f(w).map(v=>r.jsx(Fc,{file:v,selId:a?.id??"",onSel:o,indent:!0},v.id))]},w.id))]},p.key))})}),r.jsx("div",{className:"col",style:{flex:1,minWidth:0},children:a&&r.jsx(Gx,{file:a,files:c})})]})]})}function Zx({project:e}){const t=I(()=>M.memory(e),[e]),[n,s]=N.useState("sources"),[l,o]=N.useState("all"),[i,c]=N.useState(null);return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(ze,{icon:"memory",title:"Memory",sub:"Everything the agent remembers — across levels and types",actions:r.jsx(We,{value:n,onChange:s,size:"sm",label:"Memory view",options:[{value:"sources",label:"Sources"},{value:"effective",label:"Effective"}]})})}),r.jsx(oe,{state:t,label:"memory",minHeight:320,children:a=>a.files.length===0?r.jsx(Xx,{onReload:t.reload}):r.jsx(Jx,{data:a,view:n,typeF:l,onTypeF:o,sel:i,onSel:c,onReload:t.reload})})]})}function eg({title:e,req:t}){return r.jsx(se,{icon:"box",title:e,body:t?`This screen lands with ${t}. The SSR dashboard still serves it today.`:"This screen is not wired yet."})}const tg=new Set(["completed","failed","cancelled","rejected"]);function ui(e){return e.stepId??(typeof e.data?.stepId=="string"?e.data.stepId:void 0)}function ng(e){const t=new Set(e.map(c=>c.id)),n=new Map(e.map(c=>[c.id,(c.depends_on??[]).filter(a=>t.has(a)).length])),s=new Map;for(const c of e)for(const a of c.depends_on??[])t.has(a)&&s.set(a,[...s.get(a)??[],c.id]);const l=new Map(e.map(c=>[c.id,c])),o=e.filter(c=>n.get(c.id)===0).map(c=>c.id),i=[];for(;o.length;){const c=o.shift();i.push(l.get(c));for(const a of s.get(c)??[]){const d=n.get(a)-1;n.set(a,d),d===0&&o.push(a)}}return i.length===e.length?i:e}function rg(e,t,n){const s=t?.metadata?.nodeStates??{},l=new Map,o=[],i=new Set,c=(f,m)=>{i.has(f)||(i.add(f),o.push(f)),m&&!l.get(f)&&l.set(f,m)};if(e?.length)for(const f of ng(e))c(f.id,f.kind);else{for(const f of Object.keys(s))c(f);for(const f of n){const m=ui(f);m&&c(m,typeof f.data?.stepKind=="string"?f.data.stepKind:void 0)}}const a=new Map(o.map(f=>[f,s[f]??"pending"])),d=new Map;for(const f of n){const m=ui(f);if(!(!m||!i.has(m))&&(f.eventType==="step_started"?a.set(m,"running"):f.eventType==="step_completed"?a.set(m,"completed"):f.eventType==="step_failed"?a.set(m,"failed"):f.eventType==="step_skipped"&&a.set(m,"skipped"),f.eventType==="step_completed")){const g=f.data?.stats;typeof g?.costUsd=="number"&&d.set(m,g.costUsd)}}const u=t?.metadata?.approval;return t?.status==="paused"&&u?.nodeId&&a.get(u.nodeId)!=="completed"&&a.set(u.nodeId,"paused"),o.map(f=>({id:f,kind:l.get(f)??"prompt",state:a.get(f)??"pending",costUsd:d.get(f)}))}function sg(e){let t=null,n=null;for(const s of e){if(s.eventType!=="step_completed")continue;const l=s.data?.stats;typeof l?.costUsd=="number"&&(t=(t??0)+l.costUsd),typeof l?.model=="string"&&!n&&(n=l.model)}return{costUsd:t,model:n}}function Np(e){if(e==null||!Number.isFinite(e)||e<0)return"—";const t=Math.round(e/1e3);return t<60?t+"s":t<3600?Math.floor(t/60)+"m "+t%60+"s":Math.floor(t/3600)+"h "+Math.floor(t%3600/60)+"m"}function Pl(e){return typeof e=="number"?"$"+e.toFixed(2):"—"}const lg={pending:"var(--text-muted)",running:"var(--info)",completed:"var(--success)",failed:"var(--error)",paused:"var(--warn)",skipped:"var(--text-muted)"};function og({nodes:e}){return r.jsx("div",{className:"row",style:{gap:6,padding:"14px 16px",flexWrap:"wrap",alignItems:"center",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-canvas-2)"},children:e.map((t,n)=>{const s=lg[t.state]??"var(--text-muted)";return r.jsxs("div",{className:"row",style:{gap:6,alignItems:"center"},children:[n>0&&r.jsx(b,{name:"arrowRight",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsxs("div",{"data-node-id":t.id,"data-node-state":t.state,className:"row gap-8",style:{padding:"5px 11px",borderRadius:8,background:t.state==="running"?"var(--info-soft)":"var(--bg-panel)",border:`1.5px ${t.state==="skipped"?"dotted":"solid"} ${t.state==="pending"?"var(--border-subtle)":s}`,opacity:t.state==="pending"?.65:1},children:[r.jsxs("span",{style:{width:16,height:16,borderRadius:"50%",display:"grid",placeItems:"center",flexShrink:0,background:t.state==="completed"?"var(--success)":t.state==="failed"?"var(--error)":t.state==="paused"?"var(--warn)":"transparent",border:t.state==="completed"||t.state==="failed"||t.state==="paused"?"none":`1.5px solid ${s}`,animation:t.state==="running"?"spin 1.4s linear infinite":"none",borderTopColor:t.state==="running"?"transparent":void 0},children:[t.state==="completed"&&r.jsx(b,{name:"check",size:10,style:{color:"#fff"}}),t.state==="failed"&&r.jsx(b,{name:"x",size:10,style:{color:"#fff"}}),t.state==="paused"&&r.jsx(b,{name:"pause",size:9,style:{color:"#fff"}})]}),r.jsxs("div",{style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:12,fontWeight:500,whiteSpace:"nowrap"},children:t.id}),r.jsxs("div",{className:"mono muted",style:{fontSize:9},children:[t.kind,t.costUsd!==void 0&&r.jsxs("span",{className:"tabular",children:[" · ",Pl(t.costUsd)]})]})]})]})]},t.id)})})}const zp={step_started:"var(--info)",step_completed:"var(--success)",step_failed:"var(--error)",step_skipped:"var(--text-muted)",tool_called:"var(--node-code)",agent_message:"var(--text-secondary)",artifact_created:"var(--node-route)",approval_requested:"var(--warn)",approval_granted:"var(--success)",approval_rejected:"var(--error)",run_started:"var(--info)",run_completed:"var(--success)",run_failed:"var(--error)",run_cancelled:"var(--text-muted)",run_paused:"var(--warn)"};function ig(e){const t=e.data??{};if(typeof t.name=="string")return t.name+(typeof t.input=="string"&&t.input?` · ${t.input}`:"");if(typeof t.text=="string")return t.text;if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message;if(typeof t.reason=="string")return t.reason;if(e.eventType==="step_completed"){const n=t.stats;return typeof n?.costUsd=="number"?Pl(n.costUsd):""}return""}function ag(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleTimeString()}function cg({events:e,live:t}){const n=N.useRef(null),[s,l]=N.useState(!0);return N.useEffect(()=>{s&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,s]),r.jsxs("div",{ref:n,className:"scroll-y","aria-live":"polite",onScroll:o=>{const i=o.currentTarget;l(i.scrollHeight-i.scrollTop-i.clientHeight<30)},style:{flex:1,padding:"8px 14px",fontFamily:"var(--font-mono)",fontSize:11.5},children:[e.map(o=>r.jsxs("div",{className:"row gap-10",style:{padding:"4px 0",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"muted tabular",style:{flexShrink:0,width:70},children:ag(o.createdAt)}),r.jsx("span",{style:{color:zp[o.eventType]??"var(--text-secondary)",width:140,flexShrink:0},children:o.eventType}),r.jsx("span",{className:"muted",style:{flexShrink:0,width:90,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ui(o)??""}),r.jsx("span",{className:"secondary",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ig(o)})]},o.id)),!e.length&&r.jsx("div",{className:"muted",style:{padding:"8px 0"},children:"No events yet."}),t&&r.jsxs("div",{className:"row gap-6 muted",style:{padding:"6px 0"},children:[r.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--info)",animation:"skeleton 1s infinite"}}),"streaming…"]})]})}function dg({artifacts:e,loading:t}){const[n,s]=N.useState(0),l=e[Math.min(n,e.length-1)];return t?r.jsx("div",{className:"muted",style:{padding:16,fontSize:12},children:"Loading artifacts…"}):e.length?r.jsxs("div",{className:"row",style:{flex:1,minHeight:0},children:[r.jsx("div",{className:"scroll-y",style:{width:190,borderRight:"1px solid var(--border-subtle)",padding:8,flexShrink:0},children:e.map((o,i)=>r.jsxs("div",{role:"button",tabIndex:0,onClick:()=>s(i),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),s(i))},className:"row gap-8 list-row",style:{padding:"7px 9px",borderRadius:6,cursor:"pointer",background:n===i?"var(--bg-hover)":"transparent"},children:[r.jsx(b,{name:"box",size:13,style:{color:"var(--node-route)",flexShrink:0}}),r.jsxs("div",{style:{minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.name}),r.jsxs("div",{className:"muted",style:{fontSize:9.5},children:[o.nodeId,o.outputType?" · "+o.outputType:""]})]})]},o.name))}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:16},children:r.jsx("pre",{className:"mono",style:{margin:0,fontSize:12,lineHeight:1.65,color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:l?.body})})]}):r.jsx("div",{className:"muted",style:{padding:16,fontSize:12},children:"No artifacts — only completed nodes write output files."})}function ug({id:e,project:t}){const n=I(()=>M.run(e,t),[e,t]),s=I(()=>M.workflows(t),[t]),[l,o]=N.useState([]),[i,c]=N.useState("events"),[a,d]=N.useState(!1),[u,f]=N.useState(""),[m,g]=N.useState(!1),[y,p]=N.useState(null),w=n.data?.run??null,v=w?.status??"",h=!!w&&!tg.has(v),x=N.useMemo(()=>{const z=n.data?.events??[],T=new Set(z.map(L=>L.id));return[...z,...l.filter(L=>!T.has(L.id))]},[n.data,l]),j=n.data?.events.length?n.data.events[n.data.events.length-1].id:0,S=n.reload;N.useEffect(()=>{if(!h||typeof EventSource>"u")return;const z=new EventSource(um(e,j,t)),T=L=>{try{const B=JSON.parse(L.data);o(U=>U.some(K=>K.id===B.id)?U:[...U,B])}catch{}};for(const L of Object.keys(zp))z.addEventListener(L,T);return z.addEventListener("done",()=>{z.close(),S()}),z.onerror=()=>{},()=>z.close()},[e,t,h,j,S]);const C=N.useMemo(()=>{const z=s.data?.workflows.find(T=>T.workflow.name===w?.workflowName)?.workflow;return rg(z?.nodes,w,x)},[s.data,w,x]),E=N.useMemo(()=>sg(x),[x]),R=typeof w?.startedAt=="number"?w.startedAt:null,O=typeof w?.completedAt=="number"?w.completedAt:typeof w?.lastActivityAt=="number"?w.lastActivityAt:null,D=R&&O?O-R:null,ne=z=>{g(!0),p(null),z().then(()=>{g(!1),d(!1),o([]),n.reload()},T=>{g(!1),p(T instanceof Error?T.message:String(T))})},fe=()=>ne(async()=>{await M.runAction(e,"approve",void 0,t),await M.runAction(e,"resume",void 0,t)}),ke=()=>ne(()=>M.runAction(e,"reject",u.trim()?{reason:u.trim()}:void 0,t)),He=()=>ne(()=>M.runAction(e,"cancel",void 0,t)),bt=()=>ne(()=>M.runAction(e,"resume",void 0,t)),Xe=()=>ne(()=>M.runAction(e,"purge",void 0,t)),Te=I(()=>i==="artifacts"?M.runArtifacts(e,t):Promise.resolve({artifacts:[]}),[e,t,i,v]),k=w?.metadata?.approval;return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"12px 16px",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:()=>A("runs"),children:[r.jsx(b,{name:"chevronLeft",size:14}),"Runs"]}),r.jsx("span",{className:"mono",style:{fontWeight:600,fontSize:14},children:w?.workflowName??"…"}),r.jsx("span",{className:"mono muted",style:{fontSize:11.5},children:e}),w&&r.jsx(qe,{state:v}),r.jsx("span",{className:"grow"}),r.jsxs("span",{className:"mono muted tabular",style:{fontSize:11.5},title:"Duration",children:[r.jsx(b,{name:"clock",size:11,style:{verticalAlign:-1,marginRight:4}}),Np(D)]}),E.costUsd!==null&&r.jsx("span",{className:"mono tabular",style:{fontSize:11.5},title:"Run-total cost",children:Pl(E.costUsd)}),E.model&&r.jsx("span",{className:"mono muted",style:{fontSize:11.5},title:"Model",children:E.model}),(v==="running"||v==="paused")&&r.jsxs("button",{className:"btn btn-destructive btn-sm",onClick:He,disabled:m,children:[r.jsx(b,{name:"cancel",size:12}),"Cancel"]}),v==="completed"&&r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>c("artifacts"),children:[r.jsx(b,{name:"box",size:12}),"Inspect artifacts"]})]}),v==="failed"&&w?.errorMessage&&r.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--error-soft)",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{style:{color:"var(--error)",flexShrink:0},children:r.jsx(b,{name:"cancel",size:16})}),r.jsxs("div",{className:"grow",children:[r.jsx("div",{style:{fontWeight:600,fontSize:13,color:"var(--error)"},children:"Run failed"}),r.jsx("div",{className:"secondary mono",style:{fontSize:12,marginTop:1,whiteSpace:"pre-wrap"},children:w.errorMessage})]})]}),v==="rejected"&&r.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--warn-soft)",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[r.jsx("span",{style:{color:"var(--warn)",flexShrink:0},children:r.jsx(b,{name:"drift",size:18})}),r.jsxs("div",{className:"grow",style:{minWidth:220},children:[r.jsx("div",{style:{fontWeight:600,fontSize:13},children:"Rejected — parked with worktree and artifacts kept"}),r.jsx("div",{className:"secondary",style:{fontSize:12,marginTop:1},children:w?.errorMessage??"Rejected at the approval gate."})]}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>c("artifacts"),children:"Inspect artifacts"}),r.jsx("button",{className:"btn btn-destructive btn-sm",onClick:Xe,disabled:m,title:"Removes the worktree — the only destructive action. Artifacts and the run record are kept.",children:"Purge worktree"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:bt,disabled:m,title:"Runs the gate's on_reject revise prompt with your feedback, then re-pauses for review.",children:[r.jsx(b,{name:"circle",size:12}),"Resume & revise"]})]}),v==="paused"&&r.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--warn-soft)",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[r.jsx("span",{style:{color:"var(--warn)",flexShrink:0},children:r.jsx(b,{name:"pause",size:18})}),r.jsxs("div",{className:"grow",style:{minWidth:220},children:[r.jsx("div",{style:{fontWeight:600,fontSize:13},children:"Approval required"}),r.jsx("div",{className:"secondary",style:{fontSize:12,marginTop:1},children:k?.message??"The run paused at an approval gate."})]}),a?r.jsxs(r.Fragment,{children:[r.jsx("input",{className:"input",autoFocus:!0,placeholder:"Reason (optional)…","aria-label":"Rejection reason",value:u,onChange:z=>f(z.target.value),style:{width:200}}),r.jsx("button",{className:"btn btn-destructive btn-sm",onClick:ke,disabled:m,children:"Confirm reject"}),r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>d(!1),children:"Back"})]}):r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>c("artifacts"),children:"Inspect artifacts"}),r.jsx("button",{className:"btn btn-destructive btn-sm",onClick:()=>d(!0),disabled:m,children:"Reject"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:fe,disabled:m,children:[r.jsx(b,{name:"check",size:13}),"Approve"]})]})]}),y&&r.jsxs("div",{className:"row gap-8",style:{padding:"8px 16px",background:"var(--error-soft)",color:"var(--error)",fontSize:12,borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(b,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:y})]}),C.length>0&&r.jsx(og,{nodes:C}),r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{className:"row gap-2",style:{padding:"8px 14px 0",borderBottom:"1px solid var(--border-subtle)"},children:["events","artifacts"].map(z=>r.jsxs("button",{onClick:()=>c(z),style:{padding:"7px 13px",border:"none",background:"transparent",cursor:"pointer",fontSize:12.5,fontWeight:500,textTransform:"capitalize",color:i===z?"var(--text-primary)":"var(--text-muted)",borderBottom:`2px solid ${i===z?"var(--accent)":"transparent"}`,marginBottom:-1},children:[z,z==="events"&&h&&r.jsx("span",{className:"pill",style:{marginLeft:6,fontSize:9,background:"var(--info-soft)",color:"var(--info)"},children:"live"})]},z))}),i==="events"&&r.jsx(cg,{events:x,live:h}),i==="artifacts"&&r.jsx(dg,{artifacts:Te.data?.artifacts??[],loading:Te.loading})]})]})}const pg=["running","paused","rejected","completed","failed","cancelled"];function dr(e){if(e==null)return null;const t=typeof e=="number"?e:new Date(String(e)).getTime();return Number.isFinite(t)?t:null}function fg(e){const t=dr(e.startedAt);if(!t)return"—";const n=dr(e.completedAt)??dr(e.finishedAt)??dr(e.lastActivityAt);return Np(n!==null?n-t:null)}function hg({project:e,param:t}){return t?r.jsx(ug,{id:t,project:e}):r.jsx(mg,{project:e})}function mg({project:e}){const t=I(()=>M.runs(e),[e]),[n,s]=N.useState(null);if(kt(t.error))return r.jsx(se,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const l=t.data?.runs??[],o=n?l.filter(i=>i.status===n):l;return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(ze,{icon:"play",title:"Runs",sub:t.data?`${l.length} workflow runs`:"Loading runs…",actions:r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>A("workflows"),children:[r.jsx(b,{name:"play",size:13}),"Launch run"]})})}),r.jsx("div",{className:"row gap-6",style:{padding:"0 18px 12px"},children:r.jsx(We,{size:"sm",label:"Run status filter",value:n??"all",onChange:i=>s(i==="all"?null:i),options:[{value:"all",label:"All"},...pg.map(i=>({value:i,label:i[0].toUpperCase()+i.slice(1)}))]})}),t.data&&!l.length?r.jsx(se,{icon:"play",title:"No runs yet",body:"Workflow runs started from the CLI or dashboard land here.",action:r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("workflows"),children:"Browse workflows"})}):r.jsx("div",{className:"scroll-y",style:{padding:"0 18px 18px"},children:r.jsxs("div",{className:"card",style:{overflow:"hidden"},children:[r.jsxs("div",{className:"row",style:{padding:"8px 14px",fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:[r.jsx("span",{style:{width:100},children:"Status"}),r.jsx("span",{className:"grow",children:"Workflow"}),r.jsx("span",{style:{width:90},children:"Duration"}),r.jsx("span",{style:{width:130},children:"Model"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Cost"}),r.jsx("span",{style:{width:60,textAlign:"right"},children:"When"})]}),o.map(i=>r.jsxs("div",{role:"button",tabIndex:0,className:"row list-row",onClick:()=>A("runs",{param:i.id}),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),A("runs",{param:i.id}))},style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)",cursor:"pointer"},children:[r.jsx("span",{style:{width:100,flexShrink:0},children:r.jsx(qe,{state:i.status})}),r.jsxs("div",{className:"grow row gap-8",style:{minWidth:0},children:[r.jsx("span",{className:"mono",style:{fontSize:12.5},children:String(i.workflowName??i.workflowId??"—")}),r.jsx("span",{className:"mono muted",style:{fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.id})]}),r.jsx("span",{className:"mono tabular muted",style:{width:90,flexShrink:0,fontSize:11.5},children:fg(i)}),r.jsx("span",{className:"mono muted",style:{width:130,flexShrink:0,fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.model??"—"}),r.jsx("span",{className:"mono tabular",style:{width:70,flexShrink:0,textAlign:"right",fontSize:12},children:Pl(i.totalCostUsd)}),r.jsx("span",{className:"mono muted tabular",style:{width:60,flexShrink:0,textAlign:"right",fontSize:11},children:pn(dr(i.startedAt)??void 0)??"—"})]},i.id)),t.data&&!o.length&&r.jsx("div",{className:"muted",style:{padding:"14px",fontSize:12,borderTop:"1px solid var(--border-subtle)"},children:"No runs match this filter."})]})})]})}const ll=e=>e.split("/").filter(Boolean).pop()??e;function Cp(e){return e>=85?{label:"Excellent",color:"var(--success)"}:e>=70?{label:"Good",color:"var(--node-route)"}:e>=50?{label:"Fair",color:"var(--warn)"}:{label:"Needs work",color:"var(--error)"}}function Ep(e,t){const n=Tl(e.text??""),s=/REQ-[A-Z]+-\d+|[a-z][a-zA-Z]+[A-Z][a-zA-Z]+|[\w/]+\.(ts|tsx|js|jsx|md|py|rs|go)/.test(n),l=/^(read |grep |look |check |explain |tell me|why |what )/i.test(n.trim()),o=n.length>=45&&!l||n.length>=72,i=e.input_tokens+e.cache_creation_tokens+e.cache_read_tokens,c=i>0&&e.cache_read_tokens/i>=.5,a=t.some(f=>["Bash","Grep","Read"].includes(f.tool_name)&&(f.result_length??0)>3e4),d=t.some(f=>f.tool_name.includes("specship_"));let u=62;return u+=s?12:-10,u+=o?10:-9,u+=c?8:-10,u+=d||!a?9:-13,u=Math.max(14,Math.min(98,Math.round(u))),{score:u,...Cp(u)}}const vs=[{key:"input",label:"Input",color:"var(--node-spec)"},{key:"output",label:"Output",color:"var(--node-code)"},{key:"cacheCreate",label:"Cache write",color:"var(--warn)"},{key:"cacheRead",label:"Cache read",color:"var(--node-route)"}],xg=e=>({input:e.input_tokens,output:e.output_tokens,cacheCreate:e.cache_creation_tokens,cacheRead:e.cache_read_tokens});function gg({query:e}){const[t,n]=N.useState(e.sel||null);return t?r.jsx(jg,{id:t,onBack:()=>n(null)}):r.jsx(vg,{onOpen:n})}function vg({onOpen:e}){const[t,n]=N.useState("week"),[s,l]=N.useState(""),[o,i]=N.useState(""),[c,a]=N.useState("cost"),d=I(()=>M.claudeStats(),[]),u=I(()=>M.claudeProjects(),[]),f=I(()=>M.claudeSessions(s||null,200,t,o||null),[s,o,t]),[m,g]=N.useState([]);N.useEffect(()=>{if(o||!f.data)return;const w=new Set;for(const v of f.data.sessions)v.last_model&&w.add(v.last_model);g([...w].sort())},[o,f.data]);const y=d.data?.sessionCount===0,p=()=>{d.reload(),f.reload(),u.reload()};return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 12px"},children:r.jsx(ze,{icon:"sessions",title:"Sessions",sub:f.data?`${f.data.sessions.length} sessions · ${s?ll(s):"across all projects"}`:"Loading sessions…",actions:r.jsx(Cl,{value:t,onChange:n})})}),y?r.jsx(Kn,{onIngested:p}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-8",style:{padding:"0 18px 12px"},children:[r.jsx(b,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),r.jsxs("select",{className:"input","aria-label":"Project filter",value:s,onChange:w=>l(w.target.value),style:{fontSize:12,padding:"4px 8px"},children:[r.jsx("option",{value:"",children:"All projects"}),(u.data?.projects??[]).map(w=>r.jsx("option",{value:w.path,children:w.name||ll(w.path)},w.path))]}),r.jsxs("select",{className:"input","aria-label":"Model filter",value:o,onChange:w=>i(w.target.value),style:{fontSize:12,padding:"4px 8px"},children:[r.jsx("option",{value:"",children:"All models"}),m.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsx("div",{className:"grow"}),r.jsx("span",{className:"muted",style:{fontSize:11.5},children:"sort"}),r.jsx(We,{size:"sm",label:"Sort sessions",value:c,onChange:a,options:[{value:"cost",label:"Cost"},{value:"prompts",label:"Prompts"}]})]}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"0 18px 18px"},children:r.jsx(oe,{state:f,label:"sessions",minHeight:220,children:w=>r.jsx(yg,{sessions:w.sessions,sort:c,onOpen:e})})})]})]})}function yg({sessions:e,sort:t,onOpen:n}){const s=[...e].sort((o,i)=>t==="prompts"?(i.prompt_count??0)-(o.prompt_count??0):(i.total_cost_usd??0)-(o.total_cost_usd??0));if(!s.length)return r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px 4px"},children:"No sessions in this range for these filters."});const l={fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600};return r.jsxs("div",{className:"card",style:{overflow:"hidden"},children:[r.jsxs("div",{className:"row",style:{padding:"8px 14px",borderBottom:"1px solid var(--border-subtle)",...l},children:[r.jsx("span",{style:{width:90},children:"Session"}),r.jsx("span",{style:{width:110},children:"Project"}),r.jsx("span",{className:"grow",children:"Window"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Prompts"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Cache"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Cost"})]}),s.map(o=>{const i=pp(o);return r.jsxs("div",{className:"row list-row",role:"button",tabIndex:0,onClick:()=>n(o.id),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n(o.id))},style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)",cursor:"pointer"},children:[r.jsx("span",{className:"mono",style:{width:90,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},children:o.id.slice(0,8)}),r.jsx("span",{style:{width:110,overflow:"hidden"},children:r.jsx(Q,{children:ll(o.project_path)})}),r.jsxs("span",{className:"mono muted grow",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[fp(o.started_at)," – ",da(o.ended_at)," · ",o.last_model?o.last_model:"—"]}),r.jsx("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12},children:o.prompt_count??0}),r.jsxs("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12,color:Vr(i)},children:[Math.round(i*100),"%"]}),(o.unpriced_tokens??0)>0?r.jsx("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12.5,fontWeight:600,color:"var(--warn)"},title:`${o.unpriced_tokens} tokens on a model with no pricing row — cost unknown, not $0 (add pricing to heal)`,children:"unpriced ⚠"}):r.jsxs("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12.5,fontWeight:600},children:["$",(o.total_cost_usd??0).toFixed(2)]})]},o.id)})]})}function jg({id:e,onBack:t}){const n=I(()=>M.claudeSession(e),[e]),s=I(()=>M.claudeSessionSummary(e),[e]);return r.jsx(oe,{state:n,label:"session detail",minHeight:320,children:l=>{const o=l.session,i=new Map;for(const p of l.toolCalls){if(!p.prompt_id)continue;const w=i.get(p.prompt_id)??[];w.push(p),i.set(p.prompt_id,w)}const c=pp(o),a=l.prompts.filter(p=>p.is_sidechain).reduce((p,w)=>p+(w.cost_usd??0),0);Math.max(...l.prompts.map(p=>p.cost_usd??0),0);const d={input:0,output:0,cacheCreate:0,cacheRead:0};for(const p of l.prompts){const w=xg(p);for(const v of vs)d[v.key]+=w[v.key]}const u=vs.reduce((p,w)=>p+d[w.key],0)||1,f=l.prompts.map(p=>Ep(p,i.get(p.id)??[]).score),m=f.length?Math.round(f.reduce((p,w)=>p+w,0)/f.length):0,g=Cp(m),y=f.filter(p=>p<60).length;return r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18,minWidth:0},children:[r.jsxs("div",{className:"row gap-10",style:{marginBottom:14},children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:t,children:[r.jsx(b,{name:"chevronLeft",size:14}),"Sessions"]}),r.jsx("span",{className:"mono",style:{fontSize:16,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.id.slice(0,12)}),r.jsx(Q,{color:"var(--node-spec)",bg:"var(--node-spec-soft)",children:ll(o.project_path)}),o.last_model&&r.jsx(Q,{children:o.last_model})]}),r.jsxs("div",{className:"row",style:{gap:24,padding:"12px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)",marginBottom:16,flexWrap:"wrap"},children:[(o.total_cost_usd??0)===0&&(o.total_input_tokens??0)+(o.total_output_tokens??0)+(o.total_cache_creation_tokens??0)+(o.total_cache_read_tokens??0)>0?r.jsx(xn,{label:"Cost",value:"unpriced ⚠",color:"var(--warn)"}):r.jsx(xn,{label:"Cost",value:"$"+(o.total_cost_usd??0).toFixed(2)}),r.jsx(xn,{label:"Prompts",value:o.prompt_count??l.prompts.length}),r.jsx(xn,{label:"Cache hit",value:Math.round(c*100)+"%",color:Vr(c)}),r.jsx(xn,{label:"Subagent $",value:"$"+a.toFixed(2),color:"var(--node-code)"}),r.jsx(xn,{label:"Window",value:fp(o.started_at)+" – "+da(o.ended_at)})]}),r.jsxs("div",{className:"row",style:{justifyContent:"space-between",marginBottom:8},children:[r.jsxs("div",{className:"eyebrow",children:["Prompt timeline · ",l.prompts.length]}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"dot = prompt quality"})]}),r.jsxs("div",{className:"col gap-6",children:[l.prompts.map(p=>r.jsx(wg,{p,tools:i.get(p.id)??[]},p.id)),!l.prompts.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:8},children:"No prompts recorded for this session."})]}),r.jsx("div",{style:{height:20}})]}),r.jsxs("div",{className:"scroll-y",style:{width:290,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",padding:16},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:10},children:"Token mix"}),r.jsx("div",{className:"row",style:{height:10,borderRadius:999,overflow:"hidden",marginBottom:10},children:vs.map(p=>r.jsx("div",{style:{width:d[p.key]/u*100+"%",height:"100%",background:p.color}},p.key))}),r.jsx("div",{className:"col gap-6",style:{marginBottom:20},children:vs.map(p=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{style:{width:9,height:9,borderRadius:2,background:p.color,flexShrink:0}}),r.jsx("span",{className:"muted grow",style:{fontSize:11.5},children:p.label}),r.jsx("span",{className:"mono tabular",style:{fontSize:11.5},children:H(d[p.key])}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10,width:32,textAlign:"right"},children:[Math.round(d[p.key]/u*100),"%"]})]},p.key))}),r.jsxs("div",{style:{background:"var(--success-soft)",border:"1px solid rgba(70,194,107,0.25)",borderRadius:8,padding:"10px 12px",marginBottom:20},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(b,{name:"database",size:13,style:{color:"var(--success)"}}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"Cache effectiveness"})]}),r.jsxs("div",{className:"row",style:{alignItems:"baseline",gap:8,marginTop:4},children:[r.jsxs("span",{className:"tabular",style:{fontSize:24,fontWeight:700,color:"var(--success)"},children:[Math.round(c*100),"%"]}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"of input served from cache"})]})]}),f.length>0&&r.jsxs("div",{style:{background:`color-mix(in srgb, ${g.color} 7%, var(--bg-canvas))`,border:`1px solid color-mix(in srgb, ${g.color} 30%, transparent)`,borderRadius:8,padding:"10px 12px",marginBottom:20},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:8},children:[r.jsx(b,{name:"sparkles",size:13,style:{color:g.color}}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"Avg prompt quality"})]}),r.jsxs("div",{className:"row",style:{alignItems:"baseline",gap:8},children:[r.jsx("span",{className:"tabular",style:{fontSize:24,fontWeight:700,color:g.color},children:m}),r.jsxs("span",{className:"muted",style:{fontSize:10.5},children:["/100 · ",g.label]})]}),r.jsx("div",{style:{margin:"8px 0 2px"},children:r.jsx(Ur,{frac:m/100,color:g.color,height:5})}),y>0&&r.jsxs("div",{className:"muted",style:{fontSize:10.5,marginTop:7},children:[r.jsxs("span",{style:{color:"var(--warn)"},children:[y," prompt",y>1?"s":""]})," could be improved — name a symbol, file or REQ id"]})]}),r.jsx(Sg,{summaryState:s})]})]})}})}function wg({p:e,tools:t}){const n=Ep(e,t),s=e.input_tokens+e.output_tokens+e.cache_creation_tokens+e.cache_read_tokens,l=e.input_tokens+e.cache_creation_tokens+e.cache_read_tokens,o=l>0?e.cache_read_tokens/l:0,i=(e.cost_usd??0)>2.5;return r.jsxs("div",{className:"row gap-10 list-row",style:{padding:"11px 12px",borderRadius:8,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"mono muted",style:{fontSize:10.5,width:52,flexShrink:0},children:da(e.ts)}),r.jsx("span",{title:`Prompt quality: ${n.label} (${n.score}/100)`,style:{width:8,height:8,borderRadius:"50%",background:n.color,flexShrink:0,boxShadow:`0 0 6px ${n.color}66`}}),r.jsxs("span",{className:"grow",style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[!!e.is_sidechain&&r.jsxs(Q,{color:"var(--node-code)",bg:"var(--node-code-soft)",children:[r.jsx(b,{name:"bot",size:10}),"subagent"]}),!!e.is_sidechain&&" ",Tl(e.text??"")||r.jsx("span",{className:"muted",children:"(no text)"})]}),r.jsxs("span",{className:"row gap-4",style:{flexShrink:0},children:[r.jsx(b,{name:"wrench",size:11,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11},children:t.length})]}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11,width:50,textAlign:"right",flexShrink:0},children:H(s)}),r.jsxs("span",{className:"mono tabular",style:{fontSize:11,width:38,textAlign:"right",flexShrink:0,color:Vr(o)},children:[Math.round(o*100),"%"]}),r.jsxs("span",{className:"mono tabular",style:{fontSize:13,fontWeight:600,width:54,textAlign:"right",flexShrink:0,color:i?"var(--error)":"var(--text-primary)"},children:["$",(e.cost_usd??0).toFixed(2)]})]})}function Sg({summaryState:e}){return r.jsx(oe,{state:e,label:"session summary",minHeight:120,children:t=>{const n=t.byTool.map(s=>({name:s.name,calls:s.calls,totalBytes:s.totalBytes}));return r.jsxs(r.Fragment,{children:[(t.slashCommands.length>0||t.skills.length>0)&&r.jsxs("div",{style:{marginBottom:20},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:10},children:"Commands & skills"}),r.jsxs("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:[t.slashCommands.map(s=>r.jsxs("span",{className:"pill",style:{color:"var(--node-code)",background:"var(--node-code-soft)",fontFamily:"var(--font-mono)",fontWeight:500},children:[r.jsx(b,{name:"command",size:10}),s.name,s.count>1&&r.jsxs("span",{style:{opacity:.7},children:["×",s.count]})]},s.name)),t.skills.map(s=>r.jsxs("span",{className:"pill",style:{color:"var(--node-test)",background:"var(--node-test-soft)",fontFamily:"var(--font-mono)",fontWeight:500},children:[r.jsx(b,{name:"sparkles",size:10}),s.name,s.count>1&&r.jsxs("span",{style:{opacity:.7},children:["×",s.count]})]},s.name))]})]}),r.jsxs("div",{className:"eyebrow",style:{marginBottom:10},children:["Tools used · ",t.byTool.length]}),t.byTool.length?r.jsxs(r.Fragment,{children:[r.jsx(pa,{items:n,valueKey:"totalBytes",labelKey:"name",fmt:s=>H(s),color:s=>Number(s.totalBytes)>6e4?"var(--error)":Number(s.totalBytes)>2e4?"var(--warn)":"var(--node-code)"}),r.jsx("div",{className:"muted",style:{fontSize:10,marginTop:8},children:"bar = result tokens returned"})]}):r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No tool calls recorded."}),t.filesTouched.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"eyebrow",style:{margin:"20px 0 10px"},children:["Files touched · ",t.filesTouched.length]}),r.jsx("div",{className:"col gap-5",children:t.filesTouched.slice(0,10).map(s=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:"rtl",textAlign:"left",flex:1},title:s.path,children:s.path}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10,flexShrink:0},children:["×",s.ops]}),r.jsx("span",{className:"pill",style:{fontSize:9.5,flexShrink:0},children:s.lastOp})]},s.path))})]}),t.durationMs>0&&r.jsxs("div",{className:"row gap-8",style:{marginTop:20},children:[r.jsx(b,{name:"clock",size:12,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"duration"}),r.jsx("span",{className:"mono tabular",style:{fontSize:11.5},children:Rm(t.durationMs)})]})]})}})}const Tp="specship-density";function _p(){try{if(localStorage.getItem(Tp)==="compact")return"compact"}catch{}return"comfortable"}function Rp(e){document.documentElement.setAttribute("data-density",e);try{localStorage.setItem(Tp,e)}catch{}window.dispatchEvent(new Event("specship-density"))}function ys({icon:e,title:t,children:n}){return r.jsxs("div",{className:"card card-pad",style:{marginBottom:14},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(b,{name:e,size:15,style:{color:"var(--text-secondary)"}}),r.jsx("div",{style:{fontSize:13,fontWeight:600},children:t})]}),n]})}function Hc({label:e,hint:t,children:n}){return r.jsxs("div",{style:{padding:"8px 0"},children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"baseline",marginBottom:6},children:[r.jsx("div",{style:{fontSize:12.5,fontWeight:500},children:e}),t&&r.jsx("div",{className:"muted",style:{fontSize:11},children:t})]}),n]})}function kg({label:e,desc:t,on:n,onClick:s,busy:l}){return r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"8px 0"},children:[r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:12.5,fontWeight:500},children:e}),r.jsx("div",{className:"muted",style:{fontSize:11},children:t})]}),r.jsx("button",{role:"switch","aria-checked":n,"aria-label":e,disabled:l,onClick:s,style:{width:38,height:22,borderRadius:11,border:"none",cursor:l?"wait":"pointer",background:n?"var(--accent)":"var(--bg-elevated)",position:"relative",flexShrink:0,transition:"background var(--motion-fast)",opacity:l?.6:1},children:r.jsx("span",{style:{position:"absolute",top:2,left:n?18:2,width:18,height:18,borderRadius:"50%",background:"#fff",transition:"left var(--motion-fast)"}})})]})}function vn({label:e,value:t,color:n}){return r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"6px 0",fontSize:12.5},children:[r.jsx("span",{className:"muted",children:e}),r.jsx("span",{className:"mono",style:{color:n??"var(--text-primary)"},children:t})]})}function bg(e){const[t,n]=N.useState(Nl),[s,l]=N.useState(_p),o=I(()=>M.status(e.project),[e.project]),i=km(),[c,a]=N.useState(!1),[d,u]=N.useState(null),f=y=>{const p=y;n(p),zl(p)},m=y=>{const p=y;l(p),Rp(p)},g=async()=>{const y=!(i.data?.ingestEnabled??!1);a(!0),u(null);try{await M.config.set({ingestEnabled:y}),i.reload()}catch(p){u(p instanceof Error?p.message:"Failed to save")}finally{a(!1)}};return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:22},children:[r.jsx(ze,{icon:"settings",title:"Settings"}),r.jsxs("div",{style:{maxWidth:640},children:[r.jsxs(ys,{icon:"sparkles",title:"Appearance",children:[r.jsx(Hc,{label:"Theme",hint:"Dark, light, or follow your OS",children:r.jsx(We,{value:t,onChange:f,options:[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}]})}),r.jsx(Hc,{label:"Density",hint:"Row height & padding",children:r.jsx(We,{value:s,onChange:m,options:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]})})]}),r.jsxs(ys,{icon:"sessions",title:"Claude Code",children:[r.jsx(kg,{label:"Enable transcript ingest",desc:"Read JSONL transcripts from ~/.claude/projects for analytics",on:i.data?.ingestEnabled??!1,onClick:g,busy:c||i.loading}),d&&r.jsx("div",{style:{fontSize:11.5,color:"var(--error)",padding:"4px 0"},children:d}),c&&r.jsx("div",{className:"muted",style:{fontSize:11.5,padding:"4px 0"},children:"Saving…"})]}),r.jsx(ys,{icon:"database",title:"Backend",children:r.jsx(oe,{state:o,label:"Backend",minHeight:120,children:y=>r.jsxs(r.Fragment,{children:[r.jsx(vn,{label:"Database backend",value:y.backend}),r.jsx(vn,{label:"Journal mode",value:y.journalMode}),r.jsx(vn,{label:"Project root",value:r.jsx("span",{title:y.projectPath,children:y.projectPath})}),r.jsx(vn,{label:"Indexed files",value:y.fileCount.toLocaleString()})]})})}),r.jsx(ys,{icon:"graph",title:"About",children:r.jsx(oe,{state:o,label:"About",minHeight:90,children:y=>r.jsxs(r.Fragment,{children:[r.jsx(vn,{label:"Version",value:`v${y.version}`}),r.jsx(vn,{label:"Backend",value:y.backend,color:"var(--success)"})]})})})]})]})}const Mp=/^\s*<!--\s*id\s*:\s*([^\s-][^\s]*)\s*-->\s*$/,js=/^(#{1,6})\s+(.+?)\s*$/,Uc=/^\s*[-*]\s+(.*\S)\s*$/,en=e=>e.replace(/\r$/,""),ws=e=>en(e).match(Mp)?.[1]??null;function Pp(e,t){const n=e.findIndex(p=>ws(p)===t);if(n===-1)return null;let s=-1,l=2,o="";for(let p=n+1;p<e.length;p++){const w=en(e[p]);if(w.trim()==="")continue;const v=w.match(js);v&&v[1]&&v[2]&&(s=p,l=v[1].length,o=v[2]);break}if(s===-1)return null;let i=e.length;for(let p=s+1;p<e.length;p++){const w=ws(e[p]);if(w&&w!==t&&!w.startsWith(t+".")){i=p;break}}let c=-1,a=-1;for(let p=s+1;p<i;p++){const w=en(e[p]),v=w.match(js);if(v&&v[2]&&v[2].trim().toLowerCase()==="acceptance"||ws(e[p])){c=p;break}a===-1&&w.trim().startsWith("implementations:")&&(a=p)}const d=a!==-1?a:c!==-1?c:i,u=e.slice(s+1,d).map(en).join(`
46
- `).trim(),f=c!==-1?c:i,m=a!==-1?e.slice(a,f):[];for(;m.length&&en(m[m.length-1]).trim()==="";)m.pop();const g=[];let y=null;if(c!==-1){let p=null;for(let w=c;w<i;w++){const v=en(e[w]),h=ws(e[w]);if(h){p=h;continue}const x=v.match(js);if(x&&x[2]&&x[2].trim().toLowerCase()==="acceptance"){y===null&&(y=v);continue}const j=v.match(Uc);if(j&&j[1]){const S=[j[1].trim()];for(;w+1<i;){const C=en(e[w+1]);if(C.trim()===""||Mp.test(C)||js.test(C)||Uc.test(C))break;S.push(C.trim()),w++}g.push({id:p??"",text:S.join(" ").trim()}),p=null}}}return{start:n,end:i,headingIdx:s,headingLevel:l,title:o,statement:u,middle:m,acceptanceHeading:y,criteria:g}}function Lp(e,t){const n=Pp(e.split(`
47
- `),t);if(!n)return null;const{title:s,headingLevel:l,statement:o,criteria:i}=n;return{title:s,headingLevel:l,statement:o,criteria:i}}function Ng(e){return{title:e.title.trim(),statement:e.statement.trim(),criteria:e.criteria.map(t=>({text:t.text.trim()})).filter(t=>t.text.length>0)}}function zg(e,t,n){const s=e.split(`
48
- `),l=Pp(s,t);if(!l)return null;const o=[s[l.start],"#".repeat(l.headingLevel)+" "+n.title,""];return n.statement&&o.push(...n.statement.split(`
49
- `),""),l.middle.length&&o.push(...l.middle,""),n.criteria.length&&(o.push(l.acceptanceHeading??"## Acceptance"),n.criteria.forEach((i,c)=>{o.push(`<!-- id: ${t}.A${c+1} -->`,`- ${i.text}`)}),o.push("")),[...s.slice(0,l.start),...o,...s.slice(l.end)].join(`
50
- `)}function jr(e){let t=String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return t=t.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),t=t.replace(/`([^`]+?)`/g,"<code class='sp-code'>$1</code>"),t=t.replace(/\b(MUST NOT|MUST|SHALL NOT|SHALL|REQUIRED)\b/g,"<span class='sp-kw sp-kw-must'>$1</span>"),t=t.replace(/\b(SHOULD NOT|SHOULD|RECOMMENDED)\b/g,"<span class='sp-kw sp-kw-should'>$1</span>"),t=t.replace(/\b(MAY|OPTIONAL)\b/g,"<span class='sp-kw sp-kw-may'>$1</span>"),t}function pi(e){return e.kind==="tests"}function fi(e){const t=(e??[]).filter(pi);return t.length?t.some(n=>n.state==="broken")?"broken":t.every(n=>n.state==="verified")?"verified":"tested":"untested"}const Cg={untested:{label:"Untested",color:"var(--warn)",bg:"var(--warn-soft)",title:"No proving test is linked — implementation alone is not evidence."},tested:{label:"Tested",color:"var(--info)",bg:"var(--info-soft)",title:"A proving test is linked but has not passed verification yet."},verified:{label:"Test-verified",color:"var(--success)",bg:"var(--success-soft)",title:"Every linked proving test is verified."},broken:{label:"Test broken",color:"var(--error)",bg:"var(--error-soft)",title:"A linked proving test is broken."}};function Eg(e){return fi(e)==="verified"}function ol(e,t){if(!e||!e.length)return t;const n=e.map(s=>s.state);return n.includes("broken")?"broken":n.includes("orphaned")?"orphaned":n.includes("drifted")?"drifted":n.every(s=>s==="verified")?"verified":"implemented"}const Tg={verified:"check",implemented:"check",completed:"check",drifted:"drift",broken:"cancel",orphaned:"cancel",failed:"cancel"};function _g({state:e}){const t=ie[e]??ie.info,n=Tg[e];return r.jsx("div",{className:"sp-crit-mark",style:{background:t.bg,color:t.color},children:n?r.jsx(b,{name:n,size:12}):r.jsx("span",{style:{width:7,height:7,borderRadius:"50%",border:"1.6px solid "+t.color,boxSizing:"border-box"}})})}function Vc(e){const t=e.lastIndexOf(".");return t===-1?e:e.slice(t+1)}function Rg(e){return ie[e]?.label??e}function Mg({id:e,project:t,cache:n}){return e?r.jsx(Lg,{id:e,project:t,cache:n}):r.jsx(Pg,{})}function Pg(){return r.jsx(se,{icon:"book",title:"Pick a spec from the tree",body:"Or run specship init -i to index your specs/ folder if you haven’t yet.",action:r.jsxs("span",{className:"row gap-6",style:{justifyContent:"center"},children:[r.jsx("code",{className:"mono",style:{fontSize:11.5,color:"var(--accent)",background:"var(--bg-canvas)",padding:"5px 10px",borderRadius:6,border:"1px solid var(--border-subtle)"},children:"specship init -i"}),r.jsx(lt,{text:"specship init -i"})]})})}function Lg({id:e,project:t,cache:n}){const s=(t??"")+"|"+e,l=I(async()=>{const u=await M.spec(e,t);return n?.set(s,u),u},[e,t]),o=l.data??n?.get(s)??null,[i,c]=N.useState(!1),[a,d]=N.useState(null);return N.useEffect(()=>{c(!1),d(null)},[e]),o?o.spec.kind==="brief"?r.jsx(Ig,{data:o}):i?r.jsx(Qg,{data:o,project:t,onCancel:()=>c(!1),onSaved:u=>{c(!1),d(u),l.reload()}}):r.jsx(Ag,{data:o,project:t,notice:a,onEdit:()=>{d(null),c(!0)},onReload:l.reload}):l.loading?r.jsx(Dg,{}):kt(l.error)?r.jsx(se,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."}):r.jsx(se,{icon:"drift",title:`Couldn’t load ${e}`,body:l.error instanceof Error?l.error.message:"The spec detail request failed.",action:r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:l.reload,children:[r.jsx(b,{name:"refresh",size:13}),"Retry"]})})}function Ig({data:e}){const{spec:t}=e,n=typeof t.metadata?.spec=="string"?t.metadata.spec:null,s=typeof t.metadata?.created=="string"?t.metadata.created:null;return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},children:r.jsxs("div",{className:"sp-doc",children:[r.jsxs("div",{className:"sp-breadcrumb",children:[r.jsx(b,{name:"sparkles",size:13,style:{color:"var(--info)",flexShrink:0}}),r.jsx("span",{className:"mono sp-path",style:{color:"var(--text-secondary)"},children:t.sourcePath??""}),r.jsx(b,{name:"chevronRight",size:11,style:{flexShrink:0}}),r.jsx("span",{className:"mono",style:{color:"var(--info)",fontWeight:600,flexShrink:0},children:t.id}),r.jsx(lt,{text:t.id,ariaLabel:"Copy brief id"})]}),r.jsx("h1",{className:"sp-title",children:t.title}),r.jsxs("div",{className:"sp-metaline",style:{marginBottom:32},children:[r.jsx(Q,{color:"var(--info)",bg:"var(--info-soft)",dot:!0,children:"Idea"}),s&&r.jsxs("span",{className:"fact",children:["captured ",r.jsx("b",{children:s})]}),n&&r.jsxs("span",{className:"fact",children:["specified as ",r.jsx("b",{className:"mono",children:n})]}),!n&&r.jsx("span",{className:"fact muted",children:"not yet specified"})]}),r.jsxs("div",{className:"sp-sec",children:[r.jsx("div",{className:"sp-label",children:"Brief"}),t.body?.trim()?r.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:jr(t.body)}}):r.jsx("div",{className:"muted",style:{fontSize:13},children:"This brief has no body."})]})]})})}function Dg(){return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},"data-testid":"spec-skeleton",children:r.jsxs("div",{className:"sp-doc",children:[r.jsx("div",{className:"skel",style:{width:230,height:12,marginBottom:20}}),r.jsx("div",{className:"skel",style:{width:"72%",height:28,marginBottom:16}}),r.jsx("div",{className:"skel",style:{width:340,height:20,marginBottom:32}}),r.jsx("div",{className:"skel",style:{width:"100%",height:96,marginBottom:30}}),r.jsx("div",{className:"skel",style:{width:"100%",height:132,marginBottom:30}}),r.jsx("div",{className:"skel",style:{width:"100%",height:56}})]})})}function Ag({data:e,project:t,notice:n,onEdit:s,onReload:l}){const{spec:o,parent:i,children:c,links:a,childLinks:d}=e,u=i?.sourcePath??o.sourcePath??"",f=e.source!=null&&Lp(e.source,o.id)!=null,m=f?"Edit this requirement in place":e.source==null?"Source file not available":"Couldn’t locate this requirement’s section in the source file",g=c.filter(z=>z.kind==="acceptance"),y=z=>ol(d[z.id],"pending"),p=ol(a,"drafted"),w=g.filter(z=>Eg(d[z.id])).length,v=(ie[p]??ie.info).color,h=a.filter(pi),x=a.filter(z=>!pi(z)),j=fi(a),S=Cg[j],C=p==="verified"?pn(a.reduce((z,T)=>Math.max(z,T.updatedAt??0),0)||void 0):null,E=p==="verified"?"var(--success)":p==="broken"||p==="drifted"||p==="orphaned"?"var(--warn)":"var(--text-secondary)",R=typeof o.metadata?.rationale=="string"?o.metadata.rationale:typeof o.rationale=="string"?o.rationale:null,O=x.filter(z=>typeof z.id=="number"&&z.state!=="verified"),[D,ne]=N.useState(!1),[fe,ke]=N.useState(null),He=async()=>{ne(!0),ke(null);try{for(const z of O)await M.linkVerify({link_id:z.id,result:"pass"},t);ke({tone:"ok",text:`Verified ${O.length} link${O.length===1?"":"s"}.`}),l?.()}catch(z){const T=z instanceof aa&&z.code==="no_test_evidence";ke({tone:"error",text:T?"Declare a proving test first — add a `verifies:` block to this requirement (or an @verifies comment on the test) so there is evidence to promote against.":z instanceof Error?z.message:String(z)})}finally{ne(!1)}},bt=z=>[z.targetFilePath,z.targetQualifiedName].filter(Boolean).join(":")||"—",Xe=z=>A("graph",{query:{focus:z.resolvedNodeId||"spec:"+o.id}}),Te=r.jsx("span",{className:"sep"}),k=z=>r.jsx("div",{className:"card",style:{overflow:"hidden"},children:z.map((T,L)=>r.jsxs("div",{className:"row gap-10",style:{padding:"11px 14px",borderTop:L?"1px solid var(--border-subtle)":"none"},children:[r.jsx(qe,{state:T.state}),r.jsx(Q,{children:T.kind||"implements"}),T.driftAxis&&r.jsx(Q,{color:"var(--warn)",bg:"var(--warn-soft)",children:T.driftAxis+" drift"}),r.jsx("span",{className:"mono grow",style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:bt(T)}),r.jsx("span",{className:"mono muted tabular",title:"Last state change",style:{fontSize:11,flexShrink:0},children:pn(T.updatedAt)??"—"}),r.jsx(Q,{children:T.provenance||"—"}),r.jsxs("button",{className:"btn btn-ghost btn-xs",onClick:()=>Xe(T),title:"Reveal in the graph",children:[r.jsx(b,{name:"reveal",size:12}),"Reveal"]})]},L))});return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},children:r.jsxs("div",{className:"sp-doc",children:[n!=null&&r.jsxs("div",{className:"card card-pad row gap-8",style:{color:"var(--warn)",borderColor:"var(--warn)",marginBottom:20,fontSize:12.5},children:[r.jsx(b,{name:"drift",size:14,style:{flexShrink:0}}),r.jsxs("span",{children:["Saved, but not yet indexed — re-sync failed (",n,"). The file is on disk; the next sync picks it up."]})]}),r.jsxs("div",{className:"sp-breadcrumb",children:[r.jsx(b,{name:"book",size:13,style:{color:"var(--node-spec)",flexShrink:0}}),r.jsx("span",{className:"mono sp-path",style:{color:"var(--text-secondary)"},children:u}),r.jsx(b,{name:"chevronRight",size:11,style:{flexShrink:0}}),r.jsx("span",{className:"mono",style:{color:"var(--node-spec)",fontWeight:600,flexShrink:0},children:o.id}),r.jsx(lt,{text:o.id,ariaLabel:"Copy spec id"})]}),r.jsx("h1",{className:"sp-title",children:o.title}),r.jsxs("div",{className:"sp-metaline",style:{marginBottom:32},children:[r.jsx(qe,{state:p,pulse:p==="broken"||p==="drifted"}),r.jsx("span",{"data-testid":"coverage-fact",title:S.title,children:r.jsx(Q,{color:S.color,bg:S.bg,dot:!0,children:S.label})}),r.jsx(Q,{children:o.priority||"—"}),Te,r.jsx("span",{className:"fact",children:r.jsx("b",{children:o.kind||"requirement"})}),Te,r.jsxs("span",{className:"fact",children:["owned by ",r.jsx("b",{className:"mono",children:o.owner||"—"})]}),Te,r.jsxs("span",{className:"fact",children:[p==="verified"?"verified ":null,r.jsx("b",{style:{color:E},children:C?C+" ago":"—"})]})]}),r.jsxs("div",{className:"sp-sec",children:[r.jsx("div",{className:"sp-label",children:"Requirement"}),r.jsx("div",{className:"sp-statement lead",style:{"--sp-accent":v},children:o.body?.trim()?r.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:jr(o.body)}}):r.jsx("div",{className:"muted",style:{fontSize:13},children:"No normative statement recorded."})})]}),R&&r.jsxs("div",{className:"sp-sec",children:[r.jsx("div",{className:"sp-label",children:"Why it matters"}),r.jsx("div",{className:"sp-rationale",dangerouslySetInnerHTML:{__html:jr(R)}})]}),g.length>0&&r.jsxs("div",{className:"sp-sec",children:[r.jsxs("div",{className:"sp-label",children:["Acceptance criteria",r.jsx("span",{className:"ct tabular",title:"Met = a linked proving test is verified. Implementation alone doesn’t count.",style:{color:w===g.length?"var(--success)":"var(--text-muted)"},children:w+" / "+g.length+" met"})]}),r.jsx("div",{className:"row gap-4",style:{marginBottom:12},children:g.map(z=>{const T=y(z),L=ie[T]??ie.info;return r.jsx("div",{title:Vc(z.id)+" · "+Rg(T),style:{flex:1,height:4,borderRadius:999,background:L.color,opacity:T==="pending"?.25:.9}},z.id)})}),r.jsx("div",{className:"card",style:{overflow:"hidden"},children:g.map(z=>r.jsxs("div",{className:"sp-crit",children:[r.jsx(_g,{state:y(z)}),r.jsx("span",{className:"sp-crit-id",children:Vc(z.id)}),r.jsx("span",{className:"sp-crit-text",dangerouslySetInnerHTML:{__html:jr(z.body||z.title)}}),fi(d[z.id])==="untested"&&r.jsx("span",{className:"muted",title:"No proving test links to this criterion",style:{fontSize:10.5,flexShrink:0},children:"untested"})]},z.id))})]}),r.jsxs("div",{className:"sp-sec",children:[r.jsxs("div",{className:"sp-label",children:["Linked code",x.length>0&&r.jsx("span",{className:"ct",children:x.length+(x.length===1?" symbol":" symbols")})]}),x.length?k(x):r.jsxs("div",{className:"card card-pad",style:{textAlign:"center",color:"var(--error)",borderColor:"rgba(242,85,90,0.3)"},children:[r.jsx(b,{name:"drift",size:16}),r.jsx("div",{style:{marginTop:6,fontSize:12.5},children:"Orphaned — no code implements this requirement yet"})]})]}),r.jsxs("div",{className:"sp-sec",children:[r.jsxs("div",{className:"sp-label",children:["Proving tests",h.length>0&&r.jsx("span",{className:"ct",children:h.length+(h.length===1?" test":" tests")})]}),h.length?k(h):r.jsxs("div",{className:"card card-pad",style:{textAlign:"center",color:"var(--warn)",borderColor:"rgba(224,160,64,0.3)"},children:[r.jsx(b,{name:"drift",size:16}),r.jsxs("div",{style:{marginTop:6,fontSize:12.5},children:["No proving test — declare one with a ",r.jsx("code",{className:"sp-code",children:"verifies:"})," block in the spec."]})]})]}),fe&&r.jsxs("div",{className:"card card-pad row gap-8",role:fe.tone==="error"?"alert":void 0,style:{marginBottom:14,fontSize:12.5,color:fe.tone==="error"?"var(--warn)":"var(--success)",borderColor:fe.tone==="error"?"var(--warn)":"var(--success)"},children:[r.jsx(b,{name:fe.tone==="error"?"drift":"check",size:14,style:{flexShrink:0}}),r.jsx("span",{children:fe.text})]}),r.jsxs("div",{className:"row gap-8",style:{flexWrap:"wrap",marginTop:4},children:[r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the implementation workflow once Drafted",children:[r.jsx(b,{name:"play",size:13}),"Implement"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",disabled:!O.length||D,title:O.length?"Promote this requirement’s implementation links to verified":"Nothing to verify — every implementation link is already verified",onClick:O.length?()=>{He()}:void 0,children:[r.jsx(b,{name:"check",size:13}),D?"Verifying…":"Verify"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",disabled:!f,title:m,onClick:f?s:void 0,children:[r.jsx(b,{name:"reveal",size:13}),"Edit spec"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>A("graph",{query:{focus:"spec:"+o.id}}),children:[r.jsx(b,{name:"graph",size:13}),"Show in graph"]})]})]})})}const Og=["pending","implementing","implemented","verified","drifted","broken"],Bg=["P0","P1","P2","P3"],Wg=["requirement","constraint","guideline","invariant","non-functional"];function $g(e,t){const{spec:n,childLinks:s}=e,l=typeof n.metadata?.rationale=="string"?n.metadata.rationale:typeof n.rationale=="string"?n.rationale:"";return{title:t.title,priority:n.priority??"",kind:n.kind??"requirement",owner:n.owner??"",statement:t.statement,rationale:l,criteria:t.criteria.map(o=>({id:o.id,state:ol(s[o.id],"pending"),text:o.text}))}}function Kc(e){return{title:e.title,statement:e.statement,criteria:e.criteria}}const Fg={title:"",priority:"",kind:"requirement",owner:"",statement:"",rationale:"",criteria:[]};function yn({label:e,hint:t,children:n}){return r.jsxs("div",{style:{marginBottom:22},children:[r.jsx("label",{className:"sp-fl",children:e}),n,t&&r.jsx("div",{className:"muted",style:{fontSize:11,marginTop:6},children:t})]})}function Hg({value:e,onChange:t,options:n,label:s,disabled:l}){const o=n.includes(e)?n:[e,...n];return r.jsx("select",{className:"input sp-select","aria-label":s,value:e,disabled:l,onChange:i=>t(i.target.value),style:{width:"100%",textTransform:"capitalize"},children:o.map(i=>r.jsx("option",{value:i,children:i},i))})}function Ug({value:e,onChange:t,options:n,width:s,label:l}){const o=ie[e]??ie.info;return r.jsxs("div",{className:"row",style:{position:"relative",width:s??"auto",flexShrink:0},children:[r.jsx("span",{className:"pill-dot","data-testid":"crit-state-dot",style:{background:o.color,position:"absolute",left:11,pointerEvents:"none",zIndex:1}}),r.jsx("select",{className:"input sp-select","aria-label":l,value:e,onChange:i=>t(i.target.value),style:{width:"100%",paddingLeft:26,textTransform:"capitalize"},children:n.map(i=>r.jsx("option",{value:i,children:ie[i]?.label??i},i))})]})}function Vg({state:e}){return r.jsxs("div",{className:"sp-status-auto",children:[e==="drafted"?r.jsxs(r.Fragment,{children:[r.jsx(qe,{state:"drafted"}),r.jsx("span",{className:"muted",style:{fontSize:12},children:"queued for implementation"})]}):r.jsxs(r.Fragment,{children:[r.jsx(qe,{state:e}),r.jsx(b,{name:"arrowRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx(qe,{state:"drafted"})]}),r.jsx("span",{className:"grow"}),r.jsx(b,{name:"lock",size:12,style:{color:"var(--text-faint)",flexShrink:0}})]})}function Kg({criteria:e,onChange:t}){const n=(s,l)=>t(e.map((o,i)=>i===s?{...o,...l}:o));return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{marginBottom:10,gap:10},children:[r.jsx("span",{className:"eyebrow",children:"Acceptance criteria"}),r.jsx("span",{style:{flex:1,height:1,background:"var(--border-subtle)"}}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11.5},children:e.length+" total"})]}),r.jsx("div",{className:"card",style:{overflow:"hidden",marginBottom:12},children:e.length===0?r.jsx("div",{className:"muted",style:{fontSize:12.5,textAlign:"center",padding:"18px 14px"},children:"No criteria yet — add one below."}):e.map((s,l)=>r.jsxs("div",{className:"sp-crit-edit",children:[r.jsx("span",{className:"sp-crit-grip",children:r.jsx(b,{name:"grip",size:14})}),r.jsx("span",{className:"sp-crit-num",children:"A"+(l+1)}),r.jsx(Ug,{value:s.state,onChange:o=>n(l,{state:o}),options:Og,width:156,label:"Criterion A"+(l+1)+" state"}),r.jsx("input",{className:"input grow",style:{fontSize:13},value:s.text,"aria-label":"Criterion A"+(l+1)+" text",placeholder:"Observable, testable condition…",onChange:o=>n(l,{text:o.target.value})}),r.jsx("button",{className:"sp-icon-btn",title:"Remove criterion","aria-label":"Remove criterion A"+(l+1),onClick:()=>t(e.filter((o,i)=>i!==l)),children:r.jsx(b,{name:"trash",size:14})})]},l))}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>t([...e,{id:"",state:"pending",text:""}]),children:[r.jsx(b,{name:"plus",size:13}),"Add criterion"]})]})}function Qg({data:e,project:t,onCancel:n,onSaved:s}){const{spec:l}=e,o=e.parent?.sourcePath??l.sourcePath??"",i=N.useMemo(()=>Lp(e.source??"",l.id),[e.source,l.id]),[c,a]=N.useState(()=>i?$g(e,i):Fg),d=N.useRef(JSON.stringify(Kc(c))),u=JSON.stringify(Kc(c))!==d.current,[f,m]=N.useState("write"),[g,y]=N.useState(!1),[p,w]=N.useState(null),v=C=>a(E=>({...E,...C})),h=ol(e.links,"drafted"),x=(ie[h]??ie.info).color;if(!i)return r.jsx(se,{icon:"drift",title:"Can’t edit this spec",body:"Its requirement section couldn’t be located in the source file."});const j=async()=>{if(!u||g)return;const C=Ng({title:c.title,statement:c.statement,criteria:c.criteria}),E=zg(e.source??"",l.id,C);if(E===null){w("Could not locate this requirement’s section in the source file.");return}y(!0),w(null);try{const R=await M.specSave(l.id,E,t);s(R.syncError??null)}catch(R){w(R instanceof Error?R.message:String(R)),y(!1)}},S=r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!u||g,onClick:j,children:[r.jsx(b,{name:"check",size:13}),g?"Saving…":"Save changes"]});return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsxs("div",{className:"sp-edit-bar",children:[r.jsx(b,{name:"reveal",size:15,style:{color:"var(--accent)",flexShrink:0}}),r.jsxs("div",{className:"col",style:{gap:1,minWidth:0},children:[r.jsx("div",{style:{fontSize:13,fontWeight:600},children:"Editing spec"}),r.jsx("div",{className:"mono muted",style:{fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o+" · "+l.id})]}),r.jsx("div",{className:"grow"}),u&&r.jsxs("div",{className:"row gap-6",style:{marginRight:4},children:[r.jsx("span",{className:"sp-dirty-dot"}),r.jsx("span",{className:"muted",style:{fontSize:11.5},children:"Unsaved changes"})]}),r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:n,children:[r.jsx(b,{name:"x",size:13}),"Cancel"]}),S]}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"24px 28px 56px"},children:r.jsxs("div",{style:{maxWidth:780},children:[p&&r.jsxs("div",{className:"card card-pad row gap-8",role:"alert",style:{color:"var(--error)",borderColor:"rgba(242,85,90,0.35)",marginBottom:18,fontSize:12.5},children:[r.jsx(b,{name:"cancel",size:14,style:{flexShrink:0}}),r.jsxs("span",{children:["Save failed — ",p," Your draft is intact."]})]}),r.jsx(yn,{label:"Title",children:r.jsx("input",{className:"input sp-input-lg",value:c.title,"aria-label":"Title",placeholder:"Short, imperative requirement title",onChange:C=>v({title:C.target.value})})}),r.jsxs("div",{className:"sp-edit-grid",children:[r.jsx(yn,{label:"Status",hint:"Set automatically — saving re-queues this spec as Drafted so the implementation workflow picks it up.",children:r.jsx(Vg,{state:h})}),r.jsx(yn,{label:"Priority",children:r.jsx(We,{options:Bg,value:c.priority,onChange:C=>v({priority:C}),label:"Priority",disabled:!0})}),r.jsx(yn,{label:"Kind",children:r.jsx(Hg,{value:c.kind,onChange:C=>v({kind:C}),options:Wg,label:"Kind",disabled:!0})}),r.jsx(yn,{label:"Owner",children:r.jsx("input",{className:"input mono",style:{width:"100%"},value:c.owner,"aria-label":"Owner",placeholder:"unassigned",disabled:!0,onChange:C=>v({owner:C.target.value})})})]}),r.jsx("div",{className:"muted",style:{fontSize:11,margin:"-8px 0 22px"},children:"Priority, kind, and owner are document-level in the current spec format — they render from available data and are read-only here, because Save can’t persist them per-requirement (REQ-TVIZ-009.A3)."}),r.jsxs("div",{style:{marginBottom:22},children:[r.jsxs("div",{className:"row",style:{marginBottom:7},children:[r.jsx("label",{className:"sp-fl",style:{marginBottom:0},children:"Normative statement"}),r.jsx("div",{className:"grow"}),r.jsx(We,{size:"sm",options:[{value:"write",label:"Write"},{value:"preview",label:"Preview"}],value:f,onChange:m,label:"Statement editor mode"})]}),f==="write"?r.jsx("textarea",{className:"input sp-textarea",value:c.statement,spellCheck:!1,"aria-label":"Normative statement",placeholder:"The server MUST validate … (use MUST / SHOULD / MAY, **bold**, and `code`)",onChange:C=>v({statement:C.target.value})}):r.jsx("div",{className:"sp-statement",style:{"--sp-accent":x},children:c.statement.trim()?r.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:jr(c.statement)}}):r.jsx("div",{className:"muted",style:{fontSize:13},children:"Nothing to preview yet."})}),r.jsxs("div",{className:"sp-kw-legend",children:[r.jsx("span",{className:"label",children:"Keywords:"}),r.jsx("span",{className:"sp-kw sp-kw-must",children:"MUST"}),r.jsx("span",{className:"sp-kw sp-kw-should",children:"SHOULD"}),r.jsx("span",{className:"sp-kw sp-kw-may",children:"MAY"}),r.jsx("span",{className:"label",style:{marginLeft:4},children:"auto-highlight as you type"})]})]}),r.jsx(yn,{label:"Rationale",hint:"Read-only — the spec format carries no per-requirement rationale field, so Save can’t write one (REQ-TVIZ-009.A3).",children:r.jsx("textarea",{className:"input sp-textarea",value:c.rationale,spellCheck:!1,style:{minHeight:84},"aria-label":"Rationale",placeholder:"Why does this matter? What breaks without it?",disabled:!0,onChange:C=>v({rationale:C.target.value})})}),r.jsx(Kg,{criteria:c.criteria,onChange:C=>v({criteria:C})}),r.jsxs("div",{className:"row",style:{gap:10,marginTop:32,paddingTop:20,borderTop:"1px solid var(--border-subtle)"},children:[S,r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"}),r.jsx("div",{className:"grow"}),r.jsx("span",{className:"mono muted",style:{fontSize:11},children:u?"edited":"no changes"})]})]})})]})}function il(e){return t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e())}}const qg="Ideas";function Gg(e){const t=new Map,n=new Map(e.map(i=>[i.id,i])),s=(i,c)=>{let a=t.get(i);return a||(a={doc:c,path:i,reqs:[]},t.set(i,a)),c&&!a.doc&&(a.doc=c),a};for(const i of e)i.kind==="document"&&s(i.sourcePath??i.id,i);for(const i of e){if(i.kind!=="requirement")continue;const c=i.parentId?n.get(i.parentId):void 0,a=c?.sourcePath??i.sourcePath??"(unknown)";s(a,c?.kind==="document"?c:null).reqs.push(i)}const l=e.filter(i=>i.kind==="brief"),o=[...t.values()];return l.length?[{doc:null,path:qg,reqs:l,ideas:!0},...o]:o}const Yg=["verified","implemented","drifted","broken","orphaned"],Xg=["broken","orphaned","drifted"];function Jg({funnel:e}){if(!e)return null;const t=e.summary,n=t.links.drifted+t.links.broken+t.links.orphaned,s=[{label:"Ideas",value:t.ideas,color:"var(--info)"},{label:"Specified",value:t.specified},{label:"Documents",value:t.documents},{label:"Requirements",value:t.requirements},{label:"Implemented",value:t.links.implemented,color:"var(--node-spec)"},{label:"Verified",value:t.links.verified,color:"var(--success)"},{label:"Drift",value:n,color:n?"var(--warn)":"var(--success)"}];return r.jsxs("div",{className:"row gap-8","data-testid":"funnel-tiles",style:{padding:"12px 14px",flexWrap:"wrap",borderBottom:"1px solid var(--border-subtle)"},children:[s.map(l=>r.jsxs("div",{className:"card",title:l.label,style:{padding:"7px 12px",minWidth:92,background:"var(--bg-panel)"},children:[r.jsx("div",{className:"eyebrow",children:l.label}),r.jsx("div",{className:"mono tabular",style:{fontSize:17,fontWeight:600,color:l.color??"var(--text-primary)"},children:l.value})]},l.label)),e.summary.conflicts>0&&r.jsxs("div",{className:"row gap-6",style:{color:"var(--warn)",fontSize:11.5,alignSelf:"center"},children:[r.jsx(b,{name:"drift",size:13}),e.summary.conflicts," brief/spec conflict",e.summary.conflicts===1?"":"s"]})]})}function Zg({cov:e}){if(!e)return null;const t=e.testsLinks.count;return r.jsxs("span",{className:"row gap-4 mono tabular","data-testid":"coverage-chips",style:{fontSize:9.5,flexShrink:0},children:[r.jsxs("span",{title:e.implementsLinks.count+" code link(s)",style:{color:e.implementsLinks.count?"var(--node-spec)":"var(--text-faint)"},children:[e.implementsLinks.count,"c"]}),r.jsxs("span",{title:t+" proving test link(s)",style:{color:t?"var(--success)":"var(--warn)"},children:[t,"t"]}),r.jsx("span",{title:"Acceptance criteria with a proving test",style:{color:"var(--text-muted)"},children:e.criteriaWithTests+"/"+e.criteriaCount})]})}function ev({project:e,param:t,query:n}){const s=I(()=>M.specs(e),[e]),l=I(()=>M.specFunnel(e),[e]),o=I(()=>M.specCoverage(null,e),[e]),[i,c]=N.useState(t??n.sel??null);N.useEffect(()=>{const h=t??n.sel;h&&c(h)},[t,n.sel]);const[a,d]=N.useState(new Set),u=N.useRef(new Map).current,f=N.useMemo(()=>Gg(s.data?.specs??[]),[s.data]),m=s.data?.linkStates??{},g=N.useMemo(()=>new Map((o.data?.requirements??[]).map(h=>[h.specId,h])),[o.data]);if(kt(s.error))return r.jsx(se,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const y=f.reduce((h,x)=>h+x.reqs.length,0),p={};for(const h of f)for(const x of h.reqs){const j=m[x.id];j&&(p[j]=(p[j]??0)+1)}const w=h=>{const x=m[h.id];return!!x&&a.has(x)},v=h=>d(x=>{const j=new Set(x);return j.has(h)?j.delete(h):j.add(h),j});return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx(Jg,{funnel:l.data}),r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[r.jsxs("div",{className:"col",style:{width:280,flexShrink:0,borderRight:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:[r.jsxs("div",{className:"row",style:{gap:8,padding:"11px 12px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(b,{name:"book",size:15,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:13},children:"Specs"}),r.jsx("span",{className:"grow"}),r.jsx("span",{className:"muted tabular",style:{fontSize:11},children:s.data?y+" reqs":"…"})]}),r.jsxs("div",{className:"row",style:{gap:5,padding:"8px 10px",flexWrap:"wrap",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(b,{name:"filter",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),Yg.map(h=>{const x=!a.has(h),j=ie[h];return r.jsxs("button",{onClick:()=>v(h),className:"row gap-4",style:{height:22,padding:"0 8px",borderRadius:999,fontSize:10.5,fontWeight:500,cursor:"pointer",textTransform:"capitalize",border:"1px solid "+(x?"transparent":"var(--border-subtle)"),background:x?j.bg:"var(--bg-panel)",color:x?j.color:"var(--text-muted)"},children:[h,r.jsx("span",{className:"tabular",style:{opacity:.7},children:p[h]??0})]},h)})]}),r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:6},role:f.length?"tree":void 0,"aria-label":f.length?"Spec tree":void 0,children:[s.data&&!f.length&&r.jsx(se,{icon:"book",title:"No specs yet",body:"Author one with the spec-author skill — specs/*.md index on sync."}),f.map(h=>r.jsx(tv,{group:h,linkStates:m,coverage:g,selId:i,hidden:w,onSel:c},h.path))]})]}),r.jsx("div",{className:"col",style:{flex:1,minWidth:0},children:r.jsx(Mg,{id:i,project:e,cache:u},i??"")})]})]})}function tv({group:e,linkStates:t,coverage:n,selId:s,hidden:l,onSel:o}){const[i,c]=N.useState(!0),a=e.reqs.filter(g=>!l(g)),d=e.reqs.filter(g=>["drifted","broken","orphaned"].includes(t[g.id]??"")).length,u=Xg.find(g=>e.reqs.some(y=>t[y.id]===g))??null,f=e.reqs.map(g=>n.get(g.id)).filter(g=>!!g),m=f.length?{code:f.reduce((g,y)=>g+y.implementsLinks.count,0),tests:f.reduce((g,y)=>g+y.testsLinks.count,0),withTests:f.reduce((g,y)=>g+y.criteriaWithTests,0),criteria:f.reduce((g,y)=>g+y.criteriaCount,0)}:null;return e.ideas?r.jsx(nv,{group:e,reqs:a,selId:s,onSel:o}):r.jsxs("div",{children:[r.jsxs("div",{onClick:()=>c(!i),onKeyDown:il(()=>c(!i)),role:"treeitem","aria-expanded":i,tabIndex:0,className:"row gap-6 list-row","data-drift":u??void 0,title:u?`Worst link state in this document: ${u}`:void 0,style:{padding:"6px 8px",borderRadius:6,cursor:"pointer",color:"var(--text-secondary)",background:u?ie[u].bg:void 0},children:[r.jsx(b,{name:i?"chevronDown":"chevronRight",size:12,style:{color:"var(--text-muted)"}}),r.jsx(b,{name:"book",size:13,style:{color:u?ie[u].color:"var(--node-spec)"}}),r.jsx("span",{className:"mono grow",style:{fontSize:12,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path.replace(/^specs\//,"")}),m&&r.jsx("span",{className:"mono tabular","data-testid":"doc-rollup",title:`${m.code} code links · ${m.tests} test links · ${m.withTests} of ${m.criteria} criteria have a proving test`,style:{fontSize:9.5,color:"var(--text-muted)",flexShrink:0},children:m.code+"c "+m.tests+"t "+m.withTests+"/"+m.criteria}),d>0&&r.jsx("span",{className:"pill",style:{fontSize:9.5,color:"var(--warn)",background:"var(--warn-soft)"},children:d})]}),i&&a.length>0&&r.jsx("div",{role:"group",style:{marginLeft:14,borderLeft:"1px solid var(--border-subtle)",paddingLeft:6},children:a.map(g=>{const y=s===g.id,p=ie[t[g.id]??""]??ie.drafted;return r.jsxs("div",{onClick:()=>o(g.id),onKeyDown:il(()=>o(g.id)),role:"treeitem","aria-selected":y,tabIndex:0,className:"row gap-6 list-row"+(y?" selected":""),style:{padding:"5px 8px",borderRadius:6,cursor:"pointer"},children:[r.jsx("span",{className:"pill-dot",style:{background:p.color,flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:11,color:y?"var(--accent)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.id}),r.jsx("div",{className:"muted",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.title})]}),r.jsx(Zg,{cov:n.get(g.id)})]},g.id)})})]})}function nv({group:e,reqs:t,selId:n,onSel:s}){const[l,o]=N.useState(!0);return r.jsxs("div",{"data-testid":"ideas-branch",children:[r.jsxs("div",{onClick:()=>o(!l),onKeyDown:il(()=>o(!l)),role:"treeitem","aria-expanded":l,tabIndex:0,className:"row gap-6 list-row",style:{padding:"6px 8px",borderRadius:6,cursor:"pointer",color:"var(--info)",background:"var(--info-soft)"},children:[r.jsx(b,{name:l?"chevronDown":"chevronRight",size:12,style:{color:"var(--info)"}}),r.jsx(b,{name:"sparkles",size:13,style:{color:"var(--info)"}}),r.jsx("span",{className:"grow",style:{fontSize:12,fontWeight:600},children:e.path}),r.jsx("span",{className:"pill tabular",style:{fontSize:9.5,color:"var(--info)",background:"var(--info-soft)"},children:e.reqs.length})]}),l&&t.length>0&&r.jsx("div",{role:"group",style:{marginLeft:14,borderLeft:"1px solid var(--info-soft)",paddingLeft:6},children:t.map(i=>{const c=n===i.id,a=typeof i.metadata?.spec=="string";return r.jsxs("div",{onClick:()=>s(i.id),onKeyDown:il(()=>s(i.id)),role:"treeitem","aria-selected":c,tabIndex:0,className:"row gap-6 list-row"+(c?" selected":""),style:{padding:"5px 8px",borderRadius:6,cursor:"pointer"},children:[r.jsx("span",{className:"pill-dot",style:{background:a?"var(--node-spec)":"var(--info)",flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:11,color:c?"var(--accent)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.title}),r.jsx("div",{className:"mono muted",style:{fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.id})]}),a&&r.jsx("span",{className:"pill",title:"Already specified",style:{fontSize:9,color:"var(--node-spec)",background:"var(--node-spec-soft)",flexShrink:0},children:"spec’d"})]},i.id)})})]})}const Qc={untested:{label:"Untested",color:"var(--warn)",bg:"var(--warn-soft)"},tested:{label:"Tested",color:"var(--info)",bg:"var(--info-soft)"},verified:{label:"Verified",color:"var(--success)",bg:"var(--success-soft)"},broken:{label:"Broken",color:"var(--error)",bg:"var(--error-soft)"}},rv=["untested","tested","verified","broken"],qc={broken:0,untested:1,tested:2,verified:3};function sv(e,t,n,s,l){const o=e.map(a=>({specId:a.specId,title:a.title,doc:t.get(a.specId)??"—",code:a.implementsLinks.count,tests:a.testsLinks.count,criteriaWithTests:a.criteriaWithTests,criteriaCount:a.criteriaCount,verdict:a.verdict,driftAt:n.get(a.specId)??null})),i=l?1:-1,c={spec:(a,d)=>a.specId.localeCompare(d.specId),doc:(a,d)=>a.doc.localeCompare(d.doc)||a.specId.localeCompare(d.specId),code:(a,d)=>a.code-d.code,tests:(a,d)=>a.tests-d.tests,criteria:(a,d)=>(a.criteriaCount?a.criteriaWithTests/a.criteriaCount:0)-(d.criteriaCount?d.criteriaWithTests/d.criteriaCount:0),state:(a,d)=>qc[a.verdict]-qc[d.verdict],drift:(a,d)=>(a.driftAt??1/0)-(d.driftAt??1/0)};return o.sort((a,d)=>c[s](a,d)*i||a.specId.localeCompare(d.specId))}function lv({project:e}){const t=I(()=>M.specCoverage(null,e),[e]),n=I(()=>M.specs(e),[e]),s=I(()=>M.drift(e),[e]),[l,o]=N.useState("spec"),[i,c]=N.useState(!0),[a,d]=N.useState(""),[u,f]=N.useState(""),m=N.useMemo(()=>{const x=n.data?.specs??[],j=new Map(x.map(C=>[C.id,C])),S=new Map;for(const C of x){if(C.kind!=="requirement")continue;const E=C.parentId?j.get(C.parentId):void 0;S.set(C.id,(E?.sourcePath??C.sourcePath??"—").replace(/^specs\//,""))}return S},[n.data]),g=N.useMemo(()=>{const x=new Map;for(const j of s.data?.links??[])j.updatedAt&&x.set(j.specId,Math.max(x.get(j.specId)??0,j.updatedAt));return x},[s.data]),y=N.useMemo(()=>sv(t.data?.requirements??[],m,g,l,i),[t.data,m,g,l,i]),p=N.useMemo(()=>[...new Set(y.map(x=>x.doc))].sort(),[y]),w=y.filter(x=>(!a||x.doc===a)&&(!u||x.verdict===u));if(kt(t.error))return r.jsx(se,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});if(t.error)return r.jsx(se,{icon:"drift",title:"Coverage endpoint unavailable",body:"This view is backed by GET /api/spec/coverage, which this server didn’t answer. Update SpecShip and reload — the matrix will not guess at coverage from link states.",action:r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:t.reload,children:[r.jsx(b,{name:"refresh",size:13}),"Retry"]})});const v=t.data?.totals,h=(x,j,S,C)=>r.jsxs("button",{onClick:()=>{l===x?c(!i):(o(x),c(!0))},className:"row gap-4 eyebrow","aria-label":"Sort by "+j,style:{background:"none",border:"none",cursor:"pointer",padding:0,width:S,flex:S?void 0:1,justifyContent:C?"flex-end":"flex-start",color:l===x?"var(--accent)":void 0},children:[j,l===x&&r.jsx(b,{name:i?"chevronDown":"chevronRight",size:10})]});return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(ze,{icon:"matrix",title:"Traceability",sub:t.data?`${y.length} requirements · ${v?.criteriaWithTests??0} of ${v?.criteria??0} criteria have a proving test`:"Loading coverage…"})}),r.jsxs("div",{className:"row gap-8",style:{padding:"0 18px 12px",flexWrap:"wrap"},children:[r.jsx(b,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),r.jsxs("select",{className:"input","aria-label":"Filter by document",value:a,onChange:x=>d(x.target.value),style:{height:26,fontSize:11.5},children:[r.jsx("option",{value:"",children:"All documents"}),p.map(x=>r.jsx("option",{value:x,children:x},x))]}),r.jsxs("select",{className:"input","aria-label":"Filter by state",value:u,onChange:x=>f(x.target.value),style:{height:26,fontSize:11.5},children:[r.jsx("option",{value:"",children:"All states"}),rv.map(x=>r.jsx("option",{value:x,children:Qc[x].label},x))]}),r.jsxs("span",{className:"muted tabular",style:{fontSize:11},children:[w.length," shown"]})]}),r.jsxs("div",{className:"row gap-10",style:{padding:"6px 18px",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:[h("spec","Requirement",190),h("doc","Document",150),h("code","Code",54,!0),h("tests","Tests",54,!0),h("criteria","Criteria",74,!0),h("state","State",96),h("drift","Drift age",70,!0)]}),t.data&&!y.length?r.jsx(se,{icon:"book",title:"No requirements indexed",body:"Author a spec under specs/ and run a sync — the matrix fills from the coverage rollup."}):r.jsxs("div",{className:"scroll-y",style:{flex:1},role:"table","aria-label":"Traceability matrix",children:[w.map(x=>{const j=Qc[x.verdict],S=pn(x.driftAt??void 0);return r.jsxs("div",{role:"row",tabIndex:0,className:"row gap-10 list-row",onClick:()=>A("specs",{query:{sel:x.specId}}),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),A("specs",{query:{sel:x.specId}}))},style:{padding:"9px 18px",cursor:"pointer",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{style:{width:190,flexShrink:0,minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:11.5,color:"var(--node-spec)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.specId}),r.jsx("div",{className:"muted",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.title})]}),r.jsx("span",{className:"mono muted",style:{width:150,flexShrink:0,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.doc}),r.jsx("span",{className:"mono tabular",title:x.code+" code link(s)",style:{width:54,flexShrink:0,textAlign:"right",fontSize:12,color:x.code?"var(--node-spec)":"var(--text-faint)"},children:x.code}),r.jsx("span",{className:"mono tabular",title:x.tests+" proving test link(s)",style:{width:54,flexShrink:0,textAlign:"right",fontSize:12,color:x.tests?"var(--success)":"var(--warn)"},children:x.tests}),r.jsx("span",{className:"mono tabular muted",title:"Acceptance criteria with a proving test",style:{width:74,flexShrink:0,textAlign:"right",fontSize:12},children:x.criteriaWithTests+" / "+x.criteriaCount}),r.jsx("span",{style:{width:96,flexShrink:0},children:r.jsx(Q,{color:j.color,bg:j.bg,dot:!0,children:j.label})}),r.jsx("span",{className:"mono tabular",title:S?"Oldest unhealthy link, last changed":"No drifted, broken, or orphaned link",style:{width:70,flexShrink:0,textAlign:"right",fontSize:11,color:S?ie.drifted.color:"var(--text-faint)"},children:S??"—"})]},x.specId)}),t.data&&y.length>0&&!w.length&&r.jsx("div",{className:"muted",style:{padding:"18px",textAlign:"center",fontSize:12.5},children:"No requirement matches these filters."})]})]})}const Gc={error:0,warn:1,info:2},ov=e=>e==="error"?"var(--error)":e==="warn"?"var(--warn)":"var(--info)";function iv({query:e,tips:t,onSetTipState:n}){const s=I(()=>M.claudeStats(),[]),l=s.data?.sessionCount===0,o=e.sel,i=t.data?.tips??[],c=[...i].sort((d,u)=>(Gc[d.severity]??9)-(Gc[u.severity]??9)),a=d=>i.filter(u=>u.severity===d&&u.state!=="applied").length;return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(ze,{icon:"tips",title:"Tips",sub:"A senior teammate reviewed your transcripts",actions:i.length>0&&r.jsxs("div",{className:"row gap-6",children:[r.jsxs(Q,{color:"var(--error)",bg:"var(--error-soft)",children:[a("error")," urgent"]}),r.jsxs(Q,{color:"var(--warn)",bg:"var(--warn-soft)",children:[a("warn")," warn"]}),r.jsxs(Q,{color:"var(--info)",bg:"var(--info-soft)",children:[a("info")," info"]})]})}),l&&!i.length?r.jsx(Kn,{onIngested:()=>{s.reload(),t.reload()}}):r.jsx(oe,{state:t,label:"tips",minHeight:240,children:d=>d.tips.length?r.jsx("div",{className:"col gap-12",style:{maxWidth:860},children:c.map(u=>r.jsx(av,{tip:u,focus:u.id===o,onApply:()=>n(u.id,"applied"),onDismiss:()=>n(u.id,"dismissed")},u.id))}):r.jsx("div",{className:"muted",style:{fontSize:12.5,padding:8},children:"No tips — nothing wasteful in your recent sessions."})})]})}function av({tip:e,focus:t,onApply:n,onDismiss:s}){const[l,o]=N.useState(!1),i=N.useRef(null);N.useEffect(()=>{if(!t||!i.current)return;const d=i.current,u=d.closest(".scroll-y");u&&(u.scrollTop=Math.max(0,d.offsetTop-20)),o(!0);const f=setTimeout(()=>o(!1),1800);return()=>clearTimeout(f)},[t]);const c=ov(e.severity),a=e.state==="applied";return r.jsxs("div",{ref:i,className:"card",style:{display:"flex",opacity:a?.7:1,transition:"box-shadow var(--motion-fast), border-color var(--motion-fast)",boxShadow:l?`0 0 0 2px ${c}`:"none",borderColor:l?c:void 0},children:[r.jsx("div",{style:{width:3,background:c,flexShrink:0,borderRadius:"9px 0 0 9px"}}),r.jsxs("div",{style:{padding:"14px 16px",flex:1,minWidth:0},children:[r.jsxs("div",{className:"row gap-10",style:{marginBottom:10},children:[r.jsx("div",{style:{width:28,height:28,borderRadius:8,background:`color-mix(in srgb, ${c} 16%, transparent)`,display:"grid",placeItems:"center",color:c,flexShrink:0},children:r.jsx(b,{name:e.icon,size:15})}),r.jsx("div",{className:"grow",style:{minWidth:0},children:r.jsx("div",{style:{fontSize:14,fontWeight:600,letterSpacing:"-0.01em",textWrap:"pretty"},children:e.title})}),r.jsx(Q,{color:c,bg:`color-mix(in srgb, ${c} 14%, transparent)`,children:e.severity})]}),r.jsx("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.6,marginBottom:12},children:e.why}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:14},children:[r.jsxs("div",{onClick:()=>A("sessions",{query:{sel:e.evidence.session}}),role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),A("sessions",{query:{sel:e.evidence.session}}))},title:"Open session "+e.evidence.session,className:"list-row",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:10,cursor:"pointer"},children:[r.jsxs("div",{className:"row gap-6",style:{marginBottom:5},children:[r.jsx("span",{className:"eyebrow",children:"Evidence"}),r.jsx("span",{className:"grow"}),r.jsx(b,{name:"arrowRight",size:11,style:{color:"var(--text-muted)"}})]}),r.jsxs("div",{className:"row gap-6",style:{fontSize:11.5},children:[r.jsx(b,{name:"sessions",size:11,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono",style:{color:"var(--accent)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.evidence.session})]}),r.jsx("div",{className:"mono secondary",style:{fontSize:11,marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.evidence.detail})]}),r.jsxs("div",{style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:10},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:5},children:"Impact"}),r.jsx("div",{className:"tabular",style:{fontSize:16,fontWeight:700,color:"var(--success)"},children:e.saving})]})]}),r.jsxs("div",{className:"row gap-8",style:{alignItems:"center"},children:[r.jsxs("div",{className:"row gap-8 grow",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:"6px 10px",minWidth:0},children:[r.jsx("span",{className:"muted",style:{fontSize:10.5,flexShrink:0},children:"fix"}),r.jsx("code",{className:"mono grow",style:{fontSize:11.5,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.fix}),r.jsx(lt,{text:e.fix})]}),a?r.jsxs("span",{className:"pill",style:{color:"var(--success)",background:"var(--success-soft)"},children:[r.jsx(b,{name:"check",size:11}),"Applied"]}):r.jsx("button",{className:"btn btn-primary btn-sm",onClick:n,title:"Mark applied",children:"Apply"}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:s,title:"Dismiss — this tip won't come back",children:"Dismiss"})]})]})]})}const cv={bundled:"var(--node-spec)",global:"var(--node-code)",project:"var(--node-route)"};function dv({project:e,query:t}){const n=I(()=>M.workflows(e),[e]),s=n.data?.workflows??[],[l,o]=N.useState(t.run??null);if(kt(n.error))return r.jsx(se,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const i=l?s.find(c=>c.workflow.name===l):void 0;return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(ze,{icon:"workflow",title:"Workflows",sub:n.data?"Run a YAML-defined DAG of agent, shell and approval steps":"Loading workflows…"}),n.data&&!s.length&&r.jsx(se,{icon:"workflow",title:"No workflows found",body:"Add YAML definitions under .specship/workflows/ in this project or your home directory."}),r.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(340px, 1fr))",gap:12},children:s.map(({workflow:c,scope:a})=>{const d=cv[a]??"var(--text-secondary)";return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",gap:10},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:c.name}),r.jsx(Q,{color:d,bg:`color-mix(in srgb, ${d} 14%, transparent)`,children:a}),r.jsx("span",{className:"grow"}),r.jsxs("span",{className:"mono muted tabular",style:{fontSize:10.5},children:[c.nodes.length," nodes"]})]}),r.jsx("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.5,minHeight:36},children:c.description||"No description."}),r.jsxs("div",{className:"row gap-6",style:{flexWrap:"wrap",borderTop:"1px solid var(--border-subtle)",paddingTop:10},children:[(c.requires??[]).length>0&&r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"requires"}),(c.requires??[]).map(u=>r.jsx("code",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",background:"var(--bg-canvas)",padding:"1px 6px",borderRadius:4},children:u},u)),(c.inputs??[]).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"muted",style:{fontSize:10.5,marginLeft:6},children:"inputs"}),(c.inputs??[]).map(u=>r.jsxs("code",{className:"mono",style:{fontSize:10.5,color:"var(--node-spec)",background:"var(--node-spec-soft)",padding:"1px 6px",borderRadius:4},children:["$",u.name]},u.name))]}),r.jsx("span",{className:"grow"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>o(c.name),children:[r.jsx(b,{name:"play",size:13}),"Launch"]})]})]},c.name)})}),i&&r.jsx(uv,{wf:i.workflow,project:e,onClose:()=>o(null)})]})}function uv({wf:e,project:t,onClose:n}){const s=e.inputs??[],[l,o]=N.useState(()=>Object.fromEntries(s.filter(m=>m.default).map(m=>[m.name,m.default]))),[i,c]=N.useState(!1),[a,d]=N.useState(null),u=s.filter(m=>m.required&&!(l[m.name]??"").trim()),f=()=>{if(i||u.length)return;c(!0),d(null);const m=Object.fromEntries(Object.entries(l).filter(([,g])=>g.trim()));M.launchRun(e.name,m,t).then(g=>A("runs",{param:g.runId}),g=>{d(g instanceof Error?g.message:String(g)),c(!1)})};return r.jsx("div",{onMouseDown:n,role:"dialog","aria-label":"Launch "+e.name,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:90,display:"grid",placeItems:"center"},children:r.jsxs("div",{onMouseDown:m=>m.stopPropagation(),style:{width:460,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(b,{name:"workflow",size:16,style:{color:"var(--accent)"}}),r.jsx("span",{className:"mono grow",style:{fontWeight:600},children:e.name}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:n,"aria-label":"Close",children:r.jsx(b,{name:"x",size:14})})]}),r.jsxs("div",{style:{padding:16},children:[r.jsx("div",{className:"secondary",style:{fontSize:12.5,marginBottom:16,lineHeight:1.55},children:e.description||"No description."}),s.length?s.map(m=>r.jsxs("div",{style:{marginBottom:12},children:[r.jsxs("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"wf-input-"+m.name,children:[m.name,m.required&&r.jsx("span",{style:{color:"var(--error)"},children:" *"})]}),r.jsx("input",{id:"wf-input-"+m.name,className:"input mono",style:{width:"100%"},placeholder:m.description||(m.name==="SPEC_ID"?"REQ-AUTH-005":"value…"),value:l[m.name]||"",onChange:g=>o(y=>({...y,[m.name]:g.target.value})),onKeyDown:g=>{g.key==="Enter"&&f()}})]},m.name)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"8px 0"},children:"No inputs required."}),r.jsx("div",{className:"row gap-6",style:{marginTop:6,marginBottom:4},children:(e.requires??[]).map(m=>r.jsxs(Q,{children:[r.jsx(b,{name:"check",size:10}),m]},m))}),a&&r.jsxs("div",{className:"row gap-8",style:{marginTop:8,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[r.jsx(b,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:a})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:f,disabled:i||u.length>0,title:u.length?"Fill the required inputs: "+u.map(m=>m.name).join(", "):void 0,children:[r.jsx(b,{name:"play",size:13}),i?"Launching…":"Launch run"]})]})]})})}const ja=[{group:"Project",items:[{id:"dashboard",label:"Dashboard",icon:"dashboard"},{id:"graph",label:"Graph",icon:"graph"},{id:"specs",label:"Specs",icon:"book"},{id:"traceability",label:"Traceability",icon:"matrix"},{id:"drift",label:"Drift queue",icon:"drift",badge:e=>e.drift},{id:"runs",label:"Runs",icon:"play",badge:e=>e.runs,badgeKind:"warn"}]},{group:"Claude Code",items:[{id:"sessions",label:"Sessions",icon:"sessions"},{id:"heatmap",label:"Heatmap",icon:"heatmap"},{id:"costs",label:"Costs",icon:"dollar"},{id:"compare",label:"Compare projects",icon:"compare"},{id:"memory",label:"Memory",icon:"memory"},{id:"mcp",label:"MCP",icon:"plug"},{id:"tips",label:"Tips",icon:"tips",badge:e=>e.tips,badgeKind:"error"}]}],pv=[...ja.flatMap(e=>e.items.map(({id:t,label:n,icon:s})=>({id:t,label:n,icon:s}))),{id:"workflows",label:"Workflows",icon:"workflow"},{id:"designsystem",label:"Design system",icon:"layers"},{id:"settings",label:"Settings",icon:"settings"}],fv=ja.flatMap(e=>e.items.map(t=>t.id)).slice(0,7),hv={dashboard:tx,graph:_x,specs:ev,traceability:lv,drift:kx,runs:hg,workflows:dv,designsystem:()=>r.jsx(jx,{}),sessions:gg,heatmap:Rx,costs:Jm,compare:Gm,memory:Zx,mcp:Kx,settings:e=>r.jsx(bg,{...e})},uo="ss_project",Yc="ss_nav_groups",Xc="ss_nav_collapsed";function mv(){const{route:e,param:t,query:n}=pm(),[s,l]=N.useState(()=>{try{return localStorage.getItem(Xc)==="1"}catch{return!1}}),[o,i]=N.useState(()=>{try{return localStorage.getItem(uo)}catch{return null}}),[c,a]=N.useState(!1),[d,u]=N.useState(!1),f=I(()=>M.status(o),[o,e]),m=I(()=>M.projects(),[]),g=I(()=>M.runs(o),[o,e]),y=I(()=>M.claudeTips(),[e]),p=I(()=>M.drift(o),[o,e]),w=N.useCallback(()=>u(R=>!R),[]);zm({onTogglePalette:w,pageIds:fv});const v={drift:p.data?.links.length??f.data?.drift??0,runs:g.data?.runs.filter(R=>R.status==="running").length??0,tips:y.data?.tips.filter(R=>R.state!=="applied").length??0},h=N.useCallback(()=>u(!0),[]),x=N.useCallback((R,O)=>{M.setTipState(R,O).catch(()=>{}).finally(()=>y.reload())},[y.reload]),j=()=>l(R=>{try{localStorage.setItem(Xc,R?"0":"1")}catch{}return!R}),S=R=>{i(R);try{R?localStorage.setItem(uo,R):localStorage.removeItem(uo)}catch{}},C=()=>{a(!0),M.refresh(o).catch(()=>{}).finally(()=>{a(!1),f.reload()})},E=hv[e]??(()=>r.jsx(eg,{title:"Not found"}));return r.jsxs("div",{style:{display:"flex",height:"100%",position:"relative"},children:[r.jsx(xv,{route:e,collapsed:s,counts:v,version:f.data?.version,onToggleCollapse:j}),r.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[r.jsx(vv,{status:f.data,projectless:kt(f.error),projects:m.data?.projects??[],project:o,onPick:S,onRefresh:C,refreshing:c}),r.jsx(jv,{onToggle:j,onOpenPalette:h}),r.jsx("div",{"data-screen":e,style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:e==="tips"?r.jsx(iv,{project:o,param:t,query:n,tips:y,onSetTipState:x}):r.jsx(E,{project:o,param:t,query:n})},e+(t??""))]}),r.jsx(wm,{open:d,onClose:()=>u(!1),pages:pv,project:o})]})}function xv({route:e,collapsed:t,counts:n,version:s,onToggleCollapse:l}){const[o,i]=N.useState(()=>{try{return JSON.parse(localStorage.getItem(Yc)||"null")||{}}catch{return{}}}),c=d=>o[d]!==!1,a=d=>i(u=>{const f={...u,[d]:u[d]===!1};try{localStorage.setItem(Yc,JSON.stringify(f))}catch{}return f});return r.jsxs("nav",{style:{width:t?"var(--sidebar-w-collapsed)":"var(--sidebar-w)",flexShrink:0,background:"var(--bg-panel)",borderRight:"1px solid var(--border-subtle)",display:"flex",flexDirection:"column",transition:"width 120ms",overflow:"hidden"},children:[r.jsxs("div",{className:"row gap-8",onClick:l,title:t?"Expand menu":"Collapse menu",style:{padding:t?"14px 0":"15px 16px",justifyContent:t?"center":"flex-start",cursor:"pointer",userSelect:"none"},children:[r.jsx(hm,{size:26}),!t&&r.jsx("div",{className:"grow",style:{fontWeight:600,fontSize:13.5,letterSpacing:"-0.01em"},children:"SpecShip"})]}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"4px 8px"},children:ja.map(d=>r.jsxs("div",{style:{marginBottom:t?10:4},children:[!t&&r.jsxs("button",{onClick:()=>a(d.group),className:"row gap-6",style:{width:"100%",padding:"8px 8px 4px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[r.jsx("span",{className:"eyebrow grow",children:d.group}),r.jsx(b,{name:c(d.group)?"chevronDown":"chevronRight",size:12,style:{color:"var(--text-muted)"}})]}),(t||c(d.group))&&d.items.map(u=>r.jsx(po,{item:u,active:e===u.id,collapsed:t,counts:n},u.id))]},d.group))}),r.jsxs("div",{style:{padding:8,borderTop:"1px solid var(--border-subtle)"},children:[r.jsx(po,{item:{id:"designsystem",label:"Design system",icon:"layers"},active:e==="designsystem",collapsed:t}),r.jsx(po,{item:{id:"settings",label:"Settings",icon:"settings"},active:e==="settings",collapsed:t}),s&&r.jsx("div",{className:"mono tabular",title:`SpecShip v${s}`,"data-testid":"app-version",style:{padding:t?"6px 0 2px":"6px 10px 2px",fontSize:10.5,color:"var(--text-muted)",textAlign:t?"center":"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t?s:`v${s}`})]})]})}function po({item:e,active:t,collapsed:n,counts:s}){const l=c=>{c.metaKey||c.ctrlKey||c.shiftKey||c.button!==0||(c.preventDefault(),A(e.id))},o=e.badge&&s?e.badge(s):0,i=e.badgeKind;return r.jsxs("a",{href:"/"+e.id,onClick:l,title:n?e.label:void 0,className:"list-row",style:{display:"flex",alignItems:"center",gap:10,height:32,padding:n?0:"0 10px",justifyContent:n?"center":"flex-start",borderRadius:7,textDecoration:"none",marginBottom:1,color:t?"var(--text-primary)":"var(--text-secondary)",background:t?"var(--bg-active)":void 0,fontWeight:t?600:450,fontSize:13,position:"relative"},children:[t&&r.jsx("span",{style:{position:"absolute",left:0,top:7,bottom:7,width:2.5,borderRadius:2,background:"var(--accent)"}}),r.jsx(b,{name:e.icon,size:16,style:{color:t?"var(--accent)":"inherit",flexShrink:0}}),!n&&r.jsx("span",{className:"grow",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),!n&&o>0&&r.jsx("span",{className:"pill tabular",style:{fontSize:10,fontWeight:700,padding:"1px 6px",minWidth:18,justifyContent:"center",color:i==="error"?"var(--error)":i==="warn"?"var(--warn)":"var(--text-secondary)",background:i==="error"?"var(--error-soft)":i==="warn"?"var(--warn-soft)":"rgba(255,255,255,0.06)"},children:o}),n&&o>0&&r.jsx("span",{style:{position:"absolute",top:5,right:9,width:6,height:6,borderRadius:"50%",background:i==="error"?"var(--error)":"var(--warn)"}})]})}function gv({projects:e,project:t,projectPath:n,onPick:s}){const[l,o]=N.useState(!1),i=N.useRef(null),[c,a]=N.useState(null),d=()=>{if(!l){const g=i.current?.getBoundingClientRect();a(g?{top:g.bottom+5,left:g.left}:null)}o(g=>!g)};N.useEffect(()=>{if(!l)return;const g=y=>{y.target.closest("[data-projsw]")||o(!1)};return window.addEventListener("mousedown",g),()=>window.removeEventListener("mousedown",g)},[l]);const u=e.filter(g=>g.initialized),f=t??"",m=n||(t??"pick a project");return r.jsxs("div",{"data-projsw":"1",style:{position:"relative",flexShrink:0},children:[r.jsxs("button",{ref:i,onClick:d,className:"row gap-6",title:"Switch project",style:{height:24,padding:"0 8px",borderRadius:6,cursor:"pointer",background:l?"var(--bg-hover)":"transparent",border:"1px solid "+(l?"var(--border-strong)":"transparent"),transition:"background var(--motion-fast), border-color var(--motion-fast)"},children:[r.jsx(b,{name:"folder",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"mono",style:{fontSize:11.5,color:"var(--text-primary)",maxWidth:280,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m}),r.jsx(b,{name:"chevronDown",size:12,style:{color:"var(--text-muted)",flexShrink:0}})]}),l&&r.jsxs("div",{style:{position:"fixed",top:c?.top??34,left:c?.left??8,minWidth:264,background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:9,boxShadow:"var(--shadow-pop)",padding:5,zIndex:60},children:[r.jsx("div",{className:"eyebrow",style:{padding:"5px 8px 6px"},children:"Indexed projects"}),r.jsxs("button",{className:"row gap-8",onClick:()=>{s(null),o(!1)},style:Jc(f===""),children:[r.jsx(b,{name:"folder",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"grow",style:{textAlign:"left",fontSize:12.5},children:"Primary project"}),f===""&&r.jsx(b,{name:"check",size:13,style:{color:"var(--accent)",flexShrink:0}})]}),u.map(g=>{const y=g.slug===f;return r.jsxs("button",{className:"row gap-8",onClick:()=>{s(g.slug),o(!1)},style:Jc(y),children:[r.jsx(b,{name:"folder",size:13,style:{color:y?"var(--accent)":"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"grow mono",style:{textAlign:"left",fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.path}),(g.driftCount??0)>0&&r.jsxs("span",{className:"pill tabular",style:{fontSize:9.5,color:"var(--warn)",background:"var(--warn-soft)",flexShrink:0},children:[g.driftCount," drift"]}),y&&r.jsx(b,{name:"check",size:13,style:{color:"var(--accent)",flexShrink:0}})]},g.slug)}),!u.length&&r.jsx("div",{className:"muted",style:{padding:"6px 8px",fontSize:12},children:"No initialized projects found."})]})]})}function Jc(e){return{width:"100%",textAlign:"left",padding:"7px 8px",borderRadius:6,cursor:"pointer",border:"none",background:e?"var(--bg-active)":"transparent"}}function vv({status:e,projectless:t,projects:n,project:s,onPick:l,onRefresh:o,refreshing:i}){const c=(u,f,m)=>r.jsxs("div",{className:"row gap-6",style:{flexShrink:0},children:[r.jsx("span",{className:"muted",style:{fontSize:11},children:u}),r.jsx("span",{className:"mono tabular",style:{fontSize:11.5,color:m||"var(--text-secondary)"},children:f})]}),a=r.jsx("span",{style:{width:1,height:12,background:"var(--border-subtle)",flexShrink:0}}),d=e?.lastIndexed?new Date(e.lastIndexed).toLocaleString():"—";return r.jsxs("div",{style:{height:"var(--status-h)",flexShrink:0,display:"flex",alignItems:"center",gap:14,padding:"0 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel-2)",overflow:"hidden",whiteSpace:"nowrap"},children:[r.jsx(gv,{projects:n,project:s,projectPath:e?.projectPath??null,onPick:l}),a,c("nodes",e?e.nodeCount.toLocaleString():t?"—":"…"),c("edges",e?e.edgeCount.toLocaleString():t?"—":"…"),a,c("drift",e?String(e.drift):"—",e?e.drift?"var(--warn)":"var(--success)":void 0),r.jsx("div",{className:"grow"}),c("indexed",d),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:o,title:"Refresh now","aria-label":"Refresh now",children:r.jsx(b,{name:"refresh",size:12,style:{animation:i?"spin 0.8s linear infinite":"none"}})})]})}const yv={fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:4,padding:"2px 6px"};function jv({onToggle:e,onOpenPalette:t}){return r.jsxs("div",{style:{height:44,flexShrink:0,display:"flex",alignItems:"center",gap:10,padding:"0 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-canvas)"},children:[r.jsx("button",{className:"btn btn-ghost",onClick:e,style:{padding:6},title:"Toggle sidebar","aria-label":"Toggle sidebar",children:r.jsx(b,{name:"menu",size:16})}),r.jsxs("button",{onClick:t,className:"row gap-8",style:{flex:1,maxWidth:380,height:30,padding:"0 11px",background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",borderRadius:8,cursor:"text",color:"var(--text-muted)",fontSize:12.5},children:[r.jsx(b,{name:"search",size:14}),r.jsx("span",{className:"grow",style:{textAlign:"left"},children:"Search or jump to…"}),r.jsx("kbd",{style:yv,children:"⌘K"})]}),r.jsx("div",{className:"grow"}),r.jsx(wv,{}),r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:t,title:"Command palette","aria-label":"Command palette",children:r.jsx(b,{name:"command",size:14})})]})}function wv(){const[e,t]=N.useState(Nl()),n={dark:"light",light:"system",system:"dark"},s={dark:"moon",light:"sun",system:"monitor"},l=n[e];return r.jsx("button",{className:"btn btn-ghost btn-sm",title:"Theme: "+e+" — switch to "+l,"aria-label":"Theme: "+e+" — switch to "+l,onClick:()=>{zl(l),t(l)},children:r.jsx(b,{name:s[e],size:15})})}zl(Nl());Em();Rp(_p());fo.createRoot(document.getElementById("root")).render(r.jsx(Xp.StrictMode,{children:r.jsx(mv,{})}));