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
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8361],{18848:(e,t,r)=>{r.d(t,{Bz:()=>s,kj:()=>a,wx:()=>n}),r(95704);let n=["send","wait","capture","respond"];function a(e){let{binary:t,worktreeId:r,instanceId:n,messagePlaceholder:a}=e,s=null!=e.portPrefix&&3e3!==e.portPrefix?"CM_PORT=".concat(e.portPrefix," "):"",o="--instance ".concat(n),i="".concat(s).concat(t);return{send:"".concat(i," send ").concat(r,' "').concat(a,'" ').concat(o),wait:"".concat(i," wait ").concat(r," ").concat(o," --on-prompt human"),capture:"".concat(i," capture ").concat(r," ").concat(o),respond:"".concat(i," respond ").concat(r,' "').concat("1",'" ').concat(o)}}function s(e){let{binary:t,worktreeId:r,instanceId:n,instanceLabel:a,toolLabel:s}=e,o=null!=e.portPrefix&&3e3!==e.portPrefix?"CM_PORT=".concat(e.portPrefix," "):"",i="".concat(o).concat(t),l="--instance ".concat(n),c="ja"===e.locale?"ja":"en",d="".concat(i," capture ").concat(r," ").concat(l," --pane --tail ").concat(60),u="".concat(i," ask ").concat(r," ").concat(l,' "<request>" --async');if("ja"===c){let e="".concat(i," ask ").concat(r," ").concat(l,' "<依頼文>" --timeout ').concat(1800);return["## 別セッション「".concat(a,"」への委任"),"- 宛先: worktree `".concat(r,"` / instance `").concat(n,"`(").concat(s,")"),"- 依頼: ".concat(e)," - exit 0: 標準出力が返答本文\n - exit 10: 相手が確認待ち。標準出力のprompt JSONを私に報告して止まる(自分で答えない)\n - exit 124: タイムアウト。captureで状況を見て報告","- 待たない依頼: ".concat(u)," - 即座に relay id を返して exit 0。完了時に `[from ...]` 付きで返答が私のコンポーザーに届く"," - 状況確認: ".concat(i," relays / 取り消し: ").concat(i," relays cancel <relay-id>"),"- 進捗確認: ".concat(d),"- 禁止: respondで相手のプロンプトに答える / auto-yesを有効化する"].join("\n")}let m="".concat(i," ask ").concat(r," ").concat(l,' "<request>" --timeout ').concat(1800);return['## Delegating to session "'.concat(a,'"'),"- Target: worktree `".concat(r,"` / instance `").concat(n,"` (").concat(s,")"),"- Ask: ".concat(m)," - exit 0: stdout is the reply body\n - exit 10: they are waiting on a confirmation. Report the prompt JSON on stdout back to me and stop (do not answer it yourself)\n - exit 124: timed out. Look with capture and report what you see","- Ask without waiting: ".concat(u)," - exits 0 with a relay id on stdout; the reply lands in my composer prefixed `[from ...]` when the turn ends"," - Outstanding: ".concat(i," relays / withdraw: ").concat(i," relays cancel <relay-id>"),"- Progress: ".concat(d),"- Do not: answer their prompt with respond / turn auto-yes on"].join("\n")}},26020:(e,t,r)=>{r.d(t,{dI:()=>n,gB:()=>a,vK:()=>s});let n=["en","ja"],a="locale",s={en:"English",ja:"日本語"}},30061:(e,t,r)=>{r.d(t,{nR:()=>o});var n=r(95155),a=r(12115),s=r(47650);function o(e){let{content:t,delay:r=200,className:o,children:i,metadata:l}=e,c=(0,a.useRef)(null),d=(0,a.useRef)(null),u=(0,a.useRef)(null),m=(0,a.useRef)(null),[f,h]=(0,a.useState)(!1),[p,x]=(0,a.useState)({top:-9999,left:-9999}),b=(0,a.useCallback)(()=>{null!==u.current&&(clearTimeout(u.current),u.current=null)},[]),g=(0,a.useCallback)(()=>{let e=c.current;e&&(e.scrollWidth>e.clientWidth||l)&&(b(),u.current=setTimeout(()=>{let t=e.getBoundingClientRect(),r=Math.max(4,window.innerWidth-384-4);m.current={top:t.top,bottom:t.bottom},x({top:t.bottom+4,left:Math.min(t.left,r)}),h(!0),u.current=null},r))},[b,r,l]);(0,a.useLayoutEffect)(()=>{if(!f)return;let e=d.current,t=m.current;if(!e||!t)return;let{height:r}=e.getBoundingClientRect();if(r<=0)return;let n=window.innerHeight;if(t.bottom+4+r+4<=n)return;let a=t.top-4-r,s=a>=4?a:Math.max(4,n-r-4);x(e=>e.top===s?e:{...e,top:s})},[f]);let y=(0,a.useCallback)(()=>{b(),h(!1)},[b]);return(0,a.useEffect)(()=>()=>b(),[b]),(0,n.jsxs)("span",{ref:c,className:o,onMouseEnter:g,onMouseLeave:y,children:[null!=i?i:t,f&&"undefined"!=typeof document&&(0,s.createPortal)((0,n.jsxs)("span",{ref:d,role:"tooltip","aria-hidden":"true",className:"fixed z-[9999] max-w-md px-2 py-1 text-xs font-medium rounded bg-foreground text-background shadow-lg pointer-events-none",style:{top:p.top,left:p.left},children:[(0,n.jsx)("span",{className:"block break-all",children:t}),l&&(0,n.jsx)("span",{className:"mt-0.5 block whitespace-pre-line font-normal text-background/70",children:l})]}),document.body)]})}},34681:(e,t,r)=>{r.d(t,{g:()=>i});var n=r(95155);r(12115);var a=r(18955),s=r(22592),o=r(68704);function i(){let{size:e,setSize:t,isMobile:r}=(0,s.Ps)(),i=(0,a.c)("common");if(r)return null;let l=i("displaySize.ariaLabel");return(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("label",{htmlFor:"pc-display-size",className:"sr-only",children:l}),(0,n.jsx)("select",{id:"pc-display-size","data-testid":"pc-display-size-select","aria-label":l,value:e,onChange:e=>{let r=e.target.value;(0,o.fM)(r)&&t(r)},className:"text-sm bg-transparent text-foreground border border-input rounded-md px-2 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:o.Uf.map(e=>(0,n.jsx)("option",{value:e,children:i("displaySize.".concat(e))},e))})]})}},41898:(e,t,r)=>{r.d(t,{m_:()=>l});var n=r(95155),a=r(12115),s=r(47650);function o(e,t,r){return Math.min(Math.max(e,4),Math.max(4,r-t-4))}let i={top:-9999,left:-9999};function l(e){let{content:t,placement:r="right",delay:l=100,children:c,className:d}=e,[u,m]=(0,a.useState)(!1),[f,h]=(0,a.useState)(!1),p=u||f,[x,b]=(0,a.useState)(null),g=(0,a.useRef)(null),y=(0,a.useRef)(null),v=(0,a.useRef)(null),w=(0,a.useCallback)(()=>{null!==v.current&&(clearTimeout(v.current),v.current=null)},[]),j=(0,a.useCallback)(()=>{w(),v.current=setTimeout(()=>{m(!0),v.current=null},l)},[l,w]),k=(0,a.useCallback)(()=>{w(),m(!1)},[w]),N=(0,a.useCallback)(()=>{h(!0)},[]),C=(0,a.useCallback)(()=>{h(!1)},[]),S=(0,a.useCallback)(()=>{w(),m(!1),h(!1)},[w]),E=(0,a.useCallback)(()=>{let e=g.current,t=y.current;if(!e||!t)return;let n=e.getBoundingClientRect(),a=t.getBoundingClientRect();b(function(e,t,r,n){let a,s,i=t.left+t.width/2-r.width/2,l=t.top+t.height/2-r.height/2;switch(e){case"top":a=t.top-r.height-8,s=i;break;case"bottom":a=t.top+t.height+8,s=i;break;case"left":a=l,s=t.left-r.width-8;break;default:a=l,s=t.left+t.width+8}return{top:o(a,r.height,n.height),left:o(s,r.width,n.width)}}(r,{top:n.top,left:n.left,width:n.width,height:n.height},{width:a.width,height:a.height},{width:window.innerWidth,height:window.innerHeight}))},[r]);return(0,a.useLayoutEffect)(()=>p?(E(),window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}):void b(null),[p,E]),(0,a.useEffect)(()=>{if(!p)return;let e=e=>{"Escape"===e.key&&S()};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[p,S]),(0,a.useEffect)(()=>()=>{w()},[w]),(0,n.jsxs)("span",{ref:g,"data-testid":"tooltip-wrapper",className:d?"relative inline-flex ".concat(d):"relative inline-flex",tabIndex:-1,onMouseEnter:j,onMouseLeave:k,onFocus:N,onBlur:C,children:[c,p&&"undefined"!=typeof document&&(0,s.createPortal)((0,n.jsx)("span",{ref:y,role:"tooltip","aria-hidden":"true","data-placement":r,className:"fixed z-40 whitespace-nowrap px-2 py-1 text-xs font-medium rounded bg-foreground text-background shadow-lg pointer-events-none",style:null!=x?x:i,children:t}),document.body)]})}},45195:(e,t,r)=>{r.d(t,{g:()=>s});var n=r(36809),a=r(26020);function s(){return{currentLocale:(0,n.Ym)(),switchLocale:e=>{if(a.dI.includes(e)){let t="https:"===window.location.protocol;document.cookie="".concat(a.gB,"=").concat(e,";path=/;max-age=").concat(31536e3,";SameSite=Lax").concat(t?";Secure":""),localStorage.setItem("locale",e),window.location.reload()}}}}},45573:(e,t,r)=>{r.d(t,{P0:()=>Z,oQ:()=>$,tJ:()=>U,xk:()=>Y,xq:()=>ee,yW:()=>Q});var n=r(95155),a=r(12115),s=r(47650),o=r(20063),i=r(36809),l=r(18955),c=r(5379),d=r(79698),u=r(65993),m=r(37586),f=r(66685),h=r(24533),p=r(61362),x=r(95740),b=r(37772),g=r(59427),y=r(37494),v=r(79451),w=r(89559),j=r(97470),k=r(94684),N=r(76482),C=r(39332),S=r(86651),E=r(18085),M=r(87531),L=r(59854),A=r(92614),R=r(70628),z=r(22592),B=r(66966),P=r(68704),T=r(45195),I=r(80344),K=r(48481),D=r(79651),W=r(94442),O=r(18848),F=r(54014);let _=[{key:"home",href:"/"},{key:"chat",href:"/chat"},{key:"sessions",href:"/sessions"},{key:"repositories",href:"/repositories"},{key:"review",href:"/review"},{key:"skills",href:"/skills"},{key:"more",href:"/more"}],H={home:u.A,chat:m.A,sessions:f.A,repositories:h.A,review:p.A,skills:x.A,more:b.A},V="cm.palette.recents";function G(e){if(!e||"object"!=typeof e)return!1;let{kind:t,id:r}=e;return("nav"===t||"worktree"===t||"action"===t)&&"string"==typeof r}function q(e){return e.isWaitingForResponse?"waiting":e.isProcessing?"running":e.isSessionRunning?"ready":"idle"}function U(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return!!("INPUT"===t||"TEXTAREA"===t||"SELECT"===t||e.isContentEditable||e.closest('[role="log"]'))}let J=(0,M.cn)("flex cursor-pointer items-center gap-2 rounded-md px-2 py-2 text-sm","text-foreground","data-[selected=true]:bg-accent-500/15 data-[selected=true]:text-accent-700","dark:data-[selected=true]:text-accent-300"),X="shrink-0 text-muted-foreground";function Y(){var e;if("undefined"==typeof document)return null;let t=document.querySelector("[data-instance-id]");return(null==t||null==(e=t.getAttribute("data-instance-id"))?void 0:e.trim())||null}function $(e){var t,r;if("undefined"==typeof document)return!1;let n=Array.from(document.querySelectorAll('[data-testid="message-input-textarea"]'));if(0===n.length)return!1;let a=document.activeElement,s=null!=(r=n.find(e=>e===a))?r:n[0],o=s.value,i=""===o.trim()?e:"".concat(o,"\n\n").concat(e),l=null==(t=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value"))?void 0:t.set;return l?l.call(s,i):s.value=i,s.dispatchEvent(new Event("input",{bubbles:!0})),s.focus(),s.setSelectionRange(i.length,i.length),!0}async function Z(e,t,r){try{let[n,a]=await Promise.all([fetch("/api/worktrees/".concat(e,"/cli-reference")),fetch("/api/worktrees/".concat(e,"/resolve-target?instance=").concat(encodeURIComponent(t.id)))]);if(!n.ok||!a.ok)return null;let[s,o]=await Promise.all([n.json(),a.json()]);return(0,O.Bz)({binary:s.binary,worktreeId:s.worktreeId,instanceId:o.instanceId,instanceLabel:t.alias,toolLabel:(0,F.oo)(o.cliToolId),portPrefix:s.portPrefix,locale:r})}catch(e){return null}}let Q={ja:{heading:"委任 (/delegate)",menuItem:"委任方法をコンポーザーに挿入",inserted:"委任方法をコンポーザーに挿入しました",self:"自分自身には委任できません",noComposer:"コンポーザーが見つかりません。worktree 画面を開いてから実行してください",failed:"委任方法を作成できませんでした"},en:{heading:"Delegate (/delegate)",menuItem:"Insert delegation brief into the composer",inserted:"Delegation brief inserted into the composer",self:"That is this session — nothing to delegate to",noComposer:"No composer on screen. Open a worktree screen and try again",failed:"Could not build the delegation brief"}};function ee(){var e,t,r;let{open:u,setOpen:m}=(0,A.C)(),{setOpen:f}=(0,R.K)(),h=(0,o.useRouter)(),p=(0,o.usePathname)(),x=(0,i.Ym)(),b=(0,l.c)("commandPalette"),O=(0,l.c)("common"),{theme:ee,setTheme:et}=(0,c.D)(),{setSize:er,isMobile:en}=(0,z.Ps)(),{currentLocale:ea,switchLocale:es}=(0,T.g)(),eo=(0,B.rC)(),{showToast:ei}=(0,W.dj)(),[el,ec]=(0,a.useState)(!1),[ed,eu]=(0,a.useState)(""),[em,ef]=(0,a.useState)([]),eh=(0,a.useRef)(null),ep=(0,a.useRef)(null),ex=(0,a.useRef)(u);(0,a.useEffect)(()=>{ex.current=u},[u]),(0,a.useEffect)(()=>{ec(!0)},[]),(0,a.useEffect)(()=>{function e(e){if(("k"===e.key||"K"===e.key)&&(e.metaKey||e.ctrlKey)){if(ex.current){e.preventDefault(),e.stopPropagation(),m(!1);return}if(U(e.target))return;e.preventDefault(),m(!0);return}"Escape"===e.key&&ex.current&&(e.preventDefault(),e.stopPropagation(),m(!1))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[m]),(0,a.useEffect)(()=>{var e,t,r,n;u?(ep.current=null!=(t=document.activeElement)?t:null,null==(e=eh.current)||e.focus(),eu(""),ef(function(){try{let e=localStorage.getItem(V);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(G).slice(0,8)}catch(e){return[]}}())):ep.current&&(null==(r=(n=ep.current).focus)||r.call(n),ep.current=null)},[u]);let eb=(0,a.useCallback)((e,t)=>{t&&ef(e=>(function(e,t){let r=e.filter(e=>e.kind!==t.kind||e.id!==t.id),n=[t,...r].slice(0,8);try{localStorage.setItem(V,JSON.stringify(n))}catch(e){}return n})(e,t)),m(!1),e()},[m]),eg=(0,a.useCallback)(async e=>{let t=Q["ja"===x?"ja":"en"];if(function(e){let t=/^\/worktrees\/([^/?#]+)/.exec(null!=e?e:"");return t?decodeURIComponent(t[1]):null}(p)===e.worktree.id&&Y()===e.instance.id)return void ei(t.self,"info");let r=await Z(e.worktree.id,e.instance,x);if(null===r)return void ei(t.failed,"error");let n=$(r);ei(n?t.inserted:t.noComposer,n?"success":"error")},[x,p,ei]),ey=(0,a.useCallback)(async()=>{try{var e;await I.Rx.sync(),await (null==eo||null==(e=eo.refresh)?void 0:e.call(eo)),ei(b("actions.syncSuccess"),"success")}catch(e){ei(b("actions.syncError"),"error")}},[eo,ei,b]),ev="dark"===ee,ew=""===ed.trim(),ej=null!=(e=null==eo?void 0:eo.error)?e:null,ek=null!=(t=null==eo?void 0:eo.isLoading)&&t,eN=ej?[]:null!=(r=null==eo?void 0:eo.worktrees)?r:[],eC=eN.length>0,eS=!ej&&ek&&0===eN.length,eE=!function(e){let t=e.trim().toLowerCase();return""!==t&&(t.startsWith("/")||t.includes("delegate"))}(ed)?[]:function(e){let t=[];for(let n of e){var r;for(let e of(null==(r=n.agentInstances)?void 0:r.length)?n.agentInstances:n.cliToolId?[{id:n.cliToolId,cliTool:n.cliToolId,alias:(0,F.oo)(n.cliToolId),order:0}]:[])t.push({worktree:n,instance:e})}return t}(eN),eM=Q["ja"===x?"ja":"en"],eL=[...eN].sort((e,t)=>{let r=+!!e.isSessionRunning,n=+!!t.isSessionRunning;if(r!==n)return n-r;let a=e.updatedAt?new Date(e.updatedAt).getTime():0;return(t.updatedAt?new Date(t.updatedAt).getTime():0)-a}),eA=ew?eL.slice(0,8):eL,eR=[{id:"theme",label:ev?b("actions.toLight"):b("actions.toDark"),icon:ev?g.A:y.A,run:()=>et(ev?"light":"dark")},...en?[]:P.Uf.map(e=>({id:"displaysize:".concat(e),label:"".concat(b("actions.displaySizePrefix"),": ").concat(O("displaySize.".concat(e))),icon:v.A,run:()=>er(e)})),{id:"sync",label:b("actions.syncRepositories"),icon:w.A,run:()=>{ey()}},{id:"locale",label:b("actions.switchLanguage"),icon:j.A,run:()=>es("ja"===ea?"en":"ja")},{id:"github",label:b("actions.openGitHub"),icon:k.A,run:()=>window.open("https://github.com/kewton/MyCodeBranchDesk","_blank","noopener,noreferrer")},{id:"keyboardShortcuts",label:b("actions.keyboardShortcuts"),icon:N.A,run:()=>f(!0)}],ez=ew?em.map(e=>{if("nav"===e.kind){let t=_.find(t=>t.key===e.id);if(!t)return null;let r=H[t.key],a=O("nav.".concat(t.key));return{id:"nav-".concat(t.key),value:"recent nav ".concat(t.key),node:(0,n.jsxs)(n.Fragment,{children:[r&&(0,n.jsx)(r,{size:16,className:X,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:a})]}),onSelect:()=>eb(()=>h.push(t.href),{kind:"nav",id:t.key})}}if("worktree"===e.kind){let t=eN.find(t=>t.id===e.id);if(!t)return null;let r=t.repositoryDisplayName||t.repositoryName||"",a=t.branch||t.name;return{id:"worktree-".concat(t.id),value:"recent worktree ".concat(t.id),node:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.A,{size:16,className:X,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:a}),r&&(0,n.jsx)("span",{className:"ml-auto truncate pl-2 text-xs text-muted-foreground",children:r}),(0,n.jsx)(K.m,{status:q(t),size:"sm",className:r?"ml-2":"ml-auto"})]}),onSelect:()=>eb(()=>h.push("/worktrees/".concat(t.id)),{kind:"worktree",id:t.id})}}let t=eR.find(t=>t.id===e.id);if(!t)return null;let r=t.icon;return{id:"action-".concat(t.id),value:"recent action ".concat(t.id),node:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r,{size:16,className:X,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:t.label})]}),onSelect:()=>eb(t.run,{kind:"action",id:t.id})}}).filter(e=>null!==e):[];return el?(0,s.createPortal)((0,n.jsx)(n.Fragment,{children:u&&(0,n.jsxs)("div",{className:"fixed inset-0 overflow-y-auto",style:{zIndex:L.M.MODAL},"data-testid":"command-palette",children:[(0,n.jsx)("div",{"data-state":"open","aria-hidden":"true",className:"fixed inset-0 bg-black/40 backdrop-blur-sm transition-opacity data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:duration-200",onClick:()=>m(!1)}),(0,n.jsx)("div",{className:"relative flex min-h-full items-start justify-center p-4 pt-[15vh]",children:(0,n.jsx)("div",{"data-state":"open","data-testid":"command-palette-panel",className:(0,M.cn)("relative w-full max-w-lg overflow-hidden rounded-xl bg-surface/95 shadow-2xl ring-1 ring-border backdrop-blur-xl","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:duration-200"),children:(0,n.jsxs)(d.uB,{label:b("title"),className:(0,M.cn)("flex flex-col","[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-2","[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[(0,n.jsx)(S.A,{size:16,strokeWidth:2,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),(0,n.jsx)(d.uB.Input,{ref:eh,value:ed,onValueChange:eu,placeholder:b("placeholder"),"data-testid":"command-palette-input",className:"flex-1 bg-transparent py-3 text-sm text-foreground outline-none placeholder:text-muted-foreground"})]}),(0,n.jsxs)(d.uB.List,{className:"max-h-[min(60vh,360px)] overflow-y-auto p-2",children:[(0,n.jsx)(d.uB.Empty,{"data-testid":"command-palette-empty",className:"py-6 text-center text-sm text-muted-foreground",children:b("empty")}),eS&&(0,n.jsx)(d.uB.Loading,{"data-testid":"command-palette-loading",className:"py-6 text-center text-sm text-muted-foreground",children:b("loading")}),ez.length>0&&(0,n.jsx)(d.uB.Group,{heading:b("groups.recent"),children:ez.map(e=>(0,n.jsx)(d.uB.Item,{value:e.value,onSelect:e.onSelect,className:J,children:e.node},e.id))}),(0,n.jsx)(d.uB.Group,{heading:b("groups.navigation"),children:_.map(e=>{let t=O("nav.".concat(e.key)),r=H[e.key];return(0,n.jsxs)(d.uB.Item,{value:"nav ".concat(t," ").concat(e.href),onSelect:()=>eb(()=>h.push(e.href),{kind:"nav",id:e.key}),className:J,children:[r&&(0,n.jsx)(r,{size:16,className:X,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:t})]},e.key)})}),eC&&(function(e){let t=new Map;for(let r of e){let e=r.repositoryDisplayName||r.repositoryName||"",n=e||"\0unnamed",a=t.get(n);a?a.worktrees.push(r):t.set(n,{key:n,repository:e,worktrees:[r]})}return[...t.values()]})(eA).map(e=>(0,n.jsx)(d.uB.Group,{heading:e.repository||b("groups.worktrees"),children:e.worktrees.map(t=>{let r=t.branch||t.name;return(0,n.jsxs)(d.uB.Item,{value:"worktree ".concat(e.repository," ").concat(r," ").concat(t.name," ").concat(t.id),onSelect:()=>eb(()=>h.push("/worktrees/".concat(t.id)),{kind:"worktree",id:t.id}),className:J,children:[(0,n.jsx)(C.A,{size:16,className:X,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:r}),(0,n.jsx)(K.m,{status:q(t),size:"sm",className:"ml-auto"})]},t.id)})},e.key)),eE.length>0&&(0,n.jsx)(d.uB.Group,{heading:eM.heading,children:eE.map(e=>{let t=e.worktree.branch||e.worktree.name;return(0,n.jsxs)(d.uB.Item,{"data-testid":"palette-delegate-".concat(e.worktree.id,"-").concat(e.instance.id),value:"/delegate ".concat(e.worktree.id," ").concat(e.instance.id," ").concat(e.instance.alias," ").concat(t),onSelect:()=>eb(()=>{eg(e)}),className:J,children:[(0,n.jsx)(E.A,{size:16,className:X,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:e.instance.alias}),(0,n.jsxs)("span",{className:"ml-auto truncate pl-2 text-xs text-muted-foreground",children:[t," / ",e.instance.id]})]},"".concat(e.worktree.id,":").concat(e.instance.id))})}),(0,n.jsx)(d.uB.Group,{heading:b("groups.actions"),children:eR.map(e=>{let t=e.icon;return(0,n.jsxs)(d.uB.Item,{value:"action ".concat(e.id," ").concat(e.label),onSelect:()=>eb(e.run,{kind:"action",id:e.id}),className:J,children:[(0,n.jsx)(t,{size:16,className:X,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:e.label})]},e.id)})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3 border-t border-border bg-surface-2 px-3 py-2 text-[11px] text-muted-foreground",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(D.u,{children:"↑"}),(0,n.jsx)(D.u,{children:"↓"}),b("footer.navigate")]}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(D.u,{children:"↵"}),b("footer.select")]}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(D.u,{children:"esc"}),b("footer.close")]})]})]})})})]})}),document.body):null}},46892:(e,t,r)=>{r.d(t,{PL:()=>a,sb:()=>s});let n={idle:"bg-muted-foreground",ready:"bg-success",spinner:"border-info",waiting:"bg-warning"},a={idle:{className:n.idle,labelKey:"status.idle",type:"dot"},ready:{className:n.ready,labelKey:"status.ready",type:"dot"},running:{className:n.spinner,labelKey:"status.running",type:"spinner"},waiting:{className:n.waiting,labelKey:"status.waiting",type:"dot"},generating:{className:n.spinner,labelKey:"status.generating",type:"spinner"}},s={idle:"detailStatus.idle",ready:"detailStatus.ready",running:"detailStatus.running",waiting:"detailStatus.waiting"}},68361:(e,t,r)=>{r.d(t,{GV:()=>e0});var n=r(95155),a=r(12115),s=r(20063),o=r(52619),i=r.n(o),l=r(89275);let c=(0,a.forwardRef)(function(e,t){let{href:r,onClick:a,target:o,...c}=e,d=(0,s.usePathname)(),u=(0,l.Hq)();return(0,n.jsx)(i(),{ref:t,href:r,target:o,onClick:e=>{var t;null==a||a(e),e.defaultPrevented||0!==(t=e).button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||void 0!==o&&"_self"!==o||/^([a-z][a-z0-9+.-]*:)?\/\//i.test(r)||/^(mailto:|tel:)/i.test(r)||(e.preventDefault(),r!==d&&u.push(r))},...c})});var d=r(18955),u=r(59847),m=r(86651),f=r(94684),h=r(34681),p=r(32916),x=r(7636);function b(){let e=(0,p.pT)(),t=(0,d.c)("common");if(!e)return null;let{repoTabBarMode:r,setRepoTabBarMode:a}=e;return(0,n.jsxs)("div",{className:"hidden md:flex items-center",children:[(0,n.jsx)("label",{htmlFor:"repo-tab-bar-mode",className:"sr-only",children:t("repoTabBar.settingLabel")}),(0,n.jsx)("select",{id:"repo-tab-bar-mode","data-testid":"repo-tab-bar-mode-select","aria-label":t("repoTabBar.settingLabel"),title:t("repoTabBar.settingLabel"),value:r,onChange:e=>{let t=e.target.value;(0,x.m3)(t)&&a(t)},className:"rounded-md border border-border bg-surface px-2 py-1 text-sm text-muted-foreground transition-colors hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring",children:x.EN.map(e=>(0,n.jsx)("option",{value:e,children:t("repoTabBar.mode.".concat(e))},e))})]})}var g=r(5379),y=r(59427),v=r(37494);function w(){let{theme:e,setTheme:t}=(0,g.D)(),[r,s]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{s(!0)},[]),!r)return(0,n.jsx)("div",{"data-testid":"theme-toggle-placeholder",className:"w-8 h-8","aria-hidden":"true"});let o="dark"===e;return(0,n.jsx)("button",{"data-testid":"theme-toggle",onClick:()=>t(o?"light":"dark"),className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring","aria-label":o?"Switch to light mode":"Switch to dark mode",title:o?"Switch to light mode":"Switch to dark mode",children:o?(0,n.jsx)(y.A,{className:"w-5 h-5","data-testid":"theme-icon-sun"}):(0,n.jsx)(v.A,{className:"w-5 h-5","data-testid":"theme-icon-moon"})})}var j=r(63365);function k(){let{status:e}=(0,j.xM)(),t=(0,d.c)("common");if("connected"===e)return null;let r="connecting"===e,a=t(r?"connection.reconnecting":"connection.offline");return(0,n.jsxs)("span",{"data-testid":"connection-status-indicator",role:"status","aria-live":"polite",title:t(r?"connection.reconnectingTooltip":"connection.offlineTooltip"),className:"hidden sm:inline-flex items-center gap-1.5 rounded-full border border-border bg-surface px-2 py-0.5 text-xs text-muted-foreground",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:["w-1.5 h-1.5 rounded-full",r?"bg-warning motion-safe:animate-pulse":"bg-muted-foreground"].join(" ")}),a]})}var N=r(79651),C=r(92614);let S=[{labelKey:"nav.home",href:"/",isActive:e=>"/"===e},{labelKey:"nav.chat",href:"/chat",isActive:e=>e.startsWith("/chat")},{labelKey:"nav.sessions",href:"/sessions",isActive:e=>e.startsWith("/sessions")},{labelKey:"nav.repositoriesShort",href:"/repositories",isActive:e=>e.startsWith("/repositories")},{labelKey:"nav.reviewReport",href:"/review",isActive:e=>e.startsWith("/review")},{labelKey:"nav.more",href:"/more",isActive:e=>e.startsWith("/more")}];function E(e){let{title:t="CommandMate"}=e,r=(0,s.usePathname)(),o=(0,d.c)("commandPalette"),i=(0,d.c)("common"),{setOpen:l}=(0,C.C)(),[p,x]=a.useState(null);return a.useEffect(()=>{x("undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform||"")?"⌘":"Ctrl")},[]),(0,n.jsx)("header",{className:"sticky top-0 z-50 border-b border-border bg-background supports-[backdrop-filter]:bg-background/80 backdrop-blur-md",children:(0,n.jsx)("div",{className:"container-custom",children:(0,n.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,n.jsx)("div",{className:"flex items-center space-x-4",children:(0,n.jsxs)(c,{href:"/",className:"flex items-center space-x-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)("div",{className:"w-8 h-8 bg-accent-600 rounded-lg flex items-center justify-center",children:(0,n.jsx)(u.A,{size:20,strokeWidth:2,className:"text-white","aria-hidden":"true"})}),(0,n.jsx)("h1",{className:"text-xl font-bold text-foreground",children:t})]})}),(0,n.jsxs)("nav",{className:"flex items-center space-x-6",role:"navigation",children:[S.map(e=>{let t=e.isActive(r);return(0,n.jsx)(c,{href:e.href,"aria-current":t?"page":void 0,className:"relative py-1 text-sm font-medium transition-colors after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:rounded-full after:bg-accent-600 dark:after:bg-accent-400 after:origin-center motion-safe:after:transition-transform after:duration-200 after:ease-[var(--motion-ease-out)] ".concat(t?"text-accent-600 dark:text-accent-400 after:scale-x-100":"text-muted-foreground hover:text-foreground after:scale-x-0"),children:i(e.labelKey)},e.href)}),(0,n.jsxs)("button",{type:"button","data-testid":"header-command-palette-trigger",onClick:()=>l(!0),"aria-label":o("mobileTrigger"),className:"hidden md:inline-flex items-center gap-2 rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-muted-foreground hover:bg-surface-2 transition-colors",children:[(0,n.jsx)(m.A,{size:16,strokeWidth:2,"aria-hidden":"true",className:"shrink-0"}),(0,n.jsx)("span",{children:o("searchAction")}),p&&(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(N.u,{children:p}),(0,n.jsx)(N.u,{children:"K"})]})]}),(0,n.jsx)(k,{}),(0,n.jsx)(h.g,{}),(0,n.jsx)(b,{}),(0,n.jsx)(w,{}),(0,n.jsxs)("a",{href:"https://github.com/kewton/MyCodeBranchDesk",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors flex items-center space-x-1",children:[(0,n.jsx)(f.A,{size:20,strokeWidth:2,"aria-hidden":"true"}),(0,n.jsx)("span",{children:"GitHub"})]})]})]})})})}var M=r(38218);let L={showSidebar:!0,showGlobalNav:!0,showLocalNav:!1,autoCollapseSidebar:!1},A=[{prefix:"/worktrees/",config:{showGlobalNav:!1,showLocalNav:!0}},{prefix:"/sessions",config:{autoCollapseSidebar:!0}}];var R=r(22592),z=r(85710),B=r(17787),P=r(49027),T=r(27587),I=r(39649),K=r(47650),D=r(38606),W=r(48481);let O=(0,a.memo)(function(e){let{status:t,label:r,waitingKind:a}=e;return(0,n.jsx)(W.m,{"data-testid":"status-indicator",status:t,label:r,waitingKind:a,size:"lg"})});function F(e,t,r){let n=r-8-t;return n<=8?8:Math.min(Math.max(e,8),n)}function _(e){let{id:t,branch:r,isVisible:s,anchorRef:o,nextActionLabel:i}=e,[l,c]=(0,a.useState)({top:-9999,left:-9999}),d=(0,a.useRef)(null);if((0,a.useEffect)(()=>{var e,t,r;if(!s||!o.current)return;let n=o.current.getBoundingClientRect(),a=null==(e=d.current)?void 0:e.getBoundingClientRect(),i=null!=(t=null==a?void 0:a.width)?t:0,l=null!=(r=null==a?void 0:a.height)?r:0,u=window.innerWidth,m=window.innerHeight,f=n.right+8;if(f+i>u-8){let e=n.left-8-i;e>=8&&(f=e)}c({top:F(n.top,l,m),left:F(f,i,u)})},[s,o]),"undefined"==typeof document||!s)return null;let u=Math.min(384,Math.max(0,window.innerWidth-16));return K.createPortal((0,n.jsxs)("div",{ref:d,id:t,role:"tooltip",className:" fixed z-[9999] px-3 py-2 rounded-md shadow-lg bg-sidebar text-xs text-sidebar-foreground border border-sidebar-border pointer-events-none max-w-sm transition-opacity duration-150 ",style:{top:l.top,left:l.left,maxWidth:u},children:[(0,n.jsx)("p",{className:"font-medium text-sidebar-foreground whitespace-nowrap",children:r.name}),(0,n.jsx)("p",{className:"text-sidebar-muted whitespace-nowrap",children:r.repositoryName}),(0,n.jsxs)("p",{className:"text-sidebar-muted whitespace-nowrap",children:["Status: ",r.status]}),r.worktreePath&&(0,n.jsx)("p",{className:"text-sidebar-muted truncate",children:r.worktreePath}),i&&(0,n.jsxs)("p",{className:"text-sidebar-muted whitespace-nowrap",children:["Next: ",i]}),r.description&&(0,n.jsx)("p",{className:"text-sidebar-muted mt-1 border-t border-sidebar-border pt-1 whitespace-pre-wrap break-words",children:r.description})]}),document.body)}let H=0,V=(0,a.memo)(function(e){let{branch:t,isSelected:r,onClick:s,showRepositoryName:o=!0}=e,i=(0,d.c)("common"),l=(0,d.c)("worktree"),c="tooltip-".concat(t.id),u=(0,a.useRef)(null),[m,f]=(0,a.useState)(!1),h=(0,a.useRef)(null),p=(0,a.useCallback)(()=>{null!==h.current&&(clearTimeout(h.current),h.current=null)},[]);(0,a.useEffect)(()=>()=>p(),[p]);let x=(0,D.A7)(t.cliStatus),b="waiting"===x,g=!0===t.awaitingInstruction,y=t.nextActionKey?l(t.nextActionKey):null,v=(0,a.useMemo)(()=>{var e;return new Set(null!=(e=t.exitedInstanceIds)?e:[])},[t.exitedInstanceIds]),w=(b||g)&&null!==y,j=m&&!r;return(0,a.useEffect)(()=>{r&&f(!1)},[r]),(0,a.useEffect)(()=>{if(!m)return;let e=()=>f(!1);return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[m]),(0,n.jsxs)("button",{ref:u,"data-testid":"branch-list-item",onClick:()=>{p(),H=Date.now()+400,f(!1),s()},onMouseEnter:()=>{p(),Date.now()>=H&&(h.current=setTimeout(()=>{f(!0)},150))},onMouseLeave:()=>{p(),f(!1)},onFocus:e=>{p(),e.target.matches(":focus-visible")&&(h.current=setTimeout(()=>{f(!0)},150))},onBlur:()=>{p(),f(!1)},"aria-current":r?"true":void 0,"aria-describedby":j?c:void 0,"aria-label":o?void 0:"".concat(t.name," - ").concat(t.repositoryName),className:"\n group relative w-full px-4 py-3 flex flex-col gap-1\n hover:bg-sidebar-hover transition-colors\n focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring\n ".concat(r?"bg-sidebar-hover border-l-2 border-accent-500":"border-l-2 border-transparent","\n "),children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[t.cliStatus&&Object.keys(t.cliStatus).length>0&&(0,n.jsx)("div",{className:"flex items-center justify-center flex-shrink-0 w-4","aria-label":i("branchItem.cliToolStatus"),children:(0,n.jsx)(O,{status:x,label:(0,D.dw)(t.cliStatus,t.cliStatusLabels,v.size>0?e=>v.has(e)?i("branchItem.agentExited"):null:void 0),waitingKind:t.waitingKind})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-sidebar-foreground truncate",children:t.name}),o&&(0,n.jsx)("p",{className:"text-xs text-sidebar-muted truncate",children:t.repositoryName}),w&&(0,n.jsx)("p",{"data-testid":"branch-next-action",className:"text-xs font-medium truncate ".concat(b?"text-warning-foreground":"text-success-foreground"),children:y})]}),g&&(0,n.jsx)("span",{"data-testid":"awaiting-instruction-badge",className:"flex-shrink-0 rounded-full bg-success-subtle px-1.5 py-0.5 text-[10px] font-medium leading-4 text-success-foreground",title:l("awaitingInstruction.label"),children:l("awaitingInstruction.badge")}),t.hasUnread&&(0,n.jsx)("span",{"data-testid":"unread-indicator",className:"w-2 h-2 rounded-full bg-accent-500 flex-shrink-0","aria-label":i("branchItem.hasUnread")})]}),t.description&&(0,n.jsx)("div",{"data-testid":"branch-description",className:"pl-6 pr-2 mt-1 text-left",children:(0,n.jsx)("p",{className:"text-xs text-sidebar-muted line-clamp-2",children:t.description})}),(0,n.jsx)(_,{id:c,branch:t,isVisible:j,anchorRef:u,nextActionLabel:y})]})});var G=r(41898);function q(e,t,r){if(t<=0||r<=0)return 0;let n=e+t+8-r;return n>0?-Math.min(n,Math.max(0,e-8)):e<8?8-e:0}let U=(0,a.memo)(function(e){var t;let{sortKey:r,sortDirection:s,onSortKeyChange:o,onSortDirectionChange:i,options:l,defaultDirections:c,compact:u,tooltip:m,iconClassName:f="w-3 h-3"}=e,h=(0,d.c)("common"),[p,x]=(0,a.useState)(!1),b=(0,a.useRef)(null),g=(0,a.useRef)(null),y=(0,a.useRef)({x:0,y:0}),[v,w]=(0,a.useState)({x:0,y:0});(0,a.useEffect)(()=>{function e(e){b.current&&!b.current.contains(e.target)&&x(!1)}if(p)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[p]),(0,a.useEffect)(()=>{function e(e){"Escape"===e.key&&x(!1)}if(p)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[p]),(0,a.useLayoutEffect)(()=>{let e=e=>{y.current=e,w(t=>t.x===e.x&&t.y===e.y?t:e)};if(!p)return void e({x:0,y:0});let t=g.current;if(!t)return;let r=t.getBoundingClientRect();e({x:q(r.left-y.current.x,r.width,window.innerWidth),y:q(r.top-y.current.y,r.height,window.innerHeight)})},[p]);let j=(0,a.useCallback)(()=>{x(e=>!e)},[]),k=(0,a.useCallback)(e=>{if(e===r)i("asc"===s?"desc":"asc");else{var t;o(e),i(null!=(t=null==c?void 0:c[e])?t:"asc")}x(!1)},[r,s,o,i,c]),N=(0,a.useCallback)(()=>{i("asc"===s?"desc":"asc")},[s,i]),C=(null==(t=l.find(e=>e.key===r))?void 0:t.label)||"Sort",S=(0,n.jsxs)("button",{type:"button",onClick:j,"aria-expanded":p,"aria-haspopup":"listbox","aria-label":"Sort by ".concat(C),className:" flex items-center gap-1 px-2 py-1 rounded text-xs text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors ",children:[(0,n.jsx)(J,{className:f}),(0,n.jsx)("span",{className:u?"hidden":"hidden sm:inline",children:C})]});return(0,n.jsxs)("div",{ref:b,className:"relative","data-testid":"sort-selector-base",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[m?(0,n.jsx)(G.m_,{content:m,placement:"bottom",children:S}):S,(0,n.jsx)("button",{type:"button",onClick:N,"aria-label":"asc"===s?"Sort ascending":"Sort descending",className:" p-1 rounded text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors ",children:"asc"===s?(0,n.jsx)(X,{className:f}):(0,n.jsx)(Y,{className:f})})]}),p&&(0,n.jsx)("div",{ref:g,role:"listbox","aria-label":h("sort.options"),className:" absolute right-0 top-full mt-1 z-50 min-w-[140px] py-1 rounded-md shadow-lg bg-sidebar border border-sidebar-border ",style:0!==v.x||0!==v.y?{transform:"translate(".concat(v.x,"px, ").concat(v.y,"px)")}:void 0,children:l.map(e=>(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":r===e.key,onClick:()=>k(e.key),className:"\n w-full px-3 py-2 text-left text-sm\n flex items-center justify-between\n hover:bg-sidebar-hover transition-colors\n ".concat(r===e.key?"text-accent-700 dark:text-accent-400":"text-sidebar-muted","\n "),children:[(0,n.jsx)("span",{children:e.label}),r===e.key&&(0,n.jsx)("span",{className:"text-xs",children:"asc"===s?"ASC":"DESC"})]},e.key))})]})});function J(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"})})}function X(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}function Y(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}let $=[{key:"updatedAt",labelKey:"sort.updatedAt"},{key:"repositoryName",labelKey:"sort.repositoryName"},{key:"branchName",labelKey:"sort.branchName"},{key:"status",labelKey:"sort.status"}],Z={updatedAt:"desc"},Q=(0,a.memo)(function(){let{sortKey:e,sortDirection:t,setSortKey:r,setSortDirection:s}=(0,p.VF)(),o=(0,d.c)("common"),i=(0,a.useMemo)(()=>$.map(e=>{let{key:t,labelKey:r}=e;return{key:t,label:o(r)}}),[o]);return(0,n.jsx)(U,{sortKey:e,sortDirection:t,onSortKeyChange:r,onSortDirectionChange:s,options:i,defaultDirections:Z,compact:!0,tooltip:o("tooltips.sort"),iconClassName:"w-4 h-4"})});var ee=r(28019),et=r(30061),er=r(45195),en=r(26020);function ea(){let{currentLocale:e,switchLocale:t}=(0,er.g)(),r=(0,d.c)("common");return(0,n.jsx)("select",{value:e,onChange:e=>t(e.target.value),"data-testid":"locale-switcher","aria-label":r("language"),className:" w-full px-3 py-2 rounded-md bg-sidebar text-sidebar-foreground border border-sidebar-border focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent text-sm ",children:en.dI.map(e=>(0,n.jsx)("option",{value:e,children:en.vK[e]},e))})}var es=r(65380);function eo(){let e=(0,d.c)("auth"),t=(0,es.H)(),[r,s]=(0,a.useState)(!1);if(!t)return null;async function o(){s(!0);try{await fetch("/api/auth/logout",{method:"POST"}),window.location.href="/login"}catch(e){window.location.href="/login"}}return(0,n.jsx)("button",{type:"button",onClick:o,disabled:r,"data-testid":"logout-button",className:" w-full px-3 py-2 text-sm text-left rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50 transition-colors ",children:r?"...":e("logout.button")})}var ei=r(94442),el=r(44308),ec=r(24373);function ed(){let e=(0,d.c)("common"),{count:t}=(0,ec.Lv)();return 0===t?null:(0,n.jsxs)(i(),{href:el.ks,"data-testid":"attention-badge","aria-label":e("attention.badgeLabel",{count:t}),className:"mt-2 inline-flex w-full items-center justify-between gap-2 rounded-md border border-warning-border bg-warning-subtle px-2 py-1 text-xs font-medium text-warning-foreground transition-colors hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,n.jsx)("span",{className:"min-w-0 truncate",children:e("attention.label")}),(0,n.jsx)("span",{"data-testid":"attention-badge-count",className:"tabular-nums font-semibold",children:t})]})}function eu(e){let{count:t}=e,r=(0,d.c)("common");return 0===t?null:(0,n.jsx)("span",{"data-testid":"attention-badge-bubble",role:"status","aria-label":r("attention.badgeLabel",{count:t}),className:"absolute -top-1.5 -right-2.5 min-w-[1.05rem] rounded-full bg-warning-foreground px-1 text-[0.625rem] font-bold leading-[1.05rem] text-warning-subtle tabular-nums text-center",children:t>99?"99+":t})}var em=r(80344);function ef(e){let{items:t,sortKey:r,sortDirection:n,viewMode:s,filterText:o}=e,i=(0,a.useMemo)(()=>{if(!o)return t;let e=o.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e)||t.repositoryName.toLowerCase().includes(e))},[t,o]);return{sortedItems:(0,a.useMemo)(()=>(0,x.Xn)(i,r,n),[i,r,n]),groupedItems:(0,a.useMemo)(()=>"grouped"===s?(0,x._s)(i,r,n):[],[i,r,n,s])}}let eh="mcbd-sidebar-group-collapsed",ep="mcbd-sidebar-scroll-top",ex="w-4 h-4",eb=0,eg=(0,a.memo)(function(){var e,t;let r=(0,l.Hq)(),{worktrees:s,repositories:o,selectedWorktreeId:c,selectWorktree:u,refreshWorktrees:m,isLoading:f,error:h}=(0,I.$f)(),{closeMobileDrawer:b,sortKey:g,sortDirection:y,viewMode:v,setViewMode:j,repositoryOrder:k,setRepositoryOrder:N}=(0,p.VF)(),C=(0,d.c)("common"),[S,E]=(0,a.useState)(""),M=(0,a.useRef)(null),[L,A]=(0,a.useState)(()=>{try{let e=localStorage.getItem(eh);return e?function(e){try{let t=JSON.parse(e);if("object"!=typeof t||null===t||Array.isArray(t))return{};let r={},n=0;for(let[e,a]of Object.entries(t))if(!ew.has(e)&&"boolean"==typeof a){if(++n>100)break;r[e]=a}return r}catch(e){return{}}}(e):{}}catch(e){return{}}}),R=(0,a.useRef)(!1);(0,a.useEffect)(()=>{R.current||(R.current=!0,fetch("/api/sidebar/group-order").then(e=>e.json()).then(e=>{e.success&&Array.isArray(e.order)&&N(e.order)}).catch(()=>{}))},[N]);let T=(0,a.useMemo)(()=>(0,x.UZ)(o),[o]),K=(0,a.useMemo)(()=>(0,x.s6)(s,T),[s,T]),W=(0,a.useMemo)(()=>K.map(D.XK),[K]),O=(0,a.useDeferredValue)(W),F=(0,a.useRef)(null),_=(0,a.useRef)(null),[H,q]=(0,a.useState)(0);(0,a.useEffect)(()=>()=>{null!==_.current&&clearTimeout(_.current)},[]);let U=(0,a.useCallback)(()=>{null!==_.current&&(clearTimeout(_.current),_.current=null),F.current=null},[]),J=(0,a.useMemo)(()=>{let e=F.current;return!e||0===e.items.length||Date.now()>=e.expiresAt?O:e.items},[O,H]),X=(0,a.useRef)(J);(0,a.useLayoutEffect)(()=>{X.current=J;let e=F.current;e&&0===e.items.length&&O.length>0&&U()});let Y=(0,a.useCallback)(()=>{if(0===X.current.length)return;null!==_.current&&(clearTimeout(_.current),_.current=null);let e=F.current;if(e&&Date.now()<e.expiresAt){F.current={...e,expiresAt:1/0};return}F.current={items:X.current,expiresAt:1/0}},[]),$=(0,a.useCallback)(()=>{F.current&&(F.current={...F.current,expiresAt:Date.now()+1e3},null!==_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{U(),q(e=>e+1)},1e3))},[U]),{sortedItems:Z,groupedItems:et}=ef({items:J,sortKey:g,sortDirection:y,viewMode:v,filterText:S}),er=(0,a.useMemo)(()=>"grouped"===v&&et?S.trim()?et:(0,x.BN)(et,k):null,[v,et,k,S]),en="grouped"===v?er:null;(0,a.useEffect)(()=>{try{localStorage.setItem(eh,JSON.stringify(L))}catch(e){}},[L]);let es=(0,a.useCallback)(e=>{A(t=>({...t,[e]:!t[e]}))},[]),ei=(0,a.useCallback)(()=>{var e,t,r=null!=(t=null==(e=M.current)?void 0:e.scrollTop)?t:0;let n=Number.isFinite(r)&&r>0?r:0;eb=n;try{localStorage.setItem(ep,String(n))}catch(e){}},[]),el=Z.length>0||(null!=(e=null==en?void 0:en.length)?e:0)>0;(0,a.useEffect)(()=>{let e=M.current;if(!e)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=function(){try{let e=localStorage.getItem(ep);if(!e)return eb=0,0;let t=Number(e);Number.isFinite(t)&&t>=0&&(eb=t)}catch(e){}return eb}()});return()=>{window.cancelAnimationFrame(t)}},[el,v]);let ec=(0,a.useCallback)(e=>{ei(),u(e),r.push("/worktrees/".concat(e)),b()},[ei,u,r,b]),eu=(0,B.FR)((0,B.MS)(B.AN,{activationConstraint:{distance:8}})),em=(0,a.useCallback)(e=>{let{active:t,over:r}=e;if(!r||t.id===r.id||!en)return;let n=en.map(e=>e.repositoryName),a=n.indexOf(String(t.id)),s=n.indexOf(String(r.id));if(-1===a||-1===s)return;let o=(0,P.be)(n,a,s);N(o),fetch("/api/sidebar/group-order",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:o})}).catch(()=>{N(n)})},[en,N]),eg="flat"===v?0===Z.length:(null!=(t=null==en?void 0:en.length)?t:0)===0,ej=f&&0===s.length,eN=!ej&&!!h&&0===s.length,eC=(0,a.useCallback)(()=>{m()},[m]);return(0,n.jsxs)("nav",{"data-testid":"sidebar","aria-label":C("sidebar.branchNavigation"),className:"h-full flex flex-col bg-sidebar text-sidebar-foreground",role:"navigation",children:[(0,n.jsxs)("div",{"data-testid":"sidebar-header",className:"flex-shrink-0 px-4 py-4 border-b border-sidebar-border",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-y-2",children:[(0,n.jsx)("h2",{className:"min-w-0 truncate text-lg font-semibold text-sidebar-foreground",children:C("sidebar.branches")}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,n.jsx)(ek,{viewMode:v,onToggle:j}),(0,n.jsx)(Q,{}),(0,n.jsx)(eM,{refreshWorktrees:m}),(0,n.jsx)(G.m_,{content:C("tooltips.repositories"),placement:"bottom",children:(0,n.jsx)(i(),{href:"/repositories","aria-label":C("nav.repositories"),className:"p-1 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors inline-flex items-center",children:(0,n.jsx)(z.A,{className:ex,"aria-hidden":"true"})})})]})]}),(0,n.jsx)(ed,{})]}),(0,n.jsx)("div",{className:"flex-shrink-0 px-4 py-3 border-b border-sidebar-border",children:(0,n.jsx)(ee.pd,{type:"text",placeholder:C("sidebar.searchBranches"),value:S,onChange:e=>E(e.target.value),className:"bg-background shadow-none"})}),(0,n.jsx)("div",{ref:M,"data-testid":"branch-list",onScroll:ei,onMouseEnter:Y,onMouseLeave:$,className:"flex-1 overflow-y-auto overflow-x-hidden",children:ej?(0,n.jsx)(ey,{label:C("sidebar.loadingBranches")}):eN?(0,n.jsxs)("div",{"data-testid":"branch-list-error",role:"alert",className:"px-4 py-8 text-center text-sidebar-muted",children:[(0,n.jsx)("p",{className:"text-sm",children:C("sidebar.branchesLoadFailed")}),(0,n.jsx)(ee.$n,{type:"button",variant:"secondary",size:"sm",className:"mt-3","data-testid":"branch-list-retry",onClick:eC,children:C("sidebar.retryLoadBranches")})]}):eg?(0,n.jsx)("div",{className:"px-4 py-8 text-center text-sidebar-muted",children:C(S?"sidebar.noBranchesFound":"sidebar.noBranchesAvailable")}):"grouped"===v&&en?(0,n.jsx)(B.Mp,{sensors:eu,collisionDetection:B.fp,onDragEnd:em,children:(0,n.jsx)(P.gB,{items:en.map(e=>e.repositoryName),strategy:P._G,children:en.map(e=>{let t=!L[e.repositoryName]||!!S.trim();return(0,n.jsx)(ev,{group:e,isExpanded:t,selectedWorktreeId:c,onToggle:()=>es(e.repositoryName),onBranchClick:ec,isDragDisabled:!!S.trim()},e.repositoryName)})})}):Z.map(e=>(0,n.jsx)(V,{branch:e,isSelected:e.id===c,onClick:()=>ec(e.id)},e.id))}),(0,n.jsxs)("div",{className:"flex-shrink-0 px-4 py-3 border-t border-sidebar-border space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(ea,{})}),(0,n.jsx)(w,{})]}),(0,n.jsx)(eo,{})]})]})}),ey=(0,a.memo)(function(e){let{label:t}=e;return(0,n.jsxs)("div",{"data-testid":"branch-list-skeleton",role:"status","aria-live":"polite",className:"px-4 py-3 space-y-3",children:[(0,n.jsx)("span",{className:"sr-only",children:t}),[0,1,2,3,4].map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ee.EA,{className:"h-2 w-2 rounded-full"}),(0,n.jsx)(ee.EA,{className:"h-3 flex-1"})]},e))]})});function ev(e){let{group:t,isExpanded:r,selectedWorktreeId:a,onToggle:s,onBranchClick:o,isDragDisabled:i}=e,{attributes:l,listeners:c,setNodeRef:d,setActivatorNodeRef:u,transform:m,transition:f,isDragging:h}=(0,P.gl)({id:t.repositoryName,disabled:i}),p={transform:T.Ks.Transform.toString(m),transition:f,opacity:h?.5:1};return(0,n.jsxs)("div",{ref:d,style:p,className:"w-full min-w-0",children:[(0,n.jsx)(ej,{repositoryName:t.repositoryName,branchCount:t.branches.length,isExpanded:r,onClick:s,dragHandleRef:u,dragHandleListeners:i?void 0:c,dragHandleAttributes:i?void 0:l}),r&&t.branches.map(e=>(0,n.jsx)(V,{branch:e,isSelected:e.id===a,onClick:()=>o(e.id),showRepositoryName:!1},e.id))]})}let ew=new Set(["__proto__","constructor","prototype"]);function ej(e){let{repositoryName:t,branchCount:r,isExpanded:a,onClick:s,dragHandleRef:o,dragHandleListeners:i,dragHandleAttributes:l}=e,c=(0,d.c)("common");return(0,n.jsxs)("div",{className:"flex items-center w-full",children:[i&&(0,n.jsx)("div",{ref:o,...i,...l,"aria-label":c("sidebar.dragToReorderGroup"),className:" flex-shrink-0 flex items-center justify-center w-6 h-full pl-2 cursor-grab active:cursor-grabbing text-sidebar-muted hover:text-sidebar-foreground transition-colors ",children:(0,n.jsx)(eS,{})}),(0,n.jsxs)("button",{"data-testid":"group-header",type:"button",onClick:s,"aria-expanded":a,className:" flex-1 min-w-0 flex items-center gap-2 px-2 py-2 text-xs font-semibold text-sidebar-muted uppercase tracking-wider focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring transition-colors ",children:[(0,n.jsx)(eN,{isExpanded:a}),(0,n.jsx)(ee.nF,{color:(0,x.LV)(t)}),(0,n.jsx)(et.nR,{content:t,className:"flex-1 min-w-0 text-left truncate",children:t}),(0,n.jsx)("span",{className:"text-sidebar-muted font-normal tabular-nums pr-2",children:r})]})]})}function ek(e){let{viewMode:t,onToggle:r}=e,a=(0,d.c)("common");return(0,n.jsx)(G.m_,{content:a("tooltips.viewMode"),placement:"bottom",children:(0,n.jsx)("button",{"data-testid":"view-mode-toggle",type:"button",onClick:()=>{r("grouped"===t?"flat":"grouped")},"aria-label":a("grouped"===t?"sidebar.switchToFlatView":"sidebar.switchToGroupedView"),className:" p-1 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors ",children:"grouped"===t?(0,n.jsx)(eC,{className:ex}):(0,n.jsx)(ee.nF,{className:ex})})})}function eN(e){let{isExpanded:t}=e;return(0,n.jsx)("svg",{className:"w-3 h-3 flex-shrink-0 transition-transform ".concat(t?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})}function eC(e){let{className:t="w-3 h-3"}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})}function eS(){return(0,n.jsxs)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,n.jsx)("circle",{cx:"9",cy:"5",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"5",r:"1.5"}),(0,n.jsx)("circle",{cx:"9",cy:"12",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"12",r:"1.5"}),(0,n.jsx)("circle",{cx:"9",cy:"19",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"19",r:"1.5"})]})}function eE(e){let{className:t=""}=e;return(0,n.jsx)("svg",{className:"".concat(ex," ").concat(t),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20.49 9A9 9 0 005.64 5.64L4 4m16 16l-1.64-1.64A9 9 0 014.51 15"})})}let eM=(0,a.memo)(function(e){let{refreshWorktrees:t}=e,[r,s]=(0,a.useState)(!1),o=(0,a.useRef)(!1),{showToast:i}=(0,ei.dj)(),l=(0,d.c)("common"),c=(0,a.useCallback)(async()=>{if(!o.current){o.current=!0,s(!0);try{let e=await em.Rx.sync();await t(),i(l("syncSuccess",{count:e.worktreeCount}),"success",3e3)}catch(e){e instanceof em.hD&&401===e.status?i(l("syncAuthError"),"error",5e3):i(l("syncError"),"error",5e3)}finally{o.current=!1,s(!1)}}},[t,i,l]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(G.m_,{content:l("tooltips.sync"),placement:"bottom",children:(0,n.jsx)("button",{type:"button",onClick:c,disabled:r,"aria-label":l("syncButtonLabel"),className:"p-1 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:(0,n.jsx)(eE,{className:r?"animate-spin":""})})})})});var eL=r(37772),eA=r(17848),eR=r(46892),ez=r(59854);let eB=/^\/worktrees\/([^/]+)/;function eP(e,t,r){let n=r-8-t;return n<=8?8:Math.min(Math.max(e.left+t>r-8?e.right-t:e.left,8),n)}function eT(e){var t;null==e||null==(t=e.scrollIntoView)||t.call(e,{block:"nearest",inline:"nearest"})}let eI=(0,a.memo)(function(){var e;let t=(0,d.c)("common"),r=(0,s.usePathname)(),o=(0,l.Hq)(),{sortKey:i,sortDirection:c,repositoryOrder:u}=(0,p.VF)(),{worktrees:m,repositories:f,selectedWorktreeId:h,selectWorktree:b}=(0,I.$f)(),{factor:g}=(0,R.Ps)(),y=(0,a.useMemo)(()=>(0,x.UZ)(null!=f?f:[]),[f]),v=(0,a.useMemo)(()=>(0,x.s6)(null!=m?m:[],y),[m,y]),{groupedItems:w}=ef({items:(0,a.useMemo)(()=>v.map(D.XK),[v]),sortKey:i,sortDirection:c,viewMode:"grouped"}),j=(0,a.useMemo)(()=>(0,x.BN)(w,u),[w,u]),k=function(e,t){let r=eB.exec(e);if(!r)return t;try{return decodeURIComponent(r[1])}catch(e){return r[1]}}(r,h),N=(0,a.useMemo)(()=>{var e,t;return null!=(t=null==(e=j.find(e=>e.branches.some(e=>e.id===k)))?void 0:e.repositoryName)?t:null},[j,k]),[C,S]=(0,a.useState)(null),[E,M]=(0,a.useState)(null),[L,A]=(0,a.useState)(!1),z=(0,a.useRef)(null),B=(0,a.useRef)(null),P=(0,a.useRef)(new Map),T=(0,a.useCallback)((e,t)=>{t?P.current.set(e,t):P.current.delete(e)},[]),K=(0,a.useCallback)(()=>{S(null),M(null),A(!1)},[]),W=(0,a.useCallback)(e=>{let t=P.current.get(e);if(!t)return;let r=t.getBoundingClientRect();M({left:r.left,right:r.right,bottom:r.bottom}),S(e),A(!1)},[]),O=(0,a.useCallback)(e=>{if(C===e)return void K();W(e)},[C,K,W]),[F,_]=(0,a.useState)(!1),H=(0,a.useCallback)(()=>{let e=z.current;e&&_(e.scrollWidth>e.clientWidth+1)},[]);(0,a.useLayoutEffect)(()=>{H()},[H,j.length,g]),(0,a.useEffect)(()=>{window.addEventListener("resize",H);let e="undefined"!=typeof ResizeObserver?new ResizeObserver(()=>H()):null;return e&&z.current&&e.observe(z.current),()=>{window.removeEventListener("resize",H),null==e||e.disconnect()}},[H]);let V=null!==C||L;(0,a.useEffect)(()=>{if(!V)return;let e=e=>{var t,r,n;let a=e.target;!(!a||(null==(t=z.current)?void 0:t.contains(a))||(null==(r=B.current)?void 0:r.contains(a)))&&((null==(n=a.closest)?void 0:n.call(a,"[data-repository-tab-panel]"))||K())},t=e=>{if("Escape"!==e.key)return;let t=C?P.current.get(C):B.current;K(),null==t||t.focus()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[V,C,K]),(0,a.useEffect)(()=>{K()},[r,K]),(0,a.useLayoutEffect)(()=>{N&&eT(P.current.get(N))},[N,r,F]);let G=(0,a.useCallback)(e=>{K(),b(e),o.push("/worktrees/".concat(e))},[K,b,o]),q=(0,a.useCallback)(e=>{let t=P.current.get(e);eT(t),W(e),null==t||t.focus()},[W]),U=(0,a.useCallback)(e=>{var t;let r=e.currentTarget,n=(t=r.clientWidth,e.ctrlKey||e.shiftKey||Math.abs(e.deltaY)<=Math.abs(e.deltaX)?0:1===e.deltaMode?40*e.deltaY:2===e.deltaMode?e.deltaY*t:e.deltaY);0!==n&&(r.scrollLeft+=n)},[]);if(0===j.length)return null;let J=Math.round(32*g),X=null!=(e=j.find(e=>e.repositoryName===C))?e:null;return(0,n.jsxs)("div",{"data-testid":"repository-tab-bar",className:"relative flex-shrink-0 flex items-stretch border-b border-border bg-surface",style:{height:"".concat(J,"px")},children:[(0,n.jsx)("nav",{ref:z,"data-testid":"repository-tab-strip","aria-label":t("nav.repositories"),onWheel:U,className:"flex min-w-0 flex-1 flex-nowrap items-stretch overflow-x-auto overflow-y-hidden scrollbar-hide",children:j.map(e=>(0,n.jsx)(eK,{group:e,isActive:e.repositoryName===N,isOpen:e.repositoryName===C,registerTab:T,onToggle:O},e.repositoryName))}),F&&(0,n.jsx)("button",{ref:B,type:"button","data-testid":"repository-tab-overflow","aria-haspopup":"menu","aria-expanded":L,"aria-label":t("nav.more"),title:t("nav.more"),onClick:()=>{S(null),M(null),A(e=>!e)},className:"flex-shrink-0 flex items-center border-l border-border px-2 text-muted-foreground transition-colors hover:bg-surface-2 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:(0,n.jsx)(eL.A,{size:16,strokeWidth:2,"aria-hidden":"true"})}),X&&E&&(0,n.jsx)(eD,{group:X,anchor:E,factor:g,activeWorktreeId:k,onBranchClick:G}),L&&(0,n.jsx)(eW,{groups:j,anchorRef:B,activeRepositoryName:N,onSelect:q})]})}),eK=(0,a.memo)(function(e){let{group:t,isActive:r,isOpen:a,registerTab:s,onToggle:o}=e,i=(0,d.c)("common"),l=(0,x.zD)(t.branches),c=(0,x.j)(t.branches),u=i(eR.PL[l].labelKey);return(0,n.jsxs)("button",{ref:e=>s(t.repositoryName,e),type:"button","data-testid":"repository-tab","data-repository":t.repositoryName,"aria-haspopup":"menu","aria-expanded":a,"aria-current":r?"true":void 0,title:"".concat(t.repositoryName," — ").concat(u),onClick:()=>o(t.repositoryName),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),a||o(t.repositoryName))},className:"\n group/tab flex-shrink-0 flex max-w-[14rem] items-center gap-1.5 px-2.5\n border-b-2 text-xs font-medium transition-colors\n focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\n ".concat(r?"border-accent-500 bg-surface-2 text-foreground":"border-transparent text-muted-foreground hover:bg-surface-2 hover:text-foreground","\n "),children:[(0,n.jsx)(eA.n,{className:"h-3.5 w-3.5",color:(0,x.LV)(t.repositoryName)}),(0,n.jsx)("span",{className:"min-w-0 truncate",children:t.repositoryName}),(0,n.jsx)(W.m,{status:l,size:"sm",label:u,"data-testid":"repository-tab-status"}),c>0&&(0,n.jsx)("span",{"data-testid":"repository-tab-attention-count","aria-label":i("attention.badgeLabel",{count:c}),className:"flex-shrink-0 rounded-full bg-warning-subtle px-1.5 text-[10px] font-semibold leading-4 tabular-nums text-warning-foreground",children:c})]})});function eD(e){let{group:t,anchor:r,factor:s,activeWorktreeId:o,onBranchClick:i}=e,l=(0,d.c)("common"),c=(0,a.useRef)(null);if((0,a.useEffect)(()=>{var e;let t=null==(e=c.current)?void 0:e.querySelector("button");null==t||t.focus()},[t.repositoryName]),"undefined"==typeof document)return null;let u=Math.round(300*s),m=window.innerWidth;return K.createPortal((0,n.jsx)("div",{ref:c,"data-repository-tab-panel":"","data-testid":"repository-tab-popover","data-repository":t.repositoryName,role:"menu","aria-label":l("sidebar.branchNavigation"),className:"fixed rounded-md border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-lg",style:{top:r.bottom+4,left:eP(r,u,m),width:u,zIndex:ez.M.POPOVER},children:(0,n.jsx)("div",{"data-testid":"repository-tab-popover-list",className:"overflow-y-auto overflow-x-hidden py-1",style:{maxHeight:"".concat(Math.round(520*s),"px")},children:0===t.branches.length?(0,n.jsx)("p",{className:"px-4 py-6 text-center text-sm text-sidebar-muted",children:l("sidebar.noBranchesAvailable")}):t.branches.map(e=>(0,n.jsx)(V,{branch:e,isSelected:e.id===o,onClick:()=>i(e.id),showRepositoryName:!1},e.id))})}),document.body)}function eW(e){var t;let{groups:r,anchorRef:a,activeRepositoryName:s,onSelect:o}=e,i=(0,d.c)("common"),l=null==(t=a.current)?void 0:t.getBoundingClientRect();if("undefined"==typeof document||!l)return null;let c=window.innerWidth;return K.createPortal((0,n.jsx)("div",{"data-repository-tab-panel":"","data-testid":"repository-tab-overflow-menu",role:"menu","aria-label":i("nav.repositories"),className:"fixed rounded-md border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-lg",style:{top:l.bottom+4,left:eP({left:l.left,right:l.right,bottom:l.bottom},300,c),width:300,maxHeight:"".concat(520,"px"),zIndex:ez.M.POPOVER},children:(0,n.jsx)("div",{className:"overflow-y-auto py-1",style:{maxHeight:"inherit"},children:r.map(e=>{let t=(0,x.zD)(e.branches);return(0,n.jsxs)("button",{type:"button",role:"menuitem","data-testid":"repository-tab-overflow-item","data-repository":e.repositoryName,"aria-current":e.repositoryName===s?"true":void 0,onClick:()=>o(e.repositoryName),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-sidebar-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,n.jsx)(eA.n,{className:"h-3.5 w-3.5",color:(0,x.LV)(e.repositoryName)}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.repositoryName}),(0,n.jsx)(W.m,{status:t,size:"sm",label:i(eR.PL[t].labelKey)}),(0,n.jsx)("span",{className:"tabular-nums text-xs text-sidebar-muted",children:e.branches.length})]},e.repositoryName)})})}),document.body)}var eO=r(65993),eF=r(37586),e_=r(66685),eH=r(61362);let eV=[{labelKey:"nav.home",href:"/",isActive:e=>"/"===e,icon:(0,n.jsx)(eO.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.chat",href:"/chat",isActive:e=>e.startsWith("/chat"),icon:(0,n.jsx)(eF.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.sessions",href:"/sessions",isActive:e=>e.startsWith("/sessions"),icon:(0,n.jsx)(e_.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.review",href:"/review",isActive:e=>e.startsWith("/review"),icon:(0,n.jsx)(eH.A,{size:20,"aria-hidden":"true"}),showsAttentionBadge:!0},{labelKey:"nav.more",href:"/more",isActive:e=>e.startsWith("/more"),icon:(0,n.jsx)(eL.A,{size:20,"aria-hidden":"true"})}];function eG(){let e=(0,s.usePathname)(),{setOpen:t}=(0,C.C)(),r=(0,d.c)("commandPalette"),a=(0,d.c)("common"),{count:o}=(0,ec.Lv)();return(0,n.jsx)("nav",{"data-testid":"global-mobile-nav",className:"fixed bottom-0 left-0 right-0 z-50 border-t border-border bg-background supports-[backdrop-filter]:bg-background/80 backdrop-blur-md pb-safe",children:(0,n.jsxs)("div",{className:"flex items-center justify-around h-14",children:[eV.map(t=>{let r=t.isActive(e),s=!0===t.showsAttentionBadge&&o>0;return(0,n.jsxs)(c,{href:s?el.ks:t.href,className:"flex flex-col items-center justify-center flex-1 h-full text-xs transition-colors ".concat(r?"text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),children:[(0,n.jsxs)("span",{className:"relative inline-flex",children:[t.icon,!0===t.showsAttentionBadge&&(0,n.jsx)(eu,{count:o})]}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:a(t.labelKey)})]},t.href)}),(0,n.jsxs)("button",{type:"button","data-testid":"mobile-command-palette-trigger",onClick:()=>t(!0),"aria-label":r("mobileTrigger"),className:"flex flex-col items-center justify-center flex-1 h-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(m.A,{size:20,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:r("mobileLabel")})]})]})})}var eq=r(45573),eU=r(94465),eJ=r(70628);let eX=["global","terminal","composer","editor"],eY=[{id:"commandPalette",keys:["MOD","K"],scope:"global"},{id:"keyboardHelp",keys:["?"],scope:"global"},{id:"closeOverlay",keys:["Esc"],scope:"global"},{id:"navigateList",keys:["↑","↓"],scope:"global"},{id:"terminalSearch",keys:["MOD","F"],scope:"terminal"},{id:"toggleSurfaceMode",keys:["MOD","Shift","M"],scope:"terminal"},{id:"sendMessage",keys:["↵"],scope:"composer"},{id:"composerNewline",keys:["Shift","↵"],scope:"composer"},{id:"editorIndent",keys:["Tab"],scope:"editor"},{id:"editorOutdent",keys:["Shift","Tab"],scope:"editor"},{id:"editorTabFocus",keys:["Ctrl","M"],scope:"editor"},{id:"editorSave",keys:["MOD","S"],scope:"editor"},{id:"editorFullscreen",keys:["MOD","Shift","F"],scope:"editor"}];function e$(){let{open:e,setOpen:t}=(0,eJ.K)(),{open:r}=(0,C.C)(),s=(0,d.c)("keyboardShortcuts"),[o,i]=(0,a.useState)(!1);(0,a.useEffect)(()=>i(function(){if("undefined"==typeof navigator)return!1;let e=navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)}()),[]);let l=(0,a.useRef)(e);(0,a.useEffect)(()=>{l.current=e},[e]);let c=(0,a.useRef)(r);(0,a.useEffect)(()=>{c.current=r},[r]),(0,a.useEffect)(()=>{function e(e){"?"!==e.key||e.isComposing||229===e.keyCode||(0,eq.tJ)(e.target)||c.current||l.current||(e.preventDefault(),t(!0))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eY;return eX.map(t=>({scope:t,shortcuts:e.filter(e=>e.scope===t)})).filter(e=>e.shortcuts.length>0)}();return(0,n.jsx)(eU.a,{isOpen:e,onClose:()=>t(!1),title:s("title"),size:"md",children:(0,n.jsx)("div",{"data-testid":"keyboard-shortcuts-overlay",className:"space-y-6",children:u.map(e=>{let{scope:t,shortcuts:r}=e;return(0,n.jsxs)("section",{"data-testid":"keyboard-shortcuts-scope-".concat(t),children:[(0,n.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s("scopes.".concat(t))}),(0,n.jsx)("ul",{className:"divide-y divide-border",children:r.map(e=>(0,n.jsxs)("li",{"data-testid":"keyboard-shortcut-".concat(e.id),className:"flex items-center justify-between gap-4 py-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:s("shortcuts.".concat(e.id))}),(0,n.jsx)("span",{className:"flex flex-shrink-0 items-center gap-1",children:e.keys.map((e,t)=>(0,n.jsx)(N.u,{children:"MOD"===e?o?"⌘":"Ctrl":e},t))})]},e.id))})]},t)})})})}var eZ=r(77016);let eQ="transform transition-transform duration-300 ease-out",e0=(0,a.memo)(function(e){let{children:t}=e,{isOpen:r,isMobileDrawerOpen:o,closeMobileDrawer:i,width:l,setWidth:c,repoTabBarMode:d}=(0,p.VF)(),u=(0,M.a)(),{showSidebar:m,showGlobalNav:f}=function(){var e=(0,s.usePathname)();for(let t of A)if(e.startsWith(t.prefix))return{...L,...t.config};return{...L}}(),{factor:h}=(0,R.Ps)(),b=Math.round(160*h),g=Math.round(480*h),y=Math.round(Math.min(g,Math.max(b,l*h))),v=(0,x.fs)(null!=d?d:x.PB,r),w=Math.round(32*h)+64*!!f,j=(0,a.useRef)(null),k=(0,a.useRef)(null),N=(0,a.useCallback)(e=>{c(Math.round(e/h))},[c,h]);return u?(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[o&&(0,n.jsx)("div",{"data-testid":"drawer-overlay",className:"fixed inset-0 bg-black/50 z-40",onClick:i,"aria-hidden":"true"}),m&&(0,n.jsx)("aside",{"data-testid":"sidebar-container",className:"\n fixed left-0 top-0 h-full w-72 z-50\n ".concat(eQ,"\n ").concat(o?"translate-x-0":"-translate-x-full","\n "),role:"complementary",children:(0,n.jsx)(eg,{})}),(0,n.jsx)("main",{className:"flex-1 min-h-0 overflow-hidden ".concat(f?"pb-14":""),role:"main","data-view-transition":"content",children:t}),f&&(0,n.jsx)(eG,{}),(0,n.jsx)(eq.xq,{}),(0,n.jsx)(e$,{}),(0,n.jsx)(eZ.n,{})]}):(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[v&&(0,n.jsx)(eI,{}),f&&(0,n.jsx)(E,{}),(0,n.jsxs)("div",{className:"flex flex-1 min-h-0",children:[m&&(0,n.jsxs)("aside",{ref:j,"data-testid":"sidebar-container",className:"\n fixed left-0\n ".concat(f?"top-16 h-[calc(100vh-4rem)]":"top-0 h-full","\n border-r border-border\n ").concat(eQ,"\n ").concat(r?"translate-x-0":"-translate-x-full","\n "),style:{width:"".concat(y,"px"),zIndex:ez.M.SIDEBAR,...v?{top:"".concat(w,"px"),height:"calc(100vh - ".concat(w,"px)")}:{}},role:"complementary","aria-hidden":!r,children:[(0,n.jsx)(eg,{}),(0,n.jsx)(e1,{currentWidth:y,minWidth:b,maxWidth:g,sidebarRef:j,mainRef:k,onWidthChange:N})]}),(0,n.jsx)("main",{ref:k,className:"flex-1 min-w-0 h-full overflow-hidden transition-[padding] duration-300 ease-out",style:{paddingLeft:m&&r?"".concat(y,"px"):0},role:"main","data-view-transition":"content",children:t})]}),(0,n.jsx)(eq.xq,{}),(0,n.jsx)(e$,{}),(0,n.jsx)(eZ.n,{})]})});function e1(e){let{currentWidth:t,minWidth:r,maxWidth:a,sidebarRef:s,mainRef:o,onWidthChange:i}=e;return(0,n.jsx)("div",{"data-testid":"sidebar-resize-handle","aria-hidden":"true",onMouseDown:e=>{e.preventDefault();let n=e.clientX,l=t;o.current&&(o.current.style.transition="none");let c=e=>{l=Math.max(r,Math.min(a,t+(e.clientX-n))),s.current&&(s.current.style.width="".concat(l,"px")),o.current&&(o.current.style.paddingLeft="".concat(l,"px"))},d=()=>{document.body.style.cursor="",document.body.style.userSelect="",o.current&&(o.current.style.transition=""),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d),i(l)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",c),document.addEventListener("mouseup",d)},className:"absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-accent-500/40 transition-colors"})}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[838],{38038:(e,t,s)=>{Promise.resolve().then(s.bind(s,60675))},53482:(e,t,s)=>{"use strict";s.d(t,{i:()=>c});var a=s(95155),n=s(12115),r=s(60322),i=s(9900);function o(){return(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function l(){return(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function c(e){let{text:t,className:s="",label:c="Copy"}=e,[d,u]=(0,n.useState)(!1),m=(0,n.useRef)(null);(0,n.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let p=(0,n.useCallback)(async()=>{try{await (0,r.l)(t),u(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>u(!1),i.s7)}catch(e){}},[t]);return(0,a.jsxs)("button",{type:"button",onClick:p,className:"inline-flex items-center gap-1 rounded border border-border bg-surface px-2 py-0.5 text-[11px] font-medium text-foreground transition-colors hover:bg-muted ".concat(s),"aria-label":d?"Copied":c,title:d?"Copied!":c,children:[d?(0,a.jsx)(l,{}):(0,a.jsx)(o,{}),(0,a.jsx)("span",{children:d?"Copied":c})]})}},60322:(e,t,s)=>{"use strict";s.d(t,{l:()=>n});let a=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function n(e){var t;if(!e||0===e.trim().length)return;let s=e.replace(a,"");if(null==(t=navigator.clipboard)?void 0:t.writeText)try{await navigator.clipboard.writeText(s);return}catch(e){}let n=document.createElement("textarea");n.value=s,n.style.position="fixed",n.style.left="-9999px",n.style.top="-9999px",n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{document.execCommand("copy")}finally{document.body.removeChild(n)}}},60675:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>I});var a=s(95155),n=s(68361),r=s(12115),i=s(18955),o=s(71360),l=s(28019),c=s(36402);let d=(0,r.memo)(function(e){let{onSend:t,disabled:s=!1,placeholder:n}=e,o=(0,i.c)("home"),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1),x=(0,r.useRef)(null),f=(0,r.useRef)(null),g=(0,r.useRef)(!1);(0,r.useEffect)(()=>{let e=x.current;e&&(c?(e.style.height="auto",e.style.height="".concat(Math.min(e.scrollHeight,120),"px")):e.style.height="24px")},[c]);let b=(0,r.useCallback)(async()=>{if(!p&&c.trim()&&!u&&!s)try{m(!0),await t(c.trim()),d("")}catch(e){}finally{m(!1)}},[p,c,u,s,t]),v=(0,r.useCallback)(async e=>{e.preventDefault(),await b()},[b]),y=(0,r.useCallback)(()=>{h(!0),g.current=!1,f.current&&clearTimeout(f.current)},[]),w=(0,r.useCallback)(()=>{h(!1),g.current=!0,f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{g.current=!1},300)},[]),j=(0,r.useCallback)(e=>{let{keyCode:t}=e.nativeEvent;if(229!==t){if(g.current&&"Enter"===e.key){g.current=!1;return}"Enter"!==e.key||p||e.shiftKey||(e.preventDefault(),b())}},[p,b]);return(0,a.jsxs)("form",{onSubmit:v,className:"flex shrink-0 items-center gap-2 rounded-lg border border-input bg-surface dark:bg-surface-2 px-3 py-1.5 focus-within:border-accent-500 focus-within:ring-1 focus-within:ring-accent-500","data-testid":"assistant-message-input",children:[(0,a.jsx)("textarea",{ref:x,value:c,onChange:e=>d(e.target.value),onKeyDown:j,onCompositionStart:y,onCompositionEnd:w,placeholder:null!=n?n:o("assistant.input.defaultPlaceholder"),disabled:u||s,rows:1,className:"flex-1 outline-none bg-transparent resize-none overflow-y-auto scrollbar-thin text-sm",style:{minHeight:"24px",maxHeight:"120px",paddingTop:"4px",paddingBottom:"4px",lineHeight:"18px"},"data-testid":"assistant-message-textarea"}),(0,a.jsx)(l.$n,{type:"submit",variant:"ghost",disabled:!c.trim()||u||s,className:"flex-shrink-0 rounded-full p-1.5 text-accent-600 hover:bg-accent-50 dark:text-accent-400 dark:hover:bg-accent-900/30 disabled:text-muted-foreground disabled:hover:bg-transparent","aria-label":o("assistant.input.send"),"data-testid":"assistant-send-button",children:u?(0,a.jsx)(l.y$,{size:"sm"}):(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]})});var u=s(51238),m=s(22133),p=s(10934),h=s(5225);s(1226);var x=s(53482),f=s(3005);function g(e){return e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function b(){return(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}function v(e){let{message:t}=e;return(0,a.jsx)("div",{className:"text-center text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground",children:(0,a.jsx)("span",{className:"rounded-full border border-border bg-surface-2 px-3 py-1",children:t.content})})}function y(e){let{message:t,canEdit:s,onEdit:n}=e,o=(0,i.c)("home"),[l,c]=(0,r.useState)(!1),[d,u]=(0,r.useState)(t.content),[m,p]=(0,r.useState)(!1),[h,f]=(0,r.useState)(null),v=t.deliveryStatus?"pending"===t.deliveryStatus?o("assistant.message.sending"):"failed"===t.deliveryStatus?o("assistant.message.failed"):o("assistant.message.sent"):null,y=(0,r.useCallback)(()=>{u(t.content),f(null),c(!0)},[t.content]),w=(0,r.useCallback)(()=>{c(!1),f(null)},[]),j=(0,r.useCallback)(async()=>{if(!n||m)return;let e=d.trim();if(!e||e===t.content.trim())return void c(!1);p(!0),f(null);try{await n(t,e),c(!1)}catch(e){f(e instanceof Error?e.message:o("assistant.errors.resubmitMessage"))}finally{p(!1)}},[d,t,n,m,o]);return(0,a.jsxs)("div",{className:"group ml-auto max-w-[88%] rounded-2xl border border-accent-500/40 bg-accent-500/10 px-4 py-3 text-foreground shadow-sm",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.12em] text-muted-foreground",children:[(0,a.jsx)("span",{children:o("assistant.message.you")}),(0,a.jsx)("span",{children:g(t.timestamp)})]}),l?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("textarea",{className:"w-full resize-y rounded border border-input bg-surface p-2 text-sm text-foreground focus:border-accent-500 focus:outline-none focus:ring-1 focus:ring-ring",value:d,onChange:e=>u(e.target.value),rows:Math.max(3,Math.min(12,d.split("\n").length+1)),disabled:m,"data-testid":"assistant-edit-textarea"}),h&&(0,a.jsx)("p",{className:"text-[11px] text-danger-foreground",children:h}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:w,disabled:m,className:"rounded border border-border bg-surface px-3 py-1 text-[11px] text-foreground transition-colors hover:bg-muted disabled:opacity-50",children:o("assistant.message.cancel")}),(0,a.jsx)("button",{type:"button",onClick:j,disabled:m||!d.trim(),className:"rounded bg-accent-600 px-3 py-1 text-[11px] font-medium text-white transition-colors hover:bg-accent-700 disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground","data-testid":"assistant-edit-save",children:m?o("assistant.message.resending"):o("assistant.message.saveAndResend")})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"whitespace-pre-wrap break-words text-sm leading-6",children:t.content}),(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-3",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium ".concat("failed"===t.deliveryStatus?"text-danger-foreground":"text-muted-foreground"),children:null!=v?v:""}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 opacity-60 transition-opacity group-hover:opacity-100",children:[(0,a.jsx)(x.i,{text:t.content}),s&&n&&(0,a.jsxs)("button",{type:"button",onClick:y,className:"inline-flex items-center gap-1 rounded border border-border bg-surface px-2 py-0.5 text-[11px] font-medium text-foreground transition-colors hover:bg-muted","aria-label":o("assistant.message.editMessage"),"data-testid":"assistant-edit-button",title:o("assistant.message.editAndResend"),children:[(0,a.jsx)(b,{}),(0,a.jsx)("span",{children:o("assistant.message.edit")})]})]})]})]})]})}function w(e){let{message:t,assistantLabel:s}=e;return(0,a.jsxs)("div",{className:"group mr-auto max-w-[88%] rounded-2xl border border-border bg-surface px-4 py-3 text-foreground shadow-sm",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.12em] text-muted-foreground",children:[(0,a.jsx)("span",{children:s}),(0,a.jsx)("span",{children:g(t.timestamp)})]}),(0,a.jsx)("div",{className:"assistant-md text-sm leading-6",children:(0,a.jsx)(u.oz,{remarkPlugins:[m.A],rehypePlugins:[p.A,h.A],children:t.content})}),(0,a.jsx)("div",{className:"mt-2 flex justify-end opacity-60 transition-opacity group-hover:opacity-100",children:(0,a.jsx)(x.i,{text:t.content})})]})}function j(e){let{messages:t,assistantLabel:s,sessionActive:n,waitingForResponse:o=!1,canEdit:l=!1,onEditMessage:c}=e,d=(0,i.c)("home"),u=(0,r.useRef)(null),m=(0,r.useRef)(!0),p=(0,r.useMemo)(()=>{var e;let s=t[t.length-1];return s?"".concat(t.length,":").concat(s.id,":").concat(null!=(e=s.deliveryStatus)?e:"",":").concat(s.content.length,":").concat(o?"waiting":"idle"):"empty:".concat(o?"waiting":"idle")},[t,o]);(0,r.useEffect)(()=>{u.current&&m.current&&(u.current.scrollTop=u.current.scrollHeight)},[p]);let h=(0,r.useMemo)(()=>{let e=t[t.length-1];return n&&e&&"user"===e.role&&"failed"!==e.deliveryStatus?d("assistant.working"):d("assistant.emptyState")},[t,n,d]);return(0,a.jsx)("div",{ref:u,className:"h-full min-h-0 overflow-y-scroll rounded-xl border border-border bg-surface-2 p-3",style:{scrollbarGutter:"stable"},onScroll:e=>{let t=e.currentTarget;m.current=t.scrollHeight-t.scrollTop-t.clientHeight<48},"data-testid":"assistant-message-list",children:0!==t.length||o?(0,a.jsxs)("div",{className:"space-y-3",children:[t.map(e=>"system"===e.role&&"session_boundary"===e.messageType?(0,a.jsx)(v,{message:e},e.id):"user"===e.role?(0,a.jsx)(y,{message:e,canEdit:l,onEdit:c},e.id):(0,a.jsx)(w,{message:e,assistantLabel:s},e.id)),o&&(0,a.jsxs)("div",{className:"mr-auto flex max-w-[88%] items-center gap-3 rounded-2xl border border-border bg-surface px-4 py-3 shadow-sm","data-testid":"assistant-waiting-indicator","aria-live":"polite",children:[(0,a.jsx)(f.y,{size:"sm",variant:"accent"}),(0,a.jsx)("span",{className:"text-sm text-foreground",children:d("assistant.thinking",{label:s})})]})]}):(0,a.jsx)("div",{className:"flex h-full min-h-[160px] items-center justify-center text-sm text-muted-foreground",children:h})})}function k(e){return e?{...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt),lastStartedAt:e.lastStartedAt?new Date(e.lastStartedAt):void 0,lastStoppedAt:e.lastStoppedAt?new Date(e.lastStoppedAt):void 0,contextSentAt:e.contextSentAt?new Date(e.contextSentAt):void 0}:null}function N(e){return{...e,timestamp:new Date(e.timestamp)}}let C={async getConversation(e,t){let s=await fetch("/api/assistant/conversation?repositoryId=".concat(encodeURIComponent(e),"&cliToolId=").concat(encodeURIComponent(t)));if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Failed to get conversation (".concat(s.status,")"));return k((await s.json()).conversation)},async getMessages(e){let t=await fetch("/api/assistant/messages?conversationId=".concat(encodeURIComponent(e)));if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to get messages (".concat(t.status,")"));return(await t.json()).messages.map(N)},async clearMessages(e,t){var s;let a=new URLSearchParams({conversationId:e});(null==t?void 0:t.fromMessageId)&&a.set("fromMessageId",t.fromMessageId);let n=await fetch("/api/assistant/messages?".concat(a.toString()),{method:"DELETE"});if(!n.ok)throw Error((await n.json().catch(()=>({}))).error||"Failed to clear messages (".concat(n.status,")"));return{archivedCount:null!=(s=(await n.json()).archivedCount)?s:0}},async startSession(e,t){let s=await fetch("/api/assistant/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:e,repositoryId:t})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Failed to start session (".concat(s.status,")"));let a=await s.json();return{...a,conversation:k(a.conversation)}},async sendCommand(e,t,s){let a=await fetch("/api/assistant/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:e,conversationId:t,command:s})});if(!a.ok)throw Error((await a.json().catch(()=>({}))).error||"Failed to send command (".concat(a.status,")"))},async getCurrentOutput(e,t){let s=await fetch("/api/assistant/current-output?cliToolId=".concat(encodeURIComponent(e),"&conversationId=").concat(encodeURIComponent(t)));if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Failed to get output (".concat(s.status,")"));return s.json()},async stopSession(e,t){let s=await fetch("/api/assistant/session?cliToolId=".concat(encodeURIComponent(e),"&conversationId=").concat(encodeURIComponent(t)),{method:"DELETE"});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Failed to stop session (".concat(s.status,")"));return s.json()},async getInstalledTools(){var e;let t=await fetch("/api/assistant/tools");return t.ok&&null!=(e=(await t.json()).tools)?e:[]}},S="commandmate-assistant-cli-tool",E=["claude","codex","antigravity"];function M(e){return E.includes(e)}function A(){var e;let t=(0,i.c)("home"),s=(0,c.SC)(),[n,u]=(0,r.useState)([]),[m,p]=(0,r.useState)([]),[h,x]=(0,r.useState)(""),[f,g]=(0,r.useState)("claude"),[b,v]=(0,r.useState)(null),[y,w]=(0,r.useState)([]),[k,N]=(0,r.useState)(null),[E,A]=(0,r.useState)(!1),[I,T]=(0,r.useState)(!1),[R,L]=(0,r.useState)(!1),[H,D]=(0,r.useState)(!1),[P,_]=(0,r.useState)(null),z="".concat(h,":").concat(f),F=!H||""!==h&&P!==z,U=(0,r.useRef)(null),O=(null==b?void 0:b.status)==="ready"||(null==b?void 0:b.status)==="running",B=(null==b?void 0:b.status)==="running",W=(null==b?void 0:b.status)==="ready",$=n.find(e=>e.id===h),V=(0,r.useMemo)(()=>m.filter(e=>M(e.id)),[m]),G=V.find(e=>e.id===f),J=null!=(e=null==G?void 0:G.name)?e:f,K=(0,r.useCallback)(async e=>{w(await C.getMessages(e))},[]),Z=(0,r.useCallback)(async()=>{if(!h){v(null),w([]);return}let e=await C.getConversation(h,f);v(e),e?await K(e.id):w([])},[K,h,f]);(0,r.useEffect)(()=>{{let e=localStorage.getItem(S);e&&M(e)&&g(e)}},[]),(0,r.useEffect)(()=>{async function e(){let e=await C.getInstalledTools();p(e);let t=e.filter(e=>M(e.id)),s=t.find(e=>e.installed);s&&g(e=>{let a=t.find(t=>t.id===e);return(null==a?void 0:a.installed)?e:s.id})}(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}));u(s),s.length>0&&x(e=>e||s[0].id)}catch(e){}finally{D(!0)}})(),e()},[]),(0,r.useEffect)(()=>{if(!h)return;let e=!1;return(async()=>{try{let t=await C.getConversation(h,f);if(e)return;if(v(t),t){let s=await C.getMessages(t.id);e||w(s)}else w([])}catch(s){e||N(s instanceof Error?s.message:t("assistant.errors.loadConversation"))}finally{e||_("".concat(h,":").concat(f))}})(),()=>{e=!0}},[h,f,t]),(0,r.useEffect)(()=>{if(U.current&&(clearInterval(U.current),U.current=null),!b)return;let e=async()=>{try{await Z()}catch(e){}};return e(),U.current=setInterval(e,2e3),()=>{U.current&&(clearInterval(U.current),U.current=null)}},[null==b?void 0:b.id,Z,b]);let q=(0,r.useCallback)(e=>{M(e)&&(g(e),localStorage.setItem(S,e))},[]),Q=(0,r.useCallback)(async()=>{if(h&&!E){A(!0),N(null);try{let e=await C.startSession(f,h);v(e.conversation),await K(e.conversation.id)}catch(e){N(e instanceof Error?e.message:t("assistant.errors.startSession"))}finally{A(!1)}}},[K,h,f,E,t]),X=(0,r.useCallback)(async()=>{if(b&&!I){T(!0),N(null);try{await C.stopSession(f,b.id),await Z()}catch(e){N(e instanceof Error?e.message:t("assistant.errors.stopSession"))}finally{T(!1)}}},[b,Z,f,I,t]),Y=(0,r.useCallback)(async()=>{if(b&&!R&&!B&&await s({description:t("assistant.clearHistoryConfirm"),variant:"danger"})){L(!0),N(null);try{await C.clearMessages(b.id),await Z()}catch(e){N(e instanceof Error?e.message:t("assistant.errors.clearHistory"))}finally{L(!1)}}},[R,b,B,Z,s,t]),ee=(0,r.useCallback)(async e=>{if(b&&W){N(null);try{await C.sendCommand(f,b.id,e),v(e=>e?{...e,status:"running"}:e),await Promise.all([K(b.id),Z()])}catch(e){throw N(e instanceof Error?e.message:t("assistant.errors.sendMessage")),e}}},[W,b,Z,K,f,t]),et=(0,r.useCallback)(async(e,s)=>{if(!b||!W)throw Error(t("assistant.errors.notReadyToResend"));N(null),await C.clearMessages(b.id,{fromMessageId:e.id}),await C.sendCommand(f,b.id,s),v(e=>e?{...e,status:"running"}:e),await Promise.all([K(b.id),Z()])},[W,b,Z,K,f,t]),es=(0,r.useCallback)(async e=>{if(O){if(!await s({description:t("assistant.changeRepoConfirm")}))return;try{await C.stopSession(f,b.id)}catch(e){N(e instanceof Error?e.message:t("assistant.errors.stopSession"));return}}x(e),N(null)},[b,O,f,s,t]);return(0,a.jsx)(l.Zp,{variant:"elevated",padding:"none",className:"overflow-hidden rounded-xl shadow-lg","data-testid":"assistant-chat-panel",children:(0,a.jsxs)("div",{className:"flex h-[78vh] min-h-[34rem] max-h-[48rem] flex-col gap-4 overflow-hidden bg-gradient-to-br from-transparent to-accent-500/5 p-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)_auto]",children:[(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:t("assistant.repositoryLabel")}),(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:t("assistant.cliLabel")}),(0,a.jsx)("span",{className:"hidden md:block"})]}),(0,a.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)_auto] md:items-center",children:[(0,a.jsxs)("select",{value:h,onChange:e=>void es(e.target.value),disabled:0===n.length,className:"w-full rounded-lg border border-input bg-surface px-3 py-2 text-sm text-foreground shadow-sm transition-colors focus:border-accent-500 focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground","data-testid":"assistant-repo-select",children:[0===n.length&&(0,a.jsx)("option",{value:"",children:t("assistant.noRepositories")}),n.map(e=>(0,a.jsx)("option",{value:e.id,children:e.displayName||e.name},e.id))]}),(0,a.jsx)("select",{value:f,onChange:e=>q(e.target.value),disabled:O,className:"w-full rounded-lg border border-input bg-surface px-3 py-2 text-sm text-foreground shadow-sm transition-colors focus:border-accent-500 focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground","data-testid":"assistant-tool-select",children:V.map(e=>(0,a.jsx)("option",{value:e.id,disabled:!e.installed,children:e.installed?e.name:t("assistant.toolNotInstalled",{name:e.name})},e.id))}),(0,a.jsx)("div",{children:O?(0,a.jsx)(l.$n,{variant:"danger",onClick:X,disabled:I,className:"w-full md:w-auto","data-testid":"assistant-stop-button",children:I?t("assistant.stopping"):t("assistant.stop")}):(0,a.jsx)(l.$n,{variant:"primary",onClick:Q,disabled:!h||E,className:"w-full md:w-auto","data-testid":"assistant-start-button",children:E?t("assistant.starting"):t("assistant.start")})})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:$?t("assistant.startDirectory",{repository:$.displayName||$.name,path:$.path}):t("assistant.startDirectoryHint")})]}),k&&(0,a.jsx)("div",{className:"rounded border border-danger/40 bg-danger/10 p-2 text-sm text-danger-foreground",children:k}),(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground",children:t("assistant.history")}),(0,a.jsxs)(l.$n,{type:"button",variant:"ghost",size:"sm",onClick:Y,disabled:!b||R||B||0===y.length,className:"gap-1","data-testid":"assistant-clear-button",children:[(0,a.jsx)(o.A,{className:"h-3.5 w-3.5","aria-hidden":"true"}),R?t("assistant.clearing"):t("assistant.clearHistory")]})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:F&&0===y.length?(0,a.jsx)("div",{className:"h-full min-h-0 overflow-hidden rounded-xl border border-border bg-surface-2 p-3","data-testid":"assistant-chat-loading",role:"status","aria-label":t("assistant.loadingConversation"),children:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(l.EA,{className:"ml-auto h-10 w-3/5 rounded-2xl"}),(0,a.jsx)(l.EA,{className:"mr-auto h-16 w-4/5 rounded-2xl"}),(0,a.jsx)(l.EA,{className:"ml-auto h-10 w-2/5 rounded-2xl"})]})}):(0,a.jsx)(j,{messages:y,assistantLabel:J,sessionActive:O,waitingForResponse:B,canEdit:W,onEditMessage:et})}),(0,a.jsx)("div",{className:"shrink-0",children:(0,a.jsx)(d,{onSend:ee,disabled:!W,placeholder:W?t("assistant.inputPlaceholder"):O?t("assistant.inputPlaceholderWaiting"):t("assistant.inputPlaceholderNoSession")})})]})]})})}function I(){return(0,a.jsx)(n.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:"Assistant Chat"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Converse with a local CLI assistant (Claude or Codex) scoped to a selected repository."})]}),(0,a.jsx)(A,{})]})})}},71360:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(71847).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])}},e=>{e.O(0,[6481,6809,4909,2770,790,5694,8566,1191,6402,8019,4718,8361,8441,1255,7358],()=>e(e.s=38038)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8039],{18955:(e,t,r)=>{"use strict";r.d(t,{c:()=>c});var n=r(36809);function o(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let c=o(0,n.c3);o(0,n.kc)},48278:(e,t,r)=>{"use strict";r.d(t,{oz:()=>o,tV:()=>c});let n="cm:chunk-reload-at";function o(e){if(null==e||"object"!=typeof e)return!1;let{name:t,message:r}=e;return"ChunkLoadError"===t||"string"==typeof r&&(r.includes("Loading chunk")||r.includes("Failed to fetch dynamically imported module"))}function c(e){let t=null;try{t=window.sessionStorage;let e="__cm_chunk_probe__";t.setItem(e,"1"),t.removeItem(e)}catch(e){t=null}var r={storage:t,now:Date.now(),reload:()=>window.location.reload()};if(!o(e))return"skipped";let{storage:c,now:l,reload:s}=r;if(!c)return"guarded";let i=Number(c.getItem(n));return Number.isFinite(i)&&i>0&&l-i<3e4?"guarded":(c.setItem(n,String(l)),s(),"reloaded")}},50960:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});var n=r(95155),o=r(12115),c=r(18955),l=r(48278);function s(e){let{error:t,reset:r}=e,s=(0,c.c)("error"),i=(0,c.c)("common"),a=(0,l.oz)(t);return(0,o.useEffect)(()=>{a&&(0,l.tV)(t)},[a,t]),(0,n.jsxs)("main",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-background px-6 pt-safe pb-safe text-center",children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h1",{className:"text-2xl font-semibold text-foreground",children:s(a?"chunkReload.title":"unexpected.title")}),(0,n.jsx)("p",{className:"mx-auto max-w-sm text-sm text-muted-foreground",children:s(a?"chunkReload.description":"unexpected.description")})]}),(0,n.jsx)("button",{type:"button",onClick:a?()=>window.location.reload():r,className:"rounded-lg bg-accent-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-700",children:i(a?"reload":"retry")})]})}},93350:(e,t,r)=>{Promise.resolve().then(r.bind(r,50960))}},e=>{e.O(0,[6809,8441,1255,7358],()=>e(e.s=93350)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4219],{48012:(e,t,n)=>{Promise.resolve().then(n.bind(n,54062))},48278:(e,t,n)=>{"use strict";n.d(t,{oz:()=>i,tV:()=>o});let r="cm:chunk-reload-at";function i(e){if(null==e||"object"!=typeof e)return!1;let{name:t,message:n}=e;return"ChunkLoadError"===t||"string"==typeof n&&(n.includes("Loading chunk")||n.includes("Failed to fetch dynamically imported module"))}function o(e){let t=null;try{t=window.sessionStorage;let e="__cm_chunk_probe__";t.setItem(e,"1"),t.removeItem(e)}catch(e){t=null}var n={storage:t,now:Date.now(),reload:()=>window.location.reload()};if(!i(e))return"skipped";let{storage:o,now:a,reload:l}=n;if(!o)return"guarded";let c=Number(o.getItem(r));return Number.isFinite(c)&&c>0&&a-c<3e4?"guarded":(o.setItem(r,String(a)),l(),"reloaded")}},54062:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>l});var r=n(95155),i=n(12115),o=n(48278);let a={en:{chunkTitle:"Updating to the latest version",chunkDescription:"A newer version of CommandMate is available. Reloading to get the latest update…",genericTitle:"Something went wrong",genericDescription:"An unexpected error occurred. Please reload the page.",reload:"Reload"},ja:{chunkTitle:"最新バージョンに更新しています",chunkDescription:"CommandMate の新しいバージョンが利用可能です。最新の状態にするため再読み込みします…",genericTitle:"問題が発生しました",genericDescription:"予期しないエラーが発生しました。ページを再読み込みしてください。",reload:"再読み込み"}};function l(e){let{error:t}=e,n=(0,o.oz)(t),[l,c]=(0,i.useState)("en");(0,i.useEffect)(()=>{c(function(){var e;if("undefined"!=typeof document){let e=document.cookie.match(/(?:^|;\s*)locale=([^;]+)/);if(e&&decodeURIComponent(e[1]).toLowerCase().startsWith("ja"))return"ja"}return"undefined"!=typeof navigator&&(null==(e=navigator.language)?void 0:e.toLowerCase().startsWith("ja"))?"ja":"en"}()),n&&(0,o.tV)(t)},[n,t]);let s=a[l];return(0,r.jsx)("html",{lang:l,style:{colorScheme:"light dark"},children:(0,r.jsxs)("body",{style:{margin:0,minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"1.5rem",padding:"1.5rem",textAlign:"center",background:"Canvas",color:"CanvasText",fontFamily:'system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:[(0,r.jsxs)("div",{style:{maxWidth:"24rem"},children:[(0,r.jsx)("h1",{style:{fontSize:"1.5rem",fontWeight:600,margin:"0 0 0.5rem"},children:n?s.chunkTitle:s.genericTitle}),(0,r.jsx)("p",{style:{fontSize:"0.875rem",opacity:.75,margin:0},children:n?s.chunkDescription:s.genericDescription})]}),(0,r.jsx)("button",{type:"button",onClick:()=>window.location.reload(),style:{appearance:"none",cursor:"pointer",borderRadius:"0.5rem",border:"1px solid currentColor",background:"transparent",color:"inherit",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500},children:s.reload})]})})}}},e=>{e.O(0,[8441,1255,7358],()=>e(e.s=48012)),_N_E=e.O()}]);
@@ -1 +0,0 @@
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"}]])},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(68361),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)(""),[N,y]=(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),y(r.pathPrefix),k(r.targetPort),C(r.appType),P(r.websocketEnabled),T(r.description||""),M(r.enabled)):(g(""),j(""),y(""),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:N,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:N,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:N,onChange:e=>y(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)},[]),N=(0,o.useCallback)(()=>{f(null),u(!0)},[]),y=(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:N,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:N,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:y},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 N=s(94442),y=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,N.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,y]=(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&&y(!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){y("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),y(!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,N.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,y.qG)(),{enabled:r,setEnabled:n}=(0,y.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,6402,8019,4718,8361,6022,4322,8441,1255,7358],()=>e(e.s=80867)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8898],{6473:(e,t,s)=>{"use strict";s.d(t,{Lc:()=>r,qz:()=>a});let a="animate-in fade-in-0 slide-in-from-bottom-2 fill-mode-backwards duration-300";function r(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")}},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"}]])},9219:(e,t,s)=>{"use strict";s.d(t,{k:()=>i});var a=s(95155),r=s(12115),n=s(28019),l=s(87531);function i(e){let{onRefresh:t,enabled:s=!0,className:i,children:o}=e,{containerRef:c,pullDistance:d,isRefreshing:u,isPulling:m}=function(e){let{onRefresh:t,enabled:s=!0,threshold:a=64,maxPull:n=96,resistance:l=.5}=e,i=(0,r.useRef)(null),[o,c]=(0,r.useState)(0),[d,u]=(0,r.useState)(!1),[m,x]=(0,r.useState)(!1),f=(0,r.useRef)(null),g=(0,r.useRef)(0),h=(0,r.useRef)(!1);h.current=d;let p=(0,r.useCallback)(()=>{f.current=null,g.current=0,c(0),x(!1)},[]),v=(0,r.useCallback)(e=>{if(!s||h.current)return;let t=i.current;t&&!(t.scrollTop>0)&&(f.current=e.touches[0].clientY,g.current=0)},[s]),b=(0,r.useCallback)(e=>{if(null===f.current)return;let t=i.current;if(!t)return;if(t.scrollTop>0)return void p();let s=e.touches[0].clientY-f.current;if(s<=0){0!==g.current&&(g.current=0,c(0),x(!1));return}e.cancelable&&e.preventDefault();let a=Math.min(s*l,n);g.current=a,c(a),x(!0)},[l,n,p]),N=(0,r.useCallback)(async()=>{u(!0),x(!1),c(a);try{await Promise.resolve(t())}finally{u(!1),c(0)}},[t,a]),y=(0,r.useCallback)(()=>{if(null===f.current)return;let e=g.current>=a&&!h.current;f.current=null,g.current=0,e?N():(c(0),x(!1))},[a,N]);return(0,r.useEffect)(()=>{let e=i.current;if(e)return e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchmove",b,{passive:!1}),e.addEventListener("touchend",y,{passive:!0}),e.addEventListener("touchcancel",y,{passive:!0}),()=>{e.removeEventListener("touchstart",v),e.removeEventListener("touchmove",b),e.removeEventListener("touchend",y),e.removeEventListener("touchcancel",y)}},[v,b,y]),{containerRef:i,pullDistance:o,isRefreshing:d,isPulling:m}}({onRefresh:t,enabled:s,threshold:64}),x=u||d>0,f=u?1:Math.min(d/64,1);return(0,a.jsxs)("div",{ref:c,className:(0,l.cn)("relative overflow-auto",i),style:{overscrollBehaviorY:"contain"},"data-testid":"pull-to-refresh",children:[(0,a.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:f,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,a.jsx)(n.y$,{size:"sm",variant:"accent"})}),(0,a.jsx)("div",{style:{transform:x?"translateY(".concat(d,"px)"):void 0,transition:m?"none":"transform 0.2s ease-out"},children:o})]})}},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"}]])},50857:(e,t,s)=>{"use strict";function a(e){return"running"===e||"generating"===e||"waiting"===e}function r(e){return e.isActive||a(e.status)}function n(e,t){let s=e.map((e,t)=>({it:e,index:t})).filter(e=>{let{it:t}=e;return r(t)}),a=new Set;return t>0&&s.length>0&&[...s].sort((e,t)=>Number(t.it.isActive)-Number(e.it.isActive)||e.index-t.index).slice(0,t).forEach(e=>{let{index:t}=e;return a.add(t)}),e.map((e,t)=>r(e)?{...e,slot:a.has(t)?"pill":"overflow"}:{...e,slot:"dot"})}s.d(t,{Lm:()=>r,Qo:()=>a,Uw:()=>n})},74500:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>D});var a=s(95155),r=s(12115),n=s(52619),l=s.n(n),i=s(18955),o=s(20562),c=s(8803),d=s(68361),u=s(9219),m=s(38218),x=s(66966),f=s(38606),g=s(50857),h=s(54014),p=s(55449),v=s(28019),b=s(7636),N=s(83012),y=s(6473);let w=[{key:"repositoryName",labelKey:"sort.repositoryName"},{key:"status",labelKey:"sort.status"},{key:"lastSent",labelKey:"sort.lastSent"}],j={lastSent:"desc",updatedAt:"desc"},k={ready:0,in_progress:1,in_review:2,done:3};function A(e){let{status:t,label:s}=e,r=(0,i.c)("common"),n="".concat(s,": ").concat(r("status.".concat(t)));return(0,a.jsx)(v.md,{status:t,size:"md",label:n})}let M={ready:"worktreeStatus.ready",in_progress:"worktreeStatus.inProgress",in_review:"worktreeStatus.inReview",done:"worktreeStatus.done"},C={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 D(){let e=(0,i.c)("common"),t=(0,i.c)("worktree"),s=(0,m.a)(),{worktrees:n,isLoading:D,error:L,refresh:E}=(0,x.Fn)(),S=n.length>0,[F,_]=(0,r.useState)(""),[U,P]=(0,r.useState)("lastSent"),[H,T]=(0,r.useState)("desc");(0,r.useEffect)(()=>{(0,p.qD)()},[]);let Y=(0,r.useMemo)(()=>{let e=n;if(F){let t=F.toLowerCase();e=e.filter(e=>{var s,a;return e.name.toLowerCase().includes(t)||e.repositoryName.toLowerCase().includes(t)||null!=(a=null==(s=e.repositoryDisplayName)?void 0:s.toLowerCase().includes(t))&&a})}let t=[...e];return t.sort((e,t)=>{var s,a,r,n,l,i,o,c;let d=0;switch(U){case"lastSent":{let s=(0,b.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 r=(null!=(s=e.repositoryDisplayName)?s:e.repositoryName).toLowerCase(),n=(null!=(a=t.repositoryDisplayName)?a:t.repositoryName).toLowerCase();0===(d=r.localeCompare(n))&&(d=e.name.toLowerCase().localeCompare(t.name.toLowerCase()));break}case"status":if(0==(d=(null!=(n=k[null!=(r=e.status)?r:""])?n:4)-(null!=(i=k[null!=(l=t.status)?l:""])?i:4))){let s=(null!=(o=e.repositoryDisplayName)?o:e.repositoryName).toLowerCase(),a=(null!=(c=t.repositoryDisplayName)?c:t.repositoryName).toLowerCase();d=s.localeCompare(a)}break;default:d=0}return("lastSent"===U?"desc"===H:"asc"===H)?d:-d}),t},[n,F,U,H]),z=(0,r.useCallback)(e=>{_(e.target.value)},[]),q=(0,r.useCallback)(e=>{var t;P(e),T(null!=(t=j[e])?t:"asc")},[]),B=(0,r.useCallback)(()=>{T(e=>"asc"===e?"desc":"asc")},[]);return(0,a.jsx)(d.GV,{children:(0,a.jsxs)(u.k,{onRefresh:E,enabled:s,className:"container-custom py-8 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:e("sessions.title")}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:e("sessions.description")})]}),(0,a.jsxs)("div",{className:"mb-6 flex items-center gap-3",children:[(0,a.jsx)(v.pd,{type:"text",placeholder:e("sessions.filterPlaceholder"),value:F,onChange:z,className:"max-w-md flex-1","data-testid":"sessions-filter","aria-label":e("sessions.filterAriaLabel"),inputMode:"search",enterKeyHint:"search"}),(0,a.jsxs)(v.l6,{value:U,onValueChange:q,children:[(0,a.jsx)(v.bq,{className:"w-40","data-testid":"sessions-sort-select","aria-label":e("sessions.sortByAriaLabel"),children:(0,a.jsx)(v.yv,{})}),(0,a.jsx)(v.gC,{children:w.map(t=>(0,a.jsx)(v.eb,{value:t.key,children:e(t.labelKey)},t.key))})]}),(0,a.jsx)("button",{type:"button",onClick:B,"data-testid":"sessions-sort-direction","aria-label":"asc"===H?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"===H?(0,a.jsx)(o.A,{size:16,"aria-hidden":"true"}):(0,a.jsx)(c.A,{size:16,"aria-hidden":"true"})})]}),S?(0,a.jsxs)(a.Fragment,{children:[L&&(0,a.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:L.message})}),(0,a.jsx)("div",{className:"space-y-2","data-testid":"sessions-list",children:0===Y.length?(0,a.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"sessions-empty",children:e("sessions.noMatching")}):Y.map((s,r)=>{var n,i,o,c;let d=null!=(n=s.selectedAgents)?n:(0,p.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,N.Fx)(String(s.lastUserMessageAt)):null,x=d.map(e=>{var t;return{agent:e,status:(0,f.kA)(null==(t=s.sessionStatusByCli)?void 0:t[e])}}),b=x.filter(e=>(0,g.Qo)(e.status)),w=x.length-b.length,j=d.some(e=>{var t;let a=(0,f.kA)(null==(t=s.sessionStatusByCli)?void 0:t[e]);return"running"===a||"generating"===a});return(0,a.jsxs)(l(),{href:"/worktrees/".concat(s.id),style:{animationDelay:(0,y.Lc)(r)},className:"block bg-surface rounded-lg p-4 border transition-colors ".concat(j?"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(y.qz),"data-testid":"session-item-".concat(s.id),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:null!=(i=s.repositoryDisplayName)?i:s.repositoryName}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:s.name})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 ml-4 flex-shrink-0","data-testid":"session-agents-".concat(s.id),children:[b.map(e=>{let{agent:t,status:s}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-1","data-testid":"session-agent-".concat(t),children:[(0,a.jsx)(A,{status:s,label:(0,h.oo)(t)}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,h.oo)(t)})]},t)}),w>0&&(0,a.jsxs)("div",{className:"flex items-center gap-1","data-testid":"session-idle-cluster-".concat(s.id),"aria-label":e("sessions.idleAgents",{count:w}),children:[(0,a.jsx)(v.md,{status:"idle",size:"sm","aria-hidden":!0,title:void 0}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:["+",w]})]})]})]}),s.description&&(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 whitespace-pre-wrap",children:s.description})}),s.status&&(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium rounded ".concat(null!=(c=C[null!=(o=s.status)?o:""])?c:"bg-muted text-muted-foreground"),children:function(e,t){if(!e)return"";let s=M[e];return s?t(s):e}(s.status,t)})}),u&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2","data-testid":"session-message-".concat(s.id),children:[(0,a.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,a.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,a.jsxs)(a.Fragment,{children:[D&&(0,a.jsx)("div",{className:"space-y-2","data-testid":"sessions-loading",role:"status","aria-label":e("sessions.loadingAriaLabel"),children:[0,1,2].map(e=>(0,a.jsxs)("div",{className:"block bg-surface rounded-lg p-4 border border-border shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,a.jsx)(v.EA,{className:"h-4 w-40 max-w-full"}),(0,a.jsx)(v.EA,{className:"h-3 w-56 max-w-full"})]}),(0,a.jsx)(v.EA,{className:"ml-4 h-3 w-16 flex-shrink-0"})]}),(0,a.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,a.jsx)(v.EA,{className:"h-3 min-w-0 flex-1"}),(0,a.jsx)(v.EA,{className:"h-3 w-10 flex-shrink-0"})]})]},e))}),!D&&L&&(0,a.jsx)("div",{className:"text-danger-foreground","data-testid":"sessions-error",children:e("sessions.loadError",{message:L.message})}),!D&&!L&&(0,a.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"sessions-empty",children:F?e("sessions.noMatching"):e("sessions.empty")})]})]})})}},83012:(e,t,s)=>{"use strict";s.d(t,{Fx:()=>l,Uq:()=>o,bg:()=>i,fw:()=>n,g8:()=>c});var a=s(53298),r=s(73683);function n(e,t){let s=new Date(e);return isNaN(s.getTime())?"":(0,a.m)(s,{addSuffix:!0,...t?{locale:t}:{}})}function l(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 a=Math.round(s/60);if(a<60)return"".concat(a,"m ago");let r=Math.round(a/60);if(r<24)return"".concat(r,"h ago");let n=Math.round(r/24);return n<7?"".concat(n,"d ago"):n<30?"".concat(Math.round(n/7),"w ago"):n<365?"".concat(Math.round(n/30),"mo ago"):"".concat(Math.round(n/365),"y ago")}function i(e,t){return!(e instanceof Date)||isNaN(e.getTime())?"":(0,r.GP)(e,"PPp",t?{locale:t}:void 0)}function o(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,a=e.getFullYear()===s.getFullYear()&&e.getMonth()===s.getMonth()&&e.getDate()===s.getDate();return(0,r.GP)(e,a?"HH:mm":"M/d HH:mm")}function c(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;if(!u(e))return"";let a=u(s)?s:new Date,n=u(t)?t:null,l=m(e,a)&&(null===n||m(n,a)&&m(n,e))?"HH:mm":"M/d HH:mm",i=(0,r.GP)(e,l);if(null===n)return i;let o=(0,r.GP)(n,l);return o===i?i:"".concat(o).concat(d).concat(i)}let d=" → ";function u(e){return e instanceof Date&&!isNaN(e.getTime())}function m(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}},87047:(e,t,s)=>{Promise.resolve().then(s.bind(s,74500))}},e=>{e.O(0,[6809,4909,2770,790,5694,9948,6402,8019,4718,8361,8441,1255,7358],()=>e(e.s=87047)),_N_E=e.O()}]);