commandmate 0.34.1 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +365 -343
  3. package/.next/app-path-routes-manifest.json +29 -29
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +12 -12
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/api/agents/update/route_client-reference-manifest.js +1 -1
  9. package/.next/server/app/api/agents/versions/route_client-reference-manifest.js +1 -1
  10. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/app/update-check/route.js +1 -1
  12. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/assistant/conversation/route.js.nft.json +1 -1
  14. package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/assistant/current-output/route.js.nft.json +1 -1
  16. package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/assistant/messages/route.js +1 -1
  18. package/.next/server/app/api/assistant/messages/route.js.nft.json +1 -1
  19. package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/assistant/session/route.js +1 -1
  21. package/.next/server/app/api/assistant/session/route.js.nft.json +1 -1
  22. package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/assistant/start/route.js +1 -1
  24. package/.next/server/app/api/assistant/start/route.js.nft.json +1 -1
  25. package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/assistant/terminal/route.js +1 -1
  27. package/.next/server/app/api/assistant/terminal/route.js.nft.json +1 -1
  28. package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/assistant/tools/route.js.nft.json +1 -1
  30. package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/capabilities/route.js +1 -1
  35. package/.next/server/app/api/capabilities/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/hooks/agent-event/route.js.nft.json +1 -1
  44. package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/hooks/claude-done/route.js +1 -1
  46. package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
  47. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/hooks/permission-request/route.js.nft.json +1 -1
  49. package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/relays/[relayId]/cancel/route.js +1 -1
  56. package/.next/server/app/api/relays/[relayId]/cancel/route.js.nft.json +1 -1
  57. package/.next/server/app/api/relays/[relayId]/cancel/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/relays/route.js +1 -1
  59. package/.next/server/app/api/relays/route.js.nft.json +1 -1
  60. package/.next/server/app/api/relays/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/remote/pair/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  66. package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
  67. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/repositories/clone/route.js +1 -1
  69. package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
  70. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/repositories/restore/route.js +1 -1
  73. package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -1
  74. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/repositories/route.js +1 -1
  76. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  77. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/repositories/scan/route.js +1 -1
  79. package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -1
  80. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/repositories/sync/route.js +1 -1
  82. package/.next/server/app/api/repositories/sync/route.js.nft.json +1 -1
  83. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/settings/default-agents/route.js.nft.json +1 -1
  86. package/.next/server/app/api/settings/default-agents/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/settings/default-surface-mode/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  89. package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
  91. package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  99. package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  103. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  104. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -1
  106. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js +1 -1
  108. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js.nft.json +1 -1
  109. package/.next/server/app/api/worktrees/[id]/clear-composer/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/worktrees/[id]/cli-reference/route_client-reference-manifest.js +1 -1
  111. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  112. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  114. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  115. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/worktrees/[id]/env/route_client-reference-manifest.js +1 -1
  117. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  118. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js +1 -1
  120. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  121. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  123. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  124. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  125. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  127. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  129. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  131. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  132. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  133. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  135. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  136. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  137. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  138. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  139. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  140. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  141. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  142. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  143. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  144. package/.next/server/app/api/worktrees/[id]/instances/notes/route_client-reference-manifest.js +1 -1
  145. package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js.nft.json +1 -1
  146. package/.next/server/app/api/worktrees/[id]/instances/opencode/route_client-reference-manifest.js +1 -1
  147. package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
  148. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  149. package/.next/server/app/api/worktrees/[id]/kill-session/route.js +1 -1
  150. package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
  151. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  152. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  153. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  154. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  155. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  157. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  158. package/.next/server/app/api/worktrees/[id]/opencode/diff/route_client-reference-manifest.js +1 -1
  159. package/.next/server/app/api/worktrees/[id]/opencode/session/route_client-reference-manifest.js +1 -1
  160. package/.next/server/app/api/worktrees/[id]/opencode/share/route_client-reference-manifest.js +1 -1
  161. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
  162. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
  163. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/api/worktrees/[id]/resolve-target/route_client-reference-manifest.js +1 -1
  165. package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
  166. package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
  167. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  168. package/.next/server/app/api/worktrees/[id]/route.js +1 -1
  169. package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
  170. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  171. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  172. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  173. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  175. package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
  176. package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
  177. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  178. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js.nft.json +1 -1
  179. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
  180. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
  181. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
  182. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
  183. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
  184. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
  185. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
  186. package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
  187. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  188. package/.next/server/app/api/worktrees/[id]/special-keys/route.js +1 -1
  189. package/.next/server/app/api/worktrees/[id]/special-keys/route.js.nft.json +1 -1
  190. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  191. package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
  192. package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -1
  193. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  194. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  195. package/.next/server/app/api/worktrees/[id]/timers/route.js +1 -1
  196. package/.next/server/app/api/worktrees/[id]/timers/route.js.nft.json +1 -1
  197. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  198. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  199. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  200. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  201. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  202. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  203. package/.next/server/app/api/worktrees/[id]/verify/config/route_client-reference-manifest.js +1 -1
  204. package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
  205. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route_client-reference-manifest.js +1 -1
  206. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
  207. package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
  208. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  209. package/.next/server/app/api/worktrees/apply-default-agents/route_client-reference-manifest.js +1 -1
  210. package/.next/server/app/api/worktrees/route.js +1 -1
  211. package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
  212. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  213. package/.next/server/app/chat/page.js +2 -2
  214. package/.next/server/app/chat/page.js.nft.json +1 -1
  215. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  216. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  217. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  218. package/.next/server/app/more/page.js +2 -2
  219. package/.next/server/app/more/page.js.nft.json +1 -1
  220. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  221. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  222. package/.next/server/app/page.js +1 -1
  223. package/.next/server/app/page.js.nft.json +1 -1
  224. package/.next/server/app/page_client-reference-manifest.js +1 -1
  225. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  226. package/.next/server/app/repositories/page.js +2 -2
  227. package/.next/server/app/repositories/page.js.nft.json +1 -1
  228. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  229. package/.next/server/app/review/page.js +1 -1
  230. package/.next/server/app/review/page.js.nft.json +1 -1
  231. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  232. package/.next/server/app/sessions/page.js +2 -2
  233. package/.next/server/app/sessions/page.js.nft.json +1 -1
  234. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  235. package/.next/server/app/skills/[skillId]/page.js +2 -2
  236. package/.next/server/app/skills/[skillId]/page.js.nft.json +1 -1
  237. package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
  238. package/.next/server/app/skills/installed/page.js +2 -2
  239. package/.next/server/app/skills/installed/page.js.nft.json +1 -1
  240. package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
  241. package/.next/server/app/skills/page.js +1 -1
  242. package/.next/server/app/skills/page.js.nft.json +1 -1
  243. package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  244. package/.next/server/app/worktrees/[id]/files/[...path]/page.js +2 -2
  245. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  246. package/.next/server/app/worktrees/[id]/page.js +9 -22
  247. package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
  248. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  249. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  250. package/.next/server/app-paths-manifest.json +29 -29
  251. package/.next/server/chunks/1210.js +1 -1
  252. package/.next/server/chunks/{6286.js → 1467.js} +6 -6
  253. package/.next/server/chunks/1707.js +14 -0
  254. package/.next/server/chunks/1886.js +1 -1
  255. package/.next/server/chunks/2980.js +1 -1
  256. package/.next/server/chunks/3077.js +1 -1
  257. package/.next/server/chunks/3123.js +1 -1
  258. package/.next/server/chunks/3241.js +1 -1
  259. package/.next/server/chunks/3323.js +1 -1
  260. package/.next/server/chunks/3543.js +1 -1
  261. package/.next/server/chunks/364.js +1 -0
  262. package/.next/server/chunks/3945.js +1 -1
  263. package/.next/server/chunks/434.js +1 -1
  264. package/.next/server/chunks/4443.js +1 -1
  265. package/.next/server/chunks/450.js +1 -1
  266. package/.next/server/chunks/4802.js +1 -1
  267. package/.next/server/chunks/6130.js +1 -1
  268. package/.next/server/chunks/650.js +1 -1
  269. package/.next/server/chunks/6677.js +3 -3
  270. package/.next/server/chunks/7004.js +1 -0
  271. package/.next/server/chunks/7075.js +1 -1
  272. package/.next/server/chunks/7506.js +1 -1
  273. package/.next/server/chunks/7905.js +1 -1
  274. package/.next/server/chunks/8142.js +1 -0
  275. package/.next/server/chunks/8728.js +8 -0
  276. package/.next/server/chunks/8918.js +5 -5
  277. package/.next/server/chunks/9123.js +2 -2
  278. package/.next/server/chunks/9627.js +1 -1
  279. package/.next/server/chunks/9701.js +1 -0
  280. package/.next/server/middleware-build-manifest.js +1 -1
  281. package/.next/server/middleware-manifest.json +5 -5
  282. package/.next/server/pages/500.html +1 -1
  283. package/.next/server/server-reference-manifest.json +1 -1
  284. package/.next/static/chunks/2039-117a361f795ddc4b.js +1 -0
  285. package/.next/static/chunks/2053-ce3fe896ad45e50f.js +1 -0
  286. package/.next/static/chunks/2407-6b8ca567e18ad583.js +1 -0
  287. package/.next/static/chunks/3160-79d24ca264a528b9.js +1 -0
  288. package/.next/static/chunks/{4322-dfd5a7119b5ba4fc.js → 4322-59a7dbd77a7763cc.js} +1 -1
  289. package/.next/static/chunks/4388-410b1d8ed0d8d98b.js +1 -0
  290. package/.next/static/chunks/4718-56ebb6e55073ed5e.js +1 -0
  291. package/.next/static/chunks/4949-d804db873cfd9310.js +1 -0
  292. package/.next/static/chunks/{6022-7a7d1760fc9814c7.js → 6022-d2d7bd9373ff3ae9.js} +1 -1
  293. package/.next/static/chunks/6983-3ed2099251793bdf.js +1 -0
  294. package/.next/static/chunks/934-a37509667baa86ee.js +1 -0
  295. package/.next/static/chunks/9526-4fe2fc64be44e5c1.js +1 -0
  296. package/.next/static/chunks/app/chat/page-bfc1f5bb17bd771d.js +1 -0
  297. package/.next/static/chunks/app/error-c1dc1038d0a84a33.js +1 -0
  298. package/.next/static/chunks/app/global-error-49f765ecb7fd6527.js +1 -0
  299. package/.next/static/chunks/app/{layout-4c2f21e3f653ee4c.js → layout-114dc6e93e332392.js} +1 -1
  300. package/.next/static/chunks/app/more/page-400ffa825f8f150e.js +1 -0
  301. package/.next/static/chunks/app/{page-26a42881c8648cd3.js → page-a4f03c188610c6c8.js} +1 -1
  302. package/.next/static/chunks/app/repositories/{page-2576158c8420fda0.js → page-a15efb4ce1d1721e.js} +1 -1
  303. package/.next/static/chunks/app/review/{page-35b99baaf3c93b38.js → page-90ac618489676cbc.js} +1 -1
  304. package/.next/static/chunks/app/sessions/page-366edfaa0b1faad2.js +1 -0
  305. package/.next/static/chunks/app/skills/[skillId]/{page-06799157652e8fa9.js → page-ce8f6fd9e4356580.js} +1 -1
  306. package/.next/static/chunks/app/skills/installed/{page-2f3987e3a131c8d0.js → page-566dfde26d7e63ba.js} +1 -1
  307. package/.next/static/chunks/app/skills/{page-e70bfcf5ed4e4865.js → page-7859540e8092aace.js} +1 -1
  308. package/.next/static/chunks/app/worktrees/[id]/page-df482ec0c378c77b.js +1 -0
  309. package/.next/static/chunks/{webpack-1dc9eb5ebb4fa5ff.js → webpack-0281b30457d46ebc.js} +1 -1
  310. package/.next/static/css/c511ecdf1e7f18a0.css +1 -0
  311. package/.next/trace +14 -13
  312. package/dist/lib/detection/tools/verified-against.d.ts +20 -0
  313. package/dist/lib/detection/tools/verified-against.d.ts.map +1 -1
  314. package/dist/lib/detection/tools/verified-against.js +20 -0
  315. package/dist/server/src/config/websocket-config.js +67 -0
  316. package/dist/server/src/lib/auto-yes-poller.js +40 -7
  317. package/dist/server/src/lib/auto-yes-state.js +36 -0
  318. package/dist/server/src/lib/detection/selection-shape.js +361 -3
  319. package/dist/server/src/lib/detection/tools/command-code/detect.js +96 -0
  320. package/dist/server/src/lib/detection/tools/command-code/dialog.js +314 -0
  321. package/dist/server/src/lib/detection/tools/verified-against.js +20 -0
  322. package/dist/server/src/lib/polling/response-checker.js +48 -2
  323. package/dist/server/src/lib/ws-server.js +111 -1
  324. package/package.json +1 -1
  325. package/public/sw.js +12 -0
  326. package/.next/server/chunks/120.js +0 -1
  327. package/.next/server/chunks/595.js +0 -8
  328. package/.next/server/chunks/7593.js +0 -1
  329. package/.next/static/chunks/1191-b7dfdfe86b1d31d1.js +0 -1
  330. package/.next/static/chunks/2053-9ac860ab4e92ac89.js +0 -1
  331. package/.next/static/chunks/2652-18b8fea64413467e.js +0 -1
  332. package/.next/static/chunks/4718-29cfcfb806724d9a.js +0 -1
  333. package/.next/static/chunks/5542-b6457f305d724a6b.js +0 -1
  334. package/.next/static/chunks/8361-0142beb59be2abf3.js +0 -1
  335. package/.next/static/chunks/app/chat/page-e60d07c4c79602f0.js +0 -1
  336. package/.next/static/chunks/app/error-27ab04bce6545dae.js +0 -1
  337. package/.next/static/chunks/app/global-error-7b761b8e181ffc1f.js +0 -1
  338. package/.next/static/chunks/app/more/page-fc94f86aa881489e.js +0 -1
  339. package/.next/static/chunks/app/sessions/page-a3ab6f122ec60d5a.js +0 -1
  340. package/.next/static/chunks/app/worktrees/[id]/page-60eab4e24c37cb77.js +0 -1
  341. package/.next/static/css/b09bede85744e1cf.css +0 -1
  342. /package/.next/static/{oDWX0JcwfhUYrMnnqDWVC → zNNp00FuBenN_iZtIvIBP}/_buildManifest.js +0 -0
  343. /package/.next/static/{oDWX0JcwfhUYrMnnqDWVC → zNNp00FuBenN_iZtIvIBP}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3310],{6191:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(71847).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8803:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(71847).A)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},20562:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(71847).A)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]])},48314:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(71847).A)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},68695:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(71847).A)("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]])},75676:(e,t,s)=>{"use strict";s.d(t,{jg:()=>n,kQ:()=>i,mR:()=>o,mS:()=>d,wf:()=>a});let a="terminal",r=new Set(["terminal","chat"]);function n(e){return"string"==typeof e&&r.has(e)}let i={data:null,messageId:null,visible:!1,answering:!1},l={mode:"split",mobileActivePane:"terminal",leftPaneTab:"history",splitRatio:.5,leftPaneCollapsed:!1,activityBar:{active:"files"},historyPane:{visible:!0,width:25,collapsed:!1}},d={type:null,message:null,retryable:!1,retryCount:0};function o(){return{phase:"idle",prompt:{...i},layout:{...l},error:{...d},messages:[],wsConnected:!1}}},80867:(e,t,s)=>{Promise.resolve().then(s.bind(s,95775))},95775:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>T});var a=s(95155),r=s(52619),n=s.n(r),i=s(18955),l=s(54388),d=s(28019),o=s(12115);function c(e){var t;let{appId:s,pollInterval:r=3e4,showResponseTime:n=!1,compact:l=!1}=e,d=(0,i.c)("externalApps"),[c,m]=(0,o.useState)(null),[p,x]=(0,o.useState)(!0),u=(0,o.useCallback)(async()=>{try{let e=await fetch("/api/external-apps/".concat(s,"/health"));if(e.ok){let t=await e.json();m(t)}else m({id:s,healthy:!1,lastChecked:Date.now(),error:"Failed to check health"})}catch(e){m({id:s,healthy:!1,lastChecked:Date.now(),error:"Network error"})}finally{x(!1)}},[s]);if((0,o.useEffect)(()=>{u();let e=setInterval(u,r);return()=>clearInterval(e)},[u,r]),p)return(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-muted-foreground animate-pulse"}),!l&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:d("status.checking")})]});let h=null!=(t=null==c?void 0:c.healthy)&&t,f=h?"bg-success":"bg-muted-foreground",g=d(h?"status.running":"status.stopped");return l?(0,a.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(f),title:g}):(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(f)}),(0,a.jsx)("span",{className:"text-xs ".concat(h?"text-success-foreground":"text-muted-foreground"),children:g}),n&&(null==c?void 0:c.responseTime)!==void 0&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",c.responseTime,"ms)"]})]})}function m(e){var t;let{app:s,onEdit:r,onDelete:n}=e,l=(0,i.c)("externalApps"),m=(0,i.c)("common"),[p,x]=(0,o.useState)(!1),[u,h]=(0,o.useState)(!1),f=async()=>{h(!0);try{await n(s.id)}finally{h(!1),x(!1)}},g="/proxy/".concat(s.pathPrefix,"/");return(0,a.jsxs)(d.Zp,{padding:"md",className:"relative",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h4",{className:"text-base font-semibold text-foreground truncate",children:s.displayName}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono truncate",children:s.name})]}),(0,a.jsx)(d.Ex,{variant:{sveltekit:"warning",streamlit:"error",nextjs:"info",other:"gray"}[s.appType]||"gray",children:{sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"}[t=s.appType]||t})]}),(0,a.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:l("card.status")}),(0,a.jsx)(c,{appId:s.id,pollInterval:3e4})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:l("card.port")}),(0,a.jsxs)("span",{className:"text-sm font-mono text-foreground",children:[":",s.targetPort]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:l("card.path")}),(0,a.jsxs)("span",{className:"text-sm font-mono text-foreground truncate max-w-[150px]",children:["/proxy/",s.pathPrefix,"/"]})]}),s.websocketEnabled&&(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:l("card.websocket")}),(0,a.jsx)(d.Ex,{variant:"info",children:l("card.enabled")})]}),!s.enabled&&(0,a.jsx)("div",{className:"mt-2 py-1 px-2 bg-warning-subtle border border-warning-border rounded text-xs text-warning-foreground",children:l("card.disabledNotice")})]}),p?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:l("card.deleteConfirm",{name:s.displayName})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{variant:"danger",size:"sm",onClick:f,disabled:u,loading:u,children:l("card.delete")}),(0,a.jsx)(d.$n,{variant:"ghost",size:"sm",onClick:()=>x(!1),disabled:u,children:m("cancel")})]})]}):(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,a.jsx)(d.$n,{variant:"primary",size:"sm",onClick:()=>window.open(g,"_blank"),disabled:!s.enabled,children:l("card.open")}),(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",onClick:()=>r(s),children:l("card.settings")}),(0,a.jsx)(d.$n,{variant:"ghost",size:"sm",onClick:()=>x(!0),className:"text-danger-foreground hover:bg-danger-subtle",children:l("card.delete")})]})]})}var p=s(87531);let x={MIN:1024,MAX:65535},u=/^[a-zA-Z0-9-]+$/,h={sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"},f=["sveltekit","streamlit","nextjs","other"].map(e=>({value:e,label:h[e]}));function g(e){let{isOpen:t,onClose:s,editApp:r,onSave:n}=e,l=(0,i.c)("externalApps"),c=(0,i.c)("common"),m=!!r,[h,g]=(0,o.useState)(""),[b,j]=(0,o.useState)(""),[y,N]=(0,o.useState)(""),[v,k]=(0,o.useState)(""),[w,C]=(0,o.useState)(""),[S,P]=(0,o.useState)(!1),[A,T]=(0,o.useState)(""),[E,M]=(0,o.useState)(!0),[O,I]=(0,o.useState)({}),[$,F]=(0,o.useState)(!1),[D,z]=(0,o.useState)(null);(0,o.useEffect)(()=>{t&&(r?(g(r.displayName),j(r.name),N(r.pathPrefix),k(r.targetPort),C(r.appType),P(r.websocketEnabled),T(r.description||""),M(r.enabled)):(g(""),j(""),N(""),k(""),C(""),P(!1),T(""),M(!0)),I({}),z(null))},[t,r]);let Z=async e=>{e.preventDefault(),z(null);let t=function(e,t){var s,a,r,n;let i={};return((null==(s=e.displayName)?void 0:s.trim())||(i.displayName="Display name is required"),!t&&((null==(a=e.name)?void 0:a.trim())?u.test(e.name)||(i.name="Only alphanumeric characters and hyphens are allowed"):i.name="Identifier name is required",(null==(r=e.pathPrefix)?void 0:r.trim())?u.test(e.pathPrefix)||(i.pathPrefix="Only alphanumeric characters and hyphens are allowed"):i.pathPrefix="Path prefix is required"),e.targetPort)?"number"!=typeof e.targetPort||Number.isInteger(n=e.targetPort)&&n>=x.MIN&&n<=x.MAX||(i.targetPort="Port must be between ".concat(x.MIN," and ").concat(x.MAX)):i.targetPort="Port number is required",t||e.appType||(i.appType="App type is required"),i}({displayName:h,name:b,pathPrefix:y,targetPort:v,appType:w},m);if(Object.keys(t).length>0)return void I(t);I({}),F(!0);try{if(m&&r){let e=await fetch("/api/external-apps/".concat(r.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:h,description:A||void 0,targetPort:v||void 0,websocketEnabled:S,enabled:E})});if(!e.ok){let t=await e.json();throw Error(t.error||l("form.updateFailed"))}}else{let e=await fetch("/api/external-apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:h,name:b,pathPrefix:y,targetPort:v,appType:w,websocketEnabled:S,description:A||void 0})});if(!e.ok){let t=await e.json();throw Error(t.error||l("form.createFailed"))}}n(),s()}catch(e){z(e instanceof Error?e.message:l("form.genericError"))}finally{F(!1)}};return(0,a.jsx)(d.Jh,{isOpen:t,onClose:s,title:m?l("form.editTitle"):l("form.addTitle"),size:"md",children:(0,a.jsxs)("form",{onSubmit:Z,className:"space-y-4",children:[(0,a.jsx)("div",{className:"rounded-md bg-warning-subtle p-3 mb-4 border border-warning-border",children:(0,a.jsx)("p",{className:"text-sm text-warning-foreground",children:l("form.securityWarning")})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"displayName",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.displayName")," ",(0,a.jsx)("span",{className:"text-danger",children:"*"})]}),(0,a.jsx)(d.pd,{id:"displayName",type:"text",value:h,onChange:e=>g(e.target.value),className:O.displayName?"border-danger":"",placeholder:l("form.displayNamePlaceholder"),disabled:$}),O.displayName&&(0,a.jsx)("p",{className:"mt-1 text-xs text-danger",children:O.displayName})]}),!m&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.identifierName")," ",(0,a.jsx)("span",{className:"text-danger",children:"*"})]}),(0,a.jsx)(d.pd,{id:"name",type:"text",value:b,onChange:e=>j(e.target.value),className:"font-mono ".concat(O.name?"border-danger":""),placeholder:l("form.identifierNamePlaceholder"),disabled:$}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l("form.identifierNameHelp")}),O.name&&(0,a.jsx)("p",{className:"mt-1 text-xs text-danger",children:O.name})]}),!m&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"pathPrefix",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.pathPrefix")," ",(0,a.jsx)("span",{className:"text-danger",children:"*"})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground mr-1",children:"/proxy/"}),(0,a.jsx)(d.pd,{id:"pathPrefix",type:"text",value:y,onChange:e=>N(e.target.value),className:"w-auto flex-1 font-mono ".concat(O.pathPrefix?"border-danger":""),placeholder:l("form.pathPrefixPlaceholder"),disabled:$}),(0,a.jsx)("span",{className:"text-sm text-muted-foreground ml-1",children:"/"})]}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l("form.pathPrefixHelp")}),O.pathPrefix&&(0,a.jsx)("p",{className:"mt-1 text-xs text-danger",children:O.pathPrefix})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"targetPort",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.portNumber")," ",(0,a.jsx)("span",{className:"text-danger",children:"*"})]}),(0,a.jsx)(d.pd,{id:"targetPort",type:"number",value:v,onChange:e=>k(e.target.value?parseInt(e.target.value,10):""),className:"font-mono ".concat(O.targetPort?"border-danger":""),placeholder:l("form.portNumberPlaceholder"),min:x.MIN,max:x.MAX,disabled:$}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l("form.portNumberHelp",{min:x.MIN,max:x.MAX})}),O.targetPort&&(0,a.jsx)("p",{className:"mt-1 text-xs text-danger",children:O.targetPort})]}),!m&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"appType",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.appType")," ",(0,a.jsx)("span",{className:"text-danger",children:"*"})]}),(0,a.jsxs)("select",{id:"appType",value:w,onChange:e=>C(e.target.value),className:(0,p.cn)((0,d.j1)(),O.appType&&"border-danger"),disabled:$,children:[(0,a.jsx)("option",{value:"",children:l("form.appTypePlaceholder")}),f.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))]}),O.appType&&(0,a.jsx)("p",{className:"mt-1 text-xs text-danger",children:O.appType})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"description",className:"block text-sm font-medium text-foreground mb-1",children:l("form.description")}),(0,a.jsx)(d.k_,{id:"description",value:A,onChange:e=>T(e.target.value),placeholder:l("form.descriptionPlaceholder"),rows:2,disabled:$})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.dO,{id:"websocketEnabled",checked:S,onCheckedChange:P,disabled:$}),(0,a.jsx)("label",{htmlFor:"websocketEnabled",className:"text-sm text-foreground",children:l("form.websocketLabel")})]}),m&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.dO,{id:"enabled",checked:E,onCheckedChange:M,disabled:$}),(0,a.jsx)("label",{htmlFor:"enabled",className:"text-sm text-foreground",children:l("form.enabledLabel")})]}),D&&(0,a.jsx)("div",{className:"p-3 bg-danger-subtle border border-danger-border rounded text-sm text-danger-foreground",children:D}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t border-border",children:[(0,a.jsx)(d.$n,{type:"button",variant:"ghost",onClick:s,disabled:$,children:c("cancel")}),(0,a.jsx)(d.$n,{type:"submit",variant:"primary",loading:$,children:m?l("form.save"):l("form.add")})]})]})})}function b(){let e=(0,i.c)("externalApps"),t=(0,i.c)("common"),[s,r]=(0,o.useState)([]),[n,l]=(0,o.useState)(!0),[c,p]=(0,o.useState)(null),[x,u]=(0,o.useState)(!1),[h,f]=(0,o.useState)(null),b=(0,o.useCallback)(async()=>{try{p(null);let e=await fetch("/api/external-apps");if(!e.ok)throw Error("Failed to fetch external apps");let t=await e.json();r(t.apps||[])}catch(e){p(e instanceof Error?e.message:"An error occurred")}finally{l(!1)}},[]);(0,o.useEffect)(()=>{b();let e=setInterval(b,6e4);return()=>clearInterval(e)},[b]);let j=(0,o.useCallback)(e=>{f(e),u(!0)},[]),y=(0,o.useCallback)(()=>{f(null),u(!0)},[]),N=(0,o.useCallback)(async e=>{try{let t=await fetch("/api/external-apps/".concat(e),{method:"DELETE"});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to delete app")}b()}catch(e){console.error("Failed to delete app:",e)}},[b]),v=(0,o.useCallback)(()=>{b()},[b]),k=(0,o.useCallback)(()=>{u(!1),f(null)},[]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"flex items-center justify-end",children:(0,a.jsx)(d.$n,{variant:"primary",size:"sm",onClick:y,children:e("manager.addApp")})}),n?(0,a.jsx)(d.Zp,{padding:"lg",children:(0,a.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,a.jsx)(d.y$,{size:"xl",variant:"accent"}),(0,a.jsx)("span",{className:"ml-3 text-muted-foreground",children:e("manager.loading")})]})}):c?(0,a.jsx)(d.Zp,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("p",{className:"text-danger-foreground mb-4",children:e("manager.loadError")}),(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",onClick:b,children:t("retry")})]})}):0===s.length?(0,a.jsx)(d.Zp,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("p",{className:"text-muted-foreground mb-4",children:e("manager.empty")}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:e("manager.emptyHelp")}),(0,a.jsx)(d.$n,{variant:"primary",size:"sm",onClick:y,children:e("manager.addFirst")})]})}):(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:s.map(e=>(0,a.jsx)(m,{app:e,onEdit:j,onDelete:N},e.id))}),(0,a.jsx)(g,{isOpen:x,onClose:k,editApp:h,onSave:v})]})}let j=(0,s(71847).A)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);var y=s(94442),N=s(81978);function v(){return"undefined"!=typeof navigator&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}let k={enabled:!0,thresholdMinutes:10},w=[5,10,30,60];function C(){let e=(0,i.c)("notifications"),{showToast:t}=(0,y.dj)(),[s,r]=(0,o.useState)(!0),[n,l]=(0,o.useState)(!1),[c,m]=(0,o.useState)(!0),[p,x]=(0,o.useState)(!1),[u,h]=(0,o.useState)(null),[f,g]=(0,o.useState)(null),[b,N]=(0,o.useState)(!1),[k,w]=(0,o.useState)(null),[C,A]=(0,o.useState)({prompt:!0,completion:!1}),[T,E]=(0,o.useState)(!1),[M,O]=(0,o.useState)(null),[I,$]=(0,o.useState)(null),F=null!==k&&!1!==I;(0,o.useEffect)(()=>{let e=!1;return(async()=>{let t=function(){var e,t;let s=v(),a="undefined"!=typeof navigator&&(!!/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!(null!=(e=(t=window).matchMedia)&&e.call(t,"(display-mode: standalone)").matches||!0===navigator.standalone);return{supported:s&&!a,iosNeedsInstall:a}}();e||(m(v()),x(t.iosNeedsInstall),"undefined"!=typeof Notification&&"denied"===Notification.permission&&N(!0));try{let t=await fetch("/api/push/vapid"),s=await t.json();e||(h(s.configured),g(s.publicKey))}catch(t){e||h(!1)}if(v())try{let t=await navigator.serviceWorker.getRegistration(),a=t?await t.pushManager.getSubscription():null;if(a&&!e){w(a.endpoint);let t=await fetch("/api/push/subscriptions?endpoint=".concat(encodeURIComponent(a.endpoint))),r=await t.json();if(!e){var s;$(!0===r.subscribed),O(null!=(s=r.delivery)?s:null)}r.subscribed&&r.subscription&&!e&&(A(r.subscription.preferences),E(!0===r.subscription.defaultsNoticePending))}}catch(e){}e||r(!1)})(),()=>{e=!0}},[]);let D=(0,o.useCallback)(async()=>{if(f){l(!0);try{var s,a;let r=await Notification.requestPermission();if("granted"!==r){N("denied"===r),t(e("toast.error"),"error");return}if(!await navigator.serviceWorker.getRegistration())return void t(e("toast.error"),"error");let n=await navigator.serviceWorker.ready,i=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),s=atob((e+t).replace(/-/g,"+").replace(/_/g,"/")),a=new Uint8Array(new ArrayBuffer(s.length));for(let e=0;e<s.length;e++)a[e]=s.charCodeAt(e);return a}(f)}),l=await fetch("/api/push/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription:i.toJSON(),deviceLabel:navigator.userAgent.slice(0,120)})});if(!l.ok)throw Error("subscribe request failed");let d=await l.json();w(i.endpoint),$(!0),O(null),(null==(s=d.subscription)?void 0:s.preferences)&&A(d.subscription.preferences),E((null==(a=d.subscription)?void 0:a.defaultsNoticePending)===!0),N(!1),t(e("toast.enabled"),"success")}catch(s){t(e("toast.error"),"error")}finally{l(!1)}}},[f,t,e]),z=(0,o.useCallback)(async()=>{l(!0);try{var s;let a=await navigator.serviceWorker.getRegistration(),r=a?await a.pushManager.getSubscription():null,n=null!=(s=null==r?void 0:r.endpoint)?s:k;r&&await r.unsubscribe(),n&&await fetch("/api/push/subscriptions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:n})}),w(null),$(null),O(null),t(e("toast.disabled"),"info")}catch(s){t(e("toast.error"),"error")}finally{l(!1)}},[k,t,e]),Z=(0,o.useCallback)(async(s,a)=>{if(!k)return;let r={...C,[s]:a};A(r);try{if(!(await fetch("/api/push/subscriptions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:k,preferences:r})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(s){A(C),t(e("toast.error"),"error")}},[k,C,t,e]),q=(0,o.useCallback)(async s=>{if(!k)return;let a=s?{...C,completion:!1}:C;E(!1),s&&A(a),l(!0);try{if(!(await fetch("/api/push/subscriptions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:k,...s?{preferences:a}:{},acknowledgeDefaultsNotice:!0})})).ok)throw Error("acknowledge failed");t(e(s?"defaultsNotice.adopted":"defaultsNotice.kept"),"success")}catch(s){A(C),E(!0),t(e("toast.error"),"error")}finally{l(!1)}},[k,C,t,e]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(d.Zp,{children:(0,a.jsx)(P,{})}),(0,a.jsx)(d.Zp,{children:s?(0,a.jsx)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:(0,a.jsx)(d.y$,{size:"sm"})}):c?p?(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"notifications-ios-guidance",children:e("ios.guidance")}):!1===u?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:e("notConfigured")}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:e("description")}),b&&(0,a.jsx)("p",{className:"text-sm text-danger-foreground","data-testid":"notifications-permission-denied",children:e("permission.denied")}),(()=>{if(null===M)return null;let t="removed"===M.state,s=M.statusCode,r=t?null===s?e("delivery.removedUnknownStatus"):e("delivery.removed",{status:String(s)}):null===s?e("delivery.failingUnknownStatus",{count:M.failureCount}):e("delivery.failing",{count:M.failureCount,status:String(s)});return(0,a.jsxs)("div",{className:t?"space-y-2 rounded-lg border border-danger-border bg-danger-subtle p-3":"space-y-2 rounded-lg border border-warning-border bg-warning-subtle p-3","data-testid":"notifications-delivery-health","data-delivery-state":M.state,children:[(0,a.jsx)("p",{className:t?"text-sm font-semibold text-danger-foreground":"text-sm font-semibold text-warning-foreground",children:e(t?"delivery.headingRemoved":"delivery.headingFailing")}),(0,a.jsx)("p",{className:"text-xs text-foreground",children:r}),403===s&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"notifications-delivery-apns-hint",children:e("delivery.apnsHint")}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:e("delivery.since",{timestamp:new Date(M.firstFailureAt).toLocaleString()})})]})})(),F?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-foreground",children:e("enabledOnThisDevice")}),T&&(0,a.jsxs)("div",{className:"space-y-3 rounded-lg border border-info-border bg-info-subtle p-3","data-testid":"notifications-defaults-notice",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-info-foreground",children:e("defaultsNotice.heading")}),(0,a.jsx)("p",{className:"text-xs text-foreground",children:e("defaultsNotice.completionChanged")}),(0,a.jsx)("p",{className:"text-xs text-foreground",children:e("defaultsNotice.failuresAdded")}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(d.$n,{variant:"primary",onClick:()=>q(!0),disabled:n,"data-testid":"notifications-defaults-notice-adopt",children:e("defaultsNotice.adopt")}),(0,a.jsx)(d.$n,{variant:"secondary",onClick:()=>q(!1),disabled:n,"data-testid":"notifications-defaults-notice-keep",children:e("defaultsNotice.keep")})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("types.heading")}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.promptWaiting")}),(0,a.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.promptWaitingDesc")})]}),(0,a.jsx)(d.dO,{checked:C.prompt,onCheckedChange:e=>Z("prompt",e),disabled:n,"aria-label":e("types.promptWaiting"),"data-testid":"notifications-toggle-prompt"})]}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.completion")}),(0,a.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.completionDesc")})]}),(0,a.jsx)(d.dO,{checked:C.completion,onCheckedChange:e=>Z("completion",e),disabled:n,"aria-label":e("types.completion"),"data-testid":"notifications-toggle-completion"})]})]}),(0,a.jsx)(d.$n,{variant:"secondary",onClick:z,disabled:n,"data-testid":"notifications-unsubscribe",children:e("unsubscribe")})]}):(0,a.jsxs)(d.$n,{variant:"primary",onClick:D,disabled:n||b||!f,"data-testid":"notifications-enable",children:[(0,a.jsx)(j,{className:"h-4 w-4"}),n?e("enabling"):e("enable")]})]}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:e("unsupported")})}),(0,a.jsx)(d.Zp,{children:(0,a.jsx)(S,{})})]})}function S(){let e=(0,i.c)("notifications"),{showToast:t}=(0,y.dj)(),[s,r]=(0,o.useState)(!0),[n,l]=(0,o.useState)(!1),[c,m]=(0,o.useState)(k),[p,x]=(0,o.useState)([...w]);(0,o.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/push/escalation"),s=await t.json();!e&&(s.settings&&m(s.settings),Array.isArray(s.choices)&&s.choices.length>0&&x(s.choices))}catch(e){}finally{e||r(!1)}})(),()=>{e=!0}},[]);let u=(0,o.useCallback)(async s=>{m(s),l(!0);try{if(!(await fetch("/api/push/escalation",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:s})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(s){m(c),t(e("toast.error"),"error")}finally{l(!1)}},[c,t,e]);return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("escalation.heading")}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("escalation.toggle")}),(0,a.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("escalation.toggleDesc")})]}),(0,a.jsx)(d.dO,{checked:c.enabled,onCheckedChange:e=>u({...c,enabled:e}),disabled:s||n,"aria-label":e("escalation.toggle"),"data-testid":"notifications-toggle-escalation"})]}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("span",{className:"text-sm text-foreground",children:e("escalation.threshold")}),(0,a.jsx)("select",{className:"rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground",value:String(c.thresholdMinutes),disabled:s||n||!c.enabled,"aria-label":e("escalation.threshold"),"data-testid":"notifications-escalation-threshold",onChange:e=>u({...c,thresholdMinutes:Number(e.target.value)}),children:p.map(t=>(0,a.jsx)("option",{value:String(t),children:e("escalation.minutes",{count:t})},t))})]})]})}function P(){let e=(0,i.c)("notifications"),{enabled:t,setEnabled:s}=(0,N.qG)(),{enabled:r,setEnabled:n}=(0,N.Ql)();return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("inApp.heading")}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.waitingToggle")}),(0,a.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.waitingToggleDesc")})]}),(0,a.jsx)(d.dO,{checked:t,onCheckedChange:s,"aria-label":e("inApp.waitingToggle"),"data-testid":"notifications-toggle-inapp-waiting"})]}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.soundToggle")}),(0,a.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.soundToggleDesc")})]}),(0,a.jsx)(d.dO,{checked:r,onCheckedChange:n,"aria-label":e("inApp.soundToggle"),"data-testid":"notifications-toggle-inapp-sound"})]})]})}s(72604),s(95275),s(79832);var A=s(46022);function T(){let e=(0,i.c)("notifications"),t=(0,i.c)("common"),s=(0,i.c)("skills");return(0,a.jsx)(l.GV,{children:(0,a.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"More"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Settings, external apps, and more."})]}),(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:"Quick Links"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsx)(n(),{href:"/repositories",className:"block","data-testid":"more-link-repositories",children:(0,a.jsxs)(d.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Repositories"}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Manage repositories and worktrees"})]})}),(0,a.jsx)(n(),{href:"/skills",className:"block","data-testid":"more-link-skills",children:(0,a.jsxs)(d.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-foreground",children:t("nav.skills")}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:s("page.description")})]})}),(0,a.jsx)(n(),{href:"/skills/installed",className:"block","data-testid":"more-link-skills-installed",children:(0,a.jsxs)(d.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-foreground",children:s("dashboard.title")}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:s("dashboard.description")})]})})]})]}),(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:t("settings.title")}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(A.he,{}),(0,a.jsx)(A.$8,{}),(0,a.jsx)(A.uN,{})]})]}),(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:e("title")}),(0,a.jsx)(C,{})]}),(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:"External Apps"}),(0,a.jsx)(b,{})]}),(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:"About"}),(0,a.jsx)(d.Zp,{children:(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"CommandMate - A local control plane for agent CLIs."})})]})]})})}}},e=>{e.O(0,[6809,4909,2770,790,5694,2407,6402,8019,4718,4388,6022,4322,8441,1255,7358],()=>e(e.s=80867)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{6473:(e,t,s)=>{"use strict";s.d(t,{Lc:()=>a,qz:()=>n});let n="animate-in fade-in-0 slide-in-from-bottom-2 fill-mode-backwards duration-300";function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(Number.isFinite(e)&&!(e<=0)&&!(e>=s))return"".concat(e*t,"ms")}},53292:(e,t,s)=>{"use strict";s.d(t,{Ll:()=>n,bu:()=>a});let n=2e3,a=4e3},54799:(e,t,s)=>{Promise.resolve().then(s.bind(s,75590))},75590:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>G});var n=s(95155),a=s(68361),o=s(66966),i=s(12115),r=s(18955);function d(e){let{worktrees:t}=e,s=(0,r.c)("home"),{runningCount:a,waitingCount:o}=(0,i.useMemo)(()=>{let e=0,s=0;for(let n of t)n.isSessionRunning&&(e++,n.isWaitingForResponse&&s++);return{runningCount:e,waitingCount:s}},[t]);return(0,n.jsxs)("div",{className:"mb-8",children:[(0,n.jsx)("h1",{className:"text-2xl font-semibold text-foreground",children:s("title")}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":"home-subline",children:[(0,n.jsx)("span",{className:"tabular-nums","data-testid":"subline-running",children:a})," ",s("running"),(0,n.jsx)("span",{"aria-hidden":"true",children:" \xb7 "}),(0,n.jsx)("span",{className:"tabular-nums","data-testid":"subline-waiting",children:o})," ",s("waiting")]})]})}var l=s(52619),c=s.n(l),m=s(65229),u=s(61362),h=s(99051),x=s(28019),g=s(2317);function f(e){return"boolean"==typeof e}let p=[{key:"registerRepository",href:"/repositories"},{key:"sendFirstMessage",href:"/sessions"}];function j(e){let{worktrees:t,repositories:s,isLoading:a=!1,error:o=null}=e,d=(0,r.c)("home"),{value:l,setValue:j}=(0,g.V)({key:"commandmate:onboarding-dismissed",defaultValue:!1,validate:f}),[b,v]=(0,i.useState)(!1);(0,i.useEffect)(()=>v(!0),[]);let y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{hasRepository:(null!=t?t:[]).length>0,hasSentMessage:(null!=e?e:[]).some(e=>!!e.lastUserMessageAt)}}(t,s),w=y.hasRepository&&y.hasSentMessage,N=b&&!a&&null===o;return((0,i.useEffect)(()=>{N&&w&&!l&&j(!0)},[N,w,l,j]),!N||w||l)?null:(0,n.jsx)("div",{className:"mb-8",children:(0,n.jsxs)(x.Zp,{variant:"elevated","data-testid":"onboarding-checklist",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:d("onboarding.title")}),(0,n.jsx)(x.$n,{variant:"ghost",size:"sm","aria-label":d("onboarding.dismiss"),"data-testid":"onboarding-dismiss",onClick:()=>j(!0),children:(0,n.jsx)(m.A,{size:16,"aria-hidden":"true"})})]}),(0,n.jsx)("ol",{className:"mt-3 space-y-3",children:p.map(e=>{let{key:t,href:s}=e,a="registerRepository"===t?y.hasRepository:y.hasSentMessage;return(0,n.jsxs)("li",{className:"flex items-center gap-3","data-testid":"onboarding-step-".concat(t),"data-complete":a,children:[a?(0,n.jsx)(u.A,{size:20,className:"shrink-0 text-success-foreground","aria-hidden":"true"}):(0,n.jsx)(h.A,{size:20,className:"shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 text-sm ".concat(a?"text-muted-foreground line-through":"text-foreground"),children:d("onboarding.steps.".concat(t))}),!a&&(0,n.jsx)(c(),{href:s,"data-testid":"onboarding-action-".concat(t),className:"shrink-0 rounded-md bg-accent-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:bg-accent-500 dark:hover:bg-accent-600",children:d("onboarding.actions.".concat(t))})]},t)})})]})})}var b=s(87531),v=s(44308),y=s(24373);function w(e){let{worktrees:t,isLoading:s=!1}=e,a=(0,r.c)("home"),o=(0,i.useMemo)(()=>t.filter(e=>e.isSessionRunning).length,[t]),d=(0,i.useMemo)(()=>(0,y.Kg)(t),[t]);return s?(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary-loading",role:"status","aria-label":a("sessionSummary.loading"),children:[0,1].map(e=>(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,n.jsx)("div",{className:"flex h-4 items-center",children:(0,n.jsx)(x.EA,{className:"h-3 w-16"})}),(0,n.jsx)("div",{className:"flex h-9 items-center",children:(0,n.jsx)(x.EA,{className:"h-7 w-10"})})]},e))}):(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,n.jsx)(x.md,{status:o>0?"running":"idle",size:"sm",label:a("sessionSummary.running")}),a("sessionSummary.running")]}),(0,n.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",o>0?"text-foreground":"text-muted-foreground"),"data-testid":"running-count",children:o})]}),(0,n.jsxs)(c(),{href:v.ks,"data-testid":"waiting-count-link","aria-label":a("sessionSummary.waitingLinkLabel",{count:d}),className:"block rounded-lg border border-border bg-surface-2 px-3 py-2 transition-colors hover:border-warning-border hover:bg-warning-subtle focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,n.jsx)(x.md,{status:d>0?"waiting":"idle",size:"sm",label:a("sessionSummary.waiting")}),a("sessionSummary.waiting")]}),(0,n.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",d>0?"text-foreground":"text-muted-foreground"),"data-testid":"waiting-count",children:d})]})]})}var N=s(48481),k=s(7636),C=s(83012),S=s(38606);function A(e){var t;return null!=(t=e.lastUserMessageAt)?t:e.updatedAt}function E(e){let{worktrees:t,limit:s=5,isLoading:a=!1}=e,o=(0,r.c)("home"),d=(0,i.useMemo)(()=>[...t].sort((e,t)=>(0,k.nO)(A(e),A(t))).slice(0,s),[t,s]);return a?(0,n.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions-loading",role:"status","aria-label":o("recentSessions.loading"),children:Array.from({length:s},(e,t)=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-2 py-1.5",children:[(0,n.jsx)(x.EA,{className:"h-2 w-2 shrink-0 rounded-full"}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,n.jsx)(x.EA,{className:"h-4 w-2/5"}),(0,n.jsx)(x.EA,{className:"h-3 w-3/5"})]}),(0,n.jsx)(x.EA,{className:"h-3 w-8 shrink-0"})]},t))}):0===d.length?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"recent-sessions-empty",children:o("recentSessions.empty")}),(0,n.jsx)(c(),{href:"/repositories","data-testid":"recent-sessions-cta",className:"inline-block text-sm font-medium text-accent-600 transition-colors hover:text-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:text-accent-400 dark:hover:text-accent-300",children:o("recentSessions.cta")})]}):(0,n.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions",children:d.map(e=>{var t,s,a,o;let i=A(e),r=i?(0,C.Fx)(String(i)):"";return(0,n.jsx)("li",{children:(0,n.jsxs)(c(),{href:"/worktrees/".concat(e.id),"data-testid":"recent-session-".concat(e.id),className:"flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,n.jsx)(N.m,{"data-testid":"recent-status-dot-".concat(e.id),status:(0,S.kA)({isRunning:null!=(s=e.isSessionRunning)&&s,isWaitingForResponse:null!=(a=e.isWaitingForResponse)&&a,isProcessing:null!=(o=e.isProcessing)&&o}),waitingKind:(0,S.f_)(e).waitingKind,size:"sm"}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block truncate text-sm font-medium text-foreground",children:null!=(t=e.repositoryDisplayName)?t:e.repositoryName}),(0,n.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.name})]}),r&&(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r})]})},e.id)})})}function R(e){let{worktrees:t,isLoading:s=!1}=e,a=(0,r.c)("home");return(0,n.jsxs)(x.Zp,{variant:"elevated",className:"h-full","data-testid":"session-overview-tile",children:[(0,n.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:a("sessionOverview.title")}),(0,n.jsx)(w,{worktrees:t,isLoading:s}),(0,n.jsxs)("div",{className:"mt-4 flex items-center justify-between",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:a("sessionOverview.recentSessions")}),(0,n.jsx)(c(),{href:"/sessions",className:"text-xs text-accent-600 hover:underline dark:text-accent-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","data-testid":"session-overview-view-all",children:a("sessionOverview.viewAll")})]}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)(E,{worktrees:t,isLoading:s})})]})}var M=s(36402),D=s(85872),F=s(53292);let T="commandmate-home-todo-repo";function I(e){var t;return(null==(t=e.repositoryDisplayName)?void 0:t.trim())||e.repositoryName||""}function L(){let e=(0,r.c)("home"),t=(0,r.c)("common"),s=(0,M.SC)(),[a,o]=(0,i.useState)([]),[d,l]=(0,i.useState)(""),[c,m]=(0,i.useState)([]),[u,h]=(0,i.useState)(""),[g,f]=(0,i.useState)(!1),[p,j]=(0,i.useState)(!1),[b,v]=(0,i.useState)(null),y=(0,i.useRef)(!1),w=(0,i.useMemo)(()=>c.filter(e=>!e.done).length,[c]);(0,i.useEffect)(()=>{!async function(){try{var e;let t=await fetch("/api/worktrees");if(!t.ok)return;let s=(null!=(e=(await t.json()).repositories)?e:[]).map(e=>({id:e.id,path:e.path,name:e.name,displayName:e.displayName}));if(o(s),s.length>0){let e=localStorage.getItem(T),t=e&&s.some(t=>t.id===e)?e:s[0].id;l(t)}}catch(e){}finally{y.current=!0}}()},[]);let N=(0,i.useCallback)(async()=>{f(!0),v(null);try{let e=await D.$C.listAll();m(e)}catch(t){v(t instanceof Error?t.message:e("todo.errors.load")),m([])}finally{f(!1)}},[e]);(0,i.useEffect)(()=>{N()},[N]),(0,i.useEffect)(()=>{d&&localStorage.setItem(T,d)},[d]);let k=(0,i.useCallback)(async()=>{let t=u.trim();if(t&&d&&!p){j(!0),v(null);try{await D.$C.create(d,t),h(""),await N()}catch(t){v(t instanceof Error?t.message:e("todo.errors.add"))}finally{j(!1)}}},[u,d,p,N,e]),C=(0,i.useCallback)(async t=>{m(e=>e.map(e=>e.id===t.id?{...e,done:!e.done}:e)),v(null);try{await D.$C.update(t.repositoryId,t.id,{done:!t.done})}catch(t){v(t instanceof Error?t.message:e("todo.errors.update")),N()}},[N,e]),S=(0,i.useCallback)(async n=>{if(await s({description:t("confirmDelete",{name:n.content}),variant:"danger"})){v(null);try{await D.$C.remove(n.repositoryId,n.id),m(e=>e.filter(e=>e.id!==n.id))}catch(t){v(t instanceof Error?t.message:e("todo.errors.delete"))}}},[e,s,t]),A=(0,i.useCallback)(e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),k())},[k]),E=a.length>0;return(0,n.jsxs)(x.Zp,{className:"h-full","data-testid":"home-todo-widget",children:[(0,n.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:e("todo.title")}),(0,n.jsxs)("div",{className:"flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between sm:gap-3","data-testid":"todo-selector-row",children:[(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm text-muted-foreground min-w-0",children:[(0,n.jsx)("span",{className:"shrink-0",children:e("todo.repository")}),(0,n.jsx)("select",{value:d,onChange:e=>l(e.target.value),disabled:!E,"data-testid":"todo-repo-select",className:"min-w-0 flex-1 truncate rounded-md border border-input bg-surface dark:bg-surface-2 px-2 py-1 text-sm text-surface-foreground disabled:opacity-50 sm:flex-initial sm:max-w-[16rem]",children:a.map(e=>{var t;return(0,n.jsx)("option",{value:e.id,children:(null==(t=e.displayName)?void 0:t.trim())||e.name},e.id)})})]}),E&&(0,n.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground","data-testid":"todo-remaining",children:e("todo.open",{count:w})})]}),E?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,n.jsx)(x.pd,{type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:A,maxLength:F.Ll,placeholder:e("todo.inputPlaceholder"),"data-testid":"todo-input",className:"w-auto flex-1 min-w-0"}),(0,n.jsx)(x.$n,{type:"button",variant:"primary",size:"sm",onClick:k,disabled:p||0===u.trim().length,"data-testid":"todo-add-button",className:"shrink-0",children:e("todo.add")})]}),b&&(0,n.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"todo-error",children:b}),g&&0===c.length?(0,n.jsx)("ul",{className:"space-y-1","data-testid":"todo-loading",role:"status","aria-label":e("todo.loading"),children:[0,1,2].map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-1 py-1",children:[(0,n.jsx)(x.EA,{className:"h-4 w-4 shrink-0 rounded"}),(0,n.jsx)(x.EA,{className:"h-4 ".concat(1===e?"w-2/3":"w-5/6")})]},e))}):0===c.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"todo-empty",children:e("todo.empty")}):(0,n.jsx)("ul",{className:"space-y-1","data-testid":"todo-list",children:c.map(t=>(0,n.jsxs)("li",{className:"flex flex-col gap-1 rounded-md px-1 py-1 hover:bg-muted group sm:flex-row sm:items-center sm:gap-2","data-testid":"todo-item",children:[(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,n.jsx)("label",{className:"shrink-0 inline-flex min-h-[44px] min-w-[44px] cursor-pointer items-center justify-center sm:min-h-0 sm:min-w-0",children:(0,n.jsx)(x.Sc,{checked:t.done,onCheckedChange:()=>C(t),"data-testid":"todo-checkbox","aria-label":t.done?e("todo.markAsNotDone"):e("todo.markAsDone")})}),(0,n.jsx)("span",{className:"min-w-0 flex-1 break-words text-sm ".concat(t.done?"line-through text-muted-foreground":"text-foreground"),children:t.content})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[I(t)&&(0,n.jsx)("span",{className:"shrink-0 max-w-[8rem] truncate rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground","data-testid":"todo-repo-badge",title:I(t),children:I(t)}),(0,n.jsx)("button",{type:"button",onClick:()=>S(t),"aria-label":e("todo.delete"),"data-testid":"todo-delete",className:"inline-flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center text-muted-foreground opacity-100 transition-opacity hover:text-danger-foreground sm:min-h-0 sm:min-w-0 sm:opacity-0 sm:group-hover:opacity-100",children:(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id))})]}):(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("todo.noRepositories")})]})}var U=s(37586),z=s(66685),P=s(24533),O=s(37772),H=s(6473);let $=[{key:"chat",href:"/chat",icon:(0,n.jsx)(U.A,{size:20,"aria-hidden":"true"})},{key:"sessions",href:"/sessions",icon:(0,n.jsx)(z.A,{size:20,"aria-hidden":"true"})},{key:"repositories",href:"/repositories",icon:(0,n.jsx)(P.A,{size:20,"aria-hidden":"true"})},{key:"review",href:"/review",icon:(0,n.jsx)(u.A,{size:20,"aria-hidden":"true"})},{key:"more",href:"/more",icon:(0,n.jsx)(O.A,{size:20,"aria-hidden":"true"})}];function _(){let e=(0,r.c)("common");return(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-5","data-testid":"home-quick-actions",children:$.map((t,s)=>{let a=e("nav.".concat(t.key));return(0,n.jsx)(c(),{href:t.href,"aria-label":a,className:"group block rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","data-testid":"quick-action-".concat(t.key),children:(0,n.jsxs)(x.Zp,{interactive:!0,padding:"sm",style:{animationDelay:(0,H.Lc)(s)},className:"flex h-full flex-col items-center justify-center gap-1.5 py-3 text-center hover:border-accent-300 dark:hover:border-accent-700 ".concat(H.qz),children:[(0,n.jsx)("span",{className:"text-muted-foreground group-hover:text-accent-600 dark:group-hover:text-accent-400 transition-colors",children:t.icon}),(0,n.jsx)("span",{className:"text-xs font-medium text-foreground",children:a})]})},t.href)})})}function G(){let{worktrees:e,repositories:t,isLoading:s,error:i}=(0,o.Fn)(),r=s&&0===e.length;return(0,n.jsx)(a.GV,{children:(0,n.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,n.jsx)(d,{worktrees:e}),(0,n.jsx)(j,{worktrees:e,repositories:t,isLoading:r,error:i}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-12","data-testid":"home-bento-grid",children:[(0,n.jsx)("div",{className:"md:col-span-8",children:(0,n.jsx)(R,{worktrees:e,isLoading:r})}),(0,n.jsx)("div",{className:"md:col-span-4",children:(0,n.jsx)(L,{})}),(0,n.jsx)("div",{className:"md:col-span-12",children:(0,n.jsx)(_,{})})]})]})})}},83012:(e,t,s)=>{"use strict";s.d(t,{Fx:()=>i,Uq:()=>d,bg:()=>r,fw:()=>o,g8:()=>l});var n=s(53298),a=s(73683);function o(e,t){let s=new Date(e);return isNaN(s.getTime())?"":(0,n.m)(s,{addSuffix:!0,...t?{locale:t}:{}})}function i(e){let t=new Date(e);if(isNaN(t.getTime()))return"";let s=Math.round((Date.now()-t.getTime())/1e3);if(s<45)return"now";let n=Math.round(s/60);if(n<60)return"".concat(n,"m ago");let a=Math.round(n/60);if(a<24)return"".concat(a,"h ago");let o=Math.round(a/24);return o<7?"".concat(o,"d ago"):o<30?"".concat(Math.round(o/7),"w ago"):o<365?"".concat(Math.round(o/30),"mo ago"):"".concat(Math.round(o/365),"y ago")}function r(e,t){return!(e instanceof Date)||isNaN(e.getTime())?"":(0,a.GP)(e,"PPp",t?{locale:t}:void 0)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;if(!(e instanceof Date)||isNaN(e.getTime()))return"";let s=t instanceof Date&&!isNaN(t.getTime())?t:new Date,n=e.getFullYear()===s.getFullYear()&&e.getMonth()===s.getMonth()&&e.getDate()===s.getDate();return(0,a.GP)(e,n?"HH:mm":"M/d HH:mm")}function l(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;if(!m(e))return"";let n=m(s)?s:new Date,o=m(t)?t:null,i=u(e,n)&&(null===o||u(o,n)&&u(o,e))?"HH:mm":"M/d HH:mm",r=(0,a.GP)(e,i);if(null===o)return r;let d=(0,a.GP)(o,i);return d===r?r:"".concat(d).concat(c).concat(r)}let c=" → ";function m(e){return e instanceof Date&&!isNaN(e.getTime())}function u(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}},85872:(e,t,s)=>{"use strict";async function n(e,t){throw Error((await e.json().catch(()=>({}))).error||"".concat(t," (").concat(e.status,")"))}s.d(t,{$C:()=>a,Ar:()=>i,KG:()=>o});let a={async list(e){var t;let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:n(s,"Failed to load todos")},async listAll(){var e;let t=await fetch("/api/todos");return t.ok?null!=(e=(await t.json()).todos)?e:[]:n(t,"Failed to load todos")},async create(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});return s.ok?(await s.json()).todo:n(s,"Failed to create todo")},async update(e,t,s){let a=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return a.ok?(await a.json()).todo:n(a,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await n(s,"Failed to delete todo")}},o=["todo","doing","done"],i={async list(e){var t;let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:n(s,"Failed to load todos")},async create(e,t,s){let a=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(void 0!==s?{content:t,detail:s}:{content:t})});return a.ok?(await a.json()).todo:n(a,"Failed to create todo")},async update(e,t,s){let a=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return a.ok?(await a.json()).todo:n(a,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await n(s,"Failed to delete todo")},async reorder(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({todoIds:t})});s.ok||await n(s,"Failed to reorder todos")}}}},e=>{e.O(0,[6809,4909,2770,790,5694,9948,6402,8019,4718,8361,8441,1255,7358],()=>e(e.s=54799)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{6473:(e,t,s)=>{"use strict";s.d(t,{Lc:()=>a,qz:()=>n});let n="animate-in fade-in-0 slide-in-from-bottom-2 fill-mode-backwards duration-300";function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(Number.isFinite(e)&&!(e<=0)&&!(e>=s))return"".concat(e*t,"ms")}},53292:(e,t,s)=>{"use strict";s.d(t,{Ll:()=>n,bu:()=>a});let n=2e3,a=4e3},54799:(e,t,s)=>{Promise.resolve().then(s.bind(s,75590))},75590:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>G});var n=s(95155),a=s(54388),o=s(66966),i=s(12115),r=s(18955);function d(e){let{worktrees:t}=e,s=(0,r.c)("home"),{runningCount:a,waitingCount:o}=(0,i.useMemo)(()=>{let e=0,s=0;for(let n of t)n.isSessionRunning&&(e++,n.isWaitingForResponse&&s++);return{runningCount:e,waitingCount:s}},[t]);return(0,n.jsxs)("div",{className:"mb-8",children:[(0,n.jsx)("h1",{className:"text-2xl font-semibold text-foreground",children:s("title")}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":"home-subline",children:[(0,n.jsx)("span",{className:"tabular-nums","data-testid":"subline-running",children:a})," ",s("running"),(0,n.jsx)("span",{"aria-hidden":"true",children:" \xb7 "}),(0,n.jsx)("span",{className:"tabular-nums","data-testid":"subline-waiting",children:o})," ",s("waiting")]})]})}var l=s(52619),c=s.n(l),m=s(65229),u=s(61362),h=s(99051),x=s(28019),g=s(2317);function f(e){return"boolean"==typeof e}let p=[{key:"registerRepository",href:"/repositories"},{key:"sendFirstMessage",href:"/sessions"}];function j(e){let{worktrees:t,repositories:s,isLoading:a=!1,error:o=null}=e,d=(0,r.c)("home"),{value:l,setValue:j}=(0,g.V)({key:"commandmate:onboarding-dismissed",defaultValue:!1,validate:f}),[b,v]=(0,i.useState)(!1);(0,i.useEffect)(()=>v(!0),[]);let y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{hasRepository:(null!=t?t:[]).length>0,hasSentMessage:(null!=e?e:[]).some(e=>!!e.lastUserMessageAt)}}(t,s),w=y.hasRepository&&y.hasSentMessage,N=b&&!a&&null===o;return((0,i.useEffect)(()=>{N&&w&&!l&&j(!0)},[N,w,l,j]),!N||w||l)?null:(0,n.jsx)("div",{className:"mb-8",children:(0,n.jsxs)(x.Zp,{variant:"elevated","data-testid":"onboarding-checklist",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:d("onboarding.title")}),(0,n.jsx)(x.$n,{variant:"ghost",size:"sm","aria-label":d("onboarding.dismiss"),"data-testid":"onboarding-dismiss",onClick:()=>j(!0),children:(0,n.jsx)(m.A,{size:16,"aria-hidden":"true"})})]}),(0,n.jsx)("ol",{className:"mt-3 space-y-3",children:p.map(e=>{let{key:t,href:s}=e,a="registerRepository"===t?y.hasRepository:y.hasSentMessage;return(0,n.jsxs)("li",{className:"flex items-center gap-3","data-testid":"onboarding-step-".concat(t),"data-complete":a,children:[a?(0,n.jsx)(u.A,{size:20,className:"shrink-0 text-success-foreground","aria-hidden":"true"}):(0,n.jsx)(h.A,{size:20,className:"shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 text-sm ".concat(a?"text-muted-foreground line-through":"text-foreground"),children:d("onboarding.steps.".concat(t))}),!a&&(0,n.jsx)(c(),{href:s,"data-testid":"onboarding-action-".concat(t),className:"shrink-0 rounded-md bg-accent-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:bg-accent-500 dark:hover:bg-accent-600",children:d("onboarding.actions.".concat(t))})]},t)})})]})})}var b=s(87531),v=s(44308),y=s(24373);function w(e){let{worktrees:t,isLoading:s=!1}=e,a=(0,r.c)("home"),o=(0,i.useMemo)(()=>t.filter(e=>e.isSessionRunning).length,[t]),d=(0,i.useMemo)(()=>(0,y.Kg)(t),[t]);return s?(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary-loading",role:"status","aria-label":a("sessionSummary.loading"),children:[0,1].map(e=>(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,n.jsx)("div",{className:"flex h-4 items-center",children:(0,n.jsx)(x.EA,{className:"h-3 w-16"})}),(0,n.jsx)("div",{className:"flex h-9 items-center",children:(0,n.jsx)(x.EA,{className:"h-7 w-10"})})]},e))}):(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,n.jsx)(x.md,{status:o>0?"running":"idle",size:"sm",label:a("sessionSummary.running")}),a("sessionSummary.running")]}),(0,n.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",o>0?"text-foreground":"text-muted-foreground"),"data-testid":"running-count",children:o})]}),(0,n.jsxs)(c(),{href:v.ks,"data-testid":"waiting-count-link","aria-label":a("sessionSummary.waitingLinkLabel",{count:d}),className:"block rounded-lg border border-border bg-surface-2 px-3 py-2 transition-colors hover:border-warning-border hover:bg-warning-subtle focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,n.jsx)(x.md,{status:d>0?"waiting":"idle",size:"sm",label:a("sessionSummary.waiting")}),a("sessionSummary.waiting")]}),(0,n.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",d>0?"text-foreground":"text-muted-foreground"),"data-testid":"waiting-count",children:d})]})]})}var N=s(48481),k=s(7636),C=s(83012),S=s(38606);function A(e){var t;return null!=(t=e.lastUserMessageAt)?t:e.updatedAt}function E(e){let{worktrees:t,limit:s=5,isLoading:a=!1}=e,o=(0,r.c)("home"),d=(0,i.useMemo)(()=>[...t].sort((e,t)=>(0,k.nO)(A(e),A(t))).slice(0,s),[t,s]);return a?(0,n.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions-loading",role:"status","aria-label":o("recentSessions.loading"),children:Array.from({length:s},(e,t)=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-2 py-1.5",children:[(0,n.jsx)(x.EA,{className:"h-2 w-2 shrink-0 rounded-full"}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,n.jsx)(x.EA,{className:"h-4 w-2/5"}),(0,n.jsx)(x.EA,{className:"h-3 w-3/5"})]}),(0,n.jsx)(x.EA,{className:"h-3 w-8 shrink-0"})]},t))}):0===d.length?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"recent-sessions-empty",children:o("recentSessions.empty")}),(0,n.jsx)(c(),{href:"/repositories","data-testid":"recent-sessions-cta",className:"inline-block text-sm font-medium text-accent-600 transition-colors hover:text-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:text-accent-400 dark:hover:text-accent-300",children:o("recentSessions.cta")})]}):(0,n.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions",children:d.map(e=>{var t,s,a,o;let i=A(e),r=i?(0,C.Fx)(String(i)):"";return(0,n.jsx)("li",{children:(0,n.jsxs)(c(),{href:"/worktrees/".concat(e.id),"data-testid":"recent-session-".concat(e.id),className:"flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,n.jsx)(N.m,{"data-testid":"recent-status-dot-".concat(e.id),status:(0,S.kA)({isRunning:null!=(s=e.isSessionRunning)&&s,isWaitingForResponse:null!=(a=e.isWaitingForResponse)&&a,isProcessing:null!=(o=e.isProcessing)&&o}),waitingKind:(0,S.f_)(e).waitingKind,size:"sm"}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block truncate text-sm font-medium text-foreground",children:null!=(t=e.repositoryDisplayName)?t:e.repositoryName}),(0,n.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.name})]}),r&&(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r})]})},e.id)})})}function R(e){let{worktrees:t,isLoading:s=!1}=e,a=(0,r.c)("home");return(0,n.jsxs)(x.Zp,{variant:"elevated",className:"h-full","data-testid":"session-overview-tile",children:[(0,n.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:a("sessionOverview.title")}),(0,n.jsx)(w,{worktrees:t,isLoading:s}),(0,n.jsxs)("div",{className:"mt-4 flex items-center justify-between",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:a("sessionOverview.recentSessions")}),(0,n.jsx)(c(),{href:"/sessions",className:"text-xs text-accent-600 hover:underline dark:text-accent-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","data-testid":"session-overview-view-all",children:a("sessionOverview.viewAll")})]}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)(E,{worktrees:t,isLoading:s})})]})}var M=s(36402),D=s(85872),F=s(53292);let T="commandmate-home-todo-repo";function I(e){var t;return(null==(t=e.repositoryDisplayName)?void 0:t.trim())||e.repositoryName||""}function L(){let e=(0,r.c)("home"),t=(0,r.c)("common"),s=(0,M.SC)(),[a,o]=(0,i.useState)([]),[d,l]=(0,i.useState)(""),[c,m]=(0,i.useState)([]),[u,h]=(0,i.useState)(""),[g,f]=(0,i.useState)(!1),[p,j]=(0,i.useState)(!1),[b,v]=(0,i.useState)(null),y=(0,i.useRef)(!1),w=(0,i.useMemo)(()=>c.filter(e=>!e.done).length,[c]);(0,i.useEffect)(()=>{!async function(){try{var e;let t=await fetch("/api/worktrees");if(!t.ok)return;let s=(null!=(e=(await t.json()).repositories)?e:[]).map(e=>({id:e.id,path:e.path,name:e.name,displayName:e.displayName}));if(o(s),s.length>0){let e=localStorage.getItem(T),t=e&&s.some(t=>t.id===e)?e:s[0].id;l(t)}}catch(e){}finally{y.current=!0}}()},[]);let N=(0,i.useCallback)(async()=>{f(!0),v(null);try{let e=await D.$C.listAll();m(e)}catch(t){v(t instanceof Error?t.message:e("todo.errors.load")),m([])}finally{f(!1)}},[e]);(0,i.useEffect)(()=>{N()},[N]),(0,i.useEffect)(()=>{d&&localStorage.setItem(T,d)},[d]);let k=(0,i.useCallback)(async()=>{let t=u.trim();if(t&&d&&!p){j(!0),v(null);try{await D.$C.create(d,t),h(""),await N()}catch(t){v(t instanceof Error?t.message:e("todo.errors.add"))}finally{j(!1)}}},[u,d,p,N,e]),C=(0,i.useCallback)(async t=>{m(e=>e.map(e=>e.id===t.id?{...e,done:!e.done}:e)),v(null);try{await D.$C.update(t.repositoryId,t.id,{done:!t.done})}catch(t){v(t instanceof Error?t.message:e("todo.errors.update")),N()}},[N,e]),S=(0,i.useCallback)(async n=>{if(await s({description:t("confirmDelete",{name:n.content}),variant:"danger"})){v(null);try{await D.$C.remove(n.repositoryId,n.id),m(e=>e.filter(e=>e.id!==n.id))}catch(t){v(t instanceof Error?t.message:e("todo.errors.delete"))}}},[e,s,t]),A=(0,i.useCallback)(e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),k())},[k]),E=a.length>0;return(0,n.jsxs)(x.Zp,{className:"h-full","data-testid":"home-todo-widget",children:[(0,n.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:e("todo.title")}),(0,n.jsxs)("div",{className:"flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between sm:gap-3","data-testid":"todo-selector-row",children:[(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm text-muted-foreground min-w-0",children:[(0,n.jsx)("span",{className:"shrink-0",children:e("todo.repository")}),(0,n.jsx)("select",{value:d,onChange:e=>l(e.target.value),disabled:!E,"data-testid":"todo-repo-select",className:"min-w-0 flex-1 truncate rounded-md border border-input bg-surface dark:bg-surface-2 px-2 py-1 text-sm text-surface-foreground disabled:opacity-50 sm:flex-initial sm:max-w-[16rem]",children:a.map(e=>{var t;return(0,n.jsx)("option",{value:e.id,children:(null==(t=e.displayName)?void 0:t.trim())||e.name},e.id)})})]}),E&&(0,n.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground","data-testid":"todo-remaining",children:e("todo.open",{count:w})})]}),E?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,n.jsx)(x.pd,{type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:A,maxLength:F.Ll,placeholder:e("todo.inputPlaceholder"),"data-testid":"todo-input",className:"w-auto flex-1 min-w-0"}),(0,n.jsx)(x.$n,{type:"button",variant:"primary",size:"sm",onClick:k,disabled:p||0===u.trim().length,"data-testid":"todo-add-button",className:"shrink-0",children:e("todo.add")})]}),b&&(0,n.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"todo-error",children:b}),g&&0===c.length?(0,n.jsx)("ul",{className:"space-y-1","data-testid":"todo-loading",role:"status","aria-label":e("todo.loading"),children:[0,1,2].map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-1 py-1",children:[(0,n.jsx)(x.EA,{className:"h-4 w-4 shrink-0 rounded"}),(0,n.jsx)(x.EA,{className:"h-4 ".concat(1===e?"w-2/3":"w-5/6")})]},e))}):0===c.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"todo-empty",children:e("todo.empty")}):(0,n.jsx)("ul",{className:"space-y-1","data-testid":"todo-list",children:c.map(t=>(0,n.jsxs)("li",{className:"flex flex-col gap-1 rounded-md px-1 py-1 hover:bg-muted group sm:flex-row sm:items-center sm:gap-2","data-testid":"todo-item",children:[(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,n.jsx)("label",{className:"shrink-0 inline-flex min-h-[44px] min-w-[44px] cursor-pointer items-center justify-center sm:min-h-0 sm:min-w-0",children:(0,n.jsx)(x.Sc,{checked:t.done,onCheckedChange:()=>C(t),"data-testid":"todo-checkbox","aria-label":t.done?e("todo.markAsNotDone"):e("todo.markAsDone")})}),(0,n.jsx)("span",{className:"min-w-0 flex-1 break-words text-sm ".concat(t.done?"line-through text-muted-foreground":"text-foreground"),children:t.content})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[I(t)&&(0,n.jsx)("span",{className:"shrink-0 max-w-[8rem] truncate rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground","data-testid":"todo-repo-badge",title:I(t),children:I(t)}),(0,n.jsx)("button",{type:"button",onClick:()=>S(t),"aria-label":e("todo.delete"),"data-testid":"todo-delete",className:"inline-flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center text-muted-foreground opacity-100 transition-opacity hover:text-danger-foreground sm:min-h-0 sm:min-w-0 sm:opacity-0 sm:group-hover:opacity-100",children:(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id))})]}):(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("todo.noRepositories")})]})}var U=s(37586),z=s(66685),P=s(24533),O=s(37772),H=s(6473);let $=[{key:"chat",href:"/chat",icon:(0,n.jsx)(U.A,{size:20,"aria-hidden":"true"})},{key:"sessions",href:"/sessions",icon:(0,n.jsx)(z.A,{size:20,"aria-hidden":"true"})},{key:"repositories",href:"/repositories",icon:(0,n.jsx)(P.A,{size:20,"aria-hidden":"true"})},{key:"review",href:"/review",icon:(0,n.jsx)(u.A,{size:20,"aria-hidden":"true"})},{key:"more",href:"/more",icon:(0,n.jsx)(O.A,{size:20,"aria-hidden":"true"})}];function _(){let e=(0,r.c)("common");return(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-5","data-testid":"home-quick-actions",children:$.map((t,s)=>{let a=e("nav.".concat(t.key));return(0,n.jsx)(c(),{href:t.href,"aria-label":a,className:"group block rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","data-testid":"quick-action-".concat(t.key),children:(0,n.jsxs)(x.Zp,{interactive:!0,padding:"sm",style:{animationDelay:(0,H.Lc)(s)},className:"flex h-full flex-col items-center justify-center gap-1.5 py-3 text-center hover:border-accent-300 dark:hover:border-accent-700 ".concat(H.qz),children:[(0,n.jsx)("span",{className:"text-muted-foreground group-hover:text-accent-600 dark:group-hover:text-accent-400 transition-colors",children:t.icon}),(0,n.jsx)("span",{className:"text-xs font-medium text-foreground",children:a})]})},t.href)})})}function G(){let{worktrees:e,repositories:t,isLoading:s,error:i}=(0,o.Fn)(),r=s&&0===e.length;return(0,n.jsx)(a.GV,{children:(0,n.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,n.jsx)(d,{worktrees:e}),(0,n.jsx)(j,{worktrees:e,repositories:t,isLoading:r,error:i}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-12","data-testid":"home-bento-grid",children:[(0,n.jsx)("div",{className:"md:col-span-8",children:(0,n.jsx)(R,{worktrees:e,isLoading:r})}),(0,n.jsx)("div",{className:"md:col-span-4",children:(0,n.jsx)(L,{})}),(0,n.jsx)("div",{className:"md:col-span-12",children:(0,n.jsx)(_,{})})]})]})})}},83012:(e,t,s)=>{"use strict";s.d(t,{Fx:()=>i,Uq:()=>d,bg:()=>r,fw:()=>o,g8:()=>l});var n=s(53298),a=s(73683);function o(e,t){let s=new Date(e);return isNaN(s.getTime())?"":(0,n.m)(s,{addSuffix:!0,...t?{locale:t}:{}})}function i(e){let t=new Date(e);if(isNaN(t.getTime()))return"";let s=Math.round((Date.now()-t.getTime())/1e3);if(s<45)return"now";let n=Math.round(s/60);if(n<60)return"".concat(n,"m ago");let a=Math.round(n/60);if(a<24)return"".concat(a,"h ago");let o=Math.round(a/24);return o<7?"".concat(o,"d ago"):o<30?"".concat(Math.round(o/7),"w ago"):o<365?"".concat(Math.round(o/30),"mo ago"):"".concat(Math.round(o/365),"y ago")}function r(e,t){return!(e instanceof Date)||isNaN(e.getTime())?"":(0,a.GP)(e,"PPp",t?{locale:t}:void 0)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;if(!(e instanceof Date)||isNaN(e.getTime()))return"";let s=t instanceof Date&&!isNaN(t.getTime())?t:new Date,n=e.getFullYear()===s.getFullYear()&&e.getMonth()===s.getMonth()&&e.getDate()===s.getDate();return(0,a.GP)(e,n?"HH:mm":"M/d HH:mm")}function l(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;if(!m(e))return"";let n=m(s)?s:new Date,o=m(t)?t:null,i=u(e,n)&&(null===o||u(o,n)&&u(o,e))?"HH:mm":"M/d HH:mm",r=(0,a.GP)(e,i);if(null===o)return r;let d=(0,a.GP)(o,i);return d===r?r:"".concat(d).concat(c).concat(r)}let c=" → ";function m(e){return e instanceof Date&&!isNaN(e.getTime())}function u(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}},85872:(e,t,s)=>{"use strict";async function n(e,t){throw Error((await e.json().catch(()=>({}))).error||"".concat(t," (").concat(e.status,")"))}s.d(t,{$C:()=>a,Ar:()=>i,KG:()=>o});let a={async list(e){var t;let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:n(s,"Failed to load todos")},async listAll(){var e;let t=await fetch("/api/todos");return t.ok?null!=(e=(await t.json()).todos)?e:[]:n(t,"Failed to load todos")},async create(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});return s.ok?(await s.json()).todo:n(s,"Failed to create todo")},async update(e,t,s){let a=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return a.ok?(await a.json()).todo:n(a,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await n(s,"Failed to delete todo")}},o=["todo","doing","done"],i={async list(e){var t;let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:n(s,"Failed to load todos")},async create(e,t,s){let a=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(void 0!==s?{content:t,detail:s}:{content:t})});return a.ok?(await a.json()).todo:n(a,"Failed to create todo")},async update(e,t,s){let a=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return a.ok?(await a.json()).todo:n(a,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await n(s,"Failed to delete todo")},async reorder(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({todoIds:t})});s.ok||await n(s,"Failed to reorder todos")}}}},e=>{e.O(0,[6809,4909,2770,790,5694,9948,2407,6402,8019,4718,4388,8441,1255,7358],()=>e(e.s=54799)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3135],{540:(e,t,s)=>{Promise.resolve().then(s.bind(s,24502))},9219:(e,t,s)=>{"use strict";s.d(t,{k:()=>i});var r=s(95155),a=s(12115),l=s(28019),n=s(87531);function i(e){let{onRefresh:t,enabled:s=!0,className:i,children:o}=e,{containerRef:c,pullDistance:d,isRefreshing:u,isPulling:p}=function(e){let{onRefresh:t,enabled:s=!0,threshold:r=64,maxPull:l=96,resistance:n=.5}=e,i=(0,a.useRef)(null),[o,c]=(0,a.useState)(0),[d,u]=(0,a.useState)(!1),[p,m]=(0,a.useState)(!1),h=(0,a.useRef)(null),x=(0,a.useRef)(0),f=(0,a.useRef)(!1);f.current=d;let g=(0,a.useCallback)(()=>{h.current=null,x.current=0,c(0),m(!1)},[]),b=(0,a.useCallback)(e=>{if(!s||f.current)return;let t=i.current;t&&!(t.scrollTop>0)&&(h.current=e.touches[0].clientY,x.current=0)},[s]),v=(0,a.useCallback)(e=>{if(null===h.current)return;let t=i.current;if(!t)return;if(t.scrollTop>0)return void g();let s=e.touches[0].clientY-h.current;if(s<=0){0!==x.current&&(x.current=0,c(0),m(!1));return}e.cancelable&&e.preventDefault();let r=Math.min(s*n,l);x.current=r,c(r),m(!0)},[n,l,g]),y=(0,a.useCallback)(async()=>{u(!0),m(!1),c(r);try{await Promise.resolve(t())}finally{u(!1),c(0)}},[t,r]),j=(0,a.useCallback)(()=>{if(null===h.current)return;let e=x.current>=r&&!f.current;h.current=null,x.current=0,e?y():(c(0),m(!1))},[r,y]);return(0,a.useEffect)(()=>{let e=i.current;if(e)return e.addEventListener("touchstart",b,{passive:!0}),e.addEventListener("touchmove",v,{passive:!1}),e.addEventListener("touchend",j,{passive:!0}),e.addEventListener("touchcancel",j,{passive:!0}),()=>{e.removeEventListener("touchstart",b),e.removeEventListener("touchmove",v),e.removeEventListener("touchend",j),e.removeEventListener("touchcancel",j)}},[b,v,j]),{containerRef:i,pullDistance:o,isRefreshing:d,isPulling:p}}({onRefresh:t,enabled:s,threshold:64}),m=u||d>0,h=u?1:Math.min(d/64,1);return(0,r.jsxs)("div",{ref:c,className:(0,n.cn)("relative overflow-auto",i),style:{overscrollBehaviorY:"contain"},"data-testid":"pull-to-refresh",children:[(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex justify-center",style:{transform:"translateY(".concat(m?Math.max(d-24,8):-32,"px)"),opacity:h,transition:p?"none":"transform 0.2s ease-out, opacity 0.2s ease-out"},"data-testid":"pull-to-refresh-indicator",role:"status","aria-hidden":!u,children:(0,r.jsx)(l.y$,{size:"sm",variant:"accent"})}),(0,r.jsx)("div",{style:{transform:m?"translateY(".concat(d,"px)"):void 0,transition:p?"none":"transform 0.2s ease-out"},children:o})]})}},18514:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},24502:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>A});var r=s(95155),a=s(12115),l=s(68361),n=s(9219),i=s(38218),o=s(18955),c=s(58734),d=s(28019),u=s(80344);class p{static getInstance(){return p.instance||(p.instance=new p),p.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return"https://".concat(t[1],"/").concat(t[3]).toLowerCase().replace(/\/$/,"");let s=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return s?"https://".concat(s[1],"/").concat(s[2]).toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let s=e.match(/:(.+?)(\.git)?$/);if(s&&e.startsWith("git@")){let e=s[1].split("/");return e[e.length-1]}let r=e.match(/\/([^\/]+?)(\.git)?$/);return r?r[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")?/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:{valid:!1,error:"INVALID_URL_FORMAT"}}constructor(){}}var m=s(27937),h=s(59847);let x=(0,s(71847).A)("corner-left-up",[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]);var f=s(39332);let g="w-full min-h-[44px] flex items-center gap-2 px-3 py-2 rounded-md text-left text-sm text-foreground hover:bg-muted transition-colors touch-manipulation";function b(e){var t,s;let{isOpen:l,onClose:n,onSelect:i,initialPath:c}=e,p=(0,o.c)("common"),[b,v]=(0,a.useState)(null),[y,j]=(0,a.useState)(!1),[N,k]=(0,a.useState)(null),w=(0,a.useCallback)(async e=>{j(!0),k(null);try{v(await u.gC.browse(e))}catch(e){k((0,u.hS)(e))}finally{j(!1)}},[]);(0,a.useEffect)(()=>{if(!l)return;let e=!1;return(async()=>{j(!0),k(null);try{let t=await u.gC.browse(c);if(e)return;let s=c?void 0:t.recentPaths[0];if(s)try{let t=await u.gC.browse(s);e||v(t);return}catch(t){if(e)return}v(t)}catch(t){e||k((0,u.hS)(t))}finally{e||j(!1)}})(),()=>{e=!0}},[l,c]);let C=(0,a.useCallback)(async()=>{let e=null==b?void 0:b.path;e&&(await u.gC.addRecentPath(e).catch(()=>void 0),i(e),n())},[null==b?void 0:b.path,i,n]),S=function(e,t){let s=[{label:"/",path:null}];if(!e)return s;let r=t.filter(t=>e===t||e.startsWith("".concat(t,"/"))).sort((e,t)=>t.length-e.length)[0];if(!r)return s.push({label:e,path:e}),s;s.push({label:r,path:r});let a=e.slice(r.length).split("/").filter(Boolean),l=r;for(let e of a)l="".concat(l,"/").concat(e),s.push({label:e,path:l});return s}(null!=(t=null==b?void 0:b.path)?t:null,null!=(s=null==b?void 0:b.roots)?s:[]),R=null!==b&&null===b.path;return(0,r.jsx)(d.Jh,{isOpen:l,onClose:n,title:p("repositories.pickerTitle"),size:"full",children:(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-12rem)] md:h-[26rem]",children:[(0,r.jsx)("nav",{"aria-label":p("repositories.pickerTitle"),className:"flex items-center flex-wrap gap-1 pb-2 border-b border-border text-xs",children:S.map((e,t)=>{var s;return(0,r.jsxs)(a.Fragment,{children:[t>0&&(0,r.jsx)(m.A,{className:"w-3 h-3 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("button",{type:"button",onClick:()=>{var t;w(null!=(t=e.path)?t:void 0)},disabled:t===S.length-1,className:"min-h-[32px] px-1.5 rounded font-mono text-muted-foreground hover:text-foreground hover:bg-muted disabled:text-foreground disabled:font-semibold disabled:hover:bg-transparent touch-manipulation",children:e.label})]},null!=(s=e.path)?s:"roots")})}),(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto py-2",children:[y&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground",children:[(0,r.jsx)(d.y$,{size:"sm"}),p("repositories.pickerLoading")]}),!y&&N&&(0,r.jsx)("p",{className:"px-3 py-2 text-sm text-danger-foreground",children:N}),!y&&!N&&b&&(0,r.jsxs)(r.Fragment,{children:[R&&b.recentPaths.length>0&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground",children:p("repositories.pickerRecentLabel")}),b.recentPaths.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>void w(e),className:g,children:[(0,r.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"font-mono truncate",children:e})]},e))]}),R&&(0,r.jsx)("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground",children:p("repositories.pickerRootsLabel")}),b.parent&&(0,r.jsxs)("button",{type:"button",onClick:()=>{var e;w(null!=(e=b.parent)?e:void 0)},className:g,children:[(0,r.jsx)(x,{className:"w-4 h-4 text-muted-foreground flex-shrink-0","aria-hidden":!0}),p("repositories.pickerUp")]}),b.entries.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>void w(e.path),className:g,children:[(0,r.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"font-mono truncate flex-1",children:e.name}),e.isGitRepo&&(0,r.jsxs)(d.Ex,{variant:"info",className:"flex-shrink-0",children:[(0,r.jsx)(f.A,{className:"w-3 h-3 mr-1","aria-hidden":!0}),null===e.worktreeCount?"git":p("repositories.pickerWorktreeCount",{count:e.worktreeCount})]})]},e.path)),0===b.entries.length&&(0,r.jsx)("p",{className:"px-3 py-2 text-sm text-muted-foreground",children:p("repositories.pickerEmpty")}),b.truncated&&(0,r.jsx)("p",{className:"px-3 py-2 text-xs text-warning-foreground",children:p("repositories.pickerTruncated",{limit:b.entryLimit})})]})]}),(0,r.jsxs)("div",{className:"flex gap-2 pt-2 border-t border-border",children:[(0,r.jsx)(d.$n,{type:"button",variant:"primary",onClick:()=>void C(),disabled:!(null==b?void 0:b.path),className:"min-h-[44px]",children:p("repositories.pickerSelectHere")}),(0,r.jsx)(d.$n,{type:"button",variant:"ghost",onClick:n,className:"min-h-[44px]",children:p("cancel")})]})]})})}let v={ok:"text-success-foreground",warn:"text-warning-foreground",error:"text-danger-foreground"};function y(e){var t,s,l,n,i,m;let{onRepositoryAdded:h}=e,x=(0,o.c)("common"),[f,g]=(0,a.useState)(!1),[y,j]=(0,a.useState)("local"),[N,k]=(0,a.useState)(""),[w,C]=(0,a.useState)(""),[S,R]=(0,a.useState)(!1),[E,A]=(0,a.useState)(!1),[L,T]=(0,a.useState)(!1),[$,D]=(0,a.useState)(!1),[P,z]=(0,a.useState)(null),[M,O]=(0,a.useState)(null),[U,_]=(0,a.useState)(null),[I,F]=(0,a.useState)(!1),[V,W]=(0,a.useState)([]),[H,B]=(0,a.useState)(null),[Y,G]=(0,a.useState)(null),[q,Z]=(0,a.useState)(null),K=p.getInstance(),X=(0,a.useCallback)(async e=>{try{let s=await u.Rx.getCloneStatus(e);if("completed"===s.status)_(x("repositories.cloneSuccess")),D(!1),z(null),C(""),R(!1),g(!1),h&&h();else if("failed"===s.status){var t;O((null==(t=s.error)?void 0:t.message)||x("repositories.cloneFailed")),D(!1),z(null)}else("running"===s.status||"pending"===s.status)&&setTimeout(()=>X(e),2e3)}catch(e){O((0,u.hS)(e)),D(!1),z(null)}},[h,x]);(0,a.useEffect)(()=>{P&&$&&X(P)},[P,$]),(0,a.useEffect)(()=>{if(!f)return;let e=!1;return u.gC.browse().then(t=>{e||W(t.roots)}).catch(()=>void 0),()=>{e=!0}},[f]),(0,a.useEffect)(()=>{let e=N.trim();if(!e){B(null),G(null);return}let t=!1,s=setTimeout(()=>{u.Rx.validatePath(e).then(s=>{t||(B(s),G(e))}).catch(()=>{t||(B(null),G(null))})},400);return()=>{t=!0,clearTimeout(s)}},[N]);let J=(0,a.useCallback)(async e=>{var t,s;let r;if(Y===e&&H)return null!=(t=H.duplicateScanRoots)?t:[];try{let t=await Promise.race([u.Rx.validatePath(e).then(t=>(B(t),G(e),t)),new Promise(e=>{r=setTimeout(()=>e(null),400)})]);return null!=(s=null==t?void 0:t.duplicateScanRoots)?s:[]}catch(e){return[]}finally{void 0!==r&&clearTimeout(r)}},[H,Y]),Q=(0,a.useCallback)(async e=>{try{let t=await u.Rx.scan(e);_(t.message),k(""),g(!1),h&&h()}catch(e){O((0,u.hS)(e))}},[h]),ee=async e=>{e.preventDefault();let t=N.trim();if(!t)return void O(x("repositories.pathRequired"));O(null),_(null),A(!0);try{let e=await J(t);if(e.length>0)return void Z({path:t,duplicates:e});await Q(t)}finally{A(!1)}},et=(0,a.useCallback)(()=>{Z(null),q&&(A(!0),Q(q.path).finally(()=>A(!1)))},[q,Q]),es=async e=>{if(e.preventDefault(),!w.trim())return void O(x("repositories.urlRequired"));let t=K.validate(w.trim());if(!t.valid)return void("EMPTY_URL"===t.error?O(x("repositories.urlRequired")):O(x("repositories.urlInvalid")));O(null),_(null),D(!0);try{let e=await u.Rx.clone(w.trim(),{fork:S});z(e.jobId)}catch(e){O((0,u.hS)(e)),D(!1)}},er=async()=>{O(null),_(null),T(!0);try{let e=await u.Rx.sync();_(e.message),h&&h()}catch(e){O((0,u.hS)(e))}finally{T(!1)}},ea=()=>{g(!1),k(""),C(""),R(!1),O(null),j("local"),Z(null)},el=H?(n=x,(i=H).valid?i.isGitRepo?{message:n("repositories.validationGitRepo",{count:null!=(m=i.worktreeCount)?m:1}),intent:"ok"}:{message:n("repositories.validationNotGitRepo"),intent:"warn"}:"not-found"===i.reason?{message:n("repositories.validationNotFound"),intent:"error"}:{message:n("repositories.validationOutsideRoots",{roots:i.allowedRootsLabel}),intent:"error"}):null,en=null!=(t=null==H?void 0:H.duplicateScanRoots)?t:[];return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[!f&&(0,r.jsxs)(d.$n,{"data-testid":"add-repository-button",variant:"primary",size:"sm",onClick:()=>g(!0),children:["+ ",x("repositories.add")]}),(0,r.jsx)(d.$n,{"data-testid":"sync-all-button",variant:"secondary",size:"sm",onClick:er,disabled:L,children:L?x("repositories.syncing"):x("repositories.syncAll")})]}),f&&(0,r.jsx)(d.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{children:(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2 text-foreground",children:x("repositories.addNewTitle")})}),(0,r.jsxs)(d.tU,{value:y,onValueChange:e=>j(e),children:[(0,r.jsxs)(d.j7,{className:"w-full",children:[(0,r.jsx)(d.Xi,{value:"local",children:x("repositories.localPathTab")}),(0,r.jsx)(d.Xi,{value:"url",children:x("repositories.cloneUrlTab")})]}),(0,r.jsx)(d.av,{value:"local",children:(0,r.jsxs)("form",{onSubmit:ee,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:x("repositories.localPathDescription")}),(0,r.jsx)("label",{htmlFor:"repositoryPath",className:"block text-sm font-medium text-foreground mb-2",children:x("repositories.localPathLabel")}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.pd,{id:"repositoryPath","data-testid":"repository-path-input",type:"text",value:N,onChange:e=>k(e.target.value),placeholder:"/absolute/path/to/repository",className:"font-mono flex-1",disabled:E}),(0,r.jsxs)(d.$n,{type:"button",variant:"secondary",onClick:()=>F(!0),disabled:E,className:"min-h-[44px] flex-shrink-0",children:[(0,r.jsx)(c.A,{className:"w-4 h-4 mr-1","aria-hidden":!0}),x("repositories.browse")]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:x("repositories.localPathExample",{example:V[0]?"".concat(V[0],"/my-repo"):"/Users/username/projects/my-repo"})}),V.length>0&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:x("repositories.localPathAllowedRoots",{roots:V.join(", ")})}),el&&(0,r.jsx)("p",{className:"text-xs mt-1 ".concat(v[el.intent]),children:el.message}),en.length>0&&(0,r.jsx)("p",{className:"text-xs mt-1 text-warning-foreground break-all","data-testid":"duplicate-scan-root-warning",children:x("repositories.duplicateScanRootWarning",{paths:en.join(", ")})})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.$n,{"data-testid":"repository-scan-submit",type:"submit",variant:"primary",disabled:E||!N.trim(),children:E?x("repositories.scanning"):x("repositories.scan")}),(0,r.jsx)(d.$n,{type:"button",variant:"ghost",onClick:ea,disabled:E,children:x("cancel")})]})]})}),(0,r.jsx)(d.av,{value:"url",children:(0,r.jsxs)("form",{onSubmit:es,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:x("repositories.cloneUrlDescription")}),(0,r.jsx)("label",{htmlFor:"cloneUrl",className:"block text-sm font-medium text-foreground mb-2",children:x("repositories.cloneUrlLabel")}),(0,r.jsx)(d.pd,{id:"cloneUrl",type:"text",value:w,onChange:e=>C(e.target.value),placeholder:"https://github.com/user/repo.git",className:"font-mono",disabled:$}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:x("repositories.cloneUrlHelp")})]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("input",{id:"forkBeforeClone",type:"checkbox",checked:S,onChange:e=>R(e.target.checked),disabled:$,className:"mt-1"}),(0,r.jsxs)("label",{htmlFor:"forkBeforeClone",className:"text-sm text-foreground",children:[x("repositories.forkOptionLabel"),(0,r.jsx)("span",{className:"block text-xs text-muted-foreground",children:x("repositories.forkOptionHelp")})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.$n,{type:"submit",variant:"primary",disabled:$||!w.trim(),children:$?x("repositories.cloning"):S?x("repositories.forkAndClone"):x("repositories.clone")}),(0,r.jsx)(d.$n,{type:"button",variant:"ghost",onClick:ea,disabled:$,children:x("cancel")})]})]})})]})]})}),U&&(0,r.jsx)("div",{className:"p-4 bg-success-subtle border border-success-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-success-foreground",children:U})}),M&&(0,r.jsx)("div",{className:"p-4 bg-danger-subtle border border-danger-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-danger-foreground",children:M})}),(0,r.jsx)(b,{isOpen:I,onClose:()=>F(!1),onSelect:e=>{k(e),O(null)}}),(0,r.jsx)(d.TM,{isOpen:null!==q,title:x("repositories.duplicateConfirmTitle"),description:x("repositories.duplicateConfirmBody",{path:null!=(s=null==q?void 0:q.path)?s:"",paths:(null!=(l=null==q?void 0:q.duplicates)?l:[]).join("\n")}),confirmLabel:x("repositories.duplicateConfirmAction"),variant:"default",onConfirm:et,onCancel:()=>Z(null)})]})}var j=s(18514),N=s(87531);let k={id:null,value:"",error:null,saving:!1};function w(){return(0,r.jsx)("thead",{className:"bg-muted border-b border-border",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Display name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Visibility"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Path"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Worktrees"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Scan"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Actions"})]})})}function C(e){let{repo:t,pending:s,onToggle:a}=e,l=t.visible;return(0,r.jsxs)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":l?"Hide ".concat(t.name," from sidebar"):"Show ".concat(t.name," in sidebar"),"data-testid":"visibility-toggle-".concat(t.id),onClick:()=>a(t),disabled:s,className:(0,N.cn)("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-60 disabled:cursor-not-allowed"),children:[(0,r.jsx)(d.md,{status:l?"ready":"idle",size:"sm",label:l?"Visible":"Hidden","aria-hidden":"true"}),l?"Visible":"Hidden"]})}function S(e){let{repo:t,pending:s,onToggle:a,registerRef:l}=e,n=t.enabled;return(0,r.jsxs)("button",{ref:e=>l(t.id,e),type:"button",role:"switch","aria-checked":n,"aria-label":n?"Exclude ".concat(t.name," from repository scans"):"Include ".concat(t.name," in repository scans"),"data-testid":"scan-toggle-".concat(t.id),onClick:()=>a(t),disabled:s,className:(0,N.cn)("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-60 disabled:cursor-not-allowed"),children:[(0,r.jsx)(d.md,{status:n?"ready":"idle",size:"sm",label:n?"Enabled":"Disabled","aria-hidden":"true"}),n?"Enabled":"Disabled"]})}function R(e){var t;let{repo:s,onNavigateToScanToggle:a}=e,l=(0,o.c)("common"),n=null!=(t=s.duplicateOf)?t:[];if(0===n.length)return null;let i=l("repositories.duplicateRowDetail",{paths:n.join(", ")});return(0,r.jsx)("button",{type:"button","data-testid":"duplicate-scan-root-".concat(s.id),onClick:()=>a(s.id),title:i,"aria-label":i,className:(0,N.cn)("rounded-full","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:(0,r.jsx)(d.Ex,{variant:"warning",children:l("repositories.duplicateRowBadge")})})}let E=(0,a.memo)(function(e){var t,s;let{refreshKey:l,onChanged:n}=e,i=(0,o.c)("common"),[c,p]=(0,a.useState)([]),[m,h]=(0,a.useState)(!0),[x,f]=(0,a.useState)(null),[g,b]=(0,a.useState)(k),[v,y]=(0,a.useState)(null),[E,A]=(0,a.useState)(new Set),[L,T]=(0,a.useState)(new Set),[$,D]=(0,a.useState)("all"),[P,z]=(0,a.useState)(null),M=(0,a.useRef)(new Map),O=(0,a.useCallback)((e,t)=>{t?M.current.set(e,t):M.current.delete(e)},[]),U=(0,a.useCallback)(e=>{var t;null==(t=M.current.get(e))||t.focus()},[]),_=(0,a.useCallback)(async()=>{h(!0),f(null);try{let e=await u.Rx.list();p(e.repositories)}catch(e){f((0,u.hS)(e))}finally{h(!1)}},[]);(0,a.useEffect)(()=>{_()},[_,l]);let I=(0,a.useCallback)(e=>{var t;b({id:e.id,value:null!=(t=e.displayName)?t:"",error:null,saving:!1}),y(null)},[]),F=(0,a.useCallback)(()=>{b(k)},[]),V=(0,a.useCallback)(e=>{b(t=>{if(null===t.id)return t;let s=e.length>100?"Display name must be ".concat(100," characters or less"):null;return{...t,value:e,error:s}})},[]),W=(0,a.useCallback)(async e=>{let t=g.value.trim();if(t.length>100)return void b(e=>({...e,error:"Display name must be ".concat(100," characters or less")}));b(e=>({...e,saving:!0,error:null}));try{let s=0===t.length?null:t,r=await u.Rx.updateDisplayName(e.id,s);p(t=>t.map(t=>t.id===e.id?{...t,...r.repository}:t)),b(k),y({type:"success",message:"Display name updated"}),n&&n()}catch(t){let e=(0,u.hS)(t);b(t=>({...t,saving:!1,error:e})),y({type:"error",message:e})}},[g.value,n]),H=(0,a.useCallback)((e,t)=>{"Enter"!==e.key||e.nativeEvent.isComposing?"Escape"===e.key&&(e.preventDefault(),F()):(e.preventDefault(),W(t))},[F,W]),B=(0,a.useCallback)(async e=>{if(E.has(e.id))return;let t=!e.visible;A(t=>{let s=new Set(t);return s.add(e.id),s}),p(s=>s.map(s=>s.id===e.id?{...s,visible:t}:s)),y(null);try{let s=await u.Rx.updateVisibility(e.id,t);p(t=>t.map(t=>t.id===e.id?{...t,...s.repository}:t)),n&&n()}catch(t){p(t=>t.map(t=>t.id===e.id?{...e}:t)),y({type:"error",message:(0,u.hS)(t)})}finally{A(t=>{let s=new Set(t);return s.delete(e.id),s})}},[n,E]),Y=(0,a.useCallback)((e,t)=>{T(s=>{let r=new Set(s);return t?r.add(e):r.delete(e),r})},[]),G=(0,a.useCallback)(async e=>{Y(e.id,!0),y(null);try{let t=await u.Rx.updateEnabled(e.id,!1);p(s=>s.map(s=>{var r,a;if(s.id===e.id)return{...s,...t.repository,duplicateOf:[]};let l=(null!=(r=s.duplicateOf)?r:[]).filter(t=>t!==e.path);return l.length===(null!=(a=s.duplicateOf)?a:[]).length?s:{...s,duplicateOf:l}})),y({type:"success",message:i("repositories.disableSuccess",{name:e.name})}),n&&n()}catch(e){y({type:"error",message:(0,u.hS)(e)})}finally{Y(e.id,!1)}},[n,Y,i]),q=(0,a.useCallback)(async e=>{Y(e.id,!0),y(null);try{var t;let s=await u.Rx.restore(e.path);await _(),y({type:s.warning?"error":"success",message:null!=(t=s.warning)?t:i("repositories.enableSuccess",{name:e.name,count:s.worktreeCount})}),n&&n()}catch(e){y({type:"error",message:(0,u.hS)(e)})}finally{Y(e.id,!1)}},[_,n,Y,i]),Z=(0,a.useCallback)(e=>{if(!L.has(e.id)){if(e.enabled)return void z(e);q(e)}},[q,L]),K=(0,a.useCallback)(()=>{z(null),P&&G(P)},[G,P]),X=(0,a.useMemo)(()=>c.filter(e=>!e.enabled).length,[c]),J=(0,a.useMemo)(()=>"disabled"===$?c.filter(e=>!e.enabled):c,[$,c]);return m&&0===c.length?(0,r.jsx)(d.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto","data-testid":"repository-list-loading",role:"status","aria-label":i("repositories.loading"),children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(w,{}),(0,r.jsx)("tbody",{children:[0,1,2].map(e=>(0,r.jsxs)("tr",{className:"border-b border-border",children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-24"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-20"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-16"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-48"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-10"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-14"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-20"})})]},e))})]})})}):x?(0,r.jsx)(d.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("p",{className:"text-sm text-danger-foreground",children:["Failed to load repositories: ",x]}),(0,r.jsx)(d.$n,{variant:"secondary",size:"sm",onClick:()=>void _(),children:"Retry"})]})}):(0,r.jsxs)("div",{className:"space-y-3",children:[v&&(0,r.jsx)("div",{role:"status",className:"p-3 rounded-lg text-sm ".concat("success"===v.type?"bg-success-subtle border border-success-border text-success-foreground":"bg-danger-subtle border border-danger-border text-danger-foreground"),children:v.message}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(d.$n,{variant:"all"===$?"secondary":"ghost",size:"sm","aria-pressed":"all"===$,"data-testid":"repository-filter-all",onClick:()=>D("all"),children:i("repositories.filterAll",{count:c.length})}),(0,r.jsx)(d.$n,{variant:"disabled"===$?"secondary":"ghost",size:"sm","aria-pressed":"disabled"===$,"data-testid":"repository-filter-disabled",onClick:()=>D("disabled"),children:i("repositories.filterDisabled",{count:X})})]}),(0,r.jsx)(d.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(w,{}),(0,r.jsxs)("tbody",{children:[0===J.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:7,className:"px-4 py-6 text-center text-muted-foreground",children:"disabled"===$?i("repositories.emptyDisabled"):i("repositories.empty")})}),J.map(e=>{let t=g.id===e.id;return(0,r.jsxs)("tr",{className:(0,N.cn)("border-b border-border",!e.enabled&&"bg-muted/40"),"data-testid":"repository-row-".concat(e.id),children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:(0,r.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[e.name,(0,r.jsx)(R,{repo:e,onNavigateToScanToggle:U})]})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(d.pd,{"aria-label":"Edit display name for ".concat(e.name),type:"text",value:g.value,disabled:g.saving,maxLength:101,onChange:e=>V(e.target.value),onKeyDown:t=>H(t,e)}),g.error&&(0,r.jsx)("p",{className:"text-xs text-danger-foreground",children:g.error})]}):e.displayName?(0,r.jsx)("span",{className:"text-foreground",children:e.displayName}):(0,r.jsx)("span",{className:"text-muted-foreground","aria-hidden":"true",children:"—"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(C,{repo:e,pending:E.has(e.id),onToggle:B})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)("span",{className:"block max-w-[240px] truncate font-mono text-xs text-muted-foreground",title:e.path,children:e.path})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:e.worktreeCount}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(S,{repo:e,pending:L.has(e.id),onToggle:Z,registerRef:O})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.$n,{variant:"primary",size:"sm",onClick:()=>void W(e),disabled:g.saving||null!==g.error,children:g.saving?"Saving...":"Save"}),(0,r.jsx)(d.$n,{variant:"ghost",size:"sm",onClick:F,disabled:g.saving,children:"Cancel"})]}):(0,r.jsx)(d.$n,{variant:"ghost",size:"sm",className:"px-2",onClick:()=>I(e),"aria-label":"Edit display name for ".concat(e.name),children:(0,r.jsx)(j.A,{className:"h-4 w-4","aria-hidden":"true"})})})]},e.id)})]})]})})}),(0,r.jsx)(d.TM,{isOpen:null!==P,title:i("repositories.disableConfirmTitle"),description:i("repositories.disableConfirmBody",{name:null!=(t=null==P?void 0:P.name)?t:"",count:null!=(s=null==P?void 0:P.worktreeCount)?s:0}),confirmLabel:i("repositories.disableConfirmAction"),variant:"default",onConfirm:K,onCancel:()=>z(null)})]})});function A(){let e=(0,i.a)(),[t,s]=(0,a.useState)(0),o=(0,a.useCallback)(()=>{s(e=>e+1)},[]),c=(0,a.useCallback)(async()=>{s(e=>e+1),await new Promise(e=>setTimeout(e,500))},[]);return(0,r.jsx)(l.GV,{children:(0,r.jsxs)(n.k,{onRefresh:c,enabled:e,className:"container-custom py-8 h-full",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Repositories"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage repositories and worktrees."})]}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(y,{onRepositoryAdded:o}),(0,r.jsx)(E,{refreshKey:t,onChanged:o})]})]})})}},27937:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},58734:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]])}},e=>{e.O(0,[6809,4909,2770,790,5694,6402,8019,4718,8361,8441,1255,7358],()=>e(e.s=540)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3135],{540:(e,t,s)=>{Promise.resolve().then(s.bind(s,24502))},9219:(e,t,s)=>{"use strict";s.d(t,{k:()=>i});var r=s(95155),a=s(12115),l=s(28019),n=s(87531);function i(e){let{onRefresh:t,enabled:s=!0,className:i,children:o}=e,{containerRef:c,pullDistance:d,isRefreshing:u,isPulling:p}=function(e){let{onRefresh:t,enabled:s=!0,threshold:r=64,maxPull:l=96,resistance:n=.5}=e,i=(0,a.useRef)(null),[o,c]=(0,a.useState)(0),[d,u]=(0,a.useState)(!1),[p,m]=(0,a.useState)(!1),h=(0,a.useRef)(null),x=(0,a.useRef)(0),f=(0,a.useRef)(!1);f.current=d;let g=(0,a.useCallback)(()=>{h.current=null,x.current=0,c(0),m(!1)},[]),b=(0,a.useCallback)(e=>{if(!s||f.current)return;let t=i.current;t&&!(t.scrollTop>0)&&(h.current=e.touches[0].clientY,x.current=0)},[s]),v=(0,a.useCallback)(e=>{if(null===h.current)return;let t=i.current;if(!t)return;if(t.scrollTop>0)return void g();let s=e.touches[0].clientY-h.current;if(s<=0){0!==x.current&&(x.current=0,c(0),m(!1));return}e.cancelable&&e.preventDefault();let r=Math.min(s*n,l);x.current=r,c(r),m(!0)},[n,l,g]),y=(0,a.useCallback)(async()=>{u(!0),m(!1),c(r);try{await Promise.resolve(t())}finally{u(!1),c(0)}},[t,r]),j=(0,a.useCallback)(()=>{if(null===h.current)return;let e=x.current>=r&&!f.current;h.current=null,x.current=0,e?y():(c(0),m(!1))},[r,y]);return(0,a.useEffect)(()=>{let e=i.current;if(e)return e.addEventListener("touchstart",b,{passive:!0}),e.addEventListener("touchmove",v,{passive:!1}),e.addEventListener("touchend",j,{passive:!0}),e.addEventListener("touchcancel",j,{passive:!0}),()=>{e.removeEventListener("touchstart",b),e.removeEventListener("touchmove",v),e.removeEventListener("touchend",j),e.removeEventListener("touchcancel",j)}},[b,v,j]),{containerRef:i,pullDistance:o,isRefreshing:d,isPulling:p}}({onRefresh:t,enabled:s,threshold:64}),m=u||d>0,h=u?1:Math.min(d/64,1);return(0,r.jsxs)("div",{ref:c,className:(0,n.cn)("relative overflow-auto",i),style:{overscrollBehaviorY:"contain"},"data-testid":"pull-to-refresh",children:[(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex justify-center",style:{transform:"translateY(".concat(m?Math.max(d-24,8):-32,"px)"),opacity:h,transition:p?"none":"transform 0.2s ease-out, opacity 0.2s ease-out"},"data-testid":"pull-to-refresh-indicator",role:"status","aria-hidden":!u,children:(0,r.jsx)(l.y$,{size:"sm",variant:"accent"})}),(0,r.jsx)("div",{style:{transform:m?"translateY(".concat(d,"px)"):void 0,transition:p?"none":"transform 0.2s ease-out"},children:o})]})}},18514:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},24502:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>A});var r=s(95155),a=s(12115),l=s(54388),n=s(9219),i=s(38218),o=s(18955),c=s(58734),d=s(28019),u=s(80344);class p{static getInstance(){return p.instance||(p.instance=new p),p.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return"https://".concat(t[1],"/").concat(t[3]).toLowerCase().replace(/\/$/,"");let s=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return s?"https://".concat(s[1],"/").concat(s[2]).toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let s=e.match(/:(.+?)(\.git)?$/);if(s&&e.startsWith("git@")){let e=s[1].split("/");return e[e.length-1]}let r=e.match(/\/([^\/]+?)(\.git)?$/);return r?r[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")?/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:{valid:!1,error:"INVALID_URL_FORMAT"}}constructor(){}}var m=s(27937),h=s(59847);let x=(0,s(71847).A)("corner-left-up",[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]);var f=s(39332);let g="w-full min-h-[44px] flex items-center gap-2 px-3 py-2 rounded-md text-left text-sm text-foreground hover:bg-muted transition-colors touch-manipulation";function b(e){var t,s;let{isOpen:l,onClose:n,onSelect:i,initialPath:c}=e,p=(0,o.c)("common"),[b,v]=(0,a.useState)(null),[y,j]=(0,a.useState)(!1),[N,k]=(0,a.useState)(null),w=(0,a.useCallback)(async e=>{j(!0),k(null);try{v(await u.gC.browse(e))}catch(e){k((0,u.hS)(e))}finally{j(!1)}},[]);(0,a.useEffect)(()=>{if(!l)return;let e=!1;return(async()=>{j(!0),k(null);try{let t=await u.gC.browse(c);if(e)return;let s=c?void 0:t.recentPaths[0];if(s)try{let t=await u.gC.browse(s);e||v(t);return}catch(t){if(e)return}v(t)}catch(t){e||k((0,u.hS)(t))}finally{e||j(!1)}})(),()=>{e=!0}},[l,c]);let C=(0,a.useCallback)(async()=>{let e=null==b?void 0:b.path;e&&(await u.gC.addRecentPath(e).catch(()=>void 0),i(e),n())},[null==b?void 0:b.path,i,n]),S=function(e,t){let s=[{label:"/",path:null}];if(!e)return s;let r=t.filter(t=>e===t||e.startsWith("".concat(t,"/"))).sort((e,t)=>t.length-e.length)[0];if(!r)return s.push({label:e,path:e}),s;s.push({label:r,path:r});let a=e.slice(r.length).split("/").filter(Boolean),l=r;for(let e of a)l="".concat(l,"/").concat(e),s.push({label:e,path:l});return s}(null!=(t=null==b?void 0:b.path)?t:null,null!=(s=null==b?void 0:b.roots)?s:[]),R=null!==b&&null===b.path;return(0,r.jsx)(d.Jh,{isOpen:l,onClose:n,title:p("repositories.pickerTitle"),size:"full",children:(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-12rem)] md:h-[26rem]",children:[(0,r.jsx)("nav",{"aria-label":p("repositories.pickerTitle"),className:"flex items-center flex-wrap gap-1 pb-2 border-b border-border text-xs",children:S.map((e,t)=>{var s;return(0,r.jsxs)(a.Fragment,{children:[t>0&&(0,r.jsx)(m.A,{className:"w-3 h-3 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("button",{type:"button",onClick:()=>{var t;w(null!=(t=e.path)?t:void 0)},disabled:t===S.length-1,className:"min-h-[32px] px-1.5 rounded font-mono text-muted-foreground hover:text-foreground hover:bg-muted disabled:text-foreground disabled:font-semibold disabled:hover:bg-transparent touch-manipulation",children:e.label})]},null!=(s=e.path)?s:"roots")})}),(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto py-2",children:[y&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground",children:[(0,r.jsx)(d.y$,{size:"sm"}),p("repositories.pickerLoading")]}),!y&&N&&(0,r.jsx)("p",{className:"px-3 py-2 text-sm text-danger-foreground",children:N}),!y&&!N&&b&&(0,r.jsxs)(r.Fragment,{children:[R&&b.recentPaths.length>0&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground",children:p("repositories.pickerRecentLabel")}),b.recentPaths.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>void w(e),className:g,children:[(0,r.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"font-mono truncate",children:e})]},e))]}),R&&(0,r.jsx)("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground",children:p("repositories.pickerRootsLabel")}),b.parent&&(0,r.jsxs)("button",{type:"button",onClick:()=>{var e;w(null!=(e=b.parent)?e:void 0)},className:g,children:[(0,r.jsx)(x,{className:"w-4 h-4 text-muted-foreground flex-shrink-0","aria-hidden":!0}),p("repositories.pickerUp")]}),b.entries.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>void w(e.path),className:g,children:[(0,r.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"font-mono truncate flex-1",children:e.name}),e.isGitRepo&&(0,r.jsxs)(d.Ex,{variant:"info",className:"flex-shrink-0",children:[(0,r.jsx)(f.A,{className:"w-3 h-3 mr-1","aria-hidden":!0}),null===e.worktreeCount?"git":p("repositories.pickerWorktreeCount",{count:e.worktreeCount})]})]},e.path)),0===b.entries.length&&(0,r.jsx)("p",{className:"px-3 py-2 text-sm text-muted-foreground",children:p("repositories.pickerEmpty")}),b.truncated&&(0,r.jsx)("p",{className:"px-3 py-2 text-xs text-warning-foreground",children:p("repositories.pickerTruncated",{limit:b.entryLimit})})]})]}),(0,r.jsxs)("div",{className:"flex gap-2 pt-2 border-t border-border",children:[(0,r.jsx)(d.$n,{type:"button",variant:"primary",onClick:()=>void C(),disabled:!(null==b?void 0:b.path),className:"min-h-[44px]",children:p("repositories.pickerSelectHere")}),(0,r.jsx)(d.$n,{type:"button",variant:"ghost",onClick:n,className:"min-h-[44px]",children:p("cancel")})]})]})})}let v={ok:"text-success-foreground",warn:"text-warning-foreground",error:"text-danger-foreground"};function y(e){var t,s,l,n,i,m;let{onRepositoryAdded:h}=e,x=(0,o.c)("common"),[f,g]=(0,a.useState)(!1),[y,j]=(0,a.useState)("local"),[N,k]=(0,a.useState)(""),[w,C]=(0,a.useState)(""),[S,R]=(0,a.useState)(!1),[E,A]=(0,a.useState)(!1),[L,T]=(0,a.useState)(!1),[$,D]=(0,a.useState)(!1),[P,z]=(0,a.useState)(null),[M,O]=(0,a.useState)(null),[U,_]=(0,a.useState)(null),[I,F]=(0,a.useState)(!1),[V,W]=(0,a.useState)([]),[H,B]=(0,a.useState)(null),[Y,G]=(0,a.useState)(null),[q,Z]=(0,a.useState)(null),K=p.getInstance(),X=(0,a.useCallback)(async e=>{try{let s=await u.Rx.getCloneStatus(e);if("completed"===s.status)_(x("repositories.cloneSuccess")),D(!1),z(null),C(""),R(!1),g(!1),h&&h();else if("failed"===s.status){var t;O((null==(t=s.error)?void 0:t.message)||x("repositories.cloneFailed")),D(!1),z(null)}else("running"===s.status||"pending"===s.status)&&setTimeout(()=>X(e),2e3)}catch(e){O((0,u.hS)(e)),D(!1),z(null)}},[h,x]);(0,a.useEffect)(()=>{P&&$&&X(P)},[P,$]),(0,a.useEffect)(()=>{if(!f)return;let e=!1;return u.gC.browse().then(t=>{e||W(t.roots)}).catch(()=>void 0),()=>{e=!0}},[f]),(0,a.useEffect)(()=>{let e=N.trim();if(!e){B(null),G(null);return}let t=!1,s=setTimeout(()=>{u.Rx.validatePath(e).then(s=>{t||(B(s),G(e))}).catch(()=>{t||(B(null),G(null))})},400);return()=>{t=!0,clearTimeout(s)}},[N]);let J=(0,a.useCallback)(async e=>{var t,s;let r;if(Y===e&&H)return null!=(t=H.duplicateScanRoots)?t:[];try{let t=await Promise.race([u.Rx.validatePath(e).then(t=>(B(t),G(e),t)),new Promise(e=>{r=setTimeout(()=>e(null),400)})]);return null!=(s=null==t?void 0:t.duplicateScanRoots)?s:[]}catch(e){return[]}finally{void 0!==r&&clearTimeout(r)}},[H,Y]),Q=(0,a.useCallback)(async e=>{try{let t=await u.Rx.scan(e);_(t.message),k(""),g(!1),h&&h()}catch(e){O((0,u.hS)(e))}},[h]),ee=async e=>{e.preventDefault();let t=N.trim();if(!t)return void O(x("repositories.pathRequired"));O(null),_(null),A(!0);try{let e=await J(t);if(e.length>0)return void Z({path:t,duplicates:e});await Q(t)}finally{A(!1)}},et=(0,a.useCallback)(()=>{Z(null),q&&(A(!0),Q(q.path).finally(()=>A(!1)))},[q,Q]),es=async e=>{if(e.preventDefault(),!w.trim())return void O(x("repositories.urlRequired"));let t=K.validate(w.trim());if(!t.valid)return void("EMPTY_URL"===t.error?O(x("repositories.urlRequired")):O(x("repositories.urlInvalid")));O(null),_(null),D(!0);try{let e=await u.Rx.clone(w.trim(),{fork:S});z(e.jobId)}catch(e){O((0,u.hS)(e)),D(!1)}},er=async()=>{O(null),_(null),T(!0);try{let e=await u.Rx.sync();_(e.message),h&&h()}catch(e){O((0,u.hS)(e))}finally{T(!1)}},ea=()=>{g(!1),k(""),C(""),R(!1),O(null),j("local"),Z(null)},el=H?(n=x,(i=H).valid?i.isGitRepo?{message:n("repositories.validationGitRepo",{count:null!=(m=i.worktreeCount)?m:1}),intent:"ok"}:{message:n("repositories.validationNotGitRepo"),intent:"warn"}:"not-found"===i.reason?{message:n("repositories.validationNotFound"),intent:"error"}:{message:n("repositories.validationOutsideRoots",{roots:i.allowedRootsLabel}),intent:"error"}):null,en=null!=(t=null==H?void 0:H.duplicateScanRoots)?t:[];return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[!f&&(0,r.jsxs)(d.$n,{"data-testid":"add-repository-button",variant:"primary",size:"sm",onClick:()=>g(!0),children:["+ ",x("repositories.add")]}),(0,r.jsx)(d.$n,{"data-testid":"sync-all-button",variant:"secondary",size:"sm",onClick:er,disabled:L,children:L?x("repositories.syncing"):x("repositories.syncAll")})]}),f&&(0,r.jsx)(d.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{children:(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2 text-foreground",children:x("repositories.addNewTitle")})}),(0,r.jsxs)(d.tU,{value:y,onValueChange:e=>j(e),children:[(0,r.jsxs)(d.j7,{className:"w-full",children:[(0,r.jsx)(d.Xi,{value:"local",children:x("repositories.localPathTab")}),(0,r.jsx)(d.Xi,{value:"url",children:x("repositories.cloneUrlTab")})]}),(0,r.jsx)(d.av,{value:"local",children:(0,r.jsxs)("form",{onSubmit:ee,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:x("repositories.localPathDescription")}),(0,r.jsx)("label",{htmlFor:"repositoryPath",className:"block text-sm font-medium text-foreground mb-2",children:x("repositories.localPathLabel")}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.pd,{id:"repositoryPath","data-testid":"repository-path-input",type:"text",value:N,onChange:e=>k(e.target.value),placeholder:"/absolute/path/to/repository",className:"font-mono flex-1",disabled:E}),(0,r.jsxs)(d.$n,{type:"button",variant:"secondary",onClick:()=>F(!0),disabled:E,className:"min-h-[44px] flex-shrink-0",children:[(0,r.jsx)(c.A,{className:"w-4 h-4 mr-1","aria-hidden":!0}),x("repositories.browse")]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:x("repositories.localPathExample",{example:V[0]?"".concat(V[0],"/my-repo"):"/Users/username/projects/my-repo"})}),V.length>0&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:x("repositories.localPathAllowedRoots",{roots:V.join(", ")})}),el&&(0,r.jsx)("p",{className:"text-xs mt-1 ".concat(v[el.intent]),children:el.message}),en.length>0&&(0,r.jsx)("p",{className:"text-xs mt-1 text-warning-foreground break-all","data-testid":"duplicate-scan-root-warning",children:x("repositories.duplicateScanRootWarning",{paths:en.join(", ")})})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.$n,{"data-testid":"repository-scan-submit",type:"submit",variant:"primary",disabled:E||!N.trim(),children:E?x("repositories.scanning"):x("repositories.scan")}),(0,r.jsx)(d.$n,{type:"button",variant:"ghost",onClick:ea,disabled:E,children:x("cancel")})]})]})}),(0,r.jsx)(d.av,{value:"url",children:(0,r.jsxs)("form",{onSubmit:es,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:x("repositories.cloneUrlDescription")}),(0,r.jsx)("label",{htmlFor:"cloneUrl",className:"block text-sm font-medium text-foreground mb-2",children:x("repositories.cloneUrlLabel")}),(0,r.jsx)(d.pd,{id:"cloneUrl",type:"text",value:w,onChange:e=>C(e.target.value),placeholder:"https://github.com/user/repo.git",className:"font-mono",disabled:$}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:x("repositories.cloneUrlHelp")})]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("input",{id:"forkBeforeClone",type:"checkbox",checked:S,onChange:e=>R(e.target.checked),disabled:$,className:"mt-1"}),(0,r.jsxs)("label",{htmlFor:"forkBeforeClone",className:"text-sm text-foreground",children:[x("repositories.forkOptionLabel"),(0,r.jsx)("span",{className:"block text-xs text-muted-foreground",children:x("repositories.forkOptionHelp")})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.$n,{type:"submit",variant:"primary",disabled:$||!w.trim(),children:$?x("repositories.cloning"):S?x("repositories.forkAndClone"):x("repositories.clone")}),(0,r.jsx)(d.$n,{type:"button",variant:"ghost",onClick:ea,disabled:$,children:x("cancel")})]})]})})]})]})}),U&&(0,r.jsx)("div",{className:"p-4 bg-success-subtle border border-success-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-success-foreground",children:U})}),M&&(0,r.jsx)("div",{className:"p-4 bg-danger-subtle border border-danger-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-danger-foreground",children:M})}),(0,r.jsx)(b,{isOpen:I,onClose:()=>F(!1),onSelect:e=>{k(e),O(null)}}),(0,r.jsx)(d.TM,{isOpen:null!==q,title:x("repositories.duplicateConfirmTitle"),description:x("repositories.duplicateConfirmBody",{path:null!=(s=null==q?void 0:q.path)?s:"",paths:(null!=(l=null==q?void 0:q.duplicates)?l:[]).join("\n")}),confirmLabel:x("repositories.duplicateConfirmAction"),variant:"default",onConfirm:et,onCancel:()=>Z(null)})]})}var j=s(18514),N=s(87531);let k={id:null,value:"",error:null,saving:!1};function w(){return(0,r.jsx)("thead",{className:"bg-muted border-b border-border",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Display name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Visibility"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Path"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Worktrees"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Scan"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Actions"})]})})}function C(e){let{repo:t,pending:s,onToggle:a}=e,l=t.visible;return(0,r.jsxs)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":l?"Hide ".concat(t.name," from sidebar"):"Show ".concat(t.name," in sidebar"),"data-testid":"visibility-toggle-".concat(t.id),onClick:()=>a(t),disabled:s,className:(0,N.cn)("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-60 disabled:cursor-not-allowed"),children:[(0,r.jsx)(d.md,{status:l?"ready":"idle",size:"sm",label:l?"Visible":"Hidden","aria-hidden":"true"}),l?"Visible":"Hidden"]})}function S(e){let{repo:t,pending:s,onToggle:a,registerRef:l}=e,n=t.enabled;return(0,r.jsxs)("button",{ref:e=>l(t.id,e),type:"button",role:"switch","aria-checked":n,"aria-label":n?"Exclude ".concat(t.name," from repository scans"):"Include ".concat(t.name," in repository scans"),"data-testid":"scan-toggle-".concat(t.id),onClick:()=>a(t),disabled:s,className:(0,N.cn)("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-60 disabled:cursor-not-allowed"),children:[(0,r.jsx)(d.md,{status:n?"ready":"idle",size:"sm",label:n?"Enabled":"Disabled","aria-hidden":"true"}),n?"Enabled":"Disabled"]})}function R(e){var t;let{repo:s,onNavigateToScanToggle:a}=e,l=(0,o.c)("common"),n=null!=(t=s.duplicateOf)?t:[];if(0===n.length)return null;let i=l("repositories.duplicateRowDetail",{paths:n.join(", ")});return(0,r.jsx)("button",{type:"button","data-testid":"duplicate-scan-root-".concat(s.id),onClick:()=>a(s.id),title:i,"aria-label":i,className:(0,N.cn)("rounded-full","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:(0,r.jsx)(d.Ex,{variant:"warning",children:l("repositories.duplicateRowBadge")})})}let E=(0,a.memo)(function(e){var t,s;let{refreshKey:l,onChanged:n}=e,i=(0,o.c)("common"),[c,p]=(0,a.useState)([]),[m,h]=(0,a.useState)(!0),[x,f]=(0,a.useState)(null),[g,b]=(0,a.useState)(k),[v,y]=(0,a.useState)(null),[E,A]=(0,a.useState)(new Set),[L,T]=(0,a.useState)(new Set),[$,D]=(0,a.useState)("all"),[P,z]=(0,a.useState)(null),M=(0,a.useRef)(new Map),O=(0,a.useCallback)((e,t)=>{t?M.current.set(e,t):M.current.delete(e)},[]),U=(0,a.useCallback)(e=>{var t;null==(t=M.current.get(e))||t.focus()},[]),_=(0,a.useCallback)(async()=>{h(!0),f(null);try{let e=await u.Rx.list();p(e.repositories)}catch(e){f((0,u.hS)(e))}finally{h(!1)}},[]);(0,a.useEffect)(()=>{_()},[_,l]);let I=(0,a.useCallback)(e=>{var t;b({id:e.id,value:null!=(t=e.displayName)?t:"",error:null,saving:!1}),y(null)},[]),F=(0,a.useCallback)(()=>{b(k)},[]),V=(0,a.useCallback)(e=>{b(t=>{if(null===t.id)return t;let s=e.length>100?"Display name must be ".concat(100," characters or less"):null;return{...t,value:e,error:s}})},[]),W=(0,a.useCallback)(async e=>{let t=g.value.trim();if(t.length>100)return void b(e=>({...e,error:"Display name must be ".concat(100," characters or less")}));b(e=>({...e,saving:!0,error:null}));try{let s=0===t.length?null:t,r=await u.Rx.updateDisplayName(e.id,s);p(t=>t.map(t=>t.id===e.id?{...t,...r.repository}:t)),b(k),y({type:"success",message:"Display name updated"}),n&&n()}catch(t){let e=(0,u.hS)(t);b(t=>({...t,saving:!1,error:e})),y({type:"error",message:e})}},[g.value,n]),H=(0,a.useCallback)((e,t)=>{"Enter"!==e.key||e.nativeEvent.isComposing?"Escape"===e.key&&(e.preventDefault(),F()):(e.preventDefault(),W(t))},[F,W]),B=(0,a.useCallback)(async e=>{if(E.has(e.id))return;let t=!e.visible;A(t=>{let s=new Set(t);return s.add(e.id),s}),p(s=>s.map(s=>s.id===e.id?{...s,visible:t}:s)),y(null);try{let s=await u.Rx.updateVisibility(e.id,t);p(t=>t.map(t=>t.id===e.id?{...t,...s.repository}:t)),n&&n()}catch(t){p(t=>t.map(t=>t.id===e.id?{...e}:t)),y({type:"error",message:(0,u.hS)(t)})}finally{A(t=>{let s=new Set(t);return s.delete(e.id),s})}},[n,E]),Y=(0,a.useCallback)((e,t)=>{T(s=>{let r=new Set(s);return t?r.add(e):r.delete(e),r})},[]),G=(0,a.useCallback)(async e=>{Y(e.id,!0),y(null);try{let t=await u.Rx.updateEnabled(e.id,!1);p(s=>s.map(s=>{var r,a;if(s.id===e.id)return{...s,...t.repository,duplicateOf:[]};let l=(null!=(r=s.duplicateOf)?r:[]).filter(t=>t!==e.path);return l.length===(null!=(a=s.duplicateOf)?a:[]).length?s:{...s,duplicateOf:l}})),y({type:"success",message:i("repositories.disableSuccess",{name:e.name})}),n&&n()}catch(e){y({type:"error",message:(0,u.hS)(e)})}finally{Y(e.id,!1)}},[n,Y,i]),q=(0,a.useCallback)(async e=>{Y(e.id,!0),y(null);try{var t;let s=await u.Rx.restore(e.path);await _(),y({type:s.warning?"error":"success",message:null!=(t=s.warning)?t:i("repositories.enableSuccess",{name:e.name,count:s.worktreeCount})}),n&&n()}catch(e){y({type:"error",message:(0,u.hS)(e)})}finally{Y(e.id,!1)}},[_,n,Y,i]),Z=(0,a.useCallback)(e=>{if(!L.has(e.id)){if(e.enabled)return void z(e);q(e)}},[q,L]),K=(0,a.useCallback)(()=>{z(null),P&&G(P)},[G,P]),X=(0,a.useMemo)(()=>c.filter(e=>!e.enabled).length,[c]),J=(0,a.useMemo)(()=>"disabled"===$?c.filter(e=>!e.enabled):c,[$,c]);return m&&0===c.length?(0,r.jsx)(d.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto","data-testid":"repository-list-loading",role:"status","aria-label":i("repositories.loading"),children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(w,{}),(0,r.jsx)("tbody",{children:[0,1,2].map(e=>(0,r.jsxs)("tr",{className:"border-b border-border",children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-24"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-20"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-16"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-48"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-10"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-14"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-20"})})]},e))})]})})}):x?(0,r.jsx)(d.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("p",{className:"text-sm text-danger-foreground",children:["Failed to load repositories: ",x]}),(0,r.jsx)(d.$n,{variant:"secondary",size:"sm",onClick:()=>void _(),children:"Retry"})]})}):(0,r.jsxs)("div",{className:"space-y-3",children:[v&&(0,r.jsx)("div",{role:"status",className:"p-3 rounded-lg text-sm ".concat("success"===v.type?"bg-success-subtle border border-success-border text-success-foreground":"bg-danger-subtle border border-danger-border text-danger-foreground"),children:v.message}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(d.$n,{variant:"all"===$?"secondary":"ghost",size:"sm","aria-pressed":"all"===$,"data-testid":"repository-filter-all",onClick:()=>D("all"),children:i("repositories.filterAll",{count:c.length})}),(0,r.jsx)(d.$n,{variant:"disabled"===$?"secondary":"ghost",size:"sm","aria-pressed":"disabled"===$,"data-testid":"repository-filter-disabled",onClick:()=>D("disabled"),children:i("repositories.filterDisabled",{count:X})})]}),(0,r.jsx)(d.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(w,{}),(0,r.jsxs)("tbody",{children:[0===J.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:7,className:"px-4 py-6 text-center text-muted-foreground",children:"disabled"===$?i("repositories.emptyDisabled"):i("repositories.empty")})}),J.map(e=>{let t=g.id===e.id;return(0,r.jsxs)("tr",{className:(0,N.cn)("border-b border-border",!e.enabled&&"bg-muted/40"),"data-testid":"repository-row-".concat(e.id),children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:(0,r.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[e.name,(0,r.jsx)(R,{repo:e,onNavigateToScanToggle:U})]})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(d.pd,{"aria-label":"Edit display name for ".concat(e.name),type:"text",value:g.value,disabled:g.saving,maxLength:101,onChange:e=>V(e.target.value),onKeyDown:t=>H(t,e)}),g.error&&(0,r.jsx)("p",{className:"text-xs text-danger-foreground",children:g.error})]}):e.displayName?(0,r.jsx)("span",{className:"text-foreground",children:e.displayName}):(0,r.jsx)("span",{className:"text-muted-foreground","aria-hidden":"true",children:"—"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(C,{repo:e,pending:E.has(e.id),onToggle:B})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)("span",{className:"block max-w-[240px] truncate font-mono text-xs text-muted-foreground",title:e.path,children:e.path})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:e.worktreeCount}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(S,{repo:e,pending:L.has(e.id),onToggle:Z,registerRef:O})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.$n,{variant:"primary",size:"sm",onClick:()=>void W(e),disabled:g.saving||null!==g.error,children:g.saving?"Saving...":"Save"}),(0,r.jsx)(d.$n,{variant:"ghost",size:"sm",onClick:F,disabled:g.saving,children:"Cancel"})]}):(0,r.jsx)(d.$n,{variant:"ghost",size:"sm",className:"px-2",onClick:()=>I(e),"aria-label":"Edit display name for ".concat(e.name),children:(0,r.jsx)(j.A,{className:"h-4 w-4","aria-hidden":"true"})})})]},e.id)})]})]})})}),(0,r.jsx)(d.TM,{isOpen:null!==P,title:i("repositories.disableConfirmTitle"),description:i("repositories.disableConfirmBody",{name:null!=(t=null==P?void 0:P.name)?t:"",count:null!=(s=null==P?void 0:P.worktreeCount)?s:0}),confirmLabel:i("repositories.disableConfirmAction"),variant:"default",onConfirm:K,onCancel:()=>z(null)})]})});function A(){let e=(0,i.a)(),[t,s]=(0,a.useState)(0),o=(0,a.useCallback)(()=>{s(e=>e+1)},[]),c=(0,a.useCallback)(async()=>{s(e=>e+1),await new Promise(e=>setTimeout(e,500))},[]);return(0,r.jsx)(l.GV,{children:(0,r.jsxs)(n.k,{onRefresh:c,enabled:e,className:"container-custom py-8 h-full",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Repositories"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage repositories and worktrees."})]}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(y,{onRepositoryAdded:o}),(0,r.jsx)(E,{refreshKey:t,onChanged:o})]})]})})}},27937:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},58734:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]])}},e=>{e.O(0,[6809,4909,2770,790,5694,2407,6402,8019,4718,4388,8441,1255,7358],()=>e(e.s=540)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8975],{17442:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>D});var r=a(95155),s=a(12115),n=a(18955),l=a(68361),i=a(28019),d=a(52619),o=a.n(d),c=a(20063),m=a(87531),u=a(44308),p=a(55449),x=a(38606),h=a(54014),g=a(46892);let f={in_review:"status.inReview",approval:"status.approval",stalled:"status.stalled"},v=u.DR,b={in_review:e=>"in_review"===e.status,approval:e=>!0===e.isWaitingForResponse,stalled:e=>!0===e.isStalled};function j(e){let{status:t,label:a}=e,s=(0,n.c)("common"),l=g.PL[t],i="".concat(a,": ").concat(s(l.labelKey)),d="w-2.5 h-2.5 rounded-full flex-shrink-0";return"spinner"===l.type?(0,r.jsx)("span",{className:"".concat(d," border-2 border-t-transparent animate-spin ").concat(l.className),title:i}):(0,r.jsx)("span",{className:"".concat(d," ").concat(l.className),title:i})}function y(){var e;let t=(0,n.c)("review"),[a,l]=(0,s.useState)([]),[d,g]=(0,s.useState)(!0),y=(0,c.useSearchParams)(),[w,N]=(0,s.useState)(()=>{var e;return null!=(e=(0,u._d)(null==y?void 0:y.get(u.z7)))?e:u.SD}),S=(0,s.useRef)(null),k=null!=(e=null==y?void 0:y.get(u.z7))?e:null;(0,s.useEffect)(()=>{let e=(0,u._d)(k);e&&N(e)},[k]);let C=(0,s.useCallback)(async()=>{try{let t=await fetch("/api/worktrees?include=review");if(t.ok){var e;let a=await t.json();(0,p.IK)(a.defaultSelectedAgents),l(null!=(e=a.worktrees)?e:[])}}catch(e){}finally{g(!1)}},[]);(0,s.useEffect)(()=>(C(),S.current=setInterval(C,u.Iu),()=>{S.current&&clearInterval(S.current)}),[C]);let E=(0,s.useMemo)(()=>a.filter(b[w]),[a,w]),T=(0,s.useMemo)(()=>({in_review:a.filter(b.in_review).length,approval:a.filter(b.approval).length,stalled:a.filter(b.stalled).length}),[a]),_=(0,s.useMemo)(()=>{switch(w){case"in_review":return t("empty.inReview");case"approval":return t("empty.approval");case"stalled":return t("empty.stalled")}},[w,t]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-6 inline-flex items-center gap-1 rounded-lg bg-muted p-1",role:"group","aria-label":t("filters.ariaLabel"),"data-testid":"review-filters",children:v.map(e=>{let a=w===e;return(0,r.jsxs)("button",{type:"button","aria-pressed":a,onClick:()=>N(e),"data-testid":"review-filter-".concat(e),className:(0,m.cn)("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",a?"bg-accent-500/15 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:text-foreground"),children:[t(f[e]),(0,r.jsx)("span",{className:(0,m.cn)("text-xs font-semibold tabular-nums",a?"text-accent-700 dark:text-accent-300":"text-muted-foreground"),children:T[e]})]},e)})}),d&&(0,r.jsx)("div",{className:"space-y-2","data-testid":"review-loading",role:"status","aria-label":t("filters.loading"),children:[0,1,2].map(e=>(0,r.jsx)(i.Zp,{padding:"md",children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,r.jsx)(i.EA,{className:"h-4 w-40 max-w-full"}),(0,r.jsx)(i.EA,{className:"h-3 w-24 max-w-full"})]}),(0,r.jsx)(i.EA,{className:"ml-4 h-5 w-16 flex-shrink-0"})]})},e))}),!d&&(0,r.jsx)("div",{className:"space-y-2","data-testid":"review-list",children:0===E.length?(0,r.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"review-empty",children:_}):E.map(e=>{var a;let s=null!=(a=e.selectedAgents)?a:(0,p.sA)();return(0,r.jsx)(o(),{href:"/worktrees/".concat(e.id),className:"block","data-testid":"review-item-".concat(e.id),children:(0,r.jsxs)(i.Zp,{padding:"md",className:"transition-colors ".concat(function(e){switch(e){case"in_review":return"border-info-border hover:border-info-border";case"approval":return"border-warning-border hover:border-warning-border";case"stalled":return"border-danger-border hover:border-danger-border"}}(w)),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:e.name}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.repositoryName})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-4 flex-shrink-0",children:[(0,r.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium rounded ".concat(function(e){switch(e){case"in_review":return"bg-info-subtle text-info-foreground";case"approval":return"bg-warning-subtle text-warning-foreground";case"stalled":return"bg-danger-subtle text-danger-foreground"}}(w)),children:t(f[w])}),s.map(t=>{var a;let s=(0,x.kA)(null==(a=e.sessionStatusByCli)?void 0:a[t]);return(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(j,{status:s,label:(0,h.oo)(t)}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,h.oo)(t)})]},t)})]})]}),e.description&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 whitespace-pre-wrap",children:e.description})})]})},e.id)})})]})}function w(e){let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(a,"-").concat(r)}function N(e){let{value:t,onChange:a}=e,s=(0,n.c)("review"),l=w(new Date),d=t===l;return(0,r.jsxs)("div",{className:"flex items-center gap-2","data-testid":"report-date-picker",children:[(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{let e=new Date(t+"T00:00:00");e.setDate(e.getDate()-1),a(w(e))},"data-testid":"date-prev","aria-label":s("datePicker.previousDay"),children:"<"}),(0,r.jsx)(i.pd,{type:"date",inputSize:"sm",value:t,max:l,onChange:e=>a(e.target.value),className:"w-auto","data-testid":"date-input"}),(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{if(d)return;let e=new Date(t+"T00:00:00");e.setDate(e.getDate()+1);let r=w(e);r>l||a(r)},disabled:d,"data-testid":"date-next","aria-label":s("datePicker.nextDay"),children:">"})]})}var S=a(36402),k=a(3199),C=a(4138),E=a(60322);let T=[{value:"none",labelKey:"report.modes.none"},{value:"template",labelKey:"report.modes.template"},{value:"custom",labelKey:"report.modes.custom"}];function _(){let e=(0,n.c)("review"),t=(0,S.SC)(),[a,l]=(0,s.useState)(function(){let e=new Date,t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(a,"-").concat(r)}()),[d,o]=(0,s.useState)("claude"),[c,m]=(0,s.useState)(""),[p,x]=(0,s.useState)(null),[h,g]=(0,s.useState)(0),[f,v]=(0,s.useState)(""),[b,j]=(0,s.useState)(!1),[y,w]=(0,s.useState)(!1),[_,z]=(0,s.useState)(!1),[A,D]=(0,s.useState)(!1),{copied:P,markCopied:$}=(0,C.q)(),[O,R]=(0,s.useState)(null),K=k.Vt.has(d),{mode:L,setMode:I,userInstruction:M,setUserInstruction:Z,isUserInstructionReadOnly:F,templates:U,selectedTemplateId:J,selectTemplate:V,isLoadingTemplates:q}=function(){let[e,t]=(0,s.useState)("none"),[a,r]=(0,s.useState)(""),[n,l]=(0,s.useState)([]),[i,d]=(0,s.useState)(null),[o,c]=(0,s.useState)(!1),m=(0,s.useCallback)(async()=>{c(!0);try{let e=await fetch("/api/templates");if(e.ok){let t=await e.json();l(t.templates||[])}}catch(e){}finally{c(!1)}},[]);(0,s.useEffect)(()=>{m()},[m]);let u=(0,s.useCallback)(e=>{t(e),r(""),d(null)},[]),p=(0,s.useCallback)(t=>{"custom"===e&&r(t)},[e]),x=(0,s.useCallback)(t=>{let a=n.find(e=>e.id===t);a&&"template"===e&&(d(t),r(a.content))},[n,e]);return{mode:e,setMode:u,userInstruction:a,setUserInstruction:p,isUserInstructionReadOnly:"template"===e,templates:n,selectedTemplateId:i,selectTemplate:x,isLoadingTemplates:o,refreshTemplates:m}}(),B=function(e){let[t,a]=(0,s.useState)({generating:!1}),r=(0,s.useRef)(null),n=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/daily-summary/status");if(e.ok){let t=await e.json();a(t)}}catch(e){}},[]);return(0,s.useEffect)(()=>e?(n(),r.current=setInterval(n,5e3),()=>{r.current&&(clearInterval(r.current),r.current=null)}):void a({generating:!1}),[e,n]),t}(!_),H=B.generating&&!_,W=(0,s.useCallback)(async t=>{w(!0),R(null);try{let a=await fetch("/api/daily-summary?date=".concat(t));if(!a.ok){let t=await a.json();R(t.error||e("report.errors.fetch"));return}let r=await a.json();x(r.report),g(r.messageCount),r.report?v(r.report.content):v(""),j(!1)}catch(t){R(e("report.errors.fetch"))}finally{w(!1)}},[e]);(0,s.useEffect)(()=>{W(a)},[a,W]);let[Y,G]=(0,s.useState)(!1);(0,s.useEffect)(()=>{B.generating?G(!0):Y&&(G(!1),W(a))},[B.generating,Y,W,a]);let X=async()=>{if(!p||await t({description:e("report.regenerateConfirm")})){z(!0),R(null);try{let t={date:a,tool:d};K&&c.trim()&&(t.model=c.trim()),"none"!==L&&M.trim()&&(t.userInstruction=M.trim());let r=await fetch("/api/daily-summary",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(429===r.status)return void R(e("report.errors.rateLimited"));if(!r.ok){let t=await r.json();R(t.error||e("report.errors.generate"));return}let s=await r.json();x(s.report),v(s.report.content),j(!1)}catch(t){R(e("report.errors.generate"))}finally{z(!1)}}},Q=async()=>{if(!f.trim())return void R(e("report.errors.emptyContent"));D(!0),R(null);try{let t=await fetch("/api/daily-summary",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({date:a,content:f})});if(!t.ok){let a=await t.json();R(a.error||e("report.errors.save"));return}let r=await t.json();x(r.report),j(!1)}catch(t){R(e("report.errors.save"))}finally{D(!1)}};return(0,r.jsxs)("div",{"data-testid":"report-tab",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4 mb-6",children:[(0,r.jsx)(N,{value:a,onChange:e=>{l(e)}}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("label",{className:"text-sm text-muted-foreground",children:e("report.toolLabel")}),(0,r.jsx)("select",{value:d,onChange:e=>o(e.target.value),className:"px-3 py-1 text-sm rounded border border-input bg-surface dark:bg-surface-2 text-surface-foreground","data-testid":"tool-selector",children:u.IH.map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),K&&(0,r.jsx)(i.pd,{type:"text",inputSize:"sm",placeholder:"opencode"===d?e("report.modelPlaceholderOpencode"):e("report.modelPlaceholder"),value:c,onChange:e=>m(e.target.value),className:"w-auto","data-testid":"model-input"})]})]}),(0,r.jsxs)("div",{className:"mb-4","data-testid":"generation-mode-selector",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-foreground mb-2 block",children:e("report.generationMode")}),(0,r.jsx)(i.z6,{value:L,onValueChange:e=>I(e),name:"generation-mode",className:"flex flex-row gap-4",children:T.map(t=>(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,r.jsx)(i.CU,{value:t.value,"data-testid":"mode-radio-".concat(t.value)}),(0,r.jsx)("span",{className:"text-foreground",children:e(t.labelKey)})]},t.value))})]}),"template"===L&&(0,r.jsxs)("div",{className:"mb-4","data-testid":"template-selector",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-foreground mb-2 block",children:e("report.selectTemplate")}),q?(0,r.jsx)(i.EA,{className:"h-9 w-full","data-testid":"report-template-loading",role:"status","aria-label":e("report.loadingTemplates"),"aria-hidden":void 0}):0===U.length?(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:e("report.noTemplates")}):(0,r.jsxs)("select",{value:J||"",onChange:e=>V(e.target.value),className:"px-3 py-1 text-sm rounded border border-input bg-surface dark:bg-surface-2 text-surface-foreground","data-testid":"template-select",children:[(0,r.jsx)("option",{value:"",children:e("report.templatePlaceholderOption")}),U.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),"none"!==L&&(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(i.k_,{value:M,onChange:e=>Z(e.target.value),rows:3,maxLength:u.t7,readOnly:F,placeholder:"template"===L?e("report.instructionPlaceholderTemplate"):e("report.instructionPlaceholderCustom"),className:"resize-y ".concat(F?"bg-muted cursor-not-allowed":""),"data-testid":"user-instruction-input"})}),(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(i.$n,{variant:"primary",onClick:X,disabled:_||H||0===h,"data-testid":"generate-button",children:_||H?e("report.generating"):e("report.generate")})}),(0,r.jsx)("div",{className:"mb-4 text-sm text-muted-foreground","data-testid":"message-count",children:y?(0,r.jsx)(i.EA,{className:"h-4 w-48"}):0===h?e("report.noMessages"):e("report.messagesFound",{count:h})}),O&&(0,r.jsx)("div",{className:"mb-4 p-3 bg-danger-subtle text-danger-foreground rounded-lg text-sm","data-testid":"report-error",children:O}),(_||H)&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4 text-sm text-muted-foreground","data-testid":"generating-spinner",children:[(0,r.jsx)(i.y$,{size:"sm",variant:"muted"}),H&&B.tool?B.startedAt?e("report.generatingRemoteWithTime",{tool:B.tool,seconds:Math.round((Date.now()-new Date(B.startedAt).getTime())/1e3)}):e("report.generatingRemote",{tool:B.tool}):e("report.generatingSummary")]}),!y&&p&&(0,r.jsxs)(i.Zp,{"data-testid":"report-content",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e("report.generatedBy",{tool:p.generatedByTool}),p.model&&" (".concat(p.model,")")]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:async()=>{await (0,E.l)(p.content),$()},"data-testid":"copy-report-button",children:P?e("report.copied"):e("report.copy")}),(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{b?Q():j(!0)},disabled:A,"data-testid":"edit-save-button",children:A?e("report.saving"):b?e("report.save"):e("report.edit")})]})]}),b?(0,r.jsx)(i.k_,{value:f,onChange:e=>v(e.target.value),className:"h-64 p-3 font-mono","data-testid":"report-editor"}):(0,r.jsx)("div",{className:"prose dark:prose-invert max-w-none text-sm whitespace-pre-wrap","data-testid":"report-preview",children:p.content})]})]})}function z(){let e=(0,n.c)("review"),t=(0,S.SC)(),[a,l]=(0,s.useState)([]),[d,o]=(0,s.useState)(!1),[c,m]=(0,s.useState)(null),[p,x]=(0,s.useState)(""),[h,g]=(0,s.useState)(""),[f,v]=(0,s.useState)(!1),[b,j]=(0,s.useState)(null),[y,w]=(0,s.useState)(""),[N,k]=(0,s.useState)(""),[C,E]=(0,s.useState)(!1),T=(0,s.useCallback)(async()=>{o(!0),m(null);try{let t=await fetch("/api/templates");if(!t.ok){let a=await t.json();m(a.error||e("template.errors.fetch"));return}let a=await t.json();l(a.templates||[])}catch(t){m(e("template.errors.fetch"))}finally{o(!1)}},[e]);(0,s.useEffect)(()=>{T()},[T]);let _=async()=>{if(!p.trim()||!h.trim())return void m(e("template.errors.nameAndContentRequired"));v(!0),m(null);try{let t=await fetch("/api/templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),content:h.trim()})});if(!t.ok){let a=await t.json();m(a.error||e("template.errors.create"));return}x(""),g(""),await T()}catch(t){m(e("template.errors.create"))}finally{v(!1)}},z=async()=>{if(!b||!y.trim()||!N.trim())return void m(e("template.errors.nameAndContentRequired"));E(!0),m(null);try{let t=await fetch("/api/templates/".concat(b),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y.trim(),content:N.trim()})});if(!t.ok){let a=await t.json();m(a.error||e("template.errors.update"));return}j(null),await T()}catch(t){m(e("template.errors.update"))}finally{E(!1)}},A=async a=>{if(await t({description:e("template.deleteConfirm"),variant:"danger"})){m(null);try{let t=await fetch("/api/templates/".concat(a),{method:"DELETE"});if(!t.ok){let a=await t.json();m(a.error||e("template.errors.delete"));return}await T()}catch(t){m(e("template.errors.delete"))}}},D=()=>{j(null),w(""),k("")};return(0,r.jsxs)("div",{"data-testid":"template-tab",children:[c&&(0,r.jsx)("div",{className:"mb-4 p-3 bg-danger-subtle text-danger-foreground rounded-lg text-sm","data-testid":"template-error",children:c}),(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-3",children:e("template.heading",{count:a.length,max:u.$h})}),d?(0,r.jsx)("div",{className:"space-y-3","data-testid":"template-loading",role:"status","aria-label":e("template.loading"),children:[0,1].map(e=>(0,r.jsx)(i.Zp,{padding:"md",children:(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(i.EA,{className:"h-4 w-32"}),(0,r.jsx)(i.EA,{className:"h-3 w-full"}),(0,r.jsx)(i.EA,{className:"h-3 w-2/3"})]})},e))}):0===a.length?(0,r.jsx)("div",{className:"text-sm text-muted-foreground","data-testid":"template-empty",children:e("template.empty")}):(0,r.jsx)("div",{className:"space-y-3","data-testid":"template-list",children:a.map(t=>(0,r.jsx)(i.Zp,{padding:"sm","data-testid":"template-item-".concat(t.id),children:b===t.id?(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(i.pd,{type:"text",inputSize:"sm",value:y,onChange:e=>w(e.target.value),maxLength:u.Nb,"data-testid":"edit-name-input"}),(0,r.jsx)(i.k_,{value:N,onChange:e=>k(e.target.value),maxLength:u.bm,rows:3,className:"resize-y","data-testid":"edit-content-input"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{variant:"primary",size:"sm",onClick:z,disabled:C,"data-testid":"edit-save-button",children:C?e("template.saving"):e("template.save")}),(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:D,"data-testid":"edit-cancel-button",children:e("template.cancel")})]})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,r.jsx)("span",{className:"font-medium text-sm text-foreground","data-testid":"template-name",children:t.name}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{j(t.id),w(t.name),k(t.content)},"data-testid":"edit-button-".concat(t.id),children:e("template.edit")}),(0,r.jsx)(i.$n,{variant:"danger",size:"sm",onClick:()=>A(t.id),"data-testid":"delete-button-".concat(t.id),children:e("template.delete")})]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap","data-testid":"template-content",children:t.content})]})},t.id))})]}),a.length<u.$h&&(0,r.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg shadow-sm","data-testid":"create-form",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-3",children:e("template.newHeading")}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)(i.pd,{type:"text",value:p,onChange:e=>x(e.target.value),maxLength:u.Nb,placeholder:e("template.namePlaceholder"),"data-testid":"new-name-input"}),(0,r.jsx)(i.k_,{value:h,onChange:e=>g(e.target.value),maxLength:u.bm,rows:3,placeholder:e("template.contentPlaceholder"),className:"resize-y","data-testid":"new-content-input"}),(0,r.jsx)(i.$n,{variant:"primary",onClick:_,disabled:f||!p.trim()||!h.trim(),"data-testid":"create-button",children:f?e("template.creating"):e("template.create")})]})]})]})}let A=[{value:"review",labelKey:"tabs.review"},{value:"report",labelKey:"tabs.report"},{value:"template",labelKey:"tabs.template"}];function D(){let e=(0,n.c)("review"),[t,a]=(0,s.useState)("review");return(0,r.jsx)(l.GV,{children:(0,r.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:e("page.title")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("page.description")})]}),(0,r.jsxs)(i.tU,{value:t,onValueChange:e=>a(e),children:[(0,r.jsx)(i.j7,{className:"mb-6 w-full justify-start","data-testid":"page-tabs",children:A.map(t=>(0,r.jsx)(i.Xi,{value:t.value,"data-testid":"page-tab-".concat(t.value),children:e(t.labelKey)},t.value))}),(0,r.jsx)(i.av,{value:"review",children:(0,r.jsx)(s.Suspense,{fallback:null,children:(0,r.jsx)(y,{})})}),(0,r.jsx)(i.av,{value:"report",children:(0,r.jsx)(_,{})}),(0,r.jsx)(i.av,{value:"template",children:(0,r.jsx)(z,{})})]})]})})}},60322:(e,t,a)=>{"use strict";a.d(t,{l:()=>s});let r=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function s(e){var t;if(!e||0===e.trim().length)return;let a=e.replace(r,"");if(null==(t=navigator.clipboard)?void 0:t.writeText)try{await navigator.clipboard.writeText(a);return}catch(e){}let s=document.createElement("textarea");s.value=a,s.style.position="fixed",s.style.left="-9999px",s.style.top="-9999px",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();try{document.execCommand("copy")}finally{document.body.removeChild(s)}}},80488:(e,t,a)=>{Promise.resolve().then(a.bind(a,17442))}},e=>{e.O(0,[6809,4909,2770,790,5694,6402,8019,4718,8361,998,8441,1255,7358],()=>e(e.s=80488)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8975],{17442:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>D});var r=a(95155),s=a(12115),n=a(18955),l=a(54388),i=a(28019),d=a(52619),o=a.n(d),c=a(20063),m=a(87531),u=a(44308),p=a(55449),x=a(38606),h=a(54014),g=a(46892);let f={in_review:"status.inReview",approval:"status.approval",stalled:"status.stalled"},v=u.DR,b={in_review:e=>"in_review"===e.status,approval:e=>!0===e.isWaitingForResponse,stalled:e=>!0===e.isStalled};function j(e){let{status:t,label:a}=e,s=(0,n.c)("common"),l=g.PL[t],i="".concat(a,": ").concat(s(l.labelKey)),d="w-2.5 h-2.5 rounded-full flex-shrink-0";return"spinner"===l.type?(0,r.jsx)("span",{className:"".concat(d," border-2 border-t-transparent animate-spin ").concat(l.className),title:i}):(0,r.jsx)("span",{className:"".concat(d," ").concat(l.className),title:i})}function y(){var e;let t=(0,n.c)("review"),[a,l]=(0,s.useState)([]),[d,g]=(0,s.useState)(!0),y=(0,c.useSearchParams)(),[w,N]=(0,s.useState)(()=>{var e;return null!=(e=(0,u._d)(null==y?void 0:y.get(u.z7)))?e:u.SD}),S=(0,s.useRef)(null),k=null!=(e=null==y?void 0:y.get(u.z7))?e:null;(0,s.useEffect)(()=>{let e=(0,u._d)(k);e&&N(e)},[k]);let C=(0,s.useCallback)(async()=>{try{let t=await fetch("/api/worktrees?include=review");if(t.ok){var e;let a=await t.json();(0,p.IK)(a.defaultSelectedAgents),l(null!=(e=a.worktrees)?e:[])}}catch(e){}finally{g(!1)}},[]);(0,s.useEffect)(()=>(C(),S.current=setInterval(C,u.Iu),()=>{S.current&&clearInterval(S.current)}),[C]);let E=(0,s.useMemo)(()=>a.filter(b[w]),[a,w]),T=(0,s.useMemo)(()=>({in_review:a.filter(b.in_review).length,approval:a.filter(b.approval).length,stalled:a.filter(b.stalled).length}),[a]),_=(0,s.useMemo)(()=>{switch(w){case"in_review":return t("empty.inReview");case"approval":return t("empty.approval");case"stalled":return t("empty.stalled")}},[w,t]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-6 inline-flex items-center gap-1 rounded-lg bg-muted p-1",role:"group","aria-label":t("filters.ariaLabel"),"data-testid":"review-filters",children:v.map(e=>{let a=w===e;return(0,r.jsxs)("button",{type:"button","aria-pressed":a,onClick:()=>N(e),"data-testid":"review-filter-".concat(e),className:(0,m.cn)("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",a?"bg-accent-500/15 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:text-foreground"),children:[t(f[e]),(0,r.jsx)("span",{className:(0,m.cn)("text-xs font-semibold tabular-nums",a?"text-accent-700 dark:text-accent-300":"text-muted-foreground"),children:T[e]})]},e)})}),d&&(0,r.jsx)("div",{className:"space-y-2","data-testid":"review-loading",role:"status","aria-label":t("filters.loading"),children:[0,1,2].map(e=>(0,r.jsx)(i.Zp,{padding:"md",children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,r.jsx)(i.EA,{className:"h-4 w-40 max-w-full"}),(0,r.jsx)(i.EA,{className:"h-3 w-24 max-w-full"})]}),(0,r.jsx)(i.EA,{className:"ml-4 h-5 w-16 flex-shrink-0"})]})},e))}),!d&&(0,r.jsx)("div",{className:"space-y-2","data-testid":"review-list",children:0===E.length?(0,r.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"review-empty",children:_}):E.map(e=>{var a;let s=null!=(a=e.selectedAgents)?a:(0,p.sA)();return(0,r.jsx)(o(),{href:"/worktrees/".concat(e.id),className:"block","data-testid":"review-item-".concat(e.id),children:(0,r.jsxs)(i.Zp,{padding:"md",className:"transition-colors ".concat(function(e){switch(e){case"in_review":return"border-info-border hover:border-info-border";case"approval":return"border-warning-border hover:border-warning-border";case"stalled":return"border-danger-border hover:border-danger-border"}}(w)),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:e.name}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.repositoryName})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-4 flex-shrink-0",children:[(0,r.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium rounded ".concat(function(e){switch(e){case"in_review":return"bg-info-subtle text-info-foreground";case"approval":return"bg-warning-subtle text-warning-foreground";case"stalled":return"bg-danger-subtle text-danger-foreground"}}(w)),children:t(f[w])}),s.map(t=>{var a;let s=(0,x.kA)(null==(a=e.sessionStatusByCli)?void 0:a[t]);return(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(j,{status:s,label:(0,h.oo)(t)}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,h.oo)(t)})]},t)})]})]}),e.description&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 whitespace-pre-wrap",children:e.description})})]})},e.id)})})]})}function w(e){let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(a,"-").concat(r)}function N(e){let{value:t,onChange:a}=e,s=(0,n.c)("review"),l=w(new Date),d=t===l;return(0,r.jsxs)("div",{className:"flex items-center gap-2","data-testid":"report-date-picker",children:[(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{let e=new Date(t+"T00:00:00");e.setDate(e.getDate()-1),a(w(e))},"data-testid":"date-prev","aria-label":s("datePicker.previousDay"),children:"<"}),(0,r.jsx)(i.pd,{type:"date",inputSize:"sm",value:t,max:l,onChange:e=>a(e.target.value),className:"w-auto","data-testid":"date-input"}),(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{if(d)return;let e=new Date(t+"T00:00:00");e.setDate(e.getDate()+1);let r=w(e);r>l||a(r)},disabled:d,"data-testid":"date-next","aria-label":s("datePicker.nextDay"),children:">"})]})}var S=a(36402),k=a(3199),C=a(4138),E=a(60322);let T=[{value:"none",labelKey:"report.modes.none"},{value:"template",labelKey:"report.modes.template"},{value:"custom",labelKey:"report.modes.custom"}];function _(){let e=(0,n.c)("review"),t=(0,S.SC)(),[a,l]=(0,s.useState)(function(){let e=new Date,t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(a,"-").concat(r)}()),[d,o]=(0,s.useState)("claude"),[c,m]=(0,s.useState)(""),[p,x]=(0,s.useState)(null),[h,g]=(0,s.useState)(0),[f,v]=(0,s.useState)(""),[b,j]=(0,s.useState)(!1),[y,w]=(0,s.useState)(!1),[_,z]=(0,s.useState)(!1),[A,D]=(0,s.useState)(!1),{copied:P,markCopied:$}=(0,C.q)(),[O,R]=(0,s.useState)(null),K=k.Vt.has(d),{mode:L,setMode:I,userInstruction:M,setUserInstruction:Z,isUserInstructionReadOnly:F,templates:U,selectedTemplateId:J,selectTemplate:V,isLoadingTemplates:q}=function(){let[e,t]=(0,s.useState)("none"),[a,r]=(0,s.useState)(""),[n,l]=(0,s.useState)([]),[i,d]=(0,s.useState)(null),[o,c]=(0,s.useState)(!1),m=(0,s.useCallback)(async()=>{c(!0);try{let e=await fetch("/api/templates");if(e.ok){let t=await e.json();l(t.templates||[])}}catch(e){}finally{c(!1)}},[]);(0,s.useEffect)(()=>{m()},[m]);let u=(0,s.useCallback)(e=>{t(e),r(""),d(null)},[]),p=(0,s.useCallback)(t=>{"custom"===e&&r(t)},[e]),x=(0,s.useCallback)(t=>{let a=n.find(e=>e.id===t);a&&"template"===e&&(d(t),r(a.content))},[n,e]);return{mode:e,setMode:u,userInstruction:a,setUserInstruction:p,isUserInstructionReadOnly:"template"===e,templates:n,selectedTemplateId:i,selectTemplate:x,isLoadingTemplates:o,refreshTemplates:m}}(),B=function(e){let[t,a]=(0,s.useState)({generating:!1}),r=(0,s.useRef)(null),n=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/daily-summary/status");if(e.ok){let t=await e.json();a(t)}}catch(e){}},[]);return(0,s.useEffect)(()=>e?(n(),r.current=setInterval(n,5e3),()=>{r.current&&(clearInterval(r.current),r.current=null)}):void a({generating:!1}),[e,n]),t}(!_),H=B.generating&&!_,W=(0,s.useCallback)(async t=>{w(!0),R(null);try{let a=await fetch("/api/daily-summary?date=".concat(t));if(!a.ok){let t=await a.json();R(t.error||e("report.errors.fetch"));return}let r=await a.json();x(r.report),g(r.messageCount),r.report?v(r.report.content):v(""),j(!1)}catch(t){R(e("report.errors.fetch"))}finally{w(!1)}},[e]);(0,s.useEffect)(()=>{W(a)},[a,W]);let[Y,G]=(0,s.useState)(!1);(0,s.useEffect)(()=>{B.generating?G(!0):Y&&(G(!1),W(a))},[B.generating,Y,W,a]);let X=async()=>{if(!p||await t({description:e("report.regenerateConfirm")})){z(!0),R(null);try{let t={date:a,tool:d};K&&c.trim()&&(t.model=c.trim()),"none"!==L&&M.trim()&&(t.userInstruction=M.trim());let r=await fetch("/api/daily-summary",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(429===r.status)return void R(e("report.errors.rateLimited"));if(!r.ok){let t=await r.json();R(t.error||e("report.errors.generate"));return}let s=await r.json();x(s.report),v(s.report.content),j(!1)}catch(t){R(e("report.errors.generate"))}finally{z(!1)}}},Q=async()=>{if(!f.trim())return void R(e("report.errors.emptyContent"));D(!0),R(null);try{let t=await fetch("/api/daily-summary",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({date:a,content:f})});if(!t.ok){let a=await t.json();R(a.error||e("report.errors.save"));return}let r=await t.json();x(r.report),j(!1)}catch(t){R(e("report.errors.save"))}finally{D(!1)}};return(0,r.jsxs)("div",{"data-testid":"report-tab",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4 mb-6",children:[(0,r.jsx)(N,{value:a,onChange:e=>{l(e)}}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("label",{className:"text-sm text-muted-foreground",children:e("report.toolLabel")}),(0,r.jsx)("select",{value:d,onChange:e=>o(e.target.value),className:"px-3 py-1 text-sm rounded border border-input bg-surface dark:bg-surface-2 text-surface-foreground","data-testid":"tool-selector",children:u.IH.map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),K&&(0,r.jsx)(i.pd,{type:"text",inputSize:"sm",placeholder:"opencode"===d?e("report.modelPlaceholderOpencode"):e("report.modelPlaceholder"),value:c,onChange:e=>m(e.target.value),className:"w-auto","data-testid":"model-input"})]})]}),(0,r.jsxs)("div",{className:"mb-4","data-testid":"generation-mode-selector",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-foreground mb-2 block",children:e("report.generationMode")}),(0,r.jsx)(i.z6,{value:L,onValueChange:e=>I(e),name:"generation-mode",className:"flex flex-row gap-4",children:T.map(t=>(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,r.jsx)(i.CU,{value:t.value,"data-testid":"mode-radio-".concat(t.value)}),(0,r.jsx)("span",{className:"text-foreground",children:e(t.labelKey)})]},t.value))})]}),"template"===L&&(0,r.jsxs)("div",{className:"mb-4","data-testid":"template-selector",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-foreground mb-2 block",children:e("report.selectTemplate")}),q?(0,r.jsx)(i.EA,{className:"h-9 w-full","data-testid":"report-template-loading",role:"status","aria-label":e("report.loadingTemplates"),"aria-hidden":void 0}):0===U.length?(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:e("report.noTemplates")}):(0,r.jsxs)("select",{value:J||"",onChange:e=>V(e.target.value),className:"px-3 py-1 text-sm rounded border border-input bg-surface dark:bg-surface-2 text-surface-foreground","data-testid":"template-select",children:[(0,r.jsx)("option",{value:"",children:e("report.templatePlaceholderOption")}),U.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),"none"!==L&&(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(i.k_,{value:M,onChange:e=>Z(e.target.value),rows:3,maxLength:u.t7,readOnly:F,placeholder:"template"===L?e("report.instructionPlaceholderTemplate"):e("report.instructionPlaceholderCustom"),className:"resize-y ".concat(F?"bg-muted cursor-not-allowed":""),"data-testid":"user-instruction-input"})}),(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(i.$n,{variant:"primary",onClick:X,disabled:_||H||0===h,"data-testid":"generate-button",children:_||H?e("report.generating"):e("report.generate")})}),(0,r.jsx)("div",{className:"mb-4 text-sm text-muted-foreground","data-testid":"message-count",children:y?(0,r.jsx)(i.EA,{className:"h-4 w-48"}):0===h?e("report.noMessages"):e("report.messagesFound",{count:h})}),O&&(0,r.jsx)("div",{className:"mb-4 p-3 bg-danger-subtle text-danger-foreground rounded-lg text-sm","data-testid":"report-error",children:O}),(_||H)&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4 text-sm text-muted-foreground","data-testid":"generating-spinner",children:[(0,r.jsx)(i.y$,{size:"sm",variant:"muted"}),H&&B.tool?B.startedAt?e("report.generatingRemoteWithTime",{tool:B.tool,seconds:Math.round((Date.now()-new Date(B.startedAt).getTime())/1e3)}):e("report.generatingRemote",{tool:B.tool}):e("report.generatingSummary")]}),!y&&p&&(0,r.jsxs)(i.Zp,{"data-testid":"report-content",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e("report.generatedBy",{tool:p.generatedByTool}),p.model&&" (".concat(p.model,")")]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:async()=>{await (0,E.l)(p.content),$()},"data-testid":"copy-report-button",children:P?e("report.copied"):e("report.copy")}),(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{b?Q():j(!0)},disabled:A,"data-testid":"edit-save-button",children:A?e("report.saving"):b?e("report.save"):e("report.edit")})]})]}),b?(0,r.jsx)(i.k_,{value:f,onChange:e=>v(e.target.value),className:"h-64 p-3 font-mono","data-testid":"report-editor"}):(0,r.jsx)("div",{className:"prose dark:prose-invert max-w-none text-sm whitespace-pre-wrap","data-testid":"report-preview",children:p.content})]})]})}function z(){let e=(0,n.c)("review"),t=(0,S.SC)(),[a,l]=(0,s.useState)([]),[d,o]=(0,s.useState)(!1),[c,m]=(0,s.useState)(null),[p,x]=(0,s.useState)(""),[h,g]=(0,s.useState)(""),[f,v]=(0,s.useState)(!1),[b,j]=(0,s.useState)(null),[y,w]=(0,s.useState)(""),[N,k]=(0,s.useState)(""),[C,E]=(0,s.useState)(!1),T=(0,s.useCallback)(async()=>{o(!0),m(null);try{let t=await fetch("/api/templates");if(!t.ok){let a=await t.json();m(a.error||e("template.errors.fetch"));return}let a=await t.json();l(a.templates||[])}catch(t){m(e("template.errors.fetch"))}finally{o(!1)}},[e]);(0,s.useEffect)(()=>{T()},[T]);let _=async()=>{if(!p.trim()||!h.trim())return void m(e("template.errors.nameAndContentRequired"));v(!0),m(null);try{let t=await fetch("/api/templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),content:h.trim()})});if(!t.ok){let a=await t.json();m(a.error||e("template.errors.create"));return}x(""),g(""),await T()}catch(t){m(e("template.errors.create"))}finally{v(!1)}},z=async()=>{if(!b||!y.trim()||!N.trim())return void m(e("template.errors.nameAndContentRequired"));E(!0),m(null);try{let t=await fetch("/api/templates/".concat(b),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y.trim(),content:N.trim()})});if(!t.ok){let a=await t.json();m(a.error||e("template.errors.update"));return}j(null),await T()}catch(t){m(e("template.errors.update"))}finally{E(!1)}},A=async a=>{if(await t({description:e("template.deleteConfirm"),variant:"danger"})){m(null);try{let t=await fetch("/api/templates/".concat(a),{method:"DELETE"});if(!t.ok){let a=await t.json();m(a.error||e("template.errors.delete"));return}await T()}catch(t){m(e("template.errors.delete"))}}},D=()=>{j(null),w(""),k("")};return(0,r.jsxs)("div",{"data-testid":"template-tab",children:[c&&(0,r.jsx)("div",{className:"mb-4 p-3 bg-danger-subtle text-danger-foreground rounded-lg text-sm","data-testid":"template-error",children:c}),(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-3",children:e("template.heading",{count:a.length,max:u.$h})}),d?(0,r.jsx)("div",{className:"space-y-3","data-testid":"template-loading",role:"status","aria-label":e("template.loading"),children:[0,1].map(e=>(0,r.jsx)(i.Zp,{padding:"md",children:(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(i.EA,{className:"h-4 w-32"}),(0,r.jsx)(i.EA,{className:"h-3 w-full"}),(0,r.jsx)(i.EA,{className:"h-3 w-2/3"})]})},e))}):0===a.length?(0,r.jsx)("div",{className:"text-sm text-muted-foreground","data-testid":"template-empty",children:e("template.empty")}):(0,r.jsx)("div",{className:"space-y-3","data-testid":"template-list",children:a.map(t=>(0,r.jsx)(i.Zp,{padding:"sm","data-testid":"template-item-".concat(t.id),children:b===t.id?(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(i.pd,{type:"text",inputSize:"sm",value:y,onChange:e=>w(e.target.value),maxLength:u.Nb,"data-testid":"edit-name-input"}),(0,r.jsx)(i.k_,{value:N,onChange:e=>k(e.target.value),maxLength:u.bm,rows:3,className:"resize-y","data-testid":"edit-content-input"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{variant:"primary",size:"sm",onClick:z,disabled:C,"data-testid":"edit-save-button",children:C?e("template.saving"):e("template.save")}),(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:D,"data-testid":"edit-cancel-button",children:e("template.cancel")})]})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,r.jsx)("span",{className:"font-medium text-sm text-foreground","data-testid":"template-name",children:t.name}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{j(t.id),w(t.name),k(t.content)},"data-testid":"edit-button-".concat(t.id),children:e("template.edit")}),(0,r.jsx)(i.$n,{variant:"danger",size:"sm",onClick:()=>A(t.id),"data-testid":"delete-button-".concat(t.id),children:e("template.delete")})]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap","data-testid":"template-content",children:t.content})]})},t.id))})]}),a.length<u.$h&&(0,r.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg shadow-sm","data-testid":"create-form",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-3",children:e("template.newHeading")}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)(i.pd,{type:"text",value:p,onChange:e=>x(e.target.value),maxLength:u.Nb,placeholder:e("template.namePlaceholder"),"data-testid":"new-name-input"}),(0,r.jsx)(i.k_,{value:h,onChange:e=>g(e.target.value),maxLength:u.bm,rows:3,placeholder:e("template.contentPlaceholder"),className:"resize-y","data-testid":"new-content-input"}),(0,r.jsx)(i.$n,{variant:"primary",onClick:_,disabled:f||!p.trim()||!h.trim(),"data-testid":"create-button",children:f?e("template.creating"):e("template.create")})]})]})]})}let A=[{value:"review",labelKey:"tabs.review"},{value:"report",labelKey:"tabs.report"},{value:"template",labelKey:"tabs.template"}];function D(){let e=(0,n.c)("review"),[t,a]=(0,s.useState)("review");return(0,r.jsx)(l.GV,{children:(0,r.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:e("page.title")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("page.description")})]}),(0,r.jsxs)(i.tU,{value:t,onValueChange:e=>a(e),children:[(0,r.jsx)(i.j7,{className:"mb-6 w-full justify-start","data-testid":"page-tabs",children:A.map(t=>(0,r.jsx)(i.Xi,{value:t.value,"data-testid":"page-tab-".concat(t.value),children:e(t.labelKey)},t.value))}),(0,r.jsx)(i.av,{value:"review",children:(0,r.jsx)(s.Suspense,{fallback:null,children:(0,r.jsx)(y,{})})}),(0,r.jsx)(i.av,{value:"report",children:(0,r.jsx)(_,{})}),(0,r.jsx)(i.av,{value:"template",children:(0,r.jsx)(z,{})})]})]})})}},60322:(e,t,a)=>{"use strict";a.d(t,{l:()=>s});let r=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function s(e){var t;if(!e||0===e.trim().length)return;let a=e.replace(r,"");if(null==(t=navigator.clipboard)?void 0:t.writeText)try{await navigator.clipboard.writeText(a);return}catch(e){}let s=document.createElement("textarea");s.value=a,s.style.position="fixed",s.style.left="-9999px",s.style.top="-9999px",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();try{document.execCommand("copy")}finally{document.body.removeChild(s)}}},80488:(e,t,a)=>{Promise.resolve().then(a.bind(a,17442))}},e=>{e.O(0,[6809,4909,2770,790,5694,2407,6402,8019,4718,4388,998,8441,1255,7358],()=>e(e.s=80488)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8898],{6473:(e,t,s)=>{"use strict";s.d(t,{Lc:()=>a,qz:()=>n});let n="animate-in fade-in-0 slide-in-from-bottom-2 fill-mode-backwards duration-300";function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(Number.isFinite(e)&&!(e<=0)&&!(e>=s))return"".concat(e*t,"ms")}},9219:(e,t,s)=>{"use strict";s.d(t,{k:()=>l});var n=s(95155),a=s(12115),r=s(28019),i=s(87531);function l(e){let{onRefresh:t,enabled:s=!0,className:l,children:o}=e,{containerRef:c,pullDistance:d,isRefreshing:u,isPulling:m}=function(e){let{onRefresh:t,enabled:s=!0,threshold:n=64,maxPull:r=96,resistance:i=.5}=e,l=(0,a.useRef)(null),[o,c]=(0,a.useState)(0),[d,u]=(0,a.useState)(!1),[m,x]=(0,a.useState)(!1),h=(0,a.useRef)(null),f=(0,a.useRef)(0),g=(0,a.useRef)(!1);g.current=d;let p=(0,a.useCallback)(()=>{h.current=null,f.current=0,c(0),x(!1)},[]),b=(0,a.useCallback)(e=>{if(!s||g.current)return;let t=l.current;t&&!(t.scrollTop>0)&&(h.current=e.touches[0].clientY,f.current=0)},[s]),v=(0,a.useCallback)(e=>{if(null===h.current)return;let t=l.current;if(!t)return;if(t.scrollTop>0)return void p();let s=e.touches[0].clientY-h.current;if(s<=0){0!==f.current&&(f.current=0,c(0),x(!1));return}e.cancelable&&e.preventDefault();let n=Math.min(s*i,r);f.current=n,c(n),x(!0)},[i,r,p]),y=(0,a.useCallback)(async()=>{u(!0),x(!1),c(n);try{await Promise.resolve(t())}finally{u(!1),c(0)}},[t,n]),w=(0,a.useCallback)(()=>{if(null===h.current)return;let e=f.current>=n&&!g.current;h.current=null,f.current=0,e?y():(c(0),x(!1))},[n,y]);return(0,a.useEffect)(()=>{let e=l.current;if(e)return e.addEventListener("touchstart",b,{passive:!0}),e.addEventListener("touchmove",v,{passive:!1}),e.addEventListener("touchend",w,{passive:!0}),e.addEventListener("touchcancel",w,{passive:!0}),()=>{e.removeEventListener("touchstart",b),e.removeEventListener("touchmove",v),e.removeEventListener("touchend",w),e.removeEventListener("touchcancel",w)}},[b,v,w]),{containerRef:l,pullDistance:o,isRefreshing:d,isPulling:m}}({onRefresh:t,enabled:s,threshold:64}),x=u||d>0,h=u?1:Math.min(d/64,1);return(0,n.jsxs)("div",{ref:c,className:(0,i.cn)("relative overflow-auto",l),style:{overscrollBehaviorY:"contain"},"data-testid":"pull-to-refresh",children:[(0,n.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex justify-center",style:{transform:"translateY(".concat(x?Math.max(d-24,8):-32,"px)"),opacity:h,transition:m?"none":"transform 0.2s ease-out, opacity 0.2s ease-out"},"data-testid":"pull-to-refresh-indicator",role:"status","aria-hidden":!u,children:(0,n.jsx)(r.y$,{size:"sm",variant:"accent"})}),(0,n.jsx)("div",{style:{transform:x?"translateY(".concat(d,"px)"):void 0,transition:m?"none":"transform 0.2s ease-out"},children:o})]})}},62147:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>eo});var n=s(95155),a=s(12115),r=s(52619),i=s.n(r),l=s(18955),o=s(20562),c=s(8803),d=s(54388),u=s(9219),m=s(37586),x=s(22479),h=s(54485),f=s(84228),g=s(83051),p=s(14006),b=s(73333),v=s(2954),y=s(28019),w=s(62560),j=s(308),k=s(80635),N=s(52407);function A(){let{signals:e}=(0,N.Fx)();return(0,a.useMemo)(()=>({offline:(0,N.sV)(e),reachable:(0,N._X)(e)}),[e])}var C=s(66966);let M=Object.freeze({enabled:!1,expiresAt:null});var S=s(81507),L=s(2317),I=s(75676),E=s(80344),P=s(38606),T=s(54014),R=s(55449),_=s(67149),z=s(68394);let D=[{mode:"chat",labelKey:"surfaceMode.showChat",icon:m.A},{mode:"terminal",labelKey:"surfaceMode.showTerminal",icon:x.A}];function F(e){return"flex h-7 w-7 shrink-0 items-center justify-center rounded transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ".concat(e?"bg-accent-500/15 text-accent-600 dark:text-accent-400":"text-muted-foreground hover:bg-muted hover:text-foreground")}let U=()=>{},K=(0,a.memo)(function(e){return e.connectivity?(0,n.jsx)(B,{...e,connectivity:e.connectivity}):(0,n.jsx)(O,{...e})});function O(e){let t=A();return(0,n.jsx)(B,{...e,connectivity:t})}function B(e){var t,s,r,o,c,d,u;let{worktree:m,enabled:x,connectivity:N,className:A=""}=e,K=(0,l.c)("common"),O=(0,l.c)("worktree"),B=(0,a.useMemo)(()=>{var e;return m.agentInstances&&m.agentInstances.length>0?m.agentInstances:(0,T.lu)(null!=(e=m.selectedAgents)?e:(0,R.sA)())},[m]),[V,Y]=(0,a.useState)(null),q=null!=(s=B.find(e=>e.id===V))?s:B[0],H=null==q?void 0:q.id,W=null!=(r=null==q?void 0:q.cliTool)?r:"claude",G=null!=H?H:W,{surfaceMode:J,setSurfaceMode:Q}=function(e){let{value:t,setValue:s}=(0,L.V)({key:"".concat("commandmate.sessions.tileSurfaceMode-").concat(e),defaultValue:"chat",validate:I.jg,serialize:e=>e,deserialize:e=>e});return{surfaceMode:t,setSurfaceMode:(0,a.useCallback)(e=>s(e),[s])}}(m.id),{visible:X,toggle:$}=(0,S.TG)(S.jt),Z="terminal"===J,ee=Z&&X,{terminal:et,prompt:es,refresh:en,setAutoScroll:ea}=(0,w.NK)({worktreeId:m.id,cliToolId:W,instanceId:H,enabled:x,cadence:_.sD}),{messages:er,isLoading:ei,refresh:el}=(0,j.Md)({worktreeId:m.id,cliToolId:W,instanceId:H,enabled:x&&(!Z||X),cadence:_.WT}),eo=(0,a.useCallback)((e,t)=>E.y.sendMessage(m.id,e,t),[m.id]),{messages:ec,sendOptimistic:ed,retry:eu,discard:em}=(0,k.v4)({worktreeId:m.id,serverMessages:er,sendFn:eo,onSent:el,connectivity:N}),ex=(0,a.useMemo)(()=>(function(e,t){let s=e=>{var s;return void 0!==e.optimisticState&&(null!=(s=e.instanceId)?s:e.cliToolId)!==t};return e.some(s)?e.filter(e=>!s(e)):e})(ec,G),[ec,G]),[eh,ef]=(0,a.useState)(null),eg=(0,a.useCallback)(()=>ef(null),[]),ep=(0,a.useCallback)(e=>{let t=em(e);t&&ef(t)},[em]),eb=(0,a.useCallback)(()=>{en()},[en]),ev=function(e){var t;let{worktree:s,cliToolId:n,instanceId:r}=e,i=null==(t=(0,C.rC)())?void 0:t.refresh,l=s.id,o=(0,a.useMemo)(()=>(function(e,t){var s;let n=null==(s=e.autoYesByInstance)?void 0:s[t];return n&&!0===n.enabled?{enabled:!0,expiresAt:"number"==typeof n.expiresAt?n.expiresAt:null}:M})(s,r),[s,r]),[c,d]=(0,a.useState)(null),u=(0,a.useRef)(s);u.current=s;let m=null===c||c.instanceId!==r||function(e,t,s){let n=t.enabled===e.value.enabled&&(!t.enabled||t.expiresAt===e.value.expiresAt),a=null!==e.settledRow&&s!==e.settledRow;return n||a}(c,o,s)?null:c;(0,a.useEffect)(()=>{null!==c&&null===m&&d(null)},[c,m]);let x=(0,a.useCallback)(async e=>{let t;try{let s=await fetch("/api/worktrees/".concat(encodeURIComponent(l),"/auto-yes"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:e.enabled,cliToolId:n,instanceId:r,duration:e.duration,stopPattern:e.stopPattern})});if(!s.ok)return;let a=await s.json(),i=!0===a.enabled;t={enabled:i,expiresAt:i&&"number"==typeof a.expiresAt?a.expiresAt:null}}catch(e){return}let s={instanceId:r,value:t,settledRow:null};d(s);try{await (null==i?void 0:i())}catch(e){}d(e=>e===s?{...s,settledRow:u.current}:e)},[l,n,r,i]),h=m?m.value:o;return{enabled:h.enabled,expiresAt:h.expiresAt,toggle:x}}({worktree:m,cliToolId:W,instanceId:G}),ey=(0,a.useMemo)(()=>({isRunning:et.isRunning,attaching:et.attaching,sessionStatus:et.sessionStatus,isThinking:et.isThinking,isPromptWaiting:es.visible,promptData:es.data,isSelectionListActive:et.isSelectionListActive,isPagerActive:et.isPagerActive,isDismissablePanelActive:et.isDismissablePanelActive,isUnclassifiedActive:et.isUnclassifiedActive}),[et.isRunning,et.attaching,et.sessionStatus,et.isThinking,et.isSelectionListActive,et.isPagerActive,et.isDismissablePanelActive,et.isUnclassifiedActive,es.visible,es.data]),ew=(0,a.useCallback)(e=>Q(e),[Q]),ej=(0,a.useMemo)(()=>({isLoading:ei,onRetryPending:eu,onDiscardPending:ep,onInsertToMessage:ef}),[ei,eu,ep]),{compactTuiLayoutPadding:ek,preservePaintedPanelRows:eN}=(0,a.useMemo)(()=>(0,z.EK)(W),[W]),eA="opencode"===W||"copilot"===W,eC=(u=m.id,"session-tile-history-".concat(u)),eM=(0,a.useCallback)(e=>{Y(e.target.value)},[]),eS=null!=(o=m.branch)?o:m.name,eL=null!=(c=m.repositoryDisplayName)?c:m.repositoryName,eI=(0,P.kA)(H?null==(t=m.sessionStatusByInstance)?void 0:t[H]:void 0);return(0,n.jsxs)("section",{className:"flex h-full min-w-0 flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-sm ".concat(A),"data-testid":"session-tile-".concat(m.id),"data-enabled":x?"true":"false","aria-label":K("sessions.tileAriaLabel",{branch:eS}),children:[(0,n.jsxs)("header",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[(0,n.jsx)(y.md,{status:eI,size:"sm",label:K("status.".concat(eI))}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:eL}),(0,n.jsx)(i(),{href:"/worktrees/".concat(m.id),className:"block truncate text-sm font-medium text-foreground underline-offset-2 hover:text-accent-600 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:hover:text-accent-400","data-testid":"session-tile-branch-".concat(m.id),title:eS,children:eS})]}),B.length>1&&(0,n.jsx)("select",{value:null!=(d=null==q?void 0:q.id)?d:"",onChange:eM,className:"max-w-[9rem] shrink-0 rounded-md border border-border bg-surface px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring","data-testid":"session-tile-instance-".concat(m.id),"aria-label":K("sessions.tileInstanceAriaLabel"),children:B.map(e=>(0,n.jsx)("option",{value:e.id,children:(0,T.sw)(e)},e.id))}),Z&&(0,n.jsx)("button",{type:"button",onClick:$,"aria-pressed":X,"aria-expanded":X,"aria-controls":eC,"aria-label":X?O("terminal.hideHistory"):O("terminal.showHistory"),title:X?O("terminal.hideHistory"):O("terminal.showHistory"),className:F(X),"data-testid":"session-tile-history-toggle-".concat(m.id),children:(0,n.jsx)(h.A,{size:14,"aria-hidden":"true"})}),(0,n.jsx)("div",{role:"group","aria-label":O("surfaceMode.groupLabelMobile"),className:"flex shrink-0 items-center gap-0.5 rounded-md border border-border p-0.5","data-testid":"session-tile-surface-mode-".concat(m.id),children:D.map(e=>{let{mode:t,labelKey:s,icon:a}=e,r=J===t,i=O(s);return(0,n.jsx)("button",{type:"button",onClick:()=>Q(t),"aria-pressed":r,"aria-label":i,title:i,className:F(r),"data-testid":"session-tile-surface-".concat(t,"-").concat(m.id),children:(0,n.jsx)(a,{size:14,"aria-hidden":"true"})},t)})})]}),(0,n.jsx)("div",{className:"min-w-0 flex-1 overflow-hidden ".concat("min-h-[15rem]"),"data-testid":"session-tile-body-".concat(m.id),children:x&&Z?(0,n.jsxs)("div",{className:"flex h-full min-h-0 min-w-0 flex-col","data-testid":"session-tile-terminal-stack-".concat(m.id),children:[(0,n.jsx)("div",{className:"relative min-w-0 overflow-hidden ".concat(ee?"flex-[3_3_0%] min-h-[8.5rem]":"min-h-0 flex-1"),"data-testid":"session-tile-terminal-".concat(m.id),children:(0,n.jsx)(p.D,{output:et.output,isActive:et.isRunning,attaching:et.attaching,isThinking:et.isThinking,autoScroll:et.autoScroll,onScrollChange:ea,disableAutoFollow:eA,compactTuiLayoutPadding:ek,preservePaintedPanelRows:eN,wrapMode:z.Wq.wrapMode,density:z.Wq.density})}),ee&&(0,n.jsx)("div",{id:eC,className:"min-w-0 overflow-hidden border-t border-border ".concat("flex-[2_2_0%] min-h-[6.5rem]"),"data-testid":"session-tile-history-".concat(m.id),children:(0,n.jsx)(g.bl,{messages:ex,worktreeId:m.id,worktreePath:m.path,cliToolId:W,isLoading:ei,onFilePathClick:U,onInsertToMessage:ef,onRetryPending:eu,onDiscardPending:ep,className:"h-full"})})]}):x?(0,n.jsx)(f.wY,{messages:ex,worktreeId:m.id,worktreePath:m.path,cliToolId:W,instanceId:H,live:ey,frame:et.output,onKeysSent:en,onSurfaceModeChange:ew,compact:!0,history:ej}):(0,n.jsx)("div",{className:"h-full","data-testid":"session-tile-placeholder-".concat(m.id),"aria-hidden":"true"})}),x&&(0,n.jsx)("div",{className:"shrink-0 border-t border-border p-2","data-testid":"session-tile-composer-".concat(m.id),children:(0,n.jsx)(b.E,{worktreeId:m.id,cliToolId:W,instanceId:G,isSessionRunning:et.isRunning,onOptimisticSend:ed,onMessageSent:eb,pendingInsertText:eh,onInsertConsumed:eg,autoYesSlot:(0,n.jsx)(v.T,{enabled:ev.enabled,expiresAt:ev.expiresAt,onToggle:ev.toggle,lastAutoResponse:null,cliToolName:W,inline:!0})})})]})}let V=(0,a.memo)(function(e){let{worktree:t,connectivity:s}=e,{ref:r,inViewport:i}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{rootMargin:t,threshold:s}=e,[n,r]=(0,a.useState)(!1),[i,l]=(0,a.useState)(null),o=(0,a.useCallback)(e=>{l(e)},[]);return(0,a.useEffect)(()=>{if("undefined"==typeof IntersectionObserver)return void r(!0);if(!i)return;let e=new IntersectionObserver(e=>{let t=e[e.length-1];t&&r(t.isIntersecting)},{rootMargin:t,threshold:s});return e.observe(i),()=>e.disconnect()},[i,t,s]),{ref:o,inViewport:n}}({rootMargin:"560px"});return(0,n.jsx)("div",{ref:r,className:"min-w-0 ".concat("h-[35rem]"),children:(0,n.jsx)(K,{worktree:t,enabled:i,connectivity:s})})}),Y=(0,a.memo)(function(e){let{worktrees:t}=e,s=A();return(0,n.jsx)("div",{className:"grid grid-cols-1 gap-4 xl:grid-cols-2","data-testid":"sessions-tile-grid",children:t.map(e=>(0,n.jsx)(V,{worktree:e,connectivity:s},e.id))})});var q=s(80003);let H=(0,s(71847).A)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),W=["list","tile"];function G(e){return"string"==typeof e&&W.includes(e)}let J=[{mode:"list",labelKey:"sessions.viewMode.list",icon:q.A},{mode:"tile",labelKey:"sessions.viewMode.tile",icon:H}],Q=(0,a.memo)(function(e){let{value:t,onChange:s}=e,a=(0,l.c)("common");return(0,n.jsx)("div",{className:"flex shrink-0 items-center gap-1 rounded-md border border-input bg-surface p-0.5",role:"group","aria-label":a("sessions.viewMode.groupAriaLabel"),"data-testid":"sessions-view-mode",children:J.map(e=>{let{mode:r,labelKey:i,icon:l}=e,o=t===r;return(0,n.jsx)("button",{type:"button",onClick:()=>s(r),"aria-pressed":o,"aria-label":a(i),title:a(i),"data-testid":"sessions-view-mode-".concat(r),className:"rounded p-1.5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ".concat(o?"bg-accent-100 text-accent-700 dark:bg-accent-900/30 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),children:(0,n.jsx)(l,{size:16,"aria-hidden":"true"})},r)})})});var X=s(38218),$=s(50857),Z=s(7636),ee=s(83012),et=s(6473);let es=[{key:"repositoryName",labelKey:"sort.repositoryName"},{key:"status",labelKey:"sort.status"},{key:"lastSent",labelKey:"sort.lastSent"}],en={lastSent:"desc",updatedAt:"desc"},ea={ready:0,in_progress:1,in_review:2,done:3};function er(e){let{status:t,label:s}=e,a=(0,l.c)("common"),r="".concat(s,": ").concat(a("status.".concat(t)));return(0,n.jsx)(y.md,{status:t,size:"md",label:r})}let ei={ready:"worktreeStatus.ready",in_progress:"worktreeStatus.inProgress",in_review:"worktreeStatus.inReview",done:"worktreeStatus.done"},el={done:"bg-success-subtle text-success-foreground",in_review:"bg-info-subtle text-info-foreground",in_progress:"bg-accent-100 dark:bg-accent-900/30 text-accent-700 dark:text-accent-400"};function eo(){let e=(0,l.c)("common"),t=(0,l.c)("worktree"),s=(0,X.a)(),{worktrees:r,isLoading:m,error:x,refresh:h}=(0,C.Fn)(),f=r.length>0,[g,p]=(0,a.useState)(""),[b,v]=(0,a.useState)("lastSent"),[w,j]=(0,a.useState)("desc"),{viewMode:k,setViewMode:N}=function(){let{value:e,setValue:t}=(0,L.V)({key:"mcbd-sessions-view-mode",defaultValue:"list",validate:G,serialize:e=>e,deserialize:e=>e});return{viewMode:e,setViewMode:(0,a.useCallback)(e=>t(e),[t])}}(),A="tile"===k;(0,a.useEffect)(()=>{(0,R.qD)()},[]);let M=(0,a.useMemo)(()=>{let e=r;if(g){let t=g.toLowerCase();e=e.filter(e=>{var s,n;return e.name.toLowerCase().includes(t)||e.repositoryName.toLowerCase().includes(t)||null!=(n=null==(s=e.repositoryDisplayName)?void 0:s.toLowerCase().includes(t))&&n})}let t=[...e];return t.sort((e,t)=>{var s,n,a,r,i,l,o,c;let d=0;switch(b){case"lastSent":{let s=(0,Z.nO)(e.lastUserMessageAt,t.lastUserMessageAt);if(!e.lastUserMessageAt&&!t.lastUserMessageAt)return 0;if(!e.lastUserMessageAt)return 1;if(!t.lastUserMessageAt)return -1;d=s;break}case"repositoryName":{let a=(null!=(s=e.repositoryDisplayName)?s:e.repositoryName).toLowerCase(),r=(null!=(n=t.repositoryDisplayName)?n:t.repositoryName).toLowerCase();0===(d=a.localeCompare(r))&&(d=e.name.toLowerCase().localeCompare(t.name.toLowerCase()));break}case"status":if(0==(d=(null!=(r=ea[null!=(a=e.status)?a:""])?r:4)-(null!=(l=ea[null!=(i=t.status)?i:""])?l:4))){let s=(null!=(o=e.repositoryDisplayName)?o:e.repositoryName).toLowerCase(),n=(null!=(c=t.repositoryDisplayName)?c:t.repositoryName).toLowerCase();d=s.localeCompare(n)}break;default:d=0}return("lastSent"===b?"desc"===w:"asc"===w)?d:-d}),t},[r,g,b,w]),S=(0,a.useCallback)(e=>{p(e.target.value)},[]),I=(0,a.useCallback)(e=>{var t;v(e),j(null!=(t=en[e])?t:"asc")},[]),E=(0,a.useCallback)(()=>{j(e=>"asc"===e?"desc":"asc")},[]);return(0,n.jsx)(d.GV,{children:(0,n.jsxs)(u.k,{onRefresh:h,enabled:s,className:"".concat(A?"w-full px-4 sm:px-6 lg:px-8":"container-custom"," py-8 h-full"),children:[(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:e("sessions.title")}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("sessions.description")})]}),(0,n.jsxs)("div",{className:"mb-6 flex items-center gap-3",children:[(0,n.jsx)(y.pd,{type:"text",placeholder:e("sessions.filterPlaceholder"),value:g,onChange:S,className:"max-w-md flex-1","data-testid":"sessions-filter","aria-label":e("sessions.filterAriaLabel"),inputMode:"search",enterKeyHint:"search"}),(0,n.jsxs)(y.l6,{value:b,onValueChange:I,children:[(0,n.jsx)(y.bq,{className:"w-40","data-testid":"sessions-sort-select","aria-label":e("sessions.sortByAriaLabel"),children:(0,n.jsx)(y.yv,{})}),(0,n.jsx)(y.gC,{children:es.map(t=>(0,n.jsx)(y.eb,{value:t.key,children:e(t.labelKey)},t.key))})]}),(0,n.jsx)("button",{type:"button",onClick:E,"data-testid":"sessions-sort-direction","aria-label":"asc"===w?e("sessions.sortAscending"):e("sessions.sortDescending"),className:"rounded-md border border-input bg-surface p-2 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"asc"===w?(0,n.jsx)(o.A,{size:16,"aria-hidden":"true"}):(0,n.jsx)(c.A,{size:16,"aria-hidden":"true"})}),(0,n.jsx)(Q,{value:k,onChange:N})]}),f?(0,n.jsxs)(n.Fragment,{children:[x&&(0,n.jsx)("div",{className:"mb-4 rounded-md border border-danger-border bg-danger-subtle px-3 py-2 text-sm text-danger-foreground",role:"status","data-testid":"sessions-error-banner",children:e("sessions.refreshError",{message:x.message})}),A?0===M.length?(0,n.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"sessions-empty",children:e("sessions.noMatching")}):(0,n.jsx)(Y,{worktrees:M}):(0,n.jsx)("div",{className:"space-y-2","data-testid":"sessions-list",children:0===M.length?(0,n.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"sessions-empty",children:e("sessions.noMatching")}):M.map((s,a)=>{var r,l,o,c;let d=null!=(r=s.selectedAgents)?r:(0,R.sA)(),u=s.lastUserMessage?s.lastUserMessage.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,"").replace(/[\u200B-\u200F\u2028-\u202F\uFEFF\u061C]/g,"").replace(/[\r\n\t]/g," ").replace(/\s+/g," ").trim():null,m=s.lastUserMessageAt?(0,ee.Fx)(String(s.lastUserMessageAt)):null,x=d.map(e=>{var t;return{agent:e,status:(0,P.kA)(null==(t=s.sessionStatusByCli)?void 0:t[e])}}),h=x.filter(e=>(0,$.Qo)(e.status)),f=x.length-h.length,g=d.some(e=>{var t;let n=(0,P.kA)(null==(t=s.sessionStatusByCli)?void 0:t[e]);return"running"===n||"generating"===n});return(0,n.jsxs)(i(),{href:"/worktrees/".concat(s.id),style:{animationDelay:(0,et.Lc)(a)},className:"block bg-surface rounded-lg p-4 border transition-colors ".concat(g?"border-accent-500/40 shadow-[0_0_16px_-4px_rgb(var(--accent-500)/0.45)] hover:border-accent-400":"border-border shadow-sm hover:border-accent-300 dark:hover:border-accent-700"," ").concat(et.qz),"data-testid":"session-item-".concat(s.id),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:null!=(l=s.repositoryDisplayName)?l:s.repositoryName}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:s.name})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4 flex-shrink-0","data-testid":"session-agents-".concat(s.id),children:[h.map(e=>{let{agent:t,status:s}=e;return(0,n.jsxs)("div",{className:"flex items-center gap-1","data-testid":"session-agent-".concat(t),children:[(0,n.jsx)(er,{status:s,label:(0,T.oo)(t)}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,T.oo)(t)})]},t)}),f>0&&(0,n.jsxs)("div",{className:"flex items-center gap-1","data-testid":"session-idle-cluster-".concat(s.id),"aria-label":e("sessions.idleAgents",{count:f}),children:[(0,n.jsx)(y.md,{status:"idle",size:"sm","aria-hidden":!0,title:void 0}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:["+",f]})]})]})]}),s.description&&(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 whitespace-pre-wrap",children:s.description})}),s.status&&(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium rounded ".concat(null!=(c=el[null!=(o=s.status)?o:""])?c:"bg-muted text-muted-foreground"),children:function(e,t){if(!e)return"";let s=ei[e];return s?t(s):e}(s.status,t)})}),u&&(0,n.jsxs)("div",{className:"mt-2 flex items-center gap-2","data-testid":"session-message-".concat(s.id),children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground truncate min-w-0 flex-1","data-testid":"session-message-text-".concat(s.id),title:u,children:u}),m&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0 whitespace-nowrap tabular-nums","data-testid":"session-time-".concat(s.id),children:m})]})]},s.id)})})]}):(0,n.jsxs)(n.Fragment,{children:[m&&(0,n.jsx)("div",{className:"space-y-2","data-testid":"sessions-loading",role:"status","aria-label":e("sessions.loadingAriaLabel"),children:[0,1,2].map(e=>(0,n.jsxs)("div",{className:"block bg-surface rounded-lg p-4 border border-border shadow-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,n.jsx)(y.EA,{className:"h-4 w-40 max-w-full"}),(0,n.jsx)(y.EA,{className:"h-3 w-56 max-w-full"})]}),(0,n.jsx)(y.EA,{className:"ml-4 h-3 w-16 flex-shrink-0"})]}),(0,n.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,n.jsx)(y.EA,{className:"h-3 min-w-0 flex-1"}),(0,n.jsx)(y.EA,{className:"h-3 w-10 flex-shrink-0"})]})]},e))}),!m&&x&&(0,n.jsx)("div",{className:"text-danger-foreground","data-testid":"sessions-error",children:e("sessions.loadError",{message:x.message})}),!m&&!x&&(0,n.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"sessions-empty",children:g?e("sessions.noMatching"):e("sessions.empty")})]})]})})}},80003:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(71847).A)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]])},87047:(e,t,s)=>{Promise.resolve().then(s.bind(s,62147))}},e=>{e.O(0,[6809,4909,2770,790,5694,8566,934,9948,9526,2407,6402,8019,4718,4388,2039,4949,8441,1255,7358],()=>e(e.s=87047)),_N_E=e.O()}]);