maestro-flow 0.4.2 → 0.4.4

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 (302) hide show
  1. package/.claude/commands/maestro-analyze.md +1 -1
  2. package/.claude/commands/maestro-brainstorm.md +1 -1
  3. package/.claude/commands/maestro-collab.md +1 -1
  4. package/.claude/commands/maestro-execute.md +10 -1
  5. package/.claude/commands/maestro-guard.md +101 -0
  6. package/.claude/commands/maestro-impeccable.md +1 -1
  7. package/.claude/commands/maestro-plan.md +15 -2
  8. package/.claude/commands/maestro-ralph-execute.md +9 -2
  9. package/.claude/commands/maestro-ralph.md +8 -1
  10. package/.claude/commands/maestro-verify.md +15 -1
  11. package/.claude/commands/quality-auto-test.md +1 -1
  12. package/.claude/commands/quality-debug.md +1 -1
  13. package/.claude/commands/quality-refactor.md +1 -1
  14. package/.claude/commands/quality-retrospective.md +1 -1
  15. package/.claude/commands/quality-review.md +15 -1
  16. package/.claude/commands/quality-test.md +1 -1
  17. package/.claude/commands/security-audit.md +154 -0
  18. package/.claude/skills/maestro-help/index/catalog.json +2 -0
  19. package/.codex/skills/maestro-analyze/SKILL.md +18 -1
  20. package/.codex/skills/maestro-brainstorm/SKILL.md +17 -4
  21. package/.codex/skills/maestro-collab/SKILL.md +7 -1
  22. package/.codex/skills/maestro-execute/SKILL.md +365 -348
  23. package/.codex/skills/maestro-guard/SKILL.md +97 -0
  24. package/.codex/skills/maestro-impeccable/SKILL.md +1 -1
  25. package/.codex/skills/maestro-plan/SKILL.md +66 -7
  26. package/.codex/skills/maestro-ralph/SKILL.md +1 -1
  27. package/.codex/skills/maestro-verify/SKILL.md +18 -1
  28. package/.codex/skills/quality-auto-test/SKILL.md +13 -3
  29. package/.codex/skills/quality-debug/SKILL.md +362 -346
  30. package/.codex/skills/quality-refactor/SKILL.md +1 -1
  31. package/.codex/skills/quality-retrospective/SKILL.md +292 -292
  32. package/.codex/skills/quality-review/SKILL.md +374 -365
  33. package/.codex/skills/quality-test/SKILL.md +1 -1
  34. package/.codex/skills/security-audit/SKILL.md +154 -0
  35. package/bin/maestro-hook-runner.js +21 -1
  36. package/dashboard/dist/assets/{ArtifactsPage-iJZtYsmR.js → ArtifactsPage-CVh0Z2I2.js} +3 -3
  37. package/dashboard/dist/assets/{ChatInput-DNnDLdQF.js → ChatInput-CBI3qHQQ.js} +2 -2
  38. package/dashboard/dist/assets/ChatPage-BjJ9CYox.js +22 -0
  39. package/dashboard/dist/assets/CollabPage-CprGGO9y.js +1 -0
  40. package/dashboard/dist/assets/{ExecutionPanel-BKV3GZ7Q.js → ExecutionPanel-CClxD7cH.js} +1 -1
  41. package/dashboard/dist/assets/KanbanPage-copqjdPg.js +16 -0
  42. package/dashboard/dist/assets/MaestroCoordinatePage-CioZjQ9N.js +4 -0
  43. package/dashboard/dist/assets/{MarkdownRenderer-cYFfe1uX.js → MarkdownRenderer-CtUhoxCT.js} +1 -1
  44. package/dashboard/dist/assets/McpPage-BcPPcJpr.js +21 -0
  45. package/dashboard/dist/assets/{MeetingRoomPage-wnvT7wlB.js → MeetingRoomPage-BgmAKxU-.js} +1 -1
  46. package/dashboard/dist/assets/{OutputPanel-DDL90Idy.js → OutputPanel-DgT3gMyp.js} +1 -1
  47. package/dashboard/dist/assets/{ProblemsPanel-zFN9IIs0.js → ProblemsPanel-BmG7rxoG.js} +1 -1
  48. package/dashboard/dist/assets/{RequirementBoardPage-DOPJoT0I.js → RequirementBoardPage-k8YoeQ0r.js} +1 -1
  49. package/dashboard/dist/assets/{RequirementPage-CEVquRgM.js → RequirementPage-Da2354px.js} +1 -1
  50. package/dashboard/dist/assets/{RoomsPage-D5USEWDh.js → RoomsPage-BtqDiYaU.js} +1 -1
  51. package/dashboard/dist/assets/SpecsPage-ByPVH_M3.js +36 -0
  52. package/dashboard/dist/assets/{TeamsPage-DlcEmr_Q.js → TeamsPage-sFDLN30L.js} +1 -1
  53. package/dashboard/dist/assets/{TreeBrowser-Y48Wz-QY.js → TreeBrowser-oEx8YJXV.js} +1 -1
  54. package/dashboard/dist/assets/WorkflowPage-JrX7CVHh.js +6 -0
  55. package/dashboard/dist/assets/{arrow-left-NCUOENvg.js → arrow-left-DYvgSdIH.js} +1 -1
  56. package/dashboard/dist/assets/{check-o7nfGNHf.js → check-jcgYBWVR.js} +1 -1
  57. package/dashboard/dist/assets/{chevron-right-BXySK2fn.js → chevron-right-DvZ5sMOg.js} +1 -1
  58. package/dashboard/dist/assets/{circle-cooAwnAR.js → circle-DYT-zoRZ.js} +1 -1
  59. package/dashboard/dist/assets/{circle-alert-DcSBokh4.js → circle-alert-Bfbv3gt4.js} +1 -1
  60. package/dashboard/dist/assets/{circle-check-Cd-jce4j.js → circle-check-D82WnpbI.js} +1 -1
  61. package/dashboard/dist/assets/{circle-check-big-BN7Mdp4i.js → circle-check-big-CPVD1GKF.js} +1 -1
  62. package/dashboard/dist/assets/{code-BQa9oL1n.js → code-B3bKFGI4.js} +1 -1
  63. package/dashboard/dist/assets/{columns-3-BzgxelGx.js → columns-3-BeMAQCix.js} +1 -1
  64. package/dashboard/dist/assets/{download-swRJnate.js → download-BCtpoWYB.js} +1 -1
  65. package/dashboard/dist/assets/en-2h6fD0j8.js +1 -0
  66. package/dashboard/dist/assets/{folder-DbGbLNFN.js → folder-CTj6SNNu.js} +1 -1
  67. package/dashboard/dist/assets/index-6-yE5Yl9.css +1 -0
  68. package/dashboard/dist/assets/{index-DIoMBMbv.js → index-BxR_3IbJ.js} +1 -1
  69. package/dashboard/dist/assets/{index-DLBN_7fb.js → index-CWBJLu42.js} +1 -1
  70. package/dashboard/dist/assets/index-DpcPd-UG.js +236 -0
  71. package/dashboard/dist/assets/{list-BTRAIvDq.js → list-BMv8pIQn.js} +1 -1
  72. package/dashboard/dist/assets/{loader-NHtB6Mdn.js → loader-DdM4VOgF.js} +1 -1
  73. package/dashboard/dist/assets/{minus-BjMxRTET.js → minus-D15s2E__.js} +1 -1
  74. package/dashboard/dist/assets/{pen-line-C4_O16H0.js → pen-line-DO6o4xWz.js} +1 -1
  75. package/dashboard/dist/assets/{pencil-DTmKhyDY.js → pencil-qGxg9jOe.js} +1 -1
  76. package/dashboard/dist/assets/{proxy-Dtx5p6IO.js → proxy-DOffTzwA.js} +1 -1
  77. package/dashboard/dist/assets/refresh-cw-C9UNdLCy.js +6 -0
  78. package/dashboard/dist/assets/{rows-2-GR1dZtRu.js → rows-2-CifAA5SL.js} +1 -1
  79. package/dashboard/dist/assets/{search-DVtgy2W7.js → search-pe7pU1YN.js} +1 -1
  80. package/dashboard/dist/assets/{shallow-BOmvDNsv.js → shallow-r7YynQYA.js} +1 -1
  81. package/dashboard/dist/assets/table-Bh772iIw.js +6 -0
  82. package/dashboard/dist/assets/{team-types-BPeOvVdA.js → team-types-C_HqX2p2.js} +1 -1
  83. package/dashboard/dist/assets/{terminal-CzogW4cl.js → terminal-EpmtGBlw.js} +1 -1
  84. package/dashboard/dist/assets/{trash-2-52LATVfW.js → trash-2-Xen46iNQ.js} +1 -1
  85. package/dashboard/dist/assets/{users-DLFE2voE.js → users-BLueDPxF.js} +1 -1
  86. package/dashboard/dist/assets/{zap-DhiYlgyZ.js → zap-DsQCPF61.js} +1 -1
  87. package/dashboard/dist/assets/zh-CN-r3AvxxOL.js +1 -0
  88. package/dashboard/dist/index.html +2 -2
  89. package/dashboard/dist-server/dashboard/src/server/routes/settings.js +70 -1
  90. package/dashboard/dist-server/dashboard/src/server/routes/settings.js.map +1 -1
  91. package/dashboard/dist-server/src/coordinator/output-parser.js +27 -0
  92. package/dashboard/dist-server/src/coordinator/output-parser.js.map +1 -1
  93. package/dashboard/dist-server/src/types/index.d.ts +48 -6
  94. package/dist/src/commands/coordinate.d.ts.map +1 -1
  95. package/dist/src/commands/coordinate.js +4 -0
  96. package/dist/src/commands/coordinate.js.map +1 -1
  97. package/dist/src/commands/hooks.d.ts.map +1 -1
  98. package/dist/src/commands/hooks.js +239 -8
  99. package/dist/src/commands/hooks.js.map +1 -1
  100. package/dist/src/commands/spec.d.ts.map +1 -1
  101. package/dist/src/commands/spec.js +466 -0
  102. package/dist/src/commands/spec.js.map +1 -1
  103. package/dist/src/config/index.d.ts +5 -1
  104. package/dist/src/config/index.d.ts.map +1 -1
  105. package/dist/src/config/index.js +42 -0
  106. package/dist/src/config/index.js.map +1 -1
  107. package/dist/src/coordinator/output-parser.d.ts.map +1 -1
  108. package/dist/src/coordinator/output-parser.js +27 -0
  109. package/dist/src/coordinator/output-parser.js.map +1 -1
  110. package/dist/src/hooks/delegate-monitor.d.ts +1 -0
  111. package/dist/src/hooks/delegate-monitor.d.ts.map +1 -1
  112. package/dist/src/hooks/delegate-monitor.js +1 -1
  113. package/dist/src/hooks/delegate-monitor.js.map +1 -1
  114. package/dist/src/hooks/guards/workflow-guard.d.ts +15 -0
  115. package/dist/src/hooks/guards/workflow-guard.d.ts.map +1 -1
  116. package/dist/src/hooks/guards/workflow-guard.js +61 -1
  117. package/dist/src/hooks/guards/workflow-guard.js.map +1 -1
  118. package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -1
  119. package/dist/src/hooks/keyword-spec-injector.js +63 -4
  120. package/dist/src/hooks/keyword-spec-injector.js.map +1 -1
  121. package/dist/src/hooks/plugins/decision-log-plugin.d.ts +19 -0
  122. package/dist/src/hooks/plugins/decision-log-plugin.d.ts.map +1 -0
  123. package/dist/src/hooks/plugins/decision-log-plugin.js +28 -0
  124. package/dist/src/hooks/plugins/decision-log-plugin.js.map +1 -0
  125. package/dist/src/hooks/plugins/index.d.ts +2 -0
  126. package/dist/src/hooks/plugins/index.d.ts.map +1 -1
  127. package/dist/src/hooks/plugins/index.js +1 -0
  128. package/dist/src/hooks/plugins/index.js.map +1 -1
  129. package/dist/src/hooks/plugins/spec-analytics-plugin.d.ts +13 -0
  130. package/dist/src/hooks/plugins/spec-analytics-plugin.d.ts.map +1 -0
  131. package/dist/src/hooks/plugins/spec-analytics-plugin.js +92 -0
  132. package/dist/src/hooks/plugins/spec-analytics-plugin.js.map +1 -0
  133. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts.map +1 -1
  134. package/dist/src/hooks/plugins/spec-injection-plugin.js +57 -4
  135. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  136. package/dist/src/hooks/session-context.d.ts +1 -0
  137. package/dist/src/hooks/session-context.d.ts.map +1 -1
  138. package/dist/src/hooks/session-context.js +1 -1
  139. package/dist/src/hooks/session-context.js.map +1 -1
  140. package/dist/src/hooks/skill-context.d.ts +1 -0
  141. package/dist/src/hooks/skill-context.d.ts.map +1 -1
  142. package/dist/src/hooks/skill-context.js +1 -1
  143. package/dist/src/hooks/skill-context.js.map +1 -1
  144. package/dist/src/hooks/spec-analytics.d.ts +128 -0
  145. package/dist/src/hooks/spec-analytics.d.ts.map +1 -0
  146. package/dist/src/hooks/spec-analytics.js +311 -0
  147. package/dist/src/hooks/spec-analytics.js.map +1 -0
  148. package/dist/src/hooks/spec-injector.d.ts.map +1 -1
  149. package/dist/src/hooks/spec-injector.js +129 -5
  150. package/dist/src/hooks/spec-injector.js.map +1 -1
  151. package/dist/src/tools/spec-loader.d.ts +20 -0
  152. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  153. package/dist/src/tools/spec-loader.js +58 -7
  154. package/dist/src/tools/spec-loader.js.map +1 -1
  155. package/dist/src/tui/config-ui/ConfigHub.d.ts +1 -1
  156. package/dist/src/tui/config-ui/ConfigHub.d.ts.map +1 -1
  157. package/dist/src/tui/config-ui/ConfigHub.js +16 -10
  158. package/dist/src/tui/config-ui/ConfigHub.js.map +1 -1
  159. package/dist/src/tui/config-ui/ConfigSourcesView.d.ts.map +1 -1
  160. package/dist/src/tui/config-ui/ConfigSourcesView.js +3 -2
  161. package/dist/src/tui/config-ui/ConfigSourcesView.js.map +1 -1
  162. package/dist/src/tui/config-ui/HooksPanel.d.ts.map +1 -1
  163. package/dist/src/tui/config-ui/HooksPanel.js +15 -19
  164. package/dist/src/tui/config-ui/HooksPanel.js.map +1 -1
  165. package/dist/src/tui/config-ui/SkillConfigDashboard.d.ts.map +1 -1
  166. package/dist/src/tui/config-ui/SkillConfigDashboard.js +5 -9
  167. package/dist/src/tui/config-ui/SkillConfigDashboard.js.map +1 -1
  168. package/dist/src/tui/config-ui/SkillParamEditor.d.ts.map +1 -1
  169. package/dist/src/tui/config-ui/SkillParamEditor.js +1 -3
  170. package/dist/src/tui/config-ui/SkillParamEditor.js.map +1 -1
  171. package/dist/src/tui/config-ui/SkillsList.d.ts.map +1 -1
  172. package/dist/src/tui/config-ui/SkillsList.js +7 -9
  173. package/dist/src/tui/config-ui/SkillsList.js.map +1 -1
  174. package/dist/src/tui/config-ui/SpecAnalyticsPanel.d.ts +6 -0
  175. package/dist/src/tui/config-ui/SpecAnalyticsPanel.d.ts.map +1 -0
  176. package/dist/src/tui/config-ui/SpecAnalyticsPanel.js +164 -0
  177. package/dist/src/tui/config-ui/SpecAnalyticsPanel.js.map +1 -0
  178. package/dist/src/tui/config-ui/SpecPanel.d.ts.map +1 -1
  179. package/dist/src/tui/config-ui/SpecPanel.js +918 -20
  180. package/dist/src/tui/config-ui/SpecPanel.js.map +1 -1
  181. package/dist/src/tui/config-ui/index.d.ts +3 -1
  182. package/dist/src/tui/config-ui/index.d.ts.map +1 -1
  183. package/dist/src/tui/config-ui/index.js +4 -0
  184. package/dist/src/tui/config-ui/index.js.map +1 -1
  185. package/dist/src/tui/install-ui/BackupConfig.d.ts.map +1 -1
  186. package/dist/src/tui/install-ui/BackupConfig.js +3 -2
  187. package/dist/src/tui/install-ui/BackupConfig.js.map +1 -1
  188. package/dist/src/tui/install-ui/BlueprintPreview.d.ts.map +1 -1
  189. package/dist/src/tui/install-ui/BlueprintPreview.js +7 -6
  190. package/dist/src/tui/install-ui/BlueprintPreview.js.map +1 -1
  191. package/dist/src/tui/install-ui/ComponentGrid.d.ts.map +1 -1
  192. package/dist/src/tui/install-ui/ComponentGrid.js +3 -2
  193. package/dist/src/tui/install-ui/ComponentGrid.js.map +1 -1
  194. package/dist/src/tui/install-ui/ConfigPanel.d.ts.map +1 -1
  195. package/dist/src/tui/install-ui/ConfigPanel.js +4 -3
  196. package/dist/src/tui/install-ui/ConfigPanel.js.map +1 -1
  197. package/dist/src/tui/install-ui/CyberItem.d.ts.map +1 -1
  198. package/dist/src/tui/install-ui/CyberItem.js +7 -6
  199. package/dist/src/tui/install-ui/CyberItem.js.map +1 -1
  200. package/dist/src/tui/install-ui/CyberdeckBlueprint.d.ts.map +1 -1
  201. package/dist/src/tui/install-ui/CyberdeckBlueprint.js +2 -1
  202. package/dist/src/tui/install-ui/CyberdeckBlueprint.js.map +1 -1
  203. package/dist/src/tui/install-ui/ExecutionView.d.ts.map +1 -1
  204. package/dist/src/tui/install-ui/ExecutionView.js +3 -2
  205. package/dist/src/tui/install-ui/ExecutionView.js.map +1 -1
  206. package/dist/src/tui/install-ui/GradientHeader.d.ts.map +1 -1
  207. package/dist/src/tui/install-ui/GradientHeader.js +2 -1
  208. package/dist/src/tui/install-ui/GradientHeader.js.map +1 -1
  209. package/dist/src/tui/install-ui/HooksConfig.d.ts.map +1 -1
  210. package/dist/src/tui/install-ui/HooksConfig.js +8 -8
  211. package/dist/src/tui/install-ui/HooksConfig.js.map +1 -1
  212. package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
  213. package/dist/src/tui/install-ui/InstallConfirm.js +4 -3
  214. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  215. package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
  216. package/dist/src/tui/install-ui/InstallExecution.js +3 -2
  217. package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
  218. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  219. package/dist/src/tui/install-ui/InstallFlow.js +3 -2
  220. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  221. package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
  222. package/dist/src/tui/install-ui/InstallHub.js +9 -8
  223. package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
  224. package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
  225. package/dist/src/tui/install-ui/InstallResult.js +3 -2
  226. package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
  227. package/dist/src/tui/install-ui/McpConfig.d.ts.map +1 -1
  228. package/dist/src/tui/install-ui/McpConfig.js +4 -3
  229. package/dist/src/tui/install-ui/McpConfig.js.map +1 -1
  230. package/dist/src/tui/install-ui/ResultDashboard.d.ts.map +1 -1
  231. package/dist/src/tui/install-ui/ResultDashboard.js +3 -2
  232. package/dist/src/tui/install-ui/ResultDashboard.js.map +1 -1
  233. package/dist/src/tui/install-ui/ReviewPanel.d.ts.map +1 -1
  234. package/dist/src/tui/install-ui/ReviewPanel.js +2 -1
  235. package/dist/src/tui/install-ui/ReviewPanel.js.map +1 -1
  236. package/dist/src/tui/install-ui/StatuslineConfig.d.ts.map +1 -1
  237. package/dist/src/tui/install-ui/StatuslineConfig.js +3 -2
  238. package/dist/src/tui/install-ui/StatuslineConfig.js.map +1 -1
  239. package/dist/src/tui/install-ui/StepSelector.d.ts.map +1 -1
  240. package/dist/src/tui/install-ui/StepSelector.js +11 -10
  241. package/dist/src/tui/install-ui/StepSelector.js.map +1 -1
  242. package/dist/src/tui/overlay-ui/OverlayList.d.ts.map +1 -1
  243. package/dist/src/tui/overlay-ui/OverlayList.js +8 -12
  244. package/dist/src/tui/overlay-ui/OverlayList.js.map +1 -1
  245. package/dist/src/tui/shared/components.d.ts +56 -0
  246. package/dist/src/tui/shared/components.d.ts.map +1 -0
  247. package/dist/src/tui/shared/components.js +55 -0
  248. package/dist/src/tui/shared/components.js.map +1 -0
  249. package/dist/src/tui/shared/helpers.d.ts +24 -0
  250. package/dist/src/tui/shared/helpers.d.ts.map +1 -0
  251. package/dist/src/tui/shared/helpers.js +49 -0
  252. package/dist/src/tui/shared/helpers.js.map +1 -0
  253. package/dist/src/tui/shared/index.d.ts +4 -0
  254. package/dist/src/tui/shared/index.d.ts.map +1 -0
  255. package/dist/src/tui/shared/index.js +7 -0
  256. package/dist/src/tui/shared/index.js.map +1 -0
  257. package/dist/src/tui/shared/tokens.d.ts +79 -0
  258. package/dist/src/tui/shared/tokens.d.ts.map +1 -0
  259. package/dist/src/tui/shared/tokens.js +81 -0
  260. package/dist/src/tui/shared/tokens.js.map +1 -0
  261. package/dist/src/tui/tools-ui/CommandReference.d.ts.map +1 -1
  262. package/dist/src/tui/tools-ui/CommandReference.js +2 -4
  263. package/dist/src/tui/tools-ui/CommandReference.js.map +1 -1
  264. package/dist/src/tui/tools-ui/ConfigSources.d.ts.map +1 -1
  265. package/dist/src/tui/tools-ui/ConfigSources.js +3 -2
  266. package/dist/src/tui/tools-ui/ConfigSources.js.map +1 -1
  267. package/dist/src/tui/tools-ui/RegisterSettings.d.ts.map +1 -1
  268. package/dist/src/tui/tools-ui/RegisterSettings.js +2 -1
  269. package/dist/src/tui/tools-ui/RegisterSettings.js.map +1 -1
  270. package/dist/src/tui/tools-ui/RoleMappings.d.ts.map +1 -1
  271. package/dist/src/tui/tools-ui/RoleMappings.js +3 -5
  272. package/dist/src/tui/tools-ui/RoleMappings.js.map +1 -1
  273. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
  274. package/dist/src/tui/tools-ui/ToolsDashboard.js +3 -5
  275. package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
  276. package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
  277. package/dist/src/tui/tools-ui/ToolsOverview.js +3 -5
  278. package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
  279. package/dist/src/tui/uninstall-ui/UninstallFlow.d.ts.map +1 -1
  280. package/dist/src/tui/uninstall-ui/UninstallFlow.js +8 -7
  281. package/dist/src/tui/uninstall-ui/UninstallFlow.js.map +1 -1
  282. package/dist/src/types/index.d.ts +48 -6
  283. package/dist/src/types/index.d.ts.map +1 -1
  284. package/package.json +1 -1
  285. package/workflows/debug.md +73 -0
  286. package/workflows/execute.md +27 -0
  287. package/workflows/plan.md +11 -0
  288. package/workflows/review.md +33 -1
  289. package/workflows/tdd.md +257 -0
  290. package/workflows/verify.md +57 -0
  291. package/dashboard/dist/assets/ChatPage-BjBibfE4.js +0 -22
  292. package/dashboard/dist/assets/CollabPage-8lUMUol_.js +0 -1
  293. package/dashboard/dist/assets/KanbanPage-diY3QmGd.js +0 -21
  294. package/dashboard/dist/assets/McpPage-COjuIf7U.js +0 -21
  295. package/dashboard/dist/assets/SpecsPage-BOwBin_o.js +0 -36
  296. package/dashboard/dist/assets/SupervisorPage-5iRyMU5T.js +0 -6
  297. package/dashboard/dist/assets/WorkflowPage-CmQaRVgL.js +0 -6
  298. package/dashboard/dist/assets/en-C_BD3UCD.js +0 -1
  299. package/dashboard/dist/assets/index-BEUaOz_b.css +0 -1
  300. package/dashboard/dist/assets/index-uIqUCT8y.js +0 -236
  301. package/dashboard/dist/assets/table-DCzuJAFh.js +0 -6
  302. package/dashboard/dist/assets/zh-CN-DvQKfow3.js +0 -1
@@ -0,0 +1,22 @@
1
+ var En=e=>{throw TypeError(e)};var Pn=(e,t,n)=>t.has(e)||En("Cannot "+n);var We=(e,t,n)=>(Pn(e,t,"read from private field"),n?n.call(e):t.get(e)),Tn=(e,t,n)=>t.has(e)?En("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),An=(e,t,n,r)=>(Pn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{d as Sr,k as $,r as p,s as dt,j as i,X as jr,q as fe,t as Rr,F as Nn,v as Xe,w as Zt,M as as,x as qt,y as et,z as be,D as ae,E as te,G as _t,H as tt,J as cs,K as F,N as ls,Q as wt,U as us,Y as ds,Z as fs,_ as ps,$ as hs,a0 as xs,a1 as ms}from"./index-DpcPd-UG.js";import{C as In,M as gs}from"./ChatInput-CBI3qHQQ.js";import{R as vs}from"./rows-2-CifAA5SL.js";import{T as ys}from"./TreeBrowser-oEx8YJXV.js";import{P as bs}from"./pencil-qGxg9jOe.js";import{T as kr}from"./trash-2-Xen46iNQ.js";import"./index-CWBJLu42.js";import"./zap-DsQCPF61.js";import"./MarkdownRenderer-CtUhoxCT.js";import"./chevron-right-DvZ5sMOg.js";import"./terminal-EpmtGBlw.js";import"./circle-alert-Bfbv3gt4.js";import"./search-pe7pU1YN.js";import"./folder-CTj6SNNu.js";/**
2
+ * @license lucide-react v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ws=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Cs=Sr("copy",ws);/**
7
+ * @license lucide-react v0.577.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Ss=[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],js=Sr("square-split-horizontal",Ss);function Rs(e){const t=$(r=>r.pendingApprovals),n=p.useMemo(()=>e?Object.values(t).find(r=>r.processId===e)??null:null,[e,t]);p.useEffect(()=>{if(!n)return;function r(o){const s=o.target;if(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable)return;const l=o.key;if(l==="y"||l==="Y"){o.preventDefault(),dt({action:"approve",processId:n.processId,requestId:n.id,allow:!0});return}if(l==="Escape"){o.preventDefault(),dt({action:"approve",processId:n.processId,requestId:n.id,allow:!1});return}if(l==="a"||l==="A"){o.preventDefault(),dt({action:"approve",processId:n.processId,requestId:n.id,allow:!0});return}}return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[n])}const Mr=p.createContext(null);function ks({children:e,content:t}){return i.jsx(Mr,{value:t,children:e})}function Ms(){return p.useContext(Mr)}const Es={spawning:"var(--color-accent-blue)",running:"var(--color-accent-green, #4caf50)",paused:"var(--color-accent-yellow)",stopping:"var(--color-accent-orange)",stopped:"var(--color-text-tertiary)",error:"var(--color-accent-red, #e53935)"},Ln={spawning:"starting",running:"running",paused:"paused",stopping:"stopping",error:"error"},Ps=p.memo(function({tab:t,isActive:n,isFocused:r,processStatus:o,onSelect:s,onClose:l,onDragStart:c,groupId:a}){const u=p.useCallback(()=>{s(t.id)},[s,t.id]),d=p.useCallback(m=>{m.stopPropagation(),l(t.id)},[l,t.id]),h=p.useCallback(m=>{c(t.id,m)},[c,t.id]),f=p.useCallback(m=>{m.preventDefault(),m.dataTransfer.dropEffect="move"},[]),g=o?Es[o]??"var(--color-text-tertiary)":void 0;return i.jsxs("div",{role:"tab","aria-selected":n,tabIndex:n?0:-1,className:`
12
+ group relative flex items-center gap-[var(--spacing-1)] h-[28px]
13
+ min-w-[100px] max-w-[240px] px-[var(--spacing-2)] cursor-pointer
14
+ select-none whitespace-nowrap transition-colors duration-100
15
+ text-[length:var(--font-size-xs)]
16
+ ${n?"bg-bg-primary text-text-primary border-b-[2px] border-b-accent-blue":"text-text-tertiary hover:bg-bg-hover border-b-[2px] border-b-transparent"}
17
+
18
+ `,style:{flexShrink:1},onClick:u,onDragStart:h,onDragOver:f,draggable:!0,"data-tab-id":t.id,"data-group-id":a,title:t.title,children:[i.jsx("svg",{className:"shrink-0",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",stroke:g??"var(--color-accent-green)",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),i.jsx("span",{className:"truncate flex-1 min-w-0",children:t.title}),o&&Ln[o]&&i.jsxs("span",{className:"text-[9px] font-normal shrink-0",style:{color:n?"var(--color-text-tertiary)":"var(--color-text-placeholder)"},children:["· ",Ln[o]]}),i.jsx("button",{className:`
19
+ p-[2px] rounded-[var(--radius-sm)] hover:bg-bg-active transition-opacity shrink-0
20
+ ${n?"opacity-100":"opacity-0 group-hover:opacity-100"}
21
+ `,onClick:d,"aria-label":`Close ${t.title}`,tabIndex:-1,children:i.jsx(jr,{size:12,className:"text-text-tertiary"})})]})}),On="application/json",_n="maestro-tab-drag";function Dt(e){return e.type==="leaf"?[e]:[...Dt(e.first),...Dt(e.second)]}const Ts=p.memo(function({tabs:t,activeTabId:n,groupId:r,isFocused:o,onTabSelect:s,onTabClose:l}){const{state:c,dispatch:a}=fe(),u=$(m=>m.processes),d=p.useRef(null),h=p.useCallback((m,x)=>{const v=t.find(w=>w.id===m);if(!v)return;const y={type:_n,tabId:m,sourceGroupId:r,processId:v.ref};x.dataTransfer.setData(On,JSON.stringify(y)),x.dataTransfer.effectAllowed="move"},[t,r]),f=p.useCallback(m=>{m.preventDefault();const x=m.dataTransfer.getData(On);if(!x)return;let v;try{v=JSON.parse(x)}catch{return}if(v.type!==_n)return;const y=Dt(c.editorArea).find(b=>b.id===v.sourceGroupId);if(!y)return;const w=y.tabs.find(b=>b.id===v.tabId);w&&(v.sourceGroupId===r?a({type:"SET_ACTIVE_TAB",groupId:r,tabId:v.tabId}):(a({type:"CLOSE_TAB",groupId:v.sourceGroupId,tabId:v.tabId}),a({type:"OPEN_TAB",groupId:r,tab:w})))},[c.editorArea,r,a]),g=p.useCallback(m=>{m.preventDefault(),m.dataTransfer.dropEffect="move"},[]);return i.jsxs("div",{className:"flex items-center h-[var(--size-tabbar-height)] min-h-[var(--size-tabbar-height)] bg-bg-secondary",onDrop:f,onDragOver:g,"data-tab-bar":r,children:[i.jsx("div",{ref:d,className:"flex items-end h-full overflow-x-auto scrollbar-none flex-1 min-w-0",role:"tablist","aria-label":"Open sessions",children:t.map(m=>{const x=m.id===n,v=m.ref?u[m.ref]:void 0,y=v==null?void 0:v.status;return i.jsx(Ps,{tab:m,isActive:x,isFocused:o,processStatus:y,onSelect:s,onClose:l,onDragStart:h,groupId:r},m.id)})}),i.jsx(Ns,{groupId:r})]})}),As=[{type:"chat",label:"Chat",color:"var(--color-accent-green)",icon:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},{type:"file",label:"Code",color:"var(--color-accent-blue)",icon:""},{type:"agent",label:"Terminal",color:"var(--color-accent-orange)",icon:""}];let Dn=0;function Ns({groupId:e}){const[t,n]=p.useState(!1),{dispatch:r}=fe(),o=p.useRef(null),[s,l]=p.useState({top:0,left:0}),c=p.useCallback(a=>{Dn++;const u={id:`new-${a.type}-${Dn}`,type:a.type,title:a.label,ref:""};r({type:"OPEN_TAB",groupId:e,tab:u}),n(!1)},[r,e]);return p.useEffect(()=>{if(t&&o.current){const a=o.current.getBoundingClientRect();l({top:a.bottom+2,left:a.left})}},[t]),i.jsxs("div",{className:"self-center ml-[2px] shrink-0",children:[i.jsx("button",{ref:o,type:"button",onClick:a=>{a.stopPropagation(),n(u=>!u)},className:"w-[22px] h-[22px] rounded-[4px] border-none bg-transparent flex items-center justify-center cursor-pointer transition-all duration-100",style:{color:"var(--color-text-placeholder)"},onMouseEnter:a=>{a.currentTarget.style.backgroundColor="var(--color-bg-hover)",a.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:a=>{t||(a.currentTarget.style.backgroundColor="transparent",a.currentTarget.style.color="var(--color-text-placeholder)")},title:"New tab",children:i.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),t&&Rr.createPortal(i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{position:"fixed",inset:0,zIndex:9998},onClick:()=>n(!1)}),i.jsx("div",{style:{position:"fixed",top:s.top,left:s.left,zIndex:9999,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.12)",minWidth:120,overflow:"hidden"},children:As.map(a=>i.jsxs("button",{type:"button",onClick:()=>c(a),className:"flex items-center gap-[6px] w-full px-[10px] py-[6px] border-none bg-transparent cursor-pointer text-left transition-colors duration-100 text-[11px]",style:{color:"var(--color-text-primary)",fontFamily:"inherit"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent"},children:[i.jsx(Is,{type:a.type,color:a.color}),i.jsx("span",{className:"font-medium",children:a.label})]},a.type))})]}),document.body)]})}function Is({type:e,color:t}){return e==="chat"?i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}):e==="file"?i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polyline",{points:"16 18 22 12 16 6"}),i.jsx("polyline",{points:"8 6 2 12 8 18"})]}):i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polyline",{points:"4 17 10 11 4 5"}),i.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function zn(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),n=e%60;return`${t}m ${n}s`}function Ls({processId:e}){const t=$(a=>e?a.processThoughts[e]:void 0),n=$(a=>e?a.processStreaming[e]??!1:!1),[r,o]=p.useState(0),s=p.useRef(Date.now());if(p.useEffect(()=>{if(!n&&!(t!=null&&t.subject)){o(0);return}s.current=Date.now(),o(0);const a=setInterval(()=>{o(Math.floor((Date.now()-s.current)/1e3))},1e3);return()=>clearInterval(a)},[n,t==null?void 0:t.subject]),!n&&!(t!=null&&t.subject))return null;const l=()=>{e&&dt({action:"stop",processId:e})};if(n&&!(t!=null&&t.subject))return i.jsx("div",{style:Fn,children:i.jsxs("div",{style:$n,children:[i.jsx(Bn,{}),i.jsxs("span",{style:{color:"var(--color-text-secondary)",fontSize:12},children:["Processing...",i.jsxs("span",{style:{marginLeft:6,opacity:.6},children:["(",zn(r),")"]})]}),i.jsx(Gn,{onClick:l})]})});const c=t&&t.description&&t.description!==t.subject;return i.jsx("div",{style:Fn,children:i.jsxs("div",{style:$n,children:[n&&i.jsx(Bn,{}),(t==null?void 0:t.subject)&&i.jsx("span",{style:Os,children:t.subject}),c&&i.jsx("span",{style:{flex:1,fontSize:12,color:"var(--color-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.description}),n&&i.jsxs("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",whiteSpace:"nowrap"},children:["(",zn(r),")"]}),n&&i.jsx(Gn,{onClick:l})]})})}const Fn={background:"linear-gradient(135deg, var(--color-bg-card) 0%, var(--color-bg-primary) 100%)",borderRadius:10,padding:"8px 12px",margin:"0 16px 4px 16px",border:"1px solid var(--color-border-divider)"},$n={display:"flex",alignItems:"center",gap:8},Os={display:"inline-block",fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:6,backgroundColor:"var(--color-tint-exploring)",color:"var(--color-accent-blue)",whiteSpace:"nowrap"};function Bn(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-blue)",strokeWidth:"2.5",strokeLinecap:"round",style:{animation:"spin 1s linear infinite",flexShrink:0},children:[i.jsx("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"}),i.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]})}function Gn({onClick:e}){return i.jsx("button",{type:"button",onClick:e,style:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:6,border:"1px solid var(--color-border)",backgroundColor:"var(--color-bg-card)",cursor:"pointer",color:"var(--color-text-tertiary)",flexShrink:0,padding:0,transition:"all 150ms"},onMouseEnter:t=>{const n=t.currentTarget;n.style.borderColor="var(--color-accent-red)",n.style.backgroundColor="var(--color-tint-blocked)",n.style.color="var(--color-accent-red)"},onMouseLeave:t=>{const n=t.currentTarget;n.style.borderColor="var(--color-border)",n.style.backgroundColor="var(--color-bg-card)",n.style.color="var(--color-text-tertiary)"},"aria-label":"Stop process",children:i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})})}function _s(e){var r;const t=((r=e.split(".").pop())==null?void 0:r.toLowerCase())??"";return{ts:"ts",tsx:"ts",js:"js",jsx:"js",mjs:"js",cjs:"js",json:"json",css:"css",html:"html",md:"md",yaml:"yaml",yml:"yaml",py:"py",rs:"rs",go:"go",sh:"sh",bash:"sh"}[t]??""}function Ds(e,t){if(!t||t==="md")return[e];const n=[],r=t==="json"?[[/"(?:[^"\\]|\\.)*"/g,"var(--color-accent-green, #3D9B6F)"],[/\b(true|false|null)\b/g,"var(--color-accent-orange, #D4832E)"],[/\b\d+(?:\.\d+)?\b/g,"var(--color-accent-blue, #4A90D9)"]]:[[/\/\/.*$/gm,"var(--color-text-tertiary)"],[/(['"`])(?:(?!\1|\\).|\\.)*\1/g,"var(--color-accent-green, #3D9B6F)"],[/`[^`]*`/g,"var(--color-accent-green, #3D9B6F)"],[/\b(import|export|from|const|let|var|function|return|if|else|for|while|class|interface|type|extends|implements|new|async|await|try|catch|throw|switch|case|break|default|yield|of|in|as|is|typeof|instanceof|void|null|undefined|true|false|this|super|static|readonly|public|private|protected|abstract|enum|namespace|module|declare|require)\b/g,"var(--color-accent-purple, #8B6BBF)"],[/\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/g,"var(--color-accent-blue, #4A90D9)"],[/\b([a-zA-Z_$]\w*)\s*\(/g,"var(--color-accent-orange, #D4832E)"]],o=[];for(const[a,u]of r){const d=new RegExp(a.source,a.flags);let h;for(;(h=d.exec(e))!==null;)h[1]&&a.source.includes("\\(")?o.push({start:h.index,end:h.index+h[1].length,text:h[1],color:u}):o.push({start:h.index,end:h.index+h[0].length,text:h[0],color:u})}o.sort((a,u)=>a.start-u.start);const s=[];let l=0;for(const a of o)a.start>=l&&(s.push(a),l=a.end);let c=0;for(const a of s)a.start>c&&n.push(e.slice(c,a.start)),n.push({text:a.text,color:a.color}),c=a.end;return c<e.length&&n.push(e.slice(c)),n.length>0?n:[e]}function zs({filePath:e,onClose:t,embedded:n}){const[r,o]=p.useState(null),[s,l]=p.useState(!0),[c,a]=p.useState(null);p.useEffect(()=>{let g=!1;return l(!0),a(null),fetch(`/api/workspace/file?path=${encodeURIComponent(e)}`).then(async m=>{g||(m.ok?o(await m.text()):(a(`Failed to load: ${m.status}`),o(null)))}).catch(()=>{g||a("Failed to fetch file")}).finally(()=>{g||l(!1)}),()=>{g=!0}},[e]);const u=e.split("/").pop()??e,d=_s(e),h=p.useMemo(()=>(r==null?void 0:r.split(`
22
+ `))??[],[r]),f=h.length>0?String(h.length).length:1;return i.jsxs("div",{className:"flex flex-col h-full",children:[!n&&i.jsxs("div",{className:"shrink-0 flex items-center gap-2 px-4 py-2 border-b",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-secondary)"},children:[i.jsx(Nn,{size:13,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),i.jsx("span",{className:"text-[12px] font-medium truncate flex-1",style:{color:"var(--color-text-primary)"},title:e,children:u}),i.jsx("span",{className:"text-[10px] truncate max-w-[200px]",style:{color:"var(--color-text-tertiary)"},children:e}),i.jsx("button",{type:"button",onClick:t,className:"w-6 h-6 rounded flex items-center justify-center transition-colors",style:{color:"var(--color-text-tertiary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--color-bg-hover)",g.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.color="var(--color-text-tertiary)"},"aria-label":"Close file viewer",children:i.jsx(jr,{size:12,strokeWidth:2})})]}),n&&i.jsxs("div",{className:"shrink-0 flex items-center gap-[6px] px-3 h-[26px] border-b",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-primary)"},children:[i.jsx(Nn,{size:12,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),i.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--color-text-secondary)"},title:e,children:e})]}),i.jsxs("div",{className:"flex-1 overflow-auto",children:[s&&i.jsx("div",{className:"p-4 text-[12px] animate-pulse",style:{color:"var(--color-text-tertiary)"},children:"Loading..."}),c&&i.jsx("div",{className:"p-4 text-[12px]",style:{color:"var(--color-accent-red)"},children:c}),!s&&!c&&r!==null&&i.jsx("div",{className:"m-0 text-[12px] leading-[1.7]",style:{fontFamily:"var(--font-mono)",tabSize:2},children:h.map((g,m)=>i.jsxs("div",{className:"flex hover:bg-bg-hover",style:{minHeight:"1.7em"},children:[i.jsx("span",{className:"shrink-0 select-none text-right pr-[12px] pl-[12px]",style:{color:"var(--color-text-placeholder)",width:`${f+3}ch`,userSelect:"none"},children:m+1}),i.jsx("span",{className:"flex-1 whitespace-pre-wrap break-all pr-4",style:{color:"var(--color-text-primary)"},children:Ds(g,d).map((x,v)=>typeof x=="string"?i.jsx("span",{children:x},v):i.jsx("span",{style:{color:x.color},children:x.text},v))})]},m))})]})]})}const Fs=2;function zt(e,t){if(e.type==="leaf")return e.id===t?0:-1;const n=zt(e.first,t);if(n>=0)return n+1;const r=zt(e.second,t);return r>=0?r+1:-1}function $s({tab:e}){switch(e.type){case"chat":case"agent":return e.ref?i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:i.jsx(gs,{processId:e.ref})}),i.jsx(Ls,{processId:e.ref}),i.jsx(In,{processId:e.ref})]}):i.jsx("div",{className:"flex-1 flex flex-col items-center justify-center h-full",children:i.jsxs("div",{className:"w-full px-4",style:{maxWidth:"clamp(360px, calc(100% - 32px), 700px)"},children:[i.jsxs("div",{className:"flex flex-col items-center mb-6",children:[i.jsx("h2",{className:"text-[16px] font-semibold mb-[6px]",style:{color:"var(--color-text-secondary)"},children:"Start a new conversation"}),i.jsx("p",{className:"text-[13px]",style:{color:"var(--color-text-tertiary)"},children:"Select an agent, type a message, and press Enter to begin."})]}),i.jsx(In,{processId:null})]})});case"file":return e.ref?i.jsx(zs,{filePath:e.ref,onClose:()=>{},embedded:!0}):i.jsx("div",{className:"flex items-center justify-center h-full text-[12px]",style:{color:"var(--color-text-placeholder)"},children:"Open a file from the Explorer sidebar"});default:return i.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[13px]",children:e.title})}}const Bs=p.memo(function({node:t}){const{state:n,dispatch:r}=fe(),o=Xe(y=>y.focusedGroupId),s=Ms(),l=o===t.id,c=t.id==="editor-group-1",a=p.useRef(t.tabs);a.current=t.tabs;const u=p.useRef(t.activeTabId);u.current=t.activeTabId;const d=p.useRef(t.id);d.current=t.id;const h=p.useCallback(y=>{r({type:"SET_ACTIVE_TAB",groupId:t.id,tabId:y});const w=t.tabs.find(b=>b.id===y);(w==null?void 0:w.type)==="chat"&&w.ref&&$.getState().setActiveProcessId(w.ref)},[r,t.id,t.tabs]),f=p.useCallback(y=>{r({type:"CLOSE_TAB",groupId:t.id,tabId:y})},[r,t.id]),g=p.useCallback(()=>{r({type:"SPLIT_GROUP",groupId:t.id,direction:"horizontal"})},[r,t.id]),m=p.useCallback(()=>{r({type:"SPLIT_GROUP",groupId:t.id,direction:"vertical"})},[r,t.id]),x=p.useCallback(()=>{l||r({type:"SET_FOCUSED_GROUP",groupId:t.id})},[r,t.id,l]),v=zt(n.editorArea,t.id)<Fs;return p.useEffect(()=>{function y(w){const b=a.current,C=u.current,S=d.current;if(w.ctrlKey&&w.key==="Tab"&&!w.shiftKey){if(w.preventDefault(),b.length<2)return;const k=(b.findIndex(P=>P.id===C)+1)%b.length;r({type:"SET_ACTIVE_TAB",groupId:S,tabId:b[k].id});return}if(w.ctrlKey&&w.key==="Tab"&&w.shiftKey){if(w.preventDefault(),b.length<2)return;const k=(b.findIndex(P=>P.id===C)-1+b.length)%b.length;r({type:"SET_ACTIVE_TAB",groupId:S,tabId:b[k].id});return}if(w.ctrlKey&&w.key==="w"){if(w.preventDefault(),!C)return;r({type:"CLOSE_TAB",groupId:S,tabId:C});return}}return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[r]),i.jsxs("div",{className:"flex flex-col h-full overflow-hidden ",onMouseDown:x,"data-editor-group":t.id,children:[i.jsxs("div",{className:"flex items-center shrink-0 h-[28px] border-b border-border bg-bg-secondary",children:[i.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:i.jsx(Ts,{tabs:t.tabs,activeTabId:t.activeTabId,groupId:t.id,isFocused:l,onTabSelect:h,onTabClose:f})}),v&&i.jsxs("div",{className:"flex items-center gap-[1px] px-1 shrink-0",children:[i.jsx("button",{className:"p-[3px] rounded-[var(--radius-sm)] hover:bg-bg-active text-text-tertiary hover:text-text-secondary transition-colors",onClick:g,title:"Split Right","aria-label":"Split right",children:i.jsx(js,{size:13})}),i.jsx("button",{className:"p-[3px] rounded-[var(--radius-sm)] hover:bg-bg-active text-text-tertiary hover:text-text-secondary transition-colors",onClick:m,title:"Split Down","aria-label":"Split down",children:i.jsx(vs,{size:13})})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden relative",children:t.tabs.length===0?c&&s?i.jsx("div",{className:"h-full overflow-y-auto",children:s}):i.jsx("div",{className:"flex items-center justify-center h-full text-[12px]",style:{color:"var(--color-text-placeholder)"},children:"Click + to open a new tab"}):t.tabs.map(y=>i.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{display:y.id===t.activeTabId?"flex":"none"},"data-tab-content":y.id,children:i.jsx($s,{tab:y})},y.id))})]})});function Gs(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function Ws(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function Vs(e){return e/100*window.innerHeight}function Hs(e){return e/100*window.innerWidth}function Ks(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function He({groupSize:e,panelElement:t,styleProp:n}){let r;const[o,s]=Ks(n);switch(s){case"%":{r=o/100*e;break}case"px":{r=o;break}case"rem":{r=Ws(t,o);break}case"em":{r=Gs(t,o);break}case"vh":{r=Vs(o);break}case"vw":{r=Hs(o);break}}return r}function U(e){return parseFloat(e.toFixed(3))}function De({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,o)=>(r+=t==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,r),0)}function Ft(e){const{panels:t}=e,n=De({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:o,panelConstraints:s}=r;let l=0;if(s.collapsedSize!==void 0){const d=He({groupSize:n,panelElement:o,styleProp:s.collapsedSize});l=U(d/n*100)}let c;if(s.defaultSize!==void 0){const d=He({groupSize:n,panelElement:o,styleProp:s.defaultSize});c=U(d/n*100)}let a=0;if(s.minSize!==void 0){const d=He({groupSize:n,panelElement:o,styleProp:s.minSize});a=U(d/n*100)}let u=100;if(s.maxSize!==void 0){const d=He({groupSize:n,panelElement:o,styleProp:s.maxSize});u=U(d/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:l,collapsible:s.collapsible===!0,defaultSize:c,disabled:s.disabled,minSize:a,maxSize:u,panelId:r.id}})}function B(e,t="Assertion error"){if(!e)throw Error(t)}function $t(e,t){return Array.from(t).sort(e==="horizontal"?Us:Ys)}function Us(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Ys(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Er(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Pr(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Xs({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let o,s=Number.MAX_VALUE;for(const l of t){const{x:c,y:a}=Pr(r,l),u=e==="horizontal"?c:a;u<s&&(s=u,o=l)}return B(o,"No rect found"),o}let at;function Zs(){return at===void 0&&(typeof matchMedia=="function"?at=!!matchMedia("(pointer:coarse)").matches:at=!1),at}function Tr(e){const{element:t,orientation:n,panels:r,separators:o}=e,s=$t(n,Array.from(t.children).filter(Er).map(m=>({element:m}))).map(({element:m})=>m),l=[];let c=!1,a=!1,u=-1,d=-1,h=0,f,g=[];{let m=-1;for(const x of s)x.hasAttribute("data-panel")&&(m++,x.hasAttribute("data-disabled")||(h++,u===-1&&(u=m),d=m))}if(h>1){let m=-1;for(const x of s)if(x.hasAttribute("data-panel")){m++;const v=r.find(y=>y.element===x);if(v){if(f){const y=f.element.getBoundingClientRect(),w=x.getBoundingClientRect();let b;if(a){const C=n==="horizontal"?new DOMRect(y.right,y.top,0,y.height):new DOMRect(y.left,y.bottom,y.width,0),S=n==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(g.length){case 0:{b=[C,S];break}case 1:{const j=g[0],k=Xs({orientation:n,rects:[y,w],targetRect:j.element.getBoundingClientRect()});b=[j,k===y?S:C];break}default:{b=g;break}}}else g.length?b=g:b=[n==="horizontal"?new DOMRect(y.right,w.top,w.left-y.right,w.height):new DOMRect(w.left,y.bottom,w.width,w.top-y.bottom)];for(const C of b){let S="width"in C?C:C.element.getBoundingClientRect();const j=Zs()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(S.width<j){const P=j-S.width;S=new DOMRect(S.x-P/2,S.y,S.width+P,S.height)}if(S.height<j){const P=j-S.height;S=new DOMRect(S.x,S.y-P/2,S.width,S.height+P)}const k=m<=u||m>d;!c&&!k&&l.push({group:e,groupSize:De({group:e}),panels:[f,v],separator:"width"in C?void 0:C,rect:S}),c=!1}}a=!1,f=v,g=[]}}else if(x.hasAttribute("data-separator")){x.ariaDisabled!==null&&(c=!0);const v=o.find(y=>y.element===x);v?g.push(v):(f=void 0,g=[])}else a=!0}return l}var he;class Ar{constructor(){Tn(this,he,{})}addListener(t,n){const r=We(this,he)[t];return r===void 0?We(this,he)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=We(this,he)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let o=!1,s=null;const l=Array.from(r);for(let c=0;c<l.length;c++){const a=l[c];try{a.call(null,n)}catch(u){s===null&&(o=!0,s=u)}}if(o)throw s}}removeAllListeners(){An(this,he,{})}removeListener(t,n){const r=We(this,he)[t];if(r!==void 0){const o=r.indexOf(n);o>=0&&r.splice(o,1)}}}he=new WeakMap;let oe=new Map;const Nr=new Ar;function qs(e){oe=new Map(oe),oe.delete(e)}function Wn(e,t){for(const[n]of oe)if(n.id===e)return n}function xe(e,t){for(const[n,r]of oe)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Me(){return oe}function Jt(e,t){return Nr.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function le(e,t){const n=oe.get(e);oe=new Map(oe),oe.set(e,t),Nr.emit("groupChange",{group:e,prev:n,next:t})}function Js(e,t,n){let r,o={x:1/0,y:1/0};for(const s of t){const l=Pr(n,s.rect);switch(e){case"horizontal":{l.x<=o.x&&(r=s,o=l);break}case"vertical":{l.y<=o.y&&(r=s,o=l);break}}}return r?{distance:o,hitRegion:r}:void 0}function Qs(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ei(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Kn(e),b:Kn(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();B(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Hn(Vn(n.a)),b:Hn(Vn(n.b))};if(o.a===o.b){const s=r.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let c=s.length;for(;c--;){const a=s[c];if(a===l.a)return 1;if(a===l.b)return-1}}return Math.sign(o.a-o.b)}const ti=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ni(e){const t=getComputedStyle(Ir(e)??e).display;return t==="flex"||t==="inline-flex"}function ri(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||ni(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||ti.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Vn(e){let t=e.length;for(;t--;){const n=e[t];if(B(n,"Missing node"),ri(n))return n}return null}function Hn(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Kn(e){const t=[];for(;e;)t.push(e),e=Ir(e);return t}function Ir(e){const{parentNode:t}=e;return Qs(t)?t.host:t}function oi(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function si({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Er(n)||n.contains(e)||e.contains(n))return!0;if(ei(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(oi(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Qt(e,t){const n=[];return t.forEach((r,o)=>{if(o.disabled)return;const s=Tr(o),l=Js(o.orientation,s,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&si({groupElement:o.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function ii(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function V(e,t,n=0){return Math.abs(U(e)-U(t))<=n}function re(e,t){return V(e,t)?0:e>t?1:-1}function Ie({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:o=0,collapsible:s,disabled:l,maxSize:c=100,minSize:a=0}=t;if(l&&!e)return n;if(re(r,a)<0)if(s){const u=(o+a)/2;re(r,u)<0?r=o:r=a}else r=a;return r=Math.min(c,r),r=U(r),r}function Ze({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(V(e,0))return t;const l=s==="imperative-api",c=Object.values(t),a=Object.values(o),u=[...c],[d,h]=r;B(d!=null,"Invalid first pivot index"),B(h!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const x=e<0?h:d,v=n[x];B(v,`Panel constraints not found for index ${x}`);const{collapsedSize:y=0,collapsible:w,minSize:b=0}=v;if(w){const C=c[x];if(B(C!=null,`Previous layout not found for panel index ${x}`),V(C,y)){const S=b-C;re(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}{const x=e<0?d:h,v=n[x];B(v,`No panel constraints found for index ${x}`);const{collapsedSize:y=0,collapsible:w,minSize:b=0}=v;if(w){const C=c[x];if(B(C!=null,`Previous layout not found for panel index ${x}`),V(C,b)){const S=C-y;re(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}break}default:{const x=e<0?h:d,v=n[x];B(v,`Panel constraints not found for index ${x}`);const y=c[x],{collapsible:w,collapsedSize:b,minSize:C}=v;if(w&&re(y,C)<0)if(e>0){const S=C-b,j=S/2,k=y+e;re(k,C)<0&&(e=re(e,j)<=0?0:S)}else{const S=C-b,j=100-S/2,k=y-e;re(k,C)<0&&(e=re(100+e,j)>0?0:-S)}break}}{const x=e<0?1:-1;let v=e<0?h:d,y=0;for(;;){const b=c[v];B(b!=null,`Previous layout not found for panel index ${v}`);const C=Ie({overrideDisabledPanels:l,panelConstraints:n[v],prevSize:b,size:100})-b;if(y+=C,v+=x,v<0||v>=n.length)break}const w=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-w:w}{let x=e<0?d:h;for(;x>=0&&x<n.length;){const v=Math.abs(e)-Math.abs(f),y=c[x];B(y!=null,`Previous layout not found for panel index ${x}`);const w=y-v,b=Ie({overrideDisabledPanels:l,panelConstraints:n[x],prevSize:y,size:w});if(!V(y,b)&&(f+=y-b,u[x]=b,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?x--:x++}}if(ii(a,u))return o;{const x=e<0?h:d,v=c[x];B(v!=null,`Previous layout not found for panel index ${x}`);const y=v+f,w=Ie({overrideDisabledPanels:l,panelConstraints:n[x],prevSize:v,size:y});if(u[x]=w,!V(w,y)){let b=y-w,C=e<0?h:d;for(;C>=0&&C<n.length;){const S=u[C];B(S!=null,`Previous layout not found for panel index ${C}`);const j=S+b,k=Ie({overrideDisabledPanels:l,panelConstraints:n[C],prevSize:S,size:j});if(V(S,k)||(b-=k-S,u[C]=k),V(b,0))break;e>0?C--:C++}}}const g=Object.values(u).reduce((x,v)=>v+x,0);if(!V(g,100,.1))return o;const m=Object.keys(o);return u.reduce((x,v,y)=>(x[m[y]]=v,x),{})}function Se(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||re(e[n],t[n])!==0)return!1;return!0}function je({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],o=r.reduce((c,a)=>c+a,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(c=>`${c}%`).join(", ")}`);if(!V(o,100)&&r.length>0)for(let c=0;c<t.length;c++){const a=r[c];B(a!=null,`No layout data found for index ${c}`);const u=100/o*a;r[c]=u}let s=0;for(let c=0;c<t.length;c++){const a=n[c];B(a!=null,`No layout data found for index ${c}`);const u=r[c];B(u!=null,`No layout data found for index ${c}`);const d=Ie({overrideDisabledPanels:!0,panelConstraints:t[c],prevSize:a,size:u});u!=d&&(s+=u-d,r[c]=d)}if(!V(s,0))for(let c=0;c<t.length;c++){const a=r[c];B(a!=null,`No layout data found for index ${c}`);const u=a+s,d=Ie({overrideDisabledPanels:!0,panelConstraints:t[c],prevSize:a,size:u});if(a!==d&&(s-=d-a,r[c]=d,V(s,0)))break}const l=Object.keys(e);return r.reduce((c,a,u)=>(c[l[u]]=a,c),{})}function Lr({groupId:e,panelId:t}){const n=()=>{const c=Me();for(const[a,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:h,groupSize:f,separatorToPanels:g}]of c)if(a.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:a,groupSize:f,layout:h,separatorToPanels:g};throw Error(`Group ${e} not found`)},r=()=>{const c=n().derivedPanelConstraints.find(a=>a.panelId===t);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${t}`)},o=()=>{const c=n().group.panels.find(a=>a.id===t);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const c=n().layout[t];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},l=c=>{const a=s();if(c===a)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:h,groupSize:f,layout:g,separatorToPanels:m}=n(),x=h.panels.findIndex(b=>b.id===t),v=x===h.panels.length-1,y=Ze({delta:v?a-c:c-a,initialLayout:g,panelConstraints:d,pivotIndices:v?[x-1,x]:[x,x+1],prevLayout:g,trigger:"imperative-api"}),w=je({layout:y,panelConstraints:d});Se(g,w)||le(h,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:f,layout:w,separatorToPanels:m})};return{collapse:()=>{const{collapsible:c,collapsedSize:a}=r(),{mutableValues:u}=o(),d=s();c&&d!==a&&(u.expandToSize=d,l(a))},expand:()=>{const{collapsible:c,collapsedSize:a,minSize:u}=r(),{mutableValues:d}=o(),h=s();if(c&&h===a){let f=d.expandToSize??u;f===0&&(f=1),l(f)}},getSize:()=>{const{group:c}=n(),a=s(),{element:u}=o(),d=c.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:a,inPixels:d}},isCollapsed:()=>{const{collapsible:c,collapsedSize:a}=r(),u=s();return c&&V(a,u)},resize:c=>{const{group:a}=n(),{element:u}=o(),d=De({group:a}),h=He({groupSize:d,panelElement:u,styleProp:c}),f=U(h/d*100);l(f)}}}function Un(e){if(e.defaultPrevented)return;const t=Me();Qt(e,t).forEach(n=>{if(n.separator&&!n.separator.disableDoubleClick){const r=n.panels.find(o=>o.panelConstraints.defaultSize!==void 0);if(r){const o=r.panelConstraints.defaultSize,s=Lr({groupId:n.group.id,panelId:r.id});s&&o!==void 0&&(s.resize(o),e.preventDefault())}}})}function ft(e){const t=Me();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function Or({groupId:e}){const t=()=>{const n=Me();for(const[r,o]of n)if(r.id===e)return{group:r,...o};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:o,group:s,groupSize:l,layout:c,separatorToPanels:a}=t(),u=je({layout:n,panelConstraints:o});return r?c:(Se(c,u)||le(s,{defaultLayoutDeferred:r,derivedPanelConstraints:o,groupSize:l,layout:u,separatorToPanels:a}),u)}}}function we(e,t){const n=ft(e),r=xe(n.id,!0),o=n.separators.find(d=>d.element===e);B(o,"Matching separator not found");const s=r.separatorToPanels.get(o);B(s,"Matching panels not found");const l=s.map(d=>n.panels.indexOf(d)),c=Or({groupId:n.id}).getLayout(),a=Ze({delta:t,initialLayout:c,panelConstraints:r.derivedPanelConstraints,pivotIndices:l,prevLayout:c,trigger:"keyboard"}),u=je({layout:a,panelConstraints:r.derivedPanelConstraints});Se(c,u)||le(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:u,separatorToPanels:r.separatorToPanels})}function Yn(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=ft(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&we(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&we(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&we(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&we(t,-5);break}case"End":{e.preventDefault(),we(t,100);break}case"Enter":{e.preventDefault();const r=ft(t),o=xe(r.id,!0),{derivedPanelConstraints:s,layout:l,separatorToPanels:c}=o,a=r.separators.find(f=>f.element===t);B(a,"Matching separator not found");const u=c.get(a);B(u,"Matching panels not found");const d=u[0],h=s.find(f=>f.panelId===d.id);if(B(h,"Panel metadata not found"),h.collapsible){const f=l[d.id],g=h.collapsedSize===f?r.mutableState.expandedPanelSizes[d.id]??h.minSize:h.collapsedSize;we(t,g-f)}break}case"F6":{e.preventDefault();const r=ft(t).separators.map(l=>l.element),o=Array.from(r).findIndex(l=>l===e.currentTarget);B(o!==null,"Index not found");const s=e.shiftKey?o>0?o-1:r.length-1:o+1<r.length?o+1:0;r[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),we(t,-100);break}}}let Le={cursorFlags:0,state:"inactive"};const en=new Ar;function Re(){return Le}function ai(e){return en.addListener("change",e)}function ci(e){const t=Le,n={...Le};n.cursorFlags=e,Le=n,en.emit("change",{prev:t,next:n})}function Oe(e){const t=Le;Le=e,en.emit("change",{prev:t,next:e})}function Xn(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Me(),n=Qt(e,t),r=new Map;let o=!1;n.forEach(s=>{s.separator&&(o||(o=!0,s.separator.element.focus({preventScroll:!0})));const l=t.get(s.group);l&&r.set(s.group,l.layout)}),Oe({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const li=e=>e,Et=()=>{},_r=1,Dr=2,zr=4,Fr=8,Zn=3,qn=12;let ct;function Jn(){return ct===void 0&&(ct=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ct=!0)),ct}function ui({cursorFlags:e,groups:t,state:n}){let r=0,o=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{r++;break}case"vertical":{o++;break}}})}if(!(r===0&&o===0)){switch(n){case"active":{if(e&&Jn()){const s=(e&_r)!==0,l=(e&Dr)!==0,c=(e&zr)!==0,a=(e&Fr)!==0;if(s)return c?"se-resize":a?"ne-resize":"e-resize";if(l)return c?"sw-resize":a?"nw-resize":"w-resize";if(c)return"s-resize";if(a)return"n-resize"}break}}return Jn()?r>0&&o>0?"move":r>0?"ew-resize":"ns-resize":r>0&&o>0?"grab":r>0?"col-resize":"row-resize"}}const Qn=new WeakMap;function tn(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Qn.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=Re();switch(r.state){case"active":case"hover":{const o=ui({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(l=>l.group),state:r.state}),s=`*, *:hover {cursor: ${o} !important; }`;if(t===s)return;t=s,o?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Qn.set(e,{prevStyle:t,styleSheet:n})}function $r({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:o,pointerDownAtPoint:s,prevCursorFlags:l}){let c=0;n.forEach(u=>{const{group:d,groupSize:h}=u,{orientation:f,panels:g}=d,{disableCursor:m}=d.mutableState;let x=0;s?f==="horizontal"?x=(t.clientX-s.x)/h*100:x=(t.clientY-s.y)/h*100:f==="horizontal"?x=t.clientX<0?-100:100:x=t.clientY<0?-100:100;const v=r.get(d),y=o.get(d);if(!v||!y)return;const{defaultLayoutDeferred:w,derivedPanelConstraints:b,groupSize:C,layout:S,separatorToPanels:j}=y;if(b&&S&&j){const k=Ze({delta:x,initialLayout:v,panelConstraints:b,pivotIndices:u.panels.map(P=>g.indexOf(P)),prevLayout:S,trigger:"mouse-or-touch"});if(Se(k,S)){if(x!==0&&!m)switch(f){case"horizontal":{c|=x<0?_r:Dr;break}case"vertical":{c|=x<0?zr:Fr;break}}}else le(u.group,{defaultLayoutDeferred:w,derivedPanelConstraints:b,groupSize:C,layout:k,separatorToPanels:j})}});let a=0;t.movementX===0?a|=l&Zn:a|=c&Zn,t.movementY===0?a|=l&qn:a|=c&qn,ci(a),tn(e)}function er(e){const t=Me(),n=Re();switch(n.state){case"active":$r({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function tr(e){var r,o;if(e.defaultPrevented)return;const t=Re(),n=Me();switch(t.state){case"active":{if(e.buttons===0){Oe({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const l=xe(s.group.id,!0);le(s.group,l)});return}for(const s of t.hitRegions)if(s.separator){const{element:l}=s.separator;(r=l.hasPointerCapture)!=null&&r.call(l,e.pointerId)||((o=l.setPointerCapture)==null||o.call(l,e.pointerId))}$r({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=Qt(e,n);s.length===0?t.state!=="inactive"&&Oe({cursorFlags:0,state:"inactive"}):Oe({cursorFlags:0,hitRegions:s,state:"hover"}),tn(e.currentTarget);break}}}function nr(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Re().state){case"hover":Oe({cursorFlags:0,state:"inactive"})}}function rr(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Re();switch(t.state){case"active":Oe({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(tn(e.currentTarget),t.hitRegions.forEach(n=>{const r=xe(n.group.id,!0);le(n.group,r)}),e.preventDefault())}}function or(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const l=U(s.defaultSize);n+=l,r[s.panelId]=l}else r[s.panelId]=void 0;const o=e.length-t;if(o!==0){const s=U((100-n)/o);for(const l of e)l.defaultSize===void 0&&(r[l.panelId]=s)}return r}function di(e,t,n){if(!n[0])return;const r=e.panels.find(a=>a.element===t);if(!r||!r.onResize)return;const o=De({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,l=r.mutableValues.prevSize,c={asPercentage:U(s/o*100),inPixels:s};r.mutableValues.prevSize=c,r.onResize(c,r.id,l)}function fi(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function pi({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let o=0,s=0,l=!1;const c=new Map,a=[];for(const h of e.panels){const f=r[h.id]??0;switch(h.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{l=!0;const g=f/100*n,m=U(g/t*100);c.set(h.id,m),o+=m;break}case"preserve-relative-size":default:{a.push(h.id),s+=f;break}}}if(!l||a.length===0)return r;const u=100-o,d={...r};if(c.forEach((h,f)=>{d[f]=h}),s>0)for(const h of a){const f=r[h]??0;d[h]=U(f/s*u)}else{const h=U(u/a.length);for(const f of a)d[f]=h}return d}function hi(e,t){const n=e.map(o=>o.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!r.includes(o))return!1;return!0}const Ne=new Map;function xi(e){let t=!0;B(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,o=new Set,s=new n(m=>{for(const x of m){const{borderBoxSize:v,target:y}=x;if(y===e.element){if(t){const w=De({group:e});if(w===0)return;const b=xe(e.id);if(!b)return;const C=Ft(e),S=b.defaultLayoutDeferred?or(C):b.layout,j=pi({group:e,nextGroupSize:w,prevGroupSize:b.groupSize,prevLayout:S}),k=je({layout:j,panelConstraints:C});if(!b.defaultLayoutDeferred&&Se(b.layout,k)&&fi(b.derivedPanelConstraints,C)&&b.groupSize===w)return;le(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:C,groupSize:w,layout:k,separatorToPanels:b.separatorToPanels})}}else di(e,y,v)}});s.observe(e.element),e.panels.forEach(m=>{B(!r.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.onResize&&s.observe(m.element)});const l=De({group:e}),c=Ft(e),a=e.panels.map(({id:m})=>m).join(",");let u=e.mutableState.defaultLayout;u&&(hi(e.panels,u)||(u=void 0));const d=e.mutableState.layouts[a]??u??or(c),h=je({layout:d,panelConstraints:c}),f=e.element.ownerDocument;Ne.set(f,(Ne.get(f)??0)+1);const g=new Map;return Tr(e).forEach(m=>{m.separator&&g.set(m.separator,m.panels)}),le(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:c,groupSize:l,layout:h,separatorToPanels:g}),e.separators.forEach(m=>{B(!o.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),o.add(m.id),m.element.addEventListener("keydown",Yn)}),Ne.get(f)===1&&(f.addEventListener("dblclick",Un,!0),f.addEventListener("pointerdown",Xn,!0),f.addEventListener("pointerleave",er),f.addEventListener("pointermove",tr),f.addEventListener("pointerout",nr),f.addEventListener("pointerup",rr,!0)),function(){t=!1,Ne.set(f,Math.max(0,(Ne.get(f)??0)-1)),qs(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",Yn)}),Ne.get(f)||(f.removeEventListener("dblclick",Un,!0),f.removeEventListener("pointerdown",Xn,!0),f.removeEventListener("pointerleave",er),f.removeEventListener("pointermove",tr),f.removeEventListener("pointerout",nr),f.removeEventListener("pointerup",rr,!0)),s.disconnect()}}function mi(){const[e,t]=p.useState({}),n=p.useCallback(()=>t({}),[]);return[e,n]}function nn(e){const t=p.useId();return`${e??t}`}const Ee=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Ue(e){const t=p.useRef(e);return Ee(()=>{t.current=e},[e]),p.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function rn(...e){return Ue(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function on(e){const t=p.useRef({...e});return Ee(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Br=p.createContext(null);function gi(e,t){const n=p.useRef({getLayout:()=>({}),setLayout:li});p.useImperativeHandle(t,()=>n.current,[]),Ee(()=>{Object.assign(n.current,Or({groupId:e}))})}function Gr({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:o,elementRef:s,groupRef:l,id:c,onLayoutChange:a,onLayoutChanged:u,orientation:d="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...g}){const m=p.useRef({onLayoutChange:{},onLayoutChanged:{}}),x=Ue(T=>{Se(m.current.onLayoutChange,T)||(m.current.onLayoutChange=T,a==null||a(T))}),v=Ue(T=>{Se(m.current.onLayoutChanged,T)||(m.current.onLayoutChanged=T,u==null||u(T))}),y=nn(c),w=p.useRef(null),[b,C]=mi(),S=p.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),j=rn(w,s);gi(y,l);const k=Ue((T,N)=>{const I=Re(),R=Wn(T),L=xe(T);if(L){let D=!1;switch(I.state){case"active":{D=I.hitRegions.some(O=>O.group===R);break}}return{flexGrow:L.layout[N]??1,pointerEvents:D?"none":void 0}}if(n!=null&&n[N])return{flexGrow:n==null?void 0:n[N]}}),P=on({defaultLayout:n,disableCursor:r}),M=p.useMemo(()=>({get disableCursor(){return!!P.disableCursor},getPanelStyles:k,id:y,orientation:d,registerPanel:T=>{const N=S.current;return N.panels=$t(d,[...N.panels,T]),C(),()=>{N.panels=N.panels.filter(I=>I!==T),C()}},registerSeparator:T=>{const N=S.current;return N.separators=$t(d,[...N.separators,T]),C(),()=>{N.separators=N.separators.filter(I=>I!==T),C()}},updatePanelProps:(T,{disabled:N})=>{const I=S.current.panels.find(D=>D.id===T);I&&(I.panelConstraints.disabled=N);const R=Wn(y),L=xe(y);R&&L&&le(R,{...L,derivedPanelConstraints:Ft(R)})},updateSeparatorProps:(T,{disabled:N,disableDoubleClick:I})=>{const R=S.current.separators.find(L=>L.id===T);R&&(R.disabled=N,R.disableDoubleClick=I)}}),[k,y,C,d,P]),_=p.useRef(null);return Ee(()=>{const T=w.current;if(T===null)return;const N=S.current;let I;if(P.defaultLayout!==void 0&&Object.keys(P.defaultLayout).length===N.panels.length){I={};for(const z of N.panels){const G=P.defaultLayout[z.id];G!==void 0&&(I[z.id]=G)}}const R={disabled:!!o,element:T,id:y,mutableState:{defaultLayout:I,disableCursor:!!P.disableCursor,expandedPanelSizes:S.current.lastExpandedPanelSizes,layouts:S.current.layouts},orientation:d,panels:N.panels,resizeTargetMinimumSize:N.resizeTargetMinimumSize,separators:N.separators};_.current=R;const L=xi(R),{defaultLayoutDeferred:D,derivedPanelConstraints:O,layout:A}=xe(R.id,!0);!D&&O.length>0&&(x(A),v(A));const E=Jt(y,z=>{const{defaultLayoutDeferred:G,derivedPanelConstraints:Y,layout:ne}=z.next;if(G||Y.length===0)return;const ve=R.panels.map(({id:W})=>W).join(",");R.mutableState.layouts[ve]=ne,Y.forEach(W=>{if(W.collapsible){const{layout:X}=z.prev??{};if(X){const ye=V(W.collapsedSize,ne[W.panelId]),K=V(W.collapsedSize,X[W.panelId]);ye&&!K&&(R.mutableState.expandedPanelSizes[W.panelId]=X[W.panelId])}}});const Ae=Re().state!=="active";x(ne),Ae&&v(ne)});return()=>{_.current=null,L(),E()}},[o,y,v,x,d,b,P]),p.useEffect(()=>{const T=_.current;T&&(T.mutableState.defaultLayout=n,T.mutableState.disableCursor=!!r)}),i.jsx(Br.Provider,{value:M,children:i.jsx("div",{...g,className:t,"data-group":!0,"data-testid":y,id:y,ref:j,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:d==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:d==="horizontal"?"pan-y":"pan-x"},children:e})})}Gr.displayName="Group";function sn(){const e=p.useContext(Br);return B(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function vi(e,t){const{id:n}=sn(),r=p.useRef({collapse:Et,expand:Et,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Et});p.useImperativeHandle(t,()=>r.current,[]),Ee(()=>{Object.assign(r.current,Lr({groupId:n,panelId:e}))})}function Bt({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:o,disabled:s,elementRef:l,groupResizeBehavior:c="preserve-relative-size",id:a,maxSize:u="100%",minSize:d="0%",onResize:h,panelRef:f,style:g,...m}){const x=!!a,v=nn(a),y=on({disabled:s}),w=p.useRef(null),b=rn(w,l),{getPanelStyles:C,id:S,orientation:j,registerPanel:k,updatePanelProps:P}=sn(),M=h!==null,_=Ue((R,L,D)=>{h==null||h(R,a,D)});Ee(()=>{const R=w.current;if(R!==null){const L={element:R,id:v,idIsStable:x,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:M?_:void 0,panelConstraints:{groupResizeBehavior:c,collapsedSize:n,collapsible:r,defaultSize:o,disabled:y.disabled,maxSize:u,minSize:d}};return k(L)}},[c,n,r,o,M,v,x,u,d,_,k,y]),p.useEffect(()=>{P(v,{disabled:s})},[s,v,P]),vi(v,f);const T=()=>{const R=C(S,v);if(R)return JSON.stringify(R)},N=p.useSyncExternalStore(R=>Jt(S,R),T,T);let I;return N?I=JSON.parse(N):o?I={flexGrow:void 0,flexShrink:void 0,flexBasis:o}:I={flexGrow:1},i.jsx("div",{...m,"data-disabled":s||void 0,"data-panel":!0,"data-testid":v,id:v,ref:b,style:{...yi,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...I},children:i.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...g,touchAction:j==="horizontal"?"pan-y":"pan-x"},children:e})})}Bt.displayName="Panel";const yi={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function bi({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let o,s;const l=e[n],c=t.find(a=>a.panelId===n);if(c){const a=c.maxSize,u=c.collapsible?c.collapsedSize:c.minSize,d=[r,r+1];s=je({layout:Ze({delta:u-l,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],o=je({layout:Ze({delta:a-l,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:o,valueMin:s,valueNow:l}}function Wr({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:o,id:s,style:l,...c}){const a=nn(s),u=on({disabled:n,disableDoubleClick:r}),[d,h]=p.useState({}),[f,g]=p.useState("inactive"),[m,x]=p.useState(!1),v=p.useRef(null),y=rn(v,o),{disableCursor:w,id:b,orientation:C,registerSeparator:S,updateSeparatorProps:j}=sn(),k=C==="horizontal"?"vertical":"horizontal";Ee(()=>{const _=v.current;if(_!==null){const T={disabled:u.disabled,disableDoubleClick:u.disableDoubleClick,element:_,id:a},N=S(T),I=ai(L=>{g(L.next.state!=="inactive"&&L.next.hitRegions.some(D=>D.separator===T)?L.next.state:"inactive")}),R=Jt(b,L=>{const{derivedPanelConstraints:D,layout:O,separatorToPanels:A}=L.next,E=A.get(T);if(E){const z=E[0],G=E.indexOf(z);h(bi({layout:O,panelConstraints:D,panelId:z.id,panelIndex:G}))}});return()=>{I(),R(),N()}}},[b,a,S,u]),p.useEffect(()=>{j(a,{disabled:n,disableDoubleClick:r})},[n,r,a,j]);let P;n&&!w&&(P="not-allowed");let M;if(n)M="disabled";else switch(f){case"active":{M="active";break}default:m?M="focus":M=f}return i.jsx("div",{...c,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":k,"aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:e,className:t,"data-separator":M,"data-testid":a,id:a,onBlur:()=>x(!1),onFocus:()=>x(!0),ref:y,role:"separator",style:{flexBasis:"auto",cursor:P,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}Wr.displayName="Separator";const sr=15,wi=p.memo(function({node:t}){const{dispatch:n}=fe(),r=Math.round(t.ratio*100),o=100-r,s=p.useCallback(l=>{const c=`${t.id}-first`,a=l[c];if(typeof a=="number"){const u=a/100;Math.abs(u-t.ratio)>.005&&n({type:"RESIZE_GROUP",branchId:t.id,ratio:u})}},[n,t.id,t.ratio]);return i.jsxs(Gr,{orientation:t.direction,id:t.id,className:"h-full",onLayoutChanged:s,children:[i.jsx(Bt,{id:`${t.id}-first`,defaultSize:`${r}%`,minSize:`${sr}%`,className:"overflow-hidden",style:{minWidth:"var(--size-editor-min-width)",minHeight:"var(--size-editor-min-height)"},children:i.jsx(Gt,{node:t.first})}),i.jsx(Wr,{id:`${t.id}-sep`,className:"group relative flex-shrink-0",style:{width:t.direction==="horizontal"?"1px":void 0,height:t.direction==="vertical"?"1px":void 0,backgroundColor:"var(--color-border)",transition:"background-color 150ms ease"},children:i.jsx("div",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:"var(--color-border-focused)",width:t.direction==="horizontal"?"3px":"100%",height:t.direction==="vertical"?"3px":"100%",left:t.direction==="horizontal"?"-1px":"0",top:t.direction==="vertical"?"-1px":"0"}})}),i.jsx(Bt,{id:`${t.id}-second`,defaultSize:`${o}%`,minSize:`${sr}%`,className:"overflow-hidden",style:{minWidth:"var(--size-editor-min-width)",minHeight:"var(--size-editor-min-height)"},children:i.jsx(Gt,{node:t.second})})]})}),Gt=p.memo(function({node:t}){return t.type==="branch"?i.jsx(wi,{node:t}):i.jsx(Bs,{node:t})}),Ci={center:"bg-accent-blue/10 border-accent-blue/30",left:"bg-accent-blue/15 border-l-2 border-accent-blue/50",right:"bg-accent-blue/15 border-r-2 border-accent-blue/50",top:"bg-accent-blue/15 border-t-2 border-accent-blue/50",bottom:"bg-accent-blue/15 border-b-2 border-accent-blue/50"},ir={center:"Move to group",left:"Split left",right:"Split right",top:"Split up",bottom:"Split down"},Si=p.memo(function({onDrop:t,visible:n}){const[r,o]=p.useState(null),s=p.useRef(null),l=p.useCallback((d,h)=>{var v;const f=(v=s.current)==null?void 0:v.getBoundingClientRect();if(!f)return"center";const g=(d-f.left)/f.width,m=(h-f.top)/f.height,x=.25;return g<x?"left":g>1-x?"right":m<x?"top":m>1-x?"bottom":"center"},[]),c=p.useCallback(d=>{d.preventDefault(),d.dataTransfer.dropEffect="move",o(l(d.clientX,d.clientY))},[l]),a=p.useCallback(()=>{o(null)},[]),u=p.useCallback(d=>{d.preventDefault();const h=l(d.clientX,d.clientY);o(null),t(h)},[l,t]);return n?i.jsx("div",{ref:s,className:"absolute inset-0 z-50",onDragOver:c,onDragLeave:a,onDrop:u,children:i.jsxs("div",{className:"relative w-full h-full",children:[i.jsx(Ve,{zone:"left",activeZone:r,className:"absolute left-0 top-0 bottom-0 w-[25%]"}),i.jsx(Ve,{zone:"right",activeZone:r,className:"absolute right-0 top-0 bottom-0 w-[25%]"}),i.jsx(Ve,{zone:"top",activeZone:r,className:"absolute left-[25%] right-[25%] top-0 h-[25%]"}),i.jsx(Ve,{zone:"bottom",activeZone:r,className:"absolute left-[25%] right-[25%] bottom-0 h-[25%]"}),i.jsx(Ve,{zone:"center",activeZone:r,className:"absolute left-[25%] right-[25%] top-[25%] bottom-[25%]"})]})}):null});function Ve({zone:e,activeZone:t,className:n}){const r=t===e;return i.jsx("div",{className:`${n} transition-all duration-150 ${r?Ci[e]:"border border-transparent"}`,"aria-label":ir[e],children:r&&i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("span",{className:"text-[length:var(--font-size-xs)] text-accent-blue font-[var(--font-weight-medium)] bg-bg-primary/80 px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)]",children:ir[e]})})})}const Pt=2;function Ye(e,t){if(e.type==="leaf")return e.id===t?0:-1;const n=Ye(e.first,t);if(n>=0)return n+1;const r=Ye(e.second,t);return r>=0?r+1:-1}function Wt(e){return e.type==="leaf"?[e.id]:[...Wt(e.first),...Wt(e.second)]}function ji({children:e}){const{dispatch:t}=fe(),n=Xe(h=>h.editorArea),r=Xe(h=>h.focusedGroupId),o=p.useRef(!1),s=p.useRef(null),[l,c]=p.useState(!1),a=p.useRef(n);a.current=n;const u=p.useRef(r);u.current=r,p.useEffect(()=>{function h(f){const g=a.current,m=u.current;if(f.ctrlKey&&f.key==="\\"&&!f.shiftKey&&!f.altKey){f.preventDefault(),Ye(g,m)<Pt&&t({type:"SPLIT_GROUP",groupId:m,direction:"horizontal"});return}if(f.ctrlKey&&f.key==="k"&&!f.shiftKey&&!f.altKey){f.preventDefault(),o.current=!0,s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current=!1},1e3);return}if(o.current&&f.ctrlKey&&f.key==="\\"){f.preventDefault(),o.current=!1,s.current&&(clearTimeout(s.current),s.current=null),Ye(g,m)<Pt&&t({type:"SPLIT_GROUP",groupId:m,direction:"vertical"});return}if(o.current&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){f.preventDefault(),o.current=!1,s.current&&(clearTimeout(s.current),s.current=null);const x=Wt(g),v=x.indexOf(m);if(v>=0){const y=f.key==="ArrowRight"?(v+1)%x.length:(v-1+x.length)%x.length;t({type:"SET_FOCUSED_GROUP",groupId:x[y]})}return}}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t]);const d=p.useCallback(h=>{if(c(!1),!h||h==="center")return;const f=h==="left"||h==="right"?"horizontal":"vertical";Ye(n,r)>=Pt||t({type:"SPLIT_GROUP",groupId:r,direction:f})},[t,n,r]);return i.jsx(ks,{content:e??null,children:i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden relative bg-bg-primary",children:[i.jsx(Gt,{node:n}),i.jsx(Si,{visible:l,onDrop:d})]})})}function Vr(e){return e.type==="leaf"?e:Vr(e.first)}function ht(e){return e.type==="leaf"?[e]:[...ht(e.first),...ht(e.second)]}function Ri(){const{dispatch:e}=fe(),t=Xe(a=>a.editorArea),n=Xe(a=>a.focusedGroupId),r=$(a=>a.processes),o=$(a=>a.activeProcessId),s=p.useMemo(()=>{const u=Date.now();return Object.entries(r).filter(([d,h])=>d===o?!0:u-new Date(h.startedAt).getTime()<9e5)},[r,o]),l=p.useRef(new Set);p.useEffect(()=>{const a=ht(t),u=new Set(s.map(([f])=>f)),d=new Set;for(const f of a)for(const g of f.tabs)g.ref&&d.add(g.ref);const h=n||Vr(t).id;for(const[f,g]of s){if(!d.has(f)){if(l.current.has(f))continue;const m=Zt[g.type]??g.type,x=a.find(v=>v.id===h);if(x){const v=x.tabs.find(y=>y.type==="chat"&&!y.ref);v&&e({type:"CLOSE_TAB",groupId:h,tabId:v.id})}e({type:"OPEN_TAB",groupId:h,tab:{id:`chat-${f}`,type:"chat",title:m,ref:f,icon:as}})}l.current.add(f)}for(const f of a)for(const g of f.tabs)g.type==="chat"&&g.ref&&!u.has(g.ref)&&(e({type:"CLOSE_TAB",groupId:f.id,tabId:g.id}),l.current.delete(g.ref))},[s,n,e,t]);const c=p.useRef(o);return p.useEffect(()=>{if(!o||o===c.current){c.current=o;return}c.current=o;const a=`chat-${o}`,u=ht(t);for(const d of u)if(d.tabs.some(h=>h.id===a)){d.activeTabId!==a&&e({type:"SET_ACTIVE_TAB",groupId:d.id,tabId:a});break}},[o,t,e]),i.jsx(ji,{})}const Hr=p.createContext({sidebarOpen:!0,setSidebarOpen:()=>{},activeTab:"chat",setActiveTab:()=>{},fileTreeOpen:!1,setFileTreeOpen:()=>{},historyOpen:!1,setHistoryOpen:()=>{}});function ki(){return p.useContext(Hr)}function ar(e){const t=Mi(e),n=p.forwardRef((r,o)=>{const{children:s,...l}=r,c=p.Children.toArray(s),a=c.find(Pi);if(a){const u=a.props.children,d=c.map(h=>h===a?p.Children.count(u)>1?p.Children.only(null):p.isValidElement(u)?u.props.children:null:h);return i.jsx(t,{...l,ref:o,children:p.isValidElement(u)?p.cloneElement(u,void 0,d):null})}return i.jsx(t,{...l,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function Mi(e){const t=p.forwardRef((n,r)=>{const{children:o,...s}=n;if(p.isValidElement(o)){const l=Ai(o),c=Ti(s,o.props);return o.type!==p.Fragment&&(c.ref=r?qt(r,l):l),p.cloneElement(o,c)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ei=Symbol("radix.slottable");function Pi(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ei}function Ti(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const a=s(...c);return o(...c),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Ai(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Kr(e){const t=e+"CollectionProvider",[n,r]=et(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=x=>{const{scope:v,children:y}=x,w=be.useRef(null),b=be.useRef(new Map).current;return i.jsx(o,{scope:v,itemMap:b,collectionRef:w,children:y})};l.displayName=t;const c=e+"CollectionSlot",a=ar(c),u=be.forwardRef((x,v)=>{const{scope:y,children:w}=x,b=s(c,y),C=ae(v,b.collectionRef);return i.jsx(a,{ref:C,children:w})});u.displayName=c;const d=e+"CollectionItemSlot",h="data-radix-collection-item",f=ar(d),g=be.forwardRef((x,v)=>{const{scope:y,children:w,...b}=x,C=be.useRef(null),S=ae(v,C),j=s(d,y);return be.useEffect(()=>(j.itemMap.set(C,{ref:C,...b}),()=>void j.itemMap.delete(C))),i.jsx(f,{[h]:"",ref:S,children:w})});g.displayName=d;function m(x){const v=s(e+"CollectionConsumer",x);return be.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const b=Array.from(w.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((j,k)=>b.indexOf(j.ref.current)-b.indexOf(k.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:l,Slot:u,ItemSlot:g},m,r]}var Ni=p.createContext(void 0);function Ur(e){const t=p.useContext(Ni);return e||t||"ltr"}const Ii=["top","right","bottom","left"],me=Math.min,Z=Math.max,xt=Math.round,lt=Math.floor,ie=e=>({x:e,y:e}),Li={left:"right",right:"left",bottom:"top",top:"bottom"};function Vt(e,t,n){return Z(e,me(t,n))}function ue(e,t){return typeof e=="function"?e(t):e}function de(e){return e.split("-")[0]}function Fe(e){return e.split("-")[1]}function an(e){return e==="x"?"y":"x"}function cn(e){return e==="y"?"height":"width"}function se(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ln(e){return an(se(e))}function Oi(e,t,n){n===void 0&&(n=!1);const r=Fe(e),o=ln(e),s=cn(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=mt(l)),[l,mt(l)]}function _i(e){const t=mt(e);return[Ht(e),t,Ht(t)]}function Ht(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const cr=["left","right"],lr=["right","left"],Di=["top","bottom"],zi=["bottom","top"];function Fi(e,t,n){switch(e){case"top":case"bottom":return n?t?lr:cr:t?cr:lr;case"left":case"right":return t?Di:zi;default:return[]}}function $i(e,t,n,r){const o=Fe(e);let s=Fi(de(e),n==="start",r);return o&&(s=s.map(l=>l+"-"+o),t&&(s=s.concat(s.map(Ht)))),s}function mt(e){const t=de(e);return Li[t]+e.slice(t.length)}function Bi(e){return{top:0,right:0,bottom:0,left:0,...e}}function Yr(e){return typeof e!="number"?Bi(e):{top:e,right:e,bottom:e,left:e}}function gt(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ur(e,t,n){let{reference:r,floating:o}=e;const s=se(t),l=ln(t),c=cn(l),a=de(t),u=s==="y",d=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,f=r[c]/2-o[c]/2;let g;switch(a){case"top":g={x:d,y:r.y-o.height};break;case"bottom":g={x:d,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:h};break;case"left":g={x:r.x-o.width,y:h};break;default:g={x:r.x,y:r.y}}switch(Fe(t)){case"start":g[l]-=f*(n&&u?-1:1);break;case"end":g[l]+=f*(n&&u?-1:1);break}return g}async function Gi(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:l,elements:c,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:g=0}=ue(t,e),m=Yr(g),v=c[f?h==="floating"?"reference":"floating":h],y=gt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:a})),w=h==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),C=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},S=gt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:b,strategy:a}):w);return{top:(y.top-S.top+m.top)/C.y,bottom:(S.bottom-y.bottom+m.bottom)/C.y,left:(y.left-S.left+m.left)/C.x,right:(S.right-y.right+m.right)/C.x}}const Wi=50,Vi=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:Gi},a=await(l.isRTL==null?void 0:l.isRTL(t));let u=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:h}=ur(u,r,a),f=r,g=0;const m={};for(let x=0;x<s.length;x++){const v=s[x];if(!v)continue;const{name:y,fn:w}=v,{x:b,y:C,data:S,reset:j}=await w({x:d,y:h,initialPlacement:r,placement:f,strategy:o,middlewareData:m,rects:u,platform:c,elements:{reference:e,floating:t}});d=b??d,h=C??h,m[y]={...m[y],...S},j&&g<Wi&&(g++,typeof j=="object"&&(j.placement&&(f=j.placement),j.rects&&(u=j.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):j.rects),{x:d,y:h}=ur(u,f,a)),x=-1)}return{x:d,y:h,placement:f,strategy:o,middlewareData:m}},Hi=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:l,elements:c,middlewareData:a}=t,{element:u,padding:d=0}=ue(e,t)||{};if(u==null)return{};const h=Yr(d),f={x:n,y:r},g=ln(o),m=cn(g),x=await l.getDimensions(u),v=g==="y",y=v?"top":"left",w=v?"bottom":"right",b=v?"clientHeight":"clientWidth",C=s.reference[m]+s.reference[g]-f[g]-s.floating[m],S=f[g]-s.reference[g],j=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u));let k=j?j[b]:0;(!k||!await(l.isElement==null?void 0:l.isElement(j)))&&(k=c.floating[b]||s.floating[m]);const P=C/2-S/2,M=k/2-x[m]/2-1,_=me(h[y],M),T=me(h[w],M),N=_,I=k-x[m]-T,R=k/2-x[m]/2+P,L=Vt(N,R,I),D=!a.arrow&&Fe(o)!=null&&R!==L&&s.reference[m]/2-(R<N?_:T)-x[m]/2<0,O=D?R<N?R-N:R-I:0;return{[g]:f[g]+O,data:{[g]:L,centerOffset:R-L-O,...D&&{alignmentOffset:O}},reset:D}}}),Ki=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:l,initialPlacement:c,platform:a,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:x=!0,...v}=ue(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=de(o),w=se(c),b=de(c)===c,C=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=f||(b||!x?[mt(c)]:_i(c)),j=m!=="none";!f&&j&&S.push(...$i(c,x,m,C));const k=[c,...S],P=await a.detectOverflow(t,v),M=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&M.push(P[y]),h){const R=Oi(o,l,C);M.push(P[R[0]],P[R[1]])}if(_=[..._,{placement:o,overflows:M}],!M.every(R=>R<=0)){var T,N;const R=(((T=s.flip)==null?void 0:T.index)||0)+1,L=k[R];if(L&&(!(h==="alignment"?w!==se(L):!1)||_.every(A=>se(A.placement)===w?A.overflows[0]>0:!0)))return{data:{index:R,overflows:_},reset:{placement:L}};let D=(N=_.filter(O=>O.overflows[0]<=0).sort((O,A)=>O.overflows[1]-A.overflows[1])[0])==null?void 0:N.placement;if(!D)switch(g){case"bestFit":{var I;const O=(I=_.filter(A=>{if(j){const E=se(A.placement);return E===w||E==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(E=>E>0).reduce((E,z)=>E+z,0)]).sort((A,E)=>A[1]-E[1])[0])==null?void 0:I[0];O&&(D=O);break}case"initialPlacement":D=c;break}if(o!==D)return{reset:{placement:D}}}return{}}}};function dr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fr(e){return Ii.some(t=>e[t]>=0)}const Ui=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=ue(e,t);switch(o){case"referenceHidden":{const l=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=dr(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:fr(c)}}}case"escaped":{const l=await r.detectOverflow(t,{...s,altBoundary:!0}),c=dr(l,n.floating);return{data:{escapedOffsets:c,escaped:fr(c)}}}default:return{}}}}},Xr=new Set(["left","top"]);async function Yi(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=de(n),c=Fe(n),a=se(n)==="y",u=Xr.has(l)?-1:1,d=s&&a?-1:1,h=ue(t,e);let{mainAxis:f,crossAxis:g,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof m=="number"&&(g=c==="end"?m*-1:m),a?{x:g*d,y:f*u}:{x:f*u,y:g*d}}const Xi=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:l,middlewareData:c}=t,a=await Yi(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:l}}}}},Zi=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:a={fn:y=>{let{x:w,y:b}=y;return{x:w,y:b}}},...u}=ue(e,t),d={x:n,y:r},h=await s.detectOverflow(t,u),f=se(de(o)),g=an(f);let m=d[g],x=d[f];if(l){const y=g==="y"?"top":"left",w=g==="y"?"bottom":"right",b=m+h[y],C=m-h[w];m=Vt(b,m,C)}if(c){const y=f==="y"?"top":"left",w=f==="y"?"bottom":"right",b=x+h[y],C=x-h[w];x=Vt(b,x,C)}const v=a.fn({...t,[g]:m,[f]:x});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[g]:l,[f]:c}}}}}},qi=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:l}=t,{offset:c=0,mainAxis:a=!0,crossAxis:u=!0}=ue(e,t),d={x:n,y:r},h=se(o),f=an(h);let g=d[f],m=d[h];const x=ue(c,t),v=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(a){const b=f==="y"?"height":"width",C=s.reference[f]-s.floating[b]+v.mainAxis,S=s.reference[f]+s.reference[b]-v.mainAxis;g<C?g=C:g>S&&(g=S)}if(u){var y,w;const b=f==="y"?"width":"height",C=Xr.has(de(o)),S=s.reference[h]-s.floating[b]+(C&&((y=l.offset)==null?void 0:y[h])||0)+(C?0:v.crossAxis),j=s.reference[h]+s.reference[b]+(C?0:((w=l.offset)==null?void 0:w[h])||0)-(C?v.crossAxis:0);m<S?m=S:m>j&&(m=j)}return{[f]:g,[h]:m}}}},Ji=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:l,elements:c}=t,{apply:a=()=>{},...u}=ue(e,t),d=await l.detectOverflow(t,u),h=de(o),f=Fe(o),g=se(o)==="y",{width:m,height:x}=s.floating;let v,y;h==="top"||h==="bottom"?(v=h,y=f===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(y=h,v=f==="end"?"top":"bottom");const w=x-d.top-d.bottom,b=m-d.left-d.right,C=me(x-d[v],w),S=me(m-d[y],b),j=!t.middlewareData.shift;let k=C,P=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=w),j&&!f){const _=Z(d.left,0),T=Z(d.right,0),N=Z(d.top,0),I=Z(d.bottom,0);g?P=m-2*(_!==0||T!==0?_+T:Z(d.left,d.right)):k=x-2*(N!==0||I!==0?N+I:Z(d.top,d.bottom))}await a({...t,availableWidth:P,availableHeight:k});const M=await l.getDimensions(c.floating);return m!==M.width||x!==M.height?{reset:{rects:!0}}:{}}}};function Ct(){return typeof window<"u"}function $e(e){return Zr(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ce(e){var t;return(t=(Zr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Zr(e){return Ct()?e instanceof Node||e instanceof q(e).Node:!1}function Q(e){return Ct()?e instanceof Element||e instanceof q(e).Element:!1}function pe(e){return Ct()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function pr(e){return!Ct()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}function nt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ee(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Qi(e){return/^(table|td|th)$/.test($e(e))}function St(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ea=/transform|translate|scale|rotate|perspective|filter/,ta=/paint|layout|strict|content/,Ce=e=>!!e&&e!=="none";let Tt;function un(e){const t=Q(e)?ee(e):e;return Ce(t.transform)||Ce(t.translate)||Ce(t.scale)||Ce(t.rotate)||Ce(t.perspective)||!dn()&&(Ce(t.backdropFilter)||Ce(t.filter))||ea.test(t.willChange||"")||ta.test(t.contain||"")}function na(e){let t=ge(e);for(;pe(t)&&!ze(t);){if(un(t))return t;if(St(t))return null;t=ge(t)}return null}function dn(){return Tt==null&&(Tt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Tt}function ze(e){return/^(html|body|#document)$/.test($e(e))}function ee(e){return q(e).getComputedStyle(e)}function jt(e){return Q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ge(e){if($e(e)==="html")return e;const t=e.assignedSlot||e.parentNode||pr(e)&&e.host||ce(e);return pr(t)?t.host:t}function qr(e){const t=ge(e);return ze(t)?e.ownerDocument?e.ownerDocument.body:e.body:pe(t)&&nt(t)?t:qr(t)}function qe(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=qr(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),l=q(o);if(s){const c=Kt(l);return t.concat(l,l.visualViewport||[],nt(o)?o:[],c&&n?qe(c):[])}else return t.concat(o,qe(o,[],n))}function Kt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jr(e){const t=ee(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=pe(e),s=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=xt(n)!==s||xt(r)!==l;return c&&(n=s,r=l),{width:n,height:r,$:c}}function fn(e){return Q(e)?e:e.contextElement}function _e(e){const t=fn(e);if(!pe(t))return ie(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Jr(t);let l=(s?xt(n.width):n.width)/r,c=(s?xt(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const ra=ie(0);function Qr(e){const t=q(e);return!dn()||!t.visualViewport?ra:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oa(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function ke(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=fn(e);let l=ie(1);t&&(r?Q(r)&&(l=_e(r)):l=_e(e));const c=oa(s,n,r)?Qr(s):ie(0);let a=(o.left+c.x)/l.x,u=(o.top+c.y)/l.y,d=o.width/l.x,h=o.height/l.y;if(s){const f=q(s),g=r&&Q(r)?q(r):r;let m=f,x=Kt(m);for(;x&&r&&g!==m;){const v=_e(x),y=x.getBoundingClientRect(),w=ee(x),b=y.left+(x.clientLeft+parseFloat(w.paddingLeft))*v.x,C=y.top+(x.clientTop+parseFloat(w.paddingTop))*v.y;a*=v.x,u*=v.y,d*=v.x,h*=v.y,a+=b,u+=C,m=q(x),x=Kt(m)}}return gt({width:d,height:h,x:a,y:u})}function Rt(e,t){const n=jt(e).scrollLeft;return t?t.left+n:ke(ce(e)).left+n}function eo(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Rt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function sa(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",l=ce(r),c=t?St(t.floating):!1;if(r===l||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=ie(1);const d=ie(0),h=pe(r);if((h||!h&&!s)&&(($e(r)!=="body"||nt(l))&&(a=jt(r)),h)){const g=ke(r);u=_e(r),d.x=g.x+r.clientLeft,d.y=g.y+r.clientTop}const f=l&&!h&&!s?eo(l,a):ie(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+d.x+f.x,y:n.y*u.y-a.scrollTop*u.y+d.y+f.y}}function ia(e){return Array.from(e.getClientRects())}function aa(e){const t=ce(e),n=jt(e),r=e.ownerDocument.body,o=Z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Rt(e);const c=-n.scrollTop;return ee(r).direction==="rtl"&&(l+=Z(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:l,y:c}}const hr=25;function ca(e,t){const n=q(e),r=ce(e),o=n.visualViewport;let s=r.clientWidth,l=r.clientHeight,c=0,a=0;if(o){s=o.width,l=o.height;const d=dn();(!d||d&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Rt(r);if(u<=0){const d=r.ownerDocument,h=d.body,f=getComputedStyle(h),g=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-h.clientWidth-g);m<=hr&&(s-=m)}else u<=hr&&(s+=u);return{width:s,height:l,x:c,y:a}}function la(e,t){const n=ke(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=pe(e)?_e(e):ie(1),l=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,u=r*s.y;return{width:l,height:c,x:a,y:u}}function xr(e,t,n){let r;if(t==="viewport")r=ca(e,n);else if(t==="document")r=aa(ce(e));else if(Q(t))r=la(t,n);else{const o=Qr(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return gt(r)}function to(e,t){const n=ge(e);return n===t||!Q(n)||ze(n)?!1:ee(n).position==="fixed"||to(n,t)}function ua(e,t){const n=t.get(e);if(n)return n;let r=qe(e,[],!1).filter(c=>Q(c)&&$e(c)!=="body"),o=null;const s=ee(e).position==="fixed";let l=s?ge(e):e;for(;Q(l)&&!ze(l);){const c=ee(l),a=un(l);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||nt(l)&&!a&&to(e,l))?r=r.filter(d=>d!==l):o=c,l=ge(l)}return t.set(e,r),r}function da(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?St(t)?[]:ua(t,this._c):[].concat(n),r],c=xr(t,l[0],o);let a=c.top,u=c.right,d=c.bottom,h=c.left;for(let f=1;f<l.length;f++){const g=xr(t,l[f],o);a=Z(g.top,a),u=me(g.right,u),d=me(g.bottom,d),h=Z(g.left,h)}return{width:u-h,height:d-a,x:h,y:a}}function fa(e){const{width:t,height:n}=Jr(e);return{width:t,height:n}}function pa(e,t,n){const r=pe(t),o=ce(t),s=n==="fixed",l=ke(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=ie(0);function u(){a.x=Rt(o)}if(r||!r&&!s)if(($e(t)!=="body"||nt(o))&&(c=jt(t)),r){const g=ke(t,!0,s,t);a.x=g.x+t.clientLeft,a.y=g.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?eo(o,c):ie(0),h=l.left+c.scrollLeft-a.x-d.x,f=l.top+c.scrollTop-a.y-d.y;return{x:h,y:f,width:l.width,height:l.height}}function At(e){return ee(e).position==="static"}function mr(e,t){if(!pe(e)||ee(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ce(e)===n&&(n=n.ownerDocument.body),n}function no(e,t){const n=q(e);if(St(e))return n;if(!pe(e)){let o=ge(e);for(;o&&!ze(o);){if(Q(o)&&!At(o))return o;o=ge(o)}return n}let r=mr(e,t);for(;r&&Qi(r)&&At(r);)r=mr(r,t);return r&&ze(r)&&At(r)&&!un(r)?n:r||na(e)||n}const ha=async function(e){const t=this.getOffsetParent||no,n=this.getDimensions,r=await n(e.floating);return{reference:pa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function xa(e){return ee(e).direction==="rtl"}const ma={convertOffsetParentRelativeRectToViewportRelativeRect:sa,getDocumentElement:ce,getClippingRect:da,getOffsetParent:no,getElementRects:ha,getClientRects:ia,getDimensions:fa,getScale:_e,isElement:Q,isRTL:xa};function ro(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ga(e,t){let n=null,r;const o=ce(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function l(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=e.getBoundingClientRect(),{left:d,top:h,width:f,height:g}=u;if(c||t(),!f||!g)return;const m=lt(h),x=lt(o.clientWidth-(d+f)),v=lt(o.clientHeight-(h+g)),y=lt(d),b={rootMargin:-m+"px "+-x+"px "+-v+"px "+-y+"px",threshold:Z(0,me(1,a))||1};let C=!0;function S(j){const k=j[0].intersectionRatio;if(k!==a){if(!C)return l();k?l(!1,k):r=setTimeout(()=>{l(!1,1e-7)},1e3)}k===1&&!ro(u,e.getBoundingClientRect())&&l(),C=!1}try{n=new IntersectionObserver(S,{...b,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,b)}n.observe(e)}return l(!0),s}function va(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=fn(e),d=o||s?[...u?qe(u):[],...t?qe(t):[]]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const h=u&&c?ga(u,n):null;let f=-1,g=null;l&&(g=new ResizeObserver(y=>{let[w]=y;w&&w.target===u&&g&&t&&(g.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=g)==null||b.observe(t)})),n()}),u&&!a&&g.observe(u),t&&g.observe(t));let m,x=a?ke(e):null;a&&v();function v(){const y=ke(e);x&&!ro(x,y)&&n(),x=y,m=requestAnimationFrame(v)}return n(),()=>{var y;d.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),h==null||h(),(y=g)==null||y.disconnect(),g=null,a&&cancelAnimationFrame(m)}}const ya=Xi,ba=Zi,wa=Ki,Ca=Ji,Sa=Ui,gr=Hi,ja=qi,Ra=(e,t,n)=>{const r=new Map,o={platform:ma,...n},s={...o.platform,_c:r};return Vi(e,t,{...o,platform:s})};var ka=typeof document<"u",Ma=function(){},pt=ka?p.useLayoutEffect:Ma;function vt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vt(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!vt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function oo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vr(e,t){const n=oo(e);return Math.round(t*n)/n}function Nt(e){const t=p.useRef(e);return pt(()=>{t.current=e}),t}function Ea(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:a,open:u}=e,[d,h]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,g]=p.useState(r);vt(f,r)||g(r);const[m,x]=p.useState(null),[v,y]=p.useState(null),w=p.useCallback(A=>{A!==j.current&&(j.current=A,x(A))},[]),b=p.useCallback(A=>{A!==k.current&&(k.current=A,y(A))},[]),C=s||m,S=l||v,j=p.useRef(null),k=p.useRef(null),P=p.useRef(d),M=a!=null,_=Nt(a),T=Nt(o),N=Nt(u),I=p.useCallback(()=>{if(!j.current||!k.current)return;const A={placement:t,strategy:n,middleware:f};T.current&&(A.platform=T.current),Ra(j.current,k.current,A).then(E=>{const z={...E,isPositioned:N.current!==!1};R.current&&!vt(P.current,z)&&(P.current=z,Rr.flushSync(()=>{h(z)}))})},[f,t,n,T,N]);pt(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,h(A=>({...A,isPositioned:!1})))},[u]);const R=p.useRef(!1);pt(()=>(R.current=!0,()=>{R.current=!1}),[]),pt(()=>{if(C&&(j.current=C),S&&(k.current=S),C&&S){if(_.current)return _.current(C,S,I);I()}},[C,S,I,_,M]);const L=p.useMemo(()=>({reference:j,floating:k,setReference:w,setFloating:b}),[w,b]),D=p.useMemo(()=>({reference:C,floating:S}),[C,S]),O=p.useMemo(()=>{const A={position:n,left:0,top:0};if(!D.floating)return A;const E=vr(D.floating,d.x),z=vr(D.floating,d.y);return c?{...A,transform:"translate("+E+"px, "+z+"px)",...oo(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:E,top:z}},[n,c,D.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:I,refs:L,elements:D,floatingStyles:O}),[d,I,L,D,O])}const Pa=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?gr({element:r.current,padding:o}).fn(n):{}:r?gr({element:r,padding:o}).fn(n):{}}}},Ta=(e,t)=>{const n=ya(e);return{name:n.name,fn:n.fn,options:[e,t]}},Aa=(e,t)=>{const n=ba(e);return{name:n.name,fn:n.fn,options:[e,t]}},Na=(e,t)=>({fn:ja(e).fn,options:[e,t]}),Ia=(e,t)=>{const n=wa(e);return{name:n.name,fn:n.fn,options:[e,t]}},La=(e,t)=>{const n=Ca(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oa=(e,t)=>{const n=Sa(e);return{name:n.name,fn:n.fn,options:[e,t]}},_a=(e,t)=>{const n=Pa(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Da="Arrow",so=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return i.jsx(te.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});so.displayName=Da;var za=so;function Fa(e){const[t,n]=p.useState(void 0);return _t(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let l,c;if("borderBoxSize"in s){const a=s.borderBoxSize,u=Array.isArray(a)?a[0]:a;l=u.inlineSize,c=u.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var pn="Popper",[io,ao]=et(pn),[$a,co]=io(pn),lo=e=>{const{__scopePopper:t,children:n}=e,[r,o]=p.useState(null);return i.jsx($a,{scope:t,anchor:r,onAnchorChange:o,children:n})};lo.displayName=pn;var uo="PopperAnchor",fo=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=co(uo,n),l=p.useRef(null),c=ae(t,l),a=p.useRef(null);return p.useEffect(()=>{const u=a.current;a.current=(r==null?void 0:r.current)||l.current,u!==a.current&&s.onAnchorChange(a.current)}),r?null:i.jsx(te.div,{...o,ref:c})});fo.displayName=uo;var hn="PopperContent",[Ba,Ga]=io(hn),po=p.forwardRef((e,t)=>{var X,ye,K,Be,Rn,kn;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:a=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:g="optimized",onPlaced:m,...x}=e,v=co(hn,n),[y,w]=p.useState(null),b=ae(t,Ge=>w(Ge)),[C,S]=p.useState(null),j=Fa(C),k=(j==null?void 0:j.width)??0,P=(j==null?void 0:j.height)??0,M=r+(s!=="center"?"-"+s:""),_=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],N=T.length>0,I={padding:_,boundary:T.filter(Va),altBoundary:N},{refs:R,floatingStyles:L,placement:D,isPositioned:O,middlewareData:A}=Ea({strategy:"fixed",placement:M,whileElementsMounted:(...Ge)=>va(...Ge,{animationFrame:g==="always"}),elements:{reference:v.anchor},middleware:[Ta({mainAxis:o+P,alignmentAxis:l}),a&&Aa({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Na():void 0,...I}),a&&Ia({...I}),La({...I,apply:({elements:Ge,rects:Mn,availableWidth:rs,availableHeight:os})=>{const{width:ss,height:is}=Mn.reference,it=Ge.floating.style;it.setProperty("--radix-popper-available-width",`${rs}px`),it.setProperty("--radix-popper-available-height",`${os}px`),it.setProperty("--radix-popper-anchor-width",`${ss}px`),it.setProperty("--radix-popper-anchor-height",`${is}px`)}}),C&&_a({element:C,padding:c}),Ha({arrowWidth:k,arrowHeight:P}),f&&Oa({strategy:"referenceHidden",...I})]}),[E,z]=mo(D),G=tt(m);_t(()=>{O&&(G==null||G())},[O,G]);const Y=(X=A.arrow)==null?void 0:X.x,ne=(ye=A.arrow)==null?void 0:ye.y,ve=((K=A.arrow)==null?void 0:K.centerOffset)!==0,[Ae,W]=p.useState();return _t(()=>{y&&W(window.getComputedStyle(y).zIndex)},[y]),i.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:O?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ae,"--radix-popper-transform-origin":[(Be=A.transformOrigin)==null?void 0:Be.x,(Rn=A.transformOrigin)==null?void 0:Rn.y].join(" "),...((kn=A.hide)==null?void 0:kn.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(Ba,{scope:n,placedSide:E,onArrowChange:S,arrowX:Y,arrowY:ne,shouldHideArrow:ve,children:i.jsx(te.div,{"data-side":E,"data-align":z,...x,ref:b,style:{...x.style,animation:O?void 0:"none"}})})})});po.displayName=hn;var ho="PopperArrow",Wa={top:"bottom",right:"left",bottom:"top",left:"right"},xo=p.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Ga(ho,r),l=Wa[s.placedSide];return i.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:i.jsx(za,{...o,ref:n,style:{...o.style,display:"block"}})})});xo.displayName=ho;function Va(e){return e!==null}var Ha=e=>({name:"transformOrigin",options:e,fn(t){var v,y,w;const{placement:n,rects:r,middlewareData:o}=t,l=((v=o.arrow)==null?void 0:v.centerOffset)!==0,c=l?0:e.arrowWidth,a=l?0:e.arrowHeight,[u,d]=mo(n),h={start:"0%",center:"50%",end:"100%"}[d],f=(((y=o.arrow)==null?void 0:y.x)??0)+c/2,g=(((w=o.arrow)==null?void 0:w.y)??0)+a/2;let m="",x="";return u==="bottom"?(m=l?h:`${f}px`,x=`${-a}px`):u==="top"?(m=l?h:`${f}px`,x=`${r.floating.height+a}px`):u==="right"?(m=`${-a}px`,x=l?h:`${g}px`):u==="left"&&(m=`${r.floating.width+a}px`,x=l?h:`${g}px`),{data:{x:m,y:x}}}});function mo(e){const[t,n="center"]=e.split("-");return[t,n]}var Ka=lo,Ua=fo,Ya=po,Xa=xo,It="rovingFocusGroup.onEntryFocus",Za={bubbles:!1,cancelable:!0},rt="RovingFocusGroup",[Ut,go,qa]=Kr(rt),[Ja,vo]=et(rt,[qa]),[Qa,ec]=Ja(rt),yo=p.forwardRef((e,t)=>i.jsx(Ut.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(Ut.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(tc,{...e,ref:t})})}));yo.displayName=rt;var tc=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:a,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,f=p.useRef(null),g=ae(t,f),m=Ur(s),[x,v]=ls({prop:l,defaultProp:c??null,onChange:a,caller:rt}),[y,w]=p.useState(!1),b=tt(u),C=go(n),S=p.useRef(!1),[j,k]=p.useState(0);return p.useEffect(()=>{const P=f.current;if(P)return P.addEventListener(It,b),()=>P.removeEventListener(It,b)},[b]),i.jsx(Qa,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:x,onItemFocus:p.useCallback(P=>v(P),[v]),onItemShiftTab:p.useCallback(()=>w(!0),[]),onFocusableItemAdd:p.useCallback(()=>k(P=>P+1),[]),onFocusableItemRemove:p.useCallback(()=>k(P=>P-1),[]),children:i.jsx(te.div,{tabIndex:y||j===0?-1:0,"data-orientation":r,...h,ref:g,style:{outline:"none",...e.style},onMouseDown:F(e.onMouseDown,()=>{S.current=!0}),onFocus:F(e.onFocus,P=>{const M=!S.current;if(P.target===P.currentTarget&&M&&!y){const _=new CustomEvent(It,Za);if(P.currentTarget.dispatchEvent(_),!_.defaultPrevented){const T=C().filter(D=>D.focusable),N=T.find(D=>D.active),I=T.find(D=>D.id===x),L=[N,I,...T].filter(Boolean).map(D=>D.ref.current);Co(L,d)}}S.current=!1}),onBlur:F(e.onBlur,()=>w(!1))})})}),bo="RovingFocusGroupItem",wo=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:l,...c}=e,a=cs(),u=s||a,d=ec(bo,n),h=d.currentTabStopId===u,f=go(n),{onFocusableItemAdd:g,onFocusableItemRemove:m,currentTabStopId:x}=d;return p.useEffect(()=>{if(r)return g(),()=>m()},[r,g,m]),i.jsx(Ut.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:i.jsx(te.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...c,ref:t,onMouseDown:F(e.onMouseDown,v=>{r?d.onItemFocus(u):v.preventDefault()}),onFocus:F(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:F(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=oc(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let b=f().filter(C=>C.focusable).map(C=>C.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const C=b.indexOf(v.currentTarget);b=d.loop?sc(b,C+1):b.slice(C+1)}setTimeout(()=>Co(b))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:x!=null}):l})})});wo.displayName=bo;var nc={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function rc(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function oc(e,t,n){const r=rc(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return nc[r]}function Co(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function sc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ic=yo,ac=wo;function cc(e){const t=lc(e),n=p.forwardRef((r,o)=>{const{children:s,...l}=r,c=p.Children.toArray(s),a=c.find(dc);if(a){const u=a.props.children,d=c.map(h=>h===a?p.Children.count(u)>1?p.Children.only(null):p.isValidElement(u)?u.props.children:null:h);return i.jsx(t,{...l,ref:o,children:p.isValidElement(u)?p.cloneElement(u,void 0,d):null})}return i.jsx(t,{...l,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function lc(e){const t=p.forwardRef((n,r)=>{const{children:o,...s}=n;if(p.isValidElement(o)){const l=pc(o),c=fc(s,o.props);return o.type!==p.Fragment&&(c.ref=r?qt(r,l):l),p.cloneElement(o,c)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uc=Symbol("radix.slottable");function dc(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uc}function fc(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const a=s(...c);return o(...c),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function pc(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Yt=["Enter"," "],hc=["ArrowDown","PageUp","Home"],So=["ArrowUp","PageDown","End"],xc=[...hc,...So],mc={ltr:[...Yt,"ArrowRight"],rtl:[...Yt,"ArrowLeft"]},gc={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ot="Menu",[Je,vc,yc]=Kr(ot),[Pe,jo]=et(ot,[yc,ao,vo]),kt=ao(),Ro=vo(),[bc,Te]=Pe(ot),[wc,st]=Pe(ot),ko=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:l=!0}=e,c=kt(t),[a,u]=p.useState(null),d=p.useRef(!1),h=tt(s),f=Ur(o);return p.useEffect(()=>{const g=()=>{d.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>d.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),i.jsx(Ka,{...c,children:i.jsx(bc,{scope:t,open:n,onOpenChange:h,content:a,onContentChange:u,children:i.jsx(wc,{scope:t,onClose:p.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:f,modal:l,children:r})})})};ko.displayName=ot;var Cc="MenuAnchor",xn=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=kt(n);return i.jsx(Ua,{...o,...r,ref:t})});xn.displayName=Cc;var mn="MenuPortal",[Sc,Mo]=Pe(mn,{forceMount:void 0}),Eo=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Te(mn,t);return i.jsx(Sc,{scope:t,forceMount:n,children:i.jsx(wt,{present:n||s.open,children:i.jsx(us,{asChild:!0,container:o,children:r})})})};Eo.displayName=mn;var J="MenuContent",[jc,gn]=Pe(J),Po=p.forwardRef((e,t)=>{const n=Mo(J,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Te(J,e.__scopeMenu),l=st(J,e.__scopeMenu);return i.jsx(Je.Provider,{scope:e.__scopeMenu,children:i.jsx(wt,{present:r||s.open,children:i.jsx(Je.Slot,{scope:e.__scopeMenu,children:l.modal?i.jsx(Rc,{...o,ref:t}):i.jsx(kc,{...o,ref:t})})})})}),Rc=p.forwardRef((e,t)=>{const n=Te(J,e.__scopeMenu),r=p.useRef(null),o=ae(t,r);return p.useEffect(()=>{const s=r.current;if(s)return ds(s)},[]),i.jsx(vn,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:F(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),kc=p.forwardRef((e,t)=>{const n=Te(J,e.__scopeMenu);return i.jsx(vn,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Mc=cc("MenuContent.ScrollLock"),vn=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:g,disableOutsideScroll:m,...x}=e,v=Te(J,n),y=st(J,n),w=kt(n),b=Ro(n),C=vc(n),[S,j]=p.useState(null),k=p.useRef(null),P=ae(t,k,v.onContentChange),M=p.useRef(0),_=p.useRef(""),T=p.useRef(0),N=p.useRef(null),I=p.useRef("right"),R=p.useRef(0),L=m?ps:p.Fragment,D=m?{as:Mc,allowPinchZoom:!0}:void 0,O=E=>{var X,ye;const z=_.current+E,G=C().filter(K=>!K.disabled),Y=document.activeElement,ne=(X=G.find(K=>K.ref.current===Y))==null?void 0:X.textValue,ve=G.map(K=>K.textValue),Ae=Fc(ve,z,ne),W=(ye=G.find(K=>K.textValue===Ae))==null?void 0:ye.ref.current;(function K(Be){_.current=Be,window.clearTimeout(M.current),Be!==""&&(M.current=window.setTimeout(()=>K(""),1e3))})(z),W&&setTimeout(()=>W.focus())};p.useEffect(()=>()=>window.clearTimeout(M.current),[]),fs();const A=p.useCallback(E=>{var G,Y;return I.current===((G=N.current)==null?void 0:G.side)&&Bc(E,(Y=N.current)==null?void 0:Y.area)},[]);return i.jsx(jc,{scope:n,searchRef:_,onItemEnter:p.useCallback(E=>{A(E)&&E.preventDefault()},[A]),onItemLeave:p.useCallback(E=>{var z;A(E)||((z=k.current)==null||z.focus(),j(null))},[A]),onTriggerLeave:p.useCallback(E=>{A(E)&&E.preventDefault()},[A]),pointerGraceTimerRef:T,onPointerGraceIntentChange:p.useCallback(E=>{N.current=E},[]),children:i.jsx(L,{...D,children:i.jsx(hs,{asChild:!0,trapped:o,onMountAutoFocus:F(s,E=>{var z;E.preventDefault(),(z=k.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:i.jsx(xs,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:g,children:i.jsx(ic,{asChild:!0,...b,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:j,onEntryFocus:F(a,E=>{y.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(Ya,{role:"menu","aria-orientation":"vertical","data-state":Ho(v.open),"data-radix-menu-content":"",dir:y.dir,...w,...x,ref:P,style:{outline:"none",...x.style},onKeyDown:F(x.onKeyDown,E=>{const G=E.target.closest("[data-radix-menu-content]")===E.currentTarget,Y=E.ctrlKey||E.altKey||E.metaKey,ne=E.key.length===1;G&&(E.key==="Tab"&&E.preventDefault(),!Y&&ne&&O(E.key));const ve=k.current;if(E.target!==ve||!xc.includes(E.key))return;E.preventDefault();const W=C().filter(X=>!X.disabled).map(X=>X.ref.current);So.includes(E.key)&&W.reverse(),Dc(W)}),onBlur:F(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(M.current),_.current="")}),onPointerMove:F(e.onPointerMove,Qe(E=>{const z=E.target,G=R.current!==E.clientX;if(E.currentTarget.contains(z)&&G){const Y=E.clientX>R.current?"right":"left";I.current=Y,R.current=E.clientX}}))})})})})})})});Po.displayName=J;var Ec="MenuGroup",yn=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(te.div,{role:"group",...r,ref:t})});yn.displayName=Ec;var Pc="MenuLabel",To=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(te.div,{...r,ref:t})});To.displayName=Pc;var yt="MenuItem",yr="menu.itemSelect",Mt=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=p.useRef(null),l=st(yt,e.__scopeMenu),c=gn(yt,e.__scopeMenu),a=ae(t,s),u=p.useRef(!1),d=()=>{const h=s.current;if(!n&&h){const f=new CustomEvent(yr,{bubbles:!0,cancelable:!0});h.addEventListener(yr,g=>r==null?void 0:r(g),{once:!0}),ms(h,f),f.defaultPrevented?u.current=!1:l.onClose()}};return i.jsx(Ao,{...o,ref:a,disabled:n,onClick:F(e.onClick,d),onPointerDown:h=>{var f;(f=e.onPointerDown)==null||f.call(e,h),u.current=!0},onPointerUp:F(e.onPointerUp,h=>{var f;u.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:F(e.onKeyDown,h=>{const f=c.searchRef.current!=="";n||f&&h.key===" "||Yt.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Mt.displayName=yt;var Ao=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,l=gn(yt,n),c=Ro(n),a=p.useRef(null),u=ae(t,a),[d,h]=p.useState(!1),[f,g]=p.useState("");return p.useEffect(()=>{const m=a.current;m&&g((m.textContent??"").trim())},[s.children]),i.jsx(Je.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:i.jsx(ac,{asChild:!0,...c,focusable:!r,children:i.jsx(te.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:F(e.onPointerMove,Qe(m=>{r?l.onItemLeave(m):(l.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:F(e.onPointerLeave,Qe(m=>l.onItemLeave(m))),onFocus:F(e.onFocus,()=>h(!0)),onBlur:F(e.onBlur,()=>h(!1))})})})}),Tc="MenuCheckboxItem",No=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return i.jsx(Do,{scope:e.__scopeMenu,checked:n,children:i.jsx(Mt,{role:"menuitemcheckbox","aria-checked":bt(n)?"mixed":n,...o,ref:t,"data-state":wn(n),onSelect:F(o.onSelect,()=>r==null?void 0:r(bt(n)?!0:!n),{checkForDefaultPrevented:!1})})})});No.displayName=Tc;var Io="MenuRadioGroup",[Ac,Nc]=Pe(Io,{value:void 0,onValueChange:()=>{}}),Lo=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=tt(r);return i.jsx(Ac,{scope:e.__scopeMenu,value:n,onValueChange:s,children:i.jsx(yn,{...o,ref:t})})});Lo.displayName=Io;var Oo="MenuRadioItem",_o=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=Nc(Oo,e.__scopeMenu),s=n===o.value;return i.jsx(Do,{scope:e.__scopeMenu,checked:s,children:i.jsx(Mt,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":wn(s),onSelect:F(r.onSelect,()=>{var l;return(l=o.onValueChange)==null?void 0:l.call(o,n)},{checkForDefaultPrevented:!1})})})});_o.displayName=Oo;var bn="MenuItemIndicator",[Do,Ic]=Pe(bn,{checked:!1}),zo=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=Ic(bn,n);return i.jsx(wt,{present:r||bt(s.checked)||s.checked===!0,children:i.jsx(te.span,{...o,ref:t,"data-state":wn(s.checked)})})});zo.displayName=bn;var Lc="MenuSeparator",Fo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Fo.displayName=Lc;var Oc="MenuArrow",$o=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=kt(n);return i.jsx(Xa,{...o,...r,ref:t})});$o.displayName=Oc;var _c="MenuSub",[au,Bo]=Pe(_c),Ke="MenuSubTrigger",Go=p.forwardRef((e,t)=>{const n=Te(Ke,e.__scopeMenu),r=st(Ke,e.__scopeMenu),o=Bo(Ke,e.__scopeMenu),s=gn(Ke,e.__scopeMenu),l=p.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:a}=s,u={__scopeMenu:e.__scopeMenu},d=p.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return p.useEffect(()=>d,[d]),p.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),a(null)}},[c,a]),i.jsx(xn,{asChild:!0,...u,children:i.jsx(Ao,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Ho(n.open),...e,ref:qt(t,o.onTriggerChange),onClick:h=>{var f;(f=e.onClick)==null||f.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:F(e.onPointerMove,Qe(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(s.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:F(e.onPointerLeave,Qe(h=>{var g,m;d();const f=(g=n.content)==null?void 0:g.getBoundingClientRect();if(f){const x=(m=n.content)==null?void 0:m.dataset.side,v=x==="right",y=v?-5:5,w=f[v?"left":"right"],b=f[v?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+y,y:h.clientY},{x:w,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:w,y:f.bottom}],side:x}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:F(e.onKeyDown,h=>{var g;const f=s.searchRef.current!=="";e.disabled||f&&h.key===" "||mc[r.dir].includes(h.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),h.preventDefault())})})})});Go.displayName=Ke;var Wo="MenuSubContent",Vo=p.forwardRef((e,t)=>{const n=Mo(J,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Te(J,e.__scopeMenu),l=st(J,e.__scopeMenu),c=Bo(Wo,e.__scopeMenu),a=p.useRef(null),u=ae(t,a);return i.jsx(Je.Provider,{scope:e.__scopeMenu,children:i.jsx(wt,{present:r||s.open,children:i.jsx(Je.Slot,{scope:e.__scopeMenu,children:i.jsx(vn,{id:c.contentId,"aria-labelledby":c.triggerId,...o,ref:u,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;l.isUsingKeyboardRef.current&&((h=a.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:F(e.onFocusOutside,d=>{d.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:F(e.onEscapeKeyDown,d=>{l.onClose(),d.preventDefault()}),onKeyDown:F(e.onKeyDown,d=>{var g;const h=d.currentTarget.contains(d.target),f=gc[l.dir].includes(d.key);h&&f&&(s.onOpenChange(!1),(g=c.trigger)==null||g.focus(),d.preventDefault())})})})})})});Vo.displayName=Wo;function Ho(e){return e?"open":"closed"}function bt(e){return e==="indeterminate"}function wn(e){return bt(e)?"indeterminate":e?"checked":"unchecked"}function Dc(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function zc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Fc(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let l=zc(e,Math.max(s,0));o.length===1&&(l=l.filter(u=>u!==n));const a=l.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}function $c(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,l=t.length-1;s<t.length;l=s++){const c=t[s],a=t[l],u=c.x,d=c.y,h=a.x,f=a.y;d>r!=f>r&&n<(h-u)*(r-d)/(f-d)+u&&(o=!o)}return o}function Bc(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return $c(n,t)}function Qe(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Gc=ko,Wc=xn,Vc=Eo,Hc=Po,Kc=yn,Uc=To,Yc=Mt,Xc=No,Zc=Lo,qc=_o,Jc=zo,Qc=Fo,el=$o,tl=Go,nl=Vo,Cn="ContextMenu",[rl]=et(Cn,[jo]),H=jo(),[ol,Ko]=rl(Cn),Uo=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:o,modal:s=!0}=e,[l,c]=p.useState(!1),a=H(t),u=tt(r),d=p.useCallback(h=>{c(h),u(h)},[u]);return i.jsx(ol,{scope:t,open:l,onOpenChange:d,modal:s,children:i.jsx(Gc,{...a,dir:o,open:l,onOpenChange:d,modal:s,children:n})})};Uo.displayName=Cn;var Yo="ContextMenuTrigger",Xo=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...o}=e,s=Ko(Yo,n),l=H(n),c=p.useRef({x:0,y:0}),a=p.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),u=p.useRef(0),d=p.useCallback(()=>window.clearTimeout(u.current),[]),h=f=>{c.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return p.useEffect(()=>d,[d]),p.useEffect(()=>void(r&&d()),[r,d]),i.jsxs(i.Fragment,{children:[i.jsx(Wc,{...l,virtualRef:a}),i.jsx(te.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...o,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:F(e.onContextMenu,f=>{d(),h(f),f.preventDefault()}),onPointerDown:r?e.onPointerDown:F(e.onPointerDown,ut(f=>{d(),u.current=window.setTimeout(()=>h(f),700)})),onPointerMove:r?e.onPointerMove:F(e.onPointerMove,ut(d)),onPointerCancel:r?e.onPointerCancel:F(e.onPointerCancel,ut(d)),onPointerUp:r?e.onPointerUp:F(e.onPointerUp,ut(d))})]})});Xo.displayName=Yo;var sl="ContextMenuPortal",Zo=e=>{const{__scopeContextMenu:t,...n}=e,r=H(t);return i.jsx(Vc,{...r,...n})};Zo.displayName=sl;var qo="ContextMenuContent",Jo=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Ko(qo,n),s=H(n),l=p.useRef(!1);return i.jsx(Hc,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{var a;(a=e.onCloseAutoFocus)==null||a.call(e,c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{var a;(a=e.onInteractOutside)==null||a.call(e,c),!c.defaultPrevented&&!o.modal&&(l.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Jo.displayName=qo;var il="ContextMenuGroup",al=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(Kc,{...o,...r,ref:t})});al.displayName=il;var cl="ContextMenuLabel",ll=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(Uc,{...o,...r,ref:t})});ll.displayName=cl;var ul="ContextMenuItem",Qo=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(Yc,{...o,...r,ref:t})});Qo.displayName=ul;var dl="ContextMenuCheckboxItem",fl=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(Xc,{...o,...r,ref:t})});fl.displayName=dl;var pl="ContextMenuRadioGroup",hl=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(Zc,{...o,...r,ref:t})});hl.displayName=pl;var xl="ContextMenuRadioItem",ml=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(qc,{...o,...r,ref:t})});ml.displayName=xl;var gl="ContextMenuItemIndicator",vl=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(Jc,{...o,...r,ref:t})});vl.displayName=gl;var yl="ContextMenuSeparator",es=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(Qc,{...o,...r,ref:t})});es.displayName=yl;var bl="ContextMenuArrow",wl=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(el,{...o,...r,ref:t})});wl.displayName=bl;var Cl="ContextMenuSubTrigger",Sl=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(tl,{...o,...r,ref:t})});Sl.displayName=Cl;var jl="ContextMenuSubContent",Rl=p.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return i.jsx(nl,{...o,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Rl.displayName=jl;function ut(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var kl=Uo,Ml=Xo,El=Zo,Pl=Jo,Tl=Qo,Al=es;function Nl(e,t,n){const r=[],o=n.toLowerCase();function s(l,c){for(const a of l)o&&a.type==="file"&&!a.name.toLowerCase().includes(o)&&!a.path.toLowerCase().includes(o)||(r.push({node:a,depth:c}),a.type==="directory"&&a.children&&(o||t.has(a.path))&&s(a.children,c+1))}return s(e,0),r}function Il(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[o,s]=p.useState(""),[l,c]=p.useState(new Set),a=p.useCallback(async()=>{r(!0);try{const f=await fetch("/api/workspace?tree=true");f.ok&&t(await f.json())}catch{}finally{r(!1)}},[]);p.useEffect(()=>{a()},[a]);const u=p.useCallback(f=>{f.type==="directory"&&c(g=>{const m=new Set(g);return m.has(f.path)?m.delete(f.path):m.add(f.path),m})},[]),d=p.useCallback(()=>{c(new Set)},[]),h=p.useMemo(()=>Nl(e,l,o),[e,l,o]);return{tree:e,loading:n,refreshTree:a,flatNodes:h,expandedPaths:l,searchQuery:o,setSearchQuery:s,toggleExpand:u,collapseAll:d}}function Ll(e=15e3){const[t,n]=p.useState(""),[r,o]=p.useState([]),[s,l]=p.useState([]),[c,a]=p.useState([]),[u,d]=p.useState([]),[h,f]=p.useState(!0),[g,m]=p.useState(null),x=p.useRef(!0),v=p.useCallback(async()=>{f(!0),m(null);try{const[y,w]=await Promise.all([fetch("/api/git/status"),fetch("/api/git/log?limit=8")]);if(!x.current)return;if(y.ok){const b=await y.json();b.error?m(b.error):(n(b.branch??""),o(b.staged??[]),l(b.unstaged??[]),a(b.untracked??[]))}else m(`Status fetch failed (${y.status})`);if(w.ok){const b=await w.json();b.error||d(b.commits??[])}}catch(y){x.current&&m(y.message)}finally{x.current&&f(!1)}},[]);return p.useEffect(()=>{x.current=!0,v();const y=setInterval(v,e);return()=>{x.current=!1,clearInterval(y)}},[v,e]),{branch:t,staged:r,unstaged:s,untracked:c,commits:u,loading:h,error:g,refresh:v}}function Ol(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}const ts={chat:{title:"Conversations",path:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},files:{title:"Explorer",path:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"},git:{title:"Source Control",path:""},search:{title:"Search",path:""}};function _l({tab:e}){return e==="git"?i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("path",{d:"M13 6h3a2 2 0 0 1 2 2v7"}),i.jsx("line",{x1:"6",y1:"9",x2:"6",y2:"21"})]}):e==="search"?i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"11",cy:"11",r:"8"}),i.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}):i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:ts[e].path})})}function Xt(e){return e.type==="leaf"?[e]:[...Xt(e.first),...Xt(e.second)]}async function Dl(e){try{await navigator.clipboard.writeText(e)}catch{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}}const ns={Read:"R",Glob:"R",Grep:"R",Edit:"M",Write:"C",NotebookEdit:"M"};function zl(e){var n,r;const t=new Map;for(const o of e)if(o.type==="tool_use"){const s=ns[o.name];if(!s)continue;const l=((n=o.input)==null?void 0:n.file_path)??((r=o.input)==null?void 0:r.path);if(!l||typeof l!="string")continue;const c=t.get(l);c?c.add(s):t.set(l,new Set([s]))}else if(o.type==="file_change"){const s=o.action==="create"?"C":o.action==="delete"?"D":"M",l=t.get(o.path);l?l.add(s):t.set(o.path,new Set([s]))}return[...t.entries()].map(([o,s])=>({path:o,name:o.split(/[\\/]/).pop()??o,ops:s}))}const br={R:{color:"var(--color-accent-blue)",bg:"rgba(91,141,184,0.12)"},M:{color:"var(--color-accent-yellow)",bg:"rgba(184,149,64,0.12)"},C:{color:"var(--color-accent-green)",bg:"rgba(90,158,120,0.12)"},D:{color:"var(--color-accent-red)",bg:"rgba(196,101,85,0.12)"}};function Fl({onSelectFile:e}){const t=$(c=>c.activeProcessId),n=$(c=>t?c.entries[t]:void 0),[r,o]=p.useState(!1),s=p.useMemo(()=>n?zl(n):[],[n]);if(!t||s.length===0)return null;const l=s.filter(c=>c.ops.has("M")||c.ops.has("C")).length;return i.jsxs("div",{className:"mt-1 border-t",style:{borderColor:"var(--color-border-divider)"},children:[i.jsxs("button",{type:"button",onClick:()=>o(c=>!c),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"5px 6px",fontFamily:"inherit"},children:[i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:r?"rotate(0deg)":"rotate(90deg)",transition:"transform 100ms"},children:i.jsx("path",{d:"M2 1l4 3-4 3z"})}),i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--color-text-tertiary)",flexShrink:0},children:[i.jsx("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),i.jsx("polyline",{points:"14 2 14 8 20 8"})]}),i.jsxs("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] flex-1",style:{color:"var(--color-text-tertiary)"},children:["Session Files (",s.length,")"]}),l>0&&i.jsxs("span",{className:"text-[9px] font-medium px-[4px] rounded",style:{backgroundColor:"var(--color-tint-executing)",color:"var(--color-accent-yellow)"},children:[l," modified"]})]}),!r&&i.jsx("div",{className:"flex flex-col gap-px pb-1",children:s.map(c=>i.jsxs("button",{type:"button",onClick:()=>e(c.path),className:"flex items-center gap-[5px] w-full rounded-[4px] border-none bg-transparent cursor-pointer text-left transition-colors duration-75",style:{padding:"3px 7px",fontFamily:"inherit",color:"var(--color-text-primary)"},title:c.path,onMouseEnter:a=>{a.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:a=>{a.currentTarget.style.backgroundColor="transparent"},children:[i.jsx(jn,{}),i.jsx("span",{className:"flex-1 min-w-0 text-[11px] truncate",children:c.name}),i.jsx("span",{className:"flex gap-[2px] shrink-0",children:[...c.ops].map(a=>i.jsx("span",{className:"text-[8px] font-bold px-[3px] rounded-[2px]",style:{color:br[a].color,backgroundColor:br[a].bg},children:a},a))})]},c.path))})]})}function $l({searchQuery:e}){const t=$(x=>x.processes),n=$(x=>x.setActiveProcessId),r=$(x=>x.activeProcessId),o=$(x=>x.selectedProcessIds),[s,l]=p.useState(null),c=p.useRef(null),{state:a,dispatch:u}=fe(),d=p.useCallback(async(x,v)=>{var P;if(v&&(v.ctrlKey||v.metaKey)){v.preventDefault(),$.getState().toggleProcessSelection(x),c.current=x;return}const{selectedProcessIds:y,clearProcessSelection:w}=$.getState();if(y.size>0&&!y.has(x)){$.getState().toggleProcessSelection(x),c.current=x;return}if(y.has(x)&&y.size===1){w(),c.current=null;return}w(),n(x),c.current=x;const b=`chat-${x}`,C=Xt(a.editorArea);for(const M of C)if(M.tabs.some(_=>_.id===b)){M.activeTabId!==b&&u({type:"SET_ACTIVE_TAB",groupId:M.id,tabId:b});break}const{entries:S,setEntries:j}=$.getState(),k=S[x];if(!(k&&k.some(M=>M.type==="user_message"||M.type==="assistant_message"))){l(x);try{const M=x.startsWith("cli-history-"),_=M?x.replace("cli-history-",""):x,T=M?`/api/cli-history/${encodeURIComponent(_)}/entries`:`/api/agents/${encodeURIComponent(x)}/entries`,N=await fetch(T);if(N.ok){const I=await N.json(),R=[];for(const O of I){const A={...O,processId:x};if(A.type==="assistant_message"){A.partial=!1;const E=R[R.length-1];if(E&&E.type==="assistant_message"){E.content+=A.content;continue}}if(A.type==="tool_use"&&(A.status==="completed"||A.status==="failed")){const E=R.findLastIndex(z=>z.type==="tool_use"&&z.status==="running");if(E!==-1){const z=R[E];R[E]={...z,status:A.status,result:A.result??z.result,input:z.input&&Object.keys(z.input).length>0?z.input:A.input};continue}}R.push(A)}const L=[];for(let O=0;O<R.length;O++)R[O].type==="token_usage"&&L.push(O);if(L.length>1)for(let O=L.length-2;O>=0;O--)R.splice(L[O],1);if(!R.some(O=>O.type==="user_message")){const O=$.getState().processes[x],A=(P=O==null?void 0:O.config)==null?void 0:P.prompt;if(A){const E={id:`synth-user-${x}`,processId:x,timestamp:O.startedAt,type:"user_message",content:A};R.unshift(E)}}j(x,R)}}catch{}l(null)}},[n,a.editorArea,u]);p.useEffect(()=>{function x(v){const{selectedProcessIds:y,clearProcessSelection:w,batchDismissProcesses:b}=$.getState();v.key==="Escape"&&y.size>0&&w(),v.key==="Delete"&&y.size>0&&b(y)}return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[]);const h=$(x=>x.processTitles),{active:f,completed:g}=p.useMemo(()=>{var b,C;const x=e==null?void 0:e.trim().toLowerCase(),v=Object.values(t),y=[],w=[];for(const S of v){if(x){const j=h[S.id]??((C=(b=S.config)==null?void 0:b.prompt)==null?void 0:C.slice(0,80))??"",k=Zt[S.type]??S.type;if(!`${j} ${k} ${S.type}`.toLowerCase().includes(x))continue}S.status==="running"||S.status==="spawning"?y.push(S):w.push(S)}return y.sort((S,j)=>new Date(j.startedAt).getTime()-new Date(S.startedAt).getTime()),w.sort((S,j)=>new Date(j.startedAt).getTime()-new Date(S.startedAt).getTime()),{active:y,completed:w}},[t,e,h]),m=o.size>0;return f.length===0&&g.length===0?i.jsxs("div",{className:"flex flex-col items-center gap-3 px-4 py-8 text-center",children:[i.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--color-text-placeholder)",opacity:.6},children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[12px] font-medium mb-1",style:{color:"var(--color-text-secondary)"},children:"No sessions yet"}),i.jsx("div",{className:"text-[10px] leading-relaxed",style:{color:"var(--color-text-tertiary)"},children:"Start an agent session from the Kanban board, or use the CLI to delegate tasks."})]}),i.jsx("div",{className:"flex flex-col gap-1.5 w-full mt-1",children:i.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md text-[10px]",style:{backgroundColor:"var(--color-bg-hover)"},children:[i.jsx("span",{style:{color:"var(--color-text-placeholder)"},children:"Tip"}),i.jsx("span",{style:{color:"var(--color-text-tertiary)"},children:"Ctrl+Click to multi-select sessions"})]})})]}):i.jsxs(i.Fragment,{children:[f.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] px-[6px] pt-[6px] pb-[2px]",style:{color:"var(--color-text-tertiary)"},children:["Active (",f.length,")"]}),f.map(x=>i.jsx(wr,{process:x,isActive:x.id===r,isSelected:o.has(x.id),hasSelection:m,loading:s===x.id,onSelect:d},x.id))]}),g.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] px-[6px] pt-[8px] pb-[2px]",style:{color:"var(--color-text-tertiary)"},children:["Completed (",g.length,")"]}),g.map(x=>i.jsx(wr,{process:x,isActive:x.id===r,isSelected:o.has(x.id),hasSelection:m,loading:s===x.id,onSelect:d},x.id))]}),m&&i.jsx(Bl,{count:o.size})]})}function Bl({count:e}){const t=$(o=>o.clearProcessSelection),n=$(o=>o.selectedProcessIds),r=p.useCallback(()=>{$.getState().batchDismissProcesses(n)},[n]);return i.jsxs("div",{className:"flex items-center gap-2 mx-1 mt-2 px-3 py-2 rounded-lg",style:{backgroundColor:"var(--color-tint-exploring)",border:"1px solid var(--color-accent-blue)"},children:[i.jsxs("span",{className:"text-[11px] font-medium flex-1",style:{color:"var(--color-text-primary)"},children:[e," selected"]}),i.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium border-none cursor-pointer",style:{backgroundColor:"var(--color-tint-blocked)",color:"var(--color-accent-red)"},children:[i.jsx(kr,{size:11}),"Delete"]}),i.jsx("button",{type:"button",onClick:t,className:"px-2 py-1 rounded text-[10px] border-none cursor-pointer",style:{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-secondary)"},children:"Cancel"})]})}function wr({process:e,isActive:t,isSelected:n,hasSelection:r,loading:o,onSelect:s}){var k,P;const[l,c]=p.useState(!1),[a,u]=p.useState(""),d=p.useRef(null),h=$(M=>M.processTitles),f=$(M=>M.entries[e.id]),g=p.useMemo(()=>{var N,I;if(!f)return null;let M=0,_=0;const T=new Set;for(const R of f)if(R.type==="tool_use"&&ns[R.name]){const L=((N=R.input)==null?void 0:N.file_path)??((I=R.input)==null?void 0:I.path);L&&!T.has(L)&&(T.add(L),M++)}else R.type==="file_change"&&!T.has(R.path)?(T.add(R.path),M++):R.type==="token_usage"&&(_=R.inputTokens+R.outputTokens);return{fileCount:M,tokens:_}},[f]),x=e.status==="running"||e.status==="spawning"?"var(--color-accent-green)":e.status==="error"?"var(--color-accent-red, #D05454)":"var(--color-text-placeholder)",v=Zt[e.type]??e.type,y=h[e.id]??((P=(k=e.config)==null?void 0:k.prompt)==null?void 0:P.slice(0,40))??v,w=p.useCallback(()=>{u(y),c(!0),requestAnimationFrame(()=>{var M;return(M=d.current)==null?void 0:M.focus()})},[y]),b=p.useCallback(()=>{const M=a.trim();M&&M!==y&&$.getState().renameProcess(e.id,M),c(!1)},[a,y,e.id]),C=p.useCallback(M=>{M.key==="Enter"?(M.preventDefault(),b()):M.key==="Escape"&&c(!1)},[b]),S=p.useCallback(()=>{Dl(y)},[y]),j=p.useCallback(()=>{$.getState().dismissProcess(e.id)},[e.id]);return i.jsxs(kl,{children:[i.jsx(Ml,{asChild:!0,children:i.jsxs("div",{className:"relative flex items-center gap-[7px] w-full rounded-[5px] cursor-pointer transition-all duration-100",style:{padding:"5px 7px",backgroundColor:n?"var(--color-tint-exploring)":t?"var(--color-bg-active)":"transparent",borderLeft:n?"2px solid var(--color-accent-blue)":"2px solid transparent"},onClick:M=>s(e.id,M),onMouseEnter:M=>{!t&&!n&&(M.currentTarget.style.backgroundColor="var(--color-bg-hover)")},onMouseLeave:M=>{!t&&!n&&(M.currentTarget.style.backgroundColor="transparent")},children:[r&&i.jsx("span",{className:"shrink-0 w-[13px] h-[13px] rounded-[3px] border flex items-center justify-center",style:{borderColor:n?"var(--color-accent-blue)":"var(--color-border)",backgroundColor:n?"var(--color-accent-blue)":"transparent"},children:n&&i.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"20 6 9 17 4 12"})})}),i.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:x}}),i.jsxs("div",{className:"flex-1 min-w-0",children:[l?i.jsx("input",{ref:d,type:"text",value:a,onChange:M=>u(M.target.value),onBlur:b,onKeyDown:C,className:"w-full text-[11px] font-medium bg-transparent border-b outline-none py-0",style:{color:"var(--color-text-primary)",borderColor:"var(--color-accent-blue)",fontFamily:"inherit"},onClick:M=>M.stopPropagation()}):i.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:"var(--color-text-primary)"},children:o?"Loading...":y}),i.jsxs("div",{className:"flex items-center gap-[4px] text-[9px]",style:{color:"var(--color-text-tertiary)"},children:[i.jsxs("span",{children:[Ol(e.startedAt)," · ",v.toLowerCase()]}),g&&g.fileCount>0&&i.jsxs("span",{className:"flex items-center gap-[2px] ml-auto shrink-0",style:{color:"var(--color-text-placeholder)"},children:[i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"})}),g.fileCount]}),g&&g.tokens>0&&i.jsxs("span",{className:"shrink-0",style:{color:"var(--color-text-placeholder)"},children:[g.tokens>1e3?`${(g.tokens/1e3).toFixed(0)}k`:g.tokens,"t"]})]})]})]})}),i.jsx(El,{children:i.jsxs(Pl,{className:"min-w-[150px] z-[100] rounded-md py-1",style:{backgroundColor:"var(--color-bg-elevated, var(--color-bg-primary))",border:"1px solid var(--color-border)",boxShadow:"0 4px 16px rgba(0,0,0,0.12)"},onCloseAutoFocus:M=>M.preventDefault(),children:[i.jsx(Lt,{icon:i.jsx(bs,{size:13}),label:"Rename",shortcut:"F2",onSelect:w}),i.jsx(Lt,{icon:i.jsx(Cs,{size:13}),label:"Copy Title",onSelect:S}),i.jsx(Al,{className:"h-px my-1",style:{backgroundColor:"var(--color-border-divider)"}}),i.jsx(Lt,{icon:i.jsx(kr,{size:13}),label:"Delete",shortcut:"Del",destructive:!0,onSelect:j})]})})]})}function Lt({icon:e,label:t,shortcut:n,destructive:r,onSelect:o}){return i.jsxs(Tl,{className:"flex items-center gap-2 w-full px-3 py-1.5 text-[12px] rounded-sm cursor-pointer outline-none transition-colors",style:{color:r?"var(--color-accent-red)":"var(--color-text-secondary)"},onSelect:o,onMouseEnter:s=>{s.currentTarget.style.backgroundColor=r?"var(--color-tint-blocked)":"var(--color-bg-hover)"},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent"},children:[i.jsx("span",{className:"shrink-0",style:{opacity:.7},children:e}),i.jsx("span",{className:"flex-1",children:t}),n&&i.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--color-text-tertiary)"},children:n})]})}function Sn(e){return e.type==="leaf"?e:Sn(e.first)}function Gl(){const{sidebarOpen:e,activeTab:t,setActiveTab:n}=ki(),[r,o]=p.useState(""),s=Il(),{state:l,dispatch:c}=fe(),a=p.useCallback(u=>{const d=Sn(l.editorArea),h=u.split(/[\\/]/).pop()??u;c({type:"OPEN_TAB",groupId:d.id,tab:{id:`file-${u}`,type:"file",title:h,ref:u}})},[l.editorArea,c]);return i.jsxs("div",{className:"shrink-0 flex flex-col overflow-hidden transition-[width] duration-200",style:{width:e?230:0,backgroundColor:"var(--color-bg-secondary)",borderRight:e?"1px solid var(--color-border)":"none"},children:[i.jsx("div",{className:"flex items-center shrink-0",style:{height:32,padding:"0 4px",borderBottom:"1px solid var(--color-border-divider)"},children:["chat","files","git","search"].map(u=>i.jsx("button",{type:"button",onClick:()=>n(u),title:ts[u].title,className:"flex items-center justify-center border-none bg-transparent cursor-pointer transition-all duration-100",style:{width:30,height:32,color:t===u?"var(--color-text-primary)":"var(--color-text-tertiary)",borderBottom:t===u?"2px solid var(--color-text-primary)":"2px solid transparent"},onMouseEnter:d=>{t!==u&&(d.currentTarget.style.color="var(--color-text-primary)")},onMouseLeave:d=>{t!==u&&(d.currentTarget.style.color="var(--color-text-tertiary)")},children:i.jsx(_l,{tab:u})},u))}),i.jsx("div",{className:"px-[8px] py-[4px]",children:i.jsxs("div",{className:"relative",children:[i.jsxs("svg",{className:"absolute left-[7px] top-1/2 -translate-y-1/2 pointer-events-none",width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-text-placeholder)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"11",cy:"11",r:"8"}),i.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),i.jsx("input",{type:"text",value:r,onChange:u=>o(u.target.value),placeholder:"Search...",className:"w-full py-[4px] pl-[26px] pr-[7px] text-[11px] rounded-[5px] border outline-none transition-[border-color] duration-100",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-card)",color:"var(--color-text-primary)",fontFamily:"inherit"},onFocus:u=>{u.currentTarget.style.borderColor="var(--color-accent-blue)"},onBlur:u=>{u.currentTarget.style.borderColor="var(--color-border)"}})]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-[6px] pb-[8px]",children:[t==="chat"&&i.jsxs(i.Fragment,{children:[i.jsx($l,{searchQuery:r}),i.jsx(Fl,{onSelectFile:a})]}),t==="files"&&i.jsx(ys,{tree:s.tree,selectedPath:null,onSelectFile:a,loading:s.loading}),t==="git"&&i.jsx(Hl,{}),t==="search"&&i.jsx(Wl,{searchQuery:r,onSelectFile:a})]})]})}function Wl({searchQuery:e,onSelectFile:t}){const[n,r]=p.useState([]),[o,s]=p.useState(0),[l,c]=p.useState(!1),[a,u]=p.useState(new Set),d=p.useRef(null);p.useEffect(()=>{if(d.current&&clearTimeout(d.current),e.length<2){r([]),s(0);return}return c(!0),d.current=setTimeout(async()=>{try{const g=await fetch(`/api/workspace/search?q=${encodeURIComponent(e)}&limit=30`);if(g.ok){const m=await g.json();r(m.results),s(m.total),u(new Set)}}catch{}c(!1)},300),()=>{d.current&&clearTimeout(d.current)}},[e]);const h=p.useMemo(()=>{const g=new Map;for(const m of n){const x=g.get(m.file);x?x.push(m):g.set(m.file,[m])}return g},[n]),f=p.useCallback(g=>{u(m=>{const x=new Set(m);return x.has(g)?x.delete(g):x.add(g),x})},[]);return e.length<2?i.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"Type to search across files"}):l?i.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"Searching..."}):n.length===0?i.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"No results"}):i.jsxs("div",{children:[i.jsxs("div",{className:"text-[9px] px-[6px] py-[2px]",style:{color:"var(--color-text-tertiary)"},children:[o," result",o!==1?"s":""," in ",h.size," file",h.size!==1?"s":""]}),[...h.entries()].map(([g,m])=>i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>f(g),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",fontFamily:"inherit"},children:[i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:a.has(g)?"rotate(0deg)":"rotate(90deg)",transition:"transform 100ms"},children:i.jsx("path",{d:"M2 1l4 3-4 3z"})}),i.jsx(jn,{}),i.jsx("span",{className:"flex-1 min-w-0 text-[11px] font-medium truncate",style:{color:"var(--color-text-primary)"},children:g}),i.jsx("span",{className:"text-[9px] shrink-0",style:{color:"var(--color-text-tertiary)"},children:m.length})]}),!a.has(g)&&m.map(x=>i.jsxs("button",{type:"button",onClick:()=>t(g),className:"flex items-center gap-[6px] w-full border-none bg-transparent cursor-pointer text-left transition-colors duration-75",style:{padding:"3px 7px 3px 22px",color:"var(--color-text-primary)",fontFamily:"inherit"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent"},children:[i.jsx("span",{className:"text-[10px] shrink-0 font-mono",style:{color:"var(--color-text-tertiary)",minWidth:28,textAlign:"right"},children:x.line}),i.jsx("span",{className:"text-[11px] truncate min-w-0",children:x.text.trim()})]},`${g}:${x.line}`))]},g))]})}const Cr={M:{bg:"rgba(201,155,45,0.15)",color:"var(--color-accent-yellow)"},A:{bg:"rgba(61,155,111,0.15)",color:"var(--color-accent-green)"},D:{bg:"rgba(208,84,84,0.15)",color:"var(--color-accent-red)"},R:{bg:"rgba(130,130,200,0.15)",color:"var(--color-accent-blue)"}};function Vl({status:e}){const t=Cr[e]??Cr.M;return i.jsx("span",{className:"text-[9px] font-semibold px-[5px] rounded-[3px] shrink-0",style:{backgroundColor:t.bg,color:t.color},children:e})}function jn(){return i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",style:{opacity:.6},children:[i.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),i.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Ot({path:e,status:t,onClick:n}){return i.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-[6px] px-[7px] py-[3px] rounded-[4px] cursor-pointer w-full border-none bg-transparent text-left transition-colors duration-75",style:{color:"var(--color-text-primary)",fontFamily:"inherit"},onMouseEnter:r=>{r.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:r=>{r.currentTarget.style.backgroundColor="transparent"},children:[i.jsx(jn,{}),i.jsx("span",{className:"flex-1 min-w-0 text-[11px] truncate",children:e}),i.jsx(Vl,{status:t})]})}function Hl(){const e=Ll(),{state:t,dispatch:n}=fe(),[r,o]=p.useState(!0),[s,l]=p.useState(!0),[c,a]=p.useState(!0),u=p.useCallback(f=>{const g=Sn(t.editorArea),m=f.split(/[\\/]/).pop()??f;n({type:"OPEN_TAB",groupId:g.id,tab:{id:`file-${f}`,type:"file",title:m,ref:f}})},[t.editorArea,n]);if(e.loading&&!e.branch)return i.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"Loading git status..."});if(e.error&&!e.branch)return i.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-accent-red)"},children:e.error});const d=e.staged.length,h=e.unstaged.length+e.untracked.length;return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-[5px] px-[7px] py-[4px] text-[11px] font-medium",style:{color:"var(--color-text-primary)"},children:[i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-green)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:[i.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),i.jsx("circle",{cx:"18",cy:"6",r:"3"}),i.jsx("circle",{cx:"6",cy:"18",r:"3"}),i.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),i.jsx("span",{className:"flex-1 min-w-0 truncate",children:e.branch||"unknown"}),i.jsx("button",{type:"button",onClick:e.refresh,title:"Refresh",className:"flex items-center justify-center border-none bg-transparent cursor-pointer rounded-[3px] transition-colors duration-75",style:{width:18,height:18,color:"var(--color-text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:f=>{f.currentTarget.style.color="var(--color-text-tertiary)"},children:i.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polyline",{points:"23 4 23 10 17 10"}),i.jsx("polyline",{points:"1 20 1 14 7 14"}),i.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})})]}),d>0&&i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>o(f=>!f),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",fontFamily:"inherit"},children:[i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 100ms"},children:i.jsx("path",{d:"M2 1l4 3-4 3z"})}),i.jsxs("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em]",style:{color:"var(--color-text-tertiary)"},children:["Staged Changes (",d,")"]})]}),r&&e.staged.map(f=>i.jsx(Ot,{path:f.path,status:f.status,onClick:()=>u(f.path)},`staged-${f.path}`))]}),h>0&&i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>l(f=>!f),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",fontFamily:"inherit"},children:[i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:s?"rotate(90deg)":"rotate(0deg)",transition:"transform 100ms"},children:i.jsx("path",{d:"M2 1l4 3-4 3z"})}),i.jsxs("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em]",style:{color:"var(--color-text-tertiary)"},children:["Changes (",h,")"]})]}),s&&i.jsxs(i.Fragment,{children:[e.unstaged.map(f=>i.jsx(Ot,{path:f.path,status:f.status,onClick:()=>u(f.path)},`unstaged-${f.path}`)),e.untracked.map(f=>i.jsx(Ot,{path:f,status:"A",onClick:()=>u(f)},`untracked-${f}`))]})]}),d===0&&h===0&&i.jsx("div",{className:"px-[7px] py-[10px] text-center text-[10px]",style:{color:"var(--color-text-tertiary)"},children:"No changes detected"}),e.commits.length>0&&i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>a(f=>!f),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",marginTop:4,fontFamily:"inherit"},children:[i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:c?"rotate(90deg)":"rotate(0deg)",transition:"transform 100ms"},children:i.jsx("path",{d:"M2 1l4 3-4 3z"})}),i.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em]",style:{color:"var(--color-text-tertiary)"},children:"Recent Commits"})]}),c&&e.commits.map(f=>i.jsxs("div",{className:"flex items-center gap-[6px] px-[7px] py-[3px] text-[10px]",style:{color:"var(--color-text-primary)",opacity:.7},children:[i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"shrink-0",children:i.jsx("circle",{cx:"6",cy:"6",r:"3",fill:"var(--color-text-tertiary)"})}),i.jsxs("span",{className:"truncate min-w-0",children:[i.jsx("span",{className:"font-mono",style:{color:"var(--color-accent-blue)",marginRight:4},children:f.shortHash}),f.message]})]},f.hash))]})]})}function cu(){const e=$(u=>u.activeProcessId),[t,n]=p.useState(!0),[r,o]=p.useState("chat");Rs(e);const s=t&&r==="files",l=p.useCallback(u=>{u?(n(!0),o("files")):r==="files"&&n(!1)},[r]),c=t&&r==="chat",a=p.useCallback(u=>{u?(n(!0),o("chat")):r==="chat"&&n(!1)},[r]);return i.jsx(Hr,{value:{sidebarOpen:t,setSidebarOpen:n,activeTab:r,setActiveTab:o,fileTreeOpen:s,setFileTreeOpen:l,historyOpen:c,setHistoryOpen:a},children:i.jsxs("div",{className:"h-full flex min-w-0 overflow-hidden relative",children:[i.jsx(Gl,{}),i.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:i.jsx(Ri,{})})]})})}export{cu as ChatPage};
@@ -0,0 +1 @@
1
+ import{j as e,ai as L,aj as c,ak as w,r as d,V as z}from"./index-DpcPd-UG.js";import{A as M}from"./index-BxR_3IbJ.js";import{m as T}from"./proxy-DOffTzwA.js";function $(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function D({member:t}){return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-[var(--radius-md)] border border-border bg-bg-secondary hover:shadow-sm transition-shadow",children:[e.jsxs("div",{className:"relative flex-shrink-0 rounded-full flex items-center justify-center",style:{width:40,height:40,backgroundColor:"var(--color-accent-gray)"},children:[e.jsx("span",{className:"text-white text-[length:14px] font-semibold select-none",children:t.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-bg-secondary",style:{backgroundColor:L[t.status]}})]}),e.jsxs("div",{className:"flex flex-col min-w-0 gap-0.5",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary truncate",children:t.name}),(t.currentPhase||t.currentTask)&&e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary truncate",children:[t.currentPhase,t.currentTask].filter(Boolean).join(" / ")}),e.jsx("span",{className:"text-[length:10px] text-text-tertiary",children:$(t.lastSeen)})]})]})}function R(){const t=c(a=>a.filteredMembers());return t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[e.jsx("span",{className:"text-text-secondary text-[length:var(--font-size-sm)]",children:"No team members found"}),e.jsxs("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:["Run ",e.jsx("code",{className:"px-1 py-0.5 bg-bg-hover rounded text-[10px]",children:"maestro team join"})," to join the team"]})]}):e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:t.map(a=>e.jsx(D,{member:a},a.uid))})}function O(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function E({entry:t}){const a=w[t.action]??"#9ca3af";return e.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-[length:var(--font-size-xs)]",style:{borderLeft:`3px solid ${a}`},children:[e.jsx("span",{className:"text-text-tertiary flex-shrink-0 tabular-nums w-12",children:O(t.ts)}),e.jsx("span",{className:"font-[var(--font-weight-medium)] text-text-primary flex-shrink-0",children:t.user}),e.jsxs("span",{className:"text-text-secondary truncate",children:[t.action,t.target?` → ${t.target}`:""]})]})}function _(){const t=c(s=>s.activity),a=d.useRef(null),r=t.slice(-100);return d.useEffect(()=>{const s=a.current;s&&(s.scrollTop=s.scrollHeight)},[r.length]),r.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity yet"})}):e.jsx("div",{ref:a,className:"flex flex-col gap-1 overflow-y-auto h-full pr-1",children:r.map(s=>e.jsx(E,{entry:s},`${s.ts}-${s.user}-${s.action}`))})}const k={high:{label:"High",color:"#dc2626",bg:"rgba(239,68,68,0.08)",border:"rgba(239,68,68,0.2)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(234,179,8,0.08)",border:"rgba(234,179,8,0.2)"},low:{label:"Low",color:"#16a34a",bg:"rgba(34,197,94,0.08)",border:"rgba(34,197,94,0.2)"},none:{label:"None",color:"var(--color-text-tertiary, #9ca3af)",bg:"var(--color-bg-secondary)",border:"var(--color-border)"}};function A(t){return k[t]??k.none}function I(){const t=c(i=>i.aggregated),a=c(i=>i.members);if(c(i=>i.loading)&&t.length===0)return e.jsxs("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2 text-text-secondary",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading analysis data..."]});if(t.length===0)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-3",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M3 9h18"}),e.jsx("path",{d:"M9 21V9"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity data available for analysis"}),e.jsx("span",{className:"text-text-quaternary text-[length:var(--font-size-xs)]",children:"Activity will appear here as team members work on phases and tasks"})]});const s=t.reduce((i,m)=>i+m.count,0),o=new Set(t.flatMap(i=>i.members)).size,h=t.filter(i=>i.risk==="high").length,p=t.filter(i=>i.risk==="medium").length,x=[...t].sort((i,m)=>{const g={high:0,medium:1,low:2,none:3},v=g[i.risk]??3,u=g[m.risk]??3;return v!==u?v-u:m.count-i.count});return e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsx(N,{label:"Total Activity",value:s}),e.jsx(N,{label:"Active Members",value:o,total:a.length}),e.jsx(N,{label:"High Risk",value:h,color:h>0?"#dc2626":void 0}),e.jsx(N,{label:"Medium Risk",value:p,color:p>0?"#ca8a04":void 0})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[length:var(--font-size-xs)] text-text-tertiary",children:[e.jsx("span",{children:"Risk levels:"}),["none","low","medium","high"].map(i=>{const m=A(i);return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:m.color,opacity:.7}}),e.jsx("span",{children:m.label}),e.jsxs("span",{className:"text-text-quaternary",children:["(",i==="none"?"1":i==="low"?"2":i==="medium"?"3":"4+",i==="none"?" member":" members",")"]})]},i)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("h3",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-secondary uppercase tracking-wider",children:"Activity Concentration"}),e.jsx("div",{className:"grid grid-cols-1 gap-2",children:x.map((i,m)=>e.jsx(q,{entry:i},`${i.phase}::${i.task}::${m}`))})]})]})}function N({label:t,value:a,total:r,color:s}){return e.jsxs("div",{className:"rounded-[var(--radius-md,6px)] border border-border bg-bg-secondary px-4 py-3",children:[e.jsx("div",{className:"text-[10px] text-text-tertiary uppercase tracking-wider mb-1",children:t}),e.jsxs("div",{className:"text-[length:var(--font-size-xl)] font-bold",style:{color:s??"var(--color-text-primary)"},children:[a,r!=null&&e.jsxs("span",{className:"text-[length:var(--font-size-sm)] font-normal text-text-quaternary",children:[" / ",r]})]})]})}function q({entry:t}){const a=A(t.risk),r=t.phase||"(no phase)",s=t.task||"(general)";return e.jsxs("div",{className:"flex items-center gap-4 rounded-[var(--radius-md,6px)] px-4 py-3 border transition-colors",style:{backgroundColor:a.bg,borderColor:a.border},children:[e.jsx("div",{className:"flex flex-col items-center gap-1 shrink-0 w-[52px]",children:e.jsx("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-full",style:{color:a.color,backgroundColor:`${a.color}15`},children:a.label})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-medium text-text-primary truncate",children:r}),t.task&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-quaternary",children:"/"}),e.jsx("span",{className:"text-[length:var(--font-size-sm)] text-text-secondary truncate",children:s})]})]})}),e.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-bold text-text-primary",children:t.count}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"actions"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.members.slice(0,5).map(o=>e.jsx("span",{className:"w-6 h-6 rounded-full bg-bg-secondary border border-border flex items-center justify-center text-[10px] font-medium text-text-secondary uppercase",title:o,children:o.charAt(0)},o)),t.members.length>5&&e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:["+",t.members.length-5]})]})]})}const B={init:"⚡",join:"→",leave:"←",phase_change:"◆",task_update:"●",message:"✉",sync:"↻",report:"📋",discussion:"💬"},P=[{value:"all",label:"All types"},{value:"init",label:"Init"},{value:"join",label:"Join"},{value:"phase_change",label:"Phase changes"},{value:"task_update",label:"Task updates"},{value:"message",label:"Messages"},{value:"sync",label:"Sync"}];function F(t){const a=new Date(t),r=new Date,s=new Date(r);return s.setDate(s.getDate()-1),a.toDateString()===r.toDateString()?"Today":a.toDateString()===s.toDateString()?"Yesterday":a.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function H(t){return new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function W(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function V(t){return new Date(t).toDateString()}function U(t){switch(t){case"init":return"Initialized collaboration";case"join":return"Joined the team";case"leave":return"Left the team";case"phase_change":return"Changed phase";case"task_update":return"Updated task";case"message":return"Sent a message";case"sync":return"Synced activity";case"report":return"Generated report";case"discussion":return"Started discussion";default:return t}}function K(t){return`${w[t]??"#9ca3af"}12`}function G(){const t=c(n=>n.filteredActivity()),a=c(n=>n.members),r=c(n=>n.memberFilter),s=c(n=>n.typeFilter),o=c(n=>n.setMemberFilter),h=c(n=>n.setTypeFilter),p=c(n=>n.fetchActivity),x=c(n=>n.loading),[i,m]=d.useState(200);d.useEffect(()=>{p(i)},[p,i]);const g=d.useMemo(()=>{const n=[];let f="";for(const y of t){const j=V(y.ts);j!==f&&(f=j,n.push({day:j,label:F(y.ts),entries:[]})),n[n.length-1].entries.push(y)}return n},[t]),v=new Set(t.map(n=>n.user)).size,u=new Set(t.map(n=>n.action)).size;return x&&t.length===0?e.jsx("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading history..."}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 pb-4",children:[e.jsxs("select",{value:r,onChange:n=>o(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:[e.jsx("option",{value:"all",children:"All members"}),a.map(n=>e.jsx("option",{value:n.uid,children:n.name},n.uid))]}),e.jsx("select",{value:s,onChange:n=>h(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:P.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))}),(r!=="all"||s!=="all")&&e.jsx("button",{type:"button",onClick:()=>{o("all"),h("all")},className:"text-[11px] text-text-tertiary hover:text-text-primary transition-colors",children:"Clear"}),e.jsxs("div",{className:"ml-auto flex items-center gap-4 text-[11px] text-text-quaternary",children:[e.jsxs("span",{children:[t.length," events"]}),e.jsxs("span",{children:[v," users"]}),e.jsxs("span",{children:[u," types"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-2",children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No events match filters"})]}):e.jsx("div",{className:"flex flex-col gap-5",children:g.map(n=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3 sticky top-0 bg-bg-primary z-10 py-1",children:[e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-primary",children:n.label}),e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[n.entries.length," events"]})]}),e.jsx("div",{className:"relative ml-5 pl-5 border-l-2 border-border",children:e.jsx("div",{className:"flex flex-col gap-1",children:n.entries.map((f,y)=>e.jsx(J,{entry:f},`${f.ts}-${f.user}-${f.action}-${y}`))})})]},n.day))}),t.length>=i&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx("button",{type:"button",onClick:()=>m(n=>n+200),className:"px-3 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all border border-border",children:"Load more"})})]})]})}function J({entry:t}){const a=w[t.action]??"#9ca3af",r=B[t.action]??"•",s=t.user.charAt(0).toUpperCase();return e.jsxs("div",{className:"relative flex items-start gap-3 py-2 group hover:bg-bg-secondary/50 rounded-r-[var(--radius-md,6px)] px-3 -ml-[21px] transition-colors",children:[e.jsx("div",{className:"absolute -left-[8px] top-[14px] w-[14px] h-[14px] rounded-full border-2 flex items-center justify-center",style:{borderColor:a,backgroundColor:"var(--color-bg-primary)"},children:e.jsx("span",{style:{fontSize:"7px",lineHeight:1,color:a},children:r})}),e.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-semibold shrink-0 ml-2",style:{backgroundColor:K(t.action),color:a},children:s}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:t.user}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:U(t.action)})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[t.phase_id&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:["Phase ",t.phase_id]}),t.task_id&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:t.task_id}),t.target&&e.jsx("span",{className:"text-[10px] text-text-tertiary truncate max-w-[200px]",title:t.target,children:t.target}),t.host&&e.jsxs("span",{className:"text-[10px] text-text-quaternary flex items-center gap-1",children:[e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),t.host]})]})]}),e.jsxs("div",{className:"flex flex-col items-end shrink-0 gap-0.5",children:[e.jsx("span",{className:"text-[11px] text-text-tertiary tabular-nums",children:H(t.ts)}),e.jsx("span",{className:"text-[10px] text-text-quaternary",children:W(t.ts)})]})]})}const Y=[{label:"Overview",key:"overview",shortcut:"1"},{label:"Analysis",key:"analysis",shortcut:"2"},{label:"History",key:"history",shortcut:"3"}],C=["overview","analysis","history"],Q={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function ae(){const t=c(l=>l.members);c(l=>l.loading);const a=c(l=>l.error),r=c(l=>l.activeTab),s=c(l=>l.fetchMembers),o=c(l=>l.fetchActivity),h=c(l=>l.fetchPresence),p=c(l=>l.fetchAggregated),x=c(l=>l.fetchPreflight),i=c(l=>l.setActiveTab),m=c(l=>l.clearAll),[g,v]=d.useState(null),[u,n]=d.useState(!0),{register:f,unregister:y}=d.useContext(z),j=d.useCallback(l=>i(C[l]),[i]);return d.useEffect(()=>{f({items:Y.map(l=>({label:l.label,icon:null,shortcut:l.shortcut})),activeIndex:C.indexOf(r),onSwitch:j})},[r,f,j]),d.useEffect(()=>()=>y(),[y]),d.useEffect(()=>{function l(b){b.target instanceof HTMLInputElement||b.target instanceof HTMLTextAreaElement||(b.key==="1"?i("overview"):b.key==="2"?i("analysis"):b.key==="3"&&i("history"))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[i]),d.useEffect(()=>{let l=!1;return(async()=>{n(!0);const b=await x();l||(v(b),n(!1),b!=null&&b.exists&&(s(),o(),h(),p()))})(),()=>{l=!0,m()}},[]),u?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading..."}):g!=null&&g.exists?a&&t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-accent-red text-[length:var(--font-size-sm)]",children:"Failed to load collaboration data"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:a}),e.jsx("button",{type:"button",onClick:()=>{s(),o(),h()},className:"px-3 py-1.5 rounded-[var(--radius-md)] text-[11px] font-semibold bg-bg-secondary border border-border text-text-secondary hover:text-text-primary transition-all",children:"Retry"})]}):e.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(M,{mode:"popLayout",children:e.jsxs(T.div,{className:"h-full flex flex-col overflow-hidden",variants:Q,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15},children:[r==="overview"&&e.jsx(Z,{}),r==="analysis"&&e.jsx("div",{className:"p-4 h-full overflow-y-auto",children:e.jsx(I,{})}),r==="history"&&e.jsx("div",{className:"px-4 pt-4 pb-0 h-full flex flex-col overflow-visible",children:e.jsx(G,{})})]},r)})})}):e.jsx(X,{onRefresh:async()=>{const l=await x();v(l),l!=null&&l.exists&&(s(),o(),h(),p())}})}function X({onRefresh:t}){const a=c(x=>x.initCollab),[r,s]=d.useState(!1),[o,h]=d.useState(null);async function p(){s(!0),h(null);const x=await a();x.success?t():(h(x.error??"Unknown error"),s(!1))}return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"max-w-[480px] w-full px-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-12 h-12 rounded-[12px] bg-bg-secondary border border-border flex items-center justify-center mx-auto mb-4",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-secondary",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),e.jsx("h2",{className:"text-[length:var(--font-size-xl)] font-bold text-text-primary mb-2",children:"Team Collaboration"}),e.jsx("p",{className:"text-[length:var(--font-size-sm)] text-text-secondary leading-relaxed",children:"Track team activity, detect file conflicts, and coordinate phase assignments across multiple developers."})]}),e.jsx("div",{className:"border border-border rounded-[var(--radius-md,6px)] bg-bg-secondary p-4 mb-6",children:e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:[{label:"Member presence",desc:"Online/away/offline status"},{label:"Activity feed",desc:"Real-time team actions"},{label:"Conflict detection",desc:"Overlapping file edits"},{label:"Phase coordination",desc:"Who works on what"},{label:"Activity heatmap",desc:"Concentration analysis"},{label:"Collaboration timeline",desc:"Historical view"}].map(x=>e.jsxs("div",{className:"flex items-start gap-2 py-1",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-accent-green mt-[7px] shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-primary font-medium",children:x.label}),e.jsx("div",{className:"text-[10px] text-text-tertiary",children:x.desc})]})]},x.label))})}),e.jsxs("div",{className:"text-center",children:[e.jsx("button",{type:"button",onClick:p,disabled:r,className:"px-5 py-2.5 rounded-[var(--radius-md,6px)] text-[length:var(--font-size-sm)] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-50",children:r?"Initializing...":"Enable Team Collaboration"}),o&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-accent-red mt-2",children:o}),e.jsx("p",{className:"text-[10px] text-text-quaternary mt-2",children:"Creates .workflow/collab/ and registers you as the team owner"})]})]})})}function Z(){const t=c(o=>o.members),a=c(o=>o.presence),r=a.filter(o=>o.status==="online").length,s=a.filter(o=>o.status==="away").length;return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{className:"flex-1 min-w-0 overflow-y-auto p-4",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4 text-[length:var(--font-size-xs)]",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#22c55e]"}),e.jsxs("span",{className:"text-text-secondary",children:[r," online"]})]}),s>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#eab308]"}),e.jsxs("span",{className:"text-text-secondary",children:[s," away"]})]}),e.jsxs("span",{className:"text-text-quaternary",children:[t.length," members total"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx(ee,{}),e.jsx(S,{label:"Sync Activity",command:"maestro team sync",icon:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("polyline",{points:"1 20 1 14 7 14"}),e.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}),e.jsx(S,{label:"Team Status",command:"maestro team status",icon:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})})]}),e.jsx(R,{})]}),e.jsxs("div",{className:"w-[320px] shrink-0 border-l border-border flex flex-col h-full bg-bg-primary",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border",children:e.jsx("h3",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:"Activity"})}),e.jsx("div",{className:"flex-1 overflow-hidden px-4 py-2",children:e.jsx(_,{})})]})]})}function ee(){const t=c(u=>u.addMember),[a,r]=d.useState(!1),[s,o]=d.useState(""),[h,p]=d.useState("member"),[x,i]=d.useState(!1),[m,g]=d.useState(null);async function v(u){u.preventDefault();const n=s.trim();if(!n)return;i(!0),g(null);const f=await t(n,"",h);i(!1),f.success?(o(""),p("member"),r(!1)):g(f.error??"Failed to add member")}return a?e.jsxs("form",{onSubmit:v,className:"flex items-center gap-1.5",children:[e.jsx("input",{autoFocus:!0,value:s,onChange:u=>o(u.target.value),placeholder:"Name",className:"w-[120px] px-2 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-primary placeholder:text-text-quaternary outline-none focus:border-text-tertiary"}),e.jsxs("select",{value:h,onChange:u=>p(u.target.value),className:"px-1.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-secondary outline-none",children:[e.jsx("option",{value:"member",children:"Member"}),e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"viewer",children:"Viewer"})]}),e.jsx("button",{type:"submit",disabled:x||!s.trim(),className:"px-2.5 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-40",children:x?"...":"Add"}),e.jsx("button",{type:"button",onClick:()=>{r(!1),g(null)},className:"px-1.5 py-1.5 text-[11px] text-text-tertiary hover:text-text-primary",children:"Cancel"}),m&&e.jsx("span",{className:"text-[10px] text-accent-red",children:m})]}):e.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"8.5",cy:"7",r:"4"}),e.jsx("line",{x1:"20",y1:"8",x2:"20",y2:"14"}),e.jsx("line",{x1:"23",y1:"11",x2:"17",y2:"11"})]})}),e.jsx("span",{children:"Add Member"})]})}function S({label:t,command:a,icon:r}){const[s,o]=d.useState(!1);return e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(a),o(!0),setTimeout(()=>o(!1),1500)},title:`Copy: ${a}`,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:r}),e.jsx("span",{children:s?"Copied!":t})]})}export{ae as CollabPage};
@@ -1 +1 @@
1
- import{b as c,k as l,j as e}from"./index-uIqUCT8y.js";function d(){const i=c(s=>s.slots),a=c(s=>s.supervisorStatus),t=l(s=>s.processes),n=Object.values(i),r=Object.values(t).filter(s=>s.status==="running");return e.jsxs("div",{className:"h-full overflow-y-auto p-[var(--spacing-2)] text-[11px]",children:[a&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsx("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:"Supervisor"}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary",children:[e.jsx("span",{className:["w-[6px] h-[6px] rounded-full shrink-0",a.enabled?"bg-status-completed":"bg-text-secondary/40"].join(" ")}),e.jsx("span",{children:a.enabled?"Active":"Paused"}),a.lastTickAt&&e.jsxs("span",{className:"ml-auto text-text-secondary/60",children:["Last tick: ",x(a.lastTickAt)]})]})]}),a&&a.running.length>0&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Running (",a.running.length,")"]}),a.running.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.issueId}),e.jsxs("span",{className:"ml-auto",children:["Turn ",s.turnNumber,"/",s.maxTurns]})]},s.processId))]}),n.length>0&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Execution Slots (",n.length,")"]}),n.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.issueId}),e.jsx("span",{className:"ml-auto",children:s.executor})]},s.processId))]}),r.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Active Agents (",r.length,")"]}),r.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.type}),e.jsx("span",{className:"ml-auto",children:s.status})]},s.id))]}),n.length===0&&r.length===0&&!a&&e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-xs)]",children:"No active executions."})]})}function x(i){const a=new Date(i).getTime(),t=Date.now()-a;return isNaN(t)?"":t<1e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:new Date(a).toLocaleTimeString("en-US",{hour12:!1})}export{d as ExecutionPanel};
1
+ import{b as c,k as l,j as e}from"./index-DpcPd-UG.js";function d(){const i=c(s=>s.slots),a=c(s=>s.supervisorStatus),t=l(s=>s.processes),n=Object.values(i),r=Object.values(t).filter(s=>s.status==="running");return e.jsxs("div",{className:"h-full overflow-y-auto p-[var(--spacing-2)] text-[11px]",children:[a&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsx("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:"Supervisor"}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary",children:[e.jsx("span",{className:["w-[6px] h-[6px] rounded-full shrink-0",a.enabled?"bg-status-completed":"bg-text-secondary/40"].join(" ")}),e.jsx("span",{children:a.enabled?"Active":"Paused"}),a.lastTickAt&&e.jsxs("span",{className:"ml-auto text-text-secondary/60",children:["Last tick: ",x(a.lastTickAt)]})]})]}),a&&a.running.length>0&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Running (",a.running.length,")"]}),a.running.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.issueId}),e.jsxs("span",{className:"ml-auto",children:["Turn ",s.turnNumber,"/",s.maxTurns]})]},s.processId))]}),n.length>0&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Execution Slots (",n.length,")"]}),n.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.issueId}),e.jsx("span",{className:"ml-auto",children:s.executor})]},s.processId))]}),r.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Active Agents (",r.length,")"]}),r.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.type}),e.jsx("span",{className:"ml-auto",children:s.status})]},s.id))]}),n.length===0&&r.length===0&&!a&&e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-xs)]",children:"No active executions."})]})}function x(i){const a=new Date(i).getTime(),t=Date.now()-a;return isNaN(t)?"":t<1e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:new Date(a).toLocaleTimeString("en-US",{hour12:!1})}export{d as ExecutionPanel};