commandmate 0.24.0 → 0.25.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 (240) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +307 -307
  3. package/.next/app-path-routes-manifest.json +23 -23
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +12 -12
  6. package/.next/react-loadable-manifest.json +3 -3
  7. package/.next/required-server-files.json +1 -1
  8. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  10. package/.next/server/app/api/app/update-check/route.js +1 -1
  11. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  49. package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
  60. package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  66. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  67. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  69. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  70. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  79. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  89. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  91. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  99. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  104. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  108. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  109. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
  111. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
  112. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
  114. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
  115. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
  117. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  118. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/worktrees/[id]/start-polling/route_client-reference-manifest.js +1 -1
  120. package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
  121. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  123. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  124. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  125. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  127. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  129. package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
  131. package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
  132. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  133. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/chat/page.js +2 -2
  135. package/.next/server/app/chat/page.js.nft.json +1 -1
  136. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  137. package/.next/server/app/login/page.js +2 -2
  138. package/.next/server/app/login/page.js.nft.json +1 -1
  139. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  140. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  141. package/.next/server/app/more/page.js +2 -2
  142. package/.next/server/app/more/page.js.nft.json +1 -1
  143. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  144. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  145. package/.next/server/app/page.js +1 -1
  146. package/.next/server/app/page.js.nft.json +1 -1
  147. package/.next/server/app/page_client-reference-manifest.js +1 -1
  148. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  149. package/.next/server/app/repositories/page.js +2 -2
  150. package/.next/server/app/repositories/page.js.nft.json +1 -1
  151. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  152. package/.next/server/app/review/page.js +1 -1
  153. package/.next/server/app/review/page.js.nft.json +1 -1
  154. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  155. package/.next/server/app/sessions/page.js +1 -1
  156. package/.next/server/app/sessions/page.js.nft.json +1 -1
  157. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  158. package/.next/server/app/skills/[skillId]/page.js +2 -2
  159. package/.next/server/app/skills/[skillId]/page.js.nft.json +1 -1
  160. package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
  161. package/.next/server/app/skills/installed/page.js +2 -2
  162. package/.next/server/app/skills/installed/page.js.nft.json +1 -1
  163. package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
  164. package/.next/server/app/skills/page.js +2 -2
  165. package/.next/server/app/skills/page.js.nft.json +1 -1
  166. package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  167. package/.next/server/app/worktrees/[id]/files/[...path]/page.js +2 -2
  168. package/.next/server/app/worktrees/[id]/files/[...path]/page.js.nft.json +1 -1
  169. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  170. package/.next/server/app/worktrees/[id]/page.js +6 -6
  171. package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
  172. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  173. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  174. package/.next/server/app-paths-manifest.json +23 -23
  175. package/.next/server/chunks/2119.js +1 -1
  176. package/.next/server/chunks/2404.js +1 -1
  177. package/.next/server/chunks/2445.js +1 -1
  178. package/.next/server/chunks/3346.js +1 -1
  179. package/.next/server/chunks/5164.js +1 -1
  180. package/.next/server/chunks/5571.js +1 -1
  181. package/.next/server/chunks/5959.js +3 -3
  182. package/.next/server/chunks/6130.js +1 -1
  183. package/.next/server/chunks/6285.js +1 -1
  184. package/.next/server/chunks/848.js +1 -1
  185. package/.next/server/chunks/8730.js +1 -0
  186. package/.next/server/chunks/880.js +1 -1
  187. package/.next/server/chunks/9328.js +1 -1
  188. package/.next/server/middleware-build-manifest.js +1 -1
  189. package/.next/server/middleware-manifest.json +5 -5
  190. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  191. package/.next/server/pages/500.html +1 -1
  192. package/.next/server/pages-manifest.json +1 -1
  193. package/.next/server/server-reference-manifest.json +1 -1
  194. package/.next/static/chunks/2053-dfac2d49227cc942.js +1 -0
  195. package/.next/static/chunks/3898-ef488bfa804507d9.js +1 -0
  196. package/.next/static/chunks/5229-35f9acab97a553c5.js +1 -0
  197. package/.next/static/chunks/{6381-18a6a02a94d00d76.js → 6381-51f9c4a128aadc0b.js} +1 -1
  198. package/.next/static/chunks/{9599-d29d2f8eeaf7c249.js → 8649-f551b0010dba4986.js} +1 -1
  199. package/.next/static/chunks/9263.f2034ec525abcf72.js +1 -0
  200. package/.next/static/chunks/app/chat/page-439b35c9cb90dbe0.js +1 -0
  201. package/.next/static/chunks/app/login/page-eefd515d8c37e5ee.js +1 -0
  202. package/.next/static/chunks/app/more/page-889b7546a8a553dc.js +1 -0
  203. package/.next/static/chunks/app/page-a8d04ac0e3e4c9fc.js +1 -0
  204. package/.next/static/chunks/app/repositories/page-f3c4d8839b1ca203.js +1 -0
  205. package/.next/static/chunks/app/review/page-6dc88649fe88ac16.js +1 -0
  206. package/.next/static/chunks/app/sessions/page-2c9ed9e969097688.js +1 -0
  207. package/.next/static/chunks/app/skills/[skillId]/page-19beef6121c4c982.js +1 -0
  208. package/.next/static/chunks/app/skills/installed/page-d5b9cef6d21fabda.js +1 -0
  209. package/.next/static/chunks/app/skills/page-06ef637e07dd9377.js +1 -0
  210. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/{page-9ddcb224594f620f.js → page-5fed3984fafcd910.js} +1 -1
  211. package/.next/static/chunks/app/worktrees/[id]/page-207c69540fd856ef.js +1 -0
  212. package/.next/static/chunks/{webpack-3534d858912a6c92.js → webpack-9d892a9ff07c289d.js} +1 -1
  213. package/.next/static/css/e865c4979a41aa03.css +1 -0
  214. package/.next/trace +12 -12
  215. package/README.md +96 -45
  216. package/dist/server/src/config/activity-bar-config.js +5 -1
  217. package/dist/server/src/lib/auto-yes-poller.js +40 -4
  218. package/dist/server/src/lib/cli-tools/codex.js +58 -29
  219. package/dist/server/src/lib/detection/cli-patterns.js +148 -6
  220. package/dist/server/src/lib/detection/status-detector.js +28 -0
  221. package/package.json +1 -1
  222. package/.next/server/chunks/3451.js +0 -1
  223. package/.next/static/chunks/2053-52d3c82014e1cd54.js +0 -1
  224. package/.next/static/chunks/5229-0610b4e3288e777d.js +0 -1
  225. package/.next/static/chunks/744-3ad06d8c8ca482fc.js +0 -1
  226. package/.next/static/chunks/9263.5259f73f89220d64.js +0 -1
  227. package/.next/static/chunks/app/chat/page-15d13fc024d78f5d.js +0 -1
  228. package/.next/static/chunks/app/login/page-0247a3fb569bb22b.js +0 -1
  229. package/.next/static/chunks/app/more/page-b8ba537baeac8d5b.js +0 -1
  230. package/.next/static/chunks/app/page-afc64708362f31e5.js +0 -1
  231. package/.next/static/chunks/app/repositories/page-3469dacb6be7842f.js +0 -1
  232. package/.next/static/chunks/app/review/page-2d9cb7e068f8f35a.js +0 -1
  233. package/.next/static/chunks/app/sessions/page-7470c2bfd89e0df9.js +0 -1
  234. package/.next/static/chunks/app/skills/[skillId]/page-5e24481162f7ea78.js +0 -1
  235. package/.next/static/chunks/app/skills/installed/page-efd2d710a27f9735.js +0 -1
  236. package/.next/static/chunks/app/skills/page-0498adfc6e48684b.js +0 -1
  237. package/.next/static/chunks/app/worktrees/[id]/page-e611d30e47989e5d.js +0 -1
  238. package/.next/static/css/3ac44cfc082d02ad.css +0 -1
  239. /package/.next/static/{smu4mnL7qMf8w38n9dQJE → ehkNc5xDMDkXlua08Bwq0}/_buildManifest.js +0 -0
  240. /package/.next/static/{smu4mnL7qMf8w38n9dQJE → ehkNc5xDMDkXlua08Bwq0}/_ssgManifest.js +0 -0
@@ -53,6 +53,8 @@ exports.STATUS_REASON = {
53
53
  CODEX_SELECTION_LIST: 'codex_selection_list',
54
54
  /** Issue #1017: Codex pager / edit-previous (transcript) mode. */
55
55
  CODEX_PAGER: 'codex_pager',
56
+ /** Issue #1829: Codex's hooks review screens, which only `t`/`esc` leave. */
57
+ CODEX_HOOKS_REVIEW: 'codex_hooks_review',
56
58
  ANTIGRAVITY_SELECTION_LIST: 'antigravity_selection_list',
57
59
  OPENCODE_RESPONSE_COMPLETE: 'opencode_response_complete',
58
60
  INPUT_PROMPT: 'input_prompt',
@@ -73,6 +75,9 @@ exports.SELECTION_LIST_REASONS = new Set([
73
75
  exports.STATUS_REASON.CODEX_SELECTION_LIST,
74
76
  // Issue #1017: Codex pager/edit-previous mode also drives NavigationButtons.
75
77
  exports.STATUS_REASON.CODEX_PAGER,
78
+ // Issue #1829: the hooks review screens have no numbered options — `t` and
79
+ // `esc` are the only ways out, and NavigationButtons is how a human sends them.
80
+ exports.STATUS_REASON.CODEX_HOOKS_REVIEW,
76
81
  exports.STATUS_REASON.ANTIGRAVITY_SELECTION_LIST,
77
82
  ]);
78
83
  /**
@@ -288,6 +293,29 @@ function detectSessionStatus(output, cliToolId, lastOutputTimestamp) {
288
293
  promptDetection: codexPagerPromptDetection,
289
294
  };
290
295
  }
296
+ // 0.75. Codex: the hooks review screens (Issue #1829)
297
+ // codex-cli 0.148.0 answers "1. Review hooks" with a two-screen review UI:
298
+ // screen 2 "Press t to trust all; enter to review hooks; esc to close"
299
+ // screen 3 "Press t to trust; esc to go back"
300
+ // Neither carries a numbered option, a "press enter to confirm" footer, or any
301
+ // thinking indicator, so every branch below falls through to the `running`
302
+ // default -- which is how two live sessions sat parked on screen 3 while the UI
303
+ // and `cmate wait` both reported them as busy. They are the bottom-most
304
+ // interactive element and nothing but a keypress moves them: that is `waiting`.
305
+ // Checked ahead of prompt detection because the transcript rows on screen 2 are
306
+ // ordinary text that must not be read as options.
307
+ if (cliToolId === 'codex') {
308
+ const codexLifecycleDialog = (0, cli_patterns_1.getCodexLifecycleDialog)(cleanOutput);
309
+ if (codexLifecycleDialog === 'hooks-list' || codexLifecycleDialog === 'hooks-detail') {
310
+ return {
311
+ status: 'waiting',
312
+ confidence: 'high',
313
+ reason: exports.STATUS_REASON.CODEX_HOOKS_REVIEW,
314
+ hasActivePrompt: false,
315
+ promptDetection: (0, prompt_detector_1.detectPrompt)((0, cli_patterns_1.stripBoxDrawing)(cleanOutput), (0, cli_patterns_1.buildDetectPromptOptions)(cliToolId)),
316
+ };
317
+ }
318
+ }
291
319
  // 0.8. Codex: selection list detection BEFORE prompt detection (Issue #622)
292
320
  // CODEX_SELECTION_LIST_PATTERN matches "press enter to confirm/select" footer.
293
321
  // Without this early check, detectPrompt() at priority 1 would detect the numbered
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commandmate",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "A local control plane for agent CLIs — orchestration and visibility for Claude Code, Codex, Gemini CLI, and more across Git worktrees",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -1 +0,0 @@
1
- "use strict";exports.id=3451,exports.ids=[3451],exports.modules={10290:(a,b,c)=>{c.d(b,{Hr:()=>q,Ht:()=>p,SQ:()=>n,_2:()=>o,mB:()=>r,rI:()=>l,ty:()=>m});var d=c(21124),e=c(38301),f=c.n(e),g=c(12927),h=c(71613),i=c(90133),j=c(11010),k=c(35595);let l=g.bL,m=g.l9;g.YJ;let n=f().forwardRef(({className:a,sideOffset:b=4,...c},e)=>(0,d.jsx)(g.ZL,{children:(0,d.jsx)(g.UC,{ref:e,sideOffset:b,style:{zIndex:j.M.POPOVER},className:(0,k.cn)("min-w-[8rem] overflow-hidden rounded-md border border-border bg-surface p-1 text-surface-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...c})}));n.displayName="DropdownMenuContent";let o=f().forwardRef(({className:a,inset:b,...c},e)=>(0,d.jsx)(g.q7,{ref:e,className:(0,k.cn)("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-muted focus:text-surface-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",b&&"pl-8",a),...c}));o.displayName="DropdownMenuItem",f().forwardRef(({className:a,children:b,checked:c,...e},f)=>(0,d.jsxs)(g.H_,{ref:f,checked:c,className:(0,k.cn)("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-muted focus:text-surface-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...e,children:[(0,d.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,d.jsx)(g.VF,{children:(0,d.jsx)(h.A,{size:16,"aria-hidden":"true"})})}),b]})).displayName="DropdownMenuCheckboxItem";let p=f().forwardRef(({className:a,children:b,...c},e)=>(0,d.jsxs)(g.hN,{ref:e,className:(0,k.cn)("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-muted focus:text-surface-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...c,children:[(0,d.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,d.jsx)(g.VF,{children:(0,d.jsx)(i.A,{size:8,className:"fill-current","aria-hidden":"true"})})}),b]}));p.displayName="DropdownMenuRadioItem";let q=g.z6;f().forwardRef(({className:a,inset:b,...c},e)=>(0,d.jsx)(g.JU,{ref:e,className:(0,k.cn)("px-2 py-1.5 text-xs font-semibold text-muted-foreground",b&&"pl-8",a),...c})).displayName="DropdownMenuLabel";let r=f().forwardRef(({className:a,...b},c)=>(0,d.jsx)(g.wv,{ref:c,className:(0,k.cn)("-mx-1 my-1 h-px bg-border",a),...b}));r.displayName="DropdownMenuSeparator"},22317:(a,b,c)=>{c.d(b,{m:()=>l});var d=c(21124);c(38301);var e=c(20481),f=c(35595);let g={idle:{colorClass:"bg-muted-foreground",labelKey:"status.idle"},ready:{colorClass:"bg-success",labelKey:"status.ready"},running:{colorClass:"bg-success text-success ring-2 ring-success/40",animationClass:"animate-status-glow",labelKey:"status.running"},generating:{colorClass:"bg-success text-success ring-2 ring-success/40",animationClass:"animate-status-glow",labelKey:"status.generating"},waiting:{colorClass:"bg-warning text-warning ring-4 ring-warning/50",animationClass:"animate-status-attention",labelKey:"status.waiting"},error:{colorClass:"bg-danger",labelKey:"status.error"}},h={colorClass:"bg-warning text-warning ring-2 ring-warning/40",animationClass:"animate-status-glow",labelKey:"status.waiting"},i=new Set(["menu","unclassified"]),j={colorClass:"bg-muted-foreground",labelKey:"status.unknown"},k={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"};function l({status:a,size:b="md",label:c,waitingKind:l,className:m,...n}){let o=(0,e.c)("common"),p=function(a,b){let c=g[a]??j;return"waiting"!==a?c:b&&i.has(b)?h:c}(a,l),q=c??o(p.labelKey);return(0,d.jsx)("span",{className:(0,f.cn)("inline-block flex-shrink-0 rounded-full",k[b],p.colorClass,p.animationClass,m),title:q,"aria-label":q,...n})}},73451:(a,b,c)=>{c.d(b,{Ex:()=>q,$n:()=>d.$,Zp:()=>k,Wu:()=>n,aR:()=>l,ZB:()=>m,Sc:()=>D,TM:()=>t.TM,pd:()=>v,Jh:()=>s.a,z6:()=>G,CU:()=>H,l6:()=>S,gC:()=>V,eb:()=>W,bq:()=>U,yv:()=>T,EA:()=>x.E,y$:()=>y.y,md:()=>r.m,dO:()=>z.d,tU:()=>K,av:()=>N,j7:()=>L,Xi:()=>M,k_:()=>w,j1:()=>u});var d=c(94260),e=c(21124),f=c(38301),g=c.n(f),h=c(26691),i=c(35595);let j=(0,h.F)("bg-surface text-surface-foreground rounded-lg border border-border shadow-sm",{variants:{variant:{default:"",elevated:"bg-gradient-to-b from-surface to-surface-2 shadow-md",interactive:"cursor-pointer transition-all duration-200 hover:border-accent-500 hover:shadow-md motion-safe:hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-accent-500 focus-visible:shadow-md motion-safe:focus-visible:-translate-y-0.5"},hover:{true:"transition-shadow duration-200 hover:shadow-md",false:""},interactive:{true:"cursor-pointer transition-all duration-200 hover:shadow-lg active:shadow-md motion-safe:hover:-translate-y-0.5 motion-safe:active:translate-y-0",false:""},padding:{none:"",sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{variant:"default",hover:!1,interactive:!1,padding:"md"}});function k({variant:a="default",hover:b=!1,interactive:c=!1,padding:d="md",className:f="",children:g,...h}){return(0,e.jsx)("div",{className:(0,i.cn)(j({variant:a,hover:b,interactive:c,padding:d}),f),...h,children:g})}function l({className:a="",children:b,...c}){return(0,e.jsx)("div",{className:(0,i.cn)("mb-3",a),...c,children:b})}function m({className:a="",children:b,...c}){return(0,e.jsx)("h3",{className:(0,i.cn)("text-lg font-semibold text-surface-foreground",a),...c,children:b})}function n({className:a="",children:b,...c}){return(0,e.jsx)("div",{className:(0,i.cn)(a),...c,children:b})}let o=(0,h.F)("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",{variants:{variant:{success:"bg-success-subtle text-success-foreground",warning:"bg-warning-subtle text-warning-foreground",error:"bg-danger-subtle text-danger-foreground",info:"bg-accent-100 dark:bg-accent-900 text-accent-800 dark:text-accent-300",gray:"bg-muted text-muted-foreground"}},defaultVariants:{variant:"gray"}}),p={success:"bg-success",warning:"bg-warning",error:"bg-danger",info:"bg-info",gray:"bg-muted-foreground"};function q({variant:a="gray",dot:b=!1,className:c="",children:d,...f}){return(0,e.jsxs)("span",{className:(0,i.cn)(o({variant:a}),c),...f,children:[b&&(0,e.jsx)("span",{className:(0,i.cn)("mr-1.5 inline-block h-2 w-2 rounded-full",p[a]),"aria-hidden":"true"}),d]})}var r=c(22317),s=c(98033),t=c(79782);let u=(0,h.F)("flex w-full rounded-md border border-input bg-surface dark:bg-surface-2 text-surface-foreground shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-ring disabled:cursor-not-allowed disabled:opacity-50",{variants:{inputSize:{sm:"h-8 px-2.5 py-1 text-sm",md:"px-3 py-2 text-sm",lg:"px-4 py-2.5 text-base"}},defaultVariants:{inputSize:"md"}}),v=g().forwardRef(({className:a,inputSize:b,type:c="text",...d},f)=>(0,e.jsx)("input",{ref:f,type:c,className:(0,i.cn)(u({inputSize:b}),a),...d}));v.displayName="Input";let w=g().forwardRef(({className:a,...b},c)=>(0,e.jsx)("textarea",{ref:c,className:(0,i.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-surface dark:bg-surface-2 px-3 py-2 text-sm text-surface-foreground shadow-sm","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-ring","disabled:cursor-not-allowed disabled:opacity-50",a),...b}));w.displayName="Textarea";var x=c(79689),y=c(17793),z=c(74892),A=c(89339),B=c(51881),C=c(71613);let D=g().forwardRef(({className:a,...b},c)=>(0,e.jsx)(A.bL,{ref:c,className:(0,i.cn)("peer inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-sm border border-input bg-surface text-surface-foreground shadow-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:border-accent-600 data-[state=checked]:bg-accent-600 data-[state=checked]:text-white","data-[state=indeterminate]:border-accent-600 data-[state=indeterminate]:bg-accent-600 data-[state=indeterminate]:text-white",a),...b,children:(0,e.jsx)(A.C1,{className:"flex items-center justify-center text-current",children:"indeterminate"===b.checked?(0,e.jsx)(B.A,{className:"h-3 w-3",strokeWidth:3,"aria-hidden":"true"}):(0,e.jsx)(C.A,{className:"h-3 w-3",strokeWidth:3,"aria-hidden":"true"})})}));D.displayName="Checkbox";var E=c(64450),F=c(90133);let G=g().forwardRef(({className:a,...b},c)=>(0,e.jsx)(E.bL,{ref:c,className:(0,i.cn)("grid gap-2",a),...b}));G.displayName="RadioGroup";let H=g().forwardRef(({className:a,...b},c)=>(0,e.jsx)(E.q7,{ref:c,className:(0,i.cn)("aspect-square h-4 w-4 shrink-0 cursor-pointer rounded-full border border-input bg-surface text-accent-600 shadow-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:border-accent-600",a),...b,children:(0,e.jsx)(E.C1,{className:"flex items-center justify-center",children:(0,e.jsx)(F.A,{className:"h-2 w-2 fill-accent-600 text-accent-600","aria-hidden":"true"})})}));H.displayName="RadioGroupItem";var I=c(89989);let J=g().createContext("underline"),K=g().forwardRef(({variant:a="underline",...b},c)=>(0,e.jsx)(J.Provider,{value:a,children:(0,e.jsx)(I.bL,{ref:c,...b})}));K.displayName="Tabs";let L=g().forwardRef(({className:a,...b},c)=>{let d=g().useContext(J);return(0,e.jsx)(I.B8,{ref:c,className:(0,i.cn)("inline-flex items-center","pill"===d?"gap-1 rounded-lg bg-muted p-1":"gap-4 border-b border-border",a),...b})});L.displayName="TabsList";let M=g().forwardRef(({className:a,...b},c)=>{let d=g().useContext(J);return(0,e.jsx)(I.l9,{ref:c,className:(0,i.cn)("inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50","pill"===d?"rounded-md px-3 py-1.5 text-muted-foreground data-[state=active]:bg-surface data-[state=active]:text-surface-foreground data-[state=active]:shadow-sm":"-mb-px border-b-2 border-transparent px-1 py-2 text-muted-foreground hover:text-foreground data-[state=active]:border-accent-500 data-[state=active]:text-accent-600",a),...b})});M.displayName="TabsTrigger";let N=g().forwardRef(({className:a,...b},c)=>(0,e.jsx)(I.UC,{ref:c,className:(0,i.cn)("mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",a),...b}));N.displayName="TabsContent";var O=c(39567),P=c(85351),Q=c(82042),R=c(11010);let S=O.bL;O.YJ;let T=O.WT,U=g().forwardRef(({className:a,children:b,...c},d)=>(0,e.jsxs)(O.l9,{ref:d,className:(0,i.cn)("flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-surface dark:bg-surface-2 px-3 py-2 text-sm text-surface-foreground shadow-sm","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-ring","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",a),...c,children:[b,(0,e.jsx)(O.In,{asChild:!0,children:(0,e.jsx)(P.A,{size:16,className:"opacity-60","aria-hidden":"true"})})]}));U.displayName="SelectTrigger";let V=g().forwardRef(({className:a,children:b,position:c="popper",...d},f)=>(0,e.jsx)(O.ZL,{children:(0,e.jsxs)(O.UC,{ref:f,position:c,style:{zIndex:R.M.POPOVER},className:(0,i.cn)("relative max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-surface text-surface-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===c&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",a),...d,children:[(0,e.jsx)(O.PP,{className:"flex h-6 items-center justify-center",children:(0,e.jsx)(Q.A,{size:16,"aria-hidden":"true"})}),(0,e.jsx)(O.LM,{className:(0,i.cn)("p-1","popper"===c&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:b}),(0,e.jsx)(O.wn,{className:"flex h-6 items-center justify-center",children:(0,e.jsx)(P.A,{size:16,"aria-hidden":"true"})})]})}));V.displayName="SelectContent",g().forwardRef(({className:a,...b},c)=>(0,e.jsx)(O.JU,{ref:c,className:(0,i.cn)("px-2 py-1.5 text-xs font-semibold text-muted-foreground",a),...b})).displayName="SelectLabel";let W=g().forwardRef(({className:a,children:b,...c},d)=>(0,e.jsxs)(O.q7,{ref:d,className:(0,i.cn)("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-muted focus:text-surface-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...c,children:[(0,e.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,e.jsx)(O.VF,{children:(0,e.jsx)(C.A,{size:16,"aria-hidden":"true"})})}),(0,e.jsx)(O.p4,{children:b})]}));W.displayName="SelectItem",g().forwardRef(({className:a,...b},c)=>(0,e.jsx)(O.wv,{ref:c,className:(0,i.cn)("-mx-1 my-1 h-px bg-border",a),...b})).displayName="SelectSeparator";var X=c(16992);X.Kq,X.bL,X.l9,g().forwardRef(({className:a,sideOffset:b=4,children:c,...d},f)=>(0,e.jsx)(X.ZL,{children:(0,e.jsxs)(X.UC,{ref:f,sideOffset:b,style:{zIndex:R.M.POPOVER},className:(0,i.cn)("overflow-hidden rounded-md bg-foreground px-2.5 py-1.5 text-xs text-background shadow-md","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...d,children:[c,(0,e.jsx)(X.i3,{className:"fill-foreground"})]})})).displayName="TooltipContent",c(10290),c(85647)},74892:(a,b,c)=>{c.d(b,{d:()=>i});var d=c(21124),e=c(38301),f=c.n(e),g=c(75441),h=c(35595);let i=f().forwardRef(({className:a,...b},c)=>(0,d.jsx)(g.bL,{ref:c,className:(0,h.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-accent-600 data-[state=unchecked]:bg-muted",a),...b,children:(0,d.jsx)(g.zi,{className:(0,h.cn)("pointer-events-none block h-4 w-4 rounded-full bg-surface shadow-lg ring-0 transition-transform","data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));i.displayName="Switch"},79689:(a,b,c)=>{c.d(b,{E:()=>f});var d=c(21124);c(38301);var e=c(35595);function f({className:a,...b}){return(0,d.jsx)("div",{className:(0,e.cn)("animate-pulse rounded-md bg-muted",a),"aria-hidden":"true",...b})}},85647:(a,b,c)=>{c.d(b,{u:()=>f});var d=c(21124);c(38301);var e=c(35595);function f({className:a,children:b,...c}){return(0,d.jsx)("kbd",{className:(0,e.cn)("inline-flex h-5 min-w-[1.25rem] items-center justify-center rounded-sm border border-border bg-surface px-1","font-mono text-[10px] font-medium leading-none text-muted-foreground",a),...c,children:b})}}};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2053],{24027:(e,t,s)=>{s.d(t,{Uc:()=>A,G8:()=>v,OJ:()=>C,RF:()=>R});var l=s(95155),a=s(12115),n=s(18955),r=s(51238),i=s(22133),d=s(89451),o=s(10934),c=s(92254),u=s(5225);s(1226);var x=s(89715),m=s(57828),p=s(52056),g=s(65229),h=s(67909),k=s(3005);let f=(0,h.default)(()=>Promise.all([s.e(221),s.e(7485),s.e(953)]).then(s.bind(s,90953)).then(e=>({default:e.MermaidDiagram})),{loadableGenerated:{webpack:()=>[90953]},ssr:!1,loading:function(){let e=(0,n.c)("worktree");return(0,l.jsxs)("div",{className:"mermaid-loading flex items-center gap-2 text-muted-foreground p-4",children:[(0,l.jsx)(k.y,{size:"sm"}),(0,l.jsx)("span",{children:e("mermaid.loading")})]})}});function j(e){let{className:t,children:s}=e;if(t&&t.split(" ").includes("language-mermaid")){let e=null==s?"":"string"==typeof s?s:Array.isArray(s)?s.map(e=>"string"==typeof e?e:"").join(""):String(s);return(0,l.jsx)(f,{code:e})}return(0,l.jsx)("code",{className:t,children:s})}var b=s(50666),y=s(69352),N=s(76246);function w(e){let{apiUrl:t,alt:s,width:r,height:i}=e,d=(0,n.c)("worktree"),[o,c]=(0,a.useState)(null);return((0,a.useEffect)(()=>{let e=!1;return fetch(t).then(e=>e.ok?e.json():null).then(t=>{!e&&(null==t?void 0:t.content)&&c(t.content)}).catch(()=>{}),()=>{e=!0}},[t]),o)?(0,l.jsx)("img",{src:o,alt:s,width:r,height:i,style:{maxWidth:r||"100%"}}):(0,l.jsx)("span",{style:{color:"#999"},children:d("markdownPreview.loadingImage")})}let v=(0,a.memo)(function(e){let{content:t,onOpenFile:s,currentFilePath:n,worktreeId:x}=e,m=(0,a.useRef)(s);m.current=s;let p=(0,a.useRef)(n);p.current=n;let g=(0,a.useRef)(x);g.current=x;let h=(0,a.useCallback)((e,t)=>{let s=(0,y.d3)(t);if(s)switch((0,y.dj)(s)){case"anchor":break;case"external":e.preventDefault(),window.open(s,"_blank","noopener,noreferrer");break;case"relative":{e.preventDefault();let t=p.current,l=m.current;if(t&&l){let e=(0,y.WU)(t,s);e&&l(e)}}}},[]),k=(0,a.useMemo)(()=>({code:j,pre:e=>{let{children:t}=e;return!function(e){let t=a.Children.toArray(e)[0];if(!a.isValidElement(t))return!1;let s=t.props.className;return"string"==typeof s&&s.split(" ").includes("language-mermaid")}(t)?(0,l.jsx)(b.Ck,{children:(0,l.jsx)("pre",{className:"overflow-x-auto",children:t})}):(0,l.jsx)("pre",{children:t})},img:e=>{var t,s,a,n;let{src:r,alt:i,width:d,height:o,...c}=e,u=null!=d?d:null==(s=c.node)||null==(t=s.properties)?void 0:t.width,x=null!=o?o:null==(n=c.node)||null==(a=n.properties)?void 0:a.height;if("string"==typeof r&&!r.startsWith("http://")&&!r.startsWith("https://")&&!r.startsWith("data:")){let e=p.current,t=g.current;if(e&&t){let s=(0,y.WU)(e,r);if(s){let e="/api/worktrees/".concat(t,"/files/").concat((0,N.o)(s));return(0,l.jsx)(w,{apiUrl:e,alt:null!=i?i:"",width:u,height:x})}}}return(0,l.jsx)("img",{src:r,alt:null!=i?i:"",width:u,height:x,style:{maxWidth:u||"100%"}})},a:e=>{let{href:t,children:s,...a}=e;return t?(0,l.jsx)("a",{...a,href:t,onClick:e=>h(e,t),children:s}):(0,l.jsx)("a",{...a,children:s})}}),[h]),f=(0,a.useMemo)(()=>[i.A],[]),v=(0,a.useMemo)(()=>[d.A,[o.A,y.uO],c.A,u.A],[]);return(0,l.jsx)(r.oz,{remarkPlugins:f,rehypePlugins:v,components:k,children:t})}),R=(0,a.memo)(function(e){let{mobileTab:t,onTabChange:s}=e,a=(0,n.c)("worktree");return(0,l.jsxs)("div",{className:"flex border-b border-border",children:[(0,l.jsxs)("button",{"data-testid":"mobile-tab-editor",onClick:()=>s("editor"),className:"flex-1 py-2 text-sm font-medium ".concat("editor"===t?"text-accent-600 dark:text-accent-400 border-b-2 border-accent-600 dark:border-accent-400":"text-muted-foreground"),children:[(0,l.jsx)(x.A,{className:"h-4 w-4 inline-block mr-1"}),a("markdownPreview.editor")]}),(0,l.jsxs)("button",{"data-testid":"mobile-tab-preview",onClick:()=>s("preview"),className:"flex-1 py-2 text-sm font-medium ".concat("preview"===t?"text-accent-600 dark:text-accent-400 border-b-2 border-accent-600 dark:border-accent-400":"text-muted-foreground"),children:[(0,l.jsx)(m.A,{className:"h-4 w-4 inline-block mr-1"}),a("markdownPreview.preview")]})]})}),C=(0,a.memo)(function(e){let{isMobile:t}=e,s=(0,n.c)("worktree");return(0,l.jsxs)("div",{"data-testid":"maximize-hint",className:"flex items-center justify-center px-4 py-1 bg-muted text-muted-foreground text-xs",children:[s("markdownPreview.exitFullscreenHint")," ",t&&s("markdownPreview.exitFullscreenHintSwipe")]})}),A=(0,a.memo)(function(e){let{onDismiss:t}=e,s=(0,n.c)("worktree");return(0,l.jsxs)("div",{"data-testid":"large-file-warning",className:"flex items-center gap-2 px-4 py-2 bg-warning-subtle border-b border-warning-border text-warning-foreground text-sm",children:[(0,l.jsx)(p.A,{className:"h-4 w-4"}),s("markdownPreview.largeFileWarning"),(0,l.jsx)("button",{onClick:t,className:"ml-auto text-warning hover:text-warning",children:(0,l.jsx)(g.A,{className:"h-4 w-4"})})]})})},34380:(e,t,s)=>{s.d(t,{B:()=>E});var l=s(95155),a=s(12115),n=s(18955),r=s(744),i=s(54014),d=s(74385),o=s(50825),c=s(37381);function u(e){var t,s,l,a,n;let r=e.agentInstances&&e.agentInstances.length>0?e.agentInstances.map(e=>e.alias||e.cliTool):null!=(s=e.selectedAgents)?s:e.cliToolId?[e.cliToolId]:[];return{id:e.id,name:e.name,repositoryName:null!=(l=e.repositoryDisplayName)?l:e.repositoryName,syncedBranch:null!=(a=e.branch)?a:null,liveBranch:null!=(n=null==(t=e.gitStatus)?void 0:t.currentBranch)?n:null,dirty:e.gitStatus?e.gitStatus.isDirty:null,agents:[...new Set(r)],sessionRunning:!0===e.isSessionRunning}}let x={status:"loading",options:[]};async function m(e){let t=await fetch("/api/worktrees",{signal:e,headers:{Accept:"application/json"}});if(!t.ok)throw Error("HTTP ".concat(t.status));let s=await t.json(),l=null==s?void 0:s.worktrees;if(!Array.isArray(l))throw Error("Malformed worktree list");return l.map(u)}function p(e){let{selectedWorktreeId:t,onSelect:s,disabled:i=!1}=e,d=(0,n.c)("skills"),[o,u]=(0,a.useState)(x),[p,h]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=new AbortController;return u(x),m(e.signal).then(t=>{e.signal.aborted||u({status:"loaded",options:t})}).catch(()=>{e.signal.aborted||u({status:"error",options:[]})}),()=>e.abort()},[p]);let k=(0,a.useCallback)(()=>h(e=>e+1),[]);return"loading"===o.status?(0,l.jsxs)("div",{className:"space-y-2","data-testid":"skill-target-loading",children:[(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:d("target.loading")}),(0,l.jsx)(r.EA,{className:"h-24 w-full rounded-lg"})]}):"error"===o.status?(0,l.jsxs)(r.Zp,{className:"space-y-3","data-testid":"skill-target-error",children:[(0,l.jsx)(c.u,{tone:"danger",children:d("target.errorNotice")}),(0,l.jsx)(r.$n,{variant:"secondary",size:"sm",onClick:k,"data-testid":"skill-target-retry",children:d("target.retry")})]}):0===o.options.length?(0,l.jsx)(r.Zp,{"data-testid":"skill-target-empty",children:(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:d("target.empty")})}):(0,l.jsxs)("div",{className:"space-y-3","data-testid":"skill-target-selector",children:[(0,l.jsx)("div",{role:"radiogroup","aria-label":d("target.heading"),className:"space-y-2",children:o.options.map(e=>(0,l.jsx)(g,{option:e,selected:e.id===t,disabled:i,onSelect:s},e.id))}),(0,l.jsx)(c.u,{tone:"neutral","data-testid":"skill-target-branch-notice",children:d("target.branchFreshnessNotice")})]})}function g(e){var t;let{option:s,selected:a,disabled:i,onSelect:d}=e,o=(0,n.c)("skills"),c=null!=(t=s.liveBranch)?t:s.syncedBranch;return(0,l.jsxs)("button",{type:"button",role:"radio","aria-checked":a,disabled:i,onClick:()=>d(s.id),"data-testid":"skill-target-option-".concat(s.id),className:"w-full rounded-lg border px-3 py-2.5 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60 ".concat(a?"border-accent-500 bg-accent-50 dark:bg-accent-950/40":"border-border bg-card hover:bg-muted"),children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("span",{className:"text-sm font-semibold text-foreground break-all",children:s.name}),a&&(0,l.jsx)(r.Ex,{variant:"info",children:o("target.selected")})]}),(0,l.jsxs)("dl",{className:"mt-1.5 grid grid-cols-1 gap-x-4 gap-y-1 sm:grid-cols-2",children:[(0,l.jsx)(h,{label:o("target.repository"),children:s.repositoryName}),(0,l.jsx)(h,{label:o("target.branch"),children:null!=c?c:o("target.branchUnknown")}),(0,l.jsx)(h,{label:o("target.agents"),children:s.agents.length>0?s.agents.join(", "):o("target.agentsNone")}),(0,l.jsx)(h,{label:o("target.workingTree"),children:o(null===s.dirty?"target.workingTreeUnknown":s.dirty?"target.workingTreeDirty":"target.workingTreeClean")})]}),s.sessionRunning&&(0,l.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground","data-testid":"skill-target-session-".concat(s.id),children:o("target.sessionRunning")})]})}function h(e){let{label:t,children:s}=e;return(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:t}),(0,l.jsx)("dd",{className:"text-xs text-foreground break-words",children:s})]})}var k=s(95584);function f(e){let{label:t,children:s}=e;return(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:t}),(0,l.jsx)("dd",{className:"mt-0.5 break-words text-sm text-foreground",children:s})]})}function j(e){let{level:t,kind:s,label:a}=e,i=(0,n.c)("skills");return(0,l.jsxs)(r.Ex,{variant:k.eK[t],"data-testid":"skill-plan-risk-".concat(s,"-").concat(t),children:[a,": ",i(k.pP[t])]})}function b(e){let{entry:t}=e,s=(0,n.c)("skills"),a=k.KL[t.reason];return(0,l.jsxs)("li",{className:"space-y-1.5 rounded-md border border-border px-3 py-2","data-testid":"skill-plan-file-".concat(t.path),children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(r.Ex,{variant:k.tC[t.change],children:s(k.AS[t.change])}),(0,l.jsx)("span",{className:"break-all font-mono text-xs text-foreground",children:t.path}),t.generated&&(0,l.jsx)(r.Ex,{variant:"gray",children:s("plan.fileGenerated")})]}),a&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:s(a)}),t.gitIgnored&&(0,l.jsx)("p",{className:"text-xs text-warning-foreground",children:s("plan.gitIgnored")}),t.binary?(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:s("plan.diffBinary")}):t.diff?(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{className:"cursor-pointer text-xs text-accent-600 dark:text-accent-400",children:s("plan.diffToggle",{additions:t.additions,deletions:t.deletions})}),(0,l.jsx)("pre",{className:"mt-1 overflow-x-auto rounded bg-muted p-2 font-mono text-[11px] leading-snug text-foreground",children:t.diff}),t.diffTruncated&&(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:s("plan.diffTruncated")})]}):null]})}function y(e){var t,s,a;let{plan:i}=e,d=(0,n.c)("skills"),{target:o,skill:u}=i,x=u.compatibility.commandmate;return(0,l.jsxs)(r.Zp,{className:"space-y-4","data-testid":"skill-install-plan",children:[(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:d("plan.heading")}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:d("plan.expiresAt",{timestamp:i.expiresAt})})]}),(0,l.jsxs)("section",{className:"space-y-2",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.targetHeading")}),(0,l.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,l.jsx)(f,{label:d("target.repository"),children:o.repositoryName}),(0,l.jsx)(f,{label:d("target.heading"),children:o.worktreeName}),(0,l.jsx)(f,{label:d("target.branch"),children:null!=(t=o.branch)?t:d("target.branchUnknown")}),(0,l.jsx)(f,{label:d("plan.headStateLabel"),children:d(null!=(s=k.kF[o.headState])?s:"plan.headState.unknown")}),(0,l.jsx)(f,{label:d("target.workingTree"),children:o.workingTreeDirty?d("target.workingTreeDirty"):d("target.workingTreeClean")}),(0,l.jsx)(f,{label:d("plan.installRoot"),children:(0,l.jsx)("span",{className:"break-all font-mono text-xs",children:(o.installRoots&&o.installRoots.length>0?o.installRoots:[o.installRoot]).map(e=>(0,l.jsx)("span",{className:"block",children:e},e))})}),(0,l.jsx)(f,{label:d("plan.existingInstall"),children:o.existingInstall?d("plan.existingInstallVersion",{version:o.existingInstall.version}):d("plan.existingInstallNone")}),(0,l.jsx)(f,{label:d("detail.recommendedVersion"),children:(0,l.jsx)("span",{className:"font-mono text-xs",children:u.version})})]})]}),(0,l.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-risk-section",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.riskHeading")}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,l.jsx)(j,{level:u.declaredRisk,kind:"declared",label:d("plan.riskDeclared")}),(0,l.jsx)(j,{level:u.computedRisk,kind:"computed",label:d("plan.riskComputed")}),(0,l.jsx)(j,{level:u.effectiveRisk,kind:"effective",label:d("plan.riskEffective")})]}),(0,l.jsx)("p",{className:"break-words text-sm text-foreground",children:u.riskRationale}),(0,l.jsx)(c.u,{tone:"neutral",children:d("plan.riskNotice")})]}),(0,l.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-permissions",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("permissions.heading")}),u.declaredPermissions.length>0?(0,l.jsx)("div",{className:"flex flex-wrap gap-1.5",children:u.declaredPermissions.map(e=>(0,l.jsx)(r.Ex,{variant:"warning",children:k.z2[e]?d(k.z2[e]):e},e))}):(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:d("plan.permissionsNone")}),(0,l.jsx)(c.u,{tone:"warning",children:d("permissions.declarationOnlyNotice")})]}),(0,l.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-requirements",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("requirements.heading")}),0===u.requirements.commands.length&&0===u.requirements.networkHosts.length?(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:d("plan.requirementsNone")}):(0,l.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[u.requirements.commands.length>0&&(0,l.jsx)(f,{label:d("plan.requirementsCommands"),children:u.requirements.commands.map(e=>{var t;return"".concat(e.name," ").concat(null!=(t=e.versionRange)?t:d("plan.commandAnyVersion"))}).join(", ")}),u.requirements.networkHosts.length>0&&(0,l.jsx)(f,{label:d("plan.requirementsHosts"),children:u.requirements.networkHosts.join(", ")})]})]}),(0,l.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-scripts",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.scriptsHeading")}),0===u.executablePaths.length&&0===u.scriptPaths.length?(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:d("plan.scriptsNone")}):(0,l.jsx)("ul",{className:"space-y-1",children:[...new Set([...u.scriptPaths,...u.executablePaths])].map(e=>(0,l.jsx)("li",{className:"break-all font-mono text-xs text-foreground",children:e},e))})]}),"compatible"!==x.status&&(0,l.jsx)(c.u,{tone:"warning","data-testid":"skill-plan-compatibility-notice",children:d((0,k.e5)(x.messageKey),{range:x.requiredRange,currentVersion:null!=(a=x.currentVersion)?a:""})}),i.warnings.length>0&&(0,l.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-warnings",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.warningsHeading")}),(0,l.jsx)("ul",{className:"space-y-1",children:i.warnings.map(e=>(0,l.jsx)("li",{className:"text-xs text-warning-foreground",children:k.RO[e]?d(k.RO[e]):e},e))})]}),(0,l.jsxs)("section",{className:"space-y-2","data-testid":"skill-plan-files",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d("plan.filesHeading")}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"skill-plan-stats",children:d("plan.stats",{added:i.stats.added,modified:i.stats.modified,unchanged:i.stats.unchanged,conflicted:i.stats.conflicted,unmanaged:i.stats.unmanaged})}),0===i.files.length?(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:d("plan.filesEmpty")}):(0,l.jsx)("ul",{className:"space-y-2",children:i.files.map(e=>(0,l.jsx)(b,{entry:e},e.path))})]}),i.blockers.length>0&&(0,l.jsxs)("section",{className:"space-y-2","data-testid":"skill-install-blockers",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-danger-foreground",children:d("plan.blockersHeading")}),(0,l.jsx)("ul",{className:"space-y-1",children:i.blockers.map(e=>{var t,s;return(0,l.jsxs)("li",{className:"text-xs text-danger-foreground",children:[e.path&&(0,l.jsx)("span",{className:"mr-1 break-all font-mono",children:e.path}),e.code.startsWith("skills.")?d((0,k.e5)(e.code),{range:x.requiredRange,currentVersion:null!=(t=x.currentVersion)?t:""}):k.KL[e.code]?d(k.KL[e.code]):e.code]},"".concat(e.code,":").concat(null!=(s=e.path)?s:""))})}),(0,l.jsx)(c.u,{tone:"danger",children:d("plan.blockedNotice")})]})]})}function N(e){let{entry:t}=e,s=(0,n.c)("skills"),a=k.Mj[t.disposition],i=k.hJ[t.reason];return(0,l.jsxs)("li",{className:"flex flex-wrap items-center gap-2","data-testid":"skill-uninstall-file-".concat(t.path),children:[(0,l.jsx)(r.Ex,{variant:"remove"===t.disposition?"info":"warning",children:a?s(a):t.disposition}),(0,l.jsx)("span",{className:"break-all font-mono text-xs text-foreground",children:t.path}),i&&(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:s(i)})]})}function w(e){var t;let{plan:s}=e,a=(0,n.c)("skills"),{target:d,skill:o}=s;return(0,l.jsxs)(r.Zp,{className:"space-y-4","data-testid":"skill-uninstall-plan",children:[(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:a("uninstall.heading")}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:a("uninstall.expiresAt",{timestamp:s.expiresAt})})]}),(0,l.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,l.jsx)(f,{label:a("target.repository"),children:d.repositoryName}),(0,l.jsx)(f,{label:a("target.heading"),children:d.worktreeName}),(0,l.jsx)(f,{label:a("target.branch"),children:null!=(t=d.branch)?t:a("target.branchUnknown")}),(0,l.jsx)(f,{label:a("uninstall.installedVersion"),children:(0,l.jsx)("span",{className:"font-mono text-xs",children:o.version||a("uninstall.versionUnknown")})}),(0,l.jsx)(f,{label:a("plan.installRoot"),children:(0,l.jsx)("span",{className:"break-all font-mono text-xs",children:d.installRoot})}),(0,l.jsx)(f,{label:a("target.workingTree"),children:d.workingTreeDirty?a("target.workingTreeDirty"):a("target.workingTreeClean")})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"skill-uninstall-stats",children:a("uninstall.stats",{removable:s.stats.removable,modified:s.stats.modified,missing:s.stats.missing,unknown:s.stats.unknown,irregular:s.stats.irregular})}),(0,l.jsxs)("section",{className:"space-y-2",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:a("uninstall.removalsHeading")}),0===s.removals.length?(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:a("uninstall.removalsEmpty")}):(0,l.jsx)("ul",{className:"space-y-1.5",children:s.removals.map(e=>(0,l.jsx)(N,{entry:e},e.path))})]}),(0,l.jsxs)("section",{className:"space-y-2",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:a("uninstall.retainedHeading")}),0===s.retained.length?(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:a("uninstall.retainedEmpty")}):(0,l.jsx)("ul",{className:"space-y-1.5",children:s.retained.map(e=>(0,l.jsx)(N,{entry:e},e.path))})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[s.skill.agents.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-1.5","data-testid":"skill-uninstall-agents",children:s.skill.agents.map(e=>(0,l.jsx)(r.Ex,{variant:"gray",children:(0,i.f_)(e.agent)},e.agent))}),(0,l.jsx)(c.u,{tone:"neutral",children:a((0,k.e5)(s.nextActionKey))})]}),s.blockers.length>0&&(0,l.jsxs)("section",{className:"space-y-2","data-testid":"skill-uninstall-blockers",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-danger-foreground",children:a("uninstall.blockersHeading")}),(0,l.jsx)("ul",{className:"space-y-1",children:s.blockers.map(e=>{var t;return(0,l.jsxs)("li",{className:"text-xs text-danger-foreground",children:[e.path&&(0,l.jsx)("span",{className:"mr-1 break-all font-mono",children:e.path}),a((0,k.e5)(e.messageKey))]},"".concat(e.code,":").concat(null!=(t=e.path)?t:""))})})]})]})}var v=s(80130);let R={worktreeId:null,busy:null,installPlan:null,uninstallPlan:null,installResult:null,uninstallResult:null,riskAcknowledged:!1,failure:null};function C(e){return{...e,installPlan:null,uninstallPlan:null,installResult:null,uninstallResult:null,riskAcknowledged:!1,failure:null}}function A(e,t){return"".concat(e,"-").concat(t)}function I(e){let{failure:t}=e,s=(0,n.c)("skills");return(0,l.jsxs)("div",{className:"space-y-2","data-testid":"skill-operation-error",children:[(0,l.jsxs)(c.u,{tone:"danger",children:[(0,l.jsx)("p",{className:"font-medium",children:s("operation.errorHeading")}),(0,l.jsx)("p",{className:"mt-1",children:s((0,k.FW)(t.code))}),(0,l.jsx)("p",{className:"mt-1 break-words",children:s("state.errorCode",{code:t.code})})]}),t.nextActionKey&&(0,l.jsx)(c.u,{tone:"warning",children:s((0,k.e5)(t.nextActionKey))}),t.blockers&&t.blockers.length>0&&(0,l.jsx)("ul",{className:"space-y-1","data-testid":"skill-operation-error-blockers",children:t.blockers.map(e=>{var t;return(0,l.jsxs)("li",{className:"text-xs text-danger-foreground",children:[e.path&&(0,l.jsx)("span",{className:"mr-1 break-all font-mono",children:e.path}),s((0,k.e5)(e.messageKey))]},"".concat(e.code,":").concat(null!=(t=e.path)?t:""))})})]})}function P(e){let{agents:t,skillId:s,version:a}=e,r=(0,n.c)("skills");return 0===t.length?null:(0,l.jsxs)("div",{className:"space-y-1","data-testid":"skill-operation-reload",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:r("operation.reloadHeading")}),(0,l.jsx)("ul",{className:"space-y-1",children:t.map(e=>(0,l.jsx)("li",{className:"text-xs text-muted-foreground",children:r((0,k.e5)(e.messageKey),{agent:(0,i.f_)(e.agent),skillId:s,version:a})},e.agent))})]})}function E(e){var t;let{skillId:s,version:i,blockedReason:u,worktreeId:x,agents:m=[]}=e,g=(0,n.c)("skills"),[h,f]=(0,a.useState)(()=>x?{...R,worktreeId:x}:R),j=(0,a.useCallback)(e=>{f(t=>t.worktreeId===e?t:C({...t,worktreeId:e,busy:null}))},[]);(0,a.useEffect)(()=>{x&&j(x)},[x,j]);let b=(0,a.useCallback)(async()=>{let e=h.worktreeId;if(!e)return;f(e=>({...C(e),busy:"install-plan"}));let t=await (0,v.Q6)(e,s,{version:null!=i?i:void 0});f(e=>({...e,busy:null,installPlan:t.ok?t.data.plan:null,failure:t.ok?null:t.failure}))},[s,h.worktreeId,i]),N=(0,a.useCallback)(async()=>{let e=h.worktreeId,t=h.installPlan;if(!e||!t||t.requiresRiskAcknowledgement&&!h.riskAcknowledged)return;f(e=>({...e,busy:"install-apply",failure:null}));let l=await (0,v.Xi)(e,s,{planToken:t.token,version:t.skill.version,acknowledgeRisk:!!t.requiresRiskAcknowledgement||void 0,idempotencyKey:A("skill-install",t.token)});l.ok&&(0,d.k)(e),f(e=>({...e,busy:null,installPlan:l.ok?null:e.installPlan,installResult:l.ok?l.data:null,failure:l.ok?null:l.failure}))},[s,h.installPlan,h.riskAcknowledged,h.worktreeId]),E=(0,a.useCallback)(async()=>{let e=h.worktreeId;if(!e)return;f(e=>({...C(e),busy:"uninstall-plan"}));let t=await (0,v.hN)(e,s);f(e=>({...e,busy:null,uninstallPlan:t.ok?t.data.plan:null,failure:t.ok?null:t.failure}))},[s,h.worktreeId]),K=(0,a.useCallback)(async()=>{let e=h.worktreeId,t=h.uninstallPlan;if(!e||!t)return;f(e=>({...e,busy:"uninstall-apply",failure:null}));let l=await (0,v.E)(e,s,{planToken:t.token,idempotencyKey:A("skill-uninstall",t.token)});f(e=>({...e,busy:null,uninstallPlan:l.ok?null:e.uninstallPlan,uninstallResult:l.ok?l.data:null,failure:l.ok?null:l.failure}))},[s,h.uninstallPlan,h.worktreeId]),T=(0,a.useCallback)(()=>{f(e=>C(e))},[]),H=null!==h.busy,S=h.installPlan,W=h.uninstallPlan,q=null!=u?u:g(h.worktreeId?"plan.ready":"plan.chooseTarget"),z=null!==S&&S.requiresRiskAcknowledgement&&!h.riskAcknowledged;return(0,l.jsxs)("div",{className:"space-y-3","data-testid":"skill-install-panel",children:[!x&&(0,l.jsx)(p,{selectedWorktreeId:h.worktreeId,onSelect:j,disabled:H}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsx)(r.$n,{variant:"primary",disabled:H||null!==u||!h.worktreeId,onClick:b,"data-testid":"skill-install-action","aria-describedby":"skill-install-reason",children:g("install-plan"===h.busy?"plan.building":"plan.build")}),(0,l.jsx)(r.$n,{variant:"secondary",disabled:H||!h.worktreeId,onClick:E,"data-testid":"skill-uninstall-action",children:g("uninstall-plan"===h.busy?"uninstall.building":"uninstall.build")})]}),(0,l.jsx)("p",{id:"skill-install-reason",className:"text-sm text-muted-foreground","data-testid":"skill-install-reason",children:q}),m.length>0&&(0,l.jsxs)("div",{className:"space-y-1","data-testid":"skill-install-reload-preview",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:g("operation.reloadHeading")}),(0,l.jsx)("ul",{className:"space-y-1",children:m.map(e=>(0,l.jsx)(o.m,{agent:e,variant:"reload"},e.agent))})]}),h.failure&&(0,l.jsx)(I,{failure:h.failure}),S&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)(y,{plan:S}),S.requiresRiskAcknowledgement&&(0,l.jsxs)(r.Zp,{className:"space-y-3","data-testid":"skill-install-risk-acknowledgement",children:[(0,l.jsx)(c.u,{tone:"danger",children:g((0,k.e5)(null!=(t=S.riskAcknowledgementMessageKey)?t:"skills.plan.highRiskAcknowledgement"))}),(0,l.jsxs)("label",{className:"flex items-start gap-2 text-sm text-foreground",children:[(0,l.jsx)(r.Sc,{checked:h.riskAcknowledged,onCheckedChange:e=>f(t=>({...t,riskAcknowledged:!0===e})),disabled:H,"data-testid":"skill-install-risk-checkbox",className:"mt-0.5"}),(0,l.jsx)("span",{children:g("plan.acknowledgeLabel")})]})]}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsx)(r.$n,{variant:S.requiresRiskAcknowledgement?"danger":"primary",disabled:H||!S.installable||z,onClick:N,"data-testid":"skill-install-confirm",children:g("install-apply"===h.busy?"plan.confirming":"plan.confirm")}),(0,l.jsx)(r.$n,{variant:"ghost",disabled:H,onClick:T,"data-testid":"skill-install-discard",children:g("plan.discard")})]})]}),W&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)(w,{plan:W}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsx)(r.$n,{variant:"danger",disabled:H||!W.removable,onClick:K,"data-testid":"skill-uninstall-confirm",children:g("uninstall-apply"===h.busy?"uninstall.confirming":"uninstall.confirm")}),(0,l.jsx)(r.$n,{variant:"ghost",disabled:H,onClick:T,"data-testid":"skill-uninstall-discard",children:g("plan.discard")})]})]}),h.installResult&&(0,l.jsxs)(r.Zp,{className:"space-y-3","data-testid":"skill-install-result",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:g("operation.installedHeading")}),(0,l.jsx)(c.u,{tone:"info",children:g((0,k.e5)(h.installResult.operation.nextActionKey))}),h.installResult.operation.replayed&&(0,l.jsx)(c.u,{tone:"neutral","data-testid":"skill-operation-replayed",children:g("operation.replayNotice")}),h.installResult.install&&"files"in h.installResult.install&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:g("operation.filesWritten",{count:h.installResult.install.files.length})}),"reload"in h.installResult&&(0,l.jsx)(P,{agents:h.installResult.reload.agents,skillId:h.installResult.reload.skillId,version:h.installResult.reload.version}),(0,l.jsx)(r.$n,{variant:"secondary",size:"sm",onClick:T,"data-testid":"skill-operation-reset",children:g("operation.startOver")})]}),h.uninstallResult&&(0,l.jsxs)(r.Zp,{className:"space-y-3","data-testid":"skill-uninstall-result",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:g("operation.uninstalledHeading")}),(0,l.jsx)(c.u,{tone:"info",children:g((0,k.e5)(h.uninstallResult.operation.nextActionKey))}),h.uninstallResult.operation.replayed&&(0,l.jsx)(c.u,{tone:"neutral","data-testid":"skill-operation-replayed",children:g("operation.replayNotice")}),h.uninstallResult.uninstall&&"removedFiles"in h.uninstallResult.uninstall&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:g("operation.filesRemoved",{count:h.uninstallResult.uninstall.removedFiles.length})}),"reload"in h.uninstallResult&&(0,l.jsx)(P,{agents:h.uninstallResult.reload.agents,skillId:h.uninstallResult.reload.skillId,version:h.uninstallResult.reload.version}),(0,l.jsx)(r.$n,{variant:"secondary",size:"sm",onClick:T,"data-testid":"skill-operation-reset",children:g("operation.startOver")})]})]})}},50666:(e,t,s)=>{s.d(t,{Ck:()=>r});var l=s(95155),a=s(12115),n=s(53482);function r(e){let{children:t,as:s="div",className:r=""}=e,i=function e(t){return null==t||"boolean"==typeof t?"":"string"==typeof t?t:"number"==typeof t?String(t):Array.isArray(t)?t.map(e).join(""):a.isValidElement(t)?e(t.props.children):""}(t);if(!i||0===i.trim().length)return(0,l.jsx)(s,{className:r||void 0,children:t});let d="relative group ".concat("span"===s?"block ":"").concat(r).trim();return(0,l.jsxs)(s,{className:d,"data-testid":"code-block-with-copy",children:[t,(0,l.jsx)(n.i,{text:i,className:"absolute right-2 top-2 z-10 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 focus:opacity-100"})]})}},50825:(e,t,s)=>{s.d(t,{m:()=>o});var l=s(95155);s(12115);var a=s(18955),n=s(54014),r=s(37381),i=s(95584);function d(e){let{axis:t,agentName:s}=e,n=(0,a.c)("skills");return(0,l.jsxs)("li",{className:"text-xs text-muted-foreground","data-testid":"skill-agent-axis-".concat(t.axis),children:[(0,l.jsx)("span",{className:"font-medium text-foreground",children:n((0,i.e5)(t.axisKey))}),": ",(0,l.jsx)("span",{"data-testid":"skill-agent-axis-".concat(t.axis,"-").concat(t.outcome),children:n((0,i.e5)(t.outcomeKey))})," — ",n((0,i.e5)(t.evidenceKindKey)),t.limitationKey&&(0,l.jsx)("span",{className:"mt-0.5 block","data-testid":"skill-agent-axis-".concat(t.axis,"-limitation"),children:n((0,i.e5)(t.limitationKey),{agent:s})})]})}function o(e){var t;let{agent:s,variant:o="full"}=e,c=(0,a.c)("skills"),u=(0,n.f_)(s.agent),x=s.measured;return"reload"===o?(0,l.jsx)("li",{className:"text-xs text-muted-foreground","data-testid":"skill-agent-reload-".concat(s.agent),children:c((0,i.e5)(s.reloadKey),{agent:u})}):(0,l.jsxs)("div",{className:"space-y-1","data-testid":"skill-agent-evidence-".concat(s.agent),children:[(0,l.jsx)("p",{className:"text-xs font-medium text-foreground",children:u}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:c("compatibility.declaredLabel",{support:c((0,i.e5)(s.declaredLabelKey))})}),(0,l.jsxs)("p",{className:"text-xs text-muted-foreground break-words",children:[c("compatibility.evidence"),": ",s.evidence]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground break-words","data-testid":"skill-agent-verification-".concat(s.agent),children:c((0,i.e5)(s.verificationKey))}),x?(0,l.jsxs)("div",{className:"space-y-0.5 border-l-2 border-border pl-2",children:[(0,l.jsx)("p",{className:"text-xs font-medium text-foreground",children:c("compatibility.measuredHeading")}),(0,l.jsxs)("ul",{className:"space-y-0.5",children:[(0,l.jsx)(d,{axis:x.discovery,agentName:u}),(0,l.jsx)(d,{axis:x.invocation,agentName:u})]}),x.testedVersion&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:c("compatibility.testedVersion",{agent:u,version:x.testedVersion})}),x.testedDate&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:c("compatibility.testedDate",{date:x.testedDate})}),x.discoveryRoots.length>0&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground break-all",children:c("compatibility.discoveryRoots",{roots:x.discoveryRoots.join(", ")})}),x.evidenceSource&&(0,l.jsxs)("p",{className:"text-xs text-muted-foreground break-all",children:[c("compatibility.evidenceSource"),": ",x.evidenceSource]}),x.stale&&(0,l.jsx)(r.u,{tone:"warning","data-testid":"skill-agent-evidence-stale-".concat(s.agent),children:c("compatibility.evidenceStale",{days:null!=(t=x.ageDays)?t:0})})]}):s.skipReasonKey&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground break-words","data-testid":"skill-agent-skip-reason-".concat(s.agent),children:c((0,i.e5)(s.skipReasonKey))}),(0,l.jsxs)("p",{className:"text-xs text-muted-foreground break-words",children:[(0,l.jsx)("span",{className:"font-medium text-foreground",children:c("compatibility.reloadHeading",{agent:u})}),": ",c((0,i.e5)(s.reloadKey),{agent:u})]})]})}},53482:(e,t,s)=>{s.d(t,{i:()=>o});var l=s(95155),a=s(12115),n=s(60322),r=s(9900);function i(){return(0,l.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.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 d(){return(0,l.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function o(e){let{text:t,className:s="",label:o="Copy"}=e,[c,u]=(0,a.useState)(!1),x=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);let m=(0,a.useCallback)(async()=>{try{await (0,n.l)(t),u(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>u(!1),r.s7)}catch(e){}},[t]);return(0,l.jsxs)("button",{type:"button",onClick:m,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":c?"Copied":o,title:c?"Copied!":o,children:[c?(0,l.jsx)(d,{}):(0,l.jsx)(i,{}),(0,l.jsx)("span",{children:c?"Copied":o})]})}},60322:(e,t,s)=>{s.d(t,{l:()=>a});let l=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function a(e){var t;if(!e||0===e.trim().length)return;let s=e.replace(l,"");if(null==(t=navigator.clipboard)?void 0:t.writeText)try{await navigator.clipboard.writeText(s);return}catch(e){}let a=document.createElement("textarea");a.value=s,a.style.position="fixed",a.style.left="-9999px",a.style.top="-9999px",a.style.opacity="0",document.body.appendChild(a),a.focus(),a.select();try{document.execCommand("copy")}finally{document.body.removeChild(a)}}},69352:(e,t,s)=>{s.d(t,{WU:()=>o,d3:()=>c,dj:()=>d,uO:()=>u});var l,a,n,r,i=s(9567);function d(e){return e.startsWith("#")?"anchor":e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:")?"external":"relative"}function o(e,t){if(!t)return null;let s=e.substring(0,e.lastIndexOf("/")+1);try{let e=new URL(s,"file:///"),l=new URL(t,e),a=decodeURIComponent(l.pathname);if(a.startsWith("/")){let e=a.substring(1);if(e.length>0)return e}}catch(e){}return null}function c(e){return!e||0===e.length||e.length>2048||/[\x00-\x1f\x7f]/.test(e)?null:e}let u={...i.j,attributes:{...i.j.attributes,a:[...(null!=(n=null==(l=i.j.attributes)?void 0:l.a)?n:[]).filter(e=>"href"!==e),["href",/^(?:#|mailto:|tel:|https?:\/\/|(?![a-zA-Z][a-zA-Z0-9+.-]*:))/]],img:[...(null!=(r=null==(a=i.j.attributes)?void 0:a.img)?r:[]).filter(e=>"src"!==e),["src",/^(?:https?:\/\/|(?![a-zA-Z][a-zA-Z0-9+.-]*:))/],"alt","width","height"]}}},74385:(e,t,s)=>{s.d(t,{I:()=>l,k:()=>a});let l="skill:installed";function a(e){window.dispatchEvent(new CustomEvent(l,{detail:{worktreeId:e}}))}},75333:(e,t,s)=>{s.d(t,{Xz:()=>o,qW:()=>c,uE:()=>u});var l=s(95155);s(12115);var a=s(18955),n=s(77801),r=s(744),i=s(54014),d=s(95584);function o(e){let{status:t,className:s}=e,n=(0,a.c)("skills");return(0,l.jsx)(r.Ex,{variant:d.H$[t],className:s,"data-testid":"skill-compatibility-".concat(t),children:n(d.OV[t])})}function c(e){let{risk:t,className:s}=e,i=(0,a.c)("skills");return(0,l.jsxs)(r.Ex,{variant:d.eK[t],className:s,"data-testid":"skill-declared-risk-".concat(t),children:["high"===t&&(0,l.jsx)(n.A,{size:12,"aria-hidden":"true",className:"mr-1 shrink-0"}),i("risk.declaredLabel",{level:i(d.pP[t])})]})}function u(e){let{agent:t}=e,s=(0,a.c)("skills");return(0,l.jsxs)(r.Ex,{variant:d.Et[t.support],"data-testid":"skill-agent-".concat(t.agent,"-").concat(t.support),children:[(0,i.f_)(t.agent),": ",s((0,d.e5)(t.labelKey))]})}},76246:(e,t,s)=>{s.d(t,{o:()=>l});function l(e){return e?e.split("/").map(encodeURIComponent).join("/"):""}},99648:(e,t,s)=>{s.d(t,{Co:()=>l,Ms:()=>n,td:()=>a});let l=".agents/skills",a=".claude/skills",n="skills.permissions.declarationOnlyNotice"}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5229],{15229:(e,t,r)=>{r.d(t,{GV:()=>ti});var n=r(95155),s=r(12115),a=r(20063),i=r(52619),o=r.n(i),l=r(89275);let c=(0,s.forwardRef)(function(e,t){let{href:r,onClick:s,target:i,...c}=e,d=(0,a.usePathname)(),u=(0,l.Hq)();return(0,n.jsx)(o(),{ref:t,href:r,target:i,onClick:e=>{var t;null==s||s(e),e.defaultPrevented||0!==(t=e).button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||void 0!==i&&"_self"!==i||/^([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),h=r(94684),f=r(34681),x=r(5379),p=r(59427),b=r(37494);function g(){let{theme:e,setTheme:t}=(0,x.D)(),[r,a]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{a(!0)},[]),!r)return(0,n.jsx)("div",{"data-testid":"theme-toggle-placeholder",className:"w-8 h-8","aria-hidden":"true"});let i="dark"===e;return(0,n.jsx)("button",{"data-testid":"theme-toggle",onClick:()=>t(i?"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":i?"Switch to light mode":"Switch to dark mode",title:i?"Switch to light mode":"Switch to dark mode",children:i?(0,n.jsx)(p.A,{className:"w-5 h-5","data-testid":"theme-icon-sun"}):(0,n.jsx)(b.A,{className:"w-5 h-5","data-testid":"theme-icon-moon"})})}var v=r(63365);function y(){let{status:e}=(0,v.xM)(),t=(0,d.c)("common");if("connected"===e)return null;let r="connecting"===e,s=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(" ")}),s]})}var j=r(79651),w=r(92614);let k=[{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 N(e){let{title:t="CommandMate"}=e,r=(0,a.usePathname)(),i=(0,d.c)("commandPalette"),o=(0,d.c)("common"),{setOpen:l}=(0,w.C)(),[x,p]=s.useState(null);return s.useEffect(()=>{p("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:[k.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:o(e.labelKey)},e.href)}),(0,n.jsxs)("button",{type:"button","data-testid":"header-command-palette-trigger",onClick:()=>l(!0),"aria-label":i("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:i("searchAction")}),x&&(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(j.u,{children:x}),(0,n.jsx)(j.u,{children:"K"})]})]}),(0,n.jsx)(y,{}),(0,n.jsx)(f.g,{}),(0,n.jsx)(g,{}),(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)(h.A,{size:20,strokeWidth:2,"aria-hidden":"true"}),(0,n.jsx)("span",{children:"GitHub"})]})]})]})})})}var S=r(32916),C=r(38218);let A={showSidebar:!0,showGlobalNav:!0,showLocalNav:!1,autoCollapseSidebar:!1},M=[{prefix:"/worktrees/",config:{showGlobalNav:!1,showLocalNav:!0}},{prefix:"/sessions",config:{autoCollapseSidebar:!0}}];var E=r(22592),L=r(85710),R=r(17787),z=r(49027),B=r(27587),T=r(39649),D=r(47650),K=r(38606),W=r(48481);let P=(0,s.memo)(function(e){let{status:t,label:r,waitingKind:s}=e;return(0,n.jsx)(W.m,{"data-testid":"status-indicator",status:t,label:r,waitingKind:s,size:"lg"})});function I(e,t,r){let n=r-8-t;return n<=8?8:Math.min(Math.max(e,8),n)}function O(e){let{id:t,branch:r,isVisible:a,anchorRef:i,nextActionLabel:o}=e,[l,c]=(0,s.useState)({top:-9999,left:-9999}),d=(0,s.useRef)(null);if((0,s.useEffect)(()=>{var e,t,r;if(!a||!i.current)return;let n=i.current.getBoundingClientRect(),s=null==(e=d.current)?void 0:e.getBoundingClientRect(),o=null!=(t=null==s?void 0:s.width)?t:0,l=null!=(r=null==s?void 0:s.height)?r:0,u=window.innerWidth,m=window.innerHeight,h=n.right+8;if(h+o>u-8){let e=n.left-8-o;e>=8&&(h=e)}c({top:I(n.top,l,m),left:I(h,o,u)})},[a,i]),"undefined"==typeof document||!a)return null;let u=Math.min(384,Math.max(0,window.innerWidth-16));return D.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}),o&&(0,n.jsxs)("p",{className:"text-sidebar-muted whitespace-nowrap",children:["Next: ",o]}),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 _=0,F=(0,s.memo)(function(e){let{branch:t,isSelected:r,onClick:a,showRepositoryName:i=!0}=e,o=(0,d.c)("common"),l=(0,d.c)("worktree"),c="tooltip-".concat(t.id),u=(0,s.useRef)(null),[m,h]=(0,s.useState)(!1),f=(0,s.useRef)(null),x=(0,s.useCallback)(()=>{null!==f.current&&(clearTimeout(f.current),f.current=null)},[]);(0,s.useEffect)(()=>()=>x(),[x]);let p=(0,K.A7)(t.cliStatus),b="waiting"===p,g=!0===t.awaitingInstruction,v=t.nextActionKey?l(t.nextActionKey):null,y=(b||g)&&null!==v,j=m&&!r;return(0,s.useEffect)(()=>{r&&h(!1)},[r]),(0,s.useEffect)(()=>{if(!m)return;let e=()=>h(!1);return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[m]),(0,n.jsxs)("button",{ref:u,"data-testid":"branch-list-item",onClick:()=>{x(),_=Date.now()+400,h(!1),a()},onMouseEnter:()=>{x(),Date.now()>=_&&(f.current=setTimeout(()=>{h(!0)},150))},onMouseLeave:()=>{x(),h(!1)},onFocus:e=>{x(),e.target.matches(":focus-visible")&&(f.current=setTimeout(()=>{h(!0)},150))},onBlur:()=>{x(),h(!1)},"aria-current":r?"true":void 0,"aria-describedby":j?c:void 0,"aria-label":i?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":o("branchItem.cliToolStatus"),children:(0,n.jsx)(P,{status:p,label:(0,K.dw)(t.cliStatus,t.cliStatusLabels),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}),i&&(0,n.jsx)("p",{className:"text-xs text-sidebar-muted truncate",children:t.repositoryName}),y&&(0,n.jsx)("p",{"data-testid":"branch-next-action",className:"text-xs font-medium truncate ".concat(b?"text-warning-foreground":"text-success-foreground"),children:v})]}),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":o("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)(O,{id:c,branch:t,isVisible:j,anchorRef:u,nextActionLabel:v})]})});var V=r(41898);function H(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 G=(0,s.memo)(function(e){var t;let{sortKey:r,sortDirection:a,onSortKeyChange:i,onSortDirectionChange:o,options:l,defaultDirections:c,compact:u,tooltip:m,iconClassName:h="w-3 h-3"}=e,f=(0,d.c)("common"),[x,p]=(0,s.useState)(!1),b=(0,s.useRef)(null),g=(0,s.useRef)(null),v=(0,s.useRef)({x:0,y:0}),[y,j]=(0,s.useState)({x:0,y:0});(0,s.useEffect)(()=>{function e(e){b.current&&!b.current.contains(e.target)&&p(!1)}if(x)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x]),(0,s.useEffect)(()=>{function e(e){"Escape"===e.key&&p(!1)}if(x)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[x]),(0,s.useLayoutEffect)(()=>{let e=e=>{v.current=e,j(t=>t.x===e.x&&t.y===e.y?t:e)};if(!x)return void e({x:0,y:0});let t=g.current;if(!t)return;let r=t.getBoundingClientRect();e({x:H(r.left-v.current.x,r.width,window.innerWidth),y:H(r.top-v.current.y,r.height,window.innerHeight)})},[x]);let w=(0,s.useCallback)(()=>{p(e=>!e)},[]),k=(0,s.useCallback)(e=>{if(e===r)o("asc"===a?"desc":"asc");else{var t;i(e),o(null!=(t=null==c?void 0:c[e])?t:"asc")}p(!1)},[r,a,i,o,c]),N=(0,s.useCallback)(()=>{o("asc"===a?"desc":"asc")},[a,o]),S=(null==(t=l.find(e=>e.key===r))?void 0:t.label)||"Sort",C=(0,n.jsxs)("button",{type:"button",onClick:w,"aria-expanded":x,"aria-haspopup":"listbox","aria-label":"Sort by ".concat(S),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:h}),(0,n.jsx)("span",{className:u?"hidden":"hidden sm:inline",children:S})]});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)(V.m_,{content:m,placement:"bottom",children:C}):C,(0,n.jsx)("button",{type:"button",onClick:N,"aria-label":"asc"===a?"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"===a?(0,n.jsx)(U,{className:h}):(0,n.jsx)(X,{className:h})})]}),x&&(0,n.jsx)("div",{ref:g,role:"listbox","aria-label":f("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!==y.x||0!==y.y?{transform:"translate(".concat(y.x,"px, ").concat(y.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"===a?"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 U(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 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:"M19 9l-7 7-7-7"})})}let q=[{key:"updatedAt",labelKey:"sort.updatedAt"},{key:"repositoryName",labelKey:"sort.repositoryName"},{key:"branchName",labelKey:"sort.branchName"},{key:"status",labelKey:"sort.status"}],Y={updatedAt:"desc"},Z=(0,s.memo)(function(){let{sortKey:e,sortDirection:t,setSortKey:r,setSortDirection:a}=(0,S.VF)(),i=(0,d.c)("common"),o=(0,s.useMemo)(()=>q.map(e=>{let{key:t,labelKey:r}=e;return{key:t,label:i(r)}}),[i]);return(0,n.jsx)(G,{sortKey:e,sortDirection:t,onSortKeyChange:r,onSortDirectionChange:a,options:o,defaultDirections:Y,compact:!0,tooltip:i("tooltips.sort"),iconClassName:"w-4 h-4"})});var $=r(744),Q=r(30061),ee=r(36809);let et=["en","ja"],er={en:"English",ja:"日本語"};function en(){return{currentLocale:(0,ee.Ym)(),switchLocale:e=>{if(et.includes(e)){let t="https:"===window.location.protocol;document.cookie="".concat("locale","=").concat(e,";path=/;max-age=").concat(31536e3,";SameSite=Lax").concat(t?";Secure":""),localStorage.setItem("locale",e),window.location.reload()}}}}function es(){let{currentLocale:e,switchLocale:t}=en(),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:et.map(e=>(0,n.jsx)("option",{value:e,children:er[e]},e))})}var ea=r(65380);function ei(){let e=(0,d.c)("auth"),t=(0,ea.H)(),[r,a]=(0,s.useState)(!1);if(!t)return null;async function i(){a(!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:i,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 eo=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)(o(),{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),eh=r(7636);let ef="mcbd-sidebar-group-collapsed",ex="mcbd-sidebar-scroll-top",ep="mcbd-sidebar-group-order-cache",eb="w-4 h-4",eg=0;function ev(){try{let e=localStorage.getItem(ep);if(!e)return[];let t=function(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e=>"string"==typeof e).slice(0,500)}catch(e){return[]}}(e);return t.length,t}catch(e){return[]}}function ey(e){try{localStorage.setItem(ep,JSON.stringify(e))}catch(e){}}let ej=(0,s.memo)(function(){var e,t;let r=(0,l.Hq)(),{worktrees:a,repositories:i,selectedWorktreeId:c,selectWorktree:u,refreshWorktrees:m}=(0,T.$f)(),{closeMobileDrawer:h,sortKey:f,sortDirection:x,viewMode:p,setViewMode:b}=(0,S.VF)(),v=(0,d.c)("common"),[y,j]=(0,s.useState)(""),w=(0,s.useRef)(null),[k,N]=(0,s.useState)(()=>{try{let e=localStorage.getItem(ef);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,s]of Object.entries(t))if(!ek.has(e)&&"boolean"==typeof s){if(++n>100)break;r[e]=s}return r}catch(e){return{}}}(e):{}}catch(e){return{}}}),[C,A]=(0,s.useState)(ev),M=(0,s.useRef)(!1);(0,s.useEffect)(()=>{M.current||(M.current=!0,fetch("/api/sidebar/group-order").then(e=>e.json()).then(e=>{e.success&&Array.isArray(e.order)&&(A(e.order),ey(e.order))}).catch(()=>{}))},[]);let E=(0,s.useMemo)(()=>(0,eh.UZ)(i),[i]),B=(0,s.useMemo)(()=>(0,eh.s6)(a,E),[a,E]),D=(0,s.useMemo)(()=>B.map(K.XK),[B]),W=(0,s.useDeferredValue)(D),P=(0,s.useRef)(null),I=(0,s.useRef)(null);(0,s.useEffect)(()=>()=>{null!==I.current&&clearTimeout(I.current)},[]);let O=(0,s.useMemo)(()=>{let e=P.current;return!e||Date.now()>=e.expiresAt?W:e.items},[W]),_=(0,s.useRef)(O);(0,s.useLayoutEffect)(()=>{_.current=O});let H=(0,s.useCallback)(()=>{null!==I.current&&(clearTimeout(I.current),I.current=null);let e=P.current;if(e&&Date.now()<e.expiresAt){P.current={...e,expiresAt:1/0};return}P.current={items:_.current,expiresAt:1/0}},[]),G=(0,s.useCallback)(()=>{P.current&&(P.current={...P.current,expiresAt:Date.now()+1e3},null!==I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{P.current=null},1e3))},[]),{sortedItems:J,groupedItems:U}=function(e){let{items:t,sortKey:r,sortDirection:n,viewMode:a,filterText:i}=e,o=(0,s.useMemo)(()=>{if(!i)return t;let e=i.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e)||t.repositoryName.toLowerCase().includes(e))},[t,i]);return{sortedItems:(0,s.useMemo)(()=>(0,eh.Xn)(o,r,n),[o,r,n]),groupedItems:(0,s.useMemo)(()=>"grouped"===a?(0,eh._s)(o,r,n):[],[o,r,n,a])}}({items:O,sortKey:f,sortDirection:x,viewMode:p,filterText:y}),X=(0,s.useMemo)(()=>{if("grouped"!==p||!U)return null;if(y.trim()||0===C.length)return U;let e=new Map(C.map((e,t)=>[e,t]));return[...U].sort((t,r)=>{let n=e.has(t.repositoryName)?e.get(t.repositoryName):1/0,s=e.has(r.repositoryName)?e.get(r.repositoryName):1/0;return n===s?t.repositoryName.localeCompare(r.repositoryName):n-s})},[p,U,C,y]),q="grouped"===p?X:null;(0,s.useEffect)(()=>{try{localStorage.setItem(ef,JSON.stringify(k))}catch(e){}},[k]);let Y=(0,s.useCallback)(e=>{N(t=>({...t,[e]:!t[e]}))},[]),Q=(0,s.useCallback)(()=>{var e,t,r=null!=(t=null==(e=w.current)?void 0:e.scrollTop)?t:0;let n=Number.isFinite(r)&&r>0?r:0;eg=n;try{localStorage.setItem(ex,String(n))}catch(e){}},[]),ee=J.length>0||(null!=(e=null==q?void 0:q.length)?e:0)>0;(0,s.useEffect)(()=>{let e=w.current;if(!e)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=function(){try{let e=localStorage.getItem(ex);if(!e)return eg=0,0;let t=Number(e);Number.isFinite(t)&&t>=0&&(eg=t)}catch(e){}return eg}()});return()=>{window.cancelAnimationFrame(t)}},[ee,p]);let et=(0,s.useCallback)(e=>{Q(),u(e),r.push("/worktrees/".concat(e)),h()},[Q,u,r,h]),er=(0,R.FR)((0,R.MS)(R.AN,{activationConstraint:{distance:8}})),en=(0,s.useCallback)(e=>{let{active:t,over:r}=e;if(!r||t.id===r.id||!q)return;let n=q.map(e=>e.repositoryName),s=n.indexOf(String(t.id)),a=n.indexOf(String(r.id));if(-1===s||-1===a)return;let i=(0,z.be)(n,s,a);A(i),ey(i),fetch("/api/sidebar/group-order",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:i})}).catch(()=>{A(n),ey(n)})},[q]),ea="flat"===p?0===J.length:(null!=(t=null==q?void 0:q.length)?t:0)===0;return(0,n.jsxs)("nav",{"data-testid":"sidebar","aria-label":v("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:v("sidebar.branches")}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,n.jsx)(eS,{viewMode:p,onToggle:b}),(0,n.jsx)(Z,{}),(0,n.jsx)(eR,{refreshWorktrees:m}),(0,n.jsx)(V.m_,{content:v("tooltips.repositories"),placement:"bottom",children:(0,n.jsx)(o(),{href:"/repositories","aria-label":v("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)(L.A,{className:eb,"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)($.pd,{type:"text",placeholder:v("sidebar.searchBranches"),value:y,onChange:e=>j(e.target.value),className:"bg-background shadow-none"})}),(0,n.jsx)("div",{ref:w,"data-testid":"branch-list",onScroll:Q,onMouseEnter:H,onMouseLeave:G,className:"flex-1 overflow-y-auto overflow-x-hidden",children:ea?(0,n.jsx)("div",{className:"px-4 py-8 text-center text-sidebar-muted",children:v(y?"sidebar.noBranchesFound":"sidebar.noBranchesAvailable")}):"grouped"===p&&q?(0,n.jsx)(R.Mp,{sensors:er,collisionDetection:R.fp,onDragEnd:en,children:(0,n.jsx)(z.gB,{items:q.map(e=>e.repositoryName),strategy:z._G,children:q.map(e=>{let t=!k[e.repositoryName]||!!y.trim();return(0,n.jsx)(ew,{group:e,isExpanded:t,selectedWorktreeId:c,onToggle:()=>Y(e.repositoryName),onBranchClick:et,isDragDisabled:!!y.trim()},e.repositoryName)})})}):J.map(e=>(0,n.jsx)(F,{branch:e,isSelected:e.id===c,onClick:()=>et(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)(es,{})}),(0,n.jsx)(g,{})]}),(0,n.jsx)(ei,{})]})]})});function ew(e){let{group:t,isExpanded:r,selectedWorktreeId:s,onToggle:a,onBranchClick:i,isDragDisabled:o}=e,{attributes:l,listeners:c,setNodeRef:d,setActivatorNodeRef:u,transform:m,transition:h,isDragging:f}=(0,z.gl)({id:t.repositoryName,disabled:o}),x={transform:B.Ks.Transform.toString(m),transition:h,opacity:f?.5:1};return(0,n.jsxs)("div",{ref:d,style:x,className:"w-full min-w-0",children:[(0,n.jsx)(eN,{repositoryName:t.repositoryName,branchCount:t.branches.length,isExpanded:r,onClick:a,dragHandleRef:u,dragHandleListeners:o?void 0:c,dragHandleAttributes:o?void 0:l}),r&&t.branches.map(e=>(0,n.jsx)(F,{branch:e,isSelected:e.id===s,onClick:()=>i(e.id),showRepositoryName:!1},e.id))]})}let ek=new Set(["__proto__","constructor","prototype"]);function eN(e){let{repositoryName:t,branchCount:r,isExpanded:s,onClick:a,dragHandleRef:i,dragHandleListeners:o,dragHandleAttributes:l}=e,c=(0,d.c)("common");return(0,n.jsxs)("div",{className:"flex items-center w-full",children:[o&&(0,n.jsx)("div",{ref:i,...o,...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)(eE,{})}),(0,n.jsxs)("button",{"data-testid":"group-header",type:"button",onClick:a,"aria-expanded":s,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)(eC,{isExpanded:s}),(0,n.jsx)(eA,{color:(0,eh.LV)(t)}),(0,n.jsx)(Q.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 eS(e){let{viewMode:t,onToggle:r}=e,s=(0,d.c)("common");return(0,n.jsx)(V.m_,{content:s("tooltips.viewMode"),placement:"bottom",children:(0,n.jsx)("button",{"data-testid":"view-mode-toggle",type:"button",onClick:()=>{r("grouped"===t?"flat":"grouped")},"aria-label":s("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)(eM,{className:eb}):(0,n.jsx)(eA,{className:eb})})})}function eC(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 eA(e){let{className:t="w-3.5 h-3.5",color:r}=e;return(0,n.jsx)("svg",{className:"".concat(t," flex-shrink-0"),viewBox:"0 0 24 24",fill:null!=r?r:"none",stroke:r?"none":"currentColor",strokeWidth:2*!r,"aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}function eM(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 eE(){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 eL(e){let{className:t=""}=e;return(0,n.jsx)("svg",{className:"".concat(eb," ").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 eR=(0,s.memo)(function(e){let{refreshWorktrees:t}=e,[r,a]=(0,s.useState)(!1),i=(0,s.useRef)(!1),{showToast:o}=(0,eo.dj)(),l=(0,d.c)("common"),c=(0,s.useCallback)(async()=>{if(!i.current){i.current=!0,a(!0);try{let e=await em.Rx.sync();await t(),o(l("syncSuccess",{count:e.worktreeCount}),"success",3e3)}catch(e){e instanceof em.hD&&401===e.status?o(l("syncAuthError"),"error",5e3):o(l("syncError"),"error",5e3)}finally{i.current=!1,a(!1)}}},[t,o,l]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(V.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)(eL,{className:r?"animate-spin":""})})})})});var ez=r(65993),eB=r(37586),eT=r(66685),eD=r(61362),eK=r(37772);let eW=[{labelKey:"nav.home",href:"/",isActive:e=>"/"===e,icon:(0,n.jsx)(ez.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.chat",href:"/chat",isActive:e=>e.startsWith("/chat"),icon:(0,n.jsx)(eB.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.sessions",href:"/sessions",isActive:e=>e.startsWith("/sessions"),icon:(0,n.jsx)(eT.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.review",href:"/review",isActive:e=>e.startsWith("/review"),icon:(0,n.jsx)(eD.A,{size:20,"aria-hidden":"true"}),showsAttentionBadge:!0},{labelKey:"nav.more",href:"/more",isActive:e=>e.startsWith("/more"),icon:(0,n.jsx)(eK.A,{size:20,"aria-hidden":"true"})}];function eP(){let e=(0,a.usePathname)(),{setOpen:t}=(0,w.C)(),r=(0,d.c)("commandPalette"),s=(0,d.c)("common"),{count:i}=(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:[eW.map(t=>{let r=t.isActive(e),a=!0===t.showsAttentionBadge&&i>0;return(0,n.jsxs)(c,{href:a?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:i})]}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:s(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 eI=r(79698),eO=r(24533),e_=r(95740),eF=r(79451),eV=r(89559),eH=r(97470),eG=r(76482),eJ=r(39332),eU=r(87531),eX=r(59854),eq=r(70628),eY=r(66966),eZ=r(68704);let e$=[{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"}],eQ={home:ez.A,chat:eB.A,sessions:eT.A,repositories:eO.A,review:eD.A,skills:e_.A,more:eK.A},e0="cm.palette.recents";function e1(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 e2(e){return e.isWaitingForResponse?"waiting":e.isProcessing?"running":e.isSessionRunning?"ready":"idle"}function e5(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 e4=(0,eU.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"),e9="shrink-0 text-muted-foreground";function e6(){var e,t,r;let{open:i,setOpen:o}=(0,w.C)(),{setOpen:l}=(0,eq.K)(),c=(0,a.useRouter)(),u=(0,d.c)("commandPalette"),f=(0,d.c)("common"),{theme:g,setTheme:v}=(0,x.D)(),{setSize:y,isMobile:k}=(0,E.Ps)(),{currentLocale:N,switchLocale:S}=en(),C=(0,eY.rC)(),{showToast:A}=(0,eo.dj)(),[M,L]=(0,s.useState)(!1),[R,z]=(0,s.useState)(""),[B,T]=(0,s.useState)([]),K=(0,s.useRef)(null),P=(0,s.useRef)(null),I=(0,s.useRef)(i);(0,s.useEffect)(()=>{I.current=i},[i]),(0,s.useEffect)(()=>{L(!0)},[]),(0,s.useEffect)(()=>{function e(e){if(("k"===e.key||"K"===e.key)&&(e.metaKey||e.ctrlKey)){if(I.current){e.preventDefault(),e.stopPropagation(),o(!1);return}if(e5(e.target))return;e.preventDefault(),o(!0);return}"Escape"===e.key&&I.current&&(e.preventDefault(),e.stopPropagation(),o(!1))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o]),(0,s.useEffect)(()=>{var e,t,r,n;i?(P.current=null!=(t=document.activeElement)?t:null,null==(e=K.current)||e.focus(),z(""),T(function(){try{let e=localStorage.getItem(e0);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e1).slice(0,8)}catch(e){return[]}}())):P.current&&(null==(r=(n=P.current).focus)||r.call(n),P.current=null)},[i]);let O=(0,s.useCallback)((e,t)=>{t&&T(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(e0,JSON.stringify(n))}catch(e){}return n})(e,t)),o(!1),e()},[o]),_=(0,s.useCallback)(async()=>{try{var e;await em.Rx.sync(),await (null==C||null==(e=C.refresh)?void 0:e.call(C)),A(u("actions.syncSuccess"),"success")}catch(e){A(u("actions.syncError"),"error")}},[C,A,u]),F="dark"===g,V=""===R.trim(),H=null!=(e=null==C?void 0:C.error)?e:null,G=null!=(t=null==C?void 0:C.isLoading)&&t,J=H?[]:null!=(r=null==C?void 0:C.worktrees)?r:[],U=J.length>0,X=!H&&G&&0===J.length,q=[...J].sort((e,t)=>{let r=+!!e.isSessionRunning,n=+!!t.isSessionRunning;if(r!==n)return n-r;let s=e.updatedAt?new Date(e.updatedAt).getTime():0;return(t.updatedAt?new Date(t.updatedAt).getTime():0)-s}),Y=V?q.slice(0,8):q,Z=[{id:"theme",label:F?u("actions.toLight"):u("actions.toDark"),icon:F?p.A:b.A,run:()=>v(F?"light":"dark")},...k?[]:eZ.Uf.map(e=>({id:"displaysize:".concat(e),label:"".concat(u("actions.displaySizePrefix"),": ").concat(f("displaySize.".concat(e))),icon:eF.A,run:()=>y(e)})),{id:"sync",label:u("actions.syncRepositories"),icon:eV.A,run:()=>{_()}},{id:"locale",label:u("actions.switchLanguage"),icon:eH.A,run:()=>S("ja"===N?"en":"ja")},{id:"github",label:u("actions.openGitHub"),icon:h.A,run:()=>window.open("https://github.com/kewton/MyCodeBranchDesk","_blank","noopener,noreferrer")},{id:"keyboardShortcuts",label:u("actions.keyboardShortcuts"),icon:eG.A,run:()=>l(!0)}],$=V?B.map(e=>{if("nav"===e.kind){let t=e$.find(t=>t.key===e.id);if(!t)return null;let r=eQ[t.key],s=f("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:e9,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:s})]}),onSelect:()=>O(()=>c.push(t.href),{kind:"nav",id:t.key})}}if("worktree"===e.kind){let t=J.find(t=>t.id===e.id);if(!t)return null;let r=t.repositoryDisplayName||t.repositoryName||"",s=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)(eJ.A,{size:16,className:e9,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:s}),r&&(0,n.jsx)("span",{className:"ml-auto truncate pl-2 text-xs text-muted-foreground",children:r}),(0,n.jsx)(W.m,{status:e2(t),size:"sm",className:r?"ml-2":"ml-auto"})]}),onSelect:()=>O(()=>c.push("/worktrees/".concat(t.id)),{kind:"worktree",id:t.id})}}let t=Z.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:e9,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:t.label})]}),onSelect:()=>O(t.run,{kind:"action",id:t.id})}}).filter(e=>null!==e):[];return M?(0,D.createPortal)((0,n.jsx)(n.Fragment,{children:i&&(0,n.jsxs)("div",{className:"fixed inset-0 overflow-y-auto",style:{zIndex:eX.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:()=>o(!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,eU.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)(eI.uB,{label:u("title"),className:(0,eU.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)(m.A,{size:16,strokeWidth:2,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),(0,n.jsx)(eI.uB.Input,{ref:K,value:R,onValueChange:z,placeholder:u("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)(eI.uB.List,{className:"max-h-[min(60vh,360px)] overflow-y-auto p-2",children:[(0,n.jsx)(eI.uB.Empty,{"data-testid":"command-palette-empty",className:"py-6 text-center text-sm text-muted-foreground",children:u("empty")}),X&&(0,n.jsx)(eI.uB.Loading,{"data-testid":"command-palette-loading",className:"py-6 text-center text-sm text-muted-foreground",children:u("loading")}),$.length>0&&(0,n.jsx)(eI.uB.Group,{heading:u("groups.recent"),children:$.map(e=>(0,n.jsx)(eI.uB.Item,{value:e.value,onSelect:e.onSelect,className:e4,children:e.node},e.id))}),(0,n.jsx)(eI.uB.Group,{heading:u("groups.navigation"),children:e$.map(e=>{let t=f("nav.".concat(e.key)),r=eQ[e.key];return(0,n.jsxs)(eI.uB.Item,{value:"nav ".concat(t," ").concat(e.href),onSelect:()=>O(()=>c.push(e.href),{kind:"nav",id:e.key}),className:e4,children:[r&&(0,n.jsx)(r,{size:16,className:e9,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:t})]},e.key)})}),U&&(0,n.jsx)(eI.uB.Group,{heading:u("groups.worktrees"),children:Y.map(e=>{let t=e.repositoryDisplayName||e.repositoryName||"",r=e.branch||e.name;return(0,n.jsxs)(eI.uB.Item,{value:"worktree ".concat(t," ").concat(r," ").concat(e.name," ").concat(e.id),onSelect:()=>O(()=>c.push("/worktrees/".concat(e.id)),{kind:"worktree",id:e.id}),className:e4,children:[(0,n.jsx)(eJ.A,{size:16,className:e9,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:r}),t&&(0,n.jsx)("span",{className:"ml-auto truncate pl-2 text-xs text-muted-foreground",children:t}),(0,n.jsx)(W.m,{status:e2(e),size:"sm",className:t?"ml-2":"ml-auto"})]},e.id)})}),(0,n.jsx)(eI.uB.Group,{heading:u("groups.actions"),children:Z.map(e=>{let t=e.icon;return(0,n.jsxs)(eI.uB.Item,{value:"action ".concat(e.id," ").concat(e.label),onSelect:()=>O(e.run,{kind:"action",id:e.id}),className:e4,children:[(0,n.jsx)(t,{size:16,className:e9,"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)(j.u,{children:"↑"}),(0,n.jsx)(j.u,{children:"↓"}),u("footer.navigate")]}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(j.u,{children:"↵"}),u("footer.select")]}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(j.u,{children:"esc"}),u("footer.close")]})]})]})})})]})}),document.body):null}var e3=r(94465);let e8=["global","terminal","composer","editor"],e7=[{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:"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 te(){let{open:e,setOpen:t}=(0,eq.K)(),{open:r}=(0,w.C)(),a=(0,d.c)("keyboardShortcuts"),[i,o]=(0,s.useState)(!1);(0,s.useEffect)(()=>o(function(){if("undefined"==typeof navigator)return!1;let e=navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)}()),[]);let l=(0,s.useRef)(e);(0,s.useEffect)(()=>{l.current=e},[e]);let c=(0,s.useRef)(r);(0,s.useEffect)(()=>{c.current=r},[r]),(0,s.useEffect)(()=>{function e(e){"?"!==e.key||e.isComposing||229===e.keyCode||e5(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]:e7;return e8.map(t=>({scope:t,shortcuts:e.filter(e=>e.scope===t)})).filter(e=>e.shortcuts.length>0)}();return(0,n.jsx)(e3.a,{isOpen:e,onClose:()=>t(!1),title:a("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:a("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:a("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)(j.u,{children:"MOD"===e?i?"⌘":"Ctrl":e},t))})]},e.id))})]},t)})})})}var tt=r(52056),tr=r(65229),tn=r(52703);function ts(){let e=(0,d.c)("common"),[t,r]=(0,s.useState)(null),[a,i]=(0,s.useState)(null),o=(0,s.useCallback)(e=>{if(e.type!==tn.Oo)return;let{serverVersion:t,clientVersion:n}=e;"string"==typeof t&&"string"==typeof n&&t&&n&&t!==a&&r({serverVersion:t,clientVersion:n})},[a]);(0,v.T3)(o);let l=(0,s.useCallback)(()=>{window.location.reload()},[]),c=(0,s.useCallback)(()=>{r(e=>(e&&i(e.serverVersion),null))},[]);return t?(0,n.jsxs)("div",{"data-testid":"version-mismatch-banner",role:"alert","aria-live":"assertive",className:"fixed top-3 left-1/2 -translate-x-1/2 flex items-start gap-3 max-w-[92vw] rounded-lg border border-warning-border bg-warning-subtle px-4 py-3 text-warning-foreground shadow-lg",style:{zIndex:eX.M.TOAST},children:[(0,n.jsx)(tt.A,{className:"h-5 w-5 shrink-0 mt-0.5","aria-hidden":"true"}),(0,n.jsxs)("div",{className:"flex flex-col gap-0.5 text-sm",children:[(0,n.jsx)("span",{className:"font-semibold",children:e("versionMismatch.title")}),(0,n.jsx)("span",{children:e("versionMismatch.description",{serverVersion:t.serverVersion,clientVersion:t.clientVersion})})]}),(0,n.jsxs)("button",{type:"button","data-testid":"version-mismatch-reload",onClick:l,className:"shrink-0 inline-flex items-center gap-1.5 rounded-md border border-warning-border px-3 py-1.5 text-sm font-medium hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-2",children:[(0,n.jsx)(eV.A,{className:"h-4 w-4","aria-hidden":"true"}),e("versionMismatch.reload")]}),(0,n.jsx)("button",{type:"button","data-testid":"version-mismatch-dismiss",onClick:c,"aria-label":e("versionMismatch.dismiss"),className:"shrink-0 hover:opacity-70 focus:outline-none focus:ring-2 focus:ring-offset-2",children:(0,n.jsx)(tr.A,{className:"h-4 w-4","aria-hidden":"true"})})]}):null}let ta="transform transition-transform duration-300 ease-out",ti=(0,s.memo)(function(e){let{children:t}=e,{isOpen:r,isMobileDrawerOpen:i,closeMobileDrawer:o,width:l,setWidth:c}=(0,S.VF)(),d=(0,C.a)(),{showSidebar:u,showGlobalNav:m}=function(){var e=(0,a.usePathname)();for(let t of M)if(e.startsWith(t.prefix))return{...A,...t.config};return{...A}}(),{factor:h}=(0,E.Ps)(),f=Math.round(160*h),x=Math.round(480*h),p=Math.round(Math.min(x,Math.max(f,l*h))),b=(0,s.useRef)(null),g=(0,s.useRef)(null),v=(0,s.useCallback)(e=>{c(Math.round(e/h))},[c,h]);return d?(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[i&&(0,n.jsx)("div",{"data-testid":"drawer-overlay",className:"fixed inset-0 bg-black/50 z-40",onClick:o,"aria-hidden":"true"}),u&&(0,n.jsx)("aside",{"data-testid":"sidebar-container",className:"\n fixed left-0 top-0 h-full w-72 z-50\n ".concat(ta,"\n ").concat(i?"translate-x-0":"-translate-x-full","\n "),role:"complementary",children:(0,n.jsx)(ej,{})}),(0,n.jsx)("main",{className:"flex-1 min-h-0 overflow-hidden ".concat(m?"pb-14":""),role:"main","data-view-transition":"content",children:t}),m&&(0,n.jsx)(eP,{}),(0,n.jsx)(e6,{}),(0,n.jsx)(te,{}),(0,n.jsx)(ts,{})]}):(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[m&&(0,n.jsx)(N,{}),(0,n.jsxs)("div",{className:"flex flex-1 min-h-0",children:[u&&(0,n.jsxs)("aside",{ref:b,"data-testid":"sidebar-container",className:"\n fixed left-0\n ".concat(m?"top-16 h-[calc(100vh-4rem)]":"top-0 h-full","\n border-r border-border\n ").concat(ta,"\n ").concat(r?"translate-x-0":"-translate-x-full","\n "),style:{width:"".concat(p,"px"),zIndex:eX.M.SIDEBAR},role:"complementary","aria-hidden":!r,children:[(0,n.jsx)(ej,{}),(0,n.jsx)(to,{currentWidth:p,minWidth:f,maxWidth:x,sidebarRef:b,mainRef:g,onWidthChange:v})]}),(0,n.jsx)("main",{ref:g,className:"flex-1 min-w-0 h-full overflow-hidden transition-[padding] duration-300 ease-out",style:{paddingLeft:u&&r?"".concat(p,"px"):0},role:"main","data-view-transition":"content",children:t})]}),(0,n.jsx)(e6,{}),(0,n.jsx)(te,{}),(0,n.jsx)(ts,{})]})});function to(e){let{currentWidth:t,minWidth:r,maxWidth:s,sidebarRef:a,mainRef:i,onWidthChange:o}=e;return(0,n.jsx)("div",{"data-testid":"sidebar-resize-handle","aria-hidden":"true",onMouseDown:e=>{e.preventDefault();let n=e.clientX,l=t;i.current&&(i.current.style.transition="none");let c=e=>{l=Math.max(r,Math.min(s,t+(e.clientX-n))),a.current&&(a.current.style.width="".concat(l,"px")),i.current&&(i.current.style.paddingLeft="".concat(l,"px"))},d=()=>{document.body.style.cursor="",document.body.style.userSelect="",i.current&&(i.current.style.transition=""),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d),o(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"})}},30061:(e,t,r)=>{r.d(t,{nR:()=>i});var n=r(95155),s=r(12115),a=r(47650);function i(e){let{content:t,delay:r=200,className:i,children:o,metadata:l}=e,c=(0,s.useRef)(null),d=(0,s.useRef)(null),u=(0,s.useRef)(null),m=(0,s.useRef)(null),[h,f]=(0,s.useState)(!1),[x,p]=(0,s.useState)({top:-9999,left:-9999}),b=(0,s.useCallback)(()=>{null!==u.current&&(clearTimeout(u.current),u.current=null)},[]),g=(0,s.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},p({top:t.bottom+4,left:Math.min(t.left,r)}),f(!0),u.current=null},r))},[b,r,l]);(0,s.useLayoutEffect)(()=>{if(!h)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 s=t.top-4-r,a=s>=4?s:Math.max(4,n-r-4);p(e=>e.top===a?e:{...e,top:a})},[h]);let v=(0,s.useCallback)(()=>{b(),f(!1)},[b]);return(0,s.useEffect)(()=>()=>b(),[b]),(0,n.jsxs)("span",{ref:c,className:i,onMouseEnter:g,onMouseLeave:v,children:[null!=o?o:t,h&&"undefined"!=typeof document&&(0,a.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:x.top,left:x.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:()=>o});var n=r(95155);r(12115);var s=r(18955),a=r(22592),i=r(68704);function o(){let{size:e,setSize:t,isMobile:r}=(0,a.Ps)(),o=(0,s.c)("common");if(r)return null;let l=o("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,i.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:i.Uf.map(e=>(0,n.jsx)("option",{value:e,children:o("displaySize.".concat(e))},e))})]})}},41898:(e,t,r)=>{r.d(t,{m_:()=>l});var n=r(95155),s=r(12115),a=r(47650);function i(e,t,r){return Math.min(Math.max(e,4),Math.max(4,r-t-4))}let o={top:-9999,left:-9999};function l(e){let{content:t,placement:r="right",delay:l=100,children:c}=e,[d,u]=(0,s.useState)(!1),[m,h]=(0,s.useState)(null),f=(0,s.useRef)(null),x=(0,s.useRef)(null),p=(0,s.useRef)(null),b=(0,s.useCallback)(()=>{null!==p.current&&(clearTimeout(p.current),p.current=null)},[]),g=(0,s.useCallback)(()=>{b(),p.current=setTimeout(()=>{u(!0),p.current=null},l)},[l,b]),v=(0,s.useCallback)(()=>{b(),u(!1),h(null)},[b]),y=(0,s.useCallback)(()=>{let e=f.current,t=x.current;if(!e||!t)return;let n=e.getBoundingClientRect(),s=t.getBoundingClientRect();h(function(e,t,r,n){let s,a,o=t.left+t.width/2-r.width/2,l=t.top+t.height/2-r.height/2;switch(e){case"top":s=t.top-r.height-8,a=o;break;case"bottom":s=t.top+t.height+8,a=o;break;case"left":s=l,a=t.left-r.width-8;break;default:s=l,a=t.left+t.width+8}return{top:i(s,r.height,n.height),left:i(a,r.width,n.width)}}(r,{top:n.top,left:n.left,width:n.width,height:n.height},{width:s.width,height:s.height},{width:window.innerWidth,height:window.innerHeight}))},[r]);return(0,s.useLayoutEffect)(()=>{if(d)return y(),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0),()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0)}},[d,y]),(0,s.useEffect)(()=>()=>{b()},[b]),(0,n.jsxs)("span",{ref:f,"data-testid":"tooltip-wrapper",className:"relative inline-flex",tabIndex:-1,onMouseEnter:g,onMouseLeave:v,children:[c,d&&"undefined"!=typeof document&&(0,a.createPortal)((0,n.jsx)("span",{ref:x,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!=m?m:o,children:t}),document.body)]})}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[744],{744:(e,t,r)=>{r.d(t,{Ex:()=>g,$n:()=>a.$,Zp:()=>l,Wu:()=>f,aR:()=>c,ZB:()=>u,Sc:()=>L,TM:()=>h.TM,pd:()=>v,Jh:()=>p.a,z6:()=>I,CU:()=>T,l6:()=>F,gC:()=>W,eb:()=>B,bq:()=>Z,yv:()=>J,EA:()=>j.E,y$:()=>N.y,md:()=>x.m,dO:()=>k.d,tU:()=>E,av:()=>V,j7:()=>O,Xi:()=>P,k_:()=>y,j1:()=>w});var a=r(31166),s=r(95155),n=r(12115),i=r(83101),o=r(87531);let d=(0,i.F)("bg-surface text-surface-foreground rounded-lg border border-border shadow-sm",{variants:{variant:{default:"",elevated:"bg-gradient-to-b from-surface to-surface-2 shadow-md",interactive:"cursor-pointer transition-all duration-200 hover:border-accent-500 hover:shadow-md motion-safe:hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-accent-500 focus-visible:shadow-md motion-safe:focus-visible:-translate-y-0.5"},hover:{true:"transition-shadow duration-200 hover:shadow-md",false:""},interactive:{true:"cursor-pointer transition-all duration-200 hover:shadow-lg active:shadow-md motion-safe:hover:-translate-y-0.5 motion-safe:active:translate-y-0",false:""},padding:{none:"",sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{variant:"default",hover:!1,interactive:!1,padding:"md"}});function l(e){let{variant:t="default",hover:r=!1,interactive:a=!1,padding:n="md",className:i="",children:l,...c}=e;return(0,s.jsx)("div",{className:(0,o.cn)(d({variant:t,hover:r,interactive:a,padding:n}),i),...c,children:l})}function c(e){let{className:t="",children:r,...a}=e;return(0,s.jsx)("div",{className:(0,o.cn)("mb-3",t),...a,children:r})}function u(e){let{className:t="",children:r,...a}=e;return(0,s.jsx)("h3",{className:(0,o.cn)("text-lg font-semibold text-surface-foreground",t),...a,children:r})}function f(e){let{className:t="",children:r,...a}=e;return(0,s.jsx)("div",{className:(0,o.cn)(t),...a,children:r})}let m=(0,i.F)("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",{variants:{variant:{success:"bg-success-subtle text-success-foreground",warning:"bg-warning-subtle text-warning-foreground",error:"bg-danger-subtle text-danger-foreground",info:"bg-accent-100 dark:bg-accent-900 text-accent-800 dark:text-accent-300",gray:"bg-muted text-muted-foreground"}},defaultVariants:{variant:"gray"}}),b={success:"bg-success",warning:"bg-warning",error:"bg-danger",info:"bg-info",gray:"bg-muted-foreground"};function g(e){let{variant:t="gray",dot:r=!1,className:a="",children:n,...i}=e;return(0,s.jsxs)("span",{className:(0,o.cn)(m({variant:t}),a),...i,children:[r&&(0,s.jsx)("span",{className:(0,o.cn)("mr-1.5 inline-block h-2 w-2 rounded-full",b[t]),"aria-hidden":"true"}),n]})}var x=r(48481),p=r(94465),h=r(36402);let w=(0,i.F)("flex w-full rounded-md border border-input bg-surface dark:bg-surface-2 text-surface-foreground shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-ring disabled:cursor-not-allowed disabled:opacity-50",{variants:{inputSize:{sm:"h-8 px-2.5 py-1 text-sm",md:"px-3 py-2 text-sm",lg:"px-4 py-2.5 text-base"}},defaultVariants:{inputSize:"md"}}),v=n.forwardRef((e,t)=>{let{className:r,inputSize:a,type:n="text",...i}=e;return(0,s.jsx)("input",{ref:t,type:n,className:(0,o.cn)(w({inputSize:a}),r),...i})});v.displayName="Input";let y=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)("textarea",{ref:t,className:(0,o.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-surface dark:bg-surface-2 px-3 py-2 text-sm text-surface-foreground shadow-sm","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-ring","disabled:cursor-not-allowed disabled:opacity-50",r),...a})});y.displayName="Textarea";var j=r(40051),N=r(3005),k=r(91758),C=r(38162),R=r(7125),z=r(5917);let L=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(C.bL,{ref:t,className:(0,o.cn)("peer inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-sm border border-input bg-surface text-surface-foreground shadow-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:border-accent-600 data-[state=checked]:bg-accent-600 data-[state=checked]:text-white","data-[state=indeterminate]:border-accent-600 data-[state=indeterminate]:bg-accent-600 data-[state=indeterminate]:text-white",r),...a,children:(0,s.jsx)(C.C1,{className:"flex items-center justify-center text-current",children:"indeterminate"===a.checked?(0,s.jsx)(R.A,{className:"h-3 w-3",strokeWidth:3,"aria-hidden":"true"}):(0,s.jsx)(z.A,{className:"h-3 w-3",strokeWidth:3,"aria-hidden":"true"})})})});L.displayName="Checkbox";var S=r(24058),M=r(99051);let I=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(S.bL,{ref:t,className:(0,o.cn)("grid gap-2",r),...a})});I.displayName="RadioGroup";let T=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(S.q7,{ref:t,className:(0,o.cn)("aspect-square h-4 w-4 shrink-0 cursor-pointer rounded-full border border-input bg-surface text-accent-600 shadow-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:border-accent-600",r),...a,children:(0,s.jsx)(S.C1,{className:"flex items-center justify-center",children:(0,s.jsx)(M.A,{className:"h-2 w-2 fill-accent-600 text-accent-600","aria-hidden":"true"})})})});T.displayName="RadioGroupItem";var A=r(25667);let K=n.createContext("underline"),E=n.forwardRef((e,t)=>{let{variant:r="underline",...a}=e;return(0,s.jsx)(K.Provider,{value:r,children:(0,s.jsx)(A.bL,{ref:t,...a})})});E.displayName="Tabs";let O=n.forwardRef((e,t)=>{let{className:r,...a}=e,i=n.useContext(K);return(0,s.jsx)(A.B8,{ref:t,className:(0,o.cn)("inline-flex items-center","pill"===i?"gap-1 rounded-lg bg-muted p-1":"gap-4 border-b border-border",r),...a})});O.displayName="TabsList";let P=n.forwardRef((e,t)=>{let{className:r,...a}=e,i=n.useContext(K);return(0,s.jsx)(A.l9,{ref:t,className:(0,o.cn)("inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50","pill"===i?"rounded-md px-3 py-1.5 text-muted-foreground data-[state=active]:bg-surface data-[state=active]:text-surface-foreground data-[state=active]:shadow-sm":"-mb-px border-b-2 border-transparent px-1 py-2 text-muted-foreground hover:text-foreground data-[state=active]:border-accent-500 data-[state=active]:text-accent-600",r),...a})});P.displayName="TabsTrigger";let V=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(A.UC,{ref:t,className:(0,o.cn)("mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",r),...a})});V.displayName="TabsContent";var U=r(55644),_=r(24033),q=r(12108),D=r(59854);let F=U.bL;U.YJ;let J=U.WT,Z=n.forwardRef((e,t)=>{let{className:r,children:a,...n}=e;return(0,s.jsxs)(U.l9,{ref:t,className:(0,o.cn)("flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-surface dark:bg-surface-2 px-3 py-2 text-sm text-surface-foreground shadow-sm","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-ring","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",r),...n,children:[a,(0,s.jsx)(U.In,{asChild:!0,children:(0,s.jsx)(_.A,{size:16,className:"opacity-60","aria-hidden":"true"})})]})});Z.displayName="SelectTrigger";let W=n.forwardRef((e,t)=>{let{className:r,children:a,position:n="popper",...i}=e;return(0,s.jsx)(U.ZL,{children:(0,s.jsxs)(U.UC,{ref:t,position:n,style:{zIndex:D.M.POPOVER},className:(0,o.cn)("relative max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-surface text-surface-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",r),...i,children:[(0,s.jsx)(U.PP,{className:"flex h-6 items-center justify-center",children:(0,s.jsx)(q.A,{size:16,"aria-hidden":"true"})}),(0,s.jsx)(U.LM,{className:(0,o.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),(0,s.jsx)(U.wn,{className:"flex h-6 items-center justify-center",children:(0,s.jsx)(_.A,{size:16,"aria-hidden":"true"})})]})})});W.displayName="SelectContent",n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(U.JU,{ref:t,className:(0,o.cn)("px-2 py-1.5 text-xs font-semibold text-muted-foreground",r),...a})}).displayName="SelectLabel";let B=n.forwardRef((e,t)=>{let{className:r,children:a,...n}=e;return(0,s.jsxs)(U.q7,{ref:t,className:(0,o.cn)("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-muted focus:text-surface-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...n,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(U.VF,{children:(0,s.jsx)(z.A,{size:16,"aria-hidden":"true"})})}),(0,s.jsx)(U.p4,{children:a})]})});B.displayName="SelectItem",n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(U.wv,{ref:t,className:(0,o.cn)("-mx-1 my-1 h-px bg-border",r),...a})}).displayName="SelectSeparator";var H=r(47520);H.Kq,H.bL,H.l9,n.forwardRef((e,t)=>{let{className:r,sideOffset:a=4,children:n,...i}=e;return(0,s.jsx)(H.ZL,{children:(0,s.jsxs)(H.UC,{ref:t,sideOffset:a,style:{zIndex:D.M.POPOVER},className:(0,o.cn)("overflow-hidden rounded-md bg-foreground px-2.5 py-1.5 text-xs text-background shadow-md","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...i,children:[n,(0,s.jsx)(H.i3,{className:"fill-foreground"})]})})}).displayName="TooltipContent",r(26232),r(79651)},26232:(e,t,r)=>{r.d(t,{Hr:()=>g,Ht:()=>b,SQ:()=>f,_2:()=>m,mB:()=>x,rI:()=>c,ty:()=>u});var a=r(95155),s=r(12115),n=r(47971),i=r(5917),o=r(99051),d=r(59854),l=r(87531);let c=n.bL,u=n.l9;n.YJ;let f=s.forwardRef((e,t)=>{let{className:r,sideOffset:s=4,...i}=e;return(0,a.jsx)(n.ZL,{children:(0,a.jsx)(n.UC,{ref:t,sideOffset:s,style:{zIndex:d.M.POPOVER},className:(0,l.cn)("min-w-[8rem] overflow-hidden rounded-md border border-border bg-surface p-1 text-surface-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...i})})});f.displayName="DropdownMenuContent";let m=s.forwardRef((e,t)=>{let{className:r,inset:s,...i}=e;return(0,a.jsx)(n.q7,{ref:t,className:(0,l.cn)("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-muted focus:text-surface-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",r),...i})});m.displayName="DropdownMenuItem",s.forwardRef((e,t)=>{let{className:r,children:s,checked:o,...d}=e;return(0,a.jsxs)(n.H_,{ref:t,checked:o,className:(0,l.cn)("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-muted focus:text-surface-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...d,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(i.A,{size:16,"aria-hidden":"true"})})}),s]})}).displayName="DropdownMenuCheckboxItem";let b=s.forwardRef((e,t)=>{let{className:r,children:s,...i}=e;return(0,a.jsxs)(n.hN,{ref:t,className:(0,l.cn)("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-muted focus:text-surface-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...i,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(o.A,{size:8,className:"fill-current","aria-hidden":"true"})})}),s]})});b.displayName="DropdownMenuRadioItem";let g=n.z6;s.forwardRef((e,t)=>{let{className:r,inset:s,...i}=e;return(0,a.jsx)(n.JU,{ref:t,className:(0,l.cn)("px-2 py-1.5 text-xs font-semibold text-muted-foreground",s&&"pl-8",r),...i})}).displayName="DropdownMenuLabel";let x=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.wv,{ref:t,className:(0,l.cn)("-mx-1 my-1 h-px bg-border",r),...s})});x.displayName="DropdownMenuSeparator"},40051:(e,t,r)=>{r.d(t,{E:()=>n});var a=r(95155);r(12115);var s=r(87531);function n(e){let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,s.cn)("animate-pulse rounded-md bg-muted",t),"aria-hidden":"true",...r})}},48481:(e,t,r)=>{r.d(t,{m:()=>u});var a=r(95155);r(12115);var s=r(18955),n=r(87531);let i={idle:{colorClass:"bg-muted-foreground",labelKey:"status.idle"},ready:{colorClass:"bg-success",labelKey:"status.ready"},running:{colorClass:"bg-success text-success ring-2 ring-success/40",animationClass:"animate-status-glow",labelKey:"status.running"},generating:{colorClass:"bg-success text-success ring-2 ring-success/40",animationClass:"animate-status-glow",labelKey:"status.generating"},waiting:{colorClass:"bg-warning text-warning ring-4 ring-warning/50",animationClass:"animate-status-attention",labelKey:"status.waiting"},error:{colorClass:"bg-danger",labelKey:"status.error"}},o={colorClass:"bg-warning text-warning ring-2 ring-warning/40",animationClass:"animate-status-glow",labelKey:"status.waiting"},d=new Set(["menu","unclassified"]),l={colorClass:"bg-muted-foreground",labelKey:"status.unknown"},c={sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"};function u(e){let{status:t,size:r="md",label:u,waitingKind:f,className:m,...b}=e,g=(0,s.c)("common"),x=function(e,t){var r;let a=null!=(r=i[e])?r:l;return"waiting"!==e?a:t&&d.has(t)?o:a}(t,f),p=null!=u?u:g(x.labelKey);return(0,a.jsx)("span",{className:(0,n.cn)("inline-block flex-shrink-0 rounded-full",c[r],x.colorClass,x.animationClass,m),title:p,"aria-label":p,...b})}},79651:(e,t,r)=>{r.d(t,{u:()=>n});var a=r(95155);r(12115);var s=r(87531);function n(e){let{className:t,children:r,...n}=e;return(0,a.jsx)("kbd",{className:(0,s.cn)("inline-flex h-5 min-w-[1.25rem] items-center justify-center rounded-sm border border-border bg-surface px-1","font-mono text-[10px] font-medium leading-none text-muted-foreground",t),...n,children:r})}},91758:(e,t,r)=>{r.d(t,{d:()=>o});var a=r(95155),s=r(12115),n=r(27599),i=r(87531);let o=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.bL,{ref:t,className:(0,i.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-accent-600 data-[state=unchecked]:bg-muted",r),...s,children:(0,a.jsx)(n.zi,{className:(0,i.cn)("pointer-events-none block h-4 w-4 rounded-full bg-surface shadow-lg ring-0 transition-transform","data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})});o.displayName="Switch"}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9263],{55924:(e,t,r)=>{r.d(t,{K:()=>a});var n=r(95155),l=r(12115);function a(e){let{entries:t,title:r,headerOffset:a=64,root:o=null,className:s=""}=e,[i,d]=(0,l.useState)(null);return((0,l.useRef)(null).current=i,(0,l.useEffect)(()=>{if("undefined"==typeof IntersectionObserver||0===t.length)return;let e=new IntersectionObserver(e=>{let t=function(e){let t=e.filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top);return t.length>0?t[0].target.id:null}(e);t&&d(t)},{root:o,rootMargin:"-".concat(a,"px 0px -70% 0px"),threshold:0}),r=[];for(let n of t){let t=document.getElementById(n.id);t&&(e.observe(t),r.push(t))}return()=>{e.disconnect(),r.length=0}},[t,a,o]),0===t.length)?null:(0,n.jsxs)("nav",{"aria-label":r,className:s,children:[(0,n.jsx)("p",{className:"px-3 pb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:r}),(0,n.jsx)("ul",{className:"space-y-0.5 text-sm",children:t.map((e,t)=>{let r=e.id===i;return(0,n.jsx)("li",{children:(0,n.jsx)("a",{href:"#".concat(e.id),onClick:t=>((e,t)=>{e.preventDefault();let r="undefined"!=typeof document?document.getElementById(t):null;r&&r.scrollIntoView({behavior:"smooth",block:"start"}),d(t)})(t,e.id),"aria-current":r?"location":void 0,"data-depth":e.depth,style:{paddingLeft:"".concat((e.depth-1)*12+12,"px")},className:["block truncate rounded py-1 pr-2 transition-colors",r?"bg-accent-50 font-medium text-accent-700":"text-muted-foreground hover:bg-muted hover:text-foreground"].join(" "),title:e.text,children:e.text})},"".concat(e.id,"-").concat(t))})})]})}},79263:(e,t,r)=>{r.r(t),r.d(t,{MarkdownEditor:()=>ee});var n=r(95155),l=r(12115),a=r(47650),o=r(18955),s=r(80003),i=r(52056),d=r(64269),c=r(60322),u=r(94442),f=r(36402),m=r(3005),h=r(72115),v=r(89715),x=r(71847);let p=(0,x.A)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);var g=r(57828);let w=(0,x.A)("list-indent-increase",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]),b=(0,x.A)("list-indent-decrease",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);var k=r(76482),y=r(5917),j=r(75426),E=r(97624),N=r(37354);let C=(0,x.A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var S=r(65229),M=r(744);let F=(0,l.memo)(function(e){let{filePath:t,isDirty:r,viewMode:l,onViewModeChange:a,showMobileTabs:s,copied:i,onCopy:d,isMaximized:c,onToggleFullscreen:u,isAutoSaveEnabled:f,onAutoSaveToggle:m,isAutoSaving:h,isSaving:x,onSave:F,onClose:R,hideViewModeToggle:T,hideMaximizeButton:A,onIndent:P,onOutdent:V,tabMovesFocus:z,onToggleTabMovesFocus:I}=e,D=(0,o.c)("worktree"),O=e=>e.preventDefault();return(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,n.jsx)(v.A,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,n.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:t}),r&&(0,n.jsx)("span",{"data-testid":"dirty-indicator",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-warning-subtle text-warning-foreground flex-shrink-0",children:D("editor.unsaved")})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!s&&!T&&(0,n.jsxs)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1",children:[(0,n.jsx)("button",{"data-testid":"view-mode-split","aria-pressed":"split"===l,onClick:()=>a("split"),className:"p-1.5 rounded ".concat("split"===l?"bg-white dark:bg-input shadow-sm text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:D("editor.splitView"),children:(0,n.jsx)(p,{className:"h-4 w-4"})}),(0,n.jsx)("button",{"data-testid":"view-mode-editor","aria-pressed":"editor"===l,onClick:()=>a("editor"),className:"p-1.5 rounded ".concat("editor"===l?"bg-white dark:bg-input shadow-sm text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:D("editor.editorOnly"),children:(0,n.jsx)(v.A,{className:"h-4 w-4"})}),(0,n.jsx)("button",{"data-testid":"view-mode-preview","aria-pressed":"preview"===l,onClick:()=>a("preview"),className:"p-1.5 rounded ".concat("preview"===l?"bg-white dark:bg-input shadow-sm text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:D("editor.previewOnly"),children:(0,n.jsx)(g.A,{className:"h-4 w-4"})})]}),(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"editor-indent-button",onMouseDown:O,onClick:P,className:"flex min-h-[44px] min-w-[44px] items-center justify-center p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:D("editor.indent"),"aria-label":D("editor.indent"),children:(0,n.jsx)(w,{className:"h-4 w-4"})}),(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"editor-outdent-button",onMouseDown:O,onClick:V,className:"flex min-h-[44px] min-w-[44px] items-center justify-center p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:D("editor.outdent"),"aria-label":D("editor.outdent"),children:(0,n.jsx)(b,{className:"h-4 w-4"})}),(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"editor-tab-focus-toggle",onMouseDown:O,onClick:I,"aria-pressed":z,className:"flex min-h-[44px] min-w-[44px] items-center justify-center p-1.5 hover:bg-muted rounded ".concat(z?"text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:D(z?"editor.tabMovesFocusOn":"editor.tabMovesFocusOff"),"aria-label":D(z?"editor.tabMovesFocusOn":"editor.tabMovesFocusOff"),children:(0,n.jsx)(k.A,{className:"h-4 w-4"})}),(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"copy-content-button",onClick:d,className:"p-1.5 hover:bg-muted rounded ".concat(i?"text-success":"text-muted-foreground hover:text-foreground"),title:D("actions.copyContent"),children:i?(0,n.jsx)(y.A,{className:"h-4 w-4"}):(0,n.jsx)(j.A,{className:"h-4 w-4"})}),!A&&(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"maximize-button",onClick:u,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:D(c?"editor.exitFullscreen":"editor.enterFullscreen"),"aria-pressed":c,children:c?(0,n.jsx)(E.A,{className:"h-4 w-4"}):(0,n.jsx)(N.A,{className:"h-4 w-4"})}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:D("editor.auto")}),(0,n.jsx)("button",{"data-testid":"auto-save-toggle",role:"switch","aria-checked":f,onClick:()=>m(!f),className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors ".concat(f?"bg-accent-600":"bg-input"),children:(0,n.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ".concat(f?"translate-x-4":"translate-x-0.5")})})]}),f?(0,n.jsx)("span",{"data-testid":"auto-save-indicator",className:"text-sm text-muted-foreground",children:h?D("actions.saving"):r?"":D("actions.saved")}):(0,n.jsxs)(M.$n,{variant:"ghost","data-testid":"save-button",onClick:F,disabled:!r||x,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ".concat(r&&!x?"bg-accent-600 text-white hover:bg-accent-700":"bg-muted text-muted-foreground cursor-not-allowed"),children:[(0,n.jsx)(C,{className:"h-4 w-4"}),D(x?"actions.saving":"actions.save")]}),R&&(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"close-button",onClick:R,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:D("actions.close"),children:(0,n.jsx)(S.A,{className:"h-4 w-4"})})]})]})});var R=r(24027),T=r(55924),A=r(79962),P=r(38218);let V=l.useLayoutEffect;function z(){if("undefined"==typeof document)return null;let e=document;return e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement||e.msFullscreenElement||null}var I=r(2317),D=r(60850),O=r(8269),L=r(51434),K=r(59854),$=r(9900);function H(e,t){return e.lastIndexOf("\n",t-1)+1}function W(e,t,r){let n=r>t&&r>0&&"\n"===e[r-1]?r-1:r;return{start:H(e,t),end:function(e,t){let r=e.indexOf("\n",t);return -1===r?e.length:r}(e,n)}}function _(e,t,r,n,l,a){return{replaceStart:t,replaceEnd:r,replacement:n,selectionStart:l,selectionEnd:a,value:e.slice(0,t)+n+e.slice(r)}}function q(e,t,r,n){if(!(r>t&&e.slice(t,r).includes("\n"))){let l=t-H(e,t),a=n.length-l%n.length,o=" ".repeat(a),s=t+o.length;return _(e,t,r,o,s,s)}let{start:l,end:a}=W(e,t,r),o=e.slice(l,a).split("\n").map(e=>""===e||"\r"===e?e:n+e).join("\n");return _(e,l,a,o,l,l+o.length)}function B(e,t,r,n){let{start:l,end:a}=W(e,t,r),o=e.slice(l,a),s=o.split("\n").map(e=>(function(e,t){if(e.startsWith(" "))return e.slice(1);let r=0;for(;r<t.length&&" "===e[r];)r+=1;return e.slice(r)})(e,n)).join("\n");if(s===o)return t===r?null:_(e,l,a,s,t,r);if(t===r){let r=Math.min(o.length-s.length,Math.max(0,t-l)),n=t-r;return _(e,l,a,s,n,n)}return _(e,l,a,s,l,l+s.length)}let G={split:{showEditor:!0,showPreview:!0,editorWidth:"w-1/2",previewWidth:"w-1/2"},editor:{showEditor:!0,showPreview:!1,editorWidth:"w-full",previewWidth:"w-0"},preview:{showEditor:!1,showPreview:!0,editorWidth:"w-0",previewWidth:"w-full"}},U="commandmate:md-editor-view-mode",J={WARNING_THRESHOLD:512e3};function X(e){return"number"==typeof e&&e>=.1&&e<=.9}function Y(e){return"boolean"==typeof e}function Z(e){return"split"===e||"editor"===e||"preview"===e}let Q=(0,l.memo)(function(e){let{previewContent:t,onOpenFile:r,filePath:a,worktreeId:o,tocVisible:i,onToggleTocVisible:d,tocTitle:c,tocShowLabel:u,tocHideLabel:f}=e,m=(0,l.useRef)(null),h=(0,l.useRef)(null),[v,x]=(0,l.useState)(null),[p,g]=(0,l.useState)(!1);(0,l.useEffect)(()=>{x(h.current)},[]),(0,l.useEffect)(()=>{let e=m.current;if(!e||"undefined"==typeof ResizeObserver)return;let t=new ResizeObserver(e=>{var t,r;g((null!=(r=null==(t=e[0])?void 0:t.contentRect.width)?r:0)>=480)});return t.observe(e),()=>t.disconnect()},[]);let w=(0,l.useMemo)(()=>(0,A.K)(t),[t]),b=w.length>=2&&p,k=b&&i;return(0,n.jsxs)("div",{ref:m,className:"relative flex flex-1 overflow-hidden",children:[(0,n.jsx)("div",{ref:h,"data-testid":"markdown-preview",className:"flex-1 min-w-0 p-4 overflow-y-auto prose prose-sm dark:prose-invert max-w-none prose-headings:scroll-mt-2",children:(0,n.jsx)(R.G8,{content:t,onOpenFile:r,currentFilePath:a,worktreeId:o})}),k&&(0,n.jsx)("aside",{"data-testid":"markdown-preview-toc",className:"w-48 flex-shrink-0 overflow-y-auto border-l border-border py-4",children:(0,n.jsx)("div",{className:"sticky top-0",children:(0,n.jsx)(T.K,{entries:w,title:c,headerOffset:0,root:v})})}),b&&(0,n.jsx)("button",{"data-testid":"markdown-preview-toc-toggle",onClick:d,"aria-pressed":i,"aria-label":i?f:u,title:i?f:u,className:"absolute top-2 right-2 z-10 flex items-center justify-center rounded-md border border-border bg-surface/90 p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted shadow-sm",children:(0,n.jsx)(s.A,{className:"h-4 w-4"})})]})}),ee=(0,l.memo)(function(e){let{worktreeId:t,filePath:r,fileType:s,onClose:v,onSave:x,initialViewMode:p,onMaximizedChange:g,onDirtyChange:w,onOpenFile:b,initialContent:k,embedded:y=!1,onContentChange:j}=e,E="text"===(null!=s?s:r.toLowerCase().endsWith(".md")?"markdown":"text"),N=(0,o.c)("worktree"),C=(0,f.SC)(),S=void 0!==k,M=null!=k?k:"",[T,H]=(0,l.useState)(M),[W,_]=(0,l.useState)(M),[ee,et]=(0,l.useState)(M),[er,en]=(0,l.useState)(()=>E||y?"editor":function(e){if(e&&Z(e))return e;{let e=localStorage.getItem(U);if(e&&Z(e))return e}return"split"}(p)),[el,ea]=(0,l.useState)(!S),[eo,es]=(0,l.useState)(!1),[ei,ed]=(0,l.useState)(null),[ec,eu]=(0,l.useState)(()=>S&&new Blob([M]).size>J.WARNING_THRESHOLD),[ef,em]=(0,l.useState)(!1),[eh,ev]=(0,l.useState)("editor"),[ex,ep]=(0,l.useState)(null),{showToast:eg}=(0,u.dj)(),ew=(0,l.useRef)(null),eb=(0,l.useRef)(null),ek=(0,l.useRef)(null),ey=(0,l.useRef)(null),ej=(0,l.useRef)(null),eE=(0,l.useRef)(null),eN=(0,P.a)(),eC=function(){let[e,t]=(0,l.useState)(!1);return V(()=>{let e=window.matchMedia("(orientation: portrait)");t(e.matches);let r=e=>{t(e.matches)};return e.addEventListener("change",r),()=>e.removeEventListener("change",r)},[]),e}();(0,l.useEffect)(()=>{eN&&ev("preview")},[eN]);let{isKeyboardVisible:eS,keyboardHeight:eM}=(0,L.C)(),{value:eF,setValue:eR}=(0,I.V)({key:"commandmate:md-editor-maximized",defaultValue:!1,validate:Y}),{isFullscreen:eT,isFallbackMode:eA,enterFullscreen:eP,exitFullscreen:eV,toggleFullscreen:ez}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elementRef:t,onEnter:r,onExit:n,onError:a}=e,[o,s]=(0,l.useState)(!1),[i,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),f=(0,l.useCallback)(()=>{let e=null!=z();s(e),!e&&i&&d(!1)},[i]),m=(0,l.useCallback)(async()=>{if(u(null),"undefined"!=typeof navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||0)){s(!0),d(!0),null==r||r();return}if(function(){if("undefined"==typeof document)return!1;let e=document;return!!(e.fullscreenEnabled||e.webkitFullscreenEnabled||e.mozFullScreenEnabled||e.msFullscreenEnabled)}()&&(null==t?void 0:t.current))try{var e;await ((e=t.current).requestFullscreen?Promise.resolve(e.requestFullscreen()):e.webkitRequestFullscreen?Promise.resolve(e.webkitRequestFullscreen()):e.mozRequestFullScreen?Promise.resolve(e.mozRequestFullScreen()):e.msRequestFullscreen?Promise.resolve(e.msRequestFullscreen()):Promise.reject(Error("Fullscreen API not supported"))),s(!0),d(!1),null==r||r()}catch(t){let e=t instanceof Error?t.message:"Failed to enter fullscreen";u(e),null==a||a(t instanceof Error?t:Error(e)),s(!0),d(!0),null==r||r()}else s(!0),d(!0),null==r||r()},[t,r,a]),h=(0,l.useCallback)(async()=>{if(u(null),i){s(!1),d(!1),null==n||n();return}if(z())try{await function(){if("undefined"==typeof document)return Promise.resolve();let e=document;return e.exitFullscreen?Promise.resolve(e.exitFullscreen()):e.webkitExitFullscreen?Promise.resolve(e.webkitExitFullscreen()):e.mozCancelFullScreen?Promise.resolve(e.mozCancelFullScreen()):e.msExitFullscreen?Promise.resolve(e.msExitFullscreen()):Promise.resolve()}(),s(!1),null==n||n()}catch(t){let e=t instanceof Error?t.message:"Failed to exit fullscreen";u(e),null==a||a(t instanceof Error?t:Error(e)),s(!1),d(!1),null==n||n()}else s(!1),d(!1),null==n||n()},[i,n,a]),v=(0,l.useCallback)(async()=>{o?await h():await m()},[o,m,h]);return(0,l.useEffect)(()=>(function(e){if("undefined"==typeof document)return()=>{};let t=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];for(let r of t)document.addEventListener(r,e);return()=>{for(let r of t)document.removeEventListener(r,e)}})(f),[f]),{isFullscreen:o,isFallbackMode:i,enterFullscreen:m,exitFullscreen:h,toggleFullscreen:v,error:c}}({elementRef:ey,onEnter:()=>eR(!0),onExit:()=>eR(!1)}),{value:eI,setValue:eD}=(0,I.V)({key:"commandmate:md-editor-split-ratio",defaultValue:.5,validate:X}),{value:eO,setValue:eL}=(0,I.V)({key:"commandmate:md-editor-auto-save",defaultValue:!1,validate:Y}),{value:eK,setValue:e$}=(0,I.V)({key:"commandmate:md-editor-tab-moves-focus",defaultValue:!1,validate:Y}),{value:eH,setValue:eW}=(0,I.V)({key:A.Y,defaultValue:!0,validate:Y}),e_=(0,l.useCallback)(()=>{eW(e=>!e)},[eW]),{ref:eq}=(0,O.hU)({onSwipeDown:()=>{eT&&eV()},threshold:150,enabled:eT&&eN}),eB=T!==W,eG=E?G.editor:G[er];(0,l.useEffect)(()=>{null==w||w(eB)},[eB,w]);let eU=!E&&eN&&eC&&"split"===er,eJ=(0,l.useMemo)(()=>(0,d.sg)(e=>{et(e)},300),[]),eX=(0,l.useCallback)(async()=>{ea(!0),ed(null);try{let n=await fetch("/api/worktrees/".concat(t,"/files/").concat(r)),l=await n.json();if(!n.ok||!l.success){var e;throw Error((null==(e=l.error)?void 0:e.message)||N("editor.loadError"))}let a=l.content||"";H(a),_(a),et(a),new Blob([a]).size>J.WARNING_THRESHOLD&&eu(!0)}catch(e){ed(e instanceof Error?e.message:N("editor.loadError"))}finally{ea(!1)}},[t,r]),eY=(0,l.useCallback)(async e=>{let n=await fetch("/api/worktrees/".concat(t,"/files/").concat(r),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})});if(401===n.status||n.redirected)throw Error(N("editor.sessionExpired"));let l=await n.json();if(!n.ok||!l.success){var a;throw Error((null==(a=l.error)?void 0:a.message)||N("editor.saveError"))}_(e)},[t,r,N]),{isSaving:eZ,error:eQ,saveNow:e0}=(0,D.U)({value:T,saveFn:eY,debounceMs:3e3,disabled:!eO}),e1=(0,l.useCallback)(e=>{eL(e),e&&eB&&eY(T)},[eL,eB,eY,T]),e4=(0,l.useCallback)(async()=>{if(eB&&!eo){es(!0);try{await eY(T),eg(N("editor.saveSuccess"),"success"),x&&x(r,T)}catch(e){eg(e instanceof Error?e.message:N("editor.saveError"),"error")}finally{es(!1)}}},[eY,T,eB,eo,x,r,eg,N]),e2=T.split("\n").length,e5=(0,l.useCallback)(()=>{ew.current&&eb.current&&(eb.current.scrollTop=ew.current.scrollTop)},[]),e3=(0,l.useCallback)(e=>{let t=e.target.value;H(t),eJ(t),null==j||j(t)},[eJ,j]),e8=(0,l.useCallback)(e=>{en(e),localStorage.setItem(U,e)},[]),e7=(0,l.useCallback)(async()=>{if(eO){if((eB||eZ)&&(await e0(),eQ)&&!await C({description:N("editor.saveFailedCloseConfirm"),variant:"danger"}))return}else if(eB&&!await C({description:N("editor.unsavedCloseConfirm"),variant:"danger"}))return;null==v||v()},[eO,eB,eZ,e0,eQ,v,C,N]),e9=(0,l.useCallback)(async()=>{try{await (0,c.l)(T),em(!0),setTimeout(()=>em(!1),$.pX)}catch(e){}},[T]),e6=(0,l.useCallback)(e=>{if(!ej.current)return;let t=ej.current.offsetWidth;if(0===t)return;let r=e/t;eD(e=>Math.max(.1,Math.min(.9,e+r)))},[eD]),te=(0,l.useCallback)(()=>{eD(.5)},[eD]),tt=(0,l.useCallback)(e=>{if(e.target!==ew.current||e.currentTarget===e.target){if((e.ctrlKey||e.metaKey)&&"s"===e.key){e.preventDefault(),eO?(async()=>{await e0(),null==x||x(r,T)})():e4();return}if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F"===e.key){e.preventDefault(),ez();return}if("Escape"===e.key&&eT){e.preventDefault(),eV();return}}},[e4,eO,e0,x,r,T,ez,eV,eT]),tr=(0,l.useCallback)(e=>{let t=ew.current;if(!t)return;if(e.value===t.value)return void t.setSelectionRange(e.selectionStart,e.selectionEnd);t.focus(),t.setSelectionRange(e.replaceStart,e.replaceEnd);let r=!1;try{r="function"==typeof document.execCommand&&document.execCommand("insertText",!1,e.replacement)}catch(e){r=!1}if(r)return void t.setSelectionRange(e.selectionStart,e.selectionEnd);eE.current={start:e.selectionStart,end:e.selectionEnd},H(e.value),eJ(e.value),null==j||j(e.value)},[eJ,j]),tn=(0,l.useCallback)(()=>{let e=ew.current;e&&tr(q(e.value,e.selectionStart,e.selectionEnd," "))},[tr]),tl=(0,l.useCallback)(()=>{let e=ew.current;if(!e)return;let t=B(e.value,e.selectionStart,e.selectionEnd," ");t&&tr(t)},[tr]),ta=(0,l.useCallback)(()=>{e$(e=>!e)},[e$]),to=(0,l.useCallback)(e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&("m"===e.key||"M"===e.key)){e.preventDefault(),ta();return}if("Tab"===e.key&&!eK&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=e.currentTarget,r=e.shiftKey?B(t.value,t.selectionStart,t.selectionEnd," "):q(t.value,t.selectionStart,t.selectionEnd," ");r&&(e.preventDefault(),tr(r));return}tt(e)},[eK,ta,tr,tt]);(0,l.useEffect)(()=>{let e=eE.current;if(!e)return;eE.current=null;let t=ew.current;t&&(t.focus(),t.setSelectionRange(e.start,e.end))},[T]);let ts=(0,l.useCallback)(e=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{ref:eb,className:"flex-shrink-0 py-4 pl-2 pr-2 text-right select-none text-muted-foreground font-mono text-sm bg-muted dark:bg-muted/50 border-r border-border overflow-hidden","aria-hidden":"true",children:Array.from({length:e2},(e,t)=>(0,n.jsx)("div",{className:"leading-[1.5rem]",children:t+1},t+1))}),(0,n.jsx)("textarea",{ref:ew,"data-testid":"markdown-editor-textarea",value:T,onChange:e3,onKeyDown:to,onScroll:e5,className:"flex-1 py-4 pr-4 pl-3 font-mono text-sm resize-none bg-surface text-foreground focus:outline-none leading-[1.5rem]".concat(e?" focus:ring-2 focus:ring-ring focus:ring-inset":""),placeholder:E?N("editor.placeholder"):N("editor.placeholderMarkdown"),spellCheck:!1})]}),[e2,T,e3,to,e5,E,N]);(0,l.useEffect)(()=>{let e=e=>{"Escape"===e.key&&eT&&(e.preventDefault(),eV())};return eT&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[eT,eV]),(0,l.useEffect)(()=>{y||eF&&!eT&&eP()},[]),(0,l.useEffect)(()=>{if("undefined"==typeof document)return;let e=document.getElementById("markdown-editor-portal");return e||((e=document.createElement("div")).id="markdown-editor-portal",document.body.appendChild(e)),ep(e),()=>{let e=document.getElementById("markdown-editor-portal");e&&0===e.childNodes.length&&e.remove()}},[]),(0,l.useEffect)(()=>{null==g||g(eT)},[eT,g]),(0,l.useEffect)(()=>{S||eX()},[eX,S]),(0,l.useEffect)(()=>{let e=eO?eB||eZ:eB,t=t=>{e&&(t.preventDefault(),t.returnValue="")};return e?(ek.current=t,window.addEventListener("beforeunload",t)):ek.current&&(window.removeEventListener("beforeunload",ek.current),ek.current=null),()=>{ek.current&&window.removeEventListener("beforeunload",ek.current)}},[eB,eZ,eO]),(0,l.useEffect)(()=>{eQ&&eO&&(eL(!1),eg(N("editor.autoSaveFailed"),"error"))},[eQ,eO,eL,eg,N]);let ti=(0,l.useMemo)(()=>{let e="flex flex-col bg-surface";return eT&&eA?"".concat(e," fixed inset-0"):"".concat(e," h-full")},[eT,eA]),td=(0,l.useMemo)(()=>{if(eT)return{zIndex:K.M.MAXIMIZED_EDITOR}},[eT]),tc=(0,l.useMemo)(()=>{if("split"===er&&!eU)return{width:"".concat(100*eI,"%"),flexShrink:0}},[er,eI,eU]),tu=(0,l.useMemo)(()=>{if("split"===er&&!eU)return{width:"".concat((1-eI)*100,"%"),flexShrink:0}},[er,eI,eU]),tf=(0,l.useMemo)(()=>{if(eS&&eM>0)return{paddingBottom:eM}},[eS,eM]);if(el)return(0,n.jsx)("div",{"data-testid":"markdown-editor",className:"flex items-center justify-center h-full bg-surface",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)(m.y,{size:"xl",variant:"accent",className:"inline-block"}),(0,n.jsx)("p",{className:"mt-4 text-muted-foreground",children:N("editor.loading")})]})});if(ei)return(0,n.jsx)("div",{"data-testid":"markdown-editor-error",className:"flex items-center justify-center h-full bg-surface",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)(i.A,{className:"h-12 w-12 text-danger mx-auto mb-4"}),(0,n.jsx)("p",{className:"text-danger-foreground",children:ei}),v&&(0,n.jsx)("button",{onClick:v,className:"mt-4 px-4 py-2 bg-muted hover:bg-muted/80 rounded-lg text-foreground",children:N("actions.close")})]})});let tm=(0,n.jsxs)("div",{ref:e=>{ey.current=e,eq.current=e},"data-testid":"markdown-editor",className:ti,style:td,onKeyDown:tt,role:eT&&eA?"dialog":void 0,"aria-modal":eT&&eA?"true":void 0,children:[(0,n.jsx)(F,{filePath:r,isDirty:eB,viewMode:er,onViewModeChange:e8,showMobileTabs:eU,copied:ef,onCopy:e9,isMaximized:eT,onToggleFullscreen:ez,isAutoSaveEnabled:eO,onAutoSaveToggle:e1,isAutoSaving:eZ,isSaving:eo,onSave:e4,onClose:v?e7:void 0,hideViewModeToggle:E||y,hideMaximizeButton:y,onIndent:tn,onOutdent:tl,tabMovesFocus:eK,onToggleTabMovesFocus:ta}),eT&&(0,n.jsx)(R.OJ,{isMobile:eN}),ec&&(0,n.jsx)(R.Uc,{onDismiss:()=>eu(!1)}),eU&&(0,n.jsx)(R.RF,{mobileTab:eh,onTabChange:ev}),(0,n.jsxs)("div",{ref:ej,className:"flex flex-1 overflow-hidden",style:tf,children:[eU?"editor"===eh&&(0,n.jsx)("div",{"data-testid":"markdown-editor-container",className:"flex overflow-hidden w-full flex-1",children:ts(!1)}):(0,n.jsx)("div",{"data-testid":"markdown-editor-container",className:"flex overflow-hidden transition-all duration-200 ".concat(eG.showEditor?"":"hidden"),style:"split"===er?tc:{width:eG.showEditor?"100%":"0%"},children:ts(!0)}),"split"===er&&eG.showEditor&&eG.showPreview&&!eU&&(0,n.jsx)(h.f,{onResize:e6,onDoubleClick:te,orientation:"horizontal",ariaValueNow:Math.round(100*eI),minRatio:.1}),eU?"preview"===eh&&(0,n.jsx)("div",{"data-testid":"markdown-preview-container",className:"flex flex-col overflow-hidden w-full",children:(0,n.jsx)(Q,{previewContent:ee,onOpenFile:b,filePath:r,worktreeId:t,tocVisible:eH,onToggleTocVisible:e_,tocTitle:N("toc.title"),tocShowLabel:N("toc.show"),tocHideLabel:N("toc.hide")})}):(0,n.jsx)("div",{"data-testid":"markdown-preview-container",className:"flex flex-col overflow-hidden transition-all duration-200 ".concat(eG.showPreview?"":"hidden"),style:"split"===er?tu:{width:eG.showPreview?"100%":"0%"},children:(0,n.jsx)(Q,{previewContent:ee,onOpenFile:b,filePath:r,worktreeId:t,tocVisible:eH,onToggleTocVisible:e_,tocTitle:N("toc.title"),tocShowLabel:N("toc.show"),tocHideLabel:N("toc.hide")})})]})]});return eT&&eA&&ex?(0,a.createPortal)(tm,ex):tm})},79962:(e,t,r)=>{r.d(t,{K:()=>s,Y:()=>l});var n=r(21286);let l="commandmate:md-toc-visible",a=/^ {0,3}(#{1,6})(?:[ \t]+(.*?))?[ \t]*$/,o=/^( {0,3})(`{3,}|~{3,})(.*)$/;function s(e){if(!e)return[];let t=new n.A,r=[],l=null,s=0;for(let n of e.split("\n")){var i;let e=o.exec(n);if(l){if(e){let t=e[2];t[0]===l&&t.length>=s&&""===e[3].trim()&&(l=null,s=0)}continue}if(e){let t=e[2],r=t[0];if("`"===r&&e[3].includes("`"));else{l=r,s=t.length;continue}}let d=a.exec(n);if(!d)continue;let c=d[1].length,u=function(e){let t=e;return(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/!\[[^\]]*\]\([^)]*\)/g,"")).replace(/!\[[^\]]*\]\[[^\]]*\]/g,"")).replace(/\[([^\]]*)\]\([^)]*\)/g,"$1")).replace(/\[([^\]]*)\]\[[^\]]*\]/g,"$1")).replace(/\[([^\]]*)\]/g,"$1")).replace(/(`+)([\s\S]*?)\1/g,"$2")).replace(/(\*\*|__)(.*?)\1/g,"$2")).replace(/(\*|_)(.*?)\1/g,"$2")).replace(/~~(.*?)~~/g,"$1")).replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")).trim()}((null!=(i=d[2])?i:"").replace(/([ \t]|^)#+[ \t]*$/,"")),f=t.slug(u);r.push({depth:c,text:u,id:f})}return r}},80003:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(71847).A)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]])}}]);
@@ -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(15229),r=s(12115),i=s(18955),o=s(71360),l=s(744),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,4974,8566,1191,6402,744,6381,5229,8441,1255,7358],()=>e(e.s=38038)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{1150:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let r=n(95155),l=n(12115),o=n(24437);function a(e){return{default:e&&"default"in e?e.default:e}}n(36552);let u={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},i=function(e){let t={...u,...e},n=(0,l.lazy)(()=>t.loader().then(a)),i=t.loading;function s(e){let a=i?(0,r.jsx)(i,{isLoading:!0,pastDelay:!0,error:null}):null,u=!t.ssr||!!t.loading,s=u?l.Suspense:l.Fragment,c=t.ssr?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(o.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(s,{...u?{fallback:a}:{},children:c})}return s.displayName="LoadableComponent",s}},8567:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=n(17828)},17828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,n(64054).createAsyncLocalStorage)()},24437:(e,t,n)=>{"use strict";function r(e){let{reason:t,children:n}=e;return n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return r}}),n(24553)},36552:(e,t,n)=>{"use strict";function r(e){let{moduleIds:t}=e;return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return r}}),n(95155),n(47650),n(8567),n(77278)},48935:(e,t,n)=>{Promise.resolve().then(n.bind(n,70462))},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{bindSnapshot:function(){return a},createAsyncLocalStorage:function(){return o},createSnapshot:function(){return u}});let n=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class r{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}static bind(e){return e}}let l="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return l?new l:new r}function a(e){return l?l.bind(e):r.bind(e)}function u(){return l?l.snapshot():function(e,...t){return e(...t)}}},65380:(e,t,n)=>{"use strict";n.d(t,{H:()=>u,O:()=>a});var r=n(95155),l=n(12115);let o=(0,l.createContext)(!1);function a(e){let{children:t,authEnabled:n}=e;return(0,r.jsx)(o.Provider,{value:n,children:t})}function u(){return(0,l.useContext)(o)}},67909:(e,t,n)=>{"use strict";n.d(t,{default:()=>l.a});var r=n(86278),l=n.n(r)},70462:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var r=n(95155),l=n(12115),o=n(67909),a=n(18955),u=n(65380);let i=/(?:^|&)token=([^&]*)/;var s=n(744);let c=(0,o.default)(()=>n.e(6271).then(n.bind(n,6271)).then(e=>({default:e.QrCodeGenerator})),{loadableGenerated:{webpack:()=>[6271]},ssr:!1});function d(){var e;let t=(0,a.c)("auth"),n=(0,u.H)(),[o,d]=(0,l.useState)(""),[f,h]=(0,l.useState)(null),[b,m]=(0,l.useState)(!1),[g,p]=(0,l.useState)(null),{autoLoginErrorKey:y,retryAfterSeconds:v,clearError:_}=function(e){let[t,n]=(0,l.useState)(null),[r,o]=(0,l.useState)(null),a=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{let t;if(!e||a.current)return;a.current=!0;let r=window.location.hash;if(!r)return;let l=(r.startsWith("#")?r.substring(1):r).match(i);if(l){history.replaceState(null,"","".concat(window.location.pathname).concat(window.location.search));try{t=decodeURIComponent(l[1])}catch(e){n("token_invalid");return}if(t=t.trim()){if(t.length>256)return void n("token_invalid");(async()=>{try{let e=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t})});e.ok?window.location.href="/":401===e.status?n("token_invalid"):429===e.status?(o(function(e){if(!e)return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}(e.headers.get("Retry-After"))),n("rate_limited")):n("auto_login_failed")}catch(e){n("auto_login_failed")}})()}}},[e]),{autoLoginErrorKey:t,retryAfterSeconds:r,clearError:()=>{n(null),o(null)}}}(n),j={token_invalid:t("login.qr.tokenExpiredOrInvalid"),rate_limited:t("login.qr.rateLimited"),auto_login_failed:t("login.qr.autoLoginError")},x=y&&null!=(e=j[y])?e:null;async function w(e){e.preventDefault(),h(null),_(),m(!0);try{let e=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:o})});if(e.ok){window.location.href="/";return}if(429===e.status){let n=e.headers.get("Retry-After"),r=n?parseInt(n,10):900;p(r),h(t("error.lockedOut"));return}if(401===e.status)return void h(t("error.invalidToken"));h(t("error.unknownError"))}catch(e){h(t("error.unknownError"))}finally{m(!1)}}if((0,l.useEffect)(()=>{n||(window.location.href="/")},[n]),(0,l.useEffect)(()=>{null!==v&&p(v)},[v]),(0,l.useEffect)(()=>{if(null===g||g<=0)return;let e=setInterval(()=>{p(t=>null===t||t<=1?(clearInterval(e),null):t-1)},1e3);return()=>clearInterval(e)},[g]),!n)return null;let k=x||f;return(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-background",children:(0,r.jsxs)("div",{className:"bg-surface p-8 rounded-lg shadow-md w-full max-w-md",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold mb-6 text-center text-foreground",children:t("login.title")}),(0,r.jsxs)("form",{onSubmit:w,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"token",className:"block text-sm font-medium text-foreground mb-1",children:t("login.tokenLabel")}),(0,r.jsx)(s.pd,{id:"token",type:"password",value:o,onChange:e=>d(e.target.value),placeholder:t("login.tokenPlaceholder"),autoFocus:!0,autoComplete:"off",disabled:null!==g&&g>0})]}),k&&(0,r.jsxs)("div",{className:"text-danger-foreground text-sm",children:[k,null!==g&&g>0&&(0,r.jsx)("div",{className:"mt-1",children:t("error.retryAfter",{minutes:Math.ceil(g/60)})})]}),(0,r.jsx)(s.$n,{type:"submit",fullWidth:!0,loading:b,disabled:!o||null!==g&&g>0,children:t("login.submitButton")})]}),(0,r.jsx)("div",{className:"hidden md:block",children:(0,r.jsx)(c,{})})]})})}},86278:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let r=n(28140)._(n(1150));function l(e,t){var n;let l={};"function"==typeof e&&(l.loader=e);let o={...l,...t};return(0,r.default)({...o,modules:null==(n=o.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},e=>{e.O(0,[6809,4909,2770,6402,744,8441,1255,7358],()=>e(e.s=48935)),_N_E=e.O()}]);