@ai-development-environment/server 0.0.102 → 0.0.103

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 (266) hide show
  1. package/package.json +1 -1
  2. package/standalone/.next/BUILD_ID +1 -1
  3. package/standalone/.next/build-manifest.json +3 -3
  4. package/standalone/.next/prerender-manifest.json +3 -3
  5. package/standalone/.next/server/app/[locale]/(auth)/register/page.js.nft.json +1 -1
  6. package/standalone/.next/server/app/[locale]/(auth)/register/page_client-reference-manifest.js +1 -1
  7. package/standalone/.next/server/app/[locale]/(auth)/sign-in/page.js.nft.json +1 -1
  8. package/standalone/.next/server/app/[locale]/(auth)/sign-in/page_client-reference-manifest.js +1 -1
  9. package/standalone/.next/server/app/[locale]/(dashboard)/actions/page.js.nft.json +1 -1
  10. package/standalone/.next/server/app/[locale]/(dashboard)/actions/page_client-reference-manifest.js +1 -1
  11. package/standalone/.next/server/app/[locale]/(dashboard)/actions-cache/page.js.nft.json +1 -1
  12. package/standalone/.next/server/app/[locale]/(dashboard)/actions-cache/page_client-reference-manifest.js +1 -1
  13. package/standalone/.next/server/app/[locale]/(dashboard)/agents/[id]/page.js.nft.json +1 -1
  14. package/standalone/.next/server/app/[locale]/(dashboard)/agents/[id]/page_client-reference-manifest.js +1 -1
  15. package/standalone/.next/server/app/[locale]/(dashboard)/agents/page.js.nft.json +1 -1
  16. package/standalone/.next/server/app/[locale]/(dashboard)/agents/page_client-reference-manifest.js +1 -1
  17. package/standalone/.next/server/app/[locale]/(dashboard)/analytics-events/page.js.nft.json +1 -1
  18. package/standalone/.next/server/app/[locale]/(dashboard)/analytics-events/page_client-reference-manifest.js +1 -1
  19. package/standalone/.next/server/app/[locale]/(dashboard)/api-keys/page.js.nft.json +1 -1
  20. package/standalone/.next/server/app/[locale]/(dashboard)/api-keys/page_client-reference-manifest.js +1 -1
  21. package/standalone/.next/server/app/[locale]/(dashboard)/apps/[appId]/page.js.nft.json +1 -1
  22. package/standalone/.next/server/app/[locale]/(dashboard)/apps/[appId]/page_client-reference-manifest.js +1 -1
  23. package/standalone/.next/server/app/[locale]/(dashboard)/apps/page.js.nft.json +1 -1
  24. package/standalone/.next/server/app/[locale]/(dashboard)/apps/page_client-reference-manifest.js +1 -1
  25. package/standalone/.next/server/app/[locale]/(dashboard)/build-data/page.js.nft.json +1 -1
  26. package/standalone/.next/server/app/[locale]/(dashboard)/build-data/page_client-reference-manifest.js +1 -1
  27. package/standalone/.next/server/app/[locale]/(dashboard)/builds/[buildId]/coverage/page.js.nft.json +1 -1
  28. package/standalone/.next/server/app/[locale]/(dashboard)/builds/[buildId]/coverage/page_client-reference-manifest.js +1 -1
  29. package/standalone/.next/server/app/[locale]/(dashboard)/builds/[buildId]/page.js.nft.json +1 -1
  30. package/standalone/.next/server/app/[locale]/(dashboard)/builds/[buildId]/page_client-reference-manifest.js +1 -1
  31. package/standalone/.next/server/app/[locale]/(dashboard)/builds/page.js.nft.json +1 -1
  32. package/standalone/.next/server/app/[locale]/(dashboard)/builds/page_client-reference-manifest.js +1 -1
  33. package/standalone/.next/server/app/[locale]/(dashboard)/changes/page.js.nft.json +1 -1
  34. package/standalone/.next/server/app/[locale]/(dashboard)/changes/page_client-reference-manifest.js +1 -1
  35. package/standalone/.next/server/app/[locale]/(dashboard)/codebases/[codebaseId]/page.js.nft.json +1 -1
  36. package/standalone/.next/server/app/[locale]/(dashboard)/codebases/[codebaseId]/page_client-reference-manifest.js +1 -1
  37. package/standalone/.next/server/app/[locale]/(dashboard)/codebases/page.js.nft.json +1 -1
  38. package/standalone/.next/server/app/[locale]/(dashboard)/codebases/page_client-reference-manifest.js +1 -1
  39. package/standalone/.next/server/app/[locale]/(dashboard)/codebases/repositories/[repositoryId]/page.js.nft.json +1 -1
  40. package/standalone/.next/server/app/[locale]/(dashboard)/codebases/repositories/[repositoryId]/page_client-reference-manifest.js +1 -1
  41. package/standalone/.next/server/app/[locale]/(dashboard)/commands/[commandId]/edit/page.js.nft.json +1 -1
  42. package/standalone/.next/server/app/[locale]/(dashboard)/commands/[commandId]/edit/page_client-reference-manifest.js +1 -1
  43. package/standalone/.next/server/app/[locale]/(dashboard)/commands/new/page.js.nft.json +1 -1
  44. package/standalone/.next/server/app/[locale]/(dashboard)/commands/new/page_client-reference-manifest.js +1 -1
  45. package/standalone/.next/server/app/[locale]/(dashboard)/commands/page.js.nft.json +1 -1
  46. package/standalone/.next/server/app/[locale]/(dashboard)/commands/page_client-reference-manifest.js +1 -1
  47. package/standalone/.next/server/app/[locale]/(dashboard)/commands/runs/[runId]/page.js.nft.json +1 -1
  48. package/standalone/.next/server/app/[locale]/(dashboard)/commands/runs/[runId]/page_client-reference-manifest.js +1 -1
  49. package/standalone/.next/server/app/[locale]/(dashboard)/comments/page.js.nft.json +1 -1
  50. package/standalone/.next/server/app/[locale]/(dashboard)/comments/page_client-reference-manifest.js +1 -1
  51. package/standalone/.next/server/app/[locale]/(dashboard)/console-logs/page.js.nft.json +1 -1
  52. package/standalone/.next/server/app/[locale]/(dashboard)/console-logs/page_client-reference-manifest.js +1 -1
  53. package/standalone/.next/server/app/[locale]/(dashboard)/costs/page.js.nft.json +1 -1
  54. package/standalone/.next/server/app/[locale]/(dashboard)/costs/page_client-reference-manifest.js +1 -1
  55. package/standalone/.next/server/app/[locale]/(dashboard)/credentials/page.js.nft.json +1 -1
  56. package/standalone/.next/server/app/[locale]/(dashboard)/credentials/page_client-reference-manifest.js +1 -1
  57. package/standalone/.next/server/app/[locale]/(dashboard)/devices/[id]/page.js.nft.json +1 -1
  58. package/standalone/.next/server/app/[locale]/(dashboard)/devices/[id]/page_client-reference-manifest.js +1 -1
  59. package/standalone/.next/server/app/[locale]/(dashboard)/devices/enroll/page.js.nft.json +1 -1
  60. package/standalone/.next/server/app/[locale]/(dashboard)/devices/enroll/page_client-reference-manifest.js +1 -1
  61. package/standalone/.next/server/app/[locale]/(dashboard)/devices/page.js.nft.json +1 -1
  62. package/standalone/.next/server/app/[locale]/(dashboard)/devices/page_client-reference-manifest.js +1 -1
  63. package/standalone/.next/server/app/[locale]/(dashboard)/drafts/page.js.nft.json +1 -1
  64. package/standalone/.next/server/app/[locale]/(dashboard)/drafts/page_client-reference-manifest.js +1 -1
  65. package/standalone/.next/server/app/[locale]/(dashboard)/github-cache/entries/[id]/page.js.nft.json +1 -1
  66. package/standalone/.next/server/app/[locale]/(dashboard)/github-cache/entries/[id]/page_client-reference-manifest.js +1 -1
  67. package/standalone/.next/server/app/[locale]/(dashboard)/github-cache/page.js.nft.json +1 -1
  68. package/standalone/.next/server/app/[locale]/(dashboard)/github-cache/page_client-reference-manifest.js +1 -1
  69. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/cache/page.js.nft.json +1 -1
  70. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/cache/page_client-reference-manifest.js +1 -1
  71. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/comments/page.js.nft.json +1 -1
  72. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/comments/page_client-reference-manifest.js +1 -1
  73. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/merge-requests/[projectId]/[iid]/page.js.nft.json +1 -1
  74. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/merge-requests/[projectId]/[iid]/page_client-reference-manifest.js +1 -1
  75. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/merge-requests/page.js.nft.json +1 -1
  76. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/merge-requests/page_client-reference-manifest.js +1 -1
  77. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/pipelines/page.js.nft.json +1 -1
  78. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/pipelines/page_client-reference-manifest.js +1 -1
  79. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/webhooks/page.js.nft.json +1 -1
  80. package/standalone/.next/server/app/[locale]/(dashboard)/gitlab/webhooks/page_client-reference-manifest.js +1 -1
  81. package/standalone/.next/server/app/[locale]/(dashboard)/jira/tickets/[issueKey]/page.js.nft.json +1 -1
  82. package/standalone/.next/server/app/[locale]/(dashboard)/jira/tickets/[issueKey]/page_client-reference-manifest.js +1 -1
  83. package/standalone/.next/server/app/[locale]/(dashboard)/jira/tickets/page.js.nft.json +1 -1
  84. package/standalone/.next/server/app/[locale]/(dashboard)/jira/tickets/page_client-reference-manifest.js +1 -1
  85. package/standalone/.next/server/app/[locale]/(dashboard)/jira-cache/page.js.nft.json +1 -1
  86. package/standalone/.next/server/app/[locale]/(dashboard)/jira-cache/page_client-reference-manifest.js +1 -1
  87. package/standalone/.next/server/app/[locale]/(dashboard)/jira-cache/tickets/[issueKey]/page.js.nft.json +1 -1
  88. package/standalone/.next/server/app/[locale]/(dashboard)/jira-cache/tickets/[issueKey]/page_client-reference-manifest.js +1 -1
  89. package/standalone/.next/server/app/[locale]/(dashboard)/jira-webhooks/page.js.nft.json +1 -1
  90. package/standalone/.next/server/app/[locale]/(dashboard)/jira-webhooks/page_client-reference-manifest.js +1 -1
  91. package/standalone/.next/server/app/[locale]/(dashboard)/jobs/[jobId]/page.js.nft.json +1 -1
  92. package/standalone/.next/server/app/[locale]/(dashboard)/jobs/[jobId]/page_client-reference-manifest.js +1 -1
  93. package/standalone/.next/server/app/[locale]/(dashboard)/notifications/page.js.nft.json +1 -1
  94. package/standalone/.next/server/app/[locale]/(dashboard)/notifications/page_client-reference-manifest.js +1 -1
  95. package/standalone/.next/server/app/[locale]/(dashboard)/page.js.nft.json +1 -1
  96. package/standalone/.next/server/app/[locale]/(dashboard)/page_client-reference-manifest.js +1 -1
  97. package/standalone/.next/server/app/[locale]/(dashboard)/plans/[runId]/page.js.nft.json +1 -1
  98. package/standalone/.next/server/app/[locale]/(dashboard)/plans/[runId]/page_client-reference-manifest.js +1 -1
  99. package/standalone/.next/server/app/[locale]/(dashboard)/plans/page.js.nft.json +1 -1
  100. package/standalone/.next/server/app/[locale]/(dashboard)/plans/page_client-reference-manifest.js +1 -1
  101. package/standalone/.next/server/app/[locale]/(dashboard)/polling/page.js.nft.json +1 -1
  102. package/standalone/.next/server/app/[locale]/(dashboard)/polling/page_client-reference-manifest.js +1 -1
  103. package/standalone/.next/server/app/[locale]/(dashboard)/prepare/page.js.nft.json +1 -1
  104. package/standalone/.next/server/app/[locale]/(dashboard)/prepare/page_client-reference-manifest.js +1 -1
  105. package/standalone/.next/server/app/[locale]/(dashboard)/provisioning-profiles/[profileId]/page.js.nft.json +1 -1
  106. package/standalone/.next/server/app/[locale]/(dashboard)/provisioning-profiles/[profileId]/page_client-reference-manifest.js +1 -1
  107. package/standalone/.next/server/app/[locale]/(dashboard)/provisioning-profiles/page.js.nft.json +1 -1
  108. package/standalone/.next/server/app/[locale]/(dashboard)/provisioning-profiles/page_client-reference-manifest.js +1 -1
  109. package/standalone/.next/server/app/[locale]/(dashboard)/pull-requests/[owner]/[repository]/[number]/page.js.nft.json +1 -1
  110. package/standalone/.next/server/app/[locale]/(dashboard)/pull-requests/[owner]/[repository]/[number]/page_client-reference-manifest.js +1 -1
  111. package/standalone/.next/server/app/[locale]/(dashboard)/pull-requests/page.js.nft.json +1 -1
  112. package/standalone/.next/server/app/[locale]/(dashboard)/pull-requests/page_client-reference-manifest.js +1 -1
  113. package/standalone/.next/server/app/[locale]/(dashboard)/push-notifications/page.js.nft.json +1 -1
  114. package/standalone/.next/server/app/[locale]/(dashboard)/push-notifications/page_client-reference-manifest.js +1 -1
  115. package/standalone/.next/server/app/[locale]/(dashboard)/runs/new/page.js.nft.json +1 -1
  116. package/standalone/.next/server/app/[locale]/(dashboard)/runs/new/page_client-reference-manifest.js +1 -1
  117. package/standalone/.next/server/app/[locale]/(dashboard)/sessions/[runId]/page.js.nft.json +1 -1
  118. package/standalone/.next/server/app/[locale]/(dashboard)/sessions/[runId]/page_client-reference-manifest.js +1 -1
  119. package/standalone/.next/server/app/[locale]/(dashboard)/sessions/page.js.nft.json +1 -1
  120. package/standalone/.next/server/app/[locale]/(dashboard)/sessions/page_client-reference-manifest.js +1 -1
  121. package/standalone/.next/server/app/[locale]/(dashboard)/settings/page.js.nft.json +1 -1
  122. package/standalone/.next/server/app/[locale]/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  123. package/standalone/.next/server/app/[locale]/(dashboard)/skills/[skillId]/page.js.nft.json +1 -1
  124. package/standalone/.next/server/app/[locale]/(dashboard)/skills/[skillId]/page_client-reference-manifest.js +1 -1
  125. package/standalone/.next/server/app/[locale]/(dashboard)/skills/groups/[groupId]/page.js.nft.json +1 -1
  126. package/standalone/.next/server/app/[locale]/(dashboard)/skills/groups/[groupId]/page_client-reference-manifest.js +1 -1
  127. package/standalone/.next/server/app/[locale]/(dashboard)/skills/groups/page.js.nft.json +1 -1
  128. package/standalone/.next/server/app/[locale]/(dashboard)/skills/groups/page_client-reference-manifest.js +1 -1
  129. package/standalone/.next/server/app/[locale]/(dashboard)/skills/page.js.nft.json +1 -1
  130. package/standalone/.next/server/app/[locale]/(dashboard)/skills/page_client-reference-manifest.js +1 -1
  131. package/standalone/.next/server/app/[locale]/(dashboard)/skills/sync/[runId]/page.js.nft.json +1 -1
  132. package/standalone/.next/server/app/[locale]/(dashboard)/skills/sync/[runId]/page_client-reference-manifest.js +1 -1
  133. package/standalone/.next/server/app/[locale]/(dashboard)/sse/[endpointId]/mocks/page.js.nft.json +1 -1
  134. package/standalone/.next/server/app/[locale]/(dashboard)/sse/[endpointId]/mocks/page_client-reference-manifest.js +1 -1
  135. package/standalone/.next/server/app/[locale]/(dashboard)/sse/[endpointId]/page.js.nft.json +1 -1
  136. package/standalone/.next/server/app/[locale]/(dashboard)/sse/[endpointId]/page_client-reference-manifest.js +1 -1
  137. package/standalone/.next/server/app/[locale]/(dashboard)/sse/breakpoints/page.js.nft.json +1 -1
  138. package/standalone/.next/server/app/[locale]/(dashboard)/sse/breakpoints/page_client-reference-manifest.js +1 -1
  139. package/standalone/.next/server/app/[locale]/(dashboard)/sse/history/[requestId]/page.js.nft.json +1 -1
  140. package/standalone/.next/server/app/[locale]/(dashboard)/sse/history/[requestId]/page_client-reference-manifest.js +1 -1
  141. package/standalone/.next/server/app/[locale]/(dashboard)/sse/history/page.js.nft.json +1 -1
  142. package/standalone/.next/server/app/[locale]/(dashboard)/sse/history/page_client-reference-manifest.js +1 -1
  143. package/standalone/.next/server/app/[locale]/(dashboard)/sse/new/page.js.nft.json +1 -1
  144. package/standalone/.next/server/app/[locale]/(dashboard)/sse/new/page_client-reference-manifest.js +1 -1
  145. package/standalone/.next/server/app/[locale]/(dashboard)/sse/page.js.nft.json +1 -1
  146. package/standalone/.next/server/app/[locale]/(dashboard)/sse/page_client-reference-manifest.js +1 -1
  147. package/standalone/.next/server/app/[locale]/(dashboard)/sse/storage/page.js.nft.json +1 -1
  148. package/standalone/.next/server/app/[locale]/(dashboard)/sse/storage/page_client-reference-manifest.js +1 -1
  149. package/standalone/.next/server/app/[locale]/(dashboard)/status/page.js.nft.json +1 -1
  150. package/standalone/.next/server/app/[locale]/(dashboard)/status/page_client-reference-manifest.js +1 -1
  151. package/standalone/.next/server/app/[locale]/(dashboard)/tailscale/page.js.nft.json +1 -1
  152. package/standalone/.next/server/app/[locale]/(dashboard)/tailscale/page_client-reference-manifest.js +1 -1
  153. package/standalone/.next/server/app/[locale]/(dashboard)/tools/page.js.nft.json +1 -1
  154. package/standalone/.next/server/app/[locale]/(dashboard)/tools/page_client-reference-manifest.js +1 -1
  155. package/standalone/.next/server/app/[locale]/(dashboard)/unified-events/page.js.nft.json +1 -1
  156. package/standalone/.next/server/app/[locale]/(dashboard)/unified-events/page_client-reference-manifest.js +1 -1
  157. package/standalone/.next/server/app/[locale]/(dashboard)/usage/page.js.nft.json +1 -1
  158. package/standalone/.next/server/app/[locale]/(dashboard)/usage/page_client-reference-manifest.js +1 -1
  159. package/standalone/.next/server/app/[locale]/(dashboard)/users/page.js.nft.json +1 -1
  160. package/standalone/.next/server/app/[locale]/(dashboard)/users/page_client-reference-manifest.js +1 -1
  161. package/standalone/.next/server/app/[locale]/(dashboard)/webhooks/page.js.nft.json +1 -1
  162. package/standalone/.next/server/app/[locale]/(dashboard)/webhooks/page_client-reference-manifest.js +1 -1
  163. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/[workflowId]/edit/page.js.nft.json +1 -1
  164. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/[workflowId]/edit/page_client-reference-manifest.js +1 -1
  165. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/[workflowId]/page.js.nft.json +1 -1
  166. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/[workflowId]/page_client-reference-manifest.js +1 -1
  167. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/new/page.js.nft.json +1 -1
  168. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/new/page_client-reference-manifest.js +1 -1
  169. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/page.js.nft.json +1 -1
  170. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/page_client-reference-manifest.js +1 -1
  171. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/runs/[runId]/page.js.nft.json +1 -1
  172. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/runs/[runId]/page_client-reference-manifest.js +1 -1
  173. package/standalone/.next/server/app/[locale]/(dashboard)/worktrees/[worktreeId]/page.js.nft.json +1 -1
  174. package/standalone/.next/server/app/[locale]/(dashboard)/worktrees/[worktreeId]/page_client-reference-manifest.js +1 -1
  175. package/standalone/.next/server/app/[locale]/(dashboard)/worktrees/page.js.nft.json +1 -1
  176. package/standalone/.next/server/app/[locale]/(dashboard)/worktrees/page_client-reference-manifest.js +1 -1
  177. package/standalone/.next/server/app/_global-error.html +1 -1
  178. package/standalone/.next/server/app/_global-error.rsc +1 -1
  179. package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  180. package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  181. package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  182. package/standalone/.next/server/app/_not-found.html +1 -1
  183. package/standalone/.next/server/app/_not-found.rsc +1 -1
  184. package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  185. package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  186. package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  187. package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__03lyeon._.js → [root-of-the-server]__0-99nbc._.js} +2 -2
  188. package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0y7gd01._.js → [root-of-the-server]__0fh12fy._.js} +2 -2
  189. package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1rcvzx1._.js → [root-of-the-server]__0msw1ea._.js} +2 -2
  190. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__1mb4-7-._.js +1 -1
  191. package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1gancji._.js → [root-of-the-server]__1z117hv._.js} +2 -2
  192. package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__10jrizr._.js → [root-of-the-server]__1z5665a._.js} +2 -2
  193. package/standalone/.next/server/chunks/ssr/_023dgo3._.js +5 -0
  194. package/standalone/.next/server/chunks/ssr/_02h6acq._.js +3 -0
  195. package/standalone/.next/server/chunks/ssr/_066udeg._.js +5 -0
  196. package/standalone/.next/server/chunks/ssr/_0922cgb._.js +19 -19
  197. package/standalone/.next/server/chunks/ssr/{_0m88jwn._.js → _0droopp._.js} +1 -1
  198. package/standalone/.next/server/chunks/ssr/{_0els-qc._.js → _0jwh7ac._.js} +2 -2
  199. package/standalone/.next/server/chunks/ssr/{_199567s._.js → _0pvegjo._.js} +2 -2
  200. package/standalone/.next/server/chunks/ssr/_0wzxel4._.js +19 -19
  201. package/standalone/.next/server/chunks/ssr/_11gkzyr._.js +3 -0
  202. package/standalone/.next/server/chunks/ssr/_145zuge._.js +3 -0
  203. package/standalone/.next/server/chunks/ssr/{_1u6coc8._.js → _14_zd7-._.js} +1 -1
  204. package/standalone/.next/server/chunks/ssr/_16qls8q._.js +19 -19
  205. package/standalone/.next/server/chunks/ssr/{_0s80o71._.js → _1h-6nfn._.js} +1 -1
  206. package/standalone/.next/server/chunks/ssr/{_0k25g0q._.js → _1kbvnjh._.js} +2 -2
  207. package/standalone/.next/server/chunks/ssr/{_04j39ke._.js → _1qx9xhv._.js} +2 -2
  208. package/standalone/.next/server/chunks/ssr/{_1w3wwcr._.js → _1u611e5._.js} +1 -1
  209. package/standalone/.next/server/chunks/ssr/_1w59xgn._.js +3 -0
  210. package/standalone/.next/server/chunks/ssr/{_0th4tpb._.js → _1xulr95._.js} +1 -1
  211. package/standalone/.next/server/chunks/ssr/_20w2giq._.js +13 -13
  212. package/standalone/.next/server/chunks/ssr/messages_de_json_[json]_cjs_1uig1ud._.js +1 -1
  213. package/standalone/.next/server/chunks/ssr/messages_en_json_[json]_cjs_206072-._.js +1 -1
  214. package/standalone/.next/server/chunks/ssr/messages_es_json_[json]_cjs_082yukd._.js +1 -1
  215. package/standalone/.next/server/chunks/ssr/messages_fr_json_[json]_cjs_0j6-w0i._.js +1 -1
  216. package/standalone/.next/server/chunks/ssr/{node_modules_@xterm_0iv_cgm._.js → node_modules_@xterm_206nkfi._.js} +1 -1
  217. package/standalone/.next/server/chunks/ssr/src_components_09p6yr8._.js +3 -0
  218. package/standalone/.next/server/chunks/ssr/src_components_app-shell_tsx_0e1q-gv._.js +8 -8
  219. package/standalone/.next/server/middleware-build-manifest.js +3 -3
  220. package/standalone/.next/server/pages/404.html +1 -1
  221. package/standalone/.next/server/pages/500.html +1 -1
  222. package/standalone/.next/server/server-reference-manifest.js +1 -1
  223. package/standalone/.next/server/server-reference-manifest.json +1 -1
  224. package/standalone/.next/static/chunks/{2fdhex6g9gntt.css → 08tqkboq7jldl.css} +1 -1
  225. package/standalone/.next/static/chunks/{1hxkad9h8f41j.js → 0kal56xybd7n9.js} +4 -4
  226. package/standalone/.next/static/chunks/0pgwzk6rf90uw.js +37 -0
  227. package/standalone/.next/static/chunks/{1__4bv3ban1a3.js → 14lk2pj692gws.js} +5 -5
  228. package/standalone/.next/static/chunks/19af4ig4veh2-.js +1 -0
  229. package/standalone/.next/static/chunks/1b5xei_up0l_2.js +23 -0
  230. package/standalone/.next/static/chunks/1ewiemk0p9qnu.js +37 -0
  231. package/standalone/.next/static/chunks/{3juyz3i6kf3py.js → 1gh4c3m8ct7_i.js} +1 -1
  232. package/standalone/.next/static/chunks/1p9a5cg58r13e.js +3 -0
  233. package/standalone/.next/static/chunks/1qtdptnmocxn1.js +3 -0
  234. package/standalone/.next/static/chunks/{10adijll6so2_.js → 25v2w03s22scm.js} +11 -11
  235. package/standalone/.next/static/chunks/{3291rrghoao37.js → 26i49mfpe2d2z.js} +3 -3
  236. package/standalone/.next/static/chunks/{34mp4jle4d_k6.js → 2etz1yye9k9wh.js} +5 -5
  237. package/standalone/.next/static/chunks/{0ekd-i81xbmfw.js → 2llenynsmogfu.js} +26 -26
  238. package/standalone/.next/static/chunks/{0znao-d6vk181.js → 2mr6unveppm3r.js} +3 -3
  239. package/standalone/.next/static/chunks/{3exzmd_lu0k0y.js → 2z30qp7d6ecqa.js} +8 -8
  240. package/standalone/.next/static/chunks/{2e16yw43wezzd.js → 3cz48x-l6dls-.js} +5 -5
  241. package/standalone/.next/static/chunks/3hjoekqq4vnqj.js +1 -0
  242. package/standalone/.next/static/chunks/3ocoz0rzfinr0.js +39 -0
  243. package/standalone/.next/static/chunks/3p5frp3wlutlz.js +47 -0
  244. package/standalone/.next/static/chunks/{361sv84s8qa-v.js → 3qdkjzi1e42tg.js} +2 -2
  245. package/standalone/.next/static/chunks/3ww2o-5biwdc_.js +39 -0
  246. package/standalone/.next/server/chunks/ssr/_03otblz._.js +0 -5
  247. package/standalone/.next/server/chunks/ssr/_0mbr53g._.js +0 -3
  248. package/standalone/.next/server/chunks/ssr/_0p8nq_k._.js +0 -3
  249. package/standalone/.next/server/chunks/ssr/_19qbfrk._.js +0 -3
  250. package/standalone/.next/server/chunks/ssr/_1_dc705._.js +0 -3
  251. package/standalone/.next/server/chunks/ssr/_1gn4tn4._.js +0 -3
  252. package/standalone/.next/server/chunks/ssr/_1h0m3fq._.js +0 -5
  253. package/standalone/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_0naxz1r._.js +0 -3
  254. package/standalone/.next/static/chunks/02-kn9h561920.js +0 -39
  255. package/standalone/.next/static/chunks/0au0yizj5cewd.js +0 -47
  256. package/standalone/.next/static/chunks/0u_9ribfns5ba.js +0 -3
  257. package/standalone/.next/static/chunks/1k1-422docv7e.js +0 -37
  258. package/standalone/.next/static/chunks/1vkwq-2n20vqr.js +0 -1
  259. package/standalone/.next/static/chunks/2ky51_nwzd_1c.js +0 -1
  260. package/standalone/.next/static/chunks/2yu22wbx3nelq.js +0 -39
  261. package/standalone/.next/static/chunks/3_my51eonadlw.js +0 -37
  262. package/standalone/.next/static/chunks/3wp66lgdd12k4.js +0 -23
  263. package/standalone/.next/static/chunks/44xmtfrnqlc-z.js +0 -3
  264. /package/standalone/.next/static/{DwgsN-sMKHx6e6a1qAMpp → I0dfaEEIvfubol4R1MwUX}/_buildManifest.js +0 -0
  265. /package/standalone/.next/static/{DwgsN-sMKHx6e6a1qAMpp → I0dfaEEIvfubol4R1MwUX}/_clientMiddlewareManifest.js +0 -0
  266. /package/standalone/.next/static/{DwgsN-sMKHx6e6a1qAMpp → I0dfaEEIvfubol4R1MwUX}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,939050,868401,e=>{"use strict";var t=e.i(456420);let r={name:"move-right",size:24,node:[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]};r.node;let a=(0,t.default)(r);e.s(["MoveRight",0,a],939050);let s={name:"tags",size:24,node:[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]};s.node;let n=(0,t.default)(s);e.s(["Tags",0,n],868401)},448295,e=>{"use strict";var t=e.i(843476),r=e.i(688194),a=e.i(93384),s=e.i(741120),n=e.i(456420);let i={name:"test-tube-diagonal",size:24,node:[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]],aliases:["test-tube-2"]};i.node;let l=(0,n.default)(i);var o=e.i(861745),d=e.i(948148),c=e.i(271645),u=e.i(929592),h=e.i(487486),m=e.i(519455),g=e.i(515288),p=e.i(257428),x=e.i(776639),b=e.i(793479),j=e.i(110204),f=e.i(337822),v=e.i(967489),k=e.i(987968),w=e.i(624687),S=e.i(520133),y=e.i(462777),C=e.i(637611),I=e.i(360583),T=e.i(975157),N=e.i(687862),E=e.i(52253);let A=`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,939050,868401,e=>{"use strict";var t=e.i(456420);let r={name:"move-right",size:24,node:[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]};r.node;let a=(0,t.default)(r);e.s(["MoveRight",0,a],939050);let s={name:"tags",size:24,node:[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]};s.node;let n=(0,t.default)(s);e.s(["Tags",0,n],868401)},448295,e=>{"use strict";var t=e.i(843476),r=e.i(688194),a=e.i(93384),s=e.i(741120),n=e.i(456420);let i={name:"test-tube-diagonal",size:24,node:[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]],aliases:["test-tube-2"]};i.node;let l=(0,n.default)(i);var o=e.i(861745),d=e.i(948148),c=e.i(271645),u=e.i(929592),h=e.i(487486),g=e.i(519455),m=e.i(515288),p=e.i(257428),x=e.i(776639),b=e.i(793479),j=e.i(110204),f=e.i(337822),v=e.i(967489),k=e.i(987968),w=e.i(624687),S=e.i(520133),y=e.i(462777),C=e.i(637611),I=e.i(360583),T=e.i(975157),N=e.i(687862),E=e.i(52253);let A=`
2
2
  id type
3
3
  configurations {
4
4
  id name iconKey scheme buildConfiguration defaultAction advancedSettings autoExport exportSettings createdAt updatedAt
@@ -11,10 +11,10 @@
11
11
  }
12
12
  `,D=`
13
13
  id scopeKey status schemes configurations testPlans error stale headSha xcodeVersion lastParseAttemptAt lastParsedAt
14
- `,R=["BUILD","TEST","ANALYZE","ARCHIVE","BUILD_FOR_TESTING","TEST_WITHOUT_BUILDING"];function B({codebaseId:e,worktreeId:a,open:n,onOpenChange:i,onStarted:l,destinationCache:f,coverageMode:S=!1}){let W=(0,d.useTranslations)("builds"),P=(0,o.useLocale)(),[L,M]=(0,c.useState)(null),[$,O]=(0,c.useState)(null),[q,_]=(0,c.useState)([]),[U,F]=(0,c.useState)(!1),[H,V]=(0,c.useState)(""),[G,K]=(0,c.useState)("BUILD"),[z,J]=(0,c.useState)({}),[Q,Y]=(0,c.useState)([]),[X,Z]=(0,c.useState)("SIMULATOR"),[ee,et]=(0,c.useState)(""),[er,ea]=(0,c.useState)(new Set),[es,en]=(0,c.useState)({}),[ei,el]=(0,c.useState)(!1),[eo,ed]=(0,c.useState)(E.DEFAULT_EXPORT_SETTINGS),[ec,eu]=(0,c.useState)("{}"),[eh,em]=(0,c.useState)(!0),[eg,ep]=(0,c.useState)(!1),[ex,eb]=(0,c.useState)(!1),[ej,ef]=(0,c.useState)(null),[ev,ek]=(0,c.useState)(null),ew=(0,c.useRef)(0),eS=(0,c.useRef)("SIMULATOR"),ey=(0,c.useRef)(""),eC=(0,c.useRef)(!1),eI=L?.configurations.find(e=>e.id===H),eT=eI?z[eI.id]??eI.observation:null;(0,c.useEffect)(()=>{let t=!1;return(0,C.controlPlaneRequest)(`query StartBuildProject($codebaseId: ID!) {
14
+ `,R=["BUILD","TEST","ANALYZE","ARCHIVE","BUILD_FOR_TESTING","TEST_WITHOUT_BUILDING"];function B({codebaseId:e,worktreeId:a,open:n,onOpenChange:i,onStarted:l,destinationCache:f,coverageMode:S=!1}){let W=(0,d.useTranslations)("builds"),P=(0,o.useLocale)(),[L,M]=(0,c.useState)(null),[$,O]=(0,c.useState)(null),[q,_]=(0,c.useState)([]),[U,F]=(0,c.useState)(!1),[H,V]=(0,c.useState)(""),[G,K]=(0,c.useState)("BUILD"),[z,J]=(0,c.useState)({}),[Q,Y]=(0,c.useState)([]),[X,Z]=(0,c.useState)("SIMULATOR"),[ee,et]=(0,c.useState)(""),[er,ea]=(0,c.useState)(new Set),[es,en]=(0,c.useState)({}),[ei,el]=(0,c.useState)(!1),[eo,ed]=(0,c.useState)(E.DEFAULT_EXPORT_SETTINGS),[ec,eu]=(0,c.useState)("{}"),[eh,eg]=(0,c.useState)(!0),[em,ep]=(0,c.useState)(!1),[ex,eb]=(0,c.useState)(!1),[ej,ef]=(0,c.useState)(null),[ev,ek]=(0,c.useState)(null),ew=(0,c.useRef)(0),eS=(0,c.useRef)("SIMULATOR"),ey=(0,c.useRef)(""),eC=(0,c.useRef)(!1),eI=L?.configurations.find(e=>e.id===H),eT=eI?z[eI.id]??eI.observation:null;(0,c.useEffect)(()=>{let t=!1;return(0,C.controlPlaneRequest)(`query StartBuildProject($codebaseId: ID!) {
15
15
  iosAppProject(codebaseId: $codebaseId) { ${A} }
16
16
  codebase(id: $codebaseId) { agent { id name hostname } }
17
- }`,{codebaseId:e}).then(e=>{if(t)return;M(e.iosAppProject),O(e.codebase?.agent??null);let r=e.iosAppProject?.configurations[0];r&&(V(r.id),K(S?"TEST":r.defaultAction),en(r.advancedSettings??{}),el(!!(!S&&"ARCHIVE"===r.defaultAction&&r.autoExport)),ed({...E.DEFAULT_EXPORT_SETTINGS,...r.exportSettings??{}}),ea(new Set(e.iosAppProject.allowedScripts.filter(e=>e.script.enabledByDefault).map(e=>e.script.id))))}).catch(e=>ef(e instanceof Error?e.message:String(e))).finally(()=>{t||em(!1)}),()=>{t=!0}},[e,S,a]),(0,c.useEffect)(()=>{"TEST_WITHOUT_BUILDING"!==G||eC.current||(eC.current=!0,F(!0),(0,C.controlPlaneRequest)(`query StartBuildPriorBuilds($worktreeId: ID!) {
17
+ }`,{codebaseId:e}).then(e=>{if(t)return;M(e.iosAppProject),O(e.codebase?.agent??null);let r=e.iosAppProject?.configurations[0];r&&(V(r.id),K(S?"TEST":r.defaultAction),en(r.advancedSettings??{}),el(!!(!S&&"ARCHIVE"===r.defaultAction&&r.autoExport)),ed({...E.DEFAULT_EXPORT_SETTINGS,...r.exportSettings??{}}),ea(new Set(e.iosAppProject.allowedScripts.filter(e=>e.script.enabledByDefault).map(e=>e.script.id))))}).catch(e=>ef(e instanceof Error?e.message:String(e))).finally(()=>{t||eg(!1)}),()=>{t=!0}},[e,S,a]),(0,c.useEffect)(()=>{"TEST_WITHOUT_BUILDING"!==G||eC.current||(eC.current=!0,F(!0),(0,C.controlPlaneRequest)(`query StartBuildPriorBuilds($worktreeId: ID!) {
18
18
  builds(first: 50, status: SUCCEEDED, worktreeId: $worktreeId) {
19
19
  items { id action destinationType snapshot createdAt }
20
20
  }
@@ -32,9 +32,9 @@
32
32
  }
33
33
  }`,{input:{worktreeId:a,sourceKind:eI.source.kind,sourcePath:eI.source.relativePath,scheme:eI.scheme,configuration:eI.buildConfiguration,requestId:(0,y.createClientId)()}})).inspectBuildSource.signingRequirements};(0,c.useEffect)(()=>{if(!eI||eh)return;let e=window.setTimeout(()=>void eD(eI,G),0);return()=>{window.clearTimeout(e),ew.current+=1}},[H,G,eh]);let eW=(0,c.useMemo)(()=>Q.filter(e=>e.type===X),[Q,X]),eP=Q.find(e=>e.id===ee),eL=eI?`xcrun xcodebuild ${"PROJECT"===eI.source.kind?`-project ${eI.source.relativePath}`:"WORKSPACE"===eI.source.kind?`-workspace ${eI.source.relativePath}`:""} -scheme ${JSON.stringify(eI.scheme)} -configuration ${JSON.stringify(eI.buildConfiguration)} -destination ${JSON.stringify(eP?.name??"<destination>")} -hideShellScriptEnvironment ${G.toLowerCase().replaceAll("_","-")}${"TEST_WITHOUT_BUILDING"===G&&eE?` \xb7 ${W("priorBuildSummary",{id:eE})}`:""}`:"",eM=async()=>{if(eI&&eP){eb(!0),ef(null);try{let e={};try{let t=JSON.parse(ec);if(!t||"object"!=typeof t||Array.isArray(t))throw Error();e=t}catch{throw Error(W("overridesInvalid"))}let t=await (0,C.controlPlaneRequest)(`mutation StartIosBuild($input: StartBuildInput!) {
34
34
  ${S?"startWorktreeCoverage":"startBuild"}(input: $input) { id }
35
- }`,{input:{worktreeId:a,configurationId:eI.id,destination:eP,scriptIds:[...er],action:G,advancedSettings:{...es,buildSettingOverrides:e,...S?{codeCoverage:!0,parseTestResults:!0}:{},..."TEST_WITHOUT_BUILDING"===G?{priorBuildForTestingId:eE,priorTestProductsPath:null,priorXctestrunPath:null}:{}},exportWhenComplete:!S&&"ARCHIVE"===G&&ei,exportSettings:"ARCHIVE"===G?eo:null,requestId:(0,y.createClientId)()}});i(!1);let r=t.startBuild??t.startWorktreeCoverage;if(!r)throw Error(W("startBuildFailed"));l(r.id)}catch(e){ef(e instanceof Error?e.message:String(e))}finally{eb(!1)}}};return(0,t.jsx)(x.Dialog,{onOpenChange:i,open:n,children:(0,t.jsxs)(x.DialogContent,{className:"max-h-[90vh] grid-cols-[minmax(0,1fr)] overflow-y-auto sm:max-w-5xl",children:[(0,t.jsxs)(x.DialogHeader,{children:[(0,t.jsx)(x.DialogTitle,{children:W(S?"startWorktreeCoverage":"startBuild")}),(0,t.jsx)(x.DialogDescription,{children:W(S?"startWorktreeCoverageDescription":"startBuildDescription")})]}),ej&&(0,t.jsx)(u.Alert,{variant:"destructive",children:(0,t.jsx)(u.AlertDescription,{children:ej})}),ev&&(0,t.jsx)(u.Alert,{children:(0,t.jsx)(u.AlertDescription,{children:ev})}),eh?(0,t.jsxs)("p",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(k.Spinner,{})," ",W("loading")]}):L?.configurations.length?(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("configuration")}),(0,t.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:L.configurations.map(e=>(0,t.jsxs)("button",{className:`rounded-xl border p-3 text-left transition-colors ${e.id===H?"border-primary bg-primary/5":"hover:bg-muted/50"}`,onClick:()=>{e.id!==H&&(ew.current+=1),V(e.id),K(S?"TEST":e.defaultAction),en(e.advancedSettings??{}),el(!!(!S&&"ARCHIVE"===e.defaultAction&&e.autoExport)),ed({...E.DEFAULT_EXPORT_SETTINGS,...e.exportSettings??{}})},type:"button",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(N.ConfigurationIcon,{iconKey:e.iconKey}),e.name]}),(0,t.jsx)(h.Badge,{variant:"outline",children:W(`parseStatuses.${(z[e.id]??e.observation)?.status??"UNPARSED"}`)})]}),(0,t.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:[e.scheme," · ",e.buildConfiguration]})]},e.id))})]}),eI&&(0,t.jsx)(g.Card,{children:(0,t.jsxs)(g.CardContent,{className:"space-y-2 text-sm",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate font-mono text-xs",title:eI.source.relativePath,children:eI.source.relativePath}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[eI.scheme," ·"," ",eI.buildConfiguration]}),$&&(0,t.jsxs)("p",{className:"truncate text-xs text-muted-foreground",title:`${$.name} (${$.hostname})`,children:[W("agent"),": ",$.name]})]}),(0,t.jsxs)(m.Button,{disabled:eg,onClick:()=>void eR(eI),size:"sm",type:"button",variant:"outline",children:[eg?(0,t.jsx)(k.Spinner,{}):(0,t.jsx)(s.RefreshCw,{})," ",W("reparse")]})]}),eT?.error&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:eT.error})]})}),(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-3",children:[(0,t.jsxs)("div",{className:(0,T.cn)("space-y-2",S&&"hidden"),children:[(0,t.jsx)(j.Label,{children:W("action")}),(0,t.jsxs)(v.Select,{onValueChange:e=>{e!==G&&(ew.current+=1),K(e),"ARCHIVE"!==e&&el(!1)},value:G,children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsx)(v.SelectContent,{children:R.map(e=>(0,t.jsx)(v.SelectItem,{value:e,children:W(`actions.${e}`)},e))})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("destinationType")}),(0,t.jsxs)(v.Select,{disabled:"ARCHIVE"===G,onValueChange:e=>{eS.current=e,Z(e);let t=Q.find(t=>t.type===e)?.id??"";ey.current=t,et(t)},value:X,children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsxs)(v.SelectContent,{children:[(0,t.jsx)(v.SelectItem,{value:"SIMULATOR",children:W("simulator")}),(0,t.jsx)(v.SelectItem,{value:"PHYSICAL_DEVICE",children:W("physicalDevice")})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("device")}),(0,t.jsxs)(v.Select,{disabled:!eW.length,onValueChange:e=>{ey.current=e,et(e)},value:ee,children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{placeholder:W("selectDevice")})}),(0,t.jsx)(v.SelectContent,{children:eW.map(e=>(0,t.jsxs)(v.SelectItem,{value:e.id,children:[e.generic?"SIMULATOR"===e.type?W("anySimulator"):W("anyPhysicalDevice"):e.name,e.osVersion?` \xb7 ${e.osVersion}`:""]},e.id))})]})]})]}),!S&&"ARCHIVE"===G&&(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(p.Checkbox,{checked:ei,onCheckedChange:e=>el(!!e)}),W("exportWhenComplete")]}),ei&&(0,t.jsx)(E.ExportSettingsForm,{onChange:ed,onParseSigningRequirements:eB,value:eo},H)]}),"TEST_WITHOUT_BUILDING"===G&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("priorBuildForTesting")}),(0,t.jsxs)(v.Select,{disabled:U||!eN.length,onValueChange:e=>en(t=>({...t,priorBuildForTestingId:e,priorTestProductsPath:null,priorXctestrunPath:null})),value:eE??"",children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{placeholder:W("selectPriorBuildForTesting")})}),(0,t.jsx)(v.SelectContent,{children:eN.map(e=>(0,t.jsxs)(v.SelectItem,{value:e.id,children:[(0,I.formatDateValue)(e.createdAt,"short",{locale:P})," ","· ",e.id]},e.id))})]}),U&&(0,t.jsxs)("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsx)(k.Spinner,{})," ",W("loading")]}),!U&&!eN.length&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:W("noPriorBuildForTesting")})]}),["TEST","BUILD_FOR_TESTING","TEST_WITHOUT_BUILDING"].includes(G)&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("testPlan")}),(0,t.jsxs)(v.Select,{onValueChange:e=>en(t=>({...t,testPlan:"__SCHEME_DEFAULT__"===e?null:e})),value:String(es.testPlan??"__SCHEME_DEFAULT__"),children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsxs)(v.SelectContent,{children:[(0,t.jsx)(v.SelectItem,{value:"__SCHEME_DEFAULT__",children:W("schemeDefaultTestPlan")}),"string"==typeof es.testPlan&&es.testPlan&&!eT?.testPlans.includes(es.testPlan)&&(0,t.jsxs)(v.SelectItem,{value:es.testPlan,children:[es.testPlan," · ",W("savedValueUnavailable")]}),eT?.testPlans.map(e=>(0,t.jsx)(v.SelectItem,{value:e,children:e},e))]})]})]}),L.allowedScripts.length>0&&(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("scripts")}),(0,t.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:L.allowedScripts.map(({script:e})=>(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded-lg border p-2",children:[(0,t.jsx)(p.Checkbox,{checked:er.has(e.id),onCheckedChange:t=>{ea(r=>{let a=new Set(r);return t?a.add(e.id):a.delete(e.id),a})}}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"block text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.preBuildScript?W("preBuild"):"",e.preBuildScript&&e.postBuildScript?" · ":"",e.postBuildScript?W("postBuild"):""]})]})]},e.id))})]}),(0,t.jsxs)("details",{className:"rounded-xl border p-3",children:[(0,t.jsx)("summary",{className:"cursor-pointer font-medium",children:W("advancedSettings")}),(0,t.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{htmlFor:"development-team",children:W("developmentTeam")}),(0,t.jsx)(b.Input,{id:"development-team",onChange:e=>en(t=>({...t,developmentTeam:e.target.value||null})),value:String(es.developmentTeam??"")})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("packageResolution")}),(0,t.jsxs)(v.Select,{onValueChange:e=>en(t=>({...t,packageResolution:e})),value:String(es.packageResolution??"DEFAULT"),children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsx)(v.SelectContent,{children:["DEFAULT","RESOLVED_ONLY","SKIP_UPDATES","DISABLE_AUTOMATIC"].map(e=>(0,t.jsx)(v.SelectItem,{value:e,children:e},e))})]})]}),(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.Checkbox,{checked:S||!!es.codeCoverage,disabled:S,onCheckedChange:e=>en(t=>({...t,codeCoverage:!!e}))}),W("codeCoverage")]}),["TEST","TEST_WITHOUT_BUILDING"].includes(G)&&(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.Checkbox,{checked:S||!1!==es.parseTestResults,disabled:S,onCheckedChange:e=>en(t=>({...t,parseTestResults:!!e}))}),W("parseTestResults")]}),(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.Checkbox,{checked:!!es.allowProvisioningUpdates,onCheckedChange:e=>en(t=>({...t,allowProvisioningUpdates:!!e}))}),W("allowProvisioningUpdates")]}),(0,t.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,t.jsx)(j.Label,{htmlFor:"build-setting-overrides",children:W("buildSettingOverrides")}),(0,t.jsx)(w.Textarea,{className:"font-mono text-xs",id:"build-setting-overrides",onChange:e=>eu(e.target.value),rows:4,value:ec})]})]})]}),(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("commandPreview")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-lg bg-muted p-3 text-xs whitespace-pre-wrap",children:eL})]})]}):(0,t.jsx)(u.Alert,{children:(0,t.jsx)(u.AlertDescription,{children:W("noConfigurations")})}),(0,t.jsxs)(x.DialogFooter,{children:[(0,t.jsx)(m.Button,{onClick:()=>i(!1),type:"button",variant:"outline",children:W("cancel")}),(0,t.jsxs)(m.Button,{disabled:eh||ex||!eI||!eP||"TEST_WITHOUT_BUILDING"===G&&!eE,onClick:()=>void eM(),type:"button",children:[ex&&(0,t.jsx)(k.Spinner,{})," ",W("startBuild")]})]})]})})}e.s(["StartBuildButton",0,function({codebaseId:e,worktreeId:r,disabled:s,disabledReason:n,buildSettingsHref:i,onStarted:l,size:o="sm"}){let u=(0,d.useTranslations)("builds"),[h,g]=(0,c.useState)(!1),[p,x]=(0,c.useState)(!1),b=(0,c.useRef)(null),[j]=(0,c.useState)(()=>new Map),v=()=>{null!==b.current&&(window.clearTimeout(b.current),b.current=null)},k=()=>{v(),x(!0)},w=()=>{v(),b.current=window.setTimeout(()=>x(!1),150)};return(0,c.useEffect)(()=>()=>{null!==b.current&&window.clearTimeout(b.current)},[]),(0,t.jsxs)(t.Fragment,{children:[s&&i?(0,t.jsxs)(f.Popover,{onOpenChange:x,open:p,children:[(0,t.jsx)(f.PopoverAnchor,{asChild:!0,children:(0,t.jsxs)(m.Button,{"aria-disabled":"true","aria-expanded":p,"aria-haspopup":"dialog",className:"cursor-not-allowed opacity-50",onClick:k,onFocus:k,onMouseEnter:k,onMouseLeave:w,size:o,title:n??void 0,type:"button",children:[(0,t.jsx)(a.Hammer,{})," ",u("build")]})}),(0,t.jsx)(f.PopoverContent,{align:"start",className:"w-auto max-w-64 p-2 text-xs",onBlurCapture:w,onFocusCapture:v,onMouseEnter:v,onMouseLeave:w,onOpenAutoFocus:e=>e.preventDefault(),side:"top",children:(0,t.jsx)(S.Link,{className:"font-medium underline-offset-4 hover:underline",href:i,children:u("configureBuilds")})})]}):(0,t.jsxs)(m.Button,{disabled:s,onClick:()=>g(!0),size:o,title:n??void 0,type:"button",children:[(0,t.jsx)(a.Hammer,{})," ",u("build")]}),h&&(0,t.jsx)(B,{codebaseId:e,destinationCache:j,onOpenChange:g,onStarted:e=>l?.(e),open:h,worktreeId:r})]})},"WorktreeCoverageButton",0,function({codebaseId:e,worktreeId:r,disabled:a,onStarted:s}){let n=(0,d.useTranslations)("builds"),[i,o]=(0,c.useState)(!1),[u]=(0,c.useState)(()=>new Map);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(m.Button,{disabled:a,onClick:()=>o(!0),type:"button",children:[(0,t.jsx)(l,{})," ",n("generateWorktreeCoverage")]}),i&&(0,t.jsx)(B,{codebaseId:e,coverageMode:!0,destinationCache:u,onOpenChange:o,onStarted:e=>s?.(e),open:i,worktreeId:r})]})}],448295)},227286,539531,e=>{"use strict";var t=e.i(843476),r=e.i(716327),a=e.i(482022),s=e.i(948148),n=e.i(519455),i=e.i(755146),l=e.i(762525);e.s(["GitLabWorktreePipelinesMenu",0,function({pipelines:e}){let o=(0,s.useTranslations)("gitlabPages");if(!e.length)return null;let d=(0,l.aggregateGitLabPipelineStatus)(e.map(e=>e.status)),c=e=>e.stopPropagation();return(0,t.jsxs)(i.DropdownMenu,{children:[(0,t.jsx)(i.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(n.Button,{"aria-label":`${o("pipelines")}: ${d}`,className:`h-5 rounded-full px-2 py-0.5 text-xs ${(0,l.gitLabPipelineStatusClass)(d)}`,onClick:c,variant:"outline",children:[d,(0,t.jsx)(r.ChevronDown,{className:"size-3"})]})}),(0,t.jsxs)(i.DropdownMenuContent,{align:"start",className:"w-80",onClick:c,children:[(0,t.jsx)(i.DropdownMenuLabel,{children:o("pipelines")}),(0,t.jsx)(i.DropdownMenuSeparator,{}),e.map(e=>(0,t.jsx)(i.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)("a",{href:e.webUrl,rel:"noreferrer",target:"_blank",children:[(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("span",{className:"block truncate font-medium",children:["#",e.iid??e.id," · ",e.ref]}),(0,t.jsxs)("span",{className:"block text-xs text-muted-foreground",children:[e.source," · ",e.status]})]}),(0,t.jsx)(a.ExternalLink,{className:"size-3.5 shrink-0"})]})},e.id))]})]})}],227286);var o=e.i(271645),d=e.i(772436),c=e.i(975157);e.s(["QuickActionsRow",0,function({first:e,second:r}){let a=(0,o.useRef)(null),[s,n]=(0,o.useState)({paired:!1,inline:!1});return(0,o.useEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=[...e.children].filter(e=>e instanceof HTMLElement&&void 0===e.dataset.quickActionsSeparator),r=2===t.length,[a,s]=t,i=r&&a.getBoundingClientRect().bottom>s.getBoundingClientRect().top;n(e=>e.paired===r&&e.inline===i?e:{paired:r,inline:i})};t();let r=new ResizeObserver(t);for(let t of(r.observe(e),e.children))r.observe(t);let s=new MutationObserver(t);return s.observe(e,{childList:!0,subtree:!0}),()=>{r.disconnect(),s.disconnect()}}),(0,t.jsxs)("div",{className:"flex w-full flex-wrap items-center gap-2",ref:a,children:[e,s.paired&&(0,t.jsx)(d.Separator,{className:(0,c.cn)(!s.inline&&"invisible"),"data-quick-actions-separator":"",orientation:"vertical"}),r]})}],539531)},501416,e=>{"use strict";var t=e.i(843476),r=e.i(948148),a=e.i(271645),s=e.i(929592),n=e.i(519455),i=e.i(987968),l=e.i(687862),o=e.i(520133),d=e.i(637611),c=e.i(975157),u=e.i(997778);e.s(["WorkflowQuickActions",0,function({worktreeId:e,sessionData:h,workflows:m,className:g}){let p=(0,r.useTranslations)("workflows"),[x,b]=(0,a.useState)(null),[j,f]=(0,a.useState)({}),[v,k]=(0,a.useState)(null),w=(0,a.useRef)(new Map);(0,a.useEffect)(()=>{let e=w.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear()}},[]);let S=async(t,r)=>{b(t.id),k(null);try{let a=await (0,d.controlPlaneRequest)(`mutation RunWorktreeQuickAction($input: TriggerWorkflowInput!) {
35
+ }`,{input:{worktreeId:a,configurationId:eI.id,destination:eP,scriptIds:[...er],action:G,advancedSettings:{...es,buildSettingOverrides:e,...S?{codeCoverage:!0,parseTestResults:!0}:{},..."TEST_WITHOUT_BUILDING"===G?{priorBuildForTestingId:eE,priorTestProductsPath:null,priorXctestrunPath:null}:{}},exportWhenComplete:!S&&"ARCHIVE"===G&&ei,exportSettings:"ARCHIVE"===G?eo:null,requestId:(0,y.createClientId)()}});i(!1);let r=t.startBuild??t.startWorktreeCoverage;if(!r)throw Error(W("startBuildFailed"));l(r.id)}catch(e){ef(e instanceof Error?e.message:String(e))}finally{eb(!1)}}};return(0,t.jsx)(x.Dialog,{onOpenChange:i,open:n,children:(0,t.jsxs)(x.DialogContent,{className:"max-h-[90vh] grid-cols-[minmax(0,1fr)] overflow-y-auto sm:max-w-5xl",children:[(0,t.jsxs)(x.DialogHeader,{children:[(0,t.jsx)(x.DialogTitle,{children:W(S?"startWorktreeCoverage":"startBuild")}),(0,t.jsx)(x.DialogDescription,{children:W(S?"startWorktreeCoverageDescription":"startBuildDescription")})]}),ej&&(0,t.jsx)(u.Alert,{variant:"destructive",children:(0,t.jsx)(u.AlertDescription,{children:ej})}),ev&&(0,t.jsx)(u.Alert,{children:(0,t.jsx)(u.AlertDescription,{children:ev})}),eh?(0,t.jsxs)("p",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(k.Spinner,{})," ",W("loading")]}):L?.configurations.length?(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("configuration")}),(0,t.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:L.configurations.map(e=>(0,t.jsxs)("button",{className:`rounded-xl border p-3 text-left transition-colors ${e.id===H?"border-primary bg-primary/5":"hover:bg-muted/50"}`,onClick:()=>{e.id!==H&&(ew.current+=1),V(e.id),K(S?"TEST":e.defaultAction),en(e.advancedSettings??{}),el(!!(!S&&"ARCHIVE"===e.defaultAction&&e.autoExport)),ed({...E.DEFAULT_EXPORT_SETTINGS,...e.exportSettings??{}})},type:"button",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(N.ConfigurationIcon,{iconKey:e.iconKey}),e.name]}),(0,t.jsx)(h.Badge,{variant:"outline",children:W(`parseStatuses.${(z[e.id]??e.observation)?.status??"UNPARSED"}`)})]}),(0,t.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:[e.scheme," · ",e.buildConfiguration]})]},e.id))})]}),eI&&(0,t.jsx)(m.Card,{children:(0,t.jsxs)(m.CardContent,{className:"space-y-2 text-sm",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate font-mono text-xs",title:eI.source.relativePath,children:eI.source.relativePath}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[eI.scheme," ·"," ",eI.buildConfiguration]}),$&&(0,t.jsxs)("p",{className:"truncate text-xs text-muted-foreground",title:`${$.name} (${$.hostname})`,children:[W("agent"),": ",$.name]})]}),(0,t.jsxs)(g.Button,{disabled:em,onClick:()=>void eR(eI),size:"sm",type:"button",variant:"outline",children:[em?(0,t.jsx)(k.Spinner,{}):(0,t.jsx)(s.RefreshCw,{})," ",W("reparse")]})]}),eT?.error&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:eT.error})]})}),(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-3",children:[(0,t.jsxs)("div",{className:(0,T.cn)("space-y-2",S&&"hidden"),children:[(0,t.jsx)(j.Label,{children:W("action")}),(0,t.jsxs)(v.Select,{onValueChange:e=>{e!==G&&(ew.current+=1),K(e),"ARCHIVE"!==e&&el(!1)},value:G,children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsx)(v.SelectContent,{children:R.map(e=>(0,t.jsx)(v.SelectItem,{value:e,children:W(`actions.${e}`)},e))})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("destinationType")}),(0,t.jsxs)(v.Select,{disabled:"ARCHIVE"===G,onValueChange:e=>{eS.current=e,Z(e);let t=Q.find(t=>t.type===e)?.id??"";ey.current=t,et(t)},value:X,children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsxs)(v.SelectContent,{children:[(0,t.jsx)(v.SelectItem,{value:"SIMULATOR",children:W("simulator")}),(0,t.jsx)(v.SelectItem,{value:"PHYSICAL_DEVICE",children:W("physicalDevice")})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("device")}),(0,t.jsxs)(v.Select,{disabled:!eW.length,onValueChange:e=>{ey.current=e,et(e)},value:ee,children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{placeholder:W("selectDevice")})}),(0,t.jsx)(v.SelectContent,{children:eW.map(e=>(0,t.jsxs)(v.SelectItem,{value:e.id,children:[e.generic?"SIMULATOR"===e.type?W("anySimulator"):W("anyPhysicalDevice"):e.name,e.osVersion?` \xb7 ${e.osVersion}`:""]},e.id))})]})]})]}),!S&&"ARCHIVE"===G&&(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(p.Checkbox,{checked:ei,onCheckedChange:e=>el(!!e)}),W("exportWhenComplete")]}),ei&&(0,t.jsx)(E.ExportSettingsForm,{onChange:ed,onParseSigningRequirements:eB,value:eo},H)]}),"TEST_WITHOUT_BUILDING"===G&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("priorBuildForTesting")}),(0,t.jsxs)(v.Select,{disabled:U||!eN.length,onValueChange:e=>en(t=>({...t,priorBuildForTestingId:e,priorTestProductsPath:null,priorXctestrunPath:null})),value:eE??"",children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{placeholder:W("selectPriorBuildForTesting")})}),(0,t.jsx)(v.SelectContent,{children:eN.map(e=>(0,t.jsxs)(v.SelectItem,{value:e.id,children:[(0,I.formatDateValue)(e.createdAt,"short",{locale:P})," ","· ",e.id]},e.id))})]}),U&&(0,t.jsxs)("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsx)(k.Spinner,{})," ",W("loading")]}),!U&&!eN.length&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:W("noPriorBuildForTesting")})]}),["TEST","BUILD_FOR_TESTING","TEST_WITHOUT_BUILDING"].includes(G)&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("testPlan")}),(0,t.jsxs)(v.Select,{onValueChange:e=>en(t=>({...t,testPlan:"__SCHEME_DEFAULT__"===e?null:e})),value:String(es.testPlan??"__SCHEME_DEFAULT__"),children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsxs)(v.SelectContent,{children:[(0,t.jsx)(v.SelectItem,{value:"__SCHEME_DEFAULT__",children:W("schemeDefaultTestPlan")}),"string"==typeof es.testPlan&&es.testPlan&&!eT?.testPlans.includes(es.testPlan)&&(0,t.jsxs)(v.SelectItem,{value:es.testPlan,children:[es.testPlan," · ",W("savedValueUnavailable")]}),eT?.testPlans.map(e=>(0,t.jsx)(v.SelectItem,{value:e,children:e},e))]})]})]}),L.allowedScripts.length>0&&(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("scripts")}),(0,t.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:L.allowedScripts.map(({script:e})=>(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded-lg border p-2",children:[(0,t.jsx)(p.Checkbox,{checked:er.has(e.id),onCheckedChange:t=>{ea(r=>{let a=new Set(r);return t?a.add(e.id):a.delete(e.id),a})}}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"block text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.preBuildScript?W("preBuild"):"",e.preBuildScript&&e.postBuildScript?" · ":"",e.postBuildScript?W("postBuild"):""]})]})]},e.id))})]}),(0,t.jsxs)("details",{className:"rounded-xl border p-3",children:[(0,t.jsx)("summary",{className:"cursor-pointer font-medium",children:W("advancedSettings")}),(0,t.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{htmlFor:"development-team",children:W("developmentTeam")}),(0,t.jsx)(b.Input,{id:"development-team",onChange:e=>en(t=>({...t,developmentTeam:e.target.value||null})),value:String(es.developmentTeam??"")})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("packageResolution")}),(0,t.jsxs)(v.Select,{onValueChange:e=>en(t=>({...t,packageResolution:e})),value:String(es.packageResolution??"DEFAULT"),children:[(0,t.jsx)(v.SelectTrigger,{children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsx)(v.SelectContent,{children:["DEFAULT","RESOLVED_ONLY","SKIP_UPDATES","DISABLE_AUTOMATIC"].map(e=>(0,t.jsx)(v.SelectItem,{value:e,children:e},e))})]})]}),(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.Checkbox,{checked:S||!!es.codeCoverage,disabled:S,onCheckedChange:e=>en(t=>({...t,codeCoverage:!!e}))}),W("codeCoverage")]}),["TEST","TEST_WITHOUT_BUILDING"].includes(G)&&(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.Checkbox,{checked:S||!1!==es.parseTestResults,disabled:S,onCheckedChange:e=>en(t=>({...t,parseTestResults:!!e}))}),W("parseTestResults")]}),(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.Checkbox,{checked:!!es.allowProvisioningUpdates,onCheckedChange:e=>en(t=>({...t,allowProvisioningUpdates:!!e}))}),W("allowProvisioningUpdates")]}),(0,t.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,t.jsx)(j.Label,{htmlFor:"build-setting-overrides",children:W("buildSettingOverrides")}),(0,t.jsx)(w.Textarea,{className:"font-mono text-xs",id:"build-setting-overrides",onChange:e=>eu(e.target.value),rows:4,value:ec})]})]})]}),(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)(j.Label,{children:W("commandPreview")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-lg bg-muted p-3 text-xs whitespace-pre-wrap",children:eL})]})]}):(0,t.jsx)(u.Alert,{children:(0,t.jsx)(u.AlertDescription,{children:W("noConfigurations")})}),(0,t.jsxs)(x.DialogFooter,{children:[(0,t.jsx)(g.Button,{onClick:()=>i(!1),type:"button",variant:"outline",children:W("cancel")}),(0,t.jsxs)(g.Button,{disabled:eh||ex||!eI||!eP||"TEST_WITHOUT_BUILDING"===G&&!eE,onClick:()=>void eM(),type:"button",children:[ex&&(0,t.jsx)(k.Spinner,{})," ",W("startBuild")]})]})]})})}e.s(["StartBuildButton",0,function({codebaseId:e,worktreeId:r,disabled:s,disabledReason:n,buildSettingsHref:i,onStarted:l,size:o="sm"}){let u=(0,d.useTranslations)("builds"),[h,m]=(0,c.useState)(!1),[p,x]=(0,c.useState)(!1),b=(0,c.useRef)(null),[j]=(0,c.useState)(()=>new Map),v=()=>{null!==b.current&&(window.clearTimeout(b.current),b.current=null)},k=()=>{v(),x(!0)},w=()=>{v(),b.current=window.setTimeout(()=>x(!1),150)};return(0,c.useEffect)(()=>()=>{null!==b.current&&window.clearTimeout(b.current)},[]),(0,t.jsxs)(t.Fragment,{children:[s&&i?(0,t.jsxs)(f.Popover,{onOpenChange:x,open:p,children:[(0,t.jsx)(f.PopoverAnchor,{asChild:!0,children:(0,t.jsxs)(g.Button,{"aria-disabled":"true","aria-expanded":p,"aria-haspopup":"dialog",className:"cursor-not-allowed opacity-50",onClick:k,onFocus:k,onMouseEnter:k,onMouseLeave:w,size:o,title:n??void 0,type:"button",children:[(0,t.jsx)(a.Hammer,{})," ",u("build")]})}),(0,t.jsx)(f.PopoverContent,{align:"start",className:"w-auto max-w-64 p-2 text-xs",onBlurCapture:w,onFocusCapture:v,onMouseEnter:v,onMouseLeave:w,onOpenAutoFocus:e=>e.preventDefault(),side:"top",children:(0,t.jsx)(S.Link,{className:"font-medium underline-offset-4 hover:underline",href:i,children:u("configureBuilds")})})]}):(0,t.jsxs)(g.Button,{disabled:s,onClick:()=>m(!0),size:o,title:n??void 0,type:"button",children:[(0,t.jsx)(a.Hammer,{})," ",u("build")]}),h&&(0,t.jsx)(B,{codebaseId:e,destinationCache:j,onOpenChange:m,onStarted:e=>l?.(e),open:h,worktreeId:r})]})},"WorktreeCoverageButton",0,function({codebaseId:e,worktreeId:r,disabled:a,onStarted:s}){let n=(0,d.useTranslations)("builds"),[i,o]=(0,c.useState)(!1),[u]=(0,c.useState)(()=>new Map);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(g.Button,{disabled:a,onClick:()=>o(!0),type:"button",children:[(0,t.jsx)(l,{})," ",n("generateWorktreeCoverage")]}),i&&(0,t.jsx)(B,{codebaseId:e,coverageMode:!0,destinationCache:u,onOpenChange:o,onStarted:e=>s?.(e),open:i,worktreeId:r})]})}],448295)},227286,539531,e=>{"use strict";var t=e.i(843476),r=e.i(716327),a=e.i(482022),s=e.i(948148),n=e.i(519455),i=e.i(755146),l=e.i(762525);e.s(["GitLabWorktreePipelinesMenu",0,function({pipelines:e}){let o=(0,s.useTranslations)("gitlabPages");if(!e.length)return null;let d=(0,l.aggregateGitLabPipelineStatus)(e.map(e=>e.status)),c=e=>e.stopPropagation();return(0,t.jsxs)(i.DropdownMenu,{children:[(0,t.jsx)(i.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(n.Button,{"aria-label":`${o("pipelines")}: ${d}`,className:`h-5 rounded-full px-2 py-0.5 text-xs ${(0,l.gitLabPipelineStatusClass)(d)}`,onClick:c,variant:"outline",children:[d,(0,t.jsx)(r.ChevronDown,{className:"size-3"})]})}),(0,t.jsxs)(i.DropdownMenuContent,{align:"start",className:"w-80",onClick:c,children:[(0,t.jsx)(i.DropdownMenuLabel,{children:o("pipelines")}),(0,t.jsx)(i.DropdownMenuSeparator,{}),e.map(e=>(0,t.jsx)(i.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)("a",{href:e.webUrl,rel:"noreferrer",target:"_blank",children:[(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("span",{className:"block truncate font-medium",children:["#",e.iid??e.id," · ",e.ref]}),(0,t.jsxs)("span",{className:"block text-xs text-muted-foreground",children:[e.source," · ",e.status]})]}),(0,t.jsx)(a.ExternalLink,{className:"size-3.5 shrink-0"})]})},e.id))]})]})}],227286);var o=e.i(271645),d=e.i(772436),c=e.i(975157);e.s(["QuickActionsRow",0,function({first:e,second:r}){let a=(0,o.useRef)(null),[s,n]=(0,o.useState)({paired:!1,inline:!1});return(0,o.useEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=[...e.children].filter(e=>e instanceof HTMLElement&&void 0===e.dataset.quickActionsSeparator),r=2===t.length,[a,s]=t,i=r&&a.getBoundingClientRect().bottom>s.getBoundingClientRect().top;n(e=>e.paired===r&&e.inline===i?e:{paired:r,inline:i})};t();let r=new ResizeObserver(t);for(let t of(r.observe(e),e.children))r.observe(t);let s=new MutationObserver(t);return s.observe(e,{childList:!0,subtree:!0}),()=>{r.disconnect(),s.disconnect()}}),(0,t.jsxs)("div",{className:"flex w-full flex-wrap items-center gap-2",ref:a,children:[e,s.paired&&(0,t.jsx)(d.Separator,{className:(0,c.cn)(!s.inline&&"invisible"),"data-quick-actions-separator":"",orientation:"vertical"}),r]})}],539531)},501416,e=>{"use strict";var t=e.i(843476),r=e.i(948148),a=e.i(271645),s=e.i(929592),n=e.i(519455),i=e.i(987968),l=e.i(687862),o=e.i(520133),d=e.i(637611),c=e.i(975157),u=e.i(997778);e.s(["WorkflowQuickActions",0,function({worktreeId:e,sessionData:h,workflows:g,className:m}){let p=(0,r.useTranslations)("workflows"),[x,b]=(0,a.useState)(null),[j,f]=(0,a.useState)({}),[v,k]=(0,a.useState)(null),w=(0,a.useRef)(new Map);(0,a.useEffect)(()=>{let e=w.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear()}},[]);let S=async(t,r)=>{b(t.id),k(null);try{let a=await (0,d.controlPlaneRequest)(`mutation RunWorktreeQuickAction($input: TriggerWorkflowInput!) {
36
36
  triggerWorkflow(input: $input) { id }
37
- }`,{input:{workflowId:t.id,sessionData:h,resourceKind:"WORKTREE",resourceId:e,subjectKey:`WORKTREE:${e}`,choice:r}});f(e=>({...e,[t.id]:a.triggerWorkflow.id})),clearTimeout(w.current.get(t.id)),w.current.set(t.id,setTimeout(()=>{w.current.delete(t.id),f(e=>{let r={...e};return delete r[t.id],r})},5e3))}catch(e){k(e instanceof Error?e.message:String(e))}finally{b(null)}};return m.length||v?(0,t.jsxs)("div",{className:(0,c.cn)("w-full space-y-2",g),children:[(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:m.map(e=>{let r=j[e.id];return(0,t.jsxs)("div",{className:"flex items-center",children:[r&&(0,t.jsx)(n.Button,{asChild:!0,className:"rounded-r-none border-emerald-500/30 bg-emerald-500/10 text-emerald-700 hover:bg-emerald-500/20 hover:text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300 dark:hover:bg-emerald-500/20 dark:hover:text-emerald-300",size:"sm",variant:"outline",children:(0,t.jsxs)(o.Link,{href:`/workflows/runs/${r}`,title:p("quickActionStarted",{name:e.name}),children:[(0,t.jsx)(i.Spinner,{}),p("quickActionView")]})}),(0,t.jsx)(u.WorkflowChoiceMenu,{button:(0,t.jsxs)(n.Button,{className:r?"-ml-px rounded-l-none":void 0,disabled:null!==x,size:"sm",title:e.description||e.name,variant:e.quickActionButtonVariant,children:[x===e.id?(0,t.jsx)(i.Spinner,{}):(0,t.jsx)(l.ConfigurationIcon,{iconKey:e.quickActionIconKey}),e.name]}),choices:e.triggerChoices??[],hasPlainTrigger:e.hasPlainTrigger??!1,onRun:t=>void S(e,t)})]},e.id)})}),v&&(0,t.jsx)(s.Alert,{variant:"destructive",children:(0,t.jsx)(s.AlertDescription,{children:v})})]}):null}])},966264,e=>{"use strict";var t=e.i(843476),r=e.i(113030),a=e.i(741120),s=e.i(948148),n=e.i(271645),i=e.i(346194),l=e.i(929592),o=e.i(519455),d=e.i(257428),c=e.i(776639),u=e.i(793479),h=e.i(110204),m=e.i(967489),g=e.i(987968),p=e.i(624687),x=e.i(637611),b=e.i(440289);let j="__none__",f="__github_account_default__";function v(e){return e instanceof Error?e.message:String(e)}e.s(["AutoMergeButton",0,function({worktree:e,disabled:a,onCompleted:b,onError:j}){let k,w=(0,s.useTranslations)("worktrees"),S=(0,s.useTranslations)("pullRequests"),y=e.pullRequest,C=e.autoMerge,I=C&&(!y||C.pullRequestNumber===y.number&&C.repositoryNameWithOwner.toLowerCase()===y.repositoryNameWithOwner.toLowerCase())?C:null,[T,N]=(0,n.useState)(!1),[E,A]=(0,n.useState)(!1),[D,R]=(0,n.useState)(!1),[B,W]=(0,n.useState)(null),[P,L]=(0,n.useState)(null),[M,$]=(0,n.useState)(""),[O,q]=(0,n.useState)(""),[_,U]=(0,n.useState)(""),[F,H]=(0,n.useState)(f),[V,G]=(0,n.useState)(!1),[K,z]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!T||!y)return;let e=!0,[t="",r=""]=y.repositoryNameWithOwner.split("/",2);return(0,x.controlPlaneRequest)(`query GitHubPullRequestMergeOptions(
37
+ }`,{input:{workflowId:t.id,sessionData:h,resourceKind:"WORKTREE",resourceId:e,subjectKey:`WORKTREE:${e}`,choice:r}});f(e=>({...e,[t.id]:a.triggerWorkflow.id})),clearTimeout(w.current.get(t.id)),w.current.set(t.id,setTimeout(()=>{w.current.delete(t.id),f(e=>{let r={...e};return delete r[t.id],r})},5e3))}catch(e){k(e instanceof Error?e.message:String(e))}finally{b(null)}};return g.length||v?(0,t.jsxs)("div",{className:(0,c.cn)("w-full space-y-2",m),children:[(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:g.map(e=>{let r=j[e.id];return(0,t.jsxs)("div",{className:"flex items-center",children:[r&&(0,t.jsx)(n.Button,{asChild:!0,className:"rounded-r-none border-emerald-500/30 bg-emerald-500/10 text-emerald-700 hover:bg-emerald-500/20 hover:text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300 dark:hover:bg-emerald-500/20 dark:hover:text-emerald-300",size:"sm",variant:"outline",children:(0,t.jsxs)(o.Link,{href:`/workflows/runs/${r}`,title:p("quickActionStarted",{name:e.name}),children:[(0,t.jsx)(i.Spinner,{}),p("quickActionView")]})}),(0,t.jsx)(u.WorkflowChoiceMenu,{button:(0,t.jsxs)(n.Button,{className:r?"-ml-px rounded-l-none":void 0,disabled:null!==x,size:"sm",title:e.description||e.name,variant:e.quickActionButtonVariant,children:[x===e.id?(0,t.jsx)(i.Spinner,{}):(0,t.jsx)(l.ConfigurationIcon,{iconKey:e.quickActionIconKey}),e.name]}),choices:e.triggerChoices??[],hasPlainTrigger:e.hasPlainTrigger??!1,onRun:t=>void S(e,t)})]},e.id)})}),v&&(0,t.jsx)(s.Alert,{variant:"destructive",children:(0,t.jsx)(s.AlertDescription,{children:v})})]}):null}])},966264,e=>{"use strict";var t=e.i(843476),r=e.i(113030),a=e.i(741120),s=e.i(948148),n=e.i(271645),i=e.i(346194),l=e.i(929592),o=e.i(519455),d=e.i(257428),c=e.i(776639),u=e.i(793479),h=e.i(110204),g=e.i(967489),m=e.i(987968),p=e.i(624687),x=e.i(637611),b=e.i(440289);let j="__none__",f="__github_account_default__";function v(e){return e instanceof Error?e.message:String(e)}e.s(["AutoMergeButton",0,function({worktree:e,disabled:a,onCompleted:b,onError:j}){let k,w=(0,s.useTranslations)("worktrees"),S=(0,s.useTranslations)("pullRequests"),y=e.pullRequest,C=e.autoMerge,I=C&&(!y||C.pullRequestNumber===y.number&&C.repositoryNameWithOwner.toLowerCase()===y.repositoryNameWithOwner.toLowerCase())?C:null,[T,N]=(0,n.useState)(!1),[E,A]=(0,n.useState)(!1),[D,R]=(0,n.useState)(!1),[B,W]=(0,n.useState)(null),[P,L]=(0,n.useState)(null),[M,$]=(0,n.useState)(""),[O,q]=(0,n.useState)(""),[_,U]=(0,n.useState)(""),[F,H]=(0,n.useState)(f),[V,G]=(0,n.useState)(!1),[K,z]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!T||!y)return;let e=!0,[t="",r=""]=y.repositoryNameWithOwner.split("/",2);return(0,x.controlPlaneRequest)(`query GitHubPullRequestMergeOptions(
38
38
  $owner: String!
39
39
  $name: String!
40
40
  $number: Int!
@@ -64,7 +64,7 @@
64
64
  }
65
65
  }`,{input:{worktreeId:e.id,repositoryNameWithOwner:y.repositoryNameWithOwner,pullRequestNumber:y.number,method:M,commitHeadline:O,commitBody:_,authorEmail:F===f?null:F,deleteWorktree:V,moveTicketToDone:K}}),j(null),N(!1),await b()}catch(e){W(v(e))}finally{R(!1)}}},Q=async()=>{R(!0),W(null);try{await (0,x.controlPlaneRequest)(`mutation CancelWorktreeAutoMerge($worktreeId: ID!) {
66
66
  cancelWorktreeAutoMerge(worktreeId: $worktreeId)
67
- }`,{worktreeId:e.id}),j(null),N(!1),await b()}catch(e){W(v(e))}finally{R(!1)}},Y=I?.state==="ACTION_REQUIRED",X=I?.state==="COMPLETED";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Button,{className:I&&!Y?"bg-emerald-600 text-white hover:bg-emerald-700":void 0,disabled:!y||a&&!I||X,onClick:e=>{e.stopPropagation(),A(!0),L(null),W(null),N(!0)},size:"sm",type:"button",variant:Y?"destructive":I?"default":"outline",children:[(0,t.jsx)(r.GitMerge,{}),w(X?"autoMergeComplete":Y?"autoMergePaused":I?"autoMerging":"autoMerge")]}),(0,t.jsx)(c.Dialog,{onOpenChange:e=>!D&&N(e),open:T,children:(0,t.jsxs)(c.DialogContent,{className:"sm:max-w-xl",children:[(0,t.jsxs)(c.DialogHeader,{children:[(0,t.jsx)(c.DialogTitle,{children:w("autoMergeTitle")}),(0,t.jsx)(c.DialogDescription,{children:w("autoMergeDescription")})]}),!E&&(P||B)?(0,t.jsxs)("div",{className:"space-y-4",children:[(B||I?.lastError)&&(0,t.jsx)(l.Alert,{variant:"destructive",children:(0,t.jsx)(l.AlertDescription,{children:B||I?.lastError})}),P&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:S("mergeType")}),(0,t.jsxs)(m.Select,{disabled:D,onValueChange:e=>$(e),value:M,children:[(0,t.jsx)(m.SelectTrigger,{children:(0,t.jsx)(m.SelectValue,{})}),(0,t.jsx)(m.SelectContent,{children:P.availableMethods.map(e=>(0,t.jsx)(m.SelectItem,{value:e,children:S(`mergeTypes.${e}`)},e))})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:S("commitMessage")}),(0,t.jsx)(u.Input,{disabled:D,onChange:e=>q(e.target.value),value:O})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:S("commitDescription")}),(0,t.jsx)(p.Textarea,{className:"min-h-24",disabled:D,onChange:e=>U(e.target.value),value:_})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:S("commitEmail")}),(0,t.jsxs)(m.Select,{disabled:D,onValueChange:H,value:F,children:[(0,t.jsx)(m.SelectTrigger,{children:(0,t.jsx)(m.SelectValue,{})}),(0,t.jsxs)(m.SelectContent,{children:[(0,t.jsx)(m.SelectItem,{value:f,children:S("githubDefaultEmail")}),P.commitEmails.map(e=>(0,t.jsx)(m.SelectItem,{value:e,children:e},e))]})]})]}),!e.primary&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(d.Checkbox,{checked:V,disabled:D,id:`delete-after-merge-${e.id}`,onCheckedChange:e=>G(!!e)}),(0,t.jsx)(h.Label,{htmlFor:`delete-after-merge-${e.id}`,children:w("deleteAfterMerge")})]}),e.ticketKey&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(d.Checkbox,{checked:K,disabled:D,id:`done-after-merge-${e.id}`,onCheckedChange:e=>z(!!e)}),(0,t.jsx)(h.Label,{htmlFor:`done-after-merge-${e.id}`,children:w("moveTicketToDone")})]})]})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2 py-6 text-sm text-muted-foreground",children:[(0,t.jsx)(g.Spinner,{})," ",S("loadingMergeOptions")]}),(0,t.jsxs)(c.DialogFooter,{children:[I&&(0,t.jsx)(o.Button,{disabled:D,onClick:()=>void Q(),type:"button",variant:"destructive",children:w("cancelAutoMerge")}),(0,t.jsx)(o.Button,{disabled:D,onClick:()=>N(!1),type:"button",variant:"outline",children:w("cancel")}),(0,t.jsxs)(o.Button,{disabled:E||D||!M||!O.trim()||!I&&!P?.canEnableAutoMerge,onClick:()=>void J(),type:"button",children:[D&&(0,t.jsx)(g.Spinner,{}),w(Y?"resumeAutoMerge":"saveAutoMerge")]})]})]})})]})},"AutoSyncButton",0,function({worktree:e,conflictWorkflows:r,disabled:i,onCompleted:u,onError:p}){let f=(0,s.useTranslations)("worktrees"),k=e.autoSync,[w,S]=(0,n.useState)(!1),[y,C]=(0,n.useState)(!1),[I,T]=(0,n.useState)(!1),[N,E]=(0,n.useState)(null),[A,D]=(0,n.useState)(!1),[R,B]=(0,n.useState)(j),[W,P]=(0,n.useState)(j),L=(0,n.useMemo)(()=>r.find(e=>e.id===R),[r,R]),M=async()=>{C(!0),E(null);try{await (0,x.controlPlaneRequest)(`mutation ConfigureWorktreeAutoSync(
67
+ }`,{worktreeId:e.id}),j(null),N(!1),await b()}catch(e){W(v(e))}finally{R(!1)}},Y=I?.state==="ACTION_REQUIRED",X=I?.state==="COMPLETED";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Button,{className:I&&!Y?"bg-emerald-600 text-white hover:bg-emerald-700":void 0,disabled:!y||a&&!I||X,onClick:e=>{e.stopPropagation(),A(!0),L(null),W(null),N(!0)},size:"sm",type:"button",variant:Y?"destructive":I?"default":"outline",children:[(0,t.jsx)(r.GitMerge,{}),w(X?"autoMergeComplete":Y?"autoMergePaused":I?"autoMerging":"autoMerge")]}),(0,t.jsx)(c.Dialog,{onOpenChange:e=>!D&&N(e),open:T,children:(0,t.jsxs)(c.DialogContent,{className:"sm:max-w-xl",children:[(0,t.jsxs)(c.DialogHeader,{children:[(0,t.jsx)(c.DialogTitle,{children:w("autoMergeTitle")}),(0,t.jsx)(c.DialogDescription,{children:w("autoMergeDescription")})]}),!E&&(P||B)?(0,t.jsxs)("div",{className:"space-y-4",children:[(B||I?.lastError)&&(0,t.jsx)(l.Alert,{variant:"destructive",children:(0,t.jsx)(l.AlertDescription,{children:B||I?.lastError})}),P&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:S("mergeType")}),(0,t.jsxs)(g.Select,{disabled:D,onValueChange:e=>$(e),value:M,children:[(0,t.jsx)(g.SelectTrigger,{children:(0,t.jsx)(g.SelectValue,{})}),(0,t.jsx)(g.SelectContent,{children:P.availableMethods.map(e=>(0,t.jsx)(g.SelectItem,{value:e,children:S(`mergeTypes.${e}`)},e))})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:S("commitMessage")}),(0,t.jsx)(u.Input,{disabled:D,onChange:e=>q(e.target.value),value:O})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:S("commitDescription")}),(0,t.jsx)(p.Textarea,{className:"min-h-24",disabled:D,onChange:e=>U(e.target.value),value:_})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:S("commitEmail")}),(0,t.jsxs)(g.Select,{disabled:D,onValueChange:H,value:F,children:[(0,t.jsx)(g.SelectTrigger,{children:(0,t.jsx)(g.SelectValue,{})}),(0,t.jsxs)(g.SelectContent,{children:[(0,t.jsx)(g.SelectItem,{value:f,children:S("githubDefaultEmail")}),P.commitEmails.map(e=>(0,t.jsx)(g.SelectItem,{value:e,children:e},e))]})]})]}),!e.primary&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(d.Checkbox,{checked:V,disabled:D,id:`delete-after-merge-${e.id}`,onCheckedChange:e=>G(!!e)}),(0,t.jsx)(h.Label,{htmlFor:`delete-after-merge-${e.id}`,children:w("deleteAfterMerge")})]}),e.ticketKey&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(d.Checkbox,{checked:K,disabled:D,id:`done-after-merge-${e.id}`,onCheckedChange:e=>z(!!e)}),(0,t.jsx)(h.Label,{htmlFor:`done-after-merge-${e.id}`,children:w("moveTicketToDone")})]})]})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2 py-6 text-sm text-muted-foreground",children:[(0,t.jsx)(m.Spinner,{})," ",S("loadingMergeOptions")]}),(0,t.jsxs)(c.DialogFooter,{children:[I&&(0,t.jsx)(o.Button,{disabled:D,onClick:()=>void Q(),type:"button",variant:"destructive",children:w("cancelAutoMerge")}),(0,t.jsx)(o.Button,{disabled:D,onClick:()=>N(!1),type:"button",variant:"outline",children:w("cancel")}),(0,t.jsxs)(o.Button,{disabled:E||D||!M||!O.trim()||!I&&!P?.canEnableAutoMerge,onClick:()=>void J(),type:"button",children:[D&&(0,t.jsx)(m.Spinner,{}),w(Y?"resumeAutoMerge":"saveAutoMerge")]})]})]})})]})},"AutoSyncButton",0,function({worktree:e,conflictWorkflows:r,disabled:i,onCompleted:u,onError:p}){let f=(0,s.useTranslations)("worktrees"),k=e.autoSync,[w,S]=(0,n.useState)(!1),[y,C]=(0,n.useState)(!1),[I,T]=(0,n.useState)(!1),[N,E]=(0,n.useState)(null),[A,D]=(0,n.useState)(!1),[R,B]=(0,n.useState)(j),[W,P]=(0,n.useState)(j),L=(0,n.useMemo)(()=>r.find(e=>e.id===R),[r,R]),M=async()=>{C(!0),E(null);try{await (0,x.controlPlaneRequest)(`mutation ConfigureWorktreeAutoSync(
68
68
  $input: ConfigureWorktreeAutoSyncInput!
69
69
  ) {
70
70
  configureWorktreeAutoSync(input: $input) {
@@ -75,40 +75,40 @@
75
75
  cancelWorktreeAutoSync(worktreeId: $worktreeId)
76
76
  }`,{worktreeId:e.id}),p(null),S(!1),await u()}catch(e){E(v(e))}finally{C(!1)}},O=async()=>{C(!0),E(null);try{let t=await (0,x.controlPlaneRequest)(`mutation ForceWorktreeAutoSync($worktreeId: ID!, $requestId: ID!) {
77
77
  forceWorktreeAutoSync(worktreeId: $worktreeId, requestId: $requestId) { id }
78
- }`,{worktreeId:e.id,requestId:crypto.randomUUID()});await (0,b.waitForWorktreeJob)(t.forceWorktreeAutoSync.id),p(null),S(!1),await u()}catch(e){E(v(e)),await u().catch(()=>void 0)}finally{T(!1),C(!1)}},q=k?.state==="PAUSED";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Button,{className:k&&!q?"bg-emerald-600 text-white hover:bg-emerald-700":void 0,disabled:i&&!k,onClick:e=>{e.stopPropagation(),E(null),T(!1),D(!!k?.conflictWorkflowId),B(k?.conflictWorkflowId??j),P(k?.conflictWorkflowChoice??j),S(!0)},size:"sm",type:"button",variant:q?"destructive":k?"default":"outline",children:[(0,t.jsx)(a.RefreshCw,{}),f(q?"autoSyncPaused":k?"autoSyncing":"autoSync")]}),(0,t.jsx)(c.Dialog,{onOpenChange:e=>{y||S(e),e||T(!1)},open:w,children:(0,t.jsxs)(c.DialogContent,{className:"sm:max-w-xl",children:[(0,t.jsxs)(c.DialogHeader,{children:[(0,t.jsx)(c.DialogTitle,{children:f("autoSyncTitle")}),(0,t.jsx)(c.DialogDescription,{children:f("autoSyncDescription")})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(N||k?.lastError)&&(0,t.jsx)(l.Alert,{variant:"destructive",children:(0,t.jsx)(l.AlertDescription,{children:N||k?.lastError})}),(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(d.Checkbox,{checked:A,disabled:y||0===r.length,id:`auto-sync-workflow-${e.id}`,onCheckedChange:e=>D(!!e)}),(0,t.jsx)(h.Label,{htmlFor:`auto-sync-workflow-${e.id}`,children:f("useConflictWorkflow")})]}),A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:f("selectConflictWorkflow")}),(0,t.jsxs)(m.Select,{disabled:y,onValueChange:e=>{B(e),P(j)},value:R,children:[(0,t.jsx)(m.SelectTrigger,{children:(0,t.jsx)(m.SelectValue,{})}),(0,t.jsxs)(m.SelectContent,{children:[(0,t.jsx)(m.SelectItem,{value:j,children:f("noWorkflow")}),r.map(e=>(0,t.jsx)(m.SelectItem,{value:e.id,children:e.name},e.id))]})]})]}),L?.triggerChoices&&L.triggerChoices.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:f("conflictWorkflowChoice")}),(0,t.jsxs)(m.Select,{disabled:y,onValueChange:P,value:W,children:[(0,t.jsx)(m.SelectTrigger,{children:(0,t.jsx)(m.SelectValue,{})}),(0,t.jsxs)(m.SelectContent,{children:[L.hasPlainTrigger&&(0,t.jsx)(m.SelectItem,{value:j,children:f("defaultWorkflowTrigger")}),L.triggerChoices.map(e=>(0,t.jsx)(m.SelectItem,{value:e.key,children:e.label},e.key))]})]})]})]})]}),(0,t.jsxs)(c.DialogFooter,{children:[k?.state==="PAUSED"&&"PREPARATION_CONFLICT"===k.pauseReason&&(0,t.jsxs)(o.Button,{disabled:y,onClick:()=>{I?O():T(!0)},type:"button",variant:"destructive",children:[y&&(0,t.jsx)(g.Spinner,{})," ",f(I?"confirmForceSyncPreparations":"forceSyncPreparations")]}),k&&(0,t.jsx)(o.Button,{disabled:y,onClick:()=>void $(),type:"button",variant:"destructive",children:f("cancelAutoSync")}),(0,t.jsx)(o.Button,{disabled:y,onClick:()=>S(!1),type:"button",variant:"outline",children:f("cancel")}),(0,t.jsxs)(o.Button,{disabled:y||A&&R===j||!!(A&&L?.triggerChoices?.length&&!L.hasPlainTrigger&&W===j),onClick:()=>void M(),type:"button",children:[y&&(0,t.jsx)(g.Spinner,{}),f(q?"resumeAutoSync":"saveAutoSync")]})]})]})})]})}])},942230,756283,941179,e=>{"use strict";var t=e.i(843476),r=e.i(716327),a=e.i(434322),s=e.i(550420),n=e.i(948148),i=e.i(271645),l=e.i(487486),o=e.i(816484);e.i(983632);var d=e.i(272563),c=e.i(605345),u=e.i(142811),h=e.i(987968),m=e.i(784774),g=e.i(975157),p=e.i(462777),x=e.i(637611),b=e.i(455329);function j({detail:e,worktreeId:r}){let a=(0,n.useTranslations)("worktrees");return(0,t.jsxs)("div",{className:"w-full space-y-4 border-t pt-4","data-testid":"worktree-detail","data-worktree-navigation-ignore":"true",children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mb-2 font-medium",children:a("changes",{count:e.changes.length})}),(0,t.jsx)("div",{"aria-label":a("changes",{count:e.changes.length}),className:"max-h-80 divide-y overflow-auto rounded-md border",role:"group",children:e.changes.length?e.changes.map(e=>(0,t.jsx)(f,{change:e,worktreeId:r},e.path)):(0,t.jsx)("p",{className:"p-3 text-sm text-muted-foreground",children:a("noChanges")})})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mb-2 font-medium",children:a("commits",{count:e.commits.length})}),(0,t.jsx)("div",{className:"max-h-80 overflow-auto rounded-md border",children:e.commits.length?(0,t.jsx)(m.Table,{"aria-label":a("commits",{count:e.commits.length}),className:"min-w-[36rem] table-fixed text-xs",children:(0,t.jsx)(m.TableBody,{children:e.commits.map(e=>(0,t.jsxs)(m.TableRow,{children:[(0,t.jsx)(m.TableCell,{className:"w-24 px-2 py-1.5 font-mono text-muted-foreground",children:e.sha.slice(0,8)}),(0,t.jsx)(m.TableCell,{className:"max-w-0 px-2 py-1.5",children:(0,t.jsxs)("div",{className:"flex min-w-0 items-baseline gap-2",children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 break-words whitespace-normal font-medium",children:e.subject}),(0,t.jsxs)("span",{className:"shrink-0 text-muted-foreground",children:[e.authorName," ·"," ",(0,t.jsx)(o.DateTime,{value:e.authoredAt})]})]})}),(0,t.jsx)(m.TableCell,{className:"w-24 px-2 py-1.5 text-right",children:(0,t.jsx)(N,{additions:e.additions,deletions:e.deletions})})]},e.sha))})}):(0,t.jsx)("p",{className:"p-3 text-sm text-muted-foreground",children:a("noCommits")})})]})]})}function f({change:e,worktreeId:r}){let a=(0,n.useTranslations)("worktrees");return(0,t.jsx)(v,{label:e.path,summary:(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[e.conflicted&&(0,t.jsx)(l.Badge,{variant:"destructive",children:a("conflicted")}),e.staged&&(0,t.jsx)(T,{additions:e.stagedAdditions,deletions:e.stagedDeletions,label:a("staged")}),e.unstaged&&(0,t.jsx)(T,{additions:e.unstagedAdditions,deletions:e.unstagedDeletions,label:a("unstaged")}),e.untracked&&(0,t.jsx)(T,{additions:e.unstagedAdditions,deletions:e.unstagedDeletions,label:a("untracked")})]}),children:(0,t.jsxs)("div",{className:"space-y-3",children:[e.staged&&(0,t.jsx)(S,{label:a("staged"),path:e.path,previousPath:e.previousPath,scope:"STAGED",worktreeId:r}),e.unstaged&&(0,t.jsx)(S,{label:a("unstaged"),path:e.path,scope:"UNSTAGED",worktreeId:r}),e.untracked&&(0,t.jsx)(S,{label:a("untracked"),path:e.path,scope:"UNTRACKED",worktreeId:r})]})})}function v({label:e,prefix:a,summary:s,children:n}){let[l,o]=(0,i.useState)(!1);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{"aria-expanded":l,className:"flex min-h-8 w-full items-center gap-2 px-2 py-1.5 text-left hover:bg-muted/40",onClick:()=>o(e=>!e),type:"button",children:[(0,t.jsx)(r.ChevronDown,{className:(0,g.cn)("size-3.5 shrink-0 transition-transform",l&&"rotate-180")}),a&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:a}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",title:e,children:e}),(0,t.jsx)("span",{className:"shrink-0",children:s})]}),l&&n&&(0,t.jsx)("div",{className:"border-t bg-muted/10 p-3",children:n})]})}function k({worktreeId:e,commitSha:r}){let{value:a,loading:s,error:n}=y(e,"COMMIT",null,null,r);return s?(0,t.jsx)(C,{}):n?(0,t.jsx)(I,{value:n}):(0,t.jsx)("div",{className:"divide-y rounded-md border bg-background",children:a?.files.map(a=>(0,t.jsx)(w,{commitSha:r,file:a,scope:"COMMIT",worktreeId:e},`${a.previousPath??""}:${a.path}`))})}function w({file:e,worktreeId:r,scope:n,commitSha:i}){return(0,t.jsx)(v,{label:e.path,summary:(0,t.jsxs)("span",{className:"inline-flex items-center gap-2",children:[e.image?(0,t.jsx)(s.Images,{className:"size-4"}):(0,t.jsx)(a.FileCode2,{className:"size-4"}),(0,t.jsx)(l.Badge,{variant:"outline",children:e.changeType}),(0,t.jsx)(N,{additions:e.additions,deletions:e.deletions})]}),children:(0,t.jsx)(S,{commitSha:i,path:e.path,previousPath:e.previousPath,scope:n,worktreeId:r})})}function S({label:e,worktreeId:r,path:a,previousPath:s,scope:i,commitSha:l}){let o=(0,n.useTranslations)("worktreeDetail"),h=(0,u.useDiffViewLabels)(),m=(0,u.useImageDiffLabels)(),{value:g,loading:p,error:x}=y(r,i,a,s??null,l??null),b=e=>{let t=new URLSearchParams({scope:i,path:a,side:e});return s&&t.set("previousPath",s),l&&t.set("commitSha",l),`/api/worktrees/${encodeURIComponent(r)}/diff-image?${t}`};return(0,t.jsxs)("div",{className:"space-y-2",children:[e&&(0,t.jsx)("p",{className:"text-xs font-medium uppercase text-muted-foreground",children:e}),p?(0,t.jsx)(C,{}):x?(0,t.jsx)(I,{value:x}):g?.image?(0,t.jsx)(d.ImageDiff,{after:g.afterAvailable?b("AFTER"):null,before:g.beforeAvailable?b("BEFORE"):null,labels:m}):g?.patch?(0,t.jsx)(c.PatchDiffView,{labels:{...h,truncated:o("diffLimit")},mode:"UNIFIED",patch:g.patch,truncated:g.truncated,wrap:!1}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:o(g?.truncated?"diffTooLarge":g?.binary?"binaryFileChanged":"noTextChanges")})]})}function y(e,t,r,a,s){let[n,l]=(0,i.useState)(null),[o,d]=(0,i.useState)(!0),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let n=!1;return(0,x.controlPlaneRequest)(b.INSPECT_WORKTREE_DIFF_MUTATION,{input:{worktreeId:e,scope:t,path:r,previousPath:a,commitSha:s,requestId:(0,p.createClientId)()}}).then(e=>{n||l(e.inspectWorktreeDiff)}).catch(e=>{n||u(e instanceof Error?e.message:String(e))}).finally(()=>{n||d(!1)}),()=>{n=!0}},[s,r,a,t,e]),{value:n,loading:o,error:c}}function C(){let e=(0,n.useTranslations)("worktreeDetail");return(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(h.Spinner,{})," ",e("loadingDiff")]})}function I({value:e}){return(0,t.jsx)("p",{className:"text-sm text-destructive",children:e})}function T({label:e,additions:r,deletions:a}){return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:e}),(0,t.jsx)(N,{additions:r,deletions:a})]})}function N({additions:e,deletions:r}){return null===e&&null===r?(0,t.jsx)("span",{className:"text-muted-foreground",children:"—"}):(0,t.jsxs)("span",{className:"inline-flex gap-1 text-xs tabular-nums",children:[(0,t.jsxs)("span",{className:"text-emerald-700 dark:text-emerald-400",children:["+",e??0]}),(0,t.jsxs)("span",{className:"text-red-700 dark:text-red-400",children:["−",r??0]})]})}async function E(e){return(await (0,x.controlPlaneRequest)(b.INSPECT_WORKTREE_MUTATION,{id:e,requestId:(0,p.createClientId)()})).inspectWorktree}e.s(["BranchChangesPanel",0,function({files:e,truncated:r,worktreeId:a}){let s=(0,n.useTranslations)("worktreeDetail");return(0,t.jsxs)("div",{className:"space-y-3",children:[e.length?(0,t.jsx)("div",{className:"divide-y rounded-md border",children:e.map(e=>(0,t.jsx)(w,{file:e,scope:"BRANCH",worktreeId:a},`${e.previousPath??""}:${e.path}`))}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s("noBranchChanges")}),r&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:s("diffTruncated")})]})},"WorktreeDetailPanel",0,function({detail:e,worktreeId:r,inline:a=!1}){let s=(0,n.useTranslations)("worktrees");return a?(0,t.jsx)(j,{detail:e,worktreeId:r}):(0,t.jsxs)("div",{className:(0,g.cn)("w-full space-y-4",a&&"border-t pt-4"),"data-testid":"worktree-detail","data-worktree-navigation-ignore":a?"true":void 0,children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mb-2 font-medium",children:s("changes",{count:e.changes.length})}),(0,t.jsx)("div",{className:"divide-y rounded-md border",children:e.changes.length?e.changes.map(e=>(0,t.jsx)(f,{change:e,worktreeId:r},e.path)):(0,t.jsx)("p",{className:"p-3 text-sm text-muted-foreground",children:s("noChanges")})})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mb-2 font-medium",children:s("commits",{count:e.commits.length})}),(0,t.jsx)("div",{className:"divide-y rounded-md border",children:e.commits.length?e.commits.map(e=>(0,t.jsx)(v,{label:e.subject,prefix:e.sha.slice(0,8),summary:(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.authorName," · ",(0,t.jsx)(o.DateTime,{value:e.authoredAt})," ","·"," ",(0,t.jsx)(N,{additions:e.additions,deletions:e.deletions})]}),children:r?(0,t.jsx)(k,{commitSha:e.sha,worktreeId:r}):null},e.sha)):(0,t.jsx)("p",{className:"p-3 text-sm text-muted-foreground",children:s("noCommits")})})]}),(e.commitsTruncated||e.changesTruncated)&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:s("truncated")})]})}],942230),e.s(["inspectWorktree",0,E,"useLiveWorktree",0,function(e){let[t,r]=(0,i.useState)(null),a=(0,i.useCallback)(t=>{r(r=>({sourceUpdatedAt:e.updatedAt,value:r?.sourceUpdatedAt===e.updatedAt?{...r.value,...t}:t}))},[e.updatedAt]),s=(0,i.useCallback)(e=>{let t={};null!==e.hasStagedChanges&&(t.hasStagedChanges=e.hasStagedChanges),null!==e.hasUnstagedChanges&&(t.hasUnstagedChanges=e.hasUnstagedChanges),null!==e.rebaseInProgress&&(t.rebaseInProgress=e.rebaseInProgress),null!==e.hasConflicts&&(t.hasConflicts=e.hasConflicts),null!==e.pushStatus&&(t.pushStatus=e.pushStatus),"string"==typeof e.headSha&&Object.assign(t,{branch:e.branch,headSha:e.headSha,upstream:e.upstream,ahead:e.ahead,behind:e.behind,syncState:e.syncState??"UNKNOWN",baseAhead:e.baseAhead,baseBehind:e.baseBehind}),Object.keys(t).length&&a(t)},[a]);return{worktree:t?.sourceUpdatedAt===e.updatedAt?{...e,...t.value}:e,applyActivity:s,setUnstagedChanges:(0,i.useCallback)(e=>a({hasUnstagedChanges:e}),[a])}},"useQueuedWorktreeInspection",0,function(e){let t=(0,i.useRef)(!1),r=(0,i.useRef)(!1);return(0,i.useCallback)(async()=>{if(t.current){r.current=!0;return}t.current=!0;try{do r.current=!1,await e();while(r.current)}finally{t.current=!1}},[e])},"useWorktreeActivitySubscription",0,function(e,t,r){let a=(0,i.useRef)(r);(0,i.useEffect)(()=>{a.current=r},[r]),(0,i.useEffect)(()=>{if(!t)return;let r=!1,s=0,n=null,i=()=>void 0,l=e=>{r||e!==s||null!==n||(n=window.setTimeout(()=>{n=null,o()},1e3))},o=()=>{let t=++s;i=(0,x.controlPlaneSubscriptions)().subscribe({query:`subscription WorktreeInspectionChanged($worktreeId: ID!) {
78
+ }`,{worktreeId:e.id,requestId:crypto.randomUUID()});await (0,b.waitForWorktreeJob)(t.forceWorktreeAutoSync.id),p(null),S(!1),await u()}catch(e){E(v(e)),await u().catch(()=>void 0)}finally{T(!1),C(!1)}},q=k?.state==="PAUSED";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Button,{className:k&&!q?"bg-emerald-600 text-white hover:bg-emerald-700":void 0,disabled:i&&!k,onClick:e=>{e.stopPropagation(),E(null),T(!1),D(!!k?.conflictWorkflowId),B(k?.conflictWorkflowId??j),P(k?.conflictWorkflowChoice??j),S(!0)},size:"sm",type:"button",variant:q?"destructive":k?"default":"outline",children:[(0,t.jsx)(a.RefreshCw,{}),f(q?"autoSyncPaused":k?"autoSyncing":"autoSync")]}),(0,t.jsx)(c.Dialog,{onOpenChange:e=>{y||S(e),e||T(!1)},open:w,children:(0,t.jsxs)(c.DialogContent,{className:"sm:max-w-xl",children:[(0,t.jsxs)(c.DialogHeader,{children:[(0,t.jsx)(c.DialogTitle,{children:f("autoSyncTitle")}),(0,t.jsx)(c.DialogDescription,{children:f("autoSyncDescription")})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(N||k?.lastError)&&(0,t.jsx)(l.Alert,{variant:"destructive",children:(0,t.jsx)(l.AlertDescription,{children:N||k?.lastError})}),(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(d.Checkbox,{checked:A,disabled:y||0===r.length,id:`auto-sync-workflow-${e.id}`,onCheckedChange:e=>D(!!e)}),(0,t.jsx)(h.Label,{htmlFor:`auto-sync-workflow-${e.id}`,children:f("useConflictWorkflow")})]}),A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:f("selectConflictWorkflow")}),(0,t.jsxs)(g.Select,{disabled:y,onValueChange:e=>{B(e),P(j)},value:R,children:[(0,t.jsx)(g.SelectTrigger,{children:(0,t.jsx)(g.SelectValue,{})}),(0,t.jsxs)(g.SelectContent,{children:[(0,t.jsx)(g.SelectItem,{value:j,children:f("noWorkflow")}),r.map(e=>(0,t.jsx)(g.SelectItem,{value:e.id,children:e.name},e.id))]})]})]}),L?.triggerChoices&&L.triggerChoices.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Label,{className:"mb-1.5 block",children:f("conflictWorkflowChoice")}),(0,t.jsxs)(g.Select,{disabled:y,onValueChange:P,value:W,children:[(0,t.jsx)(g.SelectTrigger,{children:(0,t.jsx)(g.SelectValue,{})}),(0,t.jsxs)(g.SelectContent,{children:[L.hasPlainTrigger&&(0,t.jsx)(g.SelectItem,{value:j,children:f("defaultWorkflowTrigger")}),L.triggerChoices.map(e=>(0,t.jsx)(g.SelectItem,{value:e.key,children:e.label},e.key))]})]})]})]})]}),(0,t.jsxs)(c.DialogFooter,{children:[k?.state==="PAUSED"&&"PREPARATION_CONFLICT"===k.pauseReason&&(0,t.jsxs)(o.Button,{disabled:y,onClick:()=>{I?O():T(!0)},type:"button",variant:"destructive",children:[y&&(0,t.jsx)(m.Spinner,{})," ",f(I?"confirmForceSyncPreparations":"forceSyncPreparations")]}),k&&(0,t.jsx)(o.Button,{disabled:y,onClick:()=>void $(),type:"button",variant:"destructive",children:f("cancelAutoSync")}),(0,t.jsx)(o.Button,{disabled:y,onClick:()=>S(!1),type:"button",variant:"outline",children:f("cancel")}),(0,t.jsxs)(o.Button,{disabled:y||A&&R===j||!!(A&&L?.triggerChoices?.length&&!L.hasPlainTrigger&&W===j),onClick:()=>void M(),type:"button",children:[y&&(0,t.jsx)(m.Spinner,{}),f(q?"resumeAutoSync":"saveAutoSync")]})]})]})})]})}])},942230,756283,941179,e=>{"use strict";var t=e.i(843476),r=e.i(716327),a=e.i(434322),s=e.i(550420),n=e.i(948148),i=e.i(271645),l=e.i(487486),o=e.i(816484);e.i(983632);var d=e.i(272563),c=e.i(605345),u=e.i(142811),h=e.i(987968),g=e.i(784774),m=e.i(975157),p=e.i(462777),x=e.i(637611),b=e.i(455329);function j({detail:e,worktreeId:r}){let a=(0,n.useTranslations)("worktrees");return(0,t.jsxs)("div",{className:"w-full space-y-4 border-t pt-4","data-testid":"worktree-detail","data-worktree-navigation-ignore":"true",children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mb-2 font-medium",children:a("changes",{count:e.changes.length})}),(0,t.jsx)("div",{"aria-label":a("changes",{count:e.changes.length}),className:"max-h-80 divide-y overflow-auto rounded-md border",role:"group",children:e.changes.length?e.changes.map(e=>(0,t.jsx)(f,{change:e,worktreeId:r},e.path)):(0,t.jsx)("p",{className:"p-3 text-sm text-muted-foreground",children:a("noChanges")})})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mb-2 font-medium",children:a("commits",{count:e.commits.length})}),(0,t.jsx)("div",{className:"max-h-80 overflow-auto rounded-md border",children:e.commits.length?(0,t.jsx)(g.Table,{"aria-label":a("commits",{count:e.commits.length}),className:"min-w-[36rem] table-fixed text-xs",children:(0,t.jsx)(g.TableBody,{children:e.commits.map(e=>(0,t.jsxs)(g.TableRow,{children:[(0,t.jsx)(g.TableCell,{className:"w-24 px-2 py-1.5 font-mono text-muted-foreground",children:e.sha.slice(0,8)}),(0,t.jsx)(g.TableCell,{className:"max-w-0 px-2 py-1.5",children:(0,t.jsxs)("div",{className:"flex min-w-0 items-baseline gap-2",children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 break-words whitespace-normal font-medium",children:e.subject}),(0,t.jsxs)("span",{className:"shrink-0 text-muted-foreground",children:[e.authorName," ·"," ",(0,t.jsx)(o.DateTime,{value:e.authoredAt})]})]})}),(0,t.jsx)(g.TableCell,{className:"w-24 px-2 py-1.5 text-right",children:(0,t.jsx)(N,{additions:e.additions,deletions:e.deletions})})]},e.sha))})}):(0,t.jsx)("p",{className:"p-3 text-sm text-muted-foreground",children:a("noCommits")})})]})]})}function f({change:e,worktreeId:r}){let a=(0,n.useTranslations)("worktrees");return(0,t.jsx)(v,{label:e.path,summary:(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[e.conflicted&&(0,t.jsx)(l.Badge,{variant:"destructive",children:a("conflicted")}),e.staged&&(0,t.jsx)(T,{additions:e.stagedAdditions,deletions:e.stagedDeletions,label:a("staged")}),e.unstaged&&(0,t.jsx)(T,{additions:e.unstagedAdditions,deletions:e.unstagedDeletions,label:a("unstaged")}),e.untracked&&(0,t.jsx)(T,{additions:e.unstagedAdditions,deletions:e.unstagedDeletions,label:a("untracked")})]}),children:(0,t.jsxs)("div",{className:"space-y-3",children:[e.staged&&(0,t.jsx)(S,{label:a("staged"),path:e.path,previousPath:e.previousPath,scope:"STAGED",worktreeId:r}),e.unstaged&&(0,t.jsx)(S,{label:a("unstaged"),path:e.path,scope:"UNSTAGED",worktreeId:r}),e.untracked&&(0,t.jsx)(S,{label:a("untracked"),path:e.path,scope:"UNTRACKED",worktreeId:r})]})})}function v({label:e,prefix:a,summary:s,children:n}){let[l,o]=(0,i.useState)(!1);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{"aria-expanded":l,className:"flex min-h-8 w-full items-center gap-2 px-2 py-1.5 text-left hover:bg-muted/40",onClick:()=>o(e=>!e),type:"button",children:[(0,t.jsx)(r.ChevronDown,{className:(0,m.cn)("size-3.5 shrink-0 transition-transform",l&&"rotate-180")}),a&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:a}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",title:e,children:e}),(0,t.jsx)("span",{className:"shrink-0",children:s})]}),l&&n&&(0,t.jsx)("div",{className:"border-t bg-muted/10 p-3",children:n})]})}function k({worktreeId:e,commitSha:r}){let{value:a,loading:s,error:n}=y(e,"COMMIT",null,null,r);return s?(0,t.jsx)(C,{}):n?(0,t.jsx)(I,{value:n}):(0,t.jsx)("div",{className:"divide-y rounded-md border bg-background",children:a?.files.map(a=>(0,t.jsx)(w,{commitSha:r,file:a,scope:"COMMIT",worktreeId:e},`${a.previousPath??""}:${a.path}`))})}function w({file:e,worktreeId:r,scope:n,commitSha:i}){return(0,t.jsx)(v,{label:e.path,summary:(0,t.jsxs)("span",{className:"inline-flex items-center gap-2",children:[e.image?(0,t.jsx)(s.Images,{className:"size-4"}):(0,t.jsx)(a.FileCode2,{className:"size-4"}),(0,t.jsx)(l.Badge,{variant:"outline",children:e.changeType}),(0,t.jsx)(N,{additions:e.additions,deletions:e.deletions})]}),children:(0,t.jsx)(S,{commitSha:i,path:e.path,previousPath:e.previousPath,scope:n,worktreeId:r})})}function S({label:e,worktreeId:r,path:a,previousPath:s,scope:i,commitSha:l}){let o=(0,n.useTranslations)("worktreeDetail"),h=(0,u.useDiffViewLabels)(),g=(0,u.useImageDiffLabels)(),{value:m,loading:p,error:x}=y(r,i,a,s??null,l??null),b=e=>{let t=new URLSearchParams({scope:i,path:a,side:e});return s&&t.set("previousPath",s),l&&t.set("commitSha",l),`/api/worktrees/${encodeURIComponent(r)}/diff-image?${t}`};return(0,t.jsxs)("div",{className:"space-y-2",children:[e&&(0,t.jsx)("p",{className:"text-xs font-medium uppercase text-muted-foreground",children:e}),p?(0,t.jsx)(C,{}):x?(0,t.jsx)(I,{value:x}):m?.image?(0,t.jsx)(d.ImageDiff,{after:m.afterAvailable?b("AFTER"):null,before:m.beforeAvailable?b("BEFORE"):null,labels:g}):m?.patch?(0,t.jsx)(c.PatchDiffView,{labels:{...h,truncated:o("diffLimit")},mode:"UNIFIED",patch:m.patch,truncated:m.truncated,wrap:!1}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:o(m?.truncated?"diffTooLarge":m?.binary?"binaryFileChanged":"noTextChanges")})]})}function y(e,t,r,a,s){let[n,l]=(0,i.useState)(null),[o,d]=(0,i.useState)(!0),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let n=!1;return(0,x.controlPlaneRequest)(b.INSPECT_WORKTREE_DIFF_MUTATION,{input:{worktreeId:e,scope:t,path:r,previousPath:a,commitSha:s,requestId:(0,p.createClientId)()}}).then(e=>{n||l(e.inspectWorktreeDiff)}).catch(e=>{n||u(e instanceof Error?e.message:String(e))}).finally(()=>{n||d(!1)}),()=>{n=!0}},[s,r,a,t,e]),{value:n,loading:o,error:c}}function C(){let e=(0,n.useTranslations)("worktreeDetail");return(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(h.Spinner,{})," ",e("loadingDiff")]})}function I({value:e}){return(0,t.jsx)("p",{className:"text-sm text-destructive",children:e})}function T({label:e,additions:r,deletions:a}){return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:e}),(0,t.jsx)(N,{additions:r,deletions:a})]})}function N({additions:e,deletions:r}){return null===e&&null===r?(0,t.jsx)("span",{className:"text-muted-foreground",children:"—"}):(0,t.jsxs)("span",{className:"inline-flex gap-1 text-xs tabular-nums",children:[(0,t.jsxs)("span",{className:"text-emerald-700 dark:text-emerald-400",children:["+",e??0]}),(0,t.jsxs)("span",{className:"text-red-700 dark:text-red-400",children:["−",r??0]})]})}async function E(e){return(await (0,x.controlPlaneRequest)(b.INSPECT_WORKTREE_MUTATION,{id:e,requestId:(0,p.createClientId)()})).inspectWorktree}e.s(["BranchChangesPanel",0,function({files:e,truncated:r,worktreeId:a}){let s=(0,n.useTranslations)("worktreeDetail");return(0,t.jsxs)("div",{className:"space-y-3",children:[e.length?(0,t.jsx)("div",{className:"divide-y rounded-md border",children:e.map(e=>(0,t.jsx)(w,{file:e,scope:"BRANCH",worktreeId:a},`${e.previousPath??""}:${e.path}`))}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s("noBranchChanges")}),r&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:s("diffTruncated")})]})},"WorktreeDetailPanel",0,function({detail:e,worktreeId:r,inline:a=!1}){let s=(0,n.useTranslations)("worktrees");return a?(0,t.jsx)(j,{detail:e,worktreeId:r}):(0,t.jsxs)("div",{className:(0,m.cn)("w-full space-y-4",a&&"border-t pt-4"),"data-testid":"worktree-detail","data-worktree-navigation-ignore":a?"true":void 0,children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mb-2 font-medium",children:s("changes",{count:e.changes.length})}),(0,t.jsx)("div",{className:"divide-y rounded-md border",children:e.changes.length?e.changes.map(e=>(0,t.jsx)(f,{change:e,worktreeId:r},e.path)):(0,t.jsx)("p",{className:"p-3 text-sm text-muted-foreground",children:s("noChanges")})})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mb-2 font-medium",children:s("commits",{count:e.commits.length})}),(0,t.jsx)("div",{className:"divide-y rounded-md border",children:e.commits.length?e.commits.map(e=>(0,t.jsx)(v,{label:e.subject,prefix:e.sha.slice(0,8),summary:(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.authorName," · ",(0,t.jsx)(o.DateTime,{value:e.authoredAt})," ","·"," ",(0,t.jsx)(N,{additions:e.additions,deletions:e.deletions})]}),children:r?(0,t.jsx)(k,{commitSha:e.sha,worktreeId:r}):null},e.sha)):(0,t.jsx)("p",{className:"p-3 text-sm text-muted-foreground",children:s("noCommits")})})]}),(e.commitsTruncated||e.changesTruncated)&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:s("truncated")})]})}],942230),e.s(["inspectWorktree",0,E,"useLiveWorktree",0,function(e){let[t,r]=(0,i.useState)(null),a=(0,i.useCallback)(t=>{r(r=>({sourceUpdatedAt:e.updatedAt,value:r?.sourceUpdatedAt===e.updatedAt?{...r.value,...t}:t}))},[e.updatedAt]),s=(0,i.useCallback)(e=>{let t={};null!==e.hasStagedChanges&&(t.hasStagedChanges=e.hasStagedChanges),null!==e.hasUnstagedChanges&&(t.hasUnstagedChanges=e.hasUnstagedChanges),null!==e.rebaseInProgress&&(t.rebaseInProgress=e.rebaseInProgress),null!==e.hasConflicts&&(t.hasConflicts=e.hasConflicts),null!==e.pushStatus&&(t.pushStatus=e.pushStatus),"string"==typeof e.headSha&&Object.assign(t,{branch:e.branch,headSha:e.headSha,upstream:e.upstream,ahead:e.ahead,behind:e.behind,syncState:e.syncState??"UNKNOWN",baseAhead:e.baseAhead,baseBehind:e.baseBehind}),Object.keys(t).length&&a(t)},[a]);return{worktree:t?.sourceUpdatedAt===e.updatedAt?{...e,...t.value}:e,applyActivity:s,setUnstagedChanges:(0,i.useCallback)(e=>a({hasUnstagedChanges:e}),[a])}},"useQueuedWorktreeInspection",0,function(e){let t=(0,i.useRef)(!1),r=(0,i.useRef)(!1);return(0,i.useCallback)(async()=>{if(t.current){r.current=!0;return}t.current=!0;try{do r.current=!1,await e();while(r.current)}finally{t.current=!1}},[e])},"useWorktreeActivitySubscription",0,function(e,t,r){let a=(0,i.useRef)(r);(0,i.useEffect)(()=>{a.current=r},[r]),(0,i.useEffect)(()=>{if(!t)return;let r=!1,s=0,n=null,i=()=>void 0,l=e=>{r||e!==s||null!==n||(n=window.setTimeout(()=>{n=null,o()},1e3))},o=()=>{let t=++s;i=(0,x.controlPlaneSubscriptions)().subscribe({query:`subscription WorktreeInspectionChanged($worktreeId: ID!) {
79
79
  worktreeInspectionChanged(worktreeId: $worktreeId) {
80
80
  worktreeId branch headSha upstream ahead behind syncState baseAhead baseBehind
81
81
  hasStagedChanges hasUnstagedChanges rebaseInProgress hasConflicts pushStatus observedAt
82
82
  }
83
83
  }`,variables:{worktreeId:e}},{next:e=>{let t=e.data?.worktreeInspectionChanged;t&&a.current(t)},error:()=>l(t),complete:()=>l(t)})};return o(),()=>{r=!0,s+=1,null!==n&&window.clearTimeout(n),i()}},[t,e])}],756283);var A=e.i(113030),D=e.i(263676),R=e.i(501416),B=e.i(519455),W=e.i(906197),P=e.i(440289);e.s(["WorktreeRebaseConflictItem",0,function({worktree:e,group:r,onCompleted:a,onError:s}){let l=(0,n.useTranslations)("worktrees"),[o,d]=(0,i.useState)(!1);if(!e.rebaseInProgress)return null;let c=r.mergeConflictQuickActions??[],u=async()=>{d(!0);try{let t=await (0,x.controlPlaneRequest)(`mutation CancelWorktreeRebase($input: RunWorktreeOperationInput!) {
84
84
  runWorktreeOperation(input: $input) { id }
85
- }`,{input:{worktreeId:e.id,operation:"CANCEL_REBASE",requestId:(0,p.createClientId)()}});await (0,P.waitForWorktreeJob)(t.runWorktreeOperation.id),await a(),s(null)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,t.jsxs)(W.Item,{className:"border-destructive/40 bg-[color-mix(in_oklab,var(--destructive)_8%,var(--card))]",size:"sm",variant:"outline",children:[(0,t.jsx)(W.ItemMedia,{variant:"icon",children:(0,t.jsx)(A.GitMerge,{className:"text-destructive"})}),(0,t.jsxs)(W.ItemContent,{children:[(0,t.jsx)(W.ItemTitle,{children:l("rebasePaused")}),(0,t.jsx)(W.ItemDescription,{children:l(e.hasConflicts?"rebaseConflicts":"rebaseIncomplete")})]}),(0,t.jsx)(W.ItemActions,{children:(0,t.jsxs)(B.Button,{disabled:o,onClick:()=>void u(),size:"sm",variant:"outline",children:[o?(0,t.jsx)(h.Spinner,{}):(0,t.jsx)(D.X,{}),l("cancelRebase")]})}),e.hasConflicts&&c.length?(0,t.jsx)(W.ItemFooter,{className:"-mx-3 -mb-2.5 basis-[calc(100%+(var(--spacing)*6))] rounded-b-lg border-t border-destructive/30 bg-[color-mix(in_oklab,var(--destructive)_16%,var(--card))] px-3 py-2.5",children:(0,t.jsx)(R.WorkflowQuickActions,{sessionData:{worktree:{id:e.id,path:e.folder,branch:e.branch,baseBranch:e.baseBranch,headSha:e.headSha,rebaseInProgress:!0,hasConflicts:!0},codebase:{id:r.codebase.id,folder:r.codebase.folder},repo:{id:r.repository.id,name:r.repository.name,url:r.repository.displayOrigin,displayOrigin:r.repository.displayOrigin}},worktreeId:e.id,workflows:c})}):null]})}],941179)},267572,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(944887),s=e.i(876561),n=e.i(635416),i=e.i(768877),l=e.i(96892),o=e.i(689664),d=e.i(716327),c=e.i(867927),u=e.i(55677),h=e.i(452330),m=e.i(762368),g=e.i(482022),p=e.i(835079),x=e.i(269846),b=e.i(187516),j=e.i(113030),f=e.i(634398),v=e.i(851817),k=e.i(882505),w=e.i(84570),S=e.i(648119),y=e.i(939050),C=e.i(506184),I=e.i(515281),T=e.i(77071),N=e.i(741120),E=e.i(395925),A=e.i(856522),D=e.i(566595),R=e.i(868401),B=e.i(604139),W=e.i(759659),P=e.i(725981),L=e.i(861745),M=e.i(948148),$=e.i(90969),O=e.i(771777),q=e.i(866026),_=e.i(448295),U=e.i(966264),F=e.i(501416),H=e.i(653269),V=e.i(647776),G=e.i(227286),K=e.i(948812),z=e.i(356505),J=e.i(486122),Q=e.i(929592),Y=e.i(487486),X=e.i(519455),Z=e.i(515288),ee=e.i(257428),et=e.i(776639),er=e.i(755146),ea=e.i(82612),es=e.i(793479),en=e.i(906197),ei=e.i(110204),el=e.i(337822),eo=e.i(983913),ed=e.i(987968),ec=e.i(967489),eu=e.i(784774),eh=e.i(808562),em=e.i(624687),eg=e.i(462777),ep=e.i(360583),ex=e.i(171502),eb=e.i(637611),ej=e.i(975157),ef=e.i(520133),ev=e.i(284494),ek=e.i(539531),ew=e.i(942230),eS=e.i(455329),ey=e.i(756283),eC=e.i(440289),eI=e.i(941179),eT=e.i(940276);let eN=["gray","stone","red","rose","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","lavender","maroon","brown","olive","navy"],eE="worktrees-layout",eA="worktrees-group-by",eD="worktrees-filters",eR="__all__",eB="dirty",eW="clean",eP="non-default";function eL(e){return e?`${eD}:${e}`:eD}function eM(e){return e.hasStagedChanges||e.hasUnstagedChanges}function e$(e,t){let r=t.key.trim().toUpperCase();return{...e,agents:e.agents.map(e=>({...e,codebases:e.codebases.map(e=>({...e,worktrees:e.worktrees.map(e=>e.ticketKey?.trim().toUpperCase()===r?{...e,ticketTitle:t.summary,ticketStatus:t.status}:e)}))}))}}function eO(e,t){return e.some(e=>("string"==typeof e||"number"==typeof e)&&String(e).toLocaleLowerCase().includes(t))}function eq(e,t){let r=t.query.trim().toLocaleLowerCase();return r||t.agentId||t.repositoryId||null!==t.dirty||t.nonDefaultBranch?e.flatMap(e=>{if(t.agentId&&e.agent.id!==t.agentId)return[];let a=r.length>0&&eO([e.agent.id,e.agent.name,e.agent.hostname],r),s=e.codebases.flatMap(e=>{if(t.repositoryId&&e.repository.id!==t.repositoryId)return[];let s=r.length>0&&eO([e.repository.id,e.repository.name,e.repository.description,e.repository.canonicalOrigin,e.repository.displayOrigin,e.codebase.id,e.codebase.folder,e.codebase.observedOrigin,e.codebase.branch,e.codebase.defaultBranch],r),n=!r||a||s?e.worktrees:e.worktrees.filter(e=>eO([e.id,e.branch,e.folder,e.relativePath,e.ticketKey,e.ticketTitle,e.ticketStatus,e.pullRequest?.number,e.pullRequest?.title,e.pullRequest?.repositoryNameWithOwner,e.pullRequest?.jiraKey,...e.tags.map(e=>e.name)],r)),i=null===t.dirty?n:n.filter(e=>eM(e)===t.dirty),l=t.nonDefaultBranch?e.codebase.defaultBranch?i.filter(t=>t.branch!==e.codebase.defaultBranch):[]:i;return l.length?[{...e,worktrees:l}]:[]});return s.length?[{...e,codebases:s}]:[]}):e}function e_(e){let t=new Map;return e.forEach(e=>e.codebases.forEach(r=>{let a=t.get(r.repository.id);a?a.entries.push({agentGroup:e,group:r}):t.set(r.repository.id,{repository:r.repository,entries:[{agentGroup:e,group:r}]})})),[...t.values()].sort((e,t)=>e.repository.name.localeCompare(t.repository.name))}function eU(e,t){if(!t)return e;let r=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),a=r?"\\":"/",s=e=>r?e.replaceAll("/","\\"):e,n=e=>(r?/^[A-Za-z]:\\$/.test(e):"/"===e)?e:e.replace(/[\\/]+$/,""),i=n(s(t)),l=n(s(e)),o=r?i.toLocaleLowerCase():i,d=r?l.toLocaleLowerCase():l;if(d===o)return".";let c=i.endsWith(a)?i:`${i}${a}`,u=r?c.toLocaleLowerCase():c;return d.startsWith(u)?l.slice(c.length):e}function eF(e){return{hasChanges:eM(e),stageOperation:e.hasStagedChanges&&!e.hasUnstagedChanges?"UNSTAGE_ALL":"STAGE_ALL"}}function eH(e,t,r,a){return e.agents.some(e=>e.codebases.some(e=>e.codebase.id===t&&e.worktrees.some(e=>e.id!==a&&e.branch===r)))}let eV={gray:"border-slate-500/40 bg-slate-500/15 text-slate-700 dark:text-slate-300",stone:"border-stone-500/40 bg-stone-500/15 text-stone-700 dark:text-stone-300",red:"border-red-500/40 bg-red-500/15 text-red-700 dark:text-red-300",rose:"border-rose-500/40 bg-rose-500/15 text-rose-700 dark:text-rose-300",orange:"border-orange-500/40 bg-orange-500/15 text-orange-700 dark:text-orange-300",amber:"border-amber-500/40 bg-amber-500/15 text-amber-800 dark:text-amber-300",yellow:"border-yellow-500/40 bg-yellow-500/15 text-yellow-800 dark:text-yellow-300",lime:"border-lime-500/40 bg-lime-500/15 text-lime-800 dark:text-lime-300",green:"border-green-500/40 bg-green-500/15 text-green-700 dark:text-green-300",emerald:"border-emerald-500/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300",teal:"border-teal-500/40 bg-teal-500/15 text-teal-700 dark:text-teal-300",cyan:"border-cyan-500/40 bg-cyan-500/15 text-cyan-700 dark:text-cyan-300",sky:"border-sky-500/40 bg-sky-500/15 text-sky-700 dark:text-sky-300",blue:"border-blue-500/40 bg-blue-500/15 text-blue-700 dark:text-blue-300",indigo:"border-indigo-500/40 bg-indigo-500/15 text-indigo-700 dark:text-indigo-300",violet:"border-violet-500/40 bg-violet-500/15 text-violet-700 dark:text-violet-300",purple:"border-purple-500/40 bg-purple-500/15 text-purple-700 dark:text-purple-300",fuchsia:"border-fuchsia-500/40 bg-fuchsia-500/15 text-fuchsia-700 dark:text-fuchsia-300",pink:"border-pink-500/40 bg-pink-500/15 text-pink-700 dark:text-pink-300",lavender:"border-lavender-500/40 bg-lavender-500/15 text-lavender-700 dark:text-lavender-300",maroon:"border-maroon-500/40 bg-maroon-500/15 text-maroon-700 dark:text-maroon-300",brown:"border-brown-500/40 bg-brown-500/15 text-brown-700 dark:text-brown-300",olive:"border-olive-500/40 bg-olive-500/15 text-olive-700 dark:text-olive-300",navy:"border-navy-500/40 bg-navy-500/15 text-navy-700 dark:text-navy-300"},eG={gray:"border-slate-600 bg-slate-500",stone:"border-stone-600 bg-stone-500",red:"border-red-600 bg-red-500",rose:"border-rose-600 bg-rose-500",orange:"border-orange-600 bg-orange-500",amber:"border-amber-600 bg-amber-500",yellow:"border-yellow-600 bg-yellow-500",lime:"border-lime-600 bg-lime-500",green:"border-green-600 bg-green-500",emerald:"border-emerald-600 bg-emerald-500",teal:"border-teal-600 bg-teal-500",cyan:"border-cyan-600 bg-cyan-500",sky:"border-sky-600 bg-sky-500",blue:"border-blue-600 bg-blue-500",indigo:"border-indigo-600 bg-indigo-500",violet:"border-violet-600 bg-violet-500",purple:"border-purple-600 bg-purple-500",fuchsia:"border-fuchsia-600 bg-fuchsia-500",pink:"border-pink-600 bg-pink-500",lavender:"border-lavender-600 bg-lavender-500",maroon:"border-maroon-600 bg-maroon-500",brown:"border-brown-600 bg-brown-500",olive:"border-olive-600 bg-olive-500",navy:"border-navy-600 bg-navy-500"},eK={gray:"hover:bg-slate-500 data-[state=on]:bg-slate-500",stone:"hover:bg-stone-500 data-[state=on]:bg-stone-500",red:"hover:bg-red-500 data-[state=on]:bg-red-500",rose:"hover:bg-rose-500 data-[state=on]:bg-rose-500",orange:"hover:bg-orange-500 data-[state=on]:bg-orange-500",amber:"hover:bg-amber-500 data-[state=on]:bg-amber-500",yellow:"hover:bg-yellow-500 data-[state=on]:bg-yellow-500",lime:"hover:bg-lime-500 data-[state=on]:bg-lime-500",green:"hover:bg-green-500 data-[state=on]:bg-green-500",emerald:"hover:bg-emerald-500 data-[state=on]:bg-emerald-500",teal:"hover:bg-teal-500 data-[state=on]:bg-teal-500",cyan:"hover:bg-cyan-500 data-[state=on]:bg-cyan-500",sky:"hover:bg-sky-500 data-[state=on]:bg-sky-500",blue:"hover:bg-blue-500 data-[state=on]:bg-blue-500",indigo:"hover:bg-indigo-500 data-[state=on]:bg-indigo-500",violet:"hover:bg-violet-500 data-[state=on]:bg-violet-500",purple:"hover:bg-purple-500 data-[state=on]:bg-purple-500",fuchsia:"hover:bg-fuchsia-500 data-[state=on]:bg-fuchsia-500",pink:"hover:bg-pink-500 data-[state=on]:bg-pink-500",lavender:"hover:bg-lavender-500 data-[state=on]:bg-lavender-500",maroon:"hover:bg-maroon-500 data-[state=on]:bg-maroon-500",brown:"hover:bg-brown-500 data-[state=on]:bg-brown-500",olive:"hover:bg-olive-500 data-[state=on]:bg-olive-500",navy:"hover:bg-navy-500 data-[state=on]:bg-navy-500"};function ez({moves:e,onReload:a,onError:s,onNotice:n}){let i=(0,M.useTranslations)("worktrees"),[l,o]=(0,r.useState)(null),d=async e=>{o(e.id);try{await (0,eb.controlPlaneRequest)(`mutation RetryWorktreeMove($id: ID!) {
85
+ }`,{input:{worktreeId:e.id,operation:"CANCEL_REBASE",requestId:(0,p.createClientId)()}});await (0,P.waitForWorktreeJob)(t.runWorktreeOperation.id),await a(),s(null)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,t.jsxs)(W.Item,{className:"border-destructive/40 bg-[color-mix(in_oklab,var(--destructive)_8%,var(--card))]",size:"sm",variant:"outline",children:[(0,t.jsx)(W.ItemMedia,{variant:"icon",children:(0,t.jsx)(A.GitMerge,{className:"text-destructive"})}),(0,t.jsxs)(W.ItemContent,{children:[(0,t.jsx)(W.ItemTitle,{children:l("rebasePaused")}),(0,t.jsx)(W.ItemDescription,{children:l(e.hasConflicts?"rebaseConflicts":"rebaseIncomplete")})]}),(0,t.jsx)(W.ItemActions,{children:(0,t.jsxs)(B.Button,{disabled:o,onClick:()=>void u(),size:"sm",variant:"outline",children:[o?(0,t.jsx)(h.Spinner,{}):(0,t.jsx)(D.X,{}),l("cancelRebase")]})}),e.hasConflicts&&c.length?(0,t.jsx)(W.ItemFooter,{className:"-mx-3 -mb-2.5 basis-[calc(100%+(var(--spacing)*6))] rounded-b-lg border-t border-destructive/30 bg-[color-mix(in_oklab,var(--destructive)_16%,var(--card))] px-3 py-2.5",children:(0,t.jsx)(R.WorkflowQuickActions,{sessionData:{worktree:{id:e.id,path:e.folder,branch:e.branch,baseBranch:e.baseBranch,headSha:e.headSha,rebaseInProgress:!0,hasConflicts:!0},codebase:{id:r.codebase.id,folder:r.codebase.folder},repo:{id:r.repository.id,name:r.repository.name,url:r.repository.displayOrigin,displayOrigin:r.repository.displayOrigin}},worktreeId:e.id,workflows:c})}):null]})}],941179)},267572,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(763267),s=e.i(944887),n=e.i(876561),i=e.i(635416),l=e.i(768877),o=e.i(96892),d=e.i(689664),c=e.i(716327),u=e.i(867927),h=e.i(55677),g=e.i(452330),m=e.i(762368),p=e.i(482022),x=e.i(835079),b=e.i(269846),j=e.i(187516),f=e.i(113030),v=e.i(634398),k=e.i(851817),w=e.i(882505),S=e.i(84570),y=e.i(648119),C=e.i(939050),I=e.i(506184),T=e.i(515281),N=e.i(77071),E=e.i(741120),A=e.i(395925),D=e.i(856522),R=e.i(566595),B=e.i(868401),W=e.i(604139),P=e.i(759659),L=e.i(725981),M=e.i(861745),$=e.i(948148),O=e.i(90969),q=e.i(771777),_=e.i(866026),U=e.i(448295),F=e.i(966264),H=e.i(501416),V=e.i(653269),G=e.i(647776),K=e.i(227286),z=e.i(948812),J=e.i(356505),Q=e.i(486122),Y=e.i(929592),X=e.i(487486),Z=e.i(519455),ee=e.i(515288),et=e.i(257428),er=e.i(776639),ea=e.i(755146),es=e.i(82612),en=e.i(793479),ei=e.i(906197),el=e.i(110204),eo=e.i(337822),ed=e.i(983913),ec=e.i(987968),eu=e.i(967489),eh=e.i(784774),eg=e.i(808562),em=e.i(624687),ep=e.i(462777),ex=e.i(360583),eb=e.i(171502),ej=e.i(637611),ef=e.i(975157),ev=e.i(520133),ek=e.i(284494),ew=e.i(539531),eS=e.i(942230),ey=e.i(455329),eC=e.i(756283),eI=e.i(440289),eT=e.i(941179),eN=e.i(940276);let eE=["gray","stone","red","rose","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","lavender","maroon","brown","olive","navy"],eA="worktrees-layout",eD="worktrees-group-by",eR="worktrees-filters",eB="__all__",eW="dirty",eP="clean",eL="non-default";function eM(e){return e?`${eR}:${e}`:eR}function e$(e){return e.hasStagedChanges||e.hasUnstagedChanges}function eO(e,t){let r=t.key.trim().toUpperCase();return{...e,agents:e.agents.map(e=>({...e,codebases:e.codebases.map(e=>({...e,worktrees:e.worktrees.map(e=>e.ticketKey?.trim().toUpperCase()===r?{...e,ticketTitle:t.summary,ticketStatus:t.status}:e)}))}))}}function eq(e,t){return e.some(e=>("string"==typeof e||"number"==typeof e)&&String(e).toLocaleLowerCase().includes(t))}function e_(e,t){let r=t.query.trim().toLocaleLowerCase();return r||t.agentId||t.repositoryId||null!==t.dirty||t.nonDefaultBranch?e.flatMap(e=>{if(t.agentId&&e.agent.id!==t.agentId)return[];let a=r.length>0&&eq([e.agent.id,e.agent.name,e.agent.hostname],r),s=e.codebases.flatMap(e=>{if(t.repositoryId&&e.repository.id!==t.repositoryId)return[];let s=r.length>0&&eq([e.repository.id,e.repository.name,e.repository.description,e.repository.canonicalOrigin,e.repository.displayOrigin,e.codebase.id,e.codebase.folder,e.codebase.observedOrigin,e.codebase.branch,e.codebase.defaultBranch],r),n=!r||a||s?e.worktrees:e.worktrees.filter(e=>eq([e.id,e.branch,e.folder,e.relativePath,e.ticketKey,e.ticketTitle,e.ticketStatus,e.pullRequest?.number,e.pullRequest?.title,e.pullRequest?.repositoryNameWithOwner,e.pullRequest?.jiraKey,...e.tags.map(e=>e.name)],r)),i=null===t.dirty?n:n.filter(e=>e$(e)===t.dirty),l=t.nonDefaultBranch?e.codebase.defaultBranch?i.filter(t=>t.branch!==e.codebase.defaultBranch):[]:i;return l.length?[{...e,worktrees:l}]:[]});return s.length?[{...e,codebases:s}]:[]}):e}function eU(e){let t=new Map;return e.forEach(e=>e.codebases.forEach(r=>{let a=t.get(r.repository.id);a?a.entries.push({agentGroup:e,group:r}):t.set(r.repository.id,{repository:r.repository,entries:[{agentGroup:e,group:r}]})})),[...t.values()].sort((e,t)=>e.repository.name.localeCompare(t.repository.name))}function eF(e,t){if(!t)return e;let r=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),a=r?"\\":"/",s=e=>r?e.replaceAll("/","\\"):e,n=e=>(r?/^[A-Za-z]:\\$/.test(e):"/"===e)?e:e.replace(/[\\/]+$/,""),i=n(s(t)),l=n(s(e)),o=r?i.toLocaleLowerCase():i,d=r?l.toLocaleLowerCase():l;if(d===o)return".";let c=i.endsWith(a)?i:`${i}${a}`,u=r?c.toLocaleLowerCase():c;return d.startsWith(u)?l.slice(c.length):e}function eH(e){return{hasChanges:e$(e),stageOperation:e.hasStagedChanges&&!e.hasUnstagedChanges?"UNSTAGE_ALL":"STAGE_ALL"}}function eV(e,t,r,a){return e.agents.some(e=>e.codebases.some(e=>e.codebase.id===t&&e.worktrees.some(e=>e.id!==a&&e.branch===r)))}let eG={gray:"border-slate-500/40 bg-slate-500/15 text-slate-700 dark:text-slate-300",stone:"border-stone-500/40 bg-stone-500/15 text-stone-700 dark:text-stone-300",red:"border-red-500/40 bg-red-500/15 text-red-700 dark:text-red-300",rose:"border-rose-500/40 bg-rose-500/15 text-rose-700 dark:text-rose-300",orange:"border-orange-500/40 bg-orange-500/15 text-orange-700 dark:text-orange-300",amber:"border-amber-500/40 bg-amber-500/15 text-amber-800 dark:text-amber-300",yellow:"border-yellow-500/40 bg-yellow-500/15 text-yellow-800 dark:text-yellow-300",lime:"border-lime-500/40 bg-lime-500/15 text-lime-800 dark:text-lime-300",green:"border-green-500/40 bg-green-500/15 text-green-700 dark:text-green-300",emerald:"border-emerald-500/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300",teal:"border-teal-500/40 bg-teal-500/15 text-teal-700 dark:text-teal-300",cyan:"border-cyan-500/40 bg-cyan-500/15 text-cyan-700 dark:text-cyan-300",sky:"border-sky-500/40 bg-sky-500/15 text-sky-700 dark:text-sky-300",blue:"border-blue-500/40 bg-blue-500/15 text-blue-700 dark:text-blue-300",indigo:"border-indigo-500/40 bg-indigo-500/15 text-indigo-700 dark:text-indigo-300",violet:"border-violet-500/40 bg-violet-500/15 text-violet-700 dark:text-violet-300",purple:"border-purple-500/40 bg-purple-500/15 text-purple-700 dark:text-purple-300",fuchsia:"border-fuchsia-500/40 bg-fuchsia-500/15 text-fuchsia-700 dark:text-fuchsia-300",pink:"border-pink-500/40 bg-pink-500/15 text-pink-700 dark:text-pink-300",lavender:"border-lavender-500/40 bg-lavender-500/15 text-lavender-700 dark:text-lavender-300",maroon:"border-maroon-500/40 bg-maroon-500/15 text-maroon-700 dark:text-maroon-300",brown:"border-brown-500/40 bg-brown-500/15 text-brown-700 dark:text-brown-300",olive:"border-olive-500/40 bg-olive-500/15 text-olive-700 dark:text-olive-300",navy:"border-navy-500/40 bg-navy-500/15 text-navy-700 dark:text-navy-300"},eK={gray:"border-slate-600 bg-slate-500",stone:"border-stone-600 bg-stone-500",red:"border-red-600 bg-red-500",rose:"border-rose-600 bg-rose-500",orange:"border-orange-600 bg-orange-500",amber:"border-amber-600 bg-amber-500",yellow:"border-yellow-600 bg-yellow-500",lime:"border-lime-600 bg-lime-500",green:"border-green-600 bg-green-500",emerald:"border-emerald-600 bg-emerald-500",teal:"border-teal-600 bg-teal-500",cyan:"border-cyan-600 bg-cyan-500",sky:"border-sky-600 bg-sky-500",blue:"border-blue-600 bg-blue-500",indigo:"border-indigo-600 bg-indigo-500",violet:"border-violet-600 bg-violet-500",purple:"border-purple-600 bg-purple-500",fuchsia:"border-fuchsia-600 bg-fuchsia-500",pink:"border-pink-600 bg-pink-500",lavender:"border-lavender-600 bg-lavender-500",maroon:"border-maroon-600 bg-maroon-500",brown:"border-brown-600 bg-brown-500",olive:"border-olive-600 bg-olive-500",navy:"border-navy-600 bg-navy-500"},ez={gray:"hover:bg-slate-500 data-[state=on]:bg-slate-500",stone:"hover:bg-stone-500 data-[state=on]:bg-stone-500",red:"hover:bg-red-500 data-[state=on]:bg-red-500",rose:"hover:bg-rose-500 data-[state=on]:bg-rose-500",orange:"hover:bg-orange-500 data-[state=on]:bg-orange-500",amber:"hover:bg-amber-500 data-[state=on]:bg-amber-500",yellow:"hover:bg-yellow-500 data-[state=on]:bg-yellow-500",lime:"hover:bg-lime-500 data-[state=on]:bg-lime-500",green:"hover:bg-green-500 data-[state=on]:bg-green-500",emerald:"hover:bg-emerald-500 data-[state=on]:bg-emerald-500",teal:"hover:bg-teal-500 data-[state=on]:bg-teal-500",cyan:"hover:bg-cyan-500 data-[state=on]:bg-cyan-500",sky:"hover:bg-sky-500 data-[state=on]:bg-sky-500",blue:"hover:bg-blue-500 data-[state=on]:bg-blue-500",indigo:"hover:bg-indigo-500 data-[state=on]:bg-indigo-500",violet:"hover:bg-violet-500 data-[state=on]:bg-violet-500",purple:"hover:bg-purple-500 data-[state=on]:bg-purple-500",fuchsia:"hover:bg-fuchsia-500 data-[state=on]:bg-fuchsia-500",pink:"hover:bg-pink-500 data-[state=on]:bg-pink-500",lavender:"hover:bg-lavender-500 data-[state=on]:bg-lavender-500",maroon:"hover:bg-maroon-500 data-[state=on]:bg-maroon-500",brown:"hover:bg-brown-500 data-[state=on]:bg-brown-500",olive:"hover:bg-olive-500 data-[state=on]:bg-olive-500",navy:"hover:bg-navy-500 data-[state=on]:bg-navy-500"};function eJ({moves:e,onReload:a,onError:s,onNotice:n}){let i=(0,$.useTranslations)("worktrees"),[l,o]=(0,r.useState)(null),d=async e=>{o(e.id);try{await (0,ej.controlPlaneRequest)(`mutation RetryWorktreeMove($id: ID!) {
86
86
  retryWorktreeMoveWithStash(id: $id) { id status }
87
- }`,{id:e.id});let t=await (0,eC.waitForWorktreeMove)(e.id);if("FAILED"===t.status)throw Error(t.error||i("moveFailed"));n("SUCCEEDED_WITH_WARNING"===t.status?t.warning||i("moveCompletedWithWarning"):i("moveCompleted")),s(null),await a()}catch(e){s(e instanceof Error?e.message:String(e))}finally{o(null)}},c=async e=>{o(e.id);try{await (0,eb.controlPlaneRequest)(`mutation CancelWorktreeMove($id: ID!) {
87
+ }`,{id:e.id});let t=await (0,eI.waitForWorktreeMove)(e.id);if("FAILED"===t.status)throw Error(t.error||i("moveFailed"));n("SUCCEEDED_WITH_WARNING"===t.status?t.warning||i("moveCompletedWithWarning"):i("moveCompleted")),s(null),await a()}catch(e){s(e instanceof Error?e.message:String(e))}finally{o(null)}},c=async e=>{o(e.id);try{await (0,ej.controlPlaneRequest)(`mutation CancelWorktreeMove($id: ID!) {
88
88
  cancelWorktreeMove(id: $id) { id status }
89
- }`,{id:e.id}),n(i("moveCancelled")),s(null),await a()}catch(e){s(e instanceof Error?e.message:String(e))}finally{o(null)}};return(0,t.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,t.jsx)(Q.Alert,{children:(0,t.jsxs)(Q.AlertDescription,{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:i("moveProgress",{branch:e.branch})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"AWAITING_STASH"===e.status?e.error||i("moveNeedsStash"):i(`moveStatus.${e.status}`)})]}),"AWAITING_STASH"===e.status?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(X.Button,{disabled:l===e.id,onClick:()=>void c(e),size:"sm",variant:"outline",children:i("cancelMove")}),(0,t.jsxs)(X.Button,{disabled:l===e.id,onClick:()=>void d(e),size:"sm",children:[l===e.id&&(0,t.jsx)(ed.Spinner,{}),i("stashAndContinue")]})]}):(0,t.jsx)(ed.Spinner,{})]})},e.id))})}function eJ(e,t){return{codebaseId:e.codebase.id,...t?{worktreeId:t.id}:{},defaultBranch:e.codebase.defaultBranch,currentBranch:t?.branch,currentBaseBranch:t?.baseBranch,localBranches:e.codebase.localBranches,remoteBranches:e.codebase.remoteBranches,unavailableBranches:e.worktrees.flatMap(e=>e.branch&&e.id!==t?.id?[e.branch]:[])}}function eQ({overview:e,onCreated:a}){let s=(0,M.useTranslations)("worktrees"),n=e.agents.flatMap(e=>e.codebases.flatMap(t=>"ONLINE"===e.agent.connectionStatus&&e.agent.capabilities.includes("worktree.branch")&&"AVAILABLE"===t.codebase.availability&&!t.blockingJob?[{agentGroup:e,group:t}]:[])),[i,l]=(0,r.useState)(1===n.length?n[0].group.codebase.id:""),[o,d]=(0,r.useState)(!1),c=n.some(e=>e.group.codebase.id===i)?i:1===n.length?n[0].group.codebase.id:"",u=n.find(e=>e.group.codebase.id===c),h=n.map(({agentGroup:e,group:t})=>({value:t.codebase.id,label:`${t.repository.name} \xb7 ${e.agent.name}`,description:t.codebase.folder,keywords:`${t.repository.displayOrigin} ${e.agent.hostname}`})),m=async e=>{if(!u)throw Error(s("selectCodebase"));d(!0);try{let t=await (0,eb.controlPlaneRequest)(`mutation CreateWorktree($input: CreateWorktreeInput!) {
89
+ }`,{id:e.id}),n(i("moveCancelled")),s(null),await a()}catch(e){s(e instanceof Error?e.message:String(e))}finally{o(null)}};return(0,t.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,t.jsx)(Y.Alert,{children:(0,t.jsxs)(Y.AlertDescription,{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:i("moveProgress",{branch:e.branch})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"AWAITING_STASH"===e.status?e.error||i("moveNeedsStash"):i(`moveStatus.${e.status}`)})]}),"AWAITING_STASH"===e.status?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(Z.Button,{disabled:l===e.id,onClick:()=>void c(e),size:"sm",variant:"outline",children:i("cancelMove")}),(0,t.jsxs)(Z.Button,{disabled:l===e.id,onClick:()=>void d(e),size:"sm",children:[l===e.id&&(0,t.jsx)(ec.Spinner,{}),i("stashAndContinue")]})]}):(0,t.jsx)(ec.Spinner,{})]})},e.id))})}function eQ(e,t){return{codebaseId:e.codebase.id,...t?{worktreeId:t.id}:{},defaultBranch:e.codebase.defaultBranch,currentBranch:t?.branch,currentBaseBranch:t?.baseBranch,localBranches:e.codebase.localBranches,remoteBranches:e.codebase.remoteBranches,unavailableBranches:e.worktrees.flatMap(e=>e.branch&&e.id!==t?.id?[e.branch]:[])}}function eY({overview:e,onCreated:a}){let s=(0,$.useTranslations)("worktrees"),n=e.agents.flatMap(e=>e.codebases.flatMap(t=>"ONLINE"===e.agent.connectionStatus&&e.agent.capabilities.includes("worktree.branch")&&"AVAILABLE"===t.codebase.availability&&!t.blockingJob?[{agentGroup:e,group:t}]:[])),[i,l]=(0,r.useState)(1===n.length?n[0].group.codebase.id:""),[o,d]=(0,r.useState)(!1),c=n.some(e=>e.group.codebase.id===i)?i:1===n.length?n[0].group.codebase.id:"",u=n.find(e=>e.group.codebase.id===c),h=n.map(({agentGroup:e,group:t})=>({value:t.codebase.id,label:`${t.repository.name} \xb7 ${e.agent.name}`,description:t.codebase.folder,keywords:`${t.repository.displayOrigin} ${e.agent.hostname}`})),g=async e=>{if(!u)throw Error(s("selectCodebase"));d(!0);try{let t=await (0,ej.controlPlaneRequest)(`mutation CreateWorktree($input: CreateWorktreeInput!) {
90
90
  createWorktree(input: $input) { id }
91
- }`,{input:{codebaseId:u.group.codebase.id,selection:e,requestId:(0,eg.createClientId)()}});await (0,eC.waitForWorktreeJob)(t.createWorktree.id),await a()}finally{d(!1)}};return(0,t.jsxs)(Z.Card,{children:[(0,t.jsx)(Z.CardHeader,{children:(0,t.jsx)(Z.CardTitle,{children:s("createWorktree")})}),(0,t.jsxs)(Z.CardContent,{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ei.Label,{className:"mb-1.5 block",children:s("repositoryCheckout")}),(0,t.jsx)(eo.SearchableSelect,{ariaLabel:s("repositoryCheckout"),disabled:o||0===h.length,emptyMessage:s("noEligibleCodebases"),onValueChange:l,options:h,placeholder:s("selectCodebase"),searchPlaceholder:s("searchCodebases"),value:c})]}),u?(0,t.jsx)(ev.WorktreeBranchForm,{busy:o,onSubmit:m,submitLabel:s("createWorktree"),target:eJ(u.group)},u.group.codebase.id):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h.length?s("selectCodebaseHelp"):s("noEligibleCodebases")})]})]})}function eY({agent:e}){let r=(0,M.useTranslations)("worktrees"),a="ONLINE"===e.connectionStatus;return(0,t.jsx)(Y.Badge,{variant:a?"success":"secondary",children:r(a?"online":"offline")})}function eX({agentGroup:e,group:a,layout:s,...n}){let i={...n,agentName:e.agent.name,baseRepoDirectory:e.agent.baseRepoDirectory,branchManagementEnabled:"ONLINE"===e.agent.connectionStatus&&e.agent.capabilities.includes("worktree.branch"),group:a,liveUpdatesEnabled:"ONLINE"===e.agent.connectionStatus&&e.agent.capabilities.includes("worktree.watch")};return"cards"!==s?(0,t.jsx)(tg,{...i}):(0,t.jsx)("div",{className:"space-y-3",children:a.worktrees.map(e=>(0,r.createElement)(e5,{...i,key:e.id,worktree:e}))})}function eZ({agentGroup:e,...r}){return(0,t.jsxs)("section",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:e.agent.name}),(0,t.jsx)(eY,{agent:e.agent})]}),e.codebases.map(a=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-medium",children:a.repository.name}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:a.repository.displayOrigin})]}),(0,t.jsx)(e1,{codebase:a.codebase})]}),(0,t.jsx)(eX,{...r,agentGroup:e,group:a})]},a.codebase.id))]})}function e0({repositoryGroup:e,...r}){return(0,t.jsxs)("section",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b pb-2",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:e.repository.name}),(0,t.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:e.repository.displayOrigin})]}),e.entries.map(({agentGroup:e,group:a})=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("h3",{className:"font-medium",children:e.agent.name}),(0,t.jsx)(eY,{agent:e.agent})]}),(0,t.jsx)(e1,{codebase:a.codebase})]}),(0,t.jsx)(eX,{...r,agentGroup:e,group:a})]},a.codebase.id))]})}function e1({codebase:e}){let a=(0,M.useTranslations)("worktrees"),s=(0,L.useLocale)(),[n,i]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=()=>i(new Date().getTime()),t=window.setTimeout(e,0),r=window.setInterval(e,1e3);return()=>{window.clearTimeout(t),window.clearInterval(r)}},[]);let l=e.lastFetchedAt&&null!==n?Math.max(0,n-new Date(e.lastFetchedAt).getTime()):null,o=null===l?a("neverFetched"):l<6e4?a("secondsAgo",{count:Math.floor(l/1e3)}):(0,ep.formatDateValue)(e.lastFetchedAt,"relative",{locale:s,now:n??void 0});return(0,t.jsx)("span",{className:(0,ej.cn)("text-xs text-muted-foreground",e.lastFetchError&&"text-destructive"),title:e.lastFetchError??void 0,children:a("lastFetched",{value:o})})}function e5(e){let{inspectionRefreshToken:a,onError:s}=e,{worktree:n,applyActivity:i,setUnstagedChanges:l}=(0,ey.useLiveWorktree)(e.worktree),o={...e,worktree:n},[u,h]=(0,r.useState)(!1),[m,g]=(0,r.useState)(null),[p,x]=(0,r.useState)(!1),b=(0,r.useRef)(0),j=(0,r.useRef)(a),f=(0,M.useTranslations)("worktrees"),v=(0,ef.useRouter)(),k=(0,r.useCallback)(async()=>{let e=++b.current;x(!0);try{let t=await (0,ey.inspectWorktree)(n.id);if(e!==b.current)return;g(t),l(t.changes.some(e=>e.unstaged||e.untracked||e.conflicted)),s(null)}catch(t){e===b.current&&s(t instanceof Error?t.message:String(t))}finally{e===b.current&&x(!1)}},[s,l,n.id]),w=(0,ey.useQueuedWorktreeInspection)(k),S=(0,r.useCallback)(e=>{i(e),u&&w()},[i,u,w]);(0,ey.useWorktreeActivitySubscription)(n.id,e.liveUpdatesEnabled&&"AVAILABLE"===n.availability,S),(0,r.useEffect)(()=>{if(j.current===a||(j.current=a,!u))return;let e=window.setTimeout(()=>void w(),0);return()=>window.clearTimeout(e)},[u,a,w]);let y=()=>{let e=!u;h(e),e&&!m&&w()};return(0,t.jsxs)(Z.Card,{className:(0,ej.cn)("cursor-pointer transition-colors hover:bg-muted/30",n.highlightColor&&ex.worktreeHighlightSurfaceClasses[n.highlightColor]),onClick:e=>{(0,eT.shouldNavigateWorktreeSurface)(e)&&v.push((0,eT.worktreeDetailHref)(n.id))},children:[(0,t.jsxs)(Z.CardHeader,{className:"grid-cols-1! @md/card-header:grid-cols-[minmax(0,1fr)_auto]!",children:[(0,t.jsxs)(Z.CardTitle,{className:"min-w-0",children:[(0,t.jsxs)(X.Button,{"aria-expanded":u,className:"h-auto w-full max-w-full justify-start gap-1 p-1 text-left",onClick:()=>void y(),variant:"ghost",children:[u?(0,t.jsx)(d.ChevronDown,{}):(0,t.jsx)(c.ChevronRight,{}),(0,t.jsx)("span",{className:"truncate font-mono",children:n.branch??n.headSha?.slice(0,10)??f("detached")})]}),(n.ticketKey||n.ticketTitle)&&(0,t.jsx)(e4,{...o})]}),(0,t.jsxs)(Z.CardAction,{className:"col-start-1 row-span-1 row-start-auto flex max-w-full flex-wrap items-center justify-start gap-1 justify-self-start @md/card-header:col-start-2 @md/card-header:row-span-2 @md/card-header:row-start-1 @md/card-header:justify-end @md/card-header:justify-self-end",children:[(0,t.jsx)(tr,{worktree:n}),eM(n)&&(0,t.jsx)(Y.Badge,{variant:"destructive",children:f("dirty")}),(0,t.jsx)(tn,{...o})]})]}),(0,t.jsxs)(Z.CardContent,{className:"space-y-4",children:[(0,t.jsx)(e7,{...o,detailsExpanded:u,onToggleDetails:y}),(0,t.jsx)(eI.WorktreeRebaseConflictItem,{group:e.group,onCompleted:e.onReload,onError:e.onError,worktree:n}),p&&(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(ed.Spinner,{})," ",f("loadingDetails")]}),u&&m&&(0,t.jsx)(ew.WorktreeDetailPanel,{detail:m,inline:!0,worktreeId:n.id})]}),(0,t.jsxs)(Z.CardFooter,{className:"flex-col items-stretch gap-2","data-worktree-navigation-ignore":!0,children:[(0,t.jsx)(tc,{...o,onCompleted:async()=>{await e.onReload(),u&&await w()}}),(0,t.jsx)(ek.QuickActionsRow,{first:(0,t.jsx)(F.WorkflowQuickActions,{className:"w-auto",sessionData:{worktree:{id:n.id,path:n.folder,branch:n.branch,baseBranch:n.baseBranch,headSha:n.headSha},codebase:{id:e.group.codebase.id,folder:e.group.codebase.folder},repo:{id:e.group.repository.id,name:e.group.repository.name,url:e.group.repository.displayOrigin,displayOrigin:e.group.repository.displayOrigin}},worktreeId:n.id,workflows:e.group.quickActions??[]}),second:(0,t.jsx)(H.CommandQuickActions,{agentCapabilities:e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id))?.agent.capabilities??[],className:"w-auto",worktreeId:n.id})})]})]})}function e2({worktree:e}){let r=(0,M.useTranslations)("worktrees"),a=e.branch??e.headSha?.slice(0,10)??r("detached"),s=r("openWorktreeDetails",{branch:a});return(0,t.jsx)(X.Button,{asChild:!0,size:"icon-sm",variant:"ghost",children:(0,t.jsx)(ef.Link,{"aria-label":s,href:(0,eT.worktreeDetailHref)(e.id),title:s,children:(0,t.jsx)(i.ArrowRight,{})})})}function e4({worktree:e,onOpenTicket:r,compact:a=!1}){let s=`${e.ticketKey??""}${e.ticketTitle?`${e.ticketKey?" — ":""}${e.ticketTitle}`:""}`;return(0,t.jsxs)("div",{className:(0,ej.cn)("flex max-w-full flex-wrap items-center gap-1.5 font-normal",a?"mt-0.5 text-xs":"mt-1 text-sm"),children:[e.ticketKey?(0,t.jsx)(X.Button,{className:"h-auto min-w-0 justify-start truncate p-0 text-left font-normal",onClick:()=>r(e.ticketKey),title:s,type:"button",variant:"link",children:s}):(0,t.jsx)("p",{className:"min-w-0 truncate text-muted-foreground",title:s,children:s}),e.ticketStatus&&(e.ticketKey?(0,t.jsx)(Y.Badge,{asChild:!0,variant:"secondary",children:(0,t.jsx)("button",{onClick:()=>r(e.ticketKey),type:"button",children:e.ticketStatus})}):(0,t.jsx)(Y.Badge,{variant:"secondary",children:e.ticketStatus}))]})}function e7(e){let{worktree:r,group:a,agentName:s,baseRepoDirectory:n,detailsExpanded:i,onToggleDetails:l}=e,o=(0,M.useTranslations)("worktrees");return(0,t.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,t.jsx)(tb,{label:o("path"),mono:!0,value:eU(r.folder,n)}),(0,t.jsx)(ta,{...e})]}),(0,t.jsxs)(e3,{label:o("upToDate"),children:[(0,t.jsx)(e9,{worktree:r}),(0,t.jsx)("span",{className:"pl-6 text-xs text-muted-foreground",children:o("agent")}),(0,t.jsx)(Y.Badge,{variant:"outline",children:s})]}),(0,t.jsx)(e8,{...e}),(0,t.jsx)(e3,{label:o("pullRequest"),children:(0,t.jsx)(te,{detailsExpanded:i,onToggleDetails:l,worktree:r})}),r.latestBuild&&(0,t.jsx)(e6,{build:r.latestBuild,onCompleted:e.onReload,onError:e.onError}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[r.statusError&&(0,t.jsx)("span",{className:"text-xs text-destructive",children:r.statusError}),!a.codebase.defaultBranch&&!r.baseBranchOverride&&(0,t.jsx)("span",{className:"text-xs text-destructive",children:o("baseUnavailable")})]})]})}function e6({build:e,onCompleted:r,onError:a}){let s=(0,M.useTranslations)("worktrees"),n=(0,M.useTranslations)("builds"),i="SUCCEEDED"===e.status&&e.artifacts.some(e=>"RUNNABLE_APP"===e.kind),{rebuild:l,rebuilding:o}=(0,O.useRebuildBuild)({buildId:e.id,onCompleted:()=>r(),onError:a});return(0,t.jsxs)(e3,{label:s("latestBuild"),children:[(0,t.jsxs)(er.DropdownMenu,{children:[(0,t.jsx)(er.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(Y.Badge,{asChild:!0,variant:"outline",children:(0,t.jsxs)("button",{type:"button",children:[n(`actions.${e.action}`),(0,t.jsx)(d.ChevronDown,{})]})})}),(0,t.jsxs)(er.DropdownMenuContent,{align:"start",className:"w-36",children:[(0,t.jsx)(er.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ef.Link,{href:`/builds/${e.id}`,children:[(0,t.jsx)(g.ExternalLink,{}),n("viewBuild")]})}),(0,t.jsxs)(er.DropdownMenuItem,{disabled:o,onSelect:()=>void l(),children:[o?(0,t.jsx)(ed.Spinner,{}):(0,t.jsx)(E.RotateCcw,{}),n("rebuild")]})]})]}),"SUCCEEDED"===e.status?(0,t.jsx)(Y.Badge,{asChild:!0,variant:(0,$.buildStatusVariant)(e.status),children:(0,t.jsx)(ef.Link,{href:`/builds/${e.id}`,children:n(`statuses.${e.status}`)})}):(0,t.jsx)(Y.Badge,{variant:(0,$.buildStatusVariant)(e.status),children:n(`statuses.${e.status}`)}),e.outOfDate&&(0,t.jsx)(Y.Badge,{className:"border-amber-500/40 text-amber-700 dark:text-amber-300",variant:"outline",children:n("outOfDate")}),i&&(0,t.jsx)(q.RunBuildControls,{buildId:e.id,destinationType:e.destinationType,onCompleted:r,onError:a,preferredDestination:e.destination,size:"sm"})]})}function e3({label:e,children:r}){return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("p",{className:"w-24 shrink-0 text-xs text-muted-foreground",children:e}),(0,t.jsx)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:r})]})}function e8({compact:e=!1,...r}){let{worktree:a}=r,s=(0,M.useTranslations)("worktrees");return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[!e&&(0,t.jsx)("span",{className:"w-24 shrink-0 text-xs text-muted-foreground",children:s("tags")}),(0,t.jsx)(tn,{...r,contentAlign:e?"end":"start",contentAlignOffset:e?0:-100,trigger:(0,t.jsx)(X.Button,{"aria-label":`${s("tags")}: ${a.branch??s("detached")}`,className:(0,ej.cn)("h-auto min-h-7 max-w-full justify-start px-1 py-1 text-left font-normal",!e&&"-mx-1"),type:"button",variant:"ghost",children:(0,t.jsxs)("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[a.tags.map(e=>(0,t.jsx)(tx,{tag:e},e.id)),!a.tags.length&&(0,t.jsx)("span",{className:"text-muted-foreground",children:"—"})]})})})]})}function e9({worktree:e}){let r=(0,M.useTranslations)("worktrees"),a=0===e.baseBehind;return(0,t.jsx)(Y.Badge,{className:a?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":null===e.baseBehind?void 0:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",variant:"outline",children:null===e.baseBehind?r("unknown"):a?r("yes"):r("notUpToDate",{count:e.baseBehind})})}function te({worktree:e,detailsExpanded:r,onToggleDetails:a}){var s;let n=(0,M.useTranslations)("worktrees"),i=(0,M.useTranslations)("gitlabPages"),l=e.baseAhead??0,o=e.sourceControlRequest?.provider==="GITLAB"?e.sourceControlRequest:null;return(0,t.jsxs)(t.Fragment,{children:[e.pullRequest?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tt,{pullRequest:e.pullRequest}),(0,t.jsx)(V.PipelineMenu,{pipelineStatus:e.pullRequest.pipelineStatus,pipelines:e.pullRequest.pipelines,pipelineRevision:e.pullRequest.pipelineRevision,headSha:e.pullRequest.headRefOid,repositoryId:e.pullRequest.repositoryGithubId,repositoryNameWithOwner:e.pullRequest.repositoryNameWithOwner,repositoryUrl:e.pullRequest.repositoryUrl,requestSource:"WORKTREES"}),(0,t.jsx)(Y.Badge,{className:"APPROVED"===(s=e.pullRequest.reviewDecision)?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"CHANGES_REQUESTED"===s?"border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300":"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",children:n(`review.${e.pullRequest.reviewDecision}`)}),(0,t.jsx)(Y.Badge,{asChild:!0,className:0===e.pullRequest.unresolvedReviewThreadCount?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",children:(0,t.jsx)(ef.Link,{href:(0,K.pullRequestCommentsHref)(e.pullRequest),children:n("comments",{count:e.pullRequest.unresolvedReviewThreadCount})})})]}):o?(0,t.jsxs)(er.DropdownMenu,{children:[(0,t.jsx)(er.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(Y.Badge,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",children:["MR !",o.number]})})}),(0,t.jsxs)(er.DropdownMenuContent,{align:"start",className:"w-44",children:[(0,t.jsx)(er.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)("a",{href:o.url,rel:"noreferrer",target:"_blank",children:[(0,t.jsx)(g.ExternalLink,{}),i("openInGitLab")]})}),o.projectId?(0,t.jsx)(er.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ef.Link,{href:`/gitlab/merge-requests/${encodeURIComponent(o.projectId)}/${o.number}`,children:[(0,t.jsx)(j.GitMerge,{}),n("openDetails")]})}):null]})]}):null,(0,t.jsx)(G.GitLabWorktreePipelinesMenu,{pipelines:e.gitLabPipelines??[]}),e.pullRequest||o||(e.gitLabPipelines??[]).length||0!==l?null:(0,t.jsx)("span",{className:"text-muted-foreground",children:"—"}),l>0&&(a?(0,t.jsx)(Y.Badge,{asChild:!0,variant:"secondary",children:(0,t.jsx)("button",{"aria-expanded":r,onClick:a,type:"button",children:n("branchCommits",{count:l})})}):(0,t.jsx)(Y.Badge,{variant:"secondary",children:n("branchCommits",{count:l})}))]})}function tt({pullRequest:e}){let r=(0,M.useTranslations)("worktrees");return(0,t.jsxs)(er.DropdownMenu,{children:[(0,t.jsx)(er.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(Y.Badge,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",children:["PR #",e.number]})})}),(0,t.jsxs)(er.DropdownMenuContent,{align:"start",className:"w-44",children:[(0,t.jsx)(er.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)("a",{href:e.url,rel:"noreferrer",target:"_blank",children:[(0,t.jsx)(g.ExternalLink,{}),r("openInGitHub")]})}),(0,t.jsx)(er.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ef.Link,{href:(0,K.pullRequestDetailHref)(e),children:[(0,t.jsx)(f.GitPullRequest,{}),r("openDetails")]})})]})]})}function tr({worktree:e}){var r,a;let s=(0,M.useTranslations)("worktrees");if("IN_SYNC"===e.syncState||0===e.ahead&&0===e.behind)return(0,t.jsx)(Y.Badge,{className:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",variant:"outline",children:s("inSync")});let i=e.ahead??0,o=e.behind??0;return i>0||o>0?(0,t.jsxs)(t.Fragment,{children:[i>0&&(0,t.jsxs)(Y.Badge,{className:"border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300",variant:"outline",children:[(0,t.jsx)(l.ArrowUp,{"data-icon":"inline-start"}),s("ahead",{count:i})]}),o>0&&(0,t.jsxs)(Y.Badge,{className:"border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300",variant:"outline",children:[(0,t.jsx)(n.ArrowDown,{"data-icon":"inline-start"}),s("behind",{count:o})]})]}):(0,t.jsx)(Y.Badge,{variant:"outline",children:(r=e,a=s,"AHEAD"===r.syncState?a("ahead",{count:r.ahead??0}):"BEHIND"===r.syncState?a("behind",{count:r.behind??0}):a("DIVERGED"===r.syncState?"diverged":"IN_SYNC"===r.syncState?"upToDate":"NO_UPSTREAM"===r.syncState?"unpublished":"DETACHED"===r.syncState?"detached":"unknown"))})}function ta(e){let{worktree:a,group:s,onUpdate:n,onError:i,compact:l=!1}=e,o=(0,M.useTranslations)("worktrees"),[d,c]=(0,r.useState)(!1),[u,h]=(0,r.useState)(!1),m="__inherit_remote_default__",g=Array.from(new Set([a.baseBranchOverride,s.codebase.defaultBranch,...s.codebase.remoteBranches].filter(e=>!!e))),p=async e=>{h(!0);try{let t=await (0,eb.controlPlaneRequest)(`mutation UpdateWorktreeBase($id: ID!, $baseBranch: String) {
92
- updateWorktreeBaseBranch(id: $id, baseBranch: $baseBranch) { ${eS.WORKTREE_FIELDS} }
93
- }`,{id:a.id,baseBranch:e||null});n(t.updateWorktreeBaseBranch),i(null),c(!1)}catch(e){i(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,t.jsxs)("div",{className:"min-w-0",children:[!l&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:o("baseBranch")}),(0,t.jsx)("div",{className:(0,ej.cn)("flex min-h-6 min-w-0 items-center gap-1",!l&&"mt-0.5"),children:d?(0,t.jsxs)(ec.Select,{disabled:u,onOpenChange:c,onValueChange:e=>void p(e===m?"":e),open:d,value:a.baseBranchOverride??(s.codebase.defaultBranch?m:void 0),children:[(0,t.jsx)(ec.SelectTrigger,{"aria-label":o("baseBranch"),className:"h-7 min-w-40 max-w-full font-mono text-xs",size:"sm",children:(0,t.jsx)(ec.SelectValue,{placeholder:o("baseUnavailable")})}),(0,t.jsxs)(ec.SelectContent,{align:"start",children:[s.codebase.defaultBranch&&(0,t.jsxs)(ec.SelectItem,{value:m,children:[s.codebase.defaultBranch," · ",o("inheritBase")]}),g.map(e=>(0,t.jsx)(ec.SelectItem,{value:e,children:e},e))]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"truncate font-mono text-xs",title:a.baseBranch??void 0,children:a.baseBranch??"—"}),(0,t.jsx)(X.Button,{"aria-label":o("editBase"),onClick:()=>c(!0),size:"icon-xs",variant:"ghost",children:(0,t.jsx)(I.Pencil,{})})]})})]})}function ts(e,t){let r=t.activeMoves.some(t=>t.sourceCodebaseId===e.group.codebase.id||t.targetCodebaseId===e.group.codebase.id);return"ONLINE"===e.agentGroup.agent.connectionStatus&&e.agentGroup.agent.capabilities.includes("worktree.move.checkout")&&"AVAILABLE"===e.group.codebase.availability&&!e.group.blockingJob&&!r}function tn(e){let a,s,{worktree:n,allTags:i,editorVariant:l,onUpdate:o,onError:d,onManageTags:c,contentAlign:u="end",contentAlignOffset:m=0,trigger:g}=e,j=(0,M.useTranslations)("worktrees"),[f,v]=(0,r.useState)(!1),[k,w]=(0,r.useState)(!1),[I,E]=(0,r.useState)(!1),[A,D]=(0,r.useState)(!1),[B,P]=(0,r.useState)(!1),[L,$]=(0,r.useState)(!1),[O,q]=(0,r.useState)(null),[_,U]=(0,r.useState)(null),F=(0,r.useRef)(!1),H=(a=e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id)))?e.overview.agents.flatMap(t=>t.agent.id===a.agent.id?[]:t.codebases.flatMap(r=>r.repository.id===e.group.repository.id?[{agentGroup:t,group:r}]:[])):[],V=(s=e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id)))&&"ONLINE"===s.agent.connectionStatus&&s.agent.capabilities.includes("worktree.move.push")?"AVAILABLE"!==e.worktree.availability||e.group.blockingJob||e.worktree.rebaseInProgress||e.overview.activeMoves.some(t=>t.sourceCodebaseId===e.group.codebase.id||t.targetCodebaseId===e.group.codebase.id)?j("moveBlocked.busy"):e.worktree.branch&&e.worktree.headSha?e.worktree.hasStagedChanges||e.worktree.hasUnstagedChanges||"DIRTY"===e.worktree.pushStatus?j("moveBlocked.dirty"):"BEHIND"===e.worktree.pushStatus?j("moveBlocked.behind"):"DIVERGED"===e.worktree.pushStatus?j("moveBlocked.diverged"):"READY"!==e.worktree.pushStatus?j("moveBlocked.unknown"):H.some(t=>ts(t,e.overview))?null:j("moveBlocked.destination"):j("moveBlocked.detached"):j("moveBlocked.agent"),G=e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id)),K=!G||"ONLINE"!==G.agent.connectionStatus||!G.agent.capabilities.includes("worktree.delete")||"AVAILABLE"!==n.availability||!!e.group.blockingJob||n.rebaseInProgress||e.overview.activeMoves.some(t=>t.sourceCodebaseId===e.group.codebase.id||t.targetCodebaseId===e.group.codebase.id),z=new Set(n.tags.map(e=>e.id)),J=async(e,t)=>{let r=t?[...z,e]:[...z].filter(t=>t!==e);try{let e=await (0,eb.controlPlaneRequest)(`mutation SetWorktreeTags($id: ID!, $tagIds: [ID!]!) { setWorktreeTags(id: $id, tagIds: $tagIds) { ${eS.WORKTREE_FIELDS} } }`,{id:n.id,tagIds:r});o(e.setWorktreeTags),d(null)}catch(e){d(e instanceof Error?e.message:String(e))}},Y=async e=>{try{let t=await (0,eb.controlPlaneRequest)(`mutation HighlightWorktree($id: ID!, $color: String) { updateWorktreeHighlight(id: $id, color: $color) { ${eS.WORKTREE_FIELDS} } }`,{id:n.id,color:e});o(t.updateWorktreeHighlight),d(null)}catch(e){d(e instanceof Error?e.message:String(e))}},Z=async()=>{$(!0);try{let e=await (0,eb.controlPlaneRequest)(`mutation RefreshWorktreePullRequest($id: ID!) {
94
- refreshWorktreePullRequest(id: $id) { ${eS.WORKTREE_FIELDS} }
95
- }`,{id:n.id});o(e.refreshWorktreePullRequest),d(null)}catch(e){d(e instanceof Error?e.message:String(e))}finally{$(!1)}},ee=async(t,r=!1)=>{P(!0);try{let a=await (0,eb.controlPlaneRequest)(`mutation ChangeWorktreeBranch($input: ChangeWorktreeBranchInput!) {
91
+ }`,{input:{codebaseId:u.group.codebase.id,selection:e,requestId:(0,ep.createClientId)()}});await (0,eI.waitForWorktreeJob)(t.createWorktree.id),await a()}finally{d(!1)}};return(0,t.jsxs)(ee.Card,{children:[(0,t.jsx)(ee.CardHeader,{children:(0,t.jsx)(ee.CardTitle,{children:s("createWorktree")})}),(0,t.jsxs)(ee.CardContent,{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(el.Label,{className:"mb-1.5 block",children:s("repositoryCheckout")}),(0,t.jsx)(ed.SearchableSelect,{ariaLabel:s("repositoryCheckout"),disabled:o||0===h.length,emptyMessage:s("noEligibleCodebases"),onValueChange:l,options:h,placeholder:s("selectCodebase"),searchPlaceholder:s("searchCodebases"),value:c})]}),u?(0,t.jsx)(ek.WorktreeBranchForm,{busy:o,onSubmit:g,submitLabel:s("createWorktree"),target:eQ(u.group)},u.group.codebase.id):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h.length?s("selectCodebaseHelp"):s("noEligibleCodebases")})]})]})}function eX({agent:e}){let r=(0,$.useTranslations)("worktrees"),a="ONLINE"===e.connectionStatus;return(0,t.jsx)(X.Badge,{variant:a?"success":"secondary",children:r(a?"online":"offline")})}function eZ({agentGroup:e,group:a,layout:s,...n}){let i={...n,agentName:e.agent.name,baseRepoDirectory:e.agent.baseRepoDirectory,branchManagementEnabled:"ONLINE"===e.agent.connectionStatus&&e.agent.capabilities.includes("worktree.branch"),group:a,liveUpdatesEnabled:"ONLINE"===e.agent.connectionStatus&&e.agent.capabilities.includes("worktree.watch")};return"cards"!==s?(0,t.jsx)(tp,{...i}):(0,t.jsx)("div",{className:"space-y-3",children:a.worktrees.map(e=>(0,r.createElement)(e2,{...i,key:e.id,worktree:e}))})}function e0({agentGroup:e,...r}){return(0,t.jsxs)("section",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:e.agent.name}),(0,t.jsx)(eX,{agent:e.agent})]}),e.codebases.map(a=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-medium",children:a.repository.name}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:a.repository.displayOrigin})]}),(0,t.jsx)(e5,{codebase:a.codebase})]}),(0,t.jsx)(eZ,{...r,agentGroup:e,group:a})]},a.codebase.id))]})}function e1({repositoryGroup:e,...r}){return(0,t.jsxs)("section",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b pb-2",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:e.repository.name}),(0,t.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:e.repository.displayOrigin})]}),e.entries.map(({agentGroup:e,group:a})=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("h3",{className:"font-medium",children:e.agent.name}),(0,t.jsx)(eX,{agent:e.agent})]}),(0,t.jsx)(e5,{codebase:a.codebase})]}),(0,t.jsx)(eZ,{...r,agentGroup:e,group:a})]},a.codebase.id))]})}function e5({codebase:e}){let a=(0,$.useTranslations)("worktrees"),s=(0,M.useLocale)(),[n,i]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=()=>i(new Date().getTime()),t=window.setTimeout(e,0),r=window.setInterval(e,1e3);return()=>{window.clearTimeout(t),window.clearInterval(r)}},[]);let l=e.lastFetchedAt&&null!==n?Math.max(0,n-new Date(e.lastFetchedAt).getTime()):null,o=null===l?a("neverFetched"):l<6e4?a("secondsAgo",{count:Math.floor(l/1e3)}):(0,ex.formatDateValue)(e.lastFetchedAt,"relative",{locale:s,now:n??void 0});return(0,t.jsx)("span",{className:(0,ef.cn)("text-xs text-muted-foreground",e.lastFetchError&&"text-destructive"),title:e.lastFetchError??void 0,children:a("lastFetched",{value:o})})}function e2(e){let{inspectionRefreshToken:a,onError:s}=e,{worktree:n,applyActivity:i,setUnstagedChanges:l}=(0,eC.useLiveWorktree)(e.worktree),o={...e,worktree:n},[d,h]=(0,r.useState)(!1),[g,m]=(0,r.useState)(null),[p,x]=(0,r.useState)(!1),b=(0,r.useRef)(0),j=(0,r.useRef)(a),f=(0,$.useTranslations)("worktrees"),v=(0,ev.useRouter)(),k=(0,r.useCallback)(async()=>{let e=++b.current;x(!0);try{let t=await (0,eC.inspectWorktree)(n.id);if(e!==b.current)return;m(t),l(t.changes.some(e=>e.unstaged||e.untracked||e.conflicted)),s(null)}catch(t){e===b.current&&s(t instanceof Error?t.message:String(t))}finally{e===b.current&&x(!1)}},[s,l,n.id]),w=(0,eC.useQueuedWorktreeInspection)(k),S=(0,r.useCallback)(e=>{i(e),d&&w()},[i,d,w]);(0,eC.useWorktreeActivitySubscription)(n.id,e.liveUpdatesEnabled&&"AVAILABLE"===n.availability,S),(0,r.useEffect)(()=>{if(j.current===a||(j.current=a,!d))return;let e=window.setTimeout(()=>void w(),0);return()=>window.clearTimeout(e)},[d,a,w]);let y=()=>{let e=!d;h(e),e&&!g&&w()};return(0,t.jsxs)(ee.Card,{className:(0,ef.cn)("cursor-pointer transition-colors hover:bg-muted/30",n.highlightColor&&eb.worktreeHighlightSurfaceClasses[n.highlightColor]),onClick:e=>{(0,eN.shouldNavigateWorktreeSurface)(e)&&v.push((0,eN.worktreeDetailHref)(n.id))},children:[(0,t.jsxs)(ee.CardHeader,{className:"grid-cols-1! @md/card-header:grid-cols-[minmax(0,1fr)_auto]!",children:[(0,t.jsxs)(ee.CardTitle,{className:"min-w-0",children:[(0,t.jsxs)(Z.Button,{"aria-expanded":d,className:"h-auto w-full max-w-full justify-start gap-1 p-1 text-left",onClick:()=>void y(),variant:"ghost",children:[d?(0,t.jsx)(c.ChevronDown,{}):(0,t.jsx)(u.ChevronRight,{}),(0,t.jsx)("span",{className:"truncate font-mono",children:n.branch??n.headSha?.slice(0,10)??f("detached")})]}),(n.ticketKey||n.ticketTitle)&&(0,t.jsx)(e7,{...o})]}),(0,t.jsxs)(ee.CardAction,{className:"col-start-1 row-span-1 row-start-auto flex max-w-full flex-wrap items-center justify-start gap-1 justify-self-start @md/card-header:col-start-2 @md/card-header:row-span-2 @md/card-header:row-start-1 @md/card-header:justify-end @md/card-header:justify-self-end",children:[(0,t.jsx)(ta,{worktree:n}),e$(n)&&(0,t.jsx)(X.Badge,{variant:"destructive",children:f("dirty")}),(0,t.jsx)(ti,{...o})]})]}),(0,t.jsxs)(ee.CardContent,{className:"space-y-4",children:[(0,t.jsx)(e6,{...o,detailsExpanded:d,onToggleDetails:y}),(0,t.jsx)(eT.WorktreeRebaseConflictItem,{group:e.group,onCompleted:e.onReload,onError:e.onError,worktree:n}),p&&(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(ec.Spinner,{})," ",f("loadingDetails")]}),d&&g&&(0,t.jsx)(eS.WorktreeDetailPanel,{detail:g,inline:!0,worktreeId:n.id})]}),(0,t.jsxs)(ee.CardFooter,{className:"flex-col items-stretch gap-2","data-worktree-navigation-ignore":!0,children:[(0,t.jsx)(tu,{...o,onCompleted:async()=>{await e.onReload(),d&&await w()}}),(0,t.jsx)(ew.QuickActionsRow,{first:(0,t.jsx)(H.WorkflowQuickActions,{className:"w-auto",sessionData:{worktree:{id:n.id,path:n.folder,branch:n.branch,baseBranch:n.baseBranch,headSha:n.headSha},codebase:{id:e.group.codebase.id,folder:e.group.codebase.folder},repo:{id:e.group.repository.id,name:e.group.repository.name,url:e.group.repository.displayOrigin,displayOrigin:e.group.repository.displayOrigin}},worktreeId:n.id,workflows:e.group.quickActions??[]}),second:(0,t.jsx)(V.CommandQuickActions,{agentCapabilities:e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id))?.agent.capabilities??[],className:"w-auto",worktreeId:n.id})})]})]})}function e4({worktree:e}){let r=(0,$.useTranslations)("worktrees"),a=e.branch??e.headSha?.slice(0,10)??r("detached"),s=r("openWorktreeDetails",{branch:a});return(0,t.jsx)(Z.Button,{asChild:!0,size:"icon-sm",variant:"ghost",children:(0,t.jsx)(ev.Link,{"aria-label":s,href:(0,eN.worktreeDetailHref)(e.id),title:s,children:(0,t.jsx)(l.ArrowRight,{})})})}function e7({worktree:e,onOpenTicket:r,compact:a=!1}){let s=`${e.ticketKey??""}${e.ticketTitle?`${e.ticketKey?" — ":""}${e.ticketTitle}`:""}`;return(0,t.jsxs)("div",{className:(0,ef.cn)("flex max-w-full flex-wrap items-center gap-1.5 font-normal",a?"mt-0.5 text-xs":"mt-1 text-sm"),children:[e.ticketKey?(0,t.jsx)(Z.Button,{className:"h-auto min-w-0 justify-start truncate p-0 text-left font-normal",onClick:()=>r(e.ticketKey),title:s,type:"button",variant:"link",children:s}):(0,t.jsx)("p",{className:"min-w-0 truncate text-muted-foreground",title:s,children:s}),e.ticketStatus&&(e.ticketKey?(0,t.jsx)(X.Badge,{asChild:!0,variant:"secondary",children:(0,t.jsx)("button",{onClick:()=>r(e.ticketKey),type:"button",children:e.ticketStatus})}):(0,t.jsx)(X.Badge,{variant:"secondary",children:e.ticketStatus}))]})}function e6(e){let{worktree:r,group:a,agentName:s,baseRepoDirectory:n,detailsExpanded:i,onToggleDetails:l}=e,o=(0,$.useTranslations)("worktrees");return(0,t.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,t.jsx)(tj,{label:o("path"),mono:!0,value:eF(r.folder,n)}),(0,t.jsx)(ts,{...e})]}),(0,t.jsxs)(e8,{label:o("upToDate"),children:[(0,t.jsx)(te,{worktree:r}),(0,t.jsx)("span",{className:"pl-6 text-xs text-muted-foreground",children:o("agent")}),(0,t.jsx)(X.Badge,{variant:"outline",children:s})]}),(0,t.jsx)(e9,{...e}),(0,t.jsx)(e8,{label:o("pullRequest"),children:(0,t.jsx)(tt,{detailsExpanded:i,onToggleDetails:l,worktree:r})}),r.latestBuild&&(0,t.jsx)(e3,{build:r.latestBuild,onCompleted:e.onReload,onError:e.onError}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[r.statusError&&(0,t.jsx)("span",{className:"text-xs text-destructive",children:r.statusError}),!a.codebase.defaultBranch&&!r.baseBranchOverride&&(0,t.jsx)("span",{className:"text-xs text-destructive",children:o("baseUnavailable")})]})]})}function e3({build:e,onCompleted:r,onError:a}){let s=(0,$.useTranslations)("worktrees"),n=(0,$.useTranslations)("builds"),i="SUCCEEDED"===e.status&&e.artifacts.some(e=>"RUNNABLE_APP"===e.kind),{rebuild:l,rebuilding:o}=(0,q.useRebuildBuild)({buildId:e.id,onCompleted:()=>r(),onError:a});return(0,t.jsxs)(e8,{label:s("latestBuild"),children:[(0,t.jsxs)(ea.DropdownMenu,{children:[(0,t.jsx)(ea.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(X.Badge,{asChild:!0,variant:"outline",children:(0,t.jsxs)("button",{type:"button",children:[n(`actions.${e.action}`),(0,t.jsx)(c.ChevronDown,{})]})})}),(0,t.jsxs)(ea.DropdownMenuContent,{align:"start",className:"w-36",children:[(0,t.jsx)(ea.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ev.Link,{href:`/builds/${e.id}`,children:[(0,t.jsx)(p.ExternalLink,{}),n("viewBuild")]})}),(0,t.jsxs)(ea.DropdownMenuItem,{disabled:o,onSelect:()=>void l(),children:[o?(0,t.jsx)(ec.Spinner,{}):(0,t.jsx)(A.RotateCcw,{}),n("rebuild")]})]})]}),"SUCCEEDED"===e.status?(0,t.jsx)(X.Badge,{asChild:!0,variant:(0,O.buildStatusVariant)(e.status),children:(0,t.jsx)(ev.Link,{href:`/builds/${e.id}`,children:n(`statuses.${e.status}`)})}):(0,t.jsx)(X.Badge,{variant:(0,O.buildStatusVariant)(e.status),children:n(`statuses.${e.status}`)}),e.outOfDate&&(0,t.jsx)(X.Badge,{className:"border-amber-500/40 text-amber-700 dark:text-amber-300",variant:"outline",children:n("outOfDate")}),i&&(0,t.jsx)(_.RunBuildControls,{buildId:e.id,destinationType:e.destinationType,onCompleted:r,onError:a,preferredDestination:e.destination,size:"sm"})]})}function e8({label:e,children:r}){return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("p",{className:"w-24 shrink-0 text-xs text-muted-foreground",children:e}),(0,t.jsx)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:r})]})}function e9({compact:e=!1,...r}){let{worktree:a}=r,s=(0,$.useTranslations)("worktrees");return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[!e&&(0,t.jsx)("span",{className:"w-24 shrink-0 text-xs text-muted-foreground",children:s("tags")}),(0,t.jsx)(ti,{...r,contentAlign:e?"end":"start",contentAlignOffset:e?0:-100,trigger:(0,t.jsx)(Z.Button,{"aria-label":`${s("tags")}: ${a.branch??s("detached")}`,className:(0,ef.cn)("h-auto min-h-7 max-w-full justify-start px-1 py-1 text-left font-normal",!e&&"-mx-1"),type:"button",variant:"ghost",children:(0,t.jsxs)("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[a.tags.map(e=>(0,t.jsx)(tb,{tag:e},e.id)),!a.tags.length&&(0,t.jsx)("span",{className:"text-muted-foreground",children:"—"})]})})})]})}function te({worktree:e}){let r=(0,$.useTranslations)("worktrees"),a=0===e.baseBehind;return(0,t.jsx)(X.Badge,{className:a?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":null===e.baseBehind?void 0:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",variant:"outline",children:null===e.baseBehind?r("unknown"):a?r("yes"):r("notUpToDate",{count:e.baseBehind})})}function tt({worktree:e,detailsExpanded:r,onToggleDetails:a}){var s;let n=(0,$.useTranslations)("worktrees"),i=(0,$.useTranslations)("gitlabPages"),l=e.baseAhead??0,o=e.sourceControlRequest?.provider==="GITLAB"?e.sourceControlRequest:null;return(0,t.jsxs)(t.Fragment,{children:[e.pullRequest?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tr,{pullRequest:e.pullRequest}),(0,t.jsx)(G.PipelineMenu,{pipelineStatus:e.pullRequest.pipelineStatus,pipelines:e.pullRequest.pipelines,pipelineRevision:e.pullRequest.pipelineRevision,headSha:e.pullRequest.headRefOid,repositoryId:e.pullRequest.repositoryGithubId,repositoryNameWithOwner:e.pullRequest.repositoryNameWithOwner,repositoryUrl:e.pullRequest.repositoryUrl,requestSource:"WORKTREES"}),(0,t.jsx)(X.Badge,{className:"APPROVED"===(s=e.pullRequest.reviewDecision)?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"CHANGES_REQUESTED"===s?"border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300":"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",children:n(`review.${e.pullRequest.reviewDecision}`)}),(0,t.jsx)(X.Badge,{asChild:!0,className:0===e.pullRequest.unresolvedReviewThreadCount?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",children:(0,t.jsx)(ev.Link,{href:(0,z.pullRequestCommentsHref)(e.pullRequest),children:n("comments",{count:e.pullRequest.unresolvedReviewThreadCount})})})]}):o?(0,t.jsxs)(ea.DropdownMenu,{children:[(0,t.jsx)(ea.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(X.Badge,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",children:["MR !",o.number]})})}),(0,t.jsxs)(ea.DropdownMenuContent,{align:"start",className:"w-44",children:[(0,t.jsx)(ea.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)("a",{href:o.url,rel:"noreferrer",target:"_blank",children:[(0,t.jsx)(p.ExternalLink,{}),i("openInGitLab")]})}),o.projectId?(0,t.jsx)(ea.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ev.Link,{href:`/gitlab/merge-requests/${encodeURIComponent(o.projectId)}/${o.number}`,children:[(0,t.jsx)(f.GitMerge,{}),n("openDetails")]})}):null]})]}):null,(0,t.jsx)(K.GitLabWorktreePipelinesMenu,{pipelines:e.gitLabPipelines??[]}),e.pullRequest||o||(e.gitLabPipelines??[]).length||0!==l?null:(0,t.jsx)("span",{className:"text-muted-foreground",children:"—"}),l>0&&(a?(0,t.jsx)(X.Badge,{asChild:!0,variant:"secondary",children:(0,t.jsx)("button",{"aria-expanded":r,onClick:a,type:"button",children:n("branchCommits",{count:l})})}):(0,t.jsx)(X.Badge,{variant:"secondary",children:n("branchCommits",{count:l})}))]})}function tr({pullRequest:e}){let r=(0,$.useTranslations)("worktrees");return(0,t.jsxs)(ea.DropdownMenu,{children:[(0,t.jsx)(ea.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(X.Badge,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",children:["PR #",e.number]})})}),(0,t.jsxs)(ea.DropdownMenuContent,{align:"start",className:"w-44",children:[(0,t.jsx)(ea.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)("a",{href:e.url,rel:"noreferrer",target:"_blank",children:[(0,t.jsx)(p.ExternalLink,{}),r("openInGitHub")]})}),(0,t.jsx)(ea.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ev.Link,{href:(0,z.pullRequestDetailHref)(e),children:[(0,t.jsx)(v.GitPullRequest,{}),r("openDetails")]})})]})]})}function ta({worktree:e}){var r,a;let s=(0,$.useTranslations)("worktrees");if("IN_SYNC"===e.syncState||0===e.ahead&&0===e.behind)return(0,t.jsx)(X.Badge,{className:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",variant:"outline",children:s("inSync")});let n=e.ahead??0,l=e.behind??0;return n>0||l>0?(0,t.jsxs)(t.Fragment,{children:[n>0&&(0,t.jsxs)(X.Badge,{className:"border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300",variant:"outline",children:[(0,t.jsx)(o.ArrowUp,{"data-icon":"inline-start"}),s("ahead",{count:n})]}),l>0&&(0,t.jsxs)(X.Badge,{className:"border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300",variant:"outline",children:[(0,t.jsx)(i.ArrowDown,{"data-icon":"inline-start"}),s("behind",{count:l})]})]}):(0,t.jsx)(X.Badge,{variant:"outline",children:(r=e,a=s,"AHEAD"===r.syncState?a("ahead",{count:r.ahead??0}):"BEHIND"===r.syncState?a("behind",{count:r.behind??0}):a("DIVERGED"===r.syncState?"diverged":"IN_SYNC"===r.syncState?"upToDate":"NO_UPSTREAM"===r.syncState?"unpublished":"DETACHED"===r.syncState?"detached":"unknown"))})}function ts(e){let{worktree:a,group:s,onUpdate:n,onError:i,compact:l=!1}=e,o=(0,$.useTranslations)("worktrees"),[d,c]=(0,r.useState)(!1),[u,h]=(0,r.useState)(!1),g="__inherit_remote_default__",m=Array.from(new Set([a.baseBranchOverride,s.codebase.defaultBranch,...s.codebase.remoteBranches].filter(e=>!!e))),p=async e=>{h(!0);try{let t=await (0,ej.controlPlaneRequest)(`mutation UpdateWorktreeBase($id: ID!, $baseBranch: String) {
92
+ updateWorktreeBaseBranch(id: $id, baseBranch: $baseBranch) { ${ey.WORKTREE_FIELDS} }
93
+ }`,{id:a.id,baseBranch:e||null});n(t.updateWorktreeBaseBranch),i(null),c(!1)}catch(e){i(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,t.jsxs)("div",{className:"min-w-0",children:[!l&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:o("baseBranch")}),(0,t.jsx)("div",{className:(0,ef.cn)("flex min-h-6 min-w-0 items-center gap-1",!l&&"mt-0.5"),children:d?(0,t.jsxs)(eu.Select,{disabled:u,onOpenChange:c,onValueChange:e=>void p(e===g?"":e),open:d,value:a.baseBranchOverride??(s.codebase.defaultBranch?g:void 0),children:[(0,t.jsx)(eu.SelectTrigger,{"aria-label":o("baseBranch"),className:"h-7 min-w-40 max-w-full font-mono text-xs",size:"sm",children:(0,t.jsx)(eu.SelectValue,{placeholder:o("baseUnavailable")})}),(0,t.jsxs)(eu.SelectContent,{align:"start",children:[s.codebase.defaultBranch&&(0,t.jsxs)(eu.SelectItem,{value:g,children:[s.codebase.defaultBranch," · ",o("inheritBase")]}),m.map(e=>(0,t.jsx)(eu.SelectItem,{value:e,children:e},e))]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"truncate font-mono text-xs",title:a.baseBranch??void 0,children:a.baseBranch??"—"}),(0,t.jsx)(Z.Button,{"aria-label":o("editBase"),onClick:()=>c(!0),size:"icon-xs",variant:"ghost",children:(0,t.jsx)(T.Pencil,{})})]})})]})}function tn(e,t){let r=t.activeMoves.some(t=>t.sourceCodebaseId===e.group.codebase.id||t.targetCodebaseId===e.group.codebase.id);return"ONLINE"===e.agentGroup.agent.connectionStatus&&e.agentGroup.agent.capabilities.includes("worktree.move.checkout")&&"AVAILABLE"===e.group.codebase.availability&&!e.group.blockingJob&&!r}function ti(e){let a,s,{worktree:n,allTags:i,editorVariant:l,onUpdate:o,onError:d,onManageTags:c,contentAlign:u="end",contentAlignOffset:h=0,trigger:m}=e,p=(0,$.useTranslations)("worktrees"),[f,v]=(0,r.useState)(!1),[k,w]=(0,r.useState)(!1),[S,T]=(0,r.useState)(!1),[A,D]=(0,r.useState)(!1),[R,W]=(0,r.useState)(!1),[L,M]=(0,r.useState)(!1),[O,q]=(0,r.useState)(null),[_,U]=(0,r.useState)(null),F=(0,r.useRef)(!1),H=(a=e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id)))?e.overview.agents.flatMap(t=>t.agent.id===a.agent.id?[]:t.codebases.flatMap(r=>r.repository.id===e.group.repository.id?[{agentGroup:t,group:r}]:[])):[],V=(s=e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id)))&&"ONLINE"===s.agent.connectionStatus&&s.agent.capabilities.includes("worktree.move.push")?"AVAILABLE"!==e.worktree.availability||e.group.blockingJob||e.worktree.rebaseInProgress||e.overview.activeMoves.some(t=>t.sourceCodebaseId===e.group.codebase.id||t.targetCodebaseId===e.group.codebase.id)?p("moveBlocked.busy"):e.worktree.branch&&e.worktree.headSha?e.worktree.hasStagedChanges||e.worktree.hasUnstagedChanges||"DIRTY"===e.worktree.pushStatus?p("moveBlocked.dirty"):"BEHIND"===e.worktree.pushStatus?p("moveBlocked.behind"):"DIVERGED"===e.worktree.pushStatus?p("moveBlocked.diverged"):"READY"!==e.worktree.pushStatus?p("moveBlocked.unknown"):H.some(t=>tn(t,e.overview))?null:p("moveBlocked.destination"):p("moveBlocked.detached"):p("moveBlocked.agent"),G=e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id)),K=!G||"ONLINE"!==G.agent.connectionStatus||!G.agent.capabilities.includes("worktree.delete")||"AVAILABLE"!==n.availability||!!e.group.blockingJob||n.rebaseInProgress||e.overview.activeMoves.some(t=>t.sourceCodebaseId===e.group.codebase.id||t.targetCodebaseId===e.group.codebase.id),z=new Set(n.tags.map(e=>e.id)),J=async(e,t)=>{let r=t?[...z,e]:[...z].filter(t=>t!==e);try{let e=await (0,ej.controlPlaneRequest)(`mutation SetWorktreeTags($id: ID!, $tagIds: [ID!]!) { setWorktreeTags(id: $id, tagIds: $tagIds) { ${ey.WORKTREE_FIELDS} } }`,{id:n.id,tagIds:r});o(e.setWorktreeTags),d(null)}catch(e){d(e instanceof Error?e.message:String(e))}},Q=async e=>{try{let t=await (0,ej.controlPlaneRequest)(`mutation HighlightWorktree($id: ID!, $color: String) { updateWorktreeHighlight(id: $id, color: $color) { ${ey.WORKTREE_FIELDS} } }`,{id:n.id,color:e});o(t.updateWorktreeHighlight),d(null)}catch(e){d(e instanceof Error?e.message:String(e))}},X=async()=>{M(!0);try{let e=await (0,ej.controlPlaneRequest)(`mutation RefreshWorktreePullRequest($id: ID!) {
94
+ refreshWorktreePullRequest(id: $id) { ${ey.WORKTREE_FIELDS} }
95
+ }`,{id:n.id});o(e.refreshWorktreePullRequest),d(null)}catch(e){d(e instanceof Error?e.message:String(e))}finally{M(!1)}},ee=async(t,r=!1)=>{W(!0);try{let a=await (0,ej.controlPlaneRequest)(`mutation ChangeWorktreeBranch($input: ChangeWorktreeBranchInput!) {
96
96
  changeWorktreeBranch(input: $input) { id }
97
- }`,{input:{worktreeId:n.id,selection:t,requestId:(0,eg.createClientId)(),stashOnFailure:r}});await (0,eC.waitForWorktreeJob)(a.changeWorktreeBranch.id),await e.onReload(),q(null),U(null),v(!1),d(null)}finally{P(!1)}},et=async()=>{if(O)try{U(null),await ee(O,!0)}catch(e){U(e instanceof Error?e.message:String(e))}},ea=e.group.codebase.defaultBranch,es=!!(ea&&eH(e.overview,e.group.codebase.id,ea,n.id)),en=!e.branchManagementEnabled||"AVAILABLE"!==n.availability||!!e.group.blockingJob||n.rebaseInProgress,ei=async()=>{if(ea)try{await ee({mode:"EXISTING",branchName:ea,baseBranch:ea})}catch(e){d(e instanceof Error?e.message:String(e))}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(el.Popover,{onOpenChange:e=>{v(e),e||(q(null),U(null))},open:f,children:[(0,t.jsxs)(er.DropdownMenu,{children:[(0,t.jsx)(er.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(el.PopoverAnchor,{asChild:!0,children:g??(0,t.jsx)(X.Button,{"aria-label":j("customize"),size:"icon-sm",variant:"ghost",children:(0,t.jsx)(S.MoreHorizontal,{})})})}),(0,t.jsxs)(er.DropdownMenuContent,{align:u,alignOffset:m,className:"w-72",onCloseAutoFocus:e=>{F.current&&(F.current=!1,e.preventDefault(),v(!0))},children:[H.length>0&&(0,t.jsxs)(er.DropdownMenuItem,{disabled:!!V,onSelect:()=>E(!0),title:V??void 0,children:[(0,t.jsx)(y.MoveRight,{})," ",j("moveToAgent")]}),(0,t.jsxs)(er.DropdownMenuItem,{disabled:en,onSelect:()=>{F.current=!0},children:[(0,t.jsx)(x.GitBranch,{})," ",j("changeBranch")]}),ea&&!es&&(0,t.jsxs)(er.DropdownMenuItem,{disabled:en||B||n.branch===ea,onSelect:()=>void ei(),children:[B?(0,t.jsx)(ed.Spinner,{}):(0,t.jsx)(x.GitBranch,{})," ",j("changeBranchToDefault",{branch:ea})]}),(0,t.jsxs)(er.DropdownMenuItem,{disabled:"AVAILABLE"!==n.availability||!!e.group.blockingJob||n.rebaseInProgress||!G?.agent.capabilities.includes("worktree.commit")||!n.hasStagedChanges&&!n.hasUnstagedChanges,onSelect:()=>w(!0),children:[(0,t.jsx)(b.GitCommitHorizontal,{})," ",j("commit")]}),"NONE"!==l&&(0,t.jsx)(tm,{icon:(0,t.jsx)(h.Code2,{}),label:j("CODE_INSIDERS"===l?"openInsiders":"openCode"),operation:"OPEN_EDITOR",disabled:!!e.group.blockingJob,props:{...e,onCompleted:e.onReload}}),(0,t.jsx)(er.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ef.Link,{href:`/codebases/${e.group.codebase.id}`,children:[(0,t.jsx)(h.Code2,{})," ",j("viewCodebase")]})}),(0,t.jsx)(er.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ef.Link,{href:`/codebases/repositories/${e.group.repository.id}`,children:[(0,t.jsx)(p.FolderGit2,{})," ",j("viewRepository")]})}),n.branch&&/^github\.com\/[^/]+\/[^/]+$/i.test(e.group.repository.canonicalOrigin)&&(0,t.jsxs)(er.DropdownMenuItem,{disabled:L,onSelect:()=>void Z(),children:[L?(0,t.jsx)(ed.Spinner,{}):(0,t.jsx)(N.RefreshCw,{})," ",j("refreshPullRequest")]}),(0,t.jsx)(er.DropdownMenuSeparator,{}),(0,t.jsxs)(er.DropdownMenuLabel,{className:"flex items-center gap-1.5 leading-none",children:[(0,t.jsx)(R.Tags,{className:"size-3"}),(0,t.jsx)("span",{children:j("tags")})]}),i.map(e=>(0,t.jsxs)(er.DropdownMenuCheckboxItem,{checked:z.has(e.id),onCheckedChange:t=>void J(e.id,!!t),children:[(0,t.jsx)("span",{className:(0,ej.cn)("size-3 rounded-full border",eG[e.color])})," ",e.name]},e.id)),(0,t.jsxs)(er.DropdownMenuItem,{onSelect:c,children:[(0,t.jsx)(T.Plus,{})," ",j("manageTags")]}),(0,t.jsx)(er.DropdownMenuSeparator,{}),(0,t.jsxs)(er.DropdownMenuLabel,{className:"flex items-center justify-between gap-1.5 py-0 leading-none",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(C.Paintbrush,{className:"size-3"}),(0,t.jsx)("span",{children:j("highlight")})]}),(0,t.jsx)(X.Button,{"aria-label":j("clearHighlight"),className:"size-6",disabled:!n.highlightColor,onClick:e=>{e.stopPropagation(),Y(null)},size:"icon-sm",variant:"ghost",children:(0,t.jsx)(W.Trash2,{className:"size-3"})})]}),(0,t.jsx)(eh.ToggleGroup,{"aria-label":j("highlight"),className:"grid w-full grid-cols-8 gap-1 px-1.5 pb-1",onClick:e=>e.stopPropagation(),onValueChange:e=>{e&&Y(e)},size:"sm",spacing:1,type:"single",value:n.highlightColor??"",variant:"outline",children:eN.map(e=>(0,t.jsx)(eh.ToggleGroupItem,{"aria-label":e,className:(0,ej.cn)("aspect-square h-auto w-full min-w-0 p-0",eG[e],eK[e],"data-[state=on]:ring-2 data-[state=on]:ring-foreground"),value:e},e))}),!n.primary&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(er.DropdownMenuSeparator,{}),(0,t.jsxs)(er.DropdownMenuItem,{disabled:K,onSelect:()=>D(!0),variant:"destructive",children:[(0,t.jsx)(W.Trash2,{})," ",j("deleteWorktree")]})]})]})]}),(0,t.jsxs)(el.PopoverContent,{align:u,className:"z-60 w-[min(28rem,calc(100vw-2rem))]",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h3",{className:"font-semibold",children:j("changeBranch")}),(0,t.jsx)("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",children:eU(n.folder,e.baseRepoDirectory)})]}),(0,t.jsx)(ev.WorktreeBranchForm,{busy:B,onSubmit:e=>ee(e),onSubmitError:e=>{q(n.hasStagedChanges||n.hasUnstagedChanges?e:null)},recovery:O?(0,t.jsx)(Q.Alert,{children:(0,t.jsxs)(Q.AlertDescription,{className:"space-y-2",children:[(0,t.jsx)("p",{children:j("stashRetryHelp")}),_&&(0,t.jsx)("p",{className:"text-destructive",children:_}),(0,t.jsxs)(X.Button,{disabled:B,onClick:()=>void et(),size:"sm",type:"button",variant:"outline",children:[B&&(0,t.jsx)(ed.Spinner,{}),j("stashAndRetry")]})]})}):null,submitLabel:j("changeBranch"),target:eJ(e.group,n)})]})]}),I&&(0,t.jsx)(tl,{onOpenChange:E,open:I,props:e,targets:H.filter(t=>ts(t,e.overview))}),k&&(0,t.jsx)(ti,{onOpenChange:w,onReload:e.onReload,open:k,worktree:n}),!n.primary&&A&&(0,t.jsx)(to,{onOpenChange:D,open:A,props:e})]})}function ti({worktree:e,open:a,onOpenChange:s,onReload:n}){let i=(0,M.useTranslations)("worktrees"),[l,o]=(0,r.useState)(null),[d,c]=(0,r.useState)(""),[u,h]=(0,r.useState)(!1),[m,g]=(0,r.useState)(!0),[p,x]=(0,r.useState)(new Set),[b,j]=(0,r.useState)(!1),[f,v]=(0,r.useState)(null);(0,r.useEffect)(()=>{let t=!1;return(0,ey.inspectWorktree)(e.id).then(e=>{t||(o(e),h(!0===e.commitSigningEnabled),x(new Set(e.changes.filter(e=>e.staged).map(e=>e.path))))}).catch(e=>{t||v(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e.id]);let k=async()=>{j(!0),v(null);try{let t=await (0,eb.controlPlaneRequest)(`mutation CommitWorktree($input: CommitWorktreeInput!) {
97
+ }`,{input:{worktreeId:n.id,selection:t,requestId:(0,ep.createClientId)(),stashOnFailure:r}});await (0,eI.waitForWorktreeJob)(a.changeWorktreeBranch.id),await e.onReload(),q(null),U(null),v(!1),d(null)}finally{W(!1)}},et=async()=>{if(O)try{U(null),await ee(O,!0)}catch(e){U(e instanceof Error?e.message:String(e))}},er=e.group.codebase.defaultBranch,es=!!(er&&eV(e.overview,e.group.codebase.id,er,n.id)),en=!e.branchManagementEnabled||"AVAILABLE"!==n.availability||!!e.group.blockingJob||n.rebaseInProgress,ei=async()=>{if(er)try{await ee({mode:"EXISTING",branchName:er,baseBranch:er})}catch(e){d(e instanceof Error?e.message:String(e))}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(eo.Popover,{onOpenChange:e=>{v(e),e||(q(null),U(null))},open:f,children:[(0,t.jsxs)(ea.DropdownMenu,{children:[(0,t.jsx)(ea.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(eo.PopoverAnchor,{asChild:!0,children:m??(0,t.jsx)(Z.Button,{"aria-label":p("customize"),size:"icon-sm",variant:"ghost",children:(0,t.jsx)(y.MoreHorizontal,{})})})}),(0,t.jsxs)(ea.DropdownMenuContent,{align:u,alignOffset:h,className:"w-72",onCloseAutoFocus:e=>{F.current&&(F.current=!1,e.preventDefault(),v(!0))},children:[H.length>0&&(0,t.jsxs)(ea.DropdownMenuItem,{disabled:!!V,onSelect:()=>T(!0),title:V??void 0,children:[(0,t.jsx)(C.MoveRight,{})," ",p("moveToAgent")]}),(0,t.jsxs)(ea.DropdownMenuItem,{disabled:en,onSelect:()=>{F.current=!0},children:[(0,t.jsx)(b.GitBranch,{})," ",p("changeBranch")]}),er&&!es&&(0,t.jsxs)(ea.DropdownMenuItem,{disabled:en||R||n.branch===er,onSelect:()=>void ei(),children:[R?(0,t.jsx)(ec.Spinner,{}):(0,t.jsx)(b.GitBranch,{})," ",p("changeBranchToDefault",{branch:er})]}),(0,t.jsxs)(ea.DropdownMenuItem,{disabled:"AVAILABLE"!==n.availability||!!e.group.blockingJob||n.rebaseInProgress||!G?.agent.capabilities.includes("worktree.commit")||!n.hasStagedChanges&&!n.hasUnstagedChanges,onSelect:()=>w(!0),children:[(0,t.jsx)(j.GitCommitHorizontal,{})," ",p("commit")]}),"NONE"!==l&&(0,t.jsx)(tm,{icon:(0,t.jsx)(g.Code2,{}),label:p("CODE_INSIDERS"===l?"openInsiders":"openCode"),operation:"OPEN_EDITOR",disabled:!!e.group.blockingJob,props:{...e,onCompleted:e.onReload}}),(0,t.jsx)(ea.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ev.Link,{href:`/codebases/${e.group.codebase.id}`,children:[(0,t.jsx)(g.Code2,{})," ",p("viewCodebase")]})}),(0,t.jsx)(ea.DropdownMenuItem,{asChild:!0,children:(0,t.jsxs)(ev.Link,{href:`/codebases/repositories/${e.group.repository.id}`,children:[(0,t.jsx)(x.FolderGit2,{})," ",p("viewRepository")]})}),n.branch&&/^github\.com\/[^/]+\/[^/]+$/i.test(e.group.repository.canonicalOrigin)&&(0,t.jsxs)(ea.DropdownMenuItem,{disabled:L,onSelect:()=>void X(),children:[L?(0,t.jsx)(ec.Spinner,{}):(0,t.jsx)(E.RefreshCw,{})," ",p("refreshPullRequest")]}),(0,t.jsx)(ea.DropdownMenuSeparator,{}),(0,t.jsxs)(ea.DropdownMenuLabel,{className:"flex items-center gap-1.5 leading-none",children:[(0,t.jsx)(B.Tags,{className:"size-3"}),(0,t.jsx)("span",{children:p("tags")})]}),i.map(e=>(0,t.jsxs)(ea.DropdownMenuCheckboxItem,{checked:z.has(e.id),onCheckedChange:t=>void J(e.id,!!t),children:[(0,t.jsx)("span",{className:(0,ef.cn)("size-3 rounded-full border",eK[e.color])})," ",e.name]},e.id)),(0,t.jsxs)(ea.DropdownMenuItem,{onSelect:c,children:[(0,t.jsx)(N.Plus,{})," ",p("manageTags")]}),(0,t.jsx)(ea.DropdownMenuSeparator,{}),(0,t.jsxs)(ea.DropdownMenuLabel,{className:"flex items-center justify-between gap-1.5 py-0 leading-none",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(I.Paintbrush,{className:"size-3"}),(0,t.jsx)("span",{children:p("highlight")})]}),(0,t.jsx)(Z.Button,{"aria-label":p("clearHighlight"),className:"size-6",disabled:!n.highlightColor,onClick:e=>{e.stopPropagation(),Q(null)},size:"icon-sm",variant:"ghost",children:(0,t.jsx)(P.Trash2,{className:"size-3"})})]}),(0,t.jsx)(eg.ToggleGroup,{"aria-label":p("highlight"),className:"grid w-full grid-cols-8 gap-1 px-1.5 pb-1",onClick:e=>e.stopPropagation(),onValueChange:e=>{e&&Q(e)},size:"sm",spacing:1,type:"single",value:n.highlightColor??"",variant:"outline",children:eE.map(e=>(0,t.jsx)(eg.ToggleGroupItem,{"aria-label":e,className:(0,ef.cn)("aspect-square h-auto w-full min-w-0 p-0",eK[e],ez[e],"data-[state=on]:ring-2 data-[state=on]:ring-foreground"),value:e},e))}),!n.primary&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ea.DropdownMenuSeparator,{}),(0,t.jsxs)(ea.DropdownMenuItem,{disabled:K,onSelect:()=>D(!0),variant:"destructive",children:[(0,t.jsx)(P.Trash2,{})," ",p("deleteWorktree")]})]})]})]}),(0,t.jsxs)(eo.PopoverContent,{align:u,className:"z-60 w-[min(28rem,calc(100vw-2rem))]",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h3",{className:"font-semibold",children:p("changeBranch")}),(0,t.jsx)("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",children:eF(n.folder,e.baseRepoDirectory)})]}),(0,t.jsx)(ek.WorktreeBranchForm,{busy:R,onSubmit:e=>ee(e),onSubmitError:e=>{q(n.hasStagedChanges||n.hasUnstagedChanges?e:null)},recovery:O?(0,t.jsx)(Y.Alert,{children:(0,t.jsxs)(Y.AlertDescription,{className:"space-y-2",children:[(0,t.jsx)("p",{children:p("stashRetryHelp")}),_&&(0,t.jsx)("p",{className:"text-destructive",children:_}),(0,t.jsxs)(Z.Button,{disabled:R,onClick:()=>void et(),size:"sm",type:"button",variant:"outline",children:[R&&(0,t.jsx)(ec.Spinner,{}),p("stashAndRetry")]})]})}):null,submitLabel:p("changeBranch"),target:eQ(e.group,n)})]})]}),S&&(0,t.jsx)(to,{onOpenChange:T,open:S,props:e,targets:H.filter(t=>tn(t,e.overview))}),k&&(0,t.jsx)(tl,{onOpenChange:w,onReload:e.onReload,open:k,worktree:n}),!n.primary&&A&&(0,t.jsx)(td,{onOpenChange:D,open:A,props:e})]})}function tl({worktree:e,open:a,onOpenChange:s,onReload:n}){let i=(0,$.useTranslations)("worktrees"),[l,o]=(0,r.useState)(null),[d,c]=(0,r.useState)(""),[u,h]=(0,r.useState)(!1),[g,m]=(0,r.useState)(!0),[p,x]=(0,r.useState)(new Set),[b,j]=(0,r.useState)(!1),[f,v]=(0,r.useState)(null);(0,r.useEffect)(()=>{let t=!1;return(0,eC.inspectWorktree)(e.id).then(e=>{t||(o(e),h(!0===e.commitSigningEnabled),x(new Set(e.changes.filter(e=>e.staged).map(e=>e.path))))}).catch(e=>{t||v(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e.id]);let k=async()=>{j(!0),v(null);try{let t=await (0,ej.controlPlaneRequest)(`mutation CommitWorktree($input: CommitWorktreeInput!) {
98
98
  commitWorktree(input: $input) { id }
99
- }`,{input:{worktreeId:e.id,message:d,signed:u,stageAll:m,paths:m?[]:[...p],requestId:(0,eg.createClientId)()}});await (0,eC.waitForWorktreeJob)(t.commitWorktree.id),await n(),s(!1)}catch(e){v(e instanceof Error?e.message:String(e))}finally{j(!1)}};return(0,t.jsx)(et.Dialog,{onOpenChange:s,open:a,children:(0,t.jsxs)(et.DialogContent,{className:"max-h-[min(42rem,calc(100vh-2rem))] overflow-y-auto sm:max-w-lg",children:[(0,t.jsxs)(et.DialogHeader,{children:[(0,t.jsx)(et.DialogTitle,{children:i("commitTitle")}),(0,t.jsx)(et.DialogDescription,{children:i("commitDescription")})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)(ei.Label,{htmlFor:"worktree-commit-message",children:i("commitMessage")}),(0,t.jsx)(em.Textarea,{autoFocus:!0,id:"worktree-commit-message",onChange:e=>c(e.target.value),placeholder:i("commitMessagePlaceholder"),rows:4,value:d})]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(ee.Checkbox,{checked:u,onCheckedChange:e=>h(!!e)}),i("signedCommit")]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(ee.Checkbox,{checked:m,onCheckedChange:e=>g(!!e)}),i("stageAll")]}),!m&&l&&(0,t.jsx)("div",{className:"max-h-64 space-y-1 overflow-y-auto rounded-md border p-2",children:l.changes.map(e=>(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted",children:[(0,t.jsx)(ee.Checkbox,{checked:p.has(e.path),onCheckedChange:t=>{x(r=>{let a=new Set(r);return t?a.add(e.path):a.delete(e.path),a})}}),(0,t.jsx)("span",{className:"break-all font-mono text-xs",children:e.path})]},e.path))}),!l&&!f&&(0,t.jsx)(ed.Spinner,{}),f&&(0,t.jsx)(Q.Alert,{variant:"destructive",children:(0,t.jsx)(Q.AlertDescription,{children:f})})]}),(0,t.jsxs)(et.DialogFooter,{children:[(0,t.jsx)(X.Button,{disabled:b,onClick:()=>s(!1),variant:"outline",children:i("cancel")}),(0,t.jsxs)(X.Button,{disabled:b||!l||!d.trim()||!m&&0===p.size,onClick:()=>void k(),children:[b&&(0,t.jsx)(ed.Spinner,{})," ",i("commit")]})]})]})})}function tl({props:e,targets:a,open:s,onOpenChange:n}){let i=(0,M.useTranslations)("worktrees"),l=1===a.length?a[0].group.codebase.id:"",[o,d]=(0,r.useState)(l),[c,u]=(0,r.useState)("__new__"),[h,m]=(0,r.useState)(!1),[g,p]=(0,r.useState)(!1),[x,b]=(0,r.useState)(null),[j,f]=(0,r.useState)(null),v=a.some(e=>e.group.codebase.id===o)?o:1===a.length?a[0].group.codebase.id:"",k=a.find(e=>e.group.codebase.id===v),w=a.map(e=>({value:e.group.codebase.id,label:`${e.agentGroup.agent.name} \xb7 ${e.group.repository.name}`,description:e.group.codebase.folder,keywords:`${e.agentGroup.agent.hostname} ${e.group.repository.displayOrigin}`})),S=k?.group.worktrees.find(e=>e.id===c),y=k?.group.worktrees.find(t=>t.branch===e.worktree.branch),C=!e.worktree.primary&&e.overview.agents.some(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id)&&t.agent.capabilities.includes("worktree.delete")),I=async t=>{if("AWAITING_STASH"===t.status){f(t),await e.onReload();return}if("FAILED"===t.status)throw Error(t.error||i("moveFailed"));if("CANCELLED"===t.status)throw Error(i("moveCancelled"));e.onError("SUCCEEDED_WITH_WARNING"===t.status?t.warning:null),await e.onReload(),e.onMoved?.(t),n(!1)},T=async()=>{if(k){p(!0),b(null);try{let t=await (0,eb.controlPlaneRequest)(`mutation MoveWorktree($input: MoveWorktreeInput!) {
99
+ }`,{input:{worktreeId:e.id,message:d,signed:u,stageAll:g,paths:g?[]:[...p],requestId:(0,ep.createClientId)()}});await (0,eI.waitForWorktreeJob)(t.commitWorktree.id),await n(),s(!1)}catch(e){v(e instanceof Error?e.message:String(e))}finally{j(!1)}};return(0,t.jsx)(er.Dialog,{onOpenChange:s,open:a,children:(0,t.jsxs)(er.DialogContent,{className:"max-h-[min(42rem,calc(100vh-2rem))] overflow-y-auto sm:max-w-lg",children:[(0,t.jsxs)(er.DialogHeader,{children:[(0,t.jsx)(er.DialogTitle,{children:i("commitTitle")}),(0,t.jsx)(er.DialogDescription,{children:i("commitDescription")})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)(el.Label,{htmlFor:"worktree-commit-message",children:i("commitMessage")}),(0,t.jsx)(em.Textarea,{autoFocus:!0,id:"worktree-commit-message",onChange:e=>c(e.target.value),placeholder:i("commitMessagePlaceholder"),rows:4,value:d})]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(et.Checkbox,{checked:u,onCheckedChange:e=>h(!!e)}),i("signedCommit")]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(et.Checkbox,{checked:g,onCheckedChange:e=>m(!!e)}),i("stageAll")]}),!g&&l&&(0,t.jsx)("div",{className:"max-h-64 space-y-1 overflow-y-auto rounded-md border p-2",children:l.changes.map(e=>(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted",children:[(0,t.jsx)(et.Checkbox,{checked:p.has(e.path),onCheckedChange:t=>{x(r=>{let a=new Set(r);return t?a.add(e.path):a.delete(e.path),a})}}),(0,t.jsx)("span",{className:"break-all font-mono text-xs",children:e.path})]},e.path))}),!l&&!f&&(0,t.jsx)(ec.Spinner,{}),f&&(0,t.jsx)(Y.Alert,{variant:"destructive",children:(0,t.jsx)(Y.AlertDescription,{children:f})})]}),(0,t.jsxs)(er.DialogFooter,{children:[(0,t.jsx)(Z.Button,{disabled:b,onClick:()=>s(!1),variant:"outline",children:i("cancel")}),(0,t.jsxs)(Z.Button,{disabled:b||!l||!d.trim()||!g&&0===p.size,onClick:()=>void k(),children:[b&&(0,t.jsx)(ec.Spinner,{})," ",i("commit")]})]})]})})}function to({props:e,targets:a,open:s,onOpenChange:n}){let i=(0,$.useTranslations)("worktrees"),l=1===a.length?a[0].group.codebase.id:"",[o,d]=(0,r.useState)(l),[c,u]=(0,r.useState)("__new__"),[h,g]=(0,r.useState)(!1),[m,p]=(0,r.useState)(!1),[x,b]=(0,r.useState)(null),[j,f]=(0,r.useState)(null),v=a.some(e=>e.group.codebase.id===o)?o:1===a.length?a[0].group.codebase.id:"",k=a.find(e=>e.group.codebase.id===v),w=a.map(e=>({value:e.group.codebase.id,label:`${e.agentGroup.agent.name} \xb7 ${e.group.repository.name}`,description:e.group.codebase.folder,keywords:`${e.agentGroup.agent.hostname} ${e.group.repository.displayOrigin}`})),S=k?.group.worktrees.find(e=>e.id===c),y=k?.group.worktrees.find(t=>t.branch===e.worktree.branch),C=!e.worktree.primary&&e.overview.agents.some(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id)&&t.agent.capabilities.includes("worktree.delete")),I=async t=>{if("AWAITING_STASH"===t.status){f(t),await e.onReload();return}if("FAILED"===t.status)throw Error(t.error||i("moveFailed"));if("CANCELLED"===t.status)throw Error(i("moveCancelled"));e.onError("SUCCEEDED_WITH_WARNING"===t.status?t.warning:null),await e.onReload(),e.onMoved?.(t),n(!1)},T=async()=>{if(k){p(!0),b(null);try{let t=await (0,ej.controlPlaneRequest)(`mutation MoveWorktree($input: MoveWorktreeInput!) {
100
100
  moveWorktree(input: $input) {
101
101
  id sourceWorktreeId sourceCodebaseId targetCodebaseId targetWorktreeId destinationMode
102
102
  branch headSha deleteSource status sourceJobId targetJobId cleanupJobId error warning
103
103
  createdAt updatedAt finishedAt
104
104
  }
105
- }`,{input:{sourceWorktreeId:e.worktree.id,targetCodebaseId:k.group.codebase.id,targetWorktreeId:"__new__"===c?null:c,deleteSource:h,requestId:(0,eg.createClientId)()}});await I(await (0,eC.waitForWorktreeMove)(t.moveWorktree.id))}catch(e){b(e instanceof Error?e.message:String(e))}finally{p(!1)}}},N=async()=>{if(j){p(!0),b(null);try{await (0,eb.controlPlaneRequest)(`mutation RetryMove($id: ID!) {
105
+ }`,{input:{sourceWorktreeId:e.worktree.id,targetCodebaseId:k.group.codebase.id,targetWorktreeId:"__new__"===c?null:c,deleteSource:h,requestId:(0,ep.createClientId)()}});await I(await (0,eI.waitForWorktreeMove)(t.moveWorktree.id))}catch(e){b(e instanceof Error?e.message:String(e))}finally{p(!1)}}},N=async()=>{if(j){p(!0),b(null);try{await (0,ej.controlPlaneRequest)(`mutation RetryMove($id: ID!) {
106
106
  retryWorktreeMoveWithStash(id: $id) { id status }
107
- }`,{id:j.id}),await I(await (0,eC.waitForWorktreeMove)(j.id))}catch(e){b(e instanceof Error?e.message:String(e))}finally{p(!1)}}},E=async()=>{if(j){p(!0);try{await (0,eb.controlPlaneRequest)(`mutation CancelMove($id: ID!) {
107
+ }`,{id:j.id}),await I(await (0,eI.waitForWorktreeMove)(j.id))}catch(e){b(e instanceof Error?e.message:String(e))}finally{p(!1)}}},E=async()=>{if(j){p(!0);try{await (0,ej.controlPlaneRequest)(`mutation CancelMove($id: ID!) {
108
108
  cancelWorktreeMove(id: $id) { id status }
109
- }`,{id:j.id}),await e.onReload(),n(!1)}catch(e){b(e instanceof Error?e.message:String(e))}finally{p(!1)}}};return(0,t.jsx)(et.Dialog,{onOpenChange:e=>!g&&n(e),open:s,children:(0,t.jsxs)(et.DialogContent,{className:"sm:max-w-xl",children:[(0,t.jsxs)(et.DialogHeader,{children:[(0,t.jsx)(et.DialogTitle,{children:i("moveToAgent")}),(0,t.jsx)(et.DialogDescription,{children:i("moveDescription",{branch:e.worktree.branch??""})})]}),j?(0,t.jsx)(Q.Alert,{children:(0,t.jsxs)(Q.AlertDescription,{className:"space-y-3",children:[(0,t.jsx)("p",{children:j.error||i("moveNeedsStash")}),(0,t.jsx)("p",{className:"text-muted-foreground",children:i("moveStashHelp")})]})}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ei.Label,{className:"mb-1.5 block",children:i("destinationAgent")}),(0,t.jsx)(eo.SearchableSelect,{ariaLabel:i("destinationAgent"),disabled:g,emptyMessage:i("noMoveDestinations"),onValueChange:e=>{d(e),u("__new__")},options:w,placeholder:i("selectDestinationAgent"),searchPlaceholder:i("searchDestinationAgents"),value:v})]}),k&&(0,t.jsxs)("div",{children:[(0,t.jsx)(ei.Label,{className:"mb-1.5 block",children:i("destinationWorktree")}),(0,t.jsxs)(ec.Select,{disabled:g,onValueChange:u,value:c,children:[(0,t.jsx)(ec.SelectTrigger,{"aria-label":i("destinationWorktree"),children:(0,t.jsx)(ec.SelectValue,{})}),(0,t.jsxs)(ec.SelectContent,{children:[(0,t.jsx)(ec.SelectItem,{disabled:!!y,value:"__new__",children:i("createDestinationWorktree")}),k.group.worktrees.filter(e=>"AVAILABLE"===e.availability).map(e=>(0,t.jsxs)(ec.SelectItem,{disabled:!!y&&y.id!==e.id,value:e.id,children:[e.branch??i("detached")," ·"," ",e.relativePath]},e.id))]})]})]}),S&&(S.hasStagedChanges||S.hasUnstagedChanges)&&(0,t.jsx)(Q.Alert,{children:(0,t.jsx)(Q.AlertDescription,{children:i("dirtyDestinationWarning")})}),(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(ee.Checkbox,{checked:h,disabled:!C||g,id:`delete-source-${e.worktree.id}`,onCheckedChange:e=>m(!!e)}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ei.Label,{htmlFor:`delete-source-${e.worktree.id}`,children:i("deleteOldWorktree")}),!C&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:i("deleteOldWorktreeDisabled")})]})]})]}),x&&(0,t.jsx)(Q.Alert,{variant:"destructive",children:(0,t.jsx)(Q.AlertDescription,{children:x})}),(0,t.jsxs)(et.DialogFooter,{children:[(0,t.jsx)(X.Button,{disabled:g,onClick:()=>j?void E():n(!1),variant:"outline",children:j?i("cancelMove"):i("cancel")}),(0,t.jsxs)(X.Button,{disabled:g||!j&&!k,onClick:()=>j?void N():void T(),children:[g&&(0,t.jsx)(ed.Spinner,{}),j?i("stashAndContinue"):i("moveWorktree")]})]})]})})}function to({props:e,open:a,onOpenChange:s}){let n=(0,M.useTranslations)("worktrees"),[i,l]=(0,r.useState)(!1),[o,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=!!(e.worktree.branch&&(e.group.codebase.remoteBranches.includes(e.worktree.branch)||e.worktree.upstream===`origin/${e.worktree.branch}`)),m=e.worktree.branch===e.group.codebase.defaultBranch,g=async()=>{d(!0),u(null);try{let t=await (0,eb.controlPlaneRequest)(`mutation DeleteWorktree($input: DeleteWorktreeInput!) {
109
+ }`,{id:j.id}),await e.onReload(),n(!1)}catch(e){b(e instanceof Error?e.message:String(e))}finally{p(!1)}}};return(0,t.jsx)(er.Dialog,{onOpenChange:e=>!m&&n(e),open:s,children:(0,t.jsxs)(er.DialogContent,{className:"sm:max-w-xl",children:[(0,t.jsxs)(er.DialogHeader,{children:[(0,t.jsx)(er.DialogTitle,{children:i("moveToAgent")}),(0,t.jsx)(er.DialogDescription,{children:i("moveDescription",{branch:e.worktree.branch??""})})]}),j?(0,t.jsx)(Y.Alert,{children:(0,t.jsxs)(Y.AlertDescription,{className:"space-y-3",children:[(0,t.jsx)("p",{children:j.error||i("moveNeedsStash")}),(0,t.jsx)("p",{className:"text-muted-foreground",children:i("moveStashHelp")})]})}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(el.Label,{className:"mb-1.5 block",children:i("destinationAgent")}),(0,t.jsx)(ed.SearchableSelect,{ariaLabel:i("destinationAgent"),disabled:m,emptyMessage:i("noMoveDestinations"),onValueChange:e=>{d(e),u("__new__")},options:w,placeholder:i("selectDestinationAgent"),searchPlaceholder:i("searchDestinationAgents"),value:v})]}),k&&(0,t.jsxs)("div",{children:[(0,t.jsx)(el.Label,{className:"mb-1.5 block",children:i("destinationWorktree")}),(0,t.jsxs)(eu.Select,{disabled:m,onValueChange:u,value:c,children:[(0,t.jsx)(eu.SelectTrigger,{"aria-label":i("destinationWorktree"),children:(0,t.jsx)(eu.SelectValue,{})}),(0,t.jsxs)(eu.SelectContent,{children:[(0,t.jsx)(eu.SelectItem,{disabled:!!y,value:"__new__",children:i("createDestinationWorktree")}),k.group.worktrees.filter(e=>"AVAILABLE"===e.availability).map(e=>(0,t.jsxs)(eu.SelectItem,{disabled:!!y&&y.id!==e.id,value:e.id,children:[e.branch??i("detached")," ·"," ",e.relativePath]},e.id))]})]})]}),S&&(S.hasStagedChanges||S.hasUnstagedChanges)&&(0,t.jsx)(Y.Alert,{children:(0,t.jsx)(Y.AlertDescription,{children:i("dirtyDestinationWarning")})}),(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(et.Checkbox,{checked:h,disabled:!C||m,id:`delete-source-${e.worktree.id}`,onCheckedChange:e=>g(!!e)}),(0,t.jsxs)("div",{children:[(0,t.jsx)(el.Label,{htmlFor:`delete-source-${e.worktree.id}`,children:i("deleteOldWorktree")}),!C&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:i("deleteOldWorktreeDisabled")})]})]})]}),x&&(0,t.jsx)(Y.Alert,{variant:"destructive",children:(0,t.jsx)(Y.AlertDescription,{children:x})}),(0,t.jsxs)(er.DialogFooter,{children:[(0,t.jsx)(Z.Button,{disabled:m,onClick:()=>j?void E():n(!1),variant:"outline",children:j?i("cancelMove"):i("cancel")}),(0,t.jsxs)(Z.Button,{disabled:m||!j&&!k,onClick:()=>j?void N():void T(),children:[m&&(0,t.jsx)(ec.Spinner,{}),j?i("stashAndContinue"):i("moveWorktree")]})]})]})})}function td({props:e,open:a,onOpenChange:s}){let n=(0,$.useTranslations)("worktrees"),[i,l]=(0,r.useState)(!1),[o,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=!!(e.worktree.branch&&(e.group.codebase.remoteBranches.includes(e.worktree.branch)||e.worktree.upstream===`origin/${e.worktree.branch}`)),g=e.worktree.branch===e.group.codebase.defaultBranch,m=async()=>{d(!0),u(null);try{let t=await (0,ej.controlPlaneRequest)(`mutation DeleteWorktree($input: DeleteWorktreeInput!) {
110
110
  deleteWorktree(input: $input) { id }
111
- }`,{input:{worktreeId:e.worktree.id,deleteRemoteBranch:i,requestId:(0,eg.createClientId)()}});await (0,eC.waitForWorktreeJob)(t.deleteWorktree.id),await e.onReload(),e.onError(null),e.onDeleted?.(),s(!1)}catch(e){u(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,t.jsx)(et.Dialog,{onOpenChange:e=>!o&&s(e),open:a,children:(0,t.jsxs)(et.DialogContent,{children:[(0,t.jsxs)(et.DialogHeader,{children:[(0,t.jsx)(et.DialogTitle,{children:n("deleteWorktree")}),(0,t.jsx)(et.DialogDescription,{children:n("deleteWorktreeDescription",{path:eU(e.worktree.folder,e.baseRepoDirectory)})})]}),(0,t.jsx)(Q.Alert,{variant:"destructive",children:(0,t.jsx)(Q.AlertDescription,{children:n("deleteWorktreeWarning")})}),h&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(ee.Checkbox,{checked:i,disabled:o||m,id:`delete-remote-${e.worktree.id}`,onCheckedChange:e=>l(!!e)}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ei.Label,{htmlFor:`delete-remote-${e.worktree.id}`,children:n("deleteRemoteBranch",{branch:e.worktree.branch??""})}),m&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:n("defaultRemoteProtected")})]})]}),c&&(0,t.jsx)(Q.Alert,{variant:"destructive",children:(0,t.jsx)(Q.AlertDescription,{children:c})}),(0,t.jsxs)(et.DialogFooter,{children:[(0,t.jsx)(X.Button,{disabled:o,onClick:()=>s(!1),variant:"outline",children:n("cancel")}),(0,t.jsxs)(X.Button,{disabled:o,onClick:()=>void g(),variant:"destructive",children:[o&&(0,t.jsx)(ed.Spinner,{}),n("deleteWorktree")]})]})]})})}function td(e){let{worktree:r}=e,{appId:a}=e,s=(0,M.useTranslations)("worktrees"),n=e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id))?.agent,i=n?.connectionStatus==="ONLINE"&&n.capabilities.includes("ios.build.run")&&!1===e.group.iosBuildConfigured,l="AVAILABLE"!==r.availability||!n||"ONLINE"!==n.connectionStatus||!n.capabilities.includes("ios.build.run")||!1===e.group.iosBuildConfigured,o="AVAILABLE"!==r.availability||!n||"ONLINE"!==n.connectionStatus;return(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(_.StartBuildButton,{buildSettingsHref:i?`/codebases/repositories/${e.group.repository.id}`:void 0,codebaseId:e.group.codebase.id,disabled:l,disabledReason:n&&"ONLINE"===n.connectionStatus?n.capabilities.includes("ios.build.run")?!1===e.group.iosBuildConfigured?s("iosBuildNotConfigured"):"AVAILABLE"!==r.availability?s("worktreeUnavailable"):null:s("agentUnsupported"):s("agentOffline"),onStarted:()=>void e.onCompleted(),worktreeId:r.id}),o?(0,t.jsxs)(X.Button,{disabled:!0,size:"sm",variant:"outline",children:[(0,t.jsx)(B.Terminal,{})," ",s("newSession")]}):(0,t.jsx)(X.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,t.jsxs)(ef.Link,{href:`/runs/new?kind=session&worktree=${r.id}${a?`&app=${encodeURIComponent(a)}`:""}`,children:[(0,t.jsx)(B.Terminal,{})," ",s("newSession")]})}),o?(0,t.jsxs)(X.Button,{disabled:!0,size:"sm",variant:"outline",children:[(0,t.jsx)(u.ClipboardList,{})," ",s("newPlan")]}):(0,t.jsx)(X.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,t.jsxs)(ef.Link,{href:`/runs/new?kind=plan&worktree=${r.id}${a?`&app=${encodeURIComponent(a)}`:""}`,children:[(0,t.jsx)(u.ClipboardList,{})," ",s("newPlan")]})})]})}function tc(e){let{worktree:r}=e,a=(0,M.useTranslations)("worktrees"),n="AVAILABLE"!==r.availability||!!e.group.blockingJob||r.rebaseInProgress,i=eF(r);return(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(td,{...e}),(0,t.jsx)(th,{icon:(0,t.jsx)(m.Download,{}),label:a("pull"),operation:"PULL",props:e,disabled:n||!r.upstream||0===r.behind}),(0,t.jsx)(th,{confirm:!0,icon:(0,t.jsx)(N.RefreshCw,{}),label:a("sync"),operation:"SYNC",props:e,disabled:n||!r.upstream||!r.baseBranch||0===r.baseBehind}),(0,t.jsx)(th,{confirm:!0,icon:(0,t.jsx)(j.GitMerge,{}),label:a("rebase"),operation:"REBASE",props:e,disabled:n||!r.baseBranch||0===r.baseBehind}),(0,t.jsx)(th,{icon:(0,t.jsx)(P.Upload,{}),label:a(r.upstream?"push":"publish"),operation:"PUSH",props:e,disabled:n||!r.branch}),(0,t.jsx)(U.AutoSyncButton,{conflictWorkflows:e.group.mergeConflictQuickActions??[],disabled:n||!r.upstream||!r.baseBranch,onCompleted:e.onCompleted,onError:e.onError,worktree:r}),(0,t.jsx)(U.AutoMergeButton,{conflictWorkflows:e.group.mergeConflictQuickActions??[],disabled:n,onCompleted:e.onCompleted,onError:e.onError,worktree:r}),(0,t.jsxs)(er.DropdownMenu,{children:[(0,t.jsx)(er.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(X.Button,{size:"sm",variant:"outline",children:[(0,t.jsx)(S.MoreHorizontal,{})," ",a("moreActions")]})}),(0,t.jsxs)(er.DropdownMenuContent,{align:"end",children:[(0,t.jsx)(tm,{confirm:!0,icon:(0,t.jsx)(P.Upload,{}),label:a("forcePush"),operation:"FORCE_PUSH",props:e,disabled:n||!r.upstream}),(0,t.jsx)(tm,{confirm:!0,icon:(0,t.jsx)(E.RotateCcw,{}),label:a("reset"),operation:"RESET",props:e,disabled:n||!r.upstream}),(0,t.jsx)(tm,{confirm:!0,icon:(0,t.jsx)(w.LockOpen,{}),label:a("clearLock"),operation:"CLEAR_LOCK",props:e,disabled:n}),(0,t.jsx)(tm,{icon:(0,t.jsx)(s.Archive,{}),label:a("stashAll"),operation:"STASH_ALL",props:e,disabled:n||!i.hasChanges}),(0,t.jsx)(tm,{icon:(0,t.jsx)(o.Check,{}),label:a("UNSTAGE_ALL"===i.stageOperation?"unstageAll":"stageAll"),operation:i.stageOperation,props:e,disabled:n||!i.hasChanges})]})]}),r.activeJob&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,t.jsx)(ed.Spinner,{})," ",a("operationRunning")]})]})}function tu({props:e,operation:t,confirm:a=!1}){let s=(0,M.useTranslations)("worktrees"),[n,i]=(0,r.useState)(!1),[l,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(!1),u=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);let h=async()=>{if(a&&!n){i(!0),u.current=window.setTimeout(()=>i(!1),5e3);return}o(!0),i(!1);try{let r=await (0,eb.controlPlaneRequest)("mutation RunWorktreeOperation($input: RunWorktreeOperationInput!) { runWorktreeOperation(input: $input) { id } }",{input:{worktreeId:e.worktree.id,operation:t,requestId:(0,eg.createClientId)(),...d?{forcePreparations:!0}:{}}});e.onError(null),await e.onCompleted();let a=await (0,eC.waitForWorktreeOperationJob)(r.runWorktreeOperation.id);if(await e.onCompleted(),a?.outcome==="PREPARATION_CONFLICT"){c(!0),i(!0),e.onError(s("preparationConflict",{paths:a.preparationConflictPaths.join(", ")}));return}c(!1)}catch(t){try{await e.onCompleted()}catch{}e.onError(t instanceof Error?t.message:String(t))}finally{o(!1)}};return{armed:n,busy:l,forcePreparations:d,run:h}}function th({props:e,operation:r,label:a,icon:s,confirm:n=!1,disabled:i=!1}){let l=(0,M.useTranslations)("worktrees"),{armed:d,busy:c,forcePreparations:u,run:h}=tu({props:e,operation:r,confirm:n});return(0,t.jsxs)(X.Button,{disabled:i||c,onClick:()=>void h(),size:"sm",variant:d?"destructive":"outline",children:[c?(0,t.jsx)(ed.Spinner,{}):d?(0,t.jsx)(o.Check,{}):s," ",d?l(u?"forcePreparationOperation":"confirmAction"):a]})}function tm({props:e,operation:r,label:a,icon:s,confirm:n=!1,disabled:i=!1}){let l=(0,M.useTranslations)("worktrees"),{armed:d,busy:c,run:u}=tu({props:e,operation:r,confirm:n});return(0,t.jsxs)(er.DropdownMenuItem,{disabled:i||c,onSelect:e=>{n&&!d&&e.preventDefault(),u()},variant:d?"destructive":"default",children:[c?(0,t.jsx)(ed.Spinner,{}):d?(0,t.jsx)(o.Check,{}):s,d?l("confirmAction"):a]})}function tg(e){let a=(0,M.useTranslations)("worktrees");return(0,t.jsx)("div",{className:"rounded-xl border",children:(0,t.jsxs)(eu.Table,{children:[(0,t.jsx)(eu.TableHeader,{children:(0,t.jsxs)(eu.TableRow,{children:[(0,t.jsx)(eu.TableHead,{children:a("branch")}),(0,t.jsx)(eu.TableHead,{children:a("path")}),(0,t.jsx)(eu.TableHead,{children:a("baseBranch")}),(0,t.jsx)(eu.TableHead,{children:a("upToDate")}),(0,t.jsx)(eu.TableHead,{children:a("tags")}),(0,t.jsx)(eu.TableHead,{children:a("pullRequest")}),(0,t.jsx)(eu.TableHead,{children:a("origin")}),(0,t.jsx)(eu.TableHead,{})]})}),(0,t.jsx)(eu.TableBody,{children:e.group.worktrees.map(t=>(0,r.createElement)(tp,{...e,key:t.id,worktree:t}))})]})})}function tp(e){let{baseRepoDirectory:a,inspectionRefreshToken:s,onError:n}=e,{worktree:i,applyActivity:l,setUnstagedChanges:o}=(0,ey.useLiveWorktree)(e.worktree),u={...e,worktree:i},h=(0,M.useTranslations)("worktrees"),m=(0,ef.useRouter)(),[g,p]=(0,r.useState)(!1),[x,b]=(0,r.useState)(null),[j,f]=(0,r.useState)(!1),v=(0,r.useRef)(0),k=(0,r.useRef)(s),w=(0,r.useCallback)(async()=>{let e=++v.current;f(!0);try{let t=await (0,ey.inspectWorktree)(i.id);if(e!==v.current)return;b(t),o(t.changes.some(e=>e.unstaged||e.untracked||e.conflicted)),n(null)}catch(t){e===v.current&&n(t instanceof Error?t.message:String(t))}finally{e===v.current&&f(!1)}},[n,o,i.id]),S=(0,ey.useQueuedWorktreeInspection)(w),y=(0,r.useCallback)(e=>{l(e),g&&S()},[l,g,S]);(0,ey.useWorktreeActivitySubscription)(i.id,e.liveUpdatesEnabled&&"AVAILABLE"===i.availability,y),(0,r.useEffect)(()=>{if(k.current===s||(k.current=s,!g))return;let e=window.setTimeout(()=>void S(),0);return()=>window.clearTimeout(e)},[g,s,S]);let C=()=>{let e=!g;p(e),e&&!x&&S()},I=i.highlightColor&&ex.worktreeHighlightSurfaceClasses[i.highlightColor];return(0,t.jsxs)(r.Fragment,{children:[(0,t.jsxs)(eu.TableRow,{className:(0,ej.cn)("cursor-pointer transition-colors hover:bg-muted/50",I),onClick:e=>{(0,eT.shouldNavigateWorktreeSurface)(e)&&m.push((0,eT.worktreeDetailHref)(i.id))},children:[(0,t.jsxs)(eu.TableCell,{children:[(0,t.jsxs)(X.Button,{"aria-expanded":g,className:"max-w-full px-0 font-mono",onClick:()=>void C(),variant:"ghost",children:[g?(0,t.jsx)(d.ChevronDown,{}):(0,t.jsx)(c.ChevronRight,{}),(0,t.jsx)("span",{className:"truncate",children:i.branch??h("detached")})]}),(i.ticketKey||i.ticketTitle)&&(0,t.jsx)(e4,{...u,compact:!0})]}),(0,t.jsx)(eu.TableCell,{className:"font-mono text-xs",children:eU(i.folder,a)}),(0,t.jsx)(eu.TableCell,{children:(0,t.jsx)(ta,{...u,compact:!0})}),(0,t.jsx)(eu.TableCell,{children:(0,t.jsx)(e9,{worktree:i})}),(0,t.jsx)(eu.TableCell,{children:(0,t.jsx)(e8,{...u,compact:!0})}),(0,t.jsx)(eu.TableCell,{children:(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:(0,t.jsx)(te,{detailsExpanded:g,onToggleDetails:C,worktree:i})})}),(0,t.jsx)(eu.TableCell,{children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,t.jsx)(tr,{worktree:i}),eM(i)&&(0,t.jsx)(Y.Badge,{variant:"destructive",children:h("dirty")})]})}),(0,t.jsx)(eu.TableCell,{children:(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,t.jsx)(e2,{worktree:i}),(0,t.jsx)(tn,{...u})]})})]}),i.rebaseInProgress&&(0,t.jsx)(eu.TableRow,{className:(0,ej.cn)(I),children:(0,t.jsx)(eu.TableCell,{colSpan:8,children:(0,t.jsx)(eI.WorktreeRebaseConflictItem,{group:e.group,onCompleted:e.onReload,onError:e.onError,worktree:i})})}),(0,t.jsx)(eu.TableRow,{className:(0,ej.cn)(I),children:(0,t.jsx)(eu.TableCell,{colSpan:8,children:(0,t.jsx)(tc,{...u,onCompleted:async()=>{await e.onReload(),g&&await S()}})})}),g&&(0,t.jsx)(eu.TableRow,{className:(0,ej.cn)(I),children:(0,t.jsx)(eu.TableCell,{colSpan:8,children:j&&!x?(0,t.jsx)(ed.Spinner,{}):x?(0,t.jsx)(ew.WorktreeDetailPanel,{detail:x,inline:!0,worktreeId:i.id}):null})})]})}function tx({tag:e}){return(0,t.jsx)(Y.Badge,{className:eV[e.color],children:e.name})}function tb({label:e,value:r,mono:a=!1}){return(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e}),(0,t.jsx)("p",{className:(0,ej.cn)("flex min-h-6 items-center truncate",a&&"font-mono text-xs"),title:r,children:r})]})}function tj({open:e,onOpenChange:a,tags:s,onChanged:n}){let i=(0,M.useTranslations)("worktrees"),[l,o]=(0,r.useState)(null),[d,c]=(0,r.useState)(""),[u,h]=(0,r.useState)("blue"),[m,g]=(0,r.useState)(null),p=async e=>{e.preventDefault();try{await (0,eb.controlPlaneRequest)("mutation SaveTag($input: SaveWorktreeTagInput!) { saveWorktreeTag(input: $input) { id } }",{input:{id:l?.id??null,name:d,color:u}}),o(null),c(""),h("blue"),g(null),await n()}catch(e){g(e instanceof Error?e.message:String(e))}},x=async e=>{try{await (0,eb.controlPlaneRequest)("mutation DeleteTag($id: ID!) { deleteWorktreeTag(id: $id) }",{id:e}),await n()}catch(e){g(e instanceof Error?e.message:String(e))}};return(0,t.jsx)(et.Dialog,{onOpenChange:a,open:e,children:(0,t.jsxs)(et.DialogContent,{children:[(0,t.jsxs)(et.DialogHeader,{children:[(0,t.jsx)(et.DialogTitle,{children:i("manageTags")}),(0,t.jsx)(et.DialogDescription,{children:i("manageTagsDescription")})]}),m&&(0,t.jsx)(Q.Alert,{variant:"destructive",children:(0,t.jsx)(Q.AlertDescription,{children:m})}),(0,t.jsx)(en.ItemGroup,{className:"gap-2",children:s.map(e=>(0,t.jsxs)(en.Item,{size:"sm",variant:"outline",children:[(0,t.jsx)(en.ItemContent,{children:(0,t.jsx)(en.ItemTitle,{children:(0,t.jsx)(tx,{tag:e})})}),(0,t.jsxs)(en.ItemActions,{children:[(0,t.jsx)(X.Button,{onClick:()=>{o(e),c(e.name),h(e.color)},size:"sm",variant:"outline",children:i("edit")}),(0,t.jsx)(X.Button,{onClick:()=>void x(e.id),size:"icon-sm",variant:"destructive",children:(0,t.jsx)(W.Trash2,{})})]})]},e.id))}),(0,t.jsxs)("form",{className:"space-y-3 border-t pt-3",onSubmit:p,children:[(0,t.jsx)(ei.Label,{htmlFor:"tag-name",children:l?i("editTag"):i("createTag")}),(0,t.jsx)(es.Input,{id:"tag-name",maxLength:40,onChange:e=>c(e.target.value),required:!0,value:d}),(0,t.jsx)(eh.ToggleGroup,{"aria-label":i("highlight"),className:"grid w-full grid-cols-12 gap-1",onValueChange:e=>{e&&h(e)},size:"sm",spacing:1,type:"single",value:u,variant:"outline",children:eN.map(e=>(0,t.jsx)(eh.ToggleGroupItem,{"aria-label":e,className:(0,ej.cn)("aspect-square h-auto w-full min-w-0 p-0",eG[e],eK[e],"data-[state=on]:ring-2 data-[state=on]:ring-foreground"),value:e},e))}),(0,t.jsx)(et.DialogFooter,{children:(0,t.jsxs)(X.Button,{type:"submit",children:[(0,t.jsx)(A.Save,{})," ",i("saveTag")]})})]})]})})}function tf({appId:e,open:a,onOpenChange:n,onChanged:i}){let l=(0,M.useTranslations)("worktrees"),[o,d]=(0,r.useState)([]),[c,u]=(0,r.useState)(null),h=(0,r.useCallback)(async()=>{try{let t=await (0,eb.controlPlaneRequest)(`query HiddenWorktrees($appId: ID) { hiddenWorktrees(appId: $appId) { ${eS.WORKTREE_FIELDS} } }`,{appId:e??null});d(t.hiddenWorktrees),u(null)}catch(e){u(e instanceof Error?e.message:String(e))}},[e]);(0,r.useEffect)(()=>{if(!a)return;let e=window.setTimeout(()=>void h(),0);return()=>window.clearTimeout(e)},[a,h]);let m=async e=>{try{await (0,eb.controlPlaneRequest)(e?"mutation PurgeHidden($id: ID!) { purgeHiddenWorktree(id: $id) }":"mutation PurgeAllHidden { purgeAllHiddenWorktrees }",e?{id:e}:void 0),await h(),await i()}catch(e){u(e instanceof Error?e.message:String(e))}};return(0,t.jsx)(et.Dialog,{onOpenChange:n,open:a,children:(0,t.jsxs)(et.DialogContent,{className:"sm:max-w-3xl",children:[(0,t.jsxs)(et.DialogHeader,{children:[(0,t.jsx)(et.DialogTitle,{children:l("hiddenTitle")}),(0,t.jsx)(et.DialogDescription,{children:l("hiddenDescription")})]}),c&&(0,t.jsx)(Q.Alert,{variant:"destructive",children:(0,t.jsx)(Q.AlertDescription,{children:c})}),(0,t.jsx)("div",{className:"max-h-96 overflow-y-auto",children:o.length?(0,t.jsx)(en.ItemGroup,{className:"gap-2",children:o.map(e=>(0,t.jsxs)(en.Item,{variant:"outline",children:[(0,t.jsx)(en.ItemMedia,{variant:"icon",children:(0,t.jsx)(x.GitBranch,{})}),(0,t.jsxs)(en.ItemContent,{className:"min-w-0",children:[(0,t.jsx)(en.ItemTitle,{className:"font-mono",children:e.branch??l("detached")}),(0,t.jsx)(en.ItemDescription,{className:"truncate",title:e.folder,children:e.folder})]}),(0,t.jsx)(en.ItemActions,{children:(0,t.jsxs)(X.Button,{onClick:()=>void m(e.id),size:"sm",variant:"destructive",children:[(0,t.jsx)(W.Trash2,{})," ",l("purge")]})})]},e.id))}):(0,t.jsx)(ea.Empty,{className:"border-0 py-8",children:(0,t.jsxs)(ea.EmptyHeader,{children:[(0,t.jsx)(ea.EmptyMedia,{variant:"icon",children:(0,t.jsx)(s.Archive,{})}),(0,t.jsx)(ea.EmptyTitle,{children:l("noHidden")})]})})}),(0,t.jsx)(et.DialogFooter,{children:o.length>0&&!e&&(0,t.jsxs)(X.Button,{onClick:()=>void m(),variant:"destructive",children:[(0,t.jsx)(W.Trash2,{})," ",l("purgeAll")]})})]})})}e.s(["ActionRow",0,tc,"BaseBranchControl",0,ta,"BaseFreshnessBadge",0,e9,"OriginStatusBadges",0,tr,"PrimaryWorktreeActions",0,td,"PullRequestBadges",0,te,"TagManagerDialog",0,tj,"WorktreeMenus",0,tn,"WorktreeMetadata",0,e7,"WorktreeTagsMenu",0,e8,"WorktreeTicketLink",0,e4,"WorktreesPage",0,function({appId:e}){let n=(0,M.useTranslations)("worktrees"),[i,l]=(0,r.useState)(()=>new URLSearchParams(window.location.search).get("issue")),[o,d]=(0,r.useState)(null),[c,u]=(0,r.useState)(()=>"table"===window.localStorage.getItem(eE)?"table":"cards"),[h,m]=(0,r.useState)(()=>"repository"===window.localStorage.getItem(eA)?"repository":"agent"),[g,p]=(0,r.useState)(!0),[b,j]=(0,r.useState)(!1),[f,w]=(0,r.useState)(null),[S,y]=(0,r.useState)(null),[C,I]=(0,r.useState)(0),[T,E]=(0,r.useState)(!1),[A,R]=(0,r.useState)(!1),[B]=(0,r.useState)(()=>(function(e){let t={query:"",agentId:eR,repositoryId:eR,changes:eR,branches:eR};try{let r=window.localStorage.getItem(eL(e));if(!r)return t;let a=JSON.parse(r);if(!a||"object"!=typeof a)return t;return{query:"string"==typeof a.query?a.query:t.query,agentId:"string"==typeof a.agentId?a.agentId:t.agentId,repositoryId:"string"==typeof a.repositoryId?a.repositoryId:t.repositoryId,changes:a.changes===eB||a.changes===eW?a.changes:t.changes,branches:a.branches===eP?a.branches:t.branches}}catch{return t}})(e)),[W,L]=(0,r.useState)(B.query),[$,O]=(0,r.useState)(B.agentId),[q,_]=(0,r.useState)(B.repositoryId),[U,F]=(0,r.useState)(B.changes),[H,V]=(0,r.useState)(B.branches),G=(0,r.useRef)(0),K=(0,r.useRef)(null),Y=(0,r.useCallback)(()=>K.current?.refresh()??Promise.resolve(),[]),Z=(0,r.useCallback)(async t=>{let r=++G.current;try{let a=await (0,eb.controlPlaneRequest)(`query WorktreeOverview($appId: ID) {
111
+ }`,{input:{worktreeId:e.worktree.id,deleteRemoteBranch:i,requestId:(0,ep.createClientId)()}});await (0,eI.waitForWorktreeJob)(t.deleteWorktree.id),await e.onReload(),e.onError(null),e.onDeleted?.(),s(!1)}catch(e){u(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,t.jsx)(er.Dialog,{onOpenChange:e=>!o&&s(e),open:a,children:(0,t.jsxs)(er.DialogContent,{children:[(0,t.jsxs)(er.DialogHeader,{children:[(0,t.jsx)(er.DialogTitle,{children:n("deleteWorktree")}),(0,t.jsx)(er.DialogDescription,{children:n("deleteWorktreeDescription",{path:eF(e.worktree.folder,e.baseRepoDirectory)})})]}),(0,t.jsx)(Y.Alert,{variant:"destructive",children:(0,t.jsx)(Y.AlertDescription,{children:n("deleteWorktreeWarning")})}),h&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(et.Checkbox,{checked:i,disabled:o||g,id:`delete-remote-${e.worktree.id}`,onCheckedChange:e=>l(!!e)}),(0,t.jsxs)("div",{children:[(0,t.jsx)(el.Label,{htmlFor:`delete-remote-${e.worktree.id}`,children:n("deleteRemoteBranch",{branch:e.worktree.branch??""})}),g&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:n("defaultRemoteProtected")})]})]}),c&&(0,t.jsx)(Y.Alert,{variant:"destructive",children:(0,t.jsx)(Y.AlertDescription,{children:c})}),(0,t.jsxs)(er.DialogFooter,{children:[(0,t.jsx)(Z.Button,{disabled:o,onClick:()=>s(!1),variant:"outline",children:n("cancel")}),(0,t.jsxs)(Z.Button,{disabled:o,onClick:()=>void m(),variant:"destructive",children:[o&&(0,t.jsx)(ec.Spinner,{}),n("deleteWorktree")]})]})]})})}function tc(e){let{worktree:r}=e,{appId:a}=e,s=(0,$.useTranslations)("worktrees"),n=e.overview.agents.find(t=>t.codebases.some(t=>t.codebase.id===e.group.codebase.id))?.agent,i=n?.connectionStatus==="ONLINE"&&n.capabilities.includes("ios.build.run")&&!1===e.group.iosBuildConfigured,l="AVAILABLE"!==r.availability||!n||"ONLINE"!==n.connectionStatus||!n.capabilities.includes("ios.build.run")||!1===e.group.iosBuildConfigured,o="AVAILABLE"!==r.availability||!n||"ONLINE"!==n.connectionStatus;return(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(U.StartBuildButton,{buildSettingsHref:i?`/codebases/repositories/${e.group.repository.id}`:void 0,codebaseId:e.group.codebase.id,disabled:l,disabledReason:n&&"ONLINE"===n.connectionStatus?n.capabilities.includes("ios.build.run")?!1===e.group.iosBuildConfigured?s("iosBuildNotConfigured"):"AVAILABLE"!==r.availability?s("worktreeUnavailable"):null:s("agentUnsupported"):s("agentOffline"),onStarted:()=>void e.onCompleted(),worktreeId:r.id}),o?(0,t.jsxs)(Z.Button,{disabled:!0,size:"sm",variant:"outline",children:[(0,t.jsx)(W.Terminal,{})," ",s("newSession")]}):(0,t.jsx)(Z.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,t.jsxs)(ev.Link,{href:`/runs/new?kind=session&worktree=${r.id}${a?`&app=${encodeURIComponent(a)}`:""}`,children:[(0,t.jsx)(W.Terminal,{})," ",s("newSession")]})}),o?(0,t.jsxs)(Z.Button,{disabled:!0,size:"sm",variant:"outline",children:[(0,t.jsx)(h.ClipboardList,{})," ",s("newPlan")]}):(0,t.jsx)(Z.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,t.jsxs)(ev.Link,{href:`/runs/new?kind=plan&worktree=${r.id}${a?`&app=${encodeURIComponent(a)}`:""}`,children:[(0,t.jsx)(h.ClipboardList,{})," ",s("newPlan")]})})]})}function tu(e){let{worktree:r}=e,a=(0,$.useTranslations)("worktrees"),s="AVAILABLE"!==r.availability||!!e.group.blockingJob||r.rebaseInProgress,i=eH(r);return(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(tc,{...e}),(0,t.jsx)(tg,{icon:(0,t.jsx)(m.Download,{}),label:a("pull"),operation:"PULL",props:e,disabled:s||!r.upstream||0===r.behind}),(0,t.jsx)(tg,{confirm:!0,icon:(0,t.jsx)(E.RefreshCw,{}),label:a("sync"),operation:"SYNC",props:e,disabled:s||!r.upstream||!r.baseBranch||0===r.baseBehind}),(0,t.jsx)(tg,{confirm:!0,icon:(0,t.jsx)(f.GitMerge,{}),label:a("rebase"),operation:"REBASE",props:e,disabled:s||!r.baseBranch||0===r.baseBehind}),(0,t.jsx)(tg,{icon:(0,t.jsx)(L.Upload,{}),label:a(r.upstream?"push":"publish"),operation:"PUSH",props:e,disabled:s||!r.branch}),(0,t.jsx)(F.AutoSyncButton,{conflictWorkflows:e.group.mergeConflictQuickActions??[],disabled:s||!r.upstream||!r.baseBranch,onCompleted:e.onCompleted,onError:e.onError,worktree:r}),(0,t.jsx)(F.AutoMergeButton,{conflictWorkflows:e.group.mergeConflictQuickActions??[],disabled:s,onCompleted:e.onCompleted,onError:e.onError,worktree:r}),(0,t.jsxs)(ea.DropdownMenu,{children:[(0,t.jsx)(ea.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(Z.Button,{size:"sm",variant:"outline",children:[(0,t.jsx)(y.MoreHorizontal,{})," ",a("moreActions")]})}),(0,t.jsxs)(ea.DropdownMenuContent,{align:"end",children:[(0,t.jsx)(tm,{confirm:!0,icon:(0,t.jsx)(L.Upload,{}),label:a("forcePush"),operation:"FORCE_PUSH",props:e,disabled:s||!r.upstream}),(0,t.jsx)(tm,{confirm:!0,icon:(0,t.jsx)(A.RotateCcw,{}),label:a("reset"),operation:"RESET",props:e,disabled:s||!r.upstream}),(0,t.jsx)(tm,{confirm:!0,icon:(0,t.jsx)(S.LockOpen,{}),label:a("clearLock"),operation:"CLEAR_LOCK",props:e,disabled:s}),(0,t.jsx)(tm,{icon:(0,t.jsx)(n.Archive,{}),label:a("stashAll"),operation:"STASH_ALL",props:e,disabled:s||!i.hasChanges}),(0,t.jsx)(tm,{icon:(0,t.jsx)(d.Check,{}),label:a("UNSTAGE_ALL"===i.stageOperation?"unstageAll":"stageAll"),operation:i.stageOperation,props:e,disabled:s||!i.hasChanges})]})]}),r.activeJob&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,t.jsx)(ec.Spinner,{})," ",a("operationRunning")]})]})}function th({props:e,operation:t,confirm:a=!1}){let s=(0,$.useTranslations)("worktrees"),[n,i]=(0,r.useState)(!1),[l,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(!1),u=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);let h=async()=>{if(a&&!n){i(!0),u.current=window.setTimeout(()=>i(!1),5e3);return}o(!0),i(!1);try{let r=await (0,ej.controlPlaneRequest)("mutation RunWorktreeOperation($input: RunWorktreeOperationInput!) { runWorktreeOperation(input: $input) { id } }",{input:{worktreeId:e.worktree.id,operation:t,requestId:(0,ep.createClientId)(),...d?{forcePreparations:!0}:{}}});e.onError(null),await e.onCompleted();let a=await (0,eI.waitForWorktreeOperationJob)(r.runWorktreeOperation.id);if(await e.onCompleted(),a?.outcome==="PREPARATION_CONFLICT"){c(!0),i(!0),e.onError(s("preparationConflict",{paths:a.preparationConflictPaths.join(", ")}));return}c(!1)}catch(t){try{await e.onCompleted()}catch{}e.onError(t instanceof Error?t.message:String(t))}finally{o(!1)}};return{armed:n,busy:l,forcePreparations:d,run:h}}function tg({props:e,operation:r,label:a,icon:s,confirm:n=!1,disabled:i=!1}){let l=(0,$.useTranslations)("worktrees"),{armed:o,busy:c,forcePreparations:u,run:h}=th({props:e,operation:r,confirm:n});return(0,t.jsxs)(Z.Button,{disabled:i||c,onClick:()=>void h(),size:"sm",variant:o?"destructive":"outline",children:[c?(0,t.jsx)(ec.Spinner,{}):o?(0,t.jsx)(d.Check,{}):s," ",o?l(u?"forcePreparationOperation":"confirmAction"):a]})}function tm({props:e,operation:r,label:a,icon:s,confirm:n=!1,disabled:i=!1}){let l=(0,$.useTranslations)("worktrees"),{armed:o,busy:c,run:u}=th({props:e,operation:r,confirm:n});return(0,t.jsxs)(ea.DropdownMenuItem,{disabled:i||c,onSelect:e=>{n&&!o&&e.preventDefault(),u()},variant:o?"destructive":"default",children:[c?(0,t.jsx)(ec.Spinner,{}):o?(0,t.jsx)(d.Check,{}):s,o?l("confirmAction"):a]})}function tp(e){let a=(0,$.useTranslations)("worktrees");return(0,t.jsx)("div",{className:"rounded-xl border",children:(0,t.jsxs)(eh.Table,{children:[(0,t.jsx)(eh.TableHeader,{children:(0,t.jsxs)(eh.TableRow,{children:[(0,t.jsx)(eh.TableHead,{children:a("branch")}),(0,t.jsx)(eh.TableHead,{children:a("path")}),(0,t.jsx)(eh.TableHead,{children:a("baseBranch")}),(0,t.jsx)(eh.TableHead,{children:a("upToDate")}),(0,t.jsx)(eh.TableHead,{children:a("tags")}),(0,t.jsx)(eh.TableHead,{children:a("pullRequest")}),(0,t.jsx)(eh.TableHead,{children:a("origin")}),(0,t.jsx)(eh.TableHead,{})]})}),(0,t.jsx)(eh.TableBody,{children:e.group.worktrees.map(t=>(0,r.createElement)(tx,{...e,key:t.id,worktree:t}))})]})})}function tx(e){let{baseRepoDirectory:a,inspectionRefreshToken:s,onError:n}=e,{worktree:i,applyActivity:l,setUnstagedChanges:o}=(0,eC.useLiveWorktree)(e.worktree),d={...e,worktree:i},h=(0,$.useTranslations)("worktrees"),g=(0,ev.useRouter)(),[m,p]=(0,r.useState)(!1),[x,b]=(0,r.useState)(null),[j,f]=(0,r.useState)(!1),v=(0,r.useRef)(0),k=(0,r.useRef)(s),w=(0,r.useCallback)(async()=>{let e=++v.current;f(!0);try{let t=await (0,eC.inspectWorktree)(i.id);if(e!==v.current)return;b(t),o(t.changes.some(e=>e.unstaged||e.untracked||e.conflicted)),n(null)}catch(t){e===v.current&&n(t instanceof Error?t.message:String(t))}finally{e===v.current&&f(!1)}},[n,o,i.id]),S=(0,eC.useQueuedWorktreeInspection)(w),y=(0,r.useCallback)(e=>{l(e),m&&S()},[l,m,S]);(0,eC.useWorktreeActivitySubscription)(i.id,e.liveUpdatesEnabled&&"AVAILABLE"===i.availability,y),(0,r.useEffect)(()=>{if(k.current===s||(k.current=s,!m))return;let e=window.setTimeout(()=>void S(),0);return()=>window.clearTimeout(e)},[m,s,S]);let C=()=>{let e=!m;p(e),e&&!x&&S()},I=i.highlightColor&&eb.worktreeHighlightSurfaceClasses[i.highlightColor];return(0,t.jsxs)(r.Fragment,{children:[(0,t.jsxs)(eh.TableRow,{className:(0,ef.cn)("cursor-pointer transition-colors hover:bg-muted/50",I),onClick:e=>{(0,eN.shouldNavigateWorktreeSurface)(e)&&g.push((0,eN.worktreeDetailHref)(i.id))},children:[(0,t.jsxs)(eh.TableCell,{children:[(0,t.jsxs)(Z.Button,{"aria-expanded":m,className:"max-w-full px-0 font-mono",onClick:()=>void C(),variant:"ghost",children:[m?(0,t.jsx)(c.ChevronDown,{}):(0,t.jsx)(u.ChevronRight,{}),(0,t.jsx)("span",{className:"truncate",children:i.branch??h("detached")})]}),(i.ticketKey||i.ticketTitle)&&(0,t.jsx)(e7,{...d,compact:!0})]}),(0,t.jsx)(eh.TableCell,{className:"font-mono text-xs",children:eF(i.folder,a)}),(0,t.jsx)(eh.TableCell,{children:(0,t.jsx)(ts,{...d,compact:!0})}),(0,t.jsx)(eh.TableCell,{children:(0,t.jsx)(te,{worktree:i})}),(0,t.jsx)(eh.TableCell,{children:(0,t.jsx)(e9,{...d,compact:!0})}),(0,t.jsx)(eh.TableCell,{children:(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:(0,t.jsx)(tt,{detailsExpanded:m,onToggleDetails:C,worktree:i})})}),(0,t.jsx)(eh.TableCell,{children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,t.jsx)(ta,{worktree:i}),e$(i)&&(0,t.jsx)(X.Badge,{variant:"destructive",children:h("dirty")})]})}),(0,t.jsx)(eh.TableCell,{children:(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,t.jsx)(e4,{worktree:i}),(0,t.jsx)(ti,{...d})]})})]}),i.rebaseInProgress&&(0,t.jsx)(eh.TableRow,{className:(0,ef.cn)(I),children:(0,t.jsx)(eh.TableCell,{colSpan:8,children:(0,t.jsx)(eT.WorktreeRebaseConflictItem,{group:e.group,onCompleted:e.onReload,onError:e.onError,worktree:i})})}),(0,t.jsx)(eh.TableRow,{className:(0,ef.cn)(I),children:(0,t.jsx)(eh.TableCell,{colSpan:8,children:(0,t.jsx)(tu,{...d,onCompleted:async()=>{await e.onReload(),m&&await S()}})})}),m&&(0,t.jsx)(eh.TableRow,{className:(0,ef.cn)(I),children:(0,t.jsx)(eh.TableCell,{colSpan:8,children:j&&!x?(0,t.jsx)(ec.Spinner,{}):x?(0,t.jsx)(eS.WorktreeDetailPanel,{detail:x,inline:!0,worktreeId:i.id}):null})})]})}function tb({tag:e}){return(0,t.jsx)(X.Badge,{className:eG[e.color],children:e.name})}function tj({label:e,value:r,mono:a=!1}){return(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e}),(0,t.jsx)("p",{className:(0,ef.cn)("flex min-h-6 items-center truncate",a&&"font-mono text-xs"),title:r,children:r})]})}function tf({open:e,onOpenChange:a,tags:s,onChanged:n}){let i=(0,$.useTranslations)("worktrees"),[l,o]=(0,r.useState)(null),[d,c]=(0,r.useState)(""),[u,h]=(0,r.useState)("blue"),[g,m]=(0,r.useState)(null),p=async e=>{e.preventDefault();try{await (0,ej.controlPlaneRequest)("mutation SaveTag($input: SaveWorktreeTagInput!) { saveWorktreeTag(input: $input) { id } }",{input:{id:l?.id??null,name:d,color:u}}),o(null),c(""),h("blue"),m(null),await n()}catch(e){m(e instanceof Error?e.message:String(e))}},x=async e=>{try{await (0,ej.controlPlaneRequest)("mutation DeleteTag($id: ID!) { deleteWorktreeTag(id: $id) }",{id:e}),await n()}catch(e){m(e instanceof Error?e.message:String(e))}};return(0,t.jsx)(er.Dialog,{onOpenChange:a,open:e,children:(0,t.jsxs)(er.DialogContent,{children:[(0,t.jsxs)(er.DialogHeader,{children:[(0,t.jsx)(er.DialogTitle,{children:i("manageTags")}),(0,t.jsx)(er.DialogDescription,{children:i("manageTagsDescription")})]}),g&&(0,t.jsx)(Y.Alert,{variant:"destructive",children:(0,t.jsx)(Y.AlertDescription,{children:g})}),(0,t.jsx)(ei.ItemGroup,{className:"gap-2",children:s.map(e=>(0,t.jsxs)(ei.Item,{size:"sm",variant:"outline",children:[(0,t.jsx)(ei.ItemContent,{children:(0,t.jsx)(ei.ItemTitle,{children:(0,t.jsx)(tb,{tag:e})})}),(0,t.jsxs)(ei.ItemActions,{children:[(0,t.jsx)(Z.Button,{onClick:()=>{o(e),c(e.name),h(e.color)},size:"sm",variant:"outline",children:i("edit")}),(0,t.jsx)(Z.Button,{onClick:()=>void x(e.id),size:"icon-sm",variant:"destructive",children:(0,t.jsx)(P.Trash2,{})})]})]},e.id))}),(0,t.jsxs)("form",{className:"space-y-3 border-t pt-3",onSubmit:p,children:[(0,t.jsx)(el.Label,{htmlFor:"tag-name",children:l?i("editTag"):i("createTag")}),(0,t.jsx)(en.Input,{id:"tag-name",maxLength:40,onChange:e=>c(e.target.value),required:!0,value:d}),(0,t.jsx)(eg.ToggleGroup,{"aria-label":i("highlight"),className:"grid w-full grid-cols-12 gap-1",onValueChange:e=>{e&&h(e)},size:"sm",spacing:1,type:"single",value:u,variant:"outline",children:eE.map(e=>(0,t.jsx)(eg.ToggleGroupItem,{"aria-label":e,className:(0,ef.cn)("aspect-square h-auto w-full min-w-0 p-0",eK[e],ez[e],"data-[state=on]:ring-2 data-[state=on]:ring-foreground"),value:e},e))}),(0,t.jsx)(er.DialogFooter,{children:(0,t.jsxs)(Z.Button,{type:"submit",children:[(0,t.jsx)(D.Save,{})," ",i("saveTag")]})})]})]})})}function tv({appId:e,open:a,onOpenChange:s,onChanged:i}){let l=(0,$.useTranslations)("worktrees"),[o,d]=(0,r.useState)([]),[c,u]=(0,r.useState)(null),h=(0,r.useCallback)(async()=>{try{let t=await (0,ej.controlPlaneRequest)(`query HiddenWorktrees($appId: ID) { hiddenWorktrees(appId: $appId) { ${ey.WORKTREE_FIELDS} } }`,{appId:e??null});d(t.hiddenWorktrees),u(null)}catch(e){u(e instanceof Error?e.message:String(e))}},[e]);(0,r.useEffect)(()=>{if(!a)return;let e=window.setTimeout(()=>void h(),0);return()=>window.clearTimeout(e)},[a,h]);let g=async e=>{try{await (0,ej.controlPlaneRequest)(e?"mutation PurgeHidden($id: ID!) { purgeHiddenWorktree(id: $id) }":"mutation PurgeAllHidden { purgeAllHiddenWorktrees }",e?{id:e}:void 0),await h(),await i()}catch(e){u(e instanceof Error?e.message:String(e))}};return(0,t.jsx)(er.Dialog,{onOpenChange:s,open:a,children:(0,t.jsxs)(er.DialogContent,{className:"sm:max-w-3xl",children:[(0,t.jsxs)(er.DialogHeader,{children:[(0,t.jsx)(er.DialogTitle,{children:l("hiddenTitle")}),(0,t.jsx)(er.DialogDescription,{children:l("hiddenDescription")})]}),c&&(0,t.jsx)(Y.Alert,{variant:"destructive",children:(0,t.jsx)(Y.AlertDescription,{children:c})}),(0,t.jsx)("div",{className:"max-h-96 overflow-y-auto",children:o.length?(0,t.jsx)(ei.ItemGroup,{className:"gap-2",children:o.map(e=>(0,t.jsxs)(ei.Item,{variant:"outline",children:[(0,t.jsx)(ei.ItemMedia,{variant:"icon",children:(0,t.jsx)(b.GitBranch,{})}),(0,t.jsxs)(ei.ItemContent,{className:"min-w-0",children:[(0,t.jsx)(ei.ItemTitle,{className:"font-mono",children:e.branch??l("detached")}),(0,t.jsx)(ei.ItemDescription,{className:"truncate",title:e.folder,children:e.folder})]}),(0,t.jsx)(ei.ItemActions,{children:(0,t.jsxs)(Z.Button,{onClick:()=>void g(e.id),size:"sm",variant:"destructive",children:[(0,t.jsx)(P.Trash2,{})," ",l("purge")]})})]},e.id))}):(0,t.jsx)(es.Empty,{className:"border-0 py-8",children:(0,t.jsxs)(es.EmptyHeader,{children:[(0,t.jsx)(es.EmptyMedia,{variant:"icon",children:(0,t.jsx)(n.Archive,{})}),(0,t.jsx)(es.EmptyTitle,{children:l("noHidden")})]})})}),(0,t.jsx)(er.DialogFooter,{children:o.length>0&&!e&&(0,t.jsxs)(Z.Button,{onClick:()=>void g(),variant:"destructive",children:[(0,t.jsx)(P.Trash2,{})," ",l("purgeAll")]})})]})})}e.s(["ActionRow",0,tu,"BaseBranchControl",0,ts,"BaseFreshnessBadge",0,te,"OriginStatusBadges",0,ta,"PrimaryWorktreeActions",0,tc,"PullRequestBadges",0,tt,"TagManagerDialog",0,tf,"WorktreeMenus",0,ti,"WorktreeMetadata",0,e6,"WorktreeTagsMenu",0,e9,"WorktreeTicketLink",0,e7,"WorktreesPage",0,function({appId:e}){let i=(0,$.useTranslations)("worktrees"),[l,o]=(0,r.useState)(()=>new URLSearchParams(window.location.search).get("issue")),[d,c]=(0,r.useState)(null),[u,h]=(0,r.useState)(()=>"table"===window.localStorage.getItem(eA)?"table":"cards"),[g,m]=(0,r.useState)(()=>"repository"===window.localStorage.getItem(eD)?"repository":"agent"),[p,x]=(0,r.useState)(!0),[j,f]=(0,r.useState)(!1),[v,S]=(0,r.useState)(null),[y,C]=(0,r.useState)(null),[I,T]=(0,r.useState)(0),[N,A]=(0,r.useState)(!1),[D,B]=(0,r.useState)(!1),W=(0,a.useActiveAgent)(),P=(0,$.useTranslations)("activeAgent"),[M]=(0,r.useState)(()=>(function(e){let t={query:"",agentId:eB,repositoryId:eB,changes:eB,branches:eB};try{let r=window.localStorage.getItem(eM(e));if(!r)return t;let a=JSON.parse(r);if(!a||"object"!=typeof a)return t;return{query:"string"==typeof a.query?a.query:t.query,agentId:"string"==typeof a.agentId?a.agentId:t.agentId,repositoryId:"string"==typeof a.repositoryId?a.repositoryId:t.repositoryId,changes:a.changes===eW||a.changes===eP?a.changes:t.changes,branches:a.branches===eL?a.branches:t.branches}}catch{return t}})(e)),[O,q]=(0,r.useState)(M.query),[_,U]=(0,r.useState)(M.agentId),[F,H]=(0,r.useState)(M.repositoryId),[V,G]=(0,r.useState)(M.changes),[K,z]=(0,r.useState)(M.branches),X=(0,r.useRef)(0),ee=(0,r.useRef)(null),et=(0,r.useCallback)(()=>ee.current?.refresh()??Promise.resolve(),[]),er=(0,r.useCallback)(async t=>{let r=++X.current;try{let a=await (0,ej.controlPlaneRequest)(`query WorktreeOverview($appId: ID) {
112
112
  worktreeOverview(appId: $appId) {
113
113
  hiddenCount
114
114
  settings { editorVariant updatedAt }
@@ -134,13 +134,13 @@
134
134
  triggerChoices(resourceKind: "WORKTREE") { key label description }
135
135
  }
136
136
  repository { id canonicalOrigin displayOrigin name description jiraBranchRegex keepBaseBranchUpToDate createdAt updatedAt }
137
- codebase { ${eS.CODEBASE_FIELDS} }
138
- worktrees { ${eS.WORKTREE_FIELDS} }
137
+ codebase { ${ey.CODEBASE_FIELDS} }
138
+ worktrees { ${ey.WORKTREE_FIELDS} }
139
139
  }
140
140
  }
141
141
  }
142
- }`,{appId:e??null},{signal:t});if(r!==G.current||t.aborted)return;d(a.worktreeOverview),w(null)}catch(e){if(t.aborted)return;r!==G.current||t.aborted||w(e instanceof Error?e.message:String(e))}finally{r!==G.current||t.aborted||p(!1)}},[e]);(0,J.useJiraTicketChanges)(()=>void Y()),(0,r.useEffect)(()=>{let e=(0,a.createRefreshCoalescer)(Z);K.current=e;let t=(0,eb.onControlPlaneRecovery)(t=>{t?.initialConnection?e.refreshIfIdle():e.refresh()},{includeInitial:!0});return()=>{e.dispose(),t(),K.current===e&&(K.current=null)}},[Z]),(0,r.useEffect)(()=>{let e=window.setTimeout(()=>void Y(),0),t=window.setInterval(()=>void Y(),3e4),r=(0,eb.controlPlaneSubscriptions)(),a=r.subscribe({query:"subscription WorktreesChanged { worktreeOverviewChanged { worktreeId codebaseId } }"},{next:()=>void Y(),error:()=>void 0,complete:()=>void 0}),s=r.subscribe({query:"subscription WorktreeBuildsChanged { buildsChanged { id } }"},{next:()=>void Y(),error:()=>void 0,complete:()=>void 0}),n=r.subscribe({query:"subscription WorktreeQuickActionsChanged { workflowChanges { definitionsChanged } }"},{next:e=>{e.data?.workflowChanges?.definitionsChanged&&Y()},error:()=>void 0,complete:()=>void 0});return()=>{window.clearTimeout(e),window.clearInterval(t),G.current+=1,a(),s(),n()}},[Y,e]),(0,r.useEffect)(()=>{let e=()=>l(new URLSearchParams(window.location.search).get("issue"));return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]),(0,r.useEffect)(()=>{window.localStorage.setItem(eL(e),JSON.stringify({query:W,agentId:$,repositoryId:q,changes:U,branches:H}))},[$,e,H,U,W,q]);let ee=e=>{let t,r;t=new URLSearchParams(window.location.search),e?t.set("issue",e):t.delete("issue"),r=t.toString(),window.history.pushState(null,"",`${window.location.pathname}${r?`?${r}`:""}`),l(e)},et=async()=>{p(!0),j(!0);try{await (0,eb.controlPlaneRequest)(`mutation RefreshWorktrees {
142
+ }`,{appId:e??null},{signal:t});if(r!==X.current||t.aborted)return;c(a.worktreeOverview),S(null)}catch(e){if(t.aborted)return;r!==X.current||t.aborted||S(e instanceof Error?e.message:String(e))}finally{r!==X.current||t.aborted||x(!1)}},[e]);(0,Q.useJiraTicketChanges)(()=>void et()),(0,r.useEffect)(()=>{let e=(0,s.createRefreshCoalescer)(er);ee.current=e;let t=(0,ej.onControlPlaneRecovery)(t=>{t?.initialConnection?e.refreshIfIdle():e.refresh()},{includeInitial:!0});return()=>{e.dispose(),t(),ee.current===e&&(ee.current=null)}},[er]),(0,r.useEffect)(()=>{let e=window.setTimeout(()=>void et(),0),t=window.setInterval(()=>void et(),3e4),r=(0,ej.controlPlaneSubscriptions)(),a=r.subscribe({query:"subscription WorktreesChanged { worktreeOverviewChanged { worktreeId codebaseId } }"},{next:()=>void et(),error:()=>void 0,complete:()=>void 0}),s=r.subscribe({query:"subscription WorktreeBuildsChanged { buildsChanged { id } }"},{next:()=>void et(),error:()=>void 0,complete:()=>void 0}),n=r.subscribe({query:"subscription WorktreeQuickActionsChanged { workflowChanges { definitionsChanged } }"},{next:e=>{e.data?.workflowChanges?.definitionsChanged&&et()},error:()=>void 0,complete:()=>void 0});return()=>{window.clearTimeout(e),window.clearInterval(t),X.current+=1,a(),s(),n()}},[et,e]),(0,r.useEffect)(()=>{let e=()=>o(new URLSearchParams(window.location.search).get("issue"));return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]),(0,r.useEffect)(()=>{window.localStorage.setItem(eM(e),JSON.stringify({query:O,agentId:_,repositoryId:F,changes:V,branches:K}))},[_,e,K,V,O,F]);let ea=e=>{let t,r;t=new URLSearchParams(window.location.search),e?t.set("issue",e):t.delete("issue"),r=t.toString(),window.history.pushState(null,"",`${window.location.pathname}${r?`?${r}`:""}`),o(e)},ei=async()=>{x(!0),f(!0);try{await (0,ej.controlPlaneRequest)(`mutation RefreshWorktrees {
143
143
  refreshWorktrees
144
- }`),await Y(),I(e=>e+1),w(null)}catch(e){w(e instanceof Error?e.message:String(e))}finally{j(!1),p(!1)}},er=async()=>{let e=o?.agents.flatMap(e=>e.codebases.map(e=>e.codebase.id))??[];if(e.length){j(!0);try{await (0,eb.controlPlaneRequest)(`mutation FetchWorktreeCodebases($input: RunCodebaseOperationInput!) {
144
+ }`),await et(),T(e=>e+1),S(null)}catch(e){S(e instanceof Error?e.message:String(e))}finally{f(!1),x(!1)}},el=async()=>{let e=d?.agents.flatMap(e=>e.codebases.map(e=>e.codebase.id))??[];if(e.length){f(!0);try{await (0,ej.controlPlaneRequest)(`mutation FetchWorktreeCodebases($input: RunCodebaseOperationInput!) {
145
145
  fetchCodebases(input: $input) { jobs { id } skipped { codebaseId reason } }
146
- }`,{input:{codebaseIds:e,requestId:(0,eg.createClientId)()}}),y(n("fetchStarted")),w(null),await Y()}catch(e){w(e instanceof Error?e.message:String(e)),y(null)}finally{j(!1)}}},en=e=>{d(t=>t?{...t,agents:t.agents.map(t=>({...t,codebases:t.codebases.map(t=>({...t,worktrees:t.worktrees.map(t=>t.id===e.id?{...t,...e,ticketKey:e.ticketKey??t.ticketKey,ticketTitle:e.ticketTitle??t.ticketTitle,ticketStatus:e.ticketStatus??t.ticketStatus,pullRequest:e.pullRequest??t.pullRequest}:t)}))}))}:t)},ei=(0,r.useMemo)(()=>{let e=new Map;return o?.agents.forEach(t=>t.codebases.forEach(t=>e.set(t.repository.id,{id:t.repository.id,name:t.repository.name}))),[...e.values()].sort((e,t)=>e.name.localeCompare(t.name))},[o]),el=!o||$===eR||o.agents.some(e=>e.agent.id===$)?$:eR,eo=!o||q===eR||ei.some(e=>e.id===q)?q:eR,eu=(0,r.useMemo)(()=>eq(o?.agents??[],{query:W,agentId:el===eR?null:el,repositoryId:eo===eR?null:eo,dirty:U===eR?null:U===eB,nonDefaultBranch:H===eP}),[el,eo,H,U,o,W]),em=(0,r.useMemo)(()=>e_(eu),[eu]),ep=!!W.trim()||el!==eR||eo!==eR||U!==eR||H!==eR;return(0,t.jsxs)("section",{className:"flex w-full flex-col gap-6",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:n("title")}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:n("description")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(X.Button,{disabled:b,onClick:()=>void et(),variant:"outline",children:[(0,t.jsx)(N.RefreshCw,{className:g?"animate-spin":void 0})," ",n("refresh")]}),(0,t.jsxs)(X.Button,{disabled:b||!o?.agents.length,onClick:()=>void er(),variant:"outline",children:[(0,t.jsx)(P.Upload,{})," ",n("fetchNow")]}),(0,t.jsxs)(X.Button,{onClick:()=>R(!0),variant:"outline",children:[(0,t.jsx)(s.Archive,{})," ",n("hidden",{count:o?.hiddenCount??0})]}),(0,t.jsxs)(ec.Select,{onValueChange:e=>{("agent"===e||"repository"===e)&&(m(e),window.localStorage.setItem(eA,e))},value:h,children:[(0,t.jsx)(ec.SelectTrigger,{"aria-label":n("groupBy"),children:(0,t.jsx)(ec.SelectValue,{})}),(0,t.jsxs)(ec.SelectContent,{children:[(0,t.jsx)(ec.SelectItem,{value:"agent",children:n("groupByAgent")}),(0,t.jsx)(ec.SelectItem,{value:"repository",children:n("groupByRepository")})]})]}),(0,t.jsxs)(eh.ToggleGroup,{"aria-label":`${n("cards")} / ${n("table")}`,onValueChange:e=>{("cards"===e||"table"===e)&&(u(e),window.localStorage.setItem(eE,e))},spacing:0,type:"single",value:c,variant:"outline",children:[(0,t.jsx)(eh.ToggleGroupItem,{"aria-label":n("cards"),className:"px-2",value:"cards",children:(0,t.jsx)(v.Grid2X2,{})}),(0,t.jsx)(eh.ToggleGroupItem,{"aria-label":n("table"),className:"px-2",value:"table",children:(0,t.jsx)(k.List,{})})]})]})]}),f&&(0,t.jsx)(Q.Alert,{variant:"destructive",children:(0,t.jsx)(Q.AlertDescription,{children:f})}),S&&(0,t.jsx)(Q.Alert,{children:(0,t.jsx)(Q.AlertDescription,{children:S})}),o&&o.agents.length>0&&(0,t.jsxs)("div",{"aria-label":n("filters"),className:"flex flex-wrap gap-2",role:"search",children:[(0,t.jsxs)("div",{className:"relative min-w-0 flex-[2_1_18rem]",children:[(0,t.jsx)(D.Search,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(es.Input,{"aria-label":n("searchWorktrees"),className:"pl-9",onChange:e=>L(e.target.value),placeholder:n("searchWorktreesPlaceholder"),type:"search",value:W})]}),(0,t.jsx)("div",{className:"min-w-0 flex-[1_1_12rem]",children:(0,t.jsxs)(ec.Select,{onValueChange:O,value:el,children:[(0,t.jsx)(ec.SelectTrigger,{"aria-label":n("filterByAgent"),className:"w-full",children:(0,t.jsx)(ec.SelectValue,{})}),(0,t.jsxs)(ec.SelectContent,{children:[(0,t.jsx)(ec.SelectItem,{value:eR,children:n("allAgents")}),o.agents.map(e=>(0,t.jsx)(ec.SelectItem,{value:e.agent.id,children:e.agent.name},e.agent.id))]})]})}),(0,t.jsx)("div",{className:"min-w-0 flex-[1_1_12rem]",children:(0,t.jsxs)(ec.Select,{onValueChange:_,value:eo,children:[(0,t.jsx)(ec.SelectTrigger,{"aria-label":n("filterByRepository"),className:"w-full",children:(0,t.jsx)(ec.SelectValue,{})}),(0,t.jsxs)(ec.SelectContent,{children:[(0,t.jsx)(ec.SelectItem,{value:eR,children:n("allRepositories")}),ei.map(e=>(0,t.jsx)(ec.SelectItem,{value:e.id,children:e.name},e.id))]})]})}),(0,t.jsx)("div",{className:"min-w-0 flex-[1_1_12rem]",children:(0,t.jsxs)(ec.Select,{onValueChange:F,value:U,children:[(0,t.jsx)(ec.SelectTrigger,{"aria-label":n("filterByChanges"),className:"w-full",children:(0,t.jsx)(ec.SelectValue,{})}),(0,t.jsxs)(ec.SelectContent,{children:[(0,t.jsx)(ec.SelectItem,{value:eR,children:n("allWorktrees")}),(0,t.jsx)(ec.SelectItem,{value:eB,children:n("dirtyWorktrees")}),(0,t.jsx)(ec.SelectItem,{value:eW,children:n("cleanWorktrees")})]})]})}),(0,t.jsx)("div",{className:"min-w-0 flex-[1_1_12rem]",children:(0,t.jsxs)(ec.Select,{onValueChange:V,value:H,children:[(0,t.jsx)(ec.SelectTrigger,{"aria-label":n("filterByBranch"),className:"w-full",children:(0,t.jsx)(ec.SelectValue,{})}),(0,t.jsxs)(ec.SelectContent,{children:[(0,t.jsx)(ec.SelectItem,{value:eR,children:n("allBranches")}),(0,t.jsx)(ec.SelectItem,{value:eP,children:n("nonDefaultBranches")})]})]})})]}),o&&o.activeMoves.length>0&&(0,t.jsx)(ez,{moves:o.activeMoves,onError:w,onNotice:y,onReload:Y}),o&&(0,t.jsx)(eQ,{onCreated:async()=>{await Y(),y(n("worktreeCreated"))},overview:o}),g&&!o?(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(ed.Spinner,{})," ",n("loading")]}):o?.agents.length?ep&&0===eu.length?(0,t.jsx)(ea.Empty,{className:"border py-12",children:(0,t.jsxs)(ea.EmptyHeader,{children:[(0,t.jsx)(ea.EmptyMedia,{variant:"icon",children:(0,t.jsx)(D.Search,{})}),(0,t.jsx)(ea.EmptyTitle,{children:n("noMatchingWorktrees")}),(0,t.jsx)(ea.EmptyDescription,{children:n("noMatchingWorktreesDescription")})]})}):"repository"===h?em.map(r=>(0,t.jsx)(e0,{appId:e,allTags:o.tags,editorVariant:o.settings.editorVariant,inspectionRefreshToken:C,layout:c,onError:w,onManageTags:()=>E(!0),onOpenTicket:e=>ee(e),onReload:Y,onUpdate:en,overview:o,repositoryGroup:r},r.repository.id)):eu.map(r=>(0,t.jsx)(eZ,{appId:e,agentGroup:r,allTags:o.tags,editorVariant:o.settings.editorVariant,inspectionRefreshToken:C,layout:c,onError:w,onManageTags:()=>E(!0),onOpenTicket:e=>ee(e),onReload:Y,onUpdate:en,overview:o},r.agent.id)):(0,t.jsx)(ea.Empty,{className:"border py-12",children:(0,t.jsxs)(ea.EmptyHeader,{children:[(0,t.jsx)(ea.EmptyMedia,{variant:"icon",children:(0,t.jsx)(x.GitBranch,{})}),(0,t.jsx)(ea.EmptyTitle,{children:n("emptyTitle")}),(0,t.jsx)(ea.EmptyDescription,{children:n("emptyDescription")})]})}),(0,t.jsx)(tj,{onChanged:Y,onOpenChange:E,open:T,tags:o?.tags??[]}),(0,t.jsx)(tf,{appId:e,onChanged:Y,onOpenChange:R,open:A}),(0,t.jsx)(z.JiraTicketDrawer,{issueKey:i,onClose:()=>ee(null),onTicketChange:e=>{d(t=>t?e$(t,e):t)}})]})},"applyJiraTicketToWorktreeOverview",0,e$,"displayedWorktreePath",0,eU,"filterWorktreeAgentGroups",0,eq,"groupWorktreesByRepository",0,e_,"worktreeBranchIsTaken",0,eH,"worktreeChangeActionState",0,eF,"worktreeIsDirty",0,eM])}]);
146
+ }`,{input:{codebaseIds:e,requestId:(0,ep.createClientId)()}}),C(i("fetchStarted")),S(null),await et()}catch(e){S(e instanceof Error?e.message:String(e)),C(null)}finally{f(!1)}}},eo=e=>{c(t=>t?{...t,agents:t.agents.map(t=>({...t,codebases:t.codebases.map(t=>({...t,worktrees:t.worktrees.map(t=>t.id===e.id?{...t,...e,ticketKey:e.ticketKey??t.ticketKey,ticketTitle:e.ticketTitle??t.ticketTitle,ticketStatus:e.ticketStatus??t.ticketStatus,pullRequest:e.pullRequest??t.pullRequest}:t)}))}))}:t)},ed=(0,r.useMemo)(()=>{let e=new Map;return d?.agents.forEach(t=>t.codebases.forEach(t=>e.set(t.repository.id,{id:t.repository.id,name:t.repository.name}))),[...e.values()].sort((e,t)=>e.name.localeCompare(t.name))},[d]),eh=!d||_===eB||d.agents.some(e=>e.agent.id===_)?_:eB,em=W.activeAgentId??eh,ex=!d||F===eB||ed.some(e=>e.id===F)?F:eB,eb=(0,r.useMemo)(()=>e_(d?.agents??[],{query:O,agentId:em===eB?null:em,repositoryId:ex===eB?null:ex,dirty:V===eB?null:V===eW,nonDefaultBranch:K===eL}),[em,ex,K,V,d,O]),ef=(0,r.useMemo)(()=>eU(eb),[eb]),ev=!!O.trim()||em!==eB||ex!==eB||V!==eB||K!==eB;return(0,t.jsxs)("section",{className:"flex w-full flex-col gap-6",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:i("title")}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:i("description")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(Z.Button,{disabled:j,onClick:()=>void ei(),variant:"outline",children:[(0,t.jsx)(E.RefreshCw,{className:p?"animate-spin":void 0})," ",i("refresh")]}),(0,t.jsxs)(Z.Button,{disabled:j||!d?.agents.length,onClick:()=>void el(),variant:"outline",children:[(0,t.jsx)(L.Upload,{})," ",i("fetchNow")]}),(0,t.jsxs)(Z.Button,{onClick:()=>B(!0),variant:"outline",children:[(0,t.jsx)(n.Archive,{})," ",i("hidden",{count:d?.hiddenCount??0})]}),(0,t.jsxs)(eu.Select,{onValueChange:e=>{("agent"===e||"repository"===e)&&(m(e),window.localStorage.setItem(eD,e))},value:g,children:[(0,t.jsx)(eu.SelectTrigger,{"aria-label":i("groupBy"),children:(0,t.jsx)(eu.SelectValue,{})}),(0,t.jsxs)(eu.SelectContent,{children:[(0,t.jsx)(eu.SelectItem,{value:"agent",children:i("groupByAgent")}),(0,t.jsx)(eu.SelectItem,{value:"repository",children:i("groupByRepository")})]})]}),(0,t.jsxs)(eg.ToggleGroup,{"aria-label":`${i("cards")} / ${i("table")}`,onValueChange:e=>{("cards"===e||"table"===e)&&(h(e),window.localStorage.setItem(eA,e))},spacing:0,type:"single",value:u,variant:"outline",children:[(0,t.jsx)(eg.ToggleGroupItem,{"aria-label":i("cards"),className:"px-2",value:"cards",children:(0,t.jsx)(k.Grid2X2,{})}),(0,t.jsx)(eg.ToggleGroupItem,{"aria-label":i("table"),className:"px-2",value:"table",children:(0,t.jsx)(w.List,{})})]})]})]}),v&&(0,t.jsx)(Y.Alert,{variant:"destructive",children:(0,t.jsx)(Y.AlertDescription,{children:v})}),y&&(0,t.jsx)(Y.Alert,{children:(0,t.jsx)(Y.AlertDescription,{children:y})}),d&&d.agents.length>0&&(0,t.jsxs)("div",{"aria-label":i("filters"),className:"flex flex-wrap gap-2",role:"search",children:[(0,t.jsxs)("div",{className:"relative min-w-0 flex-[2_1_18rem]",children:[(0,t.jsx)(R.Search,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(en.Input,{"aria-label":i("searchWorktrees"),className:"pl-9",onChange:e=>q(e.target.value),placeholder:i("searchWorktreesPlaceholder"),type:"search",value:O})]}),(0,t.jsxs)("div",{className:"min-w-0 flex-[1_1_12rem]",children:[(0,t.jsxs)(eu.Select,{disabled:!!W.activeAgentId,onValueChange:U,value:em,children:[(0,t.jsx)(eu.SelectTrigger,{"aria-label":i("filterByAgent"),className:"w-full",children:(0,t.jsx)(eu.SelectValue,{})}),(0,t.jsxs)(eu.SelectContent,{children:[(0,t.jsx)(eu.SelectItem,{value:eB,children:i("allAgents")}),W.activeAgentId&&!d.agents.some(({agent:e})=>e.id===W.activeAgentId)&&(0,t.jsx)(eu.SelectItem,{value:W.activeAgentId,children:W.activeAgent?.name??P("unavailable")}),d.agents.map(e=>(0,t.jsx)(eu.SelectItem,{value:e.agent.id,children:e.agent.name},e.agent.id))]})]}),W.activeAgentId&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:P("controlled")})]}),(0,t.jsx)("div",{className:"min-w-0 flex-[1_1_12rem]",children:(0,t.jsxs)(eu.Select,{onValueChange:H,value:ex,children:[(0,t.jsx)(eu.SelectTrigger,{"aria-label":i("filterByRepository"),className:"w-full",children:(0,t.jsx)(eu.SelectValue,{})}),(0,t.jsxs)(eu.SelectContent,{children:[(0,t.jsx)(eu.SelectItem,{value:eB,children:i("allRepositories")}),ed.map(e=>(0,t.jsx)(eu.SelectItem,{value:e.id,children:e.name},e.id))]})]})}),(0,t.jsx)("div",{className:"min-w-0 flex-[1_1_12rem]",children:(0,t.jsxs)(eu.Select,{onValueChange:G,value:V,children:[(0,t.jsx)(eu.SelectTrigger,{"aria-label":i("filterByChanges"),className:"w-full",children:(0,t.jsx)(eu.SelectValue,{})}),(0,t.jsxs)(eu.SelectContent,{children:[(0,t.jsx)(eu.SelectItem,{value:eB,children:i("allWorktrees")}),(0,t.jsx)(eu.SelectItem,{value:eW,children:i("dirtyWorktrees")}),(0,t.jsx)(eu.SelectItem,{value:eP,children:i("cleanWorktrees")})]})]})}),(0,t.jsx)("div",{className:"min-w-0 flex-[1_1_12rem]",children:(0,t.jsxs)(eu.Select,{onValueChange:z,value:K,children:[(0,t.jsx)(eu.SelectTrigger,{"aria-label":i("filterByBranch"),className:"w-full",children:(0,t.jsx)(eu.SelectValue,{})}),(0,t.jsxs)(eu.SelectContent,{children:[(0,t.jsx)(eu.SelectItem,{value:eB,children:i("allBranches")}),(0,t.jsx)(eu.SelectItem,{value:eL,children:i("nonDefaultBranches")})]})]})})]}),d&&d.activeMoves.length>0&&(0,t.jsx)(eJ,{moves:d.activeMoves,onError:S,onNotice:C,onReload:et}),d&&(0,t.jsx)(eY,{onCreated:async()=>{await et(),C(i("worktreeCreated"))},overview:d}),W.ready&&(!p||d)?d?.agents.length?ev&&0===eb.length?(0,t.jsx)(es.Empty,{className:"border py-12",children:(0,t.jsxs)(es.EmptyHeader,{children:[(0,t.jsx)(es.EmptyMedia,{variant:"icon",children:(0,t.jsx)(R.Search,{})}),(0,t.jsx)(es.EmptyTitle,{children:i("noMatchingWorktrees")}),(0,t.jsx)(es.EmptyDescription,{children:i("noMatchingWorktreesDescription")})]})}):"repository"===g?ef.map(r=>(0,t.jsx)(e1,{appId:e,allTags:d.tags,editorVariant:d.settings.editorVariant,inspectionRefreshToken:I,layout:u,onError:S,onManageTags:()=>A(!0),onOpenTicket:e=>ea(e),onReload:et,onUpdate:eo,overview:d,repositoryGroup:r},r.repository.id)):eb.map(r=>(0,t.jsx)(e0,{appId:e,agentGroup:r,allTags:d.tags,editorVariant:d.settings.editorVariant,inspectionRefreshToken:I,layout:u,onError:S,onManageTags:()=>A(!0),onOpenTicket:e=>ea(e),onReload:et,onUpdate:eo,overview:d},r.agent.id)):(0,t.jsx)(es.Empty,{className:"border py-12",children:(0,t.jsxs)(es.EmptyHeader,{children:[(0,t.jsx)(es.EmptyMedia,{variant:"icon",children:(0,t.jsx)(b.GitBranch,{})}),(0,t.jsx)(es.EmptyTitle,{children:i("emptyTitle")}),(0,t.jsx)(es.EmptyDescription,{children:i("emptyDescription")})]})}):(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(ec.Spinner,{})," ",i("loading")]}),(0,t.jsx)(tf,{onChanged:et,onOpenChange:A,open:N,tags:d?.tags??[]}),(0,t.jsx)(tv,{appId:e,onChanged:et,onOpenChange:B,open:D}),(0,t.jsx)(J.JiraTicketDrawer,{issueKey:l,onClose:()=>ea(null),onTicketChange:e=>{c(t=>t?eO(t,e):t)}})]})},"applyJiraTicketToWorktreeOverview",0,eO,"displayedWorktreePath",0,eF,"filterWorktreeAgentGroups",0,e_,"groupWorktreesByRepository",0,eU,"worktreeBranchIsTaken",0,eV,"worktreeChangeActionState",0,eH,"worktreeIsDirty",0,e$])}]);