agent-log-viewer 1.0.0 → 1.0.1

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 (582) hide show
  1. package/README.md +12 -21
  2. package/bin/cli.mjs +28 -4
  3. package/bin/mcp-server.mjs +7 -0
  4. package/bin/mcp-server.test.ts +2 -0
  5. package/bin/provision-telegram-connector.mjs +193 -0
  6. package/bin/server-runtime.mjs +4 -8
  7. package/bin/server-runtime.test.ts +46 -7
  8. package/bin/telegram-login-bridge.py +253 -0
  9. package/bin/telegram-mcp-server.py +106 -0
  10. package/bin/telegram-session-reader.mjs +6 -0
  11. package/bin/telegram-session-validator.mjs +71 -0
  12. package/dist/mcp-server.mjs +31771 -25627
  13. package/dist/standalone/.next/BUILD_ID +1 -1
  14. package/dist/standalone/.next/app-path-routes-manifest.json +22 -15
  15. package/dist/standalone/.next/build-manifest.json +3 -3
  16. package/dist/standalone/.next/prerender-manifest.json +3 -3
  17. package/dist/standalone/.next/react-loadable-manifest.json +19 -0
  18. package/dist/standalone/.next/required-server-files.json +4 -1
  19. package/dist/standalone/.next/routes-manifest.json +48 -6
  20. package/dist/standalone/.next/server/account-migration-controller-worker.js +1 -0
  21. package/dist/standalone/.next/server/app/_global-error/page.js +3 -3
  22. package/dist/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  23. package/dist/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  24. package/dist/standalone/.next/server/app/_global-error.html +1 -1
  25. package/dist/standalone/.next/server/app/_global-error.rsc +1 -1
  26. package/dist/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  27. package/dist/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  28. package/dist/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  29. package/dist/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  30. package/dist/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  31. package/dist/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  32. package/dist/standalone/.next/server/app/_not-found/page.js +2 -2
  33. package/dist/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  34. package/dist/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  35. package/dist/standalone/.next/server/app/_not-found.html +1 -1
  36. package/dist/standalone/.next/server/app/_not-found.rsc +2 -2
  37. package/dist/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  38. package/dist/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  39. package/dist/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  40. package/dist/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  41. package/dist/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  42. package/dist/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  43. package/dist/standalone/.next/server/app/api/access/route.js +1 -1
  44. package/dist/standalone/.next/server/app/api/access/route.js.nft.json +1 -1
  45. package/dist/standalone/.next/server/app/api/account-migrations/[intentId]/route.js +1 -1
  46. package/dist/standalone/.next/server/app/api/account-migrations/[intentId]/route.js.nft.json +1 -1
  47. package/dist/standalone/.next/server/app/api/accounts/claude/[id]/status/route.js +4 -1
  48. package/dist/standalone/.next/server/app/api/accounts/claude/[id]/status/route.js.nft.json +1 -1
  49. package/dist/standalone/.next/server/app/api/accounts/claude/active/route.js +1 -1
  50. package/dist/standalone/.next/server/app/api/accounts/claude/active/route.js.nft.json +1 -1
  51. package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/input/route.js +4 -1
  52. package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/input/route.js.nft.json +1 -1
  53. package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/route.js +4 -1
  54. package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/route.js.nft.json +1 -1
  55. package/dist/standalone/.next/server/app/api/accounts/claude/policy/route.js +1 -1
  56. package/dist/standalone/.next/server/app/api/accounts/claude/policy/route.js.nft.json +1 -1
  57. package/dist/standalone/.next/server/app/api/accounts/claude/route.js +1 -1
  58. package/dist/standalone/.next/server/app/api/accounts/claude/route.js.nft.json +1 -1
  59. package/dist/standalone/.next/server/app/api/accounts/claude/terminal/route.js +4 -1
  60. package/dist/standalone/.next/server/app/api/accounts/claude/terminal/route.js.nft.json +1 -1
  61. package/dist/standalone/.next/server/app/api/accounts/codex/active/route.js +1 -1
  62. package/dist/standalone/.next/server/app/api/accounts/codex/active/route.js.nft.json +1 -1
  63. package/dist/standalone/.next/server/app/api/accounts/codex/policy/route.js +1 -1
  64. package/dist/standalone/.next/server/app/api/accounts/codex/policy/route.js.nft.json +1 -1
  65. package/dist/standalone/.next/server/app/api/accounts/codex/route.js +1 -1
  66. package/dist/standalone/.next/server/app/api/accounts/codex/route.js.nft.json +1 -1
  67. package/dist/standalone/.next/server/app/api/accounts/codex/terminal/route.js +4 -1
  68. package/dist/standalone/.next/server/app/api/accounts/codex/terminal/route.js.nft.json +1 -1
  69. package/dist/standalone/.next/server/app/api/accounts/route.js +1 -1
  70. package/dist/standalone/.next/server/app/api/accounts/route.js.nft.json +1 -1
  71. package/dist/standalone/.next/server/app/api/agent/route.js +1 -1
  72. package/dist/standalone/.next/server/app/api/agent/route.js.nft.json +1 -1
  73. package/dist/standalone/.next/server/app/api/agent/snapshot/route.js +1 -1
  74. package/dist/standalone/.next/server/app/api/agent/snapshot/route.js.nft.json +1 -1
  75. package/dist/standalone/.next/server/app/api/answer/route.js +1 -1
  76. package/dist/standalone/.next/server/app/api/answer/route.js.nft.json +1 -1
  77. package/dist/standalone/.next/server/app/api/artifact/route.js +1 -0
  78. package/dist/standalone/.next/server/app/api/{orchestrator → artifact}/route.js.nft.json +1 -1
  79. package/dist/standalone/.next/server/app/api/artifact/route_client-reference-manifest.js +1 -0
  80. package/dist/standalone/.next/server/app/api/attach-command/route.js +1 -1
  81. package/dist/standalone/.next/server/app/api/attach-command/route.js.nft.json +1 -1
  82. package/dist/standalone/.next/server/app/api/attention/[id]/route.js +1 -1
  83. package/dist/standalone/.next/server/app/api/attention/[id]/route.js.nft.json +1 -1
  84. package/dist/standalone/.next/server/app/api/attention/route.js +1 -1
  85. package/dist/standalone/.next/server/app/api/attention/route.js.nft.json +1 -1
  86. package/dist/standalone/.next/server/app/api/board/route.js +1 -1
  87. package/dist/standalone/.next/server/app/api/board/route.js.nft.json +1 -1
  88. package/dist/standalone/.next/server/app/api/bridge/route.js +2 -2
  89. package/dist/standalone/.next/server/app/api/bridge/route.js.nft.json +1 -1
  90. package/dist/standalone/.next/server/app/api/conversations/[conversationId]/migration/route.js +1 -1
  91. package/dist/standalone/.next/server/app/api/conversations/[conversationId]/migration/route.js.nft.json +1 -1
  92. package/dist/standalone/.next/server/app/api/conversations/route.js +1 -1
  93. package/dist/standalone/.next/server/app/api/conversations/route.js.nft.json +1 -1
  94. package/dist/standalone/.next/server/app/api/files/route.js +2 -2
  95. package/dist/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  96. package/dist/standalone/.next/server/app/api/flows/[id]/route.js +1 -1
  97. package/dist/standalone/.next/server/app/api/flows/[id]/route.js.nft.json +1 -1
  98. package/dist/standalone/.next/server/app/api/flows/route.js +1 -1
  99. package/dist/standalone/.next/server/app/api/flows/route.js.nft.json +1 -1
  100. package/dist/standalone/.next/server/app/api/image/route.js +1 -1
  101. package/dist/standalone/.next/server/app/api/image/route.js.nft.json +1 -1
  102. package/dist/standalone/.next/server/app/api/inbox/route.js +2 -2
  103. package/dist/standalone/.next/server/app/api/inbox/route.js.nft.json +1 -1
  104. package/dist/standalone/.next/server/app/api/lifecycle/reaper/route.js +1 -1
  105. package/dist/standalone/.next/server/app/api/lifecycle/reaper/route.js.nft.json +1 -1
  106. package/dist/standalone/.next/server/app/api/limits/history/route.js +4 -1
  107. package/dist/standalone/.next/server/app/api/limits/history/route.js.nft.json +1 -1
  108. package/dist/standalone/.next/server/app/api/limits/route.js +4 -1
  109. package/dist/standalone/.next/server/app/api/limits/route.js.nft.json +1 -1
  110. package/dist/standalone/.next/server/app/api/log/preflight/route.js +1 -1
  111. package/dist/standalone/.next/server/app/api/log/preflight/route.js.nft.json +1 -1
  112. package/dist/standalone/.next/server/app/api/log/project-delete/route.js +1 -1
  113. package/dist/standalone/.next/server/app/api/log/project-delete/route.js.nft.json +1 -1
  114. package/dist/standalone/.next/server/app/api/log/provenance/route.js +1 -0
  115. package/dist/standalone/.next/server/app/api/log/provenance/route.js.nft.json +1 -0
  116. package/dist/standalone/.next/server/app/api/log/provenance/route_client-reference-manifest.js +1 -0
  117. package/dist/standalone/.next/server/app/api/log/route.js +1 -1
  118. package/dist/standalone/.next/server/app/api/log/route.js.nft.json +1 -1
  119. package/dist/standalone/.next/server/app/api/logs/route.js +1 -1
  120. package/dist/standalone/.next/server/app/api/logs/route.js.nft.json +1 -1
  121. package/dist/standalone/.next/server/app/api/logs/stream/route.js +2 -2
  122. package/dist/standalone/.next/server/app/api/logs/stream/route.js.nft.json +1 -1
  123. package/dist/standalone/.next/server/app/api/monitor/lock/route.js +2 -2
  124. package/dist/standalone/.next/server/app/api/monitor/lock/route.js.nft.json +1 -1
  125. package/dist/standalone/.next/server/app/api/monitor/runs/route.js +1 -1
  126. package/dist/standalone/.next/server/app/api/monitor/runs/route.js.nft.json +1 -1
  127. package/dist/standalone/.next/server/app/api/orchestrator/rotate/route.js +1 -1
  128. package/dist/standalone/.next/server/app/api/orchestrator/rotate/route.js.nft.json +1 -1
  129. package/dist/standalone/.next/server/app/api/orchestrator/seat/route.js +1 -1
  130. package/dist/standalone/.next/server/app/api/orchestrator/seat/route.js.nft.json +1 -1
  131. package/dist/standalone/.next/server/app/api/orchestrator/seat/status/route.js +3 -0
  132. package/dist/standalone/.next/server/app/api/orchestrator/seat/status/route.js.nft.json +1 -0
  133. package/dist/standalone/.next/server/app/api/orchestrator/seat/status/route_client-reference-manifest.js +1 -0
  134. package/dist/standalone/.next/server/app/api/pipelines/[id]/route.js +1 -1
  135. package/dist/standalone/.next/server/app/api/pipelines/[id]/route.js.nft.json +1 -1
  136. package/dist/standalone/.next/server/app/api/pipelines/preflight/route.js +1 -1
  137. package/dist/standalone/.next/server/app/api/pipelines/preflight/route.js.nft.json +1 -1
  138. package/dist/standalone/.next/server/app/api/pipelines/route.js +2 -2
  139. package/dist/standalone/.next/server/app/api/pipelines/route.js.nft.json +1 -1
  140. package/dist/standalone/.next/server/app/api/pipelines/tick/route.js +2 -2
  141. package/dist/standalone/.next/server/app/api/pipelines/tick/route.js.nft.json +1 -1
  142. package/dist/standalone/.next/server/app/api/proc/route.js +1 -1
  143. package/dist/standalone/.next/server/app/api/proc/route.js.nft.json +1 -1
  144. package/dist/standalone/.next/server/app/api/projects/create/route.js +3 -0
  145. package/dist/standalone/.next/server/app/api/projects/create/route.js.nft.json +1 -0
  146. package/dist/standalone/.next/server/app/api/projects/create/route_client-reference-manifest.js +1 -0
  147. package/dist/standalone/.next/server/app/api/projects/crown/route.js +1 -0
  148. package/dist/standalone/.next/server/app/api/projects/crown/route.js.nft.json +1 -0
  149. package/dist/standalone/.next/server/app/api/projects/crown/route_client-reference-manifest.js +1 -0
  150. package/dist/standalone/.next/server/app/api/push/route.js +2 -2
  151. package/dist/standalone/.next/server/app/api/push/route.js.nft.json +1 -1
  152. package/dist/standalone/.next/server/app/api/resources/route.js +1 -1
  153. package/dist/standalone/.next/server/app/api/resources/route.js.nft.json +1 -1
  154. package/dist/standalone/.next/server/app/api/roles/route.js +2 -2
  155. package/dist/standalone/.next/server/app/api/roles/route.js.nft.json +1 -1
  156. package/dist/standalone/.next/server/app/api/runtime/answer/route.js +1 -1
  157. package/dist/standalone/.next/server/app/api/runtime/answer/route.js.nft.json +1 -1
  158. package/dist/standalone/.next/server/app/api/runtime/deployments/[deploymentId]/route.js +1 -1
  159. package/dist/standalone/.next/server/app/api/runtime/deployments/[deploymentId]/route.js.nft.json +1 -1
  160. package/dist/standalone/.next/server/app/api/runtime/deployments/capabilities/v1/route.js +1 -1
  161. package/dist/standalone/.next/server/app/api/runtime/deployments/capabilities/v1/route.js.nft.json +1 -1
  162. package/dist/standalone/.next/server/app/api/runtime/deployments/route.js +1 -1
  163. package/dist/standalone/.next/server/app/api/runtime/deployments/route.js.nft.json +1 -1
  164. package/dist/standalone/.next/server/app/api/runtime/interrupt/route.js +1 -1
  165. package/dist/standalone/.next/server/app/api/runtime/interrupt/route.js.nft.json +1 -1
  166. package/dist/standalone/.next/server/app/api/runtime/operations/[operationId]/route.js +1 -1
  167. package/dist/standalone/.next/server/app/api/runtime/operations/[operationId]/route.js.nft.json +1 -1
  168. package/dist/standalone/.next/server/app/api/runtime/operations/route.js +1 -1
  169. package/dist/standalone/.next/server/app/api/runtime/operations/route.js.nft.json +1 -1
  170. package/dist/standalone/.next/server/app/api/runtime/realtime/route.js +1 -1
  171. package/dist/standalone/.next/server/app/api/runtime/realtime/route.js.nft.json +1 -1
  172. package/dist/standalone/.next/server/app/api/runtime/send/route.js +1 -1
  173. package/dist/standalone/.next/server/app/api/runtime/send/route.js.nft.json +1 -1
  174. package/dist/standalone/.next/server/app/api/runtime/snapshot/route.js +1 -1
  175. package/dist/standalone/.next/server/app/api/runtime/snapshot/route.js.nft.json +1 -1
  176. package/dist/standalone/.next/server/app/api/runtime/spawn/route.js +1 -1
  177. package/dist/standalone/.next/server/app/api/runtime/spawn/route.js.nft.json +1 -1
  178. package/dist/standalone/.next/server/app/api/runtime/steer/route.js +1 -1
  179. package/dist/standalone/.next/server/app/api/runtime/steer/route.js.nft.json +1 -1
  180. package/dist/standalone/.next/server/app/api/runtime/stream/route.js +2 -2
  181. package/dist/standalone/.next/server/app/api/runtime/stream/route.js.nft.json +1 -1
  182. package/dist/standalone/.next/server/app/api/search/transcripts/route.js +2 -0
  183. package/dist/standalone/.next/server/app/api/search/transcripts/route.js.nft.json +1 -0
  184. package/dist/standalone/.next/server/app/api/search/transcripts/route_client-reference-manifest.js +1 -0
  185. package/dist/standalone/.next/server/app/api/session/route.js +1 -1
  186. package/dist/standalone/.next/server/app/api/session/route.js.nft.json +1 -1
  187. package/dist/standalone/.next/server/app/api/session/supersedence/route.js +1 -1
  188. package/dist/standalone/.next/server/app/api/session/supersedence/route.js.nft.json +1 -1
  189. package/dist/standalone/.next/server/app/api/session/title/route.js +1 -1
  190. package/dist/standalone/.next/server/app/api/session/title/route.js.nft.json +1 -1
  191. package/dist/standalone/.next/server/app/api/spawn/policy/route.js +6 -3
  192. package/dist/standalone/.next/server/app/api/spawn/policy/route.js.nft.json +1 -1
  193. package/dist/standalone/.next/server/app/api/spawn/route.js +2 -2
  194. package/dist/standalone/.next/server/app/api/spawn/route.js.nft.json +1 -1
  195. package/dist/standalone/.next/server/app/api/staging/route.js +2 -2
  196. package/dist/standalone/.next/server/app/api/staging/route.js.nft.json +1 -1
  197. package/dist/standalone/.next/server/app/api/task-attachments/route.js +2 -2
  198. package/dist/standalone/.next/server/app/api/task-attachments/route.js.nft.json +1 -1
  199. package/dist/standalone/.next/server/app/api/tasks/[id]/assignment/route.js +1 -1
  200. package/dist/standalone/.next/server/app/api/tasks/[id]/assignment/route.js.nft.json +1 -1
  201. package/dist/standalone/.next/server/app/api/tasks/[id]/route.js +1 -1
  202. package/dist/standalone/.next/server/app/api/tasks/[id]/route.js.nft.json +1 -1
  203. package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js +1 -1
  204. package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js.nft.json +1 -1
  205. package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js +1 -1
  206. package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js.nft.json +1 -1
  207. package/dist/standalone/.next/server/app/api/tasks/curator/route.js +1 -1
  208. package/dist/standalone/.next/server/app/api/tasks/curator/route.js.nft.json +1 -1
  209. package/dist/standalone/.next/server/app/api/tasks/route.js +2 -2
  210. package/dist/standalone/.next/server/app/api/tasks/route.js.nft.json +1 -1
  211. package/dist/standalone/.next/server/app/api/telegram/reports/route.js +1 -0
  212. package/dist/standalone/.next/server/app/api/telegram/reports/route.js.nft.json +1 -0
  213. package/dist/standalone/.next/server/app/api/telegram/reports/route_client-reference-manifest.js +1 -0
  214. package/dist/standalone/.next/server/app/api/telegram/route.js +1 -0
  215. package/dist/standalone/.next/server/app/api/telegram/route.js.nft.json +1 -0
  216. package/dist/standalone/.next/server/app/api/telegram/route_client-reference-manifest.js +1 -0
  217. package/dist/standalone/.next/server/app/api/timeline/route.js +1 -1
  218. package/dist/standalone/.next/server/app/api/timeline/route.js.nft.json +1 -1
  219. package/dist/standalone/.next/server/app/api/tmux/route.js +1 -1
  220. package/dist/standalone/.next/server/app/api/tmux/route.js.nft.json +1 -1
  221. package/dist/standalone/.next/server/app/api/tmux/targets/route.js +1 -1
  222. package/dist/standalone/.next/server/app/api/tmux/targets/route.js.nft.json +1 -1
  223. package/dist/standalone/.next/server/app/api/transcribe/backend/route.js +2 -2
  224. package/dist/standalone/.next/server/app/api/transcribe/backend/route.js.nft.json +1 -1
  225. package/dist/standalone/.next/server/app/api/transcribe/route.js +2 -2
  226. package/dist/standalone/.next/server/app/api/transcribe/route.js.nft.json +1 -1
  227. package/dist/standalone/.next/server/app/api/transcribe/token/route.js +2 -2
  228. package/dist/standalone/.next/server/app/api/transcribe/token/route.js.nft.json +1 -1
  229. package/dist/standalone/.next/server/app/api/tts/backend/route.js +1 -1
  230. package/dist/standalone/.next/server/app/api/tts/backend/route.js.nft.json +1 -1
  231. package/dist/standalone/.next/server/app/api/tts/route.js +3 -3
  232. package/dist/standalone/.next/server/app/api/tts/route.js.nft.json +1 -1
  233. package/dist/standalone/.next/server/app/api/view/presence/route.js +1 -2
  234. package/dist/standalone/.next/server/app/api/view/presence/route.js.nft.json +1 -1
  235. package/dist/standalone/.next/server/app/api/workflows/[id]/route.js +1 -1
  236. package/dist/standalone/.next/server/app/api/workflows/[id]/route.js.nft.json +1 -1
  237. package/dist/standalone/.next/server/app/api/workflows/route.js +1 -1
  238. package/dist/standalone/.next/server/app/api/workflows/route.js.nft.json +1 -1
  239. package/dist/standalone/.next/server/app/favicon.ico/route.js +1 -1
  240. package/dist/standalone/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  241. package/dist/standalone/.next/server/app/index.html +1 -1
  242. package/dist/standalone/.next/server/app/index.rsc +3 -3
  243. package/dist/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  244. package/dist/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  245. package/dist/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  246. package/dist/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  247. package/dist/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  248. package/dist/standalone/.next/server/app/page.js +41 -24
  249. package/dist/standalone/.next/server/app/page.js.nft.json +1 -1
  250. package/dist/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  251. package/dist/standalone/.next/server/app-paths-manifest.json +22 -15
  252. package/dist/standalone/.next/server/chunks/156.js +2 -2
  253. package/dist/standalone/.next/server/chunks/1617.js +2 -0
  254. package/dist/standalone/.next/server/chunks/1858.js +91 -0
  255. package/dist/standalone/.next/server/chunks/1888.js +1 -0
  256. package/dist/standalone/.next/server/chunks/1920.js +1 -1
  257. package/dist/standalone/.next/server/chunks/2190.js +1 -1
  258. package/dist/standalone/.next/server/chunks/230.js +1 -0
  259. package/dist/standalone/.next/server/chunks/2318.js +2 -0
  260. package/dist/standalone/.next/server/chunks/2324.js +1 -0
  261. package/dist/standalone/.next/server/chunks/2338.js +9 -0
  262. package/dist/standalone/.next/server/chunks/2904.js +42 -0
  263. package/dist/standalone/.next/server/chunks/2923.js +1 -0
  264. package/dist/standalone/.next/server/chunks/2962.js +1 -0
  265. package/dist/standalone/.next/server/chunks/2977.js +1 -1
  266. package/dist/standalone/.next/server/chunks/306.js +3 -3
  267. package/dist/standalone/.next/server/chunks/3086.js +1 -0
  268. package/dist/standalone/.next/server/chunks/3139.js +10 -0
  269. package/dist/standalone/.next/server/chunks/3214.js +82 -0
  270. package/dist/standalone/.next/server/chunks/3336.js +1 -1
  271. package/dist/standalone/.next/server/chunks/3558.js +1 -1
  272. package/dist/standalone/.next/server/chunks/3587.js +1 -1
  273. package/dist/standalone/.next/server/chunks/3598.js +81 -0
  274. package/dist/standalone/.next/server/chunks/3740.js +126 -0
  275. package/dist/standalone/.next/server/chunks/3793.js +6 -0
  276. package/dist/standalone/.next/server/chunks/3916.js +1 -0
  277. package/dist/standalone/.next/server/chunks/3953.js +1 -0
  278. package/dist/standalone/.next/server/chunks/4012.js +2 -2
  279. package/dist/standalone/.next/server/chunks/4191.js +1 -1
  280. package/dist/standalone/.next/server/chunks/4260.js +2 -2
  281. package/dist/standalone/.next/server/chunks/4509.js +1 -1
  282. package/dist/standalone/.next/server/chunks/4968.js +1 -1
  283. package/dist/standalone/.next/server/chunks/4972.js +130 -2
  284. package/dist/standalone/.next/server/chunks/5689.js +11 -0
  285. package/dist/standalone/.next/server/chunks/6333.js +47 -0
  286. package/dist/standalone/.next/server/chunks/6796.js +1 -0
  287. package/dist/standalone/.next/server/chunks/6826.js +2 -2
  288. package/dist/standalone/.next/server/chunks/6850.js +1 -1
  289. package/dist/standalone/.next/server/chunks/6909.js +1 -0
  290. package/dist/standalone/.next/server/chunks/6977.js +1 -0
  291. package/dist/standalone/.next/server/chunks/7126.js +1 -0
  292. package/dist/standalone/.next/server/chunks/7159.js +1 -0
  293. package/dist/standalone/.next/server/chunks/7270.js +45 -0
  294. package/dist/standalone/.next/server/chunks/7295.js +10 -0
  295. package/dist/standalone/.next/server/chunks/7471.js +16 -14
  296. package/dist/standalone/.next/server/chunks/7563.js +1 -1
  297. package/dist/standalone/.next/server/chunks/7644.js +13 -0
  298. package/dist/standalone/.next/server/chunks/7722.js +1 -1
  299. package/dist/standalone/.next/server/chunks/7733.js +4 -0
  300. package/dist/standalone/.next/server/chunks/7868.js +1 -0
  301. package/dist/standalone/.next/server/chunks/8026.js +1 -0
  302. package/dist/standalone/.next/server/chunks/8176.js +1 -1
  303. package/dist/standalone/.next/server/chunks/8444.js +1 -1
  304. package/dist/standalone/.next/server/chunks/8465.js +2 -0
  305. package/dist/standalone/.next/server/chunks/849.js +6 -0
  306. package/dist/standalone/.next/server/chunks/8600.js +12 -0
  307. package/dist/standalone/.next/server/chunks/8617.js +2 -0
  308. package/dist/standalone/.next/server/chunks/8797.js +1 -1
  309. package/dist/standalone/.next/server/chunks/8817.js +5 -0
  310. package/dist/standalone/.next/server/chunks/8966.js +2 -2
  311. package/dist/standalone/.next/server/chunks/8996.js +1 -0
  312. package/dist/standalone/.next/server/chunks/9246.js +47 -0
  313. package/dist/standalone/.next/server/chunks/9364.js +310 -0
  314. package/dist/standalone/.next/server/chunks/9411.js +3 -3
  315. package/dist/standalone/.next/server/chunks/9434.js +13 -0
  316. package/dist/standalone/.next/server/chunks/9507.js +1 -0
  317. package/dist/standalone/.next/server/chunks/9676.js +62 -0
  318. package/dist/standalone/.next/server/chunks/9733.js +6 -3
  319. package/dist/standalone/.next/server/chunks/9901.js +62 -0
  320. package/dist/standalone/.next/server/chunks/9937.js +2 -0
  321. package/dist/standalone/.next/server/chunks/9940.js +128 -0
  322. package/dist/standalone/.next/server/chunks/static/media/pdf.worker.min.65fe1ff1.mjs +6 -0
  323. package/dist/standalone/.next/server/file-scanner-worker.js +2 -2
  324. package/dist/standalone/.next/server/files-response-worker.js +5 -5
  325. package/dist/standalone/.next/server/functions-config-manifest.json +8 -1
  326. package/dist/standalone/.next/server/instrumentation.js +1 -1
  327. package/dist/standalone/.next/server/middleware-build-manifest.js +1 -1
  328. package/dist/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  329. package/dist/standalone/.next/server/pages/404.html +1 -1
  330. package/dist/standalone/.next/server/pages/500.html +1 -1
  331. package/dist/standalone/.next/server/resource-collector-worker.js +1 -1
  332. package/dist/standalone/.next/server/server-reference-manifest.json +1 -1
  333. package/dist/standalone/.next/server/wakatime-sync-worker.js +2 -0
  334. package/dist/standalone/.next/server/webpack-runtime.js +1 -1
  335. package/dist/standalone/.next/static/chunks/2619.fd64e7a5bd9005d5.js +1 -0
  336. package/dist/standalone/.next/static/chunks/8293.5545fdbde0213c98.js +1 -0
  337. package/dist/standalone/.next/static/chunks/9178-e32f088e89b55503.js +1 -0
  338. package/dist/standalone/.next/static/chunks/9b0008ae.eb7a9c4c1c92a63b.js +45 -0
  339. package/dist/standalone/.next/static/chunks/app/_global-error/page-c132c5ba005ff29e.js +1 -0
  340. package/dist/standalone/.next/static/chunks/app/api/access/route-c132c5ba005ff29e.js +1 -0
  341. package/dist/standalone/.next/static/chunks/app/api/account-migrations/[intentId]/route-c132c5ba005ff29e.js +1 -0
  342. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/[id]/status/route-c132c5ba005ff29e.js +1 -0
  343. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/active/route-c132c5ba005ff29e.js +1 -0
  344. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/input/route-c132c5ba005ff29e.js +1 -0
  345. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/route-c132c5ba005ff29e.js +1 -0
  346. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/policy/route-c132c5ba005ff29e.js +1 -0
  347. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/route-c132c5ba005ff29e.js +1 -0
  348. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/terminal/route-c132c5ba005ff29e.js +1 -0
  349. package/dist/standalone/.next/static/chunks/app/api/accounts/codex/active/route-c132c5ba005ff29e.js +1 -0
  350. package/dist/standalone/.next/static/chunks/app/api/accounts/codex/policy/route-c132c5ba005ff29e.js +1 -0
  351. package/dist/standalone/.next/static/chunks/app/api/accounts/codex/route-c132c5ba005ff29e.js +1 -0
  352. package/dist/standalone/.next/static/chunks/app/api/accounts/codex/terminal/route-c132c5ba005ff29e.js +1 -0
  353. package/dist/standalone/.next/static/chunks/app/api/accounts/route-c132c5ba005ff29e.js +1 -0
  354. package/dist/standalone/.next/static/chunks/app/api/agent/route-c132c5ba005ff29e.js +1 -0
  355. package/dist/standalone/.next/static/chunks/app/api/agent/snapshot/route-c132c5ba005ff29e.js +1 -0
  356. package/dist/standalone/.next/static/chunks/app/api/answer/route-c132c5ba005ff29e.js +1 -0
  357. package/dist/standalone/.next/static/chunks/app/api/artifact/route-c132c5ba005ff29e.js +1 -0
  358. package/dist/standalone/.next/static/chunks/app/api/attach-command/route-c132c5ba005ff29e.js +1 -0
  359. package/dist/standalone/.next/static/chunks/app/api/attention/[id]/route-c132c5ba005ff29e.js +1 -0
  360. package/dist/standalone/.next/static/chunks/app/api/attention/route-c132c5ba005ff29e.js +1 -0
  361. package/dist/standalone/.next/static/chunks/app/api/board/route-c132c5ba005ff29e.js +1 -0
  362. package/dist/standalone/.next/static/chunks/app/api/bridge/route-c132c5ba005ff29e.js +1 -0
  363. package/dist/standalone/.next/static/chunks/app/api/conversations/[conversationId]/migration/route-c132c5ba005ff29e.js +1 -0
  364. package/dist/standalone/.next/static/chunks/app/api/conversations/route-c132c5ba005ff29e.js +1 -0
  365. package/dist/standalone/.next/static/chunks/app/api/files/route-c132c5ba005ff29e.js +1 -0
  366. package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-c132c5ba005ff29e.js +1 -0
  367. package/dist/standalone/.next/static/chunks/app/api/flows/route-c132c5ba005ff29e.js +1 -0
  368. package/dist/standalone/.next/static/chunks/app/api/image/route-c132c5ba005ff29e.js +1 -0
  369. package/dist/standalone/.next/static/chunks/app/api/inbox/route-c132c5ba005ff29e.js +1 -0
  370. package/dist/standalone/.next/static/chunks/app/api/lifecycle/reaper/route-c132c5ba005ff29e.js +1 -0
  371. package/dist/standalone/.next/static/chunks/app/api/limits/history/route-c132c5ba005ff29e.js +1 -0
  372. package/dist/standalone/.next/static/chunks/app/api/limits/route-c132c5ba005ff29e.js +1 -0
  373. package/dist/standalone/.next/static/chunks/app/api/log/preflight/route-c132c5ba005ff29e.js +1 -0
  374. package/dist/standalone/.next/static/chunks/app/api/log/project-delete/route-c132c5ba005ff29e.js +1 -0
  375. package/dist/standalone/.next/static/chunks/app/api/log/provenance/route-c132c5ba005ff29e.js +1 -0
  376. package/dist/standalone/.next/static/chunks/app/api/log/route-c132c5ba005ff29e.js +1 -0
  377. package/dist/standalone/.next/static/chunks/app/api/logs/route-c132c5ba005ff29e.js +1 -0
  378. package/dist/standalone/.next/static/chunks/app/api/logs/stream/route-c132c5ba005ff29e.js +1 -0
  379. package/dist/standalone/.next/static/chunks/app/api/monitor/lock/route-c132c5ba005ff29e.js +1 -0
  380. package/dist/standalone/.next/static/chunks/app/api/monitor/runs/route-c132c5ba005ff29e.js +1 -0
  381. package/dist/standalone/.next/static/chunks/app/api/orchestrator/rotate/route-c132c5ba005ff29e.js +1 -0
  382. package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/route-c132c5ba005ff29e.js +1 -0
  383. package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/status/route-c132c5ba005ff29e.js +1 -0
  384. package/dist/standalone/.next/static/chunks/app/api/pipelines/[id]/route-c132c5ba005ff29e.js +1 -0
  385. package/dist/standalone/.next/static/chunks/app/api/pipelines/preflight/route-c132c5ba005ff29e.js +1 -0
  386. package/dist/standalone/.next/static/chunks/app/api/pipelines/route-c132c5ba005ff29e.js +1 -0
  387. package/dist/standalone/.next/static/chunks/app/api/pipelines/tick/route-c132c5ba005ff29e.js +1 -0
  388. package/dist/standalone/.next/static/chunks/app/api/proc/route-c132c5ba005ff29e.js +1 -0
  389. package/dist/standalone/.next/static/chunks/app/api/projects/create/route-c132c5ba005ff29e.js +1 -0
  390. package/dist/standalone/.next/static/chunks/app/api/projects/crown/route-c132c5ba005ff29e.js +1 -0
  391. package/dist/standalone/.next/static/chunks/app/api/push/route-c132c5ba005ff29e.js +1 -0
  392. package/dist/standalone/.next/static/chunks/app/api/resources/route-c132c5ba005ff29e.js +1 -0
  393. package/dist/standalone/.next/static/chunks/app/api/roles/route-c132c5ba005ff29e.js +1 -0
  394. package/dist/standalone/.next/static/chunks/app/api/runtime/answer/route-c132c5ba005ff29e.js +1 -0
  395. package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/[deploymentId]/route-c132c5ba005ff29e.js +1 -0
  396. package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/capabilities/v1/route-c132c5ba005ff29e.js +1 -0
  397. package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/route-c132c5ba005ff29e.js +1 -0
  398. package/dist/standalone/.next/static/chunks/app/api/runtime/interrupt/route-c132c5ba005ff29e.js +1 -0
  399. package/dist/standalone/.next/static/chunks/app/api/runtime/operations/[operationId]/route-c132c5ba005ff29e.js +1 -0
  400. package/dist/standalone/.next/static/chunks/app/api/runtime/operations/route-c132c5ba005ff29e.js +1 -0
  401. package/dist/standalone/.next/static/chunks/app/api/runtime/realtime/route-c132c5ba005ff29e.js +1 -0
  402. package/dist/standalone/.next/static/chunks/app/api/runtime/send/route-c132c5ba005ff29e.js +1 -0
  403. package/dist/standalone/.next/static/chunks/app/api/runtime/snapshot/route-c132c5ba005ff29e.js +1 -0
  404. package/dist/standalone/.next/static/chunks/app/api/runtime/spawn/route-c132c5ba005ff29e.js +1 -0
  405. package/dist/standalone/.next/static/chunks/app/api/runtime/steer/route-c132c5ba005ff29e.js +1 -0
  406. package/dist/standalone/.next/static/chunks/app/api/runtime/stream/route-c132c5ba005ff29e.js +1 -0
  407. package/dist/standalone/.next/static/chunks/app/api/search/transcripts/route-c132c5ba005ff29e.js +1 -0
  408. package/dist/standalone/.next/static/chunks/app/api/session/route-c132c5ba005ff29e.js +1 -0
  409. package/dist/standalone/.next/static/chunks/app/api/session/supersedence/route-c132c5ba005ff29e.js +1 -0
  410. package/dist/standalone/.next/static/chunks/app/api/session/title/route-c132c5ba005ff29e.js +1 -0
  411. package/dist/standalone/.next/static/chunks/app/api/spawn/policy/route-c132c5ba005ff29e.js +1 -0
  412. package/dist/standalone/.next/static/chunks/app/api/spawn/route-c132c5ba005ff29e.js +1 -0
  413. package/dist/standalone/.next/static/chunks/app/api/staging/route-c132c5ba005ff29e.js +1 -0
  414. package/dist/standalone/.next/static/chunks/app/api/task-attachments/route-c132c5ba005ff29e.js +1 -0
  415. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/assignment/route-c132c5ba005ff29e.js +1 -0
  416. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-c132c5ba005ff29e.js +1 -0
  417. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-c132c5ba005ff29e.js +1 -0
  418. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-c132c5ba005ff29e.js +1 -0
  419. package/dist/standalone/.next/static/chunks/app/api/tasks/curator/route-c132c5ba005ff29e.js +1 -0
  420. package/dist/standalone/.next/static/chunks/app/api/tasks/route-c132c5ba005ff29e.js +1 -0
  421. package/dist/standalone/.next/static/chunks/app/api/telegram/reports/route-c132c5ba005ff29e.js +1 -0
  422. package/dist/standalone/.next/static/chunks/app/api/telegram/route-c132c5ba005ff29e.js +1 -0
  423. package/dist/standalone/.next/static/chunks/app/api/timeline/route-c132c5ba005ff29e.js +1 -0
  424. package/dist/standalone/.next/static/chunks/app/api/tmux/route-c132c5ba005ff29e.js +1 -0
  425. package/dist/standalone/.next/static/chunks/app/api/tmux/targets/route-c132c5ba005ff29e.js +1 -0
  426. package/dist/standalone/.next/static/chunks/app/api/transcribe/backend/route-c132c5ba005ff29e.js +1 -0
  427. package/dist/standalone/.next/static/chunks/app/api/transcribe/route-c132c5ba005ff29e.js +1 -0
  428. package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-c132c5ba005ff29e.js +1 -0
  429. package/dist/standalone/.next/static/chunks/app/api/tts/backend/route-c132c5ba005ff29e.js +1 -0
  430. package/dist/standalone/.next/static/chunks/app/api/tts/route-c132c5ba005ff29e.js +1 -0
  431. package/dist/standalone/.next/static/chunks/app/api/view/presence/route-c132c5ba005ff29e.js +1 -0
  432. package/dist/standalone/.next/static/chunks/app/api/workflows/[id]/route-c132c5ba005ff29e.js +1 -0
  433. package/dist/standalone/.next/static/chunks/app/api/workflows/route-c132c5ba005ff29e.js +1 -0
  434. package/dist/standalone/.next/static/chunks/app/page-ac9463b910bf83fe.js +77 -0
  435. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-c132c5ba005ff29e.js +1 -0
  436. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-c132c5ba005ff29e.js +1 -0
  437. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-c132c5ba005ff29e.js +1 -0
  438. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-c132c5ba005ff29e.js +1 -0
  439. package/dist/standalone/.next/static/chunks/webpack-1637988d4c7cf23c.js +1 -0
  440. package/dist/standalone/.next/static/css/498f12ddef7ecb0e.css +1 -0
  441. package/dist/standalone/.next/static/kt9OPe8iwfpNcdOX9ygvb/_buildManifest.js +1 -0
  442. package/dist/standalone/.next/static/media/pdf.worker.min.e890bf87.mjs +6 -0
  443. package/dist/standalone/package.json +9 -5
  444. package/dist/standalone/server.bun.js +38 -0
  445. package/dist/standalone/server.js +18 -37
  446. package/package.json +9 -5
  447. package/vendor/telegram-mcp/.python-version +1 -0
  448. package/vendor/telegram-mcp/LICENSE +201 -0
  449. package/vendor/telegram-mcp/PROVENANCE.md +70 -0
  450. package/vendor/telegram-mcp/SHA256SUMS +24 -0
  451. package/vendor/telegram-mcp/main.py +67 -0
  452. package/vendor/telegram-mcp/pyproject.toml +100 -0
  453. package/vendor/telegram-mcp/requirements.txt +7 -0
  454. package/vendor/telegram-mcp/sanitize.py +143 -0
  455. package/vendor/telegram-mcp/session_string_generator.py +259 -0
  456. package/vendor/telegram-mcp/telegram_mcp/__init__.py +15 -0
  457. package/vendor/telegram-mcp/telegram_mcp/client_identity.py +31 -0
  458. package/vendor/telegram-mcp/telegram_mcp/install_guard.py +209 -0
  459. package/vendor/telegram-mcp/telegram_mcp/runner.py +198 -0
  460. package/vendor/telegram-mcp/telegram_mcp/runtime.py +1812 -0
  461. package/vendor/telegram-mcp/telegram_mcp/singleton.py +143 -0
  462. package/vendor/telegram-mcp/telegram_mcp/tools/__init__.py +13 -0
  463. package/vendor/telegram-mcp/telegram_mcp/tools/accounts.py +31 -0
  464. package/vendor/telegram-mcp/telegram_mcp/tools/chats.py +1163 -0
  465. package/vendor/telegram-mcp/telegram_mcp/tools/contacts.py +802 -0
  466. package/vendor/telegram-mcp/telegram_mcp/tools/events.py +485 -0
  467. package/vendor/telegram-mcp/telegram_mcp/tools/folders.py +600 -0
  468. package/vendor/telegram-mcp/telegram_mcp/tools/groups.py +1286 -0
  469. package/vendor/telegram-mcp/telegram_mcp/tools/media.py +470 -0
  470. package/vendor/telegram-mcp/telegram_mcp/tools/messages.py +2041 -0
  471. package/vendor/telegram-mcp/telegram_mcp/tools/profile.py +449 -0
  472. package/vendor/telegram-mcp/uv.lock +1693 -0
  473. package/dist/standalone/.next/server/app/api/orchestrator/route.js +0 -1
  474. package/dist/standalone/.next/server/app/api/orchestrator/route_client-reference-manifest.js +0 -1
  475. package/dist/standalone/.next/server/chunks/1699.js +0 -1
  476. package/dist/standalone/.next/server/chunks/2596.js +0 -1
  477. package/dist/standalone/.next/server/chunks/3886.js +0 -1
  478. package/dist/standalone/.next/server/chunks/4792.js +0 -101
  479. package/dist/standalone/.next/server/chunks/5622.js +0 -2
  480. package/dist/standalone/.next/server/chunks/616.js +0 -42
  481. package/dist/standalone/.next/server/chunks/620.js +0 -1
  482. package/dist/standalone/.next/server/chunks/6299.js +0 -4
  483. package/dist/standalone/.next/server/chunks/9598.js +0 -1
  484. package/dist/standalone/.next/server/chunks/9936.js +0 -6
  485. package/dist/standalone/.next/static/5aZdjqUDNxpxX8nVsuO2S/_buildManifest.js +0 -1
  486. package/dist/standalone/.next/static/chunks/9260-0e7e550c65609f11.js +0 -1
  487. package/dist/standalone/.next/static/chunks/app/_global-error/page-483eb859fba02a43.js +0 -1
  488. package/dist/standalone/.next/static/chunks/app/api/access/route-483eb859fba02a43.js +0 -1
  489. package/dist/standalone/.next/static/chunks/app/api/account-migrations/[intentId]/route-483eb859fba02a43.js +0 -1
  490. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/[id]/status/route-483eb859fba02a43.js +0 -1
  491. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/active/route-483eb859fba02a43.js +0 -1
  492. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/input/route-483eb859fba02a43.js +0 -1
  493. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/route-483eb859fba02a43.js +0 -1
  494. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/policy/route-483eb859fba02a43.js +0 -1
  495. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/route-483eb859fba02a43.js +0 -1
  496. package/dist/standalone/.next/static/chunks/app/api/accounts/claude/terminal/route-483eb859fba02a43.js +0 -1
  497. package/dist/standalone/.next/static/chunks/app/api/accounts/codex/active/route-483eb859fba02a43.js +0 -1
  498. package/dist/standalone/.next/static/chunks/app/api/accounts/codex/policy/route-483eb859fba02a43.js +0 -1
  499. package/dist/standalone/.next/static/chunks/app/api/accounts/codex/route-483eb859fba02a43.js +0 -1
  500. package/dist/standalone/.next/static/chunks/app/api/accounts/codex/terminal/route-483eb859fba02a43.js +0 -1
  501. package/dist/standalone/.next/static/chunks/app/api/accounts/route-483eb859fba02a43.js +0 -1
  502. package/dist/standalone/.next/static/chunks/app/api/agent/route-483eb859fba02a43.js +0 -1
  503. package/dist/standalone/.next/static/chunks/app/api/agent/snapshot/route-483eb859fba02a43.js +0 -1
  504. package/dist/standalone/.next/static/chunks/app/api/answer/route-483eb859fba02a43.js +0 -1
  505. package/dist/standalone/.next/static/chunks/app/api/attach-command/route-483eb859fba02a43.js +0 -1
  506. package/dist/standalone/.next/static/chunks/app/api/attention/[id]/route-483eb859fba02a43.js +0 -1
  507. package/dist/standalone/.next/static/chunks/app/api/attention/route-483eb859fba02a43.js +0 -1
  508. package/dist/standalone/.next/static/chunks/app/api/board/route-483eb859fba02a43.js +0 -1
  509. package/dist/standalone/.next/static/chunks/app/api/bridge/route-483eb859fba02a43.js +0 -1
  510. package/dist/standalone/.next/static/chunks/app/api/conversations/[conversationId]/migration/route-483eb859fba02a43.js +0 -1
  511. package/dist/standalone/.next/static/chunks/app/api/conversations/route-483eb859fba02a43.js +0 -1
  512. package/dist/standalone/.next/static/chunks/app/api/files/route-483eb859fba02a43.js +0 -1
  513. package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-483eb859fba02a43.js +0 -1
  514. package/dist/standalone/.next/static/chunks/app/api/flows/route-483eb859fba02a43.js +0 -1
  515. package/dist/standalone/.next/static/chunks/app/api/image/route-483eb859fba02a43.js +0 -1
  516. package/dist/standalone/.next/static/chunks/app/api/inbox/route-483eb859fba02a43.js +0 -1
  517. package/dist/standalone/.next/static/chunks/app/api/lifecycle/reaper/route-483eb859fba02a43.js +0 -1
  518. package/dist/standalone/.next/static/chunks/app/api/limits/history/route-483eb859fba02a43.js +0 -1
  519. package/dist/standalone/.next/static/chunks/app/api/limits/route-483eb859fba02a43.js +0 -1
  520. package/dist/standalone/.next/static/chunks/app/api/log/preflight/route-483eb859fba02a43.js +0 -1
  521. package/dist/standalone/.next/static/chunks/app/api/log/project-delete/route-483eb859fba02a43.js +0 -1
  522. package/dist/standalone/.next/static/chunks/app/api/log/route-483eb859fba02a43.js +0 -1
  523. package/dist/standalone/.next/static/chunks/app/api/logs/route-483eb859fba02a43.js +0 -1
  524. package/dist/standalone/.next/static/chunks/app/api/logs/stream/route-483eb859fba02a43.js +0 -1
  525. package/dist/standalone/.next/static/chunks/app/api/monitor/lock/route-483eb859fba02a43.js +0 -1
  526. package/dist/standalone/.next/static/chunks/app/api/monitor/runs/route-483eb859fba02a43.js +0 -1
  527. package/dist/standalone/.next/static/chunks/app/api/orchestrator/rotate/route-483eb859fba02a43.js +0 -1
  528. package/dist/standalone/.next/static/chunks/app/api/orchestrator/route-483eb859fba02a43.js +0 -1
  529. package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/route-483eb859fba02a43.js +0 -1
  530. package/dist/standalone/.next/static/chunks/app/api/pipelines/[id]/route-483eb859fba02a43.js +0 -1
  531. package/dist/standalone/.next/static/chunks/app/api/pipelines/preflight/route-483eb859fba02a43.js +0 -1
  532. package/dist/standalone/.next/static/chunks/app/api/pipelines/route-483eb859fba02a43.js +0 -1
  533. package/dist/standalone/.next/static/chunks/app/api/pipelines/tick/route-483eb859fba02a43.js +0 -1
  534. package/dist/standalone/.next/static/chunks/app/api/proc/route-483eb859fba02a43.js +0 -1
  535. package/dist/standalone/.next/static/chunks/app/api/push/route-483eb859fba02a43.js +0 -1
  536. package/dist/standalone/.next/static/chunks/app/api/resources/route-483eb859fba02a43.js +0 -1
  537. package/dist/standalone/.next/static/chunks/app/api/roles/route-483eb859fba02a43.js +0 -1
  538. package/dist/standalone/.next/static/chunks/app/api/runtime/answer/route-483eb859fba02a43.js +0 -1
  539. package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/[deploymentId]/route-483eb859fba02a43.js +0 -1
  540. package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/capabilities/v1/route-483eb859fba02a43.js +0 -1
  541. package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/route-483eb859fba02a43.js +0 -1
  542. package/dist/standalone/.next/static/chunks/app/api/runtime/interrupt/route-483eb859fba02a43.js +0 -1
  543. package/dist/standalone/.next/static/chunks/app/api/runtime/operations/[operationId]/route-483eb859fba02a43.js +0 -1
  544. package/dist/standalone/.next/static/chunks/app/api/runtime/operations/route-483eb859fba02a43.js +0 -1
  545. package/dist/standalone/.next/static/chunks/app/api/runtime/realtime/route-483eb859fba02a43.js +0 -1
  546. package/dist/standalone/.next/static/chunks/app/api/runtime/send/route-483eb859fba02a43.js +0 -1
  547. package/dist/standalone/.next/static/chunks/app/api/runtime/snapshot/route-483eb859fba02a43.js +0 -1
  548. package/dist/standalone/.next/static/chunks/app/api/runtime/spawn/route-483eb859fba02a43.js +0 -1
  549. package/dist/standalone/.next/static/chunks/app/api/runtime/steer/route-483eb859fba02a43.js +0 -1
  550. package/dist/standalone/.next/static/chunks/app/api/runtime/stream/route-483eb859fba02a43.js +0 -1
  551. package/dist/standalone/.next/static/chunks/app/api/session/route-483eb859fba02a43.js +0 -1
  552. package/dist/standalone/.next/static/chunks/app/api/session/supersedence/route-483eb859fba02a43.js +0 -1
  553. package/dist/standalone/.next/static/chunks/app/api/session/title/route-483eb859fba02a43.js +0 -1
  554. package/dist/standalone/.next/static/chunks/app/api/spawn/policy/route-483eb859fba02a43.js +0 -1
  555. package/dist/standalone/.next/static/chunks/app/api/spawn/route-483eb859fba02a43.js +0 -1
  556. package/dist/standalone/.next/static/chunks/app/api/staging/route-483eb859fba02a43.js +0 -1
  557. package/dist/standalone/.next/static/chunks/app/api/task-attachments/route-483eb859fba02a43.js +0 -1
  558. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/assignment/route-483eb859fba02a43.js +0 -1
  559. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-483eb859fba02a43.js +0 -1
  560. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-483eb859fba02a43.js +0 -1
  561. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-483eb859fba02a43.js +0 -1
  562. package/dist/standalone/.next/static/chunks/app/api/tasks/curator/route-483eb859fba02a43.js +0 -1
  563. package/dist/standalone/.next/static/chunks/app/api/tasks/route-483eb859fba02a43.js +0 -1
  564. package/dist/standalone/.next/static/chunks/app/api/timeline/route-483eb859fba02a43.js +0 -1
  565. package/dist/standalone/.next/static/chunks/app/api/tmux/route-483eb859fba02a43.js +0 -1
  566. package/dist/standalone/.next/static/chunks/app/api/tmux/targets/route-483eb859fba02a43.js +0 -1
  567. package/dist/standalone/.next/static/chunks/app/api/transcribe/backend/route-483eb859fba02a43.js +0 -1
  568. package/dist/standalone/.next/static/chunks/app/api/transcribe/route-483eb859fba02a43.js +0 -1
  569. package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-483eb859fba02a43.js +0 -1
  570. package/dist/standalone/.next/static/chunks/app/api/tts/backend/route-483eb859fba02a43.js +0 -1
  571. package/dist/standalone/.next/static/chunks/app/api/tts/route-483eb859fba02a43.js +0 -1
  572. package/dist/standalone/.next/static/chunks/app/api/view/presence/route-483eb859fba02a43.js +0 -1
  573. package/dist/standalone/.next/static/chunks/app/api/workflows/[id]/route-483eb859fba02a43.js +0 -1
  574. package/dist/standalone/.next/static/chunks/app/api/workflows/route-483eb859fba02a43.js +0 -1
  575. package/dist/standalone/.next/static/chunks/app/page-45fd788b5dbb86eb.js +0 -57
  576. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-483eb859fba02a43.js +0 -1
  577. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-483eb859fba02a43.js +0 -1
  578. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-483eb859fba02a43.js +0 -1
  579. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-483eb859fba02a43.js +0 -1
  580. package/dist/standalone/.next/static/chunks/webpack-46c1a0323c2ca312.js +0 -1
  581. package/dist/standalone/.next/static/css/b5b2fbc52caf460a.css +0 -1
  582. /package/dist/standalone/.next/static/{5aZdjqUDNxpxX8nVsuO2S → kt9OPe8iwfpNcdOX9ygvb}/_ssgManifest.js +0 -0
@@ -1,57 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{1541:(e,t,n)=>{"use strict";n.d(t,{vK:()=>eW,sI:()=>Z,tr:()=>X});var r=n(1691);function i(e){return"string"==typeof e?e:""}function a(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}var s=n(4654),l=n(9554);let o="\x3c!-- llv:structured-user --\x3e\n",c=/^<!-- llv:structured-user sha256=([a-f0-9]{64}) -->\n/;function d(e){let t=e.match(c);return t?{text:e.slice(t[0].length),structured:!0,contentDigest:t[1]}:e.startsWith(o)?{text:e.slice(o.length),structured:!0,contentDigest:null}:{text:e,structured:!1,contentDigest:null}}var u=n(5606),p=n(3550),m=n(6505);let f=/\x1b\[[0-9;?]*[\x20-\x2f]*[\x40-\x7e]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[\x40-\x5f]/g;function h(e,t,n){if(!t)return;let r=e.at(-1);if(r&&r.changed===n){r.text+=t;return}e.push({text:t,changed:n})}function x(e,t){let n=[];for(let r of e)"same"===r.kind?h(n,r.text,!1):r.kind===t&&h(n,r.text,!0);return n}function g(e){return e.length?e.split("\n"):[]}function b(e){return"delete"===e.op||"move"===e.op||e.hunks.some(e=>e.lines.length>0)}function v(e){let t=e.filter(b),n=t.length>8,i=t.slice(0,8),a={remaining:64e3};return{files:i.map(e=>(function(e,t){var n;let i=0,a=0;for(let t of e.hunks)for(let e of t.lines)"+"===e.t?i+=1:"-"===e.t&&(a+=1);if(!((n=e.content).length<=2e4)&&(n.match(/\s/g)?.length??0)/n.length<.02)return{path:e.path,op:e.op,hunks:[],added:i,removed:a,binary:!0,truncated:!1};let s=!1,l=0,o=0,c=[];for(let n of e.hunks){if(o>=16){s=!0;break}let e=[],i=!1;for(let a of n.lines){if(l>=200){s=!0,i=!0;break}let n=(0,r.fp)(a.text);if(n.length>2e3&&(n=n.slice(0,2e3),s=!0),t.remaining-n.length<0){s=!0,i=!0;break}t.remaining-=n.length,e.push({t:a.t,text:n}),l+=1}if(e.length){let t=function(e){let t=e.map(e=>({...e})),n=0;for(;n<t.length;){if("-"!==t[n].t){n+=1;continue}let e=n;for(;n<t.length&&"-"===t[n].t;)n+=1;let r=n;for(;n<t.length&&"+"===t[n].t;)n+=1;let i=Math.min(r-e,n-r);for(let n=0;n<i;n+=1){let i=t[e+n],a=t[r+n];if(i.text===a.text)continue;let s=function(e,t){let n=Array.from(e),r=Array.from(t);if(!n.length||!r.length||n.length*r.length>25e4)return null;let i=r.length+1,a=new Uint16Array((n.length+1)*i);for(let e=1;e<=n.length;e+=1)for(let t=1;t<=r.length;t+=1)a[e*i+t]=n[e-1]===r[t-1]?a[(e-1)*i+t-1]+1:Math.max(a[(e-1)*i+t],a[e*i+t-1]);if(a[n.length*i+r.length]/Math.max(n.length,r.length)<.5)return null;let s=[],l=n.length,o=r.length;for(;l||o;)l&&o&&n[l-1]===r[o-1]?(s.push({kind:"same",text:n[l-1]}),l-=1,o-=1):l&&(!o||a[(l-1)*i+o]>=a[l*i+o-1])?(s.push({kind:"remove",text:n[l-1]}),l-=1):(s.push({kind:"add",text:r[o-1]}),o-=1);return s.reverse()}(i.text,a.text);s&&(i.intraline=x(s,"remove"),a.intraline=x(s,"add"))}}return t}(e);c.push(n.header?{header:n.header,lines:t}:{lines:t}),o+=1}if(i)break}return{path:e.path,op:e.op,hunks:c,added:i,removed:a,binary:!1,truncated:s}})(e,a)),filesTruncated:n}}let w={files:[],filesTruncated:!1};function y(e,t){let n=[];for(let t of g(e))n.push({t:"-",text:t});for(let e of g(t))n.push({t:"+",text:e});return{hunk:{lines:n},content:`${e}
2
- ${t}`}}function k(e){return"string"==typeof e?e:""}function j(e){return"string"==typeof e&&e.trim().length>0?e:null}let N=/^\*{0,3}\s*Add File:\s*(.+)$/,S=/^\*{0,3}\s*Update File:\s*(.+)$/,C=/^\*{0,3}\s*Delete File:\s*(.+)$/,A=/^\*{0,3}\s*Move to:\s*(.+)$/,I=/^@@(.*)$/;function M(e){let t=[],n=null,r=null,i=e=>{n&&(r=void 0!==e?{header:e,lines:[]}:{lines:[]},n.hunks.push(r))},a=e=>{n&&(r||i(),r.lines.push(e))};for(let s of e.split("\n")){if(/^\*{3}\s*(Begin|End) Patch/.test(s))continue;let e=s.match(N),l=s.match(S),o=s.match(C),c=s.match(A);if(e){n={path:e[1].trim(),op:"add",hunks:[],content:""},r=null,t.push(n);continue}if(l){n={path:l[1].trim(),op:"update",hunks:[],content:""},r=null,t.push(n);continue}if(o){n={path:o[1].trim(),op:"delete",hunks:[],content:""},r=null,t.push(n);continue}if(c&&n){n.op="move",n.path=c[1].trim();continue}let d=s.match(I);if(d){i(d[1].trim());continue}if(!n)continue;let u=s[0];a("+"===u?{t:"+",text:s.slice(1)}:"-"===u?{t:"-",text:s.slice(1)}:{t:" ",text:s.startsWith(" ")?s.slice(1):s})}for(let e of t)e.content=e.hunks.flatMap(e=>e.lines.map(e=>e.text)).join("\n");return v(t)}function T(e,t){return"Write"===e?function(e){let t=j(e.file_path??e.path),n=k(e.content??e.new_string);if(!t)return w;let{hunk:r,content:i}=y("",n);return v([{path:t,op:"add",hunks:[r],content:i}])}(t):"Edit"===e||"MultiEdit"===e||"NotebookEdit"===e?function(e){let t=j(e.file_path??e.path??e.notebook_path);if(!t)return w;let n=Array.isArray(e.edits)?e.edits.filter(e=>!!e&&"object"==typeof e):[{old_string:e.old_string,new_string:e.new_string??e.new_source??e.content}],r=[],i=[],a=!1;for(let e of n){let t=k(e.old_string),n=k(e.new_string??e.new_source??e.content);if(!t&&!n)continue;t&&(a=!0);let{hunk:s,content:l}=y(t,n);r.push(s),i.push(l)}return r.length?v([{path:t,op:a?"update":"add",hunks:r,content:i.join("\n")}]):w}(t):"apply_patch"===e?M(k(t.input)):w}let $=(e,t)=>(0,s.Tl)((0,s.JK)(),e,t),E={shell:"shell",read:"file",write:"file",edit:"edit",search:"search",web:"web",spawn:"spawn",plan:"plan",mcp:"tool",other:"tool"};function R(e){return"string"==typeof e?e:""}function P(e){return"number"==typeof e&&Number.isFinite(e)?e:"string"==typeof e&&e.trim()&&Number.isFinite(Number(e))?Number(e):void 0}function O(e){return"string"==typeof e?e.trim():"number"==typeof e&&Number.isFinite(e)?String(e):""}function D(e){let t=e.replace(/[/\\]+$/,"");return(t.split(/[/\\]/).pop()??t)||t}function L(e){for(let t of Object.values(e))if("string"==typeof t&&t.trim())return t;return""}function F(e,t){let n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function _(e){return F((0,r.fp)(e),160)}function q(e,t){let n=F((0,r.fp)(e),120);return t?{label:t,value:n}:{value:n}}let z=new Set(["Bash","exec_command","shell","local_shell","run_command"]),H=new Set(["Read"]),B=new Set(["Write"]),U=new Set(["Edit","MultiEdit","NotebookEdit","apply_patch"]),K=new Set(["Grep","Glob"]),Y=new Set(["WebFetch","WebSearch"]),W=new Set(["Task","Agent","Workflow","Skill"]),J=new Set(["TodoWrite","TaskCreate","TaskUpdate","EnterPlanMode","ExitPlanMode"]);function V(e){return/^mcp__/.test(e)?"mcp":z.has(e)?"shell":H.has(e)?"read":B.has(e)?"write":U.has(e)?"edit":K.has(e)?"search":Y.has(e)?"web":W.has(e)?"spawn":J.has(e)?"plan":"other"}function G(e,t,n,r){let i=V(e),a=E[i],s=(e,t=[])=>({family:i,icon:a,summary:_(e),chips:t.slice(0,4)});if("write_stdin"===e){let e=O(t.session_id??t.cell_id),n=R(t.chars),r=0===n.length?$("tools.stdinPoll"):n.replace(/\r\n|\r|\n/g,"⏎").replace(/\t/g,"⇥").replace(/ /g,"␠").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,e=>{let t=e.charCodeAt(0);return"^"+String.fromCharCode(127===t?63:t+64)}),i=e?`${$("tools.stdin")} → ${e} \xb7 ${r}`:`${$("tools.stdin")} \xb7 ${r}`;return{family:"shell",icon:E.shell,summary:_(i),chips:e?[q(e,$("tools.session"))]:[]}}if("wait"===e){let e=O(t.cell_id??t.session_id),n=e?`${$("tools.wait")} \xb7 ${e}`:$("tools.wait");return{family:"shell",icon:E.shell,summary:_(n),chips:e?[q(e,$("tools.session"))]:[]}}let l=(0,p.$f)(e);if(l){if("wakeup"===l){let e=R(t.reason);return{family:"plan",icon:"clock",summary:_(e?`${$("tools.wakeup")} \xb7 ${e}`:$("tools.wakeup")),chips:[]}}if("cron"===l){let e=R(t.schedule??t.cron??t.interval??t.when),n=[e,R(t.name??t.prompt??t.task??t.description)].filter(Boolean).join(" \xb7 "),r=n?`${$("tools.cron")} \xb7 ${n}`:$("tools.cron"),i=[];return e&&i.push(q(e,$("tools.schedule"))),{family:"plan",icon:"clock",summary:_(r),chips:i}}let e=R(t.reason??t.until??t.description??t.target)||L(t);return{family:"plan",icon:"clock",summary:_(e?`${$("tools.monitor")} \xb7 ${e}`:$("tools.monitor")),chips:[]}}switch(i){case"shell":return s(function(e){let t,n=e;do t=n,n=(n=(n=(n=n.replace(/^export PATH=[^;]+;\s*/,"")).replace(/^cd\s+\S+\s*&&\s*/,"")).replace(/^\/usr\/bin\/zsh -lc\s+/,"")).replace(/^(["'])([\s\S]*)\1$/,(e,t,n)=>RegExp(`(?<!\\\\)${t}`).test(n)?e:n);while(n!==t);let r=n.match(/^([\w./-]+(?:\s+-)?)\s*<<\s*['"]?(\w+)['"]?/);return r&&(n=`${r[1].trim()} \xabheredoc\xbb`),n.replace(/\s+/g," ").trim()}("codex"===n?R(t.cmd??t.command):R(t.command??t.cmd))||e,[]);case"read":{let{summary:e,chips:n}=function(e){let t=R(e.file_path??e.path);if(!t)return{summary:$("tools.read"),chips:[]};let n=D(t),r=P(e.offset),i=P(e.limit),a=void 0!==r?void 0!==i?`:${r}–${r+i}`:`:${r}`:"";return{summary:`${$("tools.read")} ${n}${a?` \xb7 ${a}`:""}`,chips:[q(t)]}}(t);return s(e,n)}case"write":{let e=R(t.content??t.new_string),n=R(t.file_path??t.path),r=e?e.split("\n").length:0,i=n?D(n):"";return s(i?`${$("tools.write")} ${i} \xb7 ${$("tools.lines",{count:r})}`:$("tools.write"),n?[q(n)]:[])}case"edit":{let{summary:n,chips:i}=function(e){let{added:t,removed:n}=function(e){let t=0,n=0;for(let r of e.files)t+=r.added,n+=r.removed;return{added:t,removed:n}}(e),r=`+${t} −${n}`,i=e.files;if(0===i.length)return{summary:$("tools.edit"),chips:[]};let a=i.slice(0,4).map(e=>q(e.path));return 1===i.length?{summary:`${$("tools.edit")} ${D(i[0].path)} \xb7 ${r}`,chips:a}:{summary:`${$("tools.edit")} \xb7 ${$("tools.files",{count:i.length})} \xb7 ${r}`,chips:a}}(r??T(e,t));return s(n,i)}case"search":{let n=R(t.pattern??t.query??t.regex),r=R(t.path??t.glob??t.include),i=n?`"${n}"${r?` \xb7 ${r}`:""}`:e,a=[];return n&&a.push(q(n)),r&&a.push(q(r)),s(i,a)}case"web":{let n=R(t.url);if(n)return s(function(e){try{let t=new URL(e),n=`${t.host}${t.pathname}`.replace(/\/$/,"");return n.length>80?n.slice(0,79)+"…":n}catch{return e.length>80?e.slice(0,79)+"…":e}}(n),[q(n)]);let r=R(t.query);return s(r?`"${r}"`:e,r?[q(r)]:[])}case"spawn":{let n=R(t.subagent_type??t.agentType??t.skill??t.command??t.name??t.type),r=R(t.description??t.prompt??t.task),i=[n,r].filter(Boolean).join(" \xb7 ")||e,a=[];return n&&a.push(q(n)),r&&a.push(q(r)),s(i,a)}case"plan":{let n=Array.isArray(t.todos)?t.todos.length:void 0,r=void 0!==n?$("tools.items",{count:n}):L(t);return s(r?`${e} \xb7 ${r}`:e,r?[q(r)]:[])}case"mcp":{let n=e.replace(/^mcp__/,"").split("__"),r=n[0]??e,i=n.slice(1).join("__")||e,a=L(t);return s(`${r} \xb7 ${i}${a?` \xb7 ${a}`:""}`,a?[q(a)]:[])}default:{let n=L(t);return s(n?`${e}: ${n}`:e,n?[q(n)]:[])}}}let X=(e,t)=>(0,s.Tl)((0,s.JK)(),e,t),Q=new WeakMap;function Z(e,t){let n=Q.get(e),r=Q.get(t);return void 0!==n||void 0!==r?void 0!==n&&n===r:void 0!==e.session&&e.session===t.session}function ee(e,t){return void 0!==t&&Q.set(e,t),e}let et=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function en(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}let er=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,ei=/\S*\/(?:agent-log-viewer\/inbox|\.claude\/viewer-inbox)\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function ea(e){if(!e.includes("/.claude/viewer-inbox/")&&!e.includes("/agent-log-viewer/inbox/"))return{cleaned:e,images:[]};let t=[],n=new Set,r=[];for(let i of e.split("\n"))i.replace(ei,(e,r)=>(n.has(e)||(n.add(e),t.push({name:r,path:e})),"")).trim()&&r.push(i);return{cleaned:r.join("\n").trim(),images:t}}function es(e,t){let n=e.match(/^\s*<([a-zA-Z][\w:-]*)/)?.[1];return n||(/^\s*# AGENTS\.md/.test(e)?"AGENTS.md":/^\s*Caveat:/.test(e)?"caveat":t||X("render.system"))}function el(e,t){return e.match(RegExp(`${t}="([^"]*)"`))?.[1]??""}function eo(e){return"string"==typeof e?e:""}function ec(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function ed(e){return Array.isArray(e)?e.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)):[]}function eu(e){try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}function ep(e){let t=ec(e),n=eo(t.server),r=eo(t.tool);return n&&r&&(0,u.I)(n)?{serverName:n,toolName:r,args:ec(t.arguments),result:null}:null}function em(e){return"string"==typeof e?e.trim().length>0:"number"==typeof e||"boolean"==typeof e||(Array.isArray(e)?e.some(em):null!==e&&"object"==typeof e&&Object.values(e).some(em))}function ef(e){let t=e.trim().replace(/[_-]/g," ");return t?`Attachment: ${t.slice(0,80)}${t.length>80?"…":""}`:"Attachment"}function eh(e){let{images:t}=ea(e);return t.map(e=>({kind:"inbox-image",...e}))}function ex(e){let t=[],n=[];for(let r of ed(e)){let e=eo(r.type),i=eo(r.text)||eo(r.input_text)||eo(r.output_text);if(i&&t.push(i),"input_image"===e||"image"===e){let t=eo(ec(r.image_url).path)||eo(ec(r.source).path),i=t?eh(t):[];if(i.length){n.push(...i);continue}let a=function(e){let t=e.match(/^data:([^;,]+);base64,([A-Za-z0-9+/=]+)$/i);if(!t)return null;let n=t[1].toLowerCase();return!(0,l.PG)(n)||function(e){if(!e.length)return 0;let t=e.endsWith("==")?2:+!!e.endsWith("=");return Math.floor(3*e.length/4)-t}(t[2])>l.YP?null:{kind:"image",media:n,data:t[2]}}(eo(r.image_url)||eo(ec(r.image_url).url)||eo(r.data));a?n.push(a):em(r)&&n.push({kind:"note",text:ef(e)});continue}if("local-image"===e||"local_image"===e||"localImage"===e){let t=eh(eo(r.path)||eo(r.local_path)||eo(r.image_url)||eo(r.url));t.length?n.push(...t):em(r)&&n.push({kind:"note",text:ef(e)});continue}("input_text"!==e&&"text"!==e&&"output_text"!==e||!i)&&!i&&em(r)&&n.push({kind:"note",text:ef(e)})}return{...d(t.join(" ").trim()),attachments:n}}function eg(e){return"string"==typeof e?eS(e):Array.isArray(e)?e.map(e=>{if("string"==typeof e)return eS(e);if("number"==typeof e||"boolean"==typeof e)return String(e);if(!e||"object"!=typeof e||Array.isArray(e))return"";let t=ec(e),n=eo(t.text)||eo(t.input_text)||eo(t.output_text);if(n)return eS(n);if("input_image"===t.type||"image"===t.type)return`[${X("render.imageOutput")}]`;let r=eS(eo(t.type)).slice(0,80);return`[${r?X("render.toolOutputType",{type:r}):X("render.toolOutput")}]`}).filter(Boolean).join("\n"):null==e?"":eS(JSON.stringify(e))}function eb(e){let t=e=>e.match(e$)?.[1];if("string"==typeof e)return t(e);if(Array.isArray(e))for(let n of e){if("string"==typeof n){let e=t(n);if(void 0!==e)return e;continue}if(!n||"object"!=typeof n||Array.isArray(n))continue;let e=ec(n),r=t(eo(e.text)||eo(e.input_text)||eo(e.output_text));if(void 0!==r)return r}}function ev(e){return/^Script failed\b/im.test(e)||/\b(?:exit|exited with) code [1-9]\d*\b/i.test(e)}let ew=/(?:api.?key|access.?token|refresh.?token|authorization|bearer|secret|password|passwd|pwd|token)/i,ey=/(?:api|token|authorization|bearer|secret|password|passwd|pwd)/i,ek=/("(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token)"\s*:\s*")[^"]*/gi,ej=/((?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token)\s*[:=]\s*["']?)[^\s"',}]+/gi,eN=/(\bbearer\s+)[^\s"',}]+/gi;function eS(e){let t=e.replace(eN,"$1[redacted]");return(0,r.fp)(t).replace(ek,"$1[redacted]").replace(ej,"$1[redacted]")}function eC(e){let t=24e3,n=(e,r,i)=>{if(ew.test(r))return"[redacted]";if(i>8)return"[depth limit]";if("string"==typeof e){if(/^data:image\//i.test(e))return`[image data \xb7 ${e.length} chars]`;let n=eS(e),r=Math.max(0,Math.min(4e3,t));return t-=Math.min(n.length,r),n.length>r?n.slice(0,r)+"…":n}if(null===e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e)){let t=e.slice(0,40).map(e=>n(e,"",i+1));return e.length>t.length&&t.push(`[${e.length-t.length} more items]`),t}if(!e||"object"!=typeof e)return String(e??"");let a=Object.entries(e).slice(0,80),s=Object.fromEntries(a.map(([e,t])=>[e,n(t,e,i+1)]));return Object.keys(e).length>a.length&&(s.__truncated__="additional fields hidden"),s};return ec(n(e,"",0))}function eA(e,t,n){let i=t.split("\n").map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.match(/\|note=\[(.*)\]$/)?.[1],n=e.replace(/\|note=\[.*\]$/,""),i=(0,r.cl)(n);return{target:i.target,line:i.line,note:t,raw:e}}),a=n.split(/\s+/).map(e=>e.trim()).filter(e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)),s=(0,r.ce)(e);return{kind:"mem-citation",entries:i,rolloutIds:a,raw:s.raw,truncated:s.truncated}}let eI=/^[ \t]*(?:\[stderr\]|-{2,}\s*stderr\s*-{2,}|stderr:)[ \t]*$/im,eM=/^(?:Chunk ID:|Wall time\b|Original token count:|Output:[ \t]*$|Script completed\b|Script running with (?:cell|session) ID\b|Process running with (?:cell|session) ID\b|Process exited with code\b)/,eT=/\.([A-Za-z0-9]{1,10})$/,e$=/\brunning with (?:cell|session) ID\s+(\S+)/i;function eE(e){return"tool"===e.kind&&!e.wakeup&&!e.mcp}let eR={exec_command:"Bash",shell:"Bash",bash:"Bash",read_file:"Read",read:"Read",view_image:"Read",write_file:"Write",write:"Write",apply_patch:"apply_patch",edit_file:"Edit",search:"Grep",grep:"Grep",glob:"Glob",fetch:"WebFetch",web_search:"WebSearch"},eP=new Set(["text","image","generatedImage","store","notify"]),eO=/\btools\.([A-Za-z_]\w*)\s*\(/g,eD=/(?:^|[^.\w])(text|image|generatedImage|store|notify)\s*\(/g;function eL(e,t){let n=e[t];for(let r=t+1;r<e.length;r+=1){let t=e[r];if("\\"===t){r+=1;continue}if(t===n)return r}return e.length-1}function eF(e,t){for(let n of t){let t=RegExp(`(?:^|[{,([\\s])${n}\\s*:\\s*`).exec(e);if(!t)continue;let r=(t.index??0)+t[0].length,i=e[r];if('"'===i||"'"===i||"`"===i)return e.slice(r+1,eL(e,r))}return""}function e_(e,t){for(let n of t){let t=RegExp(`(?:^|[{,([\\s])${n}\\s*:\\s*`).exec(e);if(!t)continue;let r=(t.index??0)+t[0].length,i=e[r];if('"'===i||"'"===i||"`"===i)return eU(e.slice(r+1,eL(e,r)));let a=e.slice(r).match(/^-?\d+(?:\.\d+)?|^(?:true|false)\b/)?.[0];if(a){if("true"===a||"false"===a)return"true"===a;let e=Number(a);return Number.isFinite(e)?e:void 0}let s=e.slice(r).match(/^([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\b/)?.[1];if(s)return s;return}for(let n of t)if(RegExp(`(?:^|[{,]\\s*)${n}\\s*(?=[,}])`).test(e))return n}function eq(e,t){for(let n of t){let t=RegExp(`(?:^|[{,([\\s])${n}\\s*:\\s*`).exec(e);if(!t)continue;let r=(t.index??0)+t[0].length,i=e[r];if('"'===i||"'"===i||"`"===i)return!0;return/^(?:-?\d+(?:\.\d+)?|true\b|false\b)/.test(e.slice(r))}return!1}function ez(e){for(let t=0;t<e.length;t+=1){let n=e[t];if('"'===n||"'"===n||"`"===n)return e.slice(t+1,eL(e,t))}return""}function eH(e){return/^\s*\{/.test(e)?"":ez(e)}function eB(e,t,n){for(let r of n){let n=eF(e,[r]);if(n)return n;let i=RegExp(`(?:^|[{,\\s])${r}\\s*(?::\\s*([A-Za-z_$][\\w$]*)\\s*[,}]|[,}])`).exec(e);if(!i)continue;let a=i[1]??r,s=RegExp(`\\b(?:const|let|var)\\s+${a}\\s*=\\s*`).exec(t);if(!s)continue;let l=s.index+s[0].length,o=t[l];if('"'===o||"'"===o||"`"===o)return t.slice(l+1,eL(t,l))}return""}function eU(e){return e.replace(/\\(u[0-9a-fA-F]{4}|x[0-9a-fA-F]{2}|[\s\S])/g,(e,t)=>{switch(t[0]){case"n":return"\n";case"t":return" ";case"r":return"\r";case"b":return"\b";case"f":return"\f";case"v":return"\v";case"0":return 1===t.length?"\0":e;case"u":case"x":return String.fromCodePoint(parseInt(t.slice(1),16));case"\n":return"";default:return t}})}function eK(e){let t=e.match(/\*\*\* Begin Patch[\s\S]*?\*\*\* End Patch/g);return t?t.map(eU).join("\n"):""}function eY(e,t,n,r){let i=eo(t).trim(),a=eo(r).trim();if(!i||i!==a)return!1;let s=eo(e).trim(),l=eo(n).trim();if(!s||!l)return!1;if(s===l)return!0;let o=Date.parse(s),c=Date.parse(l);if(Number.isFinite(o)&&Number.isFinite(c))return 1e3>=Math.abs(o-c);let d=/^(.*?)(\d+)(?:\.(\d+))?$/,u=s.match(d),p=l.match(d);return!!u&&!!p&&u[1]===p[1]&&.01>=Math.abs(Number(u[2]+"."+(u[3]??"0"))-Number(p[2]+"."+(p[3]??"0")))}function eW(e){let{showSvc:t,lineFilter:n}=e,s="claude"===e.fmt||"codex"===e.fmt,l=[],o=new Map,c=new Map,h=e=>{let t=("string"==typeof e?e:"number"==typeof e&&Number.isFinite(e)?String(e):"").trim()||void 0;if(void 0===t)return;let n=c.get(t);return void 0===n&&(n={},c.set(t,n)),{label:(0,r.fp)(t).trim().slice(0,120)||void 0,owner:n}},x=new Map,g=new Map,b=new Map,v=0,w=0,y=0,k=null,j=-1/0,N=null,S=[],C=null,A=null,I=null,$=[],E=new Map,R=null,P=null,O=e=>l.length?e-l[0].seq:-1,D=e=>(l.push({seq:w,bornSrc:y,src:y,item:e}),R=null,w++),L=(e,t)=>!!(!(e.length<=2e4)&&(e.match(/\s/g)?.length??0)/e.length<.02)&&(D({kind:"blob",bytes:e.length,text:(0,r.fp)(e).slice(0,2e5),...t?{sourceId:t}:{}}),!0),F=(e,t)=>{let n=ec(e.source),r=eo(n.data)||eo(t.base64);if(!r)return;let i=eo(n.media_type)||eo(t.type),a=i.startsWith("image/")?i:"image/png",s=ec(t.dimensions);D({kind:"image",media:a,data:r,w:en(s.originalWidth),h:en(s.originalHeight),bytes:en(t.originalSize)})},_=(e,t,n,i=D,a)=>{let s=e=>i(a?{...e,sourceId:a}:e);et.lastIndex=0;let l=et.test(t);if(et.lastIndex=0,!l){let n=(0,r.wV)(t.trim(),e);return!!n&&(s(n),!0)}let o=!1,c=0,d=t=>{let i=t.trim();if(!i)return;let a=(0,r.wV)(i,e);a?(s(a),o=!0):n(i)};for(let e of t.matchAll(et)){let n=e[0],r=e.index??0;d(t.slice(c,r)),s(eA(n,e[1]??"",e[2]??"")),o=!0,c=r+n.length}return d(t.slice(c)),o},q=e=>{let t=[];return et.lastIndex=0,{cleaned:e.replace(et,(e,n,r)=>(t.push(eA(e,n,r)),"")).trim(),cites:t}},z=(t,n,r)=>{if(!n.trim())return null;let i=w;if(L(n,r))return{firstSeq:i,lastSeq:w-1};let a="codex"===e.engine?"codex":"claude";return _(t,n,e=>D({kind:"prose",ts:t,text:e,engine:a,...r?{sourceId:r}:{}}),D,r)||D({kind:"prose",ts:t,text:n,engine:a,...r?{sourceId:r}:{}}),{firstSeq:i,lastSeq:w-1}},H=(e,t,n,r)=>{let i=n.trim(),a=N;if(a&&a.shape!==e&&a.src===y-1&&a.text===i&&eY(a.ts,a.text,t,i)){let n="event-agent"===e?t:"event-agent"===a.shape?a.ts:t;for(let e=a.firstSeq;e<=a.lastSeq;e+=1){let t=O(e);if(t<0||t>=l.length)continue;let i=l[t],a=i.item;l[t]={...i,src:y,item:"prose"===a.kind||"review"===a.kind?{...a,ts:n,...r?{sourceId:r}:{}}:"mem-citation"===a.kind||"blob"===a.kind?{...a,...r?{sourceId:r}:{}}:a}}N=null,R=null;return}let s=z(t,n,r);N=s?{shape:e,text:i,ts:t,src:y,firstSeq:s.firstSeq,lastSeq:s.lastSeq}:null},B=e=>{let t,n=e.args??{},i=V(e.tool),a=e.diff??("edit"===i||"write"===i?T(e.tool,n):void 0),s=G(e.tool,n,e.engine,a),l=a&&a.files.length?{type:"diff",files:a.files,filesTruncated:a.filesTruncated}:void 0,o=void 0!==e.command?(0,r.fp)(e.command).slice(0,8e3):void 0,c=void 0!==e.summary?(0,r.fp)(e.summary).replace(/\s+/g," ").trim().slice(0,160):s.summary,d="wait"===e.tool||"write_stdin"===e.tool&&!("string"==typeof n.chars&&n.chars.length>0),u="shell"===s.family?h(n.session_id??n.cell_id):void 0;return ee({kind:"tool",id:e.id,ts:e.ts,srcCall:y,family:s.family,tool:e.tool,icon:s.icon,summary:c,chips:s.chips,body:l,lang:e.lang,command:o,status:"run",statusLabel:X("render.executing"),outputPreview:"",outputTruncated:!1,..."shell"===s.family?{...(t=function(e,t){let n=e.cwd??e.workdir??e.working_directory??e.cd,i="string"==typeof n&&n.trim()?n.trim():t?.match(/^\s*cd\s+('([^']+)'|"([^"]+)"|(\S+))\s*&&/)?.slice(2).find(Boolean);if(i)return(0,r.fp)(i).trim().slice(0,400)||void 0}(n,o))?{cwd:t}:{},...u?.label!==void 0?{session:u.label}:{}}:{},...d?{poll:!0}:{},open:!!l,...e.wakeup?{wakeup:e.wakeup}:{},...e.mcp?{mcp:{...e.mcp,args:eC(e.mcp.args),result:e.mcp.result?eC(e.mcp.result):null}}:{}},u?.owner)},U=e=>{let t=D(e),n={event:e,seq:t};return o.set(e.id,n),n},K=(e,t)=>{let n={...e.event,wakeup:t};e.event=n;let r=O(e.seq);r>=0&&r<l.length&&"tool"===l[r].item.kind&&(l[r]={...l[r],item:n},R=null)},Y=()=>{let e=null;for(let t=$.length-1;t>=0;t-=1){let n=$[t].event.wakeup;if(n&&!n.failed){e=$[t].seq;break}}for(let t of $){let n=t.event.wakeup;if(!n)continue;let r=!n.failed&&t.seq!==e;n.superseded!==r&&K(t,{...n,superseded:r})}},W=e=>({...e,reason:(0,r.fp)(e.reason).slice(0,300),prompt:(0,r.fp)(e.prompt).slice(0,4e3)}),J=(e,t,n)=>{let r="string"==typeof e||"number"==typeof e?Date.parse(String(e)):NaN,i=W((0,p.It)(n,Number.isFinite(r)?r:null)),a=U(B({ts:e,id:t,tool:"ScheduleWakeup",args:n,engine:"claude",wakeup:{...i,superseded:!1,failed:!1}}));return $.push(a),Y(),a},Z=(t,n,r,i="Bash",a)=>{let s=r||"plain-"+w+"-"+String(t??""),l="codex"===e.engine?"codex":"claude",o=B({ts:t,id:s,tool:i,args:{...a,command:n},engine:l,command:n}),c=U(o);return r||(I=c),o},ei=(e,t,n)=>{let r=n||"plain-"+w+"-"+String(e??""),i=B({ts:e,id:r,tool:"apply_patch",args:{input:t},engine:"codex",diff:M(t)});return U(i),i},em=(e,t,n,i)=>{let a=i||"plain-"+w+"-"+String(e??""),s=function(e){let t,n;if(!e||!/\btools\.[A-Za-z_]\w*\s*\(/.test(e))return null;let i=[];for(eO.lastIndex=0;(n=eO.exec(e))&&i.length<16;){let r=n[1],a=function(e,t){let n=0;for(let r=t;r<e.length;r+=1){let i=e[r];if('"'===i||"'"===i||"`"===i){r=eL(e,r);continue}if("("===i||"["===i||"{"===i)n+=1;else if((")"===i||"]"===i||"}"===i)&&0==(n-=1))return e.slice(t+1,r)}return e.slice(t+1)}(e,n.index+n[0].length-1),s=eR[r]??r,l=function(e,t,n){if("write_stdin"===e)return{session_id:e_(t,["session_id"]),cell_id:e_(t,["cell_id"]),chars:e_(t,["chars"])};if("wait"===e)return{cell_id:e_(t,["cell_id"]),session_id:e_(t,["session_id"])};switch(V(e)){case"shell":return{command:eB(t,n,["cmd","command"])||eH(t)};case"read":case"write":return{file_path:eB(t,n,["path","file_path","filePath"])||eH(t)};case"search":return{pattern:eB(t,n,["pattern","query","regex","q"])||eH(t),path:eF(t,["path","glob","include"])};case"web":return{url:eB(t,n,["url"])||eH(t)};case"edit":return{input:eK(n)};default:return{value:eF(t,["cmd","path","url","query","pattern","goal","step","title","name"])||ez(t)}}}(s,a,e),o=G(s,l,"codex");if(i.push({id:`${r}#${i.length}`,tool:r,family:o.family,icon:o.icon,summary:o.summary}),"wait"===s||"write_stdin"===s){let e=eq(a,["session_id","cell_id"]),n="wait"===s||eq(a,["chars"]);e&&n&&(t={tool:s,args:l})}}for(eD.lastIndex=0;(n=eD.exec(e))&&i.length<16;){let e=n[1];eP.has(e)&&i.push({id:`${e}#${i.length}`,tool:e,family:"other",icon:"note",summary:e})}let a=i.filter(e=>"note"!==e.icon);if(!a.length)return null;let s=(0,r.fp)(e).slice(0,8e3),l=e.length>8e3;if(1===a.length&&t)return{overlay:{},directInteractive:t};let o=eK(e),c=o?M(o):void 0;if(c&&c.files.length){let e=G("apply_patch",{input:o},"codex",c),t=a.filter(e=>"edit"!==e.family);if(0===t.length)return{overlay:{summary:e.summary,icon:e.icon,family:"edit",chips:e.chips},diff:c};let n=i.filter(e=>"edit"!==e.family);return{overlay:{summary:`${e.summary} \xb7 ${X("tools.orchestration",{count:t.length})}`.slice(0,160),icon:"cmd-group",family:"edit",chips:e.chips},body:{source:s,sourceTruncated:l,calls:n},diff:c}}let d=i,u=a;if(1===a.length&&"shell"===a[0].family&&!/\s/.test(a[0].summary)){let t=function(e){let t=e.match(/=\s*\[\s*\[[\s\S]*?\]\s*,?\s*\]/)?.[0];if(!t)return[];let n=[];for(let e=0;e<t.length&&n.length<16;e+=1){let r=t[e];if('"'!==r&&"'"!==r&&"`"!==r)continue;let i=eL(t,e),a=t.slice(e+1,i);e=i,/\s/.test(a.trim())&&!/^\s*(?:[/#]|https?:)/.test(a)&&n.push(a)}return n}(e);t.length>=2&&(u=d=t.map((e,t)=>{let n=G("Bash",{command:e},"codex");return{id:`exec_command#${t}`,tool:"exec_command",family:n.family,icon:n.icon,summary:n.summary}}))}let p=u[0];return{overlay:1===u.length?{summary:p.summary,icon:p.icon,family:p.family,chips:[]}:{summary:`${p.summary} \xb7 ${X("tools.orchestration",{count:u.length})}`.slice(0,160),icon:"cmd-group",chips:[]},body:{source:s,sourceTruncated:l,calls:d}}}(n),l=s?.directInteractive,o=B({ts:e,id:a,tool:l?.tool??t,args:l?.args??{input:n},engine:"codex",diff:s?.diff}),c=s?ee({...o,...s.overlay,...s.body?{orchestration:s.body}:{}},Q.get(o)):o;return U(c),c},ef=(e,t,n,i)=>{let a;if(!e)return null;let s=t.match(/exited with code (\d+)/)?.[1],o=t.match(/Wall time:?\s*([\d.]+)\s*seconds?/i)?.[1],c=((a=t.replace(f,"").replace(/\r\n/g,"\n")).includes("\r")?a.split("\n").map(e=>{if(!e.includes("\r"))return e;let t=e.split("\r").filter(e=>e.length>0);return t.length?t[t.length-1]:""}).join("\n"):a).split("\n"),d=0;for(;d<c.length&&eM.test(c[d]);)d+=1;let u=c.slice(d).join("\n").trim(),m="{}"===u?"":u,x=!0===n||void 0!==s&&"0"!==s,g=e.event,b=!m&&("wait"===g.tool||"write_stdin"===g.tool)&&void 0!==o,v=m,w="",k="shell"===g.family?m.match(eI):null;k&&void 0!==k.index&&(v=m.slice(0,k.index).replace(/\n+$/,""),w=m.slice(k.index+k[0].length).replace(/^\n+/,""));let j=g.outputPreview,N=g.outputTruncated;if(v){let e=x?6e4:12e3,t=(g.outputPreview+"\n"+(0,r.fp)(v)).trim();N=g.outputTruncated||t.length>e,j=t.slice(-e)}let S=g.stderr,C=g.stderrTruncated;if(w){let e=((g.stderr??"")+"\n"+(0,r.fp)(w)).trim();C=(g.stderrTruncated??!1)||e.length>6e4,S=e.slice(-6e4)}let A=void 0!==s?Number(s):g.exitCode,I=void 0!==o?Math.round(1e3*Number(o)):g.durationMs,M="shell"===g.family?h(i??t.match(e$)?.[1]):void 0,T=g.session??M?.label,$=Q.get(g)??M?.owner,E="string"==typeof g.ts||"number"==typeof g.ts?Date.parse(String(g.ts)):NaN,P=void 0!==I&&Number.isFinite(E)?new Date(E+I).toISOString():g.endTs,D=g.wakeup,L=eu(m),F=g.mcp?{...g.mcp,result:L?eC(L):g.mcp.result}:void 0;if(D){if(x)D={...D,failed:!0};else if(m){let e="string"==typeof g.ts||"number"==typeof g.ts?Date.parse(String(g.ts)):NaN;D={...W((0,p.WQ)(D,Number.isFinite(e)?e:null,m)),superseded:D.superseded,failed:!1}}}let _=ee({...g,status:x?"err":"ok",statusLabel:x?s&&"0"!==s?"exit "+s:X("render.error"):b?X("tools.waitingSeconds",{n:Math.round(Number(o))}):"ok",open:g.open||x,srcResult:y,outputPreview:j,outputTruncated:N,...void 0!==A?{exitCode:A}:{},...void 0!==I?{durationMs:I}:{},...void 0!==P?{endTs:P}:{},...void 0!==S?{stderr:S}:{},...void 0!==C?{stderrTruncated:C}:{},...void 0!==T?{session:T}:{},...D?{wakeup:D}:{},...F?{mcp:F}:{}},$);e.event=_;let q=O(e.seq);return q>=0&&q<l.length&&"tool"===l[q].item.kind&&(l[q]={...l[q],item:_},R=null),D&&D.failed&&Y(),_},eh=(e,n,i,a)=>{if(!e)return;let s=x.get(e);if(void 0!==s){let e=O(s);if(e>=0&&e<l.length){let t=l[e].item;if("tmsg"===t.kind){let r=i||/"success"\s*:\s*false/.test(n)?"err":"ok",a=n.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];l[e]={...l[e],item:{...t,delivery:r,msgId:a}},R=null}}return}!ef(o.get(e),n,i,a)&&n&&t&&D({kind:"svc",text:"output: "+(0,r.fp)(n).slice(0,200)})},ek=e=>{t?D({kind:"svc",text:e.slice(0,300)}):(v+=1,b.set(y,(b.get(y)??0)+1),R=null)},ej=e=>{D({kind:"note",text:e})},eN=(e,t,n)=>{let i,a,s,l=(i=!1,a=JSON.stringify(n,(e,t)=>{if(ew.test(e))return"[redacted]";if("encrypted_content"===e)return"[encrypted]";if("string"!=typeof t)return t;if(/^data:image\//i.test(t))return i=!0,`[image data \xb7 ${t.length} chars]`;let n=ey.test(t)?eS(t):t;return n.length<=4e3?n:(i=!0,n.slice(0,4e3)+"…")},2)??"{}",{body:(s=(0,r.ce)(a)).raw,truncated:i||s.truncated});D({kind:"record",ts:e,recordType:eS(t).slice(0,80)||X("render.record"),...l})},eU=(e,t,n=!1)=>{if(n)return void eW(t,X("render.system"));let i=t.replace(er,(t,n,i,a)=>{let s=el(i,"teammate_id")||el(i,"from")||X("render.teammate"),l=el(i,"summary"),o=a.trim();if(o.startsWith("{"))try{let e=JSON.parse(o);if("idle_notification"===e.type){let t=(0,m.T0)(e.timestamp);return D({kind:"tnote",text:X("render.left",{peer:s,at:t?" \xb7 "+t:""})}),""}}catch{}let{cleaned:c,cites:d}=q(o),u=r.HU.test(c)?(0,r.wV)(c,e):null;for(let t of(D({kind:"tmsg",ts:e,dir:"in",peer:s,summary:l,text:u?"":c}),u&&D(u),d))D(t);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!i||L(i))return;let{cleaned:a,images:s}=ea(i);for(let t of(a&&!_(e,a,t=>D({kind:"user",ts:e,text:t}))&&D({kind:"user",ts:e,text:a}),s))D({kind:"inbox-image",name:t.name,path:t.path})},eW=(e,t)=>{D({kind:"sysmsg",label:es(e,t),text:e})},eJ=(e,t)=>{let n=[],r=e=>n.push(D(e)),{cleaned:i,images:a}=ea(t.text),s=i?function(e){if(!/^\s*<realtime_delegation>/.test(e))return null;let t=e.match(/<input>([\s\S]*?)<\/input>/)?.[1]?.trim()??"",n=e.match(/<transcript_delta>([\s\S]*?)(?:<\/transcript_delta>|$)/)?.[1]?.trim()??"";return t||n?{input:t,delta:n}:null}(i):null;for(let t of(s?r({kind:"voice",ts:e,...s}):i&&r({kind:"user",ts:e,text:i}),a))r({kind:"inbox-image",name:t.name,path:t.path});for(let e of t.attachments)r(e);return{src:y,ts:e,text:t.text,entrySeqs:n,structured:t.structured}},eV=()=>{let e=S;for(let n of(S=e.filter(e=>e.structured),e)){var t;if(n.structured||(t=n.text,!/^\s*(?:# AGENTS\.md instructions\b|<(?:environment_context|permissions instructions|multi_agent_mode|turn_aborted)\b)/.test(t)))continue;let e=!1;for(let t of n.entrySeqs){let r=O(t);if(!(r<0)&&!(r>=l.length)&&"user"===l[r].item.kind){l[r]={...l[r],item:{kind:"sysmsg",label:es(n.text),text:n.text}},R=null,e=!0;break}}if(!e&&n.text){let e=y;y=n.src,eW(n.text),y=e}}},eG=(e,t)=>{D({kind:"compact",ts:e,trigger:t?.trigger,preTokens:t?.preTokens})},eX=e=>t=>{for(let n of t.split("\n"))n.trim()&&e({kind:"raw",text:(0,r.fp)(n),err:/error|failed|traceback|exception/i.test(n)})},eQ=t=>{if(!n||t.toLowerCase().includes(n))if(s)try{let n=JSON.parse(t);n&&"object"==typeof n&&!Array.isArray(n)?"claude"===e.fmt?(e=>{let t=e.timestamp;if("user"===e.type&&e.message){let n=ec(e.message).content,r=ec(ec(e.toolUseResult).file);if(!0===e.isCompactSummary){let e="string"==typeof n?n:ed(n).filter(e=>"text"===e.type).map(e=>eo(e.text)).join(" ");e.trim()&&((e,t)=>{for(let e=l.length-1;e>=0;e-=1){let n=l[e].item;if("compact"===n.kind){l[e]={...l[e],item:{...n,summary:t}},R=null;return}if("svc"!==n.kind&&"note"!==n.kind)break}D({kind:"compact",ts:e,summary:t})})(t,e.trim());return}let s=function(e){var t;if("human"===("string"==typeof e.origin?e.origin:i(a(e.origin).kind))||"typed"===i(e.promptSource))return!1;if(!0===e.isMeta||!0===e.isCompactSummary||"interruptedMessageId"in e||"promptSource"in e||"origin"in e)return!0;let n=("string"==typeof(t=a(e.message).content)?t:(Array.isArray(t)?t.map(a):[]).map(e=>i(e.text)).filter(Boolean).join("\n")).trim();return/^\[Request interrupted by user(?: for tool use)?\]$/.test(n)||/^<local-command-caveat>\s*Caveat:[\s\S]*<\/local-command-caveat>$/.test(n)||/^<task-notification\b[^>]*>[\s\S]*<\/task-notification>$/.test(n)||/^This came from another Claude session\b[\s\S]*not typed by your user[\s\S]*$/.test(n)}(e);if("string"==typeof n)eU(t,n,s);else for(let e of ed(n))if("text"===e.type)eU(t,eo(e.text),s);else if("image"===e.type)F(e,r);else if("tool_result"===e.type){let t=ed(e.content);for(let e of t)"image"===e.type&&F(e,r);let n="string"==typeof e.content?e.content:t.filter(e=>"image"!==e.type).map(e=>eo(e.text)).join(" ");eh(eo(e.tool_use_id),n,!0===e.is_error)}return}if("assistant"===e.type&&e.message){for(let i of ed(ec(e.message).content))if("text"===i.type&&eo(i.text).trim())z(t,eo(i.text),eo(e.uuid)||void 0);else if("thinking"===i.type&&eo(i.thinking).trim())D({kind:"think",text:eo(i.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===i.type&&"SendMessage"===eo(i.name)){let e=ec(i.input),n=e.message;if("string"==typeof n){let{cleaned:a,cites:s}=q(n),l=r.HU.test(a)?(0,r.wV)(a,t):null,o=D({kind:"tmsg",ts:t,dir:"out",peer:String(e.to??""),summary:String(e.summary??""),text:l?"":a});for(let e of(l&&D(l),s))D(e);let c=eo(i.id);c&&(x.set(c,o),g.set(o,c))}else ek(`SendMessage → ${String(e.to??"")} \xb7 ${eo(ec(n).type)||X("render.protocol")}`)}else if("tool_use"===i.type){let e=eo(i.name)||"tool",r=ec(i.input),a=eo(i.id)||"plain-"+w+"-"+String(t??"");if("ScheduleWakeup"===e)J(t,a,r);else{var n;let i="shell"===V(e)?eo(r.command):void 0,s="read"===V(e)?(n=eo(r.file_path),n.match(eT)?.[1]?.toLowerCase()??null):void 0,l=function(e){if(!e.startsWith("mcp__"))return null;let t=e.slice(5),n=t.indexOf("__");if(n<=0||n===t.length-2)return null;let r=t.slice(0,n),i=t.slice(n+2);return(0,u.I)(r)?{serverName:r,toolName:i}:null}(e),o=l?{...l,args:r,result:null}:void 0;U(B({ts:t,id:a,tool:e,args:r,engine:"claude",command:i,lang:s,mcp:o}))}}return}if("system"===e.type&&"compact_boundary"===e.subtype){let n=ec(e.compactMetadata);return eG(t,{trigger:eo(n.trigger)||void 0,preTokens:en(n.preTokens)})}ek(eo(e.type)||X("render.record"))})(n):(e=>{let t=ec(e.payload),n=e.timestamp;if("event_msg"===e.type){if("user_message"===t.type&&t.message)return((e,t)=>{let n=d(t),r=S.findIndex(t=>eY(t.ts,t.text,e,n.text));if(r<0)return eJ(e,{...n,attachments:[]});let[i]=S.splice(r,1);if(!i)return;let{cleaned:a,images:s}=ea(n.text);if(a){let t=i.entrySeqs.find(e=>{let t=O(e);return t>=0&&l[t]?.item.kind==="user"});if(void 0!==t){let n=O(t);l[n]={...l[n],item:{kind:"user",ts:e,text:a}}}else i.entrySeqs.push(D({kind:"user",ts:e,text:a}))}for(let e of s)i.entrySeqs.push(D({kind:"inbox-image",name:e.name,path:e.path}));var o=y;for(let e of i.entrySeqs){let t=O(e);t>=0&&t<l.length&&(l[t]={...l[t],src:o})}i.src=o,R=null})(n,eo(t.message));if(eV(),"agent_message"===t.type&&t.message)return H("event-agent",n,eo(t.message));if("task_started"===t.type)return ej(X("render.taskStarted")+(n?" \xb7 "+(0,m.T0)(n):""));if("task_complete"===t.type)return ej(X("render.taskComplete")+(n?" \xb7 "+(0,m.T0)(n):""));if("context_compacted"===t.type)return C?C=null:eG(n);if("mcp_tool_call_begin"===t.type){let e=ep(t.invocation);if(!e)return ek("mcp_tool_call_begin");let r=eo(t.call_id)||"plain-"+w+"-"+String(n??"");return U(B({ts:n,id:r,tool:`mcp__${e.serverName}__${e.toolName}`,args:e.args,engine:"codex",mcp:e}))}if("mcp_tool_call_end"===t.type){let e,r,i,a,s=eo(t.call_id)||"plain-"+w+"-"+String(n??""),c=o.get(s),d=ep(t.invocation)??c?.event.mcp??null;if(!d)return ek("mcp_tool_call_end");let u=(e=ec(t.result),r=ec(e.Ok),i=void 0!==e.Err||!0===r.isError,{output:a=ed(r.content).map(e=>eo(e.text)).filter(Boolean).join("\n")||(void 0===e.Err?"":JSON.stringify(e.Err)),result:eu(a),error:i}),p=c??U(B({ts:n,id:s,tool:`mcp__${d.serverName}__${d.toolName}`,args:d.args,engine:"codex",mcp:d}));if(ef(p,u.output,u.error),p.event.mcp&&u.result){let e={...p.event,mcp:{...p.event.mcp,result:eC(u.result)}};p.event=e;let t=O(p.seq);t>=0&&l[t]?.item.kind==="tool"&&(l[t]={...l[t],item:e}),R=null}return}return["patch_apply_end","sub_agent_activity","thread_settings_applied","token_count","turn_aborted","web_search_end"].includes(eo(t.type))?ek(eo(t.type)):eN(n,eo(t.type)||"event",t)}if("response_item"===e.type){if("message"===t.type){if("user"===t.role){let e;return(e=eJ(n,ex(t.content))).entrySeqs.length||e.text||ek("message user"),S.push(e)}eV();let e=ex(t.content).text;return e?"assistant"===t.role?H("response-assistant",n,e,eo(t.id)||void 0):eW(e,eo(t.role)):ek("message "+eo(t.role))}if(eV(),"function_call"===t.type){let e={};try{e=JSON.parse(eo(t.arguments)||"{}")}catch{e={}}let r=eo(t.name);return"exec_command"===r||"shell"===r?Z(n,String(e.cmd??e.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),eo(t.call_id),r,e):"apply_patch"===r?ei(n,String(e.input??""),eo(t.call_id)):"exec"===r||"functions.exec"===r?em(n,r,eo(e.input),eo(t.call_id)):U(B({ts:n,id:eo(t.call_id)||"plain-"+w+"-"+String(n??""),tool:r,args:e,engine:"codex"}))}if("function_call_output"===t.type){let e=eb(t.output),n=eg(t.output);return eh(eo(t.call_id),n,ev(n),e)}if("custom_tool_call"===t.type&&"apply_patch"===eo(t.name))return ei(n,eo(t.input),eo(t.call_id)||eo(t.id));if("custom_tool_call"===t.type){let e=eo(t.name)||"tool",r=eo(t.input)||eo(t.arguments);return em(n,e,r,eo(t.call_id)||eo(t.id))}if("custom_tool_call_output"===t.type){let e=eb(t.output),n=eg(t.output);return eh(eo(t.call_id),n,ev(n),e)}return"reasoning"===t.type||"agent_message"===t.type?ek(eo(t.type)):eN(n,eo(t.type)||"item",t)}return(eV(),"session_meta"===e.type)?ej(`${X("render.codexSessionCreated")} \xb7 ${eo(t.model)} \xb7 ${eo(t.cwd)}`):"compacted"===e.type?(C={src:y},eG(n)):"turn_context"===e.type||"world_state"===e.type||"inter_agent_communication_metadata"===e.type?ek(eo(e.type)):eN(n,eo(e.type)||X("render.record"),e)})(n):eN(null,"malformed_record",{value:n})}catch{eN(null,"malformed_record",{source:t})}else(e=>{let t=e.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(A)if(/^\[codex\]/.test(t))(()=>{if(!A)return;let e=A.lines.join("\n").trim();if(A=null,!e)return;let t=eX(D);_(null,e,t)||t(e)})();else{A.lines.push(t),R=null;return}if(/Assistant message$/.test(t))return;let n=t.match(/^\[([^\]]+)\]\s*(.*)$/),i=n?.[1]??null,a=n?.[2]??t;if(!(!a||/^Assistant message captured/.test(a))){if(!n&&(r.HU.test(t)||t.startsWith("<oai-mem-citation>"))){A={lines:[t],src:y},R=null;return}if(/^Running command: /.test(a))return Z(i,a.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(a)){I&&ef(I,a,/^Command failed/.test(a));return}return/^Applying \d+ file/.test(a)?D({...B({ts:i,id:"plain-"+w+"-"+String(i??""),tool:"apply_patch",engine:"codex",summary:a}),status:"ok",statusLabel:"ok"}):n&&!/^(Running|Command|Applying)/.test(a)?z(i,a):!L(t)&&D({kind:"raw",text:(0,r.fp)(t),err:/error|failed|traceback|exception/i.test(t)})}})(t)},eZ=()=>{l.length=0,o.clear(),c.clear(),x.clear(),g.clear(),b.clear(),v=0,N=null,S=[],C=null,A=null,I=null,$.length=0,E=new Map,R=null};return{feed:(e,t,n)=>{let r=t+e.length;(null===k||r<k||t>k||t<j)&&(eZ(),k=t),j=t,(e=>{let t=l.some(t=>t.bornSrc<e&&t.src>=e);for(;l.length&&l[0].src<e;){let e=l.shift();if(R=null,"tool"===e.item.kind){let t=o.get(e.item.id);t&&t.seq===e.seq&&o.delete(e.item.id)}let t=g.get(e.seq);void 0!==t&&(g.delete(e.seq),x.get(t)===e.seq&&x.delete(t))}for(let[t,n]of b){if(t>=e)break;v-=n,b.delete(t),R=null}N&&N.src<e&&(N=null),S=S.filter(t=>t.src>=e),C&&C.src<e&&(C=null),I&&0>O(I.seq)&&(I=null);let n=!1;for(let e=$.length-1;e>=0;e-=1)0>O($[e].seq)&&($.splice(e,1),n=!0);return n&&Y(),t||null!==A&&A.src<e})(t)&&(eZ(),k=t);for(let n=k-t;n<e.length;n+=1)y=t+n,eQ(e[n]);return k=r,R&&P===n||(R=(e=>{let t=[],n=new Map,r=new Map,i=(e,t)=>{let n=`${t}:${e.src}`,i=r.get(n)??0;return r.set(n,i+1),`${n}:${i}`},a=0;for(;a<l.length;){let r=l[a];if(!eE(r.item)){t.push({anchorKey:i(r,"row"),key:String(r.seq),item:r.item}),a+=1;continue}let o=a,c=[];for(;o<l.length;){let e=l[o];if(eE(e.item))c.push({idx:o,seq:e.seq,item:e.item});else if("think"!==e.item.kind)break;o+=1}let d=e&&o===l.length,u=c.length;if(u>=2){let e,l=c.slice(0,u),o=l[l.length-1].idx+1,p=l[0].seq,m=E.get(p);if(m&&m.active===d&&m.calls.length===l.length&&l.every((e,t)=>m.calls[t]===e.item))e=m;else{let t={},n=0,r=0;for(let e of l){var s;let i=(s=e.item).tool||s.family;t[i]=(t[i]??0)+1,"ok"===e.item.status?n+=1:"err"===e.item.status&&(r+=1)}e={kind:"cmd-group",ids:l.map(e=>e.item.id),calls:l.map(e=>e.item),t0:l[0]?.item.ts,t1:l.at(-1)?.item.ts,byTool:t,okCount:n,errCount:r,hasErr:r>0,active:d}}n.set(p,e),t.push({anchorKey:i(r,"group"),key:"g"+p,item:e}),a=o}else t.push({anchorKey:i(r,"row"),key:String(r.seq),item:r.item}),a+=1}return E=n,(()=>{if(!A)return[];let e=A.lines.join("\n").trim();if(!e)return[];let t=[],n=e=>t.push(e),r=eX(n);return _(null,e,r,n)||r(e),t})().forEach((e,n)=>t.push({anchorKey:null,key:"pb"+n,item:e})),{items:t,hiddenServiceCount:v}})(n),P=n),R}}}},1691:(e,t,n)=>{"use strict";n.d(t,{HU:()=>r,ce:()=>m,cl:()=>h,fp:()=>p,wV:()=>b});let r=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,i=/^\s*(\d+)[.)]\s+(.*)$/,a=/^\s*#{1,6}\s+finding\s+\d+\s*$/i,s=/^\s*[-*]\s+\*\*(severity|file|line|title|explanation):\*\*\s*(.*)$/i,l=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,o=/((?:\.{1,2}\/|\/|~\/)?[\w@.+-][\w@.+\-/]*\.(?:tsx?|jsx?|mjs|cjs|mts|cts|py|go|rs|md|json|ya?ml|toml|css|scss|html|sql|sh|env|ftl|txt))(?::(\d+))?/i,c=/\[([^\]]+)\]\(([^)\s]+)\)/,d=/(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token)/i,u=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function p(e){return d.test(e)?e.replace(u,(e,t,n,r)=>`${t}${n}${r}[redacted]`):e}function m(e){let t=p(e);return{raw:t.slice(0,24e3),truncated:t.length>24e3}}function f(e){let t=e.toUpperCase();if("P0"===t||"P1"===t||"P2"===t||"P3"===t)return t;let n=e.toLowerCase();return"critical"===n?"Critical":"high"===n?"High":"medium"===n?"Medium":"low"===n?"Low":"Info"}function h(e){let t=e.match(/^(.*?):(\d+(?:-\d+)?)$/);return t?{target:t[1]??e,line:t[2]}:{target:e}}function x(e){let t=e.match(c);if(t){let e=h((t[2]??"").replace(/^file:\/\//,"")),n=e.line?Number(e.line.split("-",1)[0]):void 0;return{file:e.target||t[1],line:Number.isFinite(n)?n:void 0}}let n=e.match(o);if(!n)return{};let r=n[2]?Number(n[2]):void 0;return{file:n[1],line:Number.isFinite(r)?r:void 0}}function g(e){return e.trim().replace(/^`([^`]*)`$/,"$1")}function b(e,t){let n=e.match(r)?.[1];if(!n)return null;let o=function(e){let t=[],n=null,r=null,i=()=>{if(n?.severity&&n.title&&n.explanation){let e=n.file?x(n.file):{},r=n.line?Number.parseInt(n.line,10):void 0;t.push({severity:f(n.severity),file:e.file??(n.file?g(n.file):void 0),line:Number.isFinite(r)?r:e.line,title:g(n.title).slice(0,200),body:m(n.explanation).raw})}n=null,r=null};for(let t of e.split("\n")){if(a.test(t)){i(),n={};continue}let e=t.match(s);if(e){let t=e[1].toLowerCase();"severity"===t&&n?.severity&&i(),(n??={})[t]=e[2]?.trim()??"",r=t;continue}let l=t.trim();n&&"explanation"===r&&l&&(n.explanation=`${n.explanation??""}
3
- ${l}`.trim())}return i(),t}(e),d=o.length>0,u=[],p=null,h=()=>{let e,t,n,r=p?.trim();r&&o.push((e=f(r.match(l)?.[1]??r.match(l)?.[2]??"Info"),t=x(r),n=function(e){let t=e,n=t.match(l);if(n&&void 0!==n.index){let e=t.slice(n.index+n[0].length).replace(/^[\s.:–—-]+/,"");e&&(t=e)}return t.replace(c,"$1").replace(/`([^`]*)`/g,"$1").replace(/\s+/g," ").trim().slice(0,200)}(r)||r.slice(0,200)||"Finding",{severity:e,file:t.file,line:t.line,title:n,body:m(r).raw})),p=null};for(let t of e.split("\n")){let e=t.trimEnd(),n=e.match(i);if(!d&&n){h(),p=n[2]??"";continue}let l=e.trim();if(null!==p){l?p=`${p}
4
- ${l}`:h();continue}!(!l||r.test(e)||a.test(e)||s.test(e)||/^(findings?|summary|open questions?|tests?|residual risk)\s*:?\s*$/i.test(l))&&0===o.length&&u.length<3&&l.length<=240&&u.push(l)}d||h();let b=o.filter(e=>l.test(e.body)).length;return n||/^findings?\s*:?$/im.test(e)||b>=2||b>=1&&/\b(review|request_changes|approve|comment)\b/i.test(e)?{kind:"review",ts:t,verdict:n,findings:o,summary:u,raw:m(e).raw}:null}},1834:(e,t,n)=>{"use strict";let r,i,a,s,l,o,c,d,u,p,m,f,h,x,g,b,v,w,y,k,j,N,S,C,A,I,M,T,$,E,R,P,O,D;n.d(t,{Viewer:()=>wS});var L,F=n(5155),_=n(1012),q=n(233),z=n(9072),H=n(9005),B=n(2115);function U(e){return e.conversationId??e.path}function K(e){return!!e.migratedTo}function Y(e){try{return decodeURIComponent(e)}catch{return e}}function W(e){let t=e.match(/^#c=(.+)$/);if(t)return{conversationId:Y((t[1]??"").replace(/#question$/,"")),filePath:null,project:null};let n=e.match(/^#f=(.+)$/);if(n)return{conversationId:null,filePath:Y((n[1]??"").replace(/#question$/,"")),project:null};let r=e.match(/^#p=(.+)$/);return r?{conversationId:null,filePath:null,project:Y(r[1]??"")}:{conversationId:null,filePath:null,project:null}}function J(e){return e.conversationId?"#c="+encodeURIComponent(e.conversationId):"#f="+encodeURIComponent(e.path)}function V(e,t){let n=null,r=null;for(let i of e)if(i.conversationId===t){if(i.path.startsWith("spawn:")){n=n??i;continue}if(r=r??i,!K(i))return i}return r??n}function G(e,t){let n=new Set,r=e;for(;void 0!==t[r]&&!n.has(r);)n.add(r),r=t[r];return r}function X(e,t,n){if(t){let e=V(n,t);if(e)return e.path}if(!e)return e;let r=n.find(t=>t.path===e);return r&&K(r)&&r.conversationId?V(n,r.conversationId)?.path??e:e}function Q(e){return e.some(K)?e.filter(e=>!K(e)):e}let Z="llv:open-accounts",ee=null;function et(e,t){ee={engine:e,accountId:t,at:Date.now()},window.dispatchEvent(new CustomEvent(Z,{detail:{engine:e,accountId:t}}))}function en(e){let t=t=>{let n=t.detail;n&&e(n)};return window.addEventListener(Z,t),()=>window.removeEventListener(Z,t)}var er=n(4654),ei=n(6027);let ea=["-agents-tools-"];function es(e,t){if(t?.trim())return t.trim();if("project_unresolved"===e)return"Unresolved project";for(let t of ea)if(e.startsWith(t)&&e.length>t.length)return e.slice(t.length);return e.replace(/^-+/,"")||e}let el="__overview__",eo=e=>Math.floor(e/300);function ec(e){return"live"===e.activity?0:"recent"===e.activity?1:"stalled"===e.activity?2:3}function ed(e){return"claude-projects"===e.root?"session"===e.kind&&!e.parent:"codex-sessions"===e.root&&!e.parent}function eu(e){return"claude-projects"===e.root&&"subagent"===e.kind}function ep(e){return!!eu(e)||!!e.handoff&&!!e.parent||"codex-sessions"===e.root&&!!e.parent}function em(e){return"shell"===e.engine}function ef(e){return e.project||"other"}function eh(e,t,n,r=[]){if(n){let t=e.find(e=>e.path===n);if(t?.cwd?.trim())return t.cwd.trim()}let i=new Map;for(let n of e){if(ef(n)!==t||null===n.projectRoot)continue;let e=n.projectRoot?.trim()||n.cwd?.trim();if(!e)continue;let r=i.get(e)??{count:0,newest:0};r.count+=1,r.newest=Math.max(r.newest,n.mtime),i.set(e,r)}return([...i].sort(([e,t],[n,r])=>r.count-t.count||r.newest-t.newest||e.localeCompare(n))[0]?.[0]??"")||r.find(e=>e.trim())?.trim()||""}function ex(e,t,n,r,i=[],a="/"){if(r){let t=e.find(e=>e.path===r)?.cwd?.trim();if(t)return t}let s=n.find(e=>e.project===t)?.projectRoot?.trim()??"";return s||eh(e,t,void 0,[...i,a])||a}let eg=new Set(["provisioning","implementing","reviewing","finishing"]);function eb(e,t=Date.now()/1e3,n=[],r=[],i=[],a={}){let s=new Map,l=(e,t=es(e))=>{let n=s.get(e);return n||(n={project:e,displayName:t,liveCount:0,attentionCount:0,conversations:0,smt:0,catalogOnly:!0},s.set(e,n)),n};for(let n of e){let e=l(ef(n),es(ef(n),n.projectName));e.catalogOnly=!1,"live"===n.activity&&(e.liveCount+=1),null!==eI(n,t)&&(e.attentionCount+=1),ed(n)&&(e.conversations+=1),e.smt=Math.max(e.smt,n.mtime)}for(let e of r){if(!e.project)continue;let t=l(e.project,es(e.project,e.displayName));t.conversations=Math.max(t.conversations,e.conversations),t.smt=Math.max(t.smt,e.smt)}for(let e of n){if("closed"===e.state||!e.project)continue;let t=l(e.project,es(e.project,a[e.project]));t.catalogOnly=!1,eg.has(e.state)&&(t.liveCount+=1),("needs_decision"===e.state||"paused"===e.state)&&(t.attentionCount+=1),t.smt=Math.max(t.smt,(Date.parse(e.createdAt)||0)/1e3)}for(let e of i){if("closed"===e.state&&!e.restored||!e.project)continue;let t=l(e.project,es(e.project,a[e.project]));t.catalogOnly=!1,("provisioning"===e.state||"running"===e.state)&&(t.liveCount+=1),("needs_decision"===e.state||"paused"===e.state)&&(t.attentionCount+=1),t.smt=Math.max(t.smt,(Date.parse(e.createdAt)||0)/1e3)}return[...s.values()].sort((e,t)=>{let n=e.attentionCount>0;return n!==t.attentionCount>0?n?-1:1:e.liveCount!==t.liveCount?t.liveCount-e.liveCount:eo(t.smt)-eo(e.smt)||e.project.localeCompare(t.project)})}function ev(e,t){let n=new Set,r=e;for(;r.parent&&!n.has(r.path);){n.add(r.path);let i=t.get(r.parent);if(!i||ef(i)!==ef(e))break;r=i}return r}function ew(e){let t=new Map;for(let n of e){if(!n.parent)continue;let e=t.get(n.parent);e?e.push(n):t.set(n.parent,[n])}return t}function ey(e,t){let n=[],r=[...t.get(e.path)??[]],i=new Set([e.path]);for(;r.length;){let e=r.pop();i.has(e.path)||(i.add(e.path),n.push(e),r.push(...t.get(e.path)??[]))}return n}function ek(e,t){let n=[],r=[...t.get(e.path)??[]],i=new Set([e.path]),a=ef(e);for(;r.length;){let e=r.pop();if(!i.has(e.path))i.add(e.path),ef(e)===a&&(n.push(e),r.push(...t.get(e.path)??[]))}return n}function ej(e,t,n){return!n?.foldedEnginePaths?.has(e.path)&&(!!n?.promotedEnginePaths?.has(e.path)||!em(e)&&("live"===e.activity||"running"===e.proc||"recent"===e.activity&&ep(e)||ep(e)&&t?.has(e.path)===!0))}function eN(e){return ej(e)||em(e)&&("live"===e.activity||"running"===e.proc)}function eS(e,t,n={}){let r=new Map(e.map(e=>[e.path,e])),i=ew(e),a=new Map,s=new Map,{expandedConversationPaths:l,enginePlacement:o}=n;for(let n of e){if(ef(n)!==t)continue;if(function(e,t){if(!e.parent||!ep(e))return!1;let n=t.get(e.parent);return!!(n&&ef(n)!==ef(e))}(n,r)){a.set(n.path,n);continue}let e=l?.has(n.path)===!0;if("live"===n.activity||"running"===n.proc||"recent"===n.activity&&ep(n)||o?.promotedEnginePaths?.has(n.path)===!0||e&&(ed(n)||ep(n))){let e=ev(n,r);em(e)?s.set(e.path,e):a.set(e.path,e);continue}"recent"===n.activity&&ed(n)&&a.set(n.path,n)}let c=[...a.values()].map(e=>(function(e,t,n,r){let i=ek(e,t),a=i.filter(e=>!r?.foldedEnginePaths?.has(e.path)&&(ep(e)||ej(e,n,r))).sort((e,t)=>("live"!==e.activity)-("live"!==t.activity)||eo(t.mtime)-eo(e.mtime)||e.path.localeCompare(t.path)),s=i.filter(e=>em(e)&&"live"===e.activity).sort((e,t)=>eo(t.mtime)-eo(e.mtime)||e.path.localeCompare(t.path)),l=[e,...a].map(e=>({file:e,tasks:[]})),o=new Map(l.map(e=>[e.file.path,e]));for(let e of s)(e.parent&&o.get(e.parent)||l[0]).tasks.push(e);let c=new Set([...o.keys(),...s.map(e=>e.path)]),d=i.filter(e=>!c.has(e.path)).sort((e,t)=>t.mtime-e.mtime),u=Math.max(...l.map(e=>e.file.mtime),...s.map(e=>e.mtime));return{key:e.path,columns:l,returnable:[],finished:d,smt:u,orphanTask:!1}})(e,i,l,o));for(let e of s.values())c.push({key:e.path,columns:[{file:e,tasks:[]}],returnable:[],finished:[],smt:e.mtime,orphanTask:!0});return c.sort((e,t)=>e.orphanTask!==t.orphanTask?e.orphanTask?1:-1:eo(t.smt)-eo(e.smt)||e.key.localeCompare(t.key))}function eC(e,t,n){if(!e)return[];let r=ew(t),i=[],a=new Set([e.path]),s=(e,t)=>{for(let l of(r.get(e.path)??[]).filter(e=>!a.has(e.path)).sort((e,t)=>ec(e)-ec(t)||t.mtime-e.mtime))a.add(l.path),n(l)&&(i.push({file:l,depth:t}),s(l,t+1))};return s(e,1),i}let eA={unowned:0,blocked:1,heuristic:2,stalled:3};function eI(e,t=Date.now()/1e3){return e.pendingQuestion?e.pendingQuestion.toolUseId:e.rateLimit?`${e.path}:rate-limited:${e.rateLimit.resetAt??"unknown"}`:e.waitingInput?`${e.path}:waiting:${Math.floor(e.waitingInput.since)}`:"stalled"===e.activity&&"running"===e.proc&&t-e.mtime<=7200?`${e.path}:stalled:${Math.floor(e.mtime)}`:null}let eM=(e=(0,er.JK)())=>"uk"===e?"uk-UA":"en-US";function eT(e,t){return new Date(1e3*e).toLocaleTimeString(eM(t),{hour:"2-digit",minute:"2-digit",hour12:!1})}function e$(e,t){let n=(0,er.JK)(),r=e-t;return r<=60?(0,er.Tl)(n,"limits.now"):r<5400?(0,er.Tl)(n,"limits.inMin",{n:Math.round(r/60)}):r<129600?(0,er.Tl)(n,"limits.inHour",{n:Math.round(r/3600)}):(0,er.Tl)(n,"limits.inDay",{n:Math.round(r/86400)})}function eE(e,t,n){if("number"!=typeof n||!Number.isFinite(n)||n<=0)return e("weekly"===t?"limits.week":"limits.5h");let r=function(e){if("number"!=typeof e||!Number.isFinite(e)||e<=0)return null;for(let t of[300,10080])if(Math.abs(e-t)<=.01*t)return t;return null}(n)??n;return 10080===r?e("limits.week"):300===r?e("limits.5h"):n%1440==0?e("limits.windowDays",{n:n/1440}):n>=60?e("limits.windowHours",{n:Math.round(n/60)}):e("limits.windowMinutes",{n:Math.round(n)})}function eR(e,t){let n=new Date(1e3*e),r=n.toLocaleTimeString(eM(),{hour:"2-digit",minute:"2-digit",hour12:!1});return e-t<86400?r:n.toLocaleDateString(eM(),{day:"numeric",month:"short"})+" "+r}let eP="llv:flows-changed",eO=new Set,eD=eO,eL=new Set;function eF(e){return eL.add(e),()=>eL.delete(e)}let e_=new Set;function eq(e){return"closed"!==e.state||!0===e.restored}function ez(e){let t=new Map;for(let n of e){if(!eq(n))continue;let e=t.get(n.implementerPath);(!e||n.createdAt>e.createdAt)&&t.set(n.implementerPath,n)}return t}function eH(e,t=[]){let n=new Set;for(let r of e)for(let e of r.rounds)for(let{path:i}of eK(r,e,t))n.add(i);return n}function eB(e,t,n){if(t.reviewerBindingId){let r=`reviewer:${t.n}:${t.reviewerBindingId}`,i=Q([...n]).find(n=>n.durableLineage?.memberships.some(n=>"flow"===n.kind&&n.containerId===e.id&&"reviewer"===n.role&&n.round===t.n&&n.slot===r));if(i)return i.conversationId?V(n,i.conversationId)??i:i}if(t.reviewerConversationId){let e=V(n,t.reviewerConversationId);if(e)return e}let r=Q([...n]).find(n=>n.durableLineage?.memberships.some(n=>"flow"===n.kind&&n.containerId===e.id&&"reviewer"===n.role&&n.round===t.n));if(r)return r;let i=t.reviewerPath?n.find(e=>e.path===t.reviewerPath)??null:null;return i?.conversationId?V(n,i.conversationId)??i:i}function eU(e,t,n){let r=Q([...n]),i=eB(e,t,n),a=r.filter(n=>n.durableLineage?.memberships.some(n=>"flow"===n.kind&&n.containerId===e.id&&"reviewer"===n.role&&n.round===t.n)).filter(e=>e!==i);return i?[...a,i]:a}function eK(e,t,n=[]){let r=eU(e,t,n).map(e=>({path:e.path,conversationId:e.conversationId??null})),i=new Set(r.map(e=>e.path));if(!t.reviewerPath||i.has(t.reviewerPath))return r;let a=n.find(e=>e.path===t.reviewerPath)??null,s=eB(e,t,n);return s&&s.path!==t.reviewerPath&&s.conversationId&&(s.conversationId===t.reviewerConversationId||s.conversationId===a?.conversationId)||r.push({path:t.reviewerPath,conversationId:t.reviewerConversationId??a?.conversationId??null}),r}let eY=new Set;function eW(e,t){return!t.has(e.path)&&("claude"===e.engine||"codex"===e.engine)&&ed(e)}let eJ=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),eV={waiting_ready:{labelKey:"flowStrip.startReview",action:"advance"},spawn_pending:{labelKey:"flowStrip.spawnReviewer",action:"advance"},relay_pending:{labelKey:"flowStrip.relayNotes",action:"advance"},needs_decision:{labelKey:"flowStrip.retryRound",action:"retry-round"},done_comment:{labelKey:"flowStrip.anotherRound",action:"another-round"}};function eG(e,t,n){var r;return t.block?.reason==="rate_limited"?{label:e("flowState.blocked_rate_limited"),detail:t.block.resetAt?e("flowState.rate_limit_until",{time:eT(t.block.resetAt,n)}):e("flowState.rate_limit_wait"),attention:!0,pending:null}:{label:(r=t.state,e(`flowState.${r}`)),detail:t.stateDetail,attention:eJ.has(t.state),pending:eV[t.state]??null}}function eX(e){return e.block?null:"spawning"===e.state||"reviewing"===e.state?"reviewer":"waiting_ready"===e.state||"relaying"===e.state||"fixing"===e.state?"implementer":null}function eQ(e){return e.block?null:"spawn_pending"===e.state||"spawning"===e.state||"reviewing"===e.state?"forward":"relay_pending"===e.state||"relaying"===e.state||"fixing"===e.state||"waiting_ready"===e.state&&e.rounds.length?"back":null}let eZ={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function e0(e){return"APPROVE"===e?{color:"var(--color-success)",soft:"var(--color-success-soft)"}:"REQUEST_CHANGES"===e?{color:"var(--color-danger)",soft:"var(--color-danger-soft)"}:"COMMENT"===e?{color:"var(--color-warning)",soft:"var(--color-warning-soft)"}:{color:"var(--color-muted)",soft:"var(--color-sunken)"}}async function e1(e,t){try{let n=await fetch(`/api/flows/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return"close"===t.action&&function(e){if(!eO.has(e))for(let t of(eO.add(e),eD=new Set(eO),eL))t()}(e),window.dispatchEvent(new Event(eP)),null;let r=await n.json().catch(()=>null);return r?.error??(0,er.Tl)((0,er.JK)(),"flowModel.failed",{status:n.status})}catch{return(0,er.Tl)((0,er.JK)(),"common.serverUnavailable")}}var e2=n(1463);function e5(){let e=void 0!==e2?e2.env?.NEXT_PUBLIC_LLV_WORKER_COLLAPSE_MINUTES:void 0,t=e?Number(e):NaN;return Number.isFinite(t)&&t>0?6e4*t:9e5}function e3(e,t){let n=e.durableLineage?.memberships.find(e=>"flow"===e.kind);if(n){let e=t.find(e=>e.id===n.containerId);if(e&&"reviewer"===n.role){let t=e.rounds.find(e=>e.n===n.round)??null;return{role:"reviewer",flow:e,round:t}}if(e&&"implementer"===n.role)return{role:"implementer",flow:e,round:null}}for(let n of t)for(let t of n.rounds)if(t.reviewerPath===e.path)return{role:"reviewer",flow:n,round:t};for(let n of t)if(n.implementerPath===e.path)return{role:"implementer",flow:n,round:null};return null}function e4(e,t){return!!(e.userAuthored||e.authorshipUnverified||"live"===e.activity||"stalled"===e.activity||"running"===e.proc||e.pendingQuestion||e.waitingInput||e.migration&&"committed"!==e.migration.phase&&"rolled-back"!==e.migration.phase||t.pinnedPaths.has(e.path)||t.protectedPaths?.has(e.path))}let e6={flow:0,pipeline:1,origin:2,worktree:3},e8=new Set,e7=e=>1e13*ec(e)-e.mtime,e9="direct-review::";function te(e){return e.id.startsWith(e9)}var tt=n(6505);function tn(e,t){return Math.floor(t.smt/300)-Math.floor(e.smt/300)||e.file.path.localeCompare(t.file.path)}function tr(e,t=Date.now()/1e3){return!!e.pendingQuestion||!!e.rateLimit||!!e.waitingInput||("stalled"===e.activity?null!==eI(e,t):"recent"===e.activity&&("claude"===e.engine||"codex"===e.engine)&&ed(e)&&!eu(e))}function ti(e,t,n,r,i=ta,a=ts){let{locale:s}=(0,er.Ym)();return(0,B.useMemo)(()=>{let l=(e,t)=>(0,er.Tl)(s,e,t),o=function(e){let t=ew(e),n=new Map;for(let r of e)n.set(r.path,ey(r,t).length);return n}(e),c=new Map;for(let e of t){let t=c.get(e.file);(!t||e.ts>t.ts)&&c.set(e.file,e)}let d=ez(a.filter(e=>!te(e))),u=eH(a,e),p=n.trim().toLowerCase(),m=e.filter(e=>!i.has(e.path)&&!u.has(e.path)&&(ed(e)||"live"===e.activity||"stalled"===e.activity||"recent"===e.activity&&!em(e))).map(e=>{let t=ef(e),n=(0,ei.cr)(e.title),i=r-e.mtime,a=d.get(e.path),u=e.pendingQuestion||e.rateLimit||e.waitingInput?"waiting":"live"===e.activity?"working":tr(e,r)?"waiting":i<=86400?"recent":"older",p=function(e,t,n){var r;if(t.pendingQuestion)return e("plan"===t.pendingQuestion.kind?"status.awaitingPlan":"status.awaitingAnswer");if(t.rateLimit)return e("status.rateLimited");if(t.waitingInput)return e("status.awaitingTerminal");if("live"===t.activity&&t.plan?.current)return`${t.plan.done}/${t.plan.total} \xb7 ${t.plan.current}`;let i=n.get(t.path);return i?`${i.label} \xb7 ${(0,tt.rK)(i.ts)}`:"live"===t.activity?e("status.working"):eu(r=t)&&"running"!==r.proc?e("status.returnedResult"):"stalled"===t.activity?e("status.stalled"):tr(t)?e("status.finishedTurn"):""}(l,e,c);if(a){let e=eG(l,a,s);e.attention?u="waiting":("reviewing"===a.state||"relaying"===a.state||"spawning"===a.state)&&(u="working"),p=`${l("status.flow",{label:e.label})}${e.detail?` — ${e.detail}`:""}`}return{file:e,project:t,title:n,descendants:o.get(e.path)??0,smt:e.mtime,kind:u,statusLine:p}}).filter(e=>!p||`${e.title} ${e.project}`.toLowerCase().includes(p)),f=(e,t)=>t.smt-e.smt||e.file.path.localeCompare(t.file.path),h=m.filter(e=>"waiting"===e.kind).sort(f),x=m.filter(e=>"working"===e.kind).sort(f);return{waiting:h,working:x,recent:m.filter(e=>"recent"===e.kind).sort(tn),older:m.filter(e=>"older"===e.kind).sort(tn),livePreview:x.slice(0,3)}},[e,t,n,r,i,a,s])}let ta=new Set,ts=[];function tl(e,t=Date.now()/1e3){return e.pendingQuestion||e.rateLimit||e.waitingInput?"waiting":"live"===e.activity?"live":"recent"===e.activity&&ep(e)&&"running"!==e.proc?"returned":tr(e,t)?"stalled"===e.activity?"stalled":"waiting":"done"}let to=new Map;function tc(e){let t=to.get(e);if(!t)return 0;let n=t.getBoundingClientRect();return n.width?Math.max(-1,Math.min(1,(n.left+n.width/2)/window.innerWidth*2-1)):0}let td=null;function tu(){if(!td){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;td=new e}return td}let tp={waiting:[{freq:784,at:0,dur:.5},{freq:1175,at:.16,dur:.75}],returned:[{freq:659,at:0,dur:.3},{freq:784,at:.09,dur:.3},{freq:988,at:.18,dur:.65}],stalled:[{freq:880,at:0,dur:.35},{freq:587,at:.14,dur:.7}],question:[{freq:1047,at:0,dur:.28},{freq:1319,at:.12,dur:.35},{freq:1568,at:.24,dur:.6}],spawned:[{freq:523,at:0,dur:.14},{freq:784,at:.06,dur:.4}],dictWarn:[{freq:660,at:0,dur:.32}],dictStop:[{freq:523,at:0,dur:.3},{freq:330,at:.17,dur:.62}]};function tm(e,t,n=0){if(!function(){try{return"off"!==localStorage.getItem("llvSound")}catch{return!0}}())return;let r=tu();if(!r)return;if("running"!==r.state)return void r.resume().catch(()=>void 0);let i=r.currentTime+.02+n/1e3,a=r.destination;if("function"==typeof r.createStereoPanner){let e=r.createStereoPanner();e.pan.value=Math.max(-1,Math.min(1,t)),e.connect(r.destination),a=e}for(let t of tp[e])!function(e,t,n,r){let i=r+n.at,a=e.createOscillator();a.type="sine",a.frequency.value=n.freq;let s=e.createGain();s.gain.setValueAtTime(0,i),s.gain.linearRampToValueAtTime(.07,i+.012),s.gain.exponentialRampToValueAtTime(4e-4,i+n.dur),a.connect(s).connect(t),a.start(i),a.stop(i+n.dur+.05);let l=e.createOscillator();l.type="sine",l.frequency.value=2*n.freq;let o=e.createGain();o.gain.setValueAtTime(0,i),o.gain.linearRampToValueAtTime(.0126,i+.012),o.gain.exponentialRampToValueAtTime(3e-4,i+.7*n.dur),l.connect(o).connect(t),l.start(i),l.stop(i+n.dur)}(r,a,t,i)}let tf={attention:{file:"attention.mp3",tier:"priority"},failure:{file:"failure.mp3",tier:"priority"},launch:{file:"launch.mp3",tier:"salient"},success:{file:"success.mp3",tier:"salient"},"viewer-mcp":{file:"viewer-mcp.mp3",tier:"routine"},"tool-tick":{file:"tool-tick.mp3",tier:"routine"}},th={priority:1,salient:.75,routine:.5},tx={priority:3,salient:2,routine:1};function tg(e){return tf[e].tier}function tb(e){return`/audio/cues/${tf[e].file}`}function tv(e){return"priority"===tg(e)}let tw={waiting:"attention",question:"attention",returned:"success",stalled:"failure",spawned:"launch"},ty="/audio/ambient/voice-call-loop.wav";function tk(e=ty){return"string"==typeof e&&e.length>0}let tj="llvSound",tN="llvAudioCueVolume",tS="llvAudioLoopEnabled",tC="llvAudioViewerLoopEnabled",tA="llvAudioLoopVolume",tI={cuesEnabled:!0,cueVolume:.4,loopEnabled:!1,viewerLoopEnabled:!1,loopVolume:.05},tM=null,tT=new Set;function t$(){if(void 0!==r)return r;try{return window.localStorage}catch{return null}}function tE(){for(let e of tT)e()}function tR(e,t){if(!e)return null;try{return e.getItem(t)}catch{return null}}function tP(e,t,n){let r=tR(e,t);return"on"===r||"off"!==r&&n}function tO(e,t,n){let r=Number.parseFloat(tR(e,t)??"");return Number.isFinite(r)?Math.max(0,Math.min(1,r)):n}function tD(){return tM??=function(e=t$()){return{cuesEnabled:tP(e,tj,tI.cuesEnabled),cueVolume:tO(e,tN,tI.cueVolume),loopEnabled:tP(e,tS,tI.loopEnabled),viewerLoopEnabled:tP(e,tC,tI.viewerLoopEnabled),loopVolume:tO(e,tA,tI.loopVolume)}}()}function tL(e){let t={...tD(),...e},n=t$();if(n)try{void 0!==e.cuesEnabled&&n.setItem(tj,t.cuesEnabled?"on":"off"),void 0!==e.cueVolume&&n.setItem(tN,String(t.cueVolume)),void 0!==e.loopEnabled&&n.setItem(tS,t.loopEnabled?"on":"off"),void 0!==e.viewerLoopEnabled&&n.setItem(tC,t.viewerLoopEnabled?"on":"off"),void 0!==e.loopVolume&&n.setItem(tA,String(t.loopVolume))}catch{}return tM={...t,cueVolume:Math.max(0,Math.min(1,t.cueVolume)),loopVolume:Math.max(0,Math.min(1,t.loopVolume))},tE(),tM}function tF(e){return tT.add(e),()=>{tT.delete(e)}}let t_={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)},tq=function(e,t="function"==typeof fetch?fetch:null,n=t_){let r=new Map,i=new Set,a=new Set,s=(e,n)=>{let s=r.get(n);return s||(i.has(n)||a.has(n)||!t||(a.add(n),(async()=>{try{let i=await t(n);if(!i.ok)throw Error(`asset ${i.status}`);r.set(n,await e.decodeAudioData(await i.arrayBuffer()))}catch{i.add(n)}finally{a.delete(n)}})()),null)},l=t=>{let n=e();if(!n)return null;if("running"!==n.state)return n.resume().catch(()=>void 0),s(n,t),null;let r=s(n,t);return r?{context:n,buffer:r}:null};return{cues:{start(e){let t=l(e.src);if(!t)return null;try{let{context:n,buffer:r}=t,i=n.createBufferSource();i.buffer=r;let a=n.createGain();a.gain.value=e.gain;let s=n.createStereoPanner?.();return s?(s.pan.value=e.pan,a.connect(s),s.connect(n.destination)):a.connect(n.destination),i.connect(a),i.onended=()=>e.onEnded(),i.start(n.currentTime+Math.max(0,e.delaySeconds)),{stop(){try{i.stop()}catch{}}}}catch{return null}}},loop:{start(e){let t=l(e.src);if(!t)return null;try{var r,i;let a,s,l,o,{context:c,buffer:d}=t,u=c.createBufferSource();u.buffer=d,u.loop=!0,u.loopStart=0,u.loopEnd=d.duration;let p=c.createGain();p.gain.value=e.gain;let m=(r=p.gain,a=i=e.gain,s=i,l=c.currentTime,o=c.currentTime,{rampTo(e,t){let n,i=c.currentTime,d=(n=c.currentTime)>=o?s:n<=l?a:a+(n-l)/(o-l)*(s-a),u=i+Math.max(.01,t);r.cancelScheduledValues(i),r.setValueAtTime(d,i),r.linearRampToValueAtTime(e,u),a=d,s=e,l=i,o=u}});u.connect(p),p.connect(c.destination);let f=d.duration>0?d.duration:0,h=f>0?Math.max(0,e.offsetSeconds??0)%f:0,x=c.currentTime;u.start(x,h);let g=!1,b=null,v=0,w=0,y=e=>f>0?e%f:0,k=()=>{null!==b&&(n.cancel(b),b=null)},j=()=>{k(),g=!0;try{u.stop()}catch{}};return{rampTo(e,t){g||m.rampTo(Math.max(0,e),t)},pause(e){if(g||null!==b)return w;let t=Math.max(.01,e);return w=y(y(h+Math.max(0,c.currentTime-x))+t),m.rampTo(0,t),v=c.currentTime+t,b=n.schedule(j,1e3*t),w},resume:()=>!g&&(null===b||(null!==b&&c.currentTime<v?(k(),!0):(j(),!1))),stop(e){if(g)return;k(),g=!0;let t=Math.max(.01,e);m.rampTo(0,t);try{u.stop(c.currentTime+t+.05)}catch{}}}}catch{return null}}},warm(t){let n=e();if(n)for(let e of t)s(n,e)},reset(){r.clear(),i.clear(),a.clear()}}}(()=>tu()),tz=null,tH=null,tB=null,tU=0,tK=!1,tY=!1,tW=new Set,tJ=new Map;function tV(){tK||(tK=!0,tF(()=>{tU=0,tQ()}))}function tG(){var e;let t,n,r,i,a,s,l,o,c,d,u,p,m;return tH??=(t=(e={asset:ty,transport:tq.loop,prefs:tD}).schedule??((e,t)=>setTimeout(e,t)),n=e.cancel??(e=>clearTimeout(e)),r=null,i=null,a=0,s=!1,l=null,o=!1,c=null,d=()=>{let t=.35*Math.max(0,Math.min(1,e.prefs().loopVolume));return l?.25*t:o?.4*t:t},u=()=>{let{cuesEnabled:t,loopEnabled:n,viewerLoopEnabled:r}=e.prefs();return!!tk(e.asset)&&!!t&&(s?n:r)},p=()=>{let{cuesEnabled:t,loopEnabled:n,viewerLoopEnabled:r}=e.prefs();return tk(e.asset)&&t&&(n||r)},m=t=>{if(!u())return void(r?(p()?(a=r.pause(1.5),i=r):(r.stop(1.5),i=null,a=0),r=null):p()||(i=null,a=0));if(!r){if(i?.resume()){r=i,i=null,r.rampTo(d(),2.5);return}i=null,r=e.transport.start({src:e.asset,gain:0,offsetSeconds:a}),r?.rampTo(d(),2.5);return}r.rampTo(d(),t)},{configured:()=>tk(e.asset),setVoiceConnected(e){e!==s&&((s=e)||(l=null,o=!1,null!==c&&(n(c),c=null)),m(2.5))},setSpeaking(e){e!==l&&(l=e,m(e?.3:.9))},duckForCue(e){tv(e)&&(o=!0,null!==c&&n(c),c=t(()=>{c=null,o=!1,m(.9)},1200),m(.3))},refresh(){m(.9)},wanted:u,state:()=>({playing:null!==r,gain:r?d():0,ducked:!!l||o,resumeAt:a})}),tV(),tH}function tX(e){var t;let n,r,i,a,s;return(tz??=(n=(t={transport:tq.cues,prefs:tD}).maxConcurrent??3,r=t.dedupeCapacity??2048,i=new Set,a=new Map,s=0,{play({cue:e,eventId:l,pan:o=0,delayMs:c=0}){let d;if(i.has(l))return"deduped";if(i.add(l),!(i.size<=r))for(let e of i){if(i.size<=r)break;i.delete(e)}let{cuesEnabled:u,cueVolume:p}=t.prefs();if(!u)return"disabled";if(a.size>=n){let t=(()=>{let e=null;for(let[t,n]of a)(!e||tx[tg(n.cue)]<tx[tg(e.cue)])&&(e={key:t,cue:n.cue,handle:n.handle});return e})();if(!t||tx[tg(e)]<=tx[tg(t.cue)])return"dropped";t.handle.stop(),a.delete(t.key)}let m=++s,f=t.transport.start({cue:e,src:tb(e),gain:(d=Math.max(0,Math.min(1,p)),th[tg(e)]*d),pan:Math.max(-1,Math.min(1,o)),delaySeconds:Math.max(0,c)/1e3,onEnded:()=>{a.delete(m)}});return f?(a.set(m,{cue:e,handle:f}),tv(e)&&t.onPriorityCue?.(e),"played"):"blocked"},activeVoices:()=>[...a.values()].map(e=>e.cue),reset(){for(let e of a.values())e.handle.stop();a.clear(),i.clear()}}),tV(),tz).play(e)}function tQ(){let e=tG();if(e.refresh(),null!==tB&&(clearTimeout(tB),tB=null),!e.wanted()||e.state().playing){tU=0;return}tU>=30||(tU+=1,tB=setTimeout(()=>{tB=null,tQ()},700))}function tZ(e,t){if(t?tW.add(e):(tW.delete(e),tJ.delete(e)),tU=0,tW.size>0)return void t1();if(!tY){var n;tY=!0,n=()=>{tY=!1,t1()},"function"==typeof queueMicrotask?queueMicrotask(n):setTimeout(n,0)}}function t0(){let e=null;for(let t of tJ.values())e=t;return e}function t1(){let e=tG();e.setVoiceConnected(tW.size>0),e.setSpeaking(tW.size>0?t0():null),tQ()}function t2(e,t){tJ.delete(e),t&&tJ.set(e,t),tG().setSpeaking(tW.size>0?t0():null)}let t5={waiting:"waiting",returned:"returned",stalled:"stalled"};function t3(e,t){let n=e,r=new Set;for(;t[n]&&!r.has(n);)r.add(n),n=t[n];return r.has(n)?e:n}let t4="llvArchivedProjects";function t6(e){try{window.localStorage.setItem(t4,JSON.stringify([...e]))}catch{}}var t8=n(7650);let t7="llv:pipelines-changed",t9="llv:pipelines-patched",ne="llv:session-titles-changed";async function nt(e){let t,n;try{t=await fetch("/api/session/title",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({path:e.path,conversationId:e.conversationId,title:e.title,baseRevision:e.baseRevision,windowName:e.windowName})})}catch{return{ok:!1,status:0,error:"network"}}try{n=await t.json()}catch{return{ok:!1,status:t.status,error:"invalid response"}}return t.ok&&n.ok?(window.dispatchEvent(new Event(ne)),{ok:!0,override:n.override??null,revision:n.revision??0}):{ok:!1,status:t.status,error:n.error??"save failed",conflict:n.conflict??null}}let nn="llv:tasks-changed";function nr(){window.dispatchEvent(new Event(nn))}async function ni(e,t,n){try{let r=await fetch(e,{method:t,...void 0===n?{}:{headers:{"content-type":"application/json"},body:JSON.stringify(n)}}),i=await r.json().catch(()=>null);if(!r.ok||!i)return{ok:!1,status:r.status,error:i?.error??(0,er.Tl)((0,er.JK)(),"tasks.failed",{status:r.status})};return nr(),{ok:!0,data:i}}catch{return{ok:!1,status:0,error:(0,er.Tl)((0,er.JK)(),"common.serverUnavailable")}}}function na(){return"function"==typeof crypto?.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10)}async function ns(e){let t=await ni("/api/tasks","POST",e);return t.ok?{task:t.data.task}:{error:t.error}}function nl(e){return`/api/task-attachments?sha=${encodeURIComponent(e.sha256)}&ext=${encodeURIComponent(e.ext)}`}async function no(e){let t=new FormData;t.set("file",e);try{let e=await fetch("/api/task-attachments",{method:"POST",body:t}),n=await e.json().catch(()=>null);if(!e.ok||!n?.attachment)return{error:n?.error??(0,er.Tl)((0,er.JK)(),"tasks.failed",{status:e.status})};return{attachment:n.attachment}}catch{return{error:(0,er.Tl)((0,er.JK)(),"common.serverUnavailable")}}}let nc=new Map;async function nd(e){let t=nc.get(e);return t&&await t!==null?(0,er.Tl)((0,er.JK)(),"tasks.textNotSaved"):null}function nu(e,t){let n=void 0!==t.text?nc.get(e):void 0,r=(async()=>{n&&await n;let r=await ni(`/api/tasks/${encodeURIComponent(e)}`,"PATCH",t);return r.ok||404!==r.status?r.ok?null:r.error:(nr(),null)})();return void 0!==t.text&&(nc.set(e,r),r.finally(()=>{nc.get(e)===r&&nc.delete(e)})),r}async function np(e){let t=await ni(`/api/tasks/${encodeURIComponent(e)}`,"DELETE");return t.ok||404!==t.status?t.ok?null:t.error:(nr(),null)}async function nm(e,t){let n=await nd(e);if(n)return{error:n};let r=await ni(`/api/tasks/${encodeURIComponent(e)}/assignment`,"POST",{path:t});return r.ok?{task:r.data.task}:{error:r.error}}async function nf(e,t){let n=await ni(`/api/tasks/${encodeURIComponent(e)}/assignment`,"DELETE","string"==typeof t?{path:t}:t);return n.ok||404!==n.status?n.ok?null:n.error:(nr(),null)}async function nh(e,t){let n=await nd(e);if(n)return{error:n};let r=await ni(`/api/tasks/${encodeURIComponent(e)}/send`,"POST",{paths:t});return r.ok?r.data:{error:r.error}}async function nx(e,t){let n=await nd(e);if(n)return{error:n};let r=await ni(`/api/tasks/${encodeURIComponent(e)}/spawn`,"POST",{retryOfLaunchId:t});return r.ok?r.data:{error:r.error}}let ng="llv:workflows-changed";function nb(e){return e.startsWith("wf-")}let nv="llv:files-changed";function nw(){window.dispatchEvent(new Event(nv))}let ny=new TextEncoder,nk=new TextDecoder;function nj(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function nN(e){return"string"==typeof e?e:""}function nS(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>{let t=nj(e);if(!t)return"";let n=nN(t.type);return"text"===n||"input_text"===n||"output_text"===n?nN(t.text):""}).filter(Boolean).join("\n"):""}function nC(e){return Array.isArray(e)?e.filter(e=>e&&"string"==typeof e.text&&(e.text.length>0||(e.omittedChars??0)>0||(e.omittedItems??0)>0)).map(e=>({itemId:"string"==typeof e.itemId?e.itemId:null,text:e.text,phase:"awaiting-echo"===e.phase?"awaiting-echo":"streaming",startedAt:"string"==typeof e.startedAt?e.startedAt:null,completedAt:"string"==typeof e.completedAt?e.completedAt:null,..."number"==typeof e.omittedChars&&e.omittedChars>0?{omittedChars:Math.floor(e.omittedChars)}:{},..."number"==typeof e.omittedItems&&e.omittedItems>0?{omittedItems:Math.floor(e.omittedItems)}:{}})):[]}function nA(e){return Array.isArray(e.items)||Array.isArray(e.overflow)?[...nC(e.overflow),...nC(e.items)]:e.text?[{itemId:null,text:e.text,phase:"streaming",startedAt:null,completedAt:null}]:[]}function nI(e,t){let n=t.length>544?t.length-544+1:0,r=t.slice(0,n),i=r.length?[{itemId:null,text:"",phase:"awaiting-echo",startedAt:r[0]?.startedAt??null,completedAt:r.at(-1)?.completedAt??null,omittedItems:r.reduce((e,t)=>e+(t.omittedItems??1),0),omittedChars:r.reduce((e,t)=>e+[...t.text].length+(t.omittedChars??0),0)},...t.slice(n)]:t,a=i.reduce((e,t)=>{let n;return e+(n=t.text,ny.encode(n).length)},0)-65536;a>0&&(i=i.map(e=>{let t,n;if(a<=0)return e;let r=(t=e.text,ny.encode(t).length),i=function(e,t){let n=ny.encode(e),r=Math.min(t,n.length);for(;r<n.length&&(192&n[r])==128;)r+=1;return{omittedChars:[...nk.decode(n.subarray(0,r))].length,text:nk.decode(n.subarray(r))}}(e.text,a);return a-=r-(n=i.text,ny.encode(n).length),{...e,text:i.text,omittedChars:(e.omittedChars??0)+i.omittedChars}}));let s=i.at(-1);if(!s)return null;let l=Math.max(0,i.length-32),o=i.slice(0,l),c=i.slice(l);return{turnId:e,text:s.text,items:c,...o.length?{overflow:o}:{}}}function nM(e,t,n){if(!e)return[];let r=nA(e);return e.turnId===t?r:r.map(e=>"streaming"===e.phase?{...e,phase:"awaiting-echo",completedAt:e.completedAt??n}:e)}function nT(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function n$(e){return"string"==typeof e?e:""}function nE(e,t){return`voice:${JSON.stringify([e,t.map(e=>e.responseId)])}`}function nR(e){return Array.isArray(e)?e.flatMap(e=>{let t=nT(e),n=n$(t?.turnId),r=Array.isArray(t?.responses)?t.responses.flatMap(e=>{let t=nT(e),n=n$(t?.responseId);return n&&"string"==typeof t?.text?[{responseId:n,text:t.text}]:[]}):[];if(!n||0===r.length)return[];let i=n$(t?.sourceTurnId),a=nT(t?.streamChunk),s=a?.index,l=a?.startOffset,o=a?.endOffset,c=i&&Number.isInteger(s)&&Number.isInteger(l)&&Number.isInteger(o)&&s>=0&&l>=0&&o>l;return[{deliveryId:nE(n,r),turnId:n,responses:r,ready:t?.ready===!0,...c?{sourceTurnId:i,streamChunk:{index:s,startOffset:l,endOffset:o}}:{}}]}):[]}function nP(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if("string"!=typeof n||!n)continue;let e=t.indexOf(n);e>=0&&t.splice(e,1),t.push(n)}return t.slice(-256)}function nO(){return{cursor:0,retentionFloorSeq:0,filesRevision:0,hostEpoch:0,health:"unknown",scopeHeads:{},sessions:{},attentions:{},operations:{},edges:{},flows:{},workflows:{},tasks:{},deployments:{}}}function nD(e){let t={},n={};for(let r of e.sessions)n[r.conversationId]={...r,attentionIds:[...r.attentionIds],recentReceipts:[...r.recentReceipts],...r.voiceDeliveries?{voiceDeliveries:nR(r.voiceDeliveries)}:{},...r.acknowledgedVoiceDeliveryIds?{acknowledgedVoiceDeliveryIds:nP(r.acknowledgedVoiceDeliveryIds)}:{}},t[`session:${r.conversationId}`]=r.revision;let r={};for(let n of e.recentOperations)r[n.operationId]=n,t[`operation:${n.operationId}`]=n.revision;let i={};for(let n of e.edges)i[n.id]=n,t[`edge:${n.id}`]=n.revision;let a={};for(let{revision:n,value:r}of e.flows)a[r.id]=r,t[`flow:${r.id}`]=n;let s={};for(let{revision:n,value:r}of e.workflows)s[r.id]=r,t[`workflow:${r.id}`]=n;let l={};for(let{revision:n,value:r}of e.tasks)l[r.id]=r,t[`task:${r.id}`]=n;let o={};for(let n of e.deployments??[])o[n.deploymentId]=n,t[`deployment:${n.deploymentId}`]=n.revisionNumber;return{cursor:e.snapshotSeq,retentionFloorSeq:e.retentionFloorSeq,filesRevision:e.filesRevision,hostEpoch:e.runtime.hostEpoch,health:e.runtime.health,scopeHeads:t,sessions:n,attentions:function(e){let t={};for(let n of e)t[n.id]=n;return t}(e.attentions),operations:r,edges:i,flows:a,workflows:s,tasks:l,deployments:o}}function nL(e,t){return{conversationId:e,sessionKey:t.sessionKey??{engine:"codex",sessionId:e},hostKind:t.hostKind??"unhosted",host:t.host??"registering",turn:t.turn??"unknown",provenance:t.provenance??"structured",revision:0,attentionIds:[],recentReceipts:[],accountId:t.accountId??null,parentConversationId:t.parentConversationId??null,flowId:t.flowId??null,workflowId:t.workflowId??null,cwd:t.cwd??null,artifactPath:t.artifactPath??null,capabilities:t.capabilities??{steer:!1,structuredAttention:!1},activeTurnId:t.activeTurnId??null,pendingReconfigure:t.pendingReconfigure??null,drift:null}}function nF(e,t,n,r){let i=e.sessions[t]??nL(t,{}),a=n>i.revision?n:i.revision;e.sessions={...e.sessions,[t]:{...r(i),revision:a}}}function n_(e,t){return"dead"===e.host?"dead":"conflict"===e.host?"conflict":"recovering"===e.host?"recovering":"unhosted"===e.host?"unhosted":t?"waiting_input":"running"===e.turn||"interrupt_requested"===e.turn?"working":"idle"===e.turn?"idle":"unknown"}function nq(e,t){return t.attentionIds.some(t=>e.attentions[t]?.state==="open")}function nz(e){return"delivered"===e||"applied"===e||"answered"===e||"rejected"===e||"failed"===e||"interrupted"===e}let nH={"dead-host":"receipt.human.deadHost","host-dead":"receipt.human.deadHost","no-host":"receipt.human.deadHost",unhosted:"receipt.human.deadHost","host-unavailable":"receipt.human.deadHost","stale-delivery-key":"receipt.human.staleKey",duplicate:"receipt.human.duplicate","turn-active":"receipt.human.turnActive","no-active-turn":"receipt.human.noTurn"};function nB(e){return"queued"===e||"delivering"===e||"turn-started"===e||"steered"===e||"delivered"===e||"answered"===e}function nU(){try{if("u">typeof crypto&&"function"==typeof crypto.randomUUID)return`op_${crypto.randomUUID()}`}catch{}return`op_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`}n(1463);var nK=n(1463);class nY extends Error{}function nW(){if(!function(e){if(void 0===e)return!1;switch(e.trim().replace(/^(["'])([\s\S]*)\1$/,"$2").trim().toLowerCase()){case"0":case"false":case"off":case"no":return!0;default:return!1}}(nK.env.NEXT_PUBLIC_RUNTIME_UI))return!0;try{return"1"===window.localStorage.getItem("llv_runtime_ui")}catch{return!1}}let nJ=null;function nV(){return nJ||(nJ=function(e){let t={store:nO(),connection:"offline",resyncedAt:null,lastEventAt:null,enabled:!1,structuredHostsEnabled:!1},n=new Set,r=new Set,i=!1,a=null,s=0,l=!1,o=!1,c=!1,d=0,u=null,p=null,m=null,f=null,h=null,x=null,g=0,b=0,v=0;function w(){i||0===n.size||(i=!0,e.setTimeout(()=>{for(let e of(i=!1,n))e()},16))}function y(e){t={...t,...e},w()}function k(t){return t&&e.clearTimeout(t),null}function j(){g+=1,h&&e.clearInterval(h),h=null,x=k(x)}function N(){if(s+=1,p=k(p),a)try{a.close()}catch{}a=null}function S(){null===u&&"live"!==t.connection&&y({connection:"live"}),p=k(p),p=e.setTimeout(()=>{E()},2e4)}function C(){d=0,u=null,S()}async function A(){let t=await e.fetch("/api/runtime/snapshot",{headers:{accept:"application/json"}});if(t.ok)return await t.json();if(503===t.status){let e=null;try{e=(await t.json())?.code??null}catch{e=null}if("runtime-plane-absent"===e)throw new nY("runtime plane absent")}throw Error(`snapshot ${t.status}`)}function I(){N(),j(),m=k(m),f=k(f),o=!1,d=0,u=null,t={store:nO(),connection:"offline",resyncedAt:null,lastEventAt:null,enabled:!1,structuredHostsEnabled:!1},w()}function M(){c=!0,I()}async function T(t){if(l)return;l=!0;let n=s;try{let r=await A();if(n!==s)return;o=!0,y({store:nD(r),lastEventAt:e.now(),structuredHostsEnabled:!0===r.structuredHostsEnabled}),t&&(y({resyncedAt:e.now()}),f=k(f),f=e.setTimeout(()=>{f=null,y({resyncedAt:null})},6e3)),$(r.snapshotSeq)}catch(e){if(e instanceof nY)return M();if(n!==s)return;E()}finally{l=!1}}function $(n){let i;N();let l=s,o=`/api/runtime/stream?after=${encodeURIComponent(String(n))}`;try{i=e.createEventSource(o)}catch{E();return}a=i,i.onopen=()=>{l===s&&S()},i.onmessage=n=>{l===s&&function(n){let i;try{i=JSON.parse(n)}catch{return}y({lastEventAt:e.now()});let a=function(e,t){var n;if("files.revision"===t.kind){let n=function(e){if(e&&"object"==typeof e&&"filesRevision"in e){let t=e.filesRevision;if("number"==typeof t)return t}return 0}(t.payload);return n<=e.filesRevision?{outcome:"duplicate"}:{outcome:"applied",store:{...e,filesRevision:n,cursor:Math.max(e.cursor,t.seq)},filesBumped:!0}}if(t.seq<=e.cursor)return{outcome:"duplicate"};let r=(n=t.scope,`${n.type}:${n.id}`),i=e.scopeHeads[r]??0,a=t.revision??i+1;if(a<=i)return{outcome:"duplicate"};if(a>i+1)return{outcome:"gap",scope:r,expected:i+1,got:a};let s={...e,cursor:t.seq,scopeHeads:{...e.scopeHeads,[r]:a}};return function(e,t,n){switch(t.kind){case"session-status":{let r=t.payload,i=r.conversationId??t.scope.id,a=e.sessions[i],s={...a??nL(i,r),...r,conversationId:i,revision:n,attentionIds:r.attentionIds??a?.attentionIds??[],recentReceipts:a?.recentReceipts??[],acknowledgedVoiceDeliveryIds:nP(r.acknowledgedVoiceDeliveryIds??a?.acknowledgedVoiceDeliveryIds)};e.sessions={...e.sessions,[i]:s};break}case"turn-started":{let r=t.payload;nF(e,r.conversationId??t.scope.id,n,e=>({...e,turn:"running",activeTurnId:r.turnId??e.activeTurnId}));break}case"delta":{let r=t.payload,i="string"==typeof r.text?r.text:"";if(!i)break;nF(e,r.conversationId??t.scope.id,n,e=>{let n=r.turnId??e.activeTurnId??"unknown";return{...e,liveTurn:function(e,t,n,r=null){if(!n)return e??null;let i=nM(e,t,r),a=i.at(-1);return nI(t,a?.phase==="streaming"?[...i.slice(0,-1),{...a,text:a.text+n}]:[...i,{itemId:null,text:n,phase:"streaming",startedAt:r,completedAt:null}])}(e.liveTurn,n,i,t.occurredAt??t.recordedAt??null)}});break}case"item":{let r=t.payload;if("completed"!==r.phase)break;nF(e,r.conversationId??t.scope.id,n,e=>{var n,i;let a,s,l,o,c,d,u=r.turnId??e.activeTurnId??"unknown",p=r.voiceResponse;return{...e,liveTurn:function(e,t,n,r=null){let i=function(e){let t=nj(e);if(!t)return null;let n=nN(t.type),r=nj(t.message),i=nN(t.role)||nN(r?.role);return"agentMessage"!==n&&"agent_message"!==n&&"assistant"!==n&&("message"!==n||"assistant"!==i)?null:{itemId:nN(t.id)||nN(t.uuid)||nN(r?.id)||null,text:nN(t.text)||nS(t.content)||nS(r?.content)}}(n);if(!i)return e??null;let a=nM(e,t,r),s=i.itemId?a.findIndex(e=>e.itemId===i.itemId):-1;if(s>=0){let e=a[s],n=a.slice();return n[s]={...e,text:i.text||e.text,...i.text?{omittedChars:void 0}:{},phase:"awaiting-echo",completedAt:r},nI(t,n)}let l=a.at(-1);return l?.phase==="streaming"?nI(t,[...a.slice(0,-1),{...l,itemId:i.itemId,text:i.text||l.text,...i.text?{omittedChars:void 0}:{},phase:"awaiting-echo",completedAt:r}]):i.text?nI(t,[...a,{itemId:i.itemId,text:i.text,phase:"awaiting-echo",startedAt:r,completedAt:r}]):e??null}(e.liveTurn,u,r.item,t.occurredAt??t.recordedAt??null),voiceDeliveries:"string"==typeof p?.responseId&&"string"==typeof p.text?(n=e.voiceDeliveries,i={responseId:p.responseId,text:p.text},c=(o=(l=(s=(a=nR(n)).findIndex(e=>e.turnId===u))>=0?a[s]:{deliveryId:"",turnId:u,responses:[],ready:!1}).responses.findIndex(e=>e.responseId===i.responseId))>=0?l.responses.map((e,t)=>t===o?i:e):[...l.responses,i],d={deliveryId:nE(u,c),turnId:u,responses:c,ready:l.ready},s<0?[...a,d]:a.map((e,t)=>t===s?d:e)):e.voiceDeliveries}});break}case"voice-chunk":{let r=t.payload,i=nR([r.voiceDelivery])[0];nF(e,r.conversationId??t.scope.id,n,e=>({...e,voiceDeliveries:i?function(e,t){let n=nR(e),r=nR([t])[0];if(!r?.ready)return n;let i=n.find(e=>e.deliveryId===r.deliveryId);if(i){if(JSON.stringify(i)!==JSON.stringify(r))throw Error("voice delivery id belongs to different content");return n}return[...n,r]}(e.voiceDeliveries,i):e.voiceDeliveries}));break}case"turn-ended":{let r=t.payload;nF(e,r.conversationId??t.scope.id,n,e=>{var t,n,i,a;let s,l;return{...e,turn:"idle",activeTurnId:null,voiceDeliveries:r.turnId?(t=e.voiceDeliveries,n=r.turnId,i=r.outcome??"",a=e.acknowledgedVoiceDeliveryIds,l=(s=nR(t)).findIndex(e=>e.turnId===n),"completed"!==i?s.filter(e=>e.turnId!==n&&e.sourceTurnId!==n):l<0||s[l].ready?s:nP(a).includes(s[l].deliveryId)?s.filter((e,t)=>t!==l):s.map((e,t)=>t===l?{...e,ready:!0}:e)):e.voiceDeliveries}});break}case"voice-delivery-acknowledged":{let r=t.payload;nF(e,r.conversationId??t.scope.id,n,e=>{var t,n;let i=r.deliveryId??"";return{...e,voiceDeliveries:(t=e.voiceDeliveries,nR(t).filter(e=>e.deliveryId!==i)),acknowledgedVoiceDeliveryIds:(n=e.acknowledgedVoiceDeliveryIds,nP([...nP(n),i]))}});break}case"voice-delivery-progress":nF(e,t.payload.conversationId??t.scope.id,n,e=>e);break;case"attention":{let r=t.payload;e.attentions={...e.attentions,[r.id]:r},nF(e,r.conversationId,n,e=>e.attentionIds.includes(r.id)?e:{...e,attentionIds:[...e.attentionIds,r.id]});break}case"attention-resolved":{let r=t.payload,i=e.attentions[r.attentionId];i&&(e.attentions={...e.attentions,[r.attentionId]:{...i,state:r.state??"resolved",unowned:!1}});let a=r.conversationId??i?.conversationId;a&&nF(e,a,n,e=>({...e,attentionIds:e.attentionIds.filter(e=>e!==r.attentionId)}));break}case"receipt":{let r=t.payload,i={...r,revision:n};e.operations={...e.operations,[r.operationId]:i},nF(e,r.conversationId,e.sessions[r.conversationId]?.revision??0,e=>{var t,n;let r;return{...e,recentReceipts:(t=e.recentReceipts,n=i,r=t.filter(e=>e.operationId!==n.operationId),[n,...r].slice(0,8))}});break}case"edge.created":{let r=t.payload;e.edges={...e.edges,[r.id]:{...r,revision:n}};break}case"flow.state":{let n=t.payload;e.flows={...e.flows,[n.id]:n};break}case"reconcile.drift":{let r=t.payload;nF(e,r.conversationId,n,e=>({...e,drift:r}));break}case"deployment.state":{let n=t.payload;e.deployments={...e.deployments,[n.deploymentId]:n}}}}(s,t,a),{outcome:"applied",store:s,filesBumped:!1}}(t.store,i);if("applied"===a.outcome){if(y({store:a.store}),C(),a.filesBumped)for(let e of r)e(a.store.filesRevision)}else"duplicate"===a.outcome?C():T(!0)}(n.data)},i.onerror=()=>{l===s&&E()},i.addEventListener("heartbeat",()=>{l===s&&(y({lastEventAt:e.now()}),C())}),i.addEventListener("fault",e=>{if(l===s){try{let t=JSON.parse(e.data);if("runtime-host-unavailable"!==t.code)return}catch{return}E()}}),i.addEventListener("reset",()=>{l===s&&T(!0)})}function E(){let t,n;N();let r=e.now();(null===u&&(u=r),r-u>=15e3)?(N(),j(),t=g,y({connection:"degraded"}),O(t),h=e.setInterval(()=>void O(t),1e4),x=e.setTimeout(()=>{x=null,j(),u=null,d=0,R()},6e4)):(y({connection:"reconnecting"}),m=k(m),n=Math.min(500*2**d,8e3),d+=1,m=e.setTimeout(()=>{m=null,R()},n))}function R(){o?P():T(!1)}async function P(){let e=s;try{let n=await A();if(e!==s)return;y({structuredHostsEnabled:!0===n.structuredHostsEnabled}),$(t.store.cursor)}catch(t){if(t instanceof nY)return M();if(e!==s)return;E()}}async function O(n){let i=++b;try{let a=await A();if(n!==g||a.snapshotSeq<t.store.cursor||a.snapshotSeq===t.store.cursor&&i<v)return;v=Math.max(v,i);let s=t.store.filesRevision;if(y({store:nD(a),lastEventAt:e.now(),connection:"degraded",structuredHostsEnabled:!0===a.structuredHostsEnabled}),a.filesRevision>s)for(let e of r)e(a.filesRevision)}catch(i){if(i instanceof nY)return M();if(n!==g)return;let r=t.lastEventAt;null!==r&&e.now()-r>=6e4&&"offline"!==t.connection&&y({connection:"offline"})}}return{getState:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),subscribeFilesRevision:e=>(r.add(e),()=>r.delete(e)),start(){c||t.enabled||(y({enabled:!0,connection:"reconnecting"}),T(!1))},stop(){I()},async refresh(){let n=s;try{let r=await A();if(n!==s||r.snapshotSeq<t.store.cursor)return!0;return o=!0,y({store:nD(r),lastEventAt:e.now(),structuredHostsEnabled:!0===r.structuredHostsEnabled}),!0}catch(e){return e instanceof nY&&M(),!1}}}}({fetch:(e,t)=>fetch(e,t),createEventSource:e=>new EventSource(e),now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)})),nJ}let nG={tmux:{status:"healthy"}},nX={files:[],pinOverlayPaths:[],requestScope:null,projectCatalog:[],projectAliases:{},projectDisplayNames:{},projectCwds:{},flows:[],pipelines:[],workflows:[],tasks:[],systemHealth:nG,conversationAliases:{},launchRoutes:{},loaded:!1,catalogFailures:0};function nQ(e,t){let n=[];return t&&n.push("path="+encodeURIComponent(t)),n.length?"/api/files?"+n.join("&"):"/api/files"}function nZ(e,t){return JSON.stringify(e)===JSON.stringify(t)}function n0(e,t,n){let r=new Map(e.map(e=>[n(e),e])),i=t.map(e=>{let t=r.get(n(e));return void 0!==t&&nZ(t,e)?t:e});return i.length===e.length&&i.every((t,n)=>t===e[n])?e:i}function n1(e,t){return{...t,files:n0(e.files,t.files,e=>e.path),projectCatalog:n0(e.projectCatalog,t.projectCatalog,e=>e.project),projectAliases:nZ(e.projectAliases,t.projectAliases)?e.projectAliases:t.projectAliases,projectDisplayNames:nZ(e.projectDisplayNames,t.projectDisplayNames)?e.projectDisplayNames:t.projectDisplayNames,projectCwds:nZ(e.projectCwds,t.projectCwds)?e.projectCwds:t.projectCwds,flows:n0(e.flows,t.flows,e=>e.id),pipelines:n0(e.pipelines,t.pipelines,e=>e.id),workflows:n0(e.workflows,t.workflows,e=>e.id),tasks:n0(e.tasks,t.tasks,e=>e.id),systemHealth:nZ(e.systemHealth,t.systemHealth)?e.systemHealth:t.systemHealth,conversationAliases:nZ(e.conversationAliases,t.conversationAliases)?e.conversationAliases:t.conversationAliases,launchRoutes:nZ(e.launchRoutes,t.launchRoutes)?e.launchRoutes:t.launchRoutes}}let n2=(L=(e,t)=>fetch(e,t),i=nX,a=!1,s=new Map,l=new Map,o=new Map,c=0,d=0,u=Promise.resolve(),p=new Map,m=nX.pipelines,f=0,h=e=>e.catalogFailures===f?e:{...e,catalogFailures:f},x=e=>{if(!p.size)return[...e];let t=new Set,n=e.flatMap(e=>{let n=p.get(e.id);return n?(t.add(e.id),n.pipeline?[n.pipeline]:[]):[e]});for(let[e,r]of p)!t.has(e)&&r.pipeline&&n.push(r.pipeline);return n},g=e=>{let t;return h({...t=s.get(e)?.data??(i.requestScope===e?i:{...nX,requestScope:e}),pipelines:x(t.pipelines)})},b=(e,t="background")=>{if(!a)for(let[n,r]of l){if(void 0!==e){e===r&&n(h(i),t);continue}n(g(r),t)}},v=e=>{if(a)return;let t=e?0:f+1;t!==f&&(f=t,b(void 0,"urgent"))},w=e=>[...l.values()].some(t=>t===e),y=e=>{let t=o.get(e);t&&(o.delete(e),t.phase="canceled",void 0!==t.timer&&clearTimeout(t.timer),t.controller?.abort())},k=(e,t)=>"canceled"!==t.phase&&o.get(e)===t&&w(e),j=()=>{i={...i,pipelines:x(m)}},N=(e,t)=>{if(m=i.pipelines,t)for(let[t,n]of p)n.minGeneration<=e&&p.delete(t);p.size&&j()},S=()=>{for(;s.size>8;){let e=[...s.keys()].find(e=>!w(e));if(void 0===e)break;s.delete(e)}},C=(e,t,n)=>{s.delete(e),s.set(e,{data:t,etag:n}),S()},A=async(e,t,n,r,i=0,a)=>{try{let s=await I(e,t,n,r,i,a);return v(!0),s}catch(e){throw e instanceof Error&&"AbortError"===e.name||v(!1),e}},I=async(e,t,n,r,l=0,o)=>{var u,p,m,f,h;let x,g;if(a)return i;let v=nQ(void 0,e);if(o){if(!k(v,o))return i;o.phase="active",o.controller=new AbortController}let w=++c,j=s.get(v),S=(m=j?.etag??"",f=t,h=n,g={},m&&(g["If-None-Match"]=m),void 0!==f&&(g["x-llv-files-revision"]=String(f)),void 0!==h&&(g["x-llv-files-generation"]=String(h)),Object.keys(g).length>0?g:void 0),A=S||o?.controller?{...S?{headers:S}:{},...o?.controller?{signal:o.controller.signal}:{}}:void 0;try{x=await L(v,A)}finally{o&&(o.controller=void 0)}if(a||o&&!k(v,o))return i;let I=n4(x,"x-llv-files-generation"),M=n4(x,"x-llv-files-target-generation"),$="stale"===x.headers.get("x-llv-files-projection-cache"),E=M??I??n,R=void 0!==E&&($||void 0!==I&&void 0!==M&&I<M);if(304===x.status){if(!j)throw Error("files request returned 304 without a cached representation");if(w<d)return i;let n=i;return(i!==j.data||i.requestScope!==v)&&(u=i,p=j.data,i=n1(u,{...p,requestScope:v})),d=w,C(v,i,j.etag),N(r??w,!R),i!==n&&b(v),R&&void 0!==E?T(v,e,t,E,r??w,l,o):y(v),i}if(!x.ok)throw Error(`files request failed: ${x.status}`);let P=JSON.parse(await x.text());if(o&&!k(v,o)||w<d)return i;let O=Array.isArray(P)?{files:P,pinOverlayPaths:[],requestScope:v,projectCatalog:[],projectAliases:{},projectDisplayNames:{},projectCwds:{},flows:[],pipelines:[],workflows:[],tasks:[],systemHealth:nG,conversationAliases:{},launchRoutes:{},loaded:!0,catalogFailures:0}:{files:P.files??[],pinOverlayPaths:P.pinOverlayPaths??[],requestScope:v,projectCatalog:P.projectCatalog??[],projectAliases:P.projectAliases??{},projectDisplayNames:P.projectDisplayNames??{},projectCwds:P.projectCwds??{},flows:P.flows??[],pipelines:P.pipelines??[],workflows:P.workflows??[],tasks:P.tasks??[],pipelinesError:P.pipelinesError,systemHealth:P.systemHealth??nG,conversationAliases:P.conversationAliases??{},launchRoutes:P.launchRoutes??{},loaded:!0,catalogFailures:0},D=R&&e&&j?.data.files.some(t=>t.path===e)?{...j.data,requestScope:v}:O;i=n1(i,D),d=w;let F=x.headers.get("ETag");return C(v,i,F??void 0),N(r??w,!R),b(v),R&&void 0!==E?T(v,e,t,E,r??w,l,o):y(v),i},M=(e,t,n,r,s,l)=>{if(a)return Promise.resolve(i);let o=u.then(()=>A(e,t,n,r,s,l));return u=o.then(()=>void 0,()=>void 0),o},T=(e,t,n,r,i,s,l)=>{if(a)return;if(!w(e)){l&&y(e);return}let c=o.get(e);if(l){if(c!==l||"canceled"===l.phase)return}else if(c){c.targetGeneration<r&&(c.pinnedPath=t,c.revision=n,c.targetGeneration=r,c.logicalGeneration=i);return}let d=l??{pinnedPath:t,revision:n,targetGeneration:r,logicalGeneration:i,attempt:s,phase:"scheduled"};d.pinnedPath=t,d.revision=n,d.targetGeneration=r,d.logicalGeneration=i,d.attempt=s,d.phase="scheduled",l||o.set(e,d),d.timer=setTimeout(()=>{if(d.timer=void 0,!k(e,d))return void y(e);d.phase="queued";let t=d.attempt+1;M(d.pinnedPath,d.revision,d.targetGeneration,d.logicalGeneration,t,d).catch(()=>{T(e,d.pinnedPath,d.revision,d.targetGeneration,d.logicalGeneration,t,d)})},Math.min(1e3,25*2**Math.min(s,10)))},{read:()=>h(i),readScope:e=>g(nQ(void 0,e)),revalidate:(e,t)=>M(e,t),subscribe:(e,t)=>{if(a)return()=>{};let n=nQ(void 0,t);return l.set(e,n),()=>{l.delete(e),w(n)||y(n),S()}},applyPipeline:(e,t)=>{if(a)return;let n=!!e.hiddenAt&&!e.restored;p.set(e.id,{pipeline:n?null:e,minGeneration:t?c+1:1/0}),j(),b(void 0,"urgent")},revertPipeline:e=>{a||p.delete(e)&&(j(),b(void 0,"urgent"))},dispose:()=>{if(!a){for(let e of(a=!0,[...o.keys()]))y(e);l.clear()}}});function n5(e,t){(0,t8.flushSync)(()=>n2.applyPipeline(e,t)),window.dispatchEvent(new Event(t9))}function n3(e){(0,t8.flushSync)(()=>n2.revertPipeline(e)),window.dispatchEvent(new Event(t9))}function n4(e,t){let n=e.headers.get(t);if(null===n||!/^\d+$/.test(n))return;let r=Number(n);return Number.isSafeInteger(r)?r:void 0}let n6={loaded:!1,ids:new Set},n8=new Set;function n7(){return n6}let n9={claim:!1,track:!1,suppressSelection:!1},re="viewMode",rt="taskPanelOpen",rn="path:",rr=e=>`${rn}${e}`,ri=e=>`favorite:${e}`,ra=e=>`fold:${e}`,rs=e=>`tray:${e}`;function rl(e,t){let n=new Set,r=e;for(;void 0!==t[r]&&!n.has(r);)n.add(r),r=t[r];return r}function ro(e,t){return e.startsWith(rn)?rr(rl(e.slice(rn.length),t)):e}let rc={absent:0,manual:1,pinned:2,expanded:3,hidden:4};function rd(e,t){let n=new Map,r=(e,r)=>{let i=rl(e,t),a=n.get(i);(void 0===a||(rc[r]??0)>(rc[a]??0))&&n.set(i,r)};for(let t of e.prefs.hidden)r(t,"hidden");for(let t of e.prefs.expanded)r(t,"expanded");for(let t of e.prefs.manual)r(t,(e.explicitManual??[]).includes(t)?"pinned":"manual");return n}function ru(e,t){let n=new Set(e??[]),r=new Set(t??[]);return[...new Set([...n,...r])].filter(e=>n.has(e)!==r.has(e))}function rp(e,t={}){let n=e=>rr(rl(e,t));switch(e.kind){case"close":case"restore":return[n(e.path)];case"reconcile-roots":return[...e.roots,...e.removeManual].map(n);case"remap-paths":return e.pairs.flatMap(({from:e,to:t})=>[n(e),n(t)]);case"set-favorite":return[ri(e.id)];case"set-engine-child-fold":return[ra(e.id),n(e.path)];case"set-engine-tray-expanded":return[rs(e.parentId)];case"set-presentation":return[...void 0===e.viewMode?[]:[re],...void 0===e.taskPanelOpen?[]:[rt]]}}function rm(e,t){let n=ro(t,e.pathAliases??{});return e.keyRevisions?.[n]??e.keyRevisionFloor??0}function rf(e){return[...new Set(e)]}function rh(e){return e.pathAliases??{}}function rx(e,t){let n=new Set,r=e;for(;void 0!==t[r];){if(n.has(r))throw Error("board path alias cycle");n.add(r),r=t[r]}return r}function rg(e,t=rh(e)){let n=function(e){let t={};for(let n of Object.keys(e)){let r=rx(n,e);n!==r&&(t[n]=r)}return t}(t),r=rf(e.prefs.hidden.map(e=>rx(e,n))),i=new Set(r),a=e=>rf(e.map(e=>rx(e,n)).filter(e=>!i.has(e))),s=a(e.prefs.manual),l=new Set(s);return{...e,pathAliases:n,explicitManual:a(e.explicitManual??[]).filter(e=>l.has(e)),prefs:{...e.prefs,manual:s,hidden:r,expanded:a(e.prefs.expanded),favorites:rf(e.prefs.favorites??[]),foldedEngineChildIds:rf(e.prefs.foldedEngineChildIds??[]),expandedEngineTrayParentIds:rf(e.prefs.expandedEngineTrayParentIds??[])}}}function rb(e,t){let n=rg(e);for(let e of t){if("remap-paths"===e.kind){n=function(e,t,n=!1){let r=rh(e),i=t.filter(({from:e,to:t})=>rx(e,r)!==rx(t,r));if(0===i.length)return rg(e);let a=new Set(t.map(({from:e})=>rx(e,r))),s=new Set(i.map(({to:e})=>rx(e,r))),l=e=>{if(n)return!0;let t=rx(e,r);return!s.has(t)||a.has(t)},o=e.prefs.manual.filter(l),c=(e.explicitManual??[]).filter(l),d={...r};for(let{from:e,to:t}of i)d[e]=t;return rg({...e,explicitManual:c,prefs:{...e.prefs,manual:o}},d)}(n,e.pairs,e.targetPlacementAuthoritative);continue}if("reconcile-roots"===e.kind){n=function(e,t,n){let r=rh(e),i=new Set(n.map(e=>rx(e,r))),a=e.prefs.manual.filter(e=>!i.has(e)),s=(e.explicitManual??[]).filter(e=>!i.has(e)),l=new Set([...a,...e.prefs.hidden,...Object.values(r).map(e=>rx(e,r))]);for(let e of t.map(e=>rx(e,r)))l.has(e)||(a.push(e),l.add(e));return rg({...e,explicitManual:s,prefs:{...e.prefs,manual:a}})}(n,e.roots,e.removeManual);continue}if("restore"===e.kind){n=function(e,t,n){let r={...e.prefs,hidden:e.prefs.hidden.filter(e=>e!==t)},i=(e.explicitManual??[]).filter(e=>e!==t);if("auto"===n)return rg({...e,explicitManual:i,prefs:r});let a={...r,manual:r.manual.filter(e=>e!==t),expanded:r.expanded.filter(e=>e!==t)};return rg({...e,explicitManual:"manual"===n?[...i,t]:i,prefs:"manual"===n?{...a,manual:[...a.manual,t]}:{...a,expanded:[...a.expanded,t]}})}(n,rx(e.path,rh(n)),e.placement);continue}if("set-favorite"===e.kind){let t=e.favorite?rf([...n.prefs.favorites,e.id]):n.prefs.favorites.filter(t=>t!==e.id);n=rg({...n,prefs:{...n.prefs,favorites:t}});continue}if("set-engine-child-fold"===e.kind){let t=n.prefs.foldedEngineChildIds??[],r=e.folded?rf([...t,e.id]):t.filter(t=>t!==e.id),i=rx(e.path,rh(n));n=rg({...n,explicitManual:e.folded?(n.explicitManual??[]).filter(e=>e!==i):n.explicitManual,prefs:{...n.prefs,foldedEngineChildIds:r,manual:e.folded?n.prefs.manual.filter(e=>e!==i):n.prefs.manual,expanded:e.folded?n.prefs.expanded.filter(e=>e!==i):n.prefs.expanded}});continue}if("set-engine-tray-expanded"===e.kind){let t=n.prefs.expandedEngineTrayParentIds??[],r=e.expanded?rf([...t,e.parentId]):t.filter(t=>t!==e.parentId);n=rg({...n,prefs:{...n.prefs,expandedEngineTrayParentIds:r}});continue}if("set-presentation"===e.kind){n=rg({...n,prefs:{...n.prefs,...void 0===e.viewMode?{}:{viewMode:e.viewMode},...void 0===e.taskPanelOpen?{}:{taskPanelOpen:e.taskPanelOpen}}});continue}let t=rx(e.path,rh(n));n=rg({...n,explicitManual:(n.explicitManual??[]).filter(e=>e!==t),prefs:{...n.prefs,manual:n.prefs.manual.filter(e=>e!==t),expanded:n.prefs.expanded.filter(e=>e!==t),hidden:rf([...n.prefs.hidden,t])}})}return n}let rv={manual:[],hidden:[],expanded:[],favorites:[],foldedEngineChildIds:[],expandedEngineTrayParentIds:[],viewMode:null,taskPanelOpen:!1};function rw(e){return 0===e.manual.length&&0===e.hidden.length&&0===e.expanded.length&&0===e.favorites.length&&(e.foldedEngineChildIds?.length??0)===0&&(e.expandedEngineTrayParentIds?.length??0)===0&&null===e.viewMode&&!e.taskPanelOpen}function ry(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}let rk=new Map,rj=new Map,rN=new Map,rS={paths:new Set,armed:!1},rC=new Map,rA=e=>rC.get(e)??rS,rI=new Map;function rM(e,t,n=!1){let r=rk.get(e)??{manual:[],expanded:[]};n?r.expanded.includes(t)||r.expanded.push(t):r.manual.includes(t)||r.manual.push(t),rk.set(e,r),rj.get(e)?.()}let rT=new Set(["INVALID_REQUEST","PAYLOAD_TOO_LARGE"]),r$=new Set(["UNSUPPORTED_SCHEMA_VERSION"]);function rE(e,t){return JSON.stringify({prefs:e.prefs,pathAliases:e.pathAliases??{},explicitManual:e.explicitManual??[]})===JSON.stringify({prefs:t.prefs,pathAliases:t.pathAliases??{},explicitManual:t.explicitManual??[]})}function rR(e,t){if(0===t.length)return e;try{return rb(e,t)}catch{return e}}let rP=e=>e.map(e=>e.mutation),rO={prefs:rv,explicitManual:[],revision:0,sync:"unavailable",loaded:!1,selection:rS.paths,selectionArmed:!1},rD=new Map;function rL(e){let t=(0,B.useRef)(null),[n,r]=(0,B.useState)(()=>({project:e,snapshot:function(e){if(null===e)return rO;let t=rA(e),n=rN.get(e);return n?{prefs:n.prefs,explicitManual:n.explicitManual??[],revision:n.revision,sync:"current",loaded:!0,selection:t.paths,selectionArmed:t.armed}:{...rO,selection:t.paths,selectionArmed:t.armed}}(e)}));return(0,B.useEffect)(()=>{if(null===e){t.current=null,r({project:e,snapshot:rO});return}let n=function(e){let t=rD.get(e);if(t)return t.refs+=1,t.store;let n=null;try{n=window.localStorage}catch{n=null}let r=function(e){var t;let n,{project:r,fetcher:i,storage:a}=e,s=e.scheduler??{setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},l="/api/board?project="+encodeURIComponent(r),o=rN.get(r),c=o??{schemaVersion:1,revision:0,updatedAt:new Date(0).toISOString(),pathAliases:{},explicitManual:[],keyRevisions:{},keyRevisionFloor:0,prefs:rv},d=[],u=!1,p=void 0!==o,m=!1,f=p?{prefs:c.prefs,explicitManual:c.explicitManual??[],revision:c.revision,sync:"current",loaded:!0,selection:rA(r).paths,selectionArmed:rA(r).armed}:{prefs:rv,explicitManual:[],revision:0,sync:"unavailable",loaded:!1,selection:rA(r).paths,selectionArmed:rA(r).armed},h=!1,x=0,g=null,b=null,v=1e3,w=!1,y=0,k=new Set,j=()=>{0===d.length&&(w=!1);let e=rR(c,rP(d));for(let t of(f={prefs:e.prefs,explicitManual:e.explicitManual??[],revision:c.revision,sync:m?"unavailable":0===d.length?u?"pending":"current":w?"stale":"pending",loaded:p,selection:rA(r).paths,selectionArmed:rA(r).armed},p&&!m&&rN.set(r,c),k))t()},N=e=>{let t=rA(r);if(e.paths!==t.paths||e.armed!==t.armed){0!==e.paths.size||e.armed?rC.set(r,e):rC.delete(r);for(let e of[...rI.get(r)??[]])e()}},S=(t=()=>j(),(n=rI.get(r)??new Set).add(t),rI.set(r,n),()=>{n.delete(t),0===n.size&&rI.delete(r)}),C=(e,t=null)=>{if(e.revision<c.revision)return void j();if(c=e,m=!1,d.length>0){var n;n=null===t?d:function(e,t,n){if(0===t.size)return[...e];let r=n.pathAliases??{};return e.map(e=>{let i={...e.observed},a=!1;for(let s of Object.keys(e.observed)){if(!t.has(ro(s,r)))continue;let e=rm(n,s);e!==i[s]&&(i[s]=e,a=!0)}return a?{...e,observed:i}:e})}(d,t,e),(d=n.filter(t=>!Object.entries(t.observed).some(([t,n])=>rm(e,t)>n))).length>0?w=!0:$()}j()},A=async(e,t)=>{y+=1;try{let n=await i("/api/board",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({schemaVersion:1,project:r,baseRevision:t,mutations:e})});if(n.ok){let e=await n.json();return{status:"ok",applied:e.applied,board:e.board}}if(409===n.status)return{status:"conflict",board:(await n.json()).board};if(n.status>=400&&n.status<500){let e=await n.json().catch(()=>null);if(e?.error!==void 0&&rT.has(e.error))return{status:"rejected"};if(e?.error!==void 0&&r$.has(e.error))return{status:"envelope"}}return{status:"error"}}catch{return{status:"error"}}},I=async(e,t)=>{y+=1;try{let n=await i("/api/board",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({schemaVersion:1,project:r,baseRevision:t,patch:e})});if(n.ok){let e=await n.json();return{status:"ok",applied:e.applied,board:e.board}}if(409===n.status)return{status:"conflict",board:(await n.json()).board};return{status:"error"}}catch{return{status:"error"}}},M=e=>{let t;if(0===e.length)return;let n=rR(c,rP(d)),r=[...d,...e.map(e=>(function(e,t){let n={};for(let r of rp(e,t.pathAliases??{}))n[r]=rm(t,r);return{mutation:e,observed:n}})(e,c))];try{t=rb(c,rP(r))}catch{t=null}null!==t&&rE(n,t)||(d=r,j(),R())},T=()=>{if(!p||h)return;let e=rk.get(r);e&&(0!==e.manual.length||0!==e.expanded.length)&&(rk.delete(r),M([{kind:"set-presentation",viewMode:"scheme"},...e.manual.map(e=>({kind:"restore",path:e,placement:"manual"})),...e.expanded.map(e=>({kind:"restore",path:e,placement:"expanded"}))]))},$=()=>{null!==b&&(s.clearTimeout(b),b=null),v=1e3},E=()=>{if(null!==b||h)return;let e=v;v=Math.min(2*v,3e4),b=s.setTimeout(()=>{b=null,x=0,R()},e)},R=async()=>{if(u||h||0===d.length)return;u=!0,j();let e=function(e,t=128){let n=Math.max(1,Math.min(t,128)),r=[],i=0;for(let t of e){let e=function(e){let t=JSON.stringify(e);return"u"<typeof TextEncoder?t.length:new TextEncoder().encode(t).length}(t);if(r.length>0&&(r.length>=n||i+e>196608))break;r.push(t),i+=e}return r}(rP(d),g??128),t=await A(e,c.revision);if(u=!1,!h){if("ok"===t.status){$(),x=0,g=null,m=!1;let n=t.applied??rE(rR(c,e),t.board)?new Set(e.flatMap(e=>rp(e,t.board.pathAliases??{}))):null;d=d.slice(e.length),C(t.board,n),d.length&&R();return}if("rejected"===t.status){$(),x=0,1===e.length?(g=null,d=d.slice(1)):g=Math.max(1,Math.floor(e.length/2)),j(),d.length&&R();return}if("envelope"===t.status){g=null,m=!0,j(),E();return}if("conflict"===t.status){if(C(t.board),x+=1,0===d.length){x=0;return}x<=8?R():E();return}j(),E()}},P=async()=>{let e=null;try{let t=await i(l);t.ok&&(e=(await t.json()).board)}catch{e=null}if(!h){if(!e){m=!0,p=!0,j();return}if(p=!0,e.revision<c.revision)return void C(e);if(0===e.revision&&rw(e.prefs)){let t=function(e,t){if(!t)return null;let n={manual:[],hidden:[],expanded:[]},r=!1;try{let i=t.getItem(`llvCols:${e}`);if(i){let e=JSON.parse(i);n={manual:ry(e.manual),hidden:ry(e.hidden),expanded:ry(e.expanded)},r=!0}}catch{}let i=t.getItem(`llvEmptyView:${e}`),a="scheme"===i||"list"===i?i:null,s="1"===t.getItem("llvTaskPanel");return r||null!==a||s?{...n,favorites:[],foldedEngineChildIds:[],expandedEngineTrayParentIds:[],viewMode:a,taskPanelOpen:s}:null}(r,a);if(t&&!rw(t)){c={...e,prefs:t},u=!0,j();let n=await I(t,0);if(u=!1,h)return;C("ok"===n.status||"conflict"===n.status?n.board:e,"ok"===n.status&&!0===n.applied?function(e,t){let n=new Set,r=t.pathAliases??{},i=rd(e,r),a=rd(t,r);for(let e of new Set([...i.keys(),...a.keys()]))(i.get(e)??"absent")!==(a.get(e)??"absent")&&n.add(rr(e));for(let r of ru(e.prefs.favorites,t.prefs.favorites))n.add(ri(r));for(let r of ru(e.prefs.foldedEngineChildIds,t.prefs.foldedEngineChildIds))n.add(ra(r));for(let r of ru(e.prefs.expandedEngineTrayParentIds,t.prefs.expandedEngineTrayParentIds))n.add(rs(r));return e.prefs.viewMode!==t.prefs.viewMode&&n.add(re),e.prefs.taskPanelOpen!==t.prefs.taskPanelOpen&&n.add(rt),n}(e,n.board):null),d.length&&R();return}}C(e)}};rj.set(r,T),P().then(T);let O=s.setInterval(()=>{if(u||h)return;let e=y;(async()=>{try{let t=await i(l);if(!t.ok)return;let n=(await t.json()).board;if(u||h||y!==e)return;if(n.revision!==c.revision)return void C(n);m&&0===d.length&&(m=!1,j())}catch{}})()},1e4);return{getSnapshot:()=>f,subscribe:e=>(k.add(e),()=>k.delete(e)),mutate(e){M(e)},toggleSelection(e){var t;let n;N({paths:(t=rA(r).paths,(n=new Set(t)).delete(e)||n.add(e),n),armed:rA(r).armed})},commitSelection(e,t){N({paths:function(e,t,n){if(!n)return new Set(t);if(0===t.length)return e;let r=new Set(e);for(let e of t)r.add(e);return r}(rA(r).paths,e,t),armed:rA(r).armed})},clearSelection(){N(rS)},setSelectionArmed(e){N({paths:rA(r).paths,armed:e})},pruneSelectionTo(e){N({paths:function(e,t){for(let n of e)if(!t.has(n))return new Set([...e].filter(e=>t.has(e)));return e}(rA(r).paths,e),armed:rA(r).armed})},dispose(){h=!0,S(),$(),rj.get(r)===T&&rj.delete(r),s.clearInterval(O),k.clear()}}}({project:e,fetcher:(e,t)=>fetch(e,t),storage:n});return rD.set(e,{store:r,refs:1}),r}(e);t.current=n,r({project:e,snapshot:n.getSnapshot()});let i=n.subscribe(()=>r({project:e,snapshot:n.getSnapshot()}));return()=>{let n;i(),(n=rD.get(e))&&(n.refs-=1,n.refs>0||(rD.delete(e),n.store.dispose())),t.current=null}},[e]),{...n.project===e?n.snapshot:rO,mutate(e){t.current?.mutate(e)},close(e){t.current?.mutate([{kind:"close",path:e}])},restore(e,n){t.current?.mutate([{kind:"restore",path:e,placement:n}])},setViewMode(e){t.current?.mutate([{kind:"set-presentation",viewMode:e}])},setTaskPanelOpen(e){t.current?.mutate([{kind:"set-presentation",taskPanelOpen:e}])},setFavorite(e,n){t.current?.mutate([{kind:"set-favorite",id:e,favorite:n}])},setEngineChildFold(e,n,r){t.current?.mutate([{kind:"set-engine-child-fold",id:e,path:n,folded:r}])},setEngineTrayExpanded(e,n){t.current?.mutate([{kind:"set-engine-tray-expanded",parentId:e,expanded:n}])},toggleSelection(e){t.current?.toggleSelection(e)},commitSelection(e,n){t.current?.commitSelection(e,n)},clearSelection(){t.current?.clearSelection()},setSelectionArmed(e){t.current?.setSelectionArmed(e)},pruneSelectionTo(e){t.current?.pruneSelectionTo(e)}}}let rF="(max-width: 767px)";function r_(e){let t=window.matchMedia(rF);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function rq(){return(0,B.useSyncExternalStore)(r_,()=>window.matchMedia(rF).matches,()=>!1)}let rz={project:null,board:{renderedRevision:null,durableRevision:null,sync:"unavailable"}},rH={mode:"overview",focusedPath:null,selectedPaths:[],visiblePaths:[],camera:null};function rB(e,t){let n=e.z||1;return{x:-e.x/n,y:-e.y/n,width:t.w/n,height:t.h/n}}function rU(e,t,n={}){if(0===t.size)return[];let r=[],i=new Set;for(let n of e)if(!(!t.has(n)||i.has(n))&&(i.add(n),r.push(n),r.length>=64))return r;if(!n.includeUnordered)return r;for(let e of t)if(!i.has(e)&&(r.push(e),r.length>=64))break;return r}function rK(e,t){return JSON.stringify(e)===JSON.stringify(t)}function rY(e,t,n){return{project:e.project,board:e.board,mode:t.mode,focusedPath:t.focusedPath,selectedPaths:t.selectedPaths,visiblePaths:t.visiblePaths,camera:t.camera,viewport:t.viewport??n}}let rW=($=rz,E=rH,R=new Set,P=()=>{for(let e of R)e()},{reportContext(e){rK($,e)||($=e,P())},reportSlice(e){rK(E,e)||(E=e,P())},getContext:()=>$,getSlice:()=>E,subscribe:e=>(R.add(e),()=>R.delete(e))}),rJ="llvDeviceId";function rV(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"vs-"+Math.random().toString(36).slice(2)+Date.now().toString(36)}function rG(e){try{let t=e?.getItem(rJ);if(t)return t}catch{}let t=rV();try{e?.setItem(rJ,t)}catch{}return t}function rX(e,t,n,r,i){return{schemaVersion:1,viewSessionId:t.viewSessionId,deviceId:t.deviceId,device:t.device,visibility:i,sequence:n,inputSequence:r,project:e.project,mode:e.mode,viewport:e.viewport,camera:e.camera,focusedPath:e.focusedPath,selectedPaths:e.selectedPaths,visiblePaths:e.visiblePaths,board:e.board}}async function rQ(e){try{if(e.body&&"function"==typeof e.body.cancel)return void await e.body.cancel();"function"==typeof e.text&&await e.text()}catch{}}let rZ=["pointerdown","keydown","touchstart","wheel"],r0={"content-type":"application/json"};function r1(){return"u"<typeof document||"hidden"!==document.visibilityState}var r2=n(4577);function r5({onReturn:e,precise:t,t:n}){let r=n(t?"attention.return":"attention.returnLine");return(0,F.jsx)("div",{"data-scheme-ui":!0,"data-testid":"focus-return-chip",className:"absolute left-3 top-[52px] z-40 flex items-center rounded-[10px] border border-border bg-card/95 p-1 shadow-1",children:(0,F.jsx)("button",{type:"button","data-testid":"attention-return",onClick:e,title:r,"aria-label":r,className:"inline-flex h-7 w-7 items-center justify-center rounded-[8px] text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(r2.A,{className:"h-4 w-4","aria-hidden":!0})})})}let r3=(O=null,D=null,{setBoard:e=>(O=e,()=>{O===e&&(O=null)}),board:()=>O,setShell:e=>(D=e,()=>{D===e&&(D=null)}),shell:()=>D});function r4(e){return"region"===e.kind||"point"===e.kind}function r6(e){switch(e.kind){case"conversation":return[e.path];case"pipeline":return[`group::pipeline::${e.pipelineId}`];case"stage":return[`slot::${e.pipelineId}::${e.stageId}`];case"flowRound":return[`deck::${e.flowId}`];case"task":return[`task::${e.taskId}`];case"draft":return[`draft::${e.draftId}`];case"region":case"point":return[]}}let r8=e=>({x:e.x+e.w/2,y:e.y+e.h/2});function r7(e,t,n=[]){let r=r8(t),i=null;for(let t of e.named??[]){if(n.includes(t.key))continue;let e=r8(t.rect),a=Math.hypot(e.x-r.x,e.y-r.y);(!i||a<i.distance)&&(i={key:t.key,label:t.label,distance:a})}return i?{key:i.key,label:i.label}:null}function r9(e,t){return{project:e.project,rect:t,boardRevision:e.boardRevision}}let ie=()=>({resolution:"lost",frame:null,target:null,nearestAnchor:null,degraded:!1});function it(e,t,n){if(!n)return ie();if(r4(e)){if(e.project!==n.project)return ie();let t="region"===e.kind?e.rect:{x:e.x-300,y:e.y-300,w:600,h:600};return{resolution:"exact",frame:r9(n,t),target:e,nearestAnchor:r7(n,t),degraded:!1}}let r=r6(e);for(let t of r){let r=n.rectFor(t);if(r)return{resolution:"exact",frame:r9(n,r),target:e,nearestAnchor:null,degraded:!1}}if(t&&t.project===n.project){let e=r8(t.rect);return{resolution:"approximate",frame:r9(n,t.rect),target:{kind:"point",project:n.project,x:e.x,y:e.y},nearestAnchor:r7(n,t.rect,r),degraded:!0}}return ie()}let ir=e=>new Promise(t=>{setTimeout(t,e)});function ii(e){return e&&e.project.length>0&&e.rect.w>0&&e.rect.h>0?e:null}async function ia(e,t,n){return is(e,n,e=>e.project===t)}async function is(e,t,n){let r=t.timeoutMs??4e3,i=t.pollMs??40,a=t.sleep??ir,s=t.now??(()=>Date.now()),l=s()+r;for(;;){let t=e.board();if(t&&n(t))return t;if(s()>=l)return null;await a(i)}}async function il(e,t,n={}){let r=r4(e.target)?e.target.project:e.frameAtCreation.project,i=t.shell();i&&i.project!==r&&i.openProject(r);let a=await ia(t,r,n),s=it(e.target,ii(e.frameAtCreation),a?.index??null),l=!1;if(a&&"lost"===s.resolution&&"conversation"===e.target.kind&&i){let o=e.target.path;i.placePath(o),l=!0,a=await is(t,n,e=>e.project===r&&null!==e.index.rectFor(o))??a,s=it(e.target,ii(e.frameAtCreation),a.index)}return a&&s.frame&&"lost"!==s.resolution&&a.moveTo({rect:s.frame.rect,zoom:e.zoom,anchorKeys:function(e,t){if(!e||r4(e))return[];var n=r6(e);let r=[];for(let e of n){if(null===t.rectFor(e))continue;let n=t.concreteAnchorKey?.(e)??e;for(let t of n&&n!==e?[n,e]:[e])r.includes(t)||r.push(t)}return r}(s.degraded?null:s.target,a.index)})?(l||"open"!==e.intent||"conversation"!==e.target.kind||i?.openPath(e.target.path),{resolution:s.resolution,moved:!0,frame:s.frame}):{resolution:"lost",moved:!1,frame:null}}async function io(e,t,n,r={}){let i=n.shell();if("overview"===e.mode)return!!i&&(i.openOverview(),!0);if(t&&i&&i.project!==t&&i.openProject(t),e.camera&&t){let i=await ia(n,t,r);if(i?.restoreCamera(e.camera))return!0}return e.focusedPath&&i?(i.openPath(e.focusedPath),!0):!!(t&&i)}function ic(e){return`llv.attention.return-project.${e}`}function id(e,t){if(!e||!t)return{};try{let n=e.getItem(ic(t));if(!n)return{};let r=JSON.parse(n);if(!r||"object"!=typeof r||Array.isArray(r))return{};return Object.fromEntries(Object.entries(r).filter(([,e])=>null===e||"string"==typeof e))}catch{return{}}}function iu(e,t,n){if(e&&t)try{e.setItem(ic(t),JSON.stringify(n))}catch{}}function ip(e,t,n){let r=id(e,t);n in r&&(delete r[n],iu(e,t,r))}function im(){let e=rW.getSlice(),t=e.camera;return{mode:e.mode,camera:t?{x:t.x,y:t.y,zoom:t.zoom}:null,focusedPath:e.focusedPath,project:rW.getContext().project}}function ih(e){return e.ok||null!==e.refusal}function ix(){try{return window.localStorage}catch{return null}}function ig({mobile:e,bus:t=r3,deviceId:n,fetchFn:r,pollMs:i,timing:a}){let{t:s}=(0,er.Ym)(),[l,o]=(0,B.useState)(n??null);(0,B.useEffect)(()=>{void 0===n&&o(rG(ix()))},[n]);let c=e?null:n??l,d=(0,B.useRef)(new Map),u=(0,B.useCallback)(e=>{let t=d.current.get(e)??im();return{mode:t.mode,camera:t.camera,focusedPath:t.focusedPath}},[]),p=(0,B.useRef)(new Map),m=function({deviceId:e,captureViewport:t,pollMs:n=4e3,refusalTtlMs:r=12e3,fetchFn:i,surfaceVisible:a}){let[s,l]=(0,B.useState)(null),[o,c]=(0,B.useState)(0),[d,u]=(0,B.useState)(null),p=i??("function"==typeof fetch?fetch:null),m=(0,B.useRef)(r1);(0,B.useEffect)(()=>{m.current=a??r1},[a]);let f=(0,B.useCallback)(async()=>{if(!e||!p)return null;try{let t=await p(`/api/attention?deviceId=${encodeURIComponent(e)}`);if(!t.ok)return null;return await t.json()}catch{return null}},[e,p]),h=(0,B.useCallback)(async(e,t)=>{let n;if(!p)return{ok:!1,refusal:null};try{n=await p(`/api/attention/${encodeURIComponent(e)}`,{method:"POST",headers:r0,body:JSON.stringify(t)})}catch{return{ok:!1,refusal:null}}if(n.ok)return{ok:!0};let r=null;try{r=await n.json()}catch{r=null}return{ok:!1,refusal:{requestId:e,reason:"string"==typeof r?.error?r.error:`http-${n.status}`,state:"string"==typeof r?.state?r.state:null}}},[p]),x=(0,B.useCallback)(async()=>{let t=await f();if(!t)return;let n=t.live.find(e=>"pending"===e.request.state);n&&e&&m.current()?(tX({cue:"attention",eventId:`attention:${n.request.id}`}),await h(n.request.id,{kind:"offer",deviceId:e}),l(await f()??t)):l(t)},[f,h,e]),g=(0,B.useCallback)(async(e,t)=>{let n=await h(e,t);return n.ok?u(null):n.refusal&&u(n.refusal),await x(),n},[h,x]);(0,B.useEffect)(()=>{if(!e)return;let t=!1,r=async()=>{!t&&(await x(),t||c(e=>e+1))},i=setInterval(()=>{r()},n);r();let a=()=>{r()},s="u"<typeof document?null:document;return s?.addEventListener("visibilitychange",a),()=>{t=!0,clearInterval(i),s?.removeEventListener("visibilitychange",a)}},[e,n,x]);let b=(0,B.useCallback)(async(t,n="operator")=>e?g(t.id,{kind:"accept",deviceId:e,via:n}):{ok:!1,refusal:null},[g,e]),v=(0,B.useCallback)(async(n,r)=>{if(!e)return{ok:!1,refusal:null};if("lost"===r){let t=await g(n.id,{kind:"abandon",deviceId:e});return u({requestId:n.id,reason:"lost-target",state:null}),t}return g(n.id,{kind:"arrive",deviceId:e,resolution:r,returnPoint:{deviceId:e,capturedAt:new Date().toISOString(),...t(n.id)}})},[g,e,t]);return(0,B.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>u(e=>e===d?null:e),r);return()=>clearTimeout(e)},[d,r]),{view:s,offer:s?.offer??null,pollGeneration:o,refusal:d,dismissRefusal:(0,B.useCallback)(()=>u(null),[]),accept:b,preview:(0,B.useCallback)(async t=>{e&&await g(t.id,{kind:"preview",deviceId:e})},[g,e]),decline:(0,B.useCallback)(async t=>{e&&await g(t.id,{kind:"decline",deviceId:e})},[g,e]),dismiss:(0,B.useCallback)(async t=>{e&&await g(t.id,{kind:"dismiss",deviceId:e})},[g,e]),arrive:v,goBack:(0,B.useCallback)(async(t,n="control")=>e?g(t.id,{kind:"return",deviceId:e,via:n}):{ok:!1,refusal:null},[g,e]),refresh:x}}({deviceId:c,captureViewport:u,...r?{fetchFn:r}:{},...i?{pollMs:i}:{}}),f=(0,B.useCallback)(async e=>{let n=im();d.current.set(e.id,n);let r=!1;try{var i,s,l;let o;if(!(await m.accept(e,"auto-follow")).ok)return;i=ix(),s=e.id,l=n.project,o=id(i,c),delete o[s],iu(i,c,Object.fromEntries([...Object.entries(o),[s,l]].slice(-8)));let d=await il(e,t,a??{}),u=await m.arrive(e,d.resolution);u.ok?r=!0:ih(u)||"lost"===d.resolution||(r=!0,p.current.set(e.id,d.resolution))}finally{p.current.has(e.id)||d.current.delete(e.id),r||ip(ix(),c,e.id)}},[m,t,c,a]),h=(0,B.useCallback)(async e=>{let n=e.returnPoints.find(e=>e.deviceId===c);if(n){var r,i;if(!await io(n,(r=ix(),i=e.id,id(r,c)[i]??null),t,a??{}))return}ih(await m.goBack(e,"control"))&&ip(ix(),c,e.id)},[m,t,c,a]),x=(0,B.useRef)(new Set),g=(0,B.useRef)(m.view),b=m.view;(0,B.useEffect)(()=>{g.current=b},[b]);let v=m.pollGeneration;(0,B.useEffect)(()=>{if(c&&0!==p.current.size)for(let e of g.current?.live??[]){let t=p.current.get(e.request.id);if(!(void 0===t||x.current.has(e.request.id))){if("accepted"!==e.request.state||e.request.acknowledgedBy!==c){p.current.delete(e.request.id),d.current.delete(e.request.id);continue}x.current.add(e.request.id),(async()=>{try{let n=await m.arrive(e.request,t);if(!ih(n))return;p.current.delete(e.request.id),d.current.delete(e.request.id),n.ok||ip(ix(),c,e.request.id)}finally{x.current.delete(e.request.id)}})()}}},[v,m,c]);let w=(0,B.useRef)(new Set),y=m.offer,k=y&&"actionable"===y.status?y.request.id:null,j=y&&"actionable"===y.status?y.request:null;(0,B.useEffect)(()=>{c&&k&&j&&(w.current.has(k)||(w.current.add(k),f(j)))},[c,k,j,f]);let N=(0,B.useCallback)(()=>{y&&h(y.request)},[y,h]);return y&&"following"===y.status?(0,F.jsx)(r5,{onReturn:N,precise:y.returnAvailable,t:s}):null}let ib="llv-operator",iv="llv.operator.capability",iw="llv.bridge.pendingAcks",iy=[],ik=!1;function ij(){if(!ik){ik=!0;try{let e=window.sessionStorage.getItem(iw),t=e?JSON.parse(e):null;if(!Array.isArray(t))return;iy=t.flatMap(e=>"string"==typeof e?.waitingOn&&"string"==typeof e.ackToken?[{waitingOn:e.waitingOn,ackToken:e.ackToken,at:Number(e.at)||0,sessionId:"string"==typeof e.sessionId?e.sessionId:null}]:[])}catch{}}}function iN(){try{window.sessionStorage.setItem(iw,JSON.stringify(iy))}catch{}}function iS(e,t,n={}){if(!e||!t)return;ij();let r={waitingOn:e,ackToken:t,at:n.now??Date.now(),sessionId:n.sessionId??null};iy=[...iy.filter(t=>t.waitingOn!==e),r].slice(-32),iN()}function iC(e){return ij(),iy.find(t=>t.waitingOn===e)?.ackToken??null}function iA(){return ij(),iy.map(({waitingOn:e,ackToken:t,sessionId:n})=>({waitingOn:e,ackToken:t,sessionId:n}))}function iI(e){ij();let t=iy.filter(t=>t.waitingOn!==e);t.length!==iy.length&&(iy=t,iN())}let iM={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>{clearTimeout(e)}};class iT extends Error{constructor(e,t){super(e),this.name="DeadlineExceededError",this.timeoutMs=t}}function i$(e,t){let n=Math.max(1,Math.floor(e)),r=Math.min(Math.max(t.jitter??0,0),1),i=t.random??Math.random;return Math.max(0,Math.round(Math.min(t.maxMs,t.baseMs*2**Math.min(n-1,30))*(1-r*i())))}let iE=Math.floor(1e4),iR=globalThis;function iP(){return iR.__llvRetiredBridgeSessions??=[]}function iO(e){return iP().find(t=>t.sessionId===e)??null}function iD(e){return 401===e||403===e}async function iL(e,t,n,r){let i=function(e,t={}){let n,r=t.scheduler??iM,i=new AbortController,a=t.signal??null,s=!1,l=()=>{void 0!==n&&(r.clearTimeout(n),n=void 0),s&&(a?.removeEventListener("abort",o),s=!1)};function o(){l(),i.signal.aborted||i.abort(a?.reason)}return a?.aborted?i.abort(a.reason):(a&&(a.addEventListener("abort",o,{once:!0}),s=!0),Number.isFinite(e)&&e>=0&&(n=r.setTimeout(()=>{n=void 0,l(),i.signal.aborted||i.abort(new iT(t.reason??"deadline exceeded",e))},e))),{signal:i.signal,release:l}}(r.timeoutMs??8e3,{signal:r.signal??null,scheduler:r.scheduler??iM,reason:"bridge request deadline exceeded"});try{return await e(t,{...n,signal:i.signal})}finally{i.release()}}let iF={text:"",ackToken:"",commit:()=>void 0};async function i_(e,t=fetch,n={}){if(!e)return;let r=await iL(t,"/api/bridge",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ackToken:e})},n);if(!r.ok)throw new iq(r.status)}class iq extends Error{constructor(e){super(`bridge acknowledgement refused with ${e}`),this.name="BridgeAcknowledgementRefused",this.status=e}}function iz(e){return e instanceof iq&&409===e.status}async function iH(e=fetch,t=()=>!0,n={}){for(let r of iA())if(t(r.waitingOn))try{await i_(r.ackToken,e,n),iI(r.waitingOn)}catch(e){iz(e)&&iI(r.waitingOn)}}let iB=new Set,iU=new Map,iK=null,iY=null,iW=null;function iJ(e,t){return e?.conversationId===t?.conversationId&&e?.phase===t?.phase}function iV(e){return iB.add(e),()=>iB.delete(e)}function iG(){return iY}function iX(){return iW}function iQ(){return null}function iZ(){return null}function i0(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function i1(e,t){let n=i0(e);return n&&"string"==typeof n[t]?n[t]:null}function i2(e){let t=i0(e.turn),n=i0(e.item),r=(Array.isArray(e.content)?e.content:Array.isArray(n?.content)?n.content:[]).map(e=>"string"==typeof e?e:i1(e,"text")??i1(e,"transcript")??"").join("");return(i1(e,"transcript")??i1(e,"text")??i1(e,"delta")??i1(t,"transcript")??i1(t,"text")??i1(n,"transcript")??i1(n,"text")??r).slice(0,12e3)}async function i5(e){let t=await e.json().catch(()=>({}));if(!e.ok)throw Error("string"==typeof t.error?t.error:`Realtime request failed (${e.status})`);return t}async function i3(e){"complete"!==e.iceGatheringState&&await new Promise(t=>{let n=window.setTimeout(r,5e3);function r(){window.clearTimeout(n),e.removeEventListener("icegatheringstatechange",i),t()}function i(){"complete"===e.iceGatheringState&&r()}e.addEventListener("icegatheringstatechange",i)})}class i4{constructor(e){this.conversationId=e,this.snapshot={phase:"idle",lines:[],error:null,startedAt:null,micMuted:!1,outputMuted:!1},this.listeners=new Set,this.peer=null,this.events=null,this.media=null,this.audio=null,this.pendingWorkerDeliveries=new Map,this.acknowledgedWorkerDeliveries=new Set,this.deliveryAcknowledgedListeners=new Set,this.realtimeSessionId=null,this.workerDeliveryFlush=null,this.workerDeliveryWakeEpoch=null,this.unloadHangup=null,this.lineSequence=0,this.openTranscriptLines=new Map,this.epoch=0,this.subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e)),this.getSnapshot=()=>this.snapshot,this.onDeliveryAcknowledged=e=>(this.deliveryAcknowledgedListeners.add(e),()=>this.deliveryAcknowledgedListeners.delete(e)),this.micStream=()=>this.media,this.toggleMic=()=>{let e=!this.snapshot.micMuted;for(let t of this.media?.getAudioTracks()??[])t.enabled=!e;this.update({micMuted:e})},this.toggleOutput=()=>{let e=!this.snapshot.outputMuted;this.audio&&(this.audio.muted=e),this.update({outputMuted:e})},this.realtimeSession=()=>this.realtimeSessionId}async start(){if("connecting"===this.snapshot.phase||"live"===this.snapshot.phase)return;if(!navigator.mediaDevices?.getUserMedia||"u"<typeof RTCPeerConnection)return void this.setError("Realtime audio is unavailable in this browser");this.cleanupTransport(),this.update({phase:"connecting",error:null,startedAt:null,micMuted:!1,outputMuted:!1});let e=++this.epoch;try{let t=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),n=new RTCPeerConnection,r=n.createDataChannel("oai-events"),i=new Audio;for(let e of(i.autoplay=!0,i.hidden=!0,document.body.append(i),this.media=t,this.peer=n,this.events=r,this.audio=i,t.getAudioTracks()))n.addTrack(e,t);if(n.ontrack=({streams:t})=>{e===this.epoch&&(t[0]&&(i.srcObject=t[0]),i.play().catch(()=>void 0))},r.onmessage=t=>{e===this.epoch&&this.acceptWireMessage(t.data)},r.onopen=()=>{e===this.epoch&&(this.update({phase:"live",error:null,startedAt:Date.now()}),this.flushWorkerDeliveries())},this.unloadHangup=()=>{try{fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"stop",conversationId:this.conversationId,realtimeSessionId:this.realtimeSessionId}),keepalive:!0})}catch{}},window.addEventListener("pagehide",this.unloadHangup),r.onclose=()=>{e===this.epoch&&("live"===this.snapshot.phase||"connecting"===this.snapshot.phase)&&this.failWithServerReason("Realtime connection closed",e)},n.onconnectionstatechange=()=>{e===this.epoch&&("failed"===n.connectionState||"disconnected"===n.connectionState)&&this.failWithServerReason("Realtime connection was interrupted",e)},await n.setLocalDescription(await n.createOffer()),await i3(n),e!==this.epoch)return;let a=n.localDescription?.sdp;if(!a)throw Error("The browser produced no WebRTC offer");let s=await i5(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",conversationId:this.conversationId,sdp:a})}));if(e!==this.epoch)return;if("string"!=typeof s.sdp)throw Error("Codex returned no WebRTC answer");this.realtimeSessionId="string"==typeof s.realtimeSessionId?s.realtimeSessionId:null,await n.setRemoteDescription({type:"answer",sdp:s.sdp})}catch(t){if(e!==this.epoch)return;this.cleanupTransport(),this.setError(t instanceof Error?t.message:String(t))}}async stop(){if("idle"===this.snapshot.phase)return;this.epoch+=1,this.update({phase:"stopping",error:null});let e=null;try{await i5(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"stop",conversationId:this.conversationId,realtimeSessionId:this.realtimeSessionId})}))}catch(t){e=t instanceof Error?t.message:String(t)}this.cleanupTransport(),this.update({phase:e?"error":"idle",error:e})}updateWorkerProgress(e,t,n){e&&t&&"live"===this.snapshot.phase&&this.writeLine(`progress:${e}`,"progress",t,!n,"replace")}reconcileWorkerDeliveries(e,t={}){let n=nR(e);if(t.authoritative){let e=new Set(n.map(e=>e.deliveryId));for(let[t,n]of this.pendingWorkerDeliveries)n.sourceTurnId&&!e.has(t)&&this.pendingWorkerDeliveries.delete(t)}for(let e of n)!e.ready||this.acknowledgedWorkerDeliveries.has(e.deliveryId)||this.pendingWorkerDeliveries.set(e.deliveryId,e);this.flushWorkerDeliveries()}flushWorkerDeliveries(){if("live"!==this.snapshot.phase||0===this.pendingWorkerDeliveries.size)return;if(this.workerDeliveryFlush){this.workerDeliveryWakeEpoch=this.epoch;return}let e=this.deliverPendingWorkerResponses();this.workerDeliveryFlush=e,e.finally(()=>{if(this.workerDeliveryFlush!==e)return;this.workerDeliveryFlush=null;let t=this.workerDeliveryWakeEpoch;this.workerDeliveryWakeEpoch=null,t===this.epoch&&this.flushWorkerDeliveries()})}async deliverPendingWorkerResponses(){for(;"live"===this.snapshot.phase;){let e,t=this.pendingWorkerDeliveries.values().next().value;if(!t)return;try{e=await i5(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"deliverWorkerResponse",conversationId:this.conversationId,realtimeSessionId:this.realtimeSessionId,delivery:t})}))}catch{return}if(!0!==e.acknowledged||e.deliveryId!==t.deliveryId)return;for(let e of(this.pendingWorkerDeliveries.delete(t.deliveryId),this.acknowledgedWorkerDeliveries.add(t.deliveryId),this.deliveryAcknowledgedListeners))e(t.deliveryId)}}acceptWireMessage(e){let t;if("string"!=typeof e)return;try{t=JSON.parse(e)}catch{return}let n=function(e){let t=i0(e);if(!t)return{kind:"ignored"};let n=i1(t,"type")??i1(t,"method")??"";if("input_transcript.added"===n){let e=i2(t);return e?{kind:"transcript",role:"user",text:e,final:!1}:{kind:"ignored"}}if("output_transcript.added"===n){let e=i2(t);return e?{kind:"transcript",role:"assistant",text:e,final:!1}:{kind:"ignored"}}if("turn.done"===n){let e,n=i2(t);return n?{kind:"transcript",role:"user"===(e=i1(t,"role")??i1(t.turn,"role")??i1(t.item,"role"))||"input"===e?"user":("assistant"===e,"assistant"),text:n,final:!0}:{kind:"ignored"}}if("delegation.created"===n){let e=i1(t.item,"id")??i1(t.delegation,"id")??i1(t,"delegation_item_id")??"";return e?{kind:"delegation",id:e}:{kind:"ignored"}}return"error"===n?{kind:"error",message:(i1(t,"message")??i1(t.error,"message")??"Realtime conversation failed").slice(0,500)}:{kind:"ignored"}}(t);if("transcript"===n.kind)this.writeTranscript(n.role,n.text,n.final);else{if("delegation"===n.kind)return;"error"===n.kind&&this.setError(n.message)}}writeTranscript(e,t,n){this.openTranscriptLines.delete("user"===e?"assistant":"user");let r=this.openTranscriptLines.get(e)??`${e}:${++this.lineSequence}`;n?this.openTranscriptLines.delete(e):this.openTranscriptLines.set(e,r),this.writeLine(r,e,t,n,n?"replace":"append")}writeLine(e,t,n,r,i){let a=[...this.snapshot.lines],s=a.findIndex(t=>t.id===e);if(s<0)a.push({id:e,role:t,text:n.slice(-12e3),final:r});else{let e=a[s],t="replace"===i||n.startsWith(e.text)?n:`${e.text}${n}`;a[s]={...e,text:t.slice(-12e3),final:r}}this.update({lines:a.slice(-80)})}setError(e){this.update({phase:"error",error:e.slice(0,500)})}failWithServerReason(e,t){this.setError(e),(async()=>{try{let e=await i5(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",conversationId:this.conversationId})})),n=i1(e.failure,"message")?.trim()??"";n&&t===this.epoch&&"error"===this.snapshot.phase&&this.setError(n)}catch{}})()}update(e){let t=this.snapshot.phase;for(let t of(this.snapshot={...this.snapshot,...e},this.listeners))t();this.snapshot.phase!==t&&function(e,t){if(iU.get(e)!==t){iU.set(e,t),"idle"!==t&&(iK=e);let n=null;for(let[e,t]of iU)"idle"!==t&&(n={conversationId:e,phase:t});let r=n;if(!r&&iK&&(r={conversationId:iK,phase:iU.get(iK)??"idle"}),!(iJ(r,iY)&&iJ(n,iW)))for(let e of(iY=r,iW=n,iB))e()}}(this.conversationId,this.snapshot.phase)}cleanupTransport(){for(let e of(this.openTranscriptLines.clear(),this.unloadHangup&&window.removeEventListener("pagehide",this.unloadHangup),this.unloadHangup=null,this.events?.close(),this.peer?.close(),this.media?.getTracks()??[]))e.stop();this.audio?.remove(),this.events=null,this.peer=null,this.media=null,this.audio=null,this.realtimeSessionId=null}}let i6=new Map;function i8(e){let t=i6.get(e);if(t)return t;let n=new i4(e);return i6.set(e,n),n}function i7({resolveClient:e=i8}){let t=(0,B.useSyncExternalStore)(iV,iG,iZ),n=t?.conversationId??null;return!function(e,t,n={}){let r=(0,B.useRef)([]),i=(0,B.useRef)(null),{fetchFn:a,now:s,onState:l,random:o,scheduler:c}=n,d=n.pollMs??iE,u=n.requestTimeoutMs??8e3,p=(0,B.useRef)({onState:l,random:o});(0,B.useEffect)(()=>{p.current={onState:l,random:o}},[l,o]),(0,B.useEffect)(()=>{let n;if(!e||!t)return;let l=a??fetch,o=c??iM,m=s??Date.now,f=new AbortController,h=!1,x=!1,g=0,b=[],v=e=>{x||p.current.onState?.(e)},w=(e,t)=>iL(l,e,t,{timeoutMs:u,signal:f.signal,scheduler:o}),y=async(e,t)=>{let n=await w("/api/bridge",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ackToken:e,realtimeSessionId:t})});if(!n.ok)throw new iq(n.status)},k=async e=>{let t=[...b.flatMap(e=>{let t=iC(e);return t?[{waitingOn:e,ackToken:t}]:[]}),...iA().filter(t=>t.waitingOn.startsWith("voice:")&&(null===t.sessionId||t.sessionId===e))],n=new Set,r=0;for(let i of t){if(x||r>=4)break;if(!n.has(i.waitingOn)){n.add(i.waitingOn),r+=1;try{await y(i.ackToken,e),iI(i.waitingOn),b=b.filter(e=>e!==i.waitingOn)}catch(e){if(e instanceof iq&&iD(e.status))return e.status;iz(e)&&(iI(i.waitingOn),b=b.filter(e=>e!==i.waitingOn))}}}return null},j=(e,t)=>{var n,r;let i,a,s,l,o=(n=m(),r=p.current.random,i=iO(e),s={sessionId:e,status:t,attempts:a=(i?.attempts??0)+1,nextAttemptAt:n+i$(a,{baseMs:6e4,maxMs:9e5,jitter:.2,...r?{random:r}:{}})},(l=iP().filter(t=>t.sessionId!==e)).push(s),iR.__llvRetiredBridgeSessions=l.slice(-16),s),c=Math.max(0,o.nextAttemptAt-m());return v({kind:"retired",sessionId:e,status:t,attempts:o.attempts,retryInMs:c}),{kind:"retired",retryInMs:c}},N=async()=>{var t;let n,a=e.realtimeSession();if(!a)return v({kind:"idle"}),{kind:"idle"};let s=iO(a);if(s&&m()<s.nextAttemptAt)return v({kind:"retired",sessionId:a,status:s.status,attempts:s.attempts,retryInMs:Math.max(0,s.nextAttemptAt-m())}),{kind:"retired",retryInMs:Math.max(0,s.nextAttemptAt-m())};v({kind:"polling",sessionId:a});let l=await k(a);if(null!==l)return j(a,l);if(x||e.realtimeSession()!==a)return{kind:"settled"};let o=new URLSearchParams({realtimeSessionId:a});for(let e of r.current)o.append("acked",e);i.current&&o.set("lastBatchAt",i.current.toISOString());let c=await w(`/api/bridge?${o.toString()}`,{cache:"no-store"});if(iD(c.status))return j(a,c.status);if(429===(t=c.status)||t>=500)return{kind:"retryable"};if(!c.ok)return{kind:"settled"};(n=iP().filter(e=>e.sessionId!==a)).length!==iP().length&&(iR.__llvRetiredBridgeSessions=n);let d=(await c.json()).plan;if(!d||x||e.realtimeSession()!==a)return{kind:"settled"};if("deliver"===d.kind)return iS(d.delivery.deliveryId,d.ackToken,{sessionId:a}),e.reconcileWorkerDeliveries([d.delivery]),i.current=new Date,{kind:"settled"};if("already-acknowledged"!==d.kind)return{kind:"settled"};try{await y(d.ackToken,a)}catch(e){if(e instanceof iq&&iD(e.status))return j(a,e.status);if(!iz(e))return{kind:"retryable"}}return{kind:"settled"}},S=e=>{x||(void 0!==n&&o.clearTimeout(n),n=o.setTimeout(()=>{n=void 0,C()},e))},C=async()=>{let t;if(!x&&!h){h=!0;try{t=await N()}catch(e){t=(e instanceof iT||"object"==typeof e&&null!==e&&"AbortError"===e.name)&&x?{kind:"idle"}:{kind:"retryable"}}finally{h=!1}if(!x){if("retryable"===t.kind){let t=i$(g+=1,{baseMs:iE,maxMs:3e5,jitter:.3,...p.current.random?{random:p.current.random}:{}}),n=e.realtimeSession();n&&v({kind:"backing-off",sessionId:n,failures:g,delayMs:t}),S(t);return}g=0,S("retired"===t.kind?Math.min(t.retryInMs,d):d)}}},A=e.onDeliveryAcknowledged(e=>{x||iC(e)&&(r.current=[...r.current,e].slice(-256),b=[...b.filter(t=>t!==e),e].slice(-256),x||h||S(0))}),I=()=>{f.abort(Error("bridge relay page hidden"))},M=window;return M?.addEventListener("pagehide",I),C(),()=>{x=!0,M?.removeEventListener("pagehide",I),A(),void 0!==n&&o.clearTimeout(n),n=void 0,f.abort(Error("bridge relay stopped"))}},[e,a,s,c,t,d,u])}((0,B.useMemo)(()=>n?e(n):null,[n,e]),t?.phase==="live"),null}var i9=n(9992),ae=n(2298);let at={neutral:"bg-sunken text-muted",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",danger:"bg-danger-soft text-danger",accent:"bg-accent-soft text-accent",info:"bg-info-soft text-info"};function an({tone:e="neutral",className:t="",style:n,children:r,...i}){return(0,F.jsx)("span",{className:`inline-flex min-h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2 py-0.5 text-caption font-semibold leading-none tabular-nums ${n?"":at[e]} ${t}`,style:n,...i,children:r})}var ar=n(9554);let ai=0;function aa(){return ai+=1,`att-${Date.now().toString(36)}-${ai}`}function as(e){if(e.ownsPreview&&e.preview)try{URL.revokeObjectURL?.(e.preview)}catch{}}function al(e){return 4*Math.ceil(e/3)}function ao(e){return String(Math.round(e/1048576*10)/10)}function ac(e,t){return t&&0!==e.length?t.supported?e.length>t.maxImages?(0,er.Tl)((0,er.JK)(),"img.tooManyStructured",{max:t.maxImages}):e.some(e=>{var n;let r;return r=(n=e.base64).endsWith("==")?2:+!!n.endsWith("="),Math.max(0,Math.floor(3*n.length/4)-r)>t.maxRawBytesPerImage})?(0,er.Tl)((0,er.JK)(),"img.structuredTooLarge",{max:ao(t.maxRawBytesPerImage)}):e.reduce((e,t)=>e+t.base64.length,0)>t.maxEncodedBytesPerRequest?(0,er.Tl)((0,er.JK)(),"img.structuredAggregateTooLarge",{max:ao(t.maxEncodedBytesPerRequest)}):null:t.reason??(0,er.Tl)((0,er.JK)(),"composer.structuredImagesUnavailable"):null}function ad(e){let t=[];for(let n of e)"ready"===n.status&&n.base64&&t.push({id:n.id,base64:n.base64,mime:n.mime,preview:n.preview});return t}function au({attachments:e,onRemove:t,onRetry:n,onClearAll:r}){let{t:i}=(0,er.Ym)(),a=rq();if(!e.length)return null;let s=e.filter(e=>"ready"===e.status).length,l=e.length>=2?(0,F.jsxs)("button",{type:"button",onClick:r,"aria-label":i("img.clearAllAria"),className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-canvas font-semibold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"h-11 px-3 text-[11px]":"h-6 px-2 text-[10.5px]"}`,children:[(0,F.jsx)(i9.TB,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",i("img.clearAll")]}):null,o=(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold text-muted",children:[i("composer.imagesCount",{count:s||e.length})," ",(0,F.jsx)(i9.Qp,{className:"h-3 w-3","aria-hidden":!0})," ",i("img.deliveryHint")]});return a?(0,F.jsxs)("div",{"data-testid":"attachment-tray","aria-label":i("composer.imagesCount",{count:s||e.length}),className:"no-scrollbar flex max-h-16 min-w-0 max-w-full items-center gap-2 overflow-x-auto overscroll-x-contain px-2 pb-1 pt-2",children:[e.map((e,r)=>(0,F.jsx)(af,{attachment:e,index:r,onRemove:t,onRetry:n},e.id)),l]}):(0,F.jsxs)("div",{className:"flex min-w-0 max-w-full flex-wrap items-center gap-1.5","data-testid":"attachment-tray",children:[e.map((e,r)=>(0,F.jsx)(ah,{attachment:e,index:r,onRemove:t,onRetry:n},e.id)),o,l]})}function ap(e,t,n){return"reading"===e.status?(0,F.jsx)("span",{className:"absolute inset-0 flex items-center justify-center rounded bg-canvas/70","aria-label":t("img.readingAria",{n:n+1}),children:(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin text-muted","aria-hidden":!0})}):"error"===e.status?(0,F.jsx)("span",{className:"absolute inset-0 flex items-center justify-center rounded bg-danger/10","aria-hidden":!0,children:(0,F.jsx)("span",{className:"text-[10px] font-bold uppercase text-danger",children:"!"})}):null}function am({attachment:e,index:t}){let{t:n}=(0,er.Ym)();return"ready"===e.status&&e.preview?(0,F.jsx)("img",{src:e.preview,alt:n("img.previewAlt",{n:t+1}),className:"h-full w-full rounded border border-border object-cover"}):e.preview?(0,F.jsx)("img",{src:e.preview,alt:n("img.previewAlt",{n:t+1}),className:"h-full w-full rounded border border-border object-cover opacity-60"}):(0,F.jsx)("span",{className:"flex h-full w-full items-center justify-center rounded border border-border bg-sunken text-muted","aria-hidden":!0,children:(0,F.jsx)(i9.xf,{className:"h-4 w-4"})})}function af({attachment:e,index:t,onRemove:n,onRetry:r}){let{t:i}=(0,er.Ym)();return(0,F.jsxs)("div",{className:"relative flex h-12 w-12 shrink-0 flex-col","data-testid":"attachment-tile","data-status":e.status,children:[(0,F.jsxs)("span",{className:"relative h-12 w-12",children:[(0,F.jsx)(am,{attachment:e,index:t}),ap(e,i,t)]}),(0,F.jsx)("button",{type:"button",onClick:()=>n(e.id),"aria-label":i("img.removeAria",{n:t+1}),className:"absolute right-0.5 top-0.5 flex h-6 w-6 items-center justify-center rounded-full border border-border bg-card text-muted shadow-1 before:absolute before:-inset-2.5 before:content-[''] hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0})}),"error"===e.status?(0,F.jsxs)("button",{type:"button",onClick:()=>r(e.id),"aria-label":i("img.retryAria",{n:t+1}),className:"absolute inset-x-0 bottom-0 mx-auto flex h-5 items-center justify-center gap-0.5 rounded-full border border-border bg-card px-1.5 text-[9px] font-bold text-warning before:absolute before:-inset-3 before:content-[''] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)(i9.kt,{className:"h-3 w-3","aria-hidden":!0})," ",i("img.retry")]}):null]})}function ah({attachment:e,index:t,onRemove:n,onRetry:r}){let{t:i}=(0,er.Ym)();return(0,F.jsxs)("div",{className:"group/img relative h-10 w-10","data-testid":"attachment-tile","data-status":e.status,children:[(0,F.jsx)(am,{attachment:e,index:t}),ap(e,i,t),(0,F.jsx)("button",{type:"button",onClick:()=>n(e.id),"aria-label":i("img.removeAria",{n:t+1}),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full border border-border bg-card text-muted shadow-1 hover:text-danger group-hover/img:flex focus-visible:flex focus-visible:outline-none",children:(0,F.jsx)(i9.X,{className:"h-2.5 w-2.5","aria-hidden":!0})}),"error"===e.status?(0,F.jsx)("button",{type:"button",onClick:()=>r(e.id),"aria-label":i("img.retryAria",{n:t+1}),className:"absolute -bottom-1 left-1/2 flex h-4 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-card px-1 text-[8px] font-bold text-warning focus-visible:outline-none",children:(0,F.jsx)(i9.kt,{className:"h-2.5 w-2.5","aria-hidden":!0})}):null]})}function ax({onFiles:e,ariaLabel:t,className:n,disabled:r=!1,disabledReason:i}){let a=(0,B.useRef)(null);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("input",{ref:a,type:"file",accept:"image/*",multiple:!0,disabled:r,className:"hidden",onChange:t=>{e(Array.from(t.target.files??[])),t.target.value=""}}),(0,F.jsx)("button",{type:"button","aria-label":t,title:i,disabled:r,onClick:()=>a.current?.click(),className:n,children:(0,F.jsx)(i9.xf,{className:"h-4 w-4","aria-hidden":!0})})]})}async function ag(e){if(!e.busy&&!e.voiceSending){e.setVoiceSending(!0);try{var t;let n=await e.stop();if(null===n)return;let r=(t=e.currentText(),n?t?`${t.trimEnd()} ${n}`:n:t);e.setText(r),await e.submit(r)}finally{e.setVoiceSending(!1)}}}function ab(e,t,{maxPx:n,minPx:r=0,pinned:i}){(0,B.useLayoutEffect)(()=>{var t,a,s;let l=e.current;if(!l)return;let o=l.scrollTop,c=(t=l.selectionStart,a=l.selectionEnd,t===(s=l.value.length)&&a===s);l.style.height="0px",l.style.height=function(e,t,n=0){return Math.min(Math.max(e+2,n),t)}(l.scrollHeight,n,r)+"px",function({pinned:e,caretAtEnd:t}){return e||t}({pinned:i,caretAtEnd:c})?l.scrollTop=l.scrollHeight:l.scrollTop=o},[e,t,n,r,i])}function av(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}function aw(e){return Math.min(60,Math.floor(e/2))}let ay=null,ak=null,aj=async()=>{try{let e=await fetch("/api/transcribe/token",{method:"POST"});if(!e.ok)return null;let t=await e.json();return"string"==typeof t.token&&t.token?t.token:null}catch{return null}};function aN(){ak||ay&&ay.expiresAt>Date.now()||(ak=aj().then(e=>(ak=null,ay={token:e,expiresAt:Date.now()+(e?45e3:15e3)},e)))}let aS=async()=>{let e=ak;if(e){let t=await e;return t&&(ay=null),t}let t=ay;return t&&t.expiresAt>Date.now()?(t.token&&(ay=null),t.token):(ay=null,aj())};function aC({onError:e,onUnclaimedText:t,onLiveCommit:n}){let{t:r}=(0,er.Ym)(),[i,a]=(0,B.useState)("idle"),[s,l]=(0,B.useState)(0),[o,c]=(0,B.useState)(""),[d,u]=(0,B.useState)(!1),[p,m]=(0,B.useState)(""),f=(0,B.useRef)(0),h=(0,B.useRef)(null),x=(0,B.useRef)(null),g=(0,B.useRef)([]),b=(0,B.useRef)(null),v=(0,B.useRef)(!1),w=(0,B.useRef)(null),y=(0,B.useRef)(null),k=(0,B.useRef)(null),j=(0,B.useRef)(null),N=(0,B.useRef)(!1),S=(0,B.useRef)(!0),C=()=>{null!==w.current&&(clearInterval(w.current),w.current=null)},A=()=>{null!==h.current&&(clearTimeout(h.current),h.current=null)},I=()=>{let e=k.current;k.current=null,e&&(cancelAnimationFrame(e.raf),e.ctx.close().catch(()=>void 0))},M=()=>{let e=b.current;if(b.current=null,e){try{e.processor.disconnect()}catch{}try{e.ws.close()}catch{}e.stream.getTracks().forEach(e=>e.stop()),e.ctx.close().catch(()=>void 0)}},T=e=>{C(),I(),M(),c(""),a("idle");let n=j.current;if(j.current=null,v.current)return void n?.(null);let r=e.partial.trim();n?n(r):r&&t(r)};(0,B.useEffect)(()=>()=>{S.current=!1,C(),I(),A(),v.current=!0,M();let e=x.current;e&&"inactive"!==e.state&&e.stop(),e?.stream.getTracks().forEach(e=>e.stop())},[]);let $=async()=>{C(),I();let n=x.current;x.current=null,n?.stream.getTracks().forEach(e=>e.stop());let i=new Blob(g.current,{type:"audio/webm"});g.current=[];let s=j.current;if(j.current=null,v.current||i.size<2e3){a("idle"),s?.(null);return}a("busy");try{let n=new FormData;n.append("file",i,"dictation.webm");let a=await fetch("/api/transcribe",{method:"POST",body:n}),l=await a.json();if(!a.ok||"string"!=typeof l.text){e(l.error??r("dictation.failed")),s?.(null);return}let o=l.text.trim();o?s?s(o):t(o):(e(r("dictation.silence")),s?.(null))}catch{e(r("common.serverUnavailable")),s?.(null)}finally{a("idle")}},E=async()=>{if(N.current||x.current||b.current)return;N.current=!0,a("starting"),v.current=!1;let t=null,i=!0;try{let[s,o]=await Promise.all([navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),aS()]);if(t=s,!S.current||v.current)return;if(c(""),!(null!==o&&((t,i)=>{let a;try{a=new AudioContext({sampleRate:16e3})}catch{return!1}let s=new URLSearchParams({model_id:"scribe_v2_realtime",token:i,audio_format:"pcm_16000",commit_strategy:"vad",vad_silence_threshold_secs:"1.2"}),l=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?${s.toString()}`),o=a.createScriptProcessor(4096,1,1),d={ws:l,ctx:a,processor:o,stream:t,preOpenQueue:[],partial:""};b.current=d;let u=a.createMediaStreamSource(t);return o.onaudioprocess=e=>{if(b.current!==d)return;let t=function(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n+=1){let r=Math.max(-1,Math.min(1,e[n]??0));t[n]=r<0?32768*r:32767*r}let n=new Uint8Array(t.buffer),r="";for(let e=0;e<n.length;e+=1)r+=String.fromCharCode(n[e]??0);return btoa(r)}(e.inputBuffer.getChannelData(0));l.readyState===WebSocket.OPEN?l.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:t})):l.readyState===WebSocket.CONNECTING&&d.preOpenQueue.push(t)},u.connect(o),o.connect(a.destination),l.addEventListener("open",()=>{if(b.current===d){for(let e of d.preOpenQueue)l.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:e}));d.preOpenQueue=[]}}),l.addEventListener("message",t=>{if(b.current===d)try{let i=JSON.parse(t.data);if("partial_transcript"===i.message_type)d.partial=i.text??"";else if(("committed_transcript"===i.message_type||"committed_transcript_with_timestamps"===i.message_type)&&i.text)d.partial="",n(i.text);else if("auth_error"===i.message_type||"error"===i.message_type||"invalid_request"===i.message_type||"quota_exceeded"===i.message_type){e(i.error||r("dictation.liveError")),T(d);return}c(d.partial)}catch{}}),l.addEventListener("close",()=>{b.current!==d||j.current||(e(r("dictation.connectionLost")),T(d))}),!0})(t,o))){let e=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"",n=e?new MediaRecorder(t,{mimeType:e,audioBitsPerSecond:32e3}):new MediaRecorder(t,{audioBitsPerSecond:32e3});g.current=[],n.ondataavailable=e=>{e.data.size&&g.current.push(e.data)},n.onstop=()=>{$()},n.start(250),x.current=n}i=!1,(e=>{let t;try{t=new AudioContext}catch{return}let n=t.createAnalyser();n.fftSize=128,n.smoothingTimeConstant=.7,t.createMediaStreamSource(e).connect(n);let r=new Uint8Array(n.frequencyBinCount),i=()=>{if(!k.current)return;k.current.raf=requestAnimationFrame(i),n.getByteFrequencyData(r);let e=y.current;e&&function(e,t){let n=window.devicePixelRatio||1;(e.width!==56*n||e.height!==16*n)&&(e.width=56*n,e.height=16*n);let r=e.getContext("2d");if(!r)return;r.setTransform(n,0,0,n,0,0),r.clearRect(0,0,56,16);let i=Math.max(13,Math.floor(.65*t.length))/13,[a,s,l]=function(){let e=[198,40,40];if("u"<typeof document)return e;let t=getComputedStyle(document.documentElement).getPropertyValue("--color-danger").trim(),n=t.startsWith("#")?t.slice(1):"";if(6!==n.length)return e;let r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]}();for(let e=0;e<13;e+=1){let n=Math.floor(e*i),o=Math.max(n+1,Math.floor((e+1)*i)),c=0;for(let e=n;e<o;e+=1)c+=t[e]??0;let d=c/(o-n)/255,u=Math.max(1.5,16*d);r.fillStyle=`rgba(${a}, ${s}, ${l}, ${(.35+.65*d).toFixed(3)})`,r.fillRect(4.3076923076923075*e+1,(16-u)/2,2.3076923076923075,u)}}(e,r)};k.current={ctx:t,raf:requestAnimationFrame(i)}})(t),A(),u(!1),m(""),f.current=0,l(0),a("rec"),w.current=window.setInterval(()=>{var e,t;let n,i,a=f.current,s=a+1;f.current=s,l(s);let o=(e=a,t=s,n=600-aw(600),i=600-Math.min(30,Math.floor(150)),{warn:e<n&&t>=n,ping:e<i&&t>=i,capped:e<600&&t>=600});o.warn&&m(r("dictation.capWarn")),o.ping&&tm("dictWarn",0),o.capped&&(A(),u(!0),m(r("dictation.capStopped")),tm("dictStop",0),h.current=window.setTimeout(()=>{h.current=null,S.current&&u(!1)},5e3),x.current?.state==="recording"?x.current.stop():b.current&&T(b.current))},1e3)}catch{S.current&&e(t?r("dictation.unsupported"):r("dictation.noMic"))}finally{var s;i&&(s=t,s?.getTracks().forEach(e=>e.stop())),N.current=!1,S.current&&a(e=>"starting"===e?"idle":e)}};return{phase:i,elapsed:s,maxSeconds:600,remaining:Math.max(0,600-s),capStopped:d,srMessage:p,liveText:o,canvasRef:y,start:E,stop:()=>new Promise(e=>{let t=b.current;if(t){j.current=e,T(t);return}let n=x.current;n&&"recording"===n.state?(j.current=e,n.stop()):e(null)}),discard:()=>{v.current=!0,x.current?.state==="recording"?x.current.stop():b.current&&T(b.current)}}}function aA(e){return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}function aI({initialText:e,persistText:t,submit:n,disabled:r=!1,imageCapability:i=null,holdInputWhileBusy:a=!0}){let[s,l]=(0,B.useState)(e),o=(0,B.useRef)(s),c=e=>{let n="function"==typeof e?e(o.current):e;o.current=n,l(n),t(n)},[d,u]=(0,B.useState)(!1),[p,m]=(0,B.useState)(!1),[f,h]=(0,B.useState)(null),x=(0,B.useRef)(null),g=(0,B.useRef)(c);(0,B.useLayoutEffect)(()=>{g.current=c});let b=(0,B.useRef)(null),v=(0,B.useCallback)(e=>{if(b.current?.(),b.current=null,x.current=e,!e)return;let t=!1,n=()=>{t=!0},r=()=>{t&&g.current(e.value)},i=()=>{t=!1,g.current(e.value)};e.addEventListener("compositionstart",n),e.addEventListener("input",r),e.addEventListener("compositionend",i),b.current=()=>{e.removeEventListener("compositionstart",n),e.removeEventListener("input",r),e.removeEventListener("compositionend",i)}},[]),w=rq(),y=(0,B.useSyncExternalStore)(aA,()=>window.innerHeight,()=>800),k=w?Math.max(160,Math.round(.4*y)):160,j=function(e){let[t,n]=(0,B.useState)([]),r=(0,B.useRef)([]),i=(0,B.useRef)([]),a=(0,B.useRef)(!1),s=e.imageCapability??null;(0,B.useEffect)(()=>(a.current=!1,()=>{for(let e of(a.current=!0,r.current))as(e);r.current=[],i.current=[]}),[]);let l=e=>{a.current||(r.current=e,i.current=ad(e),n(e))},o=(e,t)=>{l(r.current.map(n=>n.id===e?t(n):n))},c=(0,B.useMemo)(()=>ad(t),[t]),d=t=>{let n=ac(t,s);return!n||(e.onError(n),!1)},u=(t,n)=>{new Promise((e,t)=>{let r=new FileReader;r.onload=()=>{let i=String(r.result),a=i.indexOf(",");a<0?t(Error((0,er.Tl)((0,er.JK)(),"img.readFailed"))):e({base64:i.slice(a+1),mime:n.type||"image/png",dataUrl:i})},r.onerror=()=>t(r.error??Error((0,er.Tl)((0,er.JK)(),"img.readFailed"))),r.onabort=()=>t(Error((0,er.Tl)((0,er.JK)(),"img.readAborted"))),r.readAsDataURL(n)}).then(n=>{let i=r.current.find(e=>e.id===t);if(!i)return;let a=[...ad(r.current.filter(e=>e.id!==t)),{id:t,base64:n.base64,mime:n.mime,preview:i.preview||n.dataUrl}];if(ac(a,s)){e.onError(ac(a,s)),o(t,e=>({...e,status:"error",error:(0,er.Tl)((0,er.JK)(),"img.error")}));return}o(t,e=>({...e,status:"ready",base64:n.base64,mime:n.mime,preview:e.preview||n.dataUrl}))},e=>{r.current.some(e=>e.id===t)&&o(t,t=>({...t,status:"error",error:e instanceof Error?e.message:(0,er.Tl)((0,er.JK)(),"img.error")}))})},p=t=>{if(!t.length)return;if(s&&!s.supported)return void e.onError(s.reason??(0,er.Tl)((0,er.JK)(),"composer.structuredImagesUnavailable"));let n=[];for(let r of t){if(null===(0,ar.PG)(r.type)){e.onError((0,er.Tl)((0,er.JK)(),"img.unsupported",{name:r.name||r.type||(0,er.Tl)((0,er.JK)(),"img.unknownFile")}));continue}let t=s?.maxRawBytesPerImage??ar.YP;if(r.size>t){e.onError(s?(0,er.Tl)((0,er.JK)(),"img.structuredTooLarge",{max:ao(t)}):(0,er.Tl)((0,er.JK)(),"img.tooLarge",{name:r.name||(0,er.Tl)((0,er.JK)(),"img.image")}));continue}n.push(r)}if(!n.length)return;let i=r.current.filter(e=>"error"!==e.status).length;if(s){if(i+n.length>s.maxImages)return void e.onError((0,er.Tl)((0,er.JK)(),"img.tooManyStructured",{max:s.maxImages}));if(r.current.reduce((e,t)=>e+(t.base64?.length??al(t.file.size)),0)+n.reduce((e,t)=>e+al(t.size),0)>s.maxEncodedBytesPerRequest)return void e.onError((0,er.Tl)((0,er.JK)(),"img.structuredAggregateTooLarge",{max:ao(s.maxEncodedBytesPerRequest)}))}let a=n.map(e=>{let{preview:t,ownsPreview:n}=function(e){try{let t=URL.createObjectURL;if("function"==typeof t)return{preview:t(e),ownsPreview:!0}}catch{}return{preview:"",ownsPreview:!1}}(e);return{id:aa(),status:"reading",name:e.name||(0,er.Tl)((0,er.JK)(),"img.image"),mime:e.type||"image/png",preview:t,file:e,ownsPreview:n}});for(let i of(l([...r.current,...a]),n.length===t.length&&e.onAdded?.(),a))u(i.id,i.file)},m=()=>{for(let e of r.current)as(e);l([])},f=t.some(e=>"reading"===e.status),h=t.some(e=>"error"===e.status);return{attachments:t,images:c,imagesRef:i,hasReading:f,hasError:h,addFiles:p,handlePaste:e=>{let t=Array.from(e.clipboardData.items).filter(e=>e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>null!==e);t.length&&(e.preventDefault(),p(t))},remove:e=>{let t=r.current.find(t=>t.id===e);t&&as(t),l(r.current.filter(t=>t.id!==e))},retry:e=>{let t=r.current.find(t=>t.id===e);t&&"error"===t.status&&(o(e,e=>({...e,status:"reading",error:void 0})),u(e,t.file))},clearAll:m,settleDelivered:e=>{let t=[...r.current],n=!1;for(let r of e){let e=r.id?t.findIndex(e=>e.id===r.id):t.findIndex(e=>"ready"===e.status&&e.base64===r.base64&&e.mime===r.mime);if(e<0)continue;let[i]=t.splice(e,1);i&&as(i),n=!0}n&&l(t)},clear:m,replace:e=>{if(!d(e))return!1;for(let e of r.current)as(e);return l(e.map(e=>({id:e.id??aa(),status:"ready",name:(0,er.Tl)((0,er.JK)(),"img.image"),mime:e.mime,preview:e.preview,base64:e.base64,file:new File([],(0,er.Tl)((0,er.JK)(),"img.image"),{type:e.mime}),ownsPreview:!1}))),!0},validate:()=>d(i.current)}}({onError:e=>h({kind:"err",text:e}),onAdded:()=>h(null),imageCapability:i}),N=e=>{c(t=>t?t.trimEnd()+" "+e:e),h(null),requestAnimationFrame(()=>{let e=x.current;if(!e)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t),e.scrollTop=e.scrollHeight})},S=aC({onError:e=>h({kind:"err",text:e}),onUnclaimedText:N,onLiveCommit:N}),C=S.liveText?(s?s.trimEnd()+" ":"")+S.liveText:s;ab(x,C,{maxPx:k,pinned:!!S.liveText});let A="rec"===S.phase,I="busy"===S.phase,M=a&&d||p||r,T=j.hasReading||j.hasError,$=!M&&!I&&!T&&(A||!!s.trim()||j.images.length>0);return{text:s,textRef:o,setText:c,setTextState:l,displayText:C,inputRef:x,attachInput:v,status:f,setStatus:h,busy:d,setBusy:u,voiceSending:p,dictation:S,attachments:j,insertSpoken:N,stopAndSend:()=>ag({busy:d,voiceSending:p,setVoiceSending:m,stop:S.stop,currentText:()=>o.current,setText:c,submit:n}),submit:n,dictationRecording:A,dictationBusy:I,fieldsDisabled:M,canSend:$,attachmentsBlocked:T}}let aM={phase:"idle",lines:[],error:null,startedAt:null,micMuted:!1,outputMuted:!1},aT=new Set,a$={store:nO(),connection:"offline",resyncedAt:null,lastEventAt:null,enabled:!1,structuredHostsEnabled:!1},aE=[];function aR(e,t,n=Object.is){let r=nW()&&1?nV():null,i=(0,B.useRef)(e),a=(0,B.useRef)(n),s=(0,B.useRef)(t),l=(0,B.useRef)(null);i.current=e,a.current=n,s.current=t,(0,B.useEffect)(()=>{r&&r.start()},[r]);let o=(0,B.useCallback)(e=>r?r.subscribe(e):()=>{},[r]),c=(0,B.useCallback)(()=>{if(!r)return s.current;let e=i.current(r.getState()),t=l.current;return t?.bus===r&&a.current(t.value,e)?t.value:(l.current={bus:r,value:e},e)},[r]),d=(0,B.useCallback)(()=>s.current,[]);return(0,B.useSyncExternalStore)(o,c,d)}function aP(){let e,t,n,r=(e=nW()&&1?nV():null,(0,B.useEffect)(()=>{e&&e.start()},[e]),t=(0,B.useCallback)(t=>e?e.subscribe(t):()=>{},[e]),n=(0,B.useCallback)(()=>e?e.getState():a$,[e]),(0,B.useSyncExternalStore)(t,n,()=>a$));return{enabled:r.enabled,structuredHostsEnabled:r.structuredHostsEnabled,connection:r.connection,resyncedAt:r.resyncedAt,store:r.store}}function aO(e,t){return e===t||!!e&&!!t&&e.session===t.session&&e.structuredControlsEnabled===t.structuredControlsEnabled&&e.attentions.length===t.attentions.length&&e.attentions.every((e,n)=>e===t.attentions[n])}function aD(e,t,n){var r,i;let a=aF(e.store.sessions,t,n);return a?(r=e.store,i=e.structuredHostsEnabled,{session:a,uiState:n_(a,nq(r,a)),attentions:a.attentionIds.map(e=>r.attentions[e]).filter(e=>!!e&&"open"===e.state).sort((e,t)=>Number(t.unowned)-Number(e.unowned)||e.createdAt.localeCompare(t.createdAt)),receipts:a.recentReceipts,legacy:"tmux-legacy"===a.hostKind,structuredControlsEnabled:i}):null}function aL(e){return aR(t=>aD(t,e,null),null,aO)}function aF(e,t,n){return t&&e[t]?e[t]:n?Object.values(e).find(e=>e.artifactPath===n)??null:null}function a_(e){return aR(t=>t.enabled&&e?t.store.flows[e]??null:null,null)}async function aq(e,t){try{let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok)return{ok:!1,status:n.status,error:r.error};return{ok:!0,operationId:r.operationId,receipt:r.receipt,status:n.status}}catch{return{ok:!1,error:"network"}}}function az(){return nW()?nV().refresh():Promise.resolve(!1)}let aH=new Set,aB=null,aU=!1,aK=!1,aY=!1;async function aW(){if(0!==aH.size){if(aU){aK=!0;return}aU=!0;try{let e=[...aH];for(let t=0;t<e.length;t+=64){let n=e.slice(t,t+64),r=n.map((e,t)=>({id:String(t),...null!==e.pid?{pid:e.pid}:{},...e.path?{path:e.path}:{}})),i={},a=!1;try{let e=await fetch("/api/tmux/targets",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({reqs:r})});e.ok?i=(await e.json()).targets??{}:a=!0}catch{a=!0}for(let e=0;e<n.length;e+=1){let t=n[e];aH.has(t)&&(a?t.onTarget({transportError:!0}):Object.prototype.hasOwnProperty.call(i,String(e))&&t.onTarget(i[String(e)]??null))}}}finally{aU=!1,aK&&(aK=!1,aW())}}}let aJ={requested:"switching","waiting-turn":"pending",preparing:"switching","successor-starting":"switching",verifying:"switching",committed:"done","failed-recoverable":"failed","rolled-back":"rolled-back"};function aV(e){return e?aJ[e.phase]??null:null}function aG(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function aX(e,t=0){return"number"==typeof e&&Number.isFinite(e)?e:t}function aQ(e){return"string"==typeof e?e:null}let aZ=new Set(["draining","stopped","complete"]),a0=new Set(["disabled","idle","waiting-fresh","cooldown","draining"]);async function a1(e,t,n){if(!e.startsWith("conversation_")||!Number.isInteger(n)||n<0)return{ok:!1,error:null};try{let r=await fetch(`/api/conversations/${encodeURIComponent(e)}/migration`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:t,expectedRevision:n})});if(r.ok)return{ok:!0,error:null};let i=await r.json().catch(()=>null);return{ok:!1,error:aQ(i?.error)}}catch{return{ok:!1,error:null}}}async function a2(e,t){if(!e.startsWith("conversation_"))return{ok:!1,state:"failed",phase:null,error:null};try{let n=await fetch(`/api/conversations/${encodeURIComponent(e)}/migration`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"reseat",path:t})}),r=await n.json().catch(()=>null),i=aQ(r?.reseat),a=aQ(r?.phase);if(n.ok)return{ok:!0,state:"already-migrating"===i?"already-migrating":"requested",phase:a,error:null};if("already-reseated"===i)return{ok:!0,state:"already-reseated",phase:null,error:null};return{ok:!1,state:"failed",phase:null,error:aQ(r?.error)}}catch{return{ok:!1,state:"failed",phase:null,error:null}}}var a5=n(846);function a3({label:e,side:t="top",align:n="center",children:r}){return(0,F.jsxs)("span",{className:"group/hint relative inline-flex",children:[r,(0,F.jsx)("span",{role:"tooltip",className:`pointer-events-none absolute z-[60] whitespace-nowrap rounded-[7px] bg-primary px-2 py-1 text-[10.5px] font-semibold text-white opacity-0 shadow-1 transition-opacity delay-150 duration-100 group-focus-within/hint:opacity-100 group-hover/hint:opacity-100 ${"right"===n?"right-0":"left"===n?"left-0":"left-1/2 -translate-x-1/2"} ${"top"===t?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:e})]})}function a4({onClose:e}){let{locale:t,t:n}=(0,er.Ym)(),[r,i]=(0,B.useState)(null),[a,s]=(0,B.useState)(null),[l,o]=(0,B.useState)(null),[c,d]=(0,B.useState)(!1),[u,p]=(0,B.useState)(null),m=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=!1;return fetch("/api/transcribe/backend").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.options)&&i(t)}).catch(()=>{e||s((0,er.Tl)(t,"common.serverUnavailable"))}),()=>{e=!0}},[t]),(0,B.useEffect)(()=>{let t=t=>{m.current&&!m.current.contains(t.target)&&e()},n=t=>{"Escape"===t.key&&e()};return window.addEventListener("pointerdown",t),window.addEventListener("keydown",n),()=>{window.removeEventListener("pointerdown",t),window.removeEventListener("keydown",n)}},[e]);let f=async(t,a)=>{if(r&&!r.lockedByEnv&&!u){if(!a){o(t),d(!1);return}p(t),s(null);try{let r=await fetch("/api/transcribe/backend",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({backend:t})}),a=await r.json();if(!r.ok)return void s(a.error??n("mic.saveFailed"));i(a),e()}catch{s(n("common.serverUnavailable"))}finally{p(null)}}},h=l&&r?r.options.find(e=>e.id===l):null;return(0,F.jsx)("div",{ref:m,role:"menu","aria-label":n("mic.menuTitle"),className:"absolute bottom-[calc(100%+6px)] right-0 z-40 w-[300px] rounded-[12px] border border-border bg-card p-1.5 shadow-2",children:h?(0,F.jsxs)("div",{className:"flex flex-col gap-2 p-2",children:[(0,F.jsx)("span",{className:"text-[12px] font-bold text-danger",children:n("mic.keyTitle",{name:n(`stt.${h.id}.name`)})}),(0,F.jsx)("span",{className:"text-[11.5px] leading-snug text-primary",children:n(`stt.${h.id}.fix`)}),(0,F.jsxs)("span",{className:"flex items-center gap-1 rounded-[8px] border border-border bg-canvas px-2 py-1.5",children:[(0,F.jsx)("code",{className:"min-w-0 flex-1 break-all font-mono text-[10.5px] text-primary",children:h.keyPath}),(0,F.jsxs)("button",{type:"button","aria-label":n("mic.copyPath"),title:n("mic.copyPath"),className:"inline-flex shrink-0 items-center gap-1 rounded-[6px] border border-border bg-card px-1.5 py-1 text-[10px] font-semibold text-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{navigator.clipboard.writeText(h.keyPath).then(()=>d(!0))},children:[c?(0,F.jsx)(i9.Jl,{className:"h-3 w-3 text-success","aria-hidden":!0}):(0,F.jsx)(i9.QR,{className:"h-3 w-3","aria-hidden":!0}),c?n("mic.copied"):n("mic.copy")]})]}),(0,F.jsxs)("button",{type:"button",className:"self-start rounded-[8px] px-2 py-1 text-[11px] font-semibold text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o(null),children:["← ",n("mic.back")]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-label font-semibold text-secondary",children:n("mic.menuTitle")}),r?.lockedByEnv?(0,F.jsx)("div",{className:"px-2 pb-1 text-[10.5px] text-danger",children:n("mic.menuLocked")}):null,r||a?null:(0,F.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-[11.5px] text-muted",children:[(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",n("mic.menuLoading")]}),(r?.options??[]).map(e=>{let t=r?.backend===e.id;return(0,F.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":t,disabled:!!r?.lockedByEnv||null!==u,onClick:()=>void f(e.id,e.available),className:`flex w-full items-start gap-2 rounded-[9px] px-2 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${t?"bg-accent/10":"hover:bg-canvas"}`,children:[(0,F.jsx)("span",{className:"mt-[3px] flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:u===e.id?(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 animate-spin text-muted","aria-hidden":!0}):t?(0,F.jsx)(i9.Jl,{className:"h-3.5 w-3.5 text-accent","aria-hidden":!0}):(0,F.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full",style:{backgroundColor:e.available?"var(--color-success)":"var(--color-warning)"}})}),(0,F.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,F.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-primary",children:[n(`stt.${e.id}.name`),e.available?null:(0,F.jsx)("span",{className:"rounded-full bg-warning-soft px-1.5 py-px text-[9.5px] font-bold text-warning",children:n("mic.noKey")})]}),(0,F.jsx)("span",{className:"block text-[10.5px] leading-snug text-muted",children:n(`stt.${e.id}.desc`)})]})]},e.id)}),a?(0,F.jsx)("div",{className:"px-2 py-1 text-[10.5px] font-semibold text-danger",children:a}):null]})})}function a6({phase:e,elapsed:t,maxSeconds:n,remaining:r,capStopped:i,srMessage:a,canvasRef:s,start:l,stop:o,discard:c,onText:d,busy:u=!1,anchored:p=!1}){let{t:m}=(0,er.Ym)(),f=rq(),[h,x]=(0,B.useState)(!1),g=function({phase:e,elapsed:t,maxSeconds:n,capStopped:r}){if(r&&"rec"!==e)return"capStopped";if("rec"===e)return t>=n-aw(n)&&t<n?"recWarn":"recNormal";return"busy"===e?"busy":"starting"===e?"starting":"idle"}({phase:e,elapsed:t,maxSeconds:n,capStopped:i}),b=()=>{u||("idle"===e?l():"rec"===e&&o().then(e=>{e&&d(e)}))},v=(0,F.jsx)("span",{role:"status","aria-live":"polite",className:"sr-only",children:a});if("rec"===e){let e="recWarn"===g;return(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[v,(0,F.jsxs)("button",{type:"button","aria-label":m("mic.stopRecognize"),title:e?m("mic.timeLeft",{time:av(r)}):void 0,onClick:b,className:`flex items-center gap-1.5 rounded-control border px-2 text-label font-bold tabular-nums focus-visible:outline-none focus-visible:ring-2 ${f?"min-h-11":"py-2"} ${e?"border-warning/70 bg-warning-soft text-warning focus-visible:ring-warning/50":"border-danger/50 bg-danger-soft text-danger focus-visible:ring-danger/40"}`,children:[(0,F.jsx)("canvas",{ref:s,width:56,height:16,className:"h-4 w-14","aria-hidden":!0}),e?`−${av(r)}`:av(t)]}),(0,F.jsx)("button",{type:"button","aria-label":m("mic.cancel"),onClick:c,className:`inline-flex items-center justify-center rounded-control border border-border bg-card text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${f?"h-11 w-11":"p-2"}`,children:(0,F.jsx)(i9.X,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}return"capStopped"===g?(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[v,(0,F.jsxs)("span",{className:"flex items-center gap-1.5 rounded-control border border-warning/70 bg-warning-soft px-2 py-2 text-label font-bold text-warning",children:["busy"===e?(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,F.jsx)(i9.M6,{className:"h-3.5 w-3.5",fill:"currentColor","aria-hidden":!0}),m("mic.capStopped")]})]}):(0,F.jsxs)("span",{className:"relative inline-flex shrink-0",children:[v,(0,F.jsx)("button",{type:"button","aria-label":m("busy"===e?"mic.recognizing":"starting"===e?"mic.connecting":"mic.dictate"),title:m("busy"===e?"mic.recognizing":"starting"===e?"mic.connecting":"mic.dictateHint"),disabled:"idle"!==e||u,onClick:b,onPointerEnter:aN,onFocus:aN,onContextMenu:e=>{e.preventDefault(),x(e=>!e)},className:p?`relative inline-flex shrink-0 items-center justify-center rounded-control focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${f?"h-8 w-8 before:absolute before:-inset-1.5 before:content-['']":"p-2"} ${"starting"===e?"bg-accent/10 text-accent":"text-muted hover:bg-sunken hover:text-accent"}`:`inline-flex shrink-0 items-center justify-center rounded-[8px] border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${f?"h-11 w-11":"p-2"} ${"starting"===e?"border-accent/40 bg-accent/10 text-accent":"border-border bg-card text-muted hover:text-accent"}`,children:"busy"===e?(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):"starting"===e?(0,F.jsx)(i9.GO,{className:"h-4 w-4 animate-pulse motion-reduce:animate-none","aria-hidden":!0}):(0,F.jsx)(i9.GO,{className:"h-4 w-4","aria-hidden":!0})}),h?(0,F.jsx)(a4,{onClose:()=>x(!1)}):null]})}let a8=[];function a7({label:e,actions:t,onClose:n}){let r=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let e=e=>{r.current&&!r.current.contains(e.target)&&n()},t=e=>{"Escape"===e.key&&n()};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[n]),(0,F.jsxs)("div",{ref:r,role:"menu","aria-label":e,className:"absolute bottom-[calc(100%+6px)] right-0 z-40 w-[220px] rounded-surface border border-border bg-raised p-1.5 shadow-2",children:[(0,F.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-label font-semibold text-secondary",children:e}),t.map(e=>(0,F.jsxs)("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>{e.onSelect(),n()},className:`flex w-full items-start gap-2 rounded-control px-2 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${"ok"===e.tone?"hover:bg-success/10":"hover:bg-sunken"}`,children:[(0,F.jsx)(i9.jG,{className:`mt-[2px] h-3.5 w-3.5 shrink-0 ${"ok"===e.tone?"text-success":"text-muted"}`,"aria-hidden":!0}),(0,F.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,F.jsx)("span",{className:"block text-ui font-semibold text-primary",children:e.label}),e.description?(0,F.jsx)("span",{className:"block text-caption leading-snug text-muted",children:e.description}):null]})]},e.id))]})}function a9({composer:e,placeholder:t,textareaAriaLabel:n,imageAriaLabel:r,leftSlot:i,sendLabelIdle:a,sendLabelRecording:s,sendTitleRecording:l,sendIdleClassName:o,sendIdleStyle:c,sendMenuLabel:d,sendMenuActions:u=[],showImage:p=!0,onImageFiles:m,imageDisabled:f=!1,imageDisabledReason:h,sendDisabledReason:x,onSendBlockedRecover:g,sendPayloadAvailable:b=!1,receipts:v,history:w=a8,voiceControl:y,voicePanel:k}){let{displayText:j,inputRef:N,attachInput:S,dictation:C,setText:A,attachments:I,voiceSending:M,insertSpoken:T,stopAndSend:$,submit:E,fieldsDisabled:R,canSend:P,dictationRecording:O,busy:D,status:L,dictationBusy:_,attachmentsBlocked:q}=e,{t:z}=(0,er.Ym)(),H=rq(),[U,K]=(0,B.useState)(!1),[Y,W]=(0,B.useState)(!1),[J,V]=(0,B.useState)(-1),G=(0,B.useId)(),X=!!i||p,Q=H?Y&&p:X,Z=u.length>0,ee=f&&I.images.length>0,et=I.hasReading?z("img.blockedReading"):I.hasError?z("img.blockedFailed"):void 0,en=!!x,ei=P||b&&!R&&!_&&!q,ea=en||!ei&&!Z||ee,es=H?"relative h-8 w-8 before:absolute before:-inset-1.5 before:content-['']":"p-2",el=(0,F.jsxs)(F.Fragment,{children:[H&&p&&!O?(0,F.jsx)(a3,{label:z(Y?"composer.optionsHide":"composer.optionsShow"),align:"right",children:(0,F.jsx)("button",{type:"button","data-testid":"composer-options-toggle","aria-expanded":Y,"aria-controls":G,"aria-label":z(Y?"composer.optionsHide":"composer.optionsShow"),onClick:()=>W(e=>!e),className:`inline-flex shrink-0 items-center justify-center rounded-control text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${Y?"bg-sunken text-accent":""} ${es}`,children:(0,F.jsx)(a5.A,{className:"h-4 w-4","aria-hidden":!0})})}):null,y,(0,F.jsx)(a6,{...C,busy:M||en,onText:T,anchored:!0}),(0,F.jsxs)("span",{className:"relative inline-flex shrink-0",onContextMenu:e=>{Z&&!O&&(e.preventDefault(),K(e=>!e))},children:[(0,F.jsx)(a3,{label:en?x:O?l??s:a,align:"right",children:(0,F.jsx)("button",{type:O&&!en?"button":"submit",onClick:O&&!en?()=>void $():e=>{if(en||!ei){e.preventDefault(),e.stopPropagation();return}V(-1)},disabled:ea,"aria-disabled":en||!ei||ee,"aria-label":en?x:O?s:a,style:O?void 0:c,className:`inline-flex shrink-0 items-center justify-center rounded-control border text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 aria-disabled:opacity-40 ${es} ${O?"border-danger bg-danger hover:opacity-90":o}`,children:D||M?(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,F.jsx)(i9.jG,{className:"h-4 w-4","aria-hidden":!0})})}),U&&Z&&d?(0,F.jsx)(a7,{label:d,actions:u,onClose:()=>K(!1)}):null]})]});return(0,F.jsxs)(F.Fragment,{children:[k,H&&!m?(0,F.jsx)(au,{attachments:I.attachments,onRemove:I.remove,onRetry:I.retry,onClearAll:I.clearAll}):null,(0,F.jsxs)("div",{className:`flex rounded-control border border-border bg-sunken focus-within:ring-2 focus-within:ring-accent/40 ${O?"flex-col gap-1.5 p-2.5":"items-end gap-1 py-1 pl-2.5 pr-1"}`,children:[(0,F.jsx)("textarea",{ref:S,value:j,rows:1,readOnly:!!C.liveText,onChange:e=>{V(-1),A(e.target.value)},onFocus:aN,onPaste:e=>{let t=Array.from(e.clipboardData.items).filter(e=>e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>null!==e);if(f&&t.length)return void e.preventDefault();if(m){t.length&&(e.preventDefault(),m(t));return}I.handlePaste(e)},onDragOver:e=>{Array.from(e.dataTransfer.items).some(e=>e.type.startsWith("image/"))&&(e.preventDefault(),e.dataTransfer.dropEffect=f?"none":"copy")},onDrop:e=>{let t=Array.from(e.dataTransfer.files).filter(e=>e.type.startsWith("image/"));t.length&&(e.preventDefault(),e.stopPropagation(),f||(m??I.addFiles)(t))},onKeyDown:e=>{if(("ArrowUp"===e.key||"ArrowDown"===e.key)&&!O&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=function(e,t,n,r){if(!n.length||e<0&&!r)return null;let i="ArrowUp"===t?Math.min(e+1,n.length-1):Math.max(e-1,-1);return i===e?null:{index:i,text:i<0?"":n[i]??""}}(J,e.key,w,0===j.length);if(t){e.preventDefault(),V(t.index),A(t.text),requestAnimationFrame(()=>{let e=N.current;e&&e.setSelectionRange(e.value.length,e.value.length)});return}}if("Enter"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing){if(e.preventDefault(),en||!ei||ee)return;V(-1),"rec"===C.phase?$():E()}},placeholder:t,"aria-label":n,disabled:R,className:`min-w-0 resize-none overflow-y-auto bg-transparent py-1 text-ui leading-[18px] text-primary placeholder:text-muted focus-visible:outline-none disabled:opacity-60 ${O?"w-full":"flex-1 self-center"}`}),O?(0,F.jsx)("div",{className:"flex items-center justify-end gap-1",children:el}):el]}),H&&i?(0,F.jsx)("div",{"data-testid":"composer-runtime-row",className:"flex min-h-11 min-w-0 items-center gap-1.5",children:i}):null,X&&Q?(0,F.jsxs)("div",{id:G,"data-testid":"composer-options-row",className:"flex items-center justify-between gap-1.5",children:[(0,F.jsx)("div",{className:"flex min-w-0 items-center gap-1.5",children:H?null:i}),p?(0,F.jsx)(a3,{label:r,children:(0,F.jsx)(ax,{ariaLabel:r,className:`inline-flex shrink-0 items-center justify-center rounded-control text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${es}`,onFiles:m??I.addFiles,disabled:f,disabledReason:h})}):null]}):null,H||m?null:(0,F.jsx)(au,{attachments:I.attachments,onRemove:I.remove,onRetry:I.retry,onClearAll:I.clearAll}),en?(0,F.jsxs)("span",{"data-testid":"composer-send-blocked",role:"status","aria-live":"polite",className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-caption font-semibold text-warning",children:[(0,F.jsx)("span",{className:"min-w-0",children:x}),g?(0,F.jsx)("button",{type:"button",onClick:g,className:"inline-flex min-h-8 shrink-0 items-center gap-1 rounded-control border border-border bg-card px-2 text-caption font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:z("deadHost.recheck")}):null]}):null,m||en||!et?null:(0,F.jsx)("span",{role:"status","aria-live":"polite",className:"text-caption font-semibold text-warning",children:et}),L?(0,F.jsx)("span",{role:"status","aria-live":"err"===L.kind?"assertive":"polite",className:`truncate text-caption font-semibold ${"ok"===L.kind?"text-success":"info"===L.kind?"text-warning":"text-danger"}`,children:L.text}):null,f&&h?(0,F.jsx)("span",{role:"status",className:"text-caption font-semibold text-muted",children:h}):null,v?(0,F.jsx)("div",{className:"flex flex-wrap gap-1.5",children:v}):null]})}function se(e){switch(e){case"queued":case"delivering":case"applying":case"pending":case"uncertain":return"delivering";case"rejected":case"failed":return"failed";default:return"delivered"}}let st=new Map,sn=new Set,sr=[],si=new Map,sa=[],ss=new Map,sl=[],so=new Map;function sc(e,t){return e.at!==t.at?e.at-t.at:e.id<t.id?-1:+(e.id>t.id)}function sd(e,t){return(e.retiredAt??e.at)-(t.retiredAt??t.at)||sc(e,t)}function su(e){return[...e.filter(e=>!e.retiredEchoId).sort(sc).slice(0,512),...e.filter(e=>!!e.retiredEchoId).sort(sd).slice(-512)].sort(sc)}function sp(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&"string"==typeof e.text&&"number"==typeof e.at}function sm(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&"string"==typeof e.key}function sf(e){if(so.has(e))return so.get(e)??null;try{let t=JSON.parse(sessionStorage.getItem("llvOutboxCurrentLaunch:"+e)??"null"),n=!t||"object"!=typeof t||Array.isArray(t)||"string"!=typeof t.id||"number"!=typeof t.at||void 0!==t.settledAt&&"number"!=typeof t.settledAt||void 0!==t.retiredEchoId&&"string"!=typeof t.retiredEchoId||void 0!==t.retiredAt&&"number"!=typeof t.retiredAt||void 0!==t.terminalReason&&"response-started"!==t.terminalReason&&"delivered-ttl"!==t.terminalReason?null:t;return so.set(e,n),n}catch{return so.set(e,null),null}}function sh(e,t){so.set(e,t);try{if(t)sessionStorage.setItem("llvOutboxCurrentLaunch:"+e,JSON.stringify(t));else sessionStorage.removeItem("llvOutboxCurrentLaunch:"+e)}catch{}}function sx(e,t){if(!e)return t;if(e.id===t.id){let n=t.at>e.at?t:e,r=Math.max(e.settledAt??-1/0,t.settledAt??-1/0),i=[e,t].filter(e=>e.retiredEchoId||e.terminalReason).sort((e,t)=>(e.retiredAt??e.at)-(t.retiredAt??t.at)).at(-1);return{...n,...Number.isFinite(r)?{settledAt:r}:{},...i?{...i.retiredEchoId?{retiredEchoId:i.retiredEchoId}:{},...void 0!==i.retiredAt?{retiredAt:i.retiredAt}:{},...i.terminalReason?{terminalReason:i.terminalReason}:{}}:{}}}return t.at!==e.at?t.at>e.at?t:e:t.id>e.id?t:e}function sg(e,t){sh(e,sx(sf(e),t))}function sb(e,t){let n=sf(e);n&&n.id!==t.id||sg(e,t)}function sv(e,t){return e.terminalReason?e.terminalReason:void 0!==e.settledAt&&t-e.settledAt>=6e5?"delivered-ttl":void 0}function sw(e,t,n=Date.now()){if(!t.launchOwned)return;let r=t.settledAt??("delivered"===t.state?t.at:void 0),i=void 0!==t.responseStartedAt?"response-started":sv({settledAt:r},n),a={id:t.id,at:t.at,...void 0!==r?{settledAt:r}:{}};i?sb(e,{...a,terminalReason:i,retiredAt:"response-started"===i?t.responseStartedAt:(r??t.at)+6e5}):sg(e,a)}function sy(e){let t=si.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem("llvOutboxEchoes:"+e)??"[]"),n=Array.isArray(t)?t.filter(sm).slice(-512):sa;return si.set(e,n),n}catch{return si.set(e,sa),sa}}function sk(e,t){si.set(e,t);try{if(t.length)sessionStorage.setItem("llvOutboxEchoes:"+e,JSON.stringify(t));else sessionStorage.removeItem("llvOutboxEchoes:"+e)}catch{}}function sj(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&"string"==typeof e.key&&"number"==typeof e.at&&(void 0===e.echoBaseline||"number"==typeof e.echoBaseline)&&(void 0===e.echoBaselineIds||Array.isArray(e.echoBaselineIds)&&e.echoBaselineIds.every(e=>"string"==typeof e))&&(void 0===e.retiredEchoId||"string"==typeof e.retiredEchoId)&&(void 0===e.retiredAt||"number"==typeof e.retiredAt)&&(void 0===e.launchOwned||!0===e.launchOwned)}function sN(e){let t=ss.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem("llvOutboxOccurrences:"+e)??"[]"),n=Array.isArray(t)?su(t.filter(sj)):sl;return ss.set(e,n),n}catch{return ss.set(e,sl),sl}}function sS(e,t){let n=su(t);ss.set(e,n);try{if(n.length)sessionStorage.setItem("llvOutboxOccurrences:"+e,JSON.stringify(n));else sessionStorage.removeItem("llvOutboxOccurrences:"+e)}catch{}}function sC(e,t){st.set(e,t);try{if(t.length)sessionStorage.setItem("llvOutbox:"+e,JSON.stringify(t));else sessionStorage.removeItem("llvOutbox:"+e)}catch{}for(let e of sn)e()}function sA(e,t){let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t?.retiredEchoId||e.retiredEchoId)&&n.set(e.id,e)}return su([...n.values()])}function sI(e){if("delivered"!==e.state&&void 0===e.responseStartedAt&&!e.retiredEchoId)return null;let t=sO(e.echoText??e.text);return t?{id:e.id,key:t,at:e.at,...void 0!==e.echoBaseline?{echoBaseline:e.echoBaseline}:{},...e.echoBaselineIds?.length?{echoBaselineIds:e.echoBaselineIds}:{},...e.retiredEchoId?{retiredEchoId:e.retiredEchoId}:{},...void 0!==e.retiredAt?{retiredAt:e.retiredAt}:{},...e.launchOwned?{launchOwned:!0}:{}}:null}function sM(e,t){let n=Math.max(0,t.length-32);if(n>0){for(let r of t.slice(0,n))sw(e,r);let r=t.slice(0,n).map(sI).filter(e=>null!==e);r.length&&sS(e,sA(sN(e),r))}sC(e,t.slice(-32))}function sT(e){let t=st.get(e);if(t)return t;let n=function(e){try{let t=JSON.parse(sessionStorage.getItem("llvOutbox:"+e)??"[]");if(!Array.isArray(t))return sr;return t.filter(sp).slice(-32).map(e=>{let t="number"==typeof e.images?e.images:0;if(e.launchOwned)return{...e,images:t};let n="delivering"===e.state||"queued"===e.state;return n&&t>0?{...e,images:t,state:"failed",needsReattach:!0}:{...e,images:t,state:n?"queued":e.state}})}catch{return sr}}(e);return st.set(e,n),n}function s$(e,t){if(!t.text.trim()&&!t.images)return;let n=sf(e);if(n?.id===t.id){let t=sv(n,Date.now());if(t&&!n.terminalReason&&sb(e,{...n,terminalReason:t,retiredAt:(n.settledAt??n.at)+6e5}),n.retiredEchoId||t)return}let r=sT(e),i=r.find(e=>e.id===t.id);if(i){sw(e,i),i.retiredEchoId&&sb(e,{id:t.id,at:t.at,retiredEchoId:i.retiredEchoId,...void 0!==i.retiredAt?{retiredAt:i.retiredAt}:{}}),t.echoText&&t.echoText!==i.echoText&&(sC(e,r.map(e=>e.id===t.id?{...e,echoText:t.echoText}:e)),sz(e,sy(e)));return}let a=sN(e).find(e=>e.id===t.id&&e.retiredEchoId);if(a?.retiredEchoId)return void sg(e,{id:t.id,at:a.at,retiredEchoId:a.retiredEchoId,retiredAt:a.retiredAt});sg(e,{id:t.id,at:t.at});let s=n?.id===t.id?n.settledAt:void 0;sM(e,[...r,void 0===s?{...t,state:"delivering",launchOwned:!0}:{...t,state:"delivered",settledAt:s,launchOwned:!0}]),sz(e,sy(e))}function sE(e,t,n){let r=sT(e);if(!r.some(e=>e.id===t))return;let i=r.map(e=>e.id===t?{...e,...n}:e),a=i.find(e=>e.id===t);a&&sw(e,a),sC(e,i)}function sR(e,t){let n=sT(e),r=n.filter(e=>e.id!==t);r.length!==n.length&&sC(e,r)}function sP(e,t){if(e===t)return;let n=sf(e);n&&(sh(t,sx(sf(t),n)),sh(e,null));let r=sN(e);r.length&&(sS(t,sA(sN(t),r)),sS(e,sl));let i=sy(e);if(i.length){let n=sy(t),r=new Map(i.map(e=>[e.id,e]));for(let e of n)r.delete(e.id),r.set(e.id,e);sk(t,[...r.values()].slice(-512)),sk(e,sa)}let a=sT(e);if(a.length){let n=new Map(sT(t).map(e=>[e.id,e]));for(let e of a){let t=n.get(e.id);if(!t){n.set(e.id,e);continue}e.retiredEchoId&&!t.retiredEchoId&&n.set(e.id,{...t,retiredEchoId:e.retiredEchoId,retiredAt:e.retiredAt})}sM(t,[...n.values()].sort((e,t)=>e.at-t.at)),sC(e,sr)}sz(t,sy(t))}function sO(e){return e.trim()}let sD=new Map,sL=new Set,sF=new Map;function s_(e){let t=new Map;for(let n of e)t.set(n.key,(t.get(n.key)??0)+1);return t}function sq(e,t){if(!e||e.size!==t.size)return!1;for(let[n,r]of t)if(e.get(n)!==r)return!1;return!0}function sz(e,t){let n=sT(e),r=sN(e);if(!n.length&&!r.length)return;let i=new Set([...r.flatMap(e=>e.retiredEchoId?[e.retiredEchoId]:[]),...n.flatMap(e=>e.retiredEchoId?[e.retiredEchoId]:[])]),a=[...r.map(e=>({type:"tombstone",id:e.id,at:e.at,key:e.key,echoBaseline:e.echoBaseline,echoBaselineIds:e.echoBaselineIds,retiredEchoId:e.retiredEchoId,launchOwned:e.launchOwned})),...n.map(e=>({type:"queue",id:e.id,at:e.at,key:sO(e.echoText??e.text),echoBaseline:e.echoBaseline,echoBaselineIds:e.echoBaselineIds,retiredEchoId:e.retiredEchoId,launchOwned:e.launchOwned}))].sort((e,t)=>e.at-t.at),s=new Map;for(let e of a){if(e.retiredEchoId)continue;let n=new Set(e.echoBaselineIds??[]),r=n.size?0:e.echoBaseline??0,a=t.find(t=>!(t.key!==e.key||n.has(t.id))&&(r>0?(r-=1,!1):!i.has(t.id)));a&&(i.add(a.id),s.set(`${e.type}:${e.id}`,{echoId:a.id,retiredAt:Date.now()}))}let l=!1,o=r.map(e=>{let t=s.get(`tombstone:${e.id}`);return t?(l=!0,{...e,retiredEchoId:t.echoId,retiredAt:t.retiredAt}):e});l&&sS(e,o);let c=new Map;for(let e of o){if(!e.retiredEchoId)continue;let t=c.get(e.key)??[];t.push({at:e.at,echoId:e.retiredEchoId}),c.set(e.key,t)}let d=!1,u=n.map(e=>{let t=s.get(`queue:${e.id}`);if(t)return d=!0,{...e,retiredEchoId:t.echoId,retiredAt:t.retiredAt};if(e.retiredEchoId)return e;let n=sO(e.echoText??e.text),r=new Set(e.echoBaselineIds??[]);for(let t of c.get(n)??[])t.at<=e.at&&r.add(t.echoId);return r.size===(e.echoBaselineIds?.length??0)?e:(d=!0,{...e,echoBaseline:Math.max(e.echoBaseline??0,r.size),echoBaselineIds:[...r]})});for(let t of o)t.launchOwned&&t.retiredEchoId&&sb(e,{id:t.id,at:t.at,retiredEchoId:t.retiredEchoId,retiredAt:t.retiredAt});for(let t of u)t.launchOwned&&t.retiredEchoId&&sb(e,{id:t.id,at:t.at,retiredEchoId:t.retiredEchoId,retiredAt:t.retiredAt});d&&sC(e,u)}function sH(e){return sn.add(e),()=>{sn.delete(e)}}function sB(e){return(0,B.useSyncExternalStore)(sH,()=>sT(e),()=>sr)}function sU({entries:e,ready:t,onDispatch:n}){let r=t?e.some(e=>"delivering"===e.state&&!e.launchOwned)?null:e.find(e=>"queued"===e.state)??null:null,i=r?.id??null,a=(0,B.useRef)({next:r,onDispatch:n});return(0,B.useLayoutEffect)(()=>{a.current={next:r,onDispatch:n}}),(0,B.useEffect)(()=>{let e=a.current.next;e&&a.current.onDispatch(e)},[i]),null}class sK extends Error{constructor(){super("composer admission timed out"),this.name="ComposerAdmissionTimeoutError"}}async function sY({read:e,refresh:t,late:n,timeoutMs:r=3e4,pollIntervalMs:i=1e3,signal:a}){let s=Date.now()+r,l=new Promise(()=>{}),o=n?n.then(e=>e??l,()=>l):l;for(;!a?.aborted;){let n=e();if(null!==n)return n;let r=s-Date.now();if(r<=0)break;let l=await Promise.race([(function(e,t,n){return n?.aborted||t<=0?Promise.resolve():new Promise(r=>{let i=setTimeout(a,t);function a(){clearTimeout(i),n?.removeEventListener("abort",a),r()}n?.addEventListener("abort",a,{once:!0}),e().then(a,a)})})(t,r,a).then(e),o]);if(null!==l)return l;let c=await Promise.race([(function(e,t){return t?.aborted||e<=0?Promise.resolve():new Promise(n=>{let r=setTimeout(i,e);function i(){clearTimeout(r),t?.removeEventListener("abort",i),n()}t?.addEventListener("abort",i,{once:!0})})})(Math.min(i,Math.max(0,s-Date.now())),a).then(e),o]);if(null!==c)return c}return null}var sW=n(7532);let sJ="gpt-5.6-sol",sV="gpt-5.6-terra",sG=new Set([sJ,sV,"gpt-5.6-luna","gpt-5.5","gpt-5.4","gpt-5.4-mini"]);function sX(e){return!e?.trim()||sG.has(e.trim())}let sQ={claude:[{id:"opus",label:"Opus 5",shortLabel:"Opus 5",use:"review"},{id:"fable",label:"Fable",shortLabel:"Fable",use:"general"},{id:"sonnet",label:"Sonnet",shortLabel:"Sonnet",use:"implement"},{id:"haiku",label:"Haiku",shortLabel:"Haiku",use:"general"}],codex:[{id:sJ,label:"GPT-5.6-Sol",shortLabel:"5.6-Sol",use:"review"},{id:sV,label:"GPT-5.6-Terra",shortLabel:"5.6-Terra",use:"implement"}]};function sZ(e){return"codex"===e?sJ:"opus"}let s0=["fable","opus","sonnet","haiku"];function s1(e){if("string"!=typeof e)return null;let t=e.trim().toLowerCase();if(!t||t.length>128||/[\u0000-\u001f\u007f]/.test(t))return null;for(let e of s0)if(t===e||RegExp(`(?:^|[-_.])${e}(?:[-_.]|$)`).test(t))return e;return null}let s2=0,s5=new Set;function s3(e,t){let n={id:++s2,kind:e,text:t};for(let e of s5)e(n)}function s4(e,t){let n=(0,er.JK)(),r=e.results.length,i=(0,er.Tl)(n,"tasks.sendOk",{delivered:e.delivered,total:r});if(!e.failed)return{kind:"ok",text:i};let a=new Map(t.map(e=>[e.path,e])),s=e.results.filter(e=>!e.ok).map(e=>{let t=a.get(e.path),r=t?(0,tt.cr)(t.title,40):e.path.split("/").pop()??e.path;return(0,er.Tl)(n,"tasks.sendFailPart",{title:r,error:e.error??""})});return{kind:"err",text:`${i}; ${s.join("; ")}`}}function s6(){let e=rq(),[t,n]=(0,B.useState)([]);return((0,B.useEffect)(()=>{let e=e=>{n(t=>[...t.slice(-3),e]),window.setTimeout(()=>n(t=>t.filter(t=>t.id!==e.id)),6e3)};return s5.add(e),()=>{s5.delete(e)}},[]),t.length)?(0,F.jsx)("div",{className:e?"z-50 flex shrink-0 flex-col gap-1.5 border-t border-border bg-canvas px-3 py-2 pb-[max(0.5rem,env(safe-area-inset-bottom))]":"pointer-events-none absolute inset-x-0 bottom-14 z-50 flex flex-col items-center gap-1.5 px-3",children:t.map(t=>(0,F.jsxs)("div",{className:`pointer-events-auto flex items-start gap-2 overflow-hidden rounded-surface border-l-[3px] bg-raised py-2 pl-3 pr-2 text-ui text-primary shadow-2 ${e?"w-full":"max-w-[560px]"} ${"ok"===t.kind?"border-l-success":"border-l-danger"}`,role:"status",children:[(0,F.jsx)("span",{className:`mt-px shrink-0 font-semibold ${"ok"===t.kind?"text-success":"text-danger"}`,"aria-hidden":!0,children:"ok"===t.kind?"✓":"✕"}),(0,F.jsx)("span",{className:"min-w-0 flex-1 break-words",children:t.text}),(0,F.jsx)("button",{type:"button",className:`shrink-0 rounded text-muted opacity-70 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"-my-1 -mr-1 flex h-11 w-11 items-center justify-center":"mt-0.5 p-0.5"}`,"aria-label":(0,er.Tl)((0,er.JK)(),"viewer.closeNotification"),onClick:()=>n(e=>e.filter(e=>e.id!==t.id)),children:(0,F.jsx)(i9.X,{className:e?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})]},t.id))}):null}function s8(e){return`llvAgentRuntime:${U(e)}`}function s7(e){return s8(e)+":phase"}function s9(e){return s7(e)+":operation"}function le(e){return s7(e)+":rollback"}function lt(e){return s8(e)+":resume"}function ln(e){return s8(e)+":profile"}function lr(e){let t=e.engine,n=sQ[t],r="claude"===e.engine?s1(e.launchModel??e.model)??e.model??null:e.model??null,i=n.some(e=>e.id===r)?r:n[0].id,a=(0,sW.ve)(t,i)??[];return{model:i,effort:a.includes(e.effort??"")?e.effort:a[0],fast:e.fast??!1}}function li(e){return function(e,t){let n=lr(e);try{let r=JSON.parse(localStorage.getItem(t)??"null");if(!r)return null;let i=e.engine,a=sQ[i].some(e=>e.id===r.model)?r.model:n.model,s=(0,sW.ve)(i,a)??[];return{model:a,effort:s.includes(r.effort??"")?r.effort:n.effort,fast:"codex"===i&&"boolean"==typeof r.fast?r.fast:n.fast}}catch{return null}}(e,lt(e))}function la(e){try{var t,n;let r=JSON.parse(localStorage.getItem(ln(e))??"null");if(!r||"object"!=typeof r)return null;let i=e.engine,a={};sQ[i].some(e=>e.id===r.model)&&(a.model=r.model);let s=(0,sW.ve)(i,a.model??(t=e,n=r,sQ[t.engine].some(e=>e.id===n.model)?n.model:lr(t).model))??[];return"string"==typeof r.effort&&s.includes(r.effort)&&(a.effort=r.effort),"codex"===i&&"boolean"==typeof r.fast&&(a.fast=r.fast),Object.keys(a).length?a:null}catch{return null}}function ls(e,t){let n={...la(e)??{},...t},r=e.engine;void 0!==t.model&&void 0!==n.effort&&(n.effort=(0,sW.TS)(r,n.model,n.effort)??n.effort),"codex"!==r&&delete n.fast;try{localStorage.setItem(ln(e),JSON.stringify(n))}catch{}return n}function ll(e){let t=lr(e),n=la(e);if(!n)return t;let r=e.engine,i=n.model??t.model,a=(0,sW.ve)(r,i)??[],s=n.effort&&a.includes(n.effort)?n.effort:(0,sW.TS)(r,i,n.effort??t.effort)??t.effort;return{model:i,effort:s,fast:"codex"===r&&(n.fast??t.fast)}}function lo(e){try{let t=JSON.parse(localStorage.getItem(le(e))??"null"),n=t?.draft;if(!n||"string"!=typeof n.model||"string"!=typeof n.effort||"boolean"!=typeof n.fast)return null;let r=t?.profile;if(null!==r&&("object"!=typeof r||Array.isArray(r)))return null;let i=t?.runtimeRevision;return{operationId:"string"==typeof t?.operationId?t.operationId:null,supersededOperationId:"string"==typeof t?.supersededOperationId?t.supersededOperationId:null,runtimeRevision:Number.isSafeInteger(i)&&i>=0?i:null,draft:n,profile:r??null}}catch{return null}}function lc(e,t){try{localStorage.setItem(le(e),JSON.stringify(t))}catch{}}let ld={minimal:"reasoningTier.minimal",low:"reasoningTier.low",medium:"reasoningTier.medium",high:"reasoningTier.high",xhigh:"reasoningTier.xhigh",max:"reasoningTier.max",ultra:"reasoningTier.ultra"};function lu(e,t){let n=ld[t];return n?e(n):t}function lp(e,t){return sQ[e].find(e=>e.id===t)?.label??t}function lm({file:e,surface:t,runtimeSettings:n,runtimeSession:r}){var i;let{t:a}=(0,er.Ym)(),s=rq(),l="claude"===e.engine||"codex"===e.engine?e.engine:null,o="structured"===t?"structured":"resume"===t?"resume":"live-root"===t?"live-root":null,[c,d]=(0,B.useState)(()=>l?lr(e):{model:"",effort:"",fast:!1}),u=(0,B.useRef)(c),[p,m]=(0,B.useState)("idle"),[f,h]=(0,B.useState)(""),x=(0,B.useRef)(0),g=(0,B.useRef)(null),b=(0,B.useRef)(null),[v,w]=(0,B.useState)(0),[y,k]=(0,B.useState)(!1),[j,N]=(0,B.useState)("root"),[S,C]=(0,B.useState)(""),A=(0,B.useRef)(null),I=U(e);(0,B.useEffect)(()=>{if(!l||"live-root"!==o&&"structured"!==o)return;let t=function(e){let t=lr(e);try{let n=JSON.parse(localStorage.getItem(s8(e))??"null"),r=e.engine,i=sQ[r].some(e=>e.id===n?.model)?n.model:t.model,a=(0,sW.ve)(r,i)??[];return{model:i,effort:a.includes(n?.effort??"")?n.effort:t.effort,fast:"codex"===r&&"boolean"==typeof n?.fast?n.fast:t.fast}}catch{return t}}(e);u.current=t,d(t);let n=localStorage.getItem(s7(e));g.current=localStorage.getItem(s9(e)),b.current=lo(e),m("pending"===n||"confirming"===n?n:"idle"),h("")},[l,e.path,o]);let M=(0,B.useRef)(I),T=r?.conversationId;(0,B.useEffect)(()=>{if(M.current!==I){var e=M.current;if(e&&e!==I)try{for(let t of[":profile",":resume",":phase",":phase:operation",":phase:rollback",""]){let n=localStorage.getItem(`llvAgentRuntime:${e}${t}`);null!==n&&(null===localStorage.getItem(`llvAgentRuntime:${I}${t}`)&&localStorage.setItem(`llvAgentRuntime:${I}${t}`,n),localStorage.removeItem(`llvAgentRuntime:${e}${t}`))}}catch{}M.current=I,w(e=>e+1)}},[I]);let $=(0,B.useCallback)((t=null)=>{let n=b.current??lo(e);t&&n?.operationId!==t||(b.current=null,localStorage.removeItem(le(e)))},[e]),E=(0,B.useCallback)(t=>{u.current=t.draft,d(t.draft);try{localStorage.setItem(s8(e),JSON.stringify(t.draft)),t.profile?localStorage.setItem(ln(e),JSON.stringify(t.profile)):localStorage.removeItem(ln(e))}catch{}$(t.operationId)},[$,e]),R=(0,B.useCallback)(async t=>{let n=x.current;m("saving"),h("");try{let r=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"reconfigure",path:e.path,conversationId:T,...t,fast:"codex"===l?t.fast:void 0})}),i=await r.json();if(n!==x.current)return;if(!r.ok||!i.ok)throw Error(i.error??a("runtimeConfig.failed"));g.current=i.operationId??i.receipt?.operationId??null;let s=b.current;s&&(b.current={...s,operationId:g.current},lc(e,b.current));let c="structured"===o||"pending"===i.outcome?"pending":"confirming";localStorage.setItem(s7(e),c),g.current?localStorage.setItem(s9(e),g.current):localStorage.removeItem(s9(e)),m(c)}catch(t){if(n!==x.current)return;let e=b.current;e&&E(e),h(t instanceof Error?t.message:a("runtimeConfig.failed")),m("error")}},[l,e,o,E,T,a]);(0,B.useEffect)(()=>{if("live-root"!==o||"pending"!==p)return;let e=window.setInterval(()=>void R(c),1500);return()=>window.clearInterval(e)},[o,p,R,c]),(0,B.useEffect)(()=>{if("structured"!==o)return;let t=r?.pendingReconfigure;if(t){let n=b.current,i=r.revision,a=null!==n&&(null===n.runtimeRevision||i>n.runtimeRevision);if(!(null===n||n.supersededOperationId!==t.operationId&&(n.operationId===t.operationId||a)))return;g.current=t.operationId,n&&(b.current={...n,operationId:t.operationId,runtimeRevision:Math.max(n.runtimeRevision??i,i)},lc(e,b.current)),localStorage.setItem(s7(e),"pending"),localStorage.setItem(s9(e),t.operationId),m("pending");return}let n=g.current,i=localStorage.getItem(s7(e)),s=!n&&("pending"===i||"confirming"===i),l=r?.recentReceipts.find(e=>"reconfigure"===e.kind&&(n?e.operationId===n:s&&("applied"===e.status||"failed"===e.status||"rejected"===e.status)));if(l){if(localStorage.removeItem(s7(e)),localStorage.removeItem(s9(e)),"applied"===l.status)$(l.operationId),g.current=null,m("applied"),n&&s3("ok",a("runtimeConfig.applied"));else if("failed"===l.status||"rejected"===l.status){let t=b.current??lo(e);t?.operationId===l.operationId&&E(t),g.current=null,m("error"),h(l.reason??a("runtimeConfig.failed")),n&&s3("err",l.reason??a("runtimeConfig.failed"))}}},[$,e,o,E,r,a]),(0,B.useEffect)(()=>{if("live-root"!==o||"confirming"!==p)return;let t=("claude"===l?s1(e.launchModel??e.model):e.model)===c.model,n=e.effort===c.effort,r="claude"===l||e.fast===c.fast;t&&n&&r&&(localStorage.removeItem(s7(e)),localStorage.removeItem(s9(e)),$(g.current),g.current=null,m("applied"))},[p,$,l,e,c,o]);let P="saving"===p||"pending"===p||"confirming"===p||!!("structured"===o&&r?.pendingReconfigure),O=(0,B.useMemo)(()=>{if(!l)return{model:"",effort:"",fast:!1};if("live-root"===o||"structured"===o)return"error"===p?lr(e):c;if("resume"===o)return li(e)??lr(e);return ll(e)},[l,o,p,c,e,v]),D=(0,B.useMemo)(()=>l?(0,sW.ve)(l,O.model)??[]:[],[l,O.model]),L="codex"===l,_=a("composer.settingsNextResume"),q=(0,B.useCallback)(e=>{C(a("composer.nextMessageUses",{model:l?lp(l,e.model):e.model,effort:lu(a,e.effort)}))},[l,a]),z=(0,B.useCallback)(t=>{if(l){if("live-root"===o||"structured"===o){x.current+=1,g.current=null,localStorage.removeItem(s7(e)),localStorage.removeItem(s9(e));let n=u.current,i=b.current,a=Number.isSafeInteger(r?.revision)?r.revision:null,s=i?.runtimeRevision===null||i?.runtimeRevision===void 0?a:null===a?i.runtimeRevision:Math.max(i.runtimeRevision,a),c={operationId:null,supersededOperationId:i?.operationId??i?.supersededOperationId??null,runtimeRevision:s,draft:i?.draft??n,profile:i?i.profile:la(e)};b.current=c,lc(e,c);let p=t.model?(0,sW.ve)(l,t.model)??[]:(0,sW.ve)(l,n.model)??[],m={...n,...t,effort:t.effort??(p.includes(n.effort)?n.effort:p[0]??n.effort)};u.current=m,d(m);try{localStorage.setItem(s8(e),JSON.stringify(m))}catch{}q(m),"structured"===o&&ls(e,t),R(m);return}"resume"===o?q(function(e,t){let n=e.engine,r={...li(e)??lr(e),...t};void 0!==t.model&&(r.effort=(0,sW.TS)(n,r.model,r.effort)??r.effort),"codex"!==n&&(r.fast=!1);try{localStorage.setItem(lt(e),JSON.stringify(r))}catch{}return r}(e,t)):(ls(e,t),q(ll(e))),w(e=>e+1)}},[l,o,e,q,R,r]),H=(0,B.useCallback)(()=>{k(!1),N("root"),A.current?.focus()},[]),K=e=>{z({effort:e}),s||H()},Y=e=>{z({model:e}),s||H()},W=e=>{z({fast:e}),s||H()};if(!l||!o)return null;let J=(i=O.model,sQ[l].find(e=>e.id===i)?.shortLabel??i),V=lu(a,O.effort),G=`${a("composer.runtimePill")} — ${lp(l,O.model)}, ${V}`;return(0,F.jsxs)("span",{className:"relative inline-flex",onPointerDown:e=>e.stopPropagation(),children:[(0,F.jsxs)("button",{ref:A,type:"button","aria-haspopup":"menu","aria-expanded":y,"aria-busy":P||void 0,"aria-label":G,"data-runtime-pill":!0,onClick:()=>y?H():k(!0),onKeyDown:e=>{y||"ArrowDown"!==e.key&&"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),k(!0))},className:`inline-flex h-7 min-w-0 shrink items-center gap-1 rounded-control px-1.5 text-label font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 motion-reduce:transition-none ${s?"relative min-h-11 before:absolute before:-inset-x-1 before:-inset-y-2 before:content-['']":""} ${"error"===p?"text-danger":"text-secondary hover:bg-sunken hover:text-primary"} ${y?"bg-sunken text-primary":""}`,children:[(0,F.jsx)(i9.Kq,{className:"h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}),(0,F.jsxs)("span",{className:"max-w-[52vw] truncate md:max-w-[16rem]",children:[J," \xb7 ",V]}),P?(0,F.jsx)(i9.kr,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none","aria-hidden":!0}):(0,F.jsx)(i9.yQ,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}),P?(0,F.jsx)("span",{className:"ml-1 self-center text-[10px] font-semibold text-accent","data-runtime-switch-pending":!0,children:a("runtimeConfig.pending")}):null,y&&!s?(0,F.jsx)(lf,{t:a,engine:l,face:O,efforts:D,speedShown:L,panel:j,setPanel:N,effortLocked:!1,modelLocked:!1,speedLocked:!1,lockReason:_,onSelectEffort:K,onSelectModel:Y,onSelectFast:W,onClose:H}):null,y&&s?(0,F.jsx)(lg,{t:a,engine:l,face:O,efforts:D,speedShown:L,effortLocked:!1,modelLocked:!1,speedLocked:!1,lockReason:_,onSelectEffort:K,onSelectModel:Y,onSelectFast:W,onClose:()=>{k(!1),A.current?.focus()}}):null,(0,F.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite","data-runtime-pill-status":!0,children:S}),"error"===p&&f?(0,F.jsx)("span",{className:"sr-only",role:"status","aria-live":"assertive",children:f}):null]})}function lf({t:e,engine:t,face:n,efforts:r,speedShown:i,panel:a,setPanel:s,effortLocked:l,modelLocked:o,speedLocked:c,lockReason:d,onSelectEffort:u,onSelectModel:p,onSelectFast:m,onClose:f}){let h=(0,B.useRef)(null),x=(0,B.useRef)([]),[g,b]=(0,B.useState)(0),v=(0,B.useMemo)(()=>(function({t:e,engine:t,face:n,efforts:r,speedShown:i,panel:a,effortLocked:s,modelLocked:l,speedLocked:o,lockReason:c,onSelectEffort:d,onSelectModel:u,onSelectFast:p,onOpenPanel:m}){let f=t=>({key:"back",kind:"back",label:t,checked:!1,enabled:!0,role:"menuitem",ariaLabel:`${e("composer.backTo")} — ${t}`,activate:()=>m("root")});if("model"===a)return[f(e("composer.modelGroup")),...sQ[t].map(e=>({key:e.id,kind:"model",label:e.label,checked:n.model===e.id,enabled:!l,reason:l?c:void 0,role:"menuitemradio",activate:()=>u(e.id)}))];if("speed"===a)return[f(e("composer.speedGroup")),{key:"standard",kind:"speed",label:e("composer.speedStandard"),checked:!n.fast,enabled:!o,reason:o?c:void 0,role:"menuitemradio",activate:()=>p(!1)},{key:"fast",kind:"speed",label:e("composer.speedFastTier"),checked:n.fast,enabled:!o,reason:o?c:void 0,role:"menuitemradio",activate:()=>p(!0)}];let h=r.map(t=>({key:`tier-${t}`,kind:"tier",label:lu(e,t),checked:n.effort===t,enabled:!s,reason:s?c:void 0,role:"menuitemradio",activate:()=>d(t)})),x=[{key:"model",kind:"submenu",label:e("composer.modelGroup"),detail:sQ[t].find(e=>e.id===n.model)?.shortLabel??n.model,checked:!1,enabled:!0,submenu:"model",role:"menuitem",activate:()=>m("model")}];return i&&x.push({key:"speed",kind:"submenu",label:e("composer.speedGroup"),detail:n.fast?e("composer.speedFastTier"):e("composer.speedStandard"),checked:!1,enabled:!0,submenu:"speed",role:"menuitem",activate:()=>m("speed")}),[...h,...x]})({t:e,engine:t,face:n,efforts:r,speedShown:i,panel:a,effortLocked:l,modelLocked:o,speedLocked:c,lockReason:d,onSelectEffort:u,onSelectModel:p,onSelectFast:m,onOpenPanel:s}),[e,t,n,r,i,a,l,o,c,d,u,p,m,s]),w=(0,B.useMemo)(()=>v.map((e,t)=>e.enabled?t:-1).filter(e=>e>=0),[v]);(0,B.useEffect)(()=>{let e=v.findIndex(e=>e.checked&&e.enabled),t=e>=0?e:w[0]??0;b(t),x.current[t]?.focus()},[a]),(0,B.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&f()};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[f]);let y=e=>{b(e),x.current[e]?.focus()},k=e=>{if(!w.length)return;let t=w.indexOf(g),n=t<0?0:(t+e+w.length)%w.length;y(w[n])};return(0,F.jsx)("div",{ref:h,role:"menu","aria-label":e("composer.runtimePill"),"data-runtime-popover":!0,onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),k(1);break;case"ArrowUp":e.preventDefault(),k(-1);break;case"Home":e.preventDefault(),w.length&&y(w[0]);break;case"End":e.preventDefault(),w.length&&y(w.at(-1));break;case"ArrowRight":{let t=v[g];t?.submenu&&(e.preventDefault(),s(t.submenu));break}case"ArrowLeft":"root"!==a&&(e.preventDefault(),s("root"));break;case"Escape":e.preventDefault(),f();break;case"Enter":case" ":e.preventDefault(),v[g]?.activate();break;case"Tab":f()}},className:"absolute bottom-[calc(100%+6px)] left-0 z-40 w-[240px] rounded-surface border border-border bg-raised p-1.5 shadow-2 motion-reduce:transition-none",children:"root"===a?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(lh,{label:e("composer.reasoningGroup"),children:v.filter(e=>"tier"===e.kind).map(e=>(0,F.jsx)(lx,{row:e,active:v.indexOf(e)===g,refFor:t=>{x.current[v.indexOf(e)]=t}},e.key))}),(0,F.jsx)("div",{className:"mx-2 my-1 border-t border-border/70",role:"separator"}),v.filter(e=>"submenu"===e.kind).map(e=>(0,F.jsx)(lx,{row:e,active:v.indexOf(e)===g,refFor:t=>{x.current[v.indexOf(e)]=t}},e.key))]}):(0,F.jsx)("div",{role:"group","aria-label":"model"===a?e("composer.modelGroup"):e("composer.speedGroup"),children:v.map((e,t)=>(0,F.jsx)(lx,{row:e,active:t===g,refFor:e=>{x.current[t]=e}},e.key))})})}function lh({label:e,children:t}){return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-label font-semibold text-secondary",children:e}),(0,F.jsx)("div",{role:"group","aria-label":e,children:t})]})}function lx({row:e,active:t,refFor:n}){let r=e.reason?`${e.label} — ${e.reason}`:e.label;if("back"===e.kind)return(0,F.jsxs)("button",{ref:n,type:"button",role:"menuitem",tabIndex:t?0:-1,"aria-label":e.ariaLabel,onClick:e.activate,"data-runtime-row":"back",className:"flex w-full items-center gap-1 rounded-control px-2 py-1.5 text-left text-ui font-semibold text-secondary hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)(i9.JG,{className:"h-3.5 w-3.5 shrink-0 text-muted","aria-hidden":!0}),e.label]});let i="submenu"===e.kind;return(0,F.jsxs)("button",{ref:n,type:"button",role:e.role,"aria-checked":"menuitemradio"===e.role?e.checked:void 0,"aria-haspopup":i?"menu":void 0,"aria-disabled":!e.enabled||void 0,disabled:!e.enabled,tabIndex:t?0:-1,"aria-label":e.reason?r:void 0,title:e.reason,onClick:e.activate,"data-runtime-row":e.kind,"data-runtime-value":e.key,className:`flex min-h-[28px] w-full items-center gap-2 rounded-control px-2 py-1 text-left text-ui hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-50 ${e.checked?"text-primary":"text-secondary"}`,children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.detail?(0,F.jsx)("span",{className:"shrink-0 text-caption text-muted",children:e.detail}):null,e.checked?(0,F.jsx)(i9.Jl,{className:"h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}):null,i?(0,F.jsx)(i9.c_,{className:"h-3.5 w-3.5 shrink-0 text-muted","aria-hidden":!0}):null]})}function lg({t:e,engine:t,face:n,efforts:r,speedShown:i,effortLocked:a,modelLocked:s,speedLocked:l,lockReason:o,onSelectEffort:c,onSelectModel:d,onSelectFast:u,onClose:p}){let m=(0,B.useRef)(null);return(0,B.useEffect)(()=>{m.current?.focus();let e=e=>{"Escape"===e.key&&p()};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[p]),(0,F.jsx)("div",{className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/40",role:"presentation",onClick:e=>{e.target===e.currentTarget&&p()},children:(0,F.jsxs)("div",{ref:m,role:"dialog","aria-modal":"true","aria-label":e("composer.runtimePill"),tabIndex:-1,"data-runtime-sheet":!0,className:"max-h-[80vh] w-full max-w-[440px] overflow-y-auto rounded-t-[16px] bg-card p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-2 focus-visible:outline-none",children:[(0,F.jsx)("div",{className:"mx-auto mb-2 h-1 w-10 rounded-full bg-border","aria-hidden":!0}),(0,F.jsx)(lb,{label:e("composer.reasoningGroup"),children:r.map(t=>(0,F.jsx)(lv,{label:lu(e,t),checked:n.effort===t,disabled:a,reason:a?o:void 0,onSelect:()=>c(t)},t))}),(0,F.jsx)(lb,{label:e("composer.modelGroup"),children:sQ[t].map(e=>(0,F.jsx)(lv,{label:e.label,checked:n.model===e.id,disabled:s,reason:s?o:void 0,onSelect:()=>d(e.id)},e.id))}),i?(0,F.jsxs)(lb,{label:e("composer.speedGroup"),children:[(0,F.jsx)(lv,{label:e("composer.speedStandard"),checked:!n.fast,disabled:l,reason:l?o:void 0,onSelect:()=>u(!1)}),(0,F.jsx)(lv,{label:e("composer.speedFastTier"),checked:n.fast,disabled:l,reason:l?o:void 0,onSelect:()=>u(!0)})]}):null]})})}function lb({label:e,children:t}){return(0,F.jsxs)("div",{className:"mb-2",role:"radiogroup","aria-label":e,children:[(0,F.jsx)("div",{className:"mb-1 px-1 text-label font-semibold text-secondary",children:e}),t]})}function lv({label:e,checked:t,disabled:n=!1,reason:r,onSelect:i}){return(0,F.jsxs)("button",{type:"button",role:"radio","aria-checked":t,"aria-disabled":n||void 0,disabled:n,"aria-label":r?`${e} — ${r}`:void 0,title:r,onClick:i,"data-runtime-sheet-row":!0,className:`flex min-h-11 w-full items-center gap-2 rounded-control px-2 text-left text-body hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${t?"text-primary":"text-secondary"}`,children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),t?(0,F.jsx)(i9.Jl,{className:"h-4 w-4 shrink-0 text-accent","aria-hidden":!0}):null]})}function lw(e,t){switch(t.status){case"queued":return"number"==typeof t.queuePosition?e("runtime.receipt.queuedPos",{position:t.queuePosition}):e("runtime.receipt.queued");case"rejected":case"failed":var n,r;let i;return(i=(r=n=t.reason)?nH[r.trim().toLowerCase()]??null:null)?e(i):n?e("receipt.human.verbatim",{reason:n}):e("composer.receiptFailed");default:return e(`runtime.receipt.${t.status}`)}}function ly({receipt:e,actionsDisabled:t=!1,onRetry:n,onEdit:r}){var i;let{t:a}=(0,er.Ym)(),s="rejected"===e.status||"failed"===e.status;return(0,F.jsxs)("span",{className:"inline-flex flex-wrap items-center gap-1.5 text-[11px] font-semibold","data-operation":e.operationId,children:[(0,F.jsx)(an,{tone:"rejected"===(i=e.status)||"failed"===i?"danger":"delivered"===i||"applied"===i||"answered"===i?"success":"uncertain"===i?"warning":"neutral","data-receipt-status":e.status,...s?{role:"status","aria-live":"polite"}:{},children:lw(a,e)}),s&&n?(0,F.jsx)("button",{type:"button",disabled:t,className:"min-h-11 rounded-full border border-border bg-canvas px-3 py-0.5 text-muted hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 sm:min-h-0 sm:px-2",onClick:n,children:a("runtime.receipt.retry")}):null,s&&r?(0,F.jsx)("button",{type:"button",disabled:t,className:"min-h-11 rounded-full border border-border bg-canvas px-3 py-0.5 text-muted hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 sm:min-h-0 sm:px-2",onClick:r,children:a("runtime.receipt.edit")}):null,nz(e.status)||"pending"===e.status?null:(0,F.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted motion-reduce:animate-none","aria-hidden":!0})]})}function lk(e){return"rejected"===e||"failed"===e}function lj(e){return"turn-started"===e||"steered"===e||nz(e)&&!lk(e)}function lN(e){return"send"===e.kind||"steer"===e.kind}let lS=(e,t)=>Date.parse(t.at)-Date.parse(e.at),lC=new Map,lA=new Set,lI=e=>"llvReceiptsDismissed:"+e,lM={state:"enabled"},lT={state:"hidden"},l$=e=>({state:"disabled",reason:e}),lE=e=>({state:"enabled",note:e}),lR=e=>e?.supported?lM:l$("composer.structuredImagesProtocol");function lP(e){if(!e||e.legacy||!e.structuredControlsEnabled)return!1;let t=e.session.hostKind;return"codex-app-server"===t||"claude-broker"===t}function lO(e){return"claude-projects"===e.root?"session"===e.kind:"codex-sessions"===e.root}function lD(e,t,n={}){var r;if("shell"===e.engine)return"shell";if(e.supersededBy)return"superseded";let i=(r=t)&&!r.legacy&&r.structuredControlsEnabled&&("dead"===r.session.host||"unhosted"===r.session.host)?{kind:"dead"}:lP(t)?{kind:"structured"}:t&&t.legacy||t&&!t.structuredControlsEnabled||!n.runtimeEnabled?{kind:"legacy"}:{kind:"unresolved"};return"structured"===i.kind?"structured":"dead"===i.kind?"dead":"claude-projects"===e.root&&"subagent"===e.kind?n.root?.liveness==="live"?n.root.structured?"structured-subagent":"live-subagent":void 0===n.root&&"unresolved"!==i.kind&&"running"===e.proc?"live-subagent":lO(e)?"resume":"inert":"unresolved"===i.kind?"running"===e.proc?"unresolved":lO(e)?"resume":"inert":"running"===e.proc?"subagent"===e.kind||e.parent?"live-subagent":"live-root":lO(e)?"resume":"inert"}let lL=["stop","compact","terminal"];function lF(e){var t;let n=aR(e=>e.enabled,!1),r=aL(U(e)),i="claude-projects"===e.root&&"subagent"===e.kind,a=(t=i?e.parent:null,aR(e=>aD(e,null,t),null,aO)),s={runtimeEnabled:n,...n&&i?{root:function(e){if(!e)return{liveness:"unknown",structured:!1};let t=lP(e),n=e.session.host;return{liveness:"dead"===n||"unhosted"===n?"gated":"hosted"===n?"live":"unknown",structured:t,imageInput:t?e.session.capabilities?.imageInput??null:null}}(a)}:{}},l=function(e,t,n={}){let r=lD(e,t,n);switch(r){case"live-root":return{surface:r,controls:{stop:lM,compact:lM,runtime:lM,kill:lM,terminal:lM,images:lM,send:lM}};case"live-subagent":return{surface:r,controls:{stop:lE("strip.stopSubagent"),compact:l$("strip.compactSubagent"),runtime:lT,kill:lM,terminal:lM,images:lM,send:lM}};case"structured-subagent":return{surface:r,controls:{stop:lE("strip.stopSubagent"),compact:l$("strip.compactSubagent"),runtime:lT,kill:lM,terminal:lM,images:lR(n.root?.imageInput),send:lM}};case"structured":return{surface:r,controls:{stop:lM,compact:l$("strip.structuredUnsupported"),runtime:lM,kill:lM,terminal:lM,images:lR(t?.session.capabilities?.imageInput),send:lM}};case"resume":return{surface:r,controls:{stop:lT,compact:lT,runtime:lM,kill:lT,terminal:lM,images:lM,send:lM}};case"dead":return{surface:r,controls:{stop:lT,compact:lT,runtime:lT,kill:lT,terminal:lM,images:l$("composer.imagesBlockedDuringRecovery"),send:lM}};case"superseded":return{surface:r,controls:{stop:lT,compact:lT,runtime:lT,kill:lT,terminal:lM,images:lT,send:l$("superseded.sendBlocked")}};case"shell":return{surface:r,controls:{stop:lT,compact:lT,runtime:lT,kill:"running"===e.proc?lM:lT,terminal:lT,images:lT,send:lT}};case"unresolved":return{surface:r,controls:{stop:lT,compact:lT,runtime:lT,kill:lT,terminal:lT,images:lT,send:l$("strip.resolving")}};default:return{surface:"inert",controls:{stop:lT,compact:lT,runtime:lT,kill:lT,terminal:lO(e)?lM:lT,images:lT,send:lT}}}}(e,r,s),o=(!r?.structuredControlsEnabled||r.legacy?null:"codex-app-server"===r.session.hostKind||"claude-broker"===r.session.hostKind?r:null)??("structured-subagent"===l.surface?a:null);return{caps:l,runtime:r,structuredSession:o,runtimeEnabled:n,attachMode:function(e,t,n={}){let r=lD(e,t,n);return"live-root"===r||"live-subagent"===r?"live":"resume"}(e,r,s)}}var l_=n(2437),lq=n(8272),lz=n(5688),lH=n(8980),lB=n(4614);function lU({phase:e,start:t,stop:n,t:r}){let i="connecting"===e||"live"===e||"stopping"===e,a=r("connecting"===e?"voice.connecting":"stopping"===e?"voice.stopping":i?"voice.stop":"voice.start");return(0,F.jsx)(a3,{label:a,align:"right",children:(0,F.jsx)("button",{type:"button","data-testid":"voice-call-button","aria-label":a,"aria-pressed":i,onClick:()=>void(i?n():t()),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-control border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"border-danger/60 bg-danger/10 text-danger hover:bg-danger/20":"border-border text-muted hover:bg-sunken hover:text-accent"}`,children:"connecting"===e||"stopping"===e?(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):i?(0,F.jsx)(i9.M6,{className:"h-3.5 w-3.5 fill-current","aria-hidden":!0}):(0,F.jsx)(l_.A,{className:"h-4 w-4","aria-hidden":!0})})})}function lK({startedAt:e,t}){let n,[r,i]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{let e=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(e)},[]),(0,F.jsx)("span",{className:"font-mono tabular-nums text-caption text-secondary","aria-label":t("voice.elapsed"),"data-testid":"voice-elapsed",children:(n=Math.max(0,Math.floor((r-e)/1e3)),`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`)})}let lY=[0,1,2,3];function lW({stream:e,t}){let n=(0,B.useRef)([]);return(0,B.useEffect)(()=>{let t,r=window.AudioContext??window.webkitAudioContext;if(!e||!r||"function"!=typeof requestAnimationFrame)return;try{t=new r}catch{return}let i=t.createAnalyser();i.fftSize=256,i.smoothingTimeConstant=.7,t.createMediaStreamSource(e).connect(i);let a=new Uint8Array(i.frequencyBinCount),s=0,l=()=>{i.getByteFrequencyData(a);let e=0;for(let t of a)e+=t*t;let t=Math.min(1,Math.sqrt(e/a.length)/90);n.current.forEach((e,n)=>{if(!e)return;let r=.25+.12*n,i=3+26*Math.max(0,t-.4*r);e.style.height=`${Math.min(14,i).toFixed(1)}px`,e.style.opacity=t>.5*r?"1":"0.45"}),s=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(s),t.close().catch(()=>void 0)}},[e]),(0,F.jsx)("span",{className:"flex h-4 items-center gap-[2px]",role:"img","aria-label":t("voice.micLevel"),"data-testid":"voice-mic-level",children:lY.map(e=>(0,F.jsx)("span",{ref:t=>{n.current[e]=t},className:"w-[2px] rounded-full bg-success/80 transition-[height] duration-75",style:{height:"3px",opacity:.45}},e))})}function lJ({on:e,onClick:t,label:n,testId:r,OnIcon:i,OffIcon:a}){return(0,F.jsx)("button",{type:"button","data-testid":r,"aria-label":n,"aria-pressed":e,title:n,onClick:t,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-control focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"text-danger hover:bg-danger/10":"text-muted hover:bg-sunken hover:text-secondary"}`,children:(0,F.jsx)(e?i:a,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function lV({phase:e,lines:t,error:n,startedAt:r=null,stream:i=null,micMuted:a=!1,outputMuted:s=!1,onToggleMic:l,onToggleOutput:o,onRetry:c,t:d}){let u,p,{ref:m,onScroll:f}=(u=(0,B.useRef)(null),p=(0,B.useRef)(!0),(0,B.useEffect)(()=>{let e=u.current;e&&p.current&&(e.scrollTop=e.scrollHeight)},[t]),{ref:u,onScroll:()=>{let e=u.current;e&&(p.current=e.scrollHeight-e.scrollTop-e.clientHeight<24)}});if("idle"===e&&0===t.length&&!n)return null;let h="live"===e,x="connecting"===e?d("voice.connecting"):"stopping"===e?d("voice.stopping"):h?d("voice.live"):"error"===e?d("voice.failed"):d("voice.ended");return(0,F.jsxs)("section",{"aria-label":d("voice.panel"),"data-phase":e,className:`overflow-hidden rounded-control border bg-raised/70 ${"error"===e?"border-danger/40":h?"border-success/40":"border-border"}`,children:[(0,F.jsxs)("header",{className:"flex items-center gap-2 border-b border-border/60 px-2 py-1.5",children:[(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${h?"animate-pulse bg-success":"error"===e?"bg-danger":"idle"===e?"bg-muted":"bg-accent"}`,"aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-caption text-muted",role:"status",children:x}),h&&null!==r?(0,F.jsx)(lK,{startedAt:r,t:d}):null,h&&!a?(0,F.jsx)(lW,{stream:i,t:d}):null,h&&l?(0,F.jsx)(lJ,{on:a,onClick:l,testId:"voice-mic-toggle",label:a?d("voice.micUnmute"):d("voice.micMute"),OnIcon:lq.A,OffIcon:lz.A}):null,h&&o?(0,F.jsx)(lJ,{on:s,onClick:o,testId:"voice-output-toggle",label:s?d("voice.outputUnmute"):d("voice.outputMute"),OnIcon:lH.A,OffIcon:lB.A}):null]}),(0,F.jsx)("div",{ref:m,onScroll:f,"aria-live":"polite",className:"max-h-48 space-y-1.5 overflow-y-auto p-2",children:t.map((e,n)=>{let r=t[n-1]?.role!==e.role;return(0,F.jsxs)("div",{className:r&&n>0?"pt-1":void 0,children:[r?(0,F.jsx)("span",{className:`block text-caption uppercase tracking-wide ${"progress"===e.role?"text-accent":"user"===e.role?"text-secondary":"text-success"}`,children:"user"===e.role?d("voice.you"):"progress"===e.role?d("voice.progress"):d("voice.agent")}):null,(0,F.jsxs)("span",{className:`block text-label leading-snug ${"progress"===e.role&&!e.final?"text-muted":"text-primary"}`,children:[e.text,e.final?null:(0,F.jsx)("span",{className:"ml-0.5 inline-block h-3 w-px animate-pulse bg-current align-middle","aria-hidden":!0})]})]},e.id)})}),n?(0,F.jsxs)("div",{role:"alert",className:"flex items-start gap-2 border-t border-danger/30 bg-danger/5 px-2 py-1.5",children:[(0,F.jsx)("p",{className:"min-w-0 flex-1 text-label text-danger",children:n}),c?(0,F.jsxs)("button",{type:"button","data-testid":"voice-retry",onClick:c,className:"inline-flex shrink-0 items-center gap-1 rounded-control border border-danger/40 px-1.5 py-0.5 text-caption text-danger hover:bg-danger/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40",children:[(0,F.jsx)(i9.kt,{className:"h-3 w-3","aria-hidden":!0}),d("voice.retry")]}):null]}):null]})}var lG=n(2359);let lX=new Set,lQ=0;function lZ(e){return lX.add(e),()=>lX.delete(e)}function l0(){return lQ}function l1(){return 0}let l2={width:380,height:560};function l5(){let e=window.documentPictureInPicture;return e&&"function"==typeof e.requestWindow?e:null}function l3(){return null!==l5()}let l4="data-llv-adopted-style";function l6(e){for(let t of Array.from(e.document.head.querySelectorAll(`[${l4}]`)))t.remove();for(let t of Array.from(document.styleSheets))try{let n=Array.from(t.cssRules).map(e=>e.cssText).join("\n"),r=e.document.createElement("style");r.setAttribute(l4,""),r.textContent=n,e.document.head.appendChild(r)}catch{let n=t.href;if(!n)continue;let r=e.document.createElement("link");r.setAttribute(l4,""),r.rel="stylesheet",r.href=n,e.document.head.appendChild(r)}e.document.documentElement.className=document.documentElement.className,e.document.body.className=document.body.className,e.document.documentElement.lang=document.documentElement.lang,e.document.documentElement.dir=document.documentElement.dir}function l8({phase:e,t}){return("connecting"===e||"live"===e)&&l3()?(0,F.jsx)(a3,{label:t("voice.float"),align:"right",children:(0,F.jsx)("button",{type:"button","data-testid":"voice-float-button","aria-label":t("voice.float"),onClick:()=>(function(){for(let e of(lQ+=1,lX))e()})(),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-control border border-border text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(lG.A,{className:"h-4 w-4","aria-hidden":!0})})}):null}let l7=null,l9=0,oe=null;async function ot(e=fetch,t=Date.now){return l9&&t()-l9<3e4?l7:oe||(oe=(async()=>{try{let n=await e("/api/orchestrator");if(!n.ok)return null;let r=await n.json(),i=!0===r.exists&&"string"==typeof r.record?.conversationId?r.record.conversationId:null;return l7=i,l9=t(),i}catch{return null}finally{oe=null}})())}async function on(e,t=fetch,n=Date.now){return!!e.startsWith("conversation_")&&await ot(t,n)===e}let or=new Map,oi=new Map,oa=new Set,os=0;function ol(){for(let e of(os+=1,oa))e()}function oo(e,t,n){return e.set(t,n),ol(),()=>{e.get(t)===n&&(e.delete(t),ol())}}function oc(e){return oa.add(e),()=>oa.delete(e)}function od(){return null}let ou=new Map,op=new Map,om=0;function of(){return om>0}function oh(){return!1}function ox(){return os}function og(){return 0}let ob=new Set(["delivery-auto-retry","interrupt-auto-retry"]),ov=e=>"llvSent:"+e,ow=e=>e.retryOfOperationId??null,oy=new Set;function ok({receipts:e,actionsDisabled:t=!1,dismissed:n=oy,onRetry:r,onEdit:i,onDismiss:a}){let{t:s}=(0,er.Ym)(),l=(0,B.useId)(),[o,c]=(0,B.useState)(!1),d=e=>"send"===e.kind||"steer"===e.kind,u=e=>d(e)&&("failed"===e.status||"rejected"===e.status)&&"string"==typeof e.text&&e.text.length>0&&e.text.length<240,p=function(e,t=new Set){let n=e.filter(e=>lN(e)&&!!e.text).sort(lS),r=[],i=new Map;for(let e of n){let t=`${e.kind}\u0000${e.text}`,n=i.get(t);n?n.push(e):(i.set(t,[e]),r.push(t))}let a=[];for(let e of r){let n=i.get(e);if(lj(n[0].status))continue;let r=n.filter(e=>!lj(e.status)&&!(nz(e.status)&&t.has(e.operationId)));r.length&&a.push({current:r[0],attempts:r})}return a}(e,n),m=p.flatMap(e=>e.attempts),f=e=>{let t=new Map;for(let n of e.slice(1)){let e=lw(s,n);t.set(e,(t.get(e)??0)+1)}return[...t].map(([e,t])=>t>1?`${e} \xd7${t}`:e)},h=function(e,t=new Set){return e.filter(e=>(!lN(e)||!e.text)&&!lj(e.status)&&!(nz(e.status)&&t.has(e.operationId)))}(e,n),x=m.filter(e=>!nz(e.status)),g=m.filter(e=>lk(e.status)),b=x.some(e=>"string"==typeof e.reason&&ob.has(e.reason)),v=s("runtime.receipt.summary",{count:m.length}),w=s(o?"runtime.receipt.hideDetails":"runtime.receipt.showDetails");return(0,F.jsxs)(F.Fragment,{children:[m.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("details",{className:"group w-full min-w-0 rounded-control border border-border bg-sunken/55 text-caption text-secondary","data-runtime-receipt-stack":!0,open:o,onToggle:e=>c(e.currentTarget.open),children:[(0,F.jsxs)("summary",{"aria-describedby":l,"aria-label":`${w}. ${v}`,className:"flex min-h-11 max-h-11 cursor-pointer list-none items-center gap-1 overflow-hidden rounded-control px-1.5 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [&::-webkit-details-marker]:hidden",children:[(0,F.jsx)(i9.c_,{className:"h-3 w-3 shrink-0 text-muted transition-transform duration-150 group-open:rotate-90 motion-reduce:transition-none","aria-hidden":!0}),(0,F.jsx)("span",{className:"shrink-0 font-semibold text-primary",children:v}),(0,F.jsx)("span",{className:"min-w-[3rem] flex-1 truncate text-right text-muted","data-receipt-preview":!0,title:m[0].text??void 0,children:m[0].text}),(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-1","data-receipt-counts":!0,children:[x.length?(0,F.jsxs)(an,{tone:"warning","data-receipt-pending-count":!0,"aria-label":`${s("runtime.receipt.pendingCount",{count:x.length})}${b?` \xb7 ${s("runtime.receipt.busyRetry")}`:""}`,title:b?s("runtime.receipt.busyRetry"):s("runtime.receipt.pendingCount",{count:x.length}),children:[b?(0,F.jsx)(i9.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none","aria-hidden":!0}):null,(0,F.jsxs)("span",{className:"sr-only",children:[s("runtime.receipt.pendingCount",{count:x.length}),b?` \xb7 ${s("runtime.receipt.busyRetry")}`:null]}),(0,F.jsx)("span",{"aria-hidden":!0,"data-receipt-count-value":!0,children:x.length})]}):null,g.length?(0,F.jsxs)(an,{tone:"danger","data-receipt-problem-count":!0,"aria-label":s("runtime.receipt.problemCount",{count:g.length}),title:s("runtime.receipt.problemCount",{count:g.length}),children:[(0,F.jsx)("span",{"aria-hidden":!0,children:"!"}),(0,F.jsx)("span",{className:"sr-only",children:s("runtime.receipt.problemCount",{count:g.length})}),(0,F.jsx)("span",{"aria-hidden":!0,"data-receipt-count-value":!0,children:g.length})]}):null]})]}),(0,F.jsx)("div",{className:"max-h-36 space-y-1 overflow-y-auto border-t border-border/70 p-1.5","data-runtime-receipt-details":!0,children:p.map(e=>{let n=e.current,l=f(e.attempts),o="failed"===n.status,c=!nz(n.status),d=c&&"string"==typeof n.reason&&ob.has(n.reason);return(0,F.jsxs)("div",{className:"flex min-w-0 flex-col items-end gap-0.5 rounded-control bg-card/70 px-2 py-1",...c?{"data-optimistic-message":"true"}:{},children:[(0,F.jsxs)("div",{className:"flex w-full min-w-0 flex-wrap items-start justify-end gap-1.5",children:[(0,F.jsx)("span",{className:"min-w-[8rem] flex-1 whitespace-pre-wrap break-words text-right text-secondary","data-receipt-message":!0,children:n.text}),e.attempts.length>1?(0,F.jsxs)(an,{tone:"neutral","data-receipt-attempt-count":!0,"aria-label":s("runtime.receipt.attemptCount",{count:e.attempts.length}),title:s("runtime.receipt.attemptCount",{count:e.attempts.length}),children:[(0,F.jsxs)("span",{"aria-hidden":!0,children:["\xd7",e.attempts.length]}),(0,F.jsx)("span",{className:"sr-only",children:s("runtime.receipt.attemptCount",{count:e.attempts.length})})]}):null,(0,F.jsx)(ly,{receipt:n,actionsDisabled:t,onRetry:o?()=>r(n):void 0,onEdit:u(n)?()=>i(n):void 0}),a&&lk(n.status)?(0,F.jsx)("button",{type:"button","aria-label":s("runtime.receipt.dismiss"),title:s("runtime.receipt.dismiss"),"data-receipt-dismiss":!0,className:"inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0 sm:px-0.5",onClick:()=>a(e.attempts.filter(e=>nz(e.status)).map(e=>e.operationId)),children:(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0})}):null,"pending"===n.status?(0,F.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-muted motion-reduce:animate-none","aria-hidden":!0}):null,d?(0,F.jsx)("span",{className:"min-w-0 max-w-[52%] truncate text-caption text-muted","data-runtime-receipt-busy":!0,title:s("runtime.receipt.busyRetry"),children:s("runtime.receipt.busyRetry")}):null]}),l.length?(0,F.jsx)("span",{className:"min-w-0 max-w-full truncate text-caption text-muted","data-receipt-history":!0,title:l.join(" \xb7 "),children:l.join(" \xb7 ")}):null]},n.operationId)})})]}),(0,F.jsxs)("span",{id:l,className:"sr-only",role:"status","aria-live":"polite","data-runtime-receipt-status":!0,children:[s("runtime.receipt.statusSummary",{pending:s("runtime.receipt.statusPending",{count:x.length}),problems:s("runtime.receipt.statusProblems",{count:g.length})}),` ${p.map(e=>[lw(s,e.current),...f(e.attempts)].join(" \xb7 ")).join(". ")}.`,b?` ${s("runtime.receipt.busyRetry")}`:null]})]}):null,h.map(e=>{let n="failed"===e.status;return(0,F.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,F.jsx)(ly,{receipt:e,actionsDisabled:t,onRetry:d(e)&&n?()=>r(e):void 0,onEdit:u(e)?()=>i(e):void 0}),a&&lk(e.status)?(0,F.jsx)("button",{type:"button","aria-label":s("runtime.receipt.dismiss"),title:s("runtime.receipt.dismiss"),"data-receipt-dismiss":!0,className:"inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0 sm:px-0.5",onClick:()=>a([e.operationId]),children:(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0})}):null]},e.operationId)})]})}function oj(e,t){let n=t.trim();if(!n)return e;let r=e.trimStart();return r.startsWith(n)?r.slice(n.length).trimStart():e}let oN=e=>"llvPendingSend:"+e,oS=e=>"llvDraftImages:"+e;function oC(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(!n||"object"!=typeof n||Array.isArray(n)||"string"!=typeof n.base64||"string"!=typeof n.mime)return null;t.push({..."string"==typeof n.id?{id:n.id}:{},base64:n.base64,mime:n.mime,preview:`data:${n.mime};base64,${n.base64}`})}return t}function oA(e){try{let t=JSON.parse(sessionStorage.getItem(oN(e))??"[]");if(!Array.isArray(t))return[];return t.filter(e=>!!e&&"string"==typeof e.key&&"string"==typeof e.text).slice(0,8).map(e=>{let t=oC(e.images),n=null!==t&&!1!==e.payloadComplete,r=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return;let t={};return"string"==typeof e.model&&(t.model=e.model),"string"==typeof e.effort&&(t.effort=e.effort),"boolean"==typeof e.fast&&(t.fast=e.fast),Object.keys(t).length?t:void 0}(e.runtime);return{key:e.key,text:e.text,images:t??[],...r?{runtime:r}:{},...!0===e.runtimeCaptured?{runtimeCaptured:!0}:{},...n?{}:{payloadComplete:!1},..."string"==typeof e.operationId?{operationId:e.operationId}:{},...!0===e.reconciling?{reconciling:!0}:{}}})}catch{return[]}}function oI(e){let t={...e};return delete t.reconciling,t}function oM(e){return"composer-unconfirmed:"+e}function oT(e){return"claude-projects"===e.root?"session"===e.kind||"subagent"===e.kind:"codex-sessions"===e.root}let o$=e=>"llvDraft:"+e,oE="llv-compose-draft";function oR(e,t){try{for(let n of[sessionStorage.getItem("llvComposerOwner:"+e),e])if(n&&n!==t)for(let e of[o$,oS,oN,ov,lI]){let r=sessionStorage.getItem(e(n));null!==r&&(null===sessionStorage.getItem(e(t))&&sessionStorage.setItem(e(t),r),sessionStorage.removeItem(e(n)))}if(t===e)sessionStorage.removeItem("llvComposerOwner:"+e);else sessionStorage.setItem("llvComposerOwner:"+e,t)}catch{}}let oP=new Map;function oO({claimKeys:e}){let t=(0,B.useRef)(null),n=[...new Set(e)],r=n.join("\0");return(0,B.useLayoutEffect)(()=>{let e=()=>t.current?.closest("form")?.querySelector("textarea")??null,r=e(),i=n.map(e=>oP.get(e)).find(Boolean);if(r&&i){for(let e of n)oP.delete(e);let e=document.activeElement;if((!e||e===document.body||!e.isConnected)&&oF()-i.at<1e4){r.focus({preventScroll:!0});let e=Math.min(i.end,r.value.length);r.setSelectionRange(Math.min(i.start,e),e),r.scrollTop=i.scrollTop}}return()=>{let t=e();if(!t||document.activeElement!==t)return;let r=oF();for(let[e,t]of oP)r-t.at>=1e4&&oP.delete(e);let i={start:t.selectionStart??t.value.length,end:t.selectionEnd??t.value.length,scrollTop:t.scrollTop,at:r};for(let e of n)oP.set(e,i)}},[r]),(0,F.jsx)("span",{ref:t,hidden:!0,"aria-hidden":!0})}function oD(e,t){let n=o$(e),r=sessionStorage.getItem(n)??"";sessionStorage.setItem(n,r.trim()?r.replace(/\s*$/,"")+"\n\n"+t:t),window.dispatchEvent(new CustomEvent(oE,{detail:{path:e}}))}let oL=e=>new Date(e).toLocaleTimeString("uk"===(0,er.JK)()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"});function oF(){return Date.now()}function o_(e){let t=(0,B.useSyncExternalStore)(oc,of,oh),n=U(e.file);return t&&n.startsWith("conversation_")?(0,F.jsx)(oq,{cardId:n,composerProps:e}):(0,F.jsx)(oz,{...e})}function oq({cardId:e,composerProps:t}){let n=(0,B.useCallback)(t=>{if(t)return oo(ou,e,t)},[e]);return(0,B.useEffect)(()=>{var n;let r;n={file:t.file,pollPaused:t.pollPaused??!1,deadHost:t.deadHost??!1,sendBlockedReason:t.sendBlockedReason??null},(r=op.get(e))&&r.file===n.file&&r.pollPaused===n.pollPaused&&r.deadHost===n.deadHost&&r.sendBlockedReason===n.sendBlockedReason||(op.set(e,n),ol())}),(0,F.jsx)("div",{ref:n,"data-testid":"voice-composer-card-slot",className:"contents"})}function oz({file:e,pollPaused:t=!1,deadHost:n=!1,sendBlockedReason:r=null,dockNode:i}){var a,s,l,o,c,d;let u,p,m,{t:f}=(0,er.Ym)(),h=U(e),{caps:x,structuredSession:g}=lF(e),b=h.startsWith("conversation_")&&g?.session.hostKind==="codex-app-server"&&"hosted"===g.session.host,v=g?.session.liveTurn,w=(a=v?.turnId??"",s=v?.text??"",l=!!(v?.turnId&&g?.session.activeTurnId===v.turnId),o=g?.session.voiceDeliveries??[],u=(0,B.useMemo)(()=>b&&h.startsWith("conversation_")?i8(h):null,[h,b]),p=(0,B.useSyncExternalStore)(u?.subscribe??(()=>()=>void 0),u?.getSnapshot??(()=>aM),()=>aM),(0,B.useEffect)(()=>{u&&a&&s&&u.updateWorkerProgress(a,s,l)},[u,p.phase,s,l,a]),(0,B.useEffect)(()=>{u?.reconcileWorkerDeliveries(o,{authoritative:!0})},[u,p.phase,o]),{...p,micStream:u?.micStream()??null,toggleMic:()=>u?.toggleMic(),toggleOutput:()=>u?.toggleOutput(),realtimeSession:()=>u?.realtimeSession()??null,start:()=>u?.start()??Promise.resolve(),stop:()=>u?.stop()??Promise.resolve()}),y=(0,B.useSyncExternalStore)(oc,()=>{var e;return b&&(e=h)?oi.get(e)??null:null},od),k=(0,B.useCallback)(e=>{if(e)return oo(or,h,e)},[h]),j=g?.session.capabilities?.imageInput,N=x.controls.images,S=!!(g&&"enabled"!==N.state),C=S?f("disabled"===N.state?N.reason:"composer.structuredImagesProtocol"):void 0,A="switching"===aV(e.migration),I=function(e,t,n=!0){let[r,i]=(0,B.useState)(null);return(0,B.useEffect)(()=>{var r;if(n&&(null!==e||t))return r={pid:e,path:t??"",onTarget(e){"object"==typeof e&&null!==e&&"transportError"in e||i(e)}},aH.add(r),null===aB&&(aB=setInterval(()=>void aW(),5e3)),aY||(aY=!0,setTimeout(()=>{aY=!1,aW()},0)),()=>{aH.delete(r),0===aH.size&&null!==aB&&(clearInterval(aB),aB=null)}},[e,t,n]),null!==e||t?r:null}(e.pid,oT(e)?e.path:void 0,!t),M=aI({initialText:()=>(oR(e.path,h),sP(e.path,h),sessionStorage.getItem(o$(h))??""),persistText:e=>{e?sessionStorage.setItem(o$(h),e):sessionStorage.removeItem(o$(h))},submit:e=>eR(e),imageCapability:g?j??null:null,holdInputWhileBusy:!1}),T=function(e,t={}){let n=t.fetchFn,r=t.conversationId?.trim()??"";return(0,B.useCallback)(async()=>{if(!e)return iF;let t=n??fetch;await iH(t,e=>!e.startsWith("voice:"));try{let e=new URLSearchParams({mode:"turn-start"});r&&e.set("conversationId",r);let n=await iL(t,`/api/bridge?${e.toString()}`,{cache:"no-store"},{});if(!n.ok)return iF;let i=(await n.json()).prelude;if(!i?.text)return iF;return{text:i.text,ackToken:i.ackToken,commit:()=>{i_(i.ackToken,t).catch(()=>void 0)}}}catch{return iF}},[r,e,n])}(b,{conversationId:h}),{text:$,textRef:E,setText:R,setTextState:P,inputRef:O,setStatus:D,busy:L,setBusy:_,voiceSending:q,attachments:z}=M,H=(0,B.useRef)(!1),K=rq(),[Y,W]=(0,B.useState)([]),J=sB(h),V=(0,B.useSyncExternalStore)(e=>(sL.add(e),()=>sL.delete(e)),()=>sD.get(h)??sF,()=>sF),G=(0,B.useRef)(new Map),X=(0,B.useRef)(new Set),[Q,Z]=(0,B.useState)([]),[ee,et]=(0,B.useState)(()=>oA(h).some(e=>e.reconciling)),[en,ei]=(0,B.useState)(()=>oA(h).some(e=>!1!==e.payloadComplete)),[ea,es]=(0,B.useState)([]),el=(0,B.useRef)(nU()),eo=(0,B.useRef)([]),ec=(0,B.useRef)(new Set),ed=e=>{let t=iC(e);t&&i_(t).then(()=>iI(e)).catch(()=>{})},eu=(0,B.useRef)(ed);(0,B.useEffect)(()=>{eu.current=ed});let ep=(0,B.useRef)(new Map),em=function(e,t){let n=[...e,...t],r=new Map,i=new Map;for(let e of n){let t=r.get(e.operationId)??new Set;t.add(e.idempotencyKey),r.set(e.operationId,t);let n=i.get(e.idempotencyKey)??new Set;n.add(e.operationId),i.set(e.idempotencyKey,n)}let a=(e,t)=>t.revision-e.revision||Date.parse(t.at)-Date.parse(e.at)||e.operationId.localeCompare(t.operationId)||e.idempotencyKey.localeCompare(t.idempotencyKey),s=[...e.map(e=>({receipt:e,durable:!0})),...t.map(e=>({receipt:e,durable:!1}))].sort((e,t)=>a(e.receipt,t.receipt)),l=new Map;for(let e of s)l.has(e.receipt.operationId)||l.set(e.receipt.operationId,e);let o=new Set,c=[];for(let e of[...l.values()].sort((e,t)=>Number(t.durable)-Number(e.durable)||a(e.receipt,t.receipt)))o.has(e.receipt.idempotencyKey)||(o.add(e.receipt.idempotencyKey),c.push(e.receipt));let d=new Map(c.map(e=>[e.operationId,e])),u=new Set(c.filter(e=>(r.get(e.operationId)?.size??0)>1||(i.get(e.idempotencyKey)?.size??0)>1).map(e=>e.operationId)),p=new Set;for(let e of c){let t=new Set([e.operationId]),n=[],r=ow(e),i=!1;for(;r;){if(t.has(r)){i=!0;break}t.add(r);let e=d.get(r);if(!e)break;n.push(r),r=ow(e)}if(!i){for(let e of n)p.add(e);continue}let a=[e.operationId,...n].map(e=>d.get(e)).filter(e=>!!e).filter(e=>u.has(e.operationId));if(1===a.length&&a[0].operationId===e.operationId)for(let e of n)p.add(e)}return c.filter(e=>!p.has(e.operationId)).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.revision-e.revision||e.operationId.localeCompare(t.operationId)||e.idempotencyKey.localeCompare(t.idempotencyKey))}((c=e.path,aR(e=>{if(!e.enabled||!c&&!h)return aE;let t=aF(e.store.sessions,h,c);return t?.recentReceipts??aE},aE)),Q);(0,B.useEffect)(()=>{for(let e of em)nB(e.status)&&eu.current(e.idempotencyKey)},[em]);let ef=(d=g?.session.liveTurn?.turnId)?[...em].sort(lS).find(e=>lN(e)&&(e.turnId===d||e.operationId===d))??null:null,eh=ef?.idempotencyKey;(0,B.useEffect)(()=>{eh&&function(e,t,n){let r=sT(e),i=r.find(e=>e.id===t);if(!i||void 0!==i.responseStartedAt)return;let a=r.map(e=>e.id===t?{...e,state:"delivered",settledAt:e.settledAt??n,responseStartedAt:n}:e),s=a.find(e=>e.id===t);s&&sw(e,s,n),sC(e,a)}(h,eh,oF())},[h,eh]);let ex=(0,B.useRef)(em);(0,B.useLayoutEffect)(()=>{ex.current=em},[em]);let eg=(0,B.useRef)(new Map),eb=(0,B.useRef)({cardId:h,active:!0});(0,B.useLayoutEffect)(()=>{let e={cardId:h,active:!0};return eb.current=e,()=>{e.active=!1}},[h]);let ev=new Set(ea),ew=e=>{let t;if(!e.length)return;let n=(t=new Set(e),[...ea.filter(e=>!t.has(e)),...e].slice(-64));es(n);try{n.length?sessionStorage.setItem(lI(h),JSON.stringify(n)):sessionStorage.removeItem(lI(h))}catch{}},ey=new Set(J.filter(e=>void 0!==e.responseStartedAt).map(e=>e.id));eh&&ey.add(eh);let ek=function(e,t,n,r,i=lC,a=lA){let s=new Set,l=[];for(let t of e.filter(e=>lN(e)&&!!e.text).sort(lS))s.has(t.idempotencyKey)||(s.add(t.idempotencyKey),l.push(t));let o=new Map(i),c=new Set;for(let e of[...l].reverse()){if(!lj(e.status)||"interrupted"===e.status||n.has(e.operationId))continue;let t=e.text?.trim();t&&function(e,t){let n=e.trim();for(let[e,r]of t){if(r<=0)continue;let i=e.trim();if(i===n||240===n.length&&i.startsWith(n))return t.set(e,r-1),!0}return!1}(t,o)&&c.add(e.operationId)}let d=[];for(let e of l){if(!lj(e.status)||"interrupted"===e.status||n.has(e.operationId)||a.has(e.idempotencyKey)||c.has(e.operationId))continue;let i=Date.parse(e.at);Number.isFinite(i)&&!(t>=i+2e3)&&(r-i>=6e5||d.push(e))}return d}(em,1e3*e.mtime,ev,oF(),V,ey),ej=e=>{eo.current=e,ei(e.some(e=>!1!==e.payloadComplete));try{e.length?sessionStorage.setItem(oN(h),JSON.stringify(e.map(({key:e,text:t,images:n,runtime:r,runtimeCaptured:i,reconciling:a,payloadComplete:s,operationId:l})=>({key:e,text:t,images:n.map(({id:e,base64:t,mime:n})=>({...e?{id:e}:{},base64:t,mime:n})),...r?{runtime:r}:{},...i?{runtimeCaptured:!0}:{},...a?{reconciling:!0}:{},...!1===s?{payloadComplete:!1}:{},...l?{operationId:l}:{}})))):sessionStorage.removeItem(oN(h))}catch{try{sessionStorage.setItem(oN(h),JSON.stringify(e.map(({key:e,text:t,runtime:n,runtimeCaptured:r,reconciling:i,operationId:a})=>({key:e,text:t,...n?{runtime:n}:{},...r?{runtimeCaptured:!0}:{},...i?{reconciling:!0}:{},...a?{operationId:a}:{},payloadComplete:!1}))))}catch{}}},eN=e=>{let t=ec.current;for(t.delete(e),t.add(e);t.size>32;){let e=t.values().next().value;if(void 0===e)break;t.delete(e)}},eS=(e,t)=>{let n=eg.current.get(e);n&&(n.abort(),eg.current.delete(e),D(null),nz(t.status)&&!nB(t.status)&&(ej(eo.current.map(t=>t.key===e?oI(t):t)),el.current===e&&(el.current=nU())),et(eg.current.size>0))},eC=(e,t)=>{if(eg.current.has(e))return;let n=new AbortController;eg.current.set(e,n),et(!0),sY({read:()=>ex.current.find(t=>t.idempotencyKey===e&&(nB(t.status)||nz(t.status)))??null,refresh:az,late:t,timeoutMs:3e4,pollIntervalMs:1e3,signal:n.signal}).then(t=>{if(!n.signal.aborted){if(null===t){let t;return void(eg.current.delete(e),ej(eo.current.map(t=>t.key===e?oI(t):t)),(t=eo.current.find(t=>t.key===e))&&(et(eg.current.size>0||!1===t.payloadComplete),D({kind:"err",text:f("composer.deliveryUnconfirmed")}),X.current.has(e)&&sE(h,e,{state:"failed",settledAt:oF(),error:f("composer.deliveryUnconfirmed")}),Z(n=>{var r;return[(r=t.text,{operationId:oM(e),idempotencyKey:e,conversationId:h,kind:"send",status:"uncertain",text:r,at:new Date().toISOString(),revision:0}),...n.filter(t=>t.idempotencyKey!==e&&t.operationId!==oM(e))].slice(0,8)})))}Z(e=>[t,...e.filter(e=>e.operationId!==t.operationId)].slice(0,8))}})};if((0,B.useEffect)(()=>()=>{for(let e of eg.current.values())e.abort();eg.current.clear()},[]),(0,B.useEffect)(()=>{for(let t of(oR(e.path,h),sP(e.path,h),W(function(e){try{let t=JSON.parse(sessionStorage.getItem(ov(e))??"[]");return Array.isArray(t)?t:[]}catch{return[]}}(h)),Z([]),es(function(e){try{let t=JSON.parse(sessionStorage.getItem(lI(e))??"[]");if(!Array.isArray(t))return[];return t.filter(e=>"string"==typeof e).slice(-64)}catch{return[]}}(h)),eg.current.values()))t.abort();eg.current.clear();let t=oA(h);eo.current=t,ei(t.some(e=>!1!==e.payloadComplete)),ep.current=new Map;let n=sessionStorage.getItem(o$(h))??"",r=t.find(e=>!1!==e.payloadComplete),i=function(e){try{let t=sessionStorage.getItem(oS(e));return null===t?null:oC(JSON.parse(t))}catch{return null}}(h);H.current=!1;let a=i??(r?.text===n?r.images:[]),s=z.replace(a.map(e=>({...e})));queueMicrotask(()=>{H.current=!0}),r&&s&&(el.current=r.key,r.runtimeCaptured&&ep.current.set(r.key,r.runtime));let l=t.filter(e=>e.reconciling).map(e=>e.key),o=t.some(e=>!1===e.payloadComplete);for(let e of(et(l.length>0||o),(l.length||o)&&D({kind:"err",text:f("composer.admissionTimedOut")}),l))eC(e);ec.current=new Set},[h]),(0,B.useEffect)(()=>{H.current&&function(e,t,n){try{if(!t.length&&!n)return void sessionStorage.removeItem(oS(e));sessionStorage.setItem(oS(e),JSON.stringify(t.map(({id:e,base64:t,mime:n})=>({...e?{id:e}:{},base64:t,mime:n}))))}catch{}}(h,z.images,eo.current.length>0)},[z.images,h]),(0,B.useEffect)(()=>{var e;for(let[e]of eg.current){let t=em.find(t=>t.idempotencyKey===e&&(nB(t.status)||nz(t.status)));t&&eS(e,t)}for(let e of eo.current)!eg.current.has(e.key)&&el.current===e.key&&em.find(t=>t.idempotencyKey===e.key&&nz(t.status)&&!nB(t.status))&&(el.current=nU());if(!eo.current.length)return;let t=(e=eo.current,e.map(e=>{let t=em.find(t=>!!e.operationId&&ow(t)===e.operationId)??em.find(t=>t.operationId===e.operationId)??em.find(t=>t.idempotencyKey===e.key);return t&&t.operationId!==e.operationId?{...e,operationId:t.operationId}:e}));t.some((e,t)=>e!==eo.current[t])&&ej(t);let{settled:n,remaining:r}=function(e,t){let n=new Map,r=new Map;for(let e of t){if(!nB(e.status))continue;let t=r.get(e.operationId);t&&("delivered"!==e.status||"delivered"===t.status)||r.set(e.operationId,e);let i=n.get(e.idempotencyKey);i&&("delivered"!==e.status||"delivered"===i.status)||n.set(e.idempotencyKey,e)}let i=[],a=[];for(let t of e){let e=n.get(t.key)??(t.operationId?r.get(t.operationId):void 0);if(!e){a.push(t);continue}let s="delivered"===e.status&&"string"==typeof e.text&&e.text?e.text:t.text;i.push({entry:t,text:s})}return{settled:i,remaining:a}}(eo.current,em),i=r.some(e=>!1===e.payloadComplete&&!em.some(t=>(t.idempotencyKey===e.key||t.operationId===e.operationId)&&nz(t.status)));if(et(eg.current.size>0||i),n.length)for(let e of(ej(r),n)){if(eN(e.entry.key),X.current.has(e.entry.key)){let t=em.find(t=>t.idempotencyKey===e.entry.key&&nB(t.status)),n=t?se(t.status):"delivered";sE(h,e.entry.key,{state:n,settledAt:oF()})}else{let t=oj(E.current,e.text);t!==E.current&&R(t)}z.settleDelivered(e.entry.images),e.entry.key===el.current&&(el.current=nU())}},[em,h]),(0,B.useEffect)(()=>{for(let e of J){if(e.launchOwned||"delivered"===e.state)continue;let t=em.find(t=>t.idempotencyKey===e.id&&(nB(t.status)||nz(t.status)));if(!t)continue;let n=se(t.status);n!==e.state&&("failed"!==e.state||"delivered"===n||"delivering"===n&&nB(t.status))&&sE(h,e.id,{state:n,settledAt:oF()})}},[em,J,h]),(0,B.useEffect)(()=>{let e=e=>{if(e.detail?.path!==h)return;let t=sessionStorage.getItem(o$(h))??"";E.current=t,P(t),requestAnimationFrame(()=>{let e=O.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})};return window.addEventListener(oE,e),()=>window.removeEventListener(oE,e)},[h,O,P,E]),(0,B.useEffect)(()=>{let t=()=>W(t=>{let n=t.filter(t=>"held"===t.state||"queued"===t.state||"recovering"===t.state||"failed"===t.state||("pane"===t.via?1e3*e.mtime<t.at+2e3&&Date.now()-t.at<6e5:Date.now()-t.at<9e4));return n.length!==t.length&&sessionStorage.setItem(ov(h),JSON.stringify(n)),n.length!==t.length?n:t});t();let n=setInterval(t,5e3);return()=>clearInterval(n)},[e.mtime,h]),"hidden"===x.controls.send.state)return null;let eA=oT(e);if(null===I&&!eA)return null;let eI="unresolved"===x.surface,eM=r??(eI?f("strip.resolving"):null),eT=null===I&&!g&&!eI,e$=eT&&"claude-projects"===e.root&&"subagent"===e.kind,eE=e=>{W(e),sessionStorage.setItem(ov(h),JSON.stringify(e))},eR=(e,t)=>{var r;let i,a,s,l,o=t?.preserveDraft??!1,c=e??E.current,d=o?[]:z.imagesRef.current.map(e=>({...e}));if(q||ee||!c.trim()&&!d.length)return;if(n&&!g)return void D({kind:"err",text:f("deadHost.sendBlocked")});if(g&&S&&d.length)return void D({kind:"err",text:C});if(eM)return void D({kind:"err",text:eM});if(g&&d.length&&!z.validate())return;let u=o?nU():el.current;o||(el.current=nU()),G.current.set(u,d),X.current.add(u),r={id:u,text:c,images:d.length,at:oF(),echoBaseline:((i=sD.get(h))||(i=s_(sy(h)),sD.set(h,i)),i.get(sO(c))??0)},a=sO(r.echoText??r.text),s=r.echoBaselineIds??sy(h).filter(e=>e.key===a).map(e=>e.id),l={...r,echoBaseline:r.echoBaseline??s.length,...s.length?{echoBaselineIds:s}:{},state:"queued"},sM(h,[...sT(h).filter(e=>e.id!==r.id),l]),o||(R(""),z.clearAll()),D(null),O.current?.focus()},eP=async(t,r,i)=>{var a,s,l;let o=t??$,c=(i?G.current.get(i)??[]:z.imagesRef.current).map(e=>({...e})),d=(e,t)=>{i&&(sE(h,i,{state:e,settledAt:oF(),...t?{error:t}:{}}),"delivered"===e&&G.current.delete(i))},u=e=>(nB(e.status)&&ed(p),d(se(e.status))),p=(a=el.current,r?.clientMessageId||a),m=eo.current.find(e=>e.key===p),x=m?null:await T(),b=m||!await on(h)?"":(s={path:e.path,project:e.project},function(e,t,n){let r=t.focusedPath&&t.focusedPath!==n.path?t.focusedPath:null,i=t.selectedPaths.filter(e=>e!==n.path&&e!==r);if(!(e.project&&e.project!==n.project)&&!r&&0===i.length)return"";let a=[];if(e.project&&a.push(`project ${e.project}`),r&&a.push(`focused conversation ${r}`),i.length>0){let e=i.slice(0,6),t=i.length-e.length;a.push(`selected ${e.join(", ")}${t>0?` (+${t} more)`:""}`)}return`[viewer context — the operator is looking at: ${a.join("; ")}]`}(rW.getContext(),rW.getSlice(),s)),v=b?`${b}
5
- ${o}`:o,w=m?.text??(x?.text?`${x.text}
6
-
7
- ${v}`:v),y=m?m.images.map(e=>({...e})):c;if(!w.trim()&&!y.length){i&&sR(h,i);return}if(L||q||ee){i&&sE(h,i,{state:"queued"});return}if(n&&!g){D({kind:"err",text:f("deadHost.sendBlocked")}),d("failed",f("deadHost.sendBlocked"));return}if(g&&S&&y.length){D({kind:"err",text:C}),d("failed",C);return}if(eM){D({kind:"err",text:eM}),d("failed",eM);return}if(g&&y.length&&!z.validate())return;_(!0),D(n?{kind:"info",text:f("composer.receiptRecovering")}:null);let k=eT&&!e$,j=!!g||k;if(j&&!ep.current.has(p)){let t;for(ep.current.set(p,m?.runtimeCaptured?m.runtime:g?function(e){let t=la(e);if(!t)return;let n=e.engine,r={};return t.model&&(r.model=t.model),t.effort&&(r.effort=t.effort),"codex"===n&&"boolean"==typeof t.fast&&(r.fast=t.fast),Object.keys(r).length?r:void 0}(e):(t=li(e))?{...t.model?{model:t.model}:{},...t.effort?{effort:t.effort}:{},..."codex"===e.engine?{fast:t.fast}:{}}:{});ep.current.size>32;){let e=ep.current.keys().next().value;if(void 0===e)break;ep.current.delete(e)}}let N=ep.current.get(p),A=!(g&&S&&y.length>0),I=A&&!ec.current.has(p)&&!eo.current.some(e=>e.key===p);I&&ej([{key:p,text:w,images:y,...N?{runtime:N}:{},...j?{runtimeCaptured:!0}:{}},...eo.current].slice(0,8));let M=(e,t)=>{ec.current.has(p)||(eN(p),i||R(oj(E.current,e)),z.settleDelivered(t))},P=t=>{if(ec.current.has(p))return;let n=y.length,a="held"===t.outcome||"queued"===t.outcome||"recovering"===t.outcome,s=oF(),l={id:s,text:w.trim()||(n?f("composer.imagesCount",{count:n}):""),at:s,via:"resumed"===t.outcome||t.spawned?"spawn":"pane",state:a?t.outcome:"sent",clientMessageId:p};eE([...r?Y.filter(e=>e.id!==r.receiptId):Y,l].slice(-8));let o=eo.current.find(e=>e.key===p);ej(eo.current.filter(e=>e.key!==p)),Z(e=>e.filter(e=>e.idempotencyKey!==p&&e.operationId!==oM(p))),el.current===p&&(el.current=nU()),M(w,o?.images??y),d(a?"delivering":"delivered"),D({kind:a?"info":"ok",text:a?f("composer.deliveryHeld",{label:e.migration?.targetLabel??e.migration?.targetAccountId??""}):"resumed"===t.outcome||t.spawned?f("composer.spawned",{target:t.target??""}):t.imagePaths?.length?f("composer.sentPaths",{count:t.imagePaths.length}):f("common.sent")}),i||O.current?.focus()},F=eb.current,H=null;try{H=Promise.resolve(g?A?(l={conversationId:g.session.conversationId,text:w.trim(),images:y.map(e=>({base64:e.base64,mime:e.mime})),idempotencyKey:p,policy:"interrupt-active",...N?{runtime:N}:{}},aq("/api/runtime/send",{conversationId:l.conversationId,text:l.text,images:l.images,idempotencyKey:l.idempotencyKey,policy:l.policy??"interrupt-active",...l.runtime?{runtime:l.runtime}:{}})).then(e=>({ok:e.ok,structured:!0,error:e.error,status:e.status,receipt:e.receipt,outcome:e.receipt?.status==="delivering"||e.receipt?.status==="delivered"?e.receipt.status:"queued"})):{ok:!1,structured:!0,error:C}:fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:e.pid??void 0,path:e.path,text:w,idempotencyKey:p,clientMessageId:p,images:y.map(e=>({base64:e.base64,mime:e.mime})),...k?N??{}:{}})}).then(async e=>{let t=await e.json();return{...t,status:e.status,ok:e.ok&&!0===t.ok}}));let t=await function(e,t=15e3){let n;return Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>r(new sK),t)})]).finally(()=>{void 0!==n&&clearTimeout(n)})}(H,15e3);if(x?.ackToken&&iS(p,x.ackToken),t.ok&&(!t.structured||t.receipt&&nB(t.receipt.status))?ed(p):t.ok||iI(p),!t.ok){if(t.structured&&t.receipt){let e=("send"===t.receipt.kind||"steer"===t.receipt.kind)&&!t.receipt.text&&w.trim()?{...t.receipt,text:w.trim()}:t.receipt;if(Z(t=>[e,...t.filter(t=>t.operationId!==e.operationId)].slice(0,8)),nB(e.status)){let n=eo.current.find(e=>e.key===p);ej(eo.current.filter(e=>e.key!==p));let r="delivered"===e.status&&"string"==typeof t.receipt.text&&t.receipt.text?t.receipt.text:n?.text??w;M(r,n?.images??y),u(e),el.current===p&&(el.current=nU()),"delivered"===e.status&&D({kind:"ok",text:f("common.sent")}),i||O.current?.focus();return}nz(e.status)&&el.current===p&&(el.current=nU())}if(ec.current.has(p))return;!(!nz(t.receipt?.status??"pending")&&(void 0===t.status||t.status>=500))&&I&&ej(eo.current.filter(e=>e.key!==p)),d("failed",t.error??f("common.failedSend")),D({kind:"err",text:t.error??f("common.failedSend")});return}if(t.structured&&t.receipt){Z(e=>[t.receipt,...e.filter(e=>e.operationId!==t.receipt.operationId)].slice(0,8));let e=eo.current.find(e=>e.key===p);ej(eo.current.filter(e=>e.key!==p)),el.current===p&&(el.current=nU()),M(w,e?.images??y),u(t.receipt),i||O.current?.focus();return}P(t)}catch(e){if(!ec.current.has(p)&&(D({kind:"err",text:e instanceof sK?f("composer.admissionTimedOut"):f("common.serverUnavailable")}),e instanceof sK||d("failed",f("common.serverUnavailable")),e instanceof sK)){ej(eo.current.map(e=>e.key===p?{...e,reconciling:!0}:e));let e=H?.then(e=>{let t=e.receipt;if(t&&(nB(t.status)||nz(t.status)))return("send"===t.kind||"steer"===t.kind)&&!t.text&&w.trim()?{...t,text:w.trim()}:t;if(!e.ok||e.structured||!F.active||eb.current!==F)return null;let n=eg.current.get(p);return P(e),n?.abort(),eg.current.delete(p),et(eg.current.size>0),null});eC(p,e)}}finally{_(!1)}},eO=async e=>{if(!L&&!q){_(!0),D(null);try{let t=await fetch(`/api/runtime/operations/${encodeURIComponent(e.operationId)}`,{method:"POST"}),n=await t.json().catch(()=>({}));if(!t.ok||!n.receipt)return void D({kind:"err",text:n.error??f("common.failedSend")});Z(e=>[n.receipt,...e.filter(e=>e.operationId!==n.receipt.operationId)].slice(0,8))}catch{D({kind:"err",text:f("common.serverUnavailable")})}finally{_(!1)}}},eD=e=>{e.preventDefault(),eR()},eL=n&&!g,eF=eL||ee||!!eM,e_=(m=[...J.filter(e=>"queued"===e.state||"delivering"===e.state),...J.filter(e=>"delivered"===e.state||"failed"===e.state)].sort((e,t)=>t.at-e.at).map(e=>e.text).filter(e=>e.trim().length>0)).filter((e,t)=>e!==m[t-1]),eq=L||q||z.images.length>0,ez=g?f("composer.sendStructuredAria"):eI?f("composer.resolvingAria"):eT?f("composer.spawnAria"):f("composer.sendAria",{target:I??""}),eH=(0,F.jsx)(a9,{composer:M,placeholder:eI?f("composer.placeholderResolving"):e$?f("composer.placeholderRelay"):eT?f("composer.placeholderSpawn"):f("composer.placeholderSend"),textareaAriaLabel:f("composer.textAria"),imageAriaLabel:f("composer.addImages"),sendLabelIdle:eT?f("composer.launchAgent"):f("composer.sendToAgent"),sendLabelRecording:f("composer.stopAndSend"),sendTitleRecording:f("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",sendMenuLabel:f("composer.sendMenuTitle"),history:e_,voiceControl:b?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(lU,{phase:w.phase,start:w.start,stop:w.stop,t:f}),(0,F.jsx)(l8,{phase:w.phase,t:f})]}):void 0,voicePanel:b&&!y?(0,F.jsx)("div",{ref:k,"data-testid":"voice-dock-slot",className:"flex flex-col"}):void 0,sendMenuActions:eT&&!e$||eF?[]:[{id:"quick-ack",label:f("composer.quickAckLabel"),description:f("composer.quickAck"),disabled:eq,tone:"ok",onSelect:()=>eR(f("composer.quickAck"),{preserveDraft:!0})}],showImage:!eL,imageDisabled:S,imageDisabledReason:C,sendPayloadAvailable:en,sendDisabledReason:eL?f("deadHost.sendBlocked"):ee?f("composer.admissionTimedOut"):eM??void 0,onSendBlockedRecover:()=>void az(),receipts:em.length?(0,F.jsx)(ok,{receipts:em,actionsDisabled:L||q||eL,dismissed:ev,onRetry:e=>void eO(e),onEdit:e=>{L||q||!e.text||(el.current=nU(),R(e.text),D(null),requestAnimationFrame(()=>{O.current?.focus(),O.current?.setSelectionRange(e.text.length,e.text.length)}))},onDismiss:ew}):void 0,leftSlot:"hidden"!==x.controls.runtime.state?(0,F.jsx)(lm,{file:e,surface:x.surface,runtimeSettings:g?.session.capabilities?.runtimeSettings??null,runtimeSession:g?.session??null}):null}),eB=(0,F.jsxs)("form",{onSubmit:eD,"data-testid":K?"bounded-mobile-composer":void 0,className:`flex shrink-0 flex-col gap-1.5 border-t border-border bg-card px-2.5 ${K?"max-h-[min(38dvh,20rem)] overflow-x-clip overflow-y-auto overscroll-y-contain py-1.5":"py-2"}`,"aria-label":ez,children:[(0,F.jsx)(oO,{claimKeys:[h,e.path]}),(0,F.jsx)(sU,{entries:J,ready:!L&&!q&&!ee,onDispatch:e=>{sE(h,e.id,{state:"delivering"}),X.current.add(e.id),eP(e.text,{clientMessageId:e.id},e.id)}}),A?(0,F.jsxs)("div",{role:"status","aria-live":"polite",className:"flex items-center gap-1.5 rounded-control border border-warning/45 bg-warning-soft px-2 py-1 text-label font-semibold text-warning",children:[(0,F.jsx)(i9.eW,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:f("migrate.heldSend")})]}):null,Y.length||ek.length?(0,F.jsxs)("div",{className:"flex flex-col gap-0.5","aria-label":f("composer.queueAria"),children:[ek.map(e=>(0,F.jsxs)("div",{"data-delivery-echo":!0,className:"flex items-center justify-end gap-1.5",children:[(0,F.jsx)(i9.Jl,{className:"h-3 w-3 shrink-0 text-success","aria-hidden":!0}),(0,F.jsx)("span",{className:"sr-only",children:f("composer.deliveredEcho")}),(0,F.jsx)("span",{className:"min-w-0 max-w-[85%] truncate text-label text-secondary",title:e.text??void 0,children:e.text}),(0,F.jsx)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-caption tabular-nums text-muted",children:oL(Date.parse(e.at))}),(0,F.jsx)("button",{type:"button","aria-label":f("runtime.receipt.dismiss"),className:`inline-flex shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${K?"h-11 w-11":"px-0.5"}`,onClick:()=>ew([e.operationId]),children:(0,F.jsx)(i9.X,{className:K?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})]},e.operationId)),Y.map(e=>{let t=function(e,t){switch(t){case"held":return{label:e("composer.receiptHeld"),tone:"warning"};case"queued":return{label:e("composer.receiptQueued"),tone:"warning"};case"recovering":return{label:e("composer.receiptRecovering"),tone:"warning"};case"failed":return{label:e("composer.receiptFailed"),tone:"danger"};default:return null}}(f,e.state);return(0,F.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[t?(0,F.jsx)(an,{tone:t.tone,role:"status","aria-live":"polite",children:t.label}):null,"failed"===e.state?(0,F.jsx)("button",{type:"button","aria-label":f("composer.retrySend"),title:f("composer.retrySend"),disabled:L||q,className:`inline-flex shrink-0 items-center justify-center rounded text-muted hover:text-accent disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${K?"h-11 w-11":"px-0.5"}`,onClick:()=>{eP(e.text,{receiptId:e.id,clientMessageId:e.clientMessageId})},children:(0,F.jsx)(ae.A,{className:K?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null,(0,F.jsx)("span",{className:"min-w-0 max-w-[85%] truncate text-label text-secondary",title:e.text,children:e.text}),(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-caption tabular-nums text-muted",children:["spawn"===e.via?(0,F.jsx)(i9.jG,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,F.jsx)(i9.Qp,{className:"h-2.5 w-2.5","aria-hidden":!0}),oL(e.at)]}),(0,F.jsx)("button",{type:"button","aria-label":f("composer.removeFromQueue"),className:`inline-flex shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${K?"h-11 w-11":"px-0.5"}`,onClick:()=>eE(Y.filter(t=>t.id!==e.id)),children:(0,F.jsx)(i9.X,{className:K?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})]},e.id)})]}):null,y?(0,t8.createPortal)((0,F.jsx)("form",{onSubmit:eD,"aria-label":ez,className:"flex flex-col gap-1.5",children:eH}),y):eH]});return void 0===i?eB:i?(0,t8.createPortal)(eB,i):(0,F.jsx)("div",{hidden:!0,"data-testid":"voice-composer-parked",children:eB})}function oH(){(0,B.useSyncExternalStore)(oc,ox,og);let e=(0,B.useSyncExternalStore)(iV,iX,iQ);(0,B.useEffect)(()=>(om+=1,ol(),()=>{om-=1,ol()}),[]);let t=new Set([...ou.keys()]);return e&&t.add(e.conversationId),(0,B.useEffect)(()=>{for(let e of[...op.keys()])!t.has(e)&&op.delete(e)&&ol()}),(0,F.jsx)(F.Fragment,{children:[...t].map(e=>{let t=op.get(e)??null;return t?(0,F.jsx)(oz,{file:t.file,pollPaused:t.pollPaused,deadHost:t.deadHost,sendBlockedReason:t.sendBlockedReason,dockNode:ou.get(e)??null},e):null})})}function oB({mobile:e,resolveClient:t=i8}){var n;let{t:r}=(0,er.Ym)(),i=(0,B.useSyncExternalStore)(iV,iG,iZ),{supported:a,pipWindow:s,open:l,close:o}=function(){let[e,t]=(0,B.useState)(null),n=l3(),r=(0,B.useCallback)(async()=>{let n,r=l5();if(r&&!e){try{n=await r.requestWindow({...l2})}catch{return}l6(n),t(n)}},[e]),i=(0,B.useCallback)(()=>{e?.close(),t(null)},[e]);return(0,B.useEffect)(()=>{if(!e)return;let n=()=>t(null);e.addEventListener("pagehide",n);let r=function(e){if("u"<typeof MutationObserver)return()=>void 0;let t=!1,n=()=>{t||(t=!0,setTimeout(()=>{t=!1,e.closed||l6(e)},0))},r=new MutationObserver(n);r.observe(document.head,{childList:!0,subtree:!0,characterData:!0});let i=new MutationObserver(n);i.observe(document.documentElement,{attributes:!0,attributeFilter:["class","lang","dir"]});let a=new MutationObserver(n);return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>{r.disconnect(),i.disconnect(),a.disconnect()}}(e);return()=>{r(),e.removeEventListener("pagehide",n)}},[e]),{supported:n,pipWindow:e,open:r,close:i}}(),c=i?.conversationId??null,d=(0,B.useMemo)(()=>c?t(c):null,[c,t]),u=(0,B.useSyncExternalStore)(d?.subscribe??oU,d?.getSnapshot??oY,oY);!function(e,t=null){let n=(0,B.useRef)(Symbol("realtime-ambient-owner"));(0,B.useEffect)(()=>{let t=n.current;return tZ(t,e),()=>tZ(t,!1)},[e]),(0,B.useEffect)(()=>{let r=n.current;return t2(r,e?t:null),()=>t2(r,null)},[e,t])}(n="live"===u.phase,function(e,t){let[n,r]=(0,B.useState)(e),[i,a]=(0,B.useState)(aT);return n!==e&&(r(e),a(e?new Set(t.map(e=>e.id)):aT)),(0,B.useMemo)(()=>e?function(e){for(let t=e.length-1;t>=0;t-=1){let n=e[t];if(n&&"progress"!==n.role){if(n.final)return null;return"user"===n.role?"operator":"agent"}}return null}(t.filter(e=>!i.has(e.id))):null,[i,t,e])}(n,u.lines));let p=i?.phase??"idle",m="connecting"===p||"live"===p;(0,B.useEffect)(()=>{"idle"===p&&s&&o()},[o,p,s]);let f=(0,B.useSyncExternalStore)(lZ,l0,l1),h=(0,B.useRef)(f);(0,B.useEffect)(()=>{f===h.current||(h.current=f,!e&&a&&m&&!s&&l())},[m,f,e,l,s,a]);let x=(0,B.useSyncExternalStore)(oc,()=>c?or.get(c)??null:null,od),g=(0,B.useCallback)(e=>{if(e&&c)return oo(oi,c,e)},[c]);if(!d||!c)return null;let b=(0,F.jsx)(lV,{phase:u.phase,lines:u.lines,error:u.error,startedAt:u.startedAt,stream:d.micStream(),micMuted:u.micMuted,outputMuted:u.outputMuted,onToggleMic:()=>d.toggleMic(),onToggleOutput:()=>d.toggleOutput(),onRetry:()=>void d.start(),t:r});return s&&!e?(0,t8.createPortal)((0,F.jsxs)("div",{"data-testid":"voice-pip-chrome",className:"flex h-full w-full flex-col gap-2 overflow-y-auto bg-canvas p-2 text-primary",children:[(0,F.jsxs)("header",{className:"flex shrink-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-caption uppercase tracking-wide text-muted",children:r("voice.floatSurface")}),(0,F.jsx)("button",{type:"button","data-testid":"voice-float-dock","aria-label":r("voice.dock"),title:r("voice.dock"),onClick:o,className:"inline-flex min-h-7 min-w-7 items-center justify-center rounded-control border border-border px-1.5 text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(lG.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,F.jsx)("div",{className:"min-h-0 shrink-0",children:b}),(0,F.jsx)("div",{"data-testid":"voice-pip-composer-slot",ref:g,className:"flex shrink-0 flex-col gap-1.5"})]}),s.document.body):x?(0,t8.createPortal)(b,x):null}let oU=()=>()=>void 0,oK={phase:"idle",lines:[],error:null,startedAt:null,micMuted:!1,outputMuted:!1},oY=()=>oK,oW={live:{badge:"success",dot:"bg-success",pulse:!0},reconnecting:{badge:"warning",dot:"bg-warning",pulse:!0},degraded:{badge:"warning",dot:"bg-warning",pulse:!1},offline:{badge:"danger",dot:"bg-danger",pulse:!1}},oJ={live:"runtime.announce.live",reconnecting:"runtime.announce.reconnecting",degraded:"runtime.announce.degraded",offline:"runtime.announce.offline"};function oV({connection:e,resynced:t,legacy:n,compact:r,announce:i,t:a}){let s=oW[e];return(0,F.jsxs)(an,{tone:s.badge,"data-connection":e,className:`backdrop-blur ${r?"":"shadow-1"}`,children:[(0,F.jsx)("span",{className:`h-2 w-2 rounded-full ${s.dot} ${s.pulse?"animate-pulse motion-reduce:animate-none":""}`,"aria-hidden":!0}),(0,F.jsx)("span",{children:a(`runtime.${e}`)}),n?(0,F.jsxs)("span",{className:"font-normal text-muted",children:["\xb7 ",a("runtime.legacyProvenance")]}):null,t?(0,F.jsx)("span",{className:"rounded-full bg-accent-soft px-1.5 text-accent",children:a("runtime.resynced")}):null,(0,F.jsx)("span",{role:"status","aria-live":"polite",className:"sr-only",children:i})]})}function oG({legacy:e,compact:t}){let{t:n}=(0,er.Ym)(),{enabled:r,connection:i,resyncedAt:a}=aP(),s=null!==a,l=function(e,t=600){let[n,r]=(0,B.useState)(e),i=(0,B.useRef)(e);return(0,B.useEffect)(()=>{i.current=e;let n=window.setTimeout(()=>{i.current===e&&r(e)},t);return()=>window.clearTimeout(n)},[e,t]),n}(n(s?"runtime.announce.resynced":oJ[i]));return r?(0,F.jsx)("div",{className:t?"pointer-events-auto absolute right-2 top-1.5 z-30":"pointer-events-auto fixed bottom-3 left-3 z-20",children:(0,F.jsx)(oV,{connection:i,resynced:s,legacy:e,compact:t,announce:l,t:n})}):null}function oX(e,t){if(0===t.length)return[];let n=new Set(t),r=new Map;for(let t of e){let e=U(t);if(!n.has(e))continue;let i=r.get(e);(!i||t.mtime>i.mtime)&&r.set(e,t)}return[...r.entries()].map(([e,t])=>({id:e,file:t,project:ef(t)})).sort((e,t)=>t.file.mtime-e.file.mtime)}var oQ=n(4e3),oZ=n(8744);let o0="llvKeepAwake",o1=(0,B.createContext)(null);function o2({children:e,environment:t}){return(0,F.jsx)(o1.Provider,{value:function(e){let[t,n]=(0,B.useState)({enabled:!1,status:"off"}),r=(0,B.useRef)(null);(0,B.useEffect)(()=>{let t=function(e){let t=new Set,n={enabled:!1,status:"off"},r=null,i=null,a=0,s=-1,l=!1,o=!1,c=null!==e.request&&e.secureContext,d=e=>{let r={...n,...e};if(r.enabled!==n.enabled||r.status!==n.status)for(let e of(n=r,t))e()},u=()=>null===e.request?"unsupported":e.secureContext?n.enabled&&l?"waiting":"off":"insecure",p=()=>{r&&i&&r.removeEventListener("release",i),i=null},m=e=>{a+=1;let t=r;p(),r=null,d({status:e}),t&&Promise.resolve(t.release()).catch(()=>{})},f=t=>{if(t===r){if(p(),r=null,!l||!n.enabled||!e.isVisible())return void d({status:u()});if(!o){o=!0,h();return}d({status:"interrupted"})}};function h(){if(!l||!n.enabled)return;if(!c)return void d({status:u()});if(!e.isVisible())return void d({status:"waiting"});if(r||s===a)return;let t=++a;s=t,d({status:"requesting"}),e.request("screen").then(e=>{(s===t&&(s=-1),t!==a)?Promise.resolve(e.release()).catch(()=>{}):(r=e,i=()=>f(e),e.addEventListener("release",i),!0===e.released)?f(e):d({status:"active"})},e=>{if(s===t&&(s=-1),t===a){let t;d({status:"NotAllowedError"===(t=e?.name)||"SecurityError"===t?"blocked":"failed"})}})}return{getState:()=>n,subscribe:e=>(t.add(e),()=>void t.delete(e)),start(){if(l)return;l=!0;let t=(()=>{try{return e.storage?.getItem(o0)==="1"}catch{return!1}})();d({enabled:t}),d({status:u()}),t&&h()},stop(){l&&(l=!1,m(u()))},setEnabled(t){if(t!==n.enabled){d({enabled:t});try{e.storage?.setItem(o0,t?"1":"0")}catch{}o=!1,t?h():m(u())}},syncVisibility(){if(l){if(e.isVisible()){o=!1,h();return}n.enabled&&m(u())}}}}(e?e():function(){let e=navigator.wakeLock,t=null;try{t=window.localStorage}catch{t=null}return{request:e&&"function"==typeof e.request?t=>e.request(t):null,secureContext:"boolean"!=typeof window.isSecureContext||window.isSecureContext,isVisible:()=>"hidden"!==document.visibilityState,storage:t}}());r.current=t;let i=t.subscribe(()=>n(t.getState())),a=()=>t.syncVisibility();return document.addEventListener("visibilitychange",a),window.addEventListener("pageshow",a),t.start(),()=>{i(),document.removeEventListener("visibilitychange",a),window.removeEventListener("pageshow",a),t.stop(),r.current=null}},[e]);let i=(0,B.useCallback)(e=>r.current?.setEnabled(e),[]);return{...t,setEnabled:i}}(t),children:e})}function o5({children:e,environment:t}){let n=(0,B.useContext)(o1),r=rq();return n||!r?(0,F.jsx)(F.Fragment,{children:e}):(0,F.jsx)(o2,{environment:t,children:e})}let o3={unsupported:"keepAwake.unsupported",insecure:"keepAwake.insecure",off:"keepAwake.off",requesting:"keepAwake.requesting",active:"keepAwake.active",waiting:"keepAwake.waiting",interrupted:"keepAwake.interrupted",blocked:"keepAwake.blocked",failed:"keepAwake.failed"},o4=new Set(["unsupported","insecure"]),o6="keep-awake-caption";function o8(){let{t:e}=(0,er.Ym)(),t=(0,B.useContext)(o1);if(!t)return null;let{enabled:n,status:r,setEnabled:i}=t,a=o4.has(r),s="off"!==r&&"requesting"!==r&&"active"!==r,l=n&&!a;return(0,F.jsxs)("div",{"data-testid":"keep-awake-row","data-wake-lock-status":r,className:"flex flex-col gap-0.5 px-1.5 py-0.5",children:[(0,F.jsxs)("div",{className:"flex min-h-11 items-center gap-2",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 text-[13px] font-semibold text-primary",children:e("keepAwake.label")}),(0,F.jsx)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":e(l?"keepAwake.disableAria":"keepAwake.enableAria"),"aria-describedby":o6,title:e(o3[r]),disabled:a,onClick:()=>i(!n),className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-full border bg-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-45 ${"active"===r?"border-accent/45 text-accent":"border-border text-muted hover:text-primary"}`,children:l?(0,F.jsx)(oQ.A,{className:"h-5 w-5","aria-hidden":!0}):(0,F.jsx)(oZ.A,{className:"h-5 w-5","aria-hidden":!0})})]}),(0,F.jsx)("span",{id:o6,role:"status",className:`text-[11px] leading-snug ${s?"text-warning":"text-muted"}`,children:e(o3[r])})]})}var o7=n(6304),o9=n(5301);let ce=[[1920,4],[1440,3],[1024,2]];var ct=n(1189);function cn({failures:e,size:t="panel",className:n=""}){let{t:r}=(0,er.Ym)();if(e<=0)return null;let i="panel"===t;return(0,F.jsxs)("div",{role:"alert","data-catalog-error":"true",className:`flex flex-col items-center gap-2 text-center ${i?"mx-auto max-w-[420px] rounded-[10px] border border-danger/35 bg-danger-soft px-4 py-4":"px-3 py-4"} ${n}`,children:[(0,F.jsxs)("span",{className:`inline-flex items-center gap-1.5 font-bold text-danger ${i?"text-[13px]":"text-[12px]"}`,children:[(0,F.jsx)(_.A,{className:i?"h-4 w-4 shrink-0":"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),r("catalog.errorTitle")]}),i?(0,F.jsx)("span",{className:"text-[12px] text-secondary",children:r("catalog.errorBody")}):null,(0,F.jsx)("span",{className:"text-[11px] font-semibold tabular-nums text-muted",children:r("catalog.attempts",{count:e})}),(0,F.jsxs)("button",{type:"button",className:`inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border bg-card font-semibold text-primary hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"px-4 text-[13px]":"px-3 text-[12px]"}`,onClick:()=>nw(),children:[(0,F.jsx)(ct.A,{className:"h-4 w-4","aria-hidden":!0})," ",r("catalog.retry")]})]})}var cr=n(710);let ci={engine:"claude",model:"opus",effort:"low",role:"orchestrator",roleParams:{mode:"standard"}},ca=`You are the viewer's built-in Manager (issues #182, #691) — the agent that owns the board and runs the whole conveyor through the viewer's own HTTP API and MCP tools. You never act outside them.
8
-
9
- ## You do not talk to the user
10
- The user talks to ONE agent: the Codex realtime voice root, which is the gateway. You are not it, and you have no user-facing channel. Never address the user, never ask them a question directly, never assume they read anything you write in your own transcript.
11
- Everything the user should hear leaves you as a BRIDGE REPORT. The gateway drains those reports and decides what to say aloud. A thought you did not put in a report did not reach anyone.
12
-
13
- ## Bridge reports (manager -> gateway)
14
- Append one report per meaningful outcome, with a stable key so a retry after a host death is a no-op rather than a duplicate. Classes, and nothing outside this list:
15
- - status — brief progress worth surfacing; keep these rare.
16
- - completed / failed — a stage, review, merge or deploy settled.
17
- - blocked — you cannot proceed and need a decision.
18
- - review_verdict — an APPROVE or REQUEST_CHANGES with the round and PR.
19
- - question — you need an answer from the user; the gateway will ask them and reply.
20
- Bodies are short prose, at most 2 KB, no transcript payloads, no raw tool output, no secrets, no full board dumps. Say what happened and what it means, with ids and links. Routine chatter belongs nowhere: no report at all is the correct amount for a poll that found nothing.
21
-
22
- ## Directives (gateway -> you)
23
- The gateway relays the user's intent to you with send_message. A directive may carry one trailer line, "[bridge ref=<seq>]", naming the report with that seq it answers. Treat only a trailer as an answer — never read one into unrelated prose.
24
-
25
- ## Conveyor rules
26
- Drive every accepted piece of work through: GitHub issue -> worktree lane -> implementer agent -> review flow -> merge bar -> batched deploy -> cleanup.
27
- - One lane (worktree + branch) per issue; one owner per file across active worktrees.
28
- - Spawn implementers via POST /api/spawn with src = YOUR transcript path (lineage draws the diagram edges) and role per the role table; workers end with "REVIEW_READY: <PR url>".
29
- - Reviews run as flows (POST /api/flows) or fresh reviewer spawns (role: "reviewer", reviews: <implementer ref>) — a fresh reviewer every round, verdict contract "VERDICT: APPROVE|REQUEST_CHANGES".
30
- - Merge bar: merge only on an APPROVE verdict with green gates (tsc + tests). Never merge red.
31
- - Keep task cards updated via /api/tasks. Report state changes as bridge reports, not as chat.
32
-
33
- ## Draft-only pipeline contract
34
- You NEVER auto-start pipelines. When asked to build a pipeline: assess complexity, compose stages/roles, POST /api/pipelines with autoStart: false, and report the draft id/link. The user reviews the draft on the board and presses Start himself. Auto-start is allowed only when the user explicitly asked to start it in the same request, relayed through the gateway.
35
-
36
- ## Deploys
37
- YOU decide when to deploy, and you execute it yourself. Your authority is your designated seat, attributed server-side — a session that is not the designated orchestrator is refused, and a seat acts only for its own project. Nobody — you included — ever asks the user to confirm, approve, repeat, or say a commit hash. There is no confirmation step for the user, anywhere; the user hears about deploys only through your reports.
38
- 1. Prepare: merges landed on origin/main, gates green. Never deploy red.
39
- 2. Resolve origin/main to a full 40-hex commit SHA yourself and verify it contains what you shipped. The SHA is machine evidence — never route it through the user.
40
- 3. Call deploy_exact_sha with revision=<sha>. Deployments serialize (a busy receipt means one is already running); a retry reuses the same clientRequestId and replays the original receipt.
41
- 4. Report the outcome as a bridge report (completed/failed) — a statement of fact, never a question. The deployment ledger is the durable audit of what shipped and when.
42
-
43
- ## Fences
44
- - Operate exclusively through the viewer API and MCP tools (spawn, flows, pipelines, tasks, files, agent/snapshot, tmux). No direct process or runtime manipulation.
45
- - The llv-conveyor skill in this checkout is your playbook; follow its spawn-auth notes for agent-initiated calls.
46
- - Replacing manual spawns is a non-goal: the user's own agents keep working; you coordinate, you do not take over.
47
- - Re-derive board state per turn from bounded snapshots rather than accumulating it in context.`,cs={"content-type":"application/json"};async function cl(e){try{return await e.json()}catch{return null}}async function co(e=fetch){var t;let n=await e("/api/orchestrator"),r=await cl(n);if(!n.ok||!r)throw Error("orchestrator status unavailable");if(r.record&&r.exists)return r.record.conversationId;let i=await e("/api/spawn",{method:"POST",headers:cs,body:JSON.stringify((t=r.defaultCwd,{...ci,cwd:t,prompt:ca}))}),a=await cl(i);if(!i.ok||!a?.ok||"string"!=typeof a.conversationId)throw Error(a?.error||"orchestrator spawn failed");let s=await e("/api/orchestrator",{method:"POST",headers:cs,body:JSON.stringify({conversationId:a.conversationId,path:a.path??null})}),l=await cl(s);if(!s.ok||!l?.ok||!l.record)throw Error("orchestrator adoption failed");return l.record.conversationId}function cc(){let{t:e}=(0,er.Ym)(),t=rq(),[n,r]=(0,B.useState)("idle"),i=(0,B.useRef)(!0);(0,B.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let a=(0,B.useRef)(!1),s=async()=>{if(!a.current){a.current=!0,r("busy");try{let e=await co();window.location.hash="#c="+encodeURIComponent(e),i.current&&r("idle")}catch{i.current&&r("error")}finally{a.current=!1}}},l=e("busy"===n?"orch.starting":"error"===n?"orch.error":"orch.chat");return(0,F.jsxs)("button",{type:"button",disabled:"busy"===n,"aria-label":e("orch.open"),title:e("error"===n?"orch.error":"orch.open"),className:`flex shrink-0 items-center gap-1.5 rounded-full border px-3 text-[12px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${"error"===n?"border-warning/45 bg-warning-soft text-warning hover:bg-warning/15":"border-accent/40 bg-accent-soft text-accent hover:bg-accent/15"} ${t?"min-h-11":"py-1"}`,onClick:s,children:[(0,F.jsx)(cr.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),l]})}function cd({files:e,projectCatalog:t,projectDisplayNames:n={},pipelines:r,workflows:i,archivedProjects:a,now:s,catalogFailures:l=0,onSelectProject:o,onSelectFile:c,onMenu:d,attention:u}){let{t:p}=(0,er.Ym)(),m=l>0,f=function(){let[e,t]=(0,B.useState)(3);return(0,B.useEffect)(()=>{let e=()=>t(function(){for(let[e,t]of ce)if(window.innerWidth>=e)return t;return 1}());return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),e}(),h=(0,o9.O)()?44:22,x=(0,B.useMemo)(()=>eb(e,s,i,t,r,n),[e,s,i,t,r,n]),g=(0,B.useMemo)(()=>x.filter(e=>!a.has(e.project)),[x,a]),b=x.length-g.length,v=(0,B.useMemo)(()=>g.reduce((e,t)=>e+t.liveCount,0),[g]),w=g.filter(e=>e.liveCount>0).length,y=(0,B.useMemo)(()=>g.map(t=>{let n=eS(e,t.project).flatMap(e=>e.columns.flatMap(e=>[e.file,...e.tasks])).filter(e=>"live"===e.activity),r=n.slice(0,4),i=e.filter(e=>ef(e)===t.project).sort((e,t)=>t.mtime-e.mtime)[0];return{summary:t,liveBranches:r,moreLive:n.length-r.length,latest:i}}),[e,g]);return(0,F.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,F.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 overflow-x-clip border-b border-border bg-card px-4",children:[d?(0,F.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":p("dash.openProjects"),onClick:d,children:(0,F.jsx)(o7.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,F.jsx)("h1",{className:"min-w-0 shrink truncate text-[13.5px] font-bold",children:p("rail.overview")}),(0,F.jsxs)("span",{className:`hidden min-w-0 shrink truncate text-[11.5px] min-[360px]:block ${m?"font-semibold text-danger":"text-muted"}`,"data-degraded":m?"true":void 0,children:[m?p("catalog.unreachable"):v?p("overview.branchesLiveIn",{count:v,projects:p("overview.projects",{count:w})}):p("common.nothingRunning"),!m&&b?` ${p("overview.archived",{count:b})}`:""]}),(0,F.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-2",children:[(0,F.jsx)(cc,{}),u]})]}),(0,F.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${f}, minmax(0, 1fr))`},children:[y.map(({summary:e,liveBranches:t,moreLive:n,latest:r})=>{let i=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${e.liveCount?"animate-pulse bg-success":"bg-strong"}`}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-bold",children:e.displayName}),e.liveCount?(0,F.jsx)("span",{className:"shrink-0 text-caption font-semibold tabular-nums text-muted",children:e.liveCount}):null,(0,F.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-muted",children:e.conversations})]});return(0,F.jsx)("div",{"data-testid":"overview-card",className:`flex flex-col gap-1.5 rounded-[10px] border border-border bg-card p-3 text-left shadow-1 ${e.catalogOnly?"opacity-70":""}`,children:t.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("button",{type:"button","data-testid":"overview-project",style:{minHeight:h},className:"flex items-center gap-2 rounded-[8px] text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o(e.project),children:i}),(0,F.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"overview-rows",children:[t.map(e=>{let t=(0,tt.yz)(e);return(0,F.jsxs)("button",{type:"button","data-focus-target":e.path,"data-testid":"overview-conversation",style:{minHeight:h},className:"flex items-center gap-1.5 rounded-[8px] px-1 text-left text-[11.5px] hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:(0,tt.cr)(e.title),onClick:()=>c(e),children:[(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:t.style,children:t.label}),(0,F.jsx)("span",{className:"truncate font-semibold",children:(0,tt.cr)(e.title,70)})]},e.path)}),n>0?(0,F.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-muted",children:p("overview.moreLive",{count:n})}):null]})]}):(0,F.jsxs)("button",{type:"button","data-testid":"overview-project",style:{minHeight:h},className:"flex flex-col gap-1.5 rounded-[8px] text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o(e.project),children:[(0,F.jsx)("span",{className:"flex items-center gap-2",children:i}),(0,F.jsx)("span",{className:"text-[11px] text-muted",children:p("overview.quiet",{age:r?(0,tt.rK)(r.mtime):"—"})})]})},e.project)}),m?(0,F.jsx)(cn,{failures:l,className:`col-span-full ${g.length?"mt-1":"mt-[12vh]"}`}):g.length?null:(0,F.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-muted",children:p("overview.empty")})]})]})}var cu=n(3599),cp=n(8309),cm=n(9707),cf=n(2125),ch=n(2133),cx=n(6420),cg=n(9680),cb=n(976);function cv(){return{entries:[],cursor:0}}function cw(e){return e.cursor>0}function cy(e){return e.cursor<e.entries.length}function ck(e){return"object"==typeof e&&null!==e&&"close"===e.kind&&"string"==typeof e.path&&"string"==typeof e.title}let cj=e=>`llvBoardHistory:${e}`,cN=(0,B.createContext)(null),cS=cN.Provider;function cC(){return(0,B.useContext)(cN)}let cA=new Map,cI=()=>0;function cM(e=15e3){let t=function(e){let t=cA.get(e);if(t)return null===t.timer&&Date.now()/1e3-t.now>=e/1e3&&(t.now=Date.now()/1e3),t;let n={now:Date.now()/1e3,listeners:new Set,timer:null};return n.subscribe=t=>(n.listeners.add(t),null===n.timer&&(n.now=Date.now()/1e3,n.timer=setInterval(()=>{for(let e of(n.now=Date.now()/1e3,[...n.listeners]))e()},e)),()=>{n.listeners.delete(t),0===n.listeners.size&&null!==n.timer&&(clearInterval(n.timer),n.timer=null)}),n.read=()=>n.now,cA.set(e,n),n}(e);return(0,B.useSyncExternalStore)(t.subscribe,t.read,cI)}var cT=n(5330);function c$({canUndo:e,canRedo:t,undoEntry:n,redoEntry:r,onUndo:i,onRedo:a,isMobile:s}){var l,o;let{t:c}=(0,er.Ym)(),d=n?.title.trim(),u=r?.title.trim(),p=e?(l=d?c("board.undoReopen",{title:d}):c("board.undo"),`${l} (Ctrl+Z)`):c("board.undoNothing"),m=t?(o=u?c("board.redoReclose",{title:u}):c("board.redo"),`${o} (Ctrl+Shift+Z)`):c("board.redoNothing"),f=s?"h-5 w-5":"h-4 w-4",h="flex items-center justify-center text-primary transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 hover:text-accent disabled:cursor-default disabled:text-muted disabled:opacity-40 disabled:hover:text-muted";return s?e?(0,F.jsx)(a3,{label:p,children:(0,F.jsx)("button",{type:"button",className:`${h} h-11 w-11 shrink-0 rounded-control border border-border bg-card`,onClick:i,"aria-label":p,children:(0,F.jsx)(cT.A,{className:f,"aria-hidden":!0})})}):null:e||t?(0,F.jsxs)("div",{className:"inline-flex shrink-0 items-center rounded-control border border-border bg-card",role:"group","aria-label":c("board.historyGroup"),children:[(0,F.jsx)(a3,{label:p,children:(0,F.jsx)("button",{type:"button",className:`${h} h-7 w-8`,onClick:i,disabled:!e,"aria-label":p,children:(0,F.jsx)(cT.A,{className:f,"aria-hidden":!0})})}),(0,F.jsx)("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":!0}),(0,F.jsx)(a3,{label:m,children:(0,F.jsx)("button",{type:"button",className:`${h} h-7 w-8`,onClick:a,disabled:!t,"aria-label":m,children:(0,F.jsx)(cb.A,{className:f,"aria-hidden":!0})})})]}):null}function cE(){let e=null;return{consume:t=>!!t&&e!==t.nonce&&(e=t.nonce,!0),appliedNonce:()=>e}}var cR=n(6957),cP=n(5408),cO=n(8962),cD=n(6408),cL=n(5480);let cF="default",c_=/[/\\]accounts[/\\](?:claude|codex)[/\\]([^/\\]+)[/\\]/,cq=new Set(["starting","awaiting_browser","awaiting_code","verifying","canceling","authenticated","canceled","timed_out","failed","interrupted"]),cz=new Set(["starting","awaiting_browser","awaiting_code","verifying","canceling"]);function cH(e){if("object"!=typeof e||null===e||"string"!=typeof e.operationId||"string"!=typeof e.phase||!cq.has(e.phase)||null!==e.loginUrl&&"string"!=typeof e.loginUrl||"boolean"!=typeof e.acceptsCode||"string"!=typeof e.deadlineAt)return null;let t=null;if(null!==e.result&&void 0!==e.result){let n=e.result;if("success"!==n.status&&"failure"!==n.status&&"canceled"!==n.status||"string"!=typeof n.code||"string"!=typeof n.message)return null;t={status:n.status,code:n.code,message:n.message}}return{operationId:e.operationId,phase:e.phase,loginUrl:e.loginUrl??null,acceptsCode:e.acceptsCode,deadlineAt:e.deadlineAt,result:t}}function cB(e){switch(e){case"timed_out":return"accounts.claudeLogin.err.timed_out";case"interrupted":return"accounts.claudeLogin.err.interrupted";case"verification_failed":return"accounts.claudeLogin.err.verification_failed";case"input_failed":return"accounts.claudeLogin.err.input_failed";case"login_busy":return"accounts.claudeLogin.err.login_busy";default:return"accounts.claudeLogin.err.generic"}}function cU(e){if("object"!=typeof e||null===e||"number"!=typeof e.usedPercent||!Number.isFinite(e.usedPercent))return null;let t="number"==typeof e.resetsAt&&Number.isFinite(e.resetsAt)?e.resetsAt:null,n="number"==typeof e.windowMinutes&&Number.isFinite(e.windowMinutes)?e.windowMinutes:null;return{usedPercent:e.usedPercent,resetsAt:t,windowMinutes:n}}function cK(e,t){let n=t.target?e(t.messageKey,{target:t.target,label:t.target}):e(t.messageKey);return t.detail?`${n} — ${t.detail}`:n}function cY(e){return e.find(e=>e.loginPending)?.deviceAuth??null}let cW={accounts:[],active:"",identityVersion:0,status:"loading",notice:null,challenge:null,mutation:null,migration:null,autoBalance:null};function cJ(e,t){return{kind:"error",operation:"add",messageKey:cB(e),action:{type:"retry",kind:"add",label:t}}}class cV extends Error{constructor(e){super(e??"account selection failed"),this.detail=e,this.name="SwitchRequestError"}}function cG(e){return"string"==typeof e?.detail&&e.detail?e.detail:"string"==typeof e?.error&&e.error&&!/selection failed$/i.test(e.error)?e.error:void 0}function cX(e,{fetcher:t=globalThis.fetch.bind(globalThis),timeoutMs:n=1e4}={}){let r=`/api/accounts/${e}/active`,i=`/api/accounts/${e}`,a=cW,s=0,l=null,o=!1,c=Promise.resolve(),d=null,u=null,p=new Set,m=e=>{for(let t of(a=e,x(),p))t()},f=e=>m({...a,...e}),h=()=>{null!==d&&clearInterval(d),d=null,u=null},x=()=>{let e=0===p.size?null:a.accounts.some(e=>null!=e.login&&cz.has(e.login.phase))?2500:a.accounts.some(e=>e.loginPending)||a.migration?.state==="draining"?1e4:null;e!==u&&(h(),null!==e&&(d=setInterval(()=>void b(),e),u=e))},g=()=>{s+=1,l?.abort(),l=null},b=async()=>{g();let r=s,i=new AbortController;l=i;let o=setTimeout(()=>i.abort(),n);try{let n=await t("/api/accounts",{signal:i.signal});if(!n.ok)throw Error("accounts request failed");let{active:o,accounts:c,migration:d,autoBalance:u}=function(e,t){let n=e?.[t];if("string"!=typeof n?.active||!Array.isArray(n.accounts))throw Error("accounts response invalid");let r=n.accounts.map(e=>{let n="claude"===t?cH(e.login):null,r=n?cz.has(n.phase):!0===e.loginPending,i="object"==typeof e.auth&&null!==e.auth?e.auth.state:null,a="authenticated"===i||"signed_out"===i||"unknown"===i||"error"===i?i:e.authPresent?"unknown":"signed_out";return{...e,authHealth:a,login:n,loginPending:r,effective:function(e){let t=aG(e);if(!t||"number"!=typeof t.percent||!Number.isFinite(t.percent))return null;let n="weekly"===t.window?"weekly":"session",r="fresh"===t.freshness?"fresh":"stale"===t.freshness?"stale":"unavailable";return{percent:t.percent,window:n,freshness:r}}(e.effective),limits:function(e){if("object"!=typeof e||null===e)return null;let t="fresh"===e.state?"fresh":"stale"===e.state?"stale":null;if(!t)return null;let n=cU(e.session),r=cU(e.weekly);return n||r?{freshness:t,session:n,weekly:r}:null}(e.limits)}});return{active:n.active,accounts:r,migration:function(e){let t,n=aG(e);if(!n)return null;let r=aQ(n.intentId),i=aQ(n.targetId);if(!r||!i)return null;let a=aZ.has(n.state)?n.state:"draining";return{intentId:r,targetId:i,targetLabel:aQ(n.targetLabel)??i,revision:aX(n.revision),origin:"auto"===n.origin?"auto":"manual",reason:function(e){let t=aG(e);if(!t)return null;let n="weekly"===t.window?"weekly":"session"===t.window?"session":null;return n?{window:n,fromPercent:aX(t.fromPercent),toPercent:aX(t.toPercent)}:null}(n.reason),state:a,counts:(t=aG(n.counts)??{},{done:aX(t.done),waitingTurn:aX(t.waitingTurn),inFlight:aX(t.inFlight),failed:aX(t.failed),total:aX(t.total)}),startedAt:aQ(n.startedAt)}}(n.migration),autoBalance:function(e){let t=aG(e);if(!t||"boolean"!=typeof t.enabled)return null;let n=a0.has(t.state)?t.state:"idle";return{enabled:t.enabled,thresholdPercent:aX(t.thresholdPercent,25),state:t.enabled?n:"disabled",cooldownUntil:aQ(t.cooldownUntil),lastCheckAt:aQ(t.lastCheckAt),lastOutcome:function(e){let t=aG(e);if(!t)return null;let n=aQ(t.at);if(!n)return null;let r="failed"===t.kind?"failed":"skipped"===t.kind?"skipped":"switched",i="weekly"===t.window?"weekly":"session"===t.window?"session":null;return{at:n,kind:r,fromId:aQ(t.fromId),fromPercent:"number"==typeof t.fromPercent?t.fromPercent:null,toId:aQ(t.toId),toPercent:"number"==typeof t.toPercent?t.toPercent:null,window:i,detail:aQ(t.detail)}}(t.lastOutcome)}}(n.autoBalance)}}(await n.json(),e);if(r!==s)return!1;return l=null,m({...a,active:o,accounts:c,migration:d,autoBalance:u,challenge:cY(c),status:"ready",notice:a.notice?.operation==="refresh"?null:a.notice}),!0}catch{if(r!==s)return!1;l=null;let e=a.notice&&"refresh"!==a.notice.operation?a.notice:{kind:"error",operation:"refresh",messageKey:"accounts.refreshFailed",action:{type:"retry",kind:"refresh"}};return m({...a,status:"error",notice:e}),!1}finally{clearTimeout(o)}},v=(e,t)=>{if(o||a.mutation)return Promise.resolve(!1);o=!0,f({mutation:e});let n=c.then(t,t);return c=n.then(()=>void 0,()=>void 0),n.finally(()=>{o=!1,f({mutation:null})})},w=n=>{let r=n.trim();return r?v("add",async()=>{try{let n=await t(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:r})}),s=await n.json().catch(()=>null);if("claude"===e){if(!n.ok){let e;return f({notice:cJ((e=s?.code,"string"==typeof e?e:null),r)}),await b(),!1}let e=cH(s?.login);if("string"!=typeof s?.account?.id||"string"!=typeof s.account.label||!e)throw Error("account creation failed");let t={id:s.account.id,label:s.account.label,kind:"managed",authPresent:!0===s.account.authPresent,login:e,loginPending:cz.has(e.phase),loginState:"pending",deviceAuth:null},i=a.accounts.some(e=>e.id===t.id)?a.accounts.map(e=>e.id===t.id?{...e,...t}:e):[...a.accounts,t];f({accounts:i,challenge:cY(i),notice:{kind:"success",operation:"add",messageKey:"accounts.claudeLoginStarted",target:t.label,action:null}})}else{if(!n.ok||"string"!=typeof s?.account?.id||"string"!=typeof s.account.label||"string"!=typeof s.target)throw Error("account creation failed");let e={id:s.account.id,label:s.account.label,authPresent:!0===s.account.authPresent,loginPending:!0===s.account.loginPending,loginState:!0===s.account.loginPending?"pending":"idle",deviceAuth:null,login:null},t=a.accounts.some(t=>t.id===e.id)?a.accounts:[...a.accounts,e];f({accounts:t,challenge:cY(t),notice:{kind:"success",operation:"add",messageKey:"accounts.loginOpened",target:s.target,action:null}})}}catch{return f({notice:"claude"===e?cJ(null,r):{kind:"error",operation:"add",messageKey:"accounts.addFailed",action:{type:"retry",kind:"add",label:r}}}),await b(),!1}return await b(),!0}):Promise.resolve(!1)},y=e=>{if(!e)return Promise.resolve(!1);let n=a.accounts.find(t=>t.id===e);return!n?.authPresent||n.loginPending?Promise.resolve(!1):e===a.active?(a.notice?.operation==="switch"&&f({notice:null}),b()):v("switch",async()=>{let n=a.active;f({active:e,identityVersion:a.identityVersion+1});try{let n=await t(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,mode:"select"})});if(!n.ok){let e=cG(await n.json().catch(()=>null));throw new cV(e)}}catch(r){let t=r instanceof cV?r.detail:void 0;if(f({active:n,identityVersion:a.identityVersion+1,notice:{kind:"error",operation:"switch",messageKey:"accounts.switchFailed",...t?{detail:t}:{},action:{type:"retry",kind:"switch",accountId:e}}}),await b()&&a.active===e)return f({identityVersion:a.identityVersion+1,notice:a.notice?.operation==="switch"?null:a.notice}),!0;return!1}return f({identityVersion:a.identityVersion+1,notice:a.notice?.operation==="switch"?null:a.notice}),await b(),!0})},k=(e,t)=>{f({accounts:a.accounts.map(n=>{if(!n.login||n.login.operationId!==e)return n;let r=t(n.login);return{...n,login:r,loginPending:cz.has(r.phase)}})})},j=n=>"claude"!==e?Promise.resolve(!1):v("login",async()=>{try{let e=await t(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"retry",id:n})}),r=await e.json().catch(()=>null);if(409===e.status)return await b(),f({notice:{kind:"error",operation:"login",messageKey:"accounts.claudeLogin.err.login_busy",action:null}}),!1;let s=cH(r?.login);if(202!==e.status||!s)throw Error("login retry failed");let l=a.accounts.find(e=>e.id===n)?.label??n,o=a.accounts.map(e=>e.id===n?{...e,login:s,authPresent:!1,loginState:"pending",loginPending:cz.has(s.phase)}:e);f({accounts:o,notice:{kind:"success",operation:"login",messageKey:"accounts.claudeLoginStarted",target:l,action:null}})}catch{return f({notice:{kind:"error",operation:"login",messageKey:"accounts.claudeLogin.err.generic",action:{type:"retry",kind:"loginRetry",accountId:n}}}),await b(),!1}return await b(),!0}),N=(e,n=!1)=>{let r=a.accounts.find(t=>t.id===e)?.label??e;return v("remove",async()=>{try{let s=await t(i,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,force:n})});if(!s.ok){let t=await s.json().catch(()=>null),n=t?.code==="account_removal_blocked",i=n&&Array.isArray(t?.blockers)&&t.blockers.includes("current_conversations");return f({notice:{kind:"error",operation:"remove",messageKey:i?"accounts.removeHistoryBlocked":n?"accounts.removeBlocked":"accounts.removeFailed",target:r,action:n&&!i?{type:"retry",kind:"forceRemove",accountId:e}:null}}),await b(),!1}let l=await s.json().catch(()=>null),o=a.accounts.filter(t=>t.id!==e);f({accounts:o,challenge:cY(o),identityVersion:a.identityVersion+1,notice:l?.cleanupPending===!0?{kind:"error",operation:"remove",messageKey:"accounts.cleanupPending",target:r,action:{type:"retry",kind:"cleanupOrphans"}}:null})}catch{return f({notice:{kind:"error",operation:"remove",messageKey:"accounts.removeFailed",target:r,action:null}}),await b(),!1}return await b(),!0})},S=()=>v("remove",async()=>{try{let e=await t(i,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({cleanupOrphans:!0})});if(!e.ok)throw Error("orphan cleanup failed");let n=await e.json().catch(()=>null),r=Array.isArray(n?.unresolved)?n.unresolved.filter(e=>"string"==typeof e):[];f({notice:r.length?{kind:"error",operation:"remove",messageKey:"accounts.cleanupManual",action:null}:null})}catch{return f({notice:{kind:"error",operation:"remove",messageKey:"accounts.cleanupFailed",action:null}}),await b(),!1}return await b(),!0}),C=async()=>{let e=a.notice?.action;if(!e)return!1;switch(e.kind){case"refresh":return b();case"add":return w(e.label);case"loginRetry":return j(e.accountId);case"cleanupOrphans":return S();case"forceRemove":return N(e.accountId,!0);case"switch":return y(e.accountId)}};return{engine:e,subscribe:e=>(p.add(e),x(),"loading"===a.status&&null===l&&b(),()=>{p.delete(e),0===p.size?(h(),g()):x()}),getSnapshot:()=>a,get accounts(){return a.accounts},get active(){return a.active},get identityVersion(){return a.identityVersion},get status(){return a.status},get notice(){return a.notice},get challenge(){return a.challenge},get mutation(){return a.mutation},get migration(){return a.migration},get autoBalance(){return a.autoBalance},refresh:b,add:w,retryNotice:C,select:y,submitLoginCode:(n,r)=>{if("claude"!==e)return Promise.resolve(!1);let i=r.trim();return i?v("login",async()=>{k(n,e=>({...e,phase:"verifying",acceptsCode:!1}));try{if(!(await t(`/api/accounts/claude/login/${encodeURIComponent(n)}/input`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:i})})).ok)return f({notice:{kind:"error",operation:"login",messageKey:"accounts.claudeLogin.err.input_failed",action:null}}),await b(),!1}catch{return f({notice:{kind:"error",operation:"login",messageKey:"accounts.claudeLogin.err.input_failed",action:null}}),await b(),!1}return await b(),!0}):Promise.resolve(!1)},cancelLogin:n=>"claude"!==e?Promise.resolve(!1):v("login",async()=>{k(n,e=>({...e,phase:"canceling",acceptsCode:!1}));try{if(!(await t(`/api/accounts/claude/login/${encodeURIComponent(n)}`,{method:"DELETE"})).ok)throw Error("cancel failed")}catch{return await b(),!1}return await b(),!0}),retryLogin:j,remove:N,cleanupOrphans:S,copyTerminalCommand:n=>{let r=a.accounts.find(e=>e.id===n);return!r?.authPresent||r.loginPending?Promise.resolve(!1):v("terminal",async()=>{try{let i=await t(`/api/accounts/${e}/terminal`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:n})}),a=await i.json().catch(()=>null);if(!i.ok||"string"!=typeof a?.command)return f({notice:{kind:"error",operation:"terminal",messageKey:"accounts.terminalFailed",target:r.label,...cG(a)?{detail:cG(a)}:{},action:null}}),!1;try{await navigator.clipboard.writeText(a.command)}catch{}return f({notice:{kind:"success",operation:"terminal",messageKey:"accounts.terminalCopied",target:r.label,detail:a.command,action:null}}),!0}catch{return f({notice:{kind:"error",operation:"terminal",messageKey:"accounts.terminalFailed",target:r.label,action:null}}),!1}})}}}let cQ={codex:cX("codex"),claude:cX("claude")};function cZ(e){let t=cQ[e];return{...(0,B.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot),engine:e,refresh:t.refresh,add:t.add,retryNotice:t.retryNotice,select:t.select,submitLoginCode:t.submitLoginCode,cancelLogin:t.cancelLogin,retryLogin:t.retryLogin,remove:t.remove,cleanupOrphans:t.cleanupOrphans,copyTerminalCommand:t.copyTerminalCommand}}var c0=n(9375);function c1(e,t,n){return t in c0.en?e(t):n}function c2(e,t){return c1(e,`effortTier.${t}`,t)}let c5=["deployer"];function c3(e,t){return e.runs.find(e=>e.stageId===t)?.attempts.findLast(e=>!e.historical)??null}let c4=["orchestrator","reviewer","verifier","builder","architect","cleaner","prod-auditor","deployer"].filter(e=>!c5.includes(e));function c6(e,t){return e(`pipelineState.${t}`)}let c8=new Set(["provisioning","running"]),c7=new Set(["needs_decision","paused"]);function c9(e){return!!c8.has(e.state)||"paused"===e.state&&null!==e.pausedState&&c8.has(e.pausedState)}let de={pending:{color:"var(--color-muted)",soft:"var(--color-sunken)"},running:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},reviewing:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},committing:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},passed:{color:"var(--color-success)",soft:"var(--color-success-soft)"},failed:{color:"var(--color-danger)",soft:"var(--color-danger-soft)"},needs_decision:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"},skipped:{color:"var(--color-muted)",soft:"var(--color-sunken)"}},dt={pending:"○",running:"▸",reviewing:"⟳",committing:"▾",passed:"✓",failed:"✕",needs_decision:"●!",skipped:"↷"};function dn(e,t){return e.runs.find(e=>e.stageId===t)?.attempts??[]}let dr=new Set(["draft","provisioning","running","needs_decision","paused"]),di=new Set(["pending","spawning","running","reviewing","committing"]);function da(e,t){let n=new Map(t.map(e=>[e.id,e])),r=new Set;for(let t of e)if(t.cursor&&"completed"!==t.state&&"closed"!==t.state&&"draft"!==t.state)for(let e of t.stages){let i=c3(t,e.id);if(!i)continue;if(i.agentPath){r.add(i.agentPath);continue}if("review-loop"!==e.kind)continue;let a=t.stages.findIndex(t=>t.id===e.id),s=t.stages.slice(0,a).reverse().find(e=>{let n=c3(t,e.id);return"run"===e.kind&&n?.state==="passed"&&n.agentPath}),l=i.flowId?n.get(i.flowId)?.implementerPath:s?c3(t,s.id)?.agentPath:null;l&&r.add(l)}return r}function ds(e,t){return t.size?e.filter(e=>!t.has(e.path)):e}function dl(e,t){let n=new Set;for(let t of e)for(let e of t.runs)for(let t of e.attempts)t.flowId&&n.add(t.flowId);return n.size?t.filter(e=>!n.has(e.id)):[...t]}function dc(e,t=[],n=[]){let r=new Set,i=new Set;e.srcPath&&r.add(e.srcPath),e.srcConversationId&&i.add(e.srcConversationId);let a=new Map(t.map(e=>[e.id,e]));for(let t of e.runs)for(let e of t.attempts){e.agentPath&&r.add(e.agentPath),e.conversationId&&i.add(e.conversationId);let t=e.flowId?a.get(e.flowId):null;if(t)for(let e of(r.add(t.implementerPath),t.implementerConversationId&&i.add(t.implementerConversationId),t.rounds))for(let a of eK(t,e,n))r.add(a.path),a.conversationId&&i.add(a.conversationId)}return{paths:r,conversationIds:i}}function dd(e,t,n=[],r=[]){let i=e.taskIds;if(i?.length){let e=new Map(t.map(e=>[e.id,e]));return i.flatMap(t=>{let n=e.get(t);return n?[n]:[]})}let{paths:a,conversationIds:s}=dc(e,n,r);return a.size||s.size?t.filter(e=>!!e.source&&a.has(e.source.path)||e.assignments.some(e=>!!(e.path&&a.has(e.path)||e.conversationId&&s.has(e.conversationId)))):[]}function du(e,t,n,r,i=[]){let a=n.find(e=>dc(e,r,i).paths.has(t)),s=a?dc(a,r,i).paths:null,l=s?e.filter(e=>!s.has(e)):[...e];return l.includes(t)?l:[...l,t]}function dp(e,t){let n=c3(e,t.id);if(n){if("passed"===n.state)return"passed";if("skipped"===n.state)return"skipped";if("failed"===n.state)return"failed";if("needs_decision"===n.state)return"needs_decision"}return e.cursor?.stageId===t.id&&c9(e)?e.cursor?.state==="committing"||n?.state==="committing"?"committing":"review-loop"===t.kind||e.cursor?.state==="reviewing"||n?.state==="reviewing"?"reviewing":"running":"pending"}function dm(e,t){return new Set(e.filter(e=>("closed"!==e.state||e.restored)&&t.has(e.implementerPath)).map(e=>e.id))}function df(e){return e&&(e.conversationId||e.agentPath)?{conversationId:e.conversationId,agentPath:e.agentPath}:null}function dh(e,t){if(!e)return null;if(e.conversationId){let n=V(t,e.conversationId);if(n&&!K(n))return n}if(e.agentPath){let n=X(e.agentPath,null,t);if(n)return t.find(e=>e.path===n)??null}return null}function dx(e,t,n,r,i,a=[]){var s,l,o,c;let d=(s=e,l=t,o=r,c=i,l?"review-loop"===s.kind?l.flowId&&(!o||o.has(l.flowId))?{kind:"flow",flowId:l.flowId}:null:l.agentPath&&(!c||c.has(l.agentPath))?{kind:"path",path:l.agentPath}:null:null);if(d||"review-loop"!==e.kind||!t?.flowId)return d;let u=n.find(e=>e.id===t.flowId);if(!u)return null;for(let e of[...u.rounds].reverse()){let t=[...eK(u,e,a)].reverse().find(({path:e})=>!i||i.has(e))?.path;if(t)return{kind:"path",path:t}}return!i||i.has(u.implementerPath)?{kind:"path",path:u.implementerPath}:null}function dg(e,t,n,r,i=[]){for(let a of[...e.stages].reverse()){let s=dx(a,c3(e,a.id),t,n,r,i);if(s)return s}return null}function db(e,t,n){return!!n&&(!!n.verdict||!!n.error||"needs_decision"===e.state&&e.cursor?.stageId===t.id)}function dv(e,t,n,r=[],i,a=[]){if(!n)return!1;let s=e=>!i||i.has(e),l=dn(e,t.id);if(l.some(e=>e.n!==n.n&&!!(e.agentPath&&s(e.agentPath))))return!0;let o=new Set(l.flatMap(e=>e.flowId?[e.flowId]:[])),c=new Set(l.flatMap(e=>e.agentPath?[e.agentPath]:[]));return r.some(e=>o.has(e.id)&&e.rounds.some(t=>eK(e,t,a).some(({path:e})=>!c.has(e)&&s(e))))}function dw(e,t){return e(`pipelineChipState.${t}`)}function dy(e,t){if(t.role?.roleId){var n;return n=t.role.roleId,c1(e,`roleCopy.${n}.name`,n)}return"review-loop"===t.kind?e("pipelineStrip.reviewStage"):t.id}function dk(e,t,n,r){let i=dy(e,t),a=e("pipelineSlot.stageOf",{k:n+1,n:r});return i===t.id?`${i} \xb7 ${a}`:`${i} \xb7 ${t.id} \xb7 ${a}`}function dj(e){let t=new Map;for(let n of e)"closed"!==n.state&&n.stages.forEach((e,r)=>{let i=c3(n,e.id);i?.agentPath&&t.set(i.agentPath,{pipeline:n,stage:e,index:r,total:n.stages.length})});return t}function dN(e,t){return t?dk(e,t.stage,t.index,t.total):void 0}function dS(e,t,n){let r=dp(e,t);return"skipped"===r||"completed"===n&&("passed"===r||"failed"===r)}function dC(e,t=120){let n=(e??"").split("\n").map(e=>e.trim()).find(e=>e.length>0)??"";return n.length>t?`${n.slice(0,t-1)}…`:n}function dA(e){let t,n,r,i=e.stages.length;if(e.cursor){let t=e.stages.findIndex(t=>t.id===e.cursor.stageId);return{k:t>=0?t+1:i,n:i}}let a=(t=-1,n=-1,r="",e.stages.forEach((i,a)=>{let s=c3(e,i.id);if(!s)return;di.has(s.state)&&(t=a);let l=s.completedAt??s.startedAt??"";(s.completedAt||s.startedAt)&&(-1===n||l>=r)&&(n=a,r=l)}),t>=0?t:n);return{k:a>=0?a+1:i,n:i}}let dI={pass:{color:"var(--color-success)",soft:"var(--color-success-soft)"},fail:{color:"var(--color-danger)",soft:"var(--color-danger-soft)"},needs_decision:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"}};function dM(e,t){return e("pass"===t?"pipelineVerdict.pass":"fail"===t?"pipelineVerdict.fail":"pipelineVerdict.needsDecision")}let dT=[{id:"planBuildReview",labelKey:"pipelineTemplates.planBuildReview",stages:[{kind:"run",roleId:"architect",access:"read-only",prompt:"{{task}}"},{kind:"run",roleId:"builder",access:"read-write",prompt:"{{prev.output}}"},{kind:"review-loop",roleId:"reviewer",access:"read-only",prompt:"{{task}}"}]},{id:"buildReview",labelKey:"pipelineTemplates.buildReview",stages:[{kind:"run",roleId:"builder",access:"read-write",prompt:"{{task}}"},{kind:"review-loop",roleId:"reviewer",access:"read-only",prompt:"{{task}}"}]},{id:"buildVerify",labelKey:"pipelineTemplates.buildVerify",stages:[{kind:"run",roleId:"builder",access:"read-write",prompt:"{{task}}"},{kind:"run",roleId:"verifier",access:"read-only",prompt:"{{prev.output}}"}]},{id:"blank",labelKey:"pipelineTemplates.blank",stages:[{kind:"run",roleId:"",access:"read-write",prompt:"{{task}}"},{kind:"run",roleId:"",access:"read-write",prompt:"{{prev.output}}"}]}],d$=/\{\{(?:task|prev\.output)\}\}/g;function dE(e){return e.replace(d$," ").split("\n").map(e=>e.replace(/[ \t]+/g," ").trim()).join("\n").replace(/\n{3,}/g,"\n\n").trim()}function dR(e){let t=e.indexOf("run"),n=e.indexOf("review-loop");return -1===n||-1!==t&&t<n}async function dP(e,t){try{let n=await fetch("/api/pipelines/preflight",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({repoDir:e}),signal:t}),r=await n.json().catch(()=>null);if(n.ok&&r?.ok)return r;if(r&&!r.ok&&r.code)return{ok:!1,code:r.code,path:r.path};return{ok:!1,code:"missing",path:e,error:(0,er.Tl)((0,er.JK)(),"pipelineModel.failed",{status:n.status})}}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)throw t;return{ok:!1,code:"missing",path:e,error:(0,er.Tl)((0,er.JK)(),"common.serverUnavailable")}}}async function dO(e){try{let t=await fetch("/api/pipelines",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(t.ok&&n?.pipeline)return n5(n.pipeline,!0),!1!==e.autoStart&&window.dispatchEvent(new Event(t7)),{pipeline:n.pipeline};return{error:n?.error??(0,er.Tl)((0,er.JK)(),"pipelineModel.failed",{status:t.status}),...n?.code?{code:n.code,field:n.field,path:n.path}:{}}}catch{return{error:(0,er.Tl)((0,er.JK)(),"common.serverUnavailable")}}}async function dD(e,t,n,r){var i;let a,s,l=(t??"").trim();return l?dO({task:(0,er.Tl)((0,er.JK)(),"pipelineBuilder.untitledTask"),repoDir:l,stages:n?(i=n.stages.map((e,t)=>({key:`tpl-${t}`,kind:e.kind,roleId:e.roleId,engine:"claude",model:"",effort:"",access:e.access,prompt:e.prompt,roleParams:{}})),a=new Set,s=i.map(e=>(function(e,t,n){let r=(t?t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase():"")||("review-loop"===e?"review":"stage"),i=r;for(let e=2;n.has(i);e+=1)i=`${r}-${e}`;return n.add(i),i})(e.kind,e.roleId,a)),i.map((e,t)=>{let n=function(e){let t={};for(let[n,r]of Object.entries(e))if("string"==typeof r){let e=r.trim();e&&(t[n]=e)}else null!=r&&(t[n]=r);return t}(e.roleParams);return{id:s[t],kind:e.kind,...e.roleId?{role:{roleId:e.roleId,...Object.keys(n).length?{params:n}:{}}}:{},...e.runtimeOverridden?{engine:e.engine,...e.model.trim()?{model:e.model.trim()}:{},...e.effort?{effort:e.effort}:{}}:{},..."review-loop"===e.kind?{}:{access:e.access},prompt:e.prompt,next:s[t+1]??null}})):[{id:"implement",kind:"run",role:{roleId:"builder"},prompt:"{{task}}",next:null}],...r?{src:r}:{},autoStart:!1}):{error:(0,er.Tl)((0,er.JK)(),"common.serverUnavailable")}}function dL(e,t,n,r){let i=c3(e,t.id);return!!i&&(!!(i.agentPath&&n.has(i.agentPath))||"review-loop"===t.kind&&!!(i.flowId&&r.has(i.flowId)))}let dF=new Set(["passed","failed","needs_decision","skipped"]);function d_(e,t){if(!t.onFail)return 0;let n=e.runs.find(e=>e.stageId===t.onFail.to);return n?n.attempts.filter(e=>!e.historical&&e.activatedBy?.edge==="fail"&&e.activatedBy.stageId===t.id).length:0}let dq=new Set(["start","retry-stage","skip-stage","resume","pause","close"]),dz={roleId:null,engine:"claude",model:"",effort:"",promptScaffold:null};function dH(e){let t=new Set(e.map(e=>e.id));return e.map(e=>({...e,next:null!=e.next&&e.next!==e.id&&t.has(e.next)?e.next:null,onFail:e.onFail&&t.has(e.onFail.to)?e.onFail:null}))}async function dB(e,t,n,r,i){return dU(e.id,"set-edge",{stageId:t,edge:n,to:r,...void 0!==i?{maxRounds:i}:{}},{...e,stages:e.stages.map(e=>e.id!==t?e:"pass"===n?{...e,next:r}:{...e,onFail:null===r?null:{to:r,maxRounds:i??5}})})}async function dU(e,t,n,r){r&&n5(r,!1);try{let i=await fetch(`/api/pipelines/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({action:t,...n})}),a=await i.json().catch(()=>null);if(i.ok)return a?.pipeline?n5(a.pipeline,!0):r&&n3(e),dq.has(t)&&window.dispatchEvent(new Event(t7)),null;return r&&n3(e),a?.error??(0,er.Tl)((0,er.JK)(),"pipelineModel.failed",{status:i.status})}catch{return r&&n3(e),(0,er.Tl)((0,er.JK)(),"common.serverUnavailable")}}let dK={dim:"var(--color-strong)",active:"var(--color-accent)",ok:"var(--color-success)",amber:"var(--color-warning)"};function dY(e){return"deck::"+e}function dW(e,t){return`slot::${e}::${t}`}function dJ(e){switch(e){case"reviewing":return"awaiting_verdict";case"spawning":case"relaying":case"fixing":return"running";case"spawn_pending":case"relay_pending":case"needs_decision":case"done_comment":return"attention";case"paused":return"paused";case"approved":case"closed":return"done";case"waiting_ready":return"waiting"}}function dV(e){return e.rounds.at(-1)??null}function dG(e,t,n){let r=new Map;for(let e of n)for(let t of e.paths)r.set(t,e.key);for(let e of t)for(let t of(r.set(e.key,e.key),e.flow.rounds))t.reviewerPath&&r.set(t.reviewerPath,e.key);for(let t of e)r.set(t,t);return r}function dX(e){let t=0;for(let n=0;n<e.length;n+=1)t=(31*t+e.charCodeAt(n))%360;return(t%360+360)%360}let dQ=new Set(["provisioning","running"]);function dZ(e){return!!dQ.has(e.state)||"paused"===e.state&&null!==e.pausedState&&dQ.has(e.pausedState)}function d0(e,t){let n=c3(e,t);return n?.state==="passed"||n?.state==="skipped"?"ok":n?.state==="failed"||n?.state==="needs_decision"?"amber":e.cursor?.stageId===t&&dZ(e)?"active":"dim"}let d1={authenticated:"accounts.auth.authenticated",signed_out:"accounts.auth.signedOut",unknown:"accounts.auth.unknown",error:"accounts.auth.error"},d2={claude:"Claude",codex:"Codex"};function d5(e){return e?[e.intentId,e.revision??"",e.phase,e.targetAccountId,e.failure??""].join("\0"):null}function d3({engine:e,accountId:t,file:n,runtimeSession:r}){var i,a,s,l,o;let c,d,{t:u}=(0,er.Ym)(),p=rq(),m=cZ(e),[f,h]=(0,B.useState)(!1),[x,g]=(0,B.useState)(!1),b=(0,B.useRef)(null),v=(0,B.useRef)(null),w=(0,B.useRef)(null),y=(d=dX(t),{dot:`color-mix(in srgb, hsl(${d} 60% 50%) 85%, var(--color-card))`,circleBg:`color-mix(in srgb, hsl(${d} 62% 50%) 20%, var(--color-card))`}),k=(i=m.accounts.find(e=>e.id===t))?i.authHealth??(i.authPresent?"unknown":"signed_out"):null,j=(a=u,s=t,l=e,o=k,c=d2[l],o?a("branch.accountTip",{id:s,engine:c,health:a(d1[o])}):a("branch.accountTipPlain",{id:s,engine:c})),N=u("branch.accountAria",{id:t});(0,B.useEffect)(()=>{let e=b.current;if(!e)return;let t=r?.recentReceipts.find(t=>t.operationId===e&&"reconfigure"===t.kind);t&&("applied"===t.status?(b.current=null,v.current=null,w.current=null,g(!1),s3("ok",u("accounts.conversationApplied"))):("failed"===t.status||"rejected"===t.status)&&(b.current=null,v.current=null,w.current=null,g(!1),s3("err",t.reason??u("accounts.switchFailed"))))},[r,u]),(0,B.useEffect)(()=>{x&&v.current===t&&(v.current=null,b.current=null,w.current=null,g(!1),s3("ok",u("accounts.conversationApplied")))},[t,x,u]),(0,B.useEffect)(()=>{let e=n?.migration,t=v.current;x&&!b.current&&e?.failure&&e.targetAccountId===t&&d5(e)!==w.current&&(v.current=null,w.current=null,g(!1),s3("err",e.failure))},[n?.migration,x]);let S=async i=>{if(n&&i!==t&&!x){g(!0),h(!1),v.current=i,w.current=d5(n.migration);try{let t=ll(n),a=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"reconfigure",path:n.path,conversationId:r?.conversationId??n.conversationId,accountId:i,model:t.model,effort:t.effort,fast:"codex"===e?t.fast:void 0})}),s=await a.json();if(!a.ok||!s.ok)throw Error(s.error??u("accounts.switchFailed"));v.current===i&&(b.current=s.operationId??s.receipt?.operationId??null)}catch(e){v.current=null,w.current=null,g(!1),s3("err",e instanceof Error?e.message:u("accounts.switchFailed"))}}},C=(0,F.jsx)("button",{type:"button",onClick:()=>n?h(e=>!e):et(e,t),"aria-label":N,"aria-haspopup":n?"menu":void 0,"aria-expanded":n?f:void 0,"aria-busy":x||void 0,"data-conversation-account-chip":!0,className:p?"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40":"inline-flex shrink-0 items-center gap-1 rounded-full border border-border/80 px-1.5 py-0.5 font-mono text-[9.5px] text-muted hover:border-accent/45 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:p?(0,F.jsx)("span",{className:"flex h-5 w-5 items-center justify-center rounded-full font-mono text-[10px] font-bold uppercase",style:{backgroundColor:y.circleBg,color:y.dot},"aria-hidden":!0,children:x?(0,F.jsx)(i9.kr,{className:"h-3 w-3 animate-spin"}):t.charAt(0)}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:y.dot},"aria-hidden":!0}),(0,F.jsxs)("span",{children:["@ ",function(e,t=14){return e.length>t?`${e.slice(0,t-1)}…`:e}(t)]}),x?(0,F.jsx)(i9.kr,{className:"h-2.5 w-2.5 animate-spin","aria-hidden":!0}):n?(0,F.jsx)(i9.yQ,{className:"h-2.5 w-2.5","aria-hidden":!0}):null]})});return(0,F.jsxs)("span",{className:"relative inline-flex",onPointerDown:e=>e.stopPropagation(),children:[(0,F.jsx)(a3,{label:j,children:C}),f&&n?(0,F.jsxs)("div",{role:"menu","data-conversation-account-menu":!0,className:"absolute right-0 top-full z-50 mt-1 min-w-52 rounded-surface border border-border bg-raised p-1.5 font-sans text-ui shadow-2",children:[(0,F.jsx)("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-muted",children:u("accounts.conversationTitle")}),m.accounts.map(e=>{let n=e.authPresent&&!e.loginPending;return(0,F.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":e.id===t,disabled:!n||x,onClick:()=>void S(e.id),className:"flex min-h-9 w-full items-center gap-2 rounded-control px-2 py-1.5 text-left hover:bg-sunken disabled:opacity-45",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.id===t?(0,F.jsx)(i9.Jl,{className:"h-3.5 w-3.5 text-accent","aria-hidden":!0}):null]},e.id)}),(0,F.jsx)("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),et(e,t)},className:"mt-1 w-full border-t border-border px-2 pt-2 text-left text-[11px] font-semibold text-accent",children:u("accounts.manage")})]}):null,x?(0,F.jsx)("span",{className:"sr-only",role:"status",children:u("accounts.conversationPending")}):null]})}var d4=n(8747);let d6="var(--color-info)",d8=new Map;function d7(){for(let e of document.querySelectorAll("[data-link-hover]"))e.removeAttribute("data-link-hover")}function d9(e,t,n,r){let i=Math.max(48,.45*Math.abs(n-e));return`M ${e} ${t} C ${e+i} ${t}, ${n-i} ${r}, ${n} ${r}`}function ue(e){let[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(e);(0,B.useEffect)(()=>{r.current=e},[e]);let[i,a]=(0,B.useState)(null),[s,l]=(0,B.useState)(null),o=(0,B.useRef)(null),c=(0,B.useRef)(!1),d=(0,B.useRef)(!1),u=(0,B.useRef)(null),p="link-arrow-"+(0,B.useId)().replace(/[^a-zA-Z0-9-]/g,"");return(0,B.useEffect)(()=>()=>{o.current?.detach(),o.current=null,document.body.style.cursor="",d7()},[]),(0,B.useEffect)(()=>{if(!s)return;let e=window.setTimeout(()=>{d7(),l(null)},1600);return()=>window.clearTimeout(e)},[s]),{onPillPointerDown:e=>{if("mouse"===e.pointerType&&0!==e.button||o.current)return;let t=e.currentTarget.getBoundingClientRect(),i=e=>{let t=o.current;if(!t)return;if(t.lastX=e.clientX,t.lastY=e.clientY,!t.active){if(7>Math.hypot(e.clientX-t.startX,e.clientY-t.startY))return;t.active=!0,c.current=!0,d.current=!0,document.body.style.cursor="crosshair",d7(),l(null),a({x:t.anchorX,y:t.anchorY}),n(!0),r.current.onDragStart?.()}u.current?.setAttribute("d",d9(t.anchorX,t.anchorY,e.clientX,e.clientY));let i=function(e,t,n){let r=document.elementFromPoint(e,t)?.closest("[data-link-path]"),i=r?.getAttribute("data-link-path");if(!r||!i||i===n)return null;let a=d8.get(i);return a&&a.el===r?a:null}(e.clientX,e.clientY,r.current.exclude??null);i?.el!==t.hover?.el&&(t.hover?.el.removeAttribute("data-link-hover"),i?.el.setAttribute("data-link-hover","1"),t.hover=i)},s=e=>{let t=o.current;if(o.current=null,t?.detach(),c.current=!1,document.body.style.cursor="",t?.active)if(n(!1),t.hover){let n=r.current.onDrop(t.hover,{x:e.clientX,y:e.clientY});null!==n?l({label:n,from:{x:t.anchorX,y:t.anchorY},to:{x:e.clientX,y:e.clientY}}):d7()}else d7(),r.current.onMiss?.({x:e.clientX,y:e.clientY})};o.current={startX:e.clientX,startY:e.clientY,anchorX:t.right,anchorY:t.top+t.height/2,lastX:e.clientX,lastY:e.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},window.addEventListener("pointermove",i),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s)},consumeClick:()=>{let e=d.current;return d.current=!1,e},draggingRef:c,overlay:t||s?(0,t8.createPortal)((0,F.jsxs)("div",{className:"pointer-events-none fixed inset-0 z-[95]",children:[(0,F.jsxs)("svg",{className:"block h-full w-full",children:[(0,F.jsx)("defs",{children:(0,F.jsx)("marker",{id:p,markerWidth:"9",markerHeight:"9",refX:"7",refY:"4.5",orient:"auto",children:(0,F.jsx)("path",{d:"M0,0 L8,4.5 L0,9 Z",fill:d6})})}),(0,F.jsx)("path",{ref:e=>{u.current=e;let t=o.current;e&&t?.active&&e.setAttribute("d",d9(t.anchorX,t.anchorY,t.lastX,t.lastY))},d:s?d9(s.from.x,s.from.y,s.to.x,s.to.y):void 0,fill:"none",stroke:d6,strokeWidth:2.5,strokeLinecap:"round",markerEnd:`url(#${p})`}),(0,F.jsx)("circle",{cx:s?s.from.x:i?.x??0,cy:s?s.from.y:i?.y??0,r:4,fill:d6})]}),s?(0,F.jsx)(ut,{drop:s}):null]}),document.body):null}}function ut({drop:e}){let t=Math.max(8,Math.min(e.to.x+14,window.innerWidth-288)),n=Math.max(8,Math.min(e.to.y+12,window.innerHeight-44));return(0,F.jsxs)("div",{className:"fixed flex max-w-[280px] items-center gap-1.5 rounded-full px-3 py-1.5 text-[11.5px] font-semibold text-white shadow-1",style:{left:t,top:n,backgroundColor:d6},children:[(0,F.jsx)(d4.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:"truncate",children:e.label})]})}function un({file:e,onDeleted:t}){let{t:n}=(0,er.Ym)(),r=rq(),[i,a]=(0,B.useState)(!1),[s,l]=(0,B.useState)(!1),[o,c]=(0,B.useState)("");if((0,B.useEffect)(()=>{if(!i)return;let e=window.setTimeout(()=>a(!1),5e3);return()=>window.clearTimeout(e)},[i]),"running"===e.proc)return null;let d=async()=>{l(!0),c("");try{let r=await fetch(`/api/log?path=${encodeURIComponent(e.path)}`,{method:"DELETE"}),i=await r.json();if(!r.ok||!i.ok)return void c(i.error??n("common.failedDelete"));a(!1),t?.()}catch{c(n("common.serverUnavailable"))}finally{l(!1)}};return i?(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-danger/30 bg-danger-soft px-1.5 py-0.5 text-[11px]",children:[(0,F.jsx)("span",{className:"px-0.5 font-semibold text-danger",children:n("delFile.confirm")}),(0,F.jsx)("button",{type:"button",className:`inline-flex items-center rounded-lg bg-danger font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/50 ${r?"min-h-11 px-3":"px-2 py-0.5"}`,disabled:s,onClick:d,children:s?"…":n("common.yes")}),(0,F.jsx)("button",{type:"button",className:`inline-flex items-center rounded-lg border border-border bg-card font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"min-h-11 px-3":"px-2 py-0.5"}`,onClick:()=>a(!1),children:n("common.no")})]}):(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1",children:[(0,F.jsx)("button",{type:"button",className:`inline-flex items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"h-11 w-11":"px-1.5 py-0.5"}`,"aria-label":n("delFile.aria"),title:n("delFile.aria"),onClick:()=>a(!0),children:(0,F.jsx)(i9.TB,{className:r?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),o?(0,F.jsx)("span",{className:"max-w-[160px] truncate text-[10.5px] font-semibold text-danger",title:o,children:o}):null]})}let ur=new Set,ui=-1/0,ua=-1/0,us=0,ul=!1;function uo(){for(let e of(us=0,ur)){let t=function(e,t,n,r){let i=Math.max(e.left-t,0,t-e.right),a=Math.max(e.top-n,0,n-e.bottom);return i*i+a*a<=r*r}(e.el.getBoundingClientRect(),ui,ua,e.radius);t!==e.near&&(e.near=t,e.notify(t))}}function uc(e){ui=e.clientX,ua=e.clientY,0===us&&(us=requestAnimationFrame(uo))}function ud({id:e,cardRef:t,touch:n=!1}){let r=cC(),{t:i}=(0,er.Ym)(),a=r?.has(e)??!1,s=function(e,t=!0){let[n,r]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{let n=t?e.current:null;if(!n)return void r(!1);let i={el:n,radius:88,near:!1,notify:r};return ur.add(i),ul||(ul=!0,window.addEventListener("pointermove",uc,{passive:!0})),()=>{ur.delete(i),!(ur.size>0)&&ul&&(ul=!1,window.removeEventListener("pointermove",uc),0!==us&&(cancelAnimationFrame(us),us=0))}},[e,88,t]),n}(t,!n&&!a);if(!r||a&&!n)return null;let l=a||n||s,o=i(a?"branch.unfavorite":"branch.favorite");return(0,F.jsx)("button",{type:"button","data-scheme-ui":!0,"data-favorite-crown":a?"on":"off","data-crown-hidden":l?void 0:"true","aria-pressed":a,"aria-label":o,title:o,onClick:t=>{t.stopPropagation(),r.toggle(e)},className:`favorite-crown group/crown inline-flex shrink-0 items-center justify-center rounded-[8px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"h-11 w-11":"h-6 w-6"} ${l?"opacity-100":"pointer-events-none opacity-0"} ${a?"is-favorite":""}`,children:(0,F.jsx)(z.A,{"aria-hidden":!0,className:`${n?"h-5 w-5":"h-4 w-4"} transition-[color,fill,filter,transform] duration-200 ${a?"fill-crown text-crown drop-shadow-[0_0_5px_color-mix(in_srgb,var(--color-crown)_65%,transparent)]":"text-muted [stroke-dasharray:2_3] group-hover/crown:fill-crown group-hover/crown:text-crown group-hover/crown:[stroke-dasharray:0]"}`})})}function uu({id:e,touch:t=!1}){let n=cC(),{t:r}=(0,er.Ym)();if(t||!n?.has(e))return null;let i=r("branch.unfavorite");return(0,F.jsx)("button",{type:"button","data-scheme-ui":!0,"data-favorite-marker":"on","aria-pressed":!0,"aria-label":i,title:i,onClick:t=>{t.stopPropagation(),n.toggle(e)},className:"favorite-crown-marker absolute -top-2.5 right-3 z-[3] inline-flex h-6 w-6 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(z.A,{className:"h-4 w-4 fill-crown text-crown drop-shadow-[0_1px_2px_color-mix(in_srgb,var(--color-crown)_55%,transparent)]","aria-hidden":!0})})}var up=n(2571);function um({predecessorLabel:e}){let{t}=(0,er.Ym)();return e?(0,F.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-sunken px-2.5 py-1 text-[10.5px] font-semibold text-muted",children:[(0,F.jsx)("span",{"aria-hidden":!0,children:"⇄"}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:t("migrate.divider",{label:e})})]}):null}let uf={pending:"border-warning/45 bg-warning-soft text-warning",switching:"border-accent/35 bg-accent/5 text-accent",failed:"border-danger/40 bg-danger-soft text-danger"};function uh({state:e,targetLabel:t,currentLabel:n,error:r,actionError:i,onRetry:a,onKeep:s}){let{t:l}=(0,er.Ym)();return"pending"!==e&&"switching"!==e&&"failed"!==e?null:(0,F.jsxs)("div",{role:"status","aria-label":l("migrate.ribbonAria"),className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b px-2.5 py-1 text-[11px] font-semibold ${uf[e]}`,children:["pending"===e?(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)(_.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:l("migrate.cardPending")})]}):null,"switching"===e?(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)(up.A,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:l("migrate.cardSwitching",{label:t})})]}):null,"failed"===e?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)(_.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,F.jsxs)("span",{className:"min-w-0 truncate",title:r??void 0,children:[l("migrate.cardFailed"),r?` — ${r}`:""]})]}),(0,F.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[a?(0,F.jsxs)("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1 rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)(ae.A,{className:"h-3 w-3","aria-hidden":!0})," ",l("migrate.cardRetry")]}):null,s&&n?(0,F.jsx)("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:l("migrate.cardKeep",{label:n})}):null]})]}):null,i?(0,F.jsx)("span",{role:"alert","aria-live":"assertive",className:"w-full text-[10.5px] font-semibold text-danger",title:i,children:l("migrate.recoveryFailed",{detail:i})}):null]})}function ux({file:e}){let{level:t,slots:n}=(0,tt.IR)(e);if(!t)return null;let{color:r}=(0,tt.oC)(e),i=(0,tt.$)(e);return(0,F.jsx)("span",{"data-effort-pills":!0,className:"reasoning-slot inline-flex h-[12px] shrink-0 items-end gap-px",role:"img","aria-label":i,title:i,children:Array.from({length:n},(e,n)=>(0,F.jsx)("span",{"aria-hidden":!0,className:"shrink-0 rounded-full",style:{width:"3px",height:`${7+n}px`,backgroundColor:n<t?r:"var(--color-border)"}},n))})}async function ug(e){try{if("u">typeof navigator&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return!1}function ub({t:e,label:t,value:n}){let[r,i]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>i(!1),1600);return()=>window.clearTimeout(e)},[r]),(0,F.jsxs)("div",{className:"flex items-stretch gap-1.5",children:[(0,F.jsx)("code",{className:"min-w-0 flex-1 overflow-x-auto whitespace-pre rounded-control border border-border bg-sunken px-2 py-1.5 font-mono text-[11.5px] leading-relaxed text-primary",children:n}),(0,F.jsxs)("button",{type:"button","aria-label":t,title:t,onClick:()=>void ug(n).then(e=>e&&i(!0)),className:"inline-flex min-h-11 shrink-0 items-center gap-1 self-stretch rounded-control border border-border bg-canvas px-2.5 text-label font-semibold text-secondary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:py-1",children:[r?(0,F.jsx)(i9.Jl,{className:"h-3.5 w-3.5 text-success","aria-hidden":!0}):(0,F.jsx)(i9.QR,{className:"h-3.5 w-3.5","aria-hidden":!0}),e(r?"attach.copied":"attach.copy")]})]})}function uv({t:e,loading:t,error:n,command:r,live:i=null,onClose:a,onSecondary:s,secondaryBusy:l=!1,secondaryError:o=null}){let c=s?(0,F.jsxs)("button",{type:"button",onClick:s,disabled:l,className:"inline-flex min-h-11 items-center gap-1.5 rounded-control border border-border bg-canvas px-3 text-label font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 sm:min-h-9",children:[l?(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,e("attach.secondaryViewer")]}):null,d=o?(0,F.jsx)("p",{role:"alert",className:"w-full text-caption font-semibold text-danger",children:o}):null;return(0,F.jsx)("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/40 p-3",role:"presentation",onClick:e=>{e.target===e.currentTarget&&a()},children:(0,F.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":e("attach.dialogTitle"),className:"flex max-h-[85vh] w-full max-w-[560px] flex-col gap-3 overflow-y-auto rounded-surface border border-border bg-card p-4 shadow-2",children:[(0,F.jsxs)("div",{className:"flex items-start gap-2",children:[(0,F.jsx)(i9.ke,{className:"mt-0.5 h-4 w-4 shrink-0 text-accent","aria-hidden":!0}),(0,F.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,F.jsx)("h2",{className:"text-body font-bold text-primary",children:e("attach.dialogTitle")}),i?(0,F.jsx)("p",{className:"mt-0.5 text-label text-muted",children:e("attach.hint")}):r?(0,F.jsx)("p",{className:"mt-0.5 text-label text-muted",children:e("attach.dialogIntro",{account:r.accountLabel})}):null]}),(0,F.jsx)("button",{type:"button",onClick:a,"aria-label":e("common.close"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8 sm:w-8",children:(0,F.jsx)(i9.X,{className:"h-4 w-4","aria-hidden":!0})})]}),t?(0,F.jsxs)("div",{role:"status","aria-live":"polite",className:"flex items-center gap-2 py-4 text-label font-semibold text-muted",children:[(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0})," ",e("attach.loading")]}):n?(0,F.jsx)("div",{role:"alert",className:"rounded-control border border-danger/45 bg-danger-soft px-3 py-2 text-label font-semibold text-danger",children:n}):i?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(ub,{t:e,label:e("attach.copy"),value:i.command}),(0,F.jsx)(ub,{t:e,label:e("attach.copyReadonly"),value:i.readOnlyCommand}),(0,F.jsxs)("div",{className:"flex items-start gap-1.5 text-caption font-semibold text-muted",children:[(0,F.jsx)(i9.ke,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{children:e("attach.readonlyHint")})]}),(0,F.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-border pt-3",children:[(0,F.jsxs)("button",{type:"button",onClick:()=>void ug(i.command),className:"inline-flex min-h-11 items-center gap-1.5 rounded-control border border-accent bg-accent px-3 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:min-h-9",children:[(0,F.jsx)(i9.QR,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",e("attach.copyFull")]}),c,d]})]}):r?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(ub,{t:e,label:e("attach.copyCwd"),value:r.cdCommand}),(0,F.jsx)(ub,{t:e,label:e("attach.copyCommand"),value:r.command}),"subagent-root"===r.note?(0,F.jsx)("p",{className:"text-caption text-muted",children:e("attach.subagentNote")}):null,(0,F.jsxs)("div",{className:"flex items-start gap-1.5 text-caption font-semibold text-warning",children:[(0,F.jsx)(_.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{children:e("attach.takeoverWarning")})]}),(0,F.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-border pt-3",children:[(0,F.jsxs)("button",{type:"button",onClick:()=>void ug(r.fullCommand),className:"inline-flex min-h-11 items-center gap-1.5 rounded-control border border-accent bg-accent px-3 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:min-h-9",children:[(0,F.jsx)(i9.QR,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",e("attach.copyFull")]}),c,d]})]}):null]})})}function uw({file:e,onClose:t,mode:n="resume"}){let{t:r}=(0,er.Ym)(),[i,a]=(0,B.useState)(null),[s,l]=(0,B.useState)(null),[o,c]=(0,B.useState)(null),[d,u]=(0,B.useState)(!0),[p,m]=(0,B.useState)(!1),[f,h]=(0,B.useState)(null);(0,B.useEffect)(()=>{let t=!1;return("live"===n?fetch(`/api/tmux?attach=1&path=${encodeURIComponent(e.path)}`).then(async e=>{let n=await e.json().catch(()=>({}));t||(e.ok&&n.attach?l({command:n.attach.command,readOnlyCommand:n.attach.readOnlyCommand}):c(n.error??r("attach.unavailable")))}):fetch(`/api/attach-command?path=${encodeURIComponent(e.path)}`).then(async e=>{let n=await e.json().catch(()=>({}));t||(e.ok?a(n):c(n.error??r("attach.unavailable")))})).catch(()=>{t||c(r("attach.network"))}).finally(()=>{t||u(!1)}),()=>{t=!0}},[e.path,n]);let x=async()=>{if(!p){m(!0),h(null);try{let t=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"attach-terminal",path:e.path})});if(!t.ok){let e=await t.json().catch(()=>({}));h(e.error??r("attach.secondaryFailed"))}}catch{h(r("attach.secondaryFailed"))}finally{m(!1)}}};return(0,F.jsx)(uv,{t:r,loading:d,error:o,command:i,live:s,onClose:t,onSecondary:()=>void x(),secondaryBusy:p,secondaryError:f})}function uy({t:e,cap:t,ariaLabel:n,hint:r,busy:i,onClick:a,children:s,className:l="",isMobile:o}){let c="disabled"===t.state,d=c?e(t.reason):"enabled"===t.state&&t.note?e(t.note):"",u=d?`${e(n)} — ${d}`:e(n);return(0,F.jsx)(a3,{label:d||e(r),children:(0,F.jsx)("button",{type:"button","aria-label":u,"aria-disabled":c||void 0,disabled:c||i,onClick:a,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-control text-muted hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${o?"h-11 w-11":"p-2"} ${l}`,children:i?(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):s})})}function uk({t:e,surface:t}){let n=(()=>{switch(t){case"structured":return null;case"live-subagent":return{icon:(0,F.jsx)(i9.eW,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),label:e("composer.root"),title:e("composer.titleRelay")};case"resume":return{icon:(0,F.jsx)(i9.jG,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),label:e("strip.resume"),title:e("composer.titleSpawnResumed")};case"dead":return{icon:(0,F.jsx)(i9.ke,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),label:e("strip.deadMode"),title:e("deadHost.body")};default:return{icon:(0,F.jsx)(i9.ke,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),label:e("strip.live"),title:e("branch.live")}}})();return n?(0,F.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-control bg-sunken px-1.5 py-1 text-caption font-semibold text-secondary",title:n.title,children:[n.icon,(0,F.jsx)("span",{className:"truncate",children:n.label})]}):null}function uj({t:e,isMobile:t,caps:n,layout:r,compactArmed:i,stopBusy:a,compactBusy:s,recheckBusy:l=!1,overflowOpen:o,onStop:c,onCompact:d,onRecheck:u=()=>void 0,onTerminal:p,onToggleOverflow:m,status:f}){let{controls:h,surface:x}=n,g=t||"full"!==r,b=g&&("hidden"!==h.compact.state||"hidden"!==h.terminal.state),v="hidden"!==h.stop.state?(0,F.jsx)(uy,{t:e,isMobile:t,cap:h.stop,ariaLabel:"composer.interruptAria",hint:"composer.interruptTitle",busy:a,onClick:c,className:"hover:text-danger",children:(0,F.jsx)(i9.M6,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})}):null,w=(0,F.jsx)(uy,{t:e,isMobile:t,cap:{state:"enabled"},ariaLabel:"deadHost.recheck",hint:"strip.recheckHint",busy:l,onClick:u,className:"hover:text-accent",children:(0,F.jsx)(i9.kt,{className:"h-4 w-4","aria-hidden":!0})}),y="hidden"!==h.compact.state?(0,F.jsx)(uy,{t:e,isMobile:t,cap:h.compact,ariaLabel:"composer.compactAria",hint:i?"composer.compactConfirmTitle":"composer.compactTitle",busy:s,onClick:d,className:i?"bg-info/10 text-info":"hover:text-info",children:i?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(i9.Jl,{className:"h-4 w-4","aria-hidden":!0}),(0,F.jsx)("span",{className:"text-[10.5px] font-bold",children:e("composer.compactConfirm")})]}):(0,F.jsx)(i9.O0,{className:"h-4 w-4","aria-hidden":!0})}):null,k="hidden"!==h.terminal.state?(0,F.jsx)(uy,{t:e,isMobile:t,cap:h.terminal,ariaLabel:"attach.dialogTitle",hint:"attach.dialogTitle",onClick:p,className:"hover:text-accent",children:(0,F.jsx)(i9.ke,{className:"h-4 w-4","aria-hidden":!0})}):null;return(0,F.jsxs)("div",{"data-agent-control-strip":!0,"data-strip-surface":x,"data-strip-layout":r,className:"flex shrink-0 flex-col gap-1 border-t border-border bg-card px-2.5 py-1.5",children:[(0,F.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,F.jsx)(uk,{t:e,surface:x}),v,w,g?null:y,g?null:k,b?(0,F.jsx)(a3,{label:e("strip.moreActions"),children:(0,F.jsx)("button",{type:"button","aria-expanded":o,"aria-label":e("strip.moreActions"),onClick:m,className:`inline-flex shrink-0 items-center justify-center rounded-control text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${t?"h-11 w-11":"p-2"}`,children:(0,F.jsx)(cg.A,{className:"h-4 w-4","aria-hidden":!0})})}):null]}),b&&o?(0,F.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[y,k]}):null,f?(0,F.jsx)("span",{role:"status","aria-live":"err"===f.kind?"assertive":"polite",className:`truncate text-caption font-semibold ${"ok"===f.kind?"text-success":"info"===f.kind?"text-warning":"text-danger"}`,children:f.text}):null]})}function uN({file:e}){let{t}=(0,er.Ym)(),r=rq(),{caps:i,attachMode:a,structuredSession:s}=lF(e),l=(0,B.useRef)(null),[o,c]=(0,B.useState)("full"),[d,u]=(0,B.useState)(!1),[p,m]=(0,B.useState)(!1),[f,h]=(0,B.useState)(!1),[x,g]=(0,B.useState)(!1),[b,v]=(0,B.useState)(!1),[w,y]=(0,B.useState)(!1),[k,j]=(0,B.useState)(null),N=async()=>{if("live"===a)return void y(!0);j(null);try{let r=await fetch(`/api/attach-command?path=${encodeURIComponent(e.path)}`),i=await r.json();if(r.ok&&i.fullCommand){let{copyText:e}=await Promise.resolve().then(n.bind(n,8074));if(await e(i.fullCommand))return void j({kind:"ok",text:t("attach.copiedFull")})}}catch{}y(!0)},S=(0,B.useCallback)(e=>{if(l.current?.disconnect(),l.current=null,!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??999;c(t>=430?"full":t>=300?"narrow":"mini")});t.observe(e),l.current=t},[]);if((0,B.useEffect)(()=>{if(!b)return;let e=window.setTimeout(()=>v(!1),4e3);return()=>window.clearTimeout(e)},[b]),!lL.some(e=>"hidden"!==i.controls[e].state))return null;let C=async()=>{if(!p){m(!0),j(null);try{var n,r;let i=s?await (n=s.session.conversationId,r=nU(),aq("/api/runtime/interrupt",{conversationId:n,operationId:r})):await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:e.path})}).then(async e=>{let t=await e.json();return{ok:e.ok&&!0===t.ok,error:t.error}});j(i.ok?{kind:"ok",text:t("composer.escapeSent")}:{kind:"err",text:i.error??t("composer.failedInterrupt")})}catch{j({kind:"err",text:t("common.serverUnavailable")})}finally{m(!1)}}},A=async()=>{if(!x){g(!0),j(null);try{await az()||j({kind:"err",text:t("deadHost.recheckFailed")})}finally{g(!1)}}},I=async()=>{if(!b)return void v(!0);if(v(!1),!f){h(!0),j(null);try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:e.path})}),r=await n.json();j(n.ok&&r.ok?{kind:"ok",text:t("composer.compactSent")}:{kind:"err",text:r.error??t("composer.failedCompact")})}catch{j({kind:"err",text:t("common.serverUnavailable")})}finally{h(!1)}}};return(0,F.jsxs)("div",{ref:S,children:[(0,F.jsx)(uj,{t:t,isMobile:r,caps:i,layout:o,compactArmed:b,stopBusy:p,compactBusy:f,recheckBusy:x,overflowOpen:d,onStop:()=>void C(),onCompact:()=>void I(),onRecheck:()=>void A(),onTerminal:()=>void N(),onToggleOverflow:()=>u(e=>!e),status:k}),w?(0,F.jsx)(uw,{file:e,mode:a,onClose:()=>y(!1)}):null]})}function uS({t:e,sinceLabel:t,onRespawn:n,onAttach:r,onRecheck:i,respawnBusy:a=!1,recheckBusy:s=!1,respawnError:l=null,recheckError:o=null}){return(0,F.jsxs)("div",{role:"status","aria-live":"polite","data-dead-host-banner":!0,className:"shrink-0 border-b border-danger/45 bg-danger-soft px-2.5 py-1",children:[(0,F.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[(0,F.jsx)(_.A,{className:"h-3.5 w-3.5 shrink-0 text-danger","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-label font-bold text-danger",children:e("deadHost.title",{since:t})}),(0,F.jsxs)("button",{type:"button",onClick:n,disabled:a,className:"inline-flex min-h-7 items-center gap-1 rounded-control border border-accent bg-accent px-2 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-60 [@media(pointer:coarse)]:min-h-11",children:[a?(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,F.jsx)(i9.jG,{className:"h-3.5 w-3.5","aria-hidden":!0}),e("deadHost.respawn")]}),(0,F.jsx)("button",{type:"button",onClick:r,title:e("deadHost.attach"),"aria-label":e("deadHost.attach"),className:"inline-flex min-h-7 items-center gap-1 rounded-control border border-border bg-canvas px-2 text-label font-semibold text-secondary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [@media(pointer:coarse)]:min-h-11",children:(0,F.jsx)(i9.ke,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,F.jsx)("button",{type:"button",onClick:i,disabled:s,title:e("deadHost.recheck"),"aria-label":e("deadHost.recheck"),className:"inline-flex min-h-7 items-center rounded-control border border-border bg-canvas px-1.5 text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 [@media(pointer:coarse)]:min-h-11",children:s?(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,F.jsx)(ae.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),l?(0,F.jsx)("p",{role:"alert",className:"mt-1 text-caption font-semibold text-danger",children:l}):null,o?(0,F.jsx)("p",{role:"alert",className:"mt-1 text-caption font-semibold text-danger",children:o}):null]})}function uC({file:e}){let{t}=(0,er.Ym)(),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),[s,l]=(0,B.useState)(!1),[o,c]=(0,B.useState)(null),[d,u]=(0,B.useState)(null),p=async()=>{if(!i){a(!0),c(null),u(null);try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:e.path})});if(n.ok)await az()||u(t("deadHost.recheckFailed"));else{let e=await n.json().catch(()=>({}));c(e.error??t("deadHost.respawnFailed"))}}catch{c(t("deadHost.respawnFailed"))}finally{a(!1)}}},m=async()=>{s||(l(!0),u(null),await az()||u(t("deadHost.recheckFailed")),l(!1))};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(uS,{t:t,sinceLabel:(0,tt.rK)(e.mtime),onRespawn:()=>void p(),onAttach:()=>r(!0),onRecheck:()=>void m(),respawnBusy:i,recheckBusy:s,respawnError:o,recheckError:d}),n?(0,F.jsx)(uw,{file:e,onClose:()=>r(!1)}):null]})}var uA=n(5097),uI=n(467);function uM({t:e,sinceLabel:t,onOpenSuccessor:n,onResumeHere:r,resumeBusy:i=!1,resumeError:a=null}){return(0,F.jsxs)("div",{role:"status","aria-live":"polite","data-superseded-banner":!0,className:"flex shrink-0 flex-col gap-1.5 border-b border-border bg-sunken px-2.5 py-2",children:[(0,F.jsxs)("div",{className:"flex items-center gap-1.5 text-label font-bold text-secondary",children:[(0,F.jsx)(uA.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:e("superseded.title",{since:t})})]}),(0,F.jsx)("p",{className:"text-caption font-semibold text-muted",children:e("superseded.body")}),(0,F.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,F.jsxs)("button",{type:"button",onClick:n,className:"inline-flex min-h-11 items-center gap-1 rounded-control border border-accent bg-accent px-2.5 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:min-h-8",children:[e("superseded.open")," ",(0,F.jsx)(uI.A,{className:"h-3.5 w-3.5","aria-hidden":!0})]}),(0,F.jsxs)("button",{type:"button",onClick:r,disabled:i,className:"inline-flex min-h-11 items-center gap-1 rounded-control border border-border bg-canvas px-2.5 text-label font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 sm:min-h-8",children:[i?(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,F.jsx)(i9.jG,{className:"h-3.5 w-3.5","aria-hidden":!0}),e("superseded.resumeHere")]})]}),a?(0,F.jsx)("p",{role:"alert",className:"text-caption font-semibold text-danger",children:a}):null]})}function uT({file:e}){let{t}=(0,er.Ym)(),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(null),s=e.supersededBy;if(!s)return null;let l=Date.parse(s.at)/1e3,o=(0,tt.rK)(Number.isFinite(l)?l:e.mtime),c=async()=>{if(!n&&window.confirm(t("superseded.resumeConfirm"))){r(!0),a(null);try{let n=await fetch("/api/session/supersedence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({conversationId:e.conversationId,action:"clear"})});if(!n.ok){let e=await n.json().catch(()=>({}));a(e.error??t("superseded.resumeFailed"))}}catch{a(t("superseded.resumeFailed"))}finally{r(!1)}}};return(0,F.jsx)(uM,{t:t,sinceLabel:o,onOpenSuccessor:()=>{window.location.hash="#c="+encodeURIComponent(s.tailConversationId??s.conversationId)},onResumeHere:()=>void c(),resumeBusy:n,resumeError:i})}function u$({className:e,style:t,enter:n="scale",children:r}){let i=(0,B.useRef)(null);return!function(e,t="scale"){let n=(0,B.useRef)(new Map),r=(0,B.useRef)(new WeakMap),i=(0,B.useRef)(!0);(0,B.useLayoutEffect)(()=>{let a=e.current;if(!a)return;let s="u">typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,l=a.getBoundingClientRect(),o=[...a.children].filter(e=>e instanceof HTMLElement&&void 0!==e.dataset.flipKey),c=new Map;for(let e of o){let o=e.dataset.flipKey,d=e.getBoundingClientRect(),u=r.current.get(e);u&&(u.cancel(),r.current.delete(e));let p=e.getBoundingClientRect(),m={x:p.left-l.left+a.scrollLeft,y:p.top-l.top+a.scrollTop},f=n.current.get(o);if(c.set(o,m),s||i.current||void 0!==e.dataset.flipSkip)continue;if(!f){if("none"===t)continue;let n="fade"===t?[{opacity:0},{opacity:1}]:[{opacity:0,transform:"scale(0.96)"},{opacity:1,transform:"scale(1)"}],i=e.animate(n,{duration:"fade"===t?120:240,easing:"ease-out"});r.current.set(e,i),i.addEventListener("finish",()=>r.current.delete(e));continue}let h=f.x-m.x+(d.left-p.left),x=f.y-m.y+(d.top-p.top);if(2>Math.abs(h)&&2>Math.abs(x))continue;let g=e.animate([{transform:`translate(${h}px, ${x}px)`},{transform:"translate(0px, 0px)"}],{duration:280,easing:"cubic-bezier(0.22, 0.72, 0.3, 1)"});r.current.set(e,g),g.addEventListener("finish",()=>r.current.delete(e))}n.current=c,i.current=!1})}(i,n),(0,F.jsx)("div",{ref:i,className:e,style:t,children:r})}var uE=n(7990),uR=n(4760);let uP=new Set,uO=null,uD=null,uL=null,uF=null,u_=!1,uq=!1,uz=!1,uH=!1,uB=0,uU=new Map;function uK(e,t){return e&&t(e),null}function uY(){uB+=1,uF?.close(),uF=null,uU=new Map}function uW(){uO=uK(uO,clearInterval)}async function uJ(){if(0!==uP.size){if(u_){uq=!0;return}u_=!0;try{let e=[...uP];for(let t=0;t<e.length;t+=64){let n=e.slice(t,t+64),r=n.map((e,t)=>({id:String(t),path:e.path,offset:e.getOffset()})),i={},a=!1;try{let e=await fetch("/api/logs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({reqs:r})});i=(await e.json()).chunks??{}}catch{a=!0}for(let e=0;e<n.length;e+=1){let t=n[e];if(uP.has(t))if(a)t.onChunk({transportError:!0});else{let n=i[String(e)];n&&t.onChunk(n)}}}}finally{u_=!1,uq&&(uq=!1,uJ())}}}function uV(){uz||(uz=!0,setTimeout(()=>{uz=!1,uH&&uJ()},0))}function uG(){0!==uP.size&&(uY(),uH=!0,null===uO&&(uO=setInterval(()=>void uJ(),1200)),uV(),uD=uK(uD,clearTimeout),uD=setTimeout(()=>{uD=null,0!==uP.size&&(uH=!1,uW(),uQ(0))},6e4))}function uX(){if(uL=uK(uL,clearTimeout),0===uP.size)return;if("u"<typeof EventSource||uP.size>64)return void uG();uH=!1,uW(),uD=uK(uD,clearTimeout),uY();let e=uB,t=[...uP],n=t.map((e,t)=>({id:String(t),path:e.path,offset:e.getOffset()}));uU=new Map(n.map((e,n)=>[e.id,t[n]]));let r=new EventSource(`/api/logs/stream?subs=${encodeURIComponent(JSON.stringify(n))}`);uF=r,r.addEventListener("chunk",t=>{let n;if(e===uB&&r===uF){try{n=JSON.parse(t.data)}catch{return}if("string"==typeof n.id&&n.chunk&&"object"==typeof n.chunk){var i,a;let e;i=n.id,a=n.chunk,(e=uU.get(i))&&uP.has(e)&&e.onChunk(a)}}}),r.onerror=()=>{if(e===uB&&r===uF){for(let e of uP)e.onChunk({transportError:!0});uG()}}}function uQ(e=300){uH?uV():(uL=uK(uL,clearTimeout),uL=setTimeout(uX,e))}let uZ=e=>new TextEncoder().encode(e).length,u0=new Map;function u1(e,t){let n=t>0?Math.min(t,6e3):6e3;if(e.win.lines.length<=n)return e;let r=e.win.lines.slice(0,e.win.lines.length-n),i=r.reduce((e,t)=>e+uZ(t+"\n"),0);return{...e,win:{lines:e.win.lines.slice(-n),start:e.win.start+r.length},historyStart:e.historyStart+i,hasMore:!0}}function u2(e,t){let n=u0.get(e);if(!n)return null;u0.delete(e);let r=u1(n,t);return u0.set(e,r),r}var u5=n(9103),u3=n(4962),u4=n(4890);let u6={starting:up.A,binding:up.A,queued:u5.A,reconciling:up.A,"recoverable-timeout":u5.A,"live-late-success":u3.A,failed:u4.A,recovered:u3.A};function u8({launch:e,t,onRetry:n}){var r,i;let a=u6[e.state],s=t(`spawnCard.${e.state}`),l=t(`spawnCard.initial.${e.initialMessage}`);return(0,F.jsxs)("div",{"data-launch-chips":!0,"data-launch-state":e.state,"data-launch-initial":e.initialMessage,className:"my-2 flex flex-wrap items-center gap-1.5",role:"status","aria-live":"failed"===e.state?"assertive":"polite",children:[(0,F.jsxs)("span",{"data-launch-chip":"state",title:s,className:`inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border px-2 py-0.5 text-caption font-semibold ${"failed"===(r=e.state)?"border-danger/45 bg-danger-soft text-danger":"live-late-success"===r||"recovered"===r?"border-success/45 bg-success-soft text-success":"queued"===r||"recoverable-timeout"===r?"border-warning/45 bg-warning-soft text-warning":"border-border bg-sunken text-secondary"}`,children:[(0,F.jsx)(a,{className:`h-3 w-3 shrink-0 ${"starting"===(i=e.state)||"binding"===i||"reconciling"===i?"animate-spin motion-reduce:animate-none":""}`,"aria-hidden":!0}),(0,F.jsx)("span",{className:"truncate",children:t(`spawnChip.${e.state}`)}),(0,F.jsx)("span",{className:"sr-only",children:s})]}),(0,F.jsxs)("span",{"data-launch-chip":"initial",title:l,className:"inline-flex min-w-0 max-w-full items-center rounded-full border border-border bg-sunken px-2 py-0.5 text-caption font-semibold text-muted",children:[(0,F.jsx)("span",{className:"truncate",children:t(`spawnChip.initial.${e.initialMessage}`)}),(0,F.jsx)("span",{className:"sr-only",children:l})]}),(0,F.jsx)("span",{"data-launch-chip":"id",title:t("spawnCard.launch",{id:e.launchId}),className:"inline-flex shrink-0 items-center rounded-full border border-border/70 px-2 py-0.5 font-mono text-caption text-muted/80",children:e.launchId.slice(0,8)}),e.error?(0,F.jsx)("span",{"data-launch-chip":"error",className:"min-w-0 basis-full break-words text-caption font-semibold text-danger",children:e.error}):null,"failed"===e.state&&e.retrySafe&&n?(0,F.jsxs)("button",{type:"button","data-launch-retry":!0,onClick:n,title:t("spawnCard.retrySafe"),className:"inline-flex min-h-8 shrink-0 items-center gap-1 rounded-full border border-border bg-card px-2 text-caption font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [@media(pointer:coarse)]:min-h-11",children:[(0,F.jsx)(ae.A,{className:"h-3 w-3","aria-hidden":!0})," ",t("launchHistory.retryLabel")]}):null]})}function u7({launch:e,onRetry:t}){let{t:n}=(0,er.Ym)();return(0,F.jsx)(u8,{launch:e,t:n,onRetry:t})}var u9=n(8074);let pe={ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",typescript:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",javascript:"javascript",json:"json",jsonc:"json",sh:"bash",bash:"bash",zsh:"bash",shell:"bash",py:"python",python:"python",md:"markdown",markdown:"markdown",yml:"yaml",yaml:"yaml",css:"css",scss:"css",go:"go",html:"xml",xml:"xml",svg:"xml"},pt=null;async function pn(){try{let e=(await n.e(7067).then(n.bind(n,7067))).default,[t,r,i,a,s,l,o,c,d,u]=await Promise.all([n.e(3015).then(n.bind(n,3015)),n.e(9583).then(n.bind(n,9583)),n.e(7774).then(n.bind(n,7774)),n.e(6370).then(n.bind(n,6370)),n.e(2462).then(n.bind(n,2462)),n.e(2345).then(n.bind(n,2345)),n.e(1783).then(n.bind(n,1783)),n.e(8327).then(n.bind(n,8327)),n.e(858).then(n.bind(n,858)),n.e(7297).then(n.bind(n,7297))]);return e.registerLanguage("typescript",t.default),e.registerLanguage("javascript",r.default),e.registerLanguage("json",i.default),e.registerLanguage("bash",a.default),e.registerLanguage("python",s.default),e.registerLanguage("markdown",l.default),e.registerLanguage("yaml",o.default),e.registerLanguage("css",c.default),e.registerLanguage("go",d.default),e.registerLanguage("xml",u.default),e}catch{return null}}var pr=n(6565);function pi({src:e,alt:t,caption:n,onClose:r}){let{t:i}=(0,er.Ym)(),[a,s]=(0,B.useState)(1),[l,o]=(0,B.useState)(0),[c,d]=(0,B.useState)(0),[u,p]=(0,B.useState)(!1),m=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=e=>{"Escape"===e.key&&r()};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[r]);let f=(e,t=0,n=0)=>{let r=Math.min(8,Math.max(.25,a*e)),i=r/a;s(r),o(t-(t-l)*i),d(n-(n-c)*i)},h=()=>{s(1),o(0),d(0)};return(0,t8.createPortal)((0,F.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":t,onClick:r,children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5",onClick:e=>e.stopPropagation(),children:[(0,F.jsx)("span",{className:"min-w-0 truncate text-[12.5px] font-semibold text-white/85",children:n??t}),(0,F.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[(0,F.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":i("lightbox.zoomOut"),onClick:()=>f(1/1.4),children:(0,F.jsx)(pr.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsxs)("button",{className:"rounded-lg border border-white/25 bg-white/10 px-2 py-1 text-[11.5px] font-semibold text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":i("lightbox.resetZoom"),onClick:h,children:[Math.round(100*a),"%"]}),(0,F.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":i("lightbox.zoomIn"),onClick:()=>f(1.4),children:(0,F.jsx)(cf.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsx)("button",{className:"ml-1 inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":i("common.close"),onClick:r,children:(0,F.jsx)(i9.X,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,F.jsx)("div",{className:"min-h-0 flex-1 touch-none overflow-hidden",onClick:e=>e.stopPropagation(),onWheel:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-t.width/2,r=e.clientY-t.top-t.height/2;f(e.deltaY<0?1.18:1/1.18,n,r)},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),m.current={x:e.clientX,y:e.clientY,tx:l,ty:c},p(!0)},onPointerMove:e=>{m.current&&(o(m.current.tx+(e.clientX-m.current.x)),d(m.current.ty+(e.clientY-m.current.y)))},onPointerUp:()=>{m.current=null,p(!1)},onPointerCancel:()=>{m.current=null,p(!1)},onDoubleClick:()=>1===a?f(2):h(),children:(0,F.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,F.jsx)("img",{src:e,alt:t,draggable:!1,className:`max-h-full max-w-full select-none ${u?"":"transition-transform duration-75"} ${a>1?"cursor-grab active:cursor-grabbing":"cursor-zoom-in"}`,style:{transform:`translate(${l}px, ${c}px) scale(${a})`}})})})]}),document.body)}let pa="opacity-70 transition-opacity motion-reduce:transition-none hover:opacity-100 focus-visible:opacity-100 group-hover/msg:opacity-100",ps="pr-[28px] [@media(pointer:coarse)]:pr-[50px]";var pl=n(1541);let po=/(!\[[^\]]*\]\([^)\s]+\)|`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g,pc=/^\s*!\[([^\]]*)\]\(([^)\s]+)\)\s*$/;function pd({text:e}){let[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(null);return(0,B.useEffect)(()=>()=>{null!==r.current&&window.clearTimeout(r.current)},[]),(0,F.jsx)("span",{title:t?(0,pl.tr)("common.copied"):(0,pl.tr)("common.clickToCopy"),onClick:t=>{t.preventDefault(),t.stopPropagation(),(0,u9.copyText)(e).then(e=>{e&&(n(!0),null!==r.current&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>n(!1),1400))})},className:`cursor-copy rounded-md px-1.5 py-0.5 font-mono ${t?"bg-success/15 text-success":"bg-sunken"}`,children:e})}function pu({code:e,lang:t,copyLabel:n}){let r=function(e,t){let[n,r]=(0,B.useState)(null);return(0,B.useEffect)(()=>{let n=t?pe[t.toLowerCase()]??null:null;if(!n||e.length>5e4)return;let i=!1;return(!pt&&(pt=pn()),pt).then(t=>{if(!i&&t&&t.getLanguage(n))try{let a=t.highlight(e,{language:n,ignoreIllegal:!0}).value;i||r({code:e,html:a})}catch{}}),()=>{i=!0}},[e,t]),n&&n.code===e?n.html:null}(e,t);return(0,F.jsxs)("div",{className:"group/code relative my-1.5 max-w-full",children:[r?(0,F.jsx)("pre",{className:`hljs max-w-full overflow-x-auto rounded-[10px] border border-border bg-canvas py-2 pl-3 font-mono text-[11.5px] ${ps}`,dangerouslySetInnerHTML:{__html:r}}):(0,F.jsx)("pre",{className:`max-w-full overflow-x-auto rounded-[10px] border border-border bg-canvas py-2 pl-3 font-mono text-[11.5px] ${ps}`,children:e}),(0,F.jsx)(u9.i,{text:e,label:n??(0,pl.tr)("feed.copyCode"),className:`absolute right-[6px] top-[6px] ${pa} group-hover/code:opacity-100`})]})}function pp(e){let t=e.replace(/\\([()])/g,"$1"),n=t.replace(/^file:\/\//,"");return/^(?:\/|~\/)/.test(n)?`#f=${encodeURIComponent(n.replace(/:\d+$/,""))}`:t}function pm({href:e,label:t}){let n=/^https?:\/\//.test(e);return(0,F.jsx)("a",{href:e,target:n?"_blank":void 0,rel:n?"noreferrer":void 0,title:e,className:"break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:t})}function pf({alt:e,src:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),s=function(e){let t=e.replace(/\\([()])/g,"$1");if(/^(?:https?:)?\/\//.test(t)||t.startsWith("data:"))return t;let n=t.replace(/^file:\/\//,"");return`/api/image?path=${encodeURIComponent(n)}`}(t);return i?(0,F.jsx)(pm,{href:pp(t),label:e||t}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("img",{src:s,alt:e,title:e||void 0,loading:"lazy",onClick:()=>r(!0),onError:()=>a(!0),className:"my-1 max-h-[240px] max-w-full cursor-zoom-in rounded-[10px] border border-border align-top"}),n?(0,F.jsx)(pi,{src:s,alt:e,caption:e||void 0,onClose:()=>r(!1)}):null]})}function ph({images:e}){return(0,F.jsx)("div",{className:"my-1.5 flex flex-wrap items-start gap-2",children:e.map((e,t)=>(0,F.jsx)(pf,{alt:e.alt,src:e.src},t))})}function px(e){return e.split(po).map((e,t)=>{if(!e)return null;if(e.startsWith("`")&&e.endsWith("`"))return(0,F.jsx)(pd,{text:e.slice(1,-1)},t);if(e.startsWith("**")&&e.endsWith("**"))return(0,F.jsx)("b",{children:e.slice(2,-2)},t);let n=e.match(/^!\[([^\]]*)\]\(([^)\s]+)\)$/);if(n)return(0,F.jsx)(pf,{alt:n[1],src:n[2]},t);let r=e.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);if(r)return(0,F.jsx)(pm,{href:pp(r[2]),label:r[1]},t);if(/^https?:\/\//.test(e)){let n=e.replace(/[.,;:!?…»)]+$/,""),r=e.slice(n.length),i=n.length>72?n.slice(0,69)+"…":n;return(0,F.jsxs)("span",{children:[(0,F.jsx)(pm,{href:n,label:i}),r]},t)}return e})}let pg=/^\s*\|.*\|\s*$/,pb=/^:?-{1,}:?$/;function pv({rows:e}){let t=e.map(e=>e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())),n=t.length>1&&t[1].every(e=>pb.test(e)),r=n?t[0]:null,i=n?t.slice(2):t;return(0,F.jsx)("div",{className:"my-1.5 max-w-full overflow-x-auto",children:(0,F.jsxs)("table",{className:"border-collapse text-[12.5px]",children:[r?(0,F.jsx)("thead",{children:(0,F.jsx)("tr",{children:r.map((e,t)=>(0,F.jsx)("th",{className:"border border-border bg-sunken px-2.5 py-1 text-left font-semibold",children:px(e)},t))})}):null,(0,F.jsx)("tbody",{children:i.map((e,t)=>(0,F.jsx)("tr",{children:e.map((e,t)=>(0,F.jsx)("td",{className:"border border-border px-2.5 py-1 align-top",children:px(e)},t))},t))})]})})}let pw=/^\s*```/,py=/^\s*```\s*$/;function pk(e){return e.match(/^\s*```+\s*([A-Za-z0-9+#_-]+)/)?.[1]??null}function pj(e,t){let n=e.match(/^#{1,6}\s+(.*)$/);if(n)return(0,F.jsx)("span",{className:"text-[14px] font-bold",children:px(n[1])},t);let r=e.match(/^>\s?(.*)$/);return r?(0,F.jsx)("span",{className:"border-l-2 border-border pl-2 text-muted",children:px(r[1])},t):(0,F.jsx)(B.Fragment,{children:px(e)},t)}function pN(e){let t=e.split("\n"),n=[],r=0;for(;r<t.length;){if(pw.test(t[r])){let e=r,i=pk(t[r]);for(r++;r<t.length&&!py.test(t[r]);)r++;let a=t.slice(e+1,r).join("\n");r<t.length&&r++,"\n"===n[n.length-1]&&n.pop(),n.push((0,F.jsx)(pu,{code:a,lang:i},`c${e}`));continue}if(pg.test(t[r])){let e=r;for(;r<t.length&&pg.test(t[r]);)r++;"\n"===n[n.length-1]&&n.pop(),n.push((0,F.jsx)(pv,{rows:t.slice(e,r)},`t${e}`));continue}if(pc.test(t[r])){let e=r,i=[];for(;r<t.length;){let e=t[r].match(pc);if(!e)break;i.push({alt:e[1],src:e[2]}),r++}"\n"===n[n.length-1]&&n.pop(),n.push((0,F.jsx)(ph,{images:i},`i${e}`));continue}n.push(pj(t[r],r)),++r<t.length&&n.push("\n")}return n}function pS({nodes:e}){return e}function pC(){return{chunks:[],keys:0}}function pA(e,t,n){let r=e.chunks[e.chunks.length-1];if(r&&r.nodes.length<48)return r;let i={key:e.keys++,from:t,sep:n,lines:0,nodes:[],element:null};return e.chunks.push(i),i}function pI(e){let t=e.chunks[e.chunks.length-1];t.element=(0,F.jsx)(pS,{nodes:t.nodes},t.key)}function pM(e){return e.chunks.map(e=>e.element)}function pT(){return{stableChars:0,stableLines:0,lineStart:!0,region:pC(),run:null,sep:!1,provisional:!1,anchor:"",source:"",streaming:!1,rendered:null,keys:0}}function p$(e,t){var n,r;let i=e.run,a=e.region.chunks[e.region.chunks.length-1];a.nodes.length=i.slot;let{node:s,block:l}=(n=i,r=t,"images"===n.kind?{node:(0,F.jsx)(ph,{images:n.images},`i${n.key}`),block:!0}:"table"===n.kind?!r&&n.rows.length<2?{node:pj(n.rows[0],`p${n.key}`),block:!1}:{node:(0,F.jsx)(pv,{rows:n.rows},`t${n.key}`),block:!0}:r?(n.joined??=n.code.join("\n"),{node:(0,F.jsx)(pu,{code:n.joined,lang:n.lang},`c${n.key}`),block:!0}):{node:(0,F.jsx)(pS,{nodes:pM(n.body)},`f${n.key}`),block:!1});!l&&i.sep&&a.nodes.push("\n"),a.nodes.push(s),e.sep=!l,pI(e.region)}function pE(e){p$(e,!0),e.run=null,e.provisional=!1}function pR(e,t,n){let r=pA(e.body,0,!1);e.shown++>0&&r.nodes.push("\n"),r.nodes.push((0,F.jsx)(B.Fragment,{children:t},n)),pI(e.body)}function pP(e,t,n){var r;let i,a=e.run;if(a){let n=e.region.chunks[e.region.chunks.length-1];if("fence"===a.kind)return(n.lines++,py.test(t))?void pE(e):(a.code.push(t),a.joined=null,pR(a,t,e.keys++),void p$(e,!1));if("table"===a.kind&&pg.test(t)){n.lines++,a.rows.push(t),p$(e,!1);return}if("images"===a.kind){let r=t.match(pc);if(r){n.lines++,a.images.push({alt:r[1],src:r[2]}),p$(e,!1);return}}pE(e)}let s=pA(e.region,n,e.sep);if(s.lines++,pw.test(t)){e.run={kind:"fence",slot:s.nodes.length,sep:e.sep,key:e.keys++,lang:pk(t),code:[],joined:null,body:pC(),shown:0},pR(e.run,t,e.keys++),p$(e,!1);return}if(pg.test(t)){e.run={kind:"table",slot:s.nodes.length,sep:e.sep,key:e.keys++,rows:[t]},p$(e,!1);return}let l=t.match(pc);if(l){e.run={kind:"images",slot:s.nodes.length,sep:e.sep,key:e.keys++,images:[{alt:l[1],src:l[2]}]},p$(e,!1);return}r=pj(t,e.keys++),i=e.region.chunks[e.region.chunks.length-1],e.sep&&i.nodes.push("\n"),i.nodes.push(r),e.sep=!0,pI(e.region)}function pO({text:e,streaming:t}){let[n]=(0,B.useState)(pT);return function(e,t,n){if(null!==e.rendered&&t===e.source&&n===e.streaming)return e.rendered;0===e.stableChars||e.lineStart&&!(t.length<e.source.length)&&10===t.charCodeAt(e.stableChars-1)&&t.startsWith(e.source)||function(e,t,n){if(!n||!e.anchor||!e.lineStart)return!1;let r=t.lastIndexOf(e.anchor);if(r<0)return!1;let i=r+e.anchor.length,a=e.stableChars-i;if(a<=0||!t.startsWith(e.source.slice(a)))return!1;let s=e.region.chunks;for(let e of s)e.from-=a;let l=s.findIndex(e=>e.from>=0);if(l<0)return!1;let o=s.slice(l),c=pT(),d=o[0].from,u=t.slice(0,d).split("\n"),p=0;for(let e=0;e<u.length-1;e++)pP(c,u[e],p),p+=u[e].length+1;if(c.run||c.sep!==o[0].sep)return!1;for(let t of c.region.chunks)t.key=e.region.keys++,t.element=(0,F.jsx)(pS,{nodes:t.nodes},t.key);return e.region.chunks=[...c.region.chunks,...o],e.stableChars=i,e.stableLines=e.region.chunks.reduce((e,t)=>e+t.lines,0),!0}(e,t,n)||(e.stableChars=0,e.stableLines=0,e.lineStart=!0,e.region=pC(),e.run=null,e.sep=!1,e.provisional=!1,e.anchor="");let r=t.slice(e.stableChars).split("\n"),i=n?r.length-1:r.length,a=e.stableChars;for(let t=0;t<i;t++)pP(e,r[t],a),a+=r[t].length+1,e.provisional=!1;i>0&&(e.lineStart=a<=t.length,e.stableChars=Math.min(a,t.length),e.stableLines+=i,e.anchor=t.slice(Math.max(0,e.stableChars-128),e.stableChars)),!n&&e.run&&pE(e);let s=null;if(n){let t=r[r.length-1],n=e.run?.kind==="fence"&&py.test(t);if(n!==e.provisional&&(p$(e,n),e.provisional=n),!n){let n=[];e.sep&&n.push("\n");let r=e.run?.kind==="fence"||pc.test(t);n.push((0,F.jsx)(B.Fragment,{children:r?t:px(t)},"v")),s=n}}let l=(0,F.jsxs)(F.Fragment,{children:[pM(e.region),s]});return e.source=t,e.streaming=n,e.rendered=l,l}(n,e,t)}function pD({items:e}){let{t}=(0,er.Ym)();return e.length?(0,F.jsx)("div",{"data-live-turn-group":!0,children:e.map((n,r)=>(0,F.jsxs)("div",{"data-live-turn":!0,"data-live-turn-item-id":n.itemId??void 0,className:"my-2 ml-9 whitespace-pre-wrap [overflow-wrap:anywhere] text-ui text-primary",children:[n.omittedItems?(0,F.jsx)("span",{"data-live-turn-omitted-items":!0,className:"text-muted",children:`${t("feed.liveOmittedItems",{count:n.omittedItems,chars:n.omittedChars??0})}
48
- `}):n.omittedChars?(0,F.jsx)("span",{"data-live-turn-omitted-chars":!0,className:"text-muted",children:`${t("feed.liveOmittedChars",{chars:n.omittedChars})}
49
- `}):null,(0,F.jsx)(pO,{text:n.text,streaming:"streaming"===n.phase}),"streaming"===n.phase&&r===e.length-1?(0,F.jsx)("span",{className:"ml-0.5 inline-block h-3.5 w-1.5 animate-pulse rounded-[2px] bg-accent align-text-bottom","aria-hidden":!0}):null]},n.itemId??`${n.startedAt??"live"}:${r}`))}):null}function pL({entries:e,t,onCancel:n,onRetry:r}){return e.length?(0,F.jsx)("div",{"data-outbox":!0,"aria-label":t("outbox.queueAria"),role:"log","aria-live":"polite",children:e.map(e=>{let i=function(e,t){switch(t.state){case"delivering":return{label:e("outbox.delivering"),icon:(0,F.jsx)(i9.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none","aria-hidden":!0}),className:"text-warning"};case"failed":return{label:t.needsReattach?e("outbox.reattach"):t.error??e("outbox.failed"),icon:(0,F.jsx)(_.A,{className:"h-3 w-3","aria-hidden":!0}),className:"text-danger"};case"delivered":return{label:e("outbox.delivered"),icon:null,className:"text-muted"};default:return{label:e("outbox.queued"),icon:(0,F.jsx)(u5.A,{className:"h-3 w-3","aria-hidden":!0}),className:"text-warning"}}}(t,e);return(0,F.jsx)("div",{"data-outbox-entry":e.id,"data-outbox-state":e.state,className:"group/msg my-3 flex items-start justify-end gap-1.5",children:(0,F.jsxs)("div",{className:"flex max-w-[75%] flex-col items-end gap-1",children:[(0,F.jsxs)("div",{className:"w-full whitespace-pre-wrap break-words rounded-surface bg-user px-4 py-2.5 opacity-80",children:[e.text,e.images?(0,F.jsx)("span",{className:"mt-1 block text-caption font-semibold text-muted",children:t("composer.imagesCount",{count:e.images})}):null]}),(0,F.jsxs)("div",{className:`flex items-center gap-1 text-caption font-semibold ${i.className}`,children:[i.icon,(0,F.jsx)("span",{"data-outbox-status":!0,className:"min-w-0 truncate",children:i.label}),"failed"!==e.state||e.needsReattach?null:(0,F.jsx)("button",{type:"button","data-outbox-retry":e.id,"aria-label":t("outbox.retry"),title:t("outbox.retry"),onClick:()=>r(e.id),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11",children:(0,F.jsx)(ae.A,{className:"h-3 w-3","aria-hidden":!0})}),"queued"===e.state||"failed"===e.state?(0,F.jsx)("button",{type:"button","data-outbox-cancel":e.id,"aria-label":t("outbox.cancel"),title:t("outbox.cancel"),onClick:()=>n(e.id),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11",children:(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0})}):null]})]})},e.id)})}):null}function pF({cardId:e,entries:t}){let{t:n}=(0,er.Ym)();return(0,F.jsx)(pL,{entries:t,t:n,onCancel:t=>sR(e,t),onRetry:t=>{let n,r;(r=(n=sT(e)).find(e=>e.id===t))&&"failed"===r.state&&!r.needsReattach&&sC(e,n.map(e=>e.id===t?{...e,state:"queued",error:void 0}:e))}})}let p_=new Map,pq=new Set,pz=new Set,pH=e=>`llvAssistantClaims:${e}`;function pB({item:e}){return"sourceId"in e&&"string"==typeof e.sourceId&&e.sourceId?e.sourceId:null}function pU(e){let t=p_.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem(pH(e))??"[]"),n=new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e&&e.length>0).slice(-544):[]);return p_.set(e,n),n}catch{return p_.set(e,pz),pz}}function pK(e,t){p_.set(e,t);try{t.size?sessionStorage.setItem(pH(e),JSON.stringify([...t])):sessionStorage.removeItem(pH(e))}catch{}}function pY(e){if("string"!=typeof e&&"number"!=typeof e)return null;let t=Date.parse(String(e));return Number.isFinite(t)?t:null}let pW=["launch","outbox","delta"];function pJ({name:e,path:t}){let{t:n}=(0,er.Ym)(),[r,i]=(0,B.useState)("thumb"),[a,s]=(0,B.useState)(null),[l,o]=(0,B.useState)(!1),[c,d]=(0,B.useState)(!1),[u,p]=(0,B.useState)("");(0,B.useEffect)(()=>{if(!l)return;let e=window.setTimeout(()=>o(!1),5e3);return()=>window.clearTimeout(e)},[l]);let m=`/api/inbox?name=${encodeURIComponent(e)}`,f=async()=>{d(!0),p("");try{let e=await fetch(m,{method:"DELETE"}),t=await e.json();if(!e.ok||!t.ok)return void p(t.error??n("common.failedDelete"));s("deleted")}catch{p(n("common.serverUnavailable"))}finally{d(!1),o(!1)}};return a?(0,F.jsx)("div",{className:"my-2 flex justify-end",children:(0,F.jsxs)("span",{className:"inline-flex max-w-[75%] items-center gap-1.5 rounded-full border border-border bg-sunken px-2.5 py-1 text-[11.5px] font-semibold text-muted",title:t,children:[(0,F.jsx)(i9.c9,{name:"image",className:"h-3.5 w-3.5"}),(0,F.jsx)("span",{className:"truncate",children:e}),(0,F.jsxs)("span",{className:"shrink-0",children:["\xb7 ","deleted"===a?n("inbox.deleted"):n("inbox.fileGone")]})]})}):"chip"===r?(0,F.jsx)("div",{className:"my-2 flex justify-end",children:(0,F.jsxs)("button",{type:"button",onClick:()=>i("thumb"),className:"inline-flex max-w-[75%] items-center gap-2 rounded-[14px] border border-border bg-card px-3.5 py-2 text-[13px] shadow-1",title:t,children:[(0,F.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-sunken",children:(0,F.jsx)(i9.c9,{name:"image",className:"h-4 w-4"})}),(0,F.jsx)("span",{className:"truncate font-mono text-[12px]",children:e}),(0,F.jsx)("span",{className:"shrink-0 text-[12px] font-semibold text-accent",children:n("common.show")})]})}):(0,F.jsxs)("div",{className:"my-2 flex justify-end",children:[(0,F.jsxs)("div",{className:"max-w-[75%]",children:[(0,F.jsx)("img",{src:m,alt:n("inbox.attachedAlt",{name:e}),onClick:()=>i("full"),onError:()=>s("missing"),className:"ml-auto block max-h-[240px] cursor-zoom-in rounded-[14px] border border-border"}),(0,F.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-end gap-1.5 text-[11px]",children:[(0,F.jsx)("span",{className:"min-w-0 truncate font-mono text-muted",title:t,children:e}),(0,F.jsx)("button",{type:"button",onClick:()=>i("chip"),className:"shrink-0 text-muted hover:text-primary",children:n("common.collapse")}),l?(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-danger/30 bg-danger-soft px-1.5 py-0.5",children:[(0,F.jsx)("span",{className:"px-1 font-semibold text-danger",children:n("inbox.confirmDelete")}),(0,F.jsx)("button",{type:"button",className:"rounded-lg bg-danger px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/50",disabled:c,onClick:f,children:c?n("trash.deleting"):n("trash.confirmYes")}),(0,F.jsx)("button",{type:"button",className:"rounded-lg border border-border bg-card px-2 py-0.5 font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o(!1),children:n("common.cancel")})]}):(0,F.jsxs)("button",{type:"button",onClick:()=>o(!0),"aria-label":n("inbox.deleteAria",{name:e}),className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-card px-2 py-0.5 font-semibold text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)(i9.TB,{className:"h-3 w-3","aria-hidden":!0})," ",n("inbox.deleteFromDisk")]}),u?(0,F.jsx)("span",{className:"shrink-0 font-semibold text-danger",children:u}):null]})]}),"full"===r?(0,F.jsx)(pi,{src:m,alt:n("inbox.attachedAlt",{name:e}),caption:t,onClose:()=>i("thumb")}):null]})}function pV({bytes:e,text:t}){let[n,r]=(0,B.useState)(!1),i=Math.round(e/1024);return n?(0,F.jsxs)("div",{className:"my-2 ml-9 overflow-hidden rounded-surface border border-border bg-card",children:[(0,F.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap break-all bg-sunken px-3 py-2 font-mono text-[11.5px]",children:t}),(0,F.jsx)("button",{type:"button",onClick:()=>r(!1),className:"block w-full border-t border-border px-3 py-1.5 text-[12px] text-muted",children:(0,pl.tr)("common.collapse")})]}):(0,F.jsxs)("button",{type:"button",onClick:()=>r(!0),className:"my-2 ml-9 flex items-center gap-2 rounded-surface border border-border bg-card px-3 py-1.5 text-[13px]",children:[(0,F.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-lg bg-sunken",children:(0,F.jsx)(i9.c9,{name:"blob",className:"h-3.5 w-3.5"})}),(0,F.jsx)("span",{className:"font-semibold",children:(0,pl.tr)("render.dataKb",{n:i})}),(0,F.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:(0,pl.tr)("common.show")})]})}let pG=new Set(["wait","write_stdin"]);function pX(e){return pG.has(e.tool)}function pQ(e){let t=(0,er.JK)(),n=(e,n)=>(0,er.Tl)(t,e,n);if(!Number.isFinite(e)||e<0)return"";if(e<1e3)return n("tools.durationMs",{n:Math.round(e)});let r=e/1e3;if(r<60)return n("tools.durationSec",{n:r<10?Math.round(10*r)/10:Math.round(r)});let i=Math.round(r);return n("tools.durationMin",{m:Math.floor(i/60),s:i%60})}let pZ=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function p0({status:e,className:t}){let n=t??"h-3.5 w-3.5";return"ok"===e?(0,F.jsx)(i9.Jl,{className:n,"aria-hidden":!0}):"err"===e?(0,F.jsx)(i9.X,{className:n,"aria-hidden":!0}):(0,F.jsx)(i9.kr,{className:`${n} animate-spin motion-reduce:animate-none`,"aria-hidden":!0})}function p1({file:e,line:t}){let n=t?`${e}:${t}`:e,r="inline-block min-w-0 max-w-full truncate rounded-md bg-sunken px-1.5 py-0.5 align-bottom font-mono text-[11.5px]";return pZ.test(e)?(0,F.jsx)("a",{href:`#f=${encodeURIComponent(e)}`,className:`${r} text-accent underline decoration-dotted`,title:n,children:n}):(0,F.jsx)("code",{className:r,title:n,children:n})}let p2={add:"text-diff-add",update:"text-accent",delete:"text-diff-del",move:"text-accent"};function p5({line:e}){let t="+"===e.t?"bg-diff-add-soft text-diff-add":"-"===e.t?"bg-diff-del-soft text-diff-del":"text-primary",n="+"===e.t?"bg-diff-add-strong":"bg-diff-del-strong";return(0,F.jsxs)("div",{className:`whitespace-pre px-2 ${t}`,children:[e.t,e.intraline?e.intraline.map((e,t)=>e.changed?(0,F.jsx)("span",{className:n,children:e.text},t):e.text):e.text||" "]})}function p3({file:e}){var t;let[n,r]=(0,B.useState)(!1),i=function(e){let t=[];for(let n of e){let e=!0;for(let r of n.lines)t.push({line:r,header:e?n.header:void 0}),e=!1}return t}(e.hunks),a=i.length>8,s=n?i:i.slice(0,8),l=e.hunks.flatMap(e=>e.lines.map(e=>e.t+e.text)).join("\n");return(0,F.jsxs)("div",{className:"group/diff relative overflow-hidden rounded-[10px] border border-border bg-sunken",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 border-b border-border px-2.5 py-1 text-[11.5px]",children:[(0,F.jsx)("span",{className:`shrink-0 font-semibold uppercase ${p2[e.op]}`,children:e.op}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate",children:(0,F.jsx)(p1,{file:e.path})}),e.binary?null:(0,F.jsxs)("span",{className:"shrink-0 font-mono text-[11px]",children:[(0,F.jsxs)("span",{className:"text-diff-add",children:["+",e.added]})," ",(0,F.jsxs)("span",{className:"text-diff-del",children:["−",e.removed]})]}),l?(0,F.jsx)(u9.i,{text:l,label:(0,pl.tr)("tools.copyDiff"),className:`shrink-0 ${pa} group-hover/diff:opacity-100`}):null]}),e.binary?(0,F.jsx)("div",{className:"px-2.5 py-2 text-[11.5px] text-muted",children:(0,pl.tr)("tools.binaryContent",{size:(t=e.added+e.removed,`${Math.max(1,Math.round(t/1024))} kB`)})}):i.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"max-w-full overflow-x-auto py-1 font-mono text-[11.5px] leading-[1.5]",children:s.map(({line:e,header:t},n)=>(0,F.jsxs)("div",{children:[t?(0,F.jsx)("div",{className:"whitespace-pre px-2 text-muted",children:`@@ ${t}`}):null,(0,F.jsx)(p5,{line:e})]},n))}),a?(0,F.jsx)("button",{type:"button",onClick:()=>r(e=>!e),className:"w-full border-t border-border px-2.5 py-1 text-left text-[11px] font-semibold text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:n?(0,F.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,pl.tr)("common.collapse")," ",(0,F.jsx)(i9.rX,{className:"h-3 w-3","aria-hidden":!0})]}):(0,pl.tr)("tools.showAllLines",{count:i.length})}):null]}):null,e.truncated?(0,F.jsx)("div",{className:"border-t border-border px-2.5 py-0.5 text-[10.5px] text-muted",children:(0,pl.tr)("tools.diffTruncated")}):null]})}function p4({body:e}){return(0,F.jsxs)("div",{className:"mt-1.5 space-y-1.5",children:[e.files.map((e,t)=>(0,F.jsx)(p3,{file:e},`${e.path}:${t}`)),e.filesTruncated?(0,F.jsx)("div",{className:"text-[11px] text-muted",children:(0,pl.tr)("tools.moreFiles",{count:e.files.length})}):null]})}function p6({call:e}){return(0,F.jsxs)("div",{className:"flex items-start gap-2 py-0.5 font-mono text-[11.5px] text-secondary",children:[(0,F.jsx)(i9.c9,{name:e.icon,className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted"}),(0,F.jsx)("span",{className:"min-w-0 flex-1 [overflow-wrap:anywhere]",children:e.summary})]})}function p8({orchestration:e}){return e.calls.length?(0,F.jsx)("div",{className:"mt-1.5 space-y-1.5",children:(0,F.jsxs)("div",{children:[(0,F.jsx)("div",{className:"mb-0.5 text-[10.5px] font-semibold uppercase tracking-wide text-muted",children:(0,pl.tr)("tools.nestedCalls")}),e.calls.map((e,t)=>(0,F.jsx)(p6,{call:e},`${e.id}:${t}`))]})}):null}function p7({output:e,truncated:t,lang:n,copyLabel:r,heading:i,tone:a="out",showAllLabel:s}){let[l,o]=(0,B.useState)(!1),c=i?(0,F.jsx)("div",{className:`mb-0.5 text-[10.5px] font-semibold uppercase tracking-wide ${"err"===a?"text-danger":"text-muted"}`,children:i}):null;if(!e.trim())return null;let d=e.split("\n"),u=d.length>24||e.length>4096,p=l?e:d.slice(0,24).join("\n").slice(0,4096),m=l&&n?n:null,f=r??(0,pl.tr)("tools.copyOutput");return(0,F.jsxs)("div",{className:"group/out relative mt-1.5",children:[c,m?(0,F.jsx)(pu,{code:e,lang:m,copyLabel:f}):(0,F.jsx)("pre",{className:`max-h-[420px] max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] font-mono text-[12px] text-secondary ${ps} ${"err"===a?"border-l-2 border-danger/50 pl-2":""}`,children:p}),m?null:(0,F.jsx)(u9.i,{text:e,label:f,className:`absolute right-[6px] ${pa} group-hover/out:opacity-100 ${i?"top-5":"top-[6px]"}`}),u?(0,F.jsx)("button",{type:"button",onClick:()=>o(e=>!e),className:"mt-1 inline-flex items-center gap-1 text-[11.5px] font-semibold text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:l?(0,F.jsxs)(F.Fragment,{children:[(0,pl.tr)("common.collapse")," ",(0,F.jsx)(i9.rX,{className:"h-3 w-3","aria-hidden":!0})]}):(s??(0,pl.tr)("tools.showOutput"))+(t?" \xb7 "+(0,pl.tr)("render.truncated"):"")}):t?(0,F.jsx)("div",{className:"mt-1 text-[11px] text-muted",children:(0,pl.tr)("render.truncated")}):null]})}function p9(e){return"ok"===e?"text-success":"err"===e?"text-danger":"text-muted"}function me({chips:e}){return e.length?(0,F.jsx)("div",{className:"mb-1 flex flex-wrap gap-1",children:e.map((e,t)=>(0,F.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 truncate rounded-md bg-sunken px-1.5 py-0.5 font-mono text-[11px] text-primary",children:[e.label?(0,F.jsx)("span",{className:"text-muted",children:e.label}):null,e.value]},t))}):null}function mt({event:e}){let t=(0,tt.T0)(e.ts),n=void 0!==e.endTs?(0,tt.T0)(e.endTs):"",r=n&&t?(0,pl.tr)("tools.ranAt",{start:t,end:n}):"",i=void 0!==e.durationMs?pQ(e.durationMs):"",a=void 0!==e.exitCode?(0,pl.tr)("tools.exitCode",{code:e.exitCode}):"err"===e.status?e.statusLabel||(0,pl.tr)("render.error"):"ok"===e.status&&"shell"===e.family?(0,pl.tr)("tools.exitOk"):null;return e.cwd||r||i||a?(0,F.jsxs)("div",{className:"mb-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted",children:[a?(0,F.jsxs)("span",{className:`inline-flex items-center gap-1 font-semibold ${p9(e.status)}`,children:[(0,F.jsx)(p0,{status:e.status,className:"h-3 w-3"}),a]}):null,i?(0,F.jsxs)("span",{className:"inline-flex items-center gap-1 tabular-nums",children:[(0,F.jsx)(i9.qk,{className:"h-3 w-3","aria-hidden":!0}),i]}):null,r?(0,F.jsx)("span",{className:"tabular-nums",children:r}):null,e.cwd?(0,F.jsxs)("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1",children:[(0,F.jsx)("code",{className:"min-w-0 truncate font-mono text-[11px] text-secondary",title:e.cwd,children:e.cwd}),(0,F.jsx)(u9.i,{text:e.cwd,label:(0,pl.tr)("tools.copyCwd"),className:"shrink-0 p-0.5"})]}):null]}):null}function mn({command:e}){return(0,F.jsxs)("div",{className:"group/cmd relative",children:[(0,F.jsxs)("pre",{className:`max-w-full whitespace-pre-wrap [overflow-wrap:anywhere] py-0.5 font-mono text-ui text-primary ${ps}`,children:[(0,F.jsx)("span",{className:"select-none text-muted",children:"$ "}),e]}),(0,F.jsx)(u9.i,{text:e,label:(0,pl.tr)("tools.copyCommand"),className:`absolute right-[6px] top-[6px] ${pa} group-hover/cmd:opacity-100`})]})}function mr({event:e}){let t=e.body?.type==="diff",n=!(pX(e)&&!e.outputPreview.trim()&&void 0===e.stderr&&"err"!==e.status)&&(!t||!!e.outputPreview.trim());return(0,F.jsxs)("div",{className:"mb-1 mt-1 rounded-surface bg-sunken px-2.5 py-2",children:[(0,F.jsx)(me,{chips:e.chips}),(0,F.jsx)(mt,{event:e}),e.command?(0,F.jsx)(mn,{command:e.command}):null,e.orchestration?(0,F.jsx)(p8,{orchestration:e.orchestration,source:e.command}):null,t&&e.body?.type==="diff"?(0,F.jsx)(p4,{body:e.body}):null,n?(0,F.jsx)(p7,{output:e.outputPreview,truncated:e.outputTruncated,lang:e.lang,heading:void 0!==e.stderr?(0,pl.tr)("tools.stdout"):void 0}):null,void 0!==e.stderr?(0,F.jsx)(p7,{output:e.stderr,truncated:!!e.stderrTruncated,heading:(0,pl.tr)("tools.stderr"),tone:"err",copyLabel:(0,pl.tr)("tools.copyStderr"),showAllLabel:(0,pl.tr)("tools.showStderr")}):null]})}function mi({events:e,session:t,elapsedMs:n}){let r=e.length,i="number"==typeof n&&n>0?pQ(n):"",a=[(0,pl.tr)("tools.pollRun",{count:r}),t?`→ ${t}`:"",i].filter(Boolean).join(" \xb7 ");return(0,F.jsxs)("div",{className:"flex items-center gap-2 rounded-control py-0.5 text-ui text-muted/80",children:[(0,F.jsx)("span",{className:"shrink-0 select-none text-muted","aria-hidden":!0,children:"↳"}),(0,F.jsx)(i9.c9,{name:"clock",className:"h-3.5 w-3.5 shrink-0"}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate tabular-nums text-caption",children:a})]})}function ma({event:e,index:t,nested:n=!1}){let r="err"===e.status;return(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsxs)("div",{className:`flex items-center gap-2 rounded-control py-0.5 text-ui ${r?"border-l-2 border-danger bg-danger-soft pl-2 pr-1 text-danger":n?"text-muted/90":"text-muted"}`,children:[void 0!==t?(0,F.jsxs)("span",{className:"shrink-0 tabular-nums text-caption font-semibold text-muted",children:[t,"."]}):null,n?(0,F.jsx)("span",{className:"shrink-0 select-none text-muted","aria-hidden":!0,children:"↳"}):null,(0,F.jsx)(i9.c9,{name:e.icon,className:"h-3.5 w-3.5 shrink-0"}),(0,F.jsx)("span",{className:`min-w-0 flex-1 truncate ${r?"font-semibold":"text-secondary"}`,title:e.summary,children:e.summary}),"ok"!==e.status?(0,F.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-caption font-semibold ${p9(e.status)}`,children:[(0,F.jsx)(p0,{status:e.status,className:"h-3 w-3"}),e.statusLabel]}):null]}),(0,F.jsx)(mr,{event:e})]})}function ms({event:e,showTime:t=!0,className:n="",index:r,nested:i=!1}){let[a,s]=(0,B.useState)(e.open),l=(0,tt.T0)(e.ts),o="err"===e.status;return(0,F.jsxs)("details",{className:`group/tool ${n}`,open:e.open,onToggle:e=>{e.currentTarget.open&&s(!0)},children:[(0,F.jsxs)("summary",{className:`flex cursor-pointer list-none items-center gap-2 rounded-control py-0.5 text-ui hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden ${o?"border-l-2 border-danger bg-danger-soft pl-2 pr-1 text-danger":i?"text-muted/90":"text-muted"}`,children:[void 0!==r?(0,F.jsxs)("span",{className:"shrink-0 tabular-nums text-caption font-semibold text-muted",children:[r,"."]}):null,i?(0,F.jsx)("span",{className:"shrink-0 select-none text-muted","aria-hidden":!0,children:"↳"}):null,(0,F.jsx)(i9.c9,{name:e.icon,className:"h-3.5 w-3.5 shrink-0"}),(0,F.jsx)("span",{className:`min-w-0 flex-1 truncate ${o?"font-semibold":"text-secondary"}`,title:e.summary,children:e.summary}),"ok"!==e.status?(0,F.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-caption font-semibold ${p9(e.status)}`,children:[(0,F.jsx)(p0,{status:e.status,className:"h-3 w-3"}),e.statusLabel]}):null,t&&l?(0,F.jsx)("span",{className:"shrink-0 text-caption tabular-nums text-muted",children:l}):null]}),a?(0,F.jsx)(mr,{event:e}):null]})}function ml({event:e}){return(0,F.jsx)(ms,{event:e,className:"ml-9"})}function mo({item:e}){let t=e.active,[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(t),[s,l]=(0,B.useState)(!1);i!==t&&(a(t),!i||t||s||(l(!0),r(!1)));let o=!!t||(n??e.hasErr),c=Object.entries(e.byTool).map(([e,t])=>`${e} \xd7${t}`).join(" \xb7 "),d=(0,tt.T0)(e.t0),u=(0,tt.T0)(e.t1),p=d&&u&&d!==u?`${d}–${u}`:d||u,m=function(e){let t=[];for(let n of e){if(pX(n)){let e=function(e,t){if(void 0!==t.session){for(let n=e.length-1;n>=0;n-=1)if((0,pl.sI)(e[n].parent,t))return e[n];return}return e[e.length-1]}(t,n);if(e){e.children.push(n);continue}}t.push({parent:n,children:[]})}return t}(e.calls);return(0,F.jsxs)("details",{className:"group/grp ml-9",open:o,onToggle:e=>{let n=e.currentTarget.open;if(t){n||(e.currentTarget.open=!0);return}n!==o&&r(n)},children:[(0,F.jsxs)("summary",{className:`flex cursor-pointer list-none items-center gap-2 rounded-control py-0.5 text-ui hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden ${e.hasErr?"text-danger":"text-muted"}`,children:[(0,F.jsx)(i9.c_,{className:"h-3.5 w-3.5 shrink-0 transition-transform motion-reduce:transition-none group-open/grp:rotate-90","aria-hidden":!0}),(0,F.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1 truncate text-secondary",children:[(0,pl.tr)("render.actions",{count:e.calls.length}),c?" \xb7 "+c:"",e.errCount?(0,F.jsxs)("span",{className:"ml-1 inline-flex items-center gap-0.5 font-semibold text-danger",children:[(0,F.jsx)(p0,{status:"err",className:"h-3 w-3"}),e.errCount]}):null]}),p?(0,F.jsx)("span",{className:"ml-auto shrink-0 text-caption tabular-nums text-muted",children:p}):null]}),o?(0,F.jsx)("ol",{className:"mb-1 mt-1 space-y-0.5",children:m.map((e,t)=>{let n=function(e){let t=[];for(let n of e){if(!0===n.poll&&"err"!==n.status&&!n.outputPreview.trim()&&void 0===n.stderr){let e=t[t.length-1],r="number"==typeof n.durationMs&&Number.isFinite(n.durationMs)?n.durationMs:0;if(e&&"polls"===e.kind){e.events.push(n),void 0===e.session&&void 0!==n.session&&(e.session=n.session),e.elapsedMs=(e.elapsedMs??0)+r;continue}t.push({kind:"polls",events:[n],session:n.session,elapsedMs:r});continue}t.push({kind:"call",event:n})}return t}(e.children);return(0,F.jsxs)("li",{className:"min-w-0",children:[(0,F.jsx)(ma,{event:e.parent,index:t+1}),n.length?(0,F.jsx)("div",{className:"ml-4 border-l border-border pl-2",children:n.map((e,t)=>"polls"===e.kind?(0,F.jsx)(mi,{events:e.events,session:e.session,elapsedMs:e.elapsedMs},`poll:${t}`):(0,F.jsx)(ma,{event:e.event,nested:!0},`${e.event.id}:${t}`))}):null]},`${e.parent.id}:${t}`)})}):null]})}function mc({item:e}){let t=[e.trigger?(0,pl.tr)("auto"===e.trigger?"render.compactAuto":"render.compactManual"):"",e.preTokens?(0,pl.tr)("render.compactPre",{n:Math.round(e.preTokens/1e3)}):"",(0,tt.T0)(e.ts)||""].filter(Boolean).join(" \xb7 ");return(0,F.jsxs)("div",{className:"my-3.5",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,F.jsx)("span",{className:"h-px flex-1 bg-info/30","aria-hidden":!0}),(0,F.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-info/30 bg-info-soft px-2.5 py-1 text-[11px] font-bold text-info",children:[(0,F.jsx)(i9.c9,{name:"compact",className:"h-3.5 w-3.5"}),(0,pl.tr)("render.compacted"),t?(0,F.jsx)("span",{className:"font-semibold tabular-nums opacity-75",children:t}):null]}),(0,F.jsx)("span",{className:"h-px flex-1 bg-info/30","aria-hidden":!0})]}),e.summary?(0,F.jsxs)("details",{className:"group/cmp mt-1.5 text-center",children:[(0,F.jsxs)("summary",{className:"cursor-pointer list-none text-[11px] font-semibold text-info [&::-webkit-details-marker]:hidden",children:[(0,F.jsxs)("span",{className:"group-open/cmp:hidden",children:[(0,pl.tr)("render.compactSummary")," \xb7 ",(0,pl.tr)("common.show")]}),(0,F.jsx)("span",{className:"hidden group-open/cmp:inline",children:(0,pl.tr)("common.collapse")})]}),(0,F.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-border bg-canvas px-3 py-2 text-left font-mono text-[11px] text-secondary",children:e.summary})]}):null]})}function md({media:e,data:t,w:n,h:r,bytes:i}){let[a,s]=(0,B.useState)("thumb"),l=Math.round((i??3*t.length/4)/1024),o=n&&r?`${n}\xd7${r}`:(0,pl.tr)("render.image");if("chip"===a)return(0,F.jsxs)("button",{type:"button",onClick:()=>s("thumb"),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-border bg-card px-3.5 py-2 text-[13px] shadow-1",children:[(0,F.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-sunken",children:(0,F.jsx)(i9.c9,{name:"image",className:"h-4 w-4"})}),(0,F.jsx)("span",{className:"font-semibold",children:o}),(0,F.jsxs)("span",{className:"text-muted",children:["\xb7 ",l," ",(0,pl.tr)("common.kb")]}),(0,F.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:(0,pl.tr)("common.show")})]});let c=`data:${e};base64,${t}`;return(0,F.jsxs)("div",{className:"my-2 ml-9",children:[(0,F.jsx)("img",{src:c,alt:`${(0,pl.tr)("render.image")} ${o}`,onClick:()=>s("full"),className:"max-h-[240px] cursor-zoom-in rounded-[14px] border border-border"}),(0,F.jsx)("button",{type:"button",onClick:()=>s("chip"),className:"mt-1 block text-[12px] text-muted",children:(0,pl.tr)("common.collapse")}),"full"===a?(0,F.jsx)(pi,{src:c,alt:`${(0,pl.tr)("render.image")} ${o}`,caption:`${o} \xb7 ${l} ${(0,pl.tr)("common.kb")}`,onClose:()=>s("thumb")}):null]})}function mu({item:e}){let t=e.entries.slice(0,8),n=e.rolloutIds.slice(0,6);return(0,F.jsxs)("details",{className:"group my-2 ml-9 overflow-hidden rounded-surface border border-border bg-card text-[12px]",children:[(0,F.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3 py-1.5",children:[(0,F.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-sunken",children:(0,F.jsx)(i9.c9,{name:"citation",className:"h-3.5 w-3.5"})}),(0,F.jsx)("span",{className:"text-[13px] font-semibold",children:(0,pl.tr)("render.memoryCitations",{count:e.entries.length})}),(0,F.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:(0,pl.tr)("common.show")}),(0,F.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:(0,pl.tr)("common.collapse")})]}),(0,F.jsxs)("div",{className:"border-t border-border px-3 py-2",children:[t.length?(0,F.jsx)("div",{className:"divide-y divide-border",children:t.map((e,t)=>(0,F.jsxs)("div",{className:"min-w-0 py-1.5 first:pt-0 last:pb-0",children:[(0,F.jsx)(p1,{file:e.target,line:e.line?Number(e.line.split("-",1)[0]):void 0}),e.note?(0,F.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words text-[12px] text-secondary",children:e.note}):null]},t))}):(0,F.jsx)("div",{className:"text-[12px] text-muted",children:(0,pl.tr)("render.noCitations")}),e.entries.length>t.length?(0,F.jsx)("div",{className:"mt-1.5 text-[12px] text-muted",children:(0,pl.tr)("render.moreEntries",{count:e.entries.length-t.length})}):null,n.length?(0,F.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,F.jsx)("span",{className:"text-[11px] text-muted",children:"rollout:"}),n.map(e=>(0,F.jsx)("code",{className:"rounded-full bg-sunken px-2 py-0.5 font-mono text-[10.5px] text-muted",title:e,children:e.slice(0,8)},e)),e.rolloutIds.length>n.length?(0,F.jsxs)("span",{className:"text-[11px] text-muted",children:["+",e.rolloutIds.length-n.length]}):null]}):null,(0,F.jsxs)("details",{className:"group/raw mt-2 text-[12px]",children:[(0,F.jsxs)("summary",{className:"inline-flex cursor-pointer list-none items-center gap-1 font-semibold text-muted hover:text-accent [&::-webkit-details-marker]:hidden",children:[(0,F.jsx)(i9.c_,{className:"h-3 w-3 transition-transform group-open/raw:rotate-90","aria-hidden":!0}),"raw citation block",e.truncated?" \xb7 "+(0,pl.tr)("render.truncated"):""]}),(0,F.jsx)("pre",{className:"mt-1 max-h-[260px] overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] border-t border-border pt-1.5 font-mono text-[11.5px] text-secondary",children:e.raw})]})]})]})}let mp={shutdown_request:{icon:"shutdown",labelKey:"render.shutdownRequest",tone:"amber"},shutdown_response:{icon:"shutdown",labelKey:"render.shutdownResponse",tone:"amber"},plan_approval_request:{icon:"plan",labelKey:"render.planRequest",tone:"accent"},plan_approval_response:{icon:"plan",labelKey:"render.planVerdict",tone:"accent"}};function mm(e){return"string"==typeof e&&e.length?e:void 0}function mf({approve:e}){return(0,F.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${e?"border-success/25 bg-success-soft text-success":"border-danger/25 bg-danger-soft text-danger"}`,children:e?(0,pl.tr)("render.approved"):(0,pl.tr)("render.rejected")})}function mh({payload:e}){let t=mm(e.from),n=mm(e.requestId),r=(0,tt.T0)(e.timestamp);return t||n||r?(0,F.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[11px] text-muted",children:[t?(0,F.jsx)("span",{children:(0,pl.tr)("render.from",{from:t})}):null,n?(0,F.jsx)("span",{className:"truncate font-mono",title:n,children:n.length>40?n.slice(0,40)+"…":n}):null,r?(0,F.jsx)("span",{className:"tabular-nums",children:r}):null]}):null}function mx({payload:e}){let t=mm(e.type),n=t?mp[t]:void 0;if(!n)return(0,F.jsxs)("div",{className:"text-[13px]",children:[(0,F.jsx)("div",{className:"text-muted",children:(0,pl.tr)("render.structured")}),(0,F.jsxs)("details",{className:"mt-1 text-[12px]",children:[(0,F.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:(0,pl.tr)("render.showJson")}),(0,F.jsx)("pre",{className:"mt-1 max-h-[280px] overflow-auto whitespace-pre-wrap rounded-md bg-sunken px-2.5 py-2 font-mono text-[11.5px]",children:JSON.stringify(e,null,2)})]})]});let r="boolean"==typeof e.approve?e.approve:void 0,i=mm(e.reason)??mm(e.feedback);return(0,F.jsxs)("div",{className:"text-[13px]",children:[(0,F.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,F.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-[11.5px] font-bold ${"amber"===n.tone?"border-warning/35 bg-warning-soft text-warning":"border-accent/25 bg-accent/10 text-accent"}`,children:[(0,F.jsx)(i9.c9,{name:n.icon,className:"h-3.5 w-3.5"}),(0,pl.tr)(n.labelKey)]}),void 0!==r?(0,F.jsx)(mf,{approve:r}):null]}),i?(0,F.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:pN(i)}):null,(0,F.jsx)(mh,{payload:e})]})}function mg({verdict:e}){let t="REQUEST_CHANGES"===e?i9.MA:"APPROVE"===e?i9.rW:i9.oF;return(0,F.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,F.jsx)(t,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===e?"REQUEST_CHANGES":"APPROVE"===e?"APPROVE":"COMMENT"]})}function mb({item:e}){var t;let n=e.findings.length,r=e.findings.slice(0,12);return(0,F.jsxs)("div",{className:"my-3 ml-9 overflow-hidden rounded-surface border border-codex/20 bg-card",children:[(0,F.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2",children:[(0,F.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-codex-soft text-codex",children:(0,F.jsx)(i9.uB,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,F.jsx)("span",{className:"text-[13px] font-bold",children:"Codex review"}),e.verdict?(0,F.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11.5px] font-extrabold ${"REQUEST_CHANGES"===(t=e.verdict)?"bg-danger-soft text-danger border-danger/25":"APPROVE"===t?"bg-success-soft text-success border-success/25":"bg-sunken text-secondary border-border"}`,children:(0,F.jsx)(mg,{verdict:e.verdict})}):null,(0,F.jsx)("span",{className:"text-[11px] text-muted",children:n?`${n} finding${1===n?"":"s"}`:(0,pl.tr)("render.noFindings")}),(0,tt.T0)(e.ts)?(0,F.jsx)("span",{className:"ml-auto text-label tabular-nums text-muted",children:(0,tt.T0)(e.ts)}):null]}),(0,F.jsxs)("div",{className:"px-3 py-2",children:[e.summary.length?(0,F.jsx)("div",{className:"mb-2 whitespace-pre-wrap break-words text-[13px] text-secondary",children:pN(e.summary.join("\n"))}):null,r.length?(0,F.jsx)("div",{className:"divide-y divide-border",children:r.map((e,t)=>{var n;return(0,F.jsxs)("div",{className:"py-2 first:pt-0 last:pb-0",children:[(0,F.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,F.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${"Critical"===(n=e.severity)||"High"===n||"P0"===n||"P1"===n?"border-danger/30 bg-danger-soft text-danger":"Medium"===n||"P2"===n?"border-warning/35 bg-warning-soft text-warning":"Low"===n||"P3"===n?"border-border bg-sunken text-secondary":"border-border bg-card text-muted"}`,children:e.severity}),e.file?(0,F.jsx)(p1,{file:e.file,line:e.line}):null]}),(0,F.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:px(e.title)}),e.body&&e.body!==e.title?(0,F.jsxs)("details",{className:"mt-1 text-[12px] text-muted",children:[(0,F.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:"details"}),(0,F.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words",children:pN(e.body)})]}):null]},t)})}):null,e.findings.length>r.length?(0,F.jsx)("div",{className:"mt-2 text-[12px] text-muted",children:(0,pl.tr)("render.moreFindings",{count:e.findings.length-r.length})}):null,(0,F.jsxs)("details",{className:"group/raw mt-2 text-[12px]",children:[(0,F.jsxs)("summary",{className:"inline-flex cursor-pointer list-none items-center gap-1 font-semibold text-muted hover:text-accent [&::-webkit-details-marker]:hidden",children:[(0,F.jsx)(i9.c_,{className:"h-3 w-3 transition-transform group-open/raw:rotate-90","aria-hidden":!0}),"raw review text"]}),(0,F.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] border-t border-border pt-1.5 font-mono text-[11.5px] text-secondary",children:e.raw})]})]})]})}function mv({item:e}){let t=(0,tt.T0)(e.ts);return(0,F.jsxs)("details",{className:"group/record ml-9",children:[(0,F.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-control py-0.5 text-label text-muted hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden",children:[(0,F.jsx)(i9.c_,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open/record:rotate-90","aria-hidden":!0}),(0,F.jsx)("span",{className:"shrink-0 text-secondary",children:(0,pl.tr)("render.transcriptRecord")}),(0,F.jsx)("span",{className:"min-w-0 truncate rounded-md bg-sunken px-1.5 py-0.5 font-mono text-caption text-primary",children:e.recordType}),t?(0,F.jsx)("span",{className:"ml-auto shrink-0 tabular-nums",children:t}):null]}),(0,F.jsxs)("div",{className:"mb-1 mt-1",children:[(0,F.jsxs)("div",{className:"mb-1 flex items-center gap-2 text-caption font-semibold text-muted",children:[(0,F.jsx)("span",{children:(0,pl.tr)("render.recordDetails")}),e.truncated?(0,F.jsx)("span",{className:"rounded-md bg-sunken px-1.5 py-0.5",children:(0,pl.tr)("render.truncated")}):null]}),(0,F.jsx)("pre",{className:"max-h-[320px] max-w-full overflow-auto whitespace-pre-wrap break-words border-t border-border pt-1.5 font-mono text-[11px] text-secondary",children:e.body})]})]})}function mw({label:e,text:t}){let n=t.length>=1e3?`${(t.length/1e3).toFixed(1)}k`:String(t.length);return(0,F.jsxs)("details",{className:"group ml-9",children:[(0,F.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 rounded-control py-0.5 text-label text-muted hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden",children:[(0,F.jsx)(i9.c_,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-90","aria-hidden":!0}),(0,F.jsxs)("span",{className:"truncate text-secondary",children:[(0,pl.tr)("render.system")," \xb7 ",n]})]}),(0,F.jsxs)("div",{className:"mb-1 mt-1",children:[(0,F.jsx)("span",{className:"mb-1 inline-flex items-center rounded-control bg-sunken px-1.5 py-0.5 font-mono text-caption text-muted",children:e}),(0,F.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words border-t border-border pt-1.5 font-mono text-label text-secondary",children:t})]})]})}var my=n(3550);function mk(e,t){return new Date(e).toLocaleTimeString("uk"===t?"uk-UA":"en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}function mj(e,t){let n=Math.max(0,Math.round(e/1e3));if(n<60)return t("wakeup.relSec",{count:n});let r=Math.round(n/60);if(r<60)return t("wakeup.relMin",{count:r});let i=Math.round(r/60);return i<24?t("wakeup.relHour",{count:i}):t("wakeup.relDay",{count:Math.round(i/24)})}function mN({event:e,wakeup:t}){let n,r,{locale:i,t:a}=(0,er.Ym)(),{fireAt:s,superseded:l,failed:o,reason:c,prompt:d}=t,[u,p]=(0,B.useState)(()=>Date.now()),m=o?"failed":l?"superseded":(0,my.F9)(s,u),f="pending"===m;(0,B.useEffect)(()=>{if(!f)return;let e=setInterval(()=>p(Date.now()),1e3);return()=>clearInterval(e)},[f]);let h=null!==s?mk(s,i):"",x=f&&null!==s?(r=mj(Math.abs(n=s-u),a),a(n>=0?"wakeup.inRel":"wakeup.agoRel",{rel:r})):"",g=o?{text:a("wakeup.failed"),tone:"text-danger"}:l?{text:a("wakeup.superseded"),tone:"text-muted"}:"pending"===m?{text:x,tone:"text-warning"}:"fired"===m?{text:h?a("wakeup.firedAt",{time:h}):a("wakeup.fired"),tone:"text-muted"}:{text:"",tone:"text-muted"},b=o?a("wakeup.failed"):h?a(l?"wakeup.wasSetFor":null!==s&&s<=u?"wakeup.firedAt":"wakeup.wakesAt",{time:h}):a("wakeup.noTime"),v=f?"border-warning/45 bg-warning-soft":o?"border-danger/35 bg-card":"border-border bg-card",w=f?"bg-warning-soft text-warning":o?"bg-danger-soft text-danger":"bg-sunken text-muted";return(0,F.jsxs)("details",{className:`group/wake my-2.5 ml-9 overflow-hidden rounded-surface border ${v}`,open:f||o,children:[(0,F.jsxs)("summary",{className:"flex min-h-[44px] cursor-pointer list-none items-center gap-2.5 px-3 py-2",children:[(0,F.jsx)("span",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-lg ${w}`,children:(0,F.jsx)(i9.c9,{name:"clock",className:"h-3.5 w-3.5"})}),(0,F.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,F.jsx)("span",{className:"truncate text-[12.5px] font-semibold",title:c||b,children:c||a("wakeup.card")}),(0,F.jsx)("span",{className:"truncate text-[11px] text-muted",children:b})]}),g.text?(0,F.jsx)("span",{className:`shrink-0 text-[11px] font-bold tabular-nums ${g.tone}`,children:g.text}):null]}),(0,F.jsxs)("div",{className:"border-t border-border px-3 py-2",children:[(0,F.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11.5px] text-muted",children:[(0,F.jsx)("span",{className:`font-semibold ${o?"text-danger":"text-primary"}`,children:b}),x?(0,F.jsxs)("span",{children:["\xb7 ",x]}):null,l?(0,F.jsx)("span",{className:"rounded-md bg-sunken px-1.5 py-0.5",children:a("wakeup.superseded")}):null]}),o&&e.outputPreview.trim()?(0,F.jsx)("div",{className:"mb-2",children:(0,F.jsx)(p7,{output:e.outputPreview,truncated:e.outputTruncated})}):null,d?(0,F.jsxs)("details",{className:"group/plan",children:[(0,F.jsxs)("summary",{className:"inline-flex min-h-[44px] cursor-pointer list-none items-center gap-1.5 text-[11.5px] font-semibold text-muted hover:text-accent [&::-webkit-details-marker]:hidden",children:[(0,F.jsx)(i9.c_,{className:"h-3 w-3 transition-transform group-open/plan:rotate-90","aria-hidden":!0}),a("wakeup.plan")]}),(0,F.jsx)("div",{className:"border-t border-border pt-2 text-[12.5px] leading-snug",children:pN(d)})]}):(0,F.jsx)("span",{className:"text-[11.5px] text-muted",children:a("wakeup.noPlan")})]})]})}var mS=n(852),mC=n(1691);let mA=/(?:^|\n)(?:(?: {4}|\t)[^\n]*(?:\n|$))+/g,mI=null,mM=null,mT=null,m$=new Set,mE=new Map,mR=0;function mP(e=!1){return!e&&mM?Promise.resolve(mM):(e&&(mT=null),mT??=fetch("/api/tts/backend").then(e=>{if(!e.ok)throw Error("TTS configuration unavailable");return e.json()}).then(e=>(mO(e),e)).catch(e=>{throw mT=null,e}))}function mO(e){for(let t of(mM=e,mT=Promise.resolve(e),m$))t(e)}function mD(){let e=mI;mI=null,e?.()}function mL(e,t){let n=e.options.find(t=>t.id===e.backend);return`${n.id}\0${n.model}\0${n.voice}\0${t.slice(0,4e3)}`}function mF({text:e}){let{locale:t,t:n}=(0,er.Ym)(),r=rq(),[i,a]=(0,B.useState)(mM),[s,l]=(0,B.useState)(!1),[o,c]=(0,B.useState)(null),[d,u]=(0,B.useState)("idle"),[p,m]=(0,B.useState)(""),[f,h]=(0,B.useState)({elapsed:0,total:0}),x=(0,B.useRef)(0),g=(0,B.useRef)(!0),b=(0,B.useRef)(null),v=(0,B.useRef)(null),w=(0,B.useRef)(null);if((0,B.useEffect)(()=>{g.current=!0;let e=!0,n=t=>{e&&a(t)};return m$.add(n),mP().then(t=>{e&&a(t)}).catch(()=>{e&&c((0,er.Tl)(t,"tts.configError"))}),()=>{e=!1,m$.delete(n),g.current=!1,x.current+=1,mI===b.current&&mD()}},[t]),(0,B.useEffect)(()=>{if(!s)return;let e=Array.from(w.current?.querySelectorAll("button:not(:disabled)")??[]);e.at(-1)?.focus()},[s]),!i||!e)return null;let y=i.options.find(e=>e.id===i.backend);if(!y)return null;let k=mL(i,e),j=mE.get(k),N=()=>{l(!1),queueMicrotask(()=>v.current?.focus())},S=(e,t)=>{let r=!1,i=()=>{!r&&(r=!0,e.pause(),mI===i&&(mI=null),b.current===i&&(b.current=null),g.current&&x.current===t&&(u("idle"),m(n("tts.stopped")),h({elapsed:0,total:0})))};return b.current=i,mI=i,e.onloadedmetadata=()=>h({elapsed:e.currentTime,total:Number.isFinite(e.duration)?e.duration:0}),e.ontimeupdate=()=>h({elapsed:e.currentTime,total:Number.isFinite(e.duration)?e.duration:0}),e.onended=i,e.onerror=i,u("playing"),m(n("tts.playing")),{cleanup:i}},C=async(t,r)=>{mD();let i=++x.current,a=new AbortController,s=!1,o=(e=!0)=>{!s&&(s=!0,a.abort(),t.pause(),mI===o&&(mI=null),b.current===o&&(b.current=null),g.current&&x.current===i&&(u("idle"),e&&m(n("tts.stopped"))))};b.current=o,mI=o,u("loading"),m(n("tts.generating")),l(!1),c(null);try{await r;let l=await fetch("/api/tts",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:e.slice(0,4e3)}),signal:a.signal});if(!l.ok)throw Error(n("tts.requestError",{status:l.status}));let o=await l.blob();if(a.signal.aborted||x.current!==i)return;let d=function(e,t){let n=mE.get(e);if(n)return n;let r={url:URL.createObjectURL(t),bytes:t.size};for(mE.set(e,r),mR+=r.bytes;mE.size>8||mR>0x1000000&&mE.size>1;){let e=mE.entries().next().value;if(!e)break;mE.delete(e[0]),mR-=e[1].bytes,URL.revokeObjectURL(e[1].url)}return r}(k,o);t.pause(),t.muted=!1,t.src=d.url,t.currentTime=0,s=!0;let{cleanup:u}=S(t,i);await t.play().catch(()=>{c(n("tts.playError")),m(n("tts.playError")),u()})}catch(e){if(!a.signal.aborted){let t=e instanceof Error?e.message:n("tts.requestFailed");c(t),m(t)}o(!1)}},A=()=>{let t=new Audio;t.muted=!0,t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAACAgICA";let r=t.play();mP(!0).then(i=>{if(mL(i,e)!==k){t.pause(),a(i),c(n("tts.backendChanged")),l(!1);return}C(t,r)}).catch(()=>{t.pause(),c(n("tts.configError"))})},I=async e=>{if(i.lockedByEnv)return;let t=await fetch("/api/tts/backend",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({backend:e})});if(t.ok){let e=await t.json();mO(e),a(e)}},M="idle"!==d;return(0,F.jsxs)("span",{className:"relative",children:[(0,F.jsx)("button",{ref:v,type:"button",onClick:()=>{b.current?b.current():(c(null),j?(()=>{if(!j)return;mE.delete(k),mE.set(k,j),mD();let e=++x.current,t=new Audio(j.url),{cleanup:r}=S(t,e);t.play().catch(()=>{c(n("tts.playError")),m(n("tts.playError")),r()})})():mP(!0).then(e=>{a(e),l(!0)}).catch(()=>c(n("tts.configError"))))},className:`inline-flex items-center justify-center rounded-md text-muted transition-opacity hover:bg-sunken hover:text-primary focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"h-11 w-11":"p-1"} opacity-70 hover:opacity-100 group-hover/msg:opacity-100`,"aria-label":M?n("tts.stop"):j?n("tts.replay"):n("tts.read"),title:M?n("tts.stop"):j?n("tts.replayFree"):n("tts.readPaid"),children:M?(0,F.jsx)(mS.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,F.jsx)(lB.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,F.jsx)("span",{role:"status","aria-live":"polite",className:"sr-only",children:p}),"playing"===d&&f.total>0?(0,F.jsxs)("span",{className:"text-[10px] tabular-nums text-muted",children:[Math.floor(f.elapsed)," / ",Math.ceil(f.total),"s"]}):null,s?(0,F.jsxs)("span",{ref:w,role:"dialog","aria-modal":"true","aria-label":n("tts.confirmAria"),onKeyDown:e=>{if("Escape"===e.key){e.preventDefault(),N();return}if("Enter"===e.key&&y.available){e.preventDefault(),A();return}if("Tab"!==e.key)return;let t=Array.from(w.current?.querySelectorAll("button:not(:disabled)")??[]);if(!t.length)return;let n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):e.shiftKey||document.activeElement!==r||(e.preventDefault(),n.focus())},className:"absolute right-0 top-7 z-50 block w-72 rounded-xl border border-border bg-card p-3 text-left shadow-xl",children:[(0,F.jsx)("span",{className:"block text-xs font-bold text-primary",children:n("tts.confirmTitle")}),(0,F.jsxs)("span",{className:"mt-1 block text-[11px] text-muted",children:[y.id," \xb7 ",y.model," \xb7 ",y.voice]}),(0,F.jsx)("span",{className:"block text-[11px] text-muted",children:n("tts.characters",{count:e.length.toLocaleString()})}),(0,F.jsx)("span",{className:"mt-2 block text-[11px] text-primary",children:n("tts.billing",{provider:y.id})}),(0,F.jsx)("span",{className:"block text-[11px] text-primary",children:n("tts.disclosure")}),e.length>4e3?(0,F.jsx)("span",{className:"mt-2 block text-[11px] font-semibold text-danger",children:n("tts.shorten",{count:4e3.toLocaleString()})}):null,y.available?null:(0,F.jsx)("span",{className:"mt-2 block break-all text-[11px] text-danger",children:n("tts.missingKey",{provider:y.id,path:y.keyPath})}),(0,F.jsx)("span",{className:"mt-2 flex flex-wrap gap-1",children:i.options.map(e=>(0,F.jsxs)("button",{type:"button",disabled:i.lockedByEnv,onClick:()=>void I(e.id),className:`inline-flex items-center rounded bg-sunken text-[10px] font-semibold disabled:opacity-50 ${r?"min-h-11 px-3":"px-2 py-1"}`,children:[e.id,e.id===i.backend?" ✓":""]},e.id))}),(0,F.jsxs)("span",{className:"mt-3 flex justify-end gap-2",children:[(0,F.jsx)("button",{type:"button",onClick:N,className:`inline-flex items-center rounded text-xs text-muted ${r?"min-h-11 px-3":"px-2 py-1"}`,children:n("tts.cancel")}),(0,F.jsx)("button",{type:"button",disabled:!y.available,onClick:A,className:`inline-flex items-center rounded bg-accent text-xs font-bold text-white disabled:opacity-50 ${r?"min-h-11 px-3":"px-2 py-1"}`,children:n("tts.speak")})]})]}):null,o?(0,F.jsx)("span",{role:"alert",className:"absolute right-0 top-7 z-40 w-56 rounded bg-card p-2 text-[11px] text-danger shadow",children:o}):null]})}var m_=n(9383),mq=n(2841),mz=n(3769),mH=n(4825),mB=n(4551),mU=n(1275),mK=n(5484),mY=n(5606);let mW={bot:cr.A,message:m_.A,task:cx.A,pipeline:mq.A,link:d4.A,conversation:mz.A,deploy:mH.A,tool:uE.A};function mJ(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function mV({link:e,conversationAvailability:t}){let n="conversation"===e.kind&&(!t.loaded||!t.ids.has(e.id)),r="inline-flex min-h-6 shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[10.5px] font-semibold transition-colors [@media(pointer:coarse)]:min-h-8";return n?(0,F.jsxs)("span",{"data-testid":`mcp-link-${e.kind}`,"aria-disabled":"true",title:"This conversation will open after the scanner attributes it.",className:`${r} cursor-wait border-border bg-sunken text-muted opacity-60`,children:[(0,F.jsx)(mB.A,{className:"h-3 w-3","aria-hidden":!0}),e.label]}):(0,F.jsxs)("a",{"data-testid":`mcp-link-${e.kind}`,href:e.href,onClick:t=>{"conversation"!==e.kind&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("llv:mcp-navigate",{detail:{kind:e.kind,id:e.id}})))},className:`${r} border-accent/35 bg-accent-soft text-accent hover:border-accent hover:bg-accent/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/45`,children:["conversation"===e.kind?(0,F.jsx)(mB.A,{className:"h-3 w-3","aria-hidden":!0}):(0,F.jsx)(mU.A,{className:"h-3 w-3","aria-hidden":!0}),e.label]})}function mG({event:e,availableConversationIds:t}){var n;let r,i,a,s=e.mcp,l=s?.result,o=(0,B.useMemo)(()=>(0,mY.Y)(s?.toolName??e.tool,s?.args??{},l),[e.tool,s?.args,s?.toolName,l]),c=function(e){let[t,n]=(0,B.useState)(n7);return(0,B.useEffect)(()=>{if(!e)return n8.add(n),()=>n8.delete(n)},[e]),e?{loaded:!0,ids:e}:t}(t),d="run"===e.status?"pending":"err"===e.status?"error":"success",u=mW[o.icon],p=!0===mJ(l).replayed||!0===mJ(l).replay,m=!0===mJ(l).retryable,f="error"===d?(n=e.outputPreview,i="string"==typeof(r=mJ(l)).error?r.error.trim():"",a="string"==typeof mJ(r.error).message?String(mJ(r.error).message).trim():"",i||a||n.trim()||"MCP call failed"):"",h=(0,B.useMemo)(()=>(function(e,t){try{return JSON.stringify({arguments:e,...void 0===t?{}:{result:t}},null,2)}catch{return"Payload could not be serialized."}})(s?.args??{},l),[s?.args,l]);return(0,F.jsxs)("article",{"data-testid":"mcp-call-card","data-state":d,className:"group/mcp relative my-1 ml-9",children:["pending"===d?(0,F.jsx)("div",{"data-testid":"mcp-call-progress",className:"absolute inset-x-0 top-0 h-0.5 animate-pulse bg-gradient-to-r from-transparent via-accent to-transparent"}):null,(0,F.jsxs)("details",{className:"min-w-0",children:[(0,F.jsxs)("summary",{className:"flex min-w-0 cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-0.5 rounded-control py-0.5 text-ui hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden",children:[(0,F.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 ${"error"===d?"text-danger":"success"===d?"text-success":"text-accent"} ${"pending"===d?"animate-pulse":""}`,"aria-hidden":!0}),(0,F.jsxs)("span",{className:"shrink-0 font-mono text-[9.5px] font-semibold uppercase tracking-[0.08em] text-muted",children:["MCP \xb7 ",s?.serverName??"viewer"]}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold text-secondary",title:o.title,children:o.title}),p?(0,F.jsx)("span",{"data-testid":"mcp-replay",className:"shrink-0 rounded-full bg-accent-soft px-1.5 py-0.5 text-[10px] font-bold text-accent",children:"Replay"}):null,m?(0,F.jsx)("span",{className:"shrink-0 rounded-full bg-danger-soft px-1.5 py-0.5 text-[10px] font-bold text-danger",children:"Retryable"}):null,o.links.map(e=>(0,F.jsx)(mV,{link:e,conversationAvailability:c},`${e.kind}:${e.id}`)),(0,F.jsx)("span",{className:`inline-flex shrink-0 items-center ${"error"===d?"text-danger":"success"===d?"text-success":"text-accent"}`,role:"pending"===d?"status":void 0,"aria-label":"pending"===d?`${o.verb}…`:d,children:"pending"===d?(0,F.jsx)(up.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):"success"===d?(0,F.jsx)(u3.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,F.jsx)(mK.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,tt.T0)(e.ts)?(0,F.jsx)("span",{className:"shrink-0 text-caption tabular-nums text-muted",children:(0,tt.T0)(e.ts)}):null]}),(0,F.jsxs)("div",{className:"ml-5 mt-1 text-[10.5px] text-muted",children:[o.subtitle?(0,F.jsx)("div",{className:"mb-1 truncate font-mono",title:o.subtitle,children:o.subtitle}):null,(0,F.jsx)("pre",{className:"max-h-[320px] max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] border-t border-border pt-1.5 font-mono text-[10.5px] text-secondary",children:h})]})]}),"error"===d?(0,F.jsx)("div",{className:"ml-5 border-l-2 border-danger pl-2 text-[11px] font-semibold text-danger",children:f}):null]})}let mX=(0,B.memo)(function({item:e,speakText:t}){if("image"===e.kind)return(0,F.jsx)(md,{media:e.media,data:e.data,w:e.w,h:e.h,bytes:e.bytes});if("inbox-image"===e.kind)return(0,F.jsx)(pJ,{name:e.name,path:e.path});if("blob"===e.kind)return(0,F.jsx)(pV,{bytes:e.bytes,text:e.text});if("sysmsg"===e.kind)return(0,F.jsx)(mw,{label:e.label,text:e.text});if("compact"===e.kind)return(0,F.jsx)(mc,{item:e});if("review"===e.kind)return(0,F.jsx)(mb,{item:e});if("record"===e.kind)return(0,F.jsx)(mv,{item:e});if("mem-citation"===e.kind)return(0,F.jsx)(mu,{item:e});if("prose"===e.kind){let n="codex"===e.engine?"bg-codex":"bg-claude",r="codex"===e.engine?i9.uB:i9.RE;return(0,F.jsxs)("div",{className:"group/msg my-3 flex gap-2.5",children:[(0,F.jsx)("div",{className:`mt-1 flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-full text-white ${n}`,children:(0,F.jsx)(r,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,F.jsxs)("div",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:[(0,F.jsxs)("div",{className:"mb-0.5 flex min-h-6 items-center gap-1",children:[(0,tt.T0)(e.ts)?(0,F.jsx)("span",{className:"text-label tabular-nums text-muted",children:(0,tt.T0)(e.ts)}):null,(0,F.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[t?(0,F.jsx)(mF,{text:t}):null,(0,F.jsx)(u9.i,{text:e.text,label:(0,pl.tr)("feed.copyMd"),className:pa})]})]}),pN(e.text)]})]})}if("voice"===e.kind)return(0,F.jsxs)("div",{className:"group/msg my-3 flex items-start justify-end gap-1.5",children:[(0,F.jsx)(u9.i,{text:e.input||e.delta,label:(0,pl.tr)("feed.copyMd"),className:`mt-2 ${pa}`}),(0,F.jsxs)("div",{className:"max-w-[75%] rounded-surface bg-user px-4 py-2.5",children:[(0,F.jsxs)("span",{className:"mb-1 flex items-center gap-1 text-caption uppercase tracking-wide text-muted",children:[(0,F.jsx)(i9.GO,{className:"h-3 w-3","aria-hidden":!0}),(0,pl.tr)("feed.voiceTurn")]}),e.input?(0,F.jsx)("p",{className:"whitespace-pre-wrap break-words",children:e.input}):null,e.delta?(0,F.jsxs)("details",{className:"mt-1.5",children:[(0,F.jsx)("summary",{className:"cursor-pointer list-none text-caption text-muted [&::-webkit-details-marker]:hidden",children:(0,pl.tr)("feed.voiceContext")}),(0,F.jsx)("pre",{className:"mt-1 whitespace-pre-wrap break-words text-label text-secondary",children:e.delta})]}):null]})]});if("user"===e.kind){let t=e.text.length>500;return(0,F.jsxs)("div",{className:"group/msg my-3 flex items-start justify-end gap-1.5",children:[(0,F.jsx)(u9.i,{text:e.text,label:(0,pl.tr)("feed.copyMd"),className:`mt-2 ${pa}`}),(0,F.jsx)("div",{className:"max-w-[75%] whitespace-pre-wrap break-words rounded-surface bg-user px-4 py-2.5",children:t?(0,F.jsxs)("details",{className:"group/usr",children:[(0,F.jsxs)("summary",{className:"cursor-pointer list-none [&::-webkit-details-marker]:hidden",children:[(0,F.jsxs)("span",{className:"group-open/usr:hidden",children:[e.text.slice(0,180),"… ",(0,F.jsxs)("span",{className:"font-semibold text-accent",children:["(",(0,pl.tr)("common.chars",{n:e.text.length}),")"]})]}),(0,F.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-muted group-open/usr:inline-flex",children:[(0,pl.tr)("common.collapse")," ",(0,F.jsx)(i9.rX,{className:"h-3 w-3","aria-hidden":!0})]})]}),pN(e.text)]}):pN(e.text)})]})}if("tool"===e.kind&&e.mcp)return(0,F.jsx)(mG,{event:e});if("tool"===e.kind&&e.wakeup)return(0,F.jsx)(mN,{event:e,wakeup:e.wakeup});if("tool"===e.kind)return(0,F.jsx)(ml,{event:e});if("cmd-group"===e.kind)return(0,F.jsx)(mo,{item:e});if("tmsg"===e.kind){let t=function(e){let t=e.trim();if((t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1).trim()),!t.startsWith("{"))return null;try{let e=JSON.parse(t);if(null!==e&&"object"==typeof e&&!Array.isArray(e))return e}catch{}return null}(e.text),n=e.text.length>420||e.text.split("\n").length>6;return(0,F.jsxs)("div",{className:"my-3 ml-9 overflow-hidden rounded-surface border border-accent/25 bg-accent-soft shadow-1",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2",children:[(0,F.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent",children:(0,F.jsx)(i9.gE,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,F.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:"out"===e.dir?(0,pl.tr)("render.toDir"):(0,pl.tr)("render.fromDir")}),(0,F.jsx)("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-bold text-accent",children:e.peer}),e.delivery?(0,F.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${"ok"===e.delivery?"text-success":"text-danger"}`,title:e.msgId?`msg_id: ${e.msgId}`:void 0,children:["ok"===e.delivery?(0,F.jsx)(i9.Jl,{className:"h-3 w-3","aria-hidden":!0}):(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0}),"ok"===e.delivery?(0,pl.tr)("render.delivered"):(0,pl.tr)("render.notDelivered")]}):null,(0,tt.T0)(e.ts)?(0,F.jsx)("span",{className:"ml-auto shrink-0 text-label tabular-nums text-muted",children:(0,tt.T0)(e.ts)}):null]}),(0,F.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:t?(0,F.jsx)(mx,{payload:t}):(0,F.jsxs)(F.Fragment,{children:[e.summary?(0,F.jsx)("div",{className:"text-[13px] font-bold",children:px(e.summary)}):null,n?(0,F.jsxs)("details",{className:"group/tmsg mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:[(0,F.jsxs)("summary",{className:"cursor-pointer list-none text-[12.5px] text-secondary [&::-webkit-details-marker]:hidden",children:[(0,F.jsxs)("span",{className:"group-open/tmsg:hidden",children:[e.text.slice(0,260).trimEnd(),"… ",(0,F.jsx)("span",{className:"font-semibold text-accent",children:(0,pl.tr)("common.showAll")})]}),(0,F.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-muted group-open/tmsg:inline-flex",children:[(0,pl.tr)("common.collapse")," ",(0,F.jsx)(i9.rX,{className:"h-3 w-3","aria-hidden":!0})]})]}),pN(e.text)]}):(0,F.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:pN(e.text)})]})})]})}if("tnote"===e.kind)return(0,F.jsxs)("div",{className:"my-0.5 ml-9 flex items-center gap-1.5 text-label text-muted",children:[(0,F.jsx)(i9.gE,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),e.text]});if("think"===e.kind){let t=e.text.length>150;return(0,F.jsxs)("details",{className:"my-0.5 ml-9 text-label italic text-muted",children:[(0,F.jsxs)("summary",{className:`flex list-none items-center gap-1.5 truncate ${t?"cursor-pointer [@media(pointer:coarse)]:min-h-11":""}`,title:(0,pl.tr)("render.reasoning"),children:[(0,F.jsx)(i9.jy,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,F.jsxs)("span",{className:"truncate",children:[e.text.slice(0,150),t?"…":""]})]}),t?(0,F.jsx)("div",{className:"whitespace-pre-wrap break-words pt-1 not-italic",children:pN(e.text)}):null]})}return"svc"===e.kind?(0,F.jsx)("div",{className:"my-1 break-words text-[11.5px] text-muted",children:e.text}):"note"===e.kind?(0,F.jsx)("div",{className:"my-2 break-words text-[12.5px] text-muted",children:px(e.text)}):(0,F.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${e.err?"text-danger":"text-secondary"}`,children:e.text})}),mQ=(0,B.createContext)(()=>null).Provider;class mZ{constructor(e){if(this.limit=e,this.values=new Map,!Number.isInteger(e)||e<1)throw Error("BoundedLru limit must be a positive integer")}get size(){return this.values.size}get(e){let t=this.values.get(e);if(void 0!==t)return this.values.delete(e),this.values.set(e,t),t}set(e,t){for(this.values.delete(e),this.values.set(e,t);this.values.size>this.limit;){let e=this.values.keys().next().value;if(void 0===e)return;this.values.delete(e)}}}var m0=n(9267),m1=n(9339);function m2(e){return`llvQuestionDismissed:${e.transcriptPath}:${e.toolUseId}`}function m5(){try{return window.localStorage}catch{return null}}function m3(e,t={}){return t.noPane?"question.noPane":400===e?"question.errorRejected":403===e?"question.errorNotRunning":409===e?"question.errorMoved":502===e?t.delivered?"question.errorUnconfirmed":"question.errorNotDelivered":e>=500?"common.serverUnavailable":"common.failedSend"}function m4({file:e}){let{t}=(0,er.Ym)(),n=rq(),r=n?"min-h-11":"",i=e.pendingQuestion,[a,s]=(0,B.useState)("pending"),[l,o]=(0,B.useState)(""),[c,d]=(0,B.useState)({}),[u,p]=(0,B.useState)(""),[m,f]=(0,B.useState)(""),[h,x]=(0,B.useState)(!1),[g,b]=(0,B.useState)(null),[v,w]=(0,B.useState)(null),[y,k]=(0,B.useState)(null),j=i?null!==i.paneTarget:null!==e.pid&&"running"===e.proc,N=(0,B.useMemo)(()=>i?.questions?i.questions.map((e,t)=>(c[t]??[]).map(t=>e.options[t]?.label??String(t+1)).join(", ")).filter(Boolean).join(" \xb7 "):"",[c,i]);if(!i){if(!e.waitingInput)return null;let i=e.waitingInput.menu,c="delivering"===a,d=async(n,r)=>{s("delivering"),o("");try{let a=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"dialog-key",path:e.path,key:n,...i?{question:i.question}:{},.../^[1-9]$/.test(n)?{label:r}:{}})}),l=await a.json();if(!a.ok||!l.ok){s("failed"),o(t(m3(a.status)));return}s("answered"),o(r)}catch{s("failed"),o(t("common.serverUnavailable"))}};return"answered"===a?(0,F.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-success/25 bg-success-soft px-4 py-3 text-[13px] font-semibold text-success",children:t("question.sentToPane",{text:l})}):(0,F.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-warning/45 bg-warning-soft p-4 shadow-1",children:[(0,F.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-warning-soft px-2 py-0.5 text-[11px] font-bold text-warning",children:[(0,F.jsx)(m0.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),(0,F.jsxs)("div",{className:"text-[13px] font-semibold text-primary",children:[t("question.pane",{target:e.waitingInput.target})," \xb7 ",function(e,t){let n=Math.max(0,Math.floor(Date.now()/1e3-t));if(n<60)return e("question.sec",{n:n});let r=Math.floor(n/60);return r<60?e("question.min",{n:r}):e("question.hour",{n:Math.floor(r/60)})}(t,e.waitingInput.since)]}),i?(0,F.jsxs)(F.Fragment,{children:[i.tabs.length?(0,F.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:i.tabs.map((e,t)=>(0,F.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-bold ${e.done?"bg-success/15 text-success":"bg-canvas text-muted"}`,children:[e.done?"✓ ":"",e.label]},t))}):null,(0,F.jsx)("div",{className:"mt-2 text-[14px] font-bold text-primary",children:i.question}),(0,F.jsx)("div",{className:"mt-2 space-y-1.5",children:i.options.map(e=>(0,F.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 disabled:opacity-60 ${r} ${e.recommended?"border-warning/45 bg-warning-soft":"border-border bg-canvas"}`,disabled:c||e.value>9,onClick:()=>void d(String(e.value),e.label),children:[(0,F.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-border bg-card text-[10px] font-bold",children:e.value}),(0,F.jsxs)("span",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"block text-[13px] font-bold",children:e.label}),e.description?(0,F.jsx)("span",{className:"block text-[12px] text-muted",children:e.description}):null]})]},e.value))})]}):(0,F.jsx)("pre",{className:"mt-2 max-h-[240px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-border bg-canvas px-3 py-2 text-[12px] text-muted",children:e.waitingInput.screenTail}),(0,F.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[["Tab","Enter","Escape"].map(e=>(0,F.jsx)("button",{className:`inline-flex items-center justify-center rounded-[8px] border border-border bg-canvas text-[12px] font-semibold text-muted disabled:opacity-60 ${n?"min-h-11 min-w-11 px-3":"px-2.5 py-1"}`,disabled:c,onClick:()=>void d(e,"Escape"===e?"Esc":e),children:"Escape"===e?"Esc":e},e)),(0,F.jsx)("span",{className:"text-[12px] text-muted",children:t("question.keysHint")})]}),"delivering"===a?(0,F.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-muted",children:[(0,F.jsx)(up.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===a?(0,F.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-danger",children:l}):null]})}if(y===i.toolUseId||function(e,t){try{return e?.getItem(m2(t))==="1"}catch{return!1}}(m5(),i))return null;let S=(0,F.jsx)("button",{type:"button","aria-label":t("question.dismiss"),className:`ml-auto inline-flex shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"h-11 w-11":"px-0.5"}`,onClick:()=>{var e=m5();try{e?.setItem(m2(i),"1")}catch{}k(i.toolUseId)},children:(0,F.jsx)(H.A,{className:n?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),C=async(e,n,r=null)=>{s("delivering"),o(""),b({payload:e,optimistic:n,selection:r}),w(null);try{let a=await fetch("/api/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({transcriptPath:i.transcriptPath,toolUseId:i.toolUseId,kind:i.kind,...e})}),l=await a.json();if(!a.ok||!l.ok){if(409===a.status&&(l.superseded||l.answer)){s("superseded"),o(l.answer??t("question.alreadyAnswered"));return}s("failed"),o(t(m3(a.status,l))),w(r);return}s("answered"),o(l.answer??n)}catch{s("failed"),o(t("common.serverUnavailable")),w(r)}},A=(e=c)=>i.questions?.map((t,n)=>e[n]??[])??[],I=i.questions?.length??0,M=I>1||(i.questions?.some(e=>e.multiSelect)??!1),T=i.questions?.every((e,t)=>(c[t]??[]).length>0)??!1,$=async()=>{x(!0),o("");try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:e.path})}),r=await n.json();if(!n.ok||!r.ok)return void o(t("question.openFailed"));o(t("question.opened",{target:r.target??"tmux"}))}catch{o(t("common.serverUnavailable"))}finally{x(!1)}},E="delivering"===a||!j;return"answered"===a?(0,F.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-success/25 bg-success-soft px-4 py-3 text-[13px] font-semibold text-success",children:t("question.answered",{text:l||N})}):"superseded"===a?(0,F.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-border bg-sunken px-4 py-3 text-[13px] font-semibold text-muted",children:t("question.answeredElsewhere",{text:l})}):i&&!j?(0,F.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-warning/45 bg-warning-soft p-4 shadow-1",children:[(0,F.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,F.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-warning-soft px-2 py-0.5 text-[11px] font-bold text-warning",children:[(0,F.jsx)(m0.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),S]}),(0,F.jsx)("div",{className:"text-[13px] font-semibold text-danger",children:t("question.noPane")}),"plan"===i.kind?(0,F.jsx)("pre",{className:"mt-2 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-border bg-canvas px-3 py-2 text-[13px]",children:i.plan}):i.questions?.map((e,t)=>(0,F.jsxs)("div",{className:"mt-2",children:[(0,F.jsx)("div",{className:"text-[12px] font-bold text-muted",children:e.header}),(0,F.jsx)("div",{className:"text-[13px] font-semibold text-primary",children:e.question})]},t)),(0,F.jsx)("button",{className:"mt-3 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:h,onClick:$,children:t("question.openSession")}),l?(0,F.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-muted",children:l}):null]}):(0,F.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-warning/45 bg-warning-soft p-4 shadow-1",children:[(0,F.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,F.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-warning-soft px-2 py-0.5 text-[11px] font-bold text-warning",children:[(0,F.jsx)(m0.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),j?null:(0,F.jsx)("span",{className:"text-[12px] font-semibold text-danger",children:t("question.noPane")}),S]}),"plan"===i.kind?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("pre",{className:"max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-border bg-canvas px-3 py-2 text-[13px]",children:i.plan}),(0,F.jsx)("textarea",{className:"mt-3 min-h-20 w-full resize-y rounded-[8px] border border-border bg-canvas px-3 py-2 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:t("question.rejectComment"),value:m,onChange:e=>f(e.target.value)}),(0,F.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,F.jsxs)("button",{className:`inline-flex items-center gap-1.5 rounded-[8px] bg-success px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60 ${r}`,disabled:E,onClick:()=>C({approve:!0},t("question.approved")),children:[(0,F.jsx)(m1.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("question.approve")]}),(0,F.jsxs)("button",{className:`inline-flex items-center gap-1.5 rounded-[8px] bg-danger px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60 ${r}`,disabled:E,onClick:()=>C({approve:!1,text:m},t("question.rejected")),children:[(0,F.jsx)(H.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("question.reject")]})]})]}):(0,F.jsxs)(F.Fragment,{children:[i.questions?.map((e,n)=>(0,F.jsxs)("section",{className:"mt-3 first:mt-0",children:[(0,F.jsx)("div",{className:"mb-1 inline-flex rounded-full bg-canvas px-2 py-0.5 text-[11px] font-bold text-muted",children:e.header}),(0,F.jsx)("div",{className:"mb-2 text-[14px] font-bold text-primary",children:e.question}),(0,F.jsx)("div",{className:"space-y-1.5",children:e.options.map((i,a)=>{let s=(c[n]??[]).includes(a),l=(v?.[n]??[]).includes(a);return(0,F.jsxs)("button",{"data-choice-state":l?"failed":s?"selected":void 0,className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 ${r} ${l?"border-danger/45 bg-danger-soft":s?"border-accent/45 bg-accent/10":i.recommended?"border-warning/45 bg-warning-soft":"border-border bg-canvas"}`,disabled:E,onClick:()=>{var t;let r={...c,[n]:[a]};t=e.multiSelect,w(null),d(e=>{let r=e[n]??[],i=t?r.includes(a)?r.filter(e=>e!==a):[...r,a]:[a];return{...e,[n]:i}}),e.multiSelect||1!==I||C({answers:A(r)},i.label,r)},children:[(0,F.jsx)("span",{className:`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border bg-card text-[10px] font-bold ${l?"border-danger/45 text-danger":"border-border"}`,children:l?"!":s?"✓":a+1}),(0,F.jsxs)("span",{className:"min-w-0",children:[(0,F.jsxs)("span",{className:"block text-[13px] font-bold",children:[i.label,l?(0,F.jsxs)("span",{className:"ml-1.5 font-semibold text-danger",children:["\xb7 ",t("question.failedChoice")]}):null]}),i.description?(0,F.jsx)("span",{className:"block text-[12px] text-muted",children:i.description}):null]})]},a)})})]},n)),I<=1?(0,F.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,F.jsx)("input",{className:`min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-3 py-1.5 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35 ${r}`,placeholder:t("question.ownAnswer"),value:u,onChange:e=>p(e.target.value)}),(0,F.jsxs)("button",{className:`inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60 ${r}`,disabled:E||!u.trim(),onClick:()=>C({text:u},u),children:[(0,F.jsx)(m_.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("common.send")]})]}):null,M?(0,F.jsxs)("button",{className:`mt-3 inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60 ${r}`,disabled:E||!T,onClick:()=>C({answers:A()},N,c),children:[(0,F.jsx)(m_.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("common.send")]}):null]}),"delivering"===a?(0,F.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-muted",children:[(0,F.jsx)(up.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===a?(0,F.jsxs)("div",{role:"alert",className:"mt-3 flex flex-wrap items-center gap-2 rounded-[8px] border border-danger/30 bg-danger-soft px-2.5 py-2",children:[(0,F.jsx)("span",{className:"text-[12px] font-bold text-danger",children:t("question.deliveryFailed")}),(0,F.jsx)("span",{className:"min-w-0 text-[12px] font-semibold text-danger",children:l}),g?(0,F.jsxs)("button",{type:"button",className:`ml-auto inline-flex items-center gap-1.5 rounded-[8px] border border-border bg-card px-3 py-1.5 text-[12px] font-bold text-primary hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${r}`,disabled:!j,onClick:()=>void C(g.payload,g.optimistic,g.selection),children:[(0,F.jsx)(ct.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.retryAnswer")]}):null]}):null]})}let m6={approval:"runtime.attention.approval",permission:"runtime.attention.permission",question:"runtime.attention.question",waiting_heuristic:"runtime.attention.waiting_heuristic"};function m8({attention:e,onApprove:t,onDeny:n,onAnswerQuestion:r,onAnswerQuestions:i,busy:a,archived:s=!1}){let{t:l}=(0,er.Ym)(),o=(0,B.useRef)(null),c="waiting_heuristic"===e.kind,d=function(e){let t=null===e?null:Math.max(0,Math.ceil(e/1e3)),[n,r]=(0,B.useState)(t),[i,a]=(0,B.useState)(e);return e!==i&&(a(e),r(t)),(0,B.useEffect)(()=>{if(null===e)return;let t=window.setInterval(()=>r(e=>null===e||e<=0?0:e-1),1e3);return()=>window.clearInterval(t)},[e]),n}(e.autoResolutionMs??null),[u,p]=(0,B.useState)({}),[m,f]=(0,B.useState)(e.id);m!==e.id&&(f(e.id),p({})),(0,B.useEffect)(()=>{if(s)return;let e=o.current;if(!e)return;let r=()=>Array.from(e.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(e=>!e.hasAttribute("disabled")),i=document.activeElement;i instanceof HTMLElement&&("TEXTAREA"===i.tagName||"INPUT"===i.tagName||i.isContentEditable)||r()[0]?.focus({preventScroll:!0});let a=e=>{if("Escape"===e.key&&n){e.preventDefault(),n();return}if("Enter"===e.key&&t&&e.target?.tagName!=="BUTTON"){e.preventDefault(),t();return}if("Tab"!==e.key)return;let i=r();if(0===i.length)return;let a=i[0],s=i[i.length-1];e.shiftKey&&document.activeElement===a?(e.preventDefault(),s.focus({preventScroll:!0})):e.shiftKey||document.activeElement!==s||(e.preventDefault(),a.focus({preventScroll:!0}))};return e.addEventListener("keydown",a),()=>e.removeEventListener("keydown",a)},[e.id,t,n,s]);let h=e.request.questions??(e.request.question?[e.request.question]:[]),x=e.unowned?"border-danger/60 bg-danger/5":c?"border-dashed border-border bg-canvas":"border-warning/45 bg-warning-soft";return(0,F.jsxs)("div",{ref:o,role:"group","aria-label":l("runtime.attention.title"),"data-attention-kind":e.kind,"data-attention-archived":s||void 0,className:`my-3 rounded-[8px] border p-4 shadow-1 ${x} ${s?"opacity-60 saturate-50":""}`,children:[(0,F.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[e.unowned&&!s?(0,F.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-danger/15 px-2 py-0.5 text-[11px] font-bold text-danger",role:"alert",children:[(0,F.jsx)(_.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l("runtime.attention.unowned")]}):null,(0,F.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-bold ${c?"bg-sunken text-muted":"bg-warning-soft text-warning"}`,children:l(m6[e.kind])}),c?(0,F.jsx)("span",{className:"text-[11px] text-muted",children:l("runtime.attention.heuristicNote")}):null,null===d||s?null:(0,F.jsx)("span",{className:"text-[11px] font-semibold text-muted",role:"timer","aria-live":"off",children:l("runtime.attention.expiresIn",{seconds:d})})]}),e.request.title?(0,F.jsx)("div",{className:"text-[13px] font-semibold text-primary",children:e.request.title}):null,e.request.command?(0,F.jsxs)("pre",{className:"mt-2 max-h-[220px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-border bg-canvas px-3 py-2 text-[12px]",children:[(0,F.jsx)("span",{className:"mb-1 block text-[10px] font-semibold text-secondary",children:l("runtime.attention.command")}),e.request.command]}):null,e.request.tool?(0,F.jsxs)("div",{className:"mt-2 text-[13px]",children:[(0,F.jsx)("span",{className:"text-[11px] font-semibold text-secondary",children:l("runtime.attention.tool")})," ",(0,F.jsx)("span",{className:"font-semibold text-primary",children:e.request.tool})]}):null,e.request.detail?(0,F.jsx)("div",{className:"mt-2 text-[12px] text-muted",children:e.request.detail}):null,h.length>0&&!s?(0,F.jsxs)("div",{className:"mt-2 space-y-3",children:[h.map((e,t)=>{let n=h.length>1||!0===e.multiSelect,i=u[t]??[];return(0,F.jsxs)("div",{children:[e.header?(0,F.jsx)("div",{className:"text-[11px] font-bold text-muted",children:e.header}):null,(0,F.jsx)("div",{className:"text-[14px] font-bold text-primary",children:e.prompt}),(0,F.jsx)("div",{className:"mt-2 space-y-1.5",children:(e.options??[]).map((s,l)=>(0,F.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 disabled:opacity-60 ${i.includes(l)?"border-accent bg-accent/10":s.recommended?"border-warning/45 bg-warning-soft":"border-border bg-canvas"}`,disabled:a,onClick:()=>{n?p(n=>{let r=n[t]??[],i=e.multiSelect?r.includes(l)?r.filter(e=>e!==l):[...r,l]:[l];return{...n,[t]:i}}):r?.(l,t)},children:[(0,F.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-border bg-card text-[10px] font-bold",children:l+1}),(0,F.jsxs)("span",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"block text-[13px] font-bold",children:s.label}),s.description?(0,F.jsx)("span",{className:"block text-[12px] text-muted",children:s.description}):null]})]},l))})]},t)}),h.length>1||h.some(e=>e.multiSelect)?(0,F.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:a||h.some((e,t)=>!u[t]?.length),onClick:()=>i?.(h.map((e,t)=>u[t]??[])),children:[(0,F.jsx)(m1.A,{className:"h-4 w-4","aria-hidden":!0})," ",l("runtime.attention.answer")]}):null]}):null,("approval"===e.kind||"permission"===e.kind)&&(t||n)&&!s?(0,F.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t?(0,F.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-success px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:a,onClick:t,children:[(0,F.jsx)(m1.A,{className:"h-4 w-4","aria-hidden":!0})," ",l("runtime.attention.approve")]}):null,n?(0,F.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-danger px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:a,onClick:n,children:[(0,F.jsx)(H.A,{className:"h-4 w-4","aria-hidden":!0})," ",l("runtime.attention.deny")]}):null,(0,F.jsx)("span",{className:"text-[11px] text-muted",children:l("runtime.attention.keysHint")})]}):null,a&&!s?(0,F.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-muted",children:[(0,F.jsx)(up.A,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none","aria-hidden":!0})," ",l("runtime.attention.answering")]}):null,s?(0,F.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-muted",children:l("deadHost.expiredCard")}):null]})}function m7(e,t){let n=e.request.protocol;return n?.engine==="claude"?t?{behavior:"allow"}:{behavior:"deny",message:"Denied in Viewer"}:{decision:t?"accept":"decline"}}function m9(e,t){let n=e.request.questions??(e.request.question?[e.request.question]:[]),r=n.map((e,n)=>(t[n]??[]).map(t=>e.options?.[t]?.label??String(t+1))),i=e.request.protocol;if(i?.engine==="claude"){let e=Object.fromEntries(n.map((e,t)=>[e.prompt,r[t].join(", ")]));return{behavior:"allow",updatedInput:{...i.input??{},answers:e}}}let a=i?.questionIds??(i?.questionId?[i.questionId]:[]);return{answers:Object.fromEntries(r.map((e,t)=>[a[t]??`answer_${t+1}`,{answers:e}]))}}function fe({file:e}){let{t}=(0,er.Ym)(),n=aL(U(e)),[r,i]=(0,B.useState)(null),[a,s]=(0,B.useState)(null);if(!n||n.legacy)return e.pendingQuestion||e.waitingInput?(0,F.jsx)(m4,{file:e}):null;let l=!!n&&!n.legacy&&("dead"===n.session.host||"unhosted"===n.session.host),o=async(e,r)=>{var a,l;i(e.id),s(null);let o=await (a=n.session.conversationId,l=e.id,aq("/api/runtime/answer",{conversationId:a,attentionId:l,resolution:r,operationId:nU()}));o.ok||s(o.error??t("common.failedSend")),i(null)};return(0,F.jsxs)(F.Fragment,{children:[n.attentions.map(e=>(0,F.jsx)(m8,{attention:e,archived:l,busy:r===e.id,onApprove:l||"approval"!==e.kind&&"permission"!==e.kind?void 0:()=>void o(e,m7(e,!0)),onDeny:l||"approval"!==e.kind&&"permission"!==e.kind?void 0:()=>void o(e,m7(e,!1)),onAnswerQuestion:l||"question"!==e.kind?void 0:t=>{o(e,m9(e,[[t]]))},onAnswerQuestions:l||"question"!==e.kind?void 0:t=>void o(e,m9(e,t))},e.id)),a?(0,F.jsx)("div",{role:"alert",className:"my-2 text-[12px] font-semibold text-danger",children:a}):null]})}function ft(e,t){return"prose"===e.kind&&"prose"===t.kind&&e.engine===t.engine&&String(e.ts)===String(t.ts)}function fn({file:e}){let{t}=(0,er.Ym)();return"running"===e.proc?(0,F.jsxs)(an,{tone:"success","data-capture-volatile":"pid",children:[(0,F.jsx)(i9.jG,{className:"h-3 w-3","aria-hidden":!0})," PID ",e.pid]}):"killed"===e.proc||"stalled"===e.activity?(0,F.jsx)(an,{tone:"danger",children:t("task.interruptedBadge")}):"done"===e.proc?(0,F.jsx)(an,{tone:"neutral",children:t("task.finishedBadge")}):null}function fr({file:e,compact:t=!1,hideChip:n=!1}){let{t:r}=(0,er.Ym)(),i=rq(),[a,s]=(0,B.useState)(!1),[l,o]=(0,B.useState)(!1),[c,d]=(0,B.useState)(""),[u,p]=(0,B.useState)(!1),{caps:m,structuredSession:f}=lF(e),h=m.controls.kill;(0,B.useEffect)(()=>{if(!a)return;let e=window.setTimeout(()=>s(!1),5e3);return()=>window.clearTimeout(e)},[a]);let x=(0,F.jsx)(fn,{file:e}),g=async()=>{o(!0),d("");try{if(f){let e=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",conversationId:f.session.conversationId})}),t=await e.json();if(!e.ok||!t.ok)return void d(t.error??r("task.stopFailed"));d(r("task.killRequested")),s(!1);return}let t=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e.path,force:u})}),n=await t.json();if(!t.ok||!n.ok){d(n.error??r("task.stopFailed")),p(!0);return}d(r("task.signalSent",{signal:u?"SIGKILL":"SIGTERM",pid:n.pid??""})),s(!1)}catch{d(r("common.serverUnavailable")),p(!0)}finally{o(!1)}},b="disabled"===h.state,v=b?r(h.reason):"",w=(0,ei.cr)(e.title,48)||r("task.confirmKillUntitled");return(0,F.jsxs)("span",{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5 ${t?"text-[10.5px]":"text-xs"}`,children:[n?null:x,b?(0,F.jsx)(a3,{label:v,children:(0,F.jsx)("button",{type:"button","aria-disabled":!0,disabled:!0,"aria-label":`${r("task.kill")} — ${v}`,className:`inline-flex items-center whitespace-nowrap rounded-full border border-border bg-card text-[11px] font-semibold text-muted opacity-50 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,children:r("task.kill")})}):"enabled"===h.state?a?(0,F.jsxs)("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-[8px] border border-danger/30 bg-danger-soft px-1.5 py-0.5",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate px-1 text-[11px] font-semibold text-danger",title:null===e.pid?void 0:r("task.confirmKill",{pid:e.pid}),children:r("task.confirmKillNamed",{name:w})}),null===e.pid?null:(0,F.jsxs)("span",{className:"hidden shrink-0 text-[10px] tabular-nums text-muted sm:inline",children:["PID ",e.pid]}),(0,F.jsx)("button",{className:`inline-flex shrink-0 items-center whitespace-nowrap rounded-lg bg-danger text-[11px] font-bold tabular-nums text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/50 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,disabled:l,onClick:g,children:u?"SIGKILL":t?r("common.yes"):r("task.confirmKillYes")}),(0,F.jsx)("button",{className:`inline-flex items-center whitespace-nowrap rounded-lg border border-border bg-card text-[11px] font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,onClick:()=>s(!1),children:t?r("common.no"):r("common.cancel")})]}):(0,F.jsx)("button",{className:`inline-flex items-center whitespace-nowrap rounded-full border border-border bg-card text-[11px] font-semibold text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,"aria-label":r("task.stopAria",{pid:e.pid??""}),onClick:()=>s(!0),children:r("task.kill")}):null,c?(0,F.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-muted",children:c}):null]})}function fi({file:e}){let{t}=(0,er.Ym)();return"claude-tasks"!==e.root?null:(0,F.jsxs)("div",{className:"mb-4 mt-1 rounded-[12px] border border-border bg-card px-4 py-3 shadow-1",children:[(0,F.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,F.jsx)(fn,{file:e})}),e.cmd?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"mb-1 text-[13px] font-semibold",children:e.cmdDesc||t("task.backgroundCommand")}),(0,F.jsxs)("code",{className:"block whitespace-pre-wrap break-words rounded-lg border border-border bg-sunken px-2.5 py-2 font-mono text-[12px]",children:["$ ",e.cmd]})]}):(0,F.jsx)("div",{className:"text-[13px] text-muted",children:t("task.commandNotFound")})]})}function fa(e,t=(0,er.JK)()){let n=Math.max(0,Math.round(e)),r="uk"===t?{h:" год",m:" хв",s:" с",sep:" "}:{h:"h",m:"m",s:"s",sep:" "},i=Math.floor(n/3600),a=Math.floor(n%3600/60),s=n%60,l=[];return i>0?(l.push(`${i}${r.h}`),a>0&&l.push(`${a}${r.m}`)):a>0?(l.push(`${a}${r.m}`),s>0&&l.push(`${s}${r.s}`)):l.push(`${s}${r.s}`),l.join(r.sep)}function fs(e){let t=e.lastTurn;return t&&null!==t.endedAt?Math.max(0,(t.endedAt-t.startedAt)/1e3):null}function fl({startedAt:e,label:t}){let n,r,i,a,s,[l,o]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,F.jsx)("span",{role:"timer","aria-label":t,className:"tabular-nums",children:(r=Math.floor((n=Math.max(0,Math.floor((l-e)/1e3)))/3600),i=Math.floor(n%3600/60),a=n%60,s=e=>String(e).padStart(2,"0"),r>0?`${r}:${s(i)}:${s(a)}`:`${i}:${s(a)}`)})}function fo({file:e,workingLabel:t,workingIcon:n,compact:r=!1}){let{t:i}=(0,er.Ym)(),a=e.lastTurn??null,s="live"===e.activity&&(!a||null===a.endedAt),l=r?"px-3 py-1":"px-6 py-1.5";if(s)return(0,F.jsxs)("div",{"data-turn-status":"running",className:`flex shrink-0 items-center justify-center gap-2 border-t border-border ${l} text-[12px] font-semibold text-success`,children:[(0,F.jsxs)("span",{className:"flex items-center gap-0.5","aria-hidden":!0,children:[(0,F.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-success"}),(0,F.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-success [animation-delay:150ms]"}),(0,F.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-success [animation-delay:300ms]"})]}),(0,F.jsx)(n,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:t}),a?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{"aria-hidden":!0,children:"\xb7"}),(0,F.jsx)(fl,{startedAt:a.startedAt,label:i("turn.timer")})]}):null]});let o=function(e,t=(0,er.JK)()){let n=fs(e);return null===n?null:(0,er.Tl)(t,"turn.worked",{d:fa(n,t)})}(e);return o?(0,F.jsxs)("div",{role:"note","data-turn-status":"finished",className:`flex shrink-0 items-center gap-2 border-t border-border ${l} text-[11px] font-semibold text-muted`,children:[(0,F.jsx)("span",{className:"h-px flex-1 bg-border","aria-hidden":!0}),(0,F.jsx)("span",{className:"tabular-nums",children:o}),(0,F.jsx)("span",{className:"h-px flex-1 bg-border","aria-hidden":!0})]}):null}let fc=window.matchMedia("(pointer: coarse)").matches?500:2500,fd=window.matchMedia("(pointer: coarse)").matches?1e3:6e3,fu={items:[],hiddenServiceCount:0},fp=new mZ(300);function fm(e){return Array.from(e.querySelectorAll("[data-feed-key]"))}function ff({file:e,showSvc:t,lineFilter:n,onStatus:r,paused:i,follow:a,setFollow:s,compact:l=!1,onLaunchRetry:o}){var c,d,u,p,m,f,h,x;let g,{locale:b,t:v}=(0,er.Ym)(),w=e?U(e):null,y=sB(w??""),k=(c=w??"",(0,B.useSyncExternalStore)(e=>(pq.add(e),()=>pq.delete(e)),()=>pU(c),()=>pz)),j=e?.launch??e?.spawn??null,N=e?.conversationId??null,S=!j?.conversationId||!N||j.conversationId===N,C=(d=e?.conversationId??null,u=e?.path??null,aR(e=>aD(e,d,u),null,aO))?.session??null,A=C?.liveTurn??null,I=C?.turn??null,[M,T]=(0,B.useState)(()=>w?fp.get(w)?.magnet??a:a),$=function(e,t=!1,n=2500){let[r]=(0,B.useState)(()=>e?u2(e.path,n):null),i=r?.win??{lines:[],start:0},a=(0,B.useRef)(n),[s,l]=(0,B.useState)(i),[o,c]=(0,B.useState)(r?.size??0),[d,u]=(0,B.useState)(!!(e&&!r)),[p,m]=(0,B.useState)(null),[f,h]=(0,B.useState)(r?.tickTime??null),[x,g]=(0,B.useState)(!1),[b,v]=(0,B.useState)(r?.hasMore??!1),[w,y]=(0,B.useState)(!1),[k,j]=(0,B.useState)(0),N=(0,B.useRef)(i),S=(0,B.useRef)(r?.size??0),C=(0,B.useRef)(r?.tickTime??null),A=(0,B.useRef)(r?.hasMore??!1),I=(0,B.useRef)(r?.offset??0),M=(0,B.useRef)(r?.historyStart??0),T=(0,B.useRef)(r?.partial??""),$=(0,B.useRef)(r?.first??!0),E=(0,B.useRef)(0),R=(0,B.useRef)(!1);(0,B.useEffect)(()=>{a.current=n},[n]);let P=e=>{N.current=e,l(e)},O=e=>{A.current=e,v(e)},D=e=>{var t={win:N.current,size:S.current,offset:I.current,historyStart:M.current,partial:T.current,first:$.current,hasMore:A.current,tickTime:C.current};for(u0.delete(e),u0.set(e,u1(t,6e3));u0.size>24;){let e=u0.keys().next().value;if(!e)break;u0.delete(e)}},L=()=>{I.current=0,M.current=0,T.current="",$.current=!0,O(!1)},F=(0,B.useCallback)(()=>{e&&u0.delete(e.path),P({lines:[],start:0}),L()},[e?.path]);(0,B.useEffect)(()=>{E.current+=1;let t=e?u2(e.path,a.current):null,n=t?.win??{lines:[],start:0};N.current=n,I.current=t?.offset??0,M.current=t?.historyStart??0,T.current=t?.partial??"",$.current=t?.first??!0,A.current=t?.hasMore??!1,S.current=t?.size??e?.size??0,C.current=t?.tickTime??null,l(n),v(A.current),c(S.current),h(C.current),m(null),u(!!(e&&!t))},[e?.path]),(0,B.useEffect)(()=>{var n;if(!e||x||t)return;let r=!0,i=E.current,s=(n={path:e.path,getOffset:()=>I.current,onChunk:t=>{if(r&&i===E.current){if("transportError"in t){m((0,er.Tl)((0,er.JK)(),"common.serverUnavailable")),u(!1);return}if("error"in t&&t.error){m(t.error),u(!1);return}if(I.current>t.size&&(L(),P({lines:[],start:0})),t.data){let e=T.current+t.data;if(T.current="",$.current){if(M.current=t.start,t.start>0){let n=e.indexOf("\n");M.current=t.start+(n>=0?uZ(e.slice(0,n+1)):uZ(e)),e=n>=0?e.slice(n+1):""}O(M.current>0)}let n=e.split("\n");T.current=n.pop()??"";let r=n.map(e=>e.trim()).filter(Boolean);if(0===I.current)P({lines:r,start:0});else if(r.length){let e=N.current,t=e.lines.concat(r),n=a.current;P(n>0&&t.length>n?{lines:t.slice(-n),start:e.start+(t.length-n)}:{lines:t,start:e.start})}$.current=!1}I.current=t.offset,S.current=t.size,c(t.size),m(null),t.data&&(C.current=new Date,h(C.current)),D(e.path),u(!1)}}},uP.add(n),uH?(null===uO&&(uO=setInterval(()=>void uJ(),1200)),uV()):uQ(),()=>{(uP.delete(n),0===uP.size)?(uY(),uW(),uD=uK(uD,clearTimeout),uL=uK(uL,clearTimeout),uH=!1,u_=!1,uq=!1,uz=!1):uH?uV():uQ()});return()=>{r=!1,s()}},[e?.path,x,t]);let _=(0,B.useCallback)(async()=>{if(!e||R.current||M.current<=0)return 0;R.current=!0,y(!0);let t=E.current;try{let n="",r=M.current;for(let i=0;i<4;i+=1){let i=await fetch(`/api/log?path=${encodeURIComponent(e.path)}&before=${r}`),a=await i.json();if(t!==E.current||"error"in a&&a.error)return 0;if(n=a.data+n,r=a.start,0===r||n.slice(0,-1).includes("\n"))break}let i=r;if(r>0){let e=n.indexOf("\n");if(e<0||e===n.length-1)return 0;i=r+uZ(n.slice(0,e+1)),n=n.slice(e+1)}let a=n.split("\n");""===a.at(-1)&&a.pop();let s=a.map(e=>e.trim()).filter(Boolean);if(M.current=i,O(i>0),s.length){let e=N.current;P({lines:s.concat(e.lines),start:e.start-s.length}),j(e=>e+1)}return D(e.path),s.length}catch{return 0}finally{R.current=!1,y(!1)}},[e?.path]);return{lines:s.lines,linesStart:s.start,size:o,loading:d,error:p,tickTime:f,paused:x,setPaused:g,clear:F,hasMore:b,loadingOlder:w,loadOlder:_,prependGen:k}}(e,i,M?l?fc:fd:0),E=(0,B.useRef)(null),R=(0,B.useRef)(null),P=(0,B.useRef)(null),O=l?300:1500,D=l?500:1500,[L,_]=(0,B.useState)(O),[q,z]=(0,B.useState)(0),[H,K]=(0,B.useState)(!1),[Y,W]=(0,B.useState)(null),J=(0,B.useRef)(!1),V=(0,B.useRef)(M),G=(0,B.useRef)(0),X=(0,B.useRef)(0),Q=(0,B.useRef)(null),Z=(0,B.useRef)(0),ee=(0,B.useRef)(null),et=(0,B.useRef)(null),en=(0,B.useRef)(e?.path??null),ei=(0,B.useRef)(a),ea=(e,t=!1)=>{if(et.current=null,V.current=e,T(e),s(e),e&&z(0),w){var n;let t=fp.get(w);n={magnet:e,fromBottom:t?.fromBottom??0,anchor:e?null:t?.anchor??null},fp.set(w,n)}t&&(K(!0),Q.current&&window.clearTimeout(Q.current),Q.current=window.setTimeout(()=>K(!1),450))},es=()=>{let e=E.current;e&&(Z.current=Date.now(),e.scrollTop=e.scrollHeight)},el=()=>{let e=E.current,t=et.current;if(!e||!t||V.current)return!1;if(t.path!==en.current)return et.current=null,!1;let n=t.anchor?.path===t.path?t.anchor:null;if(n){var r;let i=(r=n.key,fm(e).find(e=>e.dataset.feedKey===r)??null);if(i){let r=i.getBoundingClientRect().top-e.getBoundingClientRect().top;return Z.current=Date.now(),e.scrollTop+=r-n.offset,t.applied=!0,!0}}let i=Math.max(0,e.scrollHeight-e.clientHeight);return Z.current=Date.now(),e.scrollTop=Math.max(0,i-t.fromBottom),!(i<t.fromBottom)&&(t.applied=!0,n||(et.current=null),!0)};(0,B.useEffect)(()=>_(O),[e?.path,O]),(0,B.useEffect)(()=>{if(!w)return;let e=fp.get(w)?.magnet??a;e!==V.current&&(V.current=e,T(e))},[e?.path,w]),(0,B.useEffect)(()=>{a!==ei.current&&(ei.current=a,et.current=null,a!==V.current&&(V.current=a,T(a),a&&z(0)))},[a]),(0,B.useEffect)(()=>()=>{Q.current&&window.clearTimeout(Q.current)},[]),(0,B.useEffect)(()=>{J.current=!1,queueMicrotask(()=>W(null))},[e?.path]),(0,B.useEffect)(()=>{if(e){if(e.pendingQuestion){J.current=!0,queueMicrotask(()=>W(null));return}J.current&&e.proc&&"running"!==e.proc&&(queueMicrotask(()=>W((0,er.Tl)(b,"feed.agentEnded"))),J.current=!1)}},[e?.pendingQuestion?.toolUseId,e?.proc,e,b]);let eo=n.toLowerCase(),ec=(0,B.useMemo)(()=>e?(0,pl.vK)({engine:e.engine,fmt:e.fmt,showSvc:t,lineFilter:eo}):null,[e?.path,e?.engine,e?.fmt,t,eo,b]),ed=(0,B.useMemo)(()=>e&&ec?ec.feed($.lines,$.linesStart,"live"===e.activity):fu,[ec,e?.activity,$.lines,$.linesStart]);p=ed.items,m=e?.path??null,f=$.linesStart+$.lines.length,h=!!e&&!$.loading,g=(0,B.useRef)(null),(0,B.useEffect)(()=>{if(!w||!m||!h)return;let e=`${w}
50
- ${m}`;if(g.current?.key!==e){let t,n=null!==g.current;if(g.current={key:e,scanner:(t=null,{scan(e,n,r=0){let i=t;t=n;let a=[];var s=e=>{var t,n,s;(null!==i&&e.srcCall>=i||"run"===e.status)&&a.push((t=e,n=w,s=r,{cue:t.mcp?"viewer-mcp":"tool-tick",eventId:`tool:${n}:${t.id}`,pan:s}))};for(let t of e){let e=t.item;if("tool"===e.kind)s(e);else if("cmd-group"===e.kind)for(let t of e.calls)s(t)}for(let e=1;e<a.length;e+=1)a[e]={...a[e],delayMs:220*e};return a}})},n)return}for(let e of g.current.scanner.scan(p,f,tc(w)))tX(e)},[p,w,m,f,h]);let ep=Math.max(0,ed.items.length-L),em=ep?ed.items.slice(-L):ed.items,ef=ed.items.length-em.length,eh=(0,B.useMemo)(()=>{let e=$.lines,t=$.linesStart;return n=>n>=t&&n<t+e.length?e[n-t]??null:null},[$.lines,$.linesStart]);(0,B.useEffect)(()=>{let t=$.tickTime?.toLocaleTimeString("uk"===(0,er.JK)()?"uk-UA":"en-US",{hour12:!1})??"";$.error?r($.error):e?r(`${($.size/1024).toFixed(0)} kB${t?" \xb7 "+t:""}`):r("")},[$.error,$.size,$.tickTime,e,r]),(0,B.useLayoutEffect)(()=>{en.current=e?.path??null,ee.current=null,et.current=null},[e?.path]),(0,B.useLayoutEffect)(()=>{let e=E.current,t=P.current;e&&t&&(P.current=null,e.scrollTop=t.top+(e.scrollHeight-t.height))},[$.prependGen,L]),(0,B.useLayoutEffect)(()=>{let t=ed.items.length,n=$.prependGen!==X.current;X.current=$.prependGen;let r=t-G.current;G.current=t;let i=!1;if(e&&t&&ee.current!==e.path){ee.current=e.path;let t=w?fp.get(w):void 0;et.current=!M&&t&&(t.fromBottom>0||t.anchor)?{path:e.path,...t,applied:!1}:null,i=!0}(!et.current||(el(),!i&&et.current?.applied))&&(M?es():!n&&r>0&&z(e=>e+r))},[ed.items,M,$.prependGen]),(0,B.useEffect)(()=>{let e=E.current,t=R.current;if(!e||!t)return;let n=new ResizeObserver(()=>{V.current?es():el()});return n.observe(t),n.observe(e),()=>n.disconnect()},[]);let ex=()=>{let e=E.current;e&&(P.current={top:e.scrollTop,height:e.scrollHeight}),ep?_(e=>e+D):$.hasMore&&$.loadOlder().then(()=>_(e=>e+D))},eg=ep>0||$.hasMore,eb=ed.items.at(-1)?.item,ev=eb?.kind==="tool"&&"run"===eb.status?{icon:uE.A,label:v("feed.running",{tool:(eb.command??eb.summary).split(/[\s:·]/,1)[0]||v("feed.tool")})}:eb?.kind==="think"?{icon:i9.RE,label:v("feed.thinking")}:{icon:i9.RE,label:v("feed.working")},ew=e?.path??null,ey=(0,B.useMemo)(()=>{let e=new Set;for(let t of y){if(!t.launchOwned)continue;let n=t.echoText?.trim();n&&e.add(n);let r=t.text.trim();r&&e.add(r)}return e},[y]),ek=(0,B.useMemo)(()=>ew?ed.items.flatMap(({anchorKey:e,key:t,item:n})=>{let r="text"in n?n.text:"";return r.trim()&&("user"===n.kind||ey.has(r.trim()))?[{generation:ew,id:e??`key:${t}`,text:r}]:[]}):[],[ed.items,ew,ey]),ej=(0,B.useMemo)(()=>{let e=new Map;for(let t of ek){let n=t.text.trim();e.set(n,(e.get(n)??0)+1)}return e},[ek]);(0,B.useEffect)(()=>{w&&function(e,t){if(!Array.isArray(t)){if(sq(sD.get(e),t))return;for(let n of(sD.set(e,t),sL))n();return}let n=new Map(sy(e).map(e=>[e.id,e]));for(let e of t){let t=function(e){let t=e.id.trim();return t?e.generation?JSON.stringify([e.generation,t]):t:""}(e),r=sO(e.text);t&&r&&n.set(t,{id:t,key:r})}let r=[...n.values()].slice(-512),i=sy(e);(i.length!==r.length||i.some((e,t)=>e.id!==r[t]?.id||e.key!==r[t]?.key))&&sk(e,r);let a=s_(r),s=!sq(sD.get(e),a);if(s&&sD.set(e,a),sz(e,r),s)for(let e of sL)e()}(w,ek)},[w,ek]),(0,B.useEffect)(()=>{if(!w||!j?.launchId||!S)return;let e=j.prompt??"",t=j.promptImages??0;(e.trim()||t)&&s$(w,{id:j.launchId,text:e,images:t,at:j.promptAt??Date.now(),...j.promptEcho?{echoText:j.promptEcho}:{},...j.conversationId?{owner:j.conversationId}:{}})},[w,j?.launchId,j?.prompt,j?.promptImages,j?.promptAt,j?.promptEcho,j?.conversationId,S]),(0,B.useEffect)(()=>{w&&j?.launchId&&S&&"delivered"===j.initialMessage&&void 0!==j.deliveredAt&&function(e,t){let n=sf(e);if(n&&n.id!==t.id)return;sg(e,{id:t.id,at:n?.at??t.at,settledAt:t.settledAt});let r=sT(e),i=r.find(e=>e.id===t.id);if(!i||!i.launchOwned)return;if(i.retiredEchoId||void 0!==i.responseStartedAt||"delivered"===i.state||"failed"===i.state)return sw(e,i);let a=r.map(e=>e.id===t.id?{...e,state:"delivered",settledAt:e.settledAt??t.settledAt}:e),s=a.find(e=>e.id===t.id);s&&sw(e,s),sC(e,a)}(w,{id:j.launchId,at:j.promptAt??j.deliveredAt,settledAt:j.deliveredAt})},[w,j?.launchId,j?.initialMessage,j?.deliveredAt,j?.promptAt,S]);let eN=e?function(e,t,n,r){let i=new Map,a=[];for(let s of e){if(void 0!==r&&void 0!==s.owner&&s.owner!==r)continue;let e=sO(s.echoText??s.text);if(s.retiredEchoId){let t=Math.max(s.echoBaseline??0,i.get(e)??0);i.set(e,t+1);continue}let l=t.get(e)??0,o=Math.max(s.echoBaseline??0,i.get(e)??0);if(l>o){i.set(e,o+1);continue}if(void 0===s.responseStartedAt){if("delivered"===s.state&&n-(s.settledAt??s.at)>=6e5)continue;a.push(s)}}return a}(y,ej,Date.now(),w??void 0):[];(0,B.useEffect)(()=>{w&&e&&(!function(e,t){if(!e||e===t)return;let n=pU(e);if(!n.size)return;let r=new Set(n);for(let e of pU(t))r.delete(e),r.add(e);for(;r.size>544;){let e=r.values().next().value;if(void 0===e)break;r.delete(e)}for(let n of(pK(t,r),pK(e,pz),pq))n()}(e.path,w),function(e,t){if(!e)return;let n=pU(e),r=t.flatMap(e=>{let t=pB(e);return t?[t]:[]});if(!r.some(e=>!n.has(e)))return;let i=new Set(n);for(let e of r)i.delete(e),i.add(e);for(;i.size>544;){let e=i.values().next().value;if(void 0===e)break;i.delete(e)}for(let t of(pK(e,i),pq))t()}(w,ed.items))},[e,w,ed.items]);let eS=(0,B.useMemo)(()=>(function(e,t,n=pz,r=null){let i=e?nA(e):[];if(!i.length)return i;let a=t.flatMap(e=>{let{item:t}=e,n=pB(e);return"prose"===t.kind?[{sourceId:n,text:t.text.trim(),at:pY(t.ts)}]:n?[{sourceId:n,text:"",at:"review"===t.kind?pY(t.ts):null}]:[]}),s=new Set(a.flatMap(e=>e.sourceId?[e.sourceId]:[])),l=function(e){let t=null;for(let n of e){let e=function(e){let t="cmd-group"===e.kind?e.t1??e.t0:"ts"in e?e.ts:void 0;if("string"!=typeof t||!t)return null;let n=Date.parse(t);return Number.isFinite(n)?n:null}(n.item);null!==e&&(null===t||e>t)&&(t=e)}return t}(t),o=new Set,c=e=>{let t=pY(e.completedAt)??pY(e.startedAt);return null!==l&&null!==t&&t<=l};return i.filter(e=>{if("streaming"===e.phase)return"idle"!==r||!c(e);if(e.itemId&&(n.has(e.itemId)||s.has(e.itemId)))return!1;let t=e.itemId?a.findIndex((t,n)=>!o.has(n)&&t.sourceId===e.itemId):-1,i=e.text.trim();if(t<0&&!e.itemId&&i){let n=pY(e.startedAt);t=a.findIndex((e,t)=>!o.has(t)&&e.text===i&&(null===n||null===e.at||e.at>=n))}return t<0?!c(e):(o.add(t),!1)})})(A,ed.items,k,I),[A,ed.items,k,I]),eC=eS.length>0||eN.length>0||!!j,eA="left-1/2 -translate-x-1/2";return(0,F.jsx)(mQ,{value:eh,children:(0,F.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,F.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[e&&ed.items.length?M?"live"===e.activity?(0,F.jsxs)("div",{"data-live-tail-pill":!0,className:`pointer-events-none absolute bottom-2 ${eA} z-10 inline-flex items-center gap-1 rounded-full bg-success px-2 py-0.5 text-[10px] font-bold text-white shadow-1 transition-transform duration-200 ${H?"scale-125":"scale-100"}`,children:[(0,F.jsx)(uR.A,{className:"h-3 w-3","aria-hidden":!0})," ",v("feed.liveTail")]}):null:(0,F.jsxs)("button",{className:`absolute bottom-2 ${eA} z-10 inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-border bg-raised px-2.5 py-1 text-label font-semibold text-primary shadow-1 [@media(pointer:coarse)]:min-h-11 hover:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":v("feed.backToLive"),onClick:()=>{es(),ea(!0,!0)},children:[(0,F.jsx)(i9.yd,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",q?v("feed.newCount",{count:q}):v("feed.down")]}):null,(0,F.jsx)("div",{ref:E,"data-log-feed-scroller":!0,"data-tail-lines-start":$.linesStart,"data-tail-line-count":$.lines.length,className:l?"min-h-0 flex-1 overflow-y-auto py-3":"min-h-0 flex-1 overflow-y-auto py-6",onScroll:t=>{var n,r;let i,a,s,l=t.currentTarget,o=l.scrollTop+l.clientHeight>=l.scrollHeight-50,c=Date.now()-Z.current<300;c||(et.current=null),o&&!V.current?ea(!0,!0):!o&&V.current&&(c?es():ea(!1)),w&&e&&!c&&(r={magnet:V.current,fromBottom:Math.max(0,l.scrollHeight-l.clientHeight-l.scrollTop),anchor:V.current?null:(n=e.path,i=l.getBoundingClientRect().top,a=fm(l).find(e=>e.getBoundingClientRect().bottom>i),s=a?.dataset.feedKey,a&&s?{path:n,key:s,offset:a.getBoundingClientRect().top-i}:null)},fp.set(w,r)),l.scrollTop<120&&eg&&!$.loadingOlder&&!$.loading&&ex()},children:(0,F.jsx)("div",{ref:R,className:l?"px-3 pb-3 text-body":"mx-auto w-full max-w-[1060px] px-6 pb-4",children:e?(0,F.jsxs)(F.Fragment,{children:[l&&eg?(0,F.jsx)("button",{className:"mb-2 flex w-full items-center justify-center gap-1.5 rounded-control border border-dashed border-border bg-sunken px-2 py-1 text-label font-semibold text-muted [@media(pointer:coarse)]:min-h-11 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:$.loadingOlder,onClick:ex,children:$.loadingOlder?v("common.loading"):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(i9.rX,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",v("feed.showEarlier")]})}):null,!l&&eg&&ed.items.length?(0,F.jsx)("button",{className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-control border border-dashed border-border bg-sunken px-3 py-1.5 text-ui font-semibold text-muted [@media(pointer:coarse)]:min-h-11 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:$.loadingOlder,onClick:ex,children:$.loadingOlder?v("common.loading"):ep?v("feed.showEarlierHidden",{count:ep}):v("feed.loadEarlier")}):null,l||eg||!ed.items.length?null:(0,F.jsx)("div",{className:"mb-3 text-center text-[11px] text-muted",children:v("feed.startOfConvo")}),l?null:(0,F.jsx)(fi,{file:e}),ed.items.length?em.map(({anchorKey:e,key:t,item:n},r)=>{let i=function(e,t){let n,r=e[t]?.item;if(r?.kind!=="prose")return null;let i=t,a=t;for(;i>0&&ft(e[i-1].item,r);)i-=1;for(;a+1<e.length&&ft(e[a+1].item,r);)a+=1;let s=(n=(function(e){let t=[],n=null;for(let r of e.split("\n")){if(n){let e=r.match(/^[ \t]*(`{3,}|~{3,})[ \t]*$/)?.[1];e?.[0]===n.char&&e.length>=n.length&&(n=null);continue}let e=r.match(/^[ \t]*(`{3,}|~{3,})/)?.[1];if(e){n={char:e[0],length:e.length},t.push("");continue}t.push(r)}return t.join("\n")})(e.slice(i,a+1).map(e=>"prose"===e.item.kind?e.item.text:"").join("\n\n")).replace(mA,"\n").replace(/<oai-mem-citation>[\s\S]*?<\/oai-mem-citation>/gi,"\n").replace(/<!--[\s\S]*?-->/g," ").replace(/<(script|style|template)\b[^>]*>[\s\S]*?<\/\1>/gi," ").replace(/<([a-z][\w-]*)\b(?=[^>]*(?:\shidden(?=\s|=|>)|aria-hidden\s*=\s*["']?true))[^>]*>[\s\S]*?<\/\1>/gi," ").replace(/`+[^`\n]+`+/g," ").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/^\s*\|.*\|\s*$/gm," table omitted ").replace(/<[^>]+>/g," ").replace(/https?:\/\/\S+/g," ").replace(/^\s{0,3}(?:#{1,6}\s+|[-*+]\s+|\d+[.)]\s+)/gm,"").replace(/[*~]{1,3}/g,"").replace(/\n{3,}/g,"\n\n").trim(),(0,mC.fp)(n));return s?{text:s,firstIndex:i,lastIndex:a}:null}(ed.items,ef+r),a=i?.firstIndex===ef+r?i.text:void 0;return(0,F.jsx)("div",{"data-feed-key":e??void 0,"data-feed-kind":n.kind,"data-feed-source-id":"sourceId"in n?n.sourceId:void 0,className:l?"feed-cv":void 0,children:(0,F.jsx)(mX,{item:n,speakText:a})},t)}):eC?null:(0,F.jsxs)("div",{className:"mt-[14vh] text-center text-muted",children:[$.loading?v("common.loadingCap"):0===$.size?v("feed.noOutput"):ed.hiddenServiceCount?v("feed.onlyService",{count:ed.hiddenServiceCount}):v("feed.empty"),!$.loading&&(e.cmdDesc||e.cmd)?(0,F.jsxs)("div",{className:"mx-auto mt-3 max-w-[560px]",children:[e.cmdDesc?(0,F.jsx)("div",{className:"text-[12.5px] font-semibold text-primary",children:e.cmdDesc}):null,e.cmd?(0,F.jsx)("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap break-words rounded-[10px] border border-border bg-canvas px-3 py-2 text-left font-mono text-[11.5px] text-primary",children:e.cmd}):null]}):null]}),(x={launch:!!j,outbox:!!(w&&eN.length),delta:eS.length>0},pW.filter(e=>x[e])).map(e=>"launch"===e?(0,F.jsx)(u7,{launch:j,onRetry:o},"launch"):"outbox"===e?(0,F.jsx)(pF,{cardId:w,entries:eN},"outbox"):(0,F.jsx)(pD,{items:eS},"delta")),(0,F.jsx)(fe,{file:e}),ed.items.length&&!e.pendingQuestion&&!e.waitingInput&&Y?(0,F.jsx)("div",{className:"my-4 rounded-[8px] border border-border bg-sunken px-4 py-3 text-[13px] font-semibold text-muted",children:Y}):null,ed.items.length&&"recent"===e.activity&&tr(e)?(0,F.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 text-[11.5px] font-semibold text-warning",children:[(0,F.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-warning","aria-hidden":!0})," ",v("feed.finishedTurn")]}):ed.items.length&&"recent"===e.activity&&eu(e)&&"running"!==e.proc?(0,F.jsxs)("div",{className:"mt-2 flex items-center gap-1 text-[11.5px] font-semibold text-accent",children:[(0,F.jsx)(cD.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",v("feed.returnedResult")]}):null]}):(0,F.jsx)("div",{className:"mt-[20vh] text-center text-muted",children:v("feed.pickLog")})})})]}),e?(0,F.jsx)(fo,{file:e,workingLabel:ev.label,workingIcon:ev.icon,compact:l}):null]})})}let fh=()=>"uk"===(0,er.JK)()?"uk-UA":"en-US",fx={completed:"✓",in_progress:"▸",pending:"○"};function fg({plan:e}){let t,{t:n}=(0,er.Ym)(),r=e.total?Math.round(e.done/e.total*100):0;return(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-accent-soft px-1.5 py-0.5 font-mono text-[9.5px] font-semibold text-accent",title:(t=e.steps.map(e=>`${fx[e.status]} ${e.text}`),[(0,er.Tl)((0,er.JK)(),"plan.agentPlan"),...t].join("\n")),"aria-label":n("plan.stepsAria",{done:e.done,total:e.total})+(e.current?n("plan.nowSuffix",{current:e.current}):""),children:[e.done,"/",e.total,(0,F.jsx)("span",{className:"h-1 w-6 overflow-hidden rounded-full bg-accent/20","aria-hidden":!0,children:(0,F.jsx)("span",{className:"block h-full rounded-full bg-accent",style:{width:`${r}%`}})})]})}let fb={active:{labelKey:"plan.goal",tone:"accent"},complete:{labelKey:"plan.goalDone",tone:"success"},blocked:{labelKey:"plan.goalBlocked",tone:"danger"}};function fv(e){if(e>=1e6){let t=e/1e6;return`${Number.isInteger(t)||t>=10?Math.round(t):Math.round(10*t)/10}M`}return e>=1e3?`${Math.round(e/1e3)}K`:`${e}`}function fw({ctx:e}){var t;let n,r,{t:i}=(0,er.Ym)(),a=e.usedTokens.toLocaleString(fh());if(null!==e.windowTokens&&null!==e.pct){let t="registry"===e.source?i("plan.ctxSourceRegistry",{version:e.registryVersion??"?"}):i("plan.ctxSourceRuntime");n=`${i("plan.ctxTitle",{pct:e.pct,used:a,window:e.windowTokens.toLocaleString(fh())})}
51
- ${t}`,r=i("plan.ctxAria",{pct:e.pct})}else n=i("plan.ctxTitleUnknown",{used:a}),r=i("plan.ctxAriaUnknown",{used:a});return(0,F.jsxs)(an,{tone:null===(t=e.pct)?"neutral":t>=90?"danger":t>=70?"warning":"neutral",title:n,"aria-label":r,children:[null===e.pct?null:(0,F.jsxs)("span",{className:"font-bold",children:[e.pct,"%"]}),"ctx ",fv(e.usedTokens),null===e.windowTokens?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:"opacity-50",children:"/"}),fv(e.windowTokens)]})]})}function fy({goal:e}){let t,n,{t:r}=(0,er.Ym)(),i=fb[e.status];return(0,F.jsx)(an,{tone:i.tone,title:(t=(0,er.JK)(),n=[e.objective??(0,er.Tl)(t,"plan.noObjective")],null!==e.tokensUsed&&n.push((0,er.Tl)(t,"plan.tokens",{n:e.tokensUsed.toLocaleString(fh())})),null!==e.timeUsedSeconds&&n.push((0,er.Tl)(t,"plan.time",{n:Math.round(e.timeUsedSeconds/60)})),n.join("\n")),"aria-label":r("plan.goalAria",{status:r(i.labelKey)})+(e.objective?` — ${e.objective.slice(0,120)}`:""),children:r(i.labelKey)})}function fk(e,t){return e.path===t.path||null!=e.conversationId&&null!=t.conversationId&&e.conversationId===t.conversationId}function fj({file:e,displayMax:t=90,titleClassName:n="",className:r="",alwaysVisible:i=!1,autoEditToken:a}){let{t:s}=(0,er.Ym)(),l=rq(),[o,c]=(0,B.useState)(!1),[d,u]=(0,B.useState)(""),[p,m]=(0,B.useState)(null),[f,h]=(0,B.useState)(!1),[x,g]=(0,B.useState)(""),[b,v]=(0,B.useState)(void 0),w=(0,B.useRef)(null),y=(0,B.useRef)(null),k=(0,B.useRef)(null),j=(0,B.useRef)(!1),N=(0,B.useRef)(!1),[S,C]=(0,B.useState)({path:e.path,conversationId:e.conversationId});if(S.path!==e.path||S.conversationId!==e.conversationId){let t=!fk(S,e);C({path:e.path,conversationId:e.conversationId}),t&&(c(!1),u(""),m(null),h(!1),g(""),v(void 0))}let A=(0,B.useRef)({path:e.path,conversationId:e.conversationId});(0,B.useEffect)(()=>{A.current={path:e.path,conversationId:e.conversationId}});let I=null!==p&&(void 0!==e.titleRevision?e.titleRevision>=p.revision:null===p.title)?null:p,M=e.autoTitle??e.title,T=I?null!==I.title:void 0!==e.autoTitle,$=I?I.title??M:e.title,E=I?I.revision:e.titleRevision??0;(0,B.useEffect)(()=>{if(o){let e=w.current;e&&(e.focus(),e.select())}else N.current&&(N.current=!1,y.current?.focus())},[o]);let R=()=>{f||(j.current=!1,u($),v(void 0),c(!0))},P=(0,B.useRef)(R);(0,B.useEffect)(()=>{P.current=R}),(0,B.useEffect)(()=>{void 0!==a&&P.current()},[a]);let O=async(t,n)=>{let r={path:e.path,conversationId:e.conversationId};h(!0),v(void 0);let i=t&&t.trim()?t.trim():null,a=await nt({path:e.path,conversationId:e.conversationId,title:i,baseRevision:E,windowName:i??M});if(fk(r,A.current)){if(a.ok){m({title:a.override?.title??null,revision:a.revision}),g(null===i?s("rename.reset"):s("rename.saved",{title:(0,ei.cr)(i,60)})),h(!1);return}if(409===a.status&&n){let t=a.conflict?.revision??0;m(a.conflict?{title:a.conflict.title,revision:a.conflict.revision}:{title:null,revision:0});let n=await nt({path:e.path,conversationId:e.conversationId,title:i,baseRevision:t,windowName:i??M});if(!fk(r,A.current))return;if(n.ok){m({title:n.override?.title??null,revision:n.revision}),g(null===i?s("rename.reset"):s("rename.saved",{title:(0,ei.cr)(i,60)})),h(!1);return}g(s("rename.conflict")),v(i),h(!1);return}g(s("rename.failed")),v(i),h(!1)}},D=e=>{j.current=!0,N.current=!0,c(!1),O(e,!0)},L=()=>{j.current=!0,N.current=!0,c(!1)},_=e=>e.stopPropagation();return o?(0,F.jsxs)("span",{ref:k,className:`inline-flex min-w-0 flex-1 items-center gap-1 ${r}`,onPointerDown:_,onBlur:e=>{if(j.current){j.current=!1;return}let t=e.relatedTarget;if(t&&k.current?.contains(t))return;let n=w.current?.value??d;c(!1),O(n,!0)},children:[(0,F.jsx)("input",{ref:w,type:"text",value:d,maxLength:120,className:"min-w-0 flex-1 rounded-[6px] border border-accent/50 bg-canvas px-1.5 py-0.5 text-[12px] font-semibold text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("rename.inputAria"),onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),D(e.currentTarget.value)):"Escape"===e.key&&(e.preventDefault(),L())}}),(0,F.jsx)("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"h-11 w-11":"px-1 py-0.5"}`,"aria-label":s("rename.save"),title:s("rename.save"),onClick:()=>D(w.current?.value??d),children:(0,F.jsx)(i9.Jl,{className:l?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),T?(0,F.jsx)("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"h-11 w-11":"px-1 py-0.5"}`,"aria-label":s("rename.reset"),title:s("rename.resetHint",{title:(0,ei.cr)(M,60)}),onClick:()=>D(null),children:(0,F.jsx)(i9.kt,{className:l?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null,(0,F.jsx)("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-canvas text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"h-11 w-11":"px-1 py-0.5"}`,"aria-label":s("rename.cancel"),title:s("rename.cancel"),onClick:L,children:(0,F.jsx)(i9.X,{className:l?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),(0,F.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite",children:x})]}):(0,F.jsxs)("span",{className:`group/title inline-flex min-w-0 flex-1 items-center gap-1 ${r}`,children:[(0,F.jsx)("span",{className:`min-w-0 flex-1 truncate ${n}`,title:T?s("rename.autoHint",{title:(0,ei.cr)(M,90)}):(0,ei.cr)($),tabIndex:0,role:"button","aria-label":s("rename.editAria",{title:(0,ei.cr)($,60)}),onDoubleClick:R,onKeyDown:e=>{"F2"===e.key&&(e.preventDefault(),R())},children:(0,ei.cr)($,t)}),(0,F.jsx)("button",{ref:y,type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"h-11 w-11":"px-1 py-0.5 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/title:opacity-100"}`,"aria-label":s("rename.editAria",{title:(0,ei.cr)($,60)}),title:s("rename.edit"),onPointerDown:_,onClick:R,children:(0,F.jsx)(i9._T,{className:"h-3 w-3","aria-hidden":!0})}),void 0!==b?(0,F.jsx)("button",{type:"button",className:`inline-flex shrink-0 items-center rounded-[6px] border border-danger/40 bg-canvas font-semibold text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"min-h-11 px-3 text-[12px]":"px-1.5 py-0.5 text-[10px]"}`,onPointerDown:_,onClick:()=>void O(b,!0),children:s("rename.retry")}):null,(0,F.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite",children:x})]})}var fN=n(4914);function fS({rateLimit:e,file:t}){let{locale:n,t:r}=(0,er.Ym)(),[i,a]=(0,B.useState)("idle"),[s,l]=(0,B.useState)(null),[o,c]=(0,B.useState)(null),d=e??t?.rateLimit;if(!d)return null;let u=d.resetAt?r("rateLimit.badgeUntil",{time:eT(d.resetAt,n)}):r("rateLimit.badge"),p=!!(t?.conversationId&&!t.migration),m="pending"===i||"requested"===i,f="already-reseated"===i,h=f?r("rateLimit.reseatAlready"):o??r("requested"===i&&"waiting-turn"===s?"rateLimit.reseatWaitingTurn":"rateLimit.reseatTitle");return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(an,{tone:"danger","data-rate-limited":"",title:u,children:u}),p?(0,F.jsxs)("button",{type:"button","data-rate-limit-reseat":"",...f?{"data-rate-limit-reseated":""}:{},disabled:m||f,className:"inline-flex shrink-0 touch-manipulation items-center gap-1 rounded-full border border-danger/40 bg-canvas px-1.5 py-0.5 text-[9.5px] font-bold text-danger hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",title:h,onClick:async e=>{if(e.stopPropagation(),m||f)return;a("pending"),c(null);let n=await a2(t.conversationId,t.path);n.ok?(a("already-reseated"===n.state?"already-reseated":"requested"),l(n.phase)):(a("failed"),c(n.error))},onKeyDown:e=>e.stopPropagation(),children:[m?(0,F.jsx)(up.A,{className:"h-2.5 w-2.5 animate-spin motion-reduce:animate-none","aria-hidden":!0}):f?(0,F.jsx)(m1.A,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,F.jsx)(fN.A,{className:"h-2.5 w-2.5","aria-hidden":!0}),r(f?"rateLimit.reseatAlready":"requested"===i?"rateLimit.reseatRequested":"rateLimit.reseat")]}):null,"failed"===i?(0,F.jsx)("span",{role:"alert","aria-live":"assertive",className:"min-w-0 truncate text-[9.5px] font-semibold text-danger",title:o??void 0,children:o??r("rateLimit.reseatFailed")}):null]})}var fC=n(2879);let fA={inbox:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"},assigned:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},blocked:{color:"var(--color-danger)",soft:"var(--color-danger-soft)"},done:{color:"var(--color-success)",soft:"var(--color-success-soft)"}},fI=["inbox","assigned","blocked","done"];function fM(e){return e.split(/\r?\n/,1)[0]?.trim()??""}function fT({relations:e,onOpenTask:t}){let{t:n}=(0,er.Ym)();return e.length?(0,F.jsx)("nav",{"data-task-relations":!0,"aria-label":n("tasks.relatedNav"),className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-border bg-sunken/70 px-2 py-1",children:e.map(({task:e,relation:r})=>{let i=fM(e.text)||n("tasks.untitled");return(0,F.jsxs)("button",{type:"button","data-task-relation":e.id,className:"inline-flex min-h-7 min-w-0 max-w-full items-center gap-1.5 rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-secondary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 pointer-coarse:min-h-11 pointer-coarse:px-3","aria-label":n("tasks.openTaskAria",{title:i}),title:`${i} — ${n("assignment"===r?"tasks.relatedAssignedTitle":"tasks.relatedSourceTitle")}`,onClick:()=>t(e),children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:fA[e.status].color}}),"source"===r?(0,F.jsx)(d4.A,{className:"h-3 w-3 shrink-0 text-info","aria-hidden":!0}):(0,F.jsx)(fC.A,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:i})]},`${r}:${e.id}`)})}):null}function f$(e){return e?`wake-${e.fireAt}`:"wake-none"}function fE({wakeup:e,className:t,interactive:n=!0}){let{locale:r,t:i}=(0,er.Ym)(),[a,s]=(0,B.useState)(()=>Date.now()),[l,o]=(0,B.useState)(!1),c=e?.fireAt??0,d=!!e&&c>a;if((0,B.useEffect)(()=>{if(!d)return;let e=setInterval(()=>s(Date.now()),3e4);return()=>clearInterval(e)},[d]),!e||!d)return null;let u=mk(c,r),p=mj(c-a,i),m=i("wakeup.chipTitle",{time:u,reason:e.reason||i("wakeup.card")}),f=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(i9.qk,{className:"h-3 w-3","aria-hidden":!0}),p]}),h="inline-flex items-center gap-1 rounded-full border border-warning/45 bg-warning-soft px-2 py-0.5 text-[10px] font-bold text-warning";return n?(0,F.jsxs)("span",{className:`relative inline-flex shrink-0 ${t??""}`,children:[(0,F.jsx)("button",{type:"button","data-wakeup":!0,"aria-expanded":l,"aria-label":m,title:m,onClick:e=>{e.stopPropagation(),o(e=>!e)},onKeyDown:e=>e.stopPropagation(),onKeyUp:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),onBlur:()=>o(!1),className:`relative ${h} after:absolute after:inset-x-0 after:top-1/2 after:h-11 after:-translate-y-1/2 after:content-[''] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:f}),l?(0,F.jsx)("span",{role:"tooltip",className:"absolute left-0 top-full z-20 mt-1 max-w-[240px] whitespace-normal rounded-lg border border-border bg-card px-2.5 py-1.5 text-[11px] font-normal leading-snug text-primary shadow-1",children:m}):null]}):(0,F.jsx)("span",{"data-wakeup":!0,className:`${h} shrink-0 ${t??""}`,"aria-hidden":!0,children:f})}let fR=()=>void 0,fP={live:{section:"border-success/60 shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-success)_20%,transparent)]",header:"bg-success-soft"},waiting:{section:"border-warning/60 shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-warning)_26%,transparent)]",header:"bg-warning-soft",glow:"var(--color-warning)"},returned:{section:"border-accent/50 shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-accent)_20%,transparent)]",header:"bg-accent-soft",glow:"var(--color-accent)"},stalled:{section:"border-danger/50 shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-danger)_18%,transparent)]",header:"bg-danger-soft",glow:"var(--color-danger)"},done:{section:"border-border",header:"bg-sunken text-muted opacity-80 saturate-50"}};function fO(e,t){return"session"===t?e("kind.session"):"subagent"===t?e("kind.subagent"):"job"===t?e("kind.job"):"background"===t?e("kind.background"):t}function fD(){let{t:e}=(0,er.Ym)();return(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded-full border border-border/80 px-1.5 py-0.5 text-[9.5px] font-semibold text-muted",title:e("lineage.parentRemovedTitle"),children:[(0,F.jsx)(cR.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",e("lineage.parentRemoved")]})}function fL({file:e}){let{t}=(0,er.Ym)(),[n,r]=(0,B.useState)(()=>Date.now());(0,B.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e4);return()=>clearInterval(e)},[]);let i=n/1e3-e.mtime,a=("live"===e.activity||"recent"===e.activity)&&i>180;return(0,F.jsx)("span",{className:`shrink-0 font-mono text-[9.5px] tabular-nums ${a?"font-semibold text-warning":"text-muted"}`,title:t(a?"branch.lastActivityQuiet":"branch.lastActivity",{age:(0,tt.rK)(e.mtime)}),children:(0,tt.rK)(e.mtime)})}function fF({file:e,tasks:t,isRoot:n,onClose:r,dragHandle:i,noComposer:a,banner:s,headerActions:l,onToggleExpand:o,expanded:c,dormant:d,autoEditToken:u,showFavorite:p,onSpawnRetry:m,relatedTasks:f,onOpenTask:h,titleOverride:x}){let{t:g}=(0,er.Ym)(),b=rq(),v=(0,B.useRef)(null),w=(0,tt.yz)(e),y=tl(e),k=fP[y],j=aV(e.migration),N=(0,B.useRef)(null),[S,C]=(0,B.useState)(!1),A=(0,B.useId)(),[I,M]=(0,B.useState)(!1),T=!b||I,$=(0,B.useCallback)(()=>{let e=N.current;if(!e)return;let t=e.scrollWidth-e.clientWidth-e.scrollLeft>4;C(e=>e===t?e:t)},[]);(0,B.useEffect)(()=>{$()},[$,b,e]);let E=U(e),{caps:R,runtime:P}=lF(e),O="dead"===R.surface,D="superseded"===R.surface,L=R.controls.send,_=O||"disabled"!==L.state?null:g(L.reason),[q,z]=(0,B.useState)(null),H=e.conversationId&&Number.isInteger(e.migration?.revision)?async t=>{z(null);let n=await a1(e.conversationId,t,e.migration.revision);n.ok||z(n.error??g("retry"===t?"migrate.retryFailed":"migrate.keepFailed"))}:void 0,[K,Y]=(0,B.useState)(()=>"u">typeof IntersectionObserver);(0,B.useEffect)(()=>{let e=v.current;if(!e||"u"<typeof IntersectionObserver)return;let t=new IntersectionObserver(e=>Y(!e.some(e=>e.isIntersecting)),{rootMargin:"256px"});return t.observe(e),()=>t.disconnect()},[]);let W=!!d||K;return(0,B.useEffect)(()=>{if(!c&&v.current){var e;return e=v.current,to.set(E,e),()=>{to.get(E)===e&&to.delete(E)}}},[E,c]),(0,B.useEffect)(()=>{if(!e.spawn&&!a&&!c&&v.current){var t;return t=v.current,d8.set(e.path,{el:t,file:e}),()=>{d8.get(e.path)?.el===t&&d8.delete(e.path)}}},[e,a,c]),(0,F.jsxs)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${k.glow?"pane-attention":""}`,style:k.glow?{"--pane-glow":k.glow}:void 0,children:[p?(0,F.jsx)(uu,{id:E,touch:b}):null,(0,F.jsxs)("section",{ref:v,"data-pan-ignore":!0,"data-link-path":e.path,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border bg-card shadow-1 ${k.section}`,children:[(0,F.jsx)("span",{"aria-hidden":!0,className:`w-full shrink-0 ${n?"h-1":"h-0.5"}`,style:"done"===y?{backgroundColor:"var(--color-strong)"}:(0,tt.gA)(e)}),(0,F.jsxs)("header",{className:`reasoning-host flex shrink-0 flex-col border-b border-border ${b?"gap-y-0.5 px-2 py-1":"gap-y-1 px-2.5 py-1.5"} ${k.header} ${i?"cursor-grab active:cursor-grabbing":""}`,...i,children:[(0,F.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`,title:g(`branch.${y}`)}),x?(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold","data-pane-title-override":!0,title:`${x} — ${(0,tt.cr)(e.title)}`,children:x}):e.renamable?(0,F.jsx)(fj,{file:e,displayMax:90,titleClassName:"text-[12px] font-semibold",alwaysVisible:b,autoEditToken:u}):(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:(0,tt.cr)(e.title),children:(0,tt.cr)(e.title,90)}),(0,F.jsx)(fr,{file:e,compact:!0,hideChip:b}),b?(0,F.jsx)("button",{type:"button","data-testid":"mobile-details-toggle","aria-expanded":I,"aria-controls":A,"aria-label":I?g("branch.detailsHide"):g("branch.detailsShow"),title:I?g("branch.detailsHide"):g("branch.detailsShow"),onClick:()=>M(e=>!e),className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(i9.c_,{className:`h-4 w-4 transition-transform ${I?"rotate-90":""}`,"aria-hidden":!0})}):null,p?(0,F.jsx)(ud,{id:E,cardRef:v,touch:b}):null,o?(0,F.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${b?"h-11 w-11":"px-1.5 py-0.5"}`,"aria-label":c?g("branch.collapseFull"):g("branch.expandFull",{title:(0,tt.cr)(e.title,60)}),title:c?g("branch.collapseFull"):g("branch.expandFull",{title:(0,tt.cr)(e.title,60)}),onClick:o,children:c?(0,F.jsx)(cP.A,{className:b?"h-4 w-4":"h-3 w-3","aria-hidden":!0}):(0,F.jsx)(cO.A,{className:b?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null,l,e.spawn?null:(0,F.jsx)(un,{file:e,onDeleted:r}),r?(0,F.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${b?"h-11 w-11":"px-1.5 py-0.5"}`,"aria-label":g("branch.removeColumn",{title:(0,tt.cr)(e.title,60)}),onClick:r,children:(0,F.jsx)(i9.X,{className:b?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null]}),T?(0,F.jsxs)("div",{id:A,"data-testid":"mobile-conv-meta",className:"relative flex min-w-0 items-center gap-x-1.5",onTouchStart:b?e=>e.stopPropagation():void 0,onTouchEnd:b?e=>e.stopPropagation():void 0,children:[b&&e.ctx?(0,F.jsx)(fw,{ctx:e.ctx}):null,(0,F.jsxs)("div",{ref:N,onScroll:b?$:void 0,style:b&&S?{maskImage:"linear-gradient(to right, #000 calc(100% - 20px), transparent)",WebkitMaskImage:"linear-gradient(to right, #000 calc(100% - 20px), transparent)"}:void 0,className:`flex min-w-0 items-center gap-x-1.5 gap-y-1 ${b?"no-scrollbar flex-nowrap overflow-x-auto":"flex-wrap"}`,children:[(0,F.jsx)(fL,{file:e}),b?e.model?(0,F.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 font-mono text-[10px] font-semibold",style:{backgroundColor:(0,tt.oC)(e).soft,color:(0,tt.oC)(e).color},title:[w.label,(0,tt.$)(e)].filter(Boolean).join(" \xb7 "),children:e.effort?`${e.model} \xb7 ${e.effort}`:e.model}):(0,F.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:w.style,title:(0,tt.$)(e),children:w.label}):(0,F.jsxs)(F.Fragment,{children:[e.model?(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold",style:{backgroundColor:(0,tt.oC)(e).soft,color:(0,tt.oC)(e).color},title:[w.label,(0,tt.$)(e)].filter(Boolean).join(" \xb7 "),children:e.model}):(0,F.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:w.style,title:(0,tt.$)(e),children:w.label}),(0,F.jsx)(ux,{file:e})]}),(0,F.jsx)(fS,{file:e}),(0,F.jsx)(fE,{wakeup:e.pendingWakeup},f$(e.pendingWakeup)),e.parentRemoved?(0,F.jsx)(fD,{}):null,e.continues?(0,F.jsxs)("a",{href:"#c="+encodeURIComponent(e.continues.conversationId),"data-continues-chip":!0,className:"inline-flex shrink-0 items-center gap-0.5 truncate rounded-full border border-accent/40 bg-accent-soft px-1.5 py-0.5 text-[9.5px] font-semibold text-accent hover:border-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:g("lineage.continuesTitle",{round:e.continues.round}),children:[(0,F.jsx)(cD.A,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})," ",g("lineage.continues",{round:e.continues.round})]}):null,!b&&e.ctx?(0,F.jsx)(fw,{ctx:e.ctx}):null,e.worktree&&!b?(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded-full border border-border/80 px-1.5 py-0.5 font-mono text-[9.5px] text-muted",title:g("branch.worktree",{name:e.worktree}),children:[(0,F.jsx)(cL.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",e.worktree]}):null,"shell"===e.engine?null:(0,F.jsx)(d3,{engine:e.engine,accountId:P?.session.accountId??e.spawn?.accountId??function(e){if(!e)return cF;let t=c_.exec(e);return t?t[1]:cF}(e.path),file:e,runtimeSession:P?.session??null}),e.plan?(0,F.jsx)(fg,{plan:e.plan}):null,e.goal?(0,F.jsx)(fy,{goal:e.goal}):null,n||b?null:(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted",title:e.handoff?g("branch.handoffTitle"):g("branch.branchTitle"),children:[(0,F.jsx)(cD.A,{className:"h-3 w-3","aria-hidden":!0})," ",e.handoff?g("kind.handoff"):fO(g,e.kind)]})]})]}):null]}),j?(0,F.jsx)(uh,{state:j,targetLabel:e.migration?.targetLabel??e.migration?.targetAccountId??"",currentLabel:e.migration?.sourceLabel,error:e.migration?.failure??null,actionError:q,onRetry:H?()=>void H("retry"):void 0,onKeep:H?()=>void H("rollback"):void 0}):null,s??null,O?(0,F.jsx)(uC,{file:e}):null,D?(0,F.jsx)(uT,{file:e}):null,f?.length&&h?(0,F.jsx)(fT,{relations:f,onOpenTask:h}):null,t.length?(0,F.jsx)(u$,{className:"shrink-0 border-b border-border bg-sunken",enter:"fade",children:t.map(e=>(0,F.jsx)("div",{"data-flip-key":e.path,children:(0,F.jsx)(f_,{file:e,paused:W})},e.path))}):null,(0,F.jsx)(um,{predecessorLabel:e.predecessorLabel}),(0,F.jsx)(ff,{file:e,showSvc:!1,lineFilter:"",onStatus:fR,paused:W,follow:!0,setFollow:fR,compact:!0,onLaunchRetry:m&&e.spawn?()=>m(e):void 0}),d||!T?null:(0,F.jsx)(uN,{file:e}),a||D?null:(0,F.jsx)(o_,{file:e,pollPaused:W,deadHost:O,sendBlockedReason:_})]})]})}function f_({file:e,paused:t=!1}){let{t:n}=(0,er.Ym)(),[r,i]=(0,B.useState)(!1),a=(0,tt.cr)(e.cmdDesc||e.title,80);return(0,F.jsxs)("div",{className:"border-t border-border first:border-t-0",children:[(0,F.jsxs)("div",{className:"flex min-h-11 flex-wrap items-center gap-1.5 pl-2 pr-2.5 sm:min-h-7",children:[(0,F.jsxs)("button",{className:"flex min-h-11 min-w-0 flex-1 items-center gap-1.5 rounded-[6px] text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-7","aria-expanded":r,"aria-label":n("branch.toggleBackground",{action:n(r?"branch.collapse":"branch.expand"),title:a}),onClick:()=>i(e=>!e),children:[(0,F.jsx)(i9.c_,{className:`h-3.5 w-3.5 shrink-0 text-muted transition-transform ${r?"rotate-90":""}`,"aria-hidden":!0}),(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:(0,tt.cr)(e.title),children:a})]}),(0,F.jsx)(fr,{file:e,compact:!0})]}),r?(0,F.jsx)("div",{className:"flex h-[220px] flex-col border-t border-dashed border-border bg-canvas/60",children:(0,F.jsx)(ff,{file:e,showSvc:!1,lineFilter:"",onStatus:fR,paused:t,follow:!0,setFollow:fR,compact:!0})}):null]})}let fq={items:[],nextCursor:null,total:0};class fz extends Error{constructor(e){super(`conversation catalog request failed: ${e}`),this.status=e,this.name="ConversationCatalogRequestError"}}async function fH(e,t,n,r){let i,a=await fetch((i=new URLSearchParams({limit:"40"}),e&&i.set("project",e),t.trim()&&i.set("q",t.trim()),n&&i.set("cursor",n),`/api/conversations?${i}`),{signal:r});if(!a.ok)throw new fz(a.status);return a.json()}function fB({project:e,query:t="",enabled:n=!0}){let[r,i]=(0,B.useState)({project:e,query:t});(0,B.useEffect)(()=>{if(t===r.query&&e===r.project)return;let n=250*(r.query!==t),a=window.setTimeout(()=>i({project:e,query:t}),n);return()=>window.clearTimeout(a)},[e,t,r.project,r.query]);let a=`${r.project??""}\u0000${r.query}`,[s,l]=(0,B.useState)({key:"",page:fq,error:!1}),[o,c]=(0,B.useState)(null),[d,u]=(0,B.useState)(0);(0,B.useEffect)(()=>{if(!n)return;let e=new AbortController;return fH(r.project,r.query,null,e.signal).then(e=>l({key:a,page:e,error:!1})).catch(e=>{"AbortError"!==e.name&&l({key:a,page:fq,error:!0})}),()=>e.abort()},[r.project,r.query,n,a,d]),(0,B.useEffect)(()=>{if(!o||o.key!==a)return;let e=new AbortController;return fH(r.project,r.query,o.cursor,e.signal).then(e=>{l(t=>{if(t.key!==o.key)return t;let n=new Set(t.page.items.map(e=>e.path));return{key:t.key,page:{items:[...t.page.items,...e.items.filter(e=>!n.has(e.path))],nextCursor:e.nextCursor,total:e.total},error:!1}})}).catch(e=>{e instanceof fz&&409===e.status?u(e=>e+1):"AbortError"!==e.name&&l(e=>e.key===o.key?{...e,error:!0}:e)}).finally(()=>{e.signal.aborted||c(e=>e===o?null:e)}),()=>e.abort()},[o,r.project,r.query,a]);let p=n&&s.key===a?s:null,m=p?.page??fq,f=n&&(null===p||o?.key===a),h=p?.error??!1,x=(0,B.useCallback)(()=>{!f&&m.nextCursor&&c({key:a,cursor:m.nextCursor})},[f,m.nextCursor,a]),g=(0,B.useCallback)(()=>{c(null),u(e=>e+1)},[]);return{...m,loading:f,error:h,loadMore:x,retry:g}}function fU(){location.hash="#p="+encodeURIComponent(el)}async function fK(e,t=fetch){let n=[],r=new Set,i=null;do{let a=new URLSearchParams({project:e,limit:"100"});i&&a.set("cursor",i);let s=await t(`/api/conversations?${a}`);if(!s.ok)throw Error(`conversation catalog request failed: ${s.status}`);let l=await s.json();if(!Array.isArray(l.items))throw Error("conversation catalog response is invalid");if(n.push(...l.items),(i="string"==typeof l.nextCursor&&l.nextCursor?l.nextCursor:null)&&r.has(i))throw Error("conversation catalog cursor repeated");i&&r.add(i)}while(i);return n}async function fY(e,t,n=fetch){try{let r=await n("/api/log/project-delete",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({project:e,paths:t.map(e=>e.path)})}),i=await r.json();return r.ok&&i.ok?0:t.length}catch{return t.length}}function fW({file:e,activeSubtree:t,showProject:n=!1,onOpen:r}){let{t:i}=(0,er.Ym)(),a=rq(),[s,l]=(0,B.useState)(!1),o=(0,tt.yz)(e);return s?(0,F.jsxs)("div",{className:"flex items-center gap-2 rounded-[8px] border border-border bg-sunken/60 px-3 py-1.5 text-[11.5px] font-semibold text-muted",children:[(0,F.jsx)(i9.TB,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:(0,ei.cr)(e.title,80)}),(0,F.jsx)("span",{className:"shrink-0",children:i("trash.deletedFromDisk")})]}):(0,F.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-border bg-card px-3 py-1.5 shadow-1",children:[(0,F.jsxs)("button",{type:"button",className:`flex min-w-0 flex-1 items-center gap-2 rounded-[6px] text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"min-h-11":"h-full"}`,"aria-label":i("trash.open",{title:(0,ei.cr)(e.title,60)}),onClick:()=>r(e),children:[(0,F.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:o.style,children:o.label}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:e.path,children:(0,ei.cr)(e.title,90)}),n?(0,F.jsx)("span",{className:"max-w-[28vw] shrink-0 truncate rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[10px] font-semibold text-muted",children:e.project}):null,t?(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-accent/25 bg-accent/10 px-1.5 py-0.5 text-[10px] font-bold text-accent",title:i("trash.activeSubtree"),children:[(0,F.jsx)(i9.Zr,{className:"h-3 w-3","aria-hidden":!0}),i("trash.activeSubtree")]}):null,a?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-muted",children:(0,tt.rK)(e.mtime)}),(0,F.jsxs)("span",{className:"shrink-0 text-[10.5px] text-muted",children:[(e.size/1024).toFixed(0)," ",i("common.kb")]})]})]}),(0,F.jsx)(un,{file:e,onDeleted:()=>l(!0)})]})}function fJ({files:e,allowEmpty:t=!1,onArchive:n,compact:r=!1}){let{t:i}=(0,er.Ym)(),a=rq();return!e.length&&!t||e.some(e=>"running"===e.proc||"live"===e.activity)?null:(0,F.jsxs)("button",{type:"button",className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-canvas font-semibold text-muted hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"min-h-11 px-3 text-[13px]":r?"p-1 text-[11px]":"px-2 py-0.5 text-[11px]"}`,"aria-label":i("trash.toArchive"),title:i("trash.toArchive"),onClick:()=>{n(),fU()},children:[(0,F.jsx)(i9.Td,{className:a?"h-4 w-4":"h-3 w-3","aria-hidden":!0})," ",r&&!a?null:i("trash.toArchive")]})}function fV({project:e,files:t,available:n}){let{t:r}=(0,er.Ym)(),i=rq(),[a,s]=(0,B.useState)(!1),[l,o]=(0,B.useState)(!1),[c,d]=(0,B.useState)(""),[u,p]=(0,B.useState)(null);if((0,B.useEffect)(()=>{if(!a)return;let e=window.setTimeout(()=>s(!1),6e3);return()=>window.clearTimeout(e)},[a]),!n||t.some(e=>"running"===e.proc||"live"===e.activity))return null;let m=async()=>{o(!0),d("");try{let t=await fK(e);if(!t.length)throw Error("project catalog is empty");p(t),s(!0)}catch{d(r("trash.projectLoadFailed"))}finally{o(!1)}},f=async()=>{if(!u)return;o(!0),d("");let t=await fY(e,u);(o(!1),s(!1),t)?d(r("trash.notDeleted",{failed:t,total:u.length})):fU()};return a?(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-danger/30 bg-danger-soft px-1.5 py-0.5 text-[11px]",children:[(0,F.jsx)("span",{className:"px-0.5 font-semibold text-danger",children:r("trash.confirmDelete",{count:u?.length??0})}),(0,F.jsx)("button",{type:"button",className:`inline-flex items-center rounded-lg bg-danger font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/50 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,disabled:l,onClick:f,children:l?r("trash.deleting"):r("trash.confirmYes")}),(0,F.jsx)("button",{type:"button",className:`inline-flex items-center rounded-lg border border-border bg-card font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,onClick:()=>{s(!1),p(null)},children:r("common.cancel")})]}):(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,F.jsx)("button",{type:"button",className:`inline-flex items-center justify-center rounded-full border border-border bg-canvas text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"h-11 w-11":"p-1"}`,"aria-label":r("trash.deleteProject"),title:r("trash.deleteProject"),disabled:l,onClick:()=>void m(),children:l?(0,F.jsx)("span",{className:"text-[10px] font-bold",children:"…"}):(0,F.jsx)(i9.TB,{className:i?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),c?(0,F.jsx)("span",{className:"max-w-[180px] truncate text-[10.5px] font-semibold text-danger",children:c}):null]})}function fG({project:e,enabled:t,onOpen:n}){let{t:r}=(0,er.Ym)(),[i,a]=(0,B.useState)(""),s=!!i.trim(),l=fB({project:s?void 0:e,query:i,enabled:t});return(0,F.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-4 sm:px-4 sm:py-5",children:(0,F.jsxs)("div",{className:"mx-auto w-full max-w-[760px]",children:[(0,F.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,F.jsx)("div",{className:"text-[13.5px] font-semibold text-muted",children:r(s?"switch.results":"list.title")}),l.total?(0,F.jsx)("span",{className:"text-[11px] font-bold tabular-nums text-muted",children:l.total}):null]}),(0,F.jsx)("div",{className:"mt-0.5 text-[12px] text-muted",children:r(s?"list.searchHint":"list.hint")}),(0,F.jsx)("input",{type:"search",value:i,onChange:e=>a(e.target.value),placeholder:r("switch.search"),"aria-label":r("switch.search"),className:"mb-3 mt-2 h-11 w-full rounded-[8px] border border-border bg-card px-3 text-[13px] text-primary outline-none placeholder:text-muted focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,F.jsx)("div",{className:"space-y-1.5",children:l.items.map(e=>(0,F.jsx)(fW,{file:e,activeSubtree:!1,showProject:s,onOpen:n},e.path))}),l.loading&&!l.items.length?(0,F.jsxs)("div",{className:"flex min-h-32 items-center justify-center gap-2 text-[13px] font-semibold text-muted",children:[(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0})," ",r("common.loading")]}):null,l.error?(0,F.jsxs)("div",{className:"flex min-h-32 flex-col items-center justify-center gap-2 text-center text-[13px] font-semibold text-danger",children:[(0,F.jsx)("span",{children:r("list.failed")}),(0,F.jsx)("button",{type:"button",className:"min-h-11 rounded-[8px] border border-border bg-card px-4 font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:l.retry,children:r("list.retry")})]}):null,l.loading||l.error||l.items.length?null:(0,F.jsx)("div",{className:"min-h-32 pt-10 text-center text-[13px] font-semibold text-muted",children:r("common.nothingFound")}),l.nextCursor&&!l.error?(0,F.jsx)("button",{type:"button",className:"mt-3 flex min-h-11 w-full items-center justify-center rounded-[8px] border border-border bg-card px-4 text-[12.5px] font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",disabled:l.loading,onClick:l.loadMore,children:r(l.loading?"common.loading":"list.loadMore")}):null]})})}let fX="h-7 min-w-0 rounded-control border border-border bg-card px-1.5 text-ui text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60";function fQ({className:e,...t}){return(0,F.jsx)("select",{...t,className:e?`${fX} ${e}`:fX})}function fZ(e){return Object.fromEntries(e.parameters.map(e=>[e.key,void 0!==e.default?e.default:"integer"===e.kind?e.min??1:"select"===e.kind?e.options?.[0]??"":""]))}let f0=(0,B.forwardRef)(function({phase:e,target:t,structured:n=!1,error:r},i){let{t:a}=(0,er.Ym)(),s="attention"===e,l=s?r||(n?a("draft.attentionStructured"):t?a("draft.attention",{target:t}):a("draft.attentionNoTarget")):"confirming"===e?n?a("draft.confirmingStructured"):t?a("draft.confirming",{target:t}):a("draft.confirmingNoTarget"):n?a("draft.launchedStructured"):a("draft.launched",{target:t});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{ref:i,tabIndex:s?-1:void 0,role:"status","aria-live":s?"assertive":"polite",className:`flex items-center gap-2 text-[11.5px] font-semibold outline-none ${s?"text-danger":"text-muted"}`,children:[s?(0,F.jsx)(i9.MA,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 shrink-0 animate-spin motion-reduce:animate-none","aria-hidden":!0}),(0,F.jsx)("span",{children:l})]}),"booting-slow"===e?(0,F.jsx)("div",{className:"text-[11px] text-muted",children:n?a("draft.slowStructured"):a("draft.slow",{target:t})}):null]})});function f1({engine:e,model:t,effort:n,speed:r,disabled:i,onModel:a,onEffort:s,onSpeed:l}){let{t:o}=(0,er.Ym)();return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(fQ,{value:t,disabled:i,"aria-label":o("draft.modelAria"),title:o("draft.modelAria"),onChange:e=>a(e.target.value),children:[(0,F.jsx)("option",{value:"",children:o("draft.modelDefault")}),sQ[e].map(e=>(0,F.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,F.jsxs)(fQ,{value:n,disabled:i,"aria-label":o("draft.reasoningAria"),title:o("draft.reasoningAria"),onChange:e=>s(e.target.value),children:[(0,F.jsx)("option",{value:"",children:o("draft.effortDefault")}),sW.Lw[e].map(e=>(0,F.jsx)("option",{value:e,children:c2(o,e)},e))]}),"codex"===e?(0,F.jsxs)(fQ,{value:r,disabled:i,"aria-label":o("draft.speedAria"),title:o("draft.speedTitle"),onChange:e=>l(e.target.value),children:[(0,F.jsx)("option",{value:"",children:o("draft.speedDefault")}),(0,F.jsx)("option",{value:"fast",children:o("draft.speedFast")}),(0,F.jsx)("option",{value:"standard",children:o("draft.speedStandard")})]}):null]})}function f2(e){let t=Array.isArray(e?.accounts)?e.accounts.flatMap(e=>"string"==typeof e.id&&"string"==typeof e.label?[{id:e.id,label:e.label,authPresent:!1!==e.authPresent}]:[]):[];return{active:"string"==typeof e?.active?e.active:"",accounts:t}}let f5=new Set(["image/png","image/jpeg","image/gif","image/webp"]);function f3(e){return!e||"object"!=typeof e||Array.isArray(e)||"boolean"!=typeof e.supported||null!==e.reason&&"string"!=typeof e.reason||!Array.isArray(e.formats)||0===e.formats.length||e.formats.some(e=>"string"!=typeof e||!f5.has(e))||!Number.isSafeInteger(e.maxImages)||0>=Number(e.maxImages)||!Number.isSafeInteger(e.maxRawBytesPerImage)||0>=Number(e.maxRawBytesPerImage)||!Number.isSafeInteger(e.maxEncodedBytesPerRequest)||0>=Number(e.maxEncodedBytesPerRequest)?null:e}let f4=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],f6=(e,t)=>`llvDraftPane:${e}:${t}`;function f8({engine:e,disabled:t,onChange:n}){let{t:r}=(0,er.Ym)();return(0,F.jsx)("div",{className:"flex shrink-0 items-center gap-1",role:"radiogroup","aria-label":r("draft.engineAria"),children:f4.map(({key:r,label:i})=>{let a=e===r,s=(0,tt.t7)(r);return(0,F.jsx)("button",{type:"button",role:"radio","aria-checked":a,disabled:t,onClick:()=>n(r),style:a?{backgroundColor:"var(--color-card)",color:s.color,borderColor:s.color}:void 0,className:`rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${a?"":"border-transparent bg-transparent text-muted hover:text-primary"}`,children:i},r)})})}let f7=null,f9=null;function he(){let[e,t]=(0,B.useState)(()=>f7??[]);return(0,B.useEffect)(()=>{if(f7)return;let e=!1;return(f9??=fetch("/api/roles").then(async e=>{if(!e.ok)return null;let t=await e.json();return Array.isArray(t.roles)?t.roles:null}).catch(()=>null).then(e=>(e?f7=e:f9=null,e))).then(n=>{!e&&n&&t(n)}),()=>{e=!0}},[]),e}function ht({idPrefix:e,roles:t,roleId:n,roleParams:r,disabled:i,allowedRoleIds:a,compactPreview:s,onSelectRole:l,onSetParam:o,children:c}){var d,u;let{t:p}=(0,er.Ym)(),m=a?t.filter(e=>a.has(e.id)):t,f=m.find(e=>e.id===n)??null;return(0,F.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-border bg-sunken px-2.5 py-1.5",children:[(0,F.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,F.jsx)("label",{className:"shrink-0 text-caption font-semibold text-muted",htmlFor:`draft-role-${e}`,children:p("draft.role")}),(0,F.jsxs)(fQ,{id:`draft-role-${e}`,value:n,disabled:i,onChange:e=>l(e.target.value),"aria-label":p("draft.roleAria"),className:"flex-1",children:[(0,F.jsx)("option",{value:"",children:p("draft.noRole")}),m.map(e=>(0,F.jsx)("option",{value:e.id,children:c1(p,`roleCopy.${e.id}.name`,e.name)},e.id))]})]}),f?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("p",{className:"text-caption leading-4 text-muted",children:c1(p,`roleCopy.${f.id}.description`,f.description)}),f.parameters.length?(0,F.jsx)("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":p("draft.roleParameters"),children:f.parameters.map(e=>{var t,n;let a=(t=f.id,c1(p,`roleCopy.${t}.param.${e.key}.label`,e.label));return(0,F.jsxs)("label",{className:"flex min-w-28 flex-1 flex-col gap-0.5 text-caption text-muted",children:[(0,F.jsxs)("span",{children:[a,e.required?" *":""]}),"select"===e.kind?(0,F.jsx)(fQ,{value:String(r[e.key]??""),disabled:i,onChange:t=>o(e.key,t.target.value),children:e.options?.map(t=>{var n,r;return(0,F.jsx)("option",{value:t,children:(n=f.id,r=e.key,c1(p,`roleCopy.${n}.param.${r}.option.${t}`,t))},t)})}):(0,F.jsx)("input",{type:"integer"===e.kind?"number":"text",min:"integer"===e.kind?e.min:void 0,max:"integer"===e.kind?e.max:void 0,value:String(r[e.key]??""),disabled:i,onChange:t=>o(e.key,"integer"===e.kind&&t.target.value?Number(t.target.value):t.target.value),"aria-label":a,className:"h-7 min-w-0 rounded-control border border-border bg-card px-1.5 text-ui text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,F.jsx)("span",{className:"leading-3",children:(n=f.id,c1(p,`roleCopy.${n}.param.${e.key}.description`,e.description))})]},e.key)})}):null,c,(0,F.jsxs)("details",{className:"rounded-control border border-border bg-card/60",children:[(0,F.jsx)("summary",{className:"min-h-7 cursor-pointer select-none list-item px-2 py-1 text-caption font-semibold text-secondary marker:text-muted hover:text-primary",children:p("draft.rolePromptToggle")}),(0,F.jsxs)("div",{className:"border-t border-border px-2 py-1.5 text-caption leading-4 text-muted",children:[(0,F.jsx)("pre",{className:`whitespace-pre-wrap font-sans ${s?"max-h-24 overflow-y-auto":""}`,children:(d=f.promptPreview,u=r,d.replace(/\{\{([A-Za-z][A-Za-z0-9]*)\}\}/g,(e,t)=>String(u[t]??"")))}),(0,F.jsx)("ul",{className:`mt-1 list-disc pl-4 ${s?"max-h-16 overflow-y-auto":""}`,"aria-label":p("draft.safetyFences"),children:f.safetyFences.map(e=>(0,F.jsx)("li",{children:e},e))})]})]})]}):null]})}function hn(e,t){return sessionStorage.getItem(f6(e,t))??""}function hr(e,t,n){n?sessionStorage.setItem(f6(e,t),n):sessionStorage.removeItem(f6(e,t))}function hi(e){return hn(e,"src")}function ha(e,t){hr(e,"cwd",t),hr(e,"cwdUnverified","")}function hs(e,t){let n=t.trim();!hn(e,"cwd").trim()&&n&&hr(e,"cwd",n),n&&hr(e,"cwdUnverified","")}function hl(e,t){hr(e,"cwd",t.trim()),hr(e,"cwdUnverified","1")}let ho="llv:draft-cwd-verified";function hc({draftId:e,project:t,files:n,onClose:r,onSpawned:i}){let{t:a}=(0,er.Ym)(),[s]=(0,B.useState)(()=>hn(e,"src")),[l]=(0,B.useState)(()=>hn(e,"parentConversationId")),o=s?n.find(e=>e.path===s)??null:null,[c]=(0,B.useState)(()=>hn(e,"cwd")),[d,u]=(0,B.useState)(()=>"1"===hn(e,"cwdUnverified")),p=(0,B.useRef)(!!(s&&(!c&&!o?.cwd?.trim()||"1"===hn(e,"cwdUnverified")))),[m,f]=(0,B.useState)(()=>{let t=hn(e,"engine");return"codex"===t||"claude"===t?t:o?.engine==="codex"?"codex":"claude"}),[h,x]=(0,B.useState)(()=>c||eh(n,t,s)),[g,b]=(0,B.useState)(()=>hn(e,"model")||sZ(m)),[v,w]=(0,B.useState)(()=>hn(e,"effort")),[y,k]=(0,B.useState)(()=>{let t=hn(e,"speed");return"fast"===t||"standard"===t?t:""}),[j,N]=(0,B.useState)(()=>hn(e,"accountId")),S=he(),[C,A]=(0,B.useState)(()=>hn(e,"role")),[I,M]=(0,B.useState)(()=>(function(e){try{let t=JSON.parse(hn(e,"roleParams")||"{}");if(!t||"object"!=typeof t||Array.isArray(t))return{};return Object.fromEntries(Object.entries(t).filter(([,e])=>"string"==typeof e||"number"==typeof e))}catch{return{}}})(e)),[T,$]=(0,B.useState)(()=>hn(e,"reviews")),[E,R]=(0,B.useState)(()=>hn(e,"confirm")),[P,O]=(0,B.useState)(null),[D,L]=(0,B.useState)([]),_=`${t}
52
- ${s??""}
53
- ${m}`,[q,z]=(0,B.useState)({status:"loading",requestKey:_}),[H,K]=(0,B.useState)(0),Y=q.requestKey===_?q:{status:"loading",requestKey:_},[W,J]=(0,B.useState)(()=>(function(e){try{let t=JSON.parse(hn(e,"boot")||"null");if(!t||"number"!=typeof t.at||"string"!=typeof t.prompt||"string"!=typeof t.clientAttemptId||"booting"!==t.phase&&"confirming"!==t.phase&&"attention"!==t.phase)return null;return{...t,request:t.request&&"object"==typeof t.request?t.request:null}}catch{return null}})(e)),[V,G]=(0,B.useState)(!1),X=(0,B.useRef)(null),Z=(0,B.useRef)(new Set);(0,B.useEffect)(()=>{let t=t=>{let n=t.detail;n?.id===e&&"string"==typeof n.cwd&&(p.current=!1,x(n.cwd),u(!1))};return window.addEventListener(ho,t),()=>window.removeEventListener(ho,t)},[e]);let ee=t=>{b(t),hr(e,"model",t)},et=t=>{w(t),hr(e,"effort",t)},en=t=>{k(t),hr(e,"speed",t)},ei=n=>{z({status:"loading",requestKey:`${t}
54
- ${s??""}
55
- ${n}`}),f(n),hr(e,"engine",n),N(""),hr(e,"accountId",""),ee(sZ(n)),v&&!(0,sW.z9)(n,v)&&et("")},ea=t=>{M(t),hr(e,"roleParams",JSON.stringify(t))},es=t=>{R(t),hr(e,"confirm",t)},el=(0,B.useCallback)(t=>{J(t),hr(e,"boot",t?JSON.stringify(t):"")},[e]),eo="ready"===Y.status?Y.value:null,ec=eo?.spawnTransport==="structured",ed=eo?.spawnTransport==="structured"?eo.imageInput[m]:null,eu=ed&&"codex"===m&&!sX(g)?{...ed,supported:!1,reason:a("composer.codexImagesTextOnly")}:ed,ep=aI({initialText:()=>hn(e,"text")||(s?a("draft.readPrompt",{src:s}):""),persistText:t=>hr(e,"text",t),submit:e=>eA(e),disabled:!!W,imageCapability:eu}),{text:em,setText:ef,setStatus:ex,busy:eg,setBusy:eb,voiceSending:ev,attachments:ew}=ep;(0,B.useEffect)(()=>{let n=!1;return fetch("/api/spawn?project="+encodeURIComponent(t)+(s?"&src="+encodeURIComponent(s):"")).then(async e=>{if(!e.ok)throw Error("spawn capability request failed");return await e.json()}).then(t=>{if(n)return;Array.isArray(t.dirs)&&L(t.dirs);let r="string"==typeof t.cwd?t.cwd.trim():"",i=!!(p.current&&r);if(i){p.current=!1;let n=!1===t.cwdExists;u(n),hr(e,"cwdUnverified",n?"1":"")}x(n=>{let a=i&&r||n||r||t.dirs?.[0]||"";return a!==n&&hr(e,"cwd",a),a});let a=function(e){if(!e||"object"!=typeof e||Array.isArray(e)||"tmux"!==e.spawnTransport&&"structured"!==e.spawnTransport||!e.imageInput||"object"!=typeof e.imageInput||Array.isArray(e.imageInput))return null;let t=e.imageInput,n=f3(t.claude),r=f3(t.codex);return n&&r?{spawnTransport:e.spawnTransport,imageInput:{claude:n,codex:r}}:null}(t);if(!a)throw Error("spawn capability response is invalid");z({status:"ready",requestKey:_,value:a})}).catch(()=>{n||z({status:"error",requestKey:_})}),()=>{n=!0}},[t,e,s,m,_,H]),(0,B.useEffect)(()=>{fetch("/api/accounts").then(async e=>{if(!e.ok)return;let t=await e.json();O({claude:f2(t.claude),codex:f2(t.codex)})}).catch(()=>{})},[]),(0,B.useEffect)(()=>{if(!W)return;let e=function(e,t){if(e.path)return t.find(t=>t.path===e.path)??null;if(e.conversationId){let n=t.find(t=>t.conversationId===e.conversationId);if(n)return n}if(e.clientAttemptId){let n=t.find(t=>t.spawn?.clientAttemptId===e.clientAttemptId);if(n)return n}return null}(W,n);if(!e)return;let t=e.spawn?.launchId??W.launchId;t&&(W.prompt.trim()||W.hasImages)&&s$(U(e),{id:t,text:W.prompt,images:W.request?.images.length??0,at:W.at}),i(e)},[n,W,i]),(0,B.useEffect)(()=>{if(!W||"attention"===W.phase)return;let e=(W.phase,9e4),t=()=>{"booting"===W.phase?G(!0):el({...W,phase:"attention"})},n=W.at+e-Date.now();if(n<=0)return void t();let r=window.setTimeout(t,n);return()=>window.clearTimeout(r)},[W,el]),(0,B.useEffect)(()=>{W?.phase==="attention"&&X.current?.focus()},[W?.phase]);let ey=(0,B.useCallback)(async e=>{eb(!0),ex(null);try{let t=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(function(e){let{request:t}=e;return{engine:t.engine,...t.model?{model:t.model}:{},cwd:t.cwd,...t.effort?{effort:t.effort}:{},...null===t.fast?{}:{fast:t.fast},...t.accountId?{accountId:t.accountId}:{},prompt:t.prompt,images:t.images,clientAttemptId:e.clientAttemptId,...t.src?{src:t.src}:{},...t.parentConversationId?{parentConversationId:t.parentConversationId}:{},...t.role?{role:t.role,roleParams:t.roleParams??{}}:{},...t.reviews?{reviews:t.reviews}:{},...t.confirm?{confirm:t.confirm}:{}}}(e))}),n=null;try{n=await t.json()}catch{n=null}let r=function(e,t,n){if(n?.retrySafe)return{kind:"failed-preflight",message:n.error??null};if(t&&n?.ok){let e="string"==typeof n.path?n.path:null,t="string"==typeof n.conversationId?n.conversationId:null,r="string"==typeof n.launchId?n.launchId:null,i="string"==typeof n.target?n.target:"";if(!1===n.launched&&"string"==typeof n.error&&n.error)return{kind:"failed-launch",message:n.error,target:i,conversationId:t,launchId:r};let a="settled"===n.state&&null!==e;return{kind:"launched",durable:a?"booting":"confirming",target:i,path:a?e:null,conversationId:t,launchId:r}}return 409===e?{kind:"ambiguous"}:e>=400&&e<500?{kind:"failed-preflight",message:n?.error??null}:{kind:"ambiguous"}}(t.status,t.ok,n),i="launched"===r.kind||"failed-launch"===r.kind?r.launchId??e.clientAttemptId:null;if(i&&tX("launched"===r.kind?{cue:"launch",eventId:`launch:${i}`}:{cue:"failure",eventId:`launch-failed:${i}`}),"string"==typeof n?.launchId&&"string"==typeof n.conversationId&&nw(),"launched"===r.kind){let t=r.conversationId??(r.launchId?`spawn:${r.launchId}`:null);t&&r.launchId&&s$(t,{id:r.launchId,text:e.prompt,images:e.request.images.length,at:e.at}),el({...e,target:r.target,path:r.path,conversationId:r.conversationId,launchId:r.launchId,phase:r.durable,error:null})}else"failed-launch"===r.kind?el({...e,target:r.target,conversationId:r.conversationId,launchId:r.launchId,phase:"attention",error:r.message}):"failed-preflight"===r.kind&&(el(null),ef(e.request.prompt),ew.replace(e.request.images.map(e=>({...e,preview:`data:${e.mime};base64,${e.base64}`})))&&ex({kind:"err",text:r.message??a("draft.launchFailed")}))}catch{}finally{eb(!1)}},[ew,el,eb,ex,ef,a]);(0,B.useEffect)(()=>{let e;!W||!((e=W.request)&&("claude"===e.engine||"codex"===e.engine)&&e.engine===W.engine&&"string"==typeof e.model&&"string"==typeof e.cwd&&e.cwd.length>0&&"string"==typeof e.effort&&(null===e.fast||"boolean"==typeof e.fast)&&"string"==typeof e.accountId&&"string"==typeof e.prompt&&"string"==typeof e.src&&e.src===W.src&&(void 0===e.parentConversationId||"string"==typeof e.parentConversationId)&&(void 0===e.role||"string"==typeof e.role)&&(void 0===e.roleParams||"object"==typeof e.roleParams&&null!==e.roleParams&&!Array.isArray(e.roleParams))&&(void 0===e.reviews||"string"==typeof e.reviews)&&("reviewer"===e.role?!!e.reviews?.trim():void 0===e.reviews)&&(void 0===e.confirm||"string"==typeof e.confirm)&&Array.isArray(e.images)&&e.images.every(e=>"string"==typeof e?.base64&&"string"==typeof e?.mime))||Z.current.has(W.clientAttemptId)||(Z.current.add(W.clientAttemptId),ey(W))},[W,ey]);let ek=S.find(e=>e.id===C)??null,ej=P?.[m]??null,eN=ej?.accounts.some(e=>e.id===j)?j:ej?.active??"",eS="ready"!==Y.status||eo?.spawnTransport==="structured"&&!eu?.supported,eC="loading"===Y.status?a("composer.imageCapabilityLoading"):"error"===Y.status?a("composer.imageCapabilityError"):eo?.spawnTransport!=="structured"||"codex"!==m||sX(g)?eo?.spawnTransport!=="structured"||eu?.supported?void 0:a("composer.structuredImagesProtocol"):a("composer.codexImagesTextOnly"),eA=async e=>{var t,n,r;let i=e??em;if(eg||ev||W)return;if(ew.images.length&&eS)return void ex({kind:"err",text:eC??a("composer.structuredImagesUnavailable")});if(ew.images.length&&!ew.validate())return;if(d)return void ex({kind:"err",text:a("draft.confirmRecoveredDir")});if(!h.trim())return void ex({kind:"err",text:a("draft.needDir")});if(ek){if(ek.parameters.find(e=>{if(!e.required)return!1;let t=I[e.key];return void 0===t||"string"==typeof t&&!t.trim()}))return void ex({kind:"err",text:a("draft.roleNeedsParams")});if("deployer"===ek.id&&"deploy"!==E)return void ex({kind:"err",text:a("draft.deployConfirm")});if("reviewer"===ek.id&&!T)return void ex({kind:"err",text:a("draft.reviewerNeedsConversation")})}if(!i.trim()&&!ew.images.length)return;let o=(t=("u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,12)).replace(/[^A-Za-z0-9_-]/g,"").slice(0,128).padEnd(8,"0"),n=Date.now(),r={engine:m,model:g,cwd:h.trim(),effort:v,fast:"codex"===m&&y?"fast"===y:null,accountId:eN,prompt:i,images:ew.images.map(e=>({base64:e.base64,mime:e.mime})),src:s,...l?{parentConversationId:l}:{},...C?{role:C,roleParams:I,..."reviewer"===C&&T?{reviews:T}:{},...E?{confirm:E}:{}}:{}},{clientAttemptId:t,at:n,target:"",path:null,conversationId:null,launchId:null,prompt:r.prompt.trim(),hasImages:r.images.length>0,request:r,engine:r.engine,src:r.src,phase:"confirming",error:null});Z.current.add(o.clientAttemptId),el(o),ef(""),ew.clear(),await ey(o)},eI=(0,tt.t7)(m),eM=ep.fieldsDisabled,eT="draft-dirs-"+e,e$=W?"attention"===W.phase?"attention":"confirming"===W.phase?"confirming":V?"booting-slow":"booting":eg?"launching":"draft",eE=W?.target??"",eR=Q(n).filter(e=>("claude"===e.engine||"codex"===e.engine)&&!!(e.conversationId||e.path));return(0,F.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-border bg-card shadow-1","aria-label":a("draft.paneAria"),children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:eI.color}}),(0,F.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-2.5",style:{backgroundColor:eI.soft},children:[ej&&ej.accounts.length?(0,F.jsx)(fQ,{value:eN,disabled:eM,onChange:t=>{N(t.target.value),hr(e,"accountId",t.target.value)},className:"max-w-28","aria-label":a("draft.accountAria",{engine:"codex"===m?"Codex":"Claude"}),children:ej.accounts.map(e=>(0,F.jsx)("option",{value:e.id,disabled:!e.authPresent,children:e.id===ej.active?a("draft.accountDefault",{label:e.label}):e.authPresent?e.label:a("draft.accountNeedsLogin",{label:e.label})},e.id))}):null,(0,F.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-strong",title:a("draft.notStarted")}),(0,F.jsx)(f8,{engine:m,disabled:eM,onChange:ei}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-muted",title:o?(0,tt.cr)(o.title):void 0,children:s?a("draft.handoffLabel",{title:o?(0,tt.cr)(o.title,60):a("draft.conversation")}):a("draft.newConvo")}),(0,F.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-border bg-canvas px-1.5 py-0.5 text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":a("draft.dismiss"),onClick:r,children:(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,F.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-sunken px-2.5 py-1.5",children:[(0,F.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-muted",children:a("draft.directory")}),(0,F.jsx)("input",{value:h,disabled:eM,onChange:t=>{var n;return n=t.target.value,void(p.current=!1,u(!1),x(n),hr(e,"cwd",n),hr(e,"cwdUnverified",""))},list:eT,placeholder:"/home/…/Projects/…","aria-label":a("draft.dirAria"),className:"min-h-11 min-w-0 flex-1 rounded-[6px] border border-border bg-card px-2 py-1 font-mono text-[11px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 sm:min-h-0"}),(0,F.jsx)("datalist",{id:eT,children:D.map(e=>(0,F.jsx)("option",{value:e},e))})]}),d?(0,F.jsx)("p",{role:"alert",className:"shrink-0 border-b border-warning/30 bg-warning-soft px-2.5 py-1.5 text-[10.5px] leading-4 text-warning",children:a("draft.confirmRecoveredDir")}):null,(0,F.jsxs)(ht,{idPrefix:e,roles:S,roleId:C,roleParams:I,disabled:eM,onSelectRole:t=>{A(t),hr(e,"role",t);let n=S.find(e=>e.id===t);if(!n){ea({}),es("");return}ea(fZ(n)),es(""),ei(n.config.engine),ee(n.config.model),et(n.config.effort),en("")},onSetParam:(e,t)=>{let n={...I,[e]:t};ea(n);let r=S.find(e=>e.id===C);if(r?.id==="builder"){if("frontend"===n.domain){ei("claude"),ee("opus"),et("high"),en("");return}if("apply-fixes"===n.mode){ei("codex"),ee("gpt-5.6-terra"),et("low");return}ei(r.config.engine),ee(r.config.model),et(r.config.effort)}},children:[ek?.id==="reviewer"?(0,F.jsxs)("label",{className:"flex max-w-full flex-col gap-0.5 text-caption text-muted",children:[(0,F.jsx)("span",{children:a("draft.reviews")}),(0,F.jsxs)(fQ,{value:T,disabled:eM,onChange:t=>{var n;$(n=t.target.value),hr(e,"reviews",n)},"aria-label":a("draft.reviewsAria"),children:[(0,F.jsx)("option",{value:"",children:a("draft.reviewsPlaceholder")}),T&&!eR.some(e=>(e.conversationId??e.path)===T)?(0,F.jsx)("option",{value:T,children:T}):null,eR.map(e=>{let t=e.conversationId??e.path;return(0,F.jsx)("option",{value:t,children:(0,tt.cr)(e.title,80)},t)})]})]}):null,ek?.id==="deployer"?(0,F.jsxs)("label",{className:"flex max-w-52 flex-col gap-0.5 text-[10px] text-muted",children:[(0,F.jsx)("span",{children:a("draft.deployConfirm")}),(0,F.jsx)("input",{value:E,disabled:eM,onChange:e=>es(e.target.value),"aria-label":a("draft.deployConfirm"),placeholder:"deploy",className:"h-7 rounded-[7px] border border-border bg-card px-1.5 text-[11px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}):null]}),(0,F.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border bg-sunken px-2.5 py-1.5",children:[(0,F.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-muted",children:a("draft.reasoning")}),(0,F.jsx)(f1,{engine:m,model:g,effort:v,speed:y,disabled:eM,onModel:ee,onEffort:et,onSpeed:en})]}),(0,F.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:W?(0,F.jsxs)("div",{className:"flex flex-1 flex-col justify-end gap-3",children:[(0,F.jsx)("div",{className:"flex justify-end",children:(0,F.jsx)("span",{className:"min-w-0 max-w-[85%] whitespace-pre-wrap rounded-[10px] rounded-br-[3px] bg-accent-soft px-2.5 py-1.5 text-[12px] text-secondary",children:W.prompt||a("draft.imagesOnly")})}),(0,F.jsx)(f0,{ref:X,phase:e$,target:eE,structured:ec,error:W.error??null})]}):(0,F.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[(0,F.jsx)("span",{className:"rounded-full px-3 py-1 text-[13px] font-bold",style:{backgroundColor:eI.soft,color:eI.color},children:"claude"===m?"Claude":"Codex"}),(0,F.jsx)("div",{className:"max-w-[360px] text-[12px] text-muted",children:s?a("draft.hintRelay"):ec?a("draft.hintNewStructured"):a("draft.hintNew")}),s?(0,F.jsx)("div",{className:"max-w-[420px] truncate font-mono text-[10px] text-muted",title:s,children:s}):null]})}),(0,F.jsxs)("form",{onSubmit:e=>{e.preventDefault(),eA()},className:"flex shrink-0 flex-col gap-1.5 border-t border-border bg-card px-2.5 py-2","aria-label":a("draft.promptAria"),children:["error"===Y.status?(0,F.jsxs)("div",{role:"alert",className:"flex items-center justify-between gap-2 rounded-control bg-danger-soft px-2 py-1 text-caption text-danger",children:[(0,F.jsx)("span",{children:a("composer.imageCapabilityError")}),(0,F.jsx)("button",{type:"button",className:"shrink-0 rounded-control border border-danger/30 bg-card px-2 py-1 font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/30",onClick:()=>{z({status:"loading",requestKey:_}),K(e=>e+1)},children:a("composer.imageCapabilityRetry")})]}):null,(0,F.jsx)(a9,{composer:ep,placeholder:ec?a("draft.placeholderStructured"):a("draft.placeholder"),textareaAriaLabel:a("draft.promptTextAria"),imageAriaLabel:a("draft.addImages"),sendLabelIdle:a("composer.launchAgent"),sendLabelRecording:a("draft.stopAndLaunch"),sendIdleClassName:"hover:opacity-90",sendIdleStyle:{backgroundColor:eI.color,borderColor:eI.color},imageDisabled:eS,imageDisabledReason:eC,leftSlot:(0,F.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-control bg-sunken px-1.5 py-1 text-caption font-semibold text-secondary",title:ec?a("draft.newWindowTitleStructured"):a("draft.newWindowTitle"),children:[(0,F.jsx)(i9.jG,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",a("draft.newAgent")]})})]})]})}function hd(e,t){return{mutation:{kind:"close",path:e},ephemeral:t.filter(t=>t!==e)}}function hu(e){return`llvReviewDeckCollapsed:${e}`}function hp(e){return"approved"===e.state||"done_comment"===e.state||"closed"===e.state}function hm(e){let t=e.rounds[e.rounds.length-1];return t?`r${t.n}:${t.reviewerConversationId??t.reviewerPath??"pending"}:${t.verdict??(t.error?"error":"open")}`:"empty"}function hf(e,t,n,r){e.setItem(hu(t),JSON.stringify({v:n,at:r}))}function hh({repoDir:e,onCreate:t,onCreated:n,onClose:r}){let{t:i}=(0,er.Ym)(),[a,s]=(0,B.useState)(e),[l,o]=(0,B.useState)(0),[c,d]=(0,B.useState)(()=>e.trim()?{phase:"checking"}:{phase:"blocked",code:"missing",path:""}),u=(0,B.useRef)(0);(0,B.useEffect)(()=>{let e=a.trim(),t=++u.current,n=new AbortController;return e&&dP(e,n.signal).then(e=>{t!==u.current||n.signal.aborted||(e.ok?d({phase:"ready",repoDir:e.repoDir}):d({phase:"blocked",code:e.code,path:e.path,error:e.error}))}).catch(n=>{t!==u.current||n instanceof DOMException&&"AbortError"===n.name||d({phase:"blocked",code:"missing",path:e,error:i("common.serverUnavailable")})}),()=>n.abort()},[a,l]);let p="creating"===c.phase,m="ready"===c.phase,f="ready"===c.phase||"creating"===c.phase?c.repoDir:a,h=async e=>{if("ready"!==c.phase)return;let r=c.repoDir;d({phase:"creating",repoDir:r});let i=await t(e,r);i.pipeline?n(i.pipeline):d({phase:"blocked",code:i.code??"missing",path:i.path??r,error:i.code?void 0:i.error})};(0,B.useEffect)(()=>{let e=e=>{"Escape"!==e.key||p||(e.stopPropagation(),r())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[p,r]);let x=dT.filter(e=>"blank"!==e.id),g="blocked"===c.phase?(c.path||f).trim():"",b="blocked"===c.phase?c.error??(g?i(`pipelinePreflight.${c.code}`,{path:g}):i("pipelinePreflight.empty")):null;return(0,F.jsx)("div",{"data-pipeline-picker-state":c.phase,className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/40 sm:items-center",role:"presentation",onClick:e=>{e.target!==e.currentTarget||p||r()},children:(0,F.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":i("pipelineTemplates.title"),className:"w-full max-w-[460px] rounded-t-surface bg-card p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-2 sm:rounded-surface sm:pb-3",children:[(0,F.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,F.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,F.jsx)("div",{className:"text-title font-bold text-primary",children:i("pipelineTemplates.title")}),(0,F.jsx)("div",{className:"text-ui text-muted",children:i("pipelineTemplates.subtitle")})]}),(0,F.jsx)("button",{type:"button",onClick:r,disabled:p,"aria-label":i("common.close"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-control border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(i9.X,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,F.jsxs)("label",{className:"mb-2 flex flex-col gap-1",children:[(0,F.jsx)("span",{className:"text-label font-semibold text-secondary",children:i("pipelineTemplates.repoDir")}),(0,F.jsx)("input",{value:f,disabled:p,autoFocus:!e.trim(),onInput:e=>{let t=e.currentTarget.value;s(t),d(t.trim()?{phase:"checking"}:{phase:"blocked",code:"missing",path:""})},className:"h-11 w-full rounded-control border border-border bg-canvas px-3 text-ui font-semibold text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}),(0,F.jsxs)("div",{className:"mb-2 flex min-h-8 items-center gap-2 text-ui font-semibold text-muted","aria-live":"polite",children:["checking"===c.phase?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-accent border-r-transparent","aria-hidden":!0}),i("pipelineTemplates.checking")]}):null,"ready"===c.phase?(0,F.jsx)("span",{className:"text-success",children:i("pipelineTemplates.ready")}):null,"creating"===c.phase?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-accent border-r-transparent","aria-hidden":!0}),i("pipelineTemplates.creating")]}):null,"blocked"===c.phase?(0,F.jsxs)("span",{className:"flex w-full items-start gap-2 rounded-control border border-danger/30 bg-danger-soft px-2 py-1.5 text-danger",role:"alert",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1",children:b}),(0,F.jsx)("button",{type:"button",className:"min-h-8 shrink-0 rounded-control border border-danger/30 px-2 text-label font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40",onClick:()=>{a.trim()&&d({phase:"checking"}),o(e=>e+1)},children:i("pipelineTemplates.retry")})]}):null]}),(0,F.jsxs)("div",{className:"flex flex-col gap-1",children:[x.map(e=>(0,F.jsxs)("button",{type:"button",disabled:!m,onClick:()=>void h(e),className:"flex min-h-11 w-full flex-col justify-center gap-1 rounded-control px-3 py-2 text-left hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:[(0,F.jsx)("span",{className:"text-body font-semibold text-primary",children:i(e.labelKey)}),(0,F.jsx)("span",{className:"flex flex-wrap items-center gap-1","aria-hidden":!0,children:e.stages.map((e,t)=>(0,F.jsxs)("span",{className:"flex items-center gap-1",children:[t?(0,F.jsx)("span",{className:"text-label font-bold text-strong",children:"→"}):null,(0,F.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-caption font-semibold ${"review-loop"===e.kind?"bg-accent-soft text-accent":"bg-sunken text-secondary"}`,children:["review-loop"===e.kind?"⟳ ":"",e.roleId||i("pipelineTemplates.noRole")]})]},t))})]},e.id)),(0,F.jsxs)("button",{type:"button",disabled:!m,onClick:()=>void h(null),className:"flex min-h-11 w-full flex-col justify-center gap-0.5 rounded-control border border-dashed border-strong px-3 py-2 text-left hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:[(0,F.jsx)("span",{className:"text-body font-semibold text-primary",children:i("pipelineTemplates.blank")}),(0,F.jsx)("span",{className:"text-label text-muted",children:i("pipelineTemplates.blankHint")})]})]})]})})}function hx(e,t,n){let r=(e,r)=>n.some(n=>e<n.x+n.w+16&&e+t.w+16>n.x&&r<n.y+n.h+16&&r+t.h+16>n.y),i=Math.round(e.x),a=Math.round(e.y);if(!r(i,a))return{x:i,y:a};for(let e=1;e<=40;e+=1)for(let t=-e;t<=e;t+=1)for(let n=-e;n<=e;n+=1){if(Math.max(Math.abs(t),Math.abs(n))!==e)continue;let s=i+24*t,l=a+24*n;if(!r(s,l))return{x:s,y:l}}return{x:i+984,y:a+984}}function hg(e){return"unplaced"!==e.placement&&void 0!==e.pos}let hb=Math.max(1,Math.floor(236/13));function hv(e){let t=1,n=0;for(let r of e.match(/\s+|\S+/g)??[]){if(/\s/.test(r)){for(let e of r)n+=" "===e?40:5;for(;n>236;)t++,n-=236;continue}let e=13*r.length;if(e<=236)n>0&&n+e>236?(t++,n=e):n+=e;else{n>0&&t++;let e=Math.ceil(r.length/hb);t+=e-1,n=(r.length-(e-1)*hb)*13}}return t}function hw(e){let t=e.split(/\r\n?|\n/),n=hv(t[0]??""),r=0;for(let e=1;e<t.length;e+=1)r+=hv(t[e]);return{title:n,rest:r}}function hy(e,t=!1){let n=hw(e.text),r=n.title>2||n.rest>3,i=t&&r?n.title+n.rest:Math.min(n.title,2)+Math.min(n.rest,3),a=e.assignments.length+ +!!e.source;return Math.max(64,6+(17*i+20)+(a?28*a+8:0)+32*!!r)}function hk(e,t=!1){return hy(e,t)+36}function hj(e,t=!1){return{x:e.pos.x,y:e.pos.y,w:260,h:hk(e,t)}}function hN(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function hS(e,t){let{x:n,y:r}=hN(e),i=t.x-n,a=t.y-r;if(!i&&!a)return{x:n,y:r};let s=Math.min(i?e.w/2/Math.abs(i):1/0,a?e.h/2/Math.abs(a):1/0,1);return{x:n+i*s,y:r+a*s}}function hC(e,t,n,r,i){let a=1-e;return a*a*a*t+3*a*a*e*n+3*a*e*e*r+e*e*e*i}function hA(e,t,n,r,i,a){let s=i.x-a,l=i.y-a,o=i.x+i.w+a,c=i.y+i.h+a,d=n-e,u=r-t,p=[-d,d,-u,u],m=[e-s,o-e,t-l,c-t],f=0,h=1;for(let e=0;e<4;e++)if(0===p[e]){if(m[e]<0)return!1}else{let t=m[e]/p[e];if(p[e]<0){if(t>h)return!1;t>f&&(f=t)}else{if(t<f)return!1;t<h&&(h=t)}}return f<=h}function hI(e,t,n,r,i,a,s,l,o){if(!o.length)return!1;let c=Math.min(e,n,i,s)-10,d=Math.max(e,n,i,s)+10,u=Math.min(t,r,a,l)-10,p=Math.max(t,r,a,l)+10,m=[];for(let e of o)e.x<=d&&e.x+e.w>=c&&e.y<=p&&e.y+e.h>=u&&m.push(e);if(!m.length)return!1;let f=Math.max(8,Math.min(128,Math.ceil((Math.hypot(n-e,r-t)+Math.hypot(i-n,a-r)+Math.hypot(s-i,l-a))/24))),h=e,x=t;for(let o=1;o<=f;o++){let c=o/f,d=hC(c,e,n,i,s),u=hC(c,t,r,a,l);for(let e of m)if(hA(h,x,d,u,e,10))return!0;h=d,x=u}return!1}let hM=(e,t,n)=>e+(t-e)*n;function hT(e,t,n=0){let{x1:r,y1:i,x2:a,y2:s}=e,l=a-r,o=s-i,c=Math.abs(o)>Math.abs(l),d=(r+a)/2,u=(i+s)/2,p=Math.hypot(l,o)||1,m=-o/p,f=l/p,h=26*n,x=c?{c1x:r+m*h,c1y:u+f*h,c2x:a+m*h,c2y:u+f*h}:{c1x:d+m*h,c1y:i+f*h,c2x:d+m*h,c2y:s+f*h},g=e=>({d:`M ${r} ${i} C ${e.c1x} ${e.c1y}, ${e.c2x} ${e.c2y}, ${a} ${s}`,mid:{x:hC(.5,r,e.c1x,e.c2x,a),y:hC(.5,i,e.c1y,e.c2y,s)},crosses:!1});if(!t.length||!hI(r,i,x.c1x,x.c1y,x.c2x,x.c2y,a,s,t))return g(x);for(let e=40;e<=260;e+=40)for(let n of[1,-1]){let l=e*n,o={c1x:x.c1x+m*l,c1y:x.c1y+f*l,c2x:x.c2x+m*l,c2y:x.c2y+f*l};if(!hI(r,i,o.c1x,o.c1y,o.c2x,o.c2y,a,s,t))return g(o)}let b=function(e,t,n){let{x1:r,y1:i,x2:a,y2:s}=e,l=t.filter(e=>hA(r,i,a,s,e,10));if(!l.length)return null;let o=1/0,c=1/0,d=-1/0,u=-1/0;for(let e of l)o=Math.min(o,e.x),c=Math.min(c,e.y),d=Math.max(d,e.x+e.w),u=Math.max(u,e.y+e.h);let p={x:o,y:c,w:d-o,h:u-c},m=Math.abs(s-i)>=Math.abs(a-r),f=26*n;for(let n of(m?(r+a)/2:(i+s)/2)<=(m?p.x+p.w/2:p.y+p.h/2)?[-1,1]:[1,-1])for(let r=16;r<=256;r+=40){let i=m?function(e,t,n,r,i){let{x1:a,y1:s,x2:l,y2:o}=e,c=n<0?t.x-r-i:t.x+t.w+r+i,d=t.y-r,u=t.y+t.h+r,p=s<=o?d:u,m=s<=o?u:d;return[{x1:a,y1:s,c1x:c,c1y:s,c2x:c,c2y:p,x2:c,y2:p},{x1:c,y1:p,c1x:c,c1y:hM(p,m,1/3),c2x:c,c2y:hM(p,m,2/3),x2:c,y2:m},{x1:c,y1:m,c1x:c,c1y:o,c2x:l,c2y:o,x2:l,y2:o}]}(e,p,n,r,f):function(e,t,n,r,i){let{x1:a,y1:s,x2:l,y2:o}=e,c=n<0?t.y-r-i:t.y+t.h+r+i,d=t.x-r,u=t.x+t.w+r,p=a<=l?d:u,m=a<=l?u:d;return[{x1:a,y1:s,c1x:a,c1y:c,c2x:p,c2y:c,x2:p,y2:c},{x1:p,y1:c,c1x:hM(p,m,1/3),c1y:c,c2x:hM(p,m,2/3),c2y:c,x2:m,y2:c},{x1:m,y1:c,c1x:l,c1y:c,c2x:l,c2y:o,x2:l,y2:o}]}(e,p,n,r,f);if(!function(e,t){for(let n of e)if(hI(n.x1,n.y1,n.c1x,n.c1y,n.c2x,n.c2y,n.x2,n.y2,t))return!0;return!1}(i,t)){let e=i[1],t=m?{axis:"v",pos:e.x1,lo:Math.min(e.y1,e.y2),hi:Math.max(e.y1,e.y2)}:{axis:"h",pos:e.y1,lo:Math.min(e.x1,e.x2),hi:Math.max(e.x1,e.x2)};return{d:function(e){let t=e[0],n=`M ${t.x1} ${t.y1}`;for(let t of e)n+=` C ${t.c1x} ${t.c1y}, ${t.c2x} ${t.c2y}, ${t.x2} ${t.y2}`;return n}(i),mid:function(e){let t=e[Math.floor(e.length/2)];return{x:hC(.5,t.x1,t.c1x,t.c2x,t.x2),y:hC(.5,t.y1,t.c1y,t.c2y,t.y2)}}(i),crosses:!1,corridor:t}}}return null}(e,t,n);return b||{...g(x),crosses:!0}}function h$(e,t){let n=(t,n)=>t>=e.x&&t<=e.x+e.w&&n>=e.y&&n<=e.y+e.h;return n(t.x1,t.y1)||n(t.x2,t.y2)}function hE(e,t,n){let r=[];for(let n of t)n.id===e.taskId||h$(n,e)||r.push({x:n.x,y:n.y,w:n.w,h:n.h});for(let t of n)h$(t,e)||r.push({x:t.x,y:t.y,w:t.w,h:t.h});return r}function hR(e,t,n,r,i,a){return Math.abs((e-n)*a-(t-r)*i)}function hP(e){let t=e.replace(/[MC,]/g," ").trim().split(/\s+/).map(Number),n=[],r=t[0],i=t[1];for(let e=2;e+6<=t.length;e+=6)n.push({x1:r,y1:i,c1x:t[e],c1y:t[e+1],c2x:t[e+2],c2y:t[e+3],x2:t[e+4],y2:t[e+5]}),r=t[e+4],i=t[e+5];return n}function hO(e){return{minX:Math.min(e.x1,e.c1x,e.c2x,e.x2),maxX:Math.max(e.x1,e.c1x,e.c2x,e.x2),minY:Math.min(e.y1,e.c1y,e.c2y,e.y2),maxY:Math.max(e.y1,e.c1y,e.c2y,e.y2)}}function hD(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let e=hO(a);e.minX<t&&(t=e.minX),e.maxX>r&&(r=e.maxX),e.minY<n&&(n=e.minY),e.maxY>i&&(i=e.maxY)}return{minX:t,minY:n,maxX:r,maxY:i}}function hL(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}function hF(e,t){let n=e=>[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}],r=[];for(let i of n(e))for(let e of n(t))Math.round(i.x)===Math.round(e.x)&&Math.round(i.y)===Math.round(e.y)&&r.push(i);return r}function h_(e){let t=(e.x1+e.c1x)/2,n=(e.y1+e.c1y)/2,r=(e.c1x+e.c2x)/2,i=(e.c1y+e.c2y)/2,a=(e.c2x+e.x2)/2,s=(e.c2y+e.y2)/2,l=(t+r)/2,o=(n+i)/2,c=(r+a)/2,d=(i+s)/2,u=(l+c)/2,p=(o+d)/2;return[{x1:e.x1,y1:e.y1,c1x:t,c1y:n,c2x:l,c2y:o,x2:u,y2:p},{x1:u,y1:p,c1x:c,c1y:d,c2x:a,c2y:s,x2:e.x2,y2:e.y2}]}function hq(e){let t=e.x2-e.x1,n=e.y2-e.y1,r=Math.hypot(t,n);if(0===r)return!0;let i=Math.abs((e.c1x-e.x1)*n-(e.c1y-e.y1)*t)/r,a=Math.abs((e.c2x-e.x1)*n-(e.c2y-e.y1)*t)/r;return i<=.1&&a<=.1}function hz(e,t,n){for(let r of e)for(let e of t)if(function e(t,n,r,i){if(!hL(hO(t),hO(n)))return!1;let a=hq(t),s=hq(n);if(a&&s||i<=0){let e=function(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,s=r.x-n.x,l=r.y-n.y,o=i*l-a*s;if(0===o)return null;let c=n.x-e.x,d=n.y-e.y,u=(c*l-d*s)/o,p=(c*a-d*i)/o;return u<0||u>1||p<0||p>1?null:{x:e.x+u*i,y:e.y+u*a}}({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},{x:n.x1,y:n.y1},{x:n.x2,y:n.y2});return!!e&&!r.some(t=>2>=Math.abs(t.x-e.x)&&2>=Math.abs(t.y-e.y))}let l=a?[t]:h_(t),o=s?[n]:h_(n);for(let t of l)for(let n of o)if(e(t,n,r,i-1))return!0;return!1}(r,e,n,26))return!0;return!1}let hH=[1,-1,2,-2,3,-3];function hB(e){let t=new Set,n=new Set;for(let r of(e.srcPath&&t.add(e.srcPath),e.srcConversationId&&n.add(e.srcConversationId),e.runs))for(let e of r.attempts)e.agentPath&&t.add(e.agentPath),e.conversationId&&n.add(e.conversationId);return{paths:t,conversationIds:n}}function hU(e,t,n,r=[],i=[],a=[],s=[],l=new Set,o=new Set,c=[],d=new Set){let u=new Map(n.map(e=>[e.path,e])),p=ew(n),m=[],f=[],h=[],x=[],g=[],b=ez(r),v=eH(r,n),w=r.filter(e=>!te(e)),y=100,k=new Map,j=e=>r.find(t=>t.id===e)?.implementerPath??null;for(let e of a){if("closed"===e.state&&!e.restored)continue;let t="pipe:"+e.id;for(let n of e.runs)for(let e of n.attempts)if(e.agentPath&&k.set(e.agentPath,t),e.flowId){let n=j(e.flowId);n&&k.set(n,t)}}for(let e of w){let t="flow:"+e.id;for(let n of(k.has(e.implementerPath)||k.set(e.implementerPath,t),e.rounds))n.reviewerPath&&!k.has(n.reviewerPath)&&k.set(n.reviewerPath,t)}let N=new Map,S=e=>{let t=N.get(e.path);if(t)return t;let r=new Set,i=k.get(e.path);for(let t of(i&&r.add(i),eC(e,n,()=>!0))){let e=k.get(t.file.path);e&&r.add(e)}return N.set(e.path,r),r},C=(e,t)=>{let n=S(e),r=S(t);if(0===n.size||0===r.size)return!1;if(n.size!==r.size)return!0;for(let e of n)if(!r.has(e))return!0;return!1},A=new Set([...e.flatMap(e=>e.columns.map(e=>e.file.path)),...t.map(e=>e.path)]),I=new Set;for(let e of b.values())A.has(e.implementerPath)&&I.add(e.id);let M=new Map,T=new Map,$=[],E=new Map;{let e=new Set(s.map(e=>e.id)),t=new Set,n=[...s,...a].filter(e=>!("closed"===e.state||t.has(e.id))&&(t.add(e.id),!0)),r=new Set;for(let[t,i]of n.entries()){i.stages.forEach((e,n)=>{let r=c3(i,e.id),a="review-loop"===e.kind&&r?.flowId?j(r.flowId):null;for(let e of[r?.agentPath??null,a])e&&!E.has(e)&&E.set(e,1e4*t+n)});let n=new Set((function(e,t=new Set,n=new Set){return dr.has(e.state)?e.stages.filter(r=>{let i=c3(e,r.id);return i?!dL(e,r,t,n)&&("needs_decision"===e.state&&e.cursor?.stageId===r.id||di.has(i.state)):0===dn(e,r.id).length}):[]})(i,A,I).map(e=>e.id)),a=dr.has(i.state),s=[],l=new Set,o=null;for(let e=0;e<i.stages.length;e+=1){let t=i.stages[e],r=c3(i,t.id),c=r?.agentPath??null;if(c&&A.has(c)){l.add(c),o=c,s.push({kind:"node",index:e,path:c});continue}let d="review-loop"===t.kind&&r?.flowId?j(r.flowId):null;if(d&&A.has(d)){l.add(d),o=d,s.push({kind:"node",index:e,path:d});continue}if(n.has(t.id)){s.push({kind:"slot",index:e,slotStage:{stage:t,index:e,presentation:"placeholder"}});continue}if(!a||t.id===i.cursor?.stageId)continue;let u=dn(i,t.id).findLast(e=>e.agentPath||e.flowId);u&&s.push({kind:"slot",index:e,slotStage:{stage:t,index:e,presentation:"completed",attempt:u}})}if(!e.has(i.id)&&!l.size)continue;let p=s.filter(e=>"slot"===e.kind).length,m=(function(e,t){let n=new Set(e.taskIds??[]),r=hB(e);return t.filter(e=>n.has(e.id)||!!(e.source&&r.paths.has(e.source.path)||e.assignments.some(e=>!!(e.path&&r.paths.has(e.path)||e.conversationId&&r.conversationIds.has(e.conversationId)))))})(i,c).filter(e=>hg(e)&&!r.has(e.id)).map(e=>({task:e,h:hk(e,d.has(e.id))})),f=null;for(let e of s){if("node"!==e.kind)continue;let t=u.get(e.path)?.parent??null;if(t&&A.has(t)){f=t;break}}!f&&!o&&i.srcPath&&A.has(i.srcPath)&&(f=i.srcPath);let h=null!==f&&s.some(e=>"node"===e.kind&&(u.get(e.path)?.parent??null)!==f);if(!p&&!m.length&&!h)continue;for(let{task:e}of m)r.add(e.id);let x={pipeline:i,entries:s,tasks:m,placed:!1};if($.push(x),f){let e=M.get(f);e?e.push(x):M.set(f,[x])}else if(o){let e=T.get(o);e?e.push(x):T.set(o,[x])}}}let R=[],P=[],O=new Map,D=e=>{let t=O.get(e);if(t)return t;let n=[];return O.set(e,n),n},L=(e,t,n,r,i)=>{let{stage:a,index:s,presentation:l,attempt:o}=t,c=null!==i&&e.pipeline.stages[s-1]?.id===i.stage.id,d=dS(e.pipeline,a,l),u=d?96:620,p=i&&dS(e.pipeline,i.stage,i.presentation)?96:620,m={key:dW(e.pipeline.id,a.id),pipeline:e.pipeline,stage:a,index:s,total:e.pipeline.stages.length,presentation:l,...o?{attempt:o}:{},...c?{incoming:a.kind,incomingAnchorY:Math.min(110,Math.round(Math.min(p,u)/2))}:{},...d?{collapsedRow:!0}:{},x:n,y:r,w:600,h:u};R.push(m),D(e.pipeline.id).push(m.key)},F=(e,t,n,r,i)=>{let a={key:"task::"+t.id,taskId:t.id,pipelineId:e.pipeline.id,x:r,y:i,w:260,h:n};P.push(a),D(e.pipeline.id).push(a.key)},_=(e,t,n)=>{e.placed=!0;let r=t,i=null;for(let t of e.entries)"slot"===t.kind&&(L(e,t.slotStage,r,n,i),i=t.slotStage,r+=672);for(let{task:t,h:i}of e.tasks)F(e,t,i,r,n),r+=332;return r-72},q=new Map,z=new Set,H=[],B=new Map;for(let e of i){let t=hi(e);if(!t)continue;let n=B.get(t);n?n.push(e):B.set(t,[e])}let K=new Set,Y=e=>({file:e,branches:p.get(e.path)?.length??0}),W=(e,t,r,i,a,s)=>{let l=(e,s,o,c)=>{let d=0===c?780:680;m.push({file:e.file,tasks:e.tasks,under:i.get(e.file.path)??[],x:s,y:o,w:600,h:d,isRoot:e.file.path===a});let u=b.get(e.file.path),p=d;if(u){var w;let e,t,r=(w=s+600+170,e=u.rounds.flatMap(e=>{let t=eU(u,e,n);return t.length?t.map(t=>({key:`round:${e.n}:${t.conversationId??t.path}`,round:e,file:t})):[{key:`round:${e.n}:${e.reviewerBindingId??"pending"}`,round:e,file:null}]}),t={key:dY(u.id),flow:u,rounds:e,x:w,y:o,w:600,h:d+30*Math.min(Math.max(e.length-1,0),6)},x.push(t),t);g.push({key:"loop::"+u.id,flow:u,x1:s+600,x2:r.x,y:o}),p=Math.max(p,r.h)}let j=t.get(e.file.path)??[],N=k.get(e.file.path)??null,A=o+p+(null!==N&&j.some(e=>{for(let t of S(e.file))if(t!==N)return!0;return!1})?184:130),I=s+64,$=(t,n)=>(f.push({to:t.file.path,sourceConversationId:U(e.file),targetConversationId:U(t.file),x1:s+40,y1:o+d,x2:n+300,y2:A,color:(0,tt.yj)(t.file),live:"live"===t.file.activity}),l(t,n,A,c+1)),E=M.get(e.file.path)??[],R=new Set;for(let e of E)for(let t of e.entries)"node"===t.kind&&R.add(t.path);let P=new Map(j.map(e=>[e.file.path,e]));for(let e of E){e.placed=!0;let t=e.entries[0]?.index??0,n=I,r=I,i=null;for(let a of e.entries){let s=Math.max(n+(a.index-t)*672,r);if("slot"===a.kind)L(e,a.slotStage,s,A,i),i=a.slotStage,r=s+600+72;else{let e=P.get(a.path);if(e){let t=$(e,s);r=s+Math.max(t,600)+72;continue}let t=q.get(a.path);if(!t||z.has(a.path))continue;z.add(a.path);let n=y;y=s,"group"===t.kind?J(t.group,A):V(t.file,A);let i=y-150-s;y=n,r=s+Math.max(i,600)+72}}for(let{task:t,h:n}of e.tasks)F(e,t,n,r,A),r+=332;I=r-72+140}for(let t of T.get(e.file.path)??[])I=_(t,I,A)+140;let O=j.filter(e=>!R.has(e.file.path));for(let e=0;e<O.length;e+=1){let t=O[e],n=O[e+1],r=n&&C(t.file,n.file)?140:48;I+=$(t,I)+r}let D=r.get(e.file.path)?.filter(e=>!v.has(e.path));for(let t of(D?.length&&(h.push({key:e.file.path+"::stack",parent:e.file.path,items:D.map(Y),x:I,y:A,w:360,h:16+58*Math.min(D.length,8)-6}),f.push({to:e.file.path+"::stack",x1:s+40,y1:o+d,x2:I+180,y2:A,color:"var(--color-muted)",live:!1,dashed:!0}),I+=408),B.get(e.file.path)??[]))K.add(t),H.push({key:"draft::"+t,id:t,src:e.file.path,x:I,y:A,w:600,h:680}),f.push({to:"draft::"+t,x1:s+40,y1:o+d,x2:I+300,y2:A,color:"var(--color-accent)",live:!1,dashed:!0}),I+=648;let W=I-48-(s+64);return Math.max(W>0?Math.max(600,64+W):600,u?1370:600)};return l(e,y,s,0)},J=(e,t)=>{let n=e.columns;if(!n.length)return;let r=n[0].file.path,i=new Set(n.map(e=>e.file.path)),a=e=>{let t=e.parent,n=new Set([e.path]);for(;t&&!n.has(t)&&!i.has(t);)n.add(t),t=u.get(t)?.parent??null;return t&&i.has(t)&&t!==e.path?t:r},s=new Map;for(let e of n){if(e.file.path===r)continue;let t=a(e.file),n=s.get(t);n?n.push(e):s.set(t,[e])}let l=new Map,o=[];for(let t of[...e.returnable,...e.finished])if(!v.has(t.path))if(ep(t)){let e=a(t),n=l.get(e);n?n.push(t):l.set(e,[t])}else o.push(t);let c=new Map([[r,o]]);y+=W(n[0],s,l,c,e.key,t)+150},V=(e,t)=>{let r=o.has(e.path)?[]:(function(e,t){if(!e)return[];let n=ef(e);return eC(e,t,e=>ef(e)===n)})(e,n).map(e=>e.file).filter(e=>!v.has(e.path)),i=r.filter(e=>ep(e)),a=r.filter(e=>!ep(e));y+=W({file:e,tasks:[]},new Map,new Map(i.length?[[e.path,i]]:[]),new Map([[e.path,a]]),e.parent?"":e.path,t)+150},G=e=>l.has(U(e)),X=[],Q=[];for(let t of e){let e=t.columns[0]?.file;(e&&G(e)?X:Q).push(t)}let Z=[],ee=[];for(let e of t)(G(e)?Z:ee).push(e);X.sort((e,t)=>t.columns[0].file.mtime-e.columns[0].file.mtime),Z.sort((e,t)=>t.mtime-e.mtime);let et=e=>{if(e.pendingQuestion||e.waitingInput)return 5;let t=k.get(e.path);if(t?.startsWith("pipe:")){let e=a.find(e=>e.id===t.slice(5));if(e?.state==="needs_decision"||e?.state==="paused")return 4}if(t?.startsWith("flow:")){let e=w.find(e=>e.id===t.slice(5));if(e?.state==="needs_decision"||e?.state==="paused")return 4}if("live"===e.activity||"stalled"===e.activity||"running"===e.proc)return 3;if(t?.startsWith("pipe:")){let e=a.find(e=>e.id===t.slice(5));if(e&&"closed"!==e.state)return 1}if(t?.startsWith("flow:")){let e=w.find(e=>e.id===t.slice(5));if(e&&"closed"!==e.state)return 1}return 0},en=e=>Math.max(0,...e.columns.map(e=>et(e.file)));Q.sort((e,t)=>en(t)-en(e)||t.columns[0].file.mtime-e.columns[0].file.mtime||e.key.localeCompare(t.key)),ee.sort((e,t)=>et(t)-et(e)||t.mtime-e.mtime||e.path.localeCompare(t.path));let er=X.length+Z.length>0;{let e=new Map(Q.map(e=>[e.key,e])),t=new Map(ee.map(e=>[e.path,e])),n=new Map;for(let e of[...X,...Q])for(let t of e.columns)n.set(t.file.path,e.key);for(let e of[...Z,...ee])n.set(e.path,e.path);for(let[r,i]of M){let a=n.get(r)??r;for(let n of i)for(let r of n.entries){if("node"!==r.kind||r.path===a||q.has(r.path))continue;let n=e.get(r.path);if(n&&n.key!==a){q.set(r.path,{kind:"group",group:n,hostRootKey:a});continue}let i=t.get(r.path);i&&i.path!==a&&q.set(r.path,{kind:"manual",file:i,hostRootKey:a})}}for(let[e,t]of[...q]){let n=new Set([e]),r=t.hostRootKey;for(;r&&q.has(r);){if(n.has(r)){q.delete(e);break}n.add(r),r=q.get(r)?.hostRootKey}}}for(let e of X)J(e,100);for(let e of Z)V(e,100);let ei=100;if(er){for(let e of m)ei=Math.max(ei,e.y+e.h);for(let e of x)ei=Math.max(ei,e.y+e.h);for(let e of h)ei=Math.max(ei,e.y+e.h);for(let e of H)ei=Math.max(ei,e.y+e.h);for(let e of R)ei=Math.max(ei,e.y+e.h);for(let e of P)ei=Math.max(ei,e.y+e.h)}let ea=er?ei+220:100,es=e=>{let t=0;for(let n of m.slice(e.nodes))t=Math.max(t,n.y+n.h);for(let n of h.slice(e.stacks))t=Math.max(t,n.y+n.h);for(let n of x.slice(e.decks))t=Math.max(t,n.y+n.h);for(let n of H.slice(e.drafts))t=Math.max(t,n.y+n.h);for(let n of R.slice(e.slots))t=Math.max(t,n.y+n.h);for(let n of P.slice(e.regionTasks))t=Math.max(t,n.y+n.h);return t},el=ea,eo=ea,ec=100;y=100;let ed=e=>{let t={nodes:m.length,edges:f.length,stacks:h.length,decks:x.length,loops:g.length,drafts:H.length,slots:R.length,regionTasks:P.length},n=y;for(let t of e)t(el);let r=y;if(n>ec&&r-150>10600){let e=eo+160;var i=100-n,a=e-el;for(let e of m.slice(t.nodes))e.x+=i,e.y+=a;for(let e of f.slice(t.edges))e.x1+=i,e.x2+=i,e.y1+=a,e.y2+=a;for(let e of h.slice(t.stacks))e.x+=i,e.y+=a;for(let e of x.slice(t.decks))e.x+=i,e.y+=a;for(let e of g.slice(t.loops))e.x1+=i,e.x2+=i,e.y+=a;for(let e of H.slice(t.drafts))e.x+=i,e.y+=a;for(let e of R.slice(t.slots))e.x+=i,e.y+=a;for(let e of P.slice(t.regionTasks))e.x+=i,e.y+=a;y=100+(r-n),el=e,ec=100,eo=es(t);return}eo=Math.max(eo,es(t))},eu=e=>{let t=e.flatMap(e=>{let t=E.get(e);return void 0===t?[]:[t]});return t.length?Math.min(...t):null},em=[...Q.filter(e=>!q.has(e.key)).map(e=>({keys:new Set(e.columns.flatMap(e=>[...S(e.file)])),stageRank:eu(e.columns.map(e=>e.file.path)),place:t=>J(e,t)})),...ee.filter(e=>!q.has(e.path)).map(e=>({keys:S(e),stageRank:eu([e.path]),place:t=>V(e,t)}))],eh=[];for(let e of em){let t=[];for(let n of eh)for(let r of e.keys)if(n.keys.has(r)){t.push(n);break}let[n]=t;if(!n){eh.push({keys:new Set(e.keys),items:[e]});continue}for(let t of(n.items.push(e),e.keys))n.keys.add(t);for(let e of t.slice(1)){for(let t of(n.items.push(...e.items),e.keys))n.keys.add(t);eh.splice(eh.indexOf(e),1)}}let ex=e=>{let t=e.filter(e=>null!==e.stageRank).sort((e,t)=>e.stageRank-t.stageRank);if(t.length<2)return[...e];let n=0;return e.map(e=>null===e.stageRank?e:t[n++])};for(let e of eh)ed(ex(e.items).map(e=>e.place));for(let e of i)K.has(e)||ed([t=>{H.push({key:"draft::"+e,id:e,x:y,y:t,w:600,h:780}),y+=750}]);{let e=0;for(let t of[...m,...h,...x,...H,...R,...P])e=Math.max(e,t.y+t.h);let t=100,n=e>0?e+160:ea;for(let e of $)e.placed||(t=_(e,t,n)+150)}let eg=0,eb=0;for(let e of m)eg=Math.max(eg,e.y+e.h),eb=Math.max(eb,e.x+e.w);for(let e of h)eg=Math.max(eg,e.y+e.h),eb=Math.max(eb,e.x+e.w);for(let e of x)eg=Math.max(eg,e.y+e.h),eb=Math.max(eb,e.x+e.w);for(let e of H)eg=Math.max(eg,e.y+e.h),eb=Math.max(eb,e.x+e.w);for(let e of R)eg=Math.max(eg,e.y+e.h),eb=Math.max(eb,e.x+e.w);for(let e of P)eg=Math.max(eg,e.y+e.h),eb=Math.max(eb,e.x+e.w);let ev=dG(m.map(e=>e.file.path),x.map(e=>({key:e.key,flow:e.flow})),h.map(e=>({key:e.key,paths:e.items.map(e=>e.file.path)})));for(let e of R)ev.set(e.key,e.key);let ey=new Map([...m.map(e=>[e.file.path,e]),...H.map(e=>[e.key,e]),...h.map(e=>[e.key,e]),...x.map(e=>[e.key,e]),...R.map(e=>[e.key,e]),...P.map(e=>[e.key,e])]),ek=e=>r.find(t=>t.id===e)?.implementerPath??null,ej=new Set(m.map(e=>e.file.path)),eN=new Map(x.map(e=>[e.flow.implementerPath,e.key])),eS=e=>{let t=[],n=eN.get(e);for(let r of(n&&t.push(n),ey.has(e+"::stack")&&t.push(e+"::stack"),B.get(e)??[]))ey.has("draft::"+r)&&t.push("draft::"+r);return t},eA=(e,t)=>{let n=new Set(e),r=new Set,i=e=>{if(!r.has(e))for(let a of(r.add(e),p.get(e)??[])){let e=k.get(a.path);if(!e||e===t){if(ej.has(a.path))for(let e of(n.add(a.path),eS(a.path)))n.add(e);i(a.path)}}};for(let t of e)if(u.get(t)){for(let e of eS(t))n.add(e);i(t)}return[...n]},eI=e=>e.pipeline?(0,tt.cr)(e.pipeline.task,60):e.flow?(0,tt.cr)(u.get(e.flow.implementerPath)?.title??e.flow.project,60):e.key,eM=function(e,t,n,r=()=>null){let i=[],a=new Set;for(let e of t)if("closed"!==e.state||e.restored)for(let t of e.runs)for(let e of t.attempts)e.flowId&&a.add(e.flowId);for(let e of t){if("closed"===e.state&&!e.restored)continue;let t=new Set;for(let i of e.stages)for(let a of e.runs.find(e=>e.stageId===i.id)?.attempts??[])if("review-loop"===i.kind){if(a.agentPath){let e=n(a.agentPath);e&&t.add(e)}let e=a.flowId?r(a.flowId):null,i=e?n(e):null;if(i&&t.add(i),a.flowId){let e=n(dY(a.flowId));e&&t.add(e)}}else if(a.agentPath){let e=n(a.agentPath);e&&t.add(e)}t.size&&i.push({key:`group::pipeline::${e.id}`,kind:"pipeline",id:e.id,hue:dX(e.id),members:[...t],pipeline:e})}for(let t of ez(e).values()){if(a.has(t.id))continue;let e=new Set,r=n(t.implementerPath);r&&e.add(r);let s=n(dY(t.id));s&&e.add(s),e.size&&i.push({key:`group::flow::${t.id}`,kind:"flow",id:t.id,hue:dX(t.id),members:[...e],flow:t})}return i}(w,a,e=>ev.get(e)??null,ek),eT=new Map(eM.filter(e=>e.pipeline).map(e=>[e.pipeline.id,e])),e$=new Map;for(let e of[...s,...a])e$.has(e.id)||e$.set(e.id,e);for(let[e,t]of O){let n=eT.get(e);if(n){n.members=[...n.members,...t];continue}let r=e$.get(e);if(!r)continue;let i={key:`group::pipeline::${r.id}`,kind:"pipeline",id:r.id,hue:dX(r.id),members:t,pipeline:r};eM.push(i),eT.set(e,i)}let eE=[];for(let e of eM){let t=function(e,t){let n=1/0,r=1/0,i=-1/0,a=-1/0,s=!1;for(let l of e){let e=t(l);e&&(s=!0,n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+e.w),a=Math.max(a,e.y+e.h))}return s?{x:n-46,y:r-46,w:i-n+92,h:a-r+92}:null}("pipeline"===e.kind?eA(e.members,"pipe:"+e.id):e.members,e=>ey.get(e)??null);if(!t)continue;let n={x:t.x,y:t.y-44,w:t.w,h:t.h+44};eE.push({...e,...n,label:eI(e)})}return{nodes:m,edges:f,stacks:h,decks:x,loops:g,groups:eE,links:[...function(e,t){let n=[];for(let r of ez(e).values()){let e=t(r.implementerPath);if(!e)continue;let i=dV(r),a=(i?.reviewerPath?t(i.reviewerPath):null)??t(dY(r.id));a&&a!==e&&n.push({key:"flowlink::"+r.id,kind:"flow",from:e,to:a,leg:eQ(r),flow:{flow:r,round:i?.n??0,phase:dJ(r.state)}})}return n}(w,e=>ev.get(e)??null),...function(e,t,n=()=>null){let r=[];for(let i of e){if("closed"===i.state&&!i.restored)continue;let e=i.stages.length,a=i.cursor?.stageId??i.stages.at(-1)?.id??null,s=dZ(i),l=[],o=[],c=!1,d=e=>{let r=c3(i,e.id);if(r?.agentPath){let e=t(r.agentPath);if(e&&!e.startsWith("deck::"))return e}if("review-loop"===e.kind&&r?.flowId){let e=n(r.flowId),i=e?t(e):null;if(i)return i}return t(dW(i.id,e.id))},u=new Map(i.stages.map((e,t)=>[e.id,t]));for(let e=0;e<i.stages.length;e+=1){let t=i.stages[e],n=d(t);n&&o.push({stageId:t.id,index:e,key:n})}let p=new Map(o.map(e=>[e.stageId,e]));for(let t of i.stages){let n=p.get(t.id);if(n)for(let r of[...t.next?[{toStageId:t.next,edge:"pass"}]:[],...t.onFail?[{toStageId:t.onFail.to,edge:"fail"}]:[]]){let a=p.get(r.toStageId);if(!a)continue;let o=n.key,d=a.key;if(o===d){c=!0;continue}l.push({key:`pipelinelink::${i.id}::${t.id}::${r.toStageId}::${r.edge}`,kind:"pipeline",from:o,to:d,leg:"forward",pipeline:{pipeline:i,fromStageId:t.id,toStageId:r.toStageId,tone:"fail"===r.edge?"amber":d0(i,r.toStageId),index:(u.get(r.toStageId)??0)+1,total:e,hub:!1,paused:"paused"===i.state,edge:r.edge,isNext:"pass"===r.edge&&s&&i.cursor?.stageId===t.id}})}}let m=l.find(e=>e.pipeline.toStageId===a&&"fail"!==e.pipeline.edge)??l.at(-1);if(m){m.pipeline.hub=!0,r.push(...l);continue}if(r.push(...l),l.length||!c)continue;let f=o.find(e=>e.stageId===a)??o.at(-1),h=f?f.key:null;f&&h&&r.push({key:`pipelinehub::${i.id}`,kind:"pipeline",from:h,to:h,leg:null,pipeline:{pipeline:i,fromStageId:f.stageId,toStageId:f.stageId,tone:d0(i,a??f.stageId),index:f.index+1,total:e,hub:!0,paused:"paused"===i.state,anchorOnly:!0}})}return r}(a,e=>ev.get(e)??null,ek)],drafts:H,slots:R,regionTasks:P,byPath:ey,width:Math.max(eb+100,800),height:eg+100+140}}function hK(e){if("running"===e.proc)return!0;let t=e.spawn?.state;return"starting"===t||"binding"===t||"queued"===t}function hY(e,t){let n;if(e.path.startsWith("spawn:")||e.spawn?.state==="failed")return"dead";if("done"===e.proc||"killed"===e.proc||e.supersededBy)return"closed";let r=hK(e),i="terminal"===(n=e.authoritativeTurn?.state)||"idle"===n||"jsonl_turn_completed"===e.activityReason;if(!r&&i)return"closed";let a=!Number.isFinite(t)||t<=0?null:Math.max(0,t-e.mtime);return null===a||a<300?r?"running":"live":i?"closed":hK(e)||e.authoritativeTurn?.state==="busy"?"silent":"closed"}function hW(e){return"running"===e||"live"===e?0:"silent"===e?1:"closed"===e?2:3}function hJ(e){let t=e.durableLineage?.memberships.find(e=>"pipeline"===e.kind&&e.stageId);return t?.stageId&&e.spawn?{pipelineId:t.containerId,stageId:t.stageId,launchId:e.spawn.launchId}:null}async function hV(e,t){let n=hJ(e);return n?t(n.pipelineId,"retry-stage",{stageId:n.stageId,launchId:n.launchId}):"launch is not owned by a pipeline stage"}function hG({open:e,onToggle:t,label:n,count:r,icon:i,ariaLabel:a,mobile:s}){return(0,F.jsxs)("button",{className:`flex w-full items-center gap-2 px-4 text-label font-semibold text-secondary text-secondary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${s?"min-h-11":"h-8"}`,"aria-expanded":e,"aria-label":a,onClick:t,children:[(0,F.jsx)(i9.c_,{className:`h-3.5 w-3.5 shrink-0 text-muted transition-transform ${e?"rotate-90":""}`,"aria-hidden":!0}),i,(0,F.jsx)("span",{className:"truncate",children:n}),null!=r?(0,F.jsxs)("span",{className:"text-caption font-normal tabular-nums text-muted",children:["\xb7 ",r]}):null]})}function hX({items:e,onRetry:t}){let{t:n}=(0,er.Ym)(),r=rq(),[i,a]=(0,B.useState)(!1);return e.length?(0,F.jsxs)("div",{className:"shrink-0 border-t border-border bg-canvas","data-testid":"launch-history",children:[(0,F.jsx)(hG,{open:i,onToggle:()=>a(e=>!e),label:n("launchHistory.title"),count:e.length,icon:(0,F.jsx)(uA.A,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0}),ariaLabel:n("launchHistory.aria"),mobile:r}),i?(0,F.jsx)("ul",{className:"flex max-h-52 flex-col gap-0.5 overflow-y-auto px-3 pb-2.5",children:e.map(e=>{let i=(0,tt.yz)(e),a=e.spawn,s="failed"===a.state;return(0,F.jsxs)("li",{className:`flex min-w-0 items-center gap-1.5 rounded-[8px] px-2 text-[11px] text-primary ${r?"min-h-11":"h-7"}`,children:[(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:i.style,children:i.label}),(0,F.jsx)("span",{className:"min-w-0 shrink truncate font-semibold",title:(0,ei.cr)(e.title),children:(0,ei.cr)(e.title,60)}),(0,F.jsx)("span",{className:`shrink-0 rounded-full px-1.5 text-[10px] font-semibold ${s?"bg-danger-soft text-danger":"bg-success-soft text-success"}`,children:n(s?"launchHistory.failed":"launchHistory.recovered")}),s&&a.error?(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-danger",title:a.error,children:a.error}):(0,F.jsx)("span",{className:"min-w-0 flex-1","aria-hidden":!0}),(0,F.jsx)("span",{className:"shrink-0 font-normal text-muted",children:(0,tt.rK)(e.mtime)}),s&&a.retrySafe?(0,F.jsxs)("button",{type:"button","aria-label":n("launchHistory.retry",{title:(0,ei.cr)(e.title,40)}),title:n("launchHistory.retry",{title:(0,ei.cr)(e.title,40)}),className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"min-h-9":"h-5"}`,onClick:()=>t(e),children:[(0,F.jsx)(ae.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("launchHistory.retryLabel")]}):null]},e.path)})}):null]}):null}function hQ(e){try{let t=JSON.parse(window.localStorage.getItem("llvTaskExpand:"+e)??"[]");return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}var hZ=n(2550);function h0(e,t){return"failed"===e.state?"failed":"spawning"!==e.state||e.path?t?t.migration?"migrating":"killed"===t.proc?"killed":"running"===t.proc||"live"===t.activity||"recent"===t.activity?"live":"unhosted":"gone":"spawning"}function h1(e){return"live"===e||"killed"===e||"unhosted"===e}let h2=["now","review","blocked","planned","done"],h5={now:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},review:{color:"var(--color-info)",soft:"var(--color-info-soft)"},blocked:{color:"var(--color-danger)",soft:"var(--color-danger-soft)"},planned:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"},done:{color:"var(--color-success)",soft:"var(--color-success-soft)"}},h3=(e,t)=>t[e]??e;function h4(e,t){let n=new Set,r=new Set,i=t=>{if(t){for(let r of t.pipelines)r.project===e.project&&"paused"!==r.state&&n.add(r);for(let n of t.flows)n.project===e.project&&"paused"!==n.state&&r.add(n)}};for(let n of e.assignments)n.conversationId&&i(t.byConversationId.get(h3(n.conversationId,t.aliases))),n.path&&i(t.byPath.get(n.path));return{pipelines:[...n],flows:[...r]}}function h6(e){return e.cursor?.state==="reviewing"||"completed"===e.state||function(e){let t;for(let n of e.stages){let r=c3(e,n.id);r&&(t=r)}return t?.verdict?.status==="pass"}(e)}let h8=new Set(["reviewing","relay_pending","relaying","fixing","approved","done_comment"]);function h7(e){return h8.has(e.state)||e.rounds.at(-1)?.verdict==="APPROVE"}function h9({task:e,index:t,byPath:n,repository:r,onOpenTask:i,onPlaceOnMap:a,onOpenFile:s}){let{t:l}=(0,er.Ym)(),o=rq(),c=(0,tt.cr)(fM(e.text),60)||l("tasks.untitled"),d="unplaced"===e.placement||!e.pos,u=fA[e.status],p=function(e,t){let n=!1,r=!1;for(let i of e.assignments){let e=h0(i,i.path?t.get(i.path)??null:null);if("failed"===e)return"failed";"gone"===e&&(n=!0),"live"===e&&(r=!0)}return r?"live":n?"gone":null}(e,n),m=function(e){let t=new Set;for(let n of e.matchAll(/(?<![\w/])#(\d{1,6})\b/g))t.add(Number(n[1]));return[...t].sort((e,t)=>e-t)}(e.text),f=h4(e,t),h=f.pipelines.map(e=>(function(e){if(e.cursor){var t,n;let r=c3(e,e.cursor.stageId);if(r&&("pending"!==e.cursor.state||(t=r.activatedBy,n=e.cursor.activatedBy,null===t||null===n?t===n:t.stageId===n.stageId&&t.attempt===n.attempt&&t.edge===n.edge)))return r}let r=new Map,i=[];for(let t of e.runs)for(let e of t.attempts)e.historical||(r.set(`${t.stageId}:${e.n}`,e),i.push({stageId:t.stageId,attempt:e}));let a=null;for(let e of i){let t=function(e){for(let t of[e.startedAt,e.completedAt]){let e=t?Date.parse(t):NaN;if(Number.isFinite(e))return e}return null}(e.attempt),n=function(e,t,n){let r=new Set([`${t}:${n.n}`]),i=0,a=n.activatedBy;for(;a;){let t=`${a.stageId}:${a.attempt}`;if(r.has(t))break;r.add(t);let n=e.get(t);if(!n)break;i+=1,a=n.activatedBy}return i}(r,e.stageId,e.attempt);(!a||null!==t&&(null===a.timestamp||t>a.timestamp)||t===a.timestamp&&n>a.depth)&&(a={attempt:e.attempt,timestamp:t,depth:n})}return a?.attempt??null})(e)).map(e=>e?.agentPath?n.get(e.agentPath):void 0).filter(e=>void 0!==e).at(-1),x=f.flows.flatMap(e=>[e.implementerPath,...e.rounds.map(e=>e.reviewerPath)]).map(e=>e?n.get(e):void 0).filter(e=>void 0!==e).at(-1),g=e.assignments.map(e=>e.path?n.get(e.path)??null:null).find((t,n)=>{let r=e.assignments[n];return null!==t&&h1(h0(r,t))}),b=o?"min-h-11 px-2":"h-6 px-1.5",v=`inline-flex items-center rounded-full bg-card text-[10px] font-semibold text-secondary hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${b}`;return(0,F.jsxs)("div",{"data-flip-key":e.id,className:"flex min-w-0 max-w-full flex-wrap items-center gap-1 rounded-[10px] border border-transparent px-1 py-0.5",style:{backgroundColor:u.soft},children:[(0,F.jsx)("button",{className:`inline-flex min-w-0 max-w-[300px] items-center gap-1.5 rounded-full text-[11px] font-semibold text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${b}`,title:l(d&&a?"readiness.place":"readiness.open",{title:c}),"aria-label":l(d&&a?"readiness.place":"readiness.open",{title:c}),onClick:()=>d&&a?a(e):i(e),children:(0,F.jsx)("span",{className:"truncate",children:c})}),(0,F.jsx)("span",{className:"shrink-0 rounded-full bg-card px-1.5 text-[9px] font-bold",style:{color:u.color},children:l(`tasks.status.${e.status}`)}),p?(0,F.jsxs)("span",{className:`shrink-0 rounded-full bg-card px-1.5 text-[9px] font-bold ${"failed"===p?"text-danger":"live"===p?"text-success":"text-muted"}`,title:l(`readiness.state.${p}`),children:["failed"===p?"⚠ ":"",l(`readiness.state.${p}`)]}):null,m.map(e=>r?(0,F.jsxs)("a",{className:v,href:`https://github.com/${r}/issues/${e}`,target:"_blank",rel:"noreferrer","aria-label":l("readiness.issueAria",{issue:e}),children:["#",e]},e):(0,F.jsxs)("span",{className:`inline-flex items-center rounded-full bg-card text-[10px] font-semibold text-secondary ${b}`,children:["#",e]},e)),g?(0,F.jsx)("button",{className:v,"aria-label":l("readiness.agentAria",{title:c}),onClick:()=>s(g),children:l("readiness.agent")}):null,h?(0,F.jsx)("button",{className:v,"aria-label":l("readiness.pipelineAria",{title:c}),onClick:()=>s(h),children:l("readiness.pipeline")}):null,x&&x!==g?(0,F.jsx)("button",{className:v,"aria-label":l("readiness.reviewAria",{title:c}),onClick:()=>s(x),children:l("readiness.review")}):null]})}function xe({section:e,index:t,byPath:n,repository:r,onOpenTask:i,onPlaceOnMap:a,onOpenFile:s}){let{t:l}=(0,er.Ym)(),o=rq(),[c,d]=(0,B.useState)(!1),u=h5[e.readiness],p=l(`readiness.section.${e.readiness}`);return(0,F.jsxs)("div",{className:"min-w-0","data-readiness-section":e.readiness,children:[(0,F.jsxs)("button",{className:`flex w-full items-center gap-2 rounded-[8px] px-2 text-left text-[11px] font-semibold text-primary hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${o?"min-h-11":"h-7"}`,"aria-expanded":c,"aria-label":l("readiness.sectionAria",{section:p,count:e.items.length}),onClick:()=>d(e=>!e),children:[(0,F.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:u.color},"aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate",children:p}),(0,F.jsx)("span",{className:"shrink-0 text-[10px] font-normal tabular-nums text-muted",children:e.items.length})]}),c&&e.items.length?(0,F.jsx)(u$,{className:"mt-1 flex min-w-0 flex-wrap items-start gap-1.5 pb-1 pl-5",children:e.items.map(e=>(0,F.jsx)(h9,{task:e,index:t,byPath:n,repository:r,onOpenTask:i,onPlaceOnMap:a,onOpenFile:s},e.id))}):null]})}function xt({tasks:e,files:t,pipelines:n,flows:r,conversationAliases:i,repository:a,onOpenTask:s,onPlaceOnMap:l,onOpenFile:o}){let{t:c}=(0,er.Ym)(),d=rq(),[u,p]=(0,B.useState)(!1),m=(0,B.useMemo)(()=>(function(e,t,n={}){let r=new Map,i=new Map,a=(e,t)=>{let n=e.get(t);if(n)return n;let r={pipelines:[],flows:[]};return e.set(t,r),r},s=(e,t)=>{e&&t(a(r,h3(e,n)))},l=(e,t)=>{e&&t(a(i,e))};for(let t of e){let e=e=>{e.pipelines.includes(t)||e.pipelines.push(t)};for(let n of t.runs)for(let t of n.attempts)s(t.conversationId,e),l(t.agentPath,e)}for(let e of t){let t=t=>{t.flows.includes(e)||t.flows.push(e)};for(let n of(s(e.implementerConversationId,t),l(e.implementerPath,t),e.rounds))s(n.reviewerConversationId,t),l(n.reviewerPath,t)}return{byConversationId:r,byPath:i,aliases:n}})(n,r,i),[n,r,i]),f=(0,B.useMemo)(()=>(function(e,t){let n=new Map(h2.map(e=>[e,[]]));for(let r of e)n.get(function(e,t){if("done"===e.status)return"done";let n=h4(e,t);return"blocked"===e.status||e.assignments.some(e=>"failed"===e.state)||n.pipelines.some(e=>"needs_decision"===e.state)||n.flows.some(e=>"needs_decision"===e.state)?"blocked":n.pipelines.some(h6)||n.flows.some(h7)?"review":"assigned"===e.status?"now":"planned"}(r,t)).push(r);return h2.map(e=>{let t=n.get(e);return t.sort((e,t)=>e.updatedAt<t.updatedAt?1:e.updatedAt>t.updatedAt||e.id<t.id?-1:1),{readiness:e,items:t}})})(e,m),[e,m]),h=(0,B.useMemo)(()=>new Map(t.map(e=>[e.path,e])),[t]);return e.length?(0,F.jsxs)("div",{className:"shrink-0 border-t border-border bg-canvas","data-testid":"task-readiness",children:[(0,F.jsx)(hG,{open:u,onToggle:()=>p(e=>!e),label:c("readiness.title"),count:e.length,icon:(0,F.jsx)(hZ.A,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0}),ariaLabel:c("readiness.aria"),mobile:d}),u?(0,F.jsxs)("div",{className:`flex flex-col gap-0.5 overflow-y-auto px-3 pb-2.5 ${d?"max-h-96":"max-h-64"}`,children:[(0,F.jsx)("p",{role:"note",className:"px-2 pb-1 text-[10px] leading-snug text-muted",children:c("readiness.legend")}),f.map(e=>(0,F.jsx)(xe,{section:e,index:m,byPath:h,repository:a,onOpenTask:s,onPlaceOnMap:l,onOpenFile:o},e.readiness))]}):null]}):null}function xn({stack:e,label:t,flows:n,reviewGroup:r,onSelect:i,onExpandGroup:a}){let{t:s}=(0,er.Ym)(),l=rq(),[o,c]=(0,B.useState)(!1),d=r?.rounds[r.rounds.length-1]??null,u=d?e0(d.verdict):null;return(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsxs)("div",{className:"flex w-full items-center gap-1",children:[(0,F.jsxs)("button",{className:`flex min-w-0 flex-1 items-center gap-2 rounded-[8px] px-2 text-left text-[11px] font-semibold text-primary hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"min-h-11":"h-7"}`,"aria-expanded":o,onClick:()=>c(e=>!e),children:[(0,F.jsx)(i9.c_,{className:`h-3.5 w-3.5 shrink-0 text-muted transition-transform ${o?"rotate-90":""}`,"aria-hidden":!0}),(0,F.jsx)(i9.zg,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t}),d&&u?(0,F.jsx)("span",{className:"inline-flex h-4 shrink-0 items-center gap-1 rounded-full px-1.5 text-[9.5px] font-bold",style:{backgroundColor:u.soft,color:u.color},children:d.verdict?`${eZ[d.verdict]} ${d.verdict}`:s("roundDeck.aborted")}):null,(0,F.jsx)("span",{className:"shrink-0 text-[10px] font-normal tabular-nums text-muted",children:e.items.length})]}),r&&a?(0,F.jsx)("button",{type:"button","data-review-group-expand":!0,className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-card text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"min-h-11 min-w-11":"h-7 w-7"}`,"aria-label":s("workerStack.expandGroup"),title:s("workerStack.expandGroup"),onClick:()=>a(r),children:(0,F.jsx)(i9.zg,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}),o?(0,F.jsx)(u$,{className:"mt-1 flex flex-wrap items-start gap-1.5 pb-1 pl-5",children:e.items.map(e=>{let t=(0,tt.yz)(e),r=function(e,t){for(let n of t){let t=n.rounds.find(t=>t.reviewerPath===e.path);if(t)return t.verdict?eZ[t.verdict]:null}return null}(e,n);return(0,F.jsxs)("button",{"data-flip-key":e.path,className:`inline-flex max-w-[340px] items-center gap-1.5 rounded-full border border-transparent bg-sunken text-[11px] font-semibold text-primary hover:border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"min-h-11 px-3":"h-7 px-2"}`,title:(0,ei.cr)(e.title),onClick:()=>i(e),children:[(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:t.style,children:t.label}),r?(0,F.jsx)("span",{className:"shrink-0 text-[10px] text-muted","aria-hidden":!0,children:r}):null,(0,F.jsx)("span",{className:"truncate",children:(0,ei.cr)(e.title,60)}),(0,F.jsx)("span",{className:"shrink-0 font-normal text-muted",children:(0,tt.rK)(e.mtime)})]},e.path)})}):null]})}function xr({stacks:e,files:t,flows:n,pipelines:r=[],onSelect:i,onExpandGroup:a}){let{t:s}=(0,er.Ym)(),l=rq(),[o,c]=(0,B.useState)(!1),d=(0,B.useMemo)(()=>e.reduce((e,t)=>e+t.items.length,0),[e]),u=(0,B.useMemo)(()=>new Map(t.map(e=>[e.path,e.title])),[t]),p=(0,B.useMemo)(()=>e.filter(e=>"pipeline"===e.kind).map(e=>e.id).join(" "),[e]);return e.length?(0,F.jsxs)("div",{className:"shrink-0 border-t border-border bg-canvas","data-testid":"worker-stacks","data-worker-stack-pipeline-ids":p,children:[(0,F.jsx)(hG,{open:o,onToggle:()=>c(e=>!e),label:s("workerStack.title"),count:d,ariaLabel:s("workerStack.aria"),mobile:l}),o?(0,F.jsx)("div",{className:"flex max-h-52 flex-col gap-0.5 overflow-y-auto px-3 pb-2.5",children:e.map(e=>(0,F.jsx)(xn,{stack:e,label:(e=>{if("flow"===e.kind){let t=n.find(t=>t.id===e.id),r=t?u.get(t.implementerPath):void 0;return(0,ei.cr)(r??s("workerStack.flow"),60)}if("pipeline"===e.kind){let t=r.find(t=>t.id===e.id);return(0,ei.cr)(t?.task??s("workerStack.pipeline"),60)}return"origin"===e.kind?(0,ei.cr)(u.get(e.id)??s("workerStack.origin"),60):e.id?(0,ei.cr)(e.id,60):s("workerStack.worktree")})(e),flows:n,reviewGroup:(e=>{if("flow"!==e.kind)return null;let t=n.find(t=>t.id===e.id);return t&&te(t)&&hp(t)?t:null})(e),onSelect:i,onExpandGroup:a},e.key))}):null]}):null}function xi(e){return e.open?(0,F.jsx)(xa,{...e}):null}function xa({onClose:e,total:t,leading:n,children:r}){let{t:i}=(0,er.Ym)(),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null;a.current?.focus();let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=t,e?.isConnected&&e.focus()}},[]),(0,B.useEffect)(()=>{let t=t=>{if("Escape"===t.key)return void e();if("Tab"!==t.key)return;let n=a.current;if(!n)return;let r=[...n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled"));if(!r.length){t.preventDefault(),n.focus();return}let i=r[0],s=r[r.length-1],l=document.activeElement,o=l instanceof HTMLElement&&n.contains(l);t.shiftKey?o&&l!==i&&l!==n||(t.preventDefault(),s.focus()):o&&l!==s||(t.preventDefault(),i.focus())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),(0,F.jsx)("div",{className:"fixed inset-0 z-[60] flex flex-col justify-end bg-black/40",role:"presentation",onClick:t=>{t.target===t.currentTarget&&e()},children:(0,F.jsxs)("div",{ref:a,"data-testid":"mobile-bottom-shelf",role:"dialog","aria-modal":"true","aria-label":i("dash.hiddenShelf"),tabIndex:-1,className:"max-h-[80dvh] overflow-y-auto rounded-t-[16px] border-t border-border bg-card pb-[max(0.5rem,env(safe-area-inset-bottom))] shadow-2 focus-visible:outline-none",children:[(0,F.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-card px-4 py-2",children:[(0,F.jsx)(i9.zg,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}),(0,F.jsxs)("span",{className:"min-w-0 flex-1 truncate text-ui font-bold text-primary",children:[i("dash.hiddenShelf"),t>0?(0,F.jsx)("span",{className:"ml-1 tabular-nums text-muted",children:t}):null]}),(0,F.jsx)("button",{type:"button","aria-label":i("common.close"),onClick:e,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(i9.X,{className:"h-5 w-5","aria-hidden":!0})})]}),n?(0,F.jsx)("div",{className:"border-b border-border px-2 py-1.5",children:n}):null,t>0?(0,F.jsx)("div",{children:r}):null]})})}let xs=(e,t)=>`llvWfDraft:${e}:${t}`;function xl(e,t){return sessionStorage.getItem(xs(e,t))??""}function xo(e,t,n){n?sessionStorage.setItem(xs(e,t),n):sessionStorage.removeItem(xs(e,t))}function xc(e){for(let t of["template","dir","task","mode"])sessionStorage.removeItem(xs(e,t))}function xd({draftId:e,project:t,onClose:n,onLaunched:r}){let{t:i}=(0,er.Ym)(),[a,s]=(0,B.useState)([]),[l,o]=(0,B.useState)(()=>xl(e,"template")),[c,d]=(0,B.useState)(()=>xl(e,"dir")),[u,p]=(0,B.useState)(()=>xl(e,"task")),[m,f]=(0,B.useState)(()=>"manual"===xl(e,"mode")),[h,x]=(0,B.useState)([]),[g,b]=(0,B.useState)(!1),[v,w]=(0,B.useState)(null);(0,B.useEffect)(()=>{let n=!1;return fetch("/api/workflows").then(e=>e.json()).then(t=>{!n&&Array.isArray(t.templates)&&(s(t.templates),o(n=>{let r=n&&t.templates.some(e=>e.name===n)?n:t.templates[0]?.name??"";return r!==n&&xo(e,"template",r),r}))}).catch(()=>{}),fetch("/api/spawn?project="+encodeURIComponent(t)).then(e=>e.json()).then(t=>{!n&&Array.isArray(t.dirs)&&(x(t.dirs),d(n=>{let r=n||t.dirs?.[0]||"";return r!==n&&xo(e,"dir",r),r}))}).catch(()=>{}),()=>{n=!0}},[t,e]);let y=a.find(e=>e.name===l)??null,k=async()=>{if(!g){if(!c.trim())return void w(i("wfDraft.needDir"));if(!u.trim())return void w(i("wfDraft.needTask"));b(!0),w(null);try{let e=await fetch("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({template:l,task:u.trim(),repoDir:c.trim(),mode:m?"manual":"auto"})}),t=await e.json();if(!e.ok||!t.ok)return void w(t.error??i("wfDraft.launchFailed"));window.dispatchEvent(new Event(ng)),r()}catch{w(i("common.serverUnavailable"))}finally{b(!1)}}},j="wf-draft-dirs-"+e;return(0,F.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-border bg-card shadow-1","aria-label":i("wfDraft.paneAria"),children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0 bg-accent"}),(0,F.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border bg-accent-soft px-2.5",children:[(0,F.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-strong",title:i("wfDraft.notStarted")}),(0,F.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-accent",children:i("wfStrip.workflow")}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-muted",children:i("wfDraft.newWorkflow")}),(0,F.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-border bg-canvas px-1.5 py-0.5 text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":i("wfDraft.dismiss"),onClick:n,children:(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,F.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-border bg-sunken px-2.5 py-2",children:[(0,F.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-muted",children:i("wfDraft.template")}),(0,F.jsx)("select",{value:l,disabled:g,onChange:t=>{var n;o(n=t.target.value),xo(e,"template",n)},"aria-label":i("wfDraft.templateAria"),className:"min-w-0 flex-1 rounded-[6px] border border-border bg-card px-2 py-1 text-[11.5px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:a.map(e=>(0,F.jsx)("option",{value:e.name,children:e.name},e.name))})]}),(0,F.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-muted",children:i("wfDraft.repo")}),(0,F.jsx)("input",{value:c,disabled:g,onChange:t=>{var n;d(n=t.target.value),xo(e,"dir",n)},list:j,placeholder:"/home/…/Projects/…","aria-label":i("wfDraft.repoAria"),className:"min-w-0 flex-1 rounded-[6px] border border-border bg-card px-2 py-1 font-mono text-[11px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,F.jsx)("datalist",{id:j,children:h.map(e=>(0,F.jsx)("option",{value:e},e))})]}),(0,F.jsxs)("label",{className:"flex items-center gap-1.5 text-[10.5px] font-semibold text-muted",children:[(0,F.jsx)("input",{type:"checkbox",checked:m,disabled:g,onChange:t=>{var n;f(n=t.target.checked),xo(e,"mode",n?"manual":"")},className:"accent-accent"}),i("wfDraft.manualMode")]})]}),(0,F.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-4 py-3",children:[y?(0,F.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","aria-label":i("wfStrip.stagesAria"),children:[y.stages.map((e,t)=>(0,F.jsxs)("span",{className:"flex items-center gap-1.5",children:[t>0?(0,F.jsx)("span",{className:"text-[10px] font-bold text-strong","aria-hidden":!0,children:"→"}):null,(0,F.jsx)("span",{className:"inline-flex h-6 max-w-[200px] items-center truncate rounded-full bg-sunken px-2 text-[10.5px] font-bold text-secondary",children:"review-loop"===e.kind?`${i("wfStrip.reviewStage")} \xb7 ${e.reviewer.engine}${e.reviewer.model?" "+e.reviewer.model:""}${e.reviewer.effort?" "+e.reviewer.effort:""}`:`${e.scope.split(/[.:\n]/)[0]} \xb7 ${e.agent.engine}${e.agent.model?" "+e.agent.model:""}${e.agent.effort?" "+e.agent.effort:""}`})]},t)),(0,F.jsxs)("span",{className:"inline-flex h-6 items-center rounded-full bg-sunken px-2 text-[10.5px] font-bold text-secondary",children:["→ ","merge"===y.finish?i("wfDraft.finishMerge"):"PR"]})]}):(0,F.jsx)("div",{className:"text-[12px] text-muted",children:i("wfDraft.hint")}),(0,F.jsx)("textarea",{value:u,disabled:g,onChange:t=>{var n;p(n=t.target.value),xo(e,"task",n)},placeholder:i("wfDraft.taskPlaceholder"),"aria-label":i("wfDraft.taskAria"),className:"min-h-[160px] flex-1 resize-none rounded-[8px] border border-border bg-card px-2.5 py-2 text-[12.5px] leading-snug text-primary placeholder:text-muted/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}),(0,F.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-t border-border bg-sunken px-2.5 py-2",children:[v?(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-danger",title:v,children:v}):(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-muted",children:i("wfDraft.footerHint")}),(0,F.jsxs)("button",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-full border border-accent bg-accent px-3.5 py-1.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:g,onClick:()=>void k(),children:[g?(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,g?i("wfDraft.launching"):i("wfDraft.launch")]})]})]})}var xu=n(7033);let xp=new Set(["png","jpg","gif","webp"]);function xm(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&e.id.length>0&&"string"==typeof e.sha256&&/^[0-9a-f]{64}$/.test(e.sha256)&&"string"==typeof e.ext&&xp.has(e.ext)&&"string"==typeof e.mime&&null!==(0,ar.PG)(e.mime)&&"number"==typeof e.bytes&&Number.isFinite(e.bytes)&&e.bytes>0&&"string"==typeof e.createdAt}function xf(e,t){let[n]=(0,B.useState)(()=>(function(e){try{let t=window.localStorage.getItem("llvTaskDraft:"+e);if(t){let e=JSON.parse(t);if(e&&1===e.v&&"string"==typeof e.text)return{text:e.text,dueAt:"string"==typeof e.dueAt?e.dueAt:void 0,dueTz:"string"==typeof e.dueTz?e.dueTz:void 0,attachments:Array.isArray(e.attachments)?e.attachments.filter(xm):[]}}let n=window.sessionStorage.getItem("llvTaskSheetDraft:"+e);if(n)return window.sessionStorage.removeItem("llvTaskSheetDraft:"+e),{text:n,attachments:[]}}catch{}return{text:"",attachments:[]}})(e)),r=(0,B.useRef)(na()),[i,a]=(0,B.useState)(n.dueAt),[s,l]=(0,B.useState)(n.dueTz),[o,c]=(0,B.useState)(n.attachments),d=(0,B.useRef)({dueAt:n.dueAt,dueTz:n.dueTz,attachments:n.attachments}),u=t=>{try{let{dueAt:n,dueTz:r,attachments:i}=d.current;if(!t&&!n&&0===i.length)return void window.localStorage.removeItem("llvTaskDraft:"+e);let a={v:1,project:e,text:t,dueAt:n,dueTz:r,attachments:i,updatedAt:new Date().toISOString()};window.localStorage.setItem("llvTaskDraft:"+e,JSON.stringify(a))}catch{}},p=aI({initialText:()=>n.text,persistText:u,submit:t}),m=async e=>{let t=[];for(let n of e){if(null===(0,ar.PG)(n.type)){p.setStatus({kind:"err",text:(0,er.Tl)((0,er.JK)(),"img.unsupported",{name:n.name||n.type||(0,er.Tl)((0,er.JK)(),"img.unknownFile")})});continue}if(n.size>ar.YP){p.setStatus({kind:"err",text:(0,er.Tl)((0,er.JK)(),"img.tooLarge",{name:n.name||(0,er.Tl)((0,er.JK)(),"img.image")})});continue}t.push(n)}for(let e of t){let t=await no(e);if("error"in t){p.setStatus({kind:"err",text:t.error});continue}let n=t.attachment;d.current={...d.current,attachments:[...d.current.attachments,n]},c(d.current.attachments),u(p.textRef.current)}},f=()=>{r.current=na(),d.current={dueAt:void 0,dueTz:void 0,attachments:[]},a(void 0),l(void 0),c([]),p.setText(""),p.attachments.clear();try{window.localStorage.removeItem("llvTaskDraft:"+e)}catch{}};return{composer:p,dueAt:i,dueTz:s,setDue:e=>{d.current={...d.current,dueAt:e.dueAt,dueTz:e.dueTz},a(e.dueAt),l(e.dueTz),u(p.textRef.current)},clearDue:()=>{d.current={...d.current,dueAt:void 0,dueTz:void 0},a(void 0),l(void 0),u(p.textRef.current)},attachments:o,addFiles:m,removeAttachment:e=>{d.current={...d.current,attachments:d.current.attachments.filter(t=>t.id!==e)},c(d.current.attachments),u(p.textRef.current)},stagedAttachments:()=>d.current.attachments,getRequestId:()=>r.current,reset:f,discard:()=>{f(),p.setStatus({kind:"ok",text:(0,er.Tl)((0,er.JK)(),"tasks.draftDiscarded")})}}}function xh(e,t=Date.now()){let n=Date.parse(e);return Number.isFinite(n)&&n<t}function xx(e,t,n="en"){let r=new Date(e);if(Number.isNaN(r.getTime()))return"";let i={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};try{return new Intl.DateTimeFormat(n,{...i,timeZone:t}).format(r)}catch{return new Intl.DateTimeFormat(n,i).format(r)}}var xg=n(7618);function xb({draft:e}){let{t}=(0,er.Ym)(),n=rq(),{dueAt:r,dueTz:i,setDue:a,clearDue:s}=e,l=!!r&&xh(r);return(0,F.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,F.jsxs)("label",{className:`inline-flex items-center gap-1 rounded-full font-semibold ${n?"min-h-11 px-3 text-[12px]":"px-1.5 py-1 text-[9.5px]"} ${r?l?"bg-danger-soft text-danger":"bg-sunken text-secondary":"bg-sunken text-secondary hover:text-accent"}`,title:r&&i?t("tasks.dueTitle",{zone:i}):t("tasks.addDue"),children:[(0,F.jsx)(xg.A,{className:n?"h-4 w-4":"h-3 w-3","aria-hidden":!0}),r&&i?xx(r,i,(0,er.JK)()):t("tasks.addDue"),(0,F.jsx)("input",{type:"datetime-local","aria-label":t("tasks.addDue"),value:r?function(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let n=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}(r):"",onChange:e=>{let t,n=Number.isFinite(t=Date.parse(e.target.value))?{dueAt:new Date(t).toISOString(),dueTz:Intl.DateTimeFormat().resolvedOptions().timeZone}:null;n?a(n):s()},className:"w-0 opacity-0"})]}),r?(0,F.jsx)("button",{type:"button","aria-label":t("tasks.clearDue"),onClick:s,className:`inline-flex items-center justify-center rounded-full text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"h-11 w-11":"h-4 w-4"}`,children:(0,F.jsx)(H.A,{className:n?"h-4 w-4":"h-2.5 w-2.5","aria-hidden":!0})}):null]})}function xv({draft:e}){let{t}=(0,er.Ym)(),n=rq();return e.attachments.length?n?(0,F.jsx)("div",{className:"flex flex-col gap-1.5",children:e.attachments.map((n,r)=>(0,F.jsxs)("div",{className:"flex items-center gap-2 rounded-[8px] border border-border bg-card p-1.5",children:[(0,F.jsx)("img",{src:nl(n),alt:t("img.previewAlt",{n:r+1}),className:"h-11 w-11 shrink-0 rounded border border-border object-cover"}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-muted",children:t("img.previewAlt",{n:r+1})}),(0,F.jsx)("button",{type:"button",onClick:()=>e.removeAttachment(n.id),"aria-label":t("img.removeAria",{n:r+1}),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(H.A,{className:"h-4 w-4","aria-hidden":!0})})]},n.id))}):(0,F.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:e.attachments.map((n,r)=>(0,F.jsxs)("div",{className:"group/att relative",children:[(0,F.jsx)("img",{src:nl(n),alt:t("img.previewAlt",{n:r+1}),className:"h-10 w-10 rounded border border-border object-cover"}),(0,F.jsx)("button",{type:"button",onClick:()=>e.removeAttachment(n.id),"aria-label":t("img.removeAria",{n:r+1}),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full border border-border bg-card text-muted shadow-1 hover:text-danger group-hover/att:flex focus-visible:flex focus-visible:outline-none",children:(0,F.jsx)(H.A,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},n.id))}):null}function xw({draft:e,placeholder:t,createLabel:n,leftSlot:r}){let{t:i}=(0,er.Ym)();return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(a9,{composer:e.composer,placeholder:t,textareaAriaLabel:i("tasks.editAria"),imageAriaLabel:i("composer.addImages"),sendLabelIdle:n,sendLabelRecording:i("composer.stopAndSend"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",onImageFiles:t=>void e.addFiles(t),leftSlot:(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[(0,F.jsx)(xb,{draft:e}),r]})}),(0,F.jsx)(xv,{draft:e})]})}function xy({rows:e,scopeAll:t,onOpen:n,onToggle:r}){let{t:i}=(0,er.Ym)();return(0,F.jsxs)("section",{className:"mb-1 flex flex-col gap-0.5","aria-label":i("favorites.sectionTitle"),children:[(0,F.jsxs)("div",{className:"flex items-center gap-1 px-1 pb-0.5 text-label font-semibold text-secondary",children:[(0,F.jsx)(z.A,{className:"h-3 w-3 fill-crown text-crown","aria-hidden":!0}),i("favorites.sectionTitle"),e.length?(0,F.jsxs)("span",{className:"text-caption font-normal tabular-nums text-muted",children:["\xb7 ",e.length]}):null]}),e.length?e.map(({id:e,file:a,project:s})=>(0,F.jsxs)("div",{className:"flex items-center gap-1 rounded-control border border-border bg-card px-2 py-1.5 hover:border-accent/40",children:[(0,F.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:i("favorites.focusTitle",{title:(0,tt.cr)(a.title,60)}),onClick:()=>n(a),children:[(0,F.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tt.tz)(a.activity)}`,"aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold",children:(0,tt.cr)(a.title,90)||i("tasks.untitled")}),t?(0,F.jsx)("span",{className:"max-w-[90px] shrink-0 truncate text-caption text-muted",children:es(s,a.projectName)}):null]}),(0,F.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-control text-crown hover:bg-crown-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":i("branch.unfavorite"),title:i("branch.unfavorite"),onClick:()=>r(e),children:(0,F.jsx)(z.A,{className:"h-3.5 w-3.5 fill-crown","aria-hidden":!0})})]},e)):(0,F.jsx)("div",{className:"px-2 py-1.5 text-caption text-muted",children:i("favorites.empty")})]})}function xk(e,t){return("done"===e.status)-("done"===t.status)||t.updatedAt.localeCompare(e.updatedAt)}function xj({project:e,onDone:t}){let{t:n}=(0,er.Ym)(),r=(0,B.useRef)(()=>{}),i=xf(e,e=>r.current(e)),{composer:a}=i,s=async r=>{let s=(r??a.textRef.current).trim();if(!a.busy&&!a.voiceSending){if(!s)return void a.setStatus({kind:"err",text:n("tasks.composerNeedsText")});a.setBusy(!0),a.setStatus(null);try{let n=await ns({project:e,text:s,placement:"unplaced",dueAt:i.dueAt,dueTz:i.dueTz,attachments:i.stagedAttachments(),clientRequestId:i.getRequestId()});if("error"in n)return void a.setStatus({kind:"err",text:n.error});i.reset(),t()}finally{a.setBusy(!1)}}};return(0,B.useEffect)(()=>{r.current=s}),(0,F.jsxs)("form",{onSubmit:e=>{e.preventDefault(),i.composer.submit()},className:"flex flex-col gap-1.5 rounded-[10px] border border-border bg-card p-1.5",children:[(0,F.jsx)(xw,{draft:i,placeholder:n("tasks.newPlaceholder"),createLabel:n("tasks.panelCreate")}),(0,F.jsx)("button",{type:"button",className:"self-end text-[10px] font-semibold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:t,children:n("common.close")})]})}function xN({tasks:e,project:t,favorites:n,onOpenFavorite:r,onToggleFavorite:i,onOpenTask:a,onPlaceOnMap:s,onClose:l}){let{t:o}=(0,er.Ym)(),[c,d]=(0,B.useState)("project"),[u,p]=(0,B.useState)(!1),m=(0,B.useMemo)(()=>("project"===c?e.filter(e=>e.project===t):[...e]).sort(xk),[e,t,c]),f=(0,B.useMemo)(()=>"project"===c?n.filter(e=>e.project===t):n,[n,t,c]);return(0,F.jsxs)("aside",{className:"flex w-[280px] shrink-0 flex-col border-l border-border bg-card","aria-label":o("tasks.panelTitle"),children:[(0,F.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1.5 border-b border-border px-2.5",children:[(0,F.jsx)("span",{className:"text-[12px] font-bold",children:o("tasks.panelTitle")}),(0,F.jsx)("div",{className:"ml-1 flex items-center rounded-full border border-border p-0.5",children:["project","all"].map(e=>(0,F.jsx)("button",{type:"button","aria-pressed":c===e,className:`rounded-full px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c===e?"bg-accent/10 text-accent":"text-muted hover:text-primary"}`,onClick:()=>d(e),children:"project"===e?o("tasks.panelThisProject"):o("tasks.panelAll")},e))}),(0,F.jsx)("button",{type:"button",className:"ml-auto inline-flex shrink-0 items-center rounded-[8px] border border-border bg-canvas px-1.5 py-0.5 text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":o("tasks.panelClose"),onClick:l,children:(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,F.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5",children:[(0,F.jsx)(xy,{rows:f,scopeAll:"all"===c,onOpen:r,onToggle:i}),u?(0,F.jsx)(xj,{project:t,onDone:()=>p(!1)}):(0,F.jsxs)("button",{type:"button",className:"mb-0.5 flex h-8 shrink-0 items-center justify-center gap-1 rounded-[8px] border border-dashed border-accent/50 text-[11.5px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>p(!0),children:["+ ",o("tasks.newTask")]}),m.length?m.map(e=>{let t=fA[e.status],n="unplaced"===e.placement||!e.pos,r=!!e.dueAt&&xh(e.dueAt);return(0,F.jsxs)("div",{className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] border border-border bg-card px-2 py-1.5 hover:border-accent/40 ${"done"===e.status?"opacity-60":""}`,children:[(0,F.jsxs)("button",{type:"button",className:"flex min-w-0 flex-col gap-0.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:e.text,onClick:()=>a(e),children:[(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:t.soft,color:t.color},children:o(`tasks.status.${e.status}`)}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:fM(e.text)||o("tasks.untitled")})]}),(0,F.jsxs)("span",{className:"flex flex-wrap items-center gap-2 pl-0.5 text-[10px] text-muted",children:["all"===c?(0,F.jsx)("span",{className:"min-w-0 max-w-[110px] truncate",children:e.project}):null,e.dueAt&&e.dueTz?(0,F.jsxs)("span",{className:r?"font-semibold text-danger":"",title:o("tasks.dueTitle",{zone:e.dueTz}),children:["⏰ ",xx(e.dueAt,e.dueTz,(0,er.JK)())]}):null,e.attachments?.length?(0,F.jsxs)("span",{title:o("tasks.attachCount",{count:e.attachments.length}),children:["\uD83D\uDCCE ",e.attachments.length]}):null,e.source?(0,F.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-info",title:`${o("tasks.sourceTitle")}: ${e.source.text}`,children:[(0,F.jsx)(i9.vv,{className:"h-2.5 w-2.5","aria-hidden":!0}),o("tasks.source")]}):null,e.assignments.length?(0,F.jsxs)("span",{children:["⤷ ",e.assignments.length]}):null,(0,F.jsx)("span",{children:(0,tt.rK)(new Date(e.updatedAt).getTime()/1e3)})]})]}),n?(0,F.jsxs)("div",{className:"flex items-center gap-1.5 pl-0.5",children:[(0,F.jsx)("span",{className:"rounded-full bg-sunken px-1.5 py-0.5 text-[9px] font-bold text-warning",children:o("tasks.unplaced")}),s?(0,F.jsxs)("button",{type:"button",className:"inline-flex items-center gap-0.5 rounded-[6px] border border-border px-1.5 py-0.5 text-[9.5px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>s(e),children:[(0,F.jsx)(xu.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",o("tasks.placeOnMap")]}):null]}):null]},e.id)}):(0,F.jsx)("div",{className:"px-2 py-3 text-center text-[11px] text-muted",children:o("tasks.panelEmpty")})]})]})}var xS=n(6035),xC=n(5738),xA=n(8780);function xI({files:e,project:t,checked:n,onChange:r,maxHeight:i=240}){let{t:a}=(0,er.Ym)(),s=(0,B.useMemo)(()=>e.filter(e=>ef(e)===t&&(ed(e)||ep(e))).sort((e,t)=>t.mtime-e.mtime),[e,t]),l=(0,B.useMemo)(()=>ew(e),[e]),o=(0,B.useMemo)(()=>new Set(s.map(e=>e.path)),[s]);return s.length?(0,F.jsx)("div",{className:"flex flex-col gap-0.5 overflow-y-auto",style:{maxHeight:i},children:s.map(e=>{let t=(0,tt.yz)(e),i=ey(e,l).filter(e=>o.has(e.path)).length;return(0,F.jsxs)("div",{className:"flex items-center gap-1",children:[(0,F.jsxs)("label",{className:"flex min-h-11 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-[6px] px-1.5 hover:bg-canvas",children:[(0,F.jsx)("input",{type:"checkbox",checked:n.has(e.path),onChange:()=>{var t;let i;return t=e.path,void((i=new Set(n)).has(t)?i.delete(t):i.add(t),r(i))},className:"h-5 w-5 accent-accent"}),(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:t.style,children:t.label}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",title:(0,tt.cr)(e.title),children:(0,tt.cr)(e.title,46)})]}),i?(0,F.jsxs)("button",{type:"button",className:"inline-flex h-11 min-w-11 shrink-0 items-center justify-center gap-0.5 rounded-[6px] px-1.5 text-[10px] font-semibold text-muted hover:bg-canvas hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a("tasks.pickerAllChildren"),onClick:()=>(e=>{let t=new Set(n);for(let n of(t.add(e.path),ey(e,l)))o.has(n.path)&&t.add(n.path);r(t)})(e),children:[(0,F.jsx)(cD.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",i]}):null]},e.path)})}):(0,F.jsx)("div",{className:"px-1.5 py-2 text-[11px] text-muted",children:a("tasks.pickerEmpty")})}function xM({value:e,onPick:t}){let{t:n}=(0,er.Ym)();return(0,F.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:fI.map(r=>{let i=fA[r],a=r===e;return(0,F.jsx)("button",{type:"button","aria-pressed":a,className:"inline-flex min-h-11 items-center rounded-full border px-3 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:a?{backgroundColor:i.soft,color:i.color,borderColor:i.color}:{borderColor:"transparent",color:"var(--color-muted)"},onClick:()=>t(r),children:n(`tasks.status.${r}`)},r)})})}function xT({project:e,files:t,onCreated:n}){let{t:r}=(0,er.Ym)(),[i,a]=(0,B.useState)(()=>new Set),s=(0,B.useRef)(()=>{}),l=xf(e,e=>s.current(e)),{composer:o}=l,c=async a=>{let s=(a??o.textRef.current).trim();if(!o.busy&&!o.voiceSending){if(!s)return void o.setStatus({kind:"err",text:r("tasks.composerNeedsText")});o.setBusy(!0),o.setStatus(null);try{let r=await ns({project:e,text:s,placement:"unplaced",dueAt:l.dueAt,dueTz:l.dueTz,attachments:l.stagedAttachments(),clientRequestId:l.getRequestId()});if("error"in r)return void o.setStatus({kind:"err",text:r.error});let a=[...i];if(a.length){let e=await nh(r.task.id,a);if("error"in e)s3("err",e.error);else{let n=s4(e,t);s3(n.kind,n.text)}}l.reset(),n(r.task)}finally{o.setBusy(!1)}}};return(0,B.useEffect)(()=>{s.current=c}),(0,F.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.composer.submit()},className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,F.jsx)("div",{className:"flex flex-col gap-1.5",children:(0,F.jsx)(xw,{draft:l,placeholder:r("tasks.newPlaceholder"),createLabel:r("tasks.sheetCreate"),leftSlot:(0,F.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-sunken px-1.5 py-1 text-[9.5px] font-semibold text-secondary",children:r("tasks.sheetTargets",{count:i.size})})})}),(0,F.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-border bg-card p-1.5",children:[(0,F.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-muted",children:r("tasks.pickerTitle")}),(0,F.jsx)(xI,{files:t,project:e,checked:i,onChange:a,maxHeight:9999})]})]})}function x$({task:e,files:t,onDeleted:n}){let{t:r}=(0,er.Ym)(),[i,a]=(0,B.useState)(e.text),[s,l]=(0,B.useState)(()=>new Set),[o,c]=(0,B.useState)(!1),[d,u]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!d)return;let e=window.setTimeout(()=>u(!1),4e3);return()=>window.clearTimeout(e)},[d]);let p=(0,B.useRef)(null),m=aC({onError:e=>s3("err",e),onUnclaimedText:e=>a(t=>t?t.trimEnd()+" "+e:e),onLiveCommit:e=>a(t=>t?t.trimEnd()+" "+e:e)}),f=m.liveText?(i?i.trimEnd()+" ":"")+m.liveText:i;ab(p,f,{maxPx:260,minPx:84,pinned:!!m.liveText});let h=async()=>{if(i===e.text)return null;if(!i.trim())return r("tasks.emptyTextBlocked");let t=await nu(e.id,{text:i});return t&&s3("err",t),t},x=async()=>{let n=[...s];if(n.length&&!o){if(!i.trim())return void s3("err",r("tasks.emptyTextBlocked"));c(!0);try{if(await h()!==null)return;let r=await nh(e.id,n);if("error"in r)s3("err",r.error);else{let e=s4(r,t);s3(e.kind,e.text),l(new Set)}}finally{c(!1)}}},g=new Map(t.map(e=>[e.path,e]));return(0,F.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,F.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-border bg-card p-2",children:[(0,F.jsx)("textarea",{ref:p,value:f,readOnly:!!m.liveText,onChange:e=>a(e.target.value),onBlur:()=>void h(),rows:4,"aria-label":r("tasks.editAria"),maxLength:6e3,className:"w-full resize-none overflow-y-auto rounded-[8px] border border-border bg-card px-2.5 py-1.5 text-[12.5px] leading-[18px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,F.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,F.jsx)(xM,{value:e.status,onPick:t=>{t!==e.status&&nu(e.id,{status:t}).then(e=>{e&&s3("err",e)})}}),(0,F.jsx)(a6,{...m,onText:e=>a(t=>t?t.trimEnd()+" "+e:e)})]})]}),e.assignments.length?(0,F.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-border bg-card p-2",children:[(0,F.jsx)("div",{className:"text-[10.5px] font-bold text-muted",children:r("tasks.sheetAssignments")}),e.assignments.map((n,a)=>{let s=n.path?g.get(n.path)??null:null,l="failed"===n.state,o=s?(0,tt.yz)(s):null,c=n.path?s?(0,tt.cr)(s.title,44):n.path.split("/").pop()??n.path:l?r("tasks.failedChip"):r("tasks.spawning");return(0,F.jsxs)("div",{className:`flex min-h-11 items-center gap-1.5 rounded-[6px] px-1.5 ${l?"bg-danger-soft text-danger":s?"bg-canvas":"bg-canvas opacity-60"}`,title:l?r("tasks.chipFailedTitle",{error:n.error??""}):void 0,children:[s?(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(s.activity)}`}):null,o?(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:o.style,children:o.label}):null,(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",children:c}),l?(0,F.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,n.path&&(l||!s)||l&&n.launchId?(0,F.jsx)("button",{type:"button","data-task-sheet-retry":!0,className:"inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded px-2 text-[11px] font-bold text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{(async()=>{if(!i.trim())return s3("err",r("tasks.emptyTextBlocked"));if(await h()!==null)return;let a=n.launchId;if(l&&!n.path&&a){let t=await nx(e.id,a);"task"in t?s3("ok",r("tasks.retryLaunched")):s3("err",t.error);return}let s=await nh(e.id,[n.path]);if("error"in s)s3("err",s.error);else{let e=s4(s,t);s3(e.kind,e.text)}})()},children:l&&!n.path?r("tasks.retryLaunch"):r("tasks.retry")}):null]},(n.path??"spawning")+a)})]}):null,(0,F.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-border bg-card p-1.5",children:[(0,F.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-muted",children:r("tasks.pickerTitle")}),(0,F.jsx)(xI,{files:t,project:e.project,checked:s,onChange:l,maxHeight:9999}),(0,F.jsxs)("button",{type:"button",disabled:!s.size||o,className:"mt-1 inline-flex min-h-11 items-center justify-center gap-1.5 rounded-[8px] border border-accent bg-accent text-[12px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>void x(),children:[o?(0,F.jsx)(up.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,F.jsx)(m_.A,{className:"h-4 w-4","aria-hidden":!0}),r("tasks.pickerSend",{count:s.size})]})]}),(0,F.jsxs)("button",{type:"button",className:`inline-flex min-h-11 items-center justify-center gap-1.5 rounded-[8px] border text-[12px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${d?"border-danger bg-danger text-white":"border-border bg-card text-muted hover:border-danger/40 hover:text-danger"}`,onClick:()=>{d?np(e.id).then(e=>{e?s3("err",e):n()}):u(!0)},children:[(0,F.jsx)(xC.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),d?r("tasks.deleteConfirm"):r("tasks.delete")]})]})}function xE({project:e,projectName:t,tasks:n,files:r,initialView:i,onClose:a}){let{t:s}=(0,er.Ym)(),[l,o]=(0,B.useState)(i),c=(0,B.useMemo)(()=>[...n].sort((e,t)=>("done"===e.status)-("done"===t.status)||t.updatedAt.localeCompare(e.updatedAt)),[n]),d="object"==typeof l?n.find(e=>e.id===l.taskId)??null:null;return(0,F.jsxs)("div",{className:"fixed inset-0 z-[60] flex flex-col bg-canvas pb-[env(safe-area-inset-bottom)]",children:[(0,F.jsxs)("div",{className:"flex min-h-[52px] shrink-0 items-center gap-2 border-b border-border bg-card px-2 py-1.5",children:["list"!==l?(0,F.jsx)("button",{type:"button",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("tasks.sheetBack"),onClick:()=>o("list"),children:(0,F.jsx)(xA.A,{className:"h-5 w-5","aria-hidden":!0})}):null,(0,F.jsx)("span",{className:"shrink-0 pl-1 text-[13px] font-bold",children:"new"===l?s("tasks.sheetNew"):d?fM(d.text)||s("tasks.untitled"):s("tasks.panelTitle")}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-muted",title:t??e,children:es(e,t)}),(0,F.jsx)("button",{type:"button",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("common.close"),onClick:a,children:(0,F.jsx)(i9.X,{className:"h-5 w-5","aria-hidden":!0})})]}),"list"===l?(0,F.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:[(0,F.jsxs)("button",{type:"button",className:"flex min-h-11 shrink-0 items-center justify-center gap-1 rounded-[10px] border border-dashed border-accent/50 text-[13px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o("new"),children:["+ ",s("tasks.sheetNew")]}),c.map(e=>{let t=fA[e.status];return(0,F.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[10px] border border-border bg-card px-2.5 py-2 text-left shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===e.status?"opacity-60":""}`,onClick:()=>o({taskId:e.id}),children:[(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:t.soft,color:t.color},children:s(`tasks.status.${e.status}`)}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",children:fM(e.text)||s("tasks.untitled")})]}),(0,F.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10.5px] text-muted",children:[e.assignments.length?(0,F.jsxs)("span",{children:["⤷ ",e.assignments.length]}):null,(0,F.jsx)("span",{children:(0,tt.rK)(new Date(e.updatedAt).getTime()/1e3)})]})]},e.id)}),c.length?null:(0,F.jsx)("div",{className:"px-2 py-4 text-center text-[11.5px] text-muted",children:s("tasks.sheetEmpty")})]}):"new"===l?(0,F.jsx)(xT,{project:e,files:r,onCreated:e=>o({taskId:e.id})}):d?(0,F.jsx)(x$,{task:d,files:r,onDeleted:()=>o("list")},d.id):(0,F.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] text-muted",children:s("tasks.sheetGone")})]})}function xR(e,t){let n=new Map,r=new Set;for(let t of e)r.add(t.path),t.conversationId&&n.set(t.conversationId,t.path);let i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of t){if("done"===e.status)continue;let t=new Set;for(let i of e.assignments){let s=(i.conversationId?n.get(i.conversationId):void 0)??(i.path&&r.has(i.path)?i.path:void 0);!s||t.has(s)||(t.add(s),a(s,{task:e,relation:"assignment"}))}e.source&&r.has(e.source.path)&&!t.has(e.source.path)&&a(e.source.path,{task:e,relation:"source"})}for(let e of i.values())e.sort((e,t)=>e.relation===t.relation?0:"assignment"===e.relation?-1:1);return i}var xP=n(3665),xO=n(715);function xD({verdict:e,error:t,className:n="h-3 w-3"}){return"APPROVE"===e?(0,F.jsx)(m1.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===e?(0,F.jsx)(H.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===e?(0,F.jsx)(xP.A,{className:n,strokeWidth:2.5,"aria-hidden":!0}):t?(0,F.jsx)(_.A,{className:n,"aria-hidden":!0}):(0,F.jsx)(xO.A,{className:n,"aria-hidden":!0})}function xL(e,t){return t.error?e("roundDeck.roundAborted",{n:t.n}):t.verdict?e("roundDeck.roundVerdict",{n:t.n,verdict:`${eZ[t.verdict]} ${t.verdict}`}):e("roundDeck.roundInProgress",{n:t.n})}function xF({round:e,depth:t,pulse:n,onPull:r}){let{t:i}=(0,er.Ym)(),a=e0(e.verdict);return(0,F.jsxs)("button",{className:`deck-tab absolute inset-x-0 flex items-center gap-1.5 rounded-[9px] border bg-card px-2.5 text-left shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"deck-tab-live border-success/50":"border-border hover:border-accent/45"}`,style:{height:36,bottom:-(30*t)-10,zIndex:10-t,transform:`scale(${1-.035*t}) translateZ(${-(34*t)}px)`,transitionDelay:`${.03*t}s`},title:e.error?`${xL(i,e)}: ${e.error}`:xL(i,e),onClick:r,children:[(0,F.jsxs)("span",{className:"inline-flex h-4 shrink-0 items-center gap-1 rounded-full px-1.5 text-[9.5px] font-bold",style:{backgroundColor:a.soft,color:a.color},children:["R",e.n," ",(0,F.jsx)(xD,{verdict:e.verdict,error:!!e.error,className:"h-2.5 w-2.5"})]}),(0,F.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-muted",children:[e.error?i("roundDeck.aborted"):e.verdict?e.verdict:i("roundDeck.reviewInProgress"),null!=e.findingsCount&&e.findingsCount>0?` \xb7 ${i("roundDeck.findings",{count:e.findingsCount})}`:""]}),n?(0,F.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-success","aria-hidden":!0}):null]})}function x_({flow:e,rounds:t,focusRound:n,dormant:r=!1,groupLabel:i}){let{t:a}=(0,er.Ym)(),s=t.length?t[t.length-1]:null,l=hp(e),o=hm(e),[c,d]=(0,B.useState)(null);(0,B.useEffect)(()=>{d(function(e,t){let n=e.getItem(hu(t));if(null===n)return null;if("1"===n)return{v:"collapsed",at:null};try{let e=JSON.parse(n);if("expanded"!==e.v&&"collapsed"!==e.v)return null;return{v:e.v,at:"string"==typeof e.at?e.at:null}}catch{return null}}(window.localStorage,e.id))},[e.id]);let u=c&&(null===c.at||c.at===o)?"collapsed"===c.v:l,p=t=>{let n=t?"collapsed":"expanded";d({v:n,at:o}),hf(window.localStorage,e.id,n,o)},[m,f]=(0,B.useState)(u),[h,x]=(0,B.useState)(null);(0,B.useEffect)(()=>{if(u===m)return;if("function"!=typeof window.matchMedia||window.matchMedia("(prefers-reduced-motion: reduce)").matches){f(u),x(null);return}if(u){x("collapsing");let e=window.setTimeout(()=>{f(!0),x(null)},320);return()=>window.clearTimeout(e)}f(!1),x("expanding");let e=window.setTimeout(()=>x(null),380);return()=>window.clearTimeout(e)},[u,m]);let[g,b]=(0,B.useState)(null),[v,w]=(0,B.useState)(null);if(null!=n&&n!==v){w(n);let e=t.findLast(e=>e.round.n===Math.round(n));b(e?.key??null)}let[y,k]=(0,B.useState)(null);s&&s.key!==y&&(k(s.key),null!=g&&null===s.round.verdict&&b(null));let j=(0,B.useMemo)(()=>t.find(e=>e.key===g)??s,[t,g,s]);if(!j)return(0,F.jsx)("div",{className:"flex h-full items-center justify-center rounded-[10px] border border-dashed border-strong bg-card/60",children:(0,F.jsx)("span",{className:"text-[12px] font-semibold text-muted",children:a("roundDeck.waitingFirst")})});let N=t.filter(e=>e.key!==j.key).reverse(),S=N.slice(0,5),C=N.length-S.length,A=e0(j.round.verdict),I=null!==j.round.verdict||!!j.round.error,M=s&&j.key!==s.key&&null===s.round.verdict&&!s.round.error?s:null,T=i?a("roundDeck.groupAriaNamed",{name:i,count:t.length}):a("roundDeck.groupAria",{count:t.length}),$=(0,F.jsx)("button",{type:"button","data-review-deck-collapse":!0,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":a("roundDeck.collapseStack",{count:t.length}),"aria-expanded":"true",title:a("roundDeck.collapseStack",{count:t.length}),onClick:()=>p(!0),children:(0,F.jsx)(i9.O0,{className:"h-3.5 w-3.5","aria-hidden":!0})});if(m){let n=s?.round??j.round,r=e0(n.verdict),i=(0,tt.zZ)(e.roles.reviewer?.engine??"claude"),l=n.terminalAt??n.reviewedAt??n.startedAt,o=l?Date.parse(l):NaN;return(0,F.jsxs)("button",{type:"button","data-review-deck-collapsed":!0,className:"deck-chip-in flex h-12 w-full items-center gap-2 rounded-[10px] border border-border bg-card px-3 text-left shadow-1 hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":a("roundDeck.expandStack",{count:t.length}),"aria-expanded":"false",title:a("roundDeck.expandStack",{count:t.length}),onClick:()=>p(!1),children:[(0,F.jsx)("span",{className:"inline-flex h-6 shrink-0 items-center rounded-full px-2 text-[10px] font-bold",style:{backgroundColor:r.soft,color:r.color},children:a("roundDeck.roundsCount",{count:t.length})}),(0,F.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-muted",children:[n.error?a("roundDeck.aborted"):n.verdict?`${eZ[n.verdict]} ${n.verdict}`:a("roundDeck.reviewInProgress"),null!=n.findingsCount&&n.findingsCount>0?` \xb7 ${a("roundDeck.findings",{count:n.findingsCount})}`:""]}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:i.style,children:i.label}),Number.isFinite(o)?(0,F.jsx)("span",{className:"shrink-0 text-[10px] font-normal tabular-nums text-muted",children:(0,tt.rK)(o/1e3)}):null,(0,F.jsx)(i9.yQ,{className:"h-4 w-4 shrink-0 text-accent","aria-hidden":!0})]})}return(0,F.jsxs)("div",{role:"group","aria-label":T,className:`deck-3d relative h-full ${"collapsing"===h?"deck-collapsing":"expanding"===h?"deck-expanding":""}`,style:{paddingBottom:30*Math.min(N.length,5+ +!!C)},children:[(0,F.jsx)("div",{className:"scheme-enter deck-front relative z-[11] flex h-full flex-col",children:j.file?(0,F.jsx)(fF,{file:j.file,tasks:[],isRoot:!1,dormant:r,noComposer:"headless"===e.reviewerMode||I,headerActions:$,banner:(0,F.jsxs)("div",{className:"flex h-6 shrink-0 items-center gap-1.5 border-b border-border px-2.5 text-[10.5px] font-bold",style:{backgroundColor:A.soft,color:A.color},children:[xL(a,j.round),null!=j.round.findingsCount&&j.round.findingsCount>0?(0,F.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",a("roundDeck.findings",{count:j.round.findingsCount})]}):null,j.round.readyNote?(0,F.jsxs)("span",{className:"min-w-0 flex-1 truncate font-semibold opacity-70",title:j.round.readyNote,children:["\xb7 ",j.round.readyNote]}):null]})}):(0,F.jsxs)("div",{className:"relative flex h-full flex-col items-center justify-center gap-1 rounded-[10px] border border-border bg-card shadow-1",children:[(0,F.jsx)("div",{className:"absolute right-1.5 top-1.5",children:$}),(0,F.jsx)("span",{className:"text-[12px] font-semibold text-muted",children:xL(a,j.round)}),(0,F.jsx)("span",{className:"text-[11px] text-muted",children:j.round.error?j.round.error:a("roundDeck.spawningReviewer")})]})},j.key),S.map((e,t)=>(0,F.jsx)(xF,{round:e.round,depth:t,pulse:M?.key===e.key,onPull:()=>b(e.key)},e.key)),C>0?(0,F.jsx)("div",{className:"pointer-events-none absolute inset-x-6 flex items-center justify-center rounded-[9px] border border-border bg-card/70 text-[10px] font-semibold text-muted shadow-1",style:{height:26,bottom:-(30*S.length)-8,zIndex:10-S.length},"aria-hidden":!0,children:a("roundDeck.moreRounds",{count:C})}):null]})}var xq=n(2749);function xz({pipeline:e,stage:t,attempt:n,flows:r=[],files:i=[],availablePaths:a,mobile:s=!1,canOpenFlow:l=!0,canOpenPath:o=!0,onClose:c,onOpenPath:d,onOpenFlow:u}){let{t:p}=(0,er.Ym)(),[m,f]=(0,B.useState)(!1),[h,x]=(0,B.useState)(!1),[g,b]=(0,B.useState)(null),v=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null;return v.current?.focus(),()=>e?.focus()},[]);let w=dy(p,t),y=n.verdict,k="needs_decision"===e.state&&e.cursor?.stageId===t.id,j=dn(e,t.id).filter(e=>e.n!==n.n),N=new Set(dn(e,t.id).flatMap(e=>e.flowId?[e.flowId]:[])),S=new Set(dn(e,t.id).flatMap(e=>e.agentPath?[e.agentPath]:[])),C=new Set,A=r.filter(e=>N.has(e.id)).flatMap(e=>e.rounds.flatMap(t=>eK(e,t,i).flatMap(({path:e})=>S.has(e)||C.has(e)?[]:(C.add(e),[{n:t.n,path:e}])))),I=e=>!a||a.has(e),M=s?"min-h-11 min-w-11":"",T=y?.findings??[],$=m?T:T.slice(0,8),E=y?dI[y.status]:null,R=async t=>{if(h)return;x(!0),b(null);let n=await dU(e.id,t);x(!1),n?b(n):c()};return(0,F.jsxs)("div",{ref:v,"data-scheme-ui":!0,tabIndex:-1,role:"dialog","aria-label":p("pipelineVerdict.title",{label:w}),className:"flex max-h-[80vh] w-[260px] flex-col gap-2 overflow-y-auto rounded-[12px] border border-border bg-card p-2.5 shadow-2 focus-visible:outline-none",onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),c())},children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[y&&E?(0,F.jsx)(an,{style:{backgroundColor:E.soft,color:E.color},children:dM(p,y.status)}):(0,F.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:n.error??e.stateDetail??p("pipelineVerdict.noFindings")}),h?(0,F.jsx)(xq.A,{className:"ml-auto h-3 w-3 animate-spin text-muted","aria-hidden":!0}):null]}),y&&"number"==typeof y.confidence?(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("span",{className:"shrink-0 text-label font-semibold text-secondary",children:p("pipelineVerdict.confidence")}),(0,F.jsx)("span",{className:"h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-border","aria-hidden":!0,children:(0,F.jsx)("span",{className:"block h-full rounded-full",style:{width:`${Math.round(100*Math.max(0,Math.min(1,y.confidence)))}%`,backgroundColor:E?.color??"var(--color-accent)"}})}),(0,F.jsx)("span",{className:"shrink-0 font-mono text-[10px] text-primary",children:y.confidence.toFixed(2)})]}):null,n.reviewHeadSha?(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("span",{className:"shrink-0 text-label font-semibold text-secondary",children:p("pipelineVerdict.reviewerSha",{sha:n.reviewHeadSha.slice(0,8)})}),(0,F.jsx)("code",{className:"min-w-0 truncate font-mono text-[10px] text-primary",title:n.reviewHeadSha,children:n.reviewHeadSha})]}):null,T.length?(0,F.jsxs)("div",{className:"flex max-h-40 flex-col gap-1 overflow-y-auto",children:[(0,F.jsx)("span",{className:"text-label font-semibold text-secondary",children:p("pipelineVerdict.findings",{count:T.length})}),(0,F.jsx)("ul",{className:"flex flex-col gap-1",children:$.map((e,t)=>(0,F.jsx)("li",{className:"rounded-[7px] bg-canvas px-2 py-1 text-[10.5px] leading-4 text-primary",children:e},t))}),!m&&T.length>8?(0,F.jsx)("button",{type:"button",className:`self-start text-[10px] font-semibold text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${M}`,onClick:()=>f(!0),children:p("pipelineVerdict.more",{count:T.length-8})}):null]}):null,j.length?(0,F.jsxs)("div",{className:"flex shrink-0 flex-col gap-0.5 border-t border-border pt-1.5",children:[(0,F.jsx)("span",{className:"text-label font-semibold text-secondary",children:p("pipelineVerdict.priorAttempts")}),(0,F.jsx)("div",{className:"flex max-h-24 flex-col gap-0.5 overflow-y-auto",children:j.map(e=>{let t=p("pipelineVerdict.attemptLine",{n:e.n,status:e.verdict?dM(p,e.verdict.status):dw(p,e.state)});return e.agentPath&&d&&I(e.agentPath)?(0,F.jsx)("button",{type:"button","aria-label":p("pipelineVerdict.openAttemptTranscript",{n:e.n}),onClick:()=>d(e.agentPath),className:`rounded-control px-1 text-left font-mono text-[9.5px] text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${M}`,children:t},e.n):(0,F.jsx)("span",{className:"font-mono text-[9.5px] text-muted",children:t},e.n)})})]}):null,A.length?(0,F.jsxs)("div",{className:"flex shrink-0 flex-col gap-0.5 border-t border-border pt-1.5",children:[(0,F.jsx)("span",{className:"text-label font-semibold text-secondary",children:p("pipelineVerdict.reviewTranscripts")}),(0,F.jsx)("div",{className:"flex max-h-24 flex-col gap-0.5 overflow-y-auto",children:A.map(e=>(0,F.jsx)("button",{type:"button",disabled:!d||!I(e.path),"aria-label":p("pipelineVerdict.openReviewTranscript",{n:e.n}),onClick:()=>d?.(e.path),className:`rounded-control px-1 text-left font-mono text-[9.5px] text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${M}`,children:p("pipelineVerdict.openReviewTranscript",{n:e.n})},e.path))})]}):null,g?(0,F.jsx)("span",{className:"truncate text-[10px] font-semibold text-danger",title:g,children:g}):null,(0,F.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-t border-border pt-2",children:[n.agentPath&&d&&o&&I(n.agentPath)?(0,F.jsx)("button",{type:"button","aria-label":p("pipelineVerdict.openAttemptTranscript",{n:n.n}),className:`rounded-full border border-border bg-canvas px-2.5 py-1 text-[10px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${M}`,onClick:()=>d(n.agentPath),children:p("pipelineVerdict.openTranscript")}):null,n.flowId&&u&&l?(0,F.jsx)("button",{type:"button",className:`rounded-full border border-border bg-canvas px-2.5 py-1 text-[10px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${M}`,onClick:()=>u(n.flowId),children:p("pipelineVerdict.openFlow")}):null,k?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("button",{type:"button",className:`ml-auto rounded-full border border-accent bg-accent px-2.5 py-1 text-[10px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 ${M}`,disabled:h,onClick:()=>void R("retry-stage"),children:p("pipelineVerdict.retry")}),(0,F.jsx)("button",{type:"button",className:`rounded-full border border-border bg-canvas px-2.5 py-1 text-[10px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${M}`,disabled:h,onClick:()=>void R("skip-stage"),children:p("pipelineVerdict.skip")})]}):null]})]})}var xH=n(4088),xB=n(2363),xU=n(9585),xK=n(6763),xY=n(9314),xW=n(6619);let xJ=[];function xV({containerRef:e,onClose:t,lockScroll:n=!0,manageFocus:r=!0}){let i=(0,B.useRef)(null);(0,B.useEffect)(()=>{let t,a=(t=Symbol("modal-layer"),xJ.push(t),t);i.current=a;let s=r&&document.activeElement instanceof HTMLElement?document.activeElement:null;r&&e.current?.focus();let l=n?document.body.style.overflow:null;return n&&(document.body.style.overflow="hidden"),()=>{xJ=xJ.filter(e=>e!==a),i.current=null,n&&null!==l&&(document.body.style.overflow=l),r&&s?.isConnected&&s.focus()}},[]),(0,B.useEffect)(()=>{let n=n=>{let r=i.current;if(!r||!(xJ.length>0)||xJ[xJ.length-1]!==r)return;if("Escape"===n.key)return void t();if("Tab"!==n.key)return;let a=e.current;if(!a)return;let s=[...a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled"));if(!s.length){n.preventDefault(),a.focus();return}let l=s[0],o=s[s.length-1],c=document.activeElement,d=c instanceof HTMLElement&&a.contains(c);n.shiftKey?d&&c!==l&&c!==a||(n.preventDefault(),o.focus()):d&&c!==o||(n.preventDefault(),l.focus())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e])}var xG=n(6721);function xX({engine:e,draft:t,state:n,error:r,showSpeed:i=!0,withDefaults:a=!1,disabled:s=!1,onEdit:l,onApply:o}){let{t:c}=(0,er.Ym)(),d=(0,B.useMemo)(()=>(0,sW.ve)(e,t.model)??[],[e,t.model]),u=i&&"codex"===e;return(0,F.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1",onPointerDown:e=>e.stopPropagation(),title:r||void 0,children:[(0,F.jsxs)(fQ,{"aria-label":c("runtimeConfig.model"),value:t.model,disabled:s,className:"max-md:min-h-11",onChange:t=>{var n;let r;return n=t.target.value,r=(0,sW.ve)(e,n)??[],void l(e=>({...e,model:n,effort:r.includes(e.effort)?e.effort:a?"":r[0]}))},children:[a?(0,F.jsx)("option",{value:"",children:c("draft.modelDefault")}):null,sQ[e].map(e=>(0,F.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,F.jsxs)(fQ,{"aria-label":c("runtimeConfig.effort"),value:t.effort,disabled:s,className:"max-md:min-h-11",onChange:e=>l(t=>({...t,effort:e.target.value})),children:[a?(0,F.jsx)("option",{value:"",children:c("draft.effortDefault")}):null,d.map(e=>(0,F.jsx)("option",{value:e,children:c2(c,e)},e))]}),u?(0,F.jsxs)("label",{className:"inline-flex h-7 items-center gap-1 rounded-control border border-border bg-card px-1.5 text-ui font-semibold text-secondary max-md:min-h-11 max-md:px-2.5",title:c("runtimeConfig.speedTitle"),children:[(0,F.jsx)("input",{type:"checkbox",checked:t.fast,onChange:e=>l(t=>({...t,fast:e.target.checked}))})," ",c("draft.speedFast")]}):null,(0,F.jsxs)("button",{type:"button",className:"inline-flex h-6 items-center gap-1 rounded-full border border-border bg-canvas px-1.5 text-[9.5px] font-semibold text-muted hover:border-accent/45 hover:text-accent disabled:opacity-60 max-md:min-h-11 max-md:px-2.5 max-md:text-label",disabled:s||"saving"===n,onClick:o,"aria-label":c("runtimeConfig.apply"),children:["saving"===n||"pending"===n||"confirming"===n?(0,F.jsx)(up.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,F.jsx)(m1.A,{className:"h-3 w-3","aria-hidden":!0}),c("runtimeConfig.apply")]})]})}function xQ(e,t,n){return e.split(t).join(n)}function xZ(e,t,n,r){let i=xQ(t.prompt,"{{task}}",e.task);i=xQ(i,"{{prev.output}}",r);let a=n.promptScaffold?xQ(n.promptScaffold,"{{task}}",e.task):null;a&&(a=xQ(a,"{{prev.output}}",r));let s="read-only"===n.access?"Access: read-only. Inspect and validate freely. Avoid edits, staging, commits, pushes, and other repository mutations.":"Access: read-write. Work only inside this pipeline's dedicated worktree and commit-ready scope.",l=n.roleId?[`Role preset: ${n.roleId} (${n.engine}${n.model?`/${n.model}`:""}${n.effort?`, ${n.effort}`:""}).`,...a?["","Role prompt scaffold:",a]:[]]:[];return[i.trim(),"","Pinned task:",e.task,"","Pinned specification and acceptance criteria:",e.spec?.trim()||"No separate pinned specification was supplied.","",...l,s,"Pipeline nesting is forbidden. Never create or start another pipeline from this stage.","","Finish the completed turn with one fenced JSON object as the final block. This block is the only completion authority:","```json",'{"status":"pass","findings":[],"confidence":0.9}',"```","Use pass when the stage contract is complete, fail for a retryable stage failure, and needs_decision when operator judgment is required.","Pass requires findings to be empty or omitted. Use fail or needs_decision when findings describe unresolved work.","Every prose terminal marker must agree with the JSON status: APPROVE=pass, REQUEST_CHANGES=fail, COMMENT=needs_decision. NO FINDINGS agrees with pass.","Human-readable output may appear before the JSON block. Never place text after the block."].join("\n")}function x0({pipeline:e,stage:t,disabled:n=!1}){let{t:r}=(0,er.Ym)(),[i,a]=(0,B.useState)(!1),[s,l]=(0,B.useState)(null),o="completed"===e.state||"closed"===e.state,c=dn(e,t.id).length>0,d=e.cursor?.activatedBy?.edge==="fail"&&e.cursor.activatedBy.stageId===t.id||d_(e,t)>0,u=e.stages.filter(e=>e.id!==t.id),p=e.stages,m=async(n,r,s)=>{i||(a(!0),l(null),l(await dB(e,t.id,n,r,s)),a(!1))},f="text-caption font-semibold text-muted",h="w-full";return(0,F.jsxs)("div",{"data-stage-edges":!0,className:"flex shrink-0 flex-col gap-1.5 border-b border-border bg-card px-2.5 py-1.5","aria-label":r("pipelineSlot.connectHeading"),children:[(0,F.jsx)("span",{className:"text-caption font-bold uppercase tracking-wide text-muted",children:r("pipelineSlot.connectHeading")}),(0,F.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,F.jsxs)("label",{className:"flex min-w-[140px] flex-1 flex-col gap-1",children:[(0,F.jsx)("span",{className:f,children:r("pipelineSlot.passEdgeLabel")}),(0,F.jsxs)(fQ,{className:h,value:t.next??"",disabled:n||i||o||c,onChange:e=>void m("pass",e.target.value||null),children:[(0,F.jsx)("option",{value:"",children:r("pipelineSlot.passEdgeEnd")}),u.map(e=>(0,F.jsx)("option",{value:e.id,children:dy(r,e)},e.id))]})]}),(0,F.jsxs)("label",{className:"flex min-w-[140px] flex-1 flex-col gap-1",children:[(0,F.jsx)("span",{className:f,children:r("pipelineSlot.failEdgeLabel")}),(0,F.jsxs)(fQ,{className:h,value:t.onFail?.to??"",disabled:n||i||o||d,onChange:e=>void m("fail",e.target.value||null,e.target.value?t.onFail?.maxRounds:void 0),children:[(0,F.jsx)("option",{value:"",children:r("pipelineSlot.failEdgeNone")}),p.map(e=>(0,F.jsx)("option",{value:e.id,children:e.id===t.id?r("pipelineSlot.failEdgeSelf"):dy(r,e)},e.id))]})]}),t.onFail?(0,F.jsxs)("label",{className:"flex w-[92px] flex-col gap-1",children:[(0,F.jsx)("span",{className:f,children:r("pipelineSlot.failEdgeRounds")}),(0,F.jsx)("input",{type:"number",min:1,max:9,value:t.onFail.maxRounds,disabled:n||i||o||d,onChange:e=>{let n=Number.parseInt(e.target.value,10);Number.isInteger(n)&&n>=1&&n<=9&&m("fail",t.onFail.to,n)},className:"h-7 w-full rounded-control border border-border bg-canvas px-2 text-ui font-semibold text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}):null]}),c&&!o?(0,F.jsx)("span",{className:"text-caption font-medium text-muted",children:r("pipelineSlot.passEdgeFrozen")}):null,d&&!o?(0,F.jsx)("span",{className:"text-caption font-medium text-muted",children:r("pipelineSlot.failEdgeFrozen")}):null,s?(0,F.jsx)("span",{role:"alert",className:"text-caption font-semibold text-danger",children:s}):null]})}let x1=new Set(c4);function x2(e){let t={};for(let[n,r]of Object.entries(e))if("string"==typeof r){let e=r.trim();e&&(t[n]=e)}else null!=r&&(t[n]=r);return t}function x5({slot:e,interactive:t}){let{t:n}=(0,er.Ym)(),{pipeline:r,stage:i}=e,a=he(),s=dp(r,i),l=de[s],o=dy(n,i),c=dk(n,i,e.index,e.total),d="review-loop"===i.kind,u="draft"===r.state,p=t&&0===dn(r,i.id).length&&"completed"!==r.state&&"closed"!==r.state,m=i.effectiveRole.model??"",f=i.effectiveRole.effort??"",[h,x]=(0,B.useState)(i.effectiveRole.engine),[g,b]=(0,B.useState)({model:m,effort:f,fast:!1}),[v,w]=(0,B.useState)("idle"),[y,k]=(0,B.useState)(i.role?.roleId??""),[j,N]=(0,B.useState)(i.role?.params??{}),[S,C]=(0,B.useState)(()=>dE(i.prompt)),[A,I]=(0,B.useState)(!1),[M,T]=(0,B.useState)(null),[$,E]=(0,B.useState)(!1),[R,P]=(0,B.useState)(!1),O=`${i.effectiveRole.engine}:${i.effectiveRole.model??""}:${i.effectiveRole.effort??""}`,[D,L]=(0,B.useState)(O);D!==O&&(L(O),x(i.effectiveRole.engine),b({model:m,effort:f,fast:!1}));let _=`${i.role?.roleId??""}:${JSON.stringify(i.role?.params??{})}`,[q,z]=(0,B.useState)(_);q!==_&&(z(_),k(i.role?.roleId??""),N(i.role?.params??{}));let[H,U]=(0,B.useState)(i.prompt);if(H!==i.prompt){let e=dE(H);U(i.prompt),C(t=>t===e?dE(i.prompt):t)}let K=async e=>{I(!0),T(null),E(!1);let t=await dU(r.id,"override-stage",{stageId:i.id,...e});t?T(t):E(!0),I(!1)},Y=async()=>{if("saving"===v)return;let e={};if(g.model.trim()!==m&&(e.model=g.model.trim()||null),g.effort!==f&&(e.effort=g.effort||null),!Object.keys(e).length)return void w("applied");w("saving"),T(null);let t=await dU(r.id,"override-stage",{stageId:i.id,...e});t?(T(t),w("error")):w("applied")},W=S.trim()!==dE(i.prompt),J=()=>{var t,n,r;let a,s,l;W&&K({prompt:(t=i.prompt,n=S,r=e.index,s=(a=[...new Set(t.match(d$)??[])]).length?a.join("\n"):r>0?"{{prev.output}}":"{{task}}",(l=n.trim())?`${s}
56
-
57
- ${l}`:s)})},V=u&&t&&dR(r.stages.filter(e=>e.id!==i.id).map(e=>e.kind)),G=u&&t&&r.stages.length>1,X=r.stages.map(e=>e.kind),Q=t=>G&&t>=0&&t<r.stages.length&&t!==e.index&&dR((t=>{let n=[...X],[r]=n.splice(e.index,1);return n.splice(t,0,r),n})(t)),Z=e=>{!A&&Q(e)&&(I(!0),T(null),dU(r.id,"reorder-stage",{stageId:i.id,toIndex:e},function(e,t,n){let r=e.stages.findIndex(e=>e.id===t);if(r<0)return e;let i=[...e.stages],[a]=i.splice(r,1),s=Math.max(0,Math.min(n,i.length));i.splice(s,0,a);let l=i[0],o=l&&"review-loop"===l.kind?i.map((e,t)=>0===t?{...e,kind:"run"}:e):i;return{...e,stages:dH(o)}}(r,i.id,e)).then(e=>{e&&T(e),I(!1)}))},ee=(0,tt.t7)(h),et="pending"!==s&&"skipped"!==s,en=("running"===s||"reviewing"===s||"committing"===s)&&"paused"!==r.state,ei=d?n("pipelineSlot.reviewHint"):n("running"===s||"reviewing"===s||"committing"===s?"pipelineSlot.starting":"pipelineSlot.waiting",{role:o}),ea=(sQ[h].find(e=>e.id===m)?.label??m)||n("draft.modelDefault"),es=f?c2(n,f):n("groupOverride.effortDefault"),el=g.model!==m||g.effort!==f,eo=xZ(r,i,i.effectiveRole,"[The previous stage output will be inserted here]");return(0,F.jsxs)("section",{"data-pan-ignore":!0,"data-pipeline-stage-card":`${r.id}::${i.id}`,"data-pipeline-stage-state":s,"aria-label":n("pipelineSlot.paneAria",{title:c}),className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-control border-2 border-dashed bg-card shadow-1",style:{borderColor:et?l.color:"var(--border-strong)"},children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0 opacity-60",style:{backgroundColor:ee.color}}),(0,F.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-2.5",style:{backgroundColor:ee.soft},children:[(0,F.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${en?"animate-pulse":""}`,style:{backgroundColor:l.color},title:n(`pipelineChipState.${s}`)}),R?(0,F.jsx)(f8,{engine:h,disabled:!p||A,onChange:e=>{if(e===h)return;let t=!!(g.effort&&(0,sW.z9)(e,g.effort));x(e),b(e=>({...e,model:"",effort:t?e.effort:""})),K({engine:e,model:null,...t?{}:{effort:null}})}}):(0,F.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-card/70 px-1.5 py-0.5 text-caption font-bold capitalize text-muted",children:h}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-muted",title:c,children:c}),(0,F.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-card/70 px-1.5 py-0.5 text-caption font-bold uppercase tracking-wide text-muted",children:d?`⟳ ${n("groupOverride.reviewKind")}`:n("groupOverride.runKind")}),G?(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5",role:"group","aria-label":n("groupOverride.stagesHeading"),children:[(0,F.jsx)("button",{type:"button","data-stage-move":"earlier",className:"inline-flex h-7 w-7 items-center justify-center rounded-control border border-border bg-card/80 text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30","aria-label":n("pipelineSlot.moveEarlier",{role:o}),disabled:A||!Q(e.index-1),onClick:()=>Z(e.index-1),children:(0,F.jsx)(xA.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,F.jsx)("button",{type:"button","data-stage-move":"later",className:"inline-flex h-7 w-7 items-center justify-center rounded-control border border-border bg-card/80 text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30","aria-label":n("pipelineSlot.moveLater",{role:o}),disabled:A||!Q(e.index+1),onClick:()=>Z(e.index+1),children:(0,F.jsx)(xG.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null,t?(0,F.jsx)("button",{type:"button",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-control border border-border bg-card/80 text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":n("groupOverride.applyStage"),"aria-expanded":R,onClick:()=>P(e=>!e),children:(0,F.jsx)(a5.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null,V?(0,F.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-control border border-border bg-canvas px-1.5 py-0.5 text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40","aria-label":n("groupOverride.removeStage"),disabled:A,onClick:()=>{var e;let t,n,a;I(!0),dU(r.id,"remove-stage",{stageId:i.id},(e=i.id,t=r.stages.find(t=>t.id===e),n=t?.next&&t.next!==t.id?t.next:null,a=r.stages.filter(t=>t.id!==e).map(t=>({...t,next:t.next===e?n:t.next,onFail:t.onFail?.to===e?null:t.onFail})),{...r,stages:dH(a)})).then(e=>{e&&T(e),I(!1)})},children:(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0})}):null]}),t&&R?(0,F.jsx)(ht,{idPrefix:e.key,roles:a,roleId:y,roleParams:j,disabled:!p||A,allowedRoleIds:x1,compactPreview:!0,onSelectRole:e=>{k(e);let t=a.find(t=>t.id===e),n=t?fZ(t):{};N(n),K({role:e?{roleId:e,...Object.keys(x2(n)).length?{params:x2(n)}:{}}:null})},onSetParam:(e,t)=>{let n={...j,[e]:t};if(N(n),!y)return;let r=x2(n);K({role:{roleId:y,...Object.keys(r).length?{params:r}:{}}})}}):null,(0,F.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border bg-sunken px-2.5 py-1.5",children:[(0,F.jsx)("span",{className:"shrink-0 text-caption font-semibold text-muted",children:n("draft.reasoning")}),t&&R?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(xX,{engine:h,draft:g,state:v,error:M??"",observedModelLabel:ea,observedEffort:es,draftPending:el,showSpeed:!1,withDefaults:!0,disabled:!p||A,onEdit:e=>{b(e),w("idle")},onApply:()=>void Y()}),A?(0,F.jsx)(up.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted","aria-hidden":!0}):$?(0,F.jsx)(m1.A,{className:"h-3.5 w-3.5 shrink-0 text-success",role:"img","aria-label":n("pipelineSlot.saved")}):null]}):(0,F.jsxs)("span",{className:"min-w-0 truncate text-label font-semibold text-muted",children:[ea,f?` \xb7 ${c2(n,f)}`:""]})]}),R&&M?(0,F.jsx)("div",{className:"shrink-0 px-2.5 py-1 text-label font-semibold text-danger",role:"alert",children:M}):null,t&&R&&!p?(0,F.jsx)("div",{className:"shrink-0 px-2.5 py-1 text-label font-semibold text-muted",children:n("pipelineSlot.frozen")}):null,t&&R&&r.stages.length>1?(0,F.jsx)(x0,{pipeline:r,stage:i,disabled:A}):null,(0,F.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-3",children:[(0,F.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,F.jsx)("span",{className:"rounded-full px-3 py-1 text-body font-bold",style:{backgroundColor:l.soft,color:l.color},children:n(`pipelineChipState.${s}`)}),(0,F.jsxs)("span",{className:"truncate text-label font-semibold text-muted",children:[ea,f?` \xb7 ${c2(n,f)}`:""]})]}),(0,F.jsxs)("div",{className:"ml-auto max-w-[88%] min-h-0 overflow-hidden rounded-[14px] rounded-br-[4px] bg-accent/10 px-3 py-2.5 text-ui leading-5 text-primary shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--color-accent)_18%,transparent)]",children:[(0,F.jsx)("p",{className:"mb-1 text-caption font-bold uppercase tracking-wide text-accent",children:n("pipelineSlot.promptLabel")}),(0,F.jsx)("p",{className:"line-clamp-[12] whitespace-pre-wrap break-words",children:eo})]}),(0,F.jsx)("div",{className:"mt-auto pt-3 text-center text-ui leading-5 text-muted",children:ei})]}),t&&R?(0,F.jsxs)("form",{onSubmit:e=>{e.preventDefault(),J()},className:"flex shrink-0 flex-col gap-1 border-t border-border bg-card px-2.5 py-2","aria-label":n("pipelineSlot.promptAria"),children:[d?null:(0,F.jsx)("span",{className:"text-caption font-semibold text-secondary",children:n(e.index>0&&i.prompt.includes("{{prev.output}}")?"pipelineSlot.wiringPrev":"pipelineSlot.wiringTask")}),(0,F.jsx)("label",{className:"text-caption font-semibold text-muted",htmlFor:`slot-prompt-${e.key}`,children:n("pipelineSlot.promptLabel")}),(0,F.jsx)("textarea",{id:`slot-prompt-${e.key}`,value:S,disabled:!p||A,onChange:e=>C(e.target.value),onBlur:J,placeholder:n("pipelineSlot.noPrompt"),className:"min-h-[52px] w-full resize-y rounded-control border border-border bg-canvas px-2 py-1.5 text-ui text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),W?(0,F.jsx)("div",{className:"flex items-center justify-end",children:(0,F.jsx)("button",{type:"submit",disabled:!p||A,className:"inline-flex h-7 items-center gap-1 rounded-control border border-accent bg-accent px-2.5 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",children:n("pipelineSlot.savePrompt")})}):null]}):null]})}let x3=new Set;function x4({anchorRef:e,children:t}){let n=(0,B.useRef)(null),[r,i]=(0,B.useState)(null);return((0,B.useLayoutEffect)(()=>{let t=()=>{let t=e.current,r=n.current;if(!t)return;let a=t.getBoundingClientRect();i(function(e,t,n,r=8){let i=e.top-r,a=n.height-e.bottom-r,s=t.height>i&&a>=i,l=t.width/2,o=Math.min(Math.max(e.left+e.width/2,l+r),n.width-l-r);return s?{left:o,top:Math.max(r,Math.min(e.bottom+r,n.height-r-t.height)),below:s}:{left:o,top:Math.min(n.height-r,Math.max(e.top-r,r+t.height)),below:s}}({top:a.top,bottom:a.bottom,left:a.left,width:a.width},{width:r?.offsetWidth??260,height:r?.offsetHeight??0},{width:window.innerWidth,height:window.innerHeight}))};return t(),window.addEventListener("scroll",t,!0),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}},[e]),"u"<typeof document)?null:(0,t8.createPortal)((0,F.jsx)("div",{ref:n,className:"fixed z-[80]",style:r?{left:r.left,top:r.top,transform:r.below?"translate(-50%, 0)":"translate(-50%, -100%)"}:{left:-9999,top:0,visibility:"hidden"},children:t}),document.body)}function x6({anchorRef:e,children:t}){let[n,r]=(0,B.useState)({left:-9999,top:0,above:!1});return((0,B.useLayoutEffect)(()=>{let t=()=>{let t=e.current;if(!t)return;let n=t.getBoundingClientRect(),i=window.innerHeight-n.bottom<108;r({left:Math.max(8,Math.min(window.innerWidth-188,n.right-180)),top:i?n.top-6:n.bottom+6,above:i})};return t(),window.addEventListener("scroll",t,!0),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}},[e]),"u"<typeof document)?null:(0,t8.createPortal)((0,F.jsx)("span",{className:"fixed z-[70]",style:{left:n.left,top:n.top,transform:n.above?"translateY(-100%)":void 0},children:t}),document.body)}function x8({label:e,mobile:t,slot:n,onClose:r}){let{t:i}=(0,er.Ym)(),a=(0,B.useRef)(null);return xV({containerRef:a,onClose:r,lockScroll:!1,manageFocus:!1}),(0,F.jsxs)("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":i("pipelineStrip.configAria",{label:e}),tabIndex:-1,className:`relative h-[min(620px,calc(100vh-24px))] w-[min(600px,calc(100vw-24px))] rounded-surface bg-card shadow-3 focus-visible:outline-none ${t?"[&_button]:min-h-11 [&_button]:min-w-11":""}`,children:[(0,F.jsx)("button",{type:"button",autoFocus:!0,onClick:r,"aria-label":i("pipelineStrip.closeConfig"),className:"absolute right-2 top-2 z-20 inline-flex h-7 w-7 items-center justify-center rounded-control border border-border bg-card text-muted shadow-1 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(H.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,F.jsx)(x5,{slot:n,interactive:!0})]})}function x7({pipeline:e,stage:t,previousStage:n,index:r,flows:i,files:a,renderableFlows:s,renderablePaths:l,materializedPaths:o,materializedFlows:c,mobile:d,open:u,configurationOpen:p,onToggleVerdict:m,onCloseVerdict:f,onToggleConfiguration:h,onCloseConfiguration:x,onOpenPath:g,onOpenFlow:b}){var v;let w,{t:y}=(0,er.Ym)(),k=dp(e,t),j=de[k],N=dt[k],S=c3(e,t.id),C=dL(e,t,o,c)?"materialized":dn(e,t.id).some(e=>dF.has(e.state))?"evidence":e.cursor?.stageId===t.id&&c9(e)?"queued":"waiting",A=dy(y,t),I=(w=c3(e,(v=t).id),w?.effectiveRole.access??v.access??("review-loop"===v.kind?"read-only":"read-write")),M=("running"===k||"reviewing"===k||"committing"===k)&&"paused"!==e.state,T=S?.flowId?i.find(e=>e.id===S.flowId)??null:null,$="review-loop"===t.kind&&T?dV(T)?.n??0:0,E=dn(e,t.id).length,R=y(`pipelineChipState.${k}`),P=[t.role?.roleId??t.id,y("read-only"===I?"pipelineStrip.readOnly":"pipelineStrip.readWrite"),S?.sessionId].filter(Boolean).join(" \xb7 "),O=t=>{let n=c3(e,t.id);return dx(t,n,i,s,l,a)},D=O(t),L=t=>0===dn(e,t.id).length&&"completed"!==e.state&&"closed"!==e.state,_=L(t),q=e=>!!e&&("flow"===e.kind?!!b:!!g),z=e=>{e&&("flow"===e.kind?b?.(e.flowId):g?.(e.path))},H=_||q(D),U=()=>{_?h(t.id):z(D)},K=(0,B.useRef)(null),Y=(0,B.useRef)(null),W=(0,B.useRef)(!1);(0,B.useEffect)(()=>{W.current&&!p&&Y.current?.focus(),W.current=p},[p]);let J=db(e,t,S)||dv(e,t,S,i,l,a),V=!!(S&&["passed","failed","needs_decision","skipped"].includes(S.state)),G=S?function(e){if(!e.startedAt||!e.completedAt)return null;let t=Date.parse(e.completedAt)-Date.parse(e.startedAt);if(!Number.isFinite(t)||t<0)return null;let n=Math.round(t/1e3),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60;return r?`${r}:${String(i).padStart(2,"0")}:${String(a).padStart(2,"0")}`:`${i}:${String(a).padStart(2,"0")}`}(S):null,X=S?.effectiveRole.model??y("pipelineStrip.defaultModel"),Q=S?.verdict?dM(y,S.verdict.status):R,Z=!!(S?.flowId&&s.has(S.flowId)),ee=!!(S?.agentPath&&(!l||l.has(S.agentPath))),et=d&&"queued"!==C&&"waiting"!==C&&function(e,t,n,r=[],i,a,s=[]){return!db(e,t,n)&&!dv(e,t,n,r,a,s)&&null===dx(t,n,r,i,a,s)}(e,t,S,i,s,l,a),en=n?O(n):null,ei=!!n&&L(n),ea=n?dy(y,n):"",es=n?y(`pipelineChipState.${dp(e,n)}`):"",el={key:`pipeline-config::${e.id}::${t.id}`,pipeline:e,stage:t,index:r,total:e.stages.length,presentation:"placeholder",x:0,y:0,w:600,h:620},eo=!!(n&&n.next===t.id),ec=c9(e),ed=!!(n&&ec&&e.cursor?.stageId===n.id),eu=e.stages[r+1]?.id??null,ep=t.next?e.stages.find(e=>e.id===t.next)??null:null,em=ep&&t.next!==eu?ep:null,ef=!!(em&&ec&&e.cursor?.stageId===t.id),eh=t.onFail?e.stages.find(e=>e.id===t.onFail.to)??null:null,ex=d_(e,t);return(0,F.jsxs)("li",{ref:K,className:"relative flex shrink-0 items-center gap-1.5","data-pipeline-stage":t.id,"data-stage-state":k,"data-stage-presentation":C,children:[n&&!d&&eo?(0,F.jsxs)("span",{role:"group","aria-label":y("pipelineStrip.lineageAria",{from:ea,to:A}),"data-edge-kind":"pass","data-edge-next":ed?"true":void 0,className:`inline-flex h-7 shrink-0 items-center rounded-full border px-0.5 ${ed?"border-accent/60 bg-accent-soft text-accent":"border-border bg-sunken text-muted"}`,children:[(0,F.jsx)("button",{type:"button",disabled:!ei&&!q(en),onClick:()=>{n&&ei?h(n.id):z(en)},"aria-label":y("pipelineStrip.previousStage",{label:ea,state:es}),className:"inline-flex h-6 w-6 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-35",children:(0,F.jsx)(xU.A,{className:"h-3 w-3","aria-hidden":!0})}),ed?(0,F.jsx)("span",{className:`text-caption font-bold ${"paused"!==e.state?"animate-pulse":""}`,title:y("pipelineStrip.nextEdgeAria"),children:y("pipelineStrip.nextEdge")}):(0,F.jsx)("span",{className:"h-px w-3 bg-strong","aria-hidden":!0}),(0,F.jsx)("button",{type:"button",disabled:!H,onClick:U,"aria-label":y("pipelineStrip.nextStage",{label:A,state:R}),className:"inline-flex h-6 w-6 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-35",children:(0,F.jsx)(uI.A,{className:"h-3 w-3","aria-hidden":!0})})]}):null,et?(0,F.jsx)("button",{ref:Y,type:"button","data-stage-compact":"true",disabled:!H,onClick:U,"aria-expanded":_?p:void 0,"aria-label":y("pipelineStrip.compactChipAria",{label:A,state:R}),className:`inline-flex h-11 w-11 items-center justify-center rounded-full text-label font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-default ${M?"animate-pulse":""}`,style:{backgroundColor:j.soft,color:j.color},title:P,children:(0,F.jsx)("span",{"aria-hidden":!0,children:_?(0,F.jsx)(xK.A,{className:"h-3.5 w-3.5"}):N||("review-loop"===t.kind?"⟳":"▸")})}):(0,F.jsxs)("span",{className:`inline-flex items-stretch rounded-control border ${V?"border-border bg-sunken":"border-transparent"}`,children:[(0,F.jsxs)("button",{ref:Y,type:"button",disabled:!H,onClick:U,"aria-expanded":_?p:void 0,className:`inline-flex min-h-7 max-w-[180px] items-center gap-1 truncate rounded-l-control ${J?"":"rounded-r-control"} px-2 text-label font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-default ${M?"animate-pulse":""}`,style:{backgroundColor:j.soft,color:j.color},title:P,"aria-label":y(_?"pipelineStrip.configureStage":D?"pipelineStrip.openTranscript":"pipelineStrip.chipAria",{label:A,state:R}),children:[(0,F.jsx)("span",{"aria-hidden":!0,children:_?(0,F.jsx)(xK.A,{className:"h-3 w-3"}):"review-loop"===t.kind?"⟳":"▸"}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:A}),N?(0,F.jsx)("span",{"aria-hidden":!0,children:N}):null,(0,F.jsx)("span",{className:"text-caption font-semibold opacity-80",children:"queued"===C||"waiting"===C?y(`pipelinePresentation.${C}`):R}),$>0?(0,F.jsx)("span",{"aria-hidden":!0,children:y("pipelineStrip.roundShort",{n:$})}):null,E>1?(0,F.jsx)("span",{"aria-hidden":!0,children:y("pipelineStrip.attemptSuffix",{n:E})}):null]}),J?(0,F.jsx)("button",{type:"button",onClick:m,"aria-expanded":u,"aria-label":y("pipelineStrip.openVerdict",{label:A,state:R}),className:`inline-flex h-6 items-center rounded-r-full border-l border-card/60 px-1 text-label font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${d?"min-h-11 min-w-11 justify-center":""}`,style:{backgroundColor:j.soft,color:j.color},children:(0,F.jsx)("span",{"aria-hidden":!0,children:S.verdict?"pass"===S.verdict.status?"✓":"fail"===S.verdict.status?"✕":"●":"!"})}):null,!d&&V&&S?(0,F.jsxs)("span",{"data-stage-evidence":S.state,"aria-label":y("pipelineStrip.evidenceAria",{label:A,verdict:Q,duration:G??y("pipelineStrip.unknownDuration"),model:X}),className:"inline-flex min-h-7 max-w-[240px] items-center gap-1.5 border-l border-border px-2 text-caption font-semibold text-secondary",children:[(0,F.jsx)("span",{className:"text-strong",children:Q}),(0,F.jsx)("span",{"aria-hidden":!0,children:"\xb7"}),(0,F.jsx)("span",{className:"tabular-nums",children:G??y("pipelineStrip.unknownDuration")}),(0,F.jsx)("span",{"aria-hidden":!0,children:"\xb7"}),(0,F.jsx)("span",{className:"max-w-[100px] truncate",title:X,children:X})]}):null]}),em?(0,F.jsx)("span",{"data-edge-kind":"pass-jump","data-edge-next":ef?"true":void 0,role:"img","aria-label":y("pipelineStrip.passEdgeAria",{from:A,to:dy(y,em)}),title:ef?y("pipelineStrip.nextEdgeAria"):void 0,className:`inline-flex h-6 shrink-0 items-center gap-0.5 rounded-full border px-1.5 text-caption font-bold ${ef?`border-accent/60 bg-accent-soft text-accent ${"paused"!==e.state?"animate-pulse":""}`:"border-border bg-sunken text-muted"}`,children:(0,F.jsxs)("span",{"aria-hidden":!0,children:["→ ",dy(y,em)]})}):null,eh&&t.onFail?(0,F.jsx)("span",{"data-edge-kind":"fail",role:"img","aria-label":y("pipelineStrip.failEdgeAria",{from:A,to:dy(y,eh),k:ex,n:t.onFail.maxRounds}),className:"inline-flex h-6 shrink-0 items-center gap-0.5 rounded-full border border-dashed border-warning/70 bg-warning-soft px-1.5 text-caption font-bold text-warning",children:(0,F.jsxs)("span",{"aria-hidden":!0,children:["↩ ",dy(y,eh)," ",ex,"/",t.onFail.maxRounds]})}):null,u&&S?(0,F.jsx)(x4,{anchorRef:K,children:(0,F.jsx)(xz,{pipeline:e,stage:t,attempt:S,flows:i,files:a,availablePaths:l,mobile:d,canOpenFlow:Z,canOpenPath:ee,onClose:f,onOpenPath:g,onOpenFlow:b})}):null,p?(0,F.jsx)(x4,{anchorRef:K,children:(0,F.jsx)(x8,{label:A,mobile:d,slot:el,onClose:x})}):null]})}function x9({pipeline:e,flows:t=[],files:n=[],renderablePaths:r,renderableFlows:i=x3,materializedPaths:a=r??x3,materializedFlows:s=i,compact:l=!1,mobile:o=!1,linkedTasks:c=[],onOpenPath:d,onOpenFlow:u,onOpenTask:p}){var m;let{t:f}=(0,er.Ym)(),[h,x]=(0,B.useState)(!1),[g,b]=(0,B.useState)(null),[v,w]=(0,B.useState)(null),[y,k]=(0,B.useState)(null),[j,N]=(0,B.useState)(!1),[S,C]=(0,B.useState)("idle"),A=(0,B.useRef)(null),I=(0,B.useRef)(null),M=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if(!y)return;let e=e=>{"Escape"===e.key&&(e.stopPropagation(),k(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y]),(0,B.useLayoutEffect)(()=>{j?I.current?.focus():M.current&&A.current?.focus(),M.current=j},[j]),(0,B.useEffect)(()=>{if(!j)return;let e=e=>{"Escape"===e.key&&(e.stopPropagation(),N(!1),A.current?.focus())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[j]);let T=async t=>{h||(x(!0),b(null),b(await dU(e.id,t)),x(!1),N(!1))},$=async()=>{try{await navigator.clipboard.writeText(e.baseRef),C("copied")}catch{C("failed")}},E=c7.has(e.state),R=c8.has(e.state),P="draft"===e.state,O="completed"===e.state||"closed"===e.state,D=(m=e,c7.has(m.state)&&m.cursor?c3(m,m.cursor.stageId)?.verdict?.findings?.[0]??m.stateDetail:m.stateDetail),{k:L,n:_}=dA(e),q=R?"bg-accent-soft text-accent":E||P?"bg-warning-soft text-warning":"completed"===e.state?"bg-success-soft text-success":"bg-sunken text-muted",z="inline-flex h-7 shrink-0 items-center justify-center gap-1 rounded-control border px-2.5 text-ui font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",H=l&&!o?"w-7 px-0":"",U=`${z} border-border bg-card text-secondary hover:text-primary`;return(0,F.jsxs)("div",{"data-scheme-ui":!0,role:"group","aria-label":f("pipelineStrip.groupAria",{task:e.task}),className:`pointer-events-auto relative flex min-h-9 w-full max-w-full items-center gap-x-2.5 gap-y-1 overflow-visible rounded-surface border bg-card/95 py-1 shadow-1 ${l?"flex-nowrap px-2.5":o?"flex-wrap px-2":"flex-nowrap px-3"} ${o?"[&_button]:min-h-11 [&_button]:min-w-11":""} ${P?"border-2 border-dashed border-warning":E?"border-warning/70":"border-border"}`,children:[(0,F.jsxs)("span",{"data-pipeline-header":!0,className:`flex min-w-0 items-center gap-2 ${o?"order-1 flex-1":"max-w-[34%] shrink-0"}`,children:[(0,F.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${R?"animate-pulse bg-accent":E?"bg-warning":"completed"===e.state?"bg-success":P?"bg-warning":"bg-strong"}`,"aria-hidden":!0}),l?null:(0,F.jsx)("span",{className:"min-w-0 truncate text-ui font-semibold text-primary",title:e.task,children:e.task}),(0,F.jsx)("span",{className:`shrink-0 rounded-full px-1.5 py-0.5 text-caption font-semibold ${q}`,children:c6(f,e.state)}),!P&&_?(0,F.jsx)("span",{className:"shrink-0 text-label font-semibold tabular-nums text-muted",children:f("pipelineStrip.stageOf",{k:L,n:_})}):null,D?(0,F.jsx)("span",{className:`min-w-0 truncate text-ui font-semibold ${E?"text-warning":"text-danger"}`,title:D,children:D}):null]}),e.baseRef?(0,F.jsxs)("button",{type:"button","data-pipeline-base-ref":!0,title:f("pipelineStrip.baseShaFull",{sha:e.baseRef}),"aria-label":f("pipelineStrip.copyBaseSha",{sha:e.baseRef}),onClick:()=>void $(),className:`inline-flex shrink-0 items-center gap-1 rounded-control border border-border bg-sunken px-1.5 py-0.5 font-mono text-caption text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${o?"order-2":""}`,children:[f("pipelineStrip.baseSha",{sha:e.baseRef.slice(0,8)}),"copied"===S?(0,F.jsx)(m1.A,{className:"h-3 w-3 text-success","aria-hidden":!0}):(0,F.jsx)(xY.A,{className:"h-3 w-3","aria-hidden":!0})]}):null,(0,F.jsx)("span",{className:"sr-only","aria-live":"polite",role:"status",children:"copied"===S?f("pipelineStrip.copiedBaseSha"):"failed"===S?f("pipelineStrip.copyBaseShaFailed"):""}),(0,F.jsx)("ol",{"data-pipeline-stage-rail":!0,className:`no-scrollbar flex min-w-0 flex-1 items-center gap-1.5 overflow-x-auto ${o?"order-4 basis-full justify-start border-t border-border/70 pt-1":"justify-center"}`,"aria-label":f("pipelineStrip.stagesAria"),children:e.stages.map((l,c)=>(0,F.jsx)(x7,{pipeline:e,stage:l,previousStage:e.stages[c-1]??null,index:c,flows:t,files:n,renderableFlows:i,renderablePaths:r,materializedPaths:a,materializedFlows:s,mobile:o,open:v===l.id,configurationOpen:y===l.id,onToggleVerdict:()=>{k(null),w(e=>e===l.id?null:l.id)},onCloseVerdict:()=>w(null),onToggleConfiguration:e=>{w(null),k(t=>t===e?null:e)},onCloseConfiguration:()=>k(null),onOpenPath:d,onOpenFlow:u},l.id))}),c.length?(0,F.jsxs)("span",{className:`no-scrollbar flex max-w-[420px] min-w-0 shrink items-center gap-1 overflow-x-auto ${o?"order-5 basis-full":""}`,"aria-label":f("pipelineStrip.linkedTasks"),children:[(0,F.jsx)("span",{className:"text-caption font-semibold text-muted","aria-hidden":!0,children:"↗"}),c.map(e=>{let t=e.text.split("\n",1)[0]?.trim()||e.id;return(0,F.jsx)("button",{type:"button",disabled:!p,onClick:()=>p?.(e),"aria-label":f("pipelineStrip.openTask",{label:t}),className:"inline-flex h-7 max-w-[150px] items-center truncate rounded-control border border-border bg-sunken px-2 text-caption font-semibold text-secondary hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",children:t},e.id)})]}):null,(0,F.jsxs)("span",{"data-pipeline-actions":!0,className:`relative flex shrink-0 items-center gap-1.5 ${o?"order-3":""}`,children:[g?(0,F.jsx)("span",{role:"alert",className:"max-w-[220px] truncate text-caption font-semibold text-danger",title:g,children:g}):null,h?(0,F.jsx)(xq.A,{className:"h-3.5 w-3.5 animate-spin text-muted","aria-hidden":!0}):null,P?(0,F.jsxs)("button",{className:`${z} ${H} border-warning bg-warning text-white hover:opacity-90`,"aria-label":f("pipelineStrip.start"),disabled:h||e.stages.length<1,title:e.stages.length<1?f("groupOverride.startNeedsStages"):void 0,onClick:()=>void T("start"),children:[(0,F.jsx)(xW.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l&&!o?null:f("pipelineStrip.start")]}):"needs_decision"===e.state?(0,F.jsxs)("button",{className:`${z} ${H} border-accent bg-accent text-white hover:opacity-90`,"aria-label":f("pipelineStrip.retryStage"),disabled:h,onClick:()=>void T("retry-stage"),children:[(0,F.jsx)(xq.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l&&!o?null:f("pipelineStrip.retryStage")]}):O?(0,F.jsx)("span",{className:o?"h-11 w-11":"h-7 w-7","aria-hidden":!0}):"paused"===e.state?(0,F.jsxs)("button",{className:`${z} ${H} border-success/40 bg-success-soft text-success hover:opacity-90`,"aria-label":f("pipelineStrip.resume"),disabled:h,onClick:()=>void T("resume"),children:[(0,F.jsx)(xW.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l&&!o?null:f("pipelineStrip.resume")]}):(0,F.jsxs)("button",{className:`${U} ${H}`,"aria-label":f("pipelineStrip.pause"),disabled:h,onClick:()=>void T("pause"),children:[(0,F.jsx)(m0.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l&&!o?null:f("pipelineStrip.pause")]}),(0,F.jsx)("button",{ref:A,type:"button","aria-label":f("pipelineStrip.moreActions"),"aria-haspopup":"menu","aria-expanded":j,disabled:h,onClick:()=>N(e=>!e),className:`${z} border-border bg-card px-2 text-secondary hover:text-primary`,children:(0,F.jsx)(cg.A,{className:"h-4 w-4","aria-hidden":!0})}),j?(0,F.jsx)(x6,{anchorRef:A,children:(0,F.jsxs)("span",{role:"menu","aria-label":f("pipelineStrip.moreActions"),className:"flex min-w-[180px] flex-col gap-1 rounded-[10px] border border-border bg-card p-1.5 shadow-3",children:["needs_decision"===e.state?(0,F.jsx)("button",{ref:I,role:"menuitem",type:"button",disabled:h,onClick:()=>void T("skip-stage"),className:"inline-flex min-h-9 items-center rounded-control px-2 text-left text-ui font-semibold text-secondary hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:f("pipelineStrip.skipStage")}):null,(0,F.jsx)("button",{ref:"needs_decision"===e.state?void 0:I,role:"menuitem",type:"button",disabled:h,onClick:()=>void T(P?"delete":"close"),className:"inline-flex min-h-9 items-center rounded-control px-2 text-left text-ui font-semibold text-danger hover:bg-danger-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:f(P?"pipelineStrip.discard":"pipelineStrip.close")})]})}):null]})]})}function ge({pipeline:e,flows:t=[],files:n=[],renderablePaths:r,renderableFlows:i,linkedTasks:a=[],defaultExpanded:s=!0,onOpenPath:l,onOpenFlow:o,onOpenTask:c}){let{t:d}=(0,er.Ym)(),[u,p]=(0,B.useState)(s),m="draft"===e.state,f=c7.has(e.state),h=c8.has(e.state),{k:x,n:g}=dA(e),b=h?"bg-accent-soft text-accent":f||m?"bg-warning-soft text-warning":"completed"===e.state?"bg-success-soft text-success":"bg-sunken text-muted";return(0,F.jsxs)("div",{className:"px-2 py-1.5 [&_button]:!h-11 [&_button]:!min-h-11","data-testid":"mobile-pipeline-dock","data-pipeline-draft":m||void 0,children:[(0,F.jsxs)("button",{type:"button","data-testid":"mobile-pipeline-dock-summary","aria-expanded":u,"aria-label":d(u?"pipelineMobile.collapseDock":"pipelineMobile.expandDock",{task:e.task}),onClick:()=>p(e=>!e),className:"flex min-h-11 w-full items-center gap-2 rounded-control px-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${h?"animate-pulse bg-accent":f||m?"bg-warning":"completed"===e.state?"bg-success":"bg-strong"}`,"aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-primary",children:e.task}),(0,F.jsx)("span",{className:`shrink-0 rounded-full px-1.5 py-0.5 text-caption font-semibold ${b}`,children:c6(d,e.state)}),!m&&g?(0,F.jsx)("span",{className:"shrink-0 text-label font-semibold tabular-nums text-muted",children:d("pipelineStrip.stageOf",{k:x,n:g})}):null,u?(0,F.jsx)(xH.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}):(0,F.jsx)(xB.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0})]}),u?(0,F.jsx)(x9,{pipeline:e,flows:t,files:n,renderablePaths:r,renderableFlows:i,mobile:!0,linkedTasks:a,onOpenPath:l,onOpenFlow:o,onOpenTask:c}):null]})}function gt(e){let t=0,n=0,r=0;for(let i of e)"completed"===i.state?r+=1:"draft"===i.state||c7.has(i.state)?n+=1:t+=1;return{total:e.length,active:t,attention:n,completed:r}}var gn=n(412);function gr({pipelines:e,onOpen:t}){let{t:n}=(0,er.Ym)();if(!e.length)return null;let r=gt(e),i=[];return r.active&&i.push(n("pipelineMobile.summaryActive",{n:r.active})),r.attention&&i.push(n("pipelineMobile.summaryAttention",{n:r.attention})),r.completed&&i.push(n("pipelineMobile.summaryCompleted",{n:r.completed})),(0,F.jsx)("div",{className:"shrink-0 border-t border-border bg-card",children:(0,F.jsxs)("button",{type:"button","data-testid":"mobile-pipeline-summary",onClick:t,"aria-haspopup":"dialog","aria-label":n("pipelineMobile.summaryOpen",{n:r.total}),className:"flex min-h-11 w-full items-center gap-2 px-3 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40",children:[(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-1","aria-hidden":!0,children:[r.active?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-accent"}):null,r.attention?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-warning"}):null,r.completed?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-success"}):null,r.active||r.attention||r.completed?null:(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-strong"})]}),(0,F.jsx)(gn.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-primary",children:n("pipelineMobile.summaryCount",{n:r.total})}),i.length?(0,F.jsx)("span",{className:"shrink-0 truncate text-label font-semibold text-muted",children:i.join(" \xb7 ")}):null,(0,F.jsx)(xG.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0})]})})}function gi({pipelines:e,onOpen:t}){let{t:n}=(0,er.Ym)();if(!e.length)return null;let r=gt(e),i=[];r.active&&i.push(n("pipelineMobile.summaryActive",{n:r.active})),r.attention&&i.push(n("pipelineMobile.summaryAttention",{n:r.attention})),r.completed&&i.push(n("pipelineMobile.summaryCompleted",{n:r.completed}));let a=[n("pipelineMobile.summaryCount",{n:r.total}),...i].join(" \xb7 "),s=r.attention||r.active||r.total,l=r.attention?"bg-warning/10 text-warning":r.active?"bg-accent/10 text-accent":"bg-sunken text-muted";return(0,F.jsxs)("button",{type:"button","data-testid":"mobile-pipeline-summary",onClick:t,"aria-haspopup":"dialog","aria-label":a,className:"inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-[8px] text-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)(gn.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:`rounded-full px-1 text-[10px] font-bold ${l}`,children:s})]})}function ga({pipelines:e,render:t,onClose:n}){let{t:r}=(0,er.Ym)(),[i,a]=(0,B.useState)(!1),s=(0,B.useRef)(null),l=e.filter(e=>"completed"!==e.state),o=e.filter(e=>"completed"===e.state);xV({containerRef:s,onClose:n});let c=e=>(0,F.jsx)(ge,{pipeline:e,flows:t.flows,files:t.files,renderablePaths:t.renderablePaths,renderableFlows:t.renderableFlows,linkedTasks:t.linkedTasksByPipeline.get(e.id)??[],defaultExpanded:!1,onOpenPath:t.onOpenPath,onOpenFlow:t.onOpenFlow,onOpenTask:t.onOpenTask},e.id);return(0,F.jsx)("div",{className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/40",role:"presentation",onClick:e=>{e.target===e.currentTarget&&n()},children:(0,F.jsxs)("div",{ref:s,role:"dialog","aria-modal":"true","aria-label":r("pipelineMobile.sheetTitle"),tabIndex:-1,"data-testid":"mobile-pipeline-sheet",className:"flex max-h-[80vh] w-full max-w-[520px] flex-col rounded-t-[16px] bg-card pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-2 focus-visible:outline-none",children:[(0,F.jsx)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:(0,F.jsx)("div",{className:"mx-auto mb-0 h-1 w-10 rounded-full bg-border","aria-hidden":!0})}),(0,F.jsxs)("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[(0,F.jsx)("span",{className:"text-ui font-bold text-primary",children:r("pipelineMobile.sheetTitle")}),(0,F.jsx)("button",{type:"button",onClick:n,"aria-label":r("pipelineMobile.closeSheet"),className:"flex h-11 w-11 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(i9.X,{className:"h-5 w-5","aria-hidden":!0})})]}),(0,F.jsxs)("div",{className:"min-h-0 flex-1 divide-y divide-border overflow-y-auto",children:[l.map(c),o.length?(0,F.jsxs)("div",{"data-testid":"mobile-pipeline-completed-group",children:[(0,F.jsxs)("button",{type:"button","data-testid":"mobile-pipeline-completed-toggle","aria-expanded":i,onClick:()=>a(e=>!e),className:"flex min-h-11 w-full items-center gap-2 px-3 py-1.5 text-left text-label font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40",children:[i?(0,F.jsx)(xB.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}):(0,F.jsx)(xG.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-success","aria-hidden":!0}),r("pipelineMobile.completedGroup",{n:o.length})]}),i?(0,F.jsx)("div",{className:"divide-y divide-border border-t border-border",children:o.map(c)}):null]}):null]})]})})}function gs(e){return"running"===e||"live"===e?"bg-success":"silent"===e?"bg-warning":"closed"===e?"bg-muted":"bg-danger"}function gl({tray:e,onToggleExpanded:t,onOpenMember:n,onUnfold:r,variant:i="docked"}){let{t:a}=(0,er.Ym)(),s=(0,B.useRef)(null);if(0===e.count)return null;let l="inline"===i,o=`subagent-tray-${e.parentConversationId}`;return(0,F.jsxs)("div",{"data-subagent-tray":e.parentConversationId,"data-subagent-tray-variant":i,"data-scheme-ui":!0,className:l?"pointer-events-auto flex w-full min-w-0 flex-col items-stretch":"pointer-events-auto absolute inset-x-2 -bottom-3 z-[7] flex flex-col items-stretch",children:[(0,F.jsxs)("button",{ref:s,type:"button","data-subagent-tray-toggle":!0,"aria-expanded":e.expanded,"aria-controls":o,"aria-label":a(e.expanded?"subagentTray.collapse":"subagentTray.toggle",{count:e.count}),className:l?"inline-flex min-h-11 w-full items-center justify-between gap-1.5 rounded-[10px] border border-border bg-card px-3 text-[12px] font-semibold text-muted shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55":"inline-flex h-6 items-center gap-1.5 self-center rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55",onClick:()=>t(!e.expanded),children:[(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"text-[12px] leading-none",children:"⑂"}),(0,F.jsx)("span",{className:"tabular-nums truncate",children:a("subagentTray.label",{count:e.count})})]}),(0,F.jsx)("span",{"aria-hidden":!0,className:"flex items-center gap-0.5",children:e.members.slice(0,6).map(e=>(0,F.jsx)("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${gs(e.state)}`},e.id))})]}),e.expanded?(0,F.jsx)("ul",{id:o,"aria-label":a("subagentTray.rows"),className:"mt-1 flex w-full min-w-0 flex-col gap-0.5 rounded-[10px] border border-dashed border-border bg-card/95 p-1 shadow-1",onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),t(!1),requestAnimationFrame(()=>s.current?.focus()))},children:e.members.map(e=>{let t;return(0,F.jsxs)("li",{className:"flex min-w-0 items-center gap-1",children:[(0,F.jsxs)("button",{type:"button","data-subagent-tray-member":e.id,"data-subagent-state":e.state,"aria-label":a("subagentTray.open",{name:e.title}),title:`${e.title} \xb7 ${(t=e.state,a(`subagentTray.state.${t}`))}`,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-md px-1.5 text-left font-medium text-primary hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55 ${l?"min-h-11 text-[13px]":"py-1 text-[11px]"}`,onClick:()=>n(e.path),children:[(0,F.jsx)("span",{"aria-hidden":!0,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full ${gs(e.state)}`}),(0,F.jsx)("span",{className:"min-w-0 truncate",children:e.title})]}),(0,F.jsx)("button",{type:"button","data-subagent-tray-unfold":e.id,"aria-label":a("subagentTray.unfold",{name:e.title}),className:`shrink-0 rounded-md text-muted hover:bg-accent/10 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55 ${l?"inline-flex min-h-11 min-w-11 items-center justify-center text-[13px]":"px-1 py-1 text-[11px]"}`,onClick:()=>r(e.id,e.path),children:(0,F.jsx)("span",{"aria-hidden":!0,children:"↥"})})]},e.id)})}):null]})}let go=e=>({x:e.x,y:e.y,w:e.w,h:e.h});function gc(e){let t=new Map;for(let n of e)for(let e of n.runs){let r=[...e.attempts].reverse().find(e=>e.agentPath)?.agentPath;r&&t.set(dW(n.id,e.stageId),r)}return t}function gd(e,t,n={}){let r=new Map(e.groups.map(e=>[e.key,go(e)])),i=[...e.nodes.map(e=>({key:e.file.path,label:(0,ei.cr)(e.file.title,60),rect:go(e)})),...e.groups.map(e=>({key:e.key,label:(0,ei.cr)(e.label,60),rect:go(e)}))].filter(e=>e.label.length>0),a=t=>{let i=e.byPath.get(t);if(i)return go(i);let a=r.get(t);if(a)return a;let s=n.extraRects?.get(t);return s?go(s):null},s=dG(e.nodes.map(e=>e.file.path),(e.decks??[]).map(e=>({key:e.key,flow:e.flow})),(e.stacks??[]).map(e=>({key:e.key,paths:e.items.map(e=>e.file.path)}))),l=e=>{if(a(e))return e;let t=n.aliases?.get(e);if(t&&a(t))return t;let r=s.get(t??e);return r&&a(r)?r:null};return{project:t,boardRevision:n.boardRevision??null,named:i,concreteAnchorKey:l,rectFor:e=>{let t=l(e);return t?a(t):null}}}function gu(e){return"running"===e||"live"===e?0:"silent"===e?1:2}function gp(e){let t=e.sessionStartedAt?Date.parse(e.sessionStartedAt):NaN;return Number.isFinite(t)?t:1e3*e.mtime}function gm({conversationId:e,entries:t,cardRect:n,onNavigate:r,onExpandedChange:i,anchorRegistry:a,exclude:s,onFold:l,now:o}){let{t:c}=(0,er.Ym)(),d=e=>c("subagentTray.fold",{name:e}),[u,p]=(0,B.useState)(null),m=(0,B.useRef)(!1),f=cM(),h=o??f,x=(0,B.useMemo)(()=>(function(e,t,n=new Set,r=0){return(function(e,t,n=()=>!0){let r=new Set(t.filter(t=>U(t)===e).map(e=>e.path)),i=new Map;for(let a of t){if(K(a)||"shell"===a.engine)continue;let t=U(a);if(t===e||a.durableLineage?.parentConversationId!==e&&(!a.parent||!r.has(a.parent))||!n(a))continue;let s=i.get(t),l=a.generation??0,o=s?.generation??0;(!s||l>o||l===o&&a.mtime>s.mtime)&&i.set(t,a)}return[...i.values()]})(e,t).filter(e=>!n.has(e.path)&&!n.has(U(e))).map(e=>({entry:e,state:hY(e,r)})).sort((e,t)=>gu(e.state)-gu(t.state)||gp(e.entry)-gp(t.entry)||U(e.entry).localeCompare(U(t.entry))).map(({entry:e,state:t})=>{let n=U(e);return{id:n,path:e.path,title:e.title,engine:e.engine,model:e.model,state:t,avatarSeed:n}})})(e,t,s,h),[e,t,s,h]),g=(0,B.useMemo)(()=>(function(e,t,n=30,r=6){if(!e.length)return[];let i=Math.max(1,Math.floor((t.h+r)/(n+r))),a=t.y+Math.max(0,t.h-n),s=e.length>12?e.slice(0,11):e,l=s.map((e,s)=>{let l=Math.floor(s/i),o=s%i;return{kind:"badge",child:e,x:t.x+t.w+r+l*(n+r),y:a-o*(n+r),size:n,column:l,row:o}});if(s.length<e.length){let o=s.length,c=Math.floor(o/i),d=o%i;l.push({kind:"overflow",count:e.length-s.length,x:t.x+t.w+r+c*(n+r),y:a-d*(n+r),size:n,column:c,row:d})}return l})(x,n),[x,n]),b=null!==u&&x.some(e=>e.id===u);return((0,B.useEffect)(()=>{i?.(b)},[b,i]),(0,B.useEffect)(()=>{if(!a)return;let t=new Map(g.flatMap(e=>"badge"===e.kind?[[e.child.id,{x:e.x+e.size/2,y:e.y+e.size/2}]]:[]));if(t.size)return a.replace(e,t)},[a,e,g]),g.length)?(0,F.jsx)(F.Fragment,{children:g.map(e=>{let t,i={left:e.x-n.x,top:e.y-n.y,height:e.size};if("overflow"===e.kind)return(0,F.jsxs)("span",{"data-subagent-overflow":!0,"data-chip-keepout":!0,"data-scheme-ui":!0,className:"pointer-events-auto absolute z-[6] inline-flex w-[30px] items-center justify-center rounded-full border border-border bg-card text-[10px] font-bold tabular-nums text-muted shadow-1",style:i,title:`${e.count} more subagents`,"aria-label":`${e.count} more subagents`,children:["+",e.count]},"overflow");let a=e.child,s=u===a.id,o="dead"===a.state,f=o||"closed"===a.state,h=function(e){let t=0;for(let n of e)t=31*t+n.charCodeAt(0)>>>0;return t%360}(a.avatarSeed),x="running"===a.state||"live"===a.state,g="silent"===a.state||o?` \xb7 ${c(`subagentTray.state.${a.state}`)}`:"",b=`${a.title} \xb7 ${a.engine}${a.model?` / ${a.model}`:""}${g}`;return(0,F.jsxs)("span",{className:"contents",children:[s&&l&&!o?(0,F.jsx)("button",{type:"button","data-subagent-fold":a.id,"data-scheme-ui":!0,"aria-label":d(a.title),title:d(a.title),className:"pointer-events-auto absolute z-[71] inline-flex h-5 w-5 items-center justify-center rounded-full border border-border bg-card text-[11px] text-muted shadow-1 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55",style:{left:e.x-n.x+202,top:e.y-n.y+5},onClick:()=>l(a.id,a.path),children:(0,F.jsx)("span",{"aria-hidden":!0,children:"↧"})}):null,(0,F.jsxs)("button",{type:"button","data-subagent-badge":a.id,"data-subagent-state":a.state,"data-chip-keepout":!0,"data-scheme-ui":!0,"aria-expanded":s,"aria-disabled":o,"aria-label":a.title,title:b,className:`pointer-events-auto absolute flex max-w-[220px] items-center overflow-hidden rounded-full border border-card bg-card text-left shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55 ${s?"z-[70] w-[220px]":"z-[6] w-[30px]"} ${f?"opacity-45 grayscale":""} ${o?"cursor-default":"cursor-pointer hover:shadow-2"}`,style:{...i,transform:s?"scale(var(--inv-z, 1))":void 0,transformOrigin:"15px center"},onMouseEnter:()=>p(a.id),onMouseLeave:()=>p(e=>e===a.id?null:e),onFocus:()=>p(a.id),onBlur:()=>p(e=>e===a.id?null:e),onPointerUp:e=>{"touch"!==e.pointerType||o||(e.preventDefault(),m.current=!0,s?r(a.path):p(a.id))},onClick:()=>{if(m.current){m.current=!1;return}o||r(a.path)},children:[(0,F.jsxs)("span",{className:"relative z-[1] inline-flex h-[30px] w-[30px] shrink-0 items-center justify-center rounded-full text-[9px] font-black tracking-[-0.04em] text-white",style:{background:`linear-gradient(135deg, oklch(72% 0.17 ${h}), oklch(48% 0.2 ${(h+58)%360}))`},"aria-hidden":!0,children:[((t=a.title.trim().split(/\s+/).filter(Boolean)).length>1?t[0][0]+t.at(-1)[0]:t[0]?.slice(0,2)||"AI").toUpperCase(),x?(0,F.jsx)("span",{"data-subagent-ring":"working",className:"absolute inset-[-2px] rounded-full ring-2 ring-success/70 animate-pulse motion-reduce:animate-none"}):null,"silent"===a.state?(0,F.jsx)("span",{"data-subagent-ring":"silent",className:"absolute inset-[-2px] rounded-full ring-2 ring-warning"}):null]}),(0,F.jsx)("span",{className:`min-w-0 truncate px-2.5 text-[11px] font-semibold text-primary ${s?"opacity-100":"opacity-0"}`,children:a.title})]})]},a.id)})}):null}function gf(e){let t=e.split("\n",1)[0]??"";return(0,tt.cr)(t,60)}function gh(e,t,n){let r=Math.max(1,Math.floor((n+16)/148)),i=Math.floor(e/r);return{x:e%r*148,y:t+76*i,w:132,h:60}}let gx={w:390,h:620},gg=[];function gb(e,t,n){return Math.min(n,Math.max(t,e))}function gv(e,t){let n=Math.max(t.w-56-40,1),r=Math.max(t.h-56-40,1),i=Math.min(n/e.w,r/e.h,1.6),a=e.w*i+40,s=e.h*i+40;return{z:i,tx:28+(t.w-56-a)/2-e.x*i,ty:28+(t.h-56-s)/2-e.y*i}}function gw({layout:e,tasks:t,workerStacks:n,pipelineOutlines:r=gg,frame:i,ringKey:a,onPick:s}){let{t:l}=(0,er.Ym)(),o=(0,B.useMemo)(()=>(function(e,t,n,r=null,i=[]){var a,s;let l,o,c=[];for(let t of e.nodes)c.push({key:t.file.path,kind:"node",rect:{x:t.x,y:t.y,w:t.w,h:t.h},title:(0,tt.cr)(t.file.title,60),pickKey:t.file.path,isRoot:t.isRoot,file:t.file});for(let t of e.decks)c.push({key:t.key,kind:"deck",rect:{x:t.x,y:t.y,w:t.w,h:t.h},title:gf(t.flow.id),pickKey:t.key,isRoot:!1,count:t.rounds.length});for(let t of e.drafts)c.push({key:t.key,kind:"draft",rect:{x:t.x,y:t.y,w:t.w,h:t.h},title:t.id,pickKey:t.key,isRoot:!0});for(let t of e.stacks){let e=t.items[0]?.file??null;c.push({key:t.key,kind:"stack",rect:{x:t.x,y:t.y,w:t.w,h:t.h},title:e?(0,tt.cr)(e.title,40):"",pickKey:e?e.path:null,isRoot:!1,count:t.items.length})}for(let e of i)c.push({key:"pipeline::"+e.id,kind:"pipeline",rect:e.rect,title:e.title,pickKey:null,isRoot:!0});let d=Math.max(e.width,1),u=Math.max(e.height,0)+48;n.forEach((e,t)=>{let n=e.items[0]??null;c.push({key:"worker::"+e.key,kind:"worker",rect:gh(t,u,d),title:e.id,pickKey:n?n.path:null,isRoot:!1,count:e.items.length})}),n.length&&(u+=(a=n.length,76*Math.ceil(a/Math.max(1,Math.floor((d+16)/148)))+16));let p=[];for(let e of t)e.pos?c.push({key:"task::"+e.id,kind:"task",rect:{x:e.pos.x,y:e.pos.y,w:132,h:60},title:gf(e.text),pickKey:"task::"+e.id,isRoot:!1}):p.push(e);p.forEach((e,t)=>{c.push({key:"task::"+e.id,kind:"task",rect:gh(t,u,d),title:gf(e.text),pickKey:"task::"+e.id,isRoot:!1})});let m=c.slice(0,400),f=c.slice(400);if(r){let e=f.findIndex(e=>e.key===r);if(e>=0){let t=f.splice(e,1)[0],n=m.pop();m.push(t),n&&f.unshift(n)}}let h=function(e){if(!e.length)return[];let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.rect.x),n=Math.min(n,a.rect.y),r=Math.max(r,a.rect.x+a.rect.w),i=Math.max(i,a.rect.y+a.rect.h);let a=Math.max((r-t)/6,1),s=Math.max((i-n)/6,1),l=new Map;for(let r of e){let e=Math.min(5,Math.floor((r.rect.x-t)/a)),i=Math.min(5,Math.floor((r.rect.y-n)/s)),o=e+":"+i,c=l.get(o)??{count:0,x:t+e*a,y:n+i*s};c.count+=1,l.set(o,c)}return[...l.entries()].map(([e,t])=>({key:"cluster::"+e,count:t.count,rect:{x:t.x,y:t.y,w:a,h:s}}))}(f),x=new Set(m.map(e=>e.key)),g=m.filter(e=>"node"===e.kind).map(e=>e.rect),b=[];for(let t of e.edges)if(x.has(t.to)&&g.some(e=>{var n,r,i;return n=e,r=t.x1,i=t.y1,r>=n.x&&r<=n.x+n.w&&i>=n.y&&i<=n.y+n.h})&&(b.push({x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),b.length>=400))break;let v=[{x:0,y:0,w:Math.max(e.width,1),h:Math.max(e.height,u,1)},...m.map(e=>e.rect),...h.map(e=>e.rect)],w=Math.min(...v.map(e=>e.x)),y=Math.min(...v.map(e=>e.y)),k=Math.max(...v.map(e=>e.x+e.w)),j=Math.max(...v.map(e=>e.y+e.h)),N=r?c.find(e=>e.key===r)?.rect??null:null,S=[...i.map(e=>e.rect),...N?[N]:[]];return{markers:m,edges:b,clusters:h,world:{x:w,y:y,w:Math.max(k-w,1),h:Math.max(j-y,1)},current:S.length?(l=Math.min(...(s=S).map(e=>e.x)),{x:l,y:o=Math.min(...s.map(e=>e.y)),w:Math.max(...s.map(e=>e.x+e.w))-l,h:Math.max(...s.map(e=>e.y+e.h))-o}):null,total:c.length}})(e,t,n,a,r),[e,t,n,a,r]),c="current"===i?o.current:null,d=(0,B.useRef)(null),[u,p]=(0,B.useState)(gx),[m,f]=(0,B.useState)(!1),[h,x]=(0,B.useState)(()=>gv(o.world,gx)),{x:g,y:b,w:v,h:w}=o.world,{w:y,h:k}=u,j=c?.x??null,N=c?.y??null,S=c?.w??null,C=c?.h??null,A=(0,B.useMemo)(()=>gv({x:g,y:b,w:v,h:w},{w:y,h:k}),[g,b,v,w,y,k]),I=(0,B.useMemo)(()=>{var e,t;let n,r,i,a,s;return null===j||null===N||null===S||null===C?null:(e={x:j,y:N,w:S,h:C},n=Math.max((t={w:y,h:k}).w-56,1),r=Math.max(t.h-56,1),i=Math.min(n/Math.max(e.w,1),r/Math.max(e.h,1),1),a=e.x+e.w/2,s=e.y+e.h/2,{z:i,tx:t.w/2-a*i,ty:t.h/2-s*i})},[j,N,S,C,y,k])??A,M=Math.min(.15,I.z);(0,B.useEffect)(()=>{let e=d.current;if(!e)return;let t=()=>{let t=e.clientWidth||gx.w,n=e.clientHeight||gx.h;p(e=>e.w===t&&e.h===n?e:{w:t,h:n})};t();let n=globalThis.ResizeObserver;if(!n)return;let r=new n(t);return r.observe(e),()=>r.disconnect()},[]),(0,B.useEffect)(()=>{let e=requestAnimationFrame(()=>f(!0));return()=>cancelAnimationFrame(e)},[]),(0,B.useEffect)(()=>{x(I)},[i,I]);let T=(0,B.useRef)(new Map),$=(0,B.useRef)(null),E=e=>{T.current.delete(e.pointerId),T.current.size<2&&($.current=null)};return(0,F.jsx)("div",{ref:d,"data-testid":"mobile-map",className:"relative min-h-0 flex-1 touch-none overflow-hidden bg-canvas",onPointerDown:e=>{e.currentTarget.setPointerCapture?.(e.pointerId),T.current.set(e.pointerId,{x:e.clientX,y:e.clientY})},onPointerMove:e=>{let t=T.current.get(e.pointerId);if(!t)return;let n={x:e.clientX,y:e.clientY};if(T.current.set(e.pointerId,n),T.current.size>=2){let[e,t]=[...T.current.values()],n=Math.hypot(e.x-t.x,e.y-t.y);if($.current){if($.current.dist>0){let e=gb($.current.z*(n/$.current.dist),M,1.6);x(t=>({...t,z:e}))}}else $.current={dist:n,z:h.z};return}x(e=>({...e,tx:e.tx+(n.x-t.x),ty:e.ty+(n.y-t.y)}))},onPointerUp:E,onPointerCancel:E,onWheel:e=>{let t=Math.exp(-(.0015*e.deltaY));x(n=>{let r=gb(n.z*t,M,1.6),i=d.current?.getBoundingClientRect(),a=i?e.clientX-i.left:u.w/2,s=i?e.clientY-i.top:u.h/2,l=(a-n.tx)/n.z,o=(s-n.ty)/n.z;return{z:r,tx:a-l*r,ty:s-o*r}})},role:"application","aria-label":l("mobile.map"),children:m?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("svg",{className:"pointer-events-none absolute inset-0 h-full w-full","aria-hidden":!0,children:(0,F.jsx)("g",{transform:`translate(${h.tx} ${h.ty}) scale(${h.z})`,children:o.edges.map((e,t)=>(0,F.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,className:"stroke-border",strokeWidth:2/h.z},t))})}),o.markers.map(e=>(0,F.jsx)(gy,{marker:e,camera:h,active:e.key===a,onPick:s},e.key)),o.clusters.map(e=>{let t=e.rect.x*h.z+h.tx,n=e.rect.y*h.z+h.ty;return(0,F.jsxs)("span",{"data-testid":"mobile-map-cluster",className:"pointer-events-none absolute flex h-6 min-w-6 items-center justify-center rounded-full border border-border bg-sunken px-1.5 text-[10px] font-bold text-muted",style:{left:t,top:n},children:["+",e.count]},e.key)})]}):(0,F.jsx)("div",{"data-testid":"mobile-map-skeleton",className:"absolute inset-0 flex flex-col gap-2 p-4","aria-label":l("mobile.mapLoading"),children:Array.from({length:5}).map((e,t)=>(0,F.jsx)("span",{className:"h-8 w-2/3 animate-pulse rounded-[8px] bg-sunken",style:{opacity:1-.15*t},"aria-hidden":!0},t))})})}function gy({marker:e,camera:t,active:n,onPick:r}){let{t:i}=(0,er.Ym)(),a=e.rect.x*t.z+t.tx,s=e.rect.y*t.z+t.ty,l=Math.max(e.rect.w*t.z,40),o=Math.max(e.rect.h*t.z,40),c=e.file?(0,tt.yz)(e.file):null,d=e.title||i(`mobile.marker.${e.kind}`),u=null===e.pickKey;return(0,F.jsxs)("button",{type:"button","data-testid":"mobile-map-marker","data-map-key":e.pickKey??"","data-map-kind":e.kind,disabled:u,onClick:()=>e.pickKey&&r(e.pickKey),"aria-label":i("mobile.marker.open",{title:d}),className:`absolute flex flex-col justify-center gap-0.5 overflow-hidden rounded-[8px] border px-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"border-accent bg-accent/10":"draft"===e.kind?"border-dashed border-border bg-canvas":"border-border bg-card"} ${u?"opacity-60":""}`,style:{left:a,top:s,width:l,height:o,minWidth:40,minHeight:40},children:[(0,F.jsxs)("span",{className:"flex items-center gap-1",children:[e.file?(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(e.file.activity)}`,"aria-hidden":!0}):null,c?(0,F.jsx)("span",{className:"shrink-0 rounded px-1 text-[8px] font-bold",style:c.style,children:c.label}):null,e.count?(0,F.jsx)("span",{className:"shrink-0 rounded-full bg-sunken px-1 text-[8px] font-bold text-muted",children:e.count}):null]}),(0,F.jsx)("span",{className:"truncate text-[9px] font-semibold text-primary",children:d})]})}let gk={waiting:5,stalled:4,live:3,returned:2,done:1},gj=new Set;function gN({project:e,projectName:t,groups:n,manual:r,files:i,flows:a,reviewGroups:s=[],pipelines:l,surfacePipelines:o=[],workerStacks:c=[],tasks:d,sheetTasks:u,drafts:p,favorites:m,isolatedManualPaths:f=gj,loaded:h,focus:x,onSelect:g,onClose:b,onDraftClose:v,onDraftSpawned:w,onActiveChange:y,taskSheetNonce:k=0,trayApi:j}){let N,{t:S}=(0,er.Ym)(),C=rL(e),[A,I]=(0,B.useState)(null),[M,T]=(0,B.useState)(!1),[$,E]=(0,B.useState)(!1),[R,P]=(0,B.useState)("all"),[O,D]=(0,B.useState)(null);(0,B.useEffect)(()=>{k>0&&D("new")},[k]);let L=(0,B.useRef)(null),_=(0,B.useRef)(null),q=(0,B.useRef)(null),[z,H]=(0,B.useState)({left:!1,right:!1}),K=(0,B.useCallback)(()=>{let e=q.current;if(!e)return;let t=e.scrollLeft>4,n=e.scrollLeft+e.clientWidth<e.scrollWidth-4;H(e=>e.left===t&&e.right===n?e:{left:t,right:n})},[]),Y=(0,B.useMemo)(()=>s.length?[...a,...s]:a,[a,s]),W=(0,B.useMemo)(()=>dl(l,Y),[l,Y]),J=(0,B.useMemo)(()=>hU(n,r,i,W,p,l,o,m,f),[n,r,i,W,p,l,o,m,f]),V=(0,B.useMemo)(()=>{let e=o.filter(e=>"completed"!==e.state&&"closed"!==e.state),t=J.nodes.map(e=>({x:e.x,y:e.y,w:e.w,h:e.h,path:e.file.path,conversationId:e.file.conversationId})),n=d.filter(hg).map(e=>hj(e,!1)),r=function(e,t,n,r,i=new Map){let a=[...e].sort((e,t)=>e.createdAt<t.createdAt?-1:e.createdAt>t.createdAt?1:e.id.localeCompare(t.id)),s=new Map,l=new Map,o=[...r],c=new Map;for(let e of a){let t=e.pos;if(!t)continue;let n={...t,w:360,h:76};l.set(e.id,n),o.push(n)}for(let e of a){if(e.pos)continue;let r=function(e,t,n){let r,i=e.taskIds??[],a=new Map(t.map(e=>[e.id,e])),s=i.map(e=>a.get(e)).find(e=>void 0!==e)??null;if(s?.pos)return{x:s.pos.x+260+32,y:s.pos.y};let l=s?null:(r=hB(e),t.find(e=>!!(e.source&&r.paths.has(e.source.path)||e.assignments.some(e=>!!(e.path&&r.paths.has(e.path)||e.conversationId&&r.conversationIds.has(e.conversationId)))))??null);if(l?.pos)return{x:l.pos.x+260+32,y:l.pos.y};let o=hB(e),c=n.filter(e=>o.paths.has(e.path)||!!(e.conversationId&&o.conversationIds.has(e.conversationId)));if(c.length){let e=c.reduce((e,t)=>({x:e.x+t.x+t.w/2,y:e.y+t.y+t.h/2}),{x:0,y:0});return{x:Math.round(e.x/c.length),y:Math.round(e.y/c.length)}}let d=Math.max(0,...t.flatMap(e=>e.pos?[e.pos.x+260]:[]),...n.map(e=>e.x+e.w)),u=function(e){let t=0x811c9dc5;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,0x1000193);return t>>>0}(e.id),p=Math.floor(u/4)%12;return{x:24*Math.ceil((d+144)/24)+u%4*384,y:120+100*p}}(e,t,n),i=`${r.x}:${r.y}`,a=c.get(i)??0;c.set(i,a+76+24);let s={...hx({x:r.x,y:r.y+a},{w:360,h:76},o),w:360,h:76};l.set(e.id,s),o.push(s)}let d=[...o];for(let e of a){let t=l.get(e.id);if(!((i.get(e.id)??76)>76)){s.set(e.id,{...t,header:t,body:null,bounds:t,direction:"collapsed"});continue}let n=d.filter(e=>e!==t),{body:r,direction:a}=function(e,t){let n={w:360,h:444},r=(t,r)=>"down"===t?{x:e.x,y:e.y+e.h+r,...n}:"up"===t?{x:e.x,y:e.y-n.h-r,...n}:"right"===t?{x:e.x+e.w+r,y:e.y,...n}:{x:e.x-n.w-r,y:e.y,...n},i=["down","up","right","left"];for(let e=0;e<=40;e+=1)for(let n of i){let i=r(n,24*e);if(!function(e,t){return t.some(t=>e.x<t.x+t.w+16&&e.x+e.w+16>t.x&&e.y<t.y+t.h+16&&e.y+e.h+16>t.y)}(i,t))return{body:i,direction:n}}return{body:{...hx(r("right",984),n,t),...n},direction:"free"}}(t,n);d.push(r);let o=function(e){let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,w:Math.max(...e.map(e=>e.x+e.w))-t,h:Math.max(...e.map(e=>e.y+e.h))-n}}([t,r]);s.set(e.id,{...o,header:t,body:r,bounds:o,direction:a})}return s}(e,d,t,[...J.nodes,...J.decks,...J.stacks,...J.drafts,...J.slots,...n]);return e.flatMap(e=>{let t=r.get(e.id);return t?[{id:e.id,title:e.task,rect:t.bounds}]:[]})},[o,J,d]),G=(0,B.useMemo)(()=>[...J.nodes.map(e=>({key:e.file.path,file:e.file,isRoot:e.isRoot,kind:"node"})),...J.decks.map(e=>({key:e.key,file:null,isRoot:!1,kind:"deck"})),...J.drafts.map(e=>({key:e.key,file:null,isRoot:!0,kind:"draft"}))],[J]),X=(0,B.useMemo)(()=>new Map(G.map(e=>[e.key,e])),[G]),Q=(0,B.useMemo)(()=>gd(J,e,{aliases:gc(l)}),[J,e,l]);(0,B.useEffect)(()=>r3.setBoard({project:e,index:Q,moveTo:({anchorKeys:e})=>{let t=e.find(e=>X.has(e));return!!t&&(I(t),T(!1),!0)},restoreCamera:()=>!1}),[e,Q,X]),(0,B.useEffect)(()=>{I(sessionStorage.getItem("llvFocus:"+e)),T(!1)},[e]),(0,B.useEffect)(()=>{x&&(I(x),T(!1))},[x]);let Z=(0,B.useMemo)(()=>{if(A&&X.has(A))return A;let e=null,t=-1;for(let n of G){if(!n.file)continue;let r=1e12*gk[tl(n.file)]+n.file.mtime;r>t&&(t=r,e=n)}return(e??G[0])?.key??null},[A,X,G]);(0,B.useEffect)(()=>{A&&X.has(A)?sessionStorage.setItem("llvFocus:"+e,A):!A&&Z&&sessionStorage.setItem("llvFocus:"+e,Z)},[A,X,Z,e]),(0,B.useEffect)(()=>{_.current?.scrollIntoView({block:"nearest",inline:"nearest"}),K()},[Z,G,K]);let ee=(0,B.useMemo)(()=>J.nodes.find(e=>e.file.path===Z)??null,[J,Z]),et=(0,B.useMemo)(()=>J.decks.find(e=>e.key===Z)??null,[J,Z]),en=(0,B.useMemo)(()=>J.drafts.find(e=>e.key===Z)??null,[J,Z]);(0,B.useEffect)(()=>{y?.(ee?.file??null)},[ee,y]),(0,B.useEffect)(()=>()=>y?.(null),[y]);let ei=(0,B.useMemo)(()=>new Set(J.groups.filter(e=>"pipeline"===e.kind&&e.pipeline).map(e=>e.id)),[J.groups]),ea=(0,B.useMemo)(()=>{let e,t;return t=new Set([...(e=function(e,t){let n=[],r=[];for(let i of e)("closed"!==i.state||i.restored)&&(t.has(i.id)?n.push(i):r.push(i));return{memberful:n,shelf:r}}(o,ei)).memberful,...e.shelf].map(e=>e.id)),o.filter(e=>t.has(e.id))},[o,ei]);(0,B.useEffect)(()=>{let e=ee?ee.file.path:null,t=J.nodes.map(e=>e.file.path),n=M?t.slice(0,128):ee?[ee.file.path]:[];rW.reportSlice({mode:M?"mobile-map":"mobile-focus",focusedPath:e,selectedPaths:rU(t,C.selection,{includeUnordered:!0}),visiblePaths:n,camera:null})},[ee,M,J,C.selection]);let el=function(e,t,n){if(!t&&!n)return null;for(let r of e){if("closed"===r.state)continue;let e=r.stages.findIndex(e=>{let i=c3(r,e.id);return!!i&&(!!t&&i.agentPath===t||!!(n&&i.flowId===n))});if(e>=0)return{pipeline:r,index:e}}return null}(l,ee?ee.file.path:null,et?et.flow.id:null),eo=(0,B.useMemo)(()=>new Set(i.map(e=>e.path)),[i]),ec=(0,B.useMemo)(()=>dm(W,new Set(J.nodes.map(e=>e.file.path))),[W,J]),ed=(0,B.useMemo)(()=>new Map(l.map(e=>[e.id,dd(e,u??d,a,i)])),[l,u,d,a,i]),eu=(0,B.useMemo)(()=>xR(i,u??d),[i,u,d]),ep=(0,B.useCallback)(e=>{let t=i.find(t=>t.path===e);t&&g(t)},[i,g]),em=(0,B.useCallback)(e=>D({taskId:e.id}),[]),ef=(0,B.useCallback)(e=>{let t=dY(e);X.has(t)&&I(t)},[X]),eh=(0,B.useCallback)(e=>{if(!G.length)return;let t=G.findIndex(e=>e.key===Z),n=G[Math.min(G.length-1,Math.max(0,(-1===t?0:t)+e))];n&&n.key!==Z&&I(n.key)},[G,Z]),ex=(0,B.useCallback)(e=>{if(T(!1),e.startsWith("task::"))return void D({taskId:e.slice(6)});if(X.has(e))return void I(e);let t=i.find(t=>t.path===e);t&&g(t)},[X,i,g]);return(0,F.jsxs)("div",{"data-testid":"mobile-chat-shell","data-chat-min-share":.6,className:"relative flex h-full max-h-[100dvh] min-h-0 min-w-0 max-w-[100dvw] flex-1 flex-col overflow-hidden overflow-x-clip",children:[(0,F.jsx)(oG,{compact:!0}),(0,F.jsxs)("div",{className:"flex shrink-0 items-stretch border-b border-border bg-card",children:[G.length>1||el?(0,F.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,F.jsxs)("div",{ref:q,onScroll:K,className:"no-scrollbar flex items-center gap-1.5 overflow-x-auto px-2 py-1",children:[el?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(gS,{pipeline:el.pipeline,index:el.index,flows:a,files:i,renderableFlows:ec,renderablePaths:eo,onHop:e=>{if(!el)return;let t=el.pipeline.stages[e];if(!t)return;let n=dx(t,c3(el.pipeline,t.id),a,ec,eo,i);if(n){if("flow"===n.kind){let e=dY(n.flowId);X.has(e)&&I(e);return}ep(n.path)}},onOpenPath:ep}),G.length>1?(0,F.jsx)("span",{"aria-hidden":!0,className:"mx-0.5 h-7 w-px shrink-0 bg-border"}):null]}):null,G.length>1?G.map(e=>(0,F.jsx)(gC,{entry:e,active:e.key===Z,chipRef:e.key===Z?_:void 0,onClick:()=>I(e.key)},e.key)):null]}),(0,F.jsx)("span",{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-0 w-6 bg-gradient-to-r from-card to-transparent transition-opacity ${z.left?"opacity-100":"opacity-0"}`}),(0,F.jsx)("span",{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 right-0 w-6 bg-gradient-to-l from-card to-transparent transition-opacity ${z.right?"opacity-100":"opacity-0"}`})]}):(0,F.jsx)("span",{className:"min-w-0 flex-1","aria-hidden":!0}),(0,F.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-l border-border px-1.5",children:[(ee||et||en)&&ea.length?(0,F.jsx)(gi,{pipelines:ea,onOpen:()=>E(!0)}):null,!function(e,t,n=0){return e>1||t>0||n>0}(J.nodes.length,c.length,V.length)?null:(0,F.jsx)("button",{type:"button",className:"inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-[8px] text-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":S("mobile.openMap"),onClick:()=>{P("all"),T(!0)},children:(0,F.jsx)(xS.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsxs)("button",{type:"button",className:"inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-[8px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":S("tasks.panelToggleAria"),onClick:()=>D("list"),children:[(0,F.jsx)(cx.A,{className:"h-4 w-4 text-accent","aria-hidden":!0}),(u??d).filter(e=>"done"!==e.status).length?(0,F.jsx)("span",{className:"rounded-full bg-accent/10 px-1 text-[10px] font-bold text-accent",children:(u??d).filter(e=>"done"!==e.status).length}):null]})]})]}),(0,F.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col pt-1 pl-[max(0.375rem,env(safe-area-inset-left))] pr-[max(0.375rem,env(safe-area-inset-right))] pb-[max(0.375rem,env(safe-area-inset-bottom))]",children:[ee?(0,F.jsxs)("div",{"data-testid":"mobile-focused-pane",className:"flex min-h-0 min-w-0 flex-1 flex-col gap-1",children:[(0,F.jsx)("div",{className:"flex min-h-0 min-w-0 flex-1",children:(0,F.jsx)(fF,{file:ee.file,tasks:ee.tasks,isRoot:ee.isRoot,showFavorite:!0,onClose:()=>b(ee.file.path),dragHandle:{onTouchStart:e=>{let t=e.touches[0];t&&(L.current={x:t.clientX,y:t.clientY})},onTouchEnd:e=>{let t=L.current;L.current=null;let n=e.changedTouches[0];if(!t||!n)return;let r=n.clientX-t.x,i=n.clientY-t.y;56>Math.abs(r)||Math.abs(r)<2*Math.abs(i)||eh(r<0?1:-1)}},relatedTasks:eu.get(ee.file.path),onOpenTask:em})}),(N=j?.trays.get(U(ee.file)))?(0,F.jsx)(gl,{tray:N,variant:"inline",onToggleExpanded:e=>j.onToggleExpanded(N.parentConversationId,e),onOpenMember:j.onOpenMember,onUnfold:j.onUnfold}):null]},ee.file.path):et?(0,F.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,F.jsx)(x_,{flow:et.flow,rounds:et.rounds,focusRound:null,groupLabel:i.find(e=>e.path===et.flow.implementerPath)?.title})},et.key):en?nb(en.id)?(0,F.jsx)(xd,{draftId:en.id,project:e,onClose:()=>v(en.id),onLaunched:()=>v(en.id)},en.key):(0,F.jsx)(hc,{draftId:en.id,project:e,files:i,onClose:()=>v(en.id),onSpawned:e=>w(en.id,e)},en.key):h?ea.length?(0,F.jsx)("div",{className:"flex min-h-0 flex-1 flex-col divide-y divide-border overflow-y-auto",children:ea.map(e=>(0,F.jsx)(ge,{pipeline:e,flows:a,files:i,renderablePaths:eo,renderableFlows:ec,linkedTasks:ed.get(e.id)??[],onOpenPath:ep,onOpenFlow:ef,onOpenTask:em},e.id))}):(0,F.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-muted",children:S("mobile.noConvos")}):(0,F.jsxs)("div",{className:"flex flex-1 items-center justify-center gap-2 text-center text-[13px] text-muted",children:[(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),S("common.loading")]}),ee?(0,F.jsx)("div",{"data-testid":"mobile-subagent-rail",className:"pointer-events-none absolute bottom-20 left-2 z-[20]",style:{width:0,height:432},children:(0,F.jsx)(gm,{conversationId:U(ee.file),entries:i,cardRect:{x:0,y:0,w:0,h:432},onNavigate:e=>{let t=i.find(t=>t.path===e);t&&g(t)}})}):null]}),M?(0,F.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-canvas pb-[env(safe-area-inset-bottom)]",children:[(0,F.jsxs)("div",{className:"flex min-h-[52px] shrink-0 items-center gap-2 border-b border-border bg-card px-2 py-1.5",children:[(0,F.jsx)("span",{className:"shrink-0 pl-1 text-[13px] font-bold",children:S("mobile.map")}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-muted",children:es(e,t)}),(0,F.jsx)("div",{role:"group",className:"flex shrink-0 rounded-full border border-border bg-canvas p-0.5","aria-label":S("mobile.mapFrame"),children:["all","current"].map(e=>(0,F.jsx)("button",{type:"button","aria-pressed":R===e,className:`min-h-11 rounded-full px-3 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${R===e?"bg-card text-accent shadow-1":"text-muted"}`,onClick:()=>P(e),children:S("all"===e?"mobile.mapAll":"mobile.mapCurrent")},e))}),(0,F.jsx)("button",{type:"button",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":S("mobile.closeMap"),onClick:()=>T(!1),children:(0,F.jsx)(i9.X,{className:"h-5 w-5","aria-hidden":!0})})]}),(0,F.jsx)(gw,{layout:J,tasks:d,workerStacks:c,pipelineOutlines:V,frame:R,ringKey:Z,onPick:ex}),ea.length?(0,F.jsx)(gr,{pipelines:ea,onOpen:()=>E(!0)}):null,(0,F.jsx)("div",{className:"shrink-0 border-t border-border bg-card px-3 py-1.5 text-center text-[11px] text-muted",children:S("mobile.tapNode")})]}):null,$&&ea.length?(0,F.jsx)(ga,{pipelines:ea,render:{flows:a,files:i,renderablePaths:eo,renderableFlows:ec,linkedTasksByPipeline:ed,onOpenPath:ep,onOpenFlow:ef,onOpenTask:em},onClose:()=>E(!1)}):null,O?(0,F.jsx)(xE,{project:e,projectName:t,tasks:u??d,files:i,initialView:O,onClose:()=>D(null)}):null]})}function gS({pipeline:e,index:t,flows:n,files:r,renderableFlows:i,renderablePaths:a,onHop:s,onOpenPath:l}){let{t:o}=(0,er.Ym)(),[c,d]=(0,B.useState)(!1),u=e.stages.length,p=e.stages[t],m=dp(e,p),f=de[m],h=t>0?e.stages[t-1]:null,x=t<u-1?e.stages[t+1]:null,g=!!h&&!!dx(h,c3(e,h.id),n,i,a,r),b=!!x&&!!dx(x,c3(e,x.id),n,i,a,r),v=c3(e,p.id),w=o(`pipelineChipState.${m}`),y=h?dy(o,h):"",k=h?o(`pipelineChipState.${dp(e,h)}`):"",j=x?dy(o,x):"",N=x?o(`pipelineChipState.${dp(e,x)}`):"",S=db(e,p,v)||dv(e,p,v,n,a,r),C=!!(v?.flowId&&i.has(v.flowId)),A=!!(v?.agentPath&&a.has(v.agentPath));return(0,F.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",role:"group","aria-label":o("pipelineMobile.chipAria",{task:e.task}),"data-testid":"mobile-pipeline-focus-row",children:[(0,F.jsxs)("span",{className:"shrink-0 rounded-full bg-sunken px-1.5 py-1 text-[10px] font-bold text-muted","aria-hidden":!0,children:["⇢ ",o("pipelineMobile.position",{k:t+1,n:u})]}),h?(0,F.jsxs)("button",{type:"button",disabled:!g,onClick:()=>s(t-1),"aria-label":o("pipelineMobile.prevStage",{label:y,state:k}),className:"inline-flex h-11 shrink-0 items-center rounded-full border border-border bg-card px-3 text-[11px] font-bold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30",children:["‹ ",dy(o,h)]}):null,(0,F.jsxs)("button",{type:"button",disabled:!S,onClick:()=>d(!0),"aria-haspopup":"dialog","aria-label":o("pipelineMobile.openVerdict",{label:dy(o,p),state:w}),className:"inline-flex h-11 shrink-0 items-center gap-1 rounded-full px-3 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-default",style:{backgroundColor:f.soft,color:f.color},children:[(0,F.jsx)("span",{"aria-hidden":!0,children:"review-loop"===p.kind?"⟳":"▸"}),dy(o,p),dt[m]?(0,F.jsx)("span",{"aria-hidden":!0,children:dt[m]}):null,(0,F.jsx)("span",{className:"text-[9px] font-semibold opacity-80",children:o(`pipelineChipState.${m}`)}),v?.verdict?(0,F.jsx)("span",{"aria-hidden":!0,children:"pass"===v.verdict.status?"✓":"fail"===v.verdict.status?"✕":"●"}):null]}),x?(0,F.jsxs)("button",{type:"button",disabled:!b,onClick:()=>s(t+1),"aria-label":o("pipelineMobile.nextStage",{label:j,state:N}),className:"inline-flex h-11 shrink-0 items-center rounded-full border border-border bg-card px-3 text-[11px] font-bold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30",children:[dy(o,x)," ›"]}):null,c&&v?(0,F.jsx)("div",{className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/40",role:"presentation",onClick:e=>{e.target===e.currentTarget&&d(!1)},children:(0,F.jsxs)("div",{className:"mb-0 w-full max-w-[420px] rounded-t-[16px] bg-card p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-2",children:[(0,F.jsx)("div",{className:"mx-auto mb-2 h-1 w-10 rounded-full bg-border","aria-hidden":!0}),(0,F.jsx)(xz,{pipeline:e,stage:p,attempt:v,flows:n,files:r,availablePaths:a,mobile:!0,canOpenFlow:C,canOpenPath:A,onClose:()=>d(!1),onOpenPath:e=>{d(!1),l(e)}})]})}):null]})}function gC({entry:e,active:t,chipRef:n,onClick:r}){let{t:i}=(0,er.Ym)();if(!e.file){let a="deck"===e.kind;return(0,F.jsxs)("button",{ref:n,type:"button",className:`flex h-11 shrink-0 items-center gap-1 rounded-full border px-3 text-[11px] font-semibold ${t?"border-accent/60 bg-accent/10 text-primary":"border-dashed border-border bg-canvas text-muted"}`,onClick:r,children:[(0,F.jsx)("span",{className:"text-[13px] leading-none text-accent",children:a?"R":"+"})," ",i(a?"scheme.flow":"mobile.agent")]})}let a=e.file,s=tl(a),l="waiting"===s||"stalled"===s,o=(0,tt.yz)(a),c=(0,tt.cr)(a.title,60);return(0,F.jsxs)("button",{ref:n,type:"button",className:`flex h-11 shrink-0 items-center gap-1.5 rounded-full border px-3 text-[11px] font-semibold ${t?"border-accent/60 bg-accent/10 text-primary":l?"border-warning/60 bg-warning-soft text-warning":"border-border bg-canvas text-muted"}`,title:c,onClick:r,children:[(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(a.activity)}`}),e.isRoot?null:(0,F.jsx)("span",{"aria-hidden":!0,children:"⤷"}),t?(0,F.jsx)("span",{className:"max-w-[52vw] truncate",children:c}):(0,F.jsxs)("span",{children:[l?"⏸ ":"",o.label]})]})}var gA=n(8617),gI=n(9805);function gM(e){return("claude-projects"===e.root||"codex-sessions"===e.root)&&e.path.endsWith(".jsonl")}function gT({file:e,onHandoff:t,inline:n=!1}){let{t:r}=(0,er.Ym)(),i=function(e){let{t}=(0,er.Ym)();return ue({exclude:e.path,onDragStart:void 0,onDrop:n=>(oD(U(n.file),t("link.handoffContext",{title:(0,tt.cr)(e.title,80),path:e.path,ask:""}).trimEnd()+"\n\n"),t("link.dropped",{title:(0,tt.cr)(n.file.title,48)}))})}(e);return n?(0,F.jsxs)("span",{"data-scheme-ui":!0,className:"inline-flex shrink-0 pl-1.5",children:[(0,F.jsxs)("button",{type:"button","aria-label":r("handoff.aria"),title:r("handoff.title"),onPointerDown:i.onPillPointerDown,onClick:()=>{i.consumeClick()||t()},className:"flex min-h-11 w-full touch-none items-center justify-center gap-1.5 rounded-[8px] border border-border bg-card text-[12px] font-semibold text-muted shadow-1 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)(gA.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),r("handoff.label")]}),i.overlay]}):(0,F.jsxs)("div",{"data-scheme-ui":!0,className:"group absolute -bottom-11 left-2 z-[2]",children:[(0,F.jsxs)("button",{type:"button","aria-label":r("handoff.aria"),title:r("handoff.title"),onPointerDown:i.onPillPointerDown,onClick:()=>{i.consumeClick()||t()},className:"flex h-7 touch-none items-center gap-1.5 rounded-full border border-border bg-card px-2 text-muted shadow-1 transition-[border-color,color] duration-150 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)(gA.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:"max-w-[0px] overflow-hidden whitespace-nowrap text-[11px] font-semibold transition-[max-width] duration-200 group-hover:max-w-[180px] group-focus-within:max-w-[180px]",children:r("handoff.label")}),(0,F.jsx)(gI.A,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),i.overlay]})}var g$=n(1906),gE=n(1285),gR=n(6900),gP=n(5085),gO=n(5367),gD=n(4215);async function gL(e,t,n){let r=[];for(let i of e){try{let e=await t(i);r.push(e.ok?{path:i,ok:!0}:{path:i,ok:!1,error:e.error})}catch(e){r.push({path:i,ok:!1,error:e instanceof Error?e.message:String(e)})}n?.(r,e[r.length]??null)}return r}function gF(e){return null!==e.file.pid}function g_(e){return e.isRoot}let gq={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};async function gz(e,t){let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return{ok:!0};let r=await n.json().catch(()=>null);return{ok:!1,error:r?.error??`HTTP ${n.status}`}}function gH({icon:e,label:t,disabled:n,confirming:r,confirmLabel:i,onClick:a}){return(0,F.jsxs)("button",{className:`inline-flex h-7 items-center gap-1 whitespace-nowrap rounded-full border px-2.5 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${r?"border-danger bg-danger text-white":"border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent"}`,disabled:n,onClick:a,children:[e,r?i:t]})}let gB=(0,B.memo)(function({project:e,nodes:t,flowsByImpl:n,onRemove:r,onFit:i,onExit:a}){let{t:s}=(0,er.Ym)(),[l,o]=(0,B.useState)(null),[c,d]=(0,B.useState)(!0),[u,p]=(0,B.useState)(null),[m,f]=(0,B.useState)(null),[h,x]=(0,B.useState)(!1),g=(0,B.useRef)(null),b=(0,B.useRef)(t);(0,B.useLayoutEffect)(()=>{b.current=t},[t]),(0,B.useEffect)(()=>{if(!m)return;let e=window.setTimeout(()=>f(null),4e3);return()=>window.clearTimeout(e)},[m]);let v=async(e,n,r)=>{var i,a;if(l||!n.length)return[];o(e),f(null);let c=new Map(u?.titles??[]);for(let e of t)c.set(e.file.path,(0,tt.cr)(e.file.title,60));let d=(i=()=>new Set(b.current.map(e=>e.file.path)),a=s("bulk.nodeGone"),e=>i().has(e)?r(e):Promise.resolve({ok:!1,error:a}));g.current={action:e,runner:d},p({action:e,items:[],current:n[0]??null,titles:c});try{return await gL(n,d,(t,n)=>p({action:e,items:[...t],current:n,titles:c}))}finally{o(null)}},w=aI({initialText:()=>"",persistText:()=>{},submit:async n=>{let r=(n??w.textRef.current).trim(),i=w.attachments.images.map(e=>({base64:e.base64,mime:e.mime}));if((r||i.length)&&!l){w.setBusy(!0);try{let n=new Map(t.map(e=>[e.file.path,e]));if(c){if(!r)return void w.setStatus({kind:"err",text:s("tasks.composerNeedsText")});let t=[];for(let e of w.attachments.images){let n=Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)),r=await no(new File([n],"attachment",{type:e.mime}));if("error"in r)return void w.setStatus({kind:"err",text:r.error});t.push(r.attachment)}let i=await ns({project:e,text:r,placement:"pinned",pos:(()=>{let e=b.current;if(!e.length)return{x:120,y:120};let t=0,n=0;for(let r of e)t+=r.x+r.w/2,n+=r.y+r.h/2;return hx({x:Math.round(t/e.length-130),y:Math.round(n/e.length-60)},{w:260,h:140},e)})(),attachments:t,clientRequestId:na()});if("error"in i)return void w.setStatus({kind:"err",text:i.error});let a=i.task.id,l=await v("message",[...n.keys()],async e=>{let t=await nh(a,[e]);if("error"in t)return{ok:!1,error:t.error};let n=t.results[0];return n?.ok?{ok:!0}:{ok:!1,error:n?.error??s("common.failedSend")}});(!n.size||l.length&&l.every(e=>e.ok))&&(w.setText(""),w.attachments.clear());return}let a=await v("message",[...n.keys()],e=>{let t=n.get(e);return gz("/api/tmux",{pid:t?.file.pid??void 0,path:e,text:r,images:i})});a.length&&a.every(e=>e.ok)&&(w.setText(""),w.attachments.clear())}finally{w.setBusy(!1)}}},disabled:null!==l}),y=t.filter(gF),k=t.filter(g_),j=t.filter(e=>eW(e.file,n)),N=u?.items.filter(e=>!e.ok).length??0;return(0,F.jsxs)("div",{"data-scheme-ui":!0,className:"absolute bottom-3 left-1/2 z-40 flex w-[640px] max-w-[94%] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-border bg-card/95 p-2.5 shadow-2",children:[h?(0,F.jsx)(gU,{count:j.length,disabled:null!==l,onStart:e=>{x(!1),v("flow",j.map(e=>e.file.path),t=>gz("/api/flows",{implementerPath:t,...e}))},onClose:()=>x(!1)}):null,(0,F.jsx)("form",{onSubmit:e=>{e.preventDefault(),w.submit()},className:"flex flex-col gap-1.5",children:(0,F.jsx)(a9,{composer:w,placeholder:s("bulk.placeholder"),textareaAriaLabel:s("bulk.textAria"),imageAriaLabel:s("composer.addImages"),sendLabelIdle:s("bulk.sendAll",{count:t.length}),sendLabelRecording:s("composer.stopAndSend"),sendTitleRecording:s("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,F.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-sunken px-2 py-1 text-[10px] font-bold text-secondary",children:s("bulk.selectedCount",{count:t.length})}),(0,F.jsxs)("button",{type:"button",role:"switch","aria-checked":c,title:s("tasks.composerToggleTitle"),onClick:()=>d(e=>!e),className:`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"border-accent bg-accent/10 text-accent":"border-border bg-card text-muted hover:text-primary"}`,children:[(0,F.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${c?"bg-accent":"bg-strong"}`,"aria-hidden":!0}),s("tasks.composerToggle")]})]})})}),(0,F.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,F.jsx)(gH,{icon:(0,F.jsx)(gO.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${s("bulk.interrupt")} ${y.length}/${t.length}`,disabled:null!==l||!y.length,onClick:()=>void v("interrupt",y.map(e=>e.file.path),e=>gz("/api/tmux",{action:"interrupt",path:e}))}),(0,F.jsx)(gH,{icon:(0,F.jsx)(mS.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${s("bulk.stop")} ${k.length}/${t.length}`,confirming:"kill"===m,confirmLabel:s("bulk.stopConfirm",{count:k.length}),disabled:null!==l||!k.length,onClick:()=>{"kill"!==m?f("kill"):v("kill",k.map(e=>e.file.path),e=>gz("/api/tmux",{action:"kill",path:e}))}}),(0,F.jsx)(gH,{icon:(0,F.jsx)(xC.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${s("bulk.remove")} ${t.length}`,confirming:"remove"===m,confirmLabel:s("bulk.removeConfirm",{count:t.length}),disabled:null!==l||!t.length,onClick:()=>{if("remove"!==m)return void f("remove");for(let e of t)r(e.file.path);f(null)}}),(0,F.jsx)(gH,{icon:(0,F.jsx)(gD.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${s("bulk.flow")} ${j.length}/${t.length}`,disabled:null!==l||!j.length,onClick:()=>x(e=>!e)}),(0,F.jsx)(gH,{icon:(0,F.jsx)(gP.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:s("bulk.fit"),disabled:!t.length,onClick:i}),(0,F.jsx)("button",{className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-full text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("bulk.exit"),title:s("bulk.exit"),onClick:a,children:(0,F.jsx)(H.A,{className:"h-4 w-4","aria-hidden":!0})})]}),u?(0,F.jsxs)("div",{className:"flex max-h-[140px] flex-col gap-0.5 overflow-y-auto rounded-[8px] border border-border bg-canvas/60 p-1.5",children:[u.items.map(e=>(0,F.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px]",children:[e.ok?(0,F.jsx)(u3.A,{className:"h-3.5 w-3.5 shrink-0 text-success","aria-hidden":!0}):(0,F.jsx)(u4.A,{className:"h-3.5 w-3.5 shrink-0 text-danger","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 shrink-0 truncate font-semibold",style:{maxWidth:"40%"},children:u.titles.get(e.path)??e.path}),e.error?(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-danger",children:e.error}):null]},e.path)),u.current?(0,F.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-muted",children:[(0,F.jsx)(up.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 truncate font-semibold",children:u.titles.get(u.current)??u.current})]}):null,!l&&N?(0,F.jsxs)("button",{className:"mt-1 inline-flex h-6 items-center gap-1 self-start rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{let e=u?.items.filter(e=>!e.ok).map(e=>e.path)??[],t=g.current;e.length&&t&&v(t.action,e,t.runner)},children:[(0,F.jsx)(ae.A,{className:"h-3 w-3","aria-hidden":!0}),s("bulk.retryFailed",{count:N})]}):null]}):null]})});function gU({count:e,disabled:t,onStart:n,onClose:r}){let{t:i}=(0,er.Ym)(),[a,s]=(0,B.useState)([]),[l,o]=(0,B.useState)(null),[c,d]=(0,B.useState)("auto"),[u,p]=(0,B.useState)(5);return(0,B.useEffect)(()=>{let e=!1;return fetch("/api/flows").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.presets)&&t.presets.length&&(s(t.presets),o(e=>e??t.presets[0].name))}).catch(()=>{}),()=>{e=!0}},[]),(0,F.jsxs)("div",{className:"absolute bottom-[calc(100%+8px)] left-1/2 flex w-[420px] max-w-[94%] -translate-x-1/2 flex-col gap-2 rounded-[12px] border border-border bg-card p-2.5 shadow-2",onKeyDown:e=>{"Escape"===e.key&&r()},children:[(0,F.jsx)("span",{className:"text-[12px] font-bold",children:i("bulk.flowTitle",{count:e})}),(0,F.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,F.jsxs)("label",{className:"col-span-3 flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[i("flowDialog.preset"),(0,F.jsx)("select",{value:l??"",className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[12px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>o(e.target.value||null),children:a.length?a.map(e=>(0,F.jsx)("option",{value:e.name,children:e.name},e.name)):(0,F.jsx)("option",{value:"",children:i("flowDialog.effortDefault")})})]}),(0,F.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[i("flowDialog.transitions"),(0,F.jsxs)("select",{value:c,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>d(e.target.value),children:[(0,F.jsx)("option",{value:"auto",children:i("flowDialog.auto")}),(0,F.jsx)("option",{value:"manual",children:i("flowDialog.manual")})]})]}),(0,F.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[i("flowDialog.roundLimit"),(0,F.jsx)("input",{type:"number",min:1,max:20,value:u,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>p(Math.max(1,Math.min(20,Number(e.target.value)||5)))})]}),(0,F.jsxs)("div",{className:"flex items-end justify-end gap-1.5",children:[(0,F.jsx)("button",{className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11px] font-semibold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:r,children:i("common.cancel")}),(0,F.jsx)("button",{className:"h-8 rounded-[8px] border border-accent bg-accent px-2.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:t||!e,onClick:()=>n({...l?{preset:l}:{roles:gq},baseMode:"head",mode:c,reviewerMode:"headless",roundLimit:u}),children:i("bulk.flowStart",{count:e})})]})]})]})}let gK=new Set;function gY(e){return!e.supersededBy&&("live"===e.activity||"stalled"===e.activity||"running"===e.proc||!!e.pendingQuestion||!!e.waitingInput)}function gW(e){return e.pipeline?"closed"!==e.pipeline.state||!!e.pipeline.restored:!!e.flow&&("closed"!==e.flow.state||!!e.flow.restored)}function gJ(e){if(!e.length)return null;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.w),i=Math.max(i,a.y+a.h);return{x:t,y:n,w:r-t,h:i-n}}function gV(e,t,n,r=gK){let i=[];for(let t of e.nodes)(gY(t.file)||t.isRoot&&n.has(U(t.file)))&&i.push(t);for(let t of e.groups)gW(t)&&i.push(t);for(let n of(i.push(...e.drafts),t))"done"!==n.status&&hg(n)&&i.push(hj(n,r.has(n.id)));return i}let gG=(e,t)=>e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y,gX=["top","right","bottom","left"],gQ=e=>"right"===e?"translate(-100%, -50%)":"left"===e?"translate(0, -50%)":"bottom"===e?"translate(-50%, -100%)":"translate(-50%, 0)",gZ=()=>"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function g0({chip:e,onFit:t}){let n,r=(0,B.useRef)(null),[i,a]=(0,B.useState)(0),[s,l]=(0,B.useState)(!1),[o,c]=(0,B.useState)(!1),d=s||o,u=e.revealWidth;return(0,F.jsxs)("button",{type:"button","data-edge-chip":e.cluster.key,className:"pointer-events-auto absolute inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border bg-card/95 px-3 text-[11px] font-bold text-primary shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{left:e.x,top:e.y,transform:gQ(e.edge),maxWidth:u},title:e.cluster.label,onClick:()=>t(e.cluster.rect),onPointerEnter:()=>{gZ()&&c(!0)},onPointerMove:e=>(e=>{if(d||gZ())return;let t=r.current;!t||t.scrollWidth-t.clientWidth>1&&e>=t.getBoundingClientRect().right-18&&a(e=>Math.min(e+1,24))})(e.clientX),onPointerLeave:()=>{a(0),c(!1)},onFocus:()=>l(!0),onBlur:()=>l(!1),children:[(0,F.jsxs)("span",{"data-edge-chip-control":!0,className:"flex shrink-0 items-center gap-1.5","aria-hidden":!0,children:[(0,F.jsx)("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:e.cluster.color}}),(0,F.jsx)("span",{children:"right"===(n=e.edge)?"→":"left"===n?"←":"bottom"===n?"↓":"↑"})]}),(0,F.jsx)("span",{ref:r,"data-edge-chip-title":!0,"data-reveal":d?"full":String(i),className:"block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap transition-[max-width] duration-150 ease-out motion-reduce:transition-none",style:{maxWidth:d?void 0:`${Math.min(120+72*i,u)}px`},children:e.cluster.label})]})}function g1({edge:e,rows:t,open:n,onToggle:r,onClose:i,onFit:a,anchor:s,vp:l}){let{t:o}=(0,er.Ym)(),c=(0,B.useRef)(null),d=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!n)return;let e=e=>{e.target instanceof Node&&c.current?.contains(e.target)||i()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[n,i]);let{x:u,y:p}=s,m=`edge-chip-overflow-${e}`,f=function(e,t,n){let{x:r,y:i}=t,a=(e,t,n)=>Math.max(t,Math.min(e,Math.max(t,n)));if("left"===e||"right"===e){let t=Math.min(256,Math.max(0,n.h-16)),s={top:a(i-t/2,8,n.h-8-t)-i,maxHeight:t};return"left"===e?{left:52,width:Math.max(0,Math.min(220,n.w-8-(r+52))),...s}:{right:52,width:Math.max(0,Math.min(220,r-52-8)),...s}}let s=Math.max(0,Math.min(260,n.w-16)),l={left:a(r-s/2,8,n.w-8-s)-r,width:s};return"top"===e?{top:52,maxHeight:Math.max(0,n.h-8-(i+52)),...l}:{bottom:52,maxHeight:Math.max(0,i-52-8),...l}}(e,s,l);return(0,F.jsxs)("div",{ref:c,className:"pointer-events-auto absolute",style:{left:u,top:p},onKeyDown:e=>{"Escape"===e.key&&n&&(e.stopPropagation(),i(),d.current?.focus())},children:[(0,F.jsxs)("button",{ref:d,type:"button",className:"absolute left-0 top-0 flex min-h-11 min-w-11 items-center justify-center rounded-full border border-border bg-card px-2 text-[11px] font-bold text-accent shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{transform:gQ(e)},"aria-expanded":n,"aria-controls":n?m:void 0,"aria-label":o("scheme.offscreenMore",{count:t.length}),onClick:r,children:["+",t.length]}),n?(0,F.jsx)("div",{id:m,"data-overflow-list":e,className:"absolute z-10 flex flex-col gap-1 overflow-y-auto rounded-[10px] border border-border bg-card p-1 shadow-2",style:{left:f.left,right:f.right,top:f.top,bottom:f.bottom,width:f.width,maxHeight:f.maxHeight},children:t.map(e=>(0,F.jsxs)("button",{type:"button","data-overflow-chip":e.cluster.key,className:"flex min-h-11 items-center gap-2 rounded-[8px] px-2 text-left text-[11px] font-semibold text-primary hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{a(e.cluster.rect),i()},children:[(0,F.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:e.cluster.color},"aria-hidden":!0}),(0,F.jsx)("span",{className:"truncate",children:e.cluster.label})]},e.cluster.key))}):null]})}function g2({clusters:e,cam:t,vp:n,hidden:r,obstacles:i=[],onFit:a}){let{t:s}=(0,er.Ym)(),l=(0,o9.O)(),o=rq(),c=(0,B.useMemo)(()=>{let e=null;if("u">typeof document)try{let t=document.createElement("canvas").getContext("2d");if(t&&"function"==typeof t.measureText){let n=("function"==typeof getComputedStyle&&document.body?getComputedStyle(document.body).fontFamily:"")||"system-ui, sans-serif";t.font=`700 11px ${n}`,t.measureText("MMMMM").width>0&&(e=t)}}catch{e=null}return t=>Math.ceil(e?e.measureText(t).width:7*t.length)+68},[]),d=(0,B.useMemo)(()=>(function(e,t,n,r=4,i=[],a=()=>520){let s={x:-t.x/t.z,y:-t.y/t.z,w:n.w/t.z,h:n.h/t.z},l=e.filter(e=>!gG(e.rect,s)).sort((e,t)=>t.priority-e.priority||e.key.localeCompare(t.key)),o=[],c=[],d=new Map;for(let e of l){let s=function(e,t,n){let r=(e.x+e.w/2)*t.z+t.x,i=(e.y+e.h/2)*t.z+t.y,a=n.w/2,s=n.h/2,l=r-a,o=i-s,c=0===l?1/0:n.w/2/Math.abs(l),d=0===o?1/0:n.h/2/Math.abs(o);if(c<=d){let e=l>=0?"right":"left";return{edge:e,x:"right"===e?n.w-22:22,y:Math.max(22,Math.min(n.h-22,s+o*c))}}let u=o>=0?"bottom":"top";return{edge:u,x:Math.max(22,Math.min(n.w-22,a+l*d)),y:"bottom"===u?n.h-22:22}}(e.rect,t,n),l=Math.max(0,a(e.label)),u=function(e,t,n,r=520){return Math.max(0,Math.min(Math.max(0,r),"right"===e?t-22:"left"===e?n.w-22-t:2*Math.min(t-22,n.w-22-t)))}(s.edge,s.x,n,l),p={cluster:e,...s,revealWidth:u},m=d.get(p.edge)??0,f=u>=l,h="left"===p.edge?{x:p.x,y:p.y-22,w:l,h:44}:"right"===p.edge?{x:p.x-l,y:p.y-22,w:l,h:44}:"top"===p.edge?{x:p.x-l/2,y:p.y,w:l,h:44}:{x:p.x-l/2,y:p.y-44,w:l,h:44};m<r&&f&&!i.some(e=>gG(h,e))?(o.push(p),d.set(p.edge,m+1)):c.push(p)}return{visible:o,overflow:c}})(e,t,n,4,i,c),[e,t,n,i,c]),u=(0,B.useMemo)(()=>{let e=new Map;for(let t of d.overflow){let n=e.get(t.edge)??[];n.push(t),e.set(t.edge,n)}let t=new Map;for(let[r,a]of e){let e=function(e,t,n=[]){for(let r of[e,...gX.filter(t=>t!==e)]){let e=function(e,t,n=[]){let r="left"===e||"right"===e,i="left"===e?10:"right"===e?t.w-10:t.w/2,a="top"===e?10:"bottom"===e?t.h-10:t.h/2,s=e=>r?{x:i,y:e}:{x:e,y:a},l=r=>!n.some(n=>gG("left"===e?{x:10,y:r-22,w:44,h:44}:"right"===e?{x:t.w-10-44,y:r-22,w:44,h:44}:"top"===e?{x:r-22,y:10,w:44,h:44}:{x:r-22,y:t.h-10-44,w:44,h:44},n)),o=r?t.h:t.w,c=o/2,d=32,u=o-22-10;if(l(c))return s(c);for(let e=24;e<=o;e+=24)for(let t of[c-e,c+e])if(t>=d&&t<=u&&l(t))return s(t);return null}(r,t,n);if(e)return{edge:r,x:e.x,y:e.y}}return null}(r,n,i);if(!e)continue;let s=t.get(e.edge);s?s.rows.push(...a):t.set(e.edge,{anchor:{x:e.x,y:e.y},rows:[...a]})}return t},[d.overflow,n,i]),[p,m]=(0,B.useState)(null);return r||l||o||!d.visible.length&&!d.overflow.length?null:(0,F.jsxs)("nav",{"data-scheme-ui":!0,"aria-label":s("scheme.offscreenNav"),className:"pointer-events-none absolute inset-0 z-[39]",children:[d.visible.map(e=>(0,F.jsx)(g0,{chip:e,onFit:a},e.cluster.key)),[...u].map(([e,{anchor:t,rows:r}])=>(0,F.jsx)(g1,{edge:e,rows:r,anchor:t,vp:n,open:p===e,onToggle:()=>m(t=>t===e?null:e),onClose:()=>m(null),onFit:a},e))]})}function g5(e,t){return e.filter(e=>e.x<=t.x+t.w&&e.x+e.w>=t.x&&e.y<=t.y+t.h&&e.y+e.h>=t.y).map(e=>e.file.path)}let g3=new Set,g4={flow:"var(--color-accent)",pipeline:"var(--color-accent)",origin:"var(--color-muted)",worktree:"var(--color-strong)"};function g6({layout:e,world:t,tasks:n=[],textExpandedIds:r=g3,currentWork:i=null,pipelineGroups:a=[],stackDots:s=[],cam:l,vp:o,onJump:c}){let d,u,p,m,f,h,{t:x}=(0,er.Ym)(),g=(0,B.useRef)(null),b=(0,B.useRef)(!1),v=(d=-l.x/l.z,u=-l.y/l.z,p=o.w/l.z,m=o.h/l.z,f=Math.min(t.x,d),h=Math.min(t.y,u),{x:f,y:h,w:Math.max(t.x+t.w,d+p)-f,h:Math.max(t.y+t.h,u+m)-h}),w=Math.min(216/v.w,148/v.h),y=(216-v.w*w)/2,k=(148-v.h*w)/2,j=e=>{let t=g.current?.getBoundingClientRect();t&&c((e.clientX-t.left-y)/w+v.x,(e.clientY-t.top-k)/w+v.y)};return(0,F.jsxs)("div",{ref:g,"data-scheme-ui":!0,className:"absolute bottom-3 right-3 z-40 cursor-pointer overflow-hidden rounded-[10px] border border-border bg-card/95 shadow-1",style:{width:216,height:148},title:x("minimap.title"),onPointerDown:e=>{e.stopPropagation(),b.current=!0,j(e);try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},onPointerMove:e=>{b.current&&j(e)},onPointerUp:e=>{b.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}},onPointerCancel:()=>{b.current=!1},children:[(0,F.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,F.jsxs)("g",{transform:`translate(${y-v.x*w} ${k-v.y*w}) scale(${w})`,children:[e.stacks.map(e=>(0,F.jsx)("circle",{cx:e.x+e.w/2,cy:e.y+e.h/2,r:7/w,fill:"var(--color-muted)",opacity:.6},e.key)),e.drafts.map(e=>(0,F.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"var(--color-muted)",opacity:.3},e.key)),e.decks.map(e=>(0,F.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"var(--color-accent)",opacity:.3},e.key)),e.groups.filter(e=>"pipeline"===e.kind).map(e=>(0,F.jsx)("rect",{"data-minimap-pipeline":e.id,x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:`hsl(${e.hue} 62% 42% / 0.08)`,stroke:`hsl(${e.hue} 62% 42%)`,strokeWidth:2/w,children:(0,F.jsx)("title",{children:e.label})},e.key)),a.map(({pipeline:e,rect:t})=>(0,F.jsx)("rect",{"data-minimap-pipeline":e.id,x:t.x,y:t.y,width:t.w,height:t.h,rx:10,fill:"var(--color-accent-soft)",stroke:"draft"===e.state?"var(--color-warning)":"var(--color-accent)",strokeDasharray:"draft"===e.state?`${6/w} ${4/w}`:void 0,strokeWidth:2/w,opacity:.8,children:(0,F.jsx)("title",{children:e.task})},e.id)),e.nodes.map(e=>(0,F.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:(0,tt.yj)(e.file),opacity:"live"===e.file.activity?.85:.35},e.file.path)),n.map(e=>(0,F.jsx)("circle",{cx:e.pos.x+130,cy:e.pos.y+hy(e,r.has(e.id))/2,r:3/w,fill:fA[e.status].color,opacity:"done"===e.status?.5:.95},e.id)),i?(0,F.jsx)("rect",{"data-minimap-current-work":"true",x:i.x,y:i.y,width:i.w,height:i.h,rx:14,fill:"none",stroke:"var(--color-warning)",strokeDasharray:`${7/w} ${5/w}`,strokeWidth:2/w,opacity:.8}):null,(0,F.jsx)("rect",{x:-l.x/l.z,y:-l.y/l.z,width:o.w/l.z,height:o.h/l.z,fill:"color-mix(in srgb, var(--color-accent) 8%, transparent)",stroke:"var(--color-accent)",strokeWidth:2.5/w})]})}),s.length?(0,F.jsx)("div",{className:"pointer-events-none absolute bottom-1 left-1 flex max-h-[70%] max-w-[150px] flex-wrap content-end items-center gap-[3px]",title:x("minimap.stacks",{count:s.length}),"aria-hidden":!0,children:s.map(e=>(0,F.jsx)("span",{className:`shrink-0 rounded-full ${s.length>24?"h-1 w-1":"h-1.5 w-1.5"}`,style:{backgroundColor:e.color}},e.key))}):null]})}let g8={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function g7({label:e,role:t,onChange:n}){let{t:r}=(0,er.Ym)(),i=(0,B.useId)();return(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("span",{className:"w-[86px] shrink-0 text-[10.5px] font-semibold text-muted",children:e}),(0,F.jsxs)("select",{value:t.engine,"aria-label":r("flowDialog.engine",{label:e}),className:"h-7 rounded-[8px] border border-border bg-canvas px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>n({...t,engine:e.target.value,effort:null}),children:[(0,F.jsx)("option",{value:"claude",children:"Claude"}),(0,F.jsx)("option",{value:"codex",children:"Codex"})]}),(0,F.jsx)("input",{value:t.model??"",list:i,placeholder:r("flowDialog.modelPlaceholder"),"aria-label":r("flowDialog.model",{label:e}),className:"h-7 w-0 min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-1.5 font-mono text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>n({...t,model:e.target.value.trim()||null})}),(0,F.jsx)("datalist",{id:i,children:sQ[t.engine].map(e=>(0,F.jsx)("option",{value:e.id,children:e.label},e.id))}),(0,F.jsxs)("select",{value:t.effort??"","aria-label":`Reasoning effort: ${e}`,className:"h-7 rounded-[8px] border border-border bg-canvas px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>n({...t,effort:e.target.value||null}),children:[(0,F.jsx)("option",{value:"",children:r("flowDialog.effortDefault")}),sW.Lw[t.engine].map(e=>(0,F.jsx)("option",{value:e,children:e},e))]})]})}function g9({file:e,onClose:t}){let{t:n}=(0,er.Ym)(),[r,i]=(0,B.useState)([]),[a,s]=(0,B.useState)(null),[l,o]=(0,B.useState)(g8),[c,d]=(0,B.useState)(!1),[u,p]=(0,B.useState)("head"),[m,f]=(0,B.useState)("auto"),[h,x]=(0,B.useState)("headless"),[g,b]=(0,B.useState)(5),[v,w]=(0,B.useState)(""),[y,k]=(0,B.useState)(!1),[j,N]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=!1;return fetch("/api/flows").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.presets)&&t.presets.length&&(i(t.presets),s(e=>e??t.presets[0].name),o({implementer:t.presets[0].implementer,reviewer:t.presets[0].reviewer}))}).catch(()=>{}),()=>{e=!0}},[]);let S=async()=>{if(!y){k(!0),N(null);try{let r=await fetch("/api/flows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({implementerPath:e.path,...c||!a?{roles:l}:{preset:a},baseMode:u,mode:m,reviewerMode:h,roundLimit:g,...v.trim()?{spec:v.trim()}:{}})});if(!r.ok){let e=await r.json().catch(()=>null);N(e?.error??n("flowDialog.createFailed",{status:r.status}));return}t()}catch{N(n("common.serverUnavailable"))}finally{k(!1)}}};return(0,F.jsxs)("div",{"data-scheme-ui":!0,className:"flex w-[420px] flex-col gap-2.5 rounded-[12px] border border-border bg-card p-3 shadow-2",onKeyDown:e=>{"Escape"===e.key&&t()},children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)("span",{className:"text-[12.5px] font-bold",children:n("flowDialog.title")}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-muted",children:n("flowDialog.subtitle")})]}),r.length?(0,F.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.preset"),(0,F.jsx)("select",{value:a??"",className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[12px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>{var t;let n;return s(t=e.target.value),void((n=r.find(e=>e.name===t))&&o({implementer:n.implementer,reviewer:n.reviewer}))},children:r.map(e=>(0,F.jsx)("option",{value:e.name,children:e.name},e.name))})]}):null,(0,F.jsx)("button",{className:"self-start text-[10.5px] font-semibold text-muted hover:text-accent focus-visible:outline-none","aria-expanded":c,onClick:()=>d(e=>!e),children:c?n("flowDialog.rolesManualOpen"):n("flowDialog.rolesManual")}),c?(0,F.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-dashed border-border bg-canvas/50 p-2",children:[(0,F.jsx)(g7,{label:n("flowDialog.implementer"),role:l.implementer,onChange:e=>o(t=>({...t,implementer:e}))}),(0,F.jsx)(g7,{label:n("flowDialog.reviewer"),role:l.reviewer,onChange:e=>o(t=>({...t,reviewer:e}))})]}):null,(0,F.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.spec"),(0,F.jsx)("textarea",{value:v,rows:4,placeholder:n("flowDialog.specPlaceholder"),className:"resize-y rounded-[8px] border border-border bg-canvas px-2 py-1.5 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>w(e.target.value)})]}),(0,F.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,F.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.diffBase"),(0,F.jsxs)("select",{value:u,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>p(e.target.value),children:[(0,F.jsx)("option",{value:"head",children:n("flowDialog.fromHead")}),(0,F.jsx)("option",{value:"merge-base",children:n("flowDialog.fromMergeBase")})]})]}),(0,F.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.reviewer"),(0,F.jsxs)("select",{value:h,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>x(e.target.value),children:[(0,F.jsx)("option",{value:"headless",children:n("flowDialog.headless")}),(0,F.jsx)("option",{value:"pane",children:n("flowDialog.tmuxPane")})]})]}),(0,F.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.transitions"),(0,F.jsxs)("select",{value:m,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>f(e.target.value),children:[(0,F.jsx)("option",{value:"auto",children:n("flowDialog.auto")}),(0,F.jsx)("option",{value:"manual",children:n("flowDialog.manual")})]})]}),(0,F.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.roundLimit"),(0,F.jsx)("input",{type:"number",min:1,max:20,value:g,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>b(Math.max(1,Math.min(20,Number(e.target.value)||5)))})]})]}),(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[j?(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-danger",children:j}):(0,F.jsx)("span",{className:"flex-1"}),(0,F.jsx)("button",{className:"rounded-[8px] border border-border bg-canvas px-2.5 py-1.5 text-[11.5px] font-semibold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:t,children:n("common.cancel")}),(0,F.jsx)("button",{className:"rounded-[8px] border border-accent bg-accent px-3 py-1.5 text-[12px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:y,onClick:()=>void S(),children:y?n("flowDialog.creating"):n("flowDialog.start")})]})]})}let be={waiting:"var(--color-muted)",running:"var(--color-accent)",awaiting_verdict:"var(--color-accent)",attention:"var(--color-warning)",paused:"var(--color-warning)",done:"var(--color-success)"};function bt({flow:e,x:t,y:n,interactive:r,moveTransition:i}){let{locale:a,t:s}=(0,er.Ym)(),l=a_(e.id),o=l?{...l,block:e.block}:e,[c,d]=(0,B.useState)(!1),[u,p]=(0,B.useState)(!1),[m,f]=(0,B.useState)(null),h=be[dJ(o.state)],x=dV(o)?.n??0,g=eG(s,o,a),b=g.label,v=x>0?s("flowHub.aria",{n:x,state:b}):s("flowHub.ariaNoRound",{state:b}),w=g.pending,y="closed"===o.state||"approved"===o.state,k=async e=>{if(u)return;p(!0),f(null);let t=await e1(o.id,{action:e});t?f(t):"close"===e&&d(!1),p(!1)};return(0,F.jsxs)("div",{className:`absolute left-0 top-0 ${c?"z-30":"z-[5]"} ${r?"":"pointer-events-none"}`,style:{transform:`translate(${t}px, ${n}px)`,transition:i},onKeyDown:e=>{"Escape"===e.key&&c&&(e.stopPropagation(),d(!1))},children:[(0,F.jsxs)("button",{"data-scheme-ui":!0,className:"absolute inline-flex h-[34px] -translate-x-1/2 -translate-y-1/2 items-center gap-1 whitespace-nowrap rounded-full border-2 bg-card px-2.5 shadow-1 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{borderColor:h,color:h},title:v,"aria-label":v,"aria-expanded":c,onClick:()=>d(e=>!e),children:[(0,F.jsx)("span",{className:"text-[15px] font-bold leading-none","aria-hidden":!0,children:"⟳"}),x>0?(0,F.jsxs)("span",{className:"text-[11px] font-bold",children:["R",x]}):null]}),c?(0,F.jsxs)("div",{"data-scheme-ui":!0,"aria-label":s("flowHub.controls"),className:"absolute bottom-[27px] left-0 z-30 flex w-[230px] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-border bg-card p-2.5 shadow-2",children:[(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:h},"aria-hidden":!0}),(0,F.jsx)("span",{className:"shrink-0 text-[11.5px] font-bold",children:b}),g.detail?(0,F.jsx)("span",{className:"min-w-0 truncate text-[10.5px] font-semibold text-muted",title:g.detail,children:g.detail}):null,u?(0,F.jsx)(xq.A,{className:"ml-auto h-3 w-3 shrink-0 animate-spin text-muted","aria-hidden":!0}):null]}),m?(0,F.jsx)("span",{className:"truncate text-[10.5px] font-semibold text-danger",title:m,children:m}):null,w?(0,F.jsx)("button",{className:"rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:u,onClick:()=>void k(w.action),children:s(w.labelKey)}):null,"reviewing"===o.state?(0,F.jsxs)("button",{className:"inline-flex items-center justify-center gap-1 rounded-full border border-danger/40 bg-danger-soft px-3 py-1 text-[11px] font-bold text-danger hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:u,title:s("flowStrip.stopReviewerTitle"),onClick:()=>void k("cancel-round"),children:[(0,F.jsx)(mS.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("flowStrip.stopReviewer")]}):null,(0,F.jsxs)("span",{className:"flex items-center gap-1.5",children:[y?null:"paused"===o.state?(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-success/40 bg-success-soft px-3 py-1 text-[11px] font-bold text-success hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:u,onClick:()=>void k("resume"),children:[(0,F.jsx)(xW.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("flowStrip.resume")]}):(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:u,onClick:()=>void k("pause"),children:[(0,F.jsx)(m0.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("flowStrip.pause")]}),(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:u,onClick:()=>void k("close"),children:[(0,F.jsx)(H.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("flowStrip.close")]})]})]}):null]})}let bn={draft:"var(--color-warning)",provisioning:"var(--color-accent)",running:"var(--color-accent)",needs_decision:"var(--color-warning)",paused:"var(--color-warning)",completed:"var(--color-success)",closed:"var(--color-muted)"};function br({pipeline:e,x:t,y:n,interactive:r,moveTransition:i}){let{t:a}=(0,er.Ym)(),[s,l]=(0,B.useState)(!1),[o,c]=(0,B.useState)(!1),[d,u]=(0,B.useState)(null),p=(0,B.useRef)(null),m=(0,B.useRef)(null),f=(0,B.useRef)(!1);(0,B.useEffect)(()=>{s?(m.current?.focus(),f.current=!0):f.current&&(p.current?.focus(),f.current=!1)},[s]);let h=bn[e.state],x=e.stages.length,g=e.cursor?.stageId??e.stages.at(-1)?.id??null,b=g?e.stages.findIndex(e=>e.id===g):-1,v=b>=0?e.stages[b]:null,w=v?dy(a,v):e.id,y=b>=0?b+1:x,k=g?c3(e,g):null,j="completed"===e.state||"closed"===e.state,N="needs_decision"===e.state,S=async t=>{if(o)return;c(!0),u(null);let n=await dU(e.id,t);n?u(n):"close"===t&&l(!1),c(!1)};return(0,F.jsxs)("div",{className:`absolute left-0 top-0 ${s?"z-30":"z-[5]"} ${r?"":"pointer-events-none"}`,style:{transform:`translate(${t}px, ${n}px)`,transition:i},onKeyDown:e=>{"Escape"===e.key&&s&&(e.stopPropagation(),l(!1))},children:[(0,F.jsxs)("button",{ref:p,"data-scheme-ui":!0,className:"absolute inline-flex h-[30px] -translate-x-1/2 -translate-y-1/2 items-center gap-1 whitespace-nowrap rounded-full border-2 bg-card px-2.5 text-[10.5px] font-bold shadow-1 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{borderColor:h,color:h},"aria-label":a("pipelineHub.aria",{task:e.task,stage:w,k:y,n:x}),"aria-expanded":s,"aria-haspopup":"dialog",onClick:()=>l(e=>!e),children:[(0,F.jsx)("span",{"aria-hidden":!0,children:"paused"===e.state?"⏸":"⇢"}),(0,F.jsx)("span",{className:"max-w-[120px] truncate",children:a("pipelineHub.stageOf",{stage:w,k:y,n:x})})]}),s?(0,F.jsxs)("div",{ref:m,"data-scheme-ui":!0,role:"dialog",tabIndex:-1,"aria-label":a("pipelineHub.controls"),className:"absolute bottom-[24px] left-0 z-30 flex w-[224px] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-border bg-card p-2.5 shadow-2 focus-visible:outline-none",children:[(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:h},"aria-hidden":!0}),(0,F.jsx)("span",{className:"shrink-0 text-[11.5px] font-bold",children:c6(a,e.state)}),o?(0,F.jsx)(xq.A,{className:"ml-auto h-3 w-3 shrink-0 animate-spin text-muted","aria-hidden":!0}):null]}),(0,F.jsxs)("span",{className:"min-w-0 truncate text-[10.5px] font-semibold text-muted",children:[a("pipelineHub.stageOf",{stage:w,k:y,n:x}),k&&k.n>1?` \xb7 ${a("pipelineHub.attempt",{n:k.n})}`:""]}),e.stateDetail?(0,F.jsx)("span",{className:"truncate text-[10px] font-semibold text-warning",title:e.stateDetail,children:e.stateDetail}):null,d?(0,F.jsx)("span",{className:"truncate text-[10.5px] font-semibold text-danger",title:d,children:d}):null,N?(0,F.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("button",{className:"flex-1 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:o,onClick:()=>void S("retry-stage"),children:a("pipelineStrip.retryStage")}),(0,F.jsx)("button",{className:"rounded-full border border-border bg-canvas px-2.5 py-1 text-[10.5px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:o,onClick:()=>void S("skip-stage"),children:a("pipelineStrip.skipStage")})]}):null,(0,F.jsxs)("span",{className:"flex items-center gap-1.5",children:[j?null:"paused"===e.state?(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-success/40 bg-success-soft px-3 py-1 text-[11px] font-bold text-success hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:o,onClick:()=>void S("resume"),children:[(0,F.jsx)(xW.A,{className:"h-3 w-3","aria-hidden":!0})," ",a("pipelineStrip.resume")]}):(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:o,onClick:()=>void S("pause"),children:[(0,F.jsx)(m0.A,{className:"h-3 w-3","aria-hidden":!0})," ",a("pipelineStrip.pause")]}),(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:o,onClick:()=>void S("close"),children:[(0,F.jsx)(H.A,{className:"h-3 w-3","aria-hidden":!0})," ",a("pipelineStrip.close")]})]})]}):null]})}var bi=n(9751);function ba({slot:e,onOpen:t}){let{t:n}=(0,er.Ym)(),{pipeline:r,stage:i,attempt:a}=e,s=dp(r,i),l=de[s],o=dk(n,i,e.index,e.total),c="review-loop"===i.kind,d=(0,tt.t7)(i.effectiveRole.engine),u=i.effectiveRole.model??"",p=(sQ[i.effectiveRole.engine].find(e=>e.id===u)?.label??u)||n("draft.modelDefault"),m=i.effectiveRole.effort?c2(n,i.effectiveRole.effort):"",f=a?.verdict??null,h=xZ(r,i,i.effectiveRole,"[The previous stage output was inserted here]");return(0,F.jsxs)("section",{"data-pipeline-stage-card":`${r.id}::${i.id}`,"data-pipeline-stage-state":s,"data-pipeline-stage-completed":"true","aria-label":n("pipelineSlot.completedAria",{title:o}),className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-control border-2 bg-card shadow-1",style:{borderColor:l.color},children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0 opacity-60",style:{backgroundColor:d.color}}),(0,F.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-2.5",style:{backgroundColor:d.soft},children:[(0,F.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:l.color},title:n(`pipelineChipState.${s}`)}),(0,F.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-card/70 px-1.5 py-0.5 text-caption font-bold capitalize text-muted",children:i.effectiveRole.engine}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-muted",title:o,children:o}),(0,F.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-card/70 px-1.5 py-0.5 text-caption font-bold uppercase tracking-wide text-muted",children:c?`⟳ ${n("groupOverride.reviewKind")}`:n("groupOverride.runKind")})]}),(0,F.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-3",children:[(0,F.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,F.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("span",{className:"rounded-full px-3 py-1 text-body font-bold",style:{backgroundColor:l.soft,color:l.color},children:a?dw(n,a.state):n(`pipelineChipState.${s}`)}),f?(0,F.jsx)("span",{className:"rounded-full px-2 py-1 text-label font-bold",style:{backgroundColor:dI[f.status].soft,color:dI[f.status].color},children:dM(n,f.status)}):null]}),(0,F.jsxs)("span",{className:"truncate text-label font-semibold text-muted",title:`${p}${m?` \xb7 ${m}`:""}`,children:[p,m?` \xb7 ${m}`:""]})]}),(0,F.jsxs)("div",{className:"ml-auto max-w-[88%] min-h-0 overflow-hidden rounded-[14px] rounded-br-[4px] bg-accent/10 px-3 py-2.5 text-ui leading-5 text-primary shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--color-accent)_18%,transparent)]",children:[(0,F.jsx)("p",{className:"mb-1 text-caption font-bold uppercase tracking-wide text-accent",children:n("pipelineSlot.promptLabel")}),(0,F.jsx)("p",{className:"line-clamp-[12] whitespace-pre-wrap break-words",children:h})]}),(0,F.jsxs)("button",{type:"button","data-scheme-ui":!0,className:"mt-auto inline-flex h-8 items-center justify-center gap-1 self-center rounded-control border border-border bg-canvas px-3 text-label font-bold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:!t,onClick:()=>t?.(),children:[(0,F.jsx)(bi.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("pipelineSlot.openTranscript")]})]})]})}function bs({slot:e,expanded:t,controls:n,onToggle:r}){let{t:i}=(0,er.Ym)(),{pipeline:a,stage:s,attempt:l}=e,o=dp(a,s),c=de[o],d=dk(i,s,e.index,e.total),u=function(e,t,n,r=function(e,t){return c3(e,t)}(t,n.id)){let i=dC(r?.error);if(i)return i;let a=dC(r?.verdict?.findings?.[0]);if(a)return`${dM(e,r.verdict.status)} — ${a}`;if(r?.state==="skipped")return e("pipelineSlot.reasonSkipped");let s=dC(r?.output);return s||(r?.verdict?dM(e,r.verdict.status):r?dw(e,r.state):e(`pipelineChipState.${dp(t,n)}`))}(i,a,s,l??c3(a,s.id));return(0,F.jsxs)("section",{"data-pan-ignore":!0,"data-pipeline-stage-card":t?void 0:`${a.id}::${s.id}`,"data-pipeline-stage-state":o,"data-pipeline-stage-row":"true","aria-label":i("pipelineSlot.rowAria",{title:d}),className:"flex h-full min-h-0 min-w-0 flex-col justify-center gap-1 overflow-hidden rounded-control border bg-card px-3 py-2 shadow-1",style:{borderColor:"var(--border-strong)"},children:[(0,F.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-label font-bold",style:{backgroundColor:c.soft,color:c.color},children:[(0,F.jsx)("span",{"aria-hidden":!0,children:dt[o]}),i(`pipelineChipState.${o}`)]}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-secondary",title:d,children:d}),r?(0,F.jsx)("button",{type:"button","data-scheme-ui":!0,"data-stage-row-toggle":!0,"aria-expanded":t,"aria-controls":n,"aria-label":i(t?"pipelineSlot.rowCollapse":"pipelineSlot.rowExpand"),title:i(t?"pipelineSlot.rowCollapse":"pipelineSlot.rowExpand"),className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-control border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:r,children:(0,F.jsx)(xG.A,{className:`h-3.5 w-3.5 transition-transform ${t?"rotate-90":""}`,"aria-hidden":!0})}):null]}),(0,F.jsx)("p",{className:"min-w-0 truncate text-label text-muted",title:u,children:u})]})}var bl=n(529);let bo=new Set(["spawning","reviewing","relaying","fixing"]),bc=[1,2,3,4,5,0];function bd({flow:e,onFocusRound:t}){let{locale:n,t:r}=(0,er.Ym)(),i=a_(e.id),a=i?{...i,block:e.block}:e,[s,l]=(0,B.useState)(!1),[o,c]=(0,B.useState)(null),[d,u]=(0,B.useState)(""),p=async(e,t)=>{if(s)return;l(!0),c(null);let n=await e1(a.id,{action:e,...t});n?c(n):t?.note!==void 0&&u(""),l(!1)},m=eG(r,a,n),f=m.pending,h=m.attention,x="closed"===a.state||"approved"===a.state,g=!!f&&("waiting_ready"===a.state||"needs_decision"===a.state);return(0,F.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex h-11 w-full items-center gap-3 rounded-[14px] border bg-card/95 px-4 shadow-1 ${h?"border-warning/70":"border-border"}`,children:[(0,F.jsxs)("span",{className:"flex min-w-0 max-w-[38%] shrink-0 items-center gap-2",children:[(0,F.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${a.block?"bg-danger":"approved"===a.state?"bg-success":"needs_decision"===a.state?"bg-danger":"paused"===a.state?"bg-warning":bo.has(a.state)?"bg-success animate-pulse":"bg-muted"}`,"aria-hidden":!0}),(0,F.jsx)("span",{className:"shrink-0 text-label font-semibold text-secondary",children:r("flowStrip.flow")}),(0,F.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:m.label}),m.detail?(0,F.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-muted",title:m.detail,children:m.detail}):null]}),(0,F.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":r("flowStrip.roundsAria"),children:a.rounds.map((e,n)=>{let i=e0(e.verdict),a=null===e.verdict&&!e.error;return(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[n>0?(0,F.jsx)("span",{className:"text-[10px] font-bold text-strong","aria-hidden":!0,children:"→"}):null,(0,F.jsxs)("button",{className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"animate-pulse":""}`,style:{backgroundColor:i.soft,color:i.color},title:e.error?r("flowStrip.roundError",{n:e.n,error:e.error}):e.verdict?r("flowStrip.roundVerdict",{n:e.n,verdict:e.verdict})+(null!=e.findingsCount?` \xb7 ${r("roundDeck.findings",{count:e.findingsCount})}`:""):r("flowStrip.roundInProgress",{n:e.n}),onClick:()=>t?.(e.n),children:["R",e.n,(0,F.jsx)(xD,{verdict:e.verdict,error:!!e.error}),null!=e.findingsCount&&e.findingsCount>0?(0,F.jsx)("span",{children:e.findingsCount}):null]})]},e.n)})}),(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[o?(0,F.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-danger",title:o,children:o}):null,s?(0,F.jsx)(xq.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted","aria-hidden":!0}):null,g?(0,F.jsx)(a3,{label:r("flowStrip.noteTitle"),children:(0,F.jsx)("input",{className:"w-40 shrink-0 rounded-full border border-border bg-canvas px-2.5 py-1 text-[10.5px] font-medium text-primary placeholder:text-muted/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",value:d,placeholder:r("flowStrip.notePlaceholder"),onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&f&&p(f.action,{note:d})}})}):null,"reviewing"===a.state?(0,F.jsx)(a3,{label:r("flowStrip.stopReviewerTitle"),children:(0,F.jsxs)("button",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-danger/40 bg-danger-soft px-2.5 text-[10.5px] font-bold text-danger hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:s,onClick:()=>void p("cancel-round"),children:[(0,F.jsx)(mS.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.stopReviewer")]})}):null,f?(0,F.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:s,onClick:()=>void p(f.action,g?{note:d}:void 0),children:r(f.labelKey)}):null,x?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(a3,{label:r("flowStrip.limitTitle"),children:(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded-full border border-border bg-canvas p-0.5",children:[bc.map(e=>{let t=a.roundLimit===e,n=0!==e&&e<a.rounds.length;return(0,F.jsx)("button",{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30 ${t?"bg-accent text-white":"text-muted hover:bg-card hover:text-primary"}`,disabled:s||n,"aria-label":0===e?r("flowStrip.limitUnlimitedAria"):r("flowStrip.limitAria",{count:e}),"aria-pressed":t,onClick:()=>void p("set-round-limit",{rounds:e}),children:0===e?(0,F.jsx)(bl.A,{className:"h-3 w-3","aria-hidden":!0}):e},e)}),bc.includes(a.roundLimit)?null:(0,F.jsx)("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1 text-[10px] font-bold text-white",children:a.roundLimit})]})}),(0,F.jsx)(a3,{label:"auto"===a.mode?r("flowStrip.autoTitle"):r("flowStrip.manualTitle"),children:(0,F.jsx)("button",{className:`shrink-0 rounded-full border px-2.5 py-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${"auto"===a.mode?"border-success/40 bg-success-soft text-success":"border-border bg-canvas text-muted hover:text-primary"}`,disabled:s,onClick:()=>void p("set-mode",{mode:"auto"===a.mode?"manual":"auto"}),children:"auto"===a.mode?r("flowDialog.auto"):r("flowStrip.manualShort")})}),"paused"===a.state?(0,F.jsx)(a3,{label:r("flowStrip.resume"),children:(0,F.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-success hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:s,"aria-label":r("flowStrip.resume"),onClick:()=>void p("resume"),children:(0,F.jsx)(xW.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,F.jsx)(a3,{label:r("flowStrip.pause"),children:(0,F.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:s,"aria-label":r("flowStrip.pause"),onClick:()=>void p("pause"),children:(0,F.jsx)(m0.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,F.jsx)(a3,{label:r("flowStrip.close"),children:(0,F.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted hover:bg-canvas hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:s,"aria-label":r("flowStrip.close"),onClick:()=>void p("close"),children:(0,F.jsx)(H.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function bu({role:e,active:t}){let{t:n}=(0,er.Ym)();return(0,F.jsxs)("div",{className:`pointer-events-none absolute -top-3 left-4 z-[12] flex h-6 items-center gap-1.5 rounded-full border px-2.5 shadow-1 ${t?"border-success/50 bg-success-soft":"border-border bg-card"}`,children:[(0,F.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${t?"animate-pulse bg-success":"bg-strong"}`,"aria-hidden":!0}),(0,F.jsx)("span",{className:`text-[10px] font-bold tracking-[0.06em] ${t?"text-success":"text-primary"}`,children:n("implementer"===e?"scheme.roleImplementer":"scheme.roleReviewer")}),(0,F.jsx)("span",{className:`text-[10px] font-semibold ${t?"text-success":"text-muted"}`,children:n(t?"scheme.roleWorking":"scheme.roleWaiting")})]})}var bp=n(5618);let bm="text-label font-semibold text-secondary",bf="h-7 w-full rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",bh="inline-flex items-center justify-center gap-1 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",bx="inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40";function bg({pipeline:e,onClose:t,label:n=e.task}){let{t:r}=(0,er.Ym)(),i="draft"===e.state,[a,s]=(0,B.useState)(!1),[l,o]=(0,B.useState)(null),[c,d]=(0,B.useState)(null),[u,p]=(0,B.useState)(e.task),[m,f]=(0,B.useState)(e.spec??""),[h,x]=(0,B.useState)(e.repoDir),g="completed"===e.state||"closed"===e.state,b="needs_decision"===e.state,v=e.stages.some(t=>(e.runs.find(e=>e.stageId===t.id)?.attempts.length??0)===0),w=async(e,t)=>{if(a)return;s(!0),o(null),d(null);let n=await t();n?o(n):d(e),s(!1)};return(0,F.jsxs)("div",{"data-scheme-ui":!0,"data-group-override":"pipeline","data-pipeline-editor":e.id,role:"dialog","aria-label":n,className:"flex max-h-[calc(100vh-24px)] w-[min(320px,calc(100vw-24px))] flex-col gap-2 overflow-y-auto rounded-[12px] border border-border bg-card p-3 shadow-2",children:[(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-bold",children:r(i?"groupOverride.draftTitle":"groupOverride.pipelineTitle",{name:n})}),(0,F.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("groupOverride.closePanel"),onClick:t,children:(0,F.jsx)(H.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),l?(0,F.jsx)("span",{role:"alert",className:"text-[10.5px] font-semibold text-danger",children:l}):null,c?(0,F.jsx)("span",{className:"text-[10.5px] font-semibold text-success",children:c}):null,i?(0,F.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[9px] border border-dashed border-warning/60 bg-warning-soft p-2",children:[(0,F.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,F.jsx)("span",{className:bm,children:r("groupOverride.task")}),(0,F.jsx)("input",{className:bf,value:u,onChange:e=>p(e.target.value)})]}),(0,F.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,F.jsx)("span",{className:bm,children:r("groupOverride.spec")}),(0,F.jsx)("textarea",{className:"min-h-[52px] w-full resize-y rounded-[8px] border border-border bg-canvas px-2 py-1.5 text-[11.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",value:m,onChange:e=>f(e.target.value)})]}),(0,F.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,F.jsx)("span",{className:bm,children:r("groupOverride.repoDir")}),(0,F.jsx)("input",{className:bf,value:h,onChange:e=>x(e.target.value)})]}),(0,F.jsx)("button",{className:bh,disabled:a||!u.trim()||!h.trim(),onClick:()=>void w(r("groupOverride.savedDraft"),()=>dU(e.id,"update-draft",{task:u,spec:m,repoDir:h})),children:r("groupOverride.saveDraft")})]}):null,!g&&v?(0,F.jsxs)("div",{"data-pipeline-editor-canvas-hint":!0,className:"flex items-start gap-1.5 rounded-[9px] border border-border bg-sunken px-2 py-1.5 text-[10.5px] font-semibold text-muted",children:[(0,F.jsx)(bp.A,{className:"mt-[1px] h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}),(0,F.jsx)("span",{children:r("groupOverride.editStagesOnCanvas")})]}):null,b?(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("button",{className:bh+" flex-1",disabled:a,onClick:()=>void w(r("pipelineStrip.retryStage"),()=>dU(e.id,"retry-stage")),children:r("pipelineStrip.retryStage")}),(0,F.jsx)("button",{className:bx,disabled:a,onClick:()=>void w(r("pipelineStrip.skipStage"),()=>dU(e.id,"skip-stage")),children:r("pipelineStrip.skipStage")})]}):null,(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[i?(0,F.jsxs)("button",{className:"inline-flex min-h-11 flex-1 items-center justify-center gap-1 rounded-full border border-accent bg-accent px-3 text-[11px] font-bold text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:a||e.stages.length<1,title:e.stages.length<1?r("groupOverride.startNeedsStages"):void 0,onClick:()=>void w(r("pipelineStrip.start"),()=>dU(e.id,"start")),children:[(0,F.jsx)(xW.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",r("pipelineStrip.start")]}):g?null:"paused"===e.state?(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-success/40 bg-success-soft px-3 py-1 text-[11px] font-bold text-success focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:a,onClick:()=>void w(r("pipelineStrip.resume"),()=>dU(e.id,"resume")),children:[(0,F.jsx)(xW.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("pipelineStrip.resume")]}):(0,F.jsxs)("button",{className:bx,disabled:a,onClick:()=>void w(r("pipelineStrip.pause"),()=>dU(e.id,"pause")),children:[(0,F.jsx)(m0.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("pipelineStrip.pause")]}),(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:a,onClick:()=>void w(r(i?"pipelineStrip.discard":"pipelineStrip.close"),()=>dU(e.id,i?"delete":"close")),children:[(0,F.jsx)(H.A,{className:"h-3 w-3","aria-hidden":!0})," ",r(i?"pipelineStrip.discard":"pipelineStrip.close")]})]})]})}let bb=["claude","codex"];function bv({group:e,onClose:t}){return e.pipeline?(0,F.jsx)(bg,{pipeline:e.pipeline,label:e.label,onClose:t}):(0,F.jsx)("div",{"data-scheme-ui":!0,"data-group-override":e.kind,role:"dialog","aria-label":e.label,className:"flex w-[268px] flex-col gap-2 rounded-[12px] border border-border bg-card p-3 shadow-2",children:e.flow?(0,F.jsx)(bA,{group:e,onClose:t}):null})}function bw({title:e,onClose:t}){let{t:n}=(0,er.Ym)();return(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-bold",children:e}),(0,F.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":n("groupOverride.closePanel"),onClick:t,children:(0,F.jsx)(H.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}let by="text-label font-semibold text-secondary",bk="h-7 w-full rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",bj="inline-flex items-center justify-center gap-1 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",bN="inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40";function bS({engine:e,value:t,onChange:n,label:r}){let{t:i}=(0,er.Ym)(),a=sW.Lw[e],s=t&&a.includes(t)?t:"";return(0,F.jsxs)("label",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,F.jsx)("span",{className:by,children:r}),(0,F.jsxs)(fQ,{className:"w-full",value:s,onChange:e=>n(e.target.value),children:[(0,F.jsx)("option",{value:"",children:i("groupOverride.effortDefault")}),a.map(e=>(0,F.jsx)("option",{value:e,children:c2(i,e)},e))]})]})}function bC({value:e,onChange:t}){let{t:n}=(0,er.Ym)();return(0,F.jsxs)("label",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,F.jsx)("span",{className:by,children:n("groupOverride.engine")}),(0,F.jsx)(fQ,{className:"w-full",value:e,onChange:e=>t(e.target.value),children:bb.map(e=>(0,F.jsx)("option",{value:e,children:e},e))})]})}function bA({group:e,onClose:t}){let{locale:n,t:r}=(0,er.Ym)(),i=e.flow,a=i.roles.reviewer,[s,l]=(0,B.useState)(a.engine),[o,c]=(0,B.useState)(a.model??""),[d,u]=(0,B.useState)(a.effort??""),[p,m]=(0,B.useState)(i.rounds.at(-1)?.readyNote??""),f=i.rounds.at(-1)?.n??0,[h,x]=(0,B.useState)(f);h!==f&&(x(f),m(i.rounds.at(-1)?.readyNote??""));let[g,b]=(0,B.useState)(String(i.roundLimit)),[v,w]=(0,B.useState)(!1),[y,k]=(0,B.useState)(null),[j,N]=(0,B.useState)(null),S="closed"===i.state||"approved"===i.state,C=eG(r,i,n).pending,A=C?.action==="advance"&&("waiting_ready"===i.state||"spawn_pending"===i.state)||C?.action==="retry-round",I=async(e,t)=>{if(v)return;w(!0),k(null),N(null);let n=await t();n?k(n):N(e),w(!1)};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(bw,{title:r("groupOverride.flowTitle",{name:e.label}),onClose:t}),y?(0,F.jsx)("span",{className:"truncate text-[10.5px] font-semibold text-danger",title:y,children:y}):null,j?(0,F.jsx)("span",{className:"truncate text-[10.5px] font-semibold text-success",children:j}):null,(0,F.jsx)("span",{className:"text-[10.5px] font-bold text-primary",children:r("groupOverride.reviewerRole")}),(0,F.jsxs)("div",{className:"flex items-end gap-1.5",children:[(0,F.jsx)(bC,{value:s,onChange:e=>{var t;(t={setEngine:l,setModel:c,setEffort:u,effort:d}).setEngine(e),t.setModel(""),t.effort&&!sW.Lw[e].includes(t.effort)&&t.setEffort("")}}),(0,F.jsx)(bS,{engine:s,value:d,onChange:u,label:r("groupOverride.effort")})]}),(0,F.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,F.jsx)("span",{className:by,children:r("groupOverride.model")}),(0,F.jsx)("input",{className:bk,value:o,placeholder:r("groupOverride.modelPlaceholder"),onChange:e=>c(e.target.value)})]}),(0,F.jsx)("button",{className:bj,disabled:v||S,onClick:()=>void I(r("groupOverride.savedReviewer"),()=>e1(i.id,{action:"set-roles",roles:{reviewer:{engine:s,model:o.trim()||null,effort:d||null}}})),children:r("groupOverride.applyRole")}),(0,F.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,F.jsx)("span",{className:by,children:r("groupOverride.nextRoundNote")}),(0,F.jsx)("textarea",{className:"min-h-[52px] w-full resize-y rounded-[8px] border border-border bg-canvas px-2 py-1.5 text-[11.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-50",value:p,placeholder:r("groupOverride.notePlaceholder"),disabled:!A||v,onChange:e=>m(e.target.value)}),A?null:(0,F.jsx)("span",{className:"text-[10px] font-semibold text-muted",children:r("groupOverride.noteUnavailable")})]}),(0,F.jsxs)("div",{className:"flex items-end gap-1.5",children:[(0,F.jsxs)("label",{className:"flex w-[86px] flex-col gap-1",children:[(0,F.jsx)("span",{className:by,children:r("groupOverride.roundLimit")}),(0,F.jsx)("input",{className:bk,type:"number",min:0,max:50,value:g,onChange:e=>b(e.target.value)})]}),(0,F.jsx)("button",{className:bN,disabled:v||S,onClick:()=>void I(r("groupOverride.savedLimit"),()=>e1(i.id,{action:"set-round-limit",rounds:Math.max(0,Math.min(50,Number(g)||0))})),children:r("groupOverride.setLimit")}),(0,F.jsx)("button",{className:bN,disabled:v||S,onClick:()=>void I(r("groupOverride.savedExtend"),()=>e1(i.id,{action:"extend",rounds:1})),children:r("groupOverride.extend")})]}),(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[C?(0,F.jsxs)("button",{className:bj+" flex-1",disabled:v,onClick:()=>void I("retry-round"===C.action?r("groupOverride.savedRetry"):r(C.labelKey),()=>e1(i.id,{action:C.action,...A?{note:p.trim()}:{}})),children:[(0,F.jsx)(xq.A,{className:"h-3 w-3","aria-hidden":!0})," ",r(C.labelKey)]}):null,"reviewing"===i.state?(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-danger/40 bg-danger-soft px-3 py-1 text-[11px] font-bold text-danger hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:v,onClick:()=>void I(r("groupOverride.savedCancel"),()=>e1(i.id,{action:"cancel-round"})),children:[(0,F.jsx)(mS.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.stopReviewer")]}):null]}),(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[S?null:"paused"===i.state?(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-success/40 bg-success-soft px-3 py-1 text-[11px] font-bold text-success hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:v,onClick:()=>void I(r("flowStrip.resume"),()=>e1(i.id,{action:"resume"})),children:[(0,F.jsx)(xW.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.resume")]}):(0,F.jsxs)("button",{className:bN,disabled:v,onClick:()=>void I(r("flowStrip.pause"),()=>e1(i.id,{action:"pause"})),children:[(0,F.jsx)(m0.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.pause")]}),(0,F.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:v,onClick:()=>void I(r("flowStrip.close"),()=>e1(i.id,{action:"close"})),children:[(0,F.jsx)(H.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.close")]})]})]})}function bI(e,t){return[...e].sort((e,n)=>t(e).localeCompare(t(n)))}let bM=[],bT=new Map;function b$(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}let bE="cubic-bezier(.22,.8,.36,1)",bR=`transform 380ms ${bE}`,bP=`left 380ms ${bE}, top 380ms ${bE}, width 380ms ${bE}, height 380ms ${bE}, transform 380ms ${bE}`,bO=1/0,bD=(0,B.memo)(function({edges:e,badgeAnchors:t,badgeAnchorRevision:n=0,width:r,height:i}){return(0,F.jsx)("svg",{width:r,height:i,className:"absolute left-0 top-0","aria-hidden":!0,children:e.map(e=>{let n=e.sourceConversationId&&e.targetConversationId?t?.anchorFor(e.sourceConversationId,e.targetConversationId)??null:null,r=n?.x??e.x1,i=n?.y??e.y1,a=Math.max(36,(e.y2-i)*.5),s=`M ${r} ${i} C ${r} ${i+a}, ${e.x2} ${e.y2-a}, ${e.x2} ${e.y2-7}`,l=`M ${e.x2-5} ${e.y2-9} L ${e.x2+5} ${e.y2-9} L ${e.x2} ${e.y2-1} Z`;return(0,F.jsxs)("g",{opacity:e.live?.9:.5,children:[(0,F.jsx)("path",{d:s,style:{d:`path("${s}")`,transition:`d 380ms ${bE}`},fill:"none",stroke:e.color,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:e.dashed?"5 7":void 0}),(0,F.jsx)("circle",{cx:r,cy:i,r:3.5,fill:e.color,style:{cx:`${r}px`,cy:`${i}px`,transition:`cx 380ms ${bE}, cy 380ms ${bE}`}}),(0,F.jsx)("path",{d:l,style:{d:`path("${l}")`,transition:`d 380ms ${bE}`},fill:e.color})]},e.to)})})}),bL=Math.atan2(56,45),bF=Math.atan2(-56,-45);function b_(e,t,n){let r=e-9*Math.cos(n),i=t-9*Math.sin(n),a=-Math.sin(n),s=Math.cos(n);return`M ${r+5*a} ${i+5*s} L ${r-5*a} ${i-5*s} L ${e} ${t} Z`}let bq=(0,B.memo)(function({loops:e,width:t,height:n}){return e.length?(0,F.jsx)("svg",{width:t,height:n,className:"absolute left-0 top-0","aria-hidden":!0,children:e.map(e=>{let t=eQ(e.flow),n=e.y+150,r=e.y+330,i=`M ${e.x1} ${n} C ${e.x1+52} ${n-56}, ${e.x2-52} ${n-56}, ${e.x2-7} ${n}`,a=`M ${e.x2} ${r} C ${e.x2-52} ${r+56}, ${e.x1+52} ${r+56}, ${e.x1+7} ${r}`,s=b_(e.x2-7,n,bL),l=b_(e.x1+7,r,bF),o=(e,t)=>({d:e,fill:"none",stroke:t?"var(--color-accent)":"var(--color-strong)",strokeWidth:t?3:2.5,strokeLinecap:"round",className:t?"loop-arc-live":void 0,style:{d:`path("${e}")`,transition:`d 380ms ${bE}`}}),c=e=>({d:`path("${e}")`,transition:`d 380ms ${bE}`});return(0,F.jsxs)("g",{children:[(0,F.jsx)("path",{...o(i,"forward"===t)}),(0,F.jsx)("path",{d:s,style:c(s),fill:"forward"===t?"var(--color-accent)":"var(--color-strong)"}),(0,F.jsx)("path",{...o(a,"back"===t)}),(0,F.jsx)("path",{d:l,style:c(l),fill:"back"===t?"var(--color-accent)":"var(--color-strong)"})]},e.key)})}):null}),bz=(0,B.memo)(function({links:e,byPath:t,obstacles:n=[],interactive:r,hubInteractive:i=r,width:a,height:s}){if(!e.length)return null;let l=e.filter(e=>e.pipeline&&!e.pipeline.anchorOnly&&t.has(e.from)&&t.has(e.to)),o=new Map(l.map(e=>[e.key,(e=>{let r=t.get(e.from),i=t.get(e.to),a=function(e,t,n=14){let r={x:e.x+e.w/2,y:e.y+e.h/2},i={x:t.x+t.w/2,y:t.y+t.h/2},a=Math.abs(i.x-r.x)>=Math.abs(i.y-r.y),s=r.x,l=r.y,o=i.x,c=i.y;a?(s=i.x>=r.x?e.x+e.w:e.x,o=i.x>=r.x?t.x:t.x+t.w,l+=n,c+=n):(l=i.y>=r.y?e.y+e.h:e.y,c=i.y>=r.y?t.y:t.y+t.h,s+=n,o+=n);let d=o-s,u=c-l,p=Math.hypot(d,u)||1,m=d/p,f=u/p,h=-f,x=[];for(let e=22;e<p-10;e+=22){let t=s+m*e,n=l+f*e,r=t-5*m,i=n-5*f;x.push(`M ${(r+5*h).toFixed(1)} ${(i+5*m).toFixed(1)} L ${t.toFixed(1)} ${n.toFixed(1)} L ${(r-5*h).toFixed(1)} ${(i-5*m).toFixed(1)}`)}return{x1:s,y1:l,x2:o,y2:c,chevrons:x}}(r,i),s=n.filter(e=>e!==r&&e!==i);if(!s.some(e=>hA(a.x1,a.y1,a.x2,a.y2,e,10)))return{d:`M ${a.x1} ${a.y1} L ${a.x2} ${a.y2}`,mid:{x:(a.x1+a.x2)/2,y:(a.y1+a.y2)/2},chevrons:a.chevrons};let l=hT({x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},s);return{d:l.d,mid:l.mid,chevrons:[]}})(e)]));return(0,F.jsxs)(F.Fragment,{children:[l.length?(0,F.jsx)("svg",{width:a,height:s,className:"absolute left-0 top-0","aria-hidden":!0,children:l.map(e=>{let t=o.get(e.key),n=dK[e.pipeline.tone],r=t.d,i=("active"===e.pipeline.tone||!!e.pipeline.isNext)&&!e.pipeline.paused,a="fail"===e.pipeline.edge;return(0,F.jsxs)("g",{"data-pipeline-edge":e.pipeline.edge??"pass","data-edge-next":e.pipeline.isNext?"true":void 0,children:[(0,F.jsx)("path",{d:r,className:i&&!a?"pipeline-rail-live":void 0,style:{d:`path("${r}")`,transition:`d 380ms ${bE}`},fill:"none",stroke:n,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:a?"6 6":"dim"===e.pipeline.tone?"5 7":void 0}),t.chevrons.map((e,t)=>(0,F.jsx)("path",{d:e,fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",opacity:.9},t))]},e.key)})}):null,e.map(e=>{let n=t.get(e.from),a=t.get(e.to);if(!n||!a)return null;if(e.pipeline){let t=o.get(e.key),r=e.pipeline.anchorOnly?n.x+n.w/2:t?.mid.x??n.x+n.w/2,a=e.pipeline.anchorOnly?n.y:t?.mid.y??n.y;return e.pipeline.hub?(0,F.jsx)(br,{pipeline:e.pipeline.pipeline,x:r,y:a,interactive:i,moveTransition:bR},e.key):(0,F.jsx)(bB,{index:e.pipeline.index,total:e.pipeline.total,color:dK[e.pipeline.tone],x:r,y:a,moveTransition:bR},e.key)}if(!e.flow)return null;let s=(n.x+n.w+a.x)/2,l=Math.min(n.y,a.y)+240;return(0,F.jsx)(bt,{flow:e.flow.flow,x:s,y:l,interactive:r,moveTransition:bR},e.key)})]})}),bH=(0,B.memo)(function({groups:e,interactive:t}){let{t:n}=(0,er.Ym)(),[r,i]=(0,B.useState)(null);if(!e.length)return null;let a=t?e.find(e=>e.id===r)??null:null;return(0,F.jsxs)("div",{"aria-hidden":!1,children:[e.map(e=>{let r,s,l=e.pipeline?.state==="draft",o=l?"var(--color-warning)":`hsl(${e.hue} 62% 42%)`,c=l?"var(--color-warning-soft)":`hsl(${e.hue} 62% 42% / 0.055)`,d=a?.id===e.id;return(0,F.jsxs)("div",{"data-scheme-group":e.kind,"data-pipeline-draft":l||void 0,className:"pointer-events-none absolute",style:{left:e.x,top:e.y,width:e.w,height:e.h,transition:bP},children:[(0,F.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0 rounded-[20px] border-2 border-dashed",style:{borderColor:o,backgroundColor:c,...l?{backgroundImage:"repeating-linear-gradient(135deg, transparent 0 12px, color-mix(in srgb, var(--color-warning) 7%, transparent) 12px 14px)"}:{}}}),(0,F.jsxs)("button",{"data-scheme-ui":!0,"data-pipeline-group-header":e.pipeline?e.id:void 0,className:`absolute -top-3 left-5 z-[8] inline-flex max-w-[26em] items-center gap-[0.4em] rounded-full bg-card px-[0.7em] py-[0.15em] font-bold shadow-1 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-default ${t?"pointer-events-auto":""}`,style:{borderColor:o,color:o,borderWidth:"0.18em",borderStyle:l?"dashed":"solid",fontSize:(r=Number.isFinite(bO)?`min(var(--inv-z, 1), ${bO})`:"var(--inv-z, 1)",`calc(11px * ${r})`)},"aria-expanded":d,"aria-haspopup":"dialog",disabled:!t,onClick:()=>i(t=>t===e.id?null:e.id),children:[(0,F.jsx)("span",{"aria-hidden":!0,children:"pipeline"===e.kind?"⇢":"⟳"}),(0,F.jsx)("span",{className:"truncate",children:e.label}),e.pipeline?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{"data-pipeline-progress":!0,className:"shrink-0 rounded-full px-[0.5em] py-[0.02em] tabular-nums opacity-90",style:{backgroundColor:c},children:(s=dA(e.pipeline),`${s.k}/${s.n}`)}),(0,F.jsx)("span",{"data-pipeline-lifecycle":!0,className:"shrink-0 truncate opacity-80",children:c6(n,e.pipeline.state)})]}):null,(0,F.jsx)("span",{"aria-hidden":!0,className:"shrink-0 opacity-70",children:"▾"})]})]},e.key)}),a?(0,F.jsx)("div",{className:"pointer-events-auto absolute left-0 top-0 z-[45]",style:{transform:`translate(${a.x+20}px, ${a.y+16}px)`,transition:bP},onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),i(null))},children:(0,F.jsx)(bv,{group:a,onClose:()=>i(null)})}):null]})});function bB({index:e,total:t,color:n,x:r,y:i,moveTransition:a}){return(0,F.jsxs)("div",{"data-scheme-ui":!0,className:"pointer-events-none absolute left-0 top-0 z-[4] inline-flex h-[18px] -translate-x-1/2 -translate-y-1/2 items-center gap-0.5 rounded-full border bg-card px-1.5 text-[9.5px] font-bold shadow-1",style:{transform:`translate(${r}px, ${i}px) translate(-50%, -50%)`,transition:a,borderColor:n,color:n},"aria-hidden":!0,children:[(0,F.jsx)("span",{children:"›"}),(0,F.jsxs)("span",{children:[e,"/",t]})]})}function bU({file:e,className:t}){let n=function(e,t=Date.now(),n=(0,er.JK)()){let r=e.lastTurn;if(r&&null===r.endedAt&&"live"===e.activity){let e=Math.max(0,(t-r.startedAt)/1e3);return{running:(0,er.Tl)(n,"turn.running",{d:fa(e,n)}),idleTitle:null}}let i=fs(e);return null!==i?{running:null,idleTitle:(0,er.Tl)(n,"turn.lastRun",{d:fa(i,n)})}:{running:null,idleTitle:null}}(e);return n.running?(0,F.jsx)("span",{className:`${t??""} shrink-0 font-semibold tabular-nums text-success`,children:n.running}):(0,F.jsx)("span",{className:`${t??""} shrink-0 tabular-nums text-muted`,title:n.idleTitle??void 0,children:(0,tt.rK)(e.mtime)})}function bK({file:e,onSelect:t}){let n=(0,tt.yz)(e);return(0,F.jsxs)("button",{className:"flex h-8 w-full min-w-0 items-center gap-1.5 rounded-[8px] px-2 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:(0,tt.cr)(e.title),onClick:()=>t(e),children:[(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:n.style,children:n.label}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:(0,tt.cr)(e.cmdDesc||e.title,80)}),(0,F.jsx)("span",{className:"shrink-0 text-[10.5px] text-muted",children:(0,tt.rK)(e.mtime)})]})}function bY({file:e}){let t=(0,tt.yz)(e);return(0,F.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[3] flex items-center justify-center",style:{opacity:"var(--label-o, 0)",transition:"opacity .25s"},"aria-hidden":!0,children:(0,F.jsxs)("div",{className:"flex max-w-[94%] items-center gap-[0.5em] rounded-[0.55em] border border-border bg-card/95 px-[0.75em] py-[0.45em] shadow-2",style:{fontSize:"calc(13px * min(var(--inv-z, 1), 2.6))"},children:[(0,F.jsx)("span",{className:`h-[0.6em] w-[0.6em] shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-[0.45em] font-bold",style:{...t.style,fontSize:"0.72em"},children:t.label}),(0,F.jsx)(fS,{rateLimit:e.rateLimit}),(0,F.jsx)(fE,{wakeup:e.pendingWakeup,interactive:!1},f$(e.pendingWakeup)),(0,F.jsx)("span",{className:"line-clamp-2 min-w-0 font-bold",children:(0,tt.cr)(e.title,70)})]})})}let bW=()=>void 0,bJ=e=>e?" opacity-35":"";function bV({node:e,ringed:t,dimmed:n,flow:r}){let{t:i}=(0,er.Ym)(),a=(0,tt.yz)(e.file);return(0,F.jsxs)("div",{"data-scheme-node":e.file.path,className:`scheme-enter absolute${bJ(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:[r?(0,F.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,F.jsx)(bd,{flow:r,onFocusRound:bW})}):null,e.under.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-border bg-card/70 shadow-1","aria-hidden":!0}),(0,F.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-border bg-card/90 shadow-1","aria-hidden":!0})]}):null,(0,F.jsxs)("div",{className:`relative z-[1] flex h-full min-w-0 flex-col overflow-hidden rounded-[10px] border border-border bg-card shadow-1 ${t?"ring-2 ring-accent/60 ring-offset-2 ring-offset-canvas":""}`,children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:(0,tt.gA)(e.file)}),(0,F.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5",children:[(0,F.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${(0,tt.tz)(e.file.activity)}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[11px] font-bold",style:a.style,children:a.label}),e.file.model?(0,F.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-muted",children:e.file.model}):null,(0,F.jsx)(fS,{file:e.file}),(0,F.jsx)(fE,{wakeup:e.file.pendingWakeup,className:"pointer-events-auto"},f$(e.file.pendingWakeup)),(0,F.jsx)(bU,{file:e.file,className:"ml-auto text-[11px]"})]}),(0,F.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[14px] font-semibold leading-snug",children:(0,F.jsx)("span",{className:"line-clamp-5",children:(0,tt.cr)(e.file.title,180)})}),e.under.length?(0,F.jsxs)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-muted",children:[e.under.length," ",i("scheme.underneath")]}):null]}),r?(0,F.jsx)(bu,{role:"implementer",active:"implementer"===eX(r)}):null,(0,F.jsx)(bY,{file:e.file})]})}function bG({draft:e,ringed:t,dimmed:n}){let{t:r}=(0,er.Ym)();return(0,F.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${bJ(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:(0,F.jsx)("div",{className:`flex h-full items-center justify-center rounded-[10px] border border-dashed border-border bg-card/70 ${t?"ring-2 ring-accent/60 ring-offset-2 ring-offset-canvas":""}`,children:(0,F.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-semibold text-muted",children:[(0,F.jsx)("span",{className:"text-[15px] leading-none text-accent",children:"+"})," ",r("mobile.agent")]})})})}function bX({deck:e,dimmed:t}){let{t:n}=(0,er.Ym)(),r=e.rounds.at(-1)??null,i=r?.round??null,a=e0(i?.verdict??null);return(0,F.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${bJ(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:[(0,F.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-border bg-card shadow-1",children:i?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-2.5",style:{backgroundColor:a.soft,color:a.color},children:[(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[12px] font-bold",children:["R",i.n," ",(0,F.jsx)(xD,{verdict:i.verdict,error:!!i.error,className:"h-3.5 w-3.5"})]}),(0,F.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:i.error?n("roundDeck.aborted"):i.verdict??n("roundDeck.reviewInProgress")})]}),(0,F.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[13px] font-semibold leading-snug",children:(0,F.jsx)("span",{className:"line-clamp-4",children:r?.file?(0,tt.cr)(r.file.title,140):n("roundDeck.spawningReviewer")})}),e.rounds.length>1?(0,F.jsx)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-muted",children:n("roundDeck.moreRounds",{count:e.rounds.length-1})}):null]}):(0,F.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] font-semibold text-muted",children:n("roundDeck.waitingFirst")})}),(0,F.jsx)(bu,{role:"reviewer",active:"reviewer"===eX(e.flow)})]})}function bQ({stack:e,dimmed:t,onSelect:n}){let{t:r}=(0,er.Ym)();return(0,F.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${bJ(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:(0,F.jsx)("div",{className:"flex h-full flex-col gap-1.5 overflow-y-auto rounded-[10px] border border-dashed border-strong bg-card/60 p-2",children:e.items.map(({file:e,branches:t})=>{let i=(0,tt.yz)(e);return(0,F.jsxs)("button",{className:"flex min-h-[52px] w-full min-w-0 flex-col justify-center gap-0.5 rounded-[8px] border border-border bg-card px-2 py-1 text-left shadow-1 hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:(0,tt.cr)(e.title),onClick:()=>n(e),children:[(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:i.style,children:i.label}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:(0,tt.cr)(e.title,70)})]}),(0,F.jsxs)("span",{className:"flex items-center gap-2 pl-3 text-[10.5px] text-muted",children:[(0,F.jsx)("span",{children:fO(r,e.kind)}),(0,F.jsx)("span",{children:(0,tt.rK)(e.mtime)}),t?(0,F.jsxs)("span",{children:["⤷ ",t]}):null]})]},e.path)})})})}function bZ({path:e,marked:t,session:n,onToggle:r,onHoverChange:i}){let{t:a}=(0,er.Ym)(),[s,l]=(0,B.useState)(!1),o=e=>{l(e),i(e)},c=t||s||n;return(0,F.jsx)("div",{"data-scheme-ui":!0,className:"scheme-select-check-zone pointer-events-auto absolute -right-5 -top-5 z-[8] h-7 w-7",onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:(0,F.jsx)("button",{type:"button","data-select-check":e,"data-select-check-revealed":c?"true":"false","aria-pressed":t,title:a(t?"scheme.selectCheckOff":"scheme.selectCheckOn"),"aria-label":a(t?"scheme.selectCheckOff":"scheme.selectCheckOn"),className:`scheme-select-check absolute bottom-0.5 left-0.5 flex h-6 w-6 items-center justify-center rounded-full border-2 border-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60 ${c?"opacity-100":"opacity-0"} ${t?"bg-accent text-white shadow-1":n?"bg-accent/60 text-white shadow-1 hover:bg-accent/80":"bg-accent/35 text-white/85 hover:bg-accent/70"}`,onClick:t=>{t.stopPropagation(),r(e)},children:(0,F.jsx)(m1.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})}function b0({node:e,ringed:t,marked:n,session:r,onToggleMember:i,dimmed:a,dormant:s,flow:l,pipeline:o,pipelineStage:c,flows:d,files:u,renderablePaths:p,renderableFlows:m,linkedTasks:f,relatedTasks:h,canFlow:x,canPipeline:g,onSelect:b,onOpenPath:v,onOpenFlow:w,onOpenTask:y,onClose:k,onFocusRound:j,onHandoff:N,onSpawnRetry:S,onExpand:C,onPipelineCreated:A,badgeAnchors:I,trayApi:M}){let T,{t:$}=(0,er.Ym)(),[E,R]=(0,B.useState)(!1),[P,O]=(0,B.useState)(!1),[D,L]=(0,B.useState)(!1),[_,q]=(0,B.useState)(!1),[z,H]=(0,B.useState)(!1),K=o&&!l?o:null;return(0,F.jsxs)("div",{"data-scheme-node":e.file.path,"data-pipeline-stage-card":c?`${c.pipeline.id}::${c.stage.id}`:void 0,"data-pipeline-stage-state":c?dp(c.pipeline,c.stage):void 0,"data-lasso-selected":n?"true":void 0,"data-select-check-hover":z?"true":void 0,className:`scheme-enter absolute ${_?"z-[60]":E||P?"z-20":""}${bJ(a)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:[i?(0,F.jsx)(bZ,{path:e.file.path,marked:n,session:r,onToggle:i,onHoverChange:H}):null,n?(0,F.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-[4] rounded-[10px] bg-accent/[0.06]"}):null,c?(0,F.jsxs)("span",{className:"pointer-events-none absolute -top-3 right-3 z-[7] inline-flex h-6 max-w-[78%] items-center gap-1.5 rounded-full border border-accent/35 bg-card px-2 text-[10.5px] font-bold text-accent shadow-1",title:dy($,c.stage),children:[(0,F.jsx)("span",{className:"truncate",children:dy($,c.stage)}),(0,F.jsxs)("span",{className:"shrink-0 text-muted",children:[c.index+1,"/",c.total]})]}):null,l?(0,F.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,F.jsx)(bd,{flow:l,onFocusRound:e=>j(l.id,e)})}):null,K?(0,F.jsx)("div",{className:"absolute -top-[60px] left-0 z-[5]",style:{width:e.w},children:(0,F.jsx)(x9,{pipeline:K,flows:d,files:u,renderablePaths:p,renderableFlows:m,linkedTasks:f,compact:!0,onOpenPath:v,onOpenFlow:w,onOpenTask:y})}):null,x||g?(0,F.jsxs)("div",{className:`absolute left-0 z-[4] flex items-center gap-1.5 ${l||K?"-top-[92px]":"-top-11"}`,children:[x?(0,F.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":P,title:$("scheme.flowTitle"),onClick:()=>O(e=>!e),children:[(0,F.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",$("scheme.flow")]}):null,g?(0,F.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":D,title:$("scheme.pipelineTitle"),onClick:()=>L(!0),children:[(0,F.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⇢"})," ",$("scheme.pipeline")]}):null]}):null,P?(0,F.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,F.jsx)(g9,{file:e.file,onClose:()=>O(!1)})}):null,D?(0,F.jsx)(hh,{repoDir:e.file.projectRoot?.trim()||e.file.cwd?.trim()||"",onClose:()=>L(!1),onCreate:(t,n)=>dD(e.file.project,n,t??void 0,e.file.path),onCreated:e=>{L(!1),A?.(e)}}):null,e.under.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-border bg-card/70 shadow-1","aria-hidden":!0}),(0,F.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-border bg-card/90 shadow-1","aria-hidden":!0})]}):null,(0,F.jsx)("div",{className:`relative z-[1] flex h-full ${t?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-canvas":""}`,children:(0,F.jsx)(fF,{file:e.file,tasks:e.tasks,isRoot:e.isRoot,dormant:s,showFavorite:!0,titleOverride:dN($,c),onClose:()=>k(e.file.path),onToggleExpand:()=>C(e.file.path),onSpawnRetry:S,relatedTasks:h,onOpenTask:y})}),(0,F.jsx)(gm,{conversationId:U(e.file),entries:u,cardRect:e,anchorRegistry:I,onExpandedChange:q,exclude:M?.foldedChildPaths,onFold:M?.onFoldChild,onNavigate:e=>{let t=u.find(t=>t.path===e);t&&b(t)}}),(T=M?.trays.get(U(e.file)))?(0,F.jsx)(gl,{tray:T,onToggleExpanded:e=>M.onToggleExpanded(T.parentConversationId,e),onOpenMember:M.onOpenMember,onUnfold:M.onUnfold}):null,l?(0,F.jsx)(bu,{role:"implementer",active:"implementer"===eX(l)}):null,(0,F.jsx)(bY,{file:e.file}),N&&gM(e.file)?(0,F.jsx)(gT,{file:e.file,onHandoff:()=>N(e.file)}):null,e.under.length?(0,F.jsxs)("button",{className:"absolute -bottom-11 left-1/2 z-[2] inline-flex h-7 -translate-x-1/2 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":E,title:$("scheme.collapsedTitle"),onClick:()=>R(e=>!e),children:[(0,F.jsx)(cm.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.under.length," ",$("scheme.underneath"),(0,F.jsx)(i9.c_,{className:`h-3 w-3 transition-transform ${E?"rotate-90":""}`,"aria-hidden":!0})]}):null,E?(0,F.jsx)("div",{className:"absolute left-0 top-[calc(100%+52px)] z-30 max-h-[280px] w-full overflow-y-auto rounded-[10px] border border-border bg-card p-1.5 shadow-2",children:e.under.map(e=>(0,F.jsx)(bK,{file:e,onSelect:b},e.path))}):null]})}function b1({draft:e,project:t,files:n,ringed:r,dimmed:i,onDraftClose:a,onDraftSpawned:s}){return(0,F.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${bJ(i)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:(0,F.jsx)("div",{className:`flex h-full ${r?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-canvas":""}`,children:nb(e.id)?(0,F.jsx)(xd,{draftId:e.id,project:t,onClose:()=>a(e.id),onLaunched:()=>a(e.id)}):(0,F.jsx)(hc,{draftId:e.id,project:t,files:n,onClose:()=>a(e.id),onSpawned:t=>s(e.id,t)})})})}function b2({onClose:e}){return(0,B.useEffect)(()=>{let t=t=>{if("Escape"!==t.key)return;let n=t.target;n&&(["INPUT","TEXTAREA","SELECT"].includes(n.tagName)||n.isContentEditable)||(t.preventDefault(),t.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),null}function b5({slot:e,lite:t,dimmed:n,files:r,onSelect:i}){let a,{t:s}=(0,er.Ym)(),[l,o]=(0,B.useState)(!1),[c,d]=(0,B.useState)(!1),u=de[dp(e.pipeline,e.stage)],{pipeline:p}=e;if(e.collapsedRow){let a=e.attempt?df(e.attempt):null,s=a?dh(a,r):null,l=`${e.key}::card`;return(0,F.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${bJ(n)} ${c?"z-30":""}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:[e.incoming?(0,F.jsx)("span",{"aria-hidden":!0,className:"absolute z-[2] inline-flex h-6 -translate-x-1/2 -translate-y-1/2 items-center rounded-full border bg-card px-1.5 text-[12px] font-bold shadow-1",style:{left:-36,top:e.incomingAnchorY??110,borderColor:u.color,color:u.color},children:"review-loop"===e.incoming?"⟳":"→"}):null,(0,F.jsx)(bs,{slot:e,expanded:c,controls:l,onToggle:t?void 0:()=>d(e=>!e)}),c?(0,F.jsxs)("div",{id:l,"data-stage-row-card":!0,className:"absolute left-0 top-[calc(100%+8px)] z-30 flex",style:{width:e.w,height:620},children:[(0,F.jsx)(b2,{onClose:()=>d(!1)}),"completed"===e.presentation?(0,F.jsx)(ba,{slot:e,onOpen:s&&!t?()=>i(s):void 0}):(0,F.jsx)(x5,{slot:e,interactive:!t})]}):null]})}if("completed"===e.presentation){let a=e.attempt?df(e.attempt):null,s=a?dh(a,r):null;return(0,F.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${bJ(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:[e.incoming?(0,F.jsx)("span",{"aria-hidden":!0,className:"absolute z-[2] inline-flex h-6 -translate-x-1/2 -translate-y-1/2 items-center rounded-full border bg-card px-1.5 text-[12px] font-bold shadow-1",style:{left:-36,top:e.incomingAnchorY??110,borderColor:u.color,color:u.color},children:"review-loop"===e.incoming?"⟳":"→"}):null,(0,F.jsx)(ba,{slot:e,onOpen:s&&!t?()=>i(s):void 0})]})}let m="draft"===p.state,f=e.index===e.total-1,h=p.stages.map(e=>e.kind),x=m&&!t&&p.stages.length<8,g=x&&dR(((a=[...h]).splice(e.index+1,0,"review-loop"),a)),b=t=>{let n,r,i,a;if(l)return;o(!0);let s=new Set(p.stages.map(e=>e.id)),c=p.stages.length+1;for(;s.has(`stage-${c}`);)c+=1;let d=e.index+1,u={id:`stage-${c}`,kind:t,prompt:d>0?"{{prev.output}}":"{{task}}",next:null};dU(p.id,"add-stage",{index:d,stage:u},(i=(r=Math.max(0,Math.min(d,(n=[...p.stages]).length)))>0?n[r-1]:null,a={...u,next:i?i.next??null:n[r]?.id??null,effectiveRole:{...dz,roleId:u.role?.roleId??null,...u.engine?{engine:u.engine}:{},access:u.access??("review-loop"===u.kind?"read-only":"read-write")}},i&&(n[r-1]={...i,next:a.id}),n.splice(r,0,a),{...p,stages:dH(n)})).then(e=>{e&&s3("err",e),o(!1)})};return(0,F.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${bJ(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:[e.incoming?(0,F.jsx)("span",{"aria-hidden":!0,className:"absolute z-[2] inline-flex h-6 -translate-x-1/2 -translate-y-1/2 items-center rounded-full border bg-card px-1.5 text-[12px] font-bold shadow-1",style:{left:-36,top:e.incomingAnchorY??110,borderColor:u.color,color:u.color},children:"review-loop"===e.incoming?"⟳":"→"}):null,(0,F.jsx)("div",{className:"flex h-full",children:(0,F.jsx)(x5,{slot:e,interactive:!t})}),x&&f?(0,F.jsxs)("div",{"data-scheme-ui":!0,className:"absolute left-full top-[110px] z-[2] flex -translate-y-1/2 items-center",children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-0 w-5 border-t-2 border-dashed border-strong"}),(0,F.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-9 shrink-0 items-center gap-1 whitespace-nowrap rounded-full border-2 border-dashed border-border bg-card px-3 text-[11.5px] font-bold text-secondary shadow-1 hover:border-accent/60 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:l,title:s("pipelineSlot.addAgentTitle"),onClick:()=>b("run"),children:[(0,F.jsx)("span",{className:"text-[14px] leading-none text-accent","aria-hidden":!0,children:"+"})," ",s("pipelineSlot.addAgent")]})]}):null,x&&"run"===e.stage.kind?(0,F.jsx)("div",{className:"absolute -bottom-10 left-0 z-[2] flex items-center gap-1.5",children:(0,F.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:l||!g,title:s("pipelineSlot.addReviewTitle"),onClick:()=>b("review-loop"),children:[(0,F.jsx)("span",{className:"text-[13px] leading-none text-accent","aria-hidden":!0,children:"⟳"})," ",s("pipelineSlot.addReview")]})}):null]})}function b3({deck:e,focus:t,dimmed:n,dormant:r,groupLabel:i}){let a=t&&t.flowId===e.flow.id?t.round+t.nonce/1e3:null;return(0,F.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${bJ(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:bR},children:[(0,F.jsx)(x_,{flow:e.flow,rounds:e.rounds,focusRound:a,dormant:r,groupLabel:i}),(0,F.jsx)(bu,{role:"reviewer",active:"reviewer"===eX(e.flow)})]})}let b4=(0,B.memo)(function({layout:e,project:t,files:n,interactive:r,lite:i,dormant:a,selected:s,multi:l,session:o,focus:c,attentionPaths:d,flowsByImpl:u,flows:p,pipelines:m=[],pipelineStrips:f,linkedTasksByPipeline:h,relatedTasksByPath:x,deckFocus:g,badgeAnchors:b,trayApi:v,onSelect:w,onClose:y,onFocusRound:k,onDraftClose:j,onDraftSpawned:N,onHandoff:S,onSpawnRetry:C,onOpenTask:A,onExpand:I,onToggleMember:M,onPipelineCreated:T}){let $=aR(e=>{let t=new Map;if(!e.enabled)return t;for(let r of Object.values(e.store.sessions))if("tmux-legacy"!==r.hostKind&&r.artifactPath){var n;t.set(r.artifactPath,"working"===(n=n_(r,nq(e.store,r)))?"live":"waiting_input"===n||"conflict"===n?"stalled":"idle"===n||"dead"===n?"idle":"recent")}return t},bT,b$),E=e=>{let t=n.find(t=>t.path===e);t&&w(t)},R=(0,B.useMemo)(()=>new Set(n.map(e=>e.path)),[n]),P=(0,B.useMemo)(()=>dj(m),[m]),O=(0,B.useMemo)(()=>bI(e.stacks,e=>e.key),[e.stacks]),D=(0,B.useMemo)(()=>bI(e.decks,e=>e.key),[e.decks]),L=(0,B.useMemo)(()=>bI(e.drafts,e=>e.key),[e.drafts]),_=(0,B.useMemo)(()=>bI(e.slots,e=>e.key),[e.slots]),q=(0,B.useMemo)(()=>bI(e.nodes,e=>e.file.path),[e.nodes]),z=(0,B.useMemo)(()=>dm(p,new Set(e.nodes.map(e=>e.file.path))),[p,e]),H=e=>{let t=p.find(t=>t.id===e);t&&k(t.id,t.rounds.at(-1)?.n??1)},U=e=>null!==d&&!e.rounds.some(e=>e.file&&d.has(e.file.path));return(0,F.jsxs)("div",{className:`${r?"":"pointer-events-none select-none"} ${o?"scheme-session":""}`.trim()||void 0,children:[O.map(e=>(0,F.jsx)(bQ,{stack:e,dimmed:null!==d&&!e.items.some(e=>d.has(e.file.path)),onSelect:w},e.key)),D.map(e=>i?(0,F.jsx)(bX,{deck:e,dimmed:U(e)},e.key):(0,F.jsx)(b3,{deck:e,focus:g,dimmed:U(e),dormant:a,groupLabel:n.find(t=>t.path===e.flow.implementerPath)?.title},e.key)),_.map(e=>(0,F.jsx)(b5,{slot:e,lite:i,dimmed:null!==d,files:n,onSelect:w},e.key)),L.map(e=>i?(0,F.jsx)(bG,{draft:e,ringed:s===e.key||c===e.key,dimmed:null!==d},e.key):(0,F.jsx)(b1,{draft:e,project:t,files:n,ringed:s===e.key||c===e.key,dimmed:null!==d,onDraftClose:j,onDraftSpawned:N},e.key)),q.map(e=>{var t;let r,m=(r=$.get(e.file.path))?{...e,file:{...e.file,activity:r}}:e,g=f.get(m.file.path)??null;return i?(0,F.jsx)(bV,{node:m,ringed:s===m.file.path||c===m.file.path,dimmed:null!==d&&!d.has(m.file.path),flow:u.get(m.file.path)??null},m.file.path):(0,F.jsx)(b0,{node:m,ringed:o?l.has(m.file.path):s===m.file.path||c===m.file.path,marked:o&&l.has(m.file.path),session:o,onToggleMember:M,dimmed:null!==d&&!d.has(m.file.path),dormant:a,flow:u.get(m.file.path)??null,pipeline:g,pipelineStage:P.get(m.file.path)??null,linkedTasks:g?h.get(g.id)??[]:[],relatedTasks:x?.get(m.file.path)??bM,flows:p,files:n,renderablePaths:R,renderableFlows:z,canFlow:eW(m.file,u),canPipeline:("claude"===(t=m.file).engine||"codex"===t.engine)&&("claude-projects"===t.root?"session"===t.kind||"subagent"===t.kind:"codex-sessions"===t.root),onSelect:w,onOpenPath:E,onOpenFlow:H,onOpenTask:A,onClose:y,onFocusRound:k,onHandoff:S,onSpawnRetry:C,onExpand:I,onPipelineCreated:T,badgeAnchors:b,trayApi:v},m.file.path)})]})}),b6="var(--color-danger)",b8=(0,B.memo)(function({edges:e,world:t,routes:n,onRetry:r}){let i=(0,B.useMemo)(()=>e.map(e=>({edge:e,route:n.get(e.key)})),[e,n]);return e.length?(0,F.jsx)("svg",{width:t.w,height:t.h,viewBox:`${t.x} ${t.y} ${t.w} ${t.h}`,className:"pointer-events-none absolute z-[2]",style:{left:t.x,top:t.y},children:i.map(({edge:e,route:t})=>{let n="source"===e.relation,i=e.failed?b6:n?"var(--color-info)":fA[e.status].color,a=e.failed?.95:n?.4:.65,s=t.crosses?.4*a:a,l=t.d,o=t.mid.x,c=t.mid.y;return(0,F.jsxs)("g",{opacity:s,children:[(0,F.jsx)("path",{d:l,style:{d:`path("${l}")`,transition:`d 380ms ${bE}`},fill:"none",stroke:i,strokeWidth:n?1.75:2.5,strokeLinecap:"round",strokeDasharray:n?"2 6":"5 7"}),(0,F.jsx)("circle",{cx:e.x2,cy:e.y2,r:n?3:4,fill:i,style:{cx:`${e.x2}px`,cy:`${e.y2}px`,transition:`cx 380ms ${bE}, cy 380ms ${bE}`}}),e.failed&&"assignment"===e.relation?(0,F.jsxs)("g",{className:"pointer-events-auto cursor-pointer",role:"button","aria-label":`retry ${e.path}`,onClick:()=>r(e.taskId,e.path),children:[(0,F.jsx)("title",{children:e.error??""}),(0,F.jsx)("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:22,style:{pointerEvents:"stroke"}}),(0,F.jsx)("circle",{cx:o,cy:c,r:11,fill:"var(--color-card)",stroke:b6,strokeWidth:2,style:{cx:`${o}px`,cy:`${c}px`,transition:`cx 380ms ${bE}, cy 380ms ${bE}`}}),(0,F.jsx)("text",{x:o,y:c+4.5,textAnchor:"middle",fontSize:13,fontWeight:700,fill:b6,style:{x:`${o}px`,y:`${c+4.5}px`,transition:`x 380ms ${bE}, y 380ms ${bE}`},children:"⚠"})]}):null]},e.key)})}):null});var b7=n(6937),b9=n(4885);let ve="linear-gradient(to bottom, #000 calc(100% - 18px), transparent)";function vt({icon:e,ariaLabel:t,title:n,hoverClass:r,disabled:i,onClick:a,dataAttr:s}){return(0,F.jsx)("button",{type:"button",...s?{[s]:""}:{},className:`-my-1 flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"cursor-not-allowed opacity-40":r}`,"aria-label":t,title:n,"aria-disabled":i||void 0,onClick:()=>{i||a()},children:e})}function vn({task:e,assignment:t,file:n,onDetach:r,onOpen:i}){let{t:a}=(0,er.Ym)(),s=h0(t,n),[l,o]=(0,B.useState)(!1),c=async()=>{let n=t.launchId;if(n&&!l){o(!0);try{let t=await nx(e.id,n);"task"in t?s3("ok",a("tasks.retryLaunched")):s3("err",t.error)}finally{o(!1)}}},d={launchId:t.launchId??null,path:t.path,conversationId:t.conversationId??null,panePid:t.panePid},u=!!d.launchId?.trim()||!!d.path?.trim()||!!d.conversationId?.trim()||null!=d.panePid&&Number.isInteger(d.panePid)&&d.panePid>0;if("spawning"===s)return(0,F.jsxs)("span",{className:"flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-border bg-card/80 px-2 text-[10.5px] font-semibold text-muted",children:[(0,F.jsx)(up.A,{className:"h-3 w-3 shrink-0 animate-spin","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a("tasks.spawning")}),u?(0,F.jsx)(vt,{icon:(0,F.jsx)(H.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:a("tasks.detachAria",{title:a("tasks.spawning")}),title:a("tasks.detach"),hoverClass:"hover:bg-black/5 hover:text-danger",onClick:()=>r(e,d)}):null]});let p="failed"===s,m=h1(s),f="handoff"===t.state,h=n?(0,tt.yz)(n):null,x=n?(0,tt.cr)(n.title,40):t.path?t.path.split("/").pop()??t.path:a("tasks.failedChip"),g=p?t.error?a("tasks.chipFailedTitle",{error:t.error}):a("tasks.failedChip"):"gone"===s?a("tasks.deadChip"):"migrating"===s?a("tasks.migratingChip"):"killed"===s?a("tasks.killedChip"):"unhosted"===s?a("tasks.unhostedChip"):f?a("tasks.handoffChip"):n?(0,tt.cr)(n.title):void 0,b=p?"border-danger/25 bg-danger-soft text-danger":"gone"===s||"killed"===s?"border-border bg-sunken text-muted opacity-70":"migrating"===s||"unhosted"===s?"border-border bg-sunken text-muted":"border-border bg-card/80";return(0,F.jsxs)("span",{className:`flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[7px] border px-2 ${b}`,title:g,children:[f?(0,F.jsx)(d4.A,{className:"h-3 w-3 shrink-0 text-info","aria-hidden":!0}):null,n?(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(n.activity)}`}):null,h?(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:h.style,children:h.label}):null,(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:x}),p?(0,F.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,p&&t.launchId?(0,F.jsx)(vt,{icon:l?(0,F.jsx)(up.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,F.jsx)(ae.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:a("tasks.retryLaunchAria",{title:x}),title:a("tasks.retryLaunch"),hoverClass:"hover:bg-black/5 hover:text-accent",disabled:l,onClick:()=>void c(),dataAttr:"data-task-retry-launch"}):null,(0,F.jsx)(vt,{icon:(0,F.jsx)(b7.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:m?a("tasks.openAgentAria",{title:x}):a("tasks.openAgentUnavailableAria",{title:x,reason:g??a("tasks.unhostedChip")}),title:m?a("tasks.openAgent"):g??a("tasks.openAgent"),hoverClass:"hover:bg-black/5 hover:text-accent",disabled:!m,onClick:()=>{n&&m&&i(n)},dataAttr:"data-task-open-agent"}),u?(0,F.jsx)(vt,{icon:(0,F.jsx)(H.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:a("tasks.detachAria",{title:x}),title:a("tasks.detach"),hoverClass:"hover:bg-black/5 hover:text-danger",onClick:()=>r(e,d)}):null]})}function vr({task:e,file:t,onOpen:n}){let{t:r}=(0,er.Ym)(),i=e.source;if(!i)return null;let a=t?(0,tt.cr)(t.title,40):i.path.split("/").pop()??i.path,s=(0,tt.zZ)(i.engine);return(0,F.jsxs)("span",{className:"flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-info/20 bg-info-soft px-2 text-info",title:`${r("tasks.sourceTitle")}: ${i.text}`,children:[(0,F.jsx)(d4.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:s.style,children:s.label}),(0,F.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold",children:r("tasks.source")}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:a}),(0,F.jsx)(vt,{icon:(0,F.jsx)(b7.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:t?r("tasks.openSourceAria",{title:a}):r("tasks.openSourceUnavailableAria",{title:a,reason:r("tasks.sourceGone")}),title:r(t?"tasks.openSource":"tasks.sourceGone"),hoverClass:"hover:bg-black/5 hover:text-accent",disabled:!t,onClick:()=>{t&&n(t)},dataAttr:"data-task-open-source"})]})}let vi=(0,B.memo)(function({task:e,files:t,camRef:n,handlers:r,completedPipelines:i=[],onOpenPipelineHistory:a,selected:s=!1,expanded:l=!1}){let o,{t:c}=(0,er.Ym)(),[d,u]=(0,B.useState)(null),p=(0,B.useRef)(null),[m,f]=(0,B.useState)(null),[h,x]=(0,B.useState)(!1),[g,b]=(0,B.useState)(""),[v,w]=(0,B.useState)(!1),[y,k]=(0,B.useState)(!1),j=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>k(!1),4e3);return()=>window.clearTimeout(e)},[y]),(0,B.useEffect)(()=>{if(!h)return;let t=window.setTimeout(()=>{g.trim()&&g!==e.text&&r.patch(e.id,{text:g})},900);return()=>window.clearTimeout(t)},[h,g,e.id,e.text,r]);let N=()=>{if(x(!1),!g.trim()){g!==e.text&&(w(!0),s3("err",c("tasks.emptyTextBlocked")));return}w(!1),g!==e.text&&r.patch(e.id,{text:g})},S=()=>(h?!g.trim():!!v)&&(s3("err",c("tasks.emptyTextBlocked")),!0),C=d??(m&&m.seen===e.updatedAt?m:e.pos),A=fA[e.status],I=fM(e.text)||c("tasks.untitled"),M=e.text.includes("\n")?e.text.slice(e.text.indexOf("\n")+1):"",T=(0,B.useRef)(null),$=(0,B.useRef)(null),[E,R]=(0,B.useState)(null);(0,B.useLayoutEffect)(()=>{if(l||h)return;let e=()=>{let e=[T.current,$.current].filter(e=>null!==e);e.some(e=>e.clientHeight>0)&&R(e.some(e=>e.scrollHeight-e.clientHeight>1))};e();let t=!1;return document.fonts?.ready.then(()=>{t||e()}),()=>{t=!0}},[e.text,l,h]);let P=l||(E??((o=hw(e.text)).title>2||o.rest>3)),O=!l&&P,D=(0,B.useMemo)(()=>new Map(t.map(e=>[e.path,e])),[t]),L=(0,B.useMemo)(()=>new Map(t.filter(e=>e.conversationId).map(e=>[e.conversationId,e])),[t]),_=h||null!==d,q=ue({onDrop:t=>S()?null:(r.handoff(e,t.file),c("tasks.linkHanded",{title:(0,tt.cr)(t.file.title,48)})),onMiss:()=>{S()||r.draft(e)}});return(0,F.jsxs)("div",{"data-scheme-task":e.id,className:`group absolute pb-9 ${_?"z-30":"z-[4]"}`,style:{transform:`translate(${C.x}px, ${C.y}px)`,width:260,transition:d?void 0:`transform 380ms ${bE}`},onPointerDown:e=>{if(0===e.button&&!h&&!e.target.closest("button, a, input, textarea, select, [data-task-pop]")){p.current={sx:e.clientX,sy:e.clientY,ox:C.x,oy:C.y,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}},onPointerMove:e=>{let t=p.current;if(!t)return;let r=e.clientX-t.sx,i=e.clientY-t.sy;if(!t.moved&&4>Math.hypot(r,i))return;t.moved=!0;let a=n.current?.z??1;u({x:t.ox+r/a,y:t.oy+i/a})},onPointerUp:t=>{let i=p.current;if(p.current=null,i){if(i.moved){let a=n.current?.z??1,s={x:Math.round(i.ox+(t.clientX-i.sx)/a),y:Math.round(i.oy+(t.clientY-i.sy)/a)};u(null),f({...s,seen:e.updatedAt}),r.patch(e.id,{pos:s}).then(e=>{e&&f(null)});return}h||((n.current?.z??1)<.55&&r.center(hj(e,l)),b(e.text),x(!0),requestAnimationFrame(()=>{let e=j.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))}))}},children:[(0,F.jsxs)("div",{className:`relative flex flex-col overflow-hidden rounded-[10px] border border-border shadow-1 transition-shadow ${"done"===e.status?"opacity-60 saturate-50":""} ${_?"shadow-2":"group-hover:shadow-2"} ${h?"ring-2 ring-accent/50":s?"ring-2 ring-accent ring-offset-1 ring-offset-canvas":""}`,style:{backgroundColor:A.soft},children:[(0,F.jsx)("div",{"aria-hidden":!0,className:"h-1.5 w-full shrink-0",style:{backgroundColor:A.color}}),!h&&i.length?(0,F.jsx)("div",{className:"absolute right-2 top-2 z-[2] flex max-w-[92px] flex-col items-end gap-1",children:i.map(e=>(0,F.jsx)("button",{type:"button","data-task-pipeline-history":e.id,className:"max-w-full truncate rounded-[5px] bg-card/90 px-1.5 py-1 text-[9.5px] font-semibold text-success shadow-1 hover:bg-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("pipelineGroup.openHistory",{task:e.task}),title:e.task,onClick:()=>a?.(e),children:"✓ pipeline"},e.id))}):null,h?(0,F.jsx)("textarea",{ref:j,value:g,onChange:e=>b(e.target.value),onBlur:()=>{var e;return e=j.current,void(document.hasFocus()?N():window.addEventListener("focus",()=>e?.focus(),{once:!0}))},onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),N())},"aria-label":c("tasks.editAria"),rows:Math.min(16,Math.max(3,g.split("\n").length+1)),className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-primary placeholder:text-muted focus-visible:outline-none",maxLength:6e3}):(0,F.jsxs)("div",{"data-task-body":!0,...O?{"data-task-clipped":""}:{},className:`cursor-text py-2 pl-3 ${i.length?"pr-[104px]":"pr-3"}`,style:O?{maskImage:ve,WebkitMaskImage:ve}:void 0,children:[(0,F.jsx)("div",{ref:T,className:`whitespace-pre-wrap break-words text-[12.5px] font-semibold leading-[17px] tracking-[-0.006em] text-primary ${l?"":"line-clamp-2"}`,children:I}),M.trim()?(0,F.jsx)("div",{ref:$,className:`whitespace-pre-wrap break-words text-[12.5px] leading-[17px] text-secondary ${l?"":"line-clamp-3"}`,children:M}):null]}),e.source||e.assignments.length?(0,F.jsxs)("div",{className:"flex flex-col gap-1 px-2 pb-2",children:[(0,F.jsx)(vr,{task:e,file:e.source?D.get(e.source.path)??null:null,onOpen:r.openAgent}),e.assignments.map((t,n)=>(0,F.jsx)(vn,{task:e,assignment:t,file:(e=>{if(e.conversationId){let t=L.get(e.conversationId);if(t)return t}return e.path?D.get(e.path)??null:null})(t),onDetach:(e,t)=>r.unassign(e,t),onOpen:r.openAgent},t.launchId??t.conversationId??t.path??(null!=t.panePid?`pane:${t.panePid}`:`index:${n}`)))]}):null,!h&&P?(0,F.jsx)("div",{className:"px-2 pb-2",children:(0,F.jsxs)("button",{type:"button","data-task-disclosure":!0,"aria-expanded":l,className:"flex h-6 w-full items-center justify-center gap-1 rounded-[7px] border border-border bg-card/60 text-[10.5px] font-semibold text-muted transition-colors hover:bg-card hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>r.toggleExpand(e.id),children:[l?(0,F.jsx)(xH.A,{className:"h-3 w-3","aria-hidden":!0}):(0,F.jsx)(xB.A,{className:"h-3 w-3","aria-hidden":!0}),c(l?"tasks.collapse":"tasks.expand")]})}):null]}),(0,F.jsxs)("div",{"data-task-actions":!0,className:`absolute left-0 top-full flex -translate-y-8 items-center gap-1.5 ${_||l?"":"pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100"} transition-opacity`,children:[(0,F.jsxs)("button",{type:"button",className:"inline-flex h-7 touch-none items-center gap-1 rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:c("tasks.sendTitle"),onPointerDown:q.onPillPointerDown,onClick:()=>{q.consumeClick()||S()||r.draft(e)},children:[(0,F.jsx)(m_.A,{className:"h-3 w-3","aria-hidden":!0})," ",c("tasks.send")]}),(0,F.jsxs)("button",{type:"button",className:"inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-[10.5px] font-bold shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{backgroundColor:A.soft,color:A.color,borderColor:A.color},title:c("tasks.statusTitle",{label:c(`tasks.status.${e.status}`)}),onClick:()=>{var t;let n;r.patch(e.id,{status:(t=e.status,n=fI.indexOf(t),fI[(n+1)%fI.length])})},children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:A.color}}),c(`tasks.status.${e.status}`)]}),r.collapse?(0,F.jsx)("button",{type:"button",className:"inline-flex h-7 items-center rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("taskStacks.collapse"),title:c("taskStacks.collapse"),onClick:()=>r.collapse(e),children:(0,F.jsx)(b9.A,{className:"h-3 w-3","aria-hidden":!0})}):null,(0,F.jsxs)("button",{type:"button",className:`inline-flex h-7 items-center gap-1 rounded-full border px-2 text-[10.5px] font-semibold shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${y?"border-danger bg-danger text-white":"border-border bg-card text-muted hover:border-danger/40 hover:text-danger"}`,"aria-label":c("tasks.deleteAria",{title:I}),title:y?c("tasks.deleteConfirm"):c("tasks.delete"),onClick:()=>{y?(k(!1),r.remove(e.id)):k(!0)},children:[(0,F.jsx)(xC.A,{className:"h-3 w-3","aria-hidden":!0}),y?c("tasks.deleteConfirm"):null]})]}),q.overlay]})});function va({project:e,pos:t,onCreated:n,onCancel:r}){let{t:i}=(0,er.Ym)(),a=(0,B.useRef)(()=>{}),s=xf(e,e=>a.current(e)),{composer:l}=s;(0,B.useEffect)(()=>{l.inputRef.current?.focus()},[l.inputRef]);let o=async r=>{let a=(r??l.textRef.current).trim();if(!l.busy&&!l.voiceSending){if(!a)return void l.setStatus({kind:"err",text:i("tasks.composerNeedsText")});l.setBusy(!0),l.setStatus(null);try{let r=await ns({project:e,text:a,placement:"pinned",pos:t,dueAt:s.dueAt,dueTz:s.dueTz,attachments:s.stagedAttachments(),clientRequestId:s.getRequestId()});if("error"in r)return void l.setStatus({kind:"err",text:r.error});s.reset(),n(r.task)}finally{l.setBusy(!1)}}};return(0,B.useEffect)(()=>{a.current=o}),(0,F.jsx)("div",{"data-scheme-task":"new","data-chip-keepout":!0,className:"absolute z-30",style:{transform:`translate(${t.x}px, ${t.y}px)`,width:260},children:(0,F.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.submit()},className:"flex flex-col gap-1.5 overflow-hidden rounded-[8px] border border-border bg-card p-2 shadow-1 ring-2 ring-accent/50",style:{backgroundColor:fA.inbox.soft},children:[(0,F.jsxs)("div",{className:"flex items-center justify-between",children:[(0,F.jsx)("span",{className:"text-[10.5px] font-bold text-muted",children:i("tasks.newTask")}),(0,F.jsx)("button",{type:"button","aria-label":i("common.close"),onClick:r,className:"inline-flex h-5 w-5 items-center justify-center rounded-[6px] text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(H.A,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,F.jsx)(xw,{draft:s,placeholder:i("tasks.newPlaceholder"),createLabel:i("tasks.panelCreate")})]})})}function vs({task:e,expanded:t}){let{t:n}=(0,er.Ym)(),r=fA[e.status];return(0,F.jsxs)("div",{"data-scheme-task":e.id,className:`absolute overflow-hidden rounded-[8px] border border-border shadow-1 ${"done"===e.status?"opacity-60 saturate-50":""}`,style:{transform:`translate(${e.pos.x}px, ${e.pos.y}px)`,width:260,height:hy(e,t),backgroundColor:r.soft},children:[(0,F.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full",style:{backgroundColor:r.color}}),(0,F.jsx)("div",{className:"px-3 py-2 text-[12.5px] font-bold leading-[17px] text-primary",children:(0,F.jsx)("span",{className:`${t?"":"line-clamp-4"} whitespace-pre-wrap break-words`,children:t?e.text:fM(e.text)||n("tasks.untitled")})})]})}let vl=(0,B.memo)(function({tasks:e,files:t,project:n,interactive:r,lite:i,camRef:a,handlers:s,selectedTaskId:l,textExpandedIds:o,pending:c,onStickyCreated:d,onCreateCancel:u,completedPipelinesByTask:p,onOpenPipelineHistory:m}){return(0,F.jsxs)("div",{className:r?void 0:"pointer-events-none select-none",children:[e.map(e=>i?(0,F.jsx)(vs,{task:e,expanded:o.has(e.id)},e.id):(0,F.jsx)(vi,{task:e,files:t,camRef:a,handlers:s,completedPipelines:p?.get(e.id),onOpenPipelineHistory:m,selected:l===e.id,expanded:o.has(e.id)},e.id)),c&&!i?(0,F.jsx)(va,{project:n,pos:c,onCreated:d,onCancel:u}):null]})});function vo(e,t,n){for(let r of t)if(e.x<r.x+r.w+n&&e.x+e.w+n>r.x&&e.y<r.y+r.h+n&&e.y+e.h+n>r.y)return!0;return!1}function vc(e,t,n){if(!vo(e,t,16)&&!vo(e,n,16))return{x:e.x,y:e.y};let r=e.w+16,i=e.h+16,a=null;for(let[s,l]of function(e,t){let n=[],r=Math.floor(1200/e),i=Math.floor(1200/t),a=Math.max(r,i);for(let e=1;e<=a;e++)for(let t=e;t>=-e;t--)for(let a=-e;a<=e;a++)Math.max(Math.abs(a),Math.abs(t))===e&&(Math.abs(a)>r||Math.abs(t)>i||n.push([a,t]));return n}(r,i)){let o=Math.round(e.x+s*r),c=Math.round(e.y+l*i),d={x:o,y:c,w:e.w,h:e.h};if(!vo(d,t,16)){if(!vo(d,n,16))return{x:o,y:c};a||(a={x:o,y:c})}}for(let i=0;i<4096;i+=1){let s=740+i%12*r,l=3200+640*Math.floor(i/12),o={x:s,y:l,w:e.w,h:e.h};if(!vo(o,t,16)){if(!vo(o,n,16))return{x:s,y:l};a||(a={x:s,y:l})}}return a??{x:e.x,y:e.y}}let vd="llvSchemeMode",vu=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y);function vp(e,t,n){return e.nodes.length>0||e.drafts.length>0||(e.groups?.length??0)>0||(t?.size??0)>0||(n?.size??0)>0}function vm(e,t){let n=Math.min(1.6,Math.max(.12,Math.min((t.w-48)/e.w,(t.h-48)/e.h,1)));return{z:n,x:(t.w-e.w*n)/2-e.x*n,y:(t.h-e.h*n)/2-e.y*n}}let vf=(e,t,n,r)=>Math.min(t,r)-Math.max(e,n);function vh(e,t){let n=null;for(let r of e){let e=r.dp+t*r.ds;(!n||e<n.score-1e-9||1e-9>Math.abs(e-n.score)&&(r.ds<n.ds-1e-9||1e-9>Math.abs(r.ds-n.ds)&&r.key<n.key))&&(n={key:r.key,score:e,ds:r.ds})}return n?.key??null}let vx=(e,t)=>({x:(e.x+e.w/2)*t.z+t.x,y:(e.y+e.h/2)*t.z+t.y}),vg=new Set,vb=new Map;function vv({active:e,title:t,onClick:n,children:r}){return(0,F.jsx)("button",{className:`inline-flex h-7 w-7 items-center justify-center rounded-[8px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"bg-accent/10 text-accent":"text-muted hover:bg-canvas hover:text-primary"}`,title:t,"aria-label":t,"aria-pressed":e,onClick:n,children:r})}function vw({project:e,groups:t,manual:n,files:r,flows:i,reviewGroups:a=[],pipelines:s=[],tasks:l,allTasks:o=l,workerStacks:c=[],surfacePipelines:d=[],drafts:u,favorites:p,isolatedManualPaths:m=vg,focus:f,ring:h,attentionPaths:x,trayApi:g,onSelect:b,onNodePick:v,mapFrame:w,onClose:y,onDraftClose:k,onDraftSpawned:j,onHandoff:N,onSpawnRetry:S,onTaskDraft:C,onOpenTask:A,onTaskCollapse:I,placeTaskId:M,onTaskPlaced:T,newTaskNonce:$,builderPipelineId:E,onBuilderOpened:R}){var P,O,D;let L,_,{t:q}=(0,er.Ym)(),z=!!v,[H,K]=(0,B.useState)(null),[Y,W]=(0,B.useState)(0),J=(0,B.useMemo)(()=>(function(e=()=>void 0){let t=new Map;return{anchorFor:(e,n)=>t.get(e)?.get(n)??null,replace(n,r){let i=new Map(r),a=!function(e,t){if(!e||e.size!==t.size)return!1;for(let[n,r]of t){let t=e.get(n);if(!t||t.x!==r.x||t.y!==r.y)return!1}return!0}(t.get(n),i);return t.set(n,i),a&&e(),()=>{t.get(n)===i&&(t.delete(n),e())}}}})(()=>W(e=>e+1)),[]),[V,G]=(0,B.useState)(null),X=E??V,Q=(0,B.useCallback)(()=>{G(null),R?.()},[R]),Z=(0,B.useCallback)(e=>{G(e.id)},[]),ee=rL(e),et=ee.selection,en=ee.selectionArmed;(0,B.useEffect)(()=>{f&&K(f)},[f]);let ea=(0,B.useMemo)(()=>a.length?[...i,...a]:i,[i,a]),es=(0,B.useMemo)(()=>dl(s,ea),[s,ea]),[el,eo]=(0,B.useState)([]),[ec,ed]=(0,B.useState)(null);(0,B.useEffect)(()=>{let t=new Set(l.map(e=>e.id));eo(n=>{let r=n.filter(n=>!t.has(n.id)&&n.project===e);return r.length===n.length?n:r})},[l,e]);let eu=(0,B.useMemo)(()=>{let t=new Set(l.map(e=>e.id)),n=el.filter(n=>!t.has(n.id)&&n.project===e);return n.length?[...l,...n]:l},[l,el,e]),[ep,em]=(0,B.useState)(new Set);(0,B.useEffect)(()=>{let e=new Set(eu.map(e=>e.id));em(t=>[...t].some(t=>!e.has(t))?new Set([...t].filter(t=>e.has(t))):t)},[eu]);let ef=(0,B.useMemo)(()=>eu.filter(hg),[eu]),eh=(0,B.useMemo)(()=>hU(t,n,r,es,u,s,d,p,m,ef,ep),[t,n,r,es,u,s,d,p,m,ef,ep]),ex=!z&&(en||et.size>0),eg=(0,B.useRef)(ee);(0,B.useEffect)(()=>{eg.current=ee});let eb=(0,B.useCallback)(()=>eg.current.clearSelection(),[]),ev=(0,B.useCallback)(e=>eg.current.toggleSelection(e),[]),ew=(0,B.useRef)(H);(0,B.useEffect)(()=>{ew.current=H},[H]);let ey=(0,B.useCallback)((e,t)=>{if(null===e){K(null),eb();return}if(t&&eh.byPath.has(e)&&eh.nodes.some(t=>t.file.path===e)){K(null);let t=ew.current;t&&t!==e&&eh.nodes.some(e=>e.file.path===t)&&eg.current.commitSelection([t],!0),eg.current.toggleSelection(e);return}K(e)},[eh,eb]),ek=(0,B.useMemo)(()=>ez(i),[i]),ej=(0,B.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=function(e){if("closed"===e.state)return null;let t=e.cursor?.stageId??e.stages.at(-1)?.id??null;if(!t)return null;let n=e.stages.find(e=>e.id===t);return n&&"review-loop"!==n.kind?c3(e,t)?.agentPath??null:null}(n);e&&t.set(e,n)}return t})(s),[s]),eN=(0,B.useMemo)(()=>dj(s),[s]),[eS,eC]=(0,B.useState)(null);(0,B.useEffect)(()=>{eC(null)},[e]);let eA=(P=eh.nodes,eS?P.find(e=>e.file.path===eS)??P.find(e=>e.file.predecessorPath===eS)??null:null),eI=null!==eA;(0,B.useEffect)(()=>{eA&&eA.file.path!==eS&&eC(eA.file.path)},[eA,eS]),(0,B.useEffect)(()=>{if(!eI)return;let e=e=>{if("Escape"!==e.key)return;let t=e.target;t&&(["INPUT","TEXTAREA","SELECT"].includes(t.tagName)||t.isContentEditable)||(e.preventDefault(),e.stopPropagation(),eC(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[eI]);let[eM,eT]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=e=>{if("F2"!==e.key)return;let t=e.target;if(t&&(["INPUT","TEXTAREA","SELECT"].includes(t.tagName)||t.isContentEditable))return;let n=ew.current;if(!n)return;let r=eh.nodes.find(e=>e.file.path===n);r?.file.renamable&&(e.preventDefault(),eC(n),eT(e=>({path:n,token:(e?.token??0)+1})))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[eh]),(0,B.useEffect)(()=>{eT(e=>e&&e.path!==eS?null:e)},[eS]);let[e$,eE]=(0,B.useState)(null),eR=(0,B.useCallback)((e,t)=>{eE(n=>({flowId:e,round:t,nonce:(n?.nonce??0)+1}))},[]),eP=h??f,eO=(0,B.useRef)(b),eD=(0,B.useRef)(v),eL=(0,B.useRef)(y),eF=(0,B.useRef)(k),e_=(0,B.useRef)(j),eq=(0,B.useRef)(N),eH=(0,B.useRef)(S),eB=(0,B.useRef)(C),eU=(0,B.useRef)(A),eY=(0,B.useRef)(I);(0,B.useEffect)(()=>{eO.current=b,eD.current=v,eL.current=y,eF.current=k,e_.current=j,eq.current=N,eH.current=S,eB.current=C,eU.current=A,eY.current=I});let eW=(0,B.useCallback)(e=>{let t=eD.current;t?t(e.path):eO.current(e)},[]),eJ=(0,B.useCallback)(e=>eL.current(e),[]),eV=(0,B.useCallback)(e=>eF.current(e),[]),eG=(0,B.useCallback)((e,t)=>e_.current(e,t),[]),eX=(0,B.useCallback)(e=>eq.current?.(e),[]),eQ=(0,B.useCallback)(e=>eH.current?.(e),[]),eZ=(0,B.useCallback)(e=>eU.current?.(e),[]),e0=(0,B.useCallback)(e=>eC(e),[]),e1=(0,B.useCallback)(e=>{let t=r.find(t=>t.path===e);t&&eW(t)},[r,eW]),e2=(0,B.useCallback)(e=>{let t=i.find(t=>t.id===e);t&&eR(t.id,t.rounds.at(-1)?.n??1)},[i,eR]),e5=(0,B.useMemo)(()=>new Set(r.map(e=>e.path)),[r]),e3=(0,B.useMemo)(()=>new Set(eh.nodes.map(e=>e.file.path)),[eh]),e4=(0,B.useMemo)(()=>dm(es,e3),[es,e3]),e6=(0,B.useMemo)(()=>new Map(s.map(e=>[e.id,dd(e,o,i,r)])),[s,o,i,r]),e8=(0,B.useMemo)(()=>{let e=new Map;for(let t of s)if(("completed"===t.state||"closed"===t.state)&&dg(t,i,e4,e5,r))for(let n of e6.get(t.id)??[]){let r=e.get(n.id)??[];r.push(t),e.set(n.id,r)}return e},[s,e6,i,e4,e5,r]),e7=(0,B.useCallback)(e=>{let t=dg(e,i,e4,e5,r);t?.kind==="path"?e1(t.path):t?.kind==="flow"&&e2(t.flowId)},[i,e4,e5,r,e1,e2]),e9=(0,B.useMemo)(()=>c.map(e=>({key:e.key,color:g4[e.kind]})),[c]),te=(0,B.useRef)(ex);(0,B.useEffect)(()=>{te.current=ex},[ex]);let tn=(0,B.useRef)(!1),tr=(0,B.useCallback)((e,t)=>{if(tn.current)return tn.current=!1,!0;if(!te.current)return K(null),!0;let n=g5(eh.nodes,{x:e,y:t,w:0,h:0});return n.length?ev(n[0]):eb(),!0},[eh,ev,eb]),ti=(0,B.useRef)(()=>!1),ta=(0,B.useMemo)(()=>[...eh.nodes,...eh.decks,...eh.stacks,...eh.drafts,...eh.slots,...eh.regionTasks].map(({x:e,y:t,w:n,h:r})=>({x:e,y:t,w:n,h:r})),[eh]),ts=(0,B.useMemo)(()=>[...eh.nodes,...eh.decks,...eh.stacks,...eh.drafts,...eh.slots],[eh]),tl=(0,B.useMemo)(()=>new Map(eh.regionTasks.map(e=>[e.taskId,{x:e.x,y:e.y}])),[eh]),to=(0,B.useMemo)(()=>(function(e,t,n){let r=e.map(e=>{let t=n?.has(e.id)??!1;return{id:e.id,createdAt:e.createdAt,x:e.pos.x,y:e.pos.y,w:260,h:hk(e,t),auto:!t&&!!e.source&&function(e){let t,n;if(null!==(t=(e.x-740)/300,n=(e.y-120)/120,!Number.isInteger(t)||t<0||!Number.isInteger(n)||n<0||n>=24?null:48*Math.floor(t/2)+2*n+t%2))return!0;let r=740===e.x||1040===e.x,i=e.y-120;return r&&i>=0&&i%120==0}(e.pos),expanded:t}}),i=(e,t)=>e.createdAt<t.createdAt?-1:e.createdAt>t.createdAt?1:e.id.localeCompare(t.id),a=[],s=[],l=new Map,o=(e,t)=>{l.set(e.id,t);let n={x:t.x,y:t.y,w:e.w,h:e.h};a.push(n),e.expanded&&s.push(n)};for(let e of r.filter(e=>e.expanded).sort(i))o(e,vc(e,a,t));for(let e of r.filter(e=>!e.expanded&&!e.auto).sort(i)){let n=vo(e,s,16)?vc(e,a,t):{x:e.x,y:e.y};o(e,n)}for(let e of r.filter(e=>e.auto).sort(i))o(e,vc(e,a,t));return l})(ef.filter(e=>!tl.has(e.id)),ta,ep),[ef,tl,ta,ep]),tc=(0,B.useMemo)(()=>ef.map(e=>{let t=tl.get(e.id)??to.get(e.id);return t&&(t.x!==e.pos.x||t.y!==e.pos.y)?{...e,pos:t}:e}),[ef,tl,to]),td=(0,B.useMemo)(()=>new Map(tc.map(e=>["task::"+e.id,hj(e,ep.has(e.id))])),[tc,ep]),tu=(0,B.useMemo)(()=>new Map(tc.map(e=>[`task::${e.id}`,fM(e.text)||q("tasks.untitled")])),[tc,q]),tp=(0,B.useMemo)(()=>(function(e,t=[],n=[]){let r=new Map,i=new Map(t.map(e=>[e.id,e])),a=({x:e,y:t,w:n,h:r})=>({x:e,y:t,w:n,h:r});for(let t of e.groups??[])if(t.pipeline)for(let e of(t.pipeline.srcPath&&r.set(t.pipeline.srcPath,a(t)),t.pipeline.runs))for(let s of e.attempts){s.agentPath&&r.set(s.agentPath,a(t));let e=s.flowId?i.get(s.flowId):null;if(e)for(let i of(r.set(e.implementerPath,a(t)),e.rounds))for(let{path:s}of eK(e,i,n))r.set(s,a(t))}for(let t of e.stacks)for(let e of t.items)r.set(e.file.path,a(t));for(let t of e.decks)for(let e of t.rounds){let n=e.file?.path??e.round.reviewerPath;n&&r.set(n,a(t))}for(let t of e.nodes)for(let e of t.under)r.set(e.path,a(t));for(let t of e.nodes)r.set(t.file.path,a(t));return r})(eh,i,r),[eh,i,r]),tm=(0,B.useMemo)(()=>(function(e,t,n,r=[]){let i=new Map;for(let e of r)e.conversationId&&i.set(e.conversationId,e.path);let a=[];for(let r of e){let e=hj(r,n?.has(r.id)??!1),s=hN(e);if(r.source){let n=t.get(r.source.path);if(n){let t=hS(e,hN(n)),i=hS(n,s);a.push({key:r.id+"::source::"+r.source.path,taskId:r.id,relation:"source",path:r.source.path,x1:t.x,y1:t.y,x2:i.x,y2:i.y,status:r.status,failed:!1,error:null})}}let l=new Set;for(let n of r.assignments){let o=(n.conversationId?i.get(n.conversationId):void 0)??n.path;if(!o||l.has(o))continue;let c=t.get(o);if(!c)continue;l.add(o);let d=hS(e,hN(c)),u=hS(c,s);a.push({key:r.id+"::"+o,taskId:r.id,relation:"assignment",path:o,x1:d.x,y1:d.y,x2:u.x,y2:u.y,status:r.status,failed:"failed"===n.state,error:n.error})}}return a})(tc,tp,ep,r),[tc,tp,ep,r]),tf=(0,B.useMemo)(()=>tc.map(e=>({id:e.id,...hj(e,ep.has(e.id))})),[tc,ep]),th=(0,B.useMemo)(()=>{let e,t,n,r;return e=Math.round,t=tm.map(t=>`${t.key}:${e(t.x1)},${e(t.y1)},${e(t.x2)},${e(t.y2)}`).join(";"),n=tf.map(t=>`${t.id}:${e(t.x)},${e(t.y)},${e(t.w)},${e(t.h)}`).join(";"),r=ta.map(t=>`${e(t.x)},${e(t.y)},${e(t.w)},${e(t.h)}`).join(";"),`${t}|${n}|${r}`},[tm,tf,ta]),tx=(0,B.useMemo)(()=>(function(e,t,n){let r=new Map,i=new Set;for(let t of function(e){let t=e.map((e,t)=>t),n=e=>{for(;t[e]!==e;)t[e]=t[t[e]],e=t[e];return e};for(let r=0;r<e.length;r++)for(let i=r+1;i<e.length;i++)(function(e,t){let n=e.x2-e.x1,r=e.y2-e.y1,i=Math.hypot(n,r),a=t.x2-t.x1,s=t.y2-t.y1,l=Math.hypot(a,s);if(0===i||0===l)return!1;let o=n/i,c=r/i,d=a/l,u=s/l;if(Math.abs(o*u-c*d)>.02||hR(t.x1,t.y1,e.x1,e.y1,o,c)>1.5||hR(t.x2,t.y2,e.x1,e.y1,o,c)>1.5||hR(e.x1,e.y1,t.x1,t.y1,d,u)>1.5||hR(e.x2,e.y2,t.x1,t.y1,d,u)>1.5)return!1;let p=(t,n)=>(t-e.x1)*o+(n-e.y1)*c,m=Math.min(0,i),f=Math.max(0,i),h=Math.min(p(t.x1,t.y1),p(t.x2,t.y2));return Math.min(f,Math.max(p(t.x1,t.y1),p(t.x2,t.y2)))-Math.max(m,h)>8})(e[r],e[i])&&(t[n(r)]=n(i));let r=new Map;return e.forEach((e,t)=>{let i=n(t),a=r.get(i);a?a.push(e):r.set(i,[e])}),[...r.values()].map(e=>e.sort((e,t)=>e.key<t.key?-1:+(e.key>t.key)))}(e))if(!function(e,t){var n;let r,i,a,s=(a=Math.hypot(r=(n=e[0]).x2-n.x1,i=n.y2-n.y1)||1,(Math.abs(r/=a)>=Math.abs(i/=a)?r<0:i<0)?{x:-r,y:-i}:{x:r,y:i});e.forEach((e,n)=>t.set(e.key,(0===n?0:n%2==1?(n+1)/2:-(n/2))*((e.x2-e.x1)*s.x+(e.y2-e.y1)*s.y>=0?1:-1)))}(t,r),t.length>1)for(let e of t)i.add(e.key);let a=new Map(e.map(e=>[e.key,e])),s=new Map,l=(e,r)=>{let i=hT(e,hE(e,t,n),r),a=hP(i.d);s.set(e.key,{route:i,cubics:a,box:hD(a)})};for(let t of e)l(t,r.get(t.key)??0);let o=[...e].sort((e,t)=>e.key<t.key?-1:+(e.key>t.key)),c=(e,t,n)=>{let r=a.get(e),i=0;for(let[l,o]of s)l!==e&&hL(n,o.box)&&hz(t,o.cubics,hF(r,a.get(l)))&&i++;return i};if(e.length<=48)for(let e=0;e<2;e++){let e=!1;for(let a of o){if(i.has(a.key))continue;let l=s.get(a.key),o=c(a.key,l.cubics,l.box);if(0===o||o>4)continue;let d=hE(a,t,n),u=r.get(a.key)??0,p=l,m=+!!l.route.crosses;for(let e of hH){let t=hT(a,d,u+e),n=+!!t.crosses;if(n>m)continue;let r=hP(t.d),i=hD(r),s=c(a.key,r,i);(n<m||s<o)&&(p={route:t,cubics:r,box:i},m=n,o=s)}p!==l&&(s.set(a.key,p),e=!0)}if(!e)break}{let e=[],i=t=>e.some(e=>e.axis===t.axis&&25>Math.abs(e.pos-t.pos)&&Math.min(e.hi,t.hi)>Math.max(e.lo,t.lo));for(let a of o){let l=s.get(a.key).route.corridor;if(l&&i(l)){let e=r.get(a.key)??0,o=hE(a,t,n);for(let t=1;t<=48;t++){let n=hT(a,o,e+t);if(!n.crosses&&(!n.corridor||!i(n.corridor))){let e=hP(n.d);s.set(a.key,{route:n,cubics:e,box:hD(e)}),l=n.corridor;break}}}l&&e.push(l)}}let d=new Set;for(let e=0;e<o.length;e++)for(let t=e+1;t<o.length;t++){let n=o[e],r=o[t],i=s.get(n.key),a=s.get(r.key);hL(i.box,a.box)&&hz(i.cubics,a.cubics,hF(n,r))&&d.add(n.key<r.key?r.key:n.key)}let u=new Map;for(let[e,t]of s)u.set(e,d.has(e)&&!t.route.crosses?{...t.route,crosses:!0}:t.route);return u})(tm,tf,ta),[th]),tg=(0,B.useMemo)(()=>{let e=[...td.values()],t=function(e){let t=1/0,n=1/0,r=-1/0,i=-1/0,a=!1,s=(e,a)=>{e<t&&(t=e),e>r&&(r=e),a<n&&(n=a),a>i&&(i=a)};for(let t of e){a=!0;let e=t.d.replace(/[MC,]/g," ").trim().split(/\s+/).map(Number);for(let t=0;t+1<e.length;t+=2)s(e[t],e[t+1]);s(t.mid.x,t.mid.y)}return a?{x:t-14,y:n-14,w:r-t+28,h:i-n+28}:null}(tx.values());return t&&e.push(t),function(e,t,n){let r=0,i=0,a=e,s=t;for(let e of n)r=Math.min(r,e.x-140),i=Math.min(i,e.y-140),a=Math.max(a,e.x+e.w+140),s=Math.max(s,e.y+e.h+140);return{x:r,y:i,w:a-r,h:s-i}}(eh.width,eh.height,e)},[eh.width,eh.height,td,tx]),tb=(0,B.useMemo)(()=>{let e=function(e,t,n,r=gK){return gJ(gV(e,t,n,r))}(eh,tc,p??vg,ep);return gJ([...e?[e]:[]])},[eh,tc,p,ep]),tv=(0,B.useMemo)(()=>gV(eh,tc,p??vg,ep).length,[eh,tc,p,ep]),tw=(0,B.useMemo)(()=>(function(e,t){let n=[];for(let t of e.groups){if(!gW(t))continue;let e=t.pipeline?"needs_decision"===t.pipeline.state||"paused"===t.pipeline.state:t.flow?.state==="needs_decision"||t.flow?.state==="paused";n.push({key:t.key,label:t.label,rect:t,priority:e?5:3,color:`hsl(${t.hue} 62% 42%)`})}for(let r of e.nodes)(r.isRoot&&t.has(U(r.file))||gY(r.file))&&n.push({key:r.file.path,label:(0,tt.cr)(r.file.title),rect:r,priority:gY(r.file)?4:2,color:"codex"===r.file.engine?"var(--color-codex)":"var(--color-claude)"});return n})(eh,p??vg),[eh,p]),ty=(0,B.useMemo)(()=>xR(r,o),[r,o]),[tk,tj]=(0,B.useState)(""),tN=(0,B.useCallback)(e=>{let t="current"===e?tv:eh.nodes.length+eh.drafts.length+eh.groups.length+eh.stacks.length+eh.decks.length+tc.length;tj(q("current"===e?"scheme.framedCurrent":"scheme.framedAll",{count:t}))},[tv,eh.nodes.length,eh.drafts.length,eh.groups.length,eh.stacks.length,eh.decks.length,tc.length,q]),tS=(0,B.useRef)(M??null);(0,B.useEffect)(()=>{tS.current=M??null},[M]);let tC=(0,B.useCallback)((e,t)=>{let n={x:Math.round(e-130),y:Math.round(t-14)},r=tS.current;if(r){tS.current=null,nu(r,{placement:"pinned",pos:n}).then(e=>{e&&s3("err",e)}),T?.();return}ed(n)},[T]),tA=(0,B.useRef)(()=>!1),tI=(0,B.useRef)(()=>!1),{cam:tM,vp:tT,viewportRef:t$,handLike:tE,taskTool:tR,setTaskTool:tP,centerOn:tO,panning:tD,glide:tL,setMode:tF,onPointerDown:t_,onPointerMove:tq,onDoubleClick:tz,onClick:tH,zoomCenter:tB,zoomTo:tU,fit:tK,fitCurrent:tY,fitRect:tW,jump:tJ,manualNonce:tV,glideBy:tG,glideFrame:tX,glideToCamera:tQ}=function({project:e,layout:t,world:n,currentWork:r=null,mapMode:i,focus:a,onNodePick:s,setSelected:l,onBackgroundDown:o,onWorldTap:c,taskRects:d,pipelineRects:u,onPlaceTask:p,onArrowNav:m,onZoomKey:f,onFit:h}){let x=(0,B.useRef)(null),g=(0,B.useRef)(null),[b,v]=(0,B.useState)({x:0,y:0,z:.5}),[w,y]=(0,B.useState)("select"),[k,j]=(0,B.useState)(!1),[N,S]=(0,B.useState)(!1),[C,A]=(0,B.useState)(!1),[I,M]=(0,B.useState)(!1),[T,$]=(0,B.useState)({w:1,h:1}),[E,R]=(0,B.useState)(0),P=(0,B.useRef)(null),O=(0,B.useRef)(!1),D=(0,B.useRef)(!1),L=(0,B.useRef)(null),F=(0,B.useRef)(new Map),_=(0,B.useRef)(null),q=(0,B.useRef)(w),z=(0,B.useRef)(N),H=(0,B.useRef)(k),U=(0,B.useRef)(p),K=(0,B.useRef)(null),Y=(0,B.useRef)(null),W=(0,B.useRef)(b);(0,B.useEffect)(()=>{W.current=b},[b]),(0,B.useEffect)(()=>{q.current=w},[w]),(0,B.useEffect)(()=>{z.current=N},[N]),(0,B.useEffect)(()=>{H.current=k},[k]),(0,B.useEffect)(()=>{U.current=p}),(0,B.useEffect)(()=>{let e=localStorage.getItem(vd);"hand"===e||"select"===e?y(e):window.matchMedia("(pointer: coarse)").matches&&y("hand")},[]);let J=(0,B.useCallback)(e=>{j(!1),y(e),localStorage.setItem(vd,e)},[]);(0,B.useEffect)(()=>{let e=x.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect();$({w:Math.max(1,t.width),h:Math.max(1,t.height)})});return t.observe(e),()=>t.disconnect()},[]);let V=(0,B.useCallback)(e=>{let t=Math.min(Math.max(e.x,120-(n.x+n.w)*e.z),T.w-120-n.x*e.z),r=Math.min(Math.max(e.y,120-(n.y+n.h)*e.z),T.h-120-n.y*e.z);return t===e.x&&r===e.y?e:{...e,x:t,y:r}},[n,T]),G=(0,B.useRef)([]),X=(0,B.useRef)(null),Q=(0,B.useCallback)(e=>{G.current.push(e),null==X.current&&(X.current=requestAnimationFrame(()=>{X.current=null;let e=G.current;G.current=[],v(t=>e.reduce((e,t)=>t(e),t))}))},[]);(0,B.useEffect)(()=>()=>{null!=X.current&&cancelAnimationFrame(X.current)},[]);let Z=(0,B.useCallback)((e,t,n)=>{Q(r=>{let i=Math.min(1.6,Math.max(.12,r.z*n));if(i===r.z)return r;let a=i/r.z;return V({z:i,x:e-(e-r.x)*a,y:t-(t-r.y)*a})})},[V,Q]),ee=(0,B.useCallback)(e=>{let t=x.current?.getBoundingClientRect();t&&Z(t.width/2,t.height/2,e)},[Z]),et=(0,B.useCallback)(e=>{let t=x.current?.getBoundingClientRect();t&&v(n=>{let r=Math.min(1.6,Math.max(.12,e));if(r===n.z)return n;let i=r/n.z,a=t.width/2,s=t.height/2;return V({z:r,x:a-(a-n.x)*i,y:s-(s-n.y)*i})})},[V]),en=(0,B.useCallback)(()=>{let e=x.current?.getBoundingClientRect();return e&&vp(t,d,u)?vm(n,{w:e.width,h:e.height}):null},[t.nodes.length,t.drafts.length,t.groups.length,d,u,n]),er=(0,B.useCallback)(e=>{"u">typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches||M(!0),v(e),K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>M(!1),500)},[]);(0,B.useEffect)(()=>()=>{K.current&&window.clearTimeout(K.current)},[]);let ei=(0,B.useCallback)(()=>{let e=en();e&&(er(e),h?.("all"))},[en,er,h]),ea=(0,B.useCallback)(()=>{let e=x.current?.getBoundingClientRect();return e&&vp(t,d,u)?vm(r??n,{w:e.width,h:e.height}):null},[r,n,t,d,u]),es=(0,B.useCallback)(()=>{let e=ea();e&&(er(V(e)),h?.(r?"current":"all"))},[ea,er,V,h,r]),el=(0,B.useCallback)(()=>{var e;let t=ea();if(!t)return;let n=V(t);r&&(e=W.current,Math.abs(e.z-n.z)<=.01*n.z&&4>=Math.abs(e.x-n.x)&&4>=Math.abs(e.y-n.y))?ei():(W.current=n,er(n),h?.(r?"current":"all"))},[ea,r,V,ei,er,h]),eo=(0,B.useCallback)(e=>{let t=x.current?.getBoundingClientRect();!t||e.w<=0||e.h<=0||er(V(vm(e,{w:t.width,h:t.height})))},[er,V]),ec=(0,B.useCallback)((e,t)=>{let n=x.current?.getBoundingClientRect();n&&er(r=>{let i=Math.min(1.6,Math.max(r.z,t));return{z:i,x:n.width/2-(e.x+e.w/2)*i,y:Math.min(n.height/2-e.y*i,.08*n.height-(e.y-40)*i)}})},[er]),ed=(0,B.useCallback)((e,t)=>{er(n=>V({...n,x:n.x-e*n.z,y:n.y-t*n.z}))},[er,V]),eu=(0,B.useCallback)(e=>{er(V({x:e.x,y:e.y,z:e.zoom}))},[er,V]),ep=(0,B.useCallback)((e,t)=>{let n=x.current?.getBoundingClientRect();if(!n)return;let r=Math.min(1.6,Math.max(.12,t));er(V({z:r,x:n.width/2-(e.x+e.w/2)*r,y:Math.min(n.height/2-e.y*r,.08*n.height-(e.y-40)*r)}))},[er,V]);(0,B.useEffect)(()=>{if(Y.current===e||!vp(t,d,u))return;if(Y.current=e,!i)try{let t=sessionStorage.getItem("llvCam:"+e);if(t){let e=JSON.parse(t);if(Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)&&e.z>=.12&&e.z<=1.6)return void v(e)}}catch{}let n=i?en():ea();n&&v(n)},[e,t,d,u,en,ea,i]),(0,B.useEffect)(()=>{if(i||Y.current!==e)return;let t=window.setTimeout(()=>sessionStorage.setItem("llvCam:"+e,JSON.stringify(b)),300);return()=>window.clearTimeout(t)},[b,e,i]);let em=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!a){em.current=null;return}if(em.current===a)return;let e=t.byPath.get(a)??d?.get(a);e&&(em.current=a,ec(e,.55))},[a,t,d,ec]),(0,B.useEffect)(()=>{let e=x.current;if(!e)return;let t=()=>{L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>R(e=>e+1),250)},n=n=>{if(n.target.closest("[data-scheme-ui]"))return;let r=e.getBoundingClientRect();if(n.ctrlKey||n.metaKey){n.preventDefault(),Z(n.clientX-r.left,n.clientY-r.top,Math.exp(-(.0022*n.deltaY))),t();return}if("select"===q.current&&!z.current){for(let t=n.target;t&&t!==e;t=t.parentElement)if(t.scrollHeight>t.clientHeight+1){let e=getComputedStyle(t).overflowY;if("auto"===e||"scroll"===e)return}}n.preventDefault();let i=n.shiftKey&&!n.deltaX?n.deltaY:n.deltaX,a=n.shiftKey&&!n.deltaX?0:n.deltaY;Q(e=>V({...e,x:e.x-i,y:e.y-a})),t()};return e.addEventListener("wheel",n,{passive:!1}),()=>{e.removeEventListener("wheel",n),L.current&&window.clearTimeout(L.current)}},[Z,V,Q]),(0,B.useEffect)(()=>{let e=e=>{var t;if(e.key.startsWith("Arrow")){if(e.metaKey||e.ctrlKey||e.altKey)return;m?.current?.(e)&&e.preventDefault();return}if(!((t=e.target)&&t.tagName&&(["INPUT","TEXTAREA","SELECT","BUTTON"].includes(t.tagName)||t.isContentEditable))){if(" "===e.key){e.preventDefault(),e.repeat||S(!0);return}!e.metaKey&&!e.ctrlKey&&!e.altKey&&("h"===e.key||"H"===e.key?J("hand"):"v"===e.key||"V"===e.key?J("select"):"t"===e.key||"T"===e.key?U.current&&j(!0):"Escape"===e.key?H.current?j(!1):l(null):"0"===e.key?e.shiftKey?ei():el():"1"===e.key?et(1):"+"===e.key||"="===e.key?f?.current?.(1)||ee(1.25):"-"!==e.key||f?.current?.(-1)||ee(.8))}},t=e=>{" "===e.key&&S(!1)};return window.addEventListener("keydown",e),window.addEventListener("keyup",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t)}},[ei,el,ee,et,J,l,m,f]);let ef=e=>{let t=x.current?.getBoundingClientRect();return t?{x:e.clientX-t.left,y:e.clientY-t.top}:{x:e.clientX,y:e.clientY}},eh=e=>{P.current={sx:e.clientX,sy:e.clientY,cx:b.x,cy:b.y},O.current=!1,A(!0);try{x.current?.setPointerCapture(e.pointerId)}catch{}};(0,B.useEffect)(()=>{let e=e=>{F.current.delete(e.pointerId),F.current.size<2&&(_.current=null,D.current&&(D.current=!1,R(e=>e+1))),P.current&&O.current&&R(e=>e+1),O.current=!1,P.current=null,A(!1)};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[]);let ex=i||"hand"===w||N,eg=(0,B.useCallback)((e,t)=>v(n=>V({...n,x:T.w/2-e*n.z,y:T.h/2-t*n.z})),[T,V]);return{cam:b,vp:T,viewportRef:x,mode:w,setMode:J,handLike:ex,taskTool:k,setTaskTool:j,centerOn:ec,panning:C,glide:I,onPointerDown:e=>{let t=e.target;if(!t.closest("[data-scheme-ui]")){if(i&&e.isPrimary&&(g.current={x:e.clientX,y:e.clientY}),"touch"===e.pointerType&&(F.current.set(e.pointerId,ef(e)),2===F.current.size)){let[e,t]=[...F.current.values()];_.current={d:vu(e,t),cx:(e.x+t.x)/2,cy:(e.y+t.y)/2},D.current=!0,P.current=null,A(!1);return}if(1===e.button){e.preventDefault(),eh(e);return}if(0===e.button){if(k&&!i&&U.current){let t=x.current?.getBoundingClientRect();if(t){e.preventDefault(),U.current((e.clientX-t.left-b.x)/b.z,(e.clientY-t.top-b.y)/b.z),j(!1),J("select");return}}if(!(i||"hand"===w||N)){if(t.closest("[data-scheme-task]"))return;let n=t.closest("[data-scheme-node]");if(n)return void l(n.getAttribute("data-scheme-node"),e.shiftKey||e.ctrlKey||e.metaKey);c&&e.isPrimary&&(g.current={x:e.clientX,y:e.clientY});let r=o?.(e)??!1;if(r&&"touch"!==e.pointerType||!r&&(l(null),t.closest("button, a, input, textarea, select")))return}eh(e)}}},onPointerMove:e=>{if("touch"===e.pointerType&&F.current.has(e.pointerId)){F.current.set(e.pointerId,ef(e));let t=_.current;if(t&&F.current.size>=2){let[e,n]=[...F.current.values()],r=vu(e,n),i=(e.x+n.x)/2,a=(e.y+n.y)/2,s=t.d>0?r/t.d:1;Q(e=>{let n=Math.min(1.6,Math.max(.12,e.z*s)),r=n/e.z;return V({z:n,x:i-(t.cx-e.x)*r,y:a-(t.cy-e.y)*r})}),_.current={d:r,cx:i,cy:a};return}}let t=P.current;if(!t)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;Math.hypot(n,r)>9&&(O.current=!0),Q(e=>V({...e,x:t.cx+n,y:t.cy+r}))},onDoubleClick:e=>{let n=e.target;if(n.closest("[data-scheme-ui]")||n.closest("[data-scheme-task]"))return;let r=n.closest("[data-scheme-node]");if(!r){if(i||!U.current)return void ei();let t=x.current?.getBoundingClientRect();return void(t&&U.current((e.clientX-t.left-b.x)/b.z,(e.clientY-t.top-b.y)/b.z))}if("hand"!==w&&!N)return;let a=t.byPath.get(r.getAttribute("data-scheme-node")??"");a&&ec(a,.9)},onClick:e=>{if(!s&&!c)return;let n=g.current;if(g.current=null,!n||Math.hypot(e.clientX-n.x,e.clientY-n.y)>9||e.target.closest("[data-scheme-ui]"))return;let r=x.current?.getBoundingClientRect();if(!r)return;let i=(e.clientX-r.left-b.x)/b.z,a=(e.clientY-r.top-b.y)/b.z;if(c?.(i,a)||!s)return;let l=((e,n)=>{let r=t=>e>=t.x&&e<=t.x+t.w&&n>=t.y&&n<=t.y+t.h;if(d){for(let[e,t]of d)if(r(t))return e}for(let e of t.nodes)if(r(e))return e.file.path;for(let e of t.drafts)if(r(e))return e.key;for(let e of t.stacks)if(r(e))return function(e,t){let n=Math.floor((t-e.y-8)/58);return e.items[Math.max(0,Math.min(n,e.items.length-1))]?.file??null}(e,n)?.path??null;for(let e of t.decks)if(r(e))return e.key;return null})(i,a);l&&s(l)},zoomCenter:ee,zoomTo:et,fit:ei,fitCurrent:es,fitRect:eo,jump:eg,manualNonce:E,glideBy:ed,glideFrame:ep,glideToCamera:eu}}({project:e,layout:eh,world:tg,currentWork:tb,mapMode:z,focus:f,onNodePick:v,setSelected:ey,onBackgroundDown:z?void 0:e=>(tn.current=!1,ti.current(e)),onWorldTap:z?void 0:tr,taskRects:td,onPlaceTask:z?void 0:tC,onArrowNav:tA,onZoomKey:tI,onFit:tN}),tZ=(0,B.useMemo)(()=>gc(s),[s]),t0=(0,B.useMemo)(()=>gd(eh,e,{extraRects:td,aliases:tZ}),[eh,e,td,tZ]);(0,B.useEffect)(()=>{if(!z)return r3.setBoard({project:e,index:t0,moveTo:({rect:e,zoom:t})=>("inspect"===t?tX({...e},.9):tW({...e}),!0),restoreCamera:e=>(tQ(e),!0)})},[z,e,t0,tX,tW,tQ]);let[t1,t2]=(0,B.useState)([]),t5=(0,B.useCallback)(()=>{let e=t$.current;if(!e)return;let t=e.getBoundingClientRect(),n=function(e,t,n){let r=[];for(let i of t){if(i.width<1||i.height<1)continue;let t={x:i.left-e.left,y:i.top-e.top,w:i.width,h:i.height};t.x+t.w<=0||t.y+t.h<=0||t.x>=n.w||t.y>=n.h||r.push(t)}return r}(t,Array.from(document.querySelectorAll("[data-chip-keepout]"),e=>e.getBoundingClientRect()),{w:t.width,h:t.height});t2(e=>e.length===n.length&&e.every((e,t)=>e.x===n[t].x&&e.y===n[t].y&&e.w===n[t].w&&e.h===n[t].h)?e:n)},[t$]);(0,B.useEffect)(()=>{t5()},[t5,tM,tT,eh]),(0,B.useEffect)(()=>{let e=0,t="function"==typeof requestAnimationFrame?requestAnimationFrame:e=>window.setTimeout(()=>e(0),16),n="function"==typeof cancelAnimationFrame?cancelAnimationFrame:e=>window.clearTimeout(e),r=()=>{e||(e=t(()=>{e=0,t5()}))},i="function"==typeof MutationObserver?new MutationObserver(r):null;i?.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class","data-chip-keepout"]});let a="function"==typeof ResizeObserver?new ResizeObserver(r):null;return a&&t$.current&&a.observe(t$.current),window.addEventListener("resize",r),()=>{e&&n(e),i?.disconnect(),a?.disconnect(),window.removeEventListener("resize",r)}},[t5,t$]);let t3=(0,B.useMemo)(()=>(function(e,t,n,r,i=[]){return[...[...e,...t,...n].map(e=>({x:e.x*r.z+r.x,y:e.y*r.z+r.y,w:e.w*r.z,h:e.h*r.z})),...i]})(eh.nodes,eh.decks,eh.drafts,tM,t1),[eh,tM,t1]),t4=(0,B.useRef)({fit:tK,fitCurrent:tY});(0,B.useEffect)(()=>{t4.current={fit:tK,fitCurrent:tY}});let t6=(0,B.useRef)(null),t8=eh.nodes.length>0||eh.drafts.length>0||eh.groups.length>0||eh.slots.length>0||td.size>0;(0,B.useEffect)(()=>{if(!z||!w||!t8){t6.current=null;return}t6.current!==w&&(t6.current=w,"current"===w?t4.current.fitCurrent():t4.current.fit())},[z,w,t8]),(0,B.useEffect)(()=>{M&&!z&&tP(!0)},[M]),(0,B.useEffect)(()=>{!$||z||ed(hx({x:Math.round((.25*tT.w-tM.x)/tM.z-130),y:Math.round((.7*tT.h-tM.y)/tM.z)},{w:260,h:140},[...td.values(),...eh.nodes]))},[$]);let t7=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!X||z||t7.current===X)return;let e=eh.groups.find(e=>"pipeline"===e.kind&&e.id===X);e&&(t7.current=X,eb(),tF("select"),tO(e,.75),Q())},[X,eh.groups]);let{onArrow:t9,onZoomKey:ne,announcement:nt}=function({enabled:e,layout:t,taskRects:n,taskLabels:r,cam:i,vp:a,selected:s,setSelected:l,centerOn:o,glideBy:c,glideFrame:d,manualNonce:u}){let{t:p}=(0,er.Ym)(),m=(0,B.useRef)(!1),f=(0,B.useRef)(null),[h,x]=(0,B.useState)(""),g=(0,B.useRef)(e),b=(0,B.useRef)(t),v=(0,B.useRef)(n),w=(0,B.useRef)(r),y=(0,B.useRef)(i),k=(0,B.useRef)(a),j=(0,B.useRef)(s),N=(0,B.useRef)(o),S=(0,B.useRef)(c),C=(0,B.useRef)(d),A=(0,B.useRef)(l),I=(0,B.useRef)(p);(0,B.useEffect)(()=>{g.current=e,b.current=t,v.current=n,w.current=r,y.current=i,k.current=a,j.current=s,N.current=o,S.current=c,C.current=d,A.current=l,I.current=p});let M=(0,B.useCallback)(e=>b.current.byPath.get(e)??v.current?.get(e),[]),T=(0,B.useCallback)(e=>(function(e,t,n,r){let i=r?.get(t);if(i)return i;let a=e.nodes.find(e=>e.file.path===t);if(a)return(0,ei.cr)(a.file.title,80);let s=e.stacks.find(e=>e.key===t);if(s){let t=e.nodes.find(e=>e.file.path===s.parent),r=t?(0,ei.cr)(t.file.title,60):null;return r?n("scheme.navStack",{count:s.items.length,title:r}):n("scheme.navStackBare",{count:s.items.length})}return t.replace(/^(?:draft|deck)::/,"")})(b.current,e,I.current,w.current),[]),$=(0,B.useCallback)(e=>{let t=M(e);m.current=!0,t&&(f.current={key:e,x:t.x,y:t.y,w:t.w,h:t.h},N.current(t,0)),A.current(e),x(T(e))},[T,M]),E=(0,B.useCallback)(e=>{let t=function(e){switch(e){case"ArrowUp":return"up";case"ArrowDown":return"down";case"ArrowLeft":return"left";case"ArrowRight":return"right";default:return null}}(e.key);if(!t||!g.current)return!1;let n=e.target,r="u">typeof document?document.activeElement:null;for(let e of[n,r])if(e&&(function(e){let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||e.isContentEditable}(e)||e.closest?.('[role="dialog"], [role="menu"], [role="listbox"], [data-scheme-ui]')))return!1;if(function(e,t){if("up"!==t&&"down"!==t)return!1;for(let n=e;n;n=n.parentElement)if(n.scrollHeight>n.clientHeight+1){let e=getComputedStyle(n).overflowY;if("auto"===e||"scroll"===e){let e=n.scrollTop<=0,r=n.scrollTop+n.clientHeight>=n.scrollHeight-1;if("up"===t&&!e||"down"===t&&!r)return!0}}return!1}(n??r,t))return!1;let i=function(e,t){let n=[];for(let[t,r]of e.byPath)n.push({key:t,x:r.x,y:r.y,w:r.w,h:r.h});if(t)for(let[e,r]of t)n.push({key:e,x:r.x,y:r.y,w:r.w,h:r.h});return n}(b.current,v.current);if(!i.length)return!1;let a=j.current;if(!(m.current&&null!=a&&i.some(e=>e.key===a))){let e=function(e,t,n,r){if(r){var i,a,s;let l,o,c,d,u=e.find(e=>e.key===r);if(u&&(i=u,a=t,s=n,l=i.x*a.z+a.x,o=i.y*a.z+a.y,c=i.w*a.z,d=i.h*a.z,(c<=0||d<=0?0:Math.max(0,Math.min(l+c,s.w)-Math.max(l,0))*Math.max(0,Math.min(o+d,s.h)-Math.max(o,0))/(c*d))>=.5))return r}let l=n.w/2,o=n.h/2,c=null;for(let n of e){let e=vx(n,t),r=Math.hypot(e.x-l,e.y-o);(!c||r<c.d-1e-9||1e-9>Math.abs(r-c.d)&&n.key<c.key)&&(c={key:n.key,d:r})}return c?.key??null}(i,y.current,k.current,a);return e&&$(e),!0}let s=function(e,t,n){let r=e.find(e=>e.key===t);if(!r)return null;let i=[];for(let a of e){if(a.key===t)continue;let e=function(e,t,n){let r,i,a,s=e.x+e.w/2,l=e.y+e.h/2,o=t.x+t.w/2,c=t.y+t.h/2;return"right"===n?(r=o-s,i=Math.abs(c-l),a=vf(e.y,e.y+e.h,t.y,t.y+t.h)):"left"===n?(r=s-o,i=Math.abs(c-l),a=vf(e.y,e.y+e.h,t.y,t.y+t.h)):(r="down"===n?c-l:l-c,i=Math.abs(o-s),a=vf(e.x,e.x+e.w,t.x,t.x+t.w)),{key:t.key,dp:r,ds:i,ov:a}}(r,a,n);e.dp>8&&i.push(e)}if(!i.length)return null;let a=i.filter(e=>e.ov>0);if(a.length)return vh(a,.3);let s=i.filter(e=>e.ds<=e.dp);return s.length?vh(s,2):vh(i,4)}(i,a,t);return s&&$(s),!0},[$]),R=(0,B.useCallback)(e=>{if(!g.current||!m.current)return!1;let t=j.current;if(null==t)return!1;let n=M(t);if(!n)return!1;let r=function(e,t,n){if(n>0){let n=null;for(let r of e)r>1.01*t&&(null===n||r<n)&&(n=r);return n}let r=null;for(let n of e)n<.99*t&&(null===r||n>r)&&(r=n);return r}(function(e,t){let n=t.w-48,r=t.h-48,i=new Set([Math.min(n/e.w,r/e.h,1.6)]);for(let e=2;e<=20;e++){let t=n/(600*e+(e-1)*48);if(t<.45)break;i.add(t)}return[...i].sort((e,t)=>e-t)}(n,k.current),y.current.z,e);return null==r||(C.current(n,r),f.current={key:t,x:n.x,y:n.y,w:n.w,h:n.h},!0)},[M]);(0,B.useEffect)(()=>{if(!m.current)return;let e=j.current;if(null==e){f.current=null;return}let r=t.byPath.get(e)??n?.get(e)??null,i=f.current,a=function(e,t){if(!t)return{kind:"drop"};if(!e)return{kind:"none"};let n=t.x-e.x,r=t.y-e.y;return .5>Math.abs(n)&&.5>Math.abs(r)?{kind:"none"}:{kind:"translate",dx:n,dy:r}}(i&&i.key===e?i:null,r);if("drop"===a.kind){m.current=!1,f.current=null,A.current(null);return}r&&(f.current={key:e,x:r.x,y:r.y,w:r.w,h:r.h}),"translate"===a.kind&&S.current(a.dx,a.dy)},[t,n]),(0,B.useEffect)(()=>{if(null==s){m.current=!1,f.current=null;return}if(!g.current)return;let e=M(s)??null;m.current=!0,f.current=e?{key:s,x:e.x,y:e.y,w:e.w,h:e.h}:null},[s,M]);let P=(0,B.useRef)(!0);return(0,B.useEffect)(()=>{if(P.current){P.current=!1;return}m.current=!1,f.current=null},[u]),(0,B.useEffect)(()=>{e||(m.current=!1,f.current=null)},[e]),{onArrow:E,onZoomKey:R,announcement:h}}({enabled:!z&&!ex&&!eI,layout:eh,taskRects:td,taskLabels:tu,cam:tM,vp:tT,selected:H,setSelected:K,centerOn:tO,glideBy:tG,glideFrame:tX,manualNonce:tV});(0,B.useEffect)(()=>{tA.current=t9,tI.current=ne},[t9,ne]);let nn=(0,B.useRef)(null),nr=(0,B.useRef)(new Map);(0,B.useEffect)(()=>{let e=new Map,t=[];for(let n of s){let r=`${n.state}:${n.cursor?.stageId??""}:${n.cursor?.state??""}`;e.set(n.id,r);let i=nr.current.get(n.id);void 0!==i&&i!==r&&t.push(function(e,t){let{k:n,n:r}=dA(t),i=t.cursor?t.stages.find(e=>e.id===t.cursor.stageId)??null:null,a=i?dy(e,i):"";return e("pipelineStrip.announce",{task:t.task,state:c6(e,t.state),stage:a,k:n,n:r})}(q,n))}nr.current=e,t.length&&nn.current&&(nn.current.textContent=t.join(". "))},[s,q]);let{marquee:ni,onBackgroundDown:na}=function({viewportRef:e,cam:t,layout:n,enabled:r,session:i,onCommit:a}){let[s,l]=(0,B.useState)(null),o=(0,B.useRef)(null),c=(0,B.useRef)(t),d=(0,B.useRef)(n),u=(0,B.useRef)(a);(0,B.useEffect)(()=>{c.current=t,d.current=n,u.current=a});let p=(0,B.useCallback)(t=>{let n=e.current?.getBoundingClientRect();return n?{x:t.clientX-n.left,y:t.clientY-n.top}:{x:t.clientX,y:t.clientY}},[e]);return(0,B.useEffect)(()=>{let e=e=>{var t,n,r,i,a;let s=o.current;if(!s)return;let u=p(e);if(!s.active&&4>Math.hypot(u.x-s.sx,u.y-s.sy))return;s.active=!0;let m=(t=s.sx,n=s.sy,{x:Math.min(t,r=u.x),y:Math.min(n,i=u.y),w:Math.abs(r-t),h:Math.abs(i-n)}),f=g5(d.current.nodes,(a=c.current,{x:(m.x-a.x)/a.z,y:(m.y-a.y)/a.z,w:m.w/a.z,h:m.h/a.z}));l({rect:m,candidates:f,additive:s.additive})},t=e=>{let t=o.current;o.current=null,t?.active&&l(t=>(e&&t&&u.current(t.candidates,t.additive),null))},n=()=>t(!0),r=()=>t(!1),i=e=>{"Escape"===e.key&&o.current?.active&&t(!1)},a=e=>{o.current?.suppressSelection&&e.preventDefault()};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",r),window.addEventListener("keydown",i),window.addEventListener("selectstart",a),window.addEventListener("dragstart",a),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",r),window.removeEventListener("keydown",i),window.removeEventListener("selectstart",a),window.removeEventListener("dragstart",a)}},[p]),{marquee:s,onBackgroundDown:(0,B.useCallback)(t=>{var n;let a=(n={enabled:r,session:i}).enabled?"touch"===t.pointerType?{claim:n.session,track:!1,suppressSelection:!1}:t.isPrimary&&0===t.button?{claim:!0,track:!0,suppressSelection:!0}:n9:n9;if(!a.track)return a.claim;let s=p(t);if(o.current={sx:s.x,sy:s.y,additive:t.shiftKey,active:!1,suppressSelection:a.suppressSelection},a.suppressSelection){let n;t.preventDefault(),(n=window.getSelection?.())&&n.rangeCount>0&&n.removeAllRanges(),e.current?.focus({preventScroll:!0})}return a.claim},[r,i,p,e])}}({viewportRef:t$,cam:tM,layout:eh,enabled:!z,session:ex,onCommit:(0,B.useCallback)((e,t)=>{tn.current=!0,K(null),eg.current.commitSelection(e,t)},[])});(0,B.useEffect)(()=>{ti.current=na},[na]);let ns=(0,B.useMemo)(()=>eh.nodes.filter(e=>et.has(e.file.path)),[eh,et]),nl=(0,B.useMemo)(()=>(function(e,t){let n=1/0,r=1/0,i=-1/0,a=-1/0,s=!1;for(let l of e)t.has(l.file.path)&&(s=!0,n=Math.min(n,l.x),r=Math.min(r,l.y),i=Math.max(i,l.x+l.w),a=Math.max(a,l.y+l.h));return s?{x:n,y:r,w:i-n,h:a-r}:null})(eh.nodes,et),[eh,et]),no=(0,B.useRef)(nl);(0,B.useEffect)(()=>{no.current=nl},[nl]);let nc=(0,B.useCallback)(()=>{no.current&&tW(no.current)},[tW]),nd=(0,B.useRef)(tM);(0,B.useEffect)(()=>{nd.current=tM},[tM]);let nh=(0,B.useRef)(()=>{});(0,B.useEffect)(()=>{nh.current=()=>{if(z)return;let e=eS?[eS]:function(e,t,n){let r=rB(t,n),i=[];for(let t of e.nodes)if(t.x<r.x+r.width&&t.x+t.w>r.x&&t.y<r.y+r.height&&t.y+t.h>r.y&&i.push(t.file.path),i.length>=128)break;return i}(eh,tM,tT),t=new Set(eh.nodes.map(e=>e.file.path));rW.reportSlice({mode:"scheme",focusedPath:null!==eS?eS:null!==H&&t.has(H)?H:null,selectedPaths:rU(eh.nodes.map(e=>e.file.path),et),visiblePaths:e,camera:{x:tM.x,y:tM.y,zoom:tM.z,worldRect:rB(tM,tT)},viewport:{width:tT.w,height:tT.h,dpr:window.devicePixelRatio||1}})}}),(0,B.useEffect)(()=>{z||nh.current()},[z,eh,et,H,eS]),(0,B.useEffect)(()=>{if(z)return;let e=window.setTimeout(()=>nh.current(),300);return()=>window.clearTimeout(e)},[z,tM,tT]);let nx=(0,B.useCallback)((e,t)=>void nf(e,t),[]),ng=(0,B.useRef)(tp);(0,B.useEffect)(()=>{ng.current=tp},[tp]);let nb=(0,B.useMemo)(()=>({patch:async(e,t)=>{let n=await nu(e,t);return n&&s3("err",n),n},remove:e=>{eo(t=>t.some(t=>t.id===e)?t.filter(t=>t.id!==e):t),np(e).then(e=>{e&&s3("err",e)})},handoff:async(e,t)=>{var n,r;let i=await nm(e.id,t.path);return"error"in i?(s3("err",i.error),i.error):(oD(U(t),(n=i.task.id,r=i.task.text,`Task #${n.slice(0,8)}: ${r}`)),null)},draft:e=>eB.current?.(e),collapse:e=>eY.current?.(e),unassign:async(e,t)=>{let n=await nf(e.id,t);n&&s3("err",n)},center:e=>tO(e,.75),toggleExpand:e=>{em(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},openAgent:e=>{let t=ng.current.get(e.path);t&&tO(t,.75),eW(e)}}),[tO,eW]),nv=(0,B.useCallback)(e=>{eo(t=>[...t,e]),ed(null)},[]),nw=(0,B.useCallback)(()=>ed(null),[]),[ny,nk]=(0,B.useState)(!1);(0,B.useEffect)(()=>{nk(e=>e?tM.z<.49500000000000005:tM.z<.4275)},[tM.z]);let nj=24*tM.z;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{ref:t$,className:`relative min-h-0 flex-1 overflow-clip ${tD?"cursor-grabbing":tR?"cursor-crosshair":tE?"cursor-grab":""} ${tD||ni?"select-none":""} ${tE?"touch-none":""}`,tabIndex:z?void 0:0,"aria-label":z?void 0:q("scheme.boardAria"),onPointerDown:t_,onPointerMove:tq,onDoubleClick:tz,onClick:tH,onScroll:e=>{e.currentTarget.scrollLeft=0,e.currentTarget.scrollTop=0},children:[(0,F.jsx)("div",{className:"sr-only","aria-live":"polite",role:"status",children:nt}),(0,F.jsx)("div",{className:"sr-only","aria-live":"polite",role:"status",children:tk}),(0,F.jsx)("div",{ref:nn,className:"sr-only","aria-live":"polite",role:"status"}),(0,F.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-nj,backgroundImage:"radial-gradient(color-mix(in srgb, var(--color-primary) 9%, transparent) 1px, transparent 1px)",backgroundSize:`${nj}px ${nj}px`,transform:`translate(${(tM.x%nj+nj)%nj}px, ${(tM.y%nj+nj)%nj}px)`,willChange:"transform"}}),(0,F.jsxs)("div",{className:`absolute left-0 top-0 ${tD?"scheme-panning":""}`,style:{width:eh.width,height:eh.height,transform:`translate(${tM.x}px, ${tM.y}px) scale(${tM.z})`,transformOrigin:"0 0",transition:tL?`transform .45s ${bE}`:void 0,willChange:"transform","--inv-z":String(1/tM.z),"--label-o":tM.z<.45?"1":"0"},children:[(0,F.jsx)(bH,{groups:eh.groups,interactive:!z&&!tE&&!ex}),(0,F.jsx)(bD,{edges:eh.edges,badgeAnchors:J,badgeAnchorRevision:Y,width:eh.width,height:eh.height}),(0,F.jsx)(bq,{loops:eh.loops,width:eh.width,height:eh.height}),(0,F.jsx)(bz,{links:eh.links,byPath:eh.byPath,obstacles:ts,interactive:!z&&!tE&&!ex,hubInteractive:!tE&&!ex,width:eh.width,height:eh.height}),(0,F.jsx)(b4,{layout:eh,project:e,files:r,interactive:!tE&&!ex,lite:z,dormant:ny,selected:H,multi:et,session:ex,focus:eP,attentionPaths:x??null,flowsByImpl:ek,flows:i,pipelines:s,pipelineStrips:z?ej:vb,linkedTasksByPipeline:e6,relatedTasksByPath:ty,deckFocus:e$,badgeAnchors:J,trayApi:z?void 0:g,onSelect:eW,onClose:eJ,onFocusRound:eR,onDraftClose:eV,onDraftSpawned:eG,onHandoff:N?eX:void 0,onSpawnRetry:S?eQ:void 0,onOpenTask:A?eZ:void 0,onExpand:e0,onToggleMember:z?void 0:ev,onPipelineCreated:Z}),(0,F.jsx)(b8,{edges:tm,world:tg,routes:tx,onRetry:nx}),(0,F.jsx)(vl,{tasks:tc,files:r,project:e,interactive:!tE&&!ex,lite:z,camRef:nd,handlers:nb,selectedTaskId:H?.startsWith("task::")?H.slice(6):null,textExpandedIds:ep,pending:ec,onStickyCreated:nv,onCreateCancel:nw,completedPipelinesByTask:e8,onOpenPipelineHistory:e7}),ex&&nl?(0,F.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-[6] rounded-[14px] border-2 border-dashed border-accent/60",style:{left:nl.x-14,top:nl.y-14,width:nl.w+28,height:nl.h+28},children:(0,F.jsx)("span",{className:"absolute -top-3 left-4 rounded-full border border-accent/50 bg-card px-2 py-0.5 font-bold text-accent",style:{fontSize:"calc(11px * min(var(--inv-z, 1), 2.6))"},children:q("bulk.selectedCount",{count:et.size})})}):null]},e),ni?(0,F.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-30",children:[(0,F.jsx)("div",{className:"absolute rounded-[4px] border border-accent/70 bg-accent/10",style:{left:ni.rect.x,top:ni.rect.y,width:ni.rect.w,height:ni.rect.h}}),ni.candidates.map(e=>{let t=eh.byPath.get(e);return t?(0,F.jsx)("div",{className:"absolute rounded-[10px] border-2 border-accent/70",style:{left:t.x*tM.z+tM.x,top:t.y*tM.z+tM.y,width:t.w*tM.z,height:t.h*tM.z}},e):null})]}):null,(0,F.jsx)(g2,{clusters:tw,cam:tM,vp:tT,hidden:z||!!ni||tD,obstacles:t3,onFit:tW}),(0,F.jsxs)("div",{"data-scheme-ui":!0,className:"absolute left-3 top-3 z-40 flex items-center gap-1 rounded-[10px] border border-border bg-card/95 p-1 shadow-1",children:[z?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(vv,{active:tE&&!tR,title:q("scheme.handTool"),onClick:()=>tF("hand"),children:(0,F.jsx)(g$.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsx)(vv,{active:!tE&&!ex&&!tR,title:q("scheme.selectTool"),onClick:()=>tF("select"),children:(0,F.jsx)(gE.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsx)(vv,{active:ex,title:q("scheme.lassoTool"),onClick:()=>{ex?eb():(tF("select"),ee.setSelectionArmed(!0))},children:(0,F.jsx)(gR.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsx)(vv,{active:tR,title:q("tasks.tool"),onClick:()=>tP(!tR),children:(0,F.jsx)(fC.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsx)("div",{className:"mx-0.5 h-5 w-px bg-border","aria-hidden":!0})]}),(0,F.jsx)(vv,{title:q("scheme.zoomOut"),onClick:()=>tB(.8),children:(0,F.jsx)(pr.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsxs)("button",{className:"min-w-[46px] rounded-[8px] px-1 text-center text-[11px] font-semibold text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:q("scheme.zoom100"),onClick:()=>tU(1),children:[Math.round(100*tM.z),"%"]}),(0,F.jsx)(vv,{title:q("scheme.zoomIn"),onClick:()=>tB(1.25),children:(0,F.jsx)(cf.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsx)(vv,{title:q("scheme.fitCurrent"),onClick:tY,children:(0,F.jsx)(gP.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,F.jsx)(vv,{title:q("scheme.fit"),onClick:tK,children:(0,F.jsx)(cO.A,{className:"h-4 w-4","aria-hidden":!0})})]}),ex?(0,F.jsx)(gB,{project:e,nodes:ns,flowsByImpl:ek,onRemove:eJ,onFit:nc,onExit:eb}):null,(0,F.jsx)(g6,{layout:eh,world:tg,tasks:tc,textExpandedIds:ep,currentWork:tb,stackDots:e9,cam:tM,vp:tT,onJump:tJ})]}),eA?(O=eA.file.path,L=eM&&null!==O&&eM.path===O?eM.token:void 0,D=dN(q,eN.get(eA.file.path)),_=void 0===L?D:void 0,(0,F.jsx)("div",{className:"fixed inset-0 z-40 flex flex-col bg-canvas p-3",role:"dialog","aria-modal":"true","aria-label":_??(0,tt.cr)(eA.file.title,90),children:(0,F.jsx)(fF,{file:eA.file,tasks:eA.tasks,isRoot:eA.isRoot,expanded:!0,showFavorite:!0,titleOverride:_,onToggleExpand:()=>eC(null),autoEditToken:L,onSpawnRetry:S?eQ:void 0,relatedTasks:ty.get(eA.file.path),onOpenTask:A?e=>{eC(null),eZ(e)}:void 0})})):null]})}function vy(){let{t:e}=(0,er.Ym)();return(0,F.jsxs)("div",{role:"status","aria-busy":"true","aria-live":"polite",className:"grid flex-1 auto-rows-min content-start gap-2.5 overflow-hidden p-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 240px), 1fr))"},children:[(0,F.jsx)("span",{className:"sr-only",children:e("dash.loadingBoard")}),Array.from({length:6}).map((e,t)=>(0,F.jsxs)("div",{"aria-hidden":!0,className:"flex animate-pulse flex-col gap-2 rounded-[10px] border border-border bg-card p-3 shadow-1 motion-reduce:animate-none",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-sunken"}),(0,F.jsx)("span",{className:"h-3 w-2/3 rounded bg-sunken"})]}),(0,F.jsx)("span",{className:"h-2.5 w-5/6 rounded bg-sunken"}),(0,F.jsx)("span",{className:"h-2.5 w-1/2 rounded bg-sunken"})]},t))]})}let vk="llvArchived";function vj(e){try{window.localStorage.setItem(vk,JSON.stringify([...e]))}catch{}}function vN({data:e,onOpen:t}){let{t:n}=(0,er.Ym)(),r=e.waiting.length,i=(0,B.useRef)(r),[a,s]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{if(r>i.current){s(!0);let e=window.setTimeout(()=>s(!1),900);return i.current=r,()=>window.clearTimeout(e)}i.current=r},[r]),(0,F.jsxs)("div",{className:"group absolute bottom-3 right-3 z-20",children:[e.livePreview.length?(0,F.jsx)("div",{className:"pointer-events-none mb-1.5 hidden w-[300px] rounded-[8px] border border-border bg-card/95 px-3 py-2 shadow-1 backdrop-blur group-focus-within:block group-hover:block",children:e.livePreview.map(e=>(0,F.jsxs)("div",{className:"flex min-w-0 gap-1.5 py-0.5 text-[10.5px]",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold",children:e.title}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-muted",children:e.statusLine||n("status.working")})]},e.file.path))}):null,(0,F.jsxs)("button",{className:`ml-auto flex items-center gap-1.5 rounded-full border border-border bg-card/95 px-2.5 py-1 text-[11.5px] font-bold shadow-1 backdrop-blur transition-transform hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 ${a?"scale-110 border-warning/70":""} motion-reduce:transition-none`,"aria-label":n("corner.openSwitchboard"),onClick:t,children:[(0,F.jsx)("span",{className:`h-2 w-2 rounded-full ${e.working.length?"animate-pulse bg-success":"bg-muted"}`}),(0,F.jsx)("span",{children:e.working.length}),(0,F.jsx)("span",{className:r?"text-warning":"text-muted",children:n("corner.waitingCount",{count:r})})]})]})}function vS(e,t){return"Escape"===e.key&&(e.stopPropagation(),t(),!0)}let vC={authenticated:"accounts.auth.authenticated",signed_out:"accounts.auth.signedOut",unknown:"accounts.auth.unknown",error:"accounts.auth.error"};function vA(e,t){return e<=10?"var(--color-danger)":e<=30?"var(--color-warning)":t}function vI({account:e,engine:t}){let{t:n}=(0,er.Ym)(),r=e.effective;if(!r||"unavailable"===r.freshness)return null;let i=(0,tt.t7)(t),a=n("weekly"===r.window?"limits.windowWeekly":"limits.windowSession"),s="stale"===r.freshness,l=vA(r.percent,i.color);return(0,F.jsx)("span",{className:`shrink-0 rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[10px] font-bold tabular-nums ${s?"opacity-55":""}`,style:{color:l},title:n(s?"accounts.effectiveStale":"accounts.effectiveTip",{window:a}),children:n("accounts.effective",{pct:Math.round(r.percent)})})}function vM({account:e,engine:t}){let{t:n}=(0,er.Ym)(),[r]=(0,B.useState)(()=>Math.floor(Date.now()/1e3)),i=e.limits;if(!i)return null;let a=[{key:"session",label:eE(n,"session",i.session?.windowMinutes),window:i.session},{key:"weekly",label:eE(n,"weekly",i.weekly?.windowMinutes),window:i.weekly}].filter(e=>null!=e.window);if(0===a.length)return null;let s="stale"===i.freshness,l=(0,tt.t7)(t);return(0,F.jsxs)("dl",{"aria-label":n("accounts.limitsAria",{label:e.label}),title:s?n("accounts.limitsStaleTip"):void 0,className:`flex flex-col gap-1 px-3.5 pb-1 pl-[30px] ${s?"opacity-70":""}`,children:[s?(0,F.jsx)("div",{className:"text-[9.5px] font-semibold text-secondary",children:n("accounts.limitsStale")}):null,a.map(({key:e,label:t,window:i})=>{let a=Math.max(0,Math.min(100,100-i.usedPercent)),s=vA(a,l.color);return(0,F.jsxs)("div",{className:"flex items-center gap-2 text-[10px] leading-snug text-muted",children:[(0,F.jsx)("dt",{className:"w-8 shrink-0 font-semibold",children:t}),(0,F.jsxs)("dd",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-1.5 w-16 shrink-0 overflow-hidden rounded-full bg-sunken sm:w-20",children:(0,F.jsx)("span",{className:"block h-full rounded-full",style:{width:`${a}%`,backgroundColor:s}})}),(0,F.jsxs)("span",{className:"font-bold tabular-nums text-primary",children:[Math.round(a),"%"]}),(0,F.jsx)("span",{children:n("limits.left")}),i.resetsAt?(0,F.jsxs)("span",{className:"truncate",children:["\xb7 ",n("limits.reset",{eta:e$(i.resetsAt,r),at:eR(i.resetsAt,r)})]}):null]})]},e)})]})}function vT(e){return e.authHealth??(e.authPresent?"unknown":"signed_out")}function v$({state:e}){let{t}=(0,er.Ym)();return"pending"===e?(0,F.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[10px] font-semibold text-muted",children:[(0,F.jsx)(i9.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none","aria-hidden":!0}),t("accounts.pendingLogin")]}):"needsLogin"===e?(0,F.jsx)("span",{className:"shrink-0 text-[10px] font-semibold",style:{color:"var(--color-warning)"},children:t("accounts.needsLogin")}):"active"===e?(0,F.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-muted",children:t("accounts.active")}):null}function vE({account:e}){let{t}=(0,er.Ym)(),n=vT(e);return(0,F.jsxs)("span",{className:"flex min-w-0 items-center gap-1 text-[9.5px] font-medium text-muted",children:[(0,F.jsx)("code",{className:"truncate font-mono",children:e.id}),(0,F.jsx)(an,{tone:"authenticated"===n?"success":"signed_out"===n||"error"===n?"danger":"neutral",className:"px-1.5 py-0 text-[9px]",children:t(vC[n])})]})}function vR({account:e,engine:t,activeId:n,onSelect:r,onRemove:i,onCopyCommand:a,disabled:s,focused:l=!1,children:o}){let{t:c}=(0,er.Ym)(),d=e.loginPending?"pending":e.authPresent&&"signed_out"!==vT(e)?e.id===n?"active":"idle":"needsLogin",u=e.id===n,p=(0,tt.t7)(t),m=e.authPresent&&"signed_out"!==vT(e)&&!e.loginPending,f=s||!m,[h,x]=(0,B.useState)(!1),g=(0,B.useRef)(null);return(0,B.useEffect)(()=>{l&&g.current?.scrollIntoView({block:"nearest"})},[l]),(0,F.jsxs)("div",{className:`relative ${l?"ring-2 ring-inset ring-accent/50":""}`,style:u?{background:`color-mix(in srgb, ${p.color} 7%, transparent)`,boxShadow:`inset 2px 0 0 ${p.color}`}:void 0,children:[(0,F.jsxs)("button",{ref:g,type:"button","aria-current":u?"true":void 0,disabled:f,onClick:r,className:"flex min-h-[44px] w-full items-center gap-2.5 px-3.5 pt-2.5 pb-1 text-left hover:bg-canvas/60 disabled:cursor-wait disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:u?p.color:"transparent",boxShadow:u?"none":"inset 0 0 0 1.5px var(--color-border)"}}),(0,F.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,F.jsx)("span",{className:`block truncate text-[13px] leading-tight ${u?"font-bold text-primary":"font-semibold"}`,children:e.label}),(0,F.jsx)(vE,{account:e})]}),(0,F.jsx)(vI,{account:e,engine:t}),(0,F.jsx)(v$,{state:d})]}),o,"pending"===d&&e.deviceAuth?(0,F.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pb-1.5 text-[10px] text-muted",children:[(0,F.jsx)("a",{href:e.deviceAuth.url,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-[44px] items-center truncate underline sm:min-h-0",children:c("accounts.openLogin")}),(0,F.jsx)("code",{className:"select-all font-semibold text-primary",children:e.deviceAuth.code})]}):null,(0,F.jsxs)("div",{className:"flex items-center gap-1 px-3.5 pb-2 pl-[30px]",children:[(0,F.jsxs)("button",{type:"button","aria-label":c("accounts.copyCliAria",{label:e.label}),disabled:s||!m,onClick:a,className:"inline-flex min-h-[44px] shrink-0 items-center gap-1.5 rounded-[6px] px-1.5 py-0.5 text-[10.5px] font-semibold text-secondary hover:bg-canvas hover:text-primary disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:[(0,F.jsx)(i9.ke,{className:"h-3.5 w-3.5 text-muted","aria-hidden":!0}),c("accounts.copyCli")]}),(0,F.jsx)("span",{className:"min-w-0 flex-1"}),"managed"===e.kind?h?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 text-right text-[10.5px] font-semibold text-danger",children:c("accounts.removeConfirm")}),(0,F.jsx)("button",{type:"button",disabled:s,onClick:()=>{x(!1),i()},className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[6px] bg-danger px-2 py-0.5 text-[10.5px] font-semibold text-white hover:opacity-90 disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:c("accounts.removeConfirmCta")}),(0,F.jsx)("button",{type:"button",disabled:s,onClick:()=>x(!1),className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[6px] px-2 py-0.5 text-[10.5px] font-semibold text-secondary hover:bg-canvas disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:c("accounts.removeConfirmCancel")})]}):(0,F.jsxs)("button",{type:"button","aria-label":c("accounts.removeAria",{label:e.label}),disabled:s,onClick:()=>x(!0),className:"inline-flex min-h-[44px] shrink-0 items-center gap-1 rounded-[6px] px-1.5 py-0.5 text-[10.5px] font-semibold text-muted hover:bg-danger-soft hover:text-danger disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:[(0,F.jsx)(i9.TB,{className:"h-3 w-3","aria-hidden":!0}),c("accounts.remove")]}):null]})]})}function vP({account:e,state:t,loginBusy:n}){let{t:r}=(0,er.Ym)(),i=e.login??null,a=i?.phase,s=null!=i&&cz.has(i.phase),l=null!==t.mutation,o=(0,B.useRef)(null),c=(0,B.useRef)(!1),[d,u]=(0,B.useState)(""),[p,m]=(0,B.useState)(!1),[f,h]=(0,B.useState)(a);a!==f&&(h(a),"awaiting_code"!==a&&(u(""),m(!1))),(0,B.useEffect)(()=>{c.current&&(c.current=!1,o.current?.focus())});let x=e=>{c.current=!0,e()};if(s&&i){let n="canceling"!==a,s=(0,F.jsx)("button",{type:"button",onClick:()=>x(()=>void t.cancelLogin(i.operationId)),disabled:l||!n,className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold hover:bg-sunken disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:r("accounts.claudeLogin.cancel")}),c=e=>(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(i9.kr,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none text-muted","aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 text-[11px] text-muted",children:r(e)}),n?s:null]}),f=`${i.operationId}-hint`;return(0,F.jsxs)("div",{ref:o,tabIndex:-1,role:"group","aria-label":r("accounts.claudeLogin.groupAria",{label:e.label}),className:"flex flex-col gap-1.5 px-3 pb-2 pl-[26px] focus-visible:outline-none",children:["starting"===a?c("accounts.claudeLogin.starting"):null,"awaiting_browser"===a?c("accounts.claudeLogin.awaitingBrowser"):null,"verifying"===a?c("accounts.claudeLogin.verifying"):null,"canceling"===a?c("accounts.claudeLogin.canceling"):null,"awaiting_code"===a?(0,F.jsxs)(F.Fragment,{children:[i.loginUrl?(0,F.jsx)("a",{href:i.loginUrl,target:"_blank",rel:"noreferrer noopener",className:"inline-flex min-h-[44px] items-center self-start text-[11px] font-semibold text-accent underline sm:min-h-0",children:r("accounts.claudeLogin.openLink")}):null,(0,F.jsxs)("form",{onSubmit:e=>{e.preventDefault(),p||l||""===d.trim()||x(()=>{m(!0),t.submitLoginCode(i.operationId,d)})},className:"flex items-center gap-2",children:[(0,F.jsx)("input",{type:"text",value:d,onChange:e=>u(e.target.value),onFocus:e=>e.currentTarget.scrollIntoView({block:"nearest"}),maxLength:8192,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":r("accounts.claudeLogin.codeLabel"),"aria-describedby":f,placeholder:r("accounts.claudeLogin.codePlaceholder"),className:"h-11 min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-2 font-mono text-[11.5px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8"}),(0,F.jsx)("button",{type:"submit",disabled:l||p||""===d.trim(),className:"h-11 shrink-0 rounded-[8px] border border-border bg-canvas px-2.5 text-[11px] font-semibold hover:bg-sunken disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8",children:r("accounts.claudeLogin.submit")})]}),(0,F.jsx)("p",{id:f,className:"text-[10px] leading-snug text-muted",children:r("accounts.claudeLogin.codeHint")}),(0,F.jsx)("div",{className:"flex justify-end",children:s})]}):null]})}if(i&&i.result?.status==="failure")return(0,F.jsxs)("div",{ref:o,tabIndex:-1,role:"alert",className:"flex items-center gap-2 px-3 pb-2 pl-[26px] focus-visible:outline-none",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 text-[10.5px] font-semibold text-danger",children:r(cB(i.result.code))}),(0,F.jsx)("button",{type:"button",onClick:()=>x(()=>void t.retryLogin(e.id)),disabled:l||n,className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold hover:bg-sunken disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:r("accounts.retry")})]});let g=vT(e);if("signed_out"===g||"error"===g||!e.authPresent){let i="error"===g?r("accounts.retry"):r("accounts.claudeLogin.signIn");return(0,F.jsx)("div",{ref:o,tabIndex:-1,className:"flex items-center gap-2 px-3 pb-2 pl-[26px] focus-visible:outline-none",children:(0,F.jsx)("button",{type:"button",onClick:()=>x(()=>void t.retryLogin(e.id)),disabled:l||n,className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[7px] border border-border bg-canvas px-2.5 py-0.5 text-[11px] font-semibold hover:bg-sunken disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:i})})}return null}function vO({state:e,onClose:t,placement:n="footer",focusAccountId:r=null}){let{t:i}=(0,er.Ym)(),{accounts:a,active:s,status:l,notice:o,mutation:c,engine:d}=e,[u,p]=(0,B.useState)(""),m="claude"===d&&a.some(e=>null!=e.login&&cz.has(e.login.phase)),f=function(e,t,n){if("claude"!==e)return"";let r=t.find(e=>e.login?.phase==="awaiting_code");if(r)return n("accounts.claudeLogin.announceCodeReady",{label:r.label});let i=t.find(e=>e.login?.phase==="authenticated");return i?n("accounts.claudeLogin.announceDone",{label:i.label}):""}(d,a,i),h=(0,B.useRef)(null),x="claude"===d?"Claude":"Codex";(0,B.useEffect)(()=>{h.current?.focus()},[]);let g=async t=>{c||await e.select(t)},b=async t=>{t.preventDefault();let n=u.trim();!n||c||await e.add(n)&&p("")};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("button",{type:"button","aria-hidden":!0,tabIndex:-1,"aria-label":i("accounts.close"),onClick:e=>{e.stopPropagation(),t()},className:"fixed inset-0 z-40 cursor-default sm:hidden"}),(0,F.jsxs)("div",{role:"dialog","aria-label":i("accounts.titleFor",{engine:x}),"aria-busy":null!==c,onKeyDown:e=>vS(e,t),className:`fixed bottom-3 left-1/2 z-50 flex w-[min(400px,calc(100vw-16px))] -translate-x-1/2 flex-col rounded-[14px] border border-border bg-card shadow-2 ${"header"===n?"sm:absolute sm:top-full sm:left-0 sm:mt-2 sm:bottom-auto sm:translate-x-0":"sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0"}`,children:[(0,F.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:(0,tt.t7)(d).color}}),(0,F.jsx)("span",{className:"text-[12.5px] font-bold",children:i("accounts.titleFor",{engine:x})}),(0,F.jsx)("button",{ref:h,type:"button","aria-label":i("accounts.close"),onClick:t,className:"ml-auto inline-flex min-h-[44px] min-w-[44px] items-center justify-center rounded-[6px] p-1 text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0",children:(0,F.jsx)(i9.X,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,F.jsx)("p",{className:"sr-only",role:"status","aria-live":"polite",children:f}),c?(0,F.jsxs)("div",{role:"status","aria-live":"polite",className:"flex items-center gap-2 border-b border-border bg-accent/5 px-3 py-2 text-[11px] font-semibold text-primary",children:[(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 shrink-0 animate-spin motion-reduce:animate-none text-accent","aria-hidden":!0}),function(e,t){switch(e){case"refresh":return t("accounts.operation.refresh");case"add":return t("accounts.operation.add");case"switch":return t("accounts.operation.switch");case"login":return t("accounts.operation.login");case"remove":return t("accounts.operation.remove");case"terminal":return t("accounts.operation.terminal")}}(c,i)]}):null,(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{className:"max-h-[min(420px,60vh)] divide-y divide-border/40 overflow-y-auto",children:["loading"===l?(0,F.jsx)("div",{className:"px-3.5 py-2 text-[11px] text-muted",children:i("accounts.loading")}):null,"error"===l&&0===a.length?(0,F.jsx)("div",{className:"px-3.5 py-2 text-[11px] text-muted",children:i("accounts.noAccounts")}):null,a.map(t=>(0,F.jsxs)(vR,{account:t,engine:d,activeId:s,disabled:null!==c,focused:t.id===r,onSelect:()=>void g(t.id),onRemove:()=>void e.remove(t.id),onCopyCommand:()=>void e.copyTerminalCommand(t.id),children:[(0,F.jsx)(vM,{account:t,engine:d}),"claude"===d?(0,F.jsx)(vP,{account:t,state:e,loginBusy:m},t.login?.operationId??t.id):null]},t.id))]}),(0,F.jsxs)("form",{onSubmit:b,className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[(0,F.jsx)("input",{value:u,onChange:e=>p(e.target.value),placeholder:i("accounts.labelPlaceholder"),className:"h-11 min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8"}),(0,F.jsx)("button",{type:"submit",disabled:null!==c||""===u.trim()||m,className:"inline-flex h-11 min-w-[44px] shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas px-2.5 text-[11px] font-semibold hover:bg-sunken disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8 sm:min-w-0",children:i("accounts.confirmAdd")})]}),(0,F.jsx)("div",{className:"flex justify-end border-t border-border px-3 py-1.5",children:(0,F.jsx)("button",{type:"button",disabled:null!==c,onClick:()=>void e.cleanupOrphans(),className:"inline-flex min-h-[44px] items-center text-[10.5px] font-semibold text-muted underline underline-offset-2 hover:text-primary disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:i("accounts.cleanupOrphans")})}),o?(0,F.jsxs)("div",{className:"flex items-center gap-2 border-t border-border px-3 py-1.5",children:[(0,F.jsx)("span",{className:`min-w-0 flex-1 text-[11px] leading-snug [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden ${"error"===o.kind?"text-danger":"text-muted"}`,title:cK(i,o),children:cK(i,o)}),o.action?(0,F.jsx)("button",{type:"button",disabled:null!==c,onClick:()=>void e.retryNotice().then(e=>{e&&"add"===o.operation&&p("")}),className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:i("forceRemove"===o.action.kind?"accounts.forceRemove":"cleanupOrphans"===o.action.kind?"accounts.cleanupOrphans":"accounts.retry")}):null]}):null]})]})]})}let vD={claude:"Claude",codex:"Codex"};function vL({engine:e}){let t=cZ(e),{t:n}=(0,er.Ym)(),[r,i]=(0,B.useState)(!1),a=(0,B.useRef)(null),s=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!r)return;let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[r]);let l=vD[e],o=(0,tt.t7)(e),c=t.accounts.find(e=>e.id===t.active),d=c?.label??n("accounts.trigger"),u=t.migration?.state==="draining";return(0,F.jsxs)("div",{ref:a,className:"relative",children:[(0,F.jsxs)("button",{ref:s,type:"button","aria-expanded":r,"aria-haspopup":"dialog","aria-label":`${n("accounts.triggerAria",{engine:l})} — ${d}`,title:`${l} \xb7 ${d}`,onClick:()=>i(e=>!e),className:"flex h-8 items-center gap-1 rounded-[7px] border border-border bg-canvas px-2 text-[11px] font-semibold hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)("span",{className:"shrink-0 font-bold",style:{color:o.color},children:l}),(0,F.jsx)("span",{className:"hidden max-w-32 truncate sm:inline",children:d}),u?(0,F.jsx)(i9.kr,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none text-accent","aria-hidden":!0}):(0,F.jsx)(i9.yQ,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0})]}),r?(0,F.jsx)(vO,{state:t,onClose:()=>{i(!1),s.current?.focus()},placement:"header"}):null]})}function vF({file:e,title:t,project:n,currentProject:r,descendants:i,statusLine:a,size:s,tone:l,onOpen:o,onArchive:c}){let{t:d}=(0,er.Ym)(),u=(0,tt.yz)(e),p="large"===s;return(0,F.jsxs)("article",{className:`reasoning-host group relative flex ${p?"h-[150px] w-[300px]":"h-[108px] w-[220px]"} shrink-0 flex-col rounded-[8px] border p-3 shadow-1 transition-colors hover:border-accent/45 ${"stalled"===l?"border-danger/45 bg-danger-soft shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-danger)_18%,transparent)]":"waiting"===l?"border-warning/55 bg-warning-soft shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-warning)_18%,transparent)]":"working"===l?"border-success/40 bg-success-soft":"border-border bg-card"}`,role:"button",tabIndex:0,"aria-label":d("switchCard.openColumn",{title:(0,tt.cr)(t,80)}),onClick:()=>o(e),onKeyDown:t=>{"Enter"===t.key&&o(e)},children:["live"===e.activity?null:(0,F.jsx)("button",{type:"button",className:"absolute right-1.5 top-1.5 z-10 hidden h-5 w-5 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:border-danger/50 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 group-hover:flex group-focus-within:flex","aria-label":d("switchCard.remove"),onClick:t=>{t.stopPropagation(),c(e)},onKeyDown:e=>e.stopPropagation(),children:(0,F.jsx)(i9.X,{className:"h-3 w-3","aria-hidden":!0})}),(0,F.jsxs)("div",{className:"relative flex min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),e.model?(0,F.jsx)("span",{className:"min-w-0 truncate rounded-full px-1.5 py-0.5 font-mono text-[9px] font-semibold",style:{backgroundColor:(0,tt.oC)(e).soft,color:(0,tt.oC)(e).color},title:[u.label,(0,tt.$)(e)].filter(Boolean).join(" \xb7 "),children:e.model}):(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:u.style,title:(0,tt.$)(e),children:u.label}),(0,F.jsx)(ux,{file:e}),(0,F.jsx)(fS,{file:e}),(0,F.jsx)(fE,{wakeup:e.pendingWakeup},f$(e.pendingWakeup)),(0,F.jsx)("span",{className:`ml-auto min-w-0 truncate rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[9.5px] font-semibold ${n===r?"text-muted":"text-primary"}`,title:n,children:es(n,e.projectName)})]}),(0,F.jsx)("div",{className:`relative mt-2 min-w-0 ${p?"text-[14px]":"text-[12.5px]"} font-bold leading-snug`,title:t,children:(0,F.jsx)("span",{className:"line-clamp-2",children:t})}),(0,F.jsxs)("div",{className:"relative mt-auto flex min-w-0 items-center gap-2 text-[10.5px] font-semibold text-muted",children:[(0,F.jsx)("span",{className:"shrink-0",children:(0,tt.rK)(e.mtime)}),e.ctx?(0,F.jsx)(fw,{ctx:e.ctx}):null,i?(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,F.jsx)(cD.A,{className:"h-3 w-3","aria-hidden":!0})," ",i]}):null]}),a?(0,F.jsx)("div",{className:`relative mt-1 min-w-0 truncate font-semibold ${"waiting"===l||"stalled"===l?p?"text-[12.5px]":"text-[11.5px]":p?"text-[11.5px]":"text-[10.5px]"} ${"stalled"===l?"text-danger":"waiting"===l?"text-warning":"text-primary/75"}`,"data-tone":l,children:a}):null,e.pid&&"running"===e.proc?(0,F.jsx)("div",{className:"relative mt-2",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,F.jsx)(fr,{file:e,compact:!0})}):null]})}function v_({title:e,items:t,size:n,currentProject:r,onOpenFile:i,onArchive:a}){return t.length?(0,F.jsxs)("section",{className:"shrink-0",children:[(0,F.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,F.jsx)("h2",{className:"text-[13px] font-bold",children:e}),(0,F.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:t.length})]}),(0,F.jsx)(u$,{className:"flex flex-wrap gap-2.5",enter:"fade",children:t.map(e=>{let t=U(e.file);return(0,F.jsx)("div",{"data-flip-key":t,children:(0,F.jsx)(vF,{file:e.file,title:e.title,project:e.project,currentProject:r,descendants:e.descendants,statusLine:e.statusLine,size:n,tone:"working"===e.kind?"working":"waiting"===e.kind&&"stalled"===e.file.activity?"stalled":"waiting"===e.kind?"waiting":"quiet",onOpen:i,onArchive:a})},t)})})]}):null}function vq({files:e,flows:t,project:n,loaded:r,catalogFailures:i=0,onOpenFile:a,onOpenCatalogFile:s}){let{t:l}=(0,er.Ym)(),[o,c]=(0,B.useState)(!1),[d,u]=(0,B.useState)(""),[p,m]=(0,B.useState)(!1),[f,h]=(0,B.useState)(!1),[x,g]=(0,B.useState)(0),b=(0,B.useRef)(null),v=function(e,t){let[n,r]=(0,B.useState)([]),[i,a]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{if(!t||!e)return;let n=!0;a(!0);let i=async()=>{try{let t=await fetch(`/api/timeline?project=${encodeURIComponent(e)}`),i=await t.json();n&&Array.isArray(i.events)&&r(i.events)}catch{}finally{n&&a(!1)}};i();let s=setInterval(i,7e3);return()=>{n=!1,clearInterval(s)}},[e,t]),{events:n,loading:i}}(n,o),{archivedPaths:w,archive:y,unarchive:k}=function(e){let[t,n]=(0,B.useState)(()=>new Set),r=(0,B.useRef)(t);return(0,B.useEffect)(()=>{let e=function(){try{let e=window.localStorage.getItem(vk),t=e?JSON.parse(e):[];return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}();r.current=e,n(e)},[]),(0,B.useEffect)(()=>{let t=r.current;if(!t.size)return;let i=new Set(t);for(let t of e)t.predecessorPath&&i.has(t.predecessorPath)&&(i.delete(t.predecessorPath),i.add(t.path)),("live"===t.activity||"running"===t.proc)&&i.delete(t.path);i.size===t.size&&[...i].every(e=>t.has(e))||(r.current=i,n(i),vj(i))},[e]),{archivedPaths:t,archive:(0,B.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),r.current=n,vj(n),n})},[]),unarchive:(0,B.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),r.current=n,vj(n),n})},[])}}(e),j=ti(e,v.events,d,x,w,t),N=fB({query:d,enabled:r&&o&&!!d.trim()}),S=ti(e,[],"",x,w,t),C=(0,B.useMemo)(()=>e.filter(e=>w.has(e.path)).map(e=>({file:e,title:(0,ei.cr)(e.title),project:ef(e)})).sort((e,t)=>t.file.mtime-e.file.mtime),[e,w]);(0,B.useEffect)(()=>{let e=()=>g(Date.now()/1e3);e();let t=window.setInterval(e,3e4);return()=>window.clearInterval(t)},[]),(0,B.useEffect)(()=>{if(!o)return;let e=e=>{"Escape"===e.key&&c(!1)};return window.addEventListener("keydown",e),window.setTimeout(()=>b.current?.focus(),0),()=>window.removeEventListener("keydown",e)},[o]);let A=e=>{a(e),c(!1)},I=e=>y(e.path);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(vN,{data:S,onOpen:()=>c(!0)}),o?(0,F.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-primary/28 p-[2.5vh]",onMouseDown:()=>c(!1),children:(0,F.jsxs)("div",{className:"flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-[8px] border border-border bg-canvas shadow-2",role:"dialog","aria-modal":"true","aria-label":l("switch.aria"),onMouseDown:e=>e.stopPropagation(),children:[(0,F.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-border bg-card px-4",children:[(0,F.jsx)("div",{className:"text-[15px] font-bold",children:l("switch.title")}),(0,F.jsx)(vL,{engine:"claude"}),(0,F.jsx)(vL,{engine:"codex"}),(0,F.jsx)("input",{ref:b,value:d,onChange:e=>u(e.target.value),placeholder:l("switch.search"),className:"h-9 min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),v.loading?(0,F.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:l("switch.updating")}):null,(0,F.jsx)("button",{className:"inline-flex h-8 w-8 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":l("switch.close"),onClick:()=>c(!1),children:(0,F.jsx)(i9.X,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,F.jsx)("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-4 py-4",children:d.trim()?(0,F.jsxs)("section",{className:"mx-auto w-full max-w-[900px]",children:[(0,F.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,F.jsx)("h2",{className:"text-[13px] font-bold",children:l("switch.results")}),(0,F.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:N.total})]}),(0,F.jsx)("div",{className:"space-y-1.5",children:N.items.map(e=>(0,F.jsxs)("button",{type:"button",className:"flex min-h-11 w-full min-w-0 items-center gap-2 rounded-[8px] border border-border bg-card px-3 text-left shadow-1 hover:border-accent/40 hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{s(e),c(!1)},children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold text-primary",children:(0,ei.cr)(e.title,100)}),(0,F.jsx)("span",{className:"max-w-[240px] shrink-0 truncate rounded-full border border-border bg-canvas px-2 py-0.5 text-[10.5px] font-semibold text-muted",title:e.project,children:es(e.project,e.projectName)})]},e.path))}),N.loading&&!N.items.length?(0,F.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-[18vh] text-[13px] font-semibold text-muted",children:[(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0})," ",l("common.loading")]}):null,N.error?(0,F.jsxs)("div",{className:"flex min-h-11 items-center justify-center gap-3 pt-4 text-[13px] font-semibold text-danger",children:[(0,F.jsx)("span",{children:l("list.failed")}),(0,F.jsx)("button",{type:"button",className:"min-h-11 rounded-[8px] border border-border bg-card px-4 font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:N.retry,children:l("list.retry")})]}):null,N.loading||N.error||N.items.length?null:(0,F.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-muted",children:l("common.nothingFound")}),N.nextCursor&&!N.error?(0,F.jsx)("button",{type:"button",className:"mt-3 flex min-h-11 w-full items-center justify-center rounded-[8px] border border-border bg-card px-4 text-[12.5px] font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",disabled:N.loading,onClick:N.loadMore,children:N.loading?l("common.loading"):l("list.loadMore")}):null]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(v_,{title:l("switch.waiting"),items:j.waiting,size:"large",currentProject:n,onOpenFile:A,onArchive:I}),(0,F.jsx)(v_,{title:l("switch.working"),items:j.working,size:"large",currentProject:n,onOpenFile:A,onArchive:I}),(0,F.jsx)(v_,{title:l("switch.recent"),items:j.recent,size:"small",currentProject:n,onOpenFile:A,onArchive:I}),(0,F.jsxs)("section",{className:"shrink-0",children:[(0,F.jsxs)("button",{className:"flex h-10 w-full items-center justify-between rounded-[8px] border border-border bg-card px-3 text-left text-[12.5px] font-bold hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":p,onClick:()=>m(e=>!e),children:[(0,F.jsx)("span",{children:l("switch.older")}),(0,F.jsx)("span",{className:"text-muted",children:j.older.length})]}),p?(0,F.jsx)("div",{className:"mt-2",children:(0,F.jsx)(v_,{title:"",items:j.older,size:"small",currentProject:n,onOpenFile:A,onArchive:I})}):null]}),j.waiting.length||j.working.length||j.recent.length||j.older.length?null:i>0?(0,F.jsx)(cn,{failures:i,className:"pt-[18vh]"}):r?(0,F.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-muted",children:l("common.nothingFound")}):(0,F.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-[18vh] text-[13px] font-semibold text-muted",children:[(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),l("common.loading")]}),C.length?(0,F.jsxs)("section",{className:"shrink-0",children:[(0,F.jsxs)("button",{className:"flex h-9 w-full items-center justify-between rounded-[8px] border border-border bg-card px-3 text-left text-[12px] font-bold text-muted hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":f,onClick:()=>h(e=>!e),children:[(0,F.jsx)("span",{children:l("switch.hidden",{count:C.length})}),(0,F.jsx)("span",{children:f?l("switch.hide"):l("common.show")})]}),f?(0,F.jsx)("div",{className:"mt-2 space-y-1",children:C.map(e=>(0,F.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-border bg-card/60 px-3 py-1.5 text-[11.5px] text-muted",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.title}),(0,F.jsx)("span",{className:"shrink-0 truncate text-[10.5px]",title:e.project,children:es(e.project,e.file.projectName)}),(0,F.jsx)("button",{className:"shrink-0 rounded-full border border-border bg-canvas px-2 py-0.5 text-[10.5px] font-semibold text-primary hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>k(e.file.path),children:l("switch.restore")})]},U(e.file)))}):null]}):null]})})]})}):null]})}function vz({ambientAvailable:e}={}){let{t}=(0,er.Ym)(),n=rq(),r=(0,B.useSyncExternalStore)(tF,tD,()=>tI),[i,a]=(0,B.useState)(!1),s=(0,B.useRef)(null),l=(0,B.useRef)(null),o=e??tk();(0,B.useEffect)(()=>{var e;let t;return e=window,t=()=>{tM=null,tE()},e.addEventListener("storage",t),()=>e.removeEventListener("storage",t)},[]);let c=n?"h-11 w-11":"h-[26px] w-[26px]",d=n?"h-5 w-5":"h-3.5 w-3.5",u=e=>{tL(e),tQ()};return(0,F.jsxs)("span",{className:"ml-auto inline-flex shrink-0 items-center gap-1",children:[(0,F.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-full border border-border bg-card text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c}`,title:t(r.cuesEnabled?"sound.on":"sound.off"),"aria-label":t(r.cuesEnabled?"sound.mute":"sound.unmute"),"aria-pressed":r.cuesEnabled,onClick:()=>{let e=!r.cuesEnabled;tL({cuesEnabled:e}),e&&tX({cue:"success",eventId:`preview:${Date.now()}`}),tQ()},children:r.cuesEnabled?(0,F.jsx)(lB.A,{className:d,"aria-hidden":!0}):(0,F.jsx)(lH.A,{className:d,"aria-hidden":!0})}),(0,F.jsxs)("span",{className:"relative inline-flex",children:[(0,F.jsx)("button",{ref:l,"data-testid":"sound-settings-trigger",className:`inline-flex shrink-0 items-center justify-center rounded-full border border-border bg-card text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c}`,title:t("sound.settings"),"aria-label":t("sound.settings"),"aria-expanded":i,onClick:()=>a(e=>!e),children:(0,F.jsx)(a5.A,{className:d,"aria-hidden":!0})}),i?(0,F.jsxs)("div",{ref:s,"data-testid":"sound-settings",role:"dialog","aria-label":t("sound.settings"),onKeyDown:e=>{vS(e,()=>{a(!1),l.current?.focus()})},className:"absolute right-0 top-full z-50 mt-1 w-56 space-y-2 rounded-control border border-border bg-card p-2 shadow-2",children:[(0,F.jsxs)("label",{className:"block space-y-1",children:[(0,F.jsx)("span",{className:"block text-[11px] font-semibold text-secondary",children:t("sound.cueVolume")}),(0,F.jsx)("input",{type:"range","data-testid":"cue-volume",min:0,max:1,step:.05,value:r.cueVolume,"aria-label":t("sound.cueVolume"),onChange:e=>u({cueVolume:Number(e.target.value)}),className:"w-full accent-accent"})]}),o?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("label",{className:"flex items-center gap-2",children:[(0,F.jsx)("input",{type:"checkbox","data-testid":"ambient-viewer-enabled",checked:r.viewerLoopEnabled,onChange:e=>{tL({viewerLoopEnabled:e.target.checked}),tQ()},className:"accent-accent"}),(0,F.jsx)("span",{className:"text-[11px] font-semibold text-secondary",children:t("sound.ambientViewer")})]}),(0,F.jsxs)("label",{className:"flex items-center gap-2",children:[(0,F.jsx)("input",{type:"checkbox","data-testid":"ambient-enabled",checked:r.loopEnabled,onChange:e=>{tL({loopEnabled:e.target.checked}),tQ()},className:"accent-accent"}),(0,F.jsx)("span",{className:"text-[11px] font-semibold text-secondary",children:t("sound.ambient")})]}),(0,F.jsxs)("label",{className:"block space-y-1",children:[(0,F.jsx)("span",{className:"block text-[11px] text-muted",children:t("sound.ambientVolume")}),(0,F.jsx)("input",{type:"range","data-testid":"ambient-volume",min:0,max:1,step:.05,value:r.loopVolume,"aria-label":t("sound.ambientVolume"),onChange:e=>u({loopVolume:Number(e.target.value)}),className:"w-full accent-accent"})]}),(0,F.jsx)("p",{className:"text-[10.5px] leading-snug text-muted",children:t("sound.ambientHint")})]}):null]}):null]})]})}function vH({items:e,activeRootPaths:t,onSelect:n}){let{t:r}=(0,er.Ym)(),i=rq(),[a,s]=(0,B.useState)(!1);return(0,F.jsxs)("div",{className:"shrink-0 border-t border-border bg-canvas",children:[(0,F.jsx)(hG,{open:a,onToggle:()=>s(e=>!e),label:r("tree.quiet"),count:e.length,mobile:i}),a?(0,F.jsx)(u$,{className:"flex max-h-44 flex-wrap items-start gap-1.5 overflow-y-auto px-3 pb-2.5",children:e.map(e=>{let a=(0,tt.yz)(e),s=(0,tt.cr)(e.cmdDesc||e.title,70),l=t?.has(e.path)??!1;return(0,F.jsxs)("button",{"data-flip-key":e.path,className:`inline-flex max-w-[360px] items-center gap-1.5 rounded-full border border-transparent bg-sunken text-[11px] font-semibold text-primary hover:border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11 px-3":"h-7 px-2"}`,title:(0,tt.cr)(e.title),onClick:()=>n(e),children:[(0,F.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tt.tz)(e.activity)}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:a.style,children:a.label}),(0,F.jsx)("span",{className:"truncate",children:s}),l?(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-accent/10 px-1.5 text-[9px] font-bold text-accent",title:r("trash.activeSubtree"),children:[(0,F.jsx)(i9.Zr,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("trash.activeSubtree")]}):null,(0,F.jsx)("span",{className:"shrink-0 font-normal text-muted",children:(0,tt.rK)(e.mtime)})]},e.path)})}):null]})}let vB=e=>`llvDrafts:${e}`;function vU(e,t){return e&&(e.startsWith("draft::")||t.some(t=>t.path===e))?e:null}function vK(e){location.hash="#p="+encodeURIComponent(e)}function vY({value:e,onChange:t,floating:n=!1}){let{t:r}=(0,er.Ym)();return(0,F.jsx)("div",{className:`z-30 inline-flex shrink-0 items-center gap-0.5 rounded-full border border-border bg-card p-0.5 shadow-1 ${n?"absolute left-3 top-3":"mx-3 mt-3 self-start"}`,children:["scheme","list"].map(n=>(0,F.jsxs)("button",{type:"button","aria-pressed":e===n,onClick:()=>t(n),"aria-label":r("scheme"===n?"dash.viewScheme":"dash.viewList"),className:`inline-flex items-center justify-center gap-1 rounded-full px-2 py-1 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e===n?"bg-accent/10 text-accent":"text-muted hover:text-primary"}`,children:["scheme"===n?(0,F.jsx)(cu.A,{className:"h-3 w-3","aria-hidden":!0}):(0,F.jsx)(cp.A,{className:"h-3 w-3","aria-hidden":!0}),r("scheme"===n?"dash.viewScheme":"dash.viewList")]},n))})}function vW({triggerLabel:e,icon:t,children:n}){let[r,i]=(0,B.useState)(!1),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!r)return;let e=e=>{a.current?.contains(e.target)||i(!1)},t=e=>{"Escape"===e.key&&i(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[r]),(0,F.jsxs)("div",{ref:a,className:"relative shrink-0",children:[(0,F.jsx)("button",{type:"button","aria-haspopup":"menu","aria-expanded":r,"aria-label":e,title:e,onClick:()=>i(e=>!e),className:"flex h-11 w-11 items-center justify-center rounded-[8px] border border-border bg-card text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:t}),r?(0,F.jsx)("div",{role:"menu",className:"absolute right-0 top-[calc(100%+6px)] z-50 flex w-[210px] max-w-[calc(100vw-1.5rem)] flex-col gap-0.5 rounded-[12px] border border-border bg-card p-1.5 shadow-2",children:n(()=>i(!1))}):null]})}function vJ({icon:e,label:t,onSelect:n,disabled:r=!1,checked:i}){return(0,F.jsxs)("button",{type:"button",role:void 0===i?"menuitem":"menuitemradio","aria-checked":i,onClick:n,disabled:r,className:`flex min-h-11 w-full items-center gap-2 rounded-[9px] px-2.5 text-left text-[13px] font-semibold hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-45 ${i?"bg-accent/10 text-accent":"text-primary"}`,children:[(0,F.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center text-accent",children:e}),t]})}let vV=(0,B.memo)(function({files:e,flows:t,pipelines:n,pipelinesError:r,workflows:i,tasks:a,conversationAliases:s,projectCatalog:l=[],projectName:o,projectCwd:c,project:d,loaded:u,catalogFailures:p=0,openNonce:m,focusRequest:f,placeRequest:h,attentionPaths:x,archived:g,catalogKnown:b,catalogConversationCount:v,onArchive:w,onUnarchive:y,onMenu:k,attention:j,onUserNavigate:N,onOpenCatalogFile:S,onCloseFile:C}){var A;let{t:I}=(0,er.Ym)(),M=rq(),T=es(d,o??l.find(e=>e.project===d)?.displayName),$=(0,B.useMemo)(()=>{let n,r;return n=!1,r=t.map(t=>{let r=X(t.implementerPath,t.implementerConversationId,e)??t.implementerPath,i=!1,a=t.rounds.map(t=>{let n=t.reviewerPath?X(t.reviewerPath,t.reviewerConversationId,e):t.reviewerPath;return n===t.reviewerPath?t:(i=!0,{...t,reviewerPath:n})});return r!==t.implementerPath||i?(n=!0,{...t,implementerPath:r,...i?{rounds:a}:{}}):t}),n?r:t},[t,e]),E=(0,B.useMemo)(()=>{let t,r;return t=!1,r=n.map(n=>{let r=!1,i=n.runs.map(t=>{let n=!1,i=t.attempts.map(t=>{let r=X(t.agentPath,t.conversationId,e);return r===t.agentPath?t:(n=!0,{...t,agentPath:r})});return n?(r=!0,{...t,attempts:i}):t});return r?(t=!0,{...n,runs:i}):n}),t?r:n},[n,e]),R=(0,B.useRef)(null),P=(0,B.useRef)(null),O=(0,B.useRef)(cE()),D=(0,B.useRef)(cE()),L=rL(d),_=(A=L.loaded,u&&A),q=function(e){let[t,n]=(0,B.useState)(cv);(0,B.useEffect)(()=>{n(null===e?cv():function(e){try{let t=window.localStorage.getItem(cj(e));return t?function(e){if("object"!=typeof e||null===e||!Array.isArray(e.entries)||"number"!=typeof e.cursor)return cv();let t=e.entries.filter(ck);if(t.length!==e.entries.length)return cv();let n=Number.isInteger(e.cursor)?Math.min(Math.max(0,e.cursor),t.length):t.length;return{entries:t,cursor:n}}(JSON.parse(t)):cv()}catch{return cv()}}(e))},[e]);let r=t=>{n(t),null!==e&&function(e,t){try{window.localStorage.setItem(cj(e),JSON.stringify(t))}catch{}}(e,t)};return{canUndo:cw(t),canRedo:cy(t),undoEntry:cw(t)?t.entries[t.cursor-1]:null,redoEntry:cy(t)?t.entries[t.cursor]:null,record:n=>{let i,a,s;null!==e&&r({entries:s=(a=Math.max(0,(i=[...t.entries.slice(0,t.cursor),n]).length-50))?i.slice(a):i,cursor:s.length})},undo:()=>{let{history:e,entry:n}=function(e){if(!cw(e))return{history:e,entry:null};let t=e.entries[e.cursor-1];return{history:{entries:e.entries,cursor:e.cursor-1},entry:t}}(t);return null!==n&&r(e),n},redo:()=>{let{history:e,entry:n}=function(e){if(!cy(e))return{history:e,entry:null};let t=e.entries[e.cursor];return{history:{entries:e.entries,cursor:e.cursor+1},entry:t}}(t);return null!==n&&r(e),n}}}(d),z=(0,B.useMemo)(()=>({manual:L.prefs.manual,hidden:L.prefs.hidden,expanded:L.prefs.expanded}),[L.prefs]),H=L.prefs.taskPanelOpen,Y=L.prefs.favorites,W=(0,B.useMemo)(()=>new Set(Y),[Y]),J=(0,B.useMemo)(()=>({has:e=>Y.includes(e),toggle:e=>L.setFavorite(e,!Y.includes(e))}),[Y]),Z=(0,B.useMemo)(()=>oX(e,Y),[e,Y]),[ee,et]=(0,B.useState)([]),[en,ei]=(0,B.useState)(()=>new Set),[ea,el]=(0,B.useState)(null),[eu,eh]=(0,B.useState)(!1),[eg,eb]=(0,B.useState)(0),[ej,eC]=(0,B.useState)(0),[eA,eM]=(0,B.useState)(null),[eT,e$]=(0,B.useState)(!1),[eE,eR]=(0,B.useState)(null),[eP,eO]=(0,B.useState)(null),[eD,eL]=(0,B.useState)([]),[eF,e_]=(0,B.useState)(0),ez=cM(3e4),eB=(0,B.useMemo)(()=>[...E.filter(e=>e.project===d).map(e=>e.repoDir),...i.filter(e=>e.project===d).map(e=>e.repoDir),...c?[c]:[]],[E,d,c,i]),eU=(0,B.useMemo)(()=>ex(e,d,l,void 0,eB,""),[e,d,l,eB]),eW=eU||"/",eJ=!!eU;(0,B.useEffect)(()=>{let e=()=>e_(Date.now());e();let t=window.setInterval(e,3e4);return()=>window.clearInterval(t)},[]),(0,B.useEffect)(()=>{if(!u)return;let t=!1,n=new Set,r=function(e){try{let t=JSON.parse(sessionStorage.getItem(vB(e))??"[]"),n=Array.isArray(t)?t.filter(e=>"string"==typeof e):[],r=n.filter(e=>!nb(e));if(r.length!==n.length){for(let e of n)nb(e)&&xc(e);sessionStorage.setItem(vB(e),JSON.stringify(r))}return r}catch{return[]}}(d),i=[];for(let t of r)if(!nb(t)){let n=hi(t)||void 0;if(hn(t,"cwd").trim()){!n&&eJ&&function(e,t){let n=t.trim();n&&"1"===hn(e,"cwdUnverified")&&(hr(e,"cwd",n),hr(e,"cwdUnverified",""),window.dispatchEvent(new window.CustomEvent(ho,{detail:{id:e,cwd:n}})))}(t,eW);continue}let r=n?e.find(e=>e.path===n)?.cwd?.trim():void 0;r?hl(t,r):n?i.push({id:t,sourcePath:n}):eJ?hs(t,eW):hl(t,eW)}et(r),ei(new Set(i.map(({id:e})=>e)));let a=(e,r,i=0)=>{fetch("/api/spawn?project="+encodeURIComponent(d)+"&src="+encodeURIComponent(r)).then(async e=>{if(!e.ok)throw Error(`spawn suggestions failed: ${e.status}`);return e.json()}).then(n=>{let r="string"==typeof n.cwd?n.cwd.trim():"";if(!r)throw Error("spawn suggestions omitted the source cwd");t||(!1===n.cwdExists?hl(e,r):hs(e,r),ei(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}))}).catch(()=>{if(t)return;if(i+1>=4){hl(e,eW),ei(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n});return}let s=i<2?0:Math.min(1e3*2**(i-2),3e4),l=window.setTimeout(()=>{n.delete(l),a(e,r,i+1)},s);n.add(l)})};for(let{id:e,sourcePath:t}of i)a(e,t);return()=>{for(let e of(t=!0,n))window.clearTimeout(e)}},[d,m,u,eW,eJ]);let eV=()=>L.setTaskPanelOpen(!H);(0,B.useEffect)(()=>()=>{R.current&&window.clearTimeout(R.current)},[]);let eG=(0,B.useMemo)(()=>(function(e){let t=Q([...e.files]),n=function(e){var t;let n=e.conversationAliases??{},r=e=>G(e,n),i=Q([...e.files]),a=function(e){let t=new Set;for(let n of e)for(let e of n.rounds)e.reviewerPath&&t.add(e.reviewerPath);return t}(e.flows),s=(t=e.tasks??[],(e,n)=>{if(!e&&!n)return null;let r=null,i="";for(let a of t){let t=function(e,t,n){let r=null;for(let i of e.assignments)(i.conversationId===t||null!==n&&i.path===n)&&(null===r||i.at>r)&&(r=i.at);return r}(a,e??"",n);null!==t&&(null===r||t>i||t===i&&a.updatedAt>r.updatedAt)&&(r=a,i=t)}return r}),l=new Map;for(let e of i){let t=e.durableLineage;if(!t||"reviewer"!==t.role||!t.reviewsConversationId||t.memberships.length||a.has(e.path))continue;let n=r(t.reviewsConversationId),i=e.conversationId?r(e.conversationId):null;if(null!==i&&i===n)continue;let o=s(i,e.path)??s(n,null),c=o?`task::${o.id}`:`subject::${n}`,d={file:e,reviewedId:n},u=l.get(c);u?u.members.push(d):l.set(c,{key:c,task:o,members:[d]})}for(let e of l.values())e.members.sort((e,t)=>e.file.mtime-t.file.mtime||(e.file.path<t.file.path?-1:1));return[...l.values()].sort((e,t)=>e.key<t.key?-1:1)}(e),r=e.nowMs??Date.now(),i=e.idleMs??e5(),a=[];for(let{key:s,members:l}of n){let n=l[l.length-1],o=V(t,n.reviewedId);if(!o||e.flows.some(e=>eq(e)&&e.implementerPath===o.path))continue;let c=l.map((e,t)=>{let{file:n}=e,r=n.review??null,i=!r&&!("live"===n.activity||"stalled"===n.activity||"running"===n.proc||n.pendingQuestion||n.waitingInput);return{n:t+1,reviewerPath:n.path,reviewerConversationId:n.conversationId??null,findingsPath:null,triggeredBy:"button",readyNote:null,verdict:r?.verdict??null,findingsCount:r?.findingsCount??null,startedAt:new Date(1e3*n.mtime).toISOString(),reviewedAt:r?.observedAt??null,terminalAt:r?.observedAt??null,relayedAt:null,error:i?"no verdict":null}}),d=c[c.length-1],u={engine:"codex"===n.file.engine?"codex":"claude",model:n.file.model,effort:n.file.effort??null};a.push({id:e9+s,template:"implement-review-loop",project:ef(o),cwd:o.cwd??"",implementerPath:o.path,implementerConversationId:o.conversationId??null,roles:{implementer:{engine:"codex"===o.engine?"codex":"claude",model:o.model,effort:o.effort??null},reviewer:u},baseRef:"",baseMode:"head",mode:"manual",reviewerMode:"pane",roundLimit:0,state:null===d.verdict&&(null===d.error||r-1e3*n.file.mtime<i)?"reviewing":"done_comment",stateDetail:null,rounds:c,createdAt:c[0].startedAt,closedAt:null})}return a.sort((e,t)=>e.id<t.id?-1:1)})({files:e,flows:$,tasks:a,conversationAliases:s,nowMs:eF}),[e,$,a,s,eF]),eX=(0,B.useMemo)(()=>eG.length?[...$,...eG]:$,[$,eG]),eQ=(0,B.useMemo)(()=>{let t=eX.filter(eq),n=function(e,t){let n=eH(t,e);for(let t of e)(t.durableLineage?.role==="reviewer"||t.durableLineage?.memberships.some(e=>"flow"===e.kind&&"reviewer"===e.role))&&n.add(t.path);let r=new Map;for(let t of e){if(!t.parent)continue;let e=r.get(t.parent);e?e.push(t):r.set(t.parent,[t])}let i=new Set,a=[...n],s=new Set(a);for(;a.length;){let e=a.pop();for(let t of r.get(e)??[])s.has(t.path)||(s.add(t.path),i.add(t.path),a.push(t.path))}return i}(e,t);for(let e of t)te(e)&&"reviewing"!==e.state||n.add(e.implementerPath);return n},[e,eX]),eZ=(0,B.useMemo)(()=>{let e=new Set(eQ);for(let t of z.expanded)e.add(t);return e},[eQ,z.expanded]),e0=(0,B.useMemo)(()=>new Set([...L.explicitManual,...z.expanded]),[L.explicitManual,z.expanded]),e1=(0,B.useMemo)(()=>da(E,eX),[E,eX]),e2=(0,B.useMemo)(()=>dl(E,eX),[E,eX]),tt=(0,B.useMemo)(()=>(function(e,t,n=eY){let r=new Map;for(let e of t)for(let t of e.rounds)t.reviewerPath&&!n.has(t.reviewerPath)&&r.set(t.reviewerPath,e.implementerPath);let i=new Map(Q(e).flatMap(e=>e.conversationId?[[e.conversationId,e.path]]:[]));for(let a of e){if(n.has(a.path))continue;let e=a.durableLineage?.memberships.find(e=>"flow"===e.kind&&"reviewer"===e.role);if(!e)continue;let s=t.find(t=>t.id===e.containerId),l=(a.durableLineage?.reviewsConversationId?i.get(a.durableLineage.reviewsConversationId):void 0)??a.parent??s?.implementerPath;l&&r.set(a.path,l)}if(!r.size)return e;let a=[];for(let t of e){if(r.has(t.path))continue;let e=t.parent?r.get(t.parent):void 0;a.push(e?{...t,parent:e}:t)}return a})(e,e2,e1),[e,e2,e1]),tn=(0,B.useMemo)(()=>(function(e,t,n=[]){let r=new Map(t.map(e=>[e.id,e])),i=da(e,t),a=new Set;for(let t of e)for(let e of t.runs)for(let t of e.attempts){t.agentPath&&!i.has(t.agentPath)&&a.add(t.agentPath);let e=t.flowId?r.get(t.flowId):null;if(e)for(let t of(i.has(e.implementerPath)||a.add(e.implementerPath),e.rounds))for(let{path:r}of eK(e,t,n))i.has(r)||a.add(r)}return a})(E,eX,e),[E,eX,e]),tr=(0,B.useMemo)(()=>(function(e){let t={flows:e.flows,pipelineStagePaths:function(e){let t=new Set;for(let n of e)for(let e of n.runs)for(let n of e.attempts)n.agentPath&&t.add(n.agentPath);return t}(e.pipelines??[]),nowMs:e.nowMs,idleMs:e.idleMs??e5(),pinnedPaths:e.pinnedPaths,protectedPaths:e.protectedPaths??e8},n=ew(e.files),r=[];for(let i of e.files)ef(i)===e.project&&function(e,t){if("engine"===e.spawnOrigin)return!1;let n=function(e,t){if(e.handoff)return null;let n=e3(e,t.flows);return n?.role==="reviewer"?"flow-reviewer":n?.role==="implementer"?e.parent?"flow-implementer":null:t.pipelineStagePaths.has(e.path)?"pipeline-stage":ep(e)?"spawned-worker":e.parent?"spawned-descendant":null}(e,t);if(!n||e4(e,t))return!1;let r=e3(e,t.flows);if("flow-reviewer"===n){var i;return!!(r?.round&&(null!==(i=r.round).verdict||null!==i.reviewedAt||null!==i.error||i.terminalAt))}return("flow-implementer"!==n||!!r&&"closed"===r.flow.state&&!r.flow.restored)&&t.nowMs-1e3*e.mtime>=t.idleMs}(i,t)&&(ey(i,n).some(e=>e4(e,t))||r.push(i));return r})({files:e,project:d,flows:eX,pipelines:E,pinnedPaths:e0,protectedPaths:e1,nowMs:eF}),[e,d,eX,E,e0,e1,eF]),ti=(0,B.useMemo)(()=>new Set(tr.map(e=>e.path)),[tr]),ta=(0,B.useMemo)(()=>new Map(e.map(e=>[e.path,e])),[e]),ts=(0,B.useMemo)(()=>(function(e,t=[],n=[]){let r=new Map(t.map(e=>[e.id,e])),i=new Map;for(let t of e)for(let e of t.runs)for(let a of e.attempts)if(a.agentPath&&!i.has(a.agentPath)&&i.set(a.agentPath,t.id),a.flowId){let e=r.get(a.flowId);if(e)for(let r of(i.has(e.implementerPath)||i.set(e.implementerPath,t.id),e.rounds))for(let{path:a}of eK(e,r,n))i.has(a)||i.set(a,t.id)}return i})(E,$,e),[E,$,e]),tl=(0,B.useMemo)(()=>e=>{let t=ta.get(e);return t?function(e,t,n){let r=e,i=new Set;for(;r&&!i.has(r.path);){let e=n.get(r.path);if(e)return e;i.add(r.path),r=r.parent?t.get(r.parent):void 0}return null}(t,ta,ts):null},[ta,ts]),to=(0,B.useMemo)(()=>e=>{let t=e,n=new Set([e.path]);for(;;){let e=t.parent?ta.get(t.parent):void 0;if(!e||n.has(e.path))break;n.add(e.path),t=e}return t.path===e.path?null:t.path},[ta]),tc=(0,B.useMemo)(()=>e.filter(e=>ef(e)===d&&(e.spawn?.state==="failed"||e.spawn?.state==="recovered")&&eF-1e3*e.mtime>=9e5).sort((e,t)=>t.mtime-e.mtime),[e,d,eF]),td=(0,B.useMemo)(()=>new Set(tc.map(e=>e.path)),[tc]),tu=(0,B.useMemo)(()=>ti.size||td.size||tn.size?ds(tt.filter(e=>!ti.has(e.path)&&!td.has(e.path)),tn):tt,[tt,ti,td,tn]),tp=(0,B.useMemo)(()=>eS(tu,d,{expandedConversationPaths:eZ}),[tu,d,eZ]),tm=(0,B.useMemo)(()=>{let t=new Set(z.hidden),n=new Set(z.manual);for(let e of tp)for(let t of(n.add(e.key),e.columns))n.add(t.file.path);let r=new Set;for(let e of n){if(t.has(e))continue;let n=ta.get(e);n&&ef(n)===d&&r.add(U(n))}let i=new Set([...tn,...ti,...td]);return function(e){let t=new Map(e.entries.map(e=>[e.path,e])),n=new Map;for(let t of e.entries){if(K(t))continue;let e=U(t),r=n.get(e),i=t.generation??0,a=r?.generation??0;(!r||i>a||i===a&&t.mtime>r.mtime)&&n.set(e,t)}let r=new Set,i=new Set,a=new Set,s=new Map,l=new Map;for(let o of n.values()){if("shell"===o.engine||"engine"!==o.spawnOrigin||e.hiddenPaths.has(o.path)||e.claimedPaths.has(o.path))continue;let n=function(e,t){let n=e.durableLineage?.parentConversationId;if(n)return n;if(e.parent){let n=t.get(e.parent);if(n)return U(n)}return e.parentRemoved?.conversationId??null}(o,t);if(!n)continue;let c=U(o);if(!e.hostEligibleParentIds.has(n)||"promoted"===function(e,t){let n;return null!==eI(e,t.now)||e.spawn?.state==="failed"||"killed"===e.proc?{presence:"promoted",reason:"attention"}:t.folded?{presence:"folded",reason:"hand-fold"}:e.userAuthored||e.authorshipUnverified||t.pinned?{presence:"promoted",reason:"owner"}:e.authoritativeTurn?.state==="busy"||"running"===e.proc||"live"===e.activity?{presence:"promoted",reason:"busy"}:"terminal"===(n=e.authoritativeTurn?.state)||"idle"===n||"idle"===e.activity||"done"===e.proc||"killed"===e.proc||e.supersededBy?{presence:"folded",reason:"quiet"}:{presence:"promoted",reason:"fail-visible"}}(o,{folded:e.foldedEngineChildIds.has(c),pinned:e.pinnedPaths.has(o.path),now:e.now}).presence){r.add(o.path);continue}i.add(o.path),a.add(c),l.set(c,function(e){let t=e.sessionStartedAt?Date.parse(e.sessionStartedAt):NaN;return Number.isFinite(t)?t:1e3*e.mtime}(o));let d=s.get(n)??[];d.push(function(e,t){let n=U(e);return{id:n,path:e.path,title:e.title,engine:e.engine,model:e.model,state:hY(e,t),avatarSeed:n}}(o,e.now)),s.set(n,d)}let o=new Map;for(let[t,n]of s)n.sort((e,t)=>hW(e.state)-hW(t.state)||(l.get(e.id)??0)-(l.get(t.id)??0)||e.id.localeCompare(t.id)),o.set(t,{parentConversationId:t,members:n,count:n.length,hottest:function(e){let t="dead";for(let n of e)hW(n)<hW(t)&&(t=n);return t}(n.map(e=>e.state)),expanded:e.expandedTrayParentIds.has(t)});return{promotedPaths:r,foldedPaths:i,foldedIds:a,traysByParent:o}}({entries:e,foldedEngineChildIds:new Set(L.prefs.foldedEngineChildIds??[]),expandedTrayParentIds:new Set(L.prefs.expandedEngineTrayParentIds??[]),pinnedPaths:e0,hiddenPaths:t,claimedPaths:i,hostEligibleParentIds:r,now:ez})},[tp,z.hidden,z.manual,L.prefs.foldedEngineChildIds,L.prefs.expandedEngineTrayParentIds,ta,d,e,tn,ti,td,e0,ez]),tf=(0,B.useMemo)(()=>tm.promotedPaths.size||tm.foldedPaths.size?eS(tu,d,{expandedConversationPaths:eZ,enginePlacement:{promotedEnginePaths:tm.promotedPaths,foldedEnginePaths:tm.foldedPaths}}):tp,[tu,d,eZ,tm,tp]),th=(0,B.useMemo)(()=>new Set(tf.map(e=>e.key)),[tf]),tx=(0,B.useMemo)(()=>(function(e,t,n){let r=ew(e),i=[];for(let a of e){if(ef(a)!==t||!ed(a)||n.has(a.path))continue;let e=ey(a,r);if(!e.length)continue;let s=a.mtime,l=ec(a);for(let t of e)s=Math.max(s,t.mtime),l=Math.min(l,ec(t));l<3&&i.push({root:a,branchCount:e.length,smt:s,band:l})}return i.sort((e,t)=>e.band-t.band||t.smt-e.smt)})(tu,d,th),[tu,d,th]),tg=(0,B.useMemo)(()=>(function(e,t,n){let r=ew(e),i=new Set;for(let a of e)ef(a)===t&&ed(a)&&n.has(a.path)&&"idle"===a.activity&&ey(a,r).some(eN)&&i.add(a.path);return i})(tu,d,th),[tu,d,th]),tb=(0,B.useMemo)(()=>(function(e,t,n,r=new Set){let i=ew(e);return e.filter(e=>ef(e)===t&&!e.parent&&(!!r.has(e.path)||!(n.has(e.path)||i.get(e.path)?.length)&&"live"!==e.activity)).sort((e,t)=>ec(e)-ec(t)||t.mtime-e.mtime)})(tu,d,th,tg),[tu,d,th,tg]),tv=(0,B.useMemo)(()=>new Set(tf.flatMap(e=>e.columns.map(e=>e.file.path))),[tf]),tw=(0,B.useMemo)(()=>new Set(z.hidden),[z.hidden]),ty=(0,B.useMemo)(()=>a.filter(e=>e.project===d),[a,d]),[tk,tj]=(0,B.useState)(()=>hQ(d));(0,B.useEffect)(()=>{tj(hQ(d))},[d]);let tN=(e,t)=>{tj(n=>{if(n.has(e)===t)return n;let r=new Set(n);t?r.add(e):r.delete(e);try{window.localStorage.setItem("llvTaskExpand:"+d,JSON.stringify([...r]))}catch{}return r})},[tS,tC]=(0,B.useState)(null),tA=(0,B.useMemo)(()=>(function(e,t){let n=new Map(t.files.map(e=>[e.path,e])),r=[],i=new Map;for(let a of e){if(!function(e,t,n){var r;let i;return!(t.expandedIds.has(e.id)||t.focusedTaskId===e.id||function(e,t){if(e.assignments.some(e=>"failed"===e.state))return!0;if("done"!==e.status&&e.dueAt){let n=Date.parse(e.dueAt);if(Number.isFinite(n)&&n<=t)return!0}return!1}(e,t.nowMs))&&(r=t.nowMs,(!Number.isFinite(i=Date.parse(e.updatedAt||e.createdAt))||!(r-i<9e5))&&!function(e,t){for(let n of e.assignments){if("spawning"===n.state)return!0;let e=n.path?t.get(n.path):void 0;if(e&&("live"===e.activity||"stalled"===e.activity||"running"===e.proc||e.pendingQuestion||e.waitingInput))return!0}return!1}(e,n??new Map(t.files.map(e=>[e.path,e]))))}(a,t,n)){r.push(a);continue}let e=i.get(a.status)??[];e.push(a),i.set(a.status,e)}let a=[];for(let e of fI){let t=i.get(e);t?.length&&(t.sort((e,t)=>e.updatedAt<t.updatedAt?1:e.updatedAt>t.updatedAt||e.id<t.id?-1:1),a.push({status:e,items:t}))}return{full:r,stacks:a}})(ty.filter(hg),{files:e,nowMs:eF,focusedTaskId:tS,expandedIds:tk}),[ty,e,eF,tS,tk]),tI=(0,B.useMemo)(()=>new Set(tA.stacks.flatMap(e=>e.items.map(e=>e.id))),[tA]),tM=(0,B.useMemo)(()=>tI.size?ty.filter(e=>!tI.has(e.id)):ty,[ty,tI]),tT=(0,B.useMemo)(()=>{let e=new Map(tu.map(e=>[e.path,e]));return z.manual.map(t=>e.get(t)).filter(e=>void 0!==e&&ef(e)===d&&!tv.has(e.path)&&!tw.has(e.path))},[z.manual,tu,d,tv,tw]),t$=(0,B.useMemo)(()=>{let t=new Map(tt.map(e=>[e.path,e])),n=new Map(e.filter(e=>tn.has(e.path)).map(e=>[e.path,e])),r=new Set(tT.map(e=>e.path)),i=eD.map(e=>t.get(e)??n.get(e)).filter(e=>void 0!==e&&ef(e)===d&&!r.has(e.path)&&(!tv.has(e.path)||tw.has(e.path))),a=(function(e){let t=new Map(e.files.map(e=>[e.path,e])),n=new Map;for(let t of e.files){let e=t.durableLineage?.memberships.find(e=>"flow"===e.kind&&"reviewer"===e.role);if(!e)continue;let r=n.get(e.containerId)??[];r.push(t.path),n.set(e.containerId,r)}let r=new Set;for(let t of e.flows)if(("closed"!==t.state||t.restored)&&e.renderedNodePaths.has(t.implementerPath)){for(let e of t.rounds)e.reviewerPath&&r.add(e.reviewerPath);for(let e of n.get(t.id)??[])r.add(e)}let i=[],a=new Set;for(let s of e.flows)for(let l of[...s.rounds.map(e=>e.reviewerPath),...n.get(s.id)??[]]){if(!l||a.has(l)||r.has(l)||e.renderedNodePaths.has(l)||e.hiddenPaths.has(l))continue;let n=t.get(l);n&&(n.userAuthored||n.authorshipUnverified||e.pinnedPaths.has(l))&&(i.push(n),a.add(l))}return i})({files:e,flows:eX,renderedNodePaths:new Set([...[...tv].filter(e=>!tw.has(e)),...r,...i.map(e=>e.path)]),hiddenPaths:tw,pinnedPaths:e0}).filter(e=>ef(e)===d&&!tn.has(e.path)),s=[...i,...a];return s.length?[...tT,...s]:tT},[eD,tt,e,tn,eX,d,tv,tw,tT,e0]),tE=(0,B.useMemo)(()=>tf.reduce((e,t)=>e+t.columns.reduce((e,t)=>e+ +("live"===t.file.activity)+t.tasks.filter(e=>"live"===e.activity).length,0),0),[tf]),tR=tf.filter(e=>!e.orphanTask).length,tP=e=>{N?.(),eO(e),tC(e.startsWith("task::")?e.slice(6):null),R.current&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>eO(null),1800)},tO=e=>{tN(e,!0),tP("task::"+e)};(0,B.useEffect)(()=>{eL([])},[d]),(0,B.useEffect)(()=>{if(!f||!(null!==vU(f.path,e)||tn.has(f.path))||!O.current.consume(f))return;let{path:t}=f;P.current=t,eL(n=>tn.has(t)?du(n,t,E,eX,e):n.includes(t)?n:[...n,t])},[f,tn,E,eX,e]),(0,B.useEffect)(()=>{if(!h||!(null!==vU(h.path,e)||tn.has(h.path))||!D.current.consume(h))return;let{path:t}=h;eL(n=>tn.has(t)?du(n,t,E,eX,e):n.includes(t)?n:[...n,t])},[h,tn,E,eX,e]),(0,B.useEffect)(()=>{let t=vU(P.current,e);t&&(P.current=null,tP(t))}),(0,B.useEffect)(()=>{let e=sessionStorage.getItem("llvTaskFocus");e&&ty.some(t=>t.id===e)&&(sessionStorage.removeItem("llvTaskFocus"),tO(e))});let tD=e=>{if(e.project!==d){sessionStorage.setItem("llvTaskFocus",e.id),vK(e.project);return}tO(e.id)};(0,B.useEffect)(()=>{let e=e=>{let t=e.detail,n=t?.id?.trim();if(!n)return;if("task"===t.kind){let e=a.find(e=>e.id===n);e&&tD(e);return}if("pipeline"!==t.kind)return;let r=E.find(e=>e.id===n);if(r){if(r.project!==d){sessionStorage.setItem("llvPipelineFocus",n),vK(r.project);return}N?.(),eR(n)}};return window.addEventListener("llv:mcp-navigate",e),()=>window.removeEventListener("llv:mcp-navigate",e)}),(0,B.useEffect)(()=>{let e=sessionStorage.getItem("llvPipelineFocus");e&&E.some(t=>t.id===e&&t.project===d)&&(sessionStorage.removeItem("llvPipelineFocus"),eR(e))},[E,d]);let tL=e=>{L.setTaskPanelOpen(!1),eM(e)},tF=e=>{et(e),sessionStorage.setItem(vB(d),JSON.stringify(e))},t_=e=>L.setViewMode(e),tq=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),tz=()=>{if(!u)return;N?.();let e=tq();eJ?ha(e,eW):hl(e,eW),tF([...ee,e]),P.current="draft::"+e},tH=async(e,t)=>(N?.(),dD(d,t,e??void 0)),tB=t=>{var n,r;N?.();let i=ee.find(e=>t.conversationId&&hn(e,"parentConversationId")===t.conversationId||hi(e)===t.path);if(i)return void tP("draft::"+i);let a=tq();n=t.path,r=t.conversationId,hr(a,"src",n),hr(a,"parentConversationId",r??""),hl(a,ex(e,d,l,t.path,eB,eW)),tF([...ee,a]),P.current="draft::"+a},tU=e=>{if(nb(e))xc(e);else for(let t of["engine","model","cwd","cwdUnverified","text","boot","src","parentConversationId","effort","speed","accountId","role","roleParams","reviews","confirm"])sessionStorage.removeItem(f6(e,t));tF(ee.filter(t=>t!==e))},tK=e=>{if(N?.(),hJ(e))return void hV(e,dU).then(e=>{e&&s3("err",e)});let t=tq();e.goal?.objective&&hr(t,"text",e.goal.objective),hl(t,e.cwd?.trim()||eW),tF([...ee,t]),P.current="draft::"+t},tY=(e,t)=>{tU(e),t1(t)},tW=e=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:e})}).catch(()=>{}),L.mutate([hd(e,eD).mutation]),eL(t=>hd(e,t).ephemeral),C?.(e)},tJ=t=>{let n=tG.get(t)?.title??e.find(e=>e.path===t)?.title??"";q.record({kind:"close",path:t,title:n}),tW(t)},tV=(0,B.useRef)(z);(0,B.useEffect)(()=>{tV.current=z});let tG=(0,B.useMemo)(()=>new Map(tt.filter(e=>ef(e)===d).map(e=>[e.path,e])),[tt,d]),tX=(0,B.useMemo)(()=>e.filter(e=>ef(e)===d&&"claude-tasks"!==e.root).length,[e,d]),tQ=b&&tX>=v,tZ=(0,B.useMemo)(()=>tf.map(e=>({key:e.key,orphanTask:e.orphanTask})),[tf]);(0,B.useEffect)(()=>{if(L.loaded&&"unavailable"!==L.sync&&(!f||vU(f.path,e))){var t,n;let r,i,a,s;L.mutate((t={files:e,groups:tZ,manual:tV.current.manual,catalog:tG,catalogComplete:tQ,project:d},r=[],(i=function(e,t){let n=[],r=new Set;for(let i of e){let e=i.predecessorPath;e&&ef(i)===t&&e!==i.path&&!r.has(e)&&(r.add(e),n.push({from:e,to:i.path}))}return n.length?{kind:"remap-paths",pairs:n}:null}(t.files,t.project))&&r.push(i),r.push((s=new Set(a=(n={groups:t.groups,manual:t.manual,catalog:t.catalog,catalogComplete:t.catalogComplete}).groups.filter(e=>!e.orphanTask).map(e=>e.key)),{kind:"reconcile-roots",roots:a,removeManual:n.manual.filter(e=>{if(s.has(e))return!1;let t=n.catalog.get(e);return t?ep(t):!1!==n.catalogComplete&&e.endsWith(".jsonl")})})),r))}},[tZ,e,tG,tQ,d,L.loaded,L.sync,f]);let t0=(0,B.useRef)(new Set);(0,B.useEffect)(()=>{if(!L.loaded||"unavailable"===L.sync)return;let t=(function(e){let t=new Set(e.hidden),n=new Set([...e.explicitManual,...e.expanded,...e.manual]),r=new Map;for(let t of e.flows)for(let e of t.rounds)e.reviewerPath&&!r.has(e.reviewerPath)&&r.set(e.reviewerPath,t);let i=[];for(let a of e.files){if(ef(a)!==e.project||!n.has(a.path)||t.has(a.path))continue;let s=r.get(a.path)??null;(a.durableLineage?.role==="reviewer"&&a.durableLineage.reviewsConversationId||s)&&(a.review?.verdict||null!==s&&function(e,t){for(let n of e.rounds)if(n.reviewerPath===t&&(null!==n.verdict||null!=n.terminalAt&&null===n.error))return!0;return!1}(s,a.path))&&!a.userAuthored&&!a.authorshipUnverified&&("live"===a.activity||"stalled"===a.activity||"running"===a.proc||a.pendingQuestion||a.waitingInput||i.push({kind:"close",path:a.path}))}return i})({files:e,flows:eX,project:d,explicitManual:L.explicitManual,manual:tV.current.manual,expanded:tV.current.expanded,hidden:tV.current.hidden}).filter(e=>!t0.current.has(e.path));if(t.length){for(let e of t)t0.current.add(e.path);L.mutate(t)}},[e,eX,d,L.loaded,L.sync,L.explicitManual,L.revision]);let t1=t=>{N?.();let n=ef(t);if(n!==d){rM(n,t.path,ep(t)),vK(n);return}if(tn.has(t.path)){P.current=t.path,eL(n=>du(n,t.path,E,eX,e));return}tv.has(t.path)&&!tw.has(t.path)||tT.some(e=>e.path===t.path)?tP(t.path):(ep(t)?L.restore(t.path,"expanded"):tv.has(t.path)?L.restore(t.path,"auto"):L.restore(t.path,"manual"),P.current=t.path)},t2=t=>{N?.();let n=e.find(e=>e.path===t);if(n){if(ef(n)!==d)return void t1(n);P.current=t,eL(e=>e.includes(t)?e:[...e,t])}},t5=(0,B.useMemo)(()=>({trays:tm.traysByParent,foldedChildPaths:tm.foldedPaths,onToggleExpanded:(e,t)=>L.setEngineTrayExpanded(e,t),onOpenMember:t2,onUnfold:(e,t)=>L.setEngineChildFold(e,t,!1),onFoldChild:(e,t)=>L.setEngineChildFold(e,t,!0)}),[tm,L]),t3=S??t1,t4=t=>{hf(window.localStorage,t.id,"expanded",hm(t));let n=e.find(e=>e.path===t.implementerPath);n?t1(n):L.restore(t.implementerPath,"manual")},t6=()=>{let t=q.undo();if(null===t||"close"!==t.kind)return;let n=tG.get(t.path)??e.find(e=>e.path===t.path);n?t1(n):L.restore(t.path,"manual")},t8=()=>{let e=q.redo();null!==e&&"close"===e.kind&&tW(e.path)},t7=(0,B.useRef)({onUndo:t6,onRedo:t8});t7.current={onUndo:t6,onRedo:t8},(0,B.useEffect)(()=>{if(null===d)return;let e=e=>{if(!(e.ctrlKey||e.metaKey)||e.altKey||"z"!==e.key.toLowerCase())return;let t=e.target,n=t?.tagName;"INPUT"===n||"TEXTAREA"===n||t?.isContentEditable||(e.preventDefault(),e.shiftKey?t7.current.onRedo():t7.current.onUndo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d]);let t9=[];tE?t9.push(`${I("dash.branchesLive",{count:tE})} \xb7 ${I("dash.trees",{count:tR})}`):tR&&t9.push(I("dash.recentConvos",{count:tR})),tx.length&&t9.push(I("dash.quietTrees",{count:tx.length}));let ne=tf.map(e=>({...e,columns:e.columns.filter(e=>!tw.has(e.file.path))})).filter(e=>e.columns.length),nt=ne.filter(e=>e.orphanTask).map(e=>e.columns[0].file),nn=ne.filter(e=>!e.orphanTask),nr=(0,B.useMemo)(()=>{let t;return t=new Set(e.filter(e=>e.project===d).map(e=>e.path)),E.filter(e=>("closed"!==e.state||!!e.restored)&&(e.project===d||e.runs.some(e=>e.attempts.some(e=>!!(e.agentPath&&t.has(e.agentPath))))))},[E,d,e]),ni=ee.filter(e=>!en.has(e)),na=nn.length>0||t$.length>0||ni.length>0||ty.length>0||nr.length>0,ns=(0,B.useMemo)(()=>e.filter(e=>ef(e)===d).sort((e,t)=>t.mtime-e.mtime),[e,d]),nl=(0,B.useMemo)(()=>{let t,n;return(n=(t=e.filter(e=>ef(e)===d).sort((e,t)=>t.mtime-e.mtime||e.path.localeCompare(t.path))).filter(ed)).length?n:t},[e,d]),no=(0,B.useMemo)(()=>na?[]:function(e,t,n=100){let r=new Map(e.map(e=>[e.path,e])),i=ew(e),a=new Set(e.filter(e=>ef(e)===t).sort((e,t)=>t.mtime-e.mtime||e.path.localeCompare(t.path)).slice(0,n).map(e=>e.path)),s=new Set;for(let e of a){let n=r.get(e)??null,i=new Set;for(;n&&ef(n)===t&&!i.has(n.path);)i.add(n.path),s.add(n.path),n=n.parent?r.get(n.parent)??null:null}let l=new Map,o=new Map;for(let e of s){let n=r.get(e);if(!n)continue;let i=ev(n,r);ef(i)===t&&(em(i)?o.set(i.path,i):l.set(i.path,i))}let c=[];for(let e of l.values()){let n=ek(e,i).filter(e=>s.has(e.path)&&ef(e)===t).sort((e,t)=>ec(e)-ec(t)||t.mtime-e.mtime||e.path.localeCompare(t.path)),r=n.filter(e=>!em(e)&&ep(e)),a=new Set([e.path,...r.map(e=>e.path)]),l=[e,...r].map(e=>({file:e,tasks:[]})),o=n.filter(e=>!a.has(e.path)),d=Math.max(e.mtime,...n.map(e=>e.mtime));c.push({key:e.path,columns:l,returnable:[],finished:o,smt:d,orphanTask:!1})}for(let e of o.values())c.push({key:e.path,columns:[{file:e,tasks:[]}],returnable:[],finished:[],smt:e.mtime,orphanTask:!0});return c.sort((e,t)=>eo(t.smt)-eo(e.smt)||e.key.localeCompare(t.key))}(ds(tt.filter(e=>!tw.has(e.path)&&!ti.has(e.path)&&!td.has(e.path)),tn),d,100),[na,tt,tw,ti,td,tn,d]),nc=no.length>0,nd=na||nc,nu=(0,B.useMemo)(()=>new Set(eD.filter(e=>tn.has(e))),[eD,tn]),np=hU(na?nn:no,na?t$:[],e,e2,na?ni:[],E,[],new Set,nu),nm=new Set;for(let e of np.decks)for(let t of e.rounds)t.file&&nm.add(t.file.path);let nf=np.nodes.map(e=>e.file.path).join("\n"),nh=function(e,t,n=new Set,r={}){let i=new Map;for(let a of e){if(n.has(a.path))continue;let{key:e,kind:s,id:l}=function(e,t,n={}){let r=n.pipelineIdOf?.(e.path)??null;if(r)return{key:"wstack::pipeline::"+r,kind:"pipeline",id:r};let i=e3(e,t)?.flow.id??null;if(i)return{key:"wstack::flow::"+i,kind:"flow",id:i};let a=n.originOf?.(e)??null;if(a)return{key:"wstack::origin::"+a,kind:"origin",id:a};let s=e.worktree??"";return{key:"wstack::worktree::"+s,kind:"worktree",id:s}}(a,t,r),o=i.get(e)??{key:e,kind:s,id:l,items:[]};o.items.push(a),i.set(e,o)}let a=[...i.values()];for(let e of a)e.items.sort((e,t)=>e7(e)-e7(t));return a.sort((e,t)=>e.kind!==t.kind?e6[e.kind]-e6[t.kind]:e7(e.items[0])-e7(t.items[0]))}(tr,eX,new Set([...nm,...tw,...td,...tn]),{pipelineIdOf:tl,originOf:to}),nx=b||nl.length>0,ng=function({preferredView:e,hasNodes:t,hasArchiveNodes:n,hasHistoryRows:r}){return"list"===e&&r?"list":"scheme"===e&&(t||n)||t?"scheme":r?"list":"scheme"}({preferredView:L.prefs.viewMode,hasNodes:na,hasArchiveNodes:nc,hasHistoryRows:nx}),nv=nd&&nx;(0,B.useEffect)(()=>{let e="unavailable"===L.sync?null:L.revision;rW.reportContext({project:d,board:{renderedRevision:e,durableRevision:e,sync:L.sync}})},[d,L.revision,L.sync]),(0,B.useEffect)(()=>{u&&0!==e.length&&L.pruneSelectionTo(new Set(e.map(e=>e.path)))},[e,u]),(0,B.useEffect)(()=>{if("scheme"===ng&&nd)return;let e=nx?nl.map(e=>e.path):[],t=e.length>0?e:nf?nf.split("\n"):[],n=t.slice(0,128),r=nx?"list":M?"mobile-focus":"list";rW.reportSlice({mode:r,focusedPath:null,selectedPaths:rU(t,L.selection,{includeUnordered:!0}),visiblePaths:n,camera:null})},[ng,nd,nx,nl,M,nf,L.selection]);let nw=nh.reduce((e,t)=>e+t.items.length,0)+tc.length+ty.length+(nc?0:tb.length),ny=M&&"scheme"===ng&&ea&&gM(ea)?ea:null,nk=M&&_&&(nw>0||!!ny);return(0,F.jsx)(cS,{value:J,children:(0,F.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,F.jsxs)("div",{"data-testid":M?"mobile-project-header":void 0,className:M?"flex min-h-[52px] min-w-0 shrink-0 items-center gap-1 border-b border-border bg-card px-2 py-1.5":"flex h-10 shrink-0 items-center gap-2.5 border-b border-border bg-card px-4",children:[k?(0,F.jsx)("button",{type:"button",className:`flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${M?"h-11 w-11":"-ml-1.5 h-7 w-7"}`,"aria-label":I("dash.openProjects"),onClick:k,children:(0,F.jsx)(o7.A,{className:M?"h-5 w-5":"h-4 w-4","aria-hidden":!0})}):null,(0,F.jsx)("h1",{className:`truncate text-[13.5px] font-bold ${M?"min-w-0 max-w-[45vw]":""}`,title:T,children:T}),(0,F.jsx)(c$,{canUndo:q.canUndo,canRedo:q.canRedo,undoEntry:q.undoEntry,redoEntry:q.redoEntry,onUndo:t6,onRedo:t8,isMobile:M}),M?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{"aria-hidden":!0,className:"min-w-0 flex-1"}),j?(0,F.jsx)("span",{className:"flex shrink-0 items-center",children:j}):null,nk?(0,F.jsxs)("button",{type:"button","data-testid":"mobile-shelf-trigger","aria-haspopup":"dialog","aria-expanded":eu,"aria-label":I("dash.hiddenShelf"),onClick:()=>eh(!0),className:"relative inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)(cm.A,{className:"h-4 w-4","aria-hidden":!0}),nw>0?(0,F.jsx)("span",{className:"absolute -right-0.5 -top-0.5 rounded-full bg-accent/10 px-1 text-[10px] font-bold tabular-nums text-accent",children:nw}):null]}):null,(0,F.jsx)(vW,{triggerLabel:I("dash.createMenu"),icon:(0,F.jsx)(cf.A,{className:"h-5 w-5","aria-hidden":!0}),children:e=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(vJ,{icon:(0,F.jsx)(ch.A,{className:"h-4 w-4","aria-hidden":!0}),label:I("dash.agent"),disabled:!u,onSelect:()=>{e(),tz()}}),(0,F.jsx)(vJ,{icon:(0,F.jsx)(cx.A,{className:"h-4 w-4","aria-hidden":!0}),label:I("dash.task"),onSelect:()=>{e(),N?.(),eC(e=>e+1)}}),(0,F.jsx)(vJ,{icon:(0,F.jsx)("span",{className:"text-[15px] font-bold leading-none",children:"≡"}),label:I("dash.pipeline"),onSelect:()=>{e(),e$(!0)}})]})}),(0,F.jsx)(vW,{triggerLabel:I("dash.moreMenu"),icon:(0,F.jsx)(cg.A,{className:"h-5 w-5","aria-hidden":!0}),children:e=>(0,F.jsxs)(F.Fragment,{children:[nv?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{role:"group","aria-label":I("dash.viewMenuGroup"),className:"flex flex-col gap-0.5",children:[(0,F.jsx)(vJ,{icon:(0,F.jsx)(cu.A,{className:"h-4 w-4","aria-hidden":!0}),label:I("dash.viewSchemeMenu"),checked:"scheme"===ng,onSelect:()=>{e(),t_("scheme")}}),(0,F.jsx)(vJ,{icon:(0,F.jsx)(cp.A,{className:"h-4 w-4","aria-hidden":!0}),label:I("dash.viewListMenu"),checked:"list"===ng,onSelect:()=>{e(),t_("list")}})]}),(0,F.jsx)("span",{"aria-hidden":!0,className:"my-0.5 h-px shrink-0 bg-border"})]}):null,q.canRedo?(0,F.jsx)(vJ,{icon:(0,F.jsx)(cb.A,{className:"h-4 w-4","aria-hidden":!0}),label:I("board.redo"),onSelect:()=>{e(),t8()}}):null,(0,F.jsxs)("div",{className:"flex min-h-11 items-center gap-2 px-1.5",children:[(0,F.jsx)("span",{className:"text-[13px] font-semibold text-primary",children:I("dash.soundMenu")}),(0,F.jsx)(vz,{})]}),(0,F.jsx)(o8,{}),(0,F.jsx)("div",{className:"flex min-h-11 items-center px-1.5",children:g?(0,F.jsxs)("button",{type:"button",className:"inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded-full border border-border bg-canvas px-3 text-[13px] font-semibold text-muted hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>y(d),children:[(0,F.jsx)(i9.$T,{className:"h-4 w-4","aria-hidden":!0})," ",I("dash.unarchive")]}):(0,F.jsx)(fJ,{files:ns,allowEmpty:b,onArchive:()=>w(d)})}),(0,F.jsx)("div",{className:"flex min-h-11 items-center px-1.5",children:(0,F.jsx)(fV,{project:d,files:ns,available:b})})]})})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:`truncate text-[11.5px] ${p>0?"font-semibold text-danger":"text-muted"}`,children:p>0?I("catalog.unreachable"):t9.length?t9.join(" \xb7 "):I("common.nothingRunning")}),(0,F.jsx)(vz,{}),g?(0,F.jsxs)("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold text-muted hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>y(d),children:[(0,F.jsx)(i9.$T,{className:"h-3 w-3","aria-hidden":!0})," ",I("dash.unarchive")]}):(0,F.jsx)(fJ,{files:ns,allowEmpty:b,onArchive:()=>w(d)}),(0,F.jsx)(fV,{project:d,files:ns,available:b}),(0,F.jsxs)("button",{type:"button",onClick:eV,"aria-pressed":H,"aria-label":I("tasks.panelToggleAria"),className:`ml-auto flex shrink-0 items-center gap-1 rounded-[8px] border px-2.5 py-1 text-[11.5px] font-bold shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${H?"border-accent/45 bg-accent/10 text-accent":"border-border bg-card text-primary hover:border-accent/45 hover:text-accent"}`,children:[(0,F.jsx)(cx.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",I("tasks.panelTitle"),ty.filter(e=>"done"!==e.status).length?(0,F.jsx)("span",{className:"rounded-full bg-accent/10 px-1.5 text-[10px] font-bold text-accent",children:ty.filter(e=>"done"!==e.status).length}):null]}),(0,F.jsxs)("button",{type:"button",onClick:()=>e$(!0),"aria-label":I("dash.newPipeline"),className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-border bg-card px-2.5 py-1 text-[11.5px] font-bold text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",I("dash.pipeline")]})]})]}),eT?(0,F.jsx)(hh,{repoDir:eU,onClose:()=>e$(!1),onCreate:tH,onCreated:e=>{e$(!1),eR(e.id)}}):null,r?(0,F.jsx)("div",{className:"shrink-0 border-b border-border bg-warning-soft px-3 py-1.5 text-[11.5px] text-warning",role:"alert",children:I("dash.pipelinesUnavailable")}):null,_&&nt.length?(0,F.jsx)("div",{className:"shrink-0 border-b border-border bg-sunken",children:nt.map(e=>(0,F.jsx)("div",{className:`border-l-4 ${"live"===e.activity?"border-l-success bg-success-soft":"border-l-muted"}`,children:(0,F.jsx)(f_,{file:e})},e.path))}):null,M?(0,F.jsx)(F.Fragment,{children:_?"scheme"===ng&&nd?(0,F.jsx)(gN,{project:d,projectName:T,groups:na?nn:no,manual:na?t$:[],files:e,flows:$,reviewGroups:eG,pipelines:E,surfacePipelines:nr,workerStacks:nh,tasks:na?tM:[],sheetTasks:ty,drafts:na?ni:[],favorites:W,isolatedManualPaths:nu,loaded:u,focus:eP,onSelect:t1,onClose:tJ,onDraftClose:tU,onDraftSpawned:tY,onActiveChange:el,taskSheetNonce:ej,trayApi:t5}):nx?(0,F.jsx)(fG,{project:d,enabled:u&&"list"===ng,onOpen:t3}):(0,F.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,F.jsxs)("div",{children:[(0,F.jsx)("div",{className:"text-[13.5px] font-semibold text-muted",children:I("dash.emptyTitle")}),(0,F.jsx)("div",{className:"mt-0.5 text-[12px] text-muted",children:I("dash.emptyHint")})]})}):p>0?(0,F.jsx)(cn,{failures:p,className:"mt-[12vh]"}):(0,F.jsx)(vy,{})}):(0,F.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,F.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[_&&nv?(0,F.jsx)(vY,{value:ng,onChange:t_,floating:!0}):null,_?"scheme"===ng&&nd?(0,F.jsx)(vw,{project:d,groups:na?nn:no,manual:na?t$:[],files:e,flows:$,reviewGroups:eG,pipelines:E,surfacePipelines:nr,tasks:na?tM:[],allTasks:ty,workerStacks:nh,drafts:na?ni:[],favorites:W,isolatedManualPaths:nu,focus:eP,attentionPaths:x,trayApi:t5,onSelect:t1,onClose:tJ,onDraftClose:tU,onDraftSpawned:tY,onHandoff:tB,onSpawnRetry:tK,onTaskDraft:e=>{N?.();let t=tq();hr(t,"text",e.text),eJ?ha(t,eW):hl(t,eW),tF([...ee,t]),P.current="draft::"+t},onOpenTask:tD,placeTaskId:eA?.id??null,onTaskPlaced:()=>eM(null),newTaskNonce:eg,onTaskCollapse:e=>tN(e.id,!1),builderPipelineId:eE,onBuilderOpened:()=>eR(null)}):nx?(0,F.jsx)(fG,{project:d,enabled:u&&"list"===ng,onOpen:t3}):(0,F.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,F.jsxs)("div",{children:[(0,F.jsx)("div",{className:"text-[13.5px] font-semibold text-muted",children:I("dash.emptyTitle")}),(0,F.jsx)("div",{className:"mt-0.5 text-[12px] text-muted",children:I("dash.emptyHint")})]})}):p>0?(0,F.jsx)(cn,{failures:p,className:"mt-[12vh]"}):(0,F.jsx)(vy,{}),(0,F.jsxs)("div",{"data-chip-keepout":!0,className:"pointer-events-none absolute bottom-4 left-4 z-30 flex items-center gap-2",children:[(0,F.jsxs)("button",{type:"button",onClick:tz,disabled:!u,"aria-label":I("dash.newConvo"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-border bg-card px-3 py-1.5 text-[11.5px] font-bold text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-45",children:[(0,F.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",I("dash.agent")]}),(0,F.jsxs)("button",{type:"button",onClick:()=>{N?.(),eb(e=>e+1)},"aria-label":I("dash.newTask"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-border bg-card px-3 py-1.5 text-[11.5px] font-bold text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,F.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",I("dash.task")]}),(0,F.jsxs)("button",{type:"button",onClick:()=>e$(!0),disabled:!u,"aria-label":I("pipelineBuilder.createDraftAria"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-border bg-card px-3 py-1.5 text-[11.5px] font-bold text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:[(0,F.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",I("board.pipeline")]})]})]}),H?(0,F.jsx)(xN,{tasks:a,project:d,favorites:Z,onOpenFavorite:t1,onToggleFavorite:e=>L.setFavorite(e,!1),onOpenTask:tD,onPlaceOnMap:tL,onClose:eV}):null]}),!M&&_?(0,F.jsx)(vq,{files:e,flows:eX,project:d,loaded:u,catalogFailures:p,onOpenFile:t1,onOpenCatalogFile:t3}):null,_&&(()=>{let t=nh.reduce((e,t)=>e+t.items.length,0)+tc.length+ty.length,n=nc?0:tb.length,r=e=>M?(...t)=>{eh(!1),e(...t)}:e,i=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(xt,{tasks:ty,files:e,pipelines:E,flows:eX,conversationAliases:s,repository:l.find(e=>e.project===d)?.repository??null,onOpenTask:r(tD),onPlaceOnMap:M?void 0:tL,onOpenFile:r(t1)}),(0,F.jsx)(hX,{items:tc,onRetry:r(tK)}),(0,F.jsx)(xr,{stacks:nh,files:e,flows:eX,pipelines:E,onSelect:r(t1),onExpandGroup:r(t4)}),!nc&&tb.length?(0,F.jsx)(vH,{items:tb,activeRootPaths:tg,onSelect:r(t1)}):null]});if(!M)return i;let a=ny?(0,F.jsx)(gT,{file:ny,onHandoff:()=>{eh(!1),tB(ny)},inline:!0}):null;return(0,F.jsx)(xi,{open:eu,onClose:()=>eh(!1),total:t+n,leading:a,children:i})})(),(0,F.jsx)(s6,{})]})})});var vG=n(908);function vX(){let{t:e}=(0,er.Ym)(),t=rq(),[r,i]=(0,B.useState)(!1),[a,s]=(0,B.useState)({status:"idle"}),[l,o]=(0,B.useState)(null),[c,d]=(0,B.useState)(!1),u=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!r||"idle"!==a.status)return;let e=!1;return fetch("/api/access").then(e=>e.json()).then(t=>{e||s(t.tailnetUrl?{status:"ready",url:t.tailnetUrl}:{status:"unavailable"})}).catch(()=>{e||s({status:"error"})}),()=>{e=!0}},[r,a.status]),(0,B.useEffect)(()=>{if("ready"!==a.status)return;let e=!1,t=a.url;return n.e(768).then(n.t.bind(n,768,19)).then(({toDataURL:e})=>e(t,{margin:1,width:220})).then(n=>{e||o({url:t,dataUrl:n})}).catch(()=>{}),()=>{e=!0}},[a]);let p="ready"===a.status&&l&&l.url===a.url?l.dataUrl:null;(0,B.useEffect)(()=>{if(!r)return;let e=e=>{"Escape"===e.key&&i(!1)},t=e=>{u.current&&!u.current.contains(e.target)&&i(!1)};return window.addEventListener("keydown",e),window.addEventListener("pointerdown",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("pointerdown",t)}},[r]);let m=(0,B.useCallback)(()=>{"ready"===a.status&&navigator.clipboard.writeText(a.url).then(()=>{d(!0),window.setTimeout(()=>d(!1),2e3)}).catch(()=>{})},[a]);return(0,F.jsxs)("div",{ref:u,className:"relative ml-auto shrink-0",children:[(0,F.jsx)("button",{type:"button","aria-expanded":r,"aria-label":e("qr.showAria"),onClick:()=>{r||s({status:"idle"}),i(!r)},className:`flex items-center justify-center rounded-[8px] border border-border bg-card text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${t?"h-11 w-11":"p-1.5"}`,children:(0,F.jsx)(vG.A,{className:"h-4 w-4","aria-hidden":!0})}),r?(0,F.jsx)("div",{className:"fixed left-1/2 top-12 z-50 flex w-[260px] -translate-x-1/2 flex-col gap-2.5 rounded-[12px] border border-border bg-card p-3 shadow-2 sm:absolute sm:left-0 sm:right-auto sm:top-full sm:mt-1.5 sm:translate-x-0",children:"idle"===a.status?(0,F.jsx)("span",{className:"text-[12px] text-primary",children:e("common.loading")}):"error"===a.status?(0,F.jsx)("span",{className:"text-[12px] font-semibold text-danger",children:e("qr.failed")}):"unavailable"===a.status?(0,F.jsxs)("span",{className:"text-[12px] leading-relaxed text-primary",children:[e("qr.startHint"),(0,F.jsx)("code",{className:"break-all rounded bg-sunken px-1 py-0.5 font-mono text-[11px]",children:"bunx agent-log-viewer --tailscale"})]}):(0,F.jsxs)(F.Fragment,{children:[p?(0,F.jsx)("img",{src:p,alt:e("qr.alt"),className:"mx-auto h-[220px] w-[220px]"}):(0,F.jsx)("span",{className:"text-[12px] text-primary",children:e("qr.generating")}),(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("input",{readOnly:!0,value:a.url,"aria-label":e("qr.linkAria"),onFocus:e=>e.currentTarget.select(),className:"min-h-[44px] min-w-0 flex-1 truncate rounded-[8px] border border-border bg-canvas px-2 py-1.5 font-mono text-[10.5px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0"}),(0,F.jsx)("button",{type:"button","aria-label":e("qr.copy"),onClick:m,className:"flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center gap-1 rounded-[8px] border border-border bg-card px-2 py-1.5 text-[11px] font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0",children:c?(0,F.jsx)(m1.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,F.jsx)(xY.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,F.jsx)("span",{className:"text-[10.5px] text-muted",children:e("qr.scanHint")})]})}):null]})}function vQ(){let{locale:e,t,setLocale:n}=(0,er.Ym)(),r=rq(),i="en"===e?"uk":"en";return(0,F.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-full border border-border bg-card px-2 text-[10.5px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"min-h-11 min-w-11":"h-[26px]"}`,title:t("lang.aria"),"aria-label":t("lang.aria"),onClick:()=>n(i),children:e.toUpperCase()})}function vZ(e){return Math.max(0,Math.min(100,e))}function v0(e,t,n){return t<=e?0:vZ((t-n)/(t-e)*100)}let v1=312,v2=138;function v5(){return"uk"===(0,er.JK)()?"uk-UA":"en-US"}function v3({series:e,tint:t,now:n}){var r;let{windowStart:i,resetsAt:a,windowSeconds:s,samples:l}=e,o=i??l[0]?.t??n-s,c=a??Math.max(n,l[l.length-1]?.t??n),d=c>o?c-o:1,u=e=>4+(Math.max(o,Math.min(c,e))-o)/d*v1,p=e=>8+(100-Math.max(0,Math.min(100,e)))/100*v2,m=null!==i&&null!==a?`M ${u(i).toFixed(2)},${p(v0(i,a,o)).toFixed(2)} L ${u(a).toFixed(2)},${p(v0(i,a,c)).toFixed(2)}`:null,f=l.length?l.map((e,t)=>`${0===t?"M":"L"} ${u(e.t).toFixed(2)},${p(e.remaining).toFixed(2)}`).join(" "):null,h=l[l.length-1]??null,x=h?(r=h.remaining,r<=10?"var(--color-danger)":r<=30?"var(--color-warning)":t):t,g=u(n);return(0,F.jsxs)("svg",{viewBox:"0 0 320 150",preserveAspectRatio:"none",className:"h-[150px] w-full",role:"img",children:[(0,F.jsx)("rect",{x:4,y:8,width:v1,height:v2,className:"fill-none stroke-border",strokeWidth:1,vectorEffect:"non-scaling-stroke"}),(0,F.jsx)("line",{x1:4,y1:p(50),x2:4+v1,y2:p(50),className:"stroke-border",strokeWidth:1,strokeDasharray:"2 3",vectorEffect:"non-scaling-stroke",opacity:.6}),m?(0,F.jsx)("path",{d:m,className:"fill-none stroke-muted",strokeWidth:1.5,strokeDasharray:"4 3",vectorEffect:"non-scaling-stroke",opacity:.7}):null,f?(0,F.jsx)("path",{d:f,fill:"none",stroke:x,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"}):null,h?(0,F.jsx)("circle",{cx:u(h.t),cy:p(h.remaining),r:2.5,fill:x,vectorEffect:"non-scaling-stroke"}):null,n>o&&n<c?(0,F.jsx)("line",{x1:g,y1:8,x2:g,y2:8+v2,className:"stroke-accent",strokeWidth:1,strokeDasharray:"1 2",vectorEffect:"non-scaling-stroke",opacity:.7}):null]})}function v4({engine:e,label:t,plan:n,activeAccountId:r,onClose:i}){var a;let s,l,{t:o,locale:c}=(0,er.Ym)(),[d,u]=(0,B.useState)(null),[p,m]=(0,B.useState)(!1),[f,h]=(0,B.useState)("weekly"),[x]=(0,B.useState)(()=>Math.round(Date.now()/1e3)),g=(0,B.useRef)(null);(0,B.useEffect)(()=>{g.current?.focus()},[]),(0,B.useEffect)(()=>{let e=!0;return fetch("/api/limits/history").then(e=>e.ok?e.json():Promise.reject(Error(String(e.status)))).then(t=>{e&&u(t)}).catch(()=>{e&&m(!0)}),()=>{e=!1}},[]);let b=d&&r&&("claude"===e?d.claudeAccountId:d.codexAccountId)===r?"claude"===e?d.claude:d.codex:null,v=e=>eE(o,e,b?b[e].windowSeconds/60:null),w=!!(d&&!b),y=b?b[f]:null,k=(0,tt.t7)(e).color,j=!!(y&&y.samples.length>0),N=y?function(e,t){let{windowStart:n,resetsAt:r,samples:i}=e;if(null===n||null===r||0===i.length)return null;let a=vZ(i[i.length-1].remaining),s=Math.min(Math.max(t,n),r),l=v0(n,r,s);return{ideal:l,actual:a,delta:a-l,zeroCrossing:function(e,t){if(e.length<2)return null;for(let t=1;t<e.length;t++)if(e[t].remaining>e[t-1].remaining+.5)return null;let n=e[0],r=e[e.length-1],i=r.t-n.t,a=n.remaining-r.remaining;return i<=0||a<=0?null:r.t+t/(a/i)}(i,a)}}(y,x):null,S=N?N.delta<-2?o("burndown.fast",{pct:Math.round(-N.delta)}):N.delta>2?o("burndown.slow",{pct:Math.round(N.delta)}):o("burndown.even"):null,C=N?.zeroCrossing?o("burndown.emptyBy",{at:(a=N.zeroCrossing,l=(s=new Date(1e3*a)).toLocaleTimeString(v5(),{hour:"2-digit",minute:"2-digit",hour12:!1}),86400>Math.abs(a-x)?l:s.toLocaleDateString(v5(),{day:"numeric",month:"short"})+" "+l)}):null,A="claude"===e&&!j&&d?.historySince?o("burndown.buildsFrom",{date:new Date(d.historySince).toLocaleDateString("uk"===c?"uk-UA":"en-US",{day:"numeric",month:"short"})}):null;return(0,F.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":o("burndown.openAria",{engine:t}),tabIndex:-1,onKeyDown:e=>vS(e,i),className:"fixed bottom-3 left-1/2 z-50 flex w-[min(430px,calc(100vw-16px))] -translate-x-1/2 flex-col rounded-[12px] border border-border bg-card shadow-2 sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0",children:[(0,F.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,F.jsx)("span",{className:"text-[12.5px] font-bold",style:{color:k},children:t}),(0,F.jsx)("span",{className:"text-[11px] text-muted",children:o("burndown.title")}),n?(0,F.jsx)("span",{className:"truncate text-[10px] text-muted",children:n}):null,(0,F.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,F.jsx)("div",{className:"flex rounded-[8px] border border-border p-0.5",role:"tablist","aria-label":o("burndown.windowAria"),children:["weekly","session"].map(e=>(0,F.jsx)("button",{type:"button",role:"tab","aria-selected":f===e,onClick:()=>h(e),className:`rounded-[6px] px-2 py-0.5 text-[10.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${f===e?"bg-sunken text-primary":"text-muted hover:text-primary"}`,children:v(e)},e))}),(0,F.jsx)("button",{ref:g,type:"button","aria-label":o("burndown.close"),onClick:i,className:"rounded-[6px] p-1 text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsx)(i9.X,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]}),(0,F.jsx)("div",{className:"px-3 py-2.5",children:p?(0,F.jsx)("div",{className:"py-6 text-center text-[12px] text-muted",children:o("burndown.failed")}):!d||w?(0,F.jsx)("div",{className:"py-6 text-center text-[12px] text-muted",children:o("burndown.loading")}):j&&y?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(v3,{series:y,tint:k,now:x}),(0,F.jsxs)("div",{className:"mt-1.5 flex items-center justify-between text-[10px] text-muted",children:[(0,F.jsxs)("span",{className:"flex items-center gap-1",children:[(0,F.jsx)("span",{className:"inline-block h-0 w-3 border-t-2 border-dashed border-muted","aria-hidden":!0}),o("burndown.ideal")]}),(0,F.jsxs)("span",{className:"flex items-center gap-1",children:[(0,F.jsx)("span",{className:"inline-block h-0 w-3 border-t-2",style:{borderColor:k},"aria-hidden":!0}),o("burndown.actual")]})]}),S?(0,F.jsxs)("div",{className:"mt-2 text-[11.5px] font-semibold text-primary",children:[S,C?(0,F.jsxs)("span",{className:"ml-1 font-normal text-muted",children:["\xb7 ",C]}):null]}):null]}):y?.windowUnreported?(0,F.jsx)("div",{className:"py-6 text-center text-[12px] text-muted",children:o("burndown.windowUnreported",{window:v(f)})}):(0,F.jsxs)("div",{className:"py-6 text-center text-[12px] text-muted",children:[o("burndown.empty"),A?(0,F.jsx)("div",{className:"mt-1 text-[11px]",children:A}):null]})})]})}function v6(e,t){if(!e)return null;let n=new Date(e);return Number.isNaN(n.getTime())?null:(0,er.Tl)(t,"limits.asOf",{time:n.toLocaleTimeString(eM(t),{hour:"2-digit",minute:"2-digit",hour12:!1})})}function v8(e,t){return e<=10?"var(--color-danger)":e<=30?"var(--color-warning)":t}function v7({label:e,window:t,engineColor:n,now:r}){let{t:i}=(0,er.Ym)();if(!t)return null;let a=Math.max(0,Math.min(100,100-t.usedPercent)),s=v8(a,n);return(0,F.jsxs)("div",{className:"mt-1.5",children:[(0,F.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,F.jsx)("span",{className:"text-[11px] font-semibold text-primary",children:e}),(0,F.jsxs)("span",{className:"text-[11px] text-muted",children:[i("limits.left")," ",(0,F.jsxs)("span",{className:`font-bold tabular-nums ${a<=30?"":"text-primary"}`,style:a<=30?{color:s}:void 0,children:[Math.round(a),"%"]})]})]}),(0,F.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-sunken",children:(0,F.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:Math.max(a,1.5)+"%",backgroundColor:s}})}),t.resetsAt?(0,F.jsx)("div",{className:"mt-[3px] text-[10px] leading-none text-muted",children:i("limits.reset",{eta:e$(t.resetsAt,r),at:eR(t.resetsAt,r)})}):null]})}function v9(e,t,n){if(!e)return!1;let r="claude"===n?e.claudeAccountId??null:e.codexAccountId??null,i="claude"===n?t.claudeAccountId??null:t.codexAccountId??null;return null!==r&&null!==i&&r!==i}function we({engine:e,label:t,limits:n,payloadAccountId:r,now:i,staleHint:a,provenance:s,onSwitched:l}){var o;let{locale:c,t:d}=(0,er.Ym)(),u=cZ(e),[p,m]=(0,B.useState)(!1),[f,h]=(0,B.useState)(!1),[x,g]=(0,B.useState)(null),b=(0,B.useRef)(null),v=(0,B.useRef)(null),w=(0,B.useRef)(null),y=(0,B.useRef)(u.identityVersion);(0,B.useEffect)(()=>{let t=e=>{h(!1),g(e),m(!0)},n=function(e){if(!ee||ee.engine!==e)return null;if(Date.now()-ee.at>5e3)return ee=null,null;let{accountId:t}=ee;return ee=null,{engine:e,accountId:t}}(e);return n&&t(n.accountId),en(n=>{n.engine===e&&t(n.accountId)})},[e]),(0,B.useEffect)(()=>{if(!p)return;let e=e=>{b.current&&!b.current.contains(e.target)&&m(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[p]),(0,B.useEffect)(()=>{if(!f)return;let e=e=>{b.current&&!b.current.contains(e.target)&&h(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[f]),(0,B.useEffect)(()=>{y.current!==u.identityVersion&&(y.current=u.identityVersion,l())},[u.identityVersion,l]),u.status;let k=(0,tt.t7)(e),j=(o=u.active,n&&o&&r===o?n:null),N=!!(n&&null===j),S=!!(j&&(j.session||j.weekly)),C=j?.capturedAt&&i-j.capturedAt>1200?(0,tt.rK)(j.capturedAt):null,A=u.accounts.find(e=>e.id===u.active),I=A?.label??d("accounts.trigger"),M=A?.effective,T=u.migration?.state==="draining",$=function(e,t){if("unavailable"!==e.source&&"cache"!==e.source)return null;if("oauth-reauthentication-required"===e.reason)return(0,er.Tl)(t,"limits.reauthRequired");if("oauth-rate-limited"!==e.reason||!e.retryAt)return null;let n=new Date(e.retryAt);return Number.isNaN(n.getTime())?(0,er.Tl)(t,"limits.rateLimited"):(0,er.Tl)(t,"limits.rateLimitedRetry",{time:n.toLocaleTimeString(eM(t),{hour:"2-digit",minute:"2-digit",hour12:!1})})}(s,c),E="loading"===u.status||N?null:$;return(0,F.jsxs)("div",{ref:b,className:"relative",children:[(0,F.jsxs)("div",{className:a?"opacity-60":"",children:[(0,F.jsx)("button",{ref:v,type:"button","aria-expanded":p,"aria-haspopup":"dialog","aria-label":d("accounts.triggerAria",{engine:t}),onClick:()=>{h(!1),m(e=>!e)},className:"block w-full px-3.5 pb-1.5 pt-2.5 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,F.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,F.jsx)("span",{className:"text-[11.5px] font-bold",style:{color:k.color},children:t}),j?.plan?(0,F.jsx)("span",{className:"truncate text-[10px] text-muted",children:j.plan}):null,a?(0,F.jsx)("span",{className:"truncate text-[10px] text-muted",children:a}):null,C?(0,F.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-warning",title:d("limits.stale",{stale:C})}):null,(0,F.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1",children:[M&&"unavailable"!==M.freshness?(0,F.jsx)("span",{className:`rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[9.5px] font-bold tabular-nums ${"stale"===M.freshness?"opacity-55":""}`,style:{color:v8(M.percent,k.color)},children:d("accounts.effective",{pct:Math.round(M.percent)})}):null,(0,F.jsxs)("span",{className:"flex items-center gap-0.5 rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:[(0,F.jsx)("span",{className:"max-w-24 truncate",children:I}),T?(0,F.jsx)(i9.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none text-accent","aria-hidden":!0}):(0,F.jsx)(i9.yQ,{className:"h-3 w-3 text-muted","aria-hidden":!0})]})]})]})}),S?(0,F.jsxs)("button",{ref:w,type:"button","aria-expanded":f,"aria-haspopup":"dialog","aria-label":d("burndown.openAria",{engine:t}),onClick:()=>{m(!1),h(e=>!e)},className:`block w-full px-3.5 pt-0.5 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${E?"pb-1.5":"pb-3"}`,children:[(0,F.jsx)(v7,{label:eE(d,"session",j.session?.windowMinutes),window:j.session,engineColor:k.color,now:i}),(0,F.jsx)(v7,{label:eE(d,"weekly",j.weekly?.windowMinutes),window:j.weekly,engineColor:k.color,now:i})]}):E?null:(0,F.jsx)("div",{className:"px-3.5 pb-3 pt-0.5 text-[10px] text-muted",children:d("loading"===u.status||N?"limits.accountLoading":"limits.noDataYet")}),E?(0,F.jsx)("div",{className:"px-3.5 pb-3 pt-0.5 text-[10px] text-muted",children:E}):null]}),p?(0,F.jsx)(vO,{state:u,onClose:()=>{m(!1),g(null),v.current?.focus()},focusAccountId:x}):null,f?(0,F.jsx)(v4,{engine:e,label:t,plan:j?.plan??null,activeAccountId:u.active,onClose:()=>{h(!1),w.current?.focus()}},u.active):null]})}function wt(){let{locale:e}=(0,er.Ym)(),[t,n]=(0,B.useState)(null),r=(0,B.useRef)(async()=>{}),i=(0,B.useCallback)(()=>void r.current(),[]);(0,B.useEffect)(()=>{var e,t;let i,a,s=(e=fetch,t=e=>{n(t=>{var n;let r,i;return{data:(r=v9(n=t?.data??null,e,"claude"),i=v9(n,e,"codex"),{claude:r?e.claude:e.claude??n?.claude??null,codex:i?e.codex:e.codex??n?.codex??null,claudeAccountId:e.claudeAccountId??n?.claudeAccountId??null,codexAccountId:e.codexAccountId??n?.codexAccountId??null,provenance:e.provenance,staleSince:e.staleSince??null}),at:Date.now()/1e3}})},i=0,a=null,{async load(){a?.abort();let n=++i;a=new AbortController;try{let r=await e("/api/limits",{signal:a.signal});if(!r.ok)return!1;let s=await r.json();if(n!==i)return!1;return a=null,t(s),!0}catch{return!1}},dispose(){i+=1,a?.abort(),a=null}}),l=async()=>{await s.load()};r.current=l,l();let o=setInterval(l,6e4);return()=>{clearInterval(o),s.dispose(),r.current=async()=>{}}},[]);let a=t?v6(t.data.provenance.claude.staleSince,e):null,s=t?v6(t.data.provenance.codex.staleSince,e):null,l=t?.at??0;return(0,F.jsxs)("div",{className:"shrink-0 border-t border-border empty:hidden",children:[(0,F.jsx)(we,{engine:"claude",label:"Claude",limits:t?.data.claude??null,payloadAccountId:t?.data.claudeAccountId??null,now:l,staleHint:a,provenance:t?.data.provenance.claude??{source:"unavailable",reason:null,staleSince:null},onSwitched:i}),(0,F.jsx)(we,{engine:"codex",label:"Codex",limits:t?.data.codex??null,payloadAccountId:t?.data.codexAccountId??null,now:l,staleHint:s,provenance:t?.data.provenance.codex??{source:"unavailable",reason:null,staleSince:null},onSwitched:i})]})}var wn=n(5298),wr=n(4526);function wi(){let{t:e}=(0,er.Ym)(),t=rq(),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e="serviceWorker"in navigator&&"PushManager"in window&&window.isSecureContext;queueMicrotask(()=>a(e)),e&&navigator.serviceWorker.getRegistration("/question-push-sw.js").then(e=>e?.pushManager.getSubscription().then(e=>r(null!==e)))},[]);let s=async()=>{if(!i||"default"===Notification.permission&&"granted"!==await Notification.requestPermission()||"granted"!==Notification.permission)return;let e=await navigator.serviceWorker.register("/question-push-sw.js"),t=await e.pushManager.getSubscription();if(t){await t.unsubscribe(),r(!1);return}let n=await (await fetch("/api/push")).json(),a=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t=atob((e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n.buffer.slice(0)}(n.publicKey)});await fetch("/api/push",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),r(!0)};return(0,F.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-full border border-border bg-card text-muted hover:text-primary disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${t?"h-11 w-11":"h-[26px] w-[26px]"}`,title:e(i?n?"push.enabled":"push.enable":"push.needsHttps"),"aria-label":e(i?n?"push.disable":"push.enable":"push.needsHttps"),"aria-pressed":n,disabled:!i,onClick:s,children:n?(0,F.jsx)(wn.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,F.jsx)(wr.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}async function wa(e,t,n={}){let r,i=n.fetch??fetch,a=n.copy??u9.copyText;try{r=await i(`/api/tmux?attach=1&target=${encodeURIComponent(e)}`,{headers:{accept:"application/json"},cache:"no-store"})}catch{return{ok:!1,reason:"network"}}let s={};try{s=await r.json()}catch{}let l=function(e,t,n){if(200===t){let t,r="string"==typeof(t="readonly"===e?n.attach?.readOnlyCommand:n.attach?.command)&&t.length>0?t:null;return r?{ok:!0,command:r}:{ok:!1,reason:"tmux-unavailable"}}return"stale-pane"===n.reason||"server-restarted"===n.reason||"tmux-unavailable"===n.reason?{ok:!1,reason:n.reason}:{ok:!1,reason:400===t?"bad-request":"tmux-unavailable"}}(t,r.status,s);return l.ok?await a(l.command)?l:{ok:!1,reason:"clipboard"}:l}function ws({kind:e,label:t,hint:n,status:r,disabled:i,onCopy:a}){let s=r?.kind===e?r:null,l=s?.phase==="loading",o=s?.phase==="copied",c="readonly"===e?i9.kU:i9.BK;return(0,F.jsxs)("button",{type:"button",disabled:i,"aria-label":t,title:n,onClick:()=>a(e),className:["inline-flex min-h-[44px] items-center gap-1.5 rounded-[8px] border px-2.5 text-[11px] font-semibold sm:min-h-0 sm:py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-wait disabled:opacity-50",o?"border-success/50 text-success":"border-border text-muted hover:bg-canvas hover:text-accent"].join(" "),children:[l?(0,F.jsx)(i9.kr,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none","aria-hidden":!0}):o?(0,F.jsx)(i9.Jl,{className:"h-3.5 w-3.5 text-success","aria-hidden":!0}):(0,F.jsx)(c,{className:"h-3.5 w-3.5","aria-hidden":!0}),(0,F.jsx)("span",{children:t})]})}function wl({status:e,onCopy:t,onRefresh:n}){var r;let{t:i}=(0,er.Ym)(),a=e?.phase==="loading",s=e?.phase==="error"?e:null,l=e?.phase==="copied"?e:null,o=null!==s&&("stale-pane"===(r=s.reason)||"server-restarted"===r||"tmux-unavailable"===r);return(0,F.jsxs)("div",{className:"mt-1.5",children:[(0,F.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,F.jsx)(ws,{kind:"attach",label:i("attach.attach"),hint:i("attach.hint"),status:e,disabled:a,onCopy:t}),(0,F.jsx)(ws,{kind:"readonly",label:i("attach.readonly"),hint:i("attach.readonlyHint"),status:e,disabled:a,onCopy:t}),a?(0,F.jsx)("span",{role:"status",className:"text-[10.5px] text-muted",children:i("attach.loading")}):null,l?(0,F.jsx)("span",{role:"status",className:"text-[10.5px] font-semibold text-success",children:i("readonly"===l.kind?"attach.copiedReadonly":"attach.copied")}):null]}),s?(0,F.jsxs)("div",{role:"alert","aria-live":"assertive",className:"mt-1 flex flex-wrap items-center gap-2 text-[10.5px] text-danger",children:[(0,F.jsx)("span",{className:"min-w-0",children:i(function(e){switch(e){case"stale-pane":return"attach.stale";case"server-restarted":return"attach.restarted";case"tmux-unavailable":return"attach.unavailable";case"bad-request":return"attach.badRequest";case"network":return"attach.network";case"clipboard":return"attach.clipboard"}}(s.reason))}),o?(0,F.jsxs)("button",{type:"button",onClick:n,className:"inline-flex min-h-[44px] items-center gap-1 rounded-[8px] border border-danger/40 px-2 font-semibold text-danger hover:bg-danger/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40 sm:min-h-0 sm:py-0.5",children:[(0,F.jsx)(i9.kt,{className:"h-3 w-3","aria-hidden":!0}),i("attach.refresh")]}):null]}):null]})}function wo({target:e,onRefresh:t}){let[n,r]=(0,B.useState)(null),i=(0,B.useRef)(!0),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>(i.current=!0,()=>{i.current=!1,null!==a.current&&window.clearTimeout(a.current)}),[]),(0,F.jsx)(wl,{status:n,onCopy:t=>{n?.phase!=="loading"&&(null!==a.current&&window.clearTimeout(a.current),r({phase:"loading",kind:t}),wa(e,t).then(e=>{i.current&&(e.ok?(r({phase:"copied",kind:t}),a.current=window.setTimeout(()=>{i.current&&r(null)},1400)):r({phase:"error",kind:t,reason:e.reason}))}))},onRefresh:()=>{r(null),t()}})}let wc=[2,6,12];function wd(e){return e>=0x280000000?Math.round(e/0x40000000)+" GiB":e>=0x40000000?(e/0x40000000).toFixed(1)+" GiB":Math.max(0,Math.round(e/1048576))+" MiB"}function wu({label:e,usedPercent:t,color:n,note:r}){let i=Math.max(1.5,Math.min(100,t));return(0,F.jsxs)("div",{className:"mt-1.5 first:mt-0",children:[(0,F.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,F.jsx)("span",{className:"text-[11px] font-semibold text-primary",children:e}),(0,F.jsx)("span",{className:"text-[11px] tabular-nums text-muted",children:r})]}),(0,F.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-sunken",children:(0,F.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:i+"%",backgroundColor:n}})})]})}function wp(){let{t:e}=(0,er.Ym)(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),a=(0,B.useRef)(null),s=(0,B.useRef)(async()=>{});(0,B.useEffect)(()=>{var e,t,r;let i,a,l,o,c=!1,d=(e=fetch,t=(e,t)=>{(0,B.startTransition)(()=>{c||n(n=>{let r;return r=null===e.system&&(n?.data.system??null)!==null,{data:{system:e.system??n?.data.system??null,sessions:e.sessions},at:t,staleSince:r?n?.staleSince??t:null}})})},r=e=>{(0,B.startTransition)(()=>{c||n(t=>t?{...t,staleSince:t.staleSince??e}:t)})},i=null,a={async run(e,t){for(;;){let n=i;if(n){if(!e||n.fresh)return n.promise;try{await n.promise}catch{}i===n&&(i=null);continue}let r=Promise.resolve().then(()=>t(e)),a={fresh:e,promise:r};i=a;try{return await r}finally{i===a&&(i=null)}}}},l=new AbortController,o=!1,{load:(n=!1)=>o?Promise.resolve(!1):a.run(n,async n=>{if(o)return!1;let i=Date.now()/1e3;try{let r=await e("/api/resources"+(n?"?fresh=1":""),{signal:l.signal});if(!r.ok)throw Error(String(r.status));let a=await r.json();return o||t(a,i),!0}catch{return o||r(i),!1}}),dispose(){o=!0,l.abort()}}),u=async(e=!1)=>{await d.load(e)};s.current=u;let p=null,m=async()=>{await u(),c||(p=setTimeout(()=>void m(),3e4))};return p=setTimeout(()=>void m(),1500),()=>{c=!0,p&&clearTimeout(p),d.dispose(),s.current=async()=>{}}},[]),(0,B.useEffect)(()=>{if(!r)return;let e=e=>{"Escape"===e.key&&i(!1)},t=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return window.addEventListener("keydown",e),window.addEventListener("pointerdown",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("pointerdown",t)}},[r]);let l=t?.data.system??null,o=t?.data.sessions??[];if(!t||!l&&0===o.length)return null;let c=l?100*(l.ramTotal-l.ramAvailable)/l.ramTotal:0,d=l?100*l.ramAvailable/l.ramTotal:100,u=l&&l.swapTotal>0?100*l.swapUsed/l.swapTotal:0;return(0,F.jsxs)("div",{ref:a,className:"relative shrink-0 border-t border-border",children:[(0,F.jsxs)("button",{type:"button","aria-expanded":r,"aria-label":e("resources.openAria"),onClick:()=>i(e=>!e),className:"block w-full px-3.5 pb-2.5 pt-2 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[t.staleSince?(0,F.jsx)("span",{className:"absolute right-2 top-2 h-1.5 w-1.5 rounded-full bg-warning",title:e("resources.stale",{stale:(0,tt.rK)(t.staleSince)})}):null,l?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(wu,{label:e("resources.ram"),usedPercent:c,color:d<10?"var(--color-danger)":d<30?"var(--color-warning)":"var(--color-muted)",note:e("resources.free",{amount:wd(l.ramAvailable)})}),l.swapTotal>0?(0,F.jsx)(wu,{label:e("resources.swap"),usedPercent:u,color:u>85?"var(--color-danger)":u>60?"var(--color-warning)":"var(--color-muted)",note:e("resources.used",{amount:wd(l.swapUsed)})}):null,(0,F.jsx)("span",{className:"mt-1.5 block text-right text-[9.5px] tabular-nums text-muted",children:e("resources.captured",{age:(0,tt.rK)(Date.parse(l.capturedAt)/1e3)})})]}):(0,F.jsx)("span",{className:"text-[11px] font-semibold text-primary",children:e("resources.title")})]}),r?(0,F.jsx)(wf,{sessions:o,now:t.at,onRefresh:()=>s.current(!0),onClose:()=>i(!1)}):null]})}async function wm(e){let t=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill-target",target:e.target})});return t.ok?null:(await t.json().catch(()=>({}))).error??String(t.status)}function wf({sessions:e,now:t,onRefresh:n,onClose:r}){let{t:i}=(0,er.Ym)(),[a,s]=(0,B.useState)(new Set),[l,o]=(0,B.useState)(null),[c,d]=(0,B.useState)(null),[u,p]=(0,B.useState)(2),[m,f]=(0,B.useState)(!1),[h,x]=(0,B.useState)(!1),[g,b]=(0,B.useState)(!1),v=(e,t)=>s(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),w=async e=>{d(null),x(!1),v(e.target,!0);try{let t=await wm(e);t&&d(t),await n()}finally{v(e.target,!1),o(null)}},y=n=>{let r=(t-3600*n)*1e3;return e.filter(e=>"live"!==e.activity&&null!==e.lastActiveAt&&Date.parse(e.lastActiveAt)<r)},k=async()=>{let e=y(u);if(0!==e.length&&!m){d(null),x(!1),f(!0);try{for(let t of e){v(t.target,!0);let e=await wm(t);e&&d(e)}await n()}finally{s(new Set),f(!1)}}},j=async()=>{if(0!==e.length&&!g){d(null),b(!0);try{for(let t of e){v(t.target,!0);let e=await wm(t);e&&d(e)}await n()}finally{s(new Set),b(!1),x(!1)}}},N=e.reduce((e,t)=>e+t.rssBytes+t.swapBytes,0),S=y(u).length;return(0,F.jsxs)("div",{className:"fixed bottom-3 left-1/2 z-50 flex w-[min(430px,calc(100vw-16px))] -translate-x-1/2 flex-col rounded-[12px] border border-border bg-card shadow-2 sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0",children:[(0,F.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,F.jsx)("span",{className:"text-[12.5px] font-bold",children:i("resources.title")}),e.length?(0,F.jsx)("span",{className:"text-[11px] tabular-nums text-muted",children:i("resources.total",{amount:wd(N)})}):null,(0,F.jsx)("button",{type:"button","aria-label":i("resources.close"),onClick:r,className:"ml-auto inline-flex min-h-[44px] min-w-[44px] items-center justify-center rounded-[6px] p-1 text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0",children:(0,F.jsx)(i9.X,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,F.jsx)("div",{className:"max-h-[min(420px,60vh)] overflow-y-auto py-1",children:0===e.length?(0,F.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-muted",children:i("resources.empty")}):e.map(e=>(0,F.jsx)(wh,{session:e,busy:a.has(e.target),armed:l===e.target,onArm:()=>o(e.target),onKill:()=>void w(e),onRefresh:n},e.target))}),(0,F.jsxs)("footer",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[(0,F.jsx)("span",{className:"text-[11px] text-muted",children:i("resources.bulkLabel")}),(0,F.jsx)("select",{value:u,onChange:e=>p(Number(e.target.value)),className:"min-h-[44px] min-w-[44px] rounded-[8px] border border-border bg-canvas px-1.5 py-1 text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0",children:wc.map(e=>(0,F.jsx)("option",{value:e,children:i("resources.hoursN",{n:e})},e))}),(0,F.jsxs)("button",{type:"button",disabled:m||0===S,title:0===S?i("resources.bulkNone"):void 0,onClick:()=>void k(),className:"ml-auto inline-flex min-h-[44px] items-center rounded-[8px] border border-danger/40 px-2.5 py-1 text-[11px] font-semibold text-danger hover:bg-danger/10 disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40 sm:min-h-0",children:[i("resources.bulkKill"),S?` (${S})`:""]})]}),(0,F.jsxs)("div",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[(0,F.jsx)("span",{className:"text-[13px] leading-none text-danger","aria-hidden":!0,children:"⚠"}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-muted",title:i("resources.killAllHint"),children:i("resources.killAllHint")}),(0,F.jsx)("button",{type:"button",disabled:g||0===e.length,title:0===e.length?i("resources.killAllNone"):i("resources.killAllHint"),onClick:()=>h?void j():x(!0),className:["inline-flex min-h-[44px] shrink-0 items-center rounded-[8px] border px-2.5 py-1 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40 disabled:cursor-not-allowed disabled:opacity-45 sm:min-h-0",h?"border-danger bg-danger text-white":"border-danger/40 text-danger hover:bg-danger/10"].join(" "),children:h?i("resources.killAllConfirm",{n:e.length}):i("resources.killAll")+(e.length?` (${e.length})`:"")})]}),c?(0,F.jsx)("div",{className:"border-t border-border px-3 py-1.5 text-[11px] font-semibold text-danger",children:c}):null]})}function wh({session:e,busy:t,armed:n,onArm:r,onKill:i,onRefresh:a}){var s;let{t:l}=(0,er.Ym)(),o=(0,tt.t7)(e.engine??""),c="live"===e.activity,d=!0===e.hostConflict,u=null!==e.lastActiveAt?Date.parse(e.lastActiveAt)/1e3:null,p=c&&!n;return(0,F.jsxs)("div",{className:"px-3 py-1.5 hover:bg-canvas",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tt.tz)(e.activity??"idle")}`}),(0,F.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-bold",style:{backgroundColor:o.soft,color:o.color},children:"codex"===e.engine?"Codex":"claude"===e.engine?"Claude":"?"}),(0,F.jsxs)("span",{className:"min-w-0 flex-1",title:[e.cwd,e.target,l("resources.procs",{count:e.procCount})].filter(Boolean).join(" \xb7 "),children:[(0,F.jsx)("span",{className:"block truncate text-[12px] font-semibold",children:d?l("resources.hostConflict"):e.title??(e.cwd?(s=e.cwd).split("/").filter(Boolean).slice(-2).join("/")||s:l("resources.orphan"))}),(0,F.jsxs)("span",{className:"block truncate text-[10.5px] text-muted",children:[d?l("resources.hostConflictHint")+" \xb7 ":null===e.title?l("resources.orphan")+" \xb7 ":e.project?e.project+" \xb7 ":"",null!==u?(0,tt.rK)(u):e.target]})]}),(0,F.jsxs)("span",{className:"shrink-0 text-right",children:[(0,F.jsx)("span",{className:"block text-[11.5px] font-bold tabular-nums",children:wd(e.rssBytes)}),e.swapBytes>0?(0,F.jsx)("span",{className:"block text-[10px] tabular-nums text-muted",children:l("resources.swapShare",{amount:wd(e.swapBytes)})}):null]}),(0,F.jsx)("button",{type:"button",disabled:t,"aria-disabled":p||t,title:l(c?"resources.killLiveHint":"resources.killHint"),onClick:()=>p?r():i(),className:["inline-flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center rounded-[8px] border px-2 py-1 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40 sm:min-h-0 sm:min-w-0",t?"cursor-wait opacity-50":"",n?"border-danger bg-danger text-white":p?"border-border text-muted opacity-60 hover:opacity-90":"border-danger/40 text-danger hover:bg-danger/10"].join(" "),children:l(n?"resources.confirm":"resources.kill")})]}),(0,F.jsx)(wo,{target:e.target,onRefresh:()=>void a()})]})}function wx({files:e,projectCatalog:t,projectDisplayNames:n={},pipelines:r,workflows:i,archivedProjects:a,selected:s,loaded:l,catalogFailures:o=0,now:c,onSelect:d}){let{t:u}=(0,er.Ym)(),p=rq(),[m,f]=(0,B.useState)(""),[h,x]=(0,B.useState)(!1),g=(0,B.useMemo)(()=>eb(e,c,i,t,r,n),[e,c,i,t,r,n]),b=(0,B.useMemo)(()=>g.filter(e=>{var t,n;let r;return t=e.project,n=e.displayName,!(r=m.trim().toLowerCase())||t.toLowerCase().includes(r)||es(t,n).toLowerCase().includes(r)}),[g,m]),v=(0,B.useMemo)(()=>b.filter(e=>!a.has(e.project)),[b,a]),w=(0,B.useMemo)(()=>b.filter(e=>a.has(e.project)),[b,a]),y=(0,B.useMemo)(()=>g.reduce((e,t)=>e+t.liveCount,0),[g]),k=(0,B.useMemo)(()=>g.reduce((e,t)=>e+t.attentionCount,0),[g]);return(0,F.jsxs)("aside",{className:"flex w-[248px] shrink-0 flex-col border-r border-border bg-card",children:[(0,F.jsx)("header",{className:`flex shrink-0 items-center gap-2 border-b border-border text-[13.5px] font-bold ${p?"min-h-[52px] gap-1.5 px-2 py-1.5":"h-10 px-4"}`,children:p?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden",children:[(0,F.jsx)("span",{className:"min-w-0 truncate",children:u("rail.title")}),y?(0,F.jsx)("span",{className:"shrink-0 text-[11px] font-semibold tabular-nums text-muted",children:y>99?"99+":y}):null,k?(0,F.jsxs)(an,{tone:"warning",children:["⏸",k>99?"99+":k]}):null]}),(0,F.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,F.jsx)(vQ,{}),(0,F.jsx)(vX,{}),(0,F.jsx)(wi,{})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{children:u("rail.title")}),y?(0,F.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[11px] font-semibold tabular-nums text-muted",children:[(0,F.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-success"}),y]}):null,k?(0,F.jsxs)(an,{tone:"warning",children:["⏸ ",k]}):null,(0,F.jsx)(vQ,{}),(0,F.jsx)(vX,{}),(0,F.jsx)(wi,{})]})}),(0,F.jsx)("div",{className:"px-2.5 pb-1 pt-2.5",children:(0,F.jsx)("input",{className:`w-full rounded-[9px] border border-border bg-canvas px-2.5 text-[12px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${p?"min-h-11":"py-1.5"}`,placeholder:u("rail.filter"),value:m,onChange:e=>f(e.target.value)})}),(0,F.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":u("rail.projects"),children:[(0,F.jsx)(wg,{label:u("rail.overview"),live:0,attention:0,total:null,age:"",active:s===el,hasLive:!1,onClick:()=>d(el)}),(0,F.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-border"}),(0,F.jsx)(u$,{children:v.map(e=>(0,F.jsx)("div",{"data-flip-key":e.project,children:(0,F.jsx)(wg,{label:e.displayName,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:(0,tt.rK)(e.smt),active:s===e.project,hasLive:e.liveCount>0,muted:e.catalogOnly,onClick:()=>d(e.project)})},e.project))}),w.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-border"}),(0,F.jsxs)("button",{type:"button",className:`mb-0.5 flex w-full items-center gap-1.5 rounded-[10px] px-2.5 text-left text-[11.5px] font-bold text-muted hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${p?"min-h-11":"py-1.5"}`,"aria-expanded":h,onClick:()=>x(e=>!e),children:[(0,F.jsx)(i9.c_,{className:`h-3 w-3 shrink-0 transition-transform ${h?"rotate-90":""}`,"aria-hidden":!0}),(0,F.jsx)(i9.Td,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),u("rail.archive"),(0,F.jsx)("span",{className:"font-semibold",children:w.length})]}),h?w.map(e=>(0,F.jsx)(wg,{label:e.displayName,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:(0,tt.rK)(e.smt),active:s===e.project,hasLive:e.liveCount>0,muted:e.catalogOnly,onClick:()=>d(e.project)},e.project)):null]}):null,v.length||w.length?null:o>0?(0,F.jsx)(cn,{failures:o,size:"inline"}):l?(0,F.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-muted",children:u("common.nothingFound")}):(0,F.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-4 text-[12px] text-muted",children:[(0,F.jsx)(i9.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),u("common.loading")]})]}),(0,F.jsx)(wp,{}),(0,F.jsx)(wt,{})]})}function wg({label:e,live:t,attention:n,total:r,age:i,active:a,hasLive:s,muted:l=!1,onClick:o}){let c=rq();return(0,F.jsxs)("button",{className:["mb-0.5 flex w-full items-center gap-2 rounded-[10px] border px-2.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",c?"min-h-11":"py-2",a?"border-border bg-canvas shadow-1":"border-transparent hover:bg-canvas",l?"opacity-65":""].join(" "),"aria-current":a?"page":void 0,onClick:o,children:[(0,F.jsx)("span",{className:["h-2 w-2 shrink-0 rounded-full",s?"animate-pulse bg-success":"bg-strong"].join(" ")}),(0,F.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,F.jsx)("span",{className:`block truncate text-[13px] ${a?"font-bold":"font-semibold"} ${l?"text-muted":""}`,children:e}),i?(0,F.jsx)("span",{className:"block text-[10.5px] text-muted",children:i}):null]}),t>0?(0,F.jsx)("span",{className:"shrink-0 text-[11px] font-semibold tabular-nums text-muted",children:t}):null,n>0?(0,F.jsxs)(an,{tone:"warning",children:["⏸ ",n]}):null,null!==r?(0,F.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-muted",children:r}):null]})}var wb=n(1463);function wv(){let{enabled:e,store:t}=aP(),n=!rq()&&(void 0!==wb?wb.env?.NEXT_PUBLIC_LLV_SHOW_DEPLOY_PILL:void 0)==="1",[r,i]=(0,B.useState)([]);(0,B.useEffect)(()=>{if(e||!n)return;let t=!0,r=async()=>{try{let e=await fetch("/api/runtime/snapshot",{headers:{accept:"application/json"}});if(!e.ok)return;let n=await e.json();t&&i(n.deployments)}catch{}};r();let a=window.setInterval(()=>void r(),3e3);return()=>{t=!1,window.clearInterval(a)}},[e,n]);let a=[...e?Object.values(t.deployments):r].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0];if(!n||!a)return null;let s=a.phase.replaceAll("-"," "),l="succeeded"===a.phase?"border-success/45 text-success":"failed"===a.phase||"rolled-back"===a.phase?"border-danger/45 text-danger":"border-accent/45 text-accent";return(0,F.jsxs)("div",{className:`pointer-events-none fixed bottom-[max(0.75rem,env(safe-area-inset-bottom))] left-1/2 z-40 max-w-[calc(100vw-1.5rem)] -translate-x-1/2 truncate rounded-full border bg-raised px-3 py-1 text-[11px] font-semibold shadow-2 backdrop-blur ${l}`,role:"status",title:a.error??`Revision ${a.revision.slice(0,12)}`,children:["Viewer deploy \xb7 ",s," \xb7 ",a.revision.slice(0,7)]})}function ww(){let{t:e}=(0,er.Ym)(),[t,n]=(0,B.useState)(null);return((0,B.useEffect)(()=>{let e=!1;return fetch("/api/staging").then(async e=>e.ok?e.json():null).then(t=>{!e&&t&&n(t)}).catch(()=>{}),()=>{e=!0}},[]),t?.staging)?(0,F.jsx)("div",{className:"pointer-events-none fixed left-1/2 top-1.5 z-40 -translate-x-1/2",children:(0,F.jsxs)(an,{tone:"warning","data-staging-badge":!0,title:e("staging.badgeTitle"),className:"shadow-1 backdrop-blur",children:[(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-warning","aria-hidden":!0}),(0,F.jsx)("span",{children:e("staging.badge")}),t.revision?(0,F.jsxs)("span",{className:"font-normal text-muted",children:["\xb7 ",t.revision.slice(0,7)]}):null]})}):null}let wy="llvProject";function wk(){return W(location.hash)}function wj(e,t){if("open"===t.kind)return{path:t.path,hydrated:!1,conversationId:t.conversationId??null};if("resolve"===t.kind)return{path:t.path,hydrated:!0,conversationId:t.conversationId??null};if("release"===t.kind)return t.path&&e?.path!==t.path?e:null;if(!e)return e;let n=t.currentPath&&t.currentPath!==e.path?{...e,path:t.currentPath}:e;return!n.hydrated||t.pending||t.paths.has(n.path)?n:null}function wN(e){e!==el?history.replaceState(null,"","#p="+encodeURIComponent(e)):history.replaceState(null,"",location.pathname)}function wS(){var e;let t,n,{t:r}=(0,er.Ym)();!function(){try{window.sessionStorage.removeItem(iv),window.localStorage.removeItem(iv)}catch{}let e=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash;if(!e.includes(ib))return;let t=new URLSearchParams(e);if(!t.has(ib))return;t.delete(ib);let n=t.toString();window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}${n?`#${n}`:""}`)}(),(0,B.useEffect)(()=>{var e,t;let n,r,i=null;try{i=window.localStorage}catch{i=null}let a="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,s=function(e){let{identity:t,fetcher:n,scheduler:r,beacon:i,endpoint:a="/api/view/presence"}=e,s=0,l=0,o=!1,c=rY(rz,rH,{width:1,height:1,dpr:1}),d="visible",u=!1,p=!1,m=!1,f=-1/0,h=null,x=null,g=0,b=0,v=()=>{g=0===g?1e3:Math.min(2*g,3e4),b=r.now()+g,p=!0},w=()=>{g=0,b=0},y=e=>{if(!u)return;let t=r.now(),n=Math.max(500*!e,500-(t-f),b-t,0);null!==h&&r.clearTimer(h),h=r.setTimer(()=>{h=null,j()},n)},k=e=>{p=!0,y(e)},j=async()=>{if(!p||m)return;p=!1;let e=++s;o&&(l+=1,o=!1);let i=rX(c,t,e,l,d);m=!0,f=r.now();try{let e=await n(a,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i)});await rQ(e),e.ok||e.status>=400&&e.status<500?w():v()}catch{v()}finally{m=!1,p&&y(!1)}},N=()=>{null!==x&&r.clearTimer(x),x=r.setTimer(()=>{k(!0),N()},1e4)};return{setView(e){JSON.stringify(e)!==JSON.stringify(c)&&(c=e,k(!1))},setVisibility(e){e!==d&&(d=e,k(!0))},markInteraction(){o=!0,k(!1)},poke(){k(!0)},start(){u||(u=!0,N(),k(!0))},stop(){u=!1,null!==h&&r.clearTimer(h),null!==x&&r.clearTimer(x),h=null,x=null,p=!1,w()},sendBeacon(){if(!i)return;let e=rX(c,t,++s,l,"hidden");try{i(a,JSON.stringify(e))}catch{}}}}({identity:{viewSessionId:rV(),deviceId:rG(i),device:{kind:(e=navigator.userAgent,t=window.innerWidth||1,(n=e.toLowerCase()).includes("ipad")||n.includes("tablet")&&!n.includes("mobi")||a&&t>=768&&t<=1280?"tablet":n.includes("mobi")||n.includes("iphone")||n.includes("android")||a&&t<768?"mobile":"desktop"),browser:(r=navigator.userAgent.toLowerCase()).includes("firefox")||r.includes("fxios")?"firefox":r.includes("edg/")||r.includes("opr/")?"other":r.includes("crios")||r.includes("chrome")||r.includes("chromium")?"chrome":r.includes("safari")?"safari":"other"}},fetcher:(e,t)=>fetch(e,t),beacon:"u">typeof navigator&&"function"==typeof navigator.sendBeacon?(e,t)=>navigator.sendBeacon(e,new Blob([t],{type:"application/json"})):void 0,scheduler:{now:()=>Date.now(),setTimer:(e,t)=>setTimeout(e,t),clearTimer:e=>clearTimeout(e)}}),l=()=>s.setView(rY(rW.getContext(),rW.getSlice(),{width:window.innerWidth||1,height:window.innerHeight||1,dpr:window.devicePixelRatio||1})),o=rW.subscribe(l),c=()=>s.markInteraction();for(let e of rZ)window.addEventListener(e,c,{passive:!0});let d=()=>s.setVisibility("hidden"===document.visibilityState?"hidden":"visible");document.addEventListener("visibilitychange",d);let u=()=>s.poke();window.addEventListener("online",u);let p=()=>l();window.addEventListener("resize",p);let m=()=>s.sendBeacon();return window.addEventListener("pagehide",m),s.setVisibility("hidden"===document.visibilityState?"hidden":"visible"),l(),s.start(),()=>{for(let e of(o(),rZ))window.removeEventListener(e,c);document.removeEventListener("visibilitychange",d),window.removeEventListener("online",u),window.removeEventListener("resize",p),window.removeEventListener("pagehide",m),s.stop()}},[]);let[i,a]=(0,B.useState)(el),[s,l]=(0,B.useState)(null),[o,c]=(0,B.useReducer)(wj,null),{files:d,requestScope:u,projectCatalog:p,projectAliases:m,projectDisplayNames:f,projectCwds:h,flows:x,pipelines:g,pipelinesError:b,workflows:v,tasks:w,conversationAliases:y,launchRoutes:k,loaded:j,catalogFailures:N}=function(e){let[t,n]=(0,B.useState)(()=>n2.readScope(e)),r=nQ(void 0,e);return(0,B.useEffect)(()=>{let t=!0,r=n2.subscribe((e,r)=>{if("urgent"===r){t&&n(e);return}t&&(0,B.startTransition)(()=>{t&&n(e)})},e),i=async n=>{if(!t)return!0;try{return await n2.revalidate(e,n),!0}catch{return!1}},a=Promise.resolve(),s=e=>{let t=a.then(()=>i(e));return a=t.then(()=>void 0),t},l=null,o=0,c=async()=>{let e=await s();if(!t)return;if(e){o=0;return}let n=Math.min(3e4,1e3*2**Math.min(o,5));o+=1,l=setTimeout(()=>{l=null,c()},n)};c();let d=null,u=null,p=e=>{e!==u&&(u=e,d&&clearInterval(d),d="poll"===e?setInterval(s,1e4):null)},m=()=>{if(l){clearTimeout(l),l=null,o=0,c();return}s()};window.addEventListener(eP,m),window.addEventListener(t7,m),window.addEventListener(ng,m),window.addEventListener(nn,m),window.addEventListener(ne,m),window.addEventListener(nv,m);let f=()=>{},h=()=>{},x=null,g=null,b=!1,v=e=>{x&&clearTimeout(x),x=setTimeout(()=>{x=null,w()},e)},w=async()=>{if(b||null===g)return;b=!0;let e=g,n=await s(e);b=!1,t&&(n&&g===e&&(g=null),null!==g&&v(1e3*!n))};if(nW()&&1){let e=nV(),t=()=>p("live"===e.getState().connection?"live":"poll");t(),f=e.subscribe(t),h=e.subscribeFilesRevision(e=>{g=null===g?e:Math.max(g,e),v(400)})}else p("poll");return()=>{t=!1,d&&clearInterval(d),l&&clearTimeout(l),x&&clearTimeout(x),r(),f(),h(),window.removeEventListener(eP,m),window.removeEventListener(t7,m),window.removeEventListener(ng,m),window.removeEventListener(nn,m),window.removeEventListener(ne,m),window.removeEventListener(nv,m)}},[e]),t.requestScope===r?t:n2.readScope(e)}((e=o?.path??null,s?.filePath??s?.conversationId??e)),S=(0,B.useMemo)(()=>Q(d),[d]),C=(0,B.useRef)(null),A=(0,B.useMemo)(()=>{if(i===el)return[];let e=S.filter(e=>ef(e)===i),t=C.current,n=t?.project===i&&t.files.length===e.length&&e.every((e,n)=>e===t.files[n])?t.files:e;return C.current={project:i,files:n},n},[S,i]);(0,B.useEffect)(()=>{for(let e of(n6={loaded:!0,ids:new Set(d.flatMap(e=>e.conversationId?[e.conversationId]:[]))},n8))e(n6)},[d]);let I=(t=(0,B.useSyncExternalStore)(eF,()=>eD,()=>e_),(0,B.useMemo)(()=>x.some(e=>t.has(e.id)&&"closed"!==e.state)?x.map(e=>t.has(e.id)&&"closed"!==e.state?{...e,state:"closed",closedAt:e.closedAt??new Date().toISOString()}:e):x,[x,t]));n=(0,B.useRef)(null),(0,B.useEffect)(()=>{let e,t,n;return e=()=>{let e=tu();e&&"running"!==e.state&&e.resume().catch(()=>void 0)},window.addEventListener("pointerdown",e,{passive:!0}),window.addEventListener("keydown",e),t=()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",e)},n=()=>{tq.warm(Object.keys(tf).map(e=>tb(e))),tU=0,tQ()},window.addEventListener("pointerdown",n,{passive:!0}),window.addEventListener("keydown",n),()=>{t(),window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",n)}},[]),(0,B.useEffect)(()=>{var e;if(!S.length||!u)return;let t=(e=n.current,{...function(e,t,n,r={}){let i=new Map;for(let t of e){if(em(t)||K(t))continue;let e=U(t);if(i.size>=4096&&!i.has(e))continue;let n=tl(t),r=t.pendingQuestion||t.waitingInput?"question":t5[n];i.set(e,{state:n,kind:r,parent:t.parent})}let a=new Set(n),s=[];if(!t){for(let[e,t]of i)t.parent&&a.add(e);return{tracked:i,linked:a,chimes:s}}for(let[e,n]of i){let i=t.get(e),l=!0===r.suppressUnseen&&void 0===i,o=void 0!==n.kind&&(i?.state==="live"||void 0===i);void 0!==n.kind&&o&&!l&&s.push({kind:n.kind,id:e}),n.parent&&!a.has(e)&&(a.add(e),o||l||s.push({kind:"spawned",id:e}))}let l=new Map(t);for(let[e,t]of i)l.delete(e),l.set(e,t);if(l.size>4096){for(let e of l.keys()){if(l.size<=4096)break;i.has(e)||l.delete(e)}for(let e of a)l.has(e)||a.delete(e)}return{tracked:l,linked:a,chimes:s}}(S,e?.tracked??null,e?.linked??new Set,{suppressUnseen:null!==e&&e.scope!==u}),scope:u});if(n.current=t,!t.chimes.length)return;let r=new Map(S.map(e=>[U(e),e.mtime]));t.chimes.forEach((e,t)=>{let n=tw[e.kind];tX({cue:n,eventId:`lifecycle:${n}:${e.id}:${r.get(e.id)??0}`,pan:tc(e.id),delayMs:220*t})})},[S,u]);let{archivedProjects:M,archiveProject:T,unarchiveProject:$}=function(e,t={}){let[n,r]=(0,B.useState)(()=>new Set),i=(0,B.useRef)(n);return(0,B.useEffect)(()=>{let e=function(){try{let e=window.localStorage.getItem(t4),t=e?JSON.parse(e):[];return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}();i.current=e,r(e)},[]),(0,B.useEffect)(()=>{let e=i.current;if(!e.size)return;let n=new Set([...e].map(e=>t3(e,t)));n.size===e.size&&[...n].every(t=>e.has(t))||(i.current=n,r(n),t6(n))},[t]),(0,B.useEffect)(()=>{let t=i.current;if(!t.size)return;let n=new Set(t);for(let t of e)("live"===t.activity||"running"===t.proc)&&n.delete(ef(t));n.size!==t.size&&(i.current=n,r(n),t6(n))},[e]),{archivedProjects:n,archiveProject:(0,B.useCallback)(e=>{r(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),i.current=n,t6(n),n})},[]),unarchiveProject:(0,B.useCallback)(e=>{r(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),i.current=n,t6(n),n})},[])}}(S,m),E=(0,B.useMemo)(()=>new Set(p.map(e=>e.project)),[p]),R=(0,B.useMemo)(()=>new Map(p.map(e=>[e.project,e.conversations])),[p]),P=rq(),[O,D]=(0,B.useState)(!1),[L,Y]=(0,B.useState)(null),X=(0,B.useRef)(null),[Z,ee]=(0,B.useState)(0),[et,ei]=(0,B.useState)(null),[ea,eo]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=wk();(e.filePath||e.conversationId)&&l(e);let t=e.project??localStorage.getItem(wy);t&&a(t)},[]),(0,B.useEffect)(()=>{let e=t3(i,m);e!==i&&(a(e),localStorage.setItem(wy,e),wN(e))},[i,m]),(0,B.useEffect)(()=>{let e=()=>{let e=wk();e.filePath||e.conversationId?(c({kind:"release"}),ei(null),l(e)):(l(null),c({kind:"release"}),ei(null),e.project&&a(e.project))};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let ec=(0,B.useCallback)(e=>{a(e),l(null),c({kind:"release"}),ei(null),localStorage.setItem(wy,e),wN(e),D(!1)},[]);(0,B.useEffect)(()=>{i===el&&(rW.reportContext(rz),rW.reportSlice(rH))},[i]),(0,B.useEffect)(()=>{if(!O)return;let e=e=>{"Escape"===e.key&&D(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[O]),(0,B.useEffect)(()=>{if(P)return en(()=>D(!0))},[P]);let ed=(0,B.useCallback)(e=>{let t=ef(e);rM(t,e.path,ep(e)),ec(t),ee(e=>e+1)},[ec]),eu=(0,B.useCallback)((e,t=!1)=>{let n=ef(e);rM(n,e.path,ep(e)),c({kind:t?"resolve":"open",path:e.path,conversationId:e.conversationId}),a(n),localStorage.setItem(wy,n),D(!1),ee(e=>e+1),ei(t=>({path:e.path,nonce:(t?.nonce??0)+1,catalog:!0}));let r=J(e);history.replaceState(null,"",r)},[]),eh=(0,B.useCallback)(e=>{eu(e),l(W(J(e)))},[eu]);(0,B.useEffect)(()=>{if(!s||0===d.length)return;let e=function(e,t,n={},r={}){let i=t.conversationId??t.filePath;if(i&&i.startsWith("spawn:")){let t=r[i];if(t){let r=V(e,G(t,n));if(r)return r}let a=e.find(e=>e.path===i)??null;return a?.conversationId?V(e,G(a.conversationId,n))??a:a}if(t.conversationId)return V(e,G(t.conversationId,n));if(t.filePath){let n=e.find(e=>e.path===t.filePath)??null;return n&&K(n)&&n.conversationId?V(e,n.conversationId)??n:n}return null}(d,s,y,k);e&&(eu(e,!0),l(null))},[s,d,y,k,eu]);let ex=(0,B.useCallback)(e=>{c({kind:"release",path:e}),ei(t=>t?.path===e?null:t),o?.path===e&&wN(i)},[o,i]);(0,B.useEffect)(()=>{if(!o?.hydrated||s)return;let e=o.conversationId?S.find(e=>e.conversationId===o.conversationId)?.path:void 0;c({kind:"files",paths:new Set(d.map(e=>e.path)),pending:!1,currentPath:e})},[o,s,d,S]);let[eg,eb]=(0,B.useState)(()=>Date.now()/1e3),ev=(0,B.useMemo)(()=>(function(e,t=Date.now()/1e3){let n=[];for(let r of e){let e=eI(r,t);if(null===e)continue;let i=r.pendingQuestion||r.rateLimit||r.waitingInput?"blocked":"stalled",a=r.pendingQuestion?function(e){let t=Date.parse(e);return Number.isFinite(t)?t/1e3:null}(r.pendingQuestion.askedAt)??r.mtime:r.rateLimit?r.mtime:r.waitingInput?r.waitingInput.since:r.mtime;n.push({id:e,file:r,project:ef(r),tier:i,since:a})}return n.sort((e,t)=>eA[e.tier]-eA[t.tier]||e.since-t.since||e.id.localeCompare(t.id))})(S,eg),[S,eg]);(0,B.useEffect)(()=>{let e=S.filter(e=>"stalled"===e.activity).map(e=>e.mtime+7200).filter(e=>e>eg);if(!e.length)return;let t=Math.max(0,(Math.min(...e)-Date.now()/1e3)*1e3)+500,n=window.setTimeout(()=>eb(Date.now()/1e3),t);return()=>window.clearTimeout(n)},[S,eg]);let[ew,ey]=(0,B.useState)(!1),ek=(0,B.useRef)(null),ej=rL(i===el?null:i),eN=(0,B.useMemo)(()=>i===el?[]:oX(S,ej.prefs.favorites).filter(e=>e.project===i),[S,ej.prefs.favorites,i]);(0,B.useEffect)(()=>{document.title=ev.length?`(${ev.length}) Agent Log Viewer`:"Agent Log Viewer"},[ev.length]),(0,B.useEffect)(()=>{if(!ew)return;let e=e=>{ek.current?.contains(e.target)||ey(!1)},t=e=>{"Escape"===e.key&&ey(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[ew]);let[eS,eC]=(0,B.useState)(!1);(0,B.useEffect)(()=>{P&&eC(!1)},[P]),(0,B.useEffect)(()=>{ev.length||(ey(!1),eC(!1))},[ev.length]);let eM=(0,B.useCallback)(()=>l(null),[]),eT=(0,B.useCallback)(e=>{l(null),ei(t=>({path:e,nonce:(t?.nonce??0)+1,catalog:!1}))},[]),e$=(0,B.useCallback)(e=>{eo(t=>({path:e,nonce:(t?.nonce??0)+1}))},[]);(0,B.useEffect)(()=>r3.setShell({project:i===el?null:i,openProject:ec,openPath:eT,placePath:e$,openOverview:()=>ec(el)}),[i,ec,eT,e$]);let eE=(0,B.useRef)(null),eR=(0,B.useMemo)(()=>ev.map(e=>e.file.path).sort().join("\n"),[ev]),eO=(0,B.useMemo)(()=>eS?new Set(eR.split("\n").filter(Boolean)):null,[eS,eR]),eL=(0,B.useMemo)(()=>i===el?[]:ev.filter(e=>e.project===i),[ev,i]);(0,B.useEffect)(()=>{if(P)return;let e=e=>{var t;if(!((t=e.target)&&t.tagName&&(["INPUT","TEXTAREA","SELECT","BUTTON"].includes(t.tagName)||t.isContentEditable))&&!e.metaKey&&!e.ctrlKey&&!e.altKey){if("n"===e.key||"N"===e.key){let t=function(e,t,n){if(!e.length)return null;let r=null===t?-1:e.findIndex(e=>e.id===t);return -1===r?1===n?e[0]:e[e.length-1]:e[(r+n+e.length)%e.length]}(eL,eE.current,e.shiftKey?-1:1);if(!t)return;e.preventDefault(),eE.current=t.id,eT(t.file.path)}else if("f"===e.key||"F"===e.key){if(!ev.length)return;e.preventDefault(),eC(e=>!e)}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[P,eL,ev.length,eT]);let eq=(0,B.useCallback)(e=>{ey(!1),e.project!==i&&ec(e.project),eE.current=e.id,eT(e.file.path)},[i,ec,eT]),ez=(0,B.useCallback)(e=>{ey(!1),e.project!==i&&ec(e.project),eT(e.file.path)},[i,ec,eT]);(0,B.useEffect)(()=>{let e=S.map(e=>({file:e,id:e.pendingQuestion||e.rateLimit||e.waitingInput?eI(e):null})).filter(e=>null!==e.id);if(null===X.current){X.current=new Set(e.map(e=>e.id));return}let t=e.find(e=>!X.current.has(e.id));for(let t of e)X.current.add(t.id);t&&queueMicrotask(()=>Y(t.file.path))},[S]);let eH=L?S.find(e=>e.path===L):null,eB=ev.length?(0,F.jsxs)("div",{ref:ek,className:"pointer-events-auto relative",children:[(0,F.jsxs)("div",{className:"flex items-center overflow-hidden rounded-full border border-warning/45 bg-warning-soft shadow-1",children:[(0,F.jsx)("button",{type:"button",className:`text-[12px] font-bold text-warning hover:bg-warning/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${P?"inline-flex min-h-11 items-center px-3.5":"px-3 py-1"}`,"aria-expanded":ew,"aria-label":r("attention.badge",{count:ev.length}),title:r("attention.openQueue"),onClick:()=>ey(e=>!e),children:P?(0,F.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,F.jsx)(_.A,{className:"h-3 w-3","aria-hidden":!0})," ",ev.length]}):r("attention.badge",{count:ev.length})}),P?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"h-4 w-px shrink-0 bg-warning/45","aria-hidden":!0}),(0,F.jsx)("button",{type:"button",className:`px-2 py-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${eS?"bg-warning/30 text-warning":"text-warning/70 hover:bg-warning/15 hover:text-warning"}`,"aria-pressed":eS,title:eS?r("attention.filterOff"):r("attention.filterOn"),"aria-label":eS?r("attention.filterOff"):r("attention.filterOn"),onClick:()=>eC(e=>!e),children:(0,F.jsx)(q.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]}),ew?(0,F.jsxs)("div",{className:`${P?"fixed inset-x-3 top-12":"absolute right-0 top-[calc(100%+6px)] w-[340px] max-w-[calc(100vw-2rem)]"} z-50 max-h-[60vh] overflow-y-auto rounded-[10px] border border-border bg-card p-1.5 shadow-1`,children:[eN.length?(0,F.jsxs)("div",{className:"mb-1 border-b border-border pb-1",children:[(0,F.jsxs)("div",{className:"flex items-center gap-1 px-2.5 pb-0.5 pt-1.5 text-label font-semibold text-secondary",children:[(0,F.jsx)(z.A,{className:"h-3 w-3 fill-crown text-crown","aria-hidden":!0}),r("favorites.sectionTitle")]}),eN.map(e=>(0,F.jsxs)("div",{className:"flex items-center gap-1 rounded-[8px] hover:bg-canvas",children:[(0,F.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-[8px] px-2.5 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:r("favorites.focusTitle",{title:(0,tt.cr)(e.file.title,60)}),onClick:()=>ez(e),children:[(0,F.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tt.tz)(e.file.activity)}`,"aria-hidden":!0}),(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-primary",children:(0,tt.cr)(e.file.title,90)})]}),(0,F.jsx)("button",{type:"button",className:"mr-1 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-[6px] text-crown hover:bg-crown-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("branch.unfavorite"),title:r("branch.unfavorite"),onClick:()=>ej.setFavorite(e.id,!1),children:(0,F.jsx)(z.A,{className:"h-3.5 w-3.5 fill-crown","aria-hidden":!0})})]},e.id))]}):null,(0,F.jsx)("div",{className:"px-2.5 pb-1 pt-1.5 text-label font-semibold text-secondary",children:r("attention.popoverTitle")}),ev.map(e=>(0,F.jsxs)("button",{type:"button",className:"flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] px-2.5 py-2 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>eq(e),children:[(0,F.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[(0,F.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-primary",children:(0,tt.cr)(e.file.title,90)}),(0,F.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-canvas px-1.5 text-[10px] font-semibold text-muted",title:e.project,children:es(e.project,e.file.projectName)}),(0,F.jsx)("span",{className:"shrink-0 text-[10.5px] text-muted",children:(0,tt.rK)(e.since)})]}),(0,F.jsx)("span",{className:`w-full truncate text-[11px] ${"stalled"===e.tier?"text-warning":"text-muted"}`,children:function(e,t){let n=t.file.pendingQuestion;if(n){if("plan"===n.kind)return e("status.awaitingPlan");let t=n.questions?.[0];return t?.header||t?.question.split("\n")[0]||e("status.awaitingAnswer")}if(t.file.rateLimit)return e("status.rateLimited");let r=t.file.waitingInput;return r?r.menu?.question.split("\n")[0]||r.screenTail||e("status.awaitingTerminal"):e("status.stalled")}(r,e)})]},e.id))]}):null]}):null,eU=(0,F.jsxs)("div",{className:"flex h-full",children:[P?null:(0,F.jsx)(wx,{files:S,projectCatalog:p,projectDisplayNames:f,pipelines:g,workflows:v,archivedProjects:M,selected:i,now:eg,loaded:j,catalogFailures:N,onSelect:ec}),P&&O?(0,F.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,F.jsx)(wx,{files:S,projectCatalog:p,projectDisplayNames:f,pipelines:g,workflows:v,archivedProjects:M,selected:i,now:eg,loaded:j,catalogFailures:N,onSelect:ec}),(0,F.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-primary/35","aria-label":r("viewer.closeProjects"),onClick:()=>D(!1)})]}):null,(0,F.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[P?null:(0,F.jsxs)("div",{className:"pointer-events-none fixed right-4 top-4 z-50 flex flex-col items-end gap-2",children:[eB,eH?(0,F.jsxs)("div",{className:"pointer-events-auto flex max-w-[360px] gap-2 rounded-[8px] border border-warning/45 bg-warning-soft px-4 py-3 text-[13px] font-semibold text-primary shadow-1",children:[(0,F.jsxs)("button",{className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{ed(eH),Y(null)},children:[(0,F.jsx)("span",{className:"block text-[11px] font-bold text-warning",children:r("viewer.agentWaiting")}),(0,F.jsx)("span",{className:"line-clamp-2",children:eH.title})]}),(0,F.jsx)("button",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("viewer.closeNotification"),onClick:()=>Y(null),children:(0,F.jsx)(H.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null]}),P&&eH?(0,F.jsxs)("div",{className:"flex shrink-0 items-stretch gap-2 border-b border-warning/45 bg-warning-soft pl-3 pr-1.5 py-1.5",children:[(0,F.jsxs)("button",{className:"flex min-h-11 min-w-0 flex-1 flex-col justify-center text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{ed(eH),Y(null)},children:[(0,F.jsx)("span",{className:"block text-[11px] font-bold text-warning",children:r("viewer.agentWaiting")}),(0,F.jsx)("span",{className:"truncate text-[13px] font-semibold text-primary",children:eH.title})]}),(0,F.jsx)("button",{className:"flex h-11 w-11 shrink-0 items-center justify-center self-center rounded-full border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("viewer.closeNotification"),onClick:()=>Y(null),children:(0,F.jsx)(H.A,{className:"h-5 w-5","aria-hidden":!0})})]}):null,i===el?(0,F.jsx)(cd,{files:S,projectCatalog:p,projectDisplayNames:f,pipelines:g,workflows:v,archivedProjects:M,now:eg,catalogFailures:N,onSelectProject:ec,onSelectFile:ed,onMenu:P?()=>D(!0):void 0,attention:P?eB:void 0}):(0,F.jsx)(vV,{files:A,flows:I,pipelines:g,pipelinesError:b,workflows:v,tasks:w,conversationAliases:y,projectCatalog:p,projectName:f[i],projectCwd:h[i],project:i,loaded:j,catalogFailures:N,openNonce:Z,focusRequest:et?.catalog&&o?.path!==et.path?null:et,placeRequest:ea,attentionPaths:eO,archived:M.has(i),catalogKnown:E.has(i),catalogConversationCount:R.get(i)??0,onArchive:T,onUnarchive:$,onMenu:P?()=>D(!0):void 0,attention:P?eB:void 0,onUserNavigate:eM,onOpenCatalogFile:eh,onCloseFile:ex})]}),P?null:(0,F.jsx)(oG,{}),(0,F.jsx)(wv,{}),(0,F.jsx)(ig,{mobile:P}),(0,F.jsx)(oB,{mobile:P}),(0,F.jsx)(i7,{}),(0,F.jsx)(oH,{}),(0,F.jsx)(ww,{})]});return(0,F.jsx)(o5,{children:eU})}},3550:(e,t,n)=>{"use strict";n.d(t,{$f:()=>i,F9:()=>d,It:()=>o,WQ:()=>c});let r={ScheduleWakeup:"wakeup",CronCreate:"cron",CronDelete:"cron",Monitor:"monitor"};function i(e){return r[e]??null}let a=/scheduled for\s+(\d{1,2}:\d{2}:\d{2})(?:\s*\(in\s+(\d+)\s*s\))?/i,s=/\bin\s+(\d+)\s*s\b/i;function l(e){return"string"==typeof e?e.trim():""}function o(e,t,n){var r;let i=e&&"object"==typeof e&&!Array.isArray(e)?e:{},o=l(i.reason),c=l(i.prompt),d="number"==typeof(r=i.delaySeconds)&&Number.isFinite(r)?r:null,u="string"==typeof n?n.match(a):null,p="string"==typeof n?n.match(s):null,m=u?.[2]??p?.[1],f=m?Number(m):null,h=u?.[1]??null,x=null;return null!==t&&null!==f?x=t+1e3*f:h?x=function(e,t){let n=e.split(":").map(Number);if(3!==n.length||n.some(e=>!Number.isFinite(e)))return null;let[r,i,a]=n,s=null!==t?new Date(t):new Date;s.setUTCHours(r,i,a,0);let l=s.getTime();return null!==t&&l<t-6e4&&(l+=864e5),l}(h,t):null!==t&&null!==d&&(x=t+1e3*d),{fireAt:x,delaySeconds:f??d,reason:o,prompt:c}}function c(e,t,n){let r=o({reason:e.reason,prompt:e.prompt},t,n);return null!==r.fireAt?r:e}function d(e,t){return null===e?"unknown":e>t?"pending":"fired"}},4654:(e,t,n)=>{"use strict";n.d(t,{JK:()=>c,Tl:()=>p,Ym:()=>m});var r=n(2115);let i={en:n(9375).en,uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.edit":"змінити","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","common.copy":"Копіювати","common.copied":"скопійовано","common.clickToCopy":"клік — скопіювати","common.yes":"Так","common.no":"Ні","common.send":"Надіслати","common.sending":"надсилаю…","common.sent":"надіслано","common.close":"Закрити","common.failedSend":"не вдалося надіслати","common.failedDelete":"не вдалося видалити","common.nothingFound":"Нічого не знайдено","common.nothingRunning":"зараз нічого не працює","common.kb":"кБ","common.chars":"{n} симв.","lang.aria":"Мова інтерфейсу","util.effortTitle":"Зусилля міркування: {effort}","runtimeConfig.model":"Модель активного агента","runtimeConfig.effort":"Зусилля міркування активного агента","runtimeConfig.speedTitle":"Fast використовує пріоритетний рівень Codex","runtimeConfig.apply":"Застосувати","runtimeConfig.failed":"Не вдалося змінити конфігурацію активного агента","runtimeConfig.pending":"зміна очікує","runtimeConfig.applied":"Налаштування розмови застосовано","time.agoSec":"{n} с тому","time.agoMin":"{n} хв тому","time.agoHour":"{n} год тому","time.agoDay":"{n} д тому","turn.worked":"Працював {d}","turn.running":"працює {d}","turn.lastRun":"останній прогін: {d}","turn.timer":"час роботи","kind.session":"сесія","kind.subagent":"субагент","kind.job":"джоба","kind.background":"фон","kind.handoff":"хендофф","rail.title":"Логи агентів","rail.filter":"Фільтр проєктів…","rail.projects":"Проєкти","rail.overview":"Огляд","rail.archive":"Архів","dash.branchesLive":{one:"{count} гілка працює",few:"{count} гілки працюють",many:"{count} гілок працюють",other:"{count} гілок працюють"},"dash.trees":{one:"{count} дерево",few:"{count} дерева",many:"{count} дерев",other:"{count} дерев"},"dash.recentConvos":{one:"{count} нещодавня розмова",few:"{count} нещодавні розмови",many:"{count} нещодавніх розмов",other:"{count} нещодавніх розмов"},"dash.quietTrees":{one:"{count} тихе дерево",few:"{count} тихі дерева",many:"{count} тихих дерев",other:"{count} тихих дерев"},"dash.openProjects":"Відкрити список проєктів","dash.createMenu":"Створити","dash.moreMenu":"Більше дій","dash.soundMenu":"Звукові сповіщення","dash.unarchive":"Повернути з архіву","dash.newConvo":"Нова розмова з агентом","dash.agent":"Агент","dash.newWorkflow":"Новий воркфлоу: етапи → ревью → PR","dash.workflow":"Воркфлоу","dash.task":"Задача","dash.newTask":"Нова задача","dash.pipelinesUnavailable":"Пайплайни тимчасово недоступні: файл стану пайплайнів не вдалося прочитати. Решта панелей працює.","dash.loadingBoard":"Завантаження дошки…","dash.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","dash.viewScheme":"схема","dash.viewList":"розмови","dash.viewSchemeMenu":"Вигляд: схема","dash.viewListMenu":"Вигляд: розмови","dash.viewMenuGroup":"Вигляд дошки","dash.hiddenShelf":"Приховане","trash.title":"Кореневі розмови","trash.hint":"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди.","trash.deletedFromDisk":"\xb7 видалено з диска","trash.open":"Відкрити {title}","trash.activeSubtree":"має активні гілки","trash.toArchive":"В архів","trash.notDeleted":"не видалено {failed} з {total}","trash.confirmDelete":{one:"Видалити з диска {count} файл проєкту?",few:"Видалити з диска {count} файли проєкту?",many:"Видалити з диска {count} файлів проєкту?",other:"Видалити з диска {count} файлів проєкту?"},"trash.deleting":"видаляю…","trash.confirmYes":"Так, видалити","trash.deleteProject":"Видалити проєкт з диска","trash.projectLoadFailed":"Не вдалося завантажити всі розмови проєкту","list.title":"Усі розмови","list.hint":"Завантажуються сторінками від найновіших з усіх розмов цього проєкту на диску.","list.searchHint":"Пошук у всіх розмовах на диску в усіх проєктах.","list.loadMore":"Завантажити більше розмов","list.failed":"Не вдалося завантажити розмови","list.retry":"Повторити","switch.aria":"Пульт агентів","switch.title":"Пульт","switch.search":"Пошук за назвою, першим промптом або проєктом","switch.results":"Усі знайдені розмови","switch.updating":"оновлення…","switch.close":"Закрити пульт","switch.waiting":"Чекає тебе","switch.working":"Працюють","switch.recent":"Нещодавні","switch.older":"Старіше","switch.hidden":"Приховані ({count})","switch.hide":"сховати","switch.restore":"повернути","accounts.activeAria":"Активний акаунт Codex","accounts.placeholder":"Акаунт Codex","accounts.add":"Додати","accounts.prompt":"Назва акаунта","accounts.login":"вхід","accounts.switchFailed":"Не вдалося змінити акаунт","accounts.conversationTitle":"Запустити цю розмову через","accounts.conversationPending":"Зміна акаунта очікує","accounts.conversationApplied":"Акаунт розмови змінено","accounts.manage":"Керувати акаунтами…","accounts.addFailed":"Не вдалося додати акаунт","accounts.loginOpened":"Вхід через пристрій відкрито в {target}","accounts.openLogin":"Відкрити вхід","accounts.refreshFailed":"Не вдалося оновити акаунти. Спробуй ще раз.","accounts.loading":"Завантаження акаунтів…","accounts.noAccounts":"Акаунтів поки немає.","limits.accountLoading":"Завантаження лімітів акаунта…","accounts.retry":"Повторити","accounts.title":"Акаунти Codex","accounts.trigger":"Акаунти","accounts.active":"активний","accounts.needsLogin":"потрібен вхід","accounts.pendingLogin":"вхід…","accounts.auth.authenticated":"Авторизовано","accounts.auth.signedOut":"Вихід виконано","accounts.auth.unknown":"Вхід не перевірено","accounts.auth.error":"Помилка входу","accounts.operation.refresh":"Оновлюємо акаунти…","accounts.operation.add":"Починаємо вхід в акаунт…","accounts.operation.switch":"Змінюємо акаунт для майбутніх запусків…","accounts.operation.login":"Оновлюємо стан входу…","accounts.operation.remove":"Видаляємо акаунт…","accounts.operation.terminal":"Готуємо команду акаунта…","accounts.terminalCopied":"Команду скопійовано для {label}","accounts.terminalFailed":"Не вдалося підготувати команду для {label}","accounts.copyCli":"Копіювати CLI","accounts.copyCliAria":"Скопіювати команду агента для {label}","accounts.labelPlaceholder":"Назва нового акаунта","accounts.confirmAdd":"Додати","accounts.close":"Закрити","accounts.remove":"Видалити","accounts.removeAria":"Видалити {label}","accounts.removeConfirm":"Видалити цей акаунт? Минулі розмови залишаться доступними.","accounts.removeConfirmCta":"Підтвердити","accounts.removeConfirmCancel":"Скасувати","accounts.removeBlocked":"Для {label} ще є активна сесія або вхід.","accounts.removeHistoryBlocked":"{label} має активні розмови. Дочекайтеся їх завершення, а потім видаліть акаунт.","accounts.removeFailed":"Не вдалося видалити цей акаунт.","accounts.cleanupPending":"{label} видалено. Локальні дані ще потрібно очистити.","accounts.cleanupManual":"Частина локальних даних акаунта не пройшла перевірку безпеки. Перевірте й видаліть її вручну.","accounts.cleanupFailed":"Не вдалося очистити покинуті теки.","accounts.forceRemove":"Видалити примусово","accounts.cleanupOrphans":"Очистити покинуті теки","accounts.titleFor":"Акаунти {engine}","accounts.triggerAria":"Акаунти {engine} — змінити або додати","accounts.effective":"{pct}%","accounts.effectiveTip":"{window} обмежує","accounts.effectiveStale":"{window} обмежує \xb7 застаріло","accounts.limitsAria":"Вікна лімітів для {label}","accounts.limitsStale":"Останні відомі значення","accounts.limitsStaleTip":"Останні відомі значення — не наживо","accounts.claudeLoginStarted":"Вхід для {label} розпочато","accounts.claudeLogin.starting":"Починаємо вхід…","accounts.claudeLogin.awaitingBrowser":"Очікуємо посилання для входу…","accounts.claudeLogin.openLink":"Відкрити вхід claude.ai","accounts.claudeLogin.codeLabel":"Код авторизації","accounts.claudeLogin.codePlaceholder":"Встав код із браузера","accounts.claudeLogin.codeHint":"Після входу скопіюй код зі сторінки claude.ai і встав його сюди.","accounts.claudeLogin.submit":"Надіслати код","accounts.claudeLogin.verifying":"Перевіряємо…","accounts.claudeLogin.canceling":"Скасовуємо…","accounts.claudeLogin.cancel":"Скасувати","accounts.claudeLogin.signIn":"Увійти","accounts.claudeLogin.groupAria":"Вхід для {label}","accounts.claudeLogin.err.timed_out":"Час на вхід вичерпано.","accounts.claudeLogin.err.interrupted":"Вхід перервано перезапуском.","accounts.claudeLogin.err.verification_failed":"Не вдалося перевірити код.","accounts.claudeLogin.err.input_failed":"Не вдалося надіслати код.","accounts.claudeLogin.err.login_busy":"Інший вхід уже триває.","accounts.claudeLogin.err.generic":"Не вдалося почати вхід. Спробуй ще раз.","accounts.claudeLogin.announceCodeReady":"Посилання для входу {label} готове. Відкрий його і встав код.","accounts.claudeLogin.announceDone":"{label}: вхід виконано.","migrate.confirmTitle":"Перемкнути {engine} на \xab{label}\xbb?","migrate.confirmBody":"Нові агенти одразу використовують \xab{label}\xbb. {idle} активних сесій перемкнуться зараз; {busy} — після поточного ходу; {deferred} неактивних розмов — під час наступного повідомлення.","migrate.confirmCta":"Перемкнути акаунт","migrate.confirmAllCta":"Мігрувати всі ({total})","migrate.confirmCancel":"Скасувати","migrate.retargetTitle":"Перенаправити міграцію на \xab{label}\xbb?","migrate.retargetBody":"Міграція на \xab{current}\xbb ще триває. Нові агенти одразу використовуватимуть \xab{label}\xbb; активні сесії буде перенаправлено, неактивні розмови перейдуть під час наступного повідомлення. \xabМігрувати всі\xbb одразу охопить відкладену історію та вже перенесені розмови.","migrate.banner":"Міграція на \xab{label}\xbb — {done}/{total} готово","migrate.bannerWaiting":"{n} чекають завершення ходу","migrate.bannerFailed":"{n} з помилкою","migrate.bannerAria":"Хід міграції {engine}","migrate.stop":"Зупинити міграцію","migrate.bannerRetryFailed":"Повторити невдалі ({n})","migrate.stoppedNotice":"Міграцію зупинено. Решта сесій лишається на своєму акаунті; нові агенти й далі використовують \xab{label}\xbb.","migrate.failedNotice":"{n} сесій не вдалося перенести на \xab{label}\xbb.","migrate.completeNotice":"Усі сесії {engine} тепер на \xab{label}\xbb","migrate.announceComplete":"Усі сесії {engine} тепер на {label}","migrate.cardPending":"Очікує зміни акаунта — після поточного ходу","migrate.cardSwitching":"Перемикання на \xab{label}\xbb…","migrate.cardFailed":"Не вдалося змінити акаунт","migrate.cardRetry":"Повторити","migrate.cardKeep":"Лишити на \xab{label}\xbb","migrate.ribbonAria":"Стан міграції акаунта","migrate.divider":"Продовжено з \xab{label}\xbb — попередній запис в архіві","migrate.openPrevious":"Відкрити попередній запис","migrate.heldSend":"Повідомлення утримано — надійде після перемикання","migrate.readOnlyPredecessor":"В архіві — розмову продовжено під \xab{label}\xbb","migrate.retryFailed":"Не вдалося повторити перемикання","migrate.keepFailed":"Не вдалося лишити цю сесію на поточному акаунті","migrate.recoveryFailed":"{detail}","autobalance.title":"Автобаланс","autobalance.desc":"Перемикає сесії цього рушія, коли активний акаунт падає нижче {threshold}%, а інший має більше.","autobalance.toggleAria":"Автобаланс для {engine}","autobalance.idle":"Остання перевірка {time} \xb7 перемикання не потрібне","autobalance.waitingFresh":"Пауза — очікуємо свіжі дані квоти","autobalance.cooldown":"Пауза після перемикання — наступна перевірка за {n} хв","autobalance.draining":"Балансування…","autobalance.switched":"Перемкнуто на \xab{to}\xbb о {time} — \xab{from}\xbb впав до {pct}% ({window})","autobalance.bannerTag":"Авто","autobalance.override":"Автобаланс пропонував \xab{to}\xbb; ваш вибір має пріоритет.","limits.windowSession":"вікно 5 год","limits.windowWeekly":"тижневе вікно","switchCard.openColumn":"Відкрити колонкою {title}","switchCard.remove":"Прибрати з пульта","composer.imagesCount":{one:"{count} картинка",few:"{count} картинки",many:"{count} картинок",other:"{count} картинок"},"composer.spawned":"запущено агента в tmux {target}","composer.sentPaths":"надіслано {count} шлях(и)","composer.failedInterrupt":"не вдалося перервати","composer.escapeSent":"надіслано Escape — агент перервано","composer.spawnAria":"Запустити агента з промптом","composer.resolvingAria":"Повідомлення наявному агенту — доставка почнеться після відновлення його хоста","composer.sendAria":"Надіслати повідомлення агенту в tmux {target}","composer.sendStructuredAria":"Надіслати повідомлення через структурований runtime-хост","composer.queueAria":"Черга надісланих повідомлень","composer.removeFromQueue":"Прибрати з черги","composer.deliveryHeld":"Притримано для \xab{label}\xbb — доставиться після зміни акаунта","composer.admissionTimedOut":"Час очікування підтвердження вичерпано. Перевіряємо надійну квитанцію; повідомлення збережено.","composer.deliveryUnconfirmed":"Не вдалося підтвердити доставку. Повідомлення збережено — надішліть ще раз, щоб безпечно повторити; той самий ключ повідомлення буде використано.","composer.runtimePill":"Модель і міркування — застосується до наступного повідомлення","composer.reasoningGroup":"Міркування","composer.modelGroup":"Модель","composer.speedGroup":"Швидкість","composer.speedStandard":"Стандартна","composer.speedFastTier":"Швидка — пріоритетний тариф","composer.backTo":"Назад","composer.nextMessageUses":"Наступне повідомлення: {model} \xb7 {effort}","composer.settingsNextResume":"застосується під час наступного відновлення розмови","composer.structuredImagesUnavailable":"Структуровані розмови поки не підтримують картинки","composer.codexImagesTextOnly":"Обрана модель Codex приймає лише текст.","composer.structuredImagesProtocol":"Цей структурований хост не узгодив підтримку зображень.","composer.imagesBlockedDuringRecovery":"Зображення з чернетки буде надіслано після відновлення хоста; текст можна надіслати вже зараз.","composer.imageCapabilityLoading":"Завантажуємо дані про підтримку зображень.","composer.imageCapabilityError":"Не вдалося завантажити дані про підтримку зображень.","composer.imageCapabilityRetry":"Повторити перевірку зображень","composer.attachTerminal":"Відкрити термінал для перегляду","composer.attachTerminalReady":"термінал для перегляду готовий у tmux {target}","composer.attachTerminalFailed":"не вдалося створити термінал для перегляду","composer.receiptHeld":"притримано","composer.receiptQueued":"у черзі","composer.receiptRecovering":"відновлення","composer.receiptFailed":"не доставлено","composer.deliveredEcho":"Доставлено — зʼявиться у стрічці","composer.retrySend":"Надіслати ще раз","composer.placeholderRelay":"написати — передам через кореневу сесію…","composer.placeholderSpawn":"промпт — агент запуститься…","composer.placeholderResolving":"написати агенту — відновлюємо з'єднання з сесією…","composer.placeholderSend":"написати агенту…","composer.textAria":"Текст для агента","composer.optionsShow":"Показати параметри повідомлення","composer.optionsHide":"Сховати параметри повідомлення","composer.titleRelay":"передасться через кореневу сесію гілки","composer.titleSpawnResumed":"запустить новий сеанс агента, який продовжить цю розмову","composer.root":"корінь","composer.interruptAria":"Перервати агента (Escape)","composer.interruptTitle":"надіслати Escape у пейн агента","composer.compactAria":"Стиснути контекст агента (/compact)","composer.compactTitle":"надіслати /compact — агент стисне контекст; після завершення у стрічці з'явиться позначка","composer.compactConfirm":"Точно?","composer.compactConfirmTitle":"Натисни ще раз, щоб надіслати /compact","composer.compactSent":"стискання почалось — позначка з'явиться у стрічці, щойно завершиться","composer.failedCompact":"не вдалося запустити стискання","composer.addImages":"Додати картинки","composer.moreTools":"Додаткові дії","composer.stopAndSend":"Зупинити запис і надіслати","composer.launchAgent":"Запустити агента","composer.sendToAgent":"Надіслати агенту","composer.stopAndSendTitle":"зупинити запис і надіслати","composer.sendMenuTitle":"Дії відправки","composer.quickAck":"Так, продовжуй","composer.quickAckLabel":"Продовжити","composer.quickAckAria":"Надіслати агенту швидке \xabТак, продовжуй\xbb","composer.quickAckTitle":"Швидка відповідь — так, продовжуй","spawnCard.starting":"Запуск прийнято. Агент запускається.","spawnCard.binding":"Ідентифікатор агента створено. Під’єднуємо структурований хост.","spawnCard.queued":"Структурований хост готовий. Перше повідомлення в черзі.","spawnCard.reconciling":"Доставка узгоджується зі структурованим хостом.","spawnCard.recoverable-timeout":"Тайм-аут першого повідомлення можна відновити, поки збережена доставка завершується.","spawnCard.live-late-success":"Пізня доставка успішна, активну розмову приєднано.","spawnCard.failed":"Запуск завершився з помилкою.","spawnCard.recovered":"Запуск відновлено за збереженими даними.","spawnCard.initial.pending":"Перше повідомлення: очікує на під’єднання хоста","spawnCard.initial.queued":"Перше повідомлення: у черзі","spawnCard.initial.delivered":"Перше повідомлення: доставлено","spawnCard.initial.failed":"Перше повідомлення: помилка доставки","spawnCard.retrySafe":"Цей запуск завершено. Можна створити нову спробу.","spawnCard.launch":"Запуск {id}","spawnChip.starting":"Запускається","spawnChip.binding":"Під’єднання хоста","spawnChip.queued":"Хост готовий","spawnChip.reconciling":"Узгодження","spawnChip.recoverable-timeout":"Завершується","spawnChip.live-late-success":"Пізня доставка успішна","spawnChip.failed":"Запуск не вдався","spawnChip.recovered":"Запущено","spawnChip.initial.pending":"Перше повідомлення: очікує","spawnChip.initial.queued":"Перше повідомлення: у черзі","spawnChip.initial.delivered":"Перше повідомлення: доставлено","spawnChip.initial.failed":"Перше повідомлення: помилка","outbox.queueAria":"Повідомлення, що очікують доставки","outbox.queued":"У черзі","outbox.delivering":"Доставляється","outbox.delivered":"Доставлено","outbox.failed":"Не доставлено","outbox.cancel":"Скасувати це повідомлення","outbox.retry":"Повторити надсилання цього повідомлення","outbox.reattach":"Не надіслано — додайте зображення знову та надішліть","strip.live":"наживо","strip.resume":"відновити","strip.deadMode":"мертвий хост","strip.moreActions":"Більше дій","strip.stopSubagent":"перериває кореневого агента","strip.compactSubagent":"недоступно для субагентів","strip.structuredUnsupported":"структурований хост поки не підтримує цю дію","strip.resolving":"визначаємо середовище агента…","deadHost.title":"Агент неактивний \xb7 {since} — повідомлення підуть у чергу","deadHost.body":"Текст, надісланий зараз, надійно зберігається і буде доставлений після відновлення хоста. Зображення не можна додати, доки хост не повернеться. Очікувані підтвердження застаріли — відновіть роботу елементами керування нижче.","deadHost.respawn":"Відновити розмову","deadHost.attach":"Відкрити в терміналі","deadHost.recheck":"Перевірити знову","deadHost.recheckFailed":"Не вдалося зʼєднатися зі середовищем — спробуйте ще раз.","strip.recheckHint":"Перевірити хост середовища ще раз","deadHost.respawnFailed":"Не вдалося перезапустити — спробуйте ще раз.","deadHost.sendBlocked":"хост мертвий — відновіть, щоб продовжити","deadHost.expiredCard":"застаріло — хост помер, перш ніж на це відповіли","superseded.title":"Раунд замінено \xb7 {since}","superseded.body":"Відновлення замінило цей раунд живим наступником. Ця розмова лишається як історія раундів.","superseded.open":"Відкрити живий раунд","superseded.resumeHere":"Продовжити тут","superseded.resumeConfirm":"Продовжити цей закритий раунд? Це розгалужить роботу: картка знову стане живою поруч із наступником.","superseded.resumeFailed":"Не вдалося зняти звʼязок заміни — спробуйте ще раз.","superseded.sendBlocked":"раунд замінено — відкрийте живий наступник","lineage.continues":"раунд {round} \xb7 продовжує попередній","lineage.continuesTitle":"Раунд {round}: продовжує замінений попередній раунд — натисніть, щоб відкрити його","attach.dialogTitle":"Підключитися у своєму терміналі","attach.dialogIntro":"Запускає цю розмову у вашому власному терміналі з тим самим акаунтом ({account}) і робочою директорією.","attach.copyCwd":"Скопіювати робочу директорію","attach.copyCommand":"Скопіювати команду","attach.copyFull":"Скопіювати повну команду","attach.copiedFull":"Повну команду скопійовано в буфер","attach.takeoverWarning":"Відновлення тут перебирає розмову у переглядача.","attach.subagentNote":"Субагенти відновлюються через свою кореневу сесію.","attach.secondaryViewer":"Відкрити панель перегляду лише для читання в tmux","attach.secondaryFailed":"Не вдалося відкрити панель перегляду — спробуйте ще раз.","receipt.human.deadHost":"хост агента помер","receipt.human.staleKey":"ключ доставки застарів","receipt.human.duplicate":"вже доставлено","receipt.human.turnActive":"агент посеред ходу","receipt.human.noTurn":"немає активного ходу","receipt.human.verbatim":"не доставлено: {reason}","draft.readPrompt":"Прочитай розмову агента у файлі {src} і продовж роботу звідти: ","draft.needDir":"вкажи робочу директорію","draft.launchFailed":"не вдалося запустити","draft.paneAria":"Чернетка нової розмови з агентом","draft.notStarted":"агент ще не запущений","draft.engineAria":"Двигун агента","draft.accountAria":"Обліковий запис {engine} для цього запуску","draft.accountDefault":"{label} \xb7 активний","draft.accountNeedsLogin":"{label} \xb7 потрібен вхід","draft.handoffLabel":"хендофф: {title}","draft.newConvo":"нова розмова","draft.conversation":"розмова","draft.dismiss":"Прибрати чернетку розмови","draft.directory":"директорія","draft.dirAria":"Робоча директорія агента","draft.confirmRecoveredDir":"Підтвердьте робочу директорію. Відредагуйте це поле перед запуском агента.","draft.reasoning":"міркування","draft.role":"роль","draft.roleAria":"Рольовий пресет агента","draft.noRole":"Без ролі","draft.roleParameters":"Параметри ролі","draft.safetyFences":"Запобіжники безпеки","draft.roleNeedsParams":"заповніть обов'язкові параметри ролі","draft.reviews":"розмова для ревʼю","draft.reviewsAria":"Розмова для ревʼю","draft.reviewsPlaceholder":"Оберіть розмову","draft.reviewerNeedsConversation":"оберіть розмову, яку перевірятиме ревʼюер","draft.deployConfirm":"Введіть deploy, щоб підтвердити цей план деплою","draft.modelAria":"Модель агента","draft.modelDefault":"модель: типова","draft.reasoningAria":"Глибина міркувань агента","draft.effortDefault":"міркування: типові","draft.speedAria":"Режим швидкості Codex","draft.speedTitle":"fast = priority tier (1.5x швидкість, більша витрата лімітів)","draft.speedDefault":"швидкість: дефолт","draft.imagesOnly":"(картинки)","draft.launched":"агент запущений у tmux {target} — чекаю, поки розмова з'явиться тут…","draft.launchedStructured":"агент запущений — чекаю, поки розмова з'явиться тут…","draft.slow":"Щось довго. Перевір вікно tmux {target} — щойно транскрипт з'явиться, панель підхопить його сама.","draft.slowStructured":"Щось довго. Щойно транскрипт з'явиться, панель підхопить його сама.","draft.confirming":"Запущено — підтверджую агента в tmux {target}. Не надсилай ще раз; панель підхопить розмову, щойно з'явиться її транскрипт.","draft.confirmingStructured":"Запущено — підтверджую агента. Не надсилай ще раз; панель підхопить розмову, щойно з'явиться її транскрипт.","draft.confirmingNoTarget":"Підтверджую, чи запустився агент. Не надсилай ще раз — панель підхопить розмову, щойно з'явиться її транскрипт.","draft.attention":"Агент, можливо, вже працює в tmux {target}. Не запускай його ще раз. Прибери цю чернетку, коли перевіриш; вона все одно підхопиться автоматично, щойно з'явиться транскрипт.","draft.attentionStructured":"Агент, можливо, вже працює. Не запускай його ще раз. Прибери цю чернетку, коли перевіриш; вона все одно підхопиться автоматично, щойно з'явиться транскрипт.","draft.attentionNoTarget":"Агент, можливо, вже працює — перевір свої вікна tmux. Не запускай його ще раз. Прибери цю чернетку, коли перевіриш; вона все одно підхопиться автоматично, щойно з'явиться транскрипт.","draft.hintRelay":"Новий агент спершу прочитає транскрипт батьківської розмови і продовжить з того місця. Допиши в промпт, що зробити далі, — гілка з'явиться на схемі поруч.","draft.hintNew":"Обери двигун і директорію, напиши перший промпт — агент запуститься в tmux, і розмова продовжиться в цій самій панелі.","draft.hintNewStructured":"Обери двигун і директорію, напиши перший промпт — агент запуститься, і розмова продовжиться в цій самій панелі.","draft.promptAria":"Перший промпт для нового агента","draft.placeholder":"перший промпт — агент запуститься в tmux…","draft.placeholderStructured":"перший промпт — агент запуститься…","draft.promptTextAria":"Текст першого промпта","draft.newWindowTitle":"нове tmux-вікно зі свіжим агентом","draft.newWindowTitleStructured":"нова структурована сесія зі свіжим агентом","draft.newAgent":"новий агент","draft.addImages":"Додати картинки до промпта","draft.stopAndLaunch":"Зупинити запис і запустити агента","draft.rolePromptToggle":"Промпт ролі (EN)","draft.speedFast":"швидкий","draft.speedStandard":"стандартний","effortTier.minimal":"мінімальні","effortTier.low":"низькі","effortTier.medium":"середні","effortTier.high":"високі","effortTier.xhigh":"дуже високі","effortTier.max":"максимальні","effortTier.ultra":"ультра","reasoningTier.minimal":"Мінімальні","reasoningTier.low":"Легкі","reasoningTier.medium":"Середні","reasoningTier.high":"Високі","reasoningTier.xhigh":"Дуже високі","reasoningTier.max":"Максимальні","reasoningTier.ultra":"Ультра","roleCopy.orchestrator.name":"Оркестратор","roleCopy.orchestrator.description":"Координує нових агентів через панель керування Viewer.","roleCopy.orchestrator.param.mode.label":"Режим","roleCopy.orchestrator.param.mode.description":"Режим роботи координаційного запуску.","roleCopy.orchestrator.param.mode.option.standard":"стандартний","roleCopy.orchestrator.param.mode.option.plan-tickets":"план у тікети","roleCopy.orchestrator.param.mode.option.wayfind":"розвідка","roleCopy.orchestrator.param.mode.option.backlog-campaign":"кампанія по беклогу","roleCopy.orchestrator.param.repo.label":"Репозиторій","roleCopy.orchestrator.param.repo.description":"Репозиторій для кампанії по беклогу.","roleCopy.orchestrator.param.issueQuery.label":"Запит задач","roleCopy.orchestrator.param.issueQuery.description":"GitHub-запит задач для кампанії по беклогу.","roleCopy.orchestrator.param.urgent.label":"Термінові","roleCopy.orchestrator.param.urgent.description":"Список термінових задач через кому.","roleCopy.orchestrator.param.maxWorkers.label":"Максимум воркерів","roleCopy.orchestrator.param.maxWorkers.description":"Ліміт воркерів для кампанії по беклогу.","roleCopy.orchestrator.param.mergePolicy.label":"Політика злиття","roleCopy.orchestrator.param.mergePolicy.description":"Спосіб доставлення для кампанії по беклогу.","roleCopy.orchestrator.param.mergePolicy.option.pr":"пул-реквест","roleCopy.orchestrator.param.mergePolicy.option.merge":"мердж","roleCopy.orchestrator.param.completionPolicy.label":"Політика завершення","roleCopy.orchestrator.param.completionPolicy.description":"Умова завершення кампанії по беклогу.","roleCopy.orchestrator.param.completionPolicy.option.pr-opened":"відкрито PR","roleCopy.orchestrator.param.completionPolicy.option.merged":"змерджено","roleCopy.orchestrator.param.completionPolicy.option.released":"зарелізено","roleCopy.reviewer.name":"Рев'юер","roleCopy.reviewer.description":"Перевіряє диф коду й повертає знахідки з доказами, впорядковані за серйозністю.","roleCopy.reviewer.param.diffSource.label":"Джерело дифу","roleCopy.reviewer.param.diffSource.description":"Диф або пул-реквест для перевірки.","roleCopy.reviewer.param.lens.label":"Лінза","roleCopy.reviewer.param.lens.description":"Фокус рев'ю.","roleCopy.reviewer.param.lens.option.correctness":"коректність","roleCopy.reviewer.param.lens.option.over-engineering":"надлишкова інженерія","roleCopy.reviewer.param.lens.option.silent-failure":"тихі збої","roleCopy.reviewer.param.lens.option.test-coverage":"покриття тестами","roleCopy.reviewer.param.lens.option.scope":"межі задачі","roleCopy.reviewer.param.lens.option.prod-ops":"прод-експлуатація","roleCopy.reviewer.param.lens.option.standards+spec":"стандарти + спека","roleCopy.reviewer.param.lens.option.code-smells":"код-смелли","roleCopy.reviewer.param.lens.option.all":"усі лінзи","roleCopy.reviewer.param.mode.label":"Режим","roleCopy.reviewer.param.mode.description":"Контекст рев'юера.","roleCopy.reviewer.param.mode.option.fresh":"свіжий контекст","roleCopy.reviewer.param.parallelN.label":"Паралельні проходи","roleCopy.reviewer.param.parallelN.description":"Кількість незалежних проходів рев'ю.","roleCopy.verifier.name":"Верифікатор","roleCopy.verifier.description":"Перевіряє гіпотези й повертає вердикт із доказами по кожному твердженню.","roleCopy.verifier.param.claims.label":"Твердження","roleCopy.verifier.param.claims.description":"Гіпотези, які треба підтвердити або спростувати.","roleCopy.builder.name":"Білдер","roleCopy.builder.description":"Пише продуктовий код за окресленою задачею.","roleCopy.builder.param.mode.label":"Режим","roleCopy.builder.param.mode.description":"Дисципліна імплементації.","roleCopy.builder.param.mode.option.plain":"звичайний","roleCopy.builder.param.mode.option.apply-fixes":"застосувати фікси","roleCopy.builder.param.mode.option.tdd":"TDD","roleCopy.builder.param.mode.option.diagnose":"діагностика","roleCopy.builder.param.mode.option.prototype":"прототип","roleCopy.builder.param.mode.option.merge-resolve":"розв'язати конфлікти","roleCopy.builder.param.domain.label":"Домен","roleCopy.builder.param.domain.description":"Продуктовий домен імплементації.","roleCopy.builder.param.domain.option.general":"загальний","roleCopy.builder.param.domain.option.frontend":"фронтенд","roleCopy.architect.name":"Архітектор","roleCopy.architect.description":"Готує обґрунтований доказами дизайн без правок продукту.","roleCopy.architect.param.mode.label":"Режим","roleCopy.architect.param.mode.description":"Формат архітектурного результату.","roleCopy.architect.param.mode.option.design":"дизайн","roleCopy.architect.param.mode.option.spec":"спека","roleCopy.architect.param.mode.option.architecture-audit":"аудит архітектури","roleCopy.cleaner.name":"Клінер","roleCopy.cleaner.description":"Безпечно відновлює брудний чекаут за контрактом із бекапами.","roleCopy.prod-auditor.name":"Прод-аудитор","roleCopy.prod-auditor.description":"Проводить розслідування на проді лише в режимі читання, з доказами.","roleCopy.prod-auditor.param.questions.label":"Питання","roleCopy.prod-auditor.param.questions.description":"Питання щодо проду для розслідування.","roleCopy.deployer.name":"Деплоєр","roleCopy.deployer.description":"Планує blue/green-деплой і зупиняється для підтвердження перед змінами.","roleCopy.deployer.param.sha.label":"SHA мерджу","roleCopy.deployer.param.sha.description":"SHA змердженого коміту для деплою.","roleCopy.deployer.param.pr.label":"Пул-реквест","roleCopy.deployer.param.pr.description":"Необов'язкове посилання на пул-реквест.","link.handoffContext":"Тобі передали контекст іншого агента — розмову \xab{title}\xbb. Її транскрипт: {path} — спочатку прочитай цей файл, щоб мати повний контекст, а тоді виконай прохання нижче.\n\n{ask}","link.dropped":"контекст у промпті \xab{title}\xbb — допиши прохання і надішли","handoff.aria":"Перекинути розмову новому агентові — чернетка з'явиться нижче","handoff.title":"клік — чернетка нового агента з цим контекстом \xb7 потягни — звʼязати з наявним","handoff.label":"перекинути агенту","qr.showAria":"Показати QR для входу з телефона","qr.failed":"не вдалося отримати посилання","qr.startHint":"Запустіть viewer з доступом через Tailscale: ","qr.alt":"QR код для входу з телефона","qr.generating":"генерую QR…","qr.linkAria":"Посилання для входу з телефона","qr.copy":"Копіювати посилання","qr.scanHint":"скануй з телефона в тому ж tailnet","push.enabled":"Push-сповіщення увімкнено","push.enable":"Увімкнути push-сповіщення","push.disable":"Вимкнути push-сповіщення","push.needsHttps":"Push потребує HTTPS","sound.on":"Звукові сповіщення увімкнено","sound.off":"Звукові сповіщення вимкнено","sound.mute":"Вимкнути звукові сповіщення","sound.unmute":"Увімкнути звукові сповіщення","sound.settings":"Рівні звуку","sound.cueVolume":"Звукові сигнали","sound.ambientViewer":"Фонова музика у переглядачі","sound.ambient":"Фонова музика під час дзвінка","sound.ambientVolume":"Рівень музики","sound.ambientHint":"Тихо звучить на цьому рівні й стишується під мову під час дзвінка. Якщо ввімкнено обидва, той самий трек продовжує грати через дзвінок.","keepAwake.label":"Не гасити екран","keepAwake.enableAria":"Не давати екрану гаснути на цьому пристрої","keepAwake.disableAria":"Дозволити екрану гаснути на цьому пристрої","keepAwake.off":"Екран гасне за звичайним таймером цього пристрою.","keepAwake.requesting":"Запитую браузер…","keepAwake.active":"Екран не гасне, поки ця вкладка видима. Витрачає більше заряду.","keepAwake.waiting":"Пауза, поки вкладка прихована. Відновиться, коли ви повернетесь.","keepAwake.interrupted":"Система зняла блокування. Вимкніть і ввімкніть, щоб запитати знову.","keepAwake.blocked":"Браузер відмовив у запиті. Екран не втримується.","keepAwake.failed":"Запит не вдався. Екран не втримується.","keepAwake.insecure":"Потрібна адреса HTTPS. Через звичайний HTTP екран втримати не можна.","keepAwake.unsupported":"Цей браузер не має блокування вимкнення екрана.","mic.stopRecognize":"Зупинити запис і розпізнати","mic.cancel":"Скасувати запис","mic.recognizing":"Розпізнаю…","mic.dictate":"Надиктувати","mic.dictateHint":"надиктувати (до 10 хв) \xb7 правий клік: спосіб розпізнавання","mic.timeLeft":"до автостопу {time}","mic.capStopped":"зупинено на 10:00","mic.connecting":"Під'єдную мікрофон — секунду…","mic.menuTitle":"Спосіб розпізнавання","mic.menuLoading":"перевіряю, що доступно…","mic.menuLocked":"Заблоковано змінною середовища LLV_TRANSCRIBE_BACKEND","mic.noKey":"не налаштовано","mic.saveFailed":"не вдалося зберегти вибір","mic.keyTitle":"{name} не налаштовано","mic.copy":"копіювати","mic.copyPath":"Скопіювати шлях","mic.copied":"скопійовано","mic.back":"Назад","stt.local.name":"Faster Whisper","stt.local.desc":"Безкоштовно, повністю локально — аудіо не покидає цю машину.","stt.local.fix":"Запусти scripts/setup-whisper.sh у теці застосунку один раз; він встановить локальний рушій у:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"У межах підписки ChatGPT, через логін Codex.","stt.chatgpt.fix":"Залогінься в Codex (команда `codex login`) — токен з'явиться у:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Платний API ElevenLabs — найточніший варіант.","stt.elevenlabs.fix":"Поклади свій API-ключ ElevenLabs (одним рядком) у цей файл:","delFile.confirm":"Видалити з диска?","delFile.aria":"Видалити розмову з диска","rename.edit":"Перейменувати","rename.editAria":"Перейменувати \xab{title}\xbb","rename.inputAria":"Назва сесії","rename.save":"Зберегти назву","rename.cancel":"Скасувати","rename.reset":"Повернути автоназву","rename.resetHint":"Повернути автоназву: {title}","rename.autoHint":"Автоназва: {title}","rename.retry":"Повторити","rename.saved":"Перейменовано на {title}","rename.conflict":"Назву змінили деінде — застосовано найновішу та повторено","rename.failed":"Не вдалося зберегти назву","img.readFailed":"не вдалося прочитати картинку","img.readAborted":"читання картинки перервано","img.unsupported":"непідтримуваний формат картинки: {name}","img.unknownFile":"невідомий файл","img.tooLarge":"{name}: завелика (ліміт 10 МБ)","img.structuredTooLarge":"Картинка перевищує ліміт цього хоста — {max} МБ","img.tooManyStructured":"За один раз можна надіслати до {max} картинок","img.structuredAggregateTooLarge":"Картинки перевищують ліміт запиту цього хоста — {max} МБ","img.image":"картинка","img.error":"помилка картинки","img.previewAlt":"прев'ю картинки {n}","img.removeAria":"Прибрати картинку {n}","img.readingAria":"завантаження картинки {n}","img.retry":"Повторити","img.retryAria":"Повторити картинку {n}","img.clearAll":"Очистити все","img.clearAllAria":"Прибрати всі картинки","img.blockedReading":"Зачекайте, поки картинка завантажиться…","img.blockedFailed":"Приберіть або повторіть невдалу картинку, щоб надіслати","img.deliveryHint":"додано до повідомлення","question.sec":"{n} с","question.min":"{n} хв","question.hour":"{n} год","question.waiting":"чекає на відповідь","question.sentToPane":"Надіслано в пейн: {text}","question.keysHint":"клавіші в пейн \xb7 або композер нижче","question.pane":"Пейн {target}","question.alreadyAnswered":"відповідь уже записана","question.openFailed":"не вдалося відкрити сесію","question.opened":"відкрито {target}","question.answered":"Відповідено: {text}","question.answeredElsewhere":"Відповідено в іншому місці: {text}","question.noPane":"tmux-пейн недоступний","question.openSession":"відкрити сесію","question.rejectComment":"Коментар до відхилення…","question.approved":"затверджено","question.rejected":"відхилено","question.approve":"Затвердити","question.reject":"Відхилити","question.ownAnswer":"Своя відповідь…","question.dismiss":"Прибрати картку запитання","question.deliveryFailed":"Доставка не вдалася","question.failedChoice":"не доставлено","question.retryAnswer":"Спробувати ще","question.errorNotRunning":"агент більше не працює, тож нічого не доставлено","question.errorMoved":"агент уже пішов далі від цього питання","question.errorUnconfirmed":"відповідь надіслано, але агент її не підтвердив","question.errorNotDelivered":"екран агента не відреагував як очікувалось, тож відповідь не доставлена","question.errorRejected":"вʼювер не зміг зібрати коректну відповідь","inbox.deleted":"видалено з диска","inbox.fileGone":"файла вже немає на диску","inbox.confirmDelete":"Видалити файл з диска?","inbox.deleteAria":"Видалити {name} з диска","inbox.deleteFromDisk":"видалити з диска","inbox.attachedAlt":"вкладена картинка {name}","lightbox.zoomOut":"Зменшити","lightbox.resetZoom":"Скинути масштаб","lightbox.zoomIn":"Збільшити","feed.agentEnded":"агент завершився","feed.copyCode":"Скопіювати код","feed.copyMd":"Скопіювати повідомлення (Markdown)","feed.voiceTurn":"Голос","feed.voiceContext":"Стенограма дзвінка","feed.speak":"Прочитати відповідь уголос (голос згенеровано ШІ)","feed.stopSpeaking":"Зупинити озвучення","tts.read":"Прочитати відповідь уголос","tts.readPaid":"Прочитати вголос (платно)","tts.replay":"Повторити аудіо відповіді","tts.replayFree":"Повторити вголос (безкоштовно)","tts.stop":"Зупинити озвучення","tts.confirmAria":"Підтвердити платне озвучення","tts.confirmTitle":"Підтвердити платне озвучення","tts.characters":"{count} символів","tts.billing":"Оплата з вашого облікового запису {provider} за кожен символ.","tts.disclosure":"Ви почуєте голос, згенерований ШІ, а не голос людини.","tts.shorten":"Озвучити перші {count} символів?","tts.missingKey":"Додайте API-ключ {provider} у {path}","tts.cancel":"Скасувати","tts.speak":"Озвучити","tts.generating":"Створення аудіо…","tts.playing":"Відтворення аудіо","tts.stopped":"Зупинено","tts.configError":"Конфігурація TTS недоступна","tts.backendChanged":"Провайдер TTS змінився. Перевірте оновлені дані та підтвердьте ще раз.","tts.requestError":"Помилка запиту TTS ({status})","tts.requestFailed":"Помилка запиту TTS","tts.playError":"Браузер заблокував відтворення аудіо. Спробуйте ще раз.","feed.running":"виконує {tool}…","feed.tool":"інструмент","feed.thinking":"думає…","feed.working":"працює…","feed.liveTail":"живий хвіст","feed.liveOmittedItems":"… ({count} попередніх відповідей асистента, {chars} символів)","feed.liveOmittedChars":"… (+{chars} символів)","feed.backToLive":"Повернутись до живого хвоста","feed.newCount":"{count} нових","feed.down":"вниз","feed.pickLog":"Вибери лог зліва — стрічка оновлюється сама","feed.showEarlier":"показати раніше","feed.showEarlierHidden":"показати раніше (сховано {count})","feed.loadEarlier":"завантажити раніше з файлу","feed.startOfConvo":"початок розмови","feed.finishedTurn":"закінчив хід — чекає відповіді","feed.returnedResult":"повернувся з результатом","feed.noOutput":"Ще без виводу — файл поки порожній","feed.onlyService":"Є лише службові записи ({count}).","feed.empty":"Порожньо (немає рядків для показу)","render.system":"системне","render.executing":"виконується…","render.error":"помилка","render.teammate":"тімейт","render.left":"{peer}: звільнився{at}","render.codexSessionCreated":"Сесія Codex створена","render.taskStarted":"Задача стартувала","render.taskComplete":"Задачу завершено","render.compacted":"контекст стиснуто","render.compactAuto":"авто","render.compactManual":"вручну","render.compactPre":"{n}k токенів до","render.compactSummary":"підсумок розмови","render.stdinSession":"stdin → сесія {id}","render.record":"запис","render.transcriptRecord":"запис транскрипту","render.recordDetails":"деталі запису","render.protocol":"протокол","render.image":"зображення","render.imageOutput":"вивід зображення","render.toolOutput":"вивід інструмента","render.toolOutputType":"вивід інструмента: {type}","render.dataKb":"даних {n} КБ","render.commands":{one:"{count} команда",few:"{count} команди",many:"{count} команд",other:"{count} команд"},"render.actions":{one:"{count} дія",few:"{count} дії",many:"{count} дій",other:"{count} дій"},"render.noFindings":"без findings","render.moreFindings":"ще {count} findings у raw","render.memoryCitations":"цитати пам'яті ({count})","render.noCitations":"без citation entries","render.moreEntries":"ще {count} entries у raw","render.truncated":"обрізано","render.shutdownRequest":"запит на завершення","render.shutdownResponse":"відповідь на завершення","render.planRequest":"запит на затвердження плану","render.planVerdict":"вердикт по плану","render.approved":"схвалено","render.rejected":"відхилено","render.from":"від {from}","render.structured":"структуроване повідомлення","render.showJson":"показати JSON","render.toDir":"до","render.fromDir":"від","render.delivered":"доставлено","render.notDelivered":"не доставлено","render.reasoning":"міркування агента","tools.read":"Читання","tools.write":"Запис","tools.edit":"Редагування","tools.lines":{one:"{count} рядок",few:"{count} рядки",many:"{count} рядків",other:"{count} рядка"},"tools.files":{one:"{count} файл",few:"{count} файли",many:"{count} файлів",other:"{count} файлу"},"tools.items":{one:"{count} пункт",few:"{count} пункти",many:"{count} пунктів",other:"{count} пункту"},"tools.family.shell":"команда оболонки","tools.family.read":"читання файлу","tools.family.write":"запис файлу","tools.family.edit":"редагування","tools.family.search":"пошук","tools.family.web":"веб","tools.family.spawn":"запуск агента","tools.family.plan":"план","tools.family.mcp":"інструмент MCP","tools.family.other":"інструмент","tools.showAllLines":"показати всі ({count} рядків)","tools.showOutput":"показати весь вивід","tools.moreFiles":"…і ще {count} файлів","tools.binaryContent":"бінарний вміст \xb7 {size}","tools.rawRecord":"сирий запис","tools.noRawRecord":"деталі більше не завантажені","tools.noOutput":"вивід не збережено","tools.noOutputTip":"повний вивід зберігається в сесії rollout","tools.stdin":"stdin","tools.stdinPoll":"опитування","tools.pollRun":{one:"{count} опитування",few:"{count} опитування",many:"{count} опитувань",other:"{count} опитувань"},"tools.wait":"очікування","tools.session":"сесія","tools.waitingSeconds":"очікування {n} с","tools.wakeup":"заплановане пробудження","tools.cron":"запланований агент","tools.monitor":"монітор","tools.schedule":"розклад","tools.diffTruncated":"обрізано","tools.orchestration":{one:"{count} виклик інструмента",few:"{count} виклики інструментів",many:"{count} викликів інструментів",other:"{count} викликів інструментів"},"tools.nestedCalls":"вкладені виклики","tools.callId":"виклик {id}","tools.copyId":"копіювати id","tools.copyDiff":"Копіювати diff","tools.copyOutput":"Копіювати вивід","tools.source":"джерело","tools.action":"дія {index}","tools.cwd":"cwd","tools.copyCwd":"копіювати cwd","tools.copyCommand":"Копіювати команду","tools.stdout":"stdout","tools.stderr":"stderr","tools.copyStderr":"Копіювати stderr","tools.showStderr":"показати весь stderr","tools.noStderr":"stderr не збережено","tools.exitOk":"код виходу 0","tools.exitCode":"код виходу {code}","tools.durationSec":"{n} с","tools.durationMin":"{m} хв {s} с","tools.durationMs":"{n} мс","tools.ranAt":"{start}–{end}","tools.nestedWaits":{one:"{count} додатковий",few:"{count} додаткові",many:"{count} додаткових",other:"{count} додаткових"},"wakeup.card":"заплановане пробудження","wakeup.wakesAt":"прокинеться о {time}","wakeup.wasSetFor":"було на {time}","wakeup.firedAt":"спрацював о {time}","wakeup.fired":"спрацював","wakeup.failed":"не заплановано","wakeup.superseded":"замінено","wakeup.noTime":"пробудження заплановано","wakeup.plan":"план пробудження","wakeup.noPlan":"план пробудження не задано","wakeup.inRel":"через {rel}","wakeup.agoRel":"{rel} тому","wakeup.relSec":{one:"{count} с",few:"{count} с",many:"{count} с",other:"{count} с"},"wakeup.relMin":{one:"{count} хв",few:"{count} хв",many:"{count} хв",other:"{count} хв"},"wakeup.relHour":{one:"{count} год",few:"{count} год",many:"{count} год",other:"{count} год"},"wakeup.relDay":{one:"{count} дн",few:"{count} дн",many:"{count} дн",other:"{count} дн"},"wakeup.chipTitle":"спить до {time} — {reason}","flowDialog.engine":"Двигун: {label}","flowDialog.modelPlaceholder":"модель (дефолт)","flowDialog.model":"Модель: {label}","flowDialog.effortDefault":"effort: дефолт","flowDialog.createFailed":"не вдалося створити флоу ({status})","flowDialog.title":"Запустити флоу","flowDialog.subtitle":"implement → review \xb7 ця розмова стає виконавцем","flowDialog.preset":"пресет","flowDialog.rolesManualOpen":"▾ ролі вручну","flowDialog.rolesManual":"▸ ролі вручну (модель / effort)","flowDialog.spec":"специфікація та критерії приймання","flowDialog.specPlaceholder":"Опис задачі\nAC1: …\nAC2: …","flowDialog.implementer":"виконавець","flowDialog.reviewer":"ревʼюер","flowDialog.diffBase":"база діфу","flowDialog.fromHead":"від поточного HEAD","flowDialog.fromMergeBase":"від merge-base з main","flowDialog.headless":"headless (без панелі)","flowDialog.tmuxPane":"tmux-панель","flowDialog.transitions":"переходи","flowDialog.auto":"авто","flowDialog.manual":"вручну (гейт на кожен крок)","flowDialog.roundLimit":"ліміт раундів","flowDialog.creating":"створюю…","flowDialog.start":"▶ Запустити","flowStrip.startReview":"Почати ревью","flowStrip.spawnReviewer":"Заспавнити ревʼюера","flowStrip.relayNotes":"Передати зауваження","flowStrip.retryRound":"Повторити раунд","flowStrip.anotherRound":"Ще коло","flowStrip.flow":"Флоу","flowStrip.roundsAria":"Раунди ревью","flowStrip.roundError":"Раунд {n}: {error}","flowStrip.roundVerdict":"Раунд {n}: {verdict}","flowStrip.roundInProgress":"Раунд {n}: триває","flowStrip.addRoundsTitle":"Додати ще раунди до ліміту","flowStrip.plus2":"+2 раунди","flowStrip.limitTitle":"Ліміт раундів: скільки ревью до зупинки (∞ — без ліміту)","flowStrip.limitAria":"Встановити ліміт раундів: {count}","flowStrip.limitUnlimitedAria":"Без ліміту раундів","flowStrip.stopReviewer":"Стоп","flowStrip.stopReviewerTitle":"Зупинити поточного ревʼюера; раунд перейде в \xabпотрібне рішення\xbb","flowStrip.notePlaceholder":"нотатка ревʼюеру…","flowStrip.noteTitle":"Піде наступному ревʼюеру як ready-нотатка раунду","flowStrip.autoTitle":"Авто: переходи самі. Клік — вручну.","flowStrip.manualTitle":"Вручну: кожен перехід чекає кліку. Клік — авто.","flowStrip.manualShort":"вручну","flowStrip.resume":"Продовжити флоу","flowStrip.pause":"Пауза","flowStrip.close":"Закрити флоу","flowHub.aria":"Керування флоу — раунд {n}, {state}","flowHub.ariaNoRound":"Керування флоу — {state}","flowHub.controls":"Керування флоу","groupOverride.closePanel":"Закрити керування","groupOverride.flowTitle":"Змінити \xb7 {name}","groupOverride.pipelineTitle":"Змінити \xb7 {name}","groupOverride.draftTitle":"Редагувати чернетку \xb7 {name}","groupOverride.task":"Завдання","groupOverride.spec":"Специфікація","groupOverride.repoDir":"Репозиторій","groupOverride.saveDraft":"Зберегти деталі чернетки","groupOverride.savedDraft":"Деталі чернетки збережено","groupOverride.reviewerRole":"Наступний рев'юер","groupOverride.engine":"Рушій","groupOverride.effort":"Зусилля","groupOverride.effortDefault":"типове","groupOverride.model":"Модель","groupOverride.modelPlaceholder":"типова для рушія","groupOverride.applyRole":"Оновити рев'юера","groupOverride.nextRoundNote":"Нотатка на наступний раунд","groupOverride.notePlaceholder":"На чому зосередити наступного рев'юера…","groupOverride.noteUnavailable":"Можна редагувати під час старту, запуску або повтору раунду.","groupOverride.roundLimit":"Ліміт раундів","groupOverride.setLimit":"Задати","groupOverride.extend":"+1 раунд","groupOverride.nextStage":"Наступний етап","groupOverride.draftStage":"Етап чернетки","groupOverride.addStage":"Додати етап","groupOverride.removeStage":"Видалити етап","groupOverride.moveStageUp":"Перемістити вгору","groupOverride.moveStageDown":"Перемістити вниз","groupOverride.role":"Роль","groupOverride.noRole":"Без ролі","groupOverride.stagePrompt":"Промпт стадії","groupOverride.applyStage":"Оновити етап","groupOverride.noEditableStage":"Немає майбутнього етапу для змін — усі етапи вже стартували.","groupOverride.editStagesOnCanvas":"Редагуйте етапи на їхніх картках — роль, модель, підказка, порядок і зʼєднання є на картці кожного етапу на полотні.","groupOverride.savedReviewer":"Рев'юера оновлено на наступний раунд","groupOverride.savedLimit":"Ліміт раундів оновлено","groupOverride.savedExtend":"Додано раунд","groupOverride.savedRetry":"Повторюємо раунд","groupOverride.savedCancel":"Рев'юера зупинено","groupOverride.savedStage":"Етап оновлено для наступного запуску","groupOverride.stagesHeading":"Етапи \xb7 порядок виконання","groupOverride.stagesHint":"Перетягуй картки, щоб змінити порядок. Порядок — це ланцюг виконання.","groupOverride.stagesEmpty":"Ще немає етапів — додай етап нижче, щоб почати збірку.","groupOverride.startNeedsStages":"Додай щонайменше 1 етап перед запуском.","groupOverride.addRunStage":"Додати етап","groupOverride.addReviewStage":"Додати цикл ревʼю","groupOverride.dragHandle":"Перетягни, щоб змінити порядок етапу","groupOverride.runKind":"запуск","groupOverride.reviewKind":"цикл ревʼю","groupOverride.reordered":"Порядок етапів змінено","groupOverride.stageAdded":"Етап додано","groupOverride.stageRemoved":"Етап видалено","pipelineBuilder.untitledTask":"Новий пайплайн","pipelineBuilder.createDraft":"Пайплайн","pipelineBuilder.createDraftAria":"Додати чернетку пайплайна на полотно","roundDeck.roundAborted":"Раунд {n} \xb7 перервано","roundDeck.roundVerdict":"Раунд {n} \xb7 {verdict}","roundDeck.roundInProgress":"Раунд {n} \xb7 триває","roundDeck.aborted":"перервано","roundDeck.reviewInProgress":"ревью триває","roundDeck.waitingFirst":"чекаю на перший раунд ревью…","roundDeck.spawningReviewer":"запускаю ревʼюера — транскрипт зʼявиться за мить…","roundDeck.moreRounds":"ще {count} раунд(и) — клікни чипи на стрічці флоу","roundDeck.findings":{one:"{count} знахідка",few:"{count} знахідки",many:"{count} знахідок",other:"{count} знахідок"},"roundDeck.roundsCount":{one:"{count} раунд",few:"{count} раунди",many:"{count} раундів",other:"{count} раундів"},"roundDeck.collapseStack":"Згорнути стек ревʼю ({count} раундів)","roundDeck.expandStack":"Розгорнути стек ревʼю ({count} раундів)","roundDeck.groupAria":{one:"Група ревʼю \xb7 {count} раунд",few:"Група ревʼю \xb7 {count} раунди",many:"Група ревʼю \xb7 {count} раундів",other:"Група ревʼю \xb7 {count} раундів"},"roundDeck.groupAriaNamed":{one:"Група ревʼю для {name} \xb7 {count} раунд",few:"Група ревʼю для {name} \xb7 {count} раунди",many:"Група ревʼю для {name} \xb7 {count} раундів",other:"Група ревʼю для {name} \xb7 {count} раундів"},"subagentTray.label":{one:"{count} підагент",few:"{count} підагенти",many:"{count} підагентів",other:"{count} підагентів"},"subagentTray.toggle":{one:"Розгорнути лоток підагентів ({count} згорнутий)",few:"Розгорнути лоток підагентів ({count} згорнуті)",many:"Розгорнути лоток підагентів ({count} згорнутих)",other:"Розгорнути лоток підагентів ({count} згорнутих)"},"subagentTray.collapse":{one:"Згорнути лоток підагентів ({count} згорнутий)",few:"Згорнути лоток підагентів ({count} згорнуті)",many:"Згорнути лоток підагентів ({count} згорнутих)",other:"Згорнути лоток підагентів ({count} згорнутих)"},"subagentTray.rows":"Згорнуті підагенти","subagentTray.open":"Відкрити транскрипт підагента {name}","subagentTray.fold":"Згорнути {name} у лоток підагентів","subagentTray.unfold":"Повернути {name} як повну картку","subagentTray.state.running":"працює","subagentTray.state.live":"наживо","subagentTray.state.silent":"живий, але мовчить","subagentTray.state.closed":"простій","subagentTray.state.dead":"недоступний","flowState.waiting_ready":"чекає READY","flowState.spawn_pending":"готовий спавнити ревʼюера","flowState.spawning":"запускаю ревʼюера","flowState.reviewing":"ревью","flowState.relay_pending":"вердикт є — передати?","flowState.relaying":"передаю зауваження","flowState.fixing":"фікси","flowState.approved":"затверджено","flowState.done_comment":"готово із зауваженнями","flowState.needs_decision":"потребує рішення","flowState.paused":"пауза","flowState.closed":"закрито","flowState.blocked_rate_limited":"заблоковано: вичерпано ліміт","flowState.rate_limit_until":"скинеться о {time}","flowState.rate_limit_wait":"чекає на скидання ліміту","flowModel.failed":"не вдалося ({status})","wfState.provisioning":"готую worktree","wfState.implementing":"етапи виконуються","wfState.reviewing":"ревью","wfState.finishing":"завершення","wfState.approved":"approved","wfState.needs_decision":"потребує рішення","wfState.paused":"пауза","wfState.closed":"закрито","wfModel.failed":"не вдалося ({status})","wfStrip.workflow":"Воркфлоу","wfStrip.stagesAria":"Етапи воркфлоу","wfStrip.reviewStage":"ревью","wfStrip.advance":"Далі","wfStrip.retryStage":"Повторити етап","wfStrip.skipStage":"Пропустити","wfStrip.resume":"Продовжити воркфлоу","wfStrip.pause":"Пауза","wfStrip.close":"Закрити воркфлоу","pipelineState.draft":"чернетка","pipelineState.provisioning":"готую worktree","pipelineState.running":"етапи виконуються","pipelineState.needs_decision":"потребує рішення","pipelineState.paused":"пауза","pipelineState.completed":"завершено","pipelineState.closed":"закрито","pipelineModel.failed":"не вдалося ({status})","pipelineStrip.pipeline":"Пайплайн","pipelineStrip.start":"Запустити пайплайн","pipelineStrip.discard":"Відкинути чернетку","pipelineStrip.stagesAria":"Етапи пайплайна","pipelineStrip.reviewStage":"цикл ревью","pipelineStrip.retryStage":"Повторити етап","pipelineStrip.skipStage":"Пропустити","pipelineStrip.resume":"Продовжити пайплайн","pipelineStrip.pause":"Пауза","pipelineStrip.close":"Закрити пайплайн","pipelineStrip.readOnly":"лише читання","pipelineStrip.readWrite":"читання й запис","pipelineStrip.groupAria":"Пайплайн {task}","pipelineStrip.baseSha":"База {sha}","pipelineStrip.baseShaFull":"Повний базовий коміт {sha}","pipelineStrip.copyBaseSha":"Скопіювати повний базовий коміт {sha}","pipelineStrip.copiedBaseSha":"Повний базовий коміт скопійовано","pipelineStrip.copyBaseShaFailed":"Не вдалося скопіювати базовий коміт","pipelineStrip.moreActions":"Інші дії пайплайна","pipelineStrip.announce":"Пайплайн {task}: {state}, етап {stage} {k} з {n}","pipelineStrip.openStage":"Відкрити етап {label}","pipelineStrip.openVerdict":"Відкрити вердикт етапу {label}, стан: {state}","pipelineStrip.openTranscript":"Відкрити транскрипт етапу {label}, стан: {state}","pipelineStrip.configureStage":"Налаштувати етап {label}, стан: {state}","pipelineStrip.configAria":"Налаштування етапу {label}","pipelineStrip.closeConfig":"Закрити налаштування етапу","pipelineStrip.lineageAria":"Послідовність етапів від {from} до {to}","pipelineStrip.previousStage":"Відкрити попередній етап {label}, стан: {state}","pipelineStrip.nextStage":"Відкрити наступний етап {label}, стан: {state}","pipelineStrip.evidenceAria":"Свідчення етапу {label}: {verdict}, тривалість {duration}, модель {model}","pipelineStrip.defaultModel":"типова модель","pipelineStrip.unknownDuration":"тривалість недоступна","pipelineStrip.linkedTasks":"Пов’язані завдання","pipelineStrip.openTask":"Відкрити пов’язане завдання {label}","pipelineStrip.roundShort":"Р{n}","pipelineStrip.attemptSuffix":"\xd7{n}","stageGraph.roundProgress":"раунд {round}/{total}","stageGraph.startedNotice":"Етап запустився, поки налаштування були відкриті. Збережену серверну конфігурацію тепер заблоковано.","pipelineStrip.chipAria":"Етап {label}: {state}","pipelineStrip.compactChipAria":"{label}, {state}","pipelineStrip.stageOf":"етап {k}/{n}","pipelineStrip.passEdgeAria":"Ребро проходження від {from} до {to}","pipelineStrip.failEdgeAria":"Ребро невдачі від {from} до {to}, раунд {k} з {n}","pipelineStrip.nextEdge":"далі","pipelineStrip.nextEdgeAria":"Це ребро виконується наступним","pipelinePresentation.queued":"У черзі","pipelinePresentation.waiting":"Очікує","pipelineShelf.aria":"Полиця пайплайнів","pipelineShelf.title":"Пайплайни","pipelineShelf.edit":"Редагувати пайплайн {task}","pipelineGroup.toggle":"Розгорнути або згорнути пайплайн {task}","pipelineGroup.openHistory":"Відкрити історію пайплайна {task}","pipelineSlot.paneAria":"Запланований етап {title}","pipelineSlot.completedAria":"Завершений етап {title} — відкрийте для перегляду","pipelineSlot.openTranscript":"Відкрити розмову","pipelineSlot.stageOf":"етап {k}/{n}","pipelineSlot.promptLabel":"Промпт стадії","pipelineSlot.noPrompt":"Додатковий контекст для агента — все вище підключається автоматично.","pipelineSlot.wiringTask":"Автоматично отримує: текст задачі","pipelineSlot.wiringPrev":"Автоматично отримує: результат попереднього етапу + текст задачі","pipelineSlot.waiting":"Вікно чату {role} з’явиться тут, щойно етап стартує.","pipelineSlot.starting":"Запускаємо агента {role}…","pipelineSlot.reviewHint":"Цикл рев’ю попереднього етапу — його раунди з’являться тут.","pipelineSlot.frozen":"Етап уже виконувався — конфігурацію заморожено.","pipelineSlot.saved":"Збережено","pipelineSlot.rowAria":"Завершений етап {title}","pipelineSlot.reasonSkipped":"Пропущено оператором — ланцюжок пішов далі","pipelineSlot.rowExpand":"Показати повну картку етапу","pipelineSlot.rowCollapse":"Згорнути назад до рядка статусу","pipelineTemplates.planBuildReview":"План → Збірка → Рев’ю","pipelineTemplates.buildReview":"Збірка → Рев’ю","pipelineTemplates.buildVerify":"Збірка → Перевірка","pipelineSlot.addAgent":"Наступний агент","pipelineSlot.addAgentTitle":"Додати наступного агента після цього етапу","pipelineSlot.addReview":"Цикл рев’ю","pipelineSlot.addReviewTitle":"Прикріпити цикл рев’ю (жорстка зв’язка) після цього етапу","pipelineSlot.moveEarlier":"Перемістити {role} раніше в ланцюжку","pipelineSlot.moveLater":"Перемістити {role} пізніше в ланцюжку","pipelineSlot.savePrompt":"Зберегти промпт","pipelineSlot.promptAria":"Редактор промпту етапу","pipelineSlot.connectHeading":"З'єднання","pipelineSlot.passEdgeLabel":"Після проходження — до","pipelineSlot.passEdgeEnd":"— завершує конвеєр","pipelineSlot.failEdgeLabel":"У разі невдачі — назад до","pipelineSlot.failEdgeNone":"— зупинка для оператора","pipelineSlot.failEdgeSelf":"↺ цей етап (повтор себе)","pipelineSlot.failEdgeRounds":"Макс. раундів циклу","pipelineSlot.passEdgeFrozen":"Цей етап уже виконувався — його ребро проходження заморожене як свідчення.","pipelineSlot.failEdgeFrozen":"Це ребро невдачі вже пройдене — воно заморожене як свідчення.","pipelineTemplates.title":"Новий пайплайн","pipelineTemplates.subtitle":"Обери шаблон. Група пайплайна з’явиться на дошці біля пов’язаного завдання. Налаштування етапів доступні за запитом.","pipelineTemplates.blank":"Порожнє полотно","pipelineTemplates.blankHint":"Почни з нуля і збери етапи вручну.","pipelineTemplates.noRole":"без ролі","pipelineTemplates.repoDir":"Каталог репозиторію","pipelineTemplates.checking":"Перевіряємо репозиторій…","pipelineTemplates.ready":"Репозиторій готовий","pipelineTemplates.creating":"Створюємо пайплайн…","pipelineTemplates.retry":"Повторити","pipelinePreflight.empty":"Вкажи каталог репозиторію","pipelinePreflight.missing":"Каталог не існує: {path}","pipelinePreflight.not_directory":"Обери каталог: {path}","pipelinePreflight.repo_unreadable":"Репозиторій недоступний для читання: {path}","pipelinePreflight.repo_untraversable":"Репозиторій неможливо відкрити: {path}","pipelinePreflight.not_git":"Обери Git-репозиторій: {path}","pipelinePreflight.probe_failed":"Перевірку репозиторію не завершено — повтори: {path}","pipelinePreflight.git_metadata_unwritable":"Метадані Git доступні лише для читання: {path}","pipelinePreflight.worktree_parent_unwritable":"Поруч із цим репозиторієм неможливо створити робочу копію пайплайна: {path}","pipelineChipState.pending":"очікує","pipelineChipState.spawning":"запускається","pipelineChipState.running":"виконується","pipelineChipState.reviewing":"рев’ю","pipelineChipState.committing":"коміт","pipelineChipState.passed":"пройдено","pipelineChipState.failed":"провалено","pipelineChipState.needs_decision":"потребує рішення","pipelineChipState.skipped":"пропущено","pipelineVerdict.pass":"успіх","pipelineVerdict.fail":"провал","pipelineVerdict.needsDecision":"рішення","pipelineVerdict.confidence":"впевненість","pipelineVerdict.reviewerSha":"SHA ревʼюера {sha}","pipelineVerdict.findings":{one:"{count} зауваження",few:"{count} зауваження",many:"{count} зауважень",other:"{count} зауважень"},"pipelineVerdict.noFindings":"зауважень немає","pipelineVerdict.more":"+{count} ще","pipelineVerdict.openTranscript":"Відкрити транскрипт","pipelineVerdict.openAttemptTranscript":"Відкрити транскрипт спроби {n}","pipelineVerdict.reviewTranscripts":"Транскрипти рев’ю","pipelineVerdict.openReviewTranscript":"Відкрити транскрипт рев’ю {n}","pipelineVerdict.openFlow":"Відкрити рев’ю","pipelineVerdict.retry":"Повторити","pipelineVerdict.skip":"Пропустити","pipelineVerdict.priorAttempts":"Попередні спроби","pipelineVerdict.attemptLine":"Спроба {n}: {status}","pipelineVerdict.title":"Вердикт етапу {label}","pipelineHub.aria":"Пайплайн {task}: {stage} \xb7 {k}/{n}","pipelineHub.controls":"Керування пайплайном","pipelineHub.stageOf":"{stage} \xb7 {k}/{n}","pipelineHub.openControls":"Відкрити керування пайплайном","pipelineHub.attempt":"спроба {n}","pipelineHub.openDashboard":"Відкрити панель","dash.pipeline":"Пайплайн","dash.newPipeline":"Новий пайплайн","board.historyGroup":"Скасувати та повторити дії на дошці","board.undo":"Скасувати","board.redo":"Повторити","board.undoReopen":"Скасувати — знову відкрити \xab{title}\xbb","board.redoReclose":"Повторити — знову закрити \xab{title}\xbb","board.undoNothing":"Немає що скасовувати","board.redoNothing":"Немає що повторювати","scheme.pipeline":"Пайплайн","scheme.pipelineTitle":"Запустити пайплайн із цієї розмови","board.pipeline":"Пайплайн","board.newPipeline":"Новий пайплайн","pipelineMobile.chipAria":"Пайплайн {task}","pipelineMobile.position":"{k}/{n}","pipelineMobile.prevStage":"Попередній етап {label}, стан: {state}","pipelineMobile.nextStage":"Наступний етап {label}, стан: {state}","pipelineMobile.openVerdict":"Відкрити вердикт для {label}, стан: {state}","pipelineMobile.expandDock":"Розгорнути пайплайн {task}","pipelineMobile.collapseDock":"Згорнути пайплайн {task}","pipelineMobile.summaryOpen":"Відкрити пайплайни ({n})","pipelineMobile.summaryCount":{one:"{n} пайплайн",other:"{n} пайплайнів"},"pipelineMobile.summaryActive":"{n} активних","pipelineMobile.summaryAttention":"{n} потребують вас","pipelineMobile.summaryCompleted":"{n} завершено","pipelineMobile.sheetTitle":"Пайплайни","pipelineMobile.closeSheet":"Закрити пайплайни","pipelineMobile.completedGroup":{one:"{n} завершений",other:"{n} завершено"},"wfDraft.paneAria":"Чернетка нового воркфлоу","wfDraft.notStarted":"воркфлоу ще не запущений","wfDraft.newWorkflow":"новий воркфлоу","wfDraft.dismiss":"Прибрати чернетку воркфлоу","wfDraft.template":"шаблон","wfDraft.templateAria":"Шаблон воркфлоу","wfDraft.repo":"репозиторій","wfDraft.repoAria":"Директорія репозиторію","wfDraft.manualMode":"вручну: гейт на межі кожного етапу","wfDraft.hint":"Обери шаблон і репозиторій, опиши задачу — воркфлоу створить worktree, прожене етапи, ревью і відкриє PR.","wfDraft.taskPlaceholder":"задача для воркфлоу — бриф піде кожному етапу…","wfDraft.taskAria":"Бриф задачі воркфлоу","wfDraft.footerHint":"worktree \xb7 етапи \xb7 ревью \xb7 PR","wfDraft.finishMerge":"merge локально","wfDraft.needDir":"вкажи директорію репозиторію","wfDraft.needTask":"опиши задачу","wfDraft.launchFailed":"не вдалося запустити","wfDraft.launch":"▶ Запустити воркфлоу","wfDraft.launching":"запускаю…","scheme.flowTitle":"Запустити цикл implement → review для цієї розмови","scheme.flow":"Флоу","scheme.collapsedTitle":"Згорнуті гілки й задачі цієї розмови","scheme.underneath":"під сподом","scheme.handTool":"Рука — тягнути полотно (H, або тримай Space)","scheme.selectTool":"Виділення — клік і робота з розмовами (V)","scheme.zoomOut":"Віддалити (−)","scheme.zoom100":"Масштаб 100% (1)","scheme.zoomIn":"Наблизити (+)","scheme.fitCurrent":"Вписати поточну роботу (0)","scheme.fit":"Вписати весь вміст (Shift+0, або подвійний клік по фону)","scheme.framedCurrent":"Поточну роботу вписано — {count} елементів","scheme.framedAll":"Весь вміст вписано — {count} елементів","scheme.offscreenNav":"Робота за межами екрана","scheme.offscreenMore":"Показати ще {count} кластерів за межами екрана","mobile.mapFrame":"Рамка мапи","mobile.mapAll":"Усе","mobile.mapCurrent":"Поточне","scheme.roleImplementer":"Імплементер","scheme.roleReviewer":"Ревʼюер","scheme.roleWorking":"працює","scheme.roleWaiting":"чекає","scheme.lassoTool":"Вибірка — обведи агентів рамкою, кліком додавай чи знімай","scheme.selectCheckOn":"Додати цього агента до вибірки","scheme.selectCheckOff":"Прибрати цього агента з вибірки","scheme.boardAria":"Дошка агентів — стрілки переміщують між вікнами агентів","scheme.navStack":{one:"{count} тиха гілка під {title}",few:"{count} тихі гілки під {title}",many:"{count} тихих гілок під {title}",other:"{count} тихих гілок під {title}"},"scheme.navStackBare":{one:"{count} тиха гілка",few:"{count} тихі гілки",many:"{count} тихих гілок",other:"{count} тихих гілок"},"bulk.selectedCount":{one:"Вибрано {count}",few:"Вибрано {count}",many:"Вибрано {count}",other:"Вибрано {count}"},"bulk.placeholder":"одне повідомлення кожному вибраному агенту…","bulk.textAria":"Текст розсилки вибраним агентам","bulk.sendAll":"Надіслати {count} агентам","bulk.interrupt":"Перервати","bulk.stop":"Зупинити","bulk.stopConfirm":"Точно зупинити {count}?","bulk.remove":"Прибрати зі схеми","bulk.removeConfirm":"Закрити {count} карток?","bulk.flow":"Флоу","bulk.fit":"Показати вибірку","bulk.exit":"Вийти з вибірки (Esc)","bulk.retryFailed":"Повторити невдалі ({count})","bulk.nodeGone":"вузол зник зі схеми","bulk.flowTitle":"Запустити ревʼю-флоу для {count} агентів","bulk.flowStart":"Запустити {count} флоу","minimap.title":"Мінімапа — клікни або тягни, щоб перейти","minimap.stacks":{one:"{count} згорнутий стек",few:"{count} згорнуті стеки",many:"{count} згорнутих стеків",other:"{count} згорнутих стеків"},"plan.agentPlan":"План агента:","plan.stepsAria":"План: {done} з {total} кроків","plan.nowSuffix":", зараз: {current}","plan.goal":"ціль","plan.goalDone":"ціль ✓","plan.goalBlocked":"ціль ✖","plan.noObjective":"(objective не записаний у хвості транскрипта)","plan.tokens":"токенів: {n}","plan.time":"часу: {n} хв","plan.ctxTitle":"Контекстне вікно: використано {pct}%\n{used} з {window} токенів","plan.ctxSourceRuntime":"Розмір вікна повідомлений середовищем агента","plan.ctxSourceRegistry":"Розмір вікна з вбудованого реєстру моделей ({version}) — приблизно","plan.ctxTitleUnknown":"Використання контексту: {used} токенів\nРозмір вікна для цієї моделі невідомий — відсоток не показується","plan.ctxAria":"Контекст: використано {pct} відсотків вікна","plan.ctxAriaUnknown":"Контекст: використано {used} токенів, розмір вікна невідомий","plan.goalAria":"Ціль сесії: {status}","limits.now":"зараз","limits.inMin":"через {n} хв","limits.inHour":"через {n} год","limits.inDay":"через {n} д","limits.asOf":"станом на {time}","limits.left":"лишилось","limits.reset":"скид {eta} \xb7 {at}","limits.stale":"дані застарілі: {stale}","limits.5h":"5 год","limits.week":"Тиждень","limits.windowMinutes":"{n} хв","limits.windowHours":"{n} год","limits.windowDays":"{n} д","limits.accountsOpenAria":"Акаунти Codex — змінити або додати","limits.noDataYet":"поки немає даних","limits.rateLimited":"Провайдер обмежує частоту запитів.","limits.rateLimitedRetry":"Провайдер обмежує частоту запитів. Наступна спроба о {time}.","limits.reauthRequired":"Потрібно повторно увійти в Claude.","burndown.title":"витрати","burndown.openAria":"Відкрити графік витрати квоти {engine}","burndown.close":"Закрити графік","burndown.windowAria":"Вікно графіка","burndown.ideal":"рівний темп","burndown.actual":"лишок","burndown.loading":"Завантаження історії…","burndown.failed":"Не вдалося завантажити історію.","burndown.empty":"Історії ще немає — графік заповнюється в міру збору даних.","burndown.windowUnreported":"Цей план не повідомляє вікно \xab{window}\xbb, тож малювати тут нічого.","burndown.buildsFrom":"історія від {date}","burndown.fast":"на {pct}% швидше за рівний темп — витрачаєте зашвидко","burndown.slow":"на {pct}% повільніше за рівний темп — є запас","burndown.even":"рівний темп","burndown.emptyBy":"за таким темпом 0% до {at}","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} вільно","resources.used":"{amount} зайнято","resources.stale":"дані про ресурси застарілі: {stale}","resources.captured":"знято {age}","resources.openAria":"Сесії агентів і пам'ять","resources.title":"Сесії агентів","resources.total":"Σ {amount}","resources.empty":"у tmux немає сесій агентів","resources.orphan":"осиротілий пейн","resources.hostConflict":"дублікат пейна розмови","resources.hostConflictHint":"кілька активних пейнів належать цій розмові","resources.procs":{one:"{count} процес",few:"{count} процеси",many:"{count} процесів",other:"{count} процесу"},"resources.swapShare":"+ {amount} swap","resources.kill":"Убити","resources.confirm":"Точно?","resources.killLiveHint":"агент зараз працює — натисни, щоб розблокувати, і підтверди","resources.killHint":"закрити tmux-пейн разом з усім деревом процесів","resources.bulkLabel":"неактивні довше ніж","resources.bulkKill":"Убити неактивні","resources.bulkNone":"немає сесій, неактивних так довго","resources.hoursN":"{n} год","resources.killAll":"Убити всіх агентів","resources.killAllConfirm":"Підтвердити — убити {n}?","resources.killAllHint":"примусово закрити кожен пейн агента, разом із активними — чистий старт, щоб наступний spawn/повідомлення пішли правильно. Твої шели і в'ювер не чіпає.","resources.killAllNone":"немає сесій агентів для закриття","resources.close":"Закрити","attach.attach":"Приєднатися","attach.readonly":"Лише перегляд","attach.copy":"Скопіювати команду приєднання","attach.copyReadonly":"Скопіювати команду приєднання лише для перегляду","attach.hint":"скопіювати команду tmux attach для цього пейна — встав її в будь-який шел","attach.readonlyHint":"скопіювати команду приєднання лише для перегляду — дивишся, не чіпаючи клавіш","attach.loading":"обчислюю…","attach.copied":"команду приєднання скопійовано","attach.copiedReadonly":"команду лише для перегляду скопійовано","attach.stale":"Цей пейн змінився або закрився. Онови й спробуй ще раз.","attach.restarted":"Сервер tmux перезапустився. Онови й спробуй ще раз.","attach.unavailable":"Ендпоінт tmux недоступний. Онови й спробуй ще раз.","attach.badRequest":"Не вдалося визначити пейн — онови список.","attach.network":"Помилка мережі — спробуй ще раз.","attach.clipboard":"Не вдалося скопіювати — перевір доступ до буфера обміну.","attach.refresh":"Оновити","status.awaitingPlan":"чекає затвердження плану","status.awaitingAnswer":"чекає відповіді на питання","status.awaitingTerminal":"чекає на відповідь у терміналі","status.working":"працює…","status.returnedResult":"повернувся з результатом","status.stalled":"перервано або чекає дозволу","status.finishedTurn":"закінчив хід — чекає відповіді","status.rateLimited":"вичерпано ліміт","status.flow":"флоу: {label}","rateLimit.badge":"вичерпано ліміт","rateLimit.badgeUntil":"ліміт до {time}","rateLimit.reseat":"продовжити на здоровому акаунті","rateLimit.reseatRequested":"пересадка…","rateLimit.reseatTitle":"Створити наступника цієї розмови на найздоровішому акаунті; вичерпана розмова паркується, прив'язані флоу переходять слідом.","rateLimit.reseatFailed":"не вдалося пересадити","rateLimit.reseatAlready":"вже пересаджено","rateLimit.reseatWaitingTurn":"Пересадку поставлено в чергу: щойно обмежений хід звільнить панель, буде створено наступника.","dictation.capWarn":"залишилось менше хвилини запису","dictation.capStopped":"Запис зупинено на 10-хвилинній межі; текст зʼявиться в полі.","dictation.failed":"не вдалося розпізнати","dictation.silence":"тиша — нічого не розпізналось","dictation.unsupported":"запис не підтримується в цьому браузері","dictation.liveError":"помилка live-транскрипції","dictation.connectionLost":"зʼєднання з транскрипцією обірвалось","dictation.noMic":"немає доступу до мікрофона","overview.branchesLiveIn":{one:"{count} гілка працює у {projects}",few:"{count} гілки працюють у {projects}",many:"{count} гілок працюють у {projects}",other:"{count} гілок працюють у {projects}"},"overview.projects":{one:"{count} проєкті",few:"{count} проєктах",many:"{count} проєктах",other:"{count} проєктах"},"overview.archived":"\xb7 {count} в архіві","overview.moreLive":"ще {count} live","overview.quiet":"тихо \xb7 остання активність {age}","overview.empty":"Логів поки нема","catalog.unreachable":"каталог недоступний","catalog.errorTitle":"Не вдалося завантажити каталог сесій","catalog.errorBody":"Сервер вʼювера не відповів, тож невідомо, що зараз працює.","catalog.retry":"Спробувати ще","catalog.attempts":{one:"{count} невдала спроба",few:"{count} невдалі спроби",many:"{count} невдалих спроб",other:"{count} невдалих спроб"},"orch.chat":"Оркестратор","orch.open":"Відкрити чат оркестратора","orch.starting":"Запускаю…","orch.error":"Не вдалося відкрити оркестратора — торкніться, щоб повторити","branch.live":"працює","branch.waiting":"закінчив хід — чекає відповіді","branch.returned":"повернувся з результатом","branch.stalled":"перервано або чекає дозволу","branch.done":"завершено — можна прибрати","branch.worktree":"Ворк-дерево {name}","branch.lastActivity":"Остання активність: {age}","branch.lastActivityQuiet":"Позначений активним, але транскрипт мовчить: остання активність {age}","branch.handoffTitle":"агент, породжений хендоффом цієї розмови","branch.branchTitle":"гілка цієї розмови","branch.accountTip":"Акаунт {id} \xb7 {engine} \xb7 {health}","branch.accountTipPlain":"Акаунт {id} \xb7 {engine}","branch.accountAria":"Відкрити акаунти для {id}","lineage.parentRemoved":"батьківську розмову видалено","lineage.parentRemovedTitle":"Транскрипт батьківської розмови видалено","branch.removeColumn":"Прибрати колонку {title}","branch.toggleBackground":"{action} фонову задачу {title}","branch.collapse":"Згорнути","branch.expand":"Розгорнути","branch.expandFull":"Розгорнути розмову {title} на все вікно","branch.collapseFull":"Повернутися до полотна (Esc)","branch.detailsShow":"Показати деталі розмови","branch.detailsHide":"Сховати деталі розмови","branch.favorite":"Додати в обране","branch.unfavorite":"Прибрати з обраного","tree.quiet":"Тихі розмови й задачі","taskStacks.collapse":"Згорнути картку назад у стек статусу","readiness.title":"Готовність задач","readiness.aria":"Секції готовності всіх задач проєкту","readiness.legend":"Зараз — призначено в роботу \xb7 На рев'ю — рев'ю триває або є вердикт \xb7 Заблоковано — потрібне рішення \xb7 Заплановано — інбокс/беклог \xb7 Готово — завершено","readiness.section.now":"Зараз","readiness.section.review":"На рев'ю","readiness.section.blocked":"Заблоковано","readiness.section.planned":"Заплановано","readiness.section.done":"Готово","readiness.sectionAria":"Задачі \xab{section}\xbb \xb7 {count}","readiness.open":"Відкрити задачу на дошці: {title}","readiness.place":"Розмістити задачу на мапі: {title}","readiness.issueAria":"Відкрити issue #{issue} на GitHub","readiness.agent":"агент","readiness.agentAria":"Відкрити призначеного агента: {title}","readiness.pipeline":"пайплайн","readiness.pipelineAria":"Відкрити стадію пайплайна: {title}","readiness.review":"рев'ю","readiness.reviewAria":"Відкрити пов'язане рев'ю: {title}","readiness.state.live":"живий","readiness.state.gone":"зник","readiness.state.failed":"збій","launchHistory.title":"Історія запусків","launchHistory.aria":"Термінальні квитанції запусків","launchHistory.failed":"невдалий","launchHistory.recovered":"відновлений","launchHistory.retryLabel":"Повторити","launchHistory.retry":"Повторити запуск: {title}","workerStack.title":"Згорнуті воркери","workerStack.aria":"Згорнуті розмови воркерів","workerStack.expandGroup":"Розгорнути групу ревʼю на дошці","workerStack.flow":"Потік","workerStack.pipeline":"Пайплайн","workerStack.origin":"Породжені","workerStack.worktree":"Воркери","corner.waitingCount":"\xb7 {count} чекають","corner.openSwitchboard":"Відкрити пульт агентів","task.working":", працює","task.interrupted":", перервано","task.finished":", закінчив","task.interruptedBadge":"перервано","task.finishedBadge":"завершено","task.stopFailed":"помилка зупинки","task.signalSent":"надіслано {signal} PID {pid}","task.killRequested":"запит на зупинку надіслано","task.confirmKill":"Точно вбити PID {pid}?","task.confirmKillNamed":"Зупинити {name}?","task.confirmKillUntitled":"цього агента","task.confirmKillYes":"Так, вбити","task.stopAria":"Зупинити процес PID {pid}","task.kill":"Вбити","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.closeNotification":"Закрити сповіщення","attention.badge":{one:"{count} чекає",few:"{count} чекають",many:"{count} чекають",other:"{count} чекають"},"attention.openQueue":"Черга уваги — хто заблокований на тобі (N — наступний)","attention.popoverTitle":"Чекають на тебе","attention.filterOn":"Показати лише тих, хто чекає на тебе (F)","attention.filterOff":"Показати всі вузли (F)","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту","mobile.mapLoading":"Завантаження карти…","mobile.marker.open":"Відкрити {title}","mobile.marker.node":"розмова","mobile.marker.deck":"рев'ю","mobile.marker.draft":"чернетка агента","mobile.marker.stack":"історія","mobile.marker.worker":"воркери","mobile.marker.task":"задача","mobile.marker.pipeline":"пайплайн","tasks.failed":"не вдалося ({status})","tasks.tool":"Задача — наступний клік кладе картку на полотно (T)","tasks.untitled":"без назви","tasks.newPlaceholder":"текст задачі… (перший рядок — назва)","tasks.newTask":"нова задача","tasks.panelCreate":"Створити задачу","tasks.unplaced":"без місця","tasks.placeOnMap":"розмістити на дошці","tasks.addDue":"дедлайн","tasks.clearDue":"Прибрати дедлайн","tasks.dueTitle":"Дедлайн (зона: {zone})","tasks.attachCount":{one:"{count} зображення",other:"{count} зображень"},"tasks.draftDiscarded":"чернетку відкинуто","tasks.editAria":"Текст задачі","tasks.spawning":"запускається…","tasks.deadChip":"розмови вже немає у списку","tasks.failedChip":"доставку не виконано","tasks.killedChip":"процес агента зупинено","tasks.unhostedChip":"агент зараз не запущений","tasks.migratingChip":"агент переходить на інший акаунт","tasks.source":"джерело","tasks.sourceTitle":"Взято з","tasks.retry":"повторити доставку","tasks.retryLaunch":"повторити запуск","tasks.retryLaunchAria":"Повторити невдалий запуск для {title}","tasks.retryLaunched":"агента перезапущено","tasks.chipFailedTitle":"не доставлено: {error}","tasks.handoffChip":"закинуто в промпт цього агента — ще не надіслано","tasks.detach":"відв'язати","tasks.detachAria":"Відв'язати {title} від задачі","tasks.expand":"Розгорнути задачу","tasks.collapse":"Згорнути задачу","tasks.openAgent":"відкрити й показати панель агента","tasks.openAgentAria":"Відкрити агента {title}","tasks.openAgentUnavailableAria":"Відкрити агента {title} — недоступно: {reason}","tasks.openSource":"відкрити й показати розмову-джерело","tasks.openSourceAria":"Відкрити розмову-джерело {title}","tasks.openSourceUnavailableAria":"Відкрити розмову-джерело {title} — недоступно: {reason}","tasks.sourceGone":"розмови-джерела немає на дошці","tasks.relatedNav":"Пов'язані задачі","tasks.openTaskAria":"Відкрити задачу {title}","tasks.relatedAssignedTitle":"призначена цій розмові","tasks.relatedSourceTitle":"записана з цієї розмови","tasks.send":"надіслати","tasks.sendTitle":"Потягни стрілку на панель агента — задача ляже в його промпт (нічого не надсилається); клік — створить чернетку нової розмови","tasks.linkHanded":"закинуто в \xab{title}\xbb — перевір і надішли там","tasks.linkSent":"задачу надіслано → \xab{title}\xbb","tasks.spawn":"агент","tasks.spawnTitle":"Запустити нового агента з цією задачею як брифом","tasks.spawnGo":"Запустити","tasks.statusTitle":"Статус: {label} — клік перемикає (інбокс → призначено → заблоковано → готово)","tasks.status.inbox":"інбокс","tasks.status.assigned":"призначено","tasks.status.blocked":"заблоковано","tasks.status.done":"готово","tasks.delete":"видалити","tasks.deleteConfirm":"точно?","tasks.deleteAria":"Видалити задачу {title}","tasks.pickerTitle":"Кому надіслати","tasks.pickerAllChildren":"⤷ всім дітям","tasks.pickerEmpty":"у проєкті немає розмов","tasks.pickerSend":"Надіслати ({count})","tasks.sendOk":"Доставлено {delivered} з {total}","tasks.sendFailPart":"✗ „{title}“: {error}","tasks.spawnOk":"агента запущено в tmux {target}","tasks.composerToggle":"створити задачу","tasks.composerToggleTitle":"Увімкнено — текст стає задачею-карткою з призначеннями на вибір; вимкнено — проста розсилка без сліду","tasks.composerNeedsText":"для задачі потрібен текст","tasks.panelTitle":"Задачі","tasks.panelToggleAria":"Показати або сховати панель задач","tasks.panelThisProject":"цей проєкт","tasks.panelAll":"всі","tasks.panelEmpty":"задач поки нема — кинь картку інструментом \xabзадача\xbb (T)","tasks.panelClose":"Закрити панель задач","favorites.sectionTitle":"Обране","favorites.empty":"обраного поки нема — наведи на картку й тапни корону","favorites.focusTitle":"Показати {title} на дошці","tasks.sheetNew":"нова задача","tasks.sheetCreate":"Створити задачу","tasks.sheetBack":"Назад до списку задач","tasks.sheetTargets":{one:"{count} адресат",few:"{count} адресати",many:"{count} адресатів",other:"{count} адресатів"},"tasks.sheetAssignments":"призначення","tasks.sheetEmpty":"задач поки нема","tasks.sheetGone":"задачі вже немає","tasks.textNotSaved":"текст не зберігся — надсилання скасовано, спробуй ще раз","tasks.emptyTextBlocked":"порожній текст не зберігається — віднови текст задачі перед надсиланням","runtime.live":"наживо","runtime.reconnecting":"перепідключення","runtime.degraded":"деградовано","runtime.offline":"офлайн","runtime.resynced":"пересинхронізовано","runtime.connection":"з'єднання рантайму","runtime.announce.live":"з'єднання рантайму наживо","runtime.announce.reconnecting":"рантайм перепідключається","runtime.announce.degraded":"рантайм деградовано — опитування оновлень","runtime.announce.offline":"рантайм офлайн","runtime.announce.resynced":"рантайм пересинхронізовано зі свіжого знімка","runtime.staleSince":"застаріло {duration}","runtime.lastKnown":"останнє оновлення {duration} тому","runtime.legacyProvenance":"легасі \xb7 похідний стан","staging.badge":"Стейджинг","staging.badgeTitle":"Стейджинг-інстанс — ізольований стан; нічого звідси не торкається проду","runtime.drift":"розбіжність: {evidence}","runtime.driftDismiss":"Сховати","runtime.receipt.pending":"надсилання…","runtime.receipt.busyRetry":"Не вдалося доставити — агент зайнятий, повторимо","runtime.receipt.summary":"Спроб доставки: {count}","runtime.receipt.pendingCount":"очікують: {count}","runtime.receipt.attemptCount":"спроб: {count}","runtime.receipt.problemCount":"проблем: {count}","runtime.receipt.showDetails":"Показати деталі доставки","runtime.receipt.hideDetails":"Сховати деталі доставки","runtime.receipt.statusSummary":"Стан доставки: {pending}, {problems}.","runtime.receipt.statusPending":{one:"{count} повідомлення очікує",few:"{count} повідомлення очікують",many:"{count} повідомлень очікують",other:"{count} повідомлень очікують"},"runtime.receipt.statusProblems":{one:"{count} проблема",few:"{count} проблеми",many:"{count} проблем",other:"{count} проблем"},"runtime.receipt.delivering":"доставляється…","runtime.receipt.applying":"застосовується…","runtime.receipt.turn-started":"хід почато","runtime.receipt.steered":"вкладено в поточний хід","runtime.receipt.queued":"у черзі","runtime.receipt.queuedPos":"у черзі \xb7 #{position}","runtime.receipt.delivered":"доставлено","runtime.receipt.applied":"зміну застосовано","runtime.receipt.interrupted":"перервано","runtime.receipt.answered":"відповіджено","runtime.receipt.rejected":"відхилено: {reason}","runtime.receipt.failed":"збій: {reason}","runtime.receipt.uncertain":"невизначено — відновлення","runtime.receipt.retry":"Повторити","runtime.receipt.edit":"Змінити й надіслати","runtime.receipt.dismiss":"Прибрати","runtime.attention.title":"потрібне твоє рішення","runtime.attention.approval":"підтвердження","runtime.attention.permission":"дозвіл","runtime.attention.question":"питання","runtime.attention.waiting_heuristic":"можливо, чекає","runtime.attention.heuristicNote":"сигнал низької впевненості","runtime.attention.unowned":"немає відповідального","runtime.attention.command":"команда","runtime.attention.tool":"інструмент","runtime.attention.approve":"Схвалити","runtime.attention.deny":"Відхилити","runtime.attention.answer":"Відповісти","runtime.attention.answering":"відповідаю…","runtime.attention.expiresIn":"авторішення через {seconds}с","runtime.attention.keysHint":"Enter схвалює \xb7 Esc відхиляє","voice.start":"Почати безперервну голосову розмову","voice.stop":"Завершити голосову розмову","voice.connecting":"Підключаю голос…","voice.live":"Голосова розмова активна \xb7 говоріть у будь-який момент","voice.stopping":"Завершую голосову розмову…","voice.failed":"Голосове зʼєднання потребує уваги","voice.panel":"Голосова розмова","voice.you":"Ви","voice.agent":"Агент","voice.progress":"Перебіг","voice.retry":"Спробувати ще раз","voice.ended":"Голосову розмову завершено","voice.elapsed":"Тривалість дзвінка","voice.micLevel":"Рівень мікрофона","voice.micMute":"Вимкнути мікрофон","voice.micUnmute":"Увімкнути мікрофон","voice.outputMute":"Приглушити агента","voice.outputUnmute":"Увімкнути звук агента","voice.floatSurface":"Голосова розмова","voice.float":"Відкрити плавуче вікно голосу","voice.dock":"Закрити плавуче вікно, не завершуючи розмову","voice.floatUnsupported":"Плавуче вікно голосу потребує браузера на Chromium; розмова лишається тут.","attention.return":"Назад, де ви були","attention.returnLine":"Повернутися туди, де ви були"}},a="llv_lang",s="en",l=!1,o=new Set;function c(){return l||(l=!0,s=function(){try{let e=window.localStorage.getItem(a);if("en"===e||"uk"===e)return e}catch{}return("u">typeof navigator?navigator.language:"").toLowerCase().startsWith("uk")?"uk":"en"}(),document.documentElement.lang=s),s}function d(e){if(l=!0,e!==s){s=e;try{window.localStorage.setItem(a,e)}catch{}for(let t of("u">typeof document&&(document.documentElement.lang=e),o))t()}}function u(e){return o.add(e),()=>o.delete(e)}function p(e,t,n){var r;let a,s=i[e][t]??i.en[t]??t;if("string"==typeof s)a=s;else{let t="number"==typeof n?.count?n.count:0;a=s[new Intl.PluralRules("uk"===e?"uk-UA":"en-US").select(t)]??s.other??s.one??""}return r=a,n?r.replace(/\{(\w+)\}/g,(e,t)=>t in n?String(n[t]):e):r}function m(){let e=(0,r.useSyncExternalStore)(u,c,()=>"en");return{locale:e,t:(t,n)=>p(e,t,n),setLocale:d}}},5301:(e,t,n)=>{"use strict";n.d(t,{O:()=>s});var r=n(2115);let i="(pointer: coarse)";function a(e){let t=window.matchMedia(i);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function s(){return(0,r.useSyncExternalStore)(a,()=>window.matchMedia(i).matches,()=>!1)}},5606:(e,t,n)=>{"use strict";function r(e){return"viewer"===e||e.startsWith("viewer-")||e.startsWith("viewer_")||"agent-log-viewer"===e||e.startsWith("agent-log-viewer-")}function i(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function a(e){return"string"==typeof e?e.trim():""}function s(e,t=120){let n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function l(e){let t=a(e.conversationId);return t?[{kind:"conversation",id:t,label:"Open agent",href:`#c=${encodeURIComponent(t)}`}]:[]}function o(e,t){return a(e[`${t}Id`])||a(i(e[t]).id)}function c(e,t){return t?[{kind:e,id:t,label:"task"===e?"Open task":"Open pipeline",href:`#${e}=${encodeURIComponent(t)}`}]:[]}function d(e,t){return[!0===e.replay||!0===e.replayed?"Replay":"",t].filter(Boolean).join(" \xb7 ")}function u(e,t,n){let r=i(t),u=i(n);if("spawn_agent"===e){let e=[[a(r.model)||a(r.engine),a(r.effort),a(r.role)].filter(Boolean).join(" "),s(a(r.prompt))].filter(Boolean).join(" \xb7 ")||"new worker";return{icon:"bot",verb:"Creating",title:`Creating agent: ${e}`,subtitle:a(u.transcriptPath),links:l(u)}}if("send_message"===e){let e=a(u.conversationId)||a(r.conversationId);return{icon:"message",verb:"Sending",title:`Sending message${e?` to ${e}`:""}: ${s(a(r.text))||"message"}`,subtitle:d(u,a(u.operationId)),links:e?[{kind:"conversation",id:e,label:"Open conversation",href:`#c=${encodeURIComponent(e)}`}]:[]}}if("create_task"===e){let e=o(u,"task");return{icon:"task",verb:"Creating",title:`Creating task: ${s(a(r.text))||"untitled task"}`,subtitle:d(u,a(r.project)),links:c("task",e)}}if("update_task"===e){let e=o(u,"task")||a(r.taskId),t=a(r.status)||s(a(r.text))||"details";return{icon:"task",verb:"Updating",title:`Updating task${e?` ${e}`:""}: ${t}`,subtitle:d(u,""),links:c("task",e)}}if("create_pipeline"===e){let e=o(u,"pipeline");return{icon:"pipeline",verb:"Creating",title:`Creating pipeline: ${s(a(r.task))||"untitled pipeline"}`,subtitle:d(u,a(r.repoDir)),links:c("pipeline",e)}}if("pipeline_action"===e){let e=o(u,"pipeline")||a(r.pipelineId),t=a(r.action)||"update",n={start:"Starting",pause:"Pausing",resume:"Resuming","retry-stage":"Retrying","skip-stage":"Skipping stage in",close:"Closing",delete:"Deleting"};return{icon:"pipeline",verb:n[t]??"Updating",title:`${n[t]??"Updating"} pipeline${e?` ${e}`:""}`,subtitle:d(u,t),links:c("pipeline",e)}}if("link_task_to_pipeline"===e){let e=a(u.taskId)||a(r.taskId),t=a(u.pipelineId)||a(r.pipelineId);return{icon:"link",verb:"Linking",title:`Linking task to pipeline: ${e||"task"} → ${t||"pipeline"}`,subtitle:d(u,""),links:[...c("task",e),...c("pipeline",t)]}}if("list_conversations"===e){let e=a(r.project)||a(r.query);return{icon:"conversation",verb:"Listing",title:`Listing conversations${e?`: ${s(e)}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} found`:""),links:[]}}if("get_conversation"===e){let e=a(u.conversationId)||a(r.conversationId),t=a(u.transcriptPath)||a(r.transcriptPath),n=e?[{kind:"conversation",id:e,label:"Open conversation",href:`#c=${encodeURIComponent(e)}`}]:[];return{icon:"conversation",verb:"Opening",title:`Opening conversation: ${e||t||"conversation"}`,subtitle:d(u,t),links:n}}if("deploy_exact_sha"===e){let e=a(u.revision)||a(r.revision);return{icon:"deploy",verb:"Deploying",title:`Deploying release ${e?e.slice(0,12):"(current HEAD)"}`,subtitle:d(u,a(u.deploymentId)),links:[]}}if("get_pipeline"===e){let e=o(u,"pipeline")||a(r.pipelineId);return{icon:"pipeline",verb:"Opening",title:`Opening pipeline: ${e||"pipeline"}`,subtitle:d(u,a(i(u.pipeline).state)),links:c("pipeline",e)}}if("board_snapshot"===e)return{icon:"conversation",verb:"Reading",title:`Reading board snapshot${a(r.project)?`: ${s(a(r.project))}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} conversations`:""),links:[]};if("list_flows"===e)return{icon:"pipeline",verb:"Listing",title:`Listing flows${a(r.project)?`: ${s(a(r.project))}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} found`:""),links:[]};if("get_flow"===e){let e=a(r.flowId)||a(u.flowId);return{icon:"pipeline",verb:"Opening",title:`Opening flow: ${e||"flow"}`,subtitle:d(u,a(i(u.flow).state)),links:[]}}if("flow_action"===e){let e=a(r.flowId)||a(u.flowId),t=a(r.action),n={pause:"Pausing",resume:"Resuming",advance:"Advancing","retry-round":"Retrying","cancel-round":"Cancelling round in",extend:"Extending","another-round":"Starting another round in",close:"Closing"}[t]??"Updating";return{icon:"pipeline",verb:n,title:`${n} flow${e?` ${e}`:""}`,subtitle:d(u,t),links:[]}}if("list_pipelines"===e)return{icon:"pipeline",verb:"Listing",title:`Listing pipelines${a(r.project)?`: ${s(a(r.project))}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} found`:""),links:[]};if("conversation_action"===e){let e=a(u.conversationId)||a(r.conversationId),t={interrupt:"Interrupting",kill:"Killing",resume:"Resuming",compact:"Compacting","dialog-key":"Answering dialog in"}[a(r.action)]??"Controlling";return{icon:"message",verb:t,title:`${t} conversation${e?` ${e}`:""}`,subtitle:d(u,a(u.operationId)),links:e?[{kind:"conversation",id:e,label:"Open conversation",href:`#c=${encodeURIComponent(e)}`}]:[]}}if("operator_snapshot"===e)return{icon:"conversation",verb:"Reading",title:"Reading operator snapshot",subtitle:d(u,a(i(u.view).mode)),links:[]};if("list_tasks"===e)return{icon:"task",verb:"Listing",title:`Listing tasks${a(r.project)?`: ${s(a(r.project))}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} found`:""),links:[]};if("get_task"===e){let e=o(u,"task")||a(r.taskId);return{icon:"task",verb:"Opening",title:`Opening task: ${e||"task"}`,subtitle:d(u,a(i(u.task).status)),links:c("task",e)}}if("deployment_status"===e){let e=a(r.deploymentId)||a(u.deploymentId)||a(r.operationId)||a(u.operationId);return{icon:"deploy",verb:"Reading",title:`Reading deployment status${e?`: ${e}`:""}`,subtitle:d(u,a(i(u.deployment).state)||a(i(i(u.operation).receipt).status)),links:[]}}if("resources"===e)return{icon:"tool",verb:"Reading",title:"Reading resources",subtitle:d(u,Array.isArray(u.sessions)?`${u.sessions.length} sessions`:""),links:[]};if("conversation_migration"===e){let e=a(u.conversationId)||a(r.conversationId),t={reseat:"Reseating",retry:"Retrying",rollback:"Rolling back"}[a(r.action)]??"Migrating";return{icon:"conversation",verb:t,title:`${t} conversation migration${e?` for ${e}`:""}`,subtitle:d(u,a(u.operationId)),links:e?[{kind:"conversation",id:e,label:"Open conversation",href:`#c=${encodeURIComponent(e)}`}]:[]}}if("agent_activity"===e){let e=a(r.conversationId)||a(r.project)||"all live agents",t="number"==typeof u.stalledCount?u.stalledCount:null,n="number"==typeof u.count?`${u.count} checked`:"";return{icon:"conversation",verb:"Checking",title:`Checking agent activity: ${s(e)}`,subtitle:d(u,[n,t?`${t} stalled`:""].filter(Boolean).join(" \xb7 ")),links:l(r)}}if("lifecycle_events"===e){let e="digest"===a(r.mode),t=i(u.relay),n=Array.isArray(t.items)?t.items.length:0,l=a(r.pipelineId)||a(r.conversationId)||a(r.project),o=e?u.relay?`${a(t.reason)} relay \xb7 ${n} change(s)`:"nothing due":"number"==typeof u.count?`${u.count} event(s)`:"";return{icon:"pipeline",verb:e?"Polling":"Reading",title:`${e?"Polling lifecycle digest":"Reading lifecycle events"}${l?`: ${s(l)}`:""}`,subtitle:d(u,o),links:c("pipeline",a(r.pipelineId))}}if("request_attention"===e){let e=i(r.target),t=a(e.kind)||"target",n="open"===a(r.intent);return{icon:"conversation",verb:"Asking",title:`Asking to ${n?"open":"show"} a ${t}`,subtitle:d(u,s(a(r.reason))),links:"conversation"===t&&a(e.path)?[]:c("task"===t?"task":"pipeline",a(e.taskId)||a(e.pipelineId))}}return{icon:"tool",verb:"Running",title:`Running MCP tool: ${e||"unknown"}`,subtitle:"",links:[]}}n.d(t,{I:()=>r,Y:()=>u})},6027:(e,t,n)=>{"use strict";function r(e,t=160){let n=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~#>]+/g,"").replace(/\s+/g," ").trim().replace(/(?:\/[^\s)]+){3,}/g,e=>{if(e.length<=40)return e;let t=e.split("/").filter(Boolean);return t.length>=2?".../"+t.slice(-2).join("/"):e}).replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1).trimEnd()+"…":n}n.d(t,{cr:()=>r})},6505:(e,t,n)=>{"use strict";n.d(t,{$:()=>v,IR:()=>w,T0:()=>l,cr:()=>a.cr,gA:()=>j,oC:()=>b,rK:()=>s,t7:()=>y,tz:()=>o,yj:()=>k,yz:()=>S,zZ:()=>N});var r=n(7532),i=n(4654),a=n(6027);function s(e){let t=(0,i.JK)(),n=Date.now()/1e3-e;return n<90?(0,i.Tl)(t,"time.agoSec",{n:Math.round(n)}):n<5400?(0,i.Tl)(t,"time.agoMin",{n:Math.round(n/60)}):n<129600?(0,i.Tl)(t,"time.agoHour",{n:Math.round(n/3600)}):(0,i.Tl)(t,"time.agoDay",{n:Math.round(n/86400)})}function l(e){if("string"!=typeof e&&"number"!=typeof e)return"";let t=new Date(e),n="uk"===(0,i.JK)()?"uk-UA":"en-US";return Number.isNaN(t.getTime())?"":t.toLocaleTimeString(n,{hour12:!1})}function o(e){return"live"===e?"animate-pulse bg-success":"recent"===e?"bg-warning":"stalled"===e?"bg-danger":"bg-strong"}let c={codex:"#2f6fd0",claude:"#d97757"},d="#9a9aa4",u=[[/fable|mythos/,"#c2410c"],[/opus/,"#8a5ad6"],[/sonnet/,"#e0913f"],[/haiku/,"#d9a58c"]],p=[[/terra/,"#2b7a62"],[/sol/,"#a55b18"],[/spark/,"#5ea3e4"],[/mini|nano/,"#7fb1e8"],[/codex/,"#1d55ab"]];function m(e,t,n,r){let i=Math.round(e),a=Math.round(t),s=Math.round(n),l=`hsl(${i} ${a}% ${s}%)`,o=`hsl(${i} ${Math.min(a,78)}% ${Math.round(r)}%)`;return{color:`light-dark(${l}, ${o})`,soft:`hsl(${i} ${a}% ${s}% / 0.14)`}}function f(e){let[t,n,r]=g(e);return m(t,n,r,Math.max(r,68))}function h(e){let t=c[e.engine];if(!t)return d;let n=(e.model??"").toLowerCase();for(let[t,r]of"codex"===e.engine?p:u)if(t.test(n))return r;return t}let x={minimal:{dl:20,ds:-32},low:{dl:12,ds:-20},medium:{dl:0,ds:0},high:{dl:-8,ds:12},xhigh:{dl:-14,ds:22},max:{dl:-19,ds:30},ultra:{dl:-24,ds:36}};function g(e){let t=parseInt(e.slice(1),16),n=(t>>16&255)/255,r=(t>>8&255)/255,i=(255&t)/255,a=Math.max(n,r,i),s=Math.min(n,r,i),l=(a+s)/2,o=a-s;if(0===o)return[0,0,100*l];let c=o/(1-Math.abs(2*l-1));return[60*(a===n?((r-i)/o+6)%6:a===r?(i-n)/o+2:(n-r)/o+4),100*c,100*l]}function b(e){let t=h(e),n=x[e.effort??""];if(!n)return f(t);let[r,i,a]=g(t),s=(e,t=0,n=100)=>Math.min(n,Math.max(t,e));return m(r,s(i+n.ds),s(a+n.dl),s(72-n.dl,58,90))}function v(e){return e.effort?(0,i.Tl)((0,i.JK)(),"util.effortTitle",{effort:e.effort}):void 0}function w(e){return(0,r.IR)(e.engine,e.model,e.effort)}function y(e){return f(c[e]??d)}function k(e){return f(h(e)).color}function j(e){return{backgroundColor:f(h(e)).color}}function N(e){let t=f(c[e]??d);return{label:({codex:"Codex",claude:"Claude",shell:"Bash"})[e]??e,style:{backgroundColor:t.soft,color:t.color}}}function S(e){return N(e.engine)}},7532:(e,t,n)=>{"use strict";n.d(t,{IR:()=>o,Lw:()=>r,TS:()=>c,ve:()=>l,z9:()=>i});let r={claude:["low","medium","high","xhigh","max"],codex:["low","medium","high","xhigh"]};function i(e,t){return r[e].includes(t)}let a=["minimal","low","medium","high","xhigh","max","ultra"],s=[[/^gpt-5\.6-(sol|terra)\b/,["low","medium","high","xhigh","max","ultra"]],[/^gpt-5\.6\b/,["low","medium","high","xhigh","max"]]];function l(e,t){if("claude"===e)return r.claude;if("codex"!==e)return null;let n=(t??"").trim().toLowerCase();for(let[e,t]of s)if(e.test(n))return t;return r.codex}function o(e,t,n){let r=l(e,t),i=(n??"").trim().toLowerCase();if(!r||!i)return{level:0,slots:0};let s=r.length,o=r.indexOf(i);if(o>=0)return{level:o+1,slots:s};let c=a.indexOf(i);return c<0?{level:0,slots:0}:{level:Math.min(Math.max(r.filter(e=>a.indexOf(e)<c).length,1),s),slots:s}}function c(e,t,n){let r=l(e,t);if(!r||0===r.length)return null;let i=(n??"").trim().toLowerCase();if(r.includes(i))return i;let{level:a}=o(e,t,i);return a>0?r[a-1]:r[0]}},8074:(e,t,n)=>{"use strict";n.d(t,{copyText:()=>o,i:()=>c});var r=n(5155),i=n(2115),a=n(5301),s=n(9992),l=n(1541);async function o(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=document.execCommand("copy");return t.remove(),n}catch{return!1}}function c({text:e,label:t,className:n=""}){let d=(0,a.O)(),[u,p]=(0,i.useState)(!1),m=(0,i.useRef)(null);(0,i.useEffect)(()=>()=>{null!==m.current&&window.clearTimeout(m.current)},[]);let f=u?(0,l.tr)("common.copied"):t??(0,l.tr)("common.copy");return(0,r.jsx)("button",{type:"button","aria-label":f,title:f,onClick:t=>{t.preventDefault(),t.stopPropagation(),o(e).then(e=>{e&&(p(!0),null!==m.current&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>p(!1),1400))})},className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-card text-muted shadow-1 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${d?"h-11 w-11":"p-1"} ${n}`,children:u?(0,r.jsx)(s.Jl,{className:d?"h-4 w-4 text-success":"h-3 w-3 text-success","aria-hidden":!0}):(0,r.jsx)(s.QR,{className:d?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})}},9097:(e,t,n)=>{Promise.resolve().then(n.bind(n,1834))},9375:(e,t,n)=>{"use strict";n.d(t,{en:()=>r});let r={"common.serverUnavailable":"server unavailable","common.loading":"loading…","common.loadingCap":"Loading…","common.cancel":"Cancel","common.edit":"edit","common.show":"show","common.showAll":"show all","common.collapse":"collapse","common.copy":"Copy","common.copied":"copied","common.clickToCopy":"click to copy","common.yes":"Yes","common.no":"No","common.send":"Send","common.sending":"sending…","common.sent":"sent","common.close":"Close","common.failedSend":"couldn't send","common.failedDelete":"couldn't delete","common.nothingFound":"Nothing found","common.nothingRunning":"nothing is running right now","common.kb":"kB","common.chars":"{n} chars","lang.aria":"Interface language","util.effortTitle":"Reasoning effort: {effort}","runtimeConfig.model":"Running agent model","runtimeConfig.effort":"Running agent reasoning effort","runtimeConfig.speedTitle":"Fast uses the Codex priority service tier","runtimeConfig.apply":"Apply","runtimeConfig.failed":"Could not change the running agent configuration","runtimeConfig.pending":"switch pending","runtimeConfig.applied":"Conversation settings applied","time.agoSec":"{n}s ago","time.agoMin":"{n}m ago","time.agoHour":"{n}h ago","time.agoDay":"{n}d ago","turn.worked":"Worked for {d}","turn.running":"working {d}","turn.lastRun":"last run: {d}","turn.timer":"elapsed work time","kind.session":"session","kind.subagent":"subagent","kind.job":"job","kind.background":"background","kind.handoff":"handoff","rail.title":"Agent logs","rail.filter":"Filter projects…","rail.projects":"Projects","rail.overview":"Overview","rail.archive":"Archive","dash.branchesLive":{one:"{count} branch running",other:"{count} branches running"},"dash.trees":{one:"{count} tree",other:"{count} trees"},"dash.recentConvos":{one:"{count} recent conversation",other:"{count} recent conversations"},"dash.quietTrees":{one:"{count} quiet tree",other:"{count} quiet trees"},"dash.openProjects":"Open project list","dash.createMenu":"Create","dash.moreMenu":"More actions","dash.soundMenu":"Sound alerts","dash.unarchive":"Restore from archive","dash.newConvo":"New conversation with an agent","dash.agent":"Agent","dash.newWorkflow":"New workflow: stages → review → PR","dash.workflow":"Workflow","dash.task":"Task","dash.newTask":"New task","dash.pipelinesUnavailable":"Pipelines are temporarily unavailable: the pipelines state file could not be read. Other panels stay live.","dash.loadingBoard":"Loading the board…","dash.emptyTitle":"The scheme is empty for now","dash.emptyHint":"Open the switchboard in the bottom-right corner and click a conversation — it will appear here","dash.viewScheme":"scheme","dash.viewList":"conversations","dash.viewSchemeMenu":"View: scheme","dash.viewListMenu":"View: conversations","dash.viewMenuGroup":"Board view","dash.hiddenShelf":"Hidden","trash.title":"Root conversations","trash.hint":"Clicking a row opens the conversation as a node; the trash icon deletes its file from disk permanently.","trash.deletedFromDisk":"\xb7 deleted from disk","trash.open":"Open {title}","trash.activeSubtree":"active branches","trash.toArchive":"Archive","trash.notDeleted":"{failed} of {total} not deleted","trash.confirmDelete":{one:"Delete {count} project file from disk?",other:"Delete {count} project files from disk?"},"trash.deleting":"deleting…","trash.confirmYes":"Yes, delete","trash.deleteProject":"Delete project from disk","trash.projectLoadFailed":"Could not load every project conversation","list.title":"All conversations","list.hint":"Loaded in recent-first pages from every conversation stored for this project.","list.searchHint":"Searching every conversation stored across all projects.","list.loadMore":"Load more conversations","list.failed":"Could not load conversations","list.retry":"Retry","switch.aria":"Agent switchboard","switch.title":"Switchboard","switch.search":"Search title, first prompt, or project","switch.results":"All conversation results","switch.updating":"updating…","switch.close":"Close switchboard","switch.waiting":"Waiting for you","switch.working":"Working","switch.recent":"Recent","switch.older":"Older","switch.hidden":"Hidden ({count})","switch.hide":"hide","switch.restore":"restore","accounts.activeAria":"Active Codex account","accounts.placeholder":"Codex account","accounts.add":"Add","accounts.prompt":"Account label","accounts.login":"login","accounts.switchFailed":"Could not switch account","accounts.conversationTitle":"Run this conversation on","accounts.conversationPending":"Account switch pending","accounts.conversationApplied":"Conversation account switched","accounts.manage":"Manage accounts…","accounts.addFailed":"Could not add account","accounts.loginOpened":"Device login opened in {target}","accounts.openLogin":"Open sign-in","accounts.refreshFailed":"Could not refresh accounts. Try again.","accounts.loading":"Loading accounts…","accounts.noAccounts":"No accounts available yet.","limits.accountLoading":"Loading account limits…","accounts.retry":"Retry","accounts.title":"Codex accounts","accounts.trigger":"Accounts","accounts.active":"active","accounts.needsLogin":"needs sign-in","accounts.pendingLogin":"signing in…","accounts.auth.authenticated":"Authenticated","accounts.auth.signedOut":"Signed out","accounts.auth.unknown":"Auth unchecked","accounts.auth.error":"Auth error","accounts.operation.refresh":"Refreshing accounts…","accounts.operation.add":"Starting account sign-in…","accounts.operation.switch":"Switching the account for future launches…","accounts.operation.login":"Updating sign-in…","accounts.operation.remove":"Removing account…","accounts.operation.terminal":"Preparing the account command…","accounts.terminalCopied":"Command copied for {label}","accounts.terminalFailed":"Could not prepare the command for {label}","accounts.copyCli":"Copy CLI","accounts.copyCliAria":"Copy the agent command for {label}","accounts.labelPlaceholder":"New account label","accounts.confirmAdd":"Add","accounts.close":"Close","accounts.remove":"Remove","accounts.removeAria":"Remove {label}","accounts.removeConfirm":"Remove this account? Its past conversations stay readable.","accounts.removeConfirmCta":"Confirm","accounts.removeConfirmCancel":"Cancel","accounts.removeBlocked":"{label} still has an active session or sign-in.","accounts.removeHistoryBlocked":"{label} still runs live conversations. Wait for them to finish, then remove it.","accounts.removeFailed":"Could not remove this account.","accounts.cleanupPending":"{label} was removed. Its local data still needs cleanup.","accounts.cleanupManual":"Some local account data failed safety checks. Inspect and remove it manually.","accounts.cleanupFailed":"Could not clean up abandoned homes.","accounts.forceRemove":"Force remove","accounts.cleanupOrphans":"Clean up abandoned homes","accounts.titleFor":"{engine} accounts","accounts.triggerAria":"{engine} accounts — switch or add","accounts.effective":"{pct}%","accounts.effectiveTip":"{window} binds","accounts.effectiveStale":"{window} binds \xb7 stale","accounts.limitsAria":"Quota windows for {label}","accounts.limitsStale":"Last known values","accounts.limitsStaleTip":"Last known values — not a live read","accounts.claudeLoginStarted":"Sign-in started for {label}","accounts.claudeLogin.starting":"Starting sign-in…","accounts.claudeLogin.awaitingBrowser":"Waiting for the sign-in link…","accounts.claudeLogin.openLink":"Open claude.ai sign-in","accounts.claudeLogin.codeLabel":"Authorization code","accounts.claudeLogin.codePlaceholder":"Paste the code from the browser","accounts.claudeLogin.codeHint":"After signing in, copy the code claude.ai shows and paste it here.","accounts.claudeLogin.submit":"Submit code","accounts.claudeLogin.verifying":"Verifying…","accounts.claudeLogin.canceling":"Canceling…","accounts.claudeLogin.cancel":"Cancel","accounts.claudeLogin.signIn":"Sign in","accounts.claudeLogin.groupAria":"{label} sign-in","accounts.claudeLogin.err.timed_out":"Sign-in timed out.","accounts.claudeLogin.err.interrupted":"Sign-in was interrupted by a restart.","accounts.claudeLogin.err.verification_failed":"The code could not be verified.","accounts.claudeLogin.err.input_failed":"The code could not be submitted.","accounts.claudeLogin.err.login_busy":"Another sign-in is already in progress.","accounts.claudeLogin.err.generic":"Sign-in could not start. Try again.","accounts.claudeLogin.announceCodeReady":"Sign-in link ready for {label}. Open it and paste the code.","accounts.claudeLogin.announceDone":"{label} signed in.","migrate.confirmTitle":"Switch {engine} to \xab{label}\xbb?","migrate.confirmBody":"New agents use \xab{label}\xbb immediately. {idle} active sessions switch now; {busy} switch after their current turn; {deferred} inactive conversations switch when you message them again.","migrate.confirmCta":"Switch account","migrate.confirmAllCta":"Migrate all ({total})","migrate.confirmCancel":"Cancel","migrate.retargetTitle":"Redirect migration to \xab{label}\xbb?","migrate.retargetBody":"A migration to \xab{current}\xbb is still running. New agents use \xab{label}\xbb immediately; active sessions redirect there, while inactive conversations move when you message them. Migrate all also moves deferred history and previously moved conversations now.","migrate.banner":"Migrating to \xab{label}\xbb — {done}/{total} done","migrate.bannerWaiting":"{n} waiting on turns","migrate.bannerFailed":"{n} failed","migrate.bannerAria":"{engine} migration progress","migrate.stop":"Stop migration","migrate.bannerRetryFailed":"Retry failed ({n})","migrate.stoppedNotice":"Migration stopped. Remaining sessions stay on their current account; new agents keep using \xab{label}\xbb.","migrate.failedNotice":"{n} sessions couldn't move to \xab{label}\xbb.","migrate.completeNotice":"All {engine} sessions now on \xab{label}\xbb","migrate.announceComplete":"All {engine} sessions now on {label}","migrate.cardPending":"Account switch pending — after current turn","migrate.cardSwitching":"Switching to \xab{label}\xbb…","migrate.cardFailed":"Account switch failed","migrate.cardRetry":"Retry","migrate.cardKeep":"Keep on \xab{label}\xbb","migrate.ribbonAria":"Account migration status","migrate.divider":"Continued from \xab{label}\xbb — previous transcript archived","migrate.openPrevious":"Open previous transcript","migrate.heldSend":"Message held — delivers after the switch","migrate.readOnlyPredecessor":"Archived — this conversation continued under \xab{label}\xbb","migrate.retryFailed":"Couldn't retry the switch","migrate.keepFailed":"Couldn't keep this session on its current account","migrate.recoveryFailed":"{detail}","autobalance.title":"Auto balance","autobalance.desc":"Switches this engine's sessions when the active account drops below {threshold}% and another has more.","autobalance.toggleAria":"Auto balance for {engine}","autobalance.idle":"Last check {time} \xb7 no switch needed","autobalance.waitingFresh":"Paused — waiting for fresh quota data","autobalance.cooldown":"Cooldown — next check in {n} min","autobalance.draining":"Balancing now…","autobalance.switched":"Switched to \xab{to}\xbb at {time} — \xab{from}\xbb fell to {pct}% ({window})","autobalance.bannerTag":"Auto","autobalance.override":"Auto balance suggested \xab{to}\xbb; your choice takes over.","limits.windowSession":"5h window","limits.windowWeekly":"weekly window","switchCard.openColumn":"Open {title} as a column","switchCard.remove":"Remove from switchboard","composer.imagesCount":{one:"{count} image",other:"{count} images"},"composer.spawned":"launched agent in tmux {target}","composer.sentPaths":"sent {count} path(s)","composer.failedInterrupt":"couldn't interrupt","composer.escapeSent":"sent Escape — agent interrupted","composer.spawnAria":"Launch an agent with a prompt","composer.resolvingAria":"Message the existing agent — delivery starts after its host is resolved","composer.sendAria":"Send a message to the agent in tmux {target}","composer.sendStructuredAria":"Send a message through the structured runtime host","composer.queueAria":"Queue of sent messages","composer.removeFromQueue":"Remove from queue","composer.deliveryHeld":"Held for \xab{label}\xbb — delivers after the account switch","composer.admissionTimedOut":"Delivery confirmation timed out. Checking the durable receipt; your message remains preserved.","composer.deliveryUnconfirmed":"Delivery couldn't be confirmed. Your message is preserved — send again to retry safely; the same message key is reused.","composer.runtimePill":"Model and reasoning — applies to your next message","composer.reasoningGroup":"Reasoning","composer.modelGroup":"Model","composer.speedGroup":"Speed","composer.speedStandard":"Standard","composer.speedFastTier":"Fast — priority tier","composer.backTo":"Back","composer.nextMessageUses":"Next message: {model} \xb7 {effort}","composer.settingsNextResume":"applies when the conversation is next resumed","composer.structuredImagesUnavailable":"Image delivery is unavailable for structured conversations","composer.codexImagesTextOnly":"The selected Codex model accepts text input only.","composer.structuredImagesProtocol":"This structured host has no negotiated image capability.","composer.imagesBlockedDuringRecovery":"Drafted images will be sent after the host recovers; text can be sent right away.","composer.imageCapabilityLoading":"Image capability is loading.","composer.imageCapabilityError":"Image capability could not be loaded.","composer.imageCapabilityRetry":"Retry image check","composer.attachTerminal":"Attach terminal viewer","composer.attachTerminalReady":"terminal viewer ready in tmux {target}","composer.attachTerminalFailed":"couldn't create the terminal viewer","composer.receiptHeld":"held","composer.receiptQueued":"queued","composer.receiptRecovering":"recovering","composer.receiptFailed":"not delivered","composer.deliveredEcho":"Delivered — appearing in the feed","composer.retrySend":"Retry send","composer.placeholderRelay":"type — I'll relay through the root session…","composer.placeholderSpawn":"prompt — the agent will start…","composer.placeholderResolving":"message the agent — reconnecting to its session…","composer.placeholderSend":"message the agent…","composer.textAria":"Text for the agent","composer.optionsShow":"Show message options","composer.optionsHide":"Hide message options","composer.titleRelay":"relayed through the branch's root session","composer.titleSpawnResumed":"starts a fresh agent session that continues this conversation","composer.root":"root","composer.interruptAria":"Interrupt the agent (Escape)","composer.interruptTitle":"send Escape to the agent pane","composer.compactAria":"Compact the agent's context (/compact)","composer.compactTitle":"send /compact — the agent condenses its context; a band appears in the feed when done","composer.compactConfirm":"Compact?","composer.compactConfirmTitle":"Click again to send /compact","composer.compactSent":"compaction started — the band will appear in the feed once it's done","composer.failedCompact":"couldn't start compaction","composer.addImages":"Add images","composer.moreTools":"More actions","composer.stopAndSend":"Stop recording and send","composer.launchAgent":"Launch the agent","composer.sendToAgent":"Send to the agent","composer.stopAndSendTitle":"stop recording and send","composer.sendMenuTitle":"Send options","composer.quickAck":"Yes, continue","composer.quickAckLabel":"Continue","composer.quickAckAria":"Send a quick “Yes, continue” to the agent","composer.quickAckTitle":"Quick reply — yes, continue","strip.live":"live","strip.resume":"resume","strip.deadMode":"dead host","strip.moreActions":"More actions","strip.stopSubagent":"interrupts the root agent","strip.compactSubagent":"not available for subagents","strip.structuredUnsupported":"the structured host does not support this action yet","strip.resolving":"resolving the agent host…","deadHost.title":"Agent inactive \xb7 {since} — messages will queue","deadHost.body":"Text you send now is saved durably and delivered after the host recovers. Images can't be attached until then. Pending approvals expired — recover with the controls below.","deadHost.respawn":"Respawn conversation","deadHost.attach":"Open in terminal","deadHost.recheck":"Re-check","deadHost.recheckFailed":"Couldn't reach the runtime — try again.","strip.recheckHint":"Re-check the runtime host","deadHost.respawnFailed":"Respawn failed — try again.","deadHost.sendBlocked":"host is dead — respawn to continue","deadHost.expiredCard":"expired — the host died before this was answered","superseded.title":"Round superseded \xb7 {since}","superseded.body":"A recovery replaced this round with a live successor. This transcript stays as round history.","superseded.open":"Open the live round","superseded.resumeHere":"Resume here","superseded.resumeConfirm":"Resume this retired round? It forks the work: this card goes live again beside the successor.","superseded.resumeFailed":"Couldn't clear the supersedence link — try again.","superseded.sendBlocked":"round superseded — open the live successor","lineage.continues":"round {round} \xb7 continues previous","lineage.continuesTitle":"Round {round}: continues a superseded predecessor round — click to open it","attach.dialogTitle":"Attach in your terminal","attach.dialogIntro":"Runs this conversation in your own terminal with the same account ({account}) and working directory.","attach.copyCwd":"Copy working directory","attach.copyCommand":"Copy command","attach.copyFull":"Copy full command","attach.copiedFull":"Full command copied to clipboard","attach.takeoverWarning":"Resuming here takes over the conversation from the viewer.","attach.subagentNote":"Subagents resume through their root session.","attach.secondaryViewer":"Open a read-only viewer pane in tmux","attach.secondaryFailed":"Couldn't open the viewer pane — try again.","receipt.human.deadHost":"the agent's host has died","receipt.human.staleKey":"the delivery key was stale","receipt.human.duplicate":"already delivered","receipt.human.turnActive":"the agent is mid-turn","receipt.human.noTurn":"there is no active turn","receipt.human.verbatim":"not delivered: {reason}","spawnCard.starting":"Launch admitted. Starting the agent.","spawnCard.binding":"Agent identity allocated. Binding the structured host.","spawnCard.queued":"The structured host is ready. The initial message is queued.","spawnCard.reconciling":"Delivery is reconciling with the structured host.","spawnCard.recoverable-timeout":"The initial-message timeout is recoverable while durable delivery settles.","spawnCard.live-late-success":"Late delivery succeeded and the live conversation was adopted.","spawnCard.failed":"The launch ended with an error.","spawnCard.recovered":"Durable evidence recovered this launch.","spawnCard.initial.pending":"Initial message: waiting for host binding","spawnCard.initial.queued":"Initial message: queued","spawnCard.initial.delivered":"Initial message: delivered","spawnCard.initial.failed":"Initial message: failed","spawnCard.retrySafe":"This launch is closed. You can start a new attempt.","spawnCard.launch":"Launch {id}","spawnChip.starting":"Starting","spawnChip.binding":"Binding host","spawnChip.queued":"Host ready","spawnChip.reconciling":"Reconciling","spawnChip.recoverable-timeout":"Settling","spawnChip.live-late-success":"Late delivery OK","spawnChip.failed":"Launch failed","spawnChip.recovered":"Launched","spawnChip.initial.pending":"First message: waiting","spawnChip.initial.queued":"First message: queued","spawnChip.initial.delivered":"First message: delivered","spawnChip.initial.failed":"First message: failed","outbox.queueAria":"Messages waiting to be delivered","outbox.queued":"Queued","outbox.delivering":"Delivering","outbox.delivered":"Delivered","outbox.failed":"Not delivered","outbox.cancel":"Cancel this message","outbox.retry":"Retry sending this message","outbox.reattach":"Not sent — re-attach the images and send again","draft.readPrompt":"Read the agent conversation in file {src} and continue from there: ","draft.needDir":"specify a working directory","draft.launchFailed":"couldn't launch","draft.paneAria":"Draft of a new agent conversation","draft.notStarted":"agent not started yet","draft.engineAria":"Agent engine","draft.accountAria":"{engine} account for this launch","draft.accountDefault":"{label} \xb7 active","draft.accountNeedsLogin":"{label} \xb7 needs sign-in","draft.handoffLabel":"handoff: {title}","draft.newConvo":"new conversation","draft.conversation":"conversation","draft.dismiss":"Dismiss the draft conversation","draft.directory":"directory","draft.dirAria":"Agent working directory","draft.confirmRecoveredDir":"Confirm the working directory. Edit this field before launching the agent.","draft.reasoning":"reasoning","draft.role":"role","draft.roleAria":"Agent role preset","draft.noRole":"No role","draft.roleParameters":"Role parameters","draft.safetyFences":"Safety fences","draft.roleNeedsParams":"complete the required role parameters","draft.reviews":"reviewed conversation","draft.reviewsAria":"Reviewed conversation","draft.reviewsPlaceholder":"Choose a conversation","draft.reviewerNeedsConversation":"choose the conversation this reviewer will review","draft.deployConfirm":"Type deploy to authorize this deployment plan","draft.modelAria":"Agent model","draft.modelDefault":"model: default","draft.reasoningAria":"Reasoning effort level","draft.effortDefault":"effort: default","draft.speedAria":"Codex speed mode","draft.speedTitle":"fast = priority tier (1.5x speed, higher usage)","draft.speedDefault":"speed: default","draft.imagesOnly":"(images)","draft.launched":"agent launched in tmux {target} — waiting for the conversation to appear here…","draft.launchedStructured":"agent launched — waiting for the conversation to appear here…","draft.slow":"Taking a while. Check tmux window {target} — the panel will pick up the transcript as soon as it appears.","draft.slowStructured":"Taking a while. The panel will pick up the transcript as soon as it appears.","draft.confirming":"Launched — confirming the agent in tmux {target}. Don't send again; the panel attaches the conversation as soon as its transcript appears.","draft.confirmingStructured":"Launched — confirming the agent. Don't send again; the panel attaches the conversation as soon as its transcript appears.","draft.confirmingNoTarget":"Confirming whether the agent started. Don't send again — the panel attaches the conversation as soon as its transcript appears.","draft.attention":"The agent may already be running in tmux {target}. Don't launch it again. Dismiss this draft once you've checked; it still attaches automatically if the transcript appears.","draft.attentionStructured":"The agent may already be running. Don't launch it again. Dismiss this draft once you've checked; it still attaches automatically if the transcript appears.","draft.attentionNoTarget":"The agent may already be running — check your tmux windows. Don't launch it again. Dismiss this draft once you've checked; it still attaches automatically if the transcript appears.","draft.hintRelay":"The new agent will first read the parent conversation's transcript and pick up from there. Add to the prompt what to do next — the branch will appear on the scheme alongside.","draft.hintNew":"Choose an engine and a directory, write the first prompt — the agent will start in tmux, and the conversation will continue in this same panel.","draft.hintNewStructured":"Choose an engine and a directory, write the first prompt — the agent will start, and the conversation will continue in this same panel.","draft.promptAria":"First prompt for the new agent","draft.placeholder":"first prompt — the agent will start in tmux…","draft.placeholderStructured":"first prompt — the agent will start…","draft.promptTextAria":"First prompt text","draft.newWindowTitle":"new tmux window with a fresh agent","draft.newWindowTitleStructured":"new structured session with a fresh agent","draft.newAgent":"new agent","draft.addImages":"Add images to the prompt","draft.stopAndLaunch":"Stop recording and launch the agent","draft.rolePromptToggle":"Role prompt (EN)","draft.speedFast":"fast","draft.speedStandard":"standard","effortTier.minimal":"minimal","effortTier.low":"low","effortTier.medium":"medium","effortTier.high":"high","effortTier.xhigh":"extra high","effortTier.max":"max","effortTier.ultra":"ultra","reasoningTier.minimal":"Minimal","reasoningTier.low":"Light","reasoningTier.medium":"Medium","reasoningTier.high":"High","reasoningTier.xhigh":"Extra High","reasoningTier.max":"Max","reasoningTier.ultra":"Ultra","roleCopy.orchestrator.name":"Orchestrator","roleCopy.orchestrator.description":"Coordinates fresh agents through the Viewer control plane.","roleCopy.orchestrator.param.mode.label":"Mode","roleCopy.orchestrator.param.mode.description":"Operating mode for the coordination run.","roleCopy.orchestrator.param.mode.option.standard":"Standard","roleCopy.orchestrator.param.mode.option.plan-tickets":"Plan tickets","roleCopy.orchestrator.param.mode.option.wayfind":"Wayfind","roleCopy.orchestrator.param.mode.option.backlog-campaign":"Backlog campaign","roleCopy.orchestrator.param.repo.label":"Repository","roleCopy.orchestrator.param.repo.description":"Repository for backlog-campaign mode.","roleCopy.orchestrator.param.issueQuery.label":"Issue query","roleCopy.orchestrator.param.issueQuery.description":"GitHub issue query for backlog-campaign mode.","roleCopy.orchestrator.param.urgent.label":"Urgent list","roleCopy.orchestrator.param.urgent.description":"Comma-separated urgent issue ids.","roleCopy.orchestrator.param.maxWorkers.label":"Maximum workers","roleCopy.orchestrator.param.maxWorkers.description":"Worker cap for backlog-campaign mode.","roleCopy.orchestrator.param.mergePolicy.label":"Merge policy","roleCopy.orchestrator.param.mergePolicy.description":"Delivery policy for backlog-campaign mode.","roleCopy.orchestrator.param.mergePolicy.option.pr":"Pull request","roleCopy.orchestrator.param.mergePolicy.option.merge":"Merge","roleCopy.orchestrator.param.completionPolicy.label":"Completion policy","roleCopy.orchestrator.param.completionPolicy.description":"Terminal policy for backlog-campaign mode.","roleCopy.orchestrator.param.completionPolicy.option.pr-opened":"PR opened","roleCopy.orchestrator.param.completionPolicy.option.merged":"Merged","roleCopy.orchestrator.param.completionPolicy.option.released":"Released","roleCopy.reviewer.name":"Reviewer","roleCopy.reviewer.description":"Reviews a code diff and returns severity-ranked evidence-backed findings.","roleCopy.reviewer.param.diffSource.label":"Diff source","roleCopy.reviewer.param.diffSource.description":"Diff or pull request reference to inspect.","roleCopy.reviewer.param.lens.label":"Lens","roleCopy.reviewer.param.lens.description":"Review lens.","roleCopy.reviewer.param.lens.option.correctness":"Correctness","roleCopy.reviewer.param.lens.option.over-engineering":"Over-engineering","roleCopy.reviewer.param.lens.option.silent-failure":"Silent failures","roleCopy.reviewer.param.lens.option.test-coverage":"Test coverage","roleCopy.reviewer.param.lens.option.scope":"Scope","roleCopy.reviewer.param.lens.option.prod-ops":"Prod ops","roleCopy.reviewer.param.lens.option.standards+spec":"Standards + spec","roleCopy.reviewer.param.lens.option.code-smells":"Code smells","roleCopy.reviewer.param.lens.option.all":"All lenses","roleCopy.reviewer.param.mode.label":"Mode","roleCopy.reviewer.param.mode.description":"Reviewer context mode.","roleCopy.reviewer.param.mode.option.fresh":"Fresh context","roleCopy.reviewer.param.parallelN.label":"Parallel passes","roleCopy.reviewer.param.parallelN.description":"Independent review passes.","roleCopy.verifier.name":"Verifier","roleCopy.verifier.description":"Tests supplied hypotheses and returns a per-claim evidence verdict.","roleCopy.verifier.param.claims.label":"Claims","roleCopy.verifier.param.claims.description":"Hypotheses to confirm or refute.","roleCopy.builder.name":"Builder","roleCopy.builder.description":"Writes product code for a scoped directive.","roleCopy.builder.param.mode.label":"Mode","roleCopy.builder.param.mode.description":"Implementation discipline.","roleCopy.builder.param.mode.option.plain":"Plain","roleCopy.builder.param.mode.option.apply-fixes":"Apply fixes","roleCopy.builder.param.mode.option.tdd":"TDD","roleCopy.builder.param.mode.option.diagnose":"Diagnose","roleCopy.builder.param.mode.option.prototype":"Prototype","roleCopy.builder.param.mode.option.merge-resolve":"Merge resolve","roleCopy.builder.param.domain.label":"Domain","roleCopy.builder.param.domain.description":"Product domain for the implementation.","roleCopy.builder.param.domain.option.general":"General","roleCopy.builder.param.domain.option.frontend":"Frontend","roleCopy.architect.name":"Architect","roleCopy.architect.description":"Produces an evidence-grounded design without product edits.","roleCopy.architect.param.mode.label":"Mode","roleCopy.architect.param.mode.description":"Architecture output mode.","roleCopy.architect.param.mode.option.design":"Design","roleCopy.architect.param.mode.option.spec":"Spec","roleCopy.architect.param.mode.option.architecture-audit":"Architecture audit","roleCopy.cleaner.name":"Cleaner","roleCopy.cleaner.description":"Safely recovers a dirty checkout under a backup contract.","roleCopy.prod-auditor.name":"Prod auditor","roleCopy.prod-auditor.description":"Performs a read-only evidence-backed production investigation.","roleCopy.prod-auditor.param.questions.label":"Questions","roleCopy.prod-auditor.param.questions.description":"Production questions to investigate.","roleCopy.deployer.name":"Deployer","roleCopy.deployer.description":"Plans a blue/green production deployment and stops for approval before mutation.","roleCopy.deployer.param.sha.label":"Merged SHA","roleCopy.deployer.param.sha.description":"Merged commit SHA to deploy.","roleCopy.deployer.param.pr.label":"Pull request","roleCopy.deployer.param.pr.description":"Optional pull request reference.","link.handoffContext":"You've been handed another agent's context — the conversation \xab{title}\xbb. Its transcript: {path} — read that file first for full context, then carry out the request below.\n\n{ask}","link.dropped":"context is in the composer of \xab{title}\xbb — type the ask and send","handoff.aria":"Hand the conversation to a new agent — a draft appears below","handoff.title":"click — draft a new agent with this context \xb7 drag — link to an existing one","handoff.label":"hand off to agent","qr.showAria":"Show a QR code for phone login","qr.failed":"couldn't get the link","qr.startHint":"Start the viewer with Tailscale access: ","qr.alt":"QR code for phone login","qr.generating":"generating QR…","qr.linkAria":"Phone login link","qr.copy":"Copy link","qr.scanHint":"scan from a phone on the same tailnet","push.enabled":"Push notifications enabled","push.enable":"Enable push notifications","push.disable":"Disable push notifications","push.needsHttps":"Push requires HTTPS","sound.on":"Sound notifications on","sound.off":"Sound notifications off","sound.mute":"Mute sound notifications","sound.unmute":"Enable sound notifications","sound.settings":"Sound levels","sound.cueVolume":"Notification cues","sound.ambientViewer":"Background music in the Viewer","sound.ambient":"Background music during a call","sound.ambientVolume":"Music level","sound.ambientHint":"Plays quietly at this level, and ducks under speech during a call. With both on, the same track keeps playing across the call.","keepAwake.label":"Keep screen awake","keepAwake.enableAria":"Keep the screen awake on this device","keepAwake.disableAria":"Let the screen sleep on this device","keepAwake.off":"The screen sleeps on this device's usual timer.","keepAwake.requesting":"Asking the browser…","keepAwake.active":"Screen stays awake while this tab is visible. Uses more battery.","keepAwake.waiting":"Paused while this tab is hidden. Resumes when you come back.","keepAwake.interrupted":"The system released the lock. Turn this off and on to ask again.","keepAwake.blocked":"The browser refused the request. The screen is not held.","keepAwake.failed":"The request failed. The screen is not held.","keepAwake.insecure":"Needs an HTTPS address. Over plain HTTP the screen cannot be held.","keepAwake.unsupported":"This browser has no screen wake lock.","mic.stopRecognize":"Stop recording and transcribe","mic.cancel":"Cancel recording","mic.recognizing":"Transcribing…","mic.dictate":"Dictate","mic.dictateHint":"dictate (up to 10 min) \xb7 right-click: transcription method","mic.timeLeft":"{time} left before auto-stop","mic.capStopped":"stopped at 10:00","mic.connecting":"Connecting the microphone — a moment…","mic.menuTitle":"Transcription method","mic.menuLoading":"checking what's available…","mic.menuLocked":"Locked by the LLV_TRANSCRIBE_BACKEND environment variable","mic.noKey":"not set up","mic.saveFailed":"couldn't save the choice","mic.keyTitle":"{name} is not set up","mic.copy":"copy","mic.copyPath":"Copy path","mic.copied":"copied","mic.back":"Back","stt.local.name":"Faster Whisper","stt.local.desc":"Free, fully local — audio never leaves this machine.","stt.local.fix":"Run scripts/setup-whisper.sh in the app folder once; it installs the local engine at:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"Covered by your ChatGPT subscription, via the Codex login.","stt.chatgpt.fix":"Log in to Codex (run `codex login`) — the token will appear at:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Paid ElevenLabs API — the most accurate option.","stt.elevenlabs.fix":"Put your ElevenLabs API key (a single line) into this file:","delFile.confirm":"Delete from disk?","delFile.aria":"Delete the conversation from disk","rename.edit":"Rename","rename.editAria":"Rename “{title}”","rename.inputAria":"Session title","rename.save":"Save name","rename.cancel":"Cancel","rename.reset":"Reset to auto title","rename.resetHint":"Reset to the auto title: {title}","rename.autoHint":"Auto title: {title}","rename.retry":"Retry","rename.saved":"Renamed to {title}","rename.conflict":"Name changed elsewhere — adopted the latest and retried","rename.failed":"Couldn't save the name","img.readFailed":"couldn't read the image","img.readAborted":"image reading aborted","img.unsupported":"unsupported image format: {name}","img.unknownFile":"unknown file","img.tooLarge":"{name}: too large (10 MB limit)","img.structuredTooLarge":"Image exceeds this host's {max} MB limit","img.tooManyStructured":"Up to {max} images can be sent at once","img.structuredAggregateTooLarge":"Images exceed this host's {max} MB request limit","img.image":"image","img.error":"image error","img.previewAlt":"image preview {n}","img.removeAria":"Remove image {n}","img.readingAria":"loading image {n}","img.retry":"Retry","img.retryAria":"Retry image {n}","img.clearAll":"Clear all","img.clearAllAria":"Remove all images","img.blockedReading":"Waiting for the image to finish loading…","img.blockedFailed":"Remove or retry the failed image to send","img.deliveryHint":"attached to the message","question.sec":"{n} s","question.min":"{n} min","question.hour":"{n} h","question.waiting":"waiting for a reply","question.sentToPane":"Sent to the pane: {text}","question.keysHint":"keys into the pane \xb7 or the composer below","question.pane":"Pane {target}","question.alreadyAnswered":"answer already recorded","question.openFailed":"couldn't open the session","question.opened":"opened {target}","question.answered":"Answered: {text}","question.answeredElsewhere":"Answered elsewhere: {text}","question.noPane":"tmux pane unavailable","question.openSession":"open session","question.rejectComment":"Rejection comment…","question.approved":"approved","question.rejected":"rejected","question.approve":"Approve","question.reject":"Reject","question.ownAnswer":"Your own answer…","question.dismiss":"Dismiss the question card","question.deliveryFailed":"Delivery failed","question.failedChoice":"not delivered","question.retryAnswer":"Retry","question.errorNotRunning":"the agent is no longer running, so nothing was delivered","question.errorMoved":"the agent has moved on from this question","question.errorUnconfirmed":"the answer was sent, but the agent never confirmed it","question.errorNotDelivered":"the agent's screen did not respond as expected, so the answer was not delivered","question.errorRejected":"the viewer could not build a valid answer","inbox.deleted":"deleted from disk","inbox.fileGone":"the file is no longer on disk","inbox.confirmDelete":"Delete the file from disk?","inbox.deleteAria":"Delete {name} from disk","inbox.deleteFromDisk":"delete from disk","inbox.attachedAlt":"attached image {name}","lightbox.zoomOut":"Zoom out","lightbox.resetZoom":"Reset zoom","lightbox.zoomIn":"Zoom in","feed.agentEnded":"agent finished","feed.copyCode":"Copy code","feed.copyMd":"Copy message (Markdown)","feed.voiceTurn":"Voice","feed.voiceContext":"Call transcript","feed.speak":"Read answer aloud (AI-generated voice)","feed.stopSpeaking":"Stop reading aloud","tts.read":"Read answer aloud","tts.readPaid":"Read aloud (paid)","tts.replay":"Replay answer audio","tts.replayFree":"Replay aloud (free)","tts.stop":"Stop reading aloud","tts.confirmAria":"Confirm paid text-to-speech","tts.confirmTitle":"Confirm paid read-aloud","tts.characters":"{count} characters","tts.billing":"Billed to your {provider} account per character.","tts.disclosure":"You’ll hear an AI-generated voice, not a human voice.","tts.shorten":"Speak the first {count} characters?","tts.missingKey":"Add the {provider} API key at {path}","tts.cancel":"Cancel","tts.speak":"Speak","tts.generating":"Generating audio…","tts.playing":"Playing audio","tts.stopped":"Stopped","tts.configError":"TTS configuration unavailable","tts.backendChanged":"The TTS provider changed. Review the updated details and confirm again.","tts.requestError":"TTS request failed ({status})","tts.requestFailed":"TTS request failed","tts.playError":"The browser blocked audio playback. Try again.","feed.running":"running {tool}…","feed.tool":"tool","feed.thinking":"thinking…","feed.working":"working…","feed.liveTail":"live tail","feed.liveOmittedItems":"… ({count} earlier assistant items, {chars} characters)","feed.liveOmittedChars":"… (+{chars} characters)","feed.backToLive":"Back to the live tail","feed.newCount":"{count} new","feed.down":"down","feed.pickLog":"Pick a log on the left — the feed updates itself","feed.showEarlier":"show earlier","feed.showEarlierHidden":"show earlier (hidden {count})","feed.loadEarlier":"load earlier from the file","feed.startOfConvo":"start of the conversation","feed.finishedTurn":"finished the turn — waiting for a reply","feed.returnedResult":"returned with a result","feed.noOutput":"No output yet — the file is empty for now","feed.onlyService":"Only service records are present ({count}).","feed.empty":"Empty (no rows to show)","render.system":"system","render.executing":"executing…","render.error":"error","render.teammate":"teammate","render.left":"{peer}: left{at}","render.codexSessionCreated":"Codex session created","render.taskStarted":"Task started","render.taskComplete":"Task completed","render.compacted":"context compacted","render.compactAuto":"auto","render.compactManual":"manual","render.compactPre":"{n}k tokens before","render.compactSummary":"conversation summary","render.stdinSession":"stdin → session {id}","render.record":"record","render.transcriptRecord":"transcript record","render.recordDetails":"record details","render.protocol":"protocol","render.image":"image","render.imageOutput":"image output","render.toolOutput":"tool output","render.toolOutputType":"tool output: {type}","render.dataKb":"{n} kB of data","render.commands":{one:"{count} command",other:"{count} commands"},"render.actions":{one:"{count} action",other:"{count} actions"},"render.noFindings":"no findings","render.moreFindings":"{count} more findings in raw","render.memoryCitations":"memory citations ({count})","render.noCitations":"no citation entries","render.moreEntries":"{count} more entries in raw","render.truncated":"truncated","render.shutdownRequest":"shutdown request","render.shutdownResponse":"shutdown response","render.planRequest":"plan approval request","render.planVerdict":"plan verdict","render.approved":"approved","render.rejected":"rejected","render.from":"from {from}","render.structured":"structured message","render.showJson":"show JSON","render.toDir":"to","render.fromDir":"from","render.delivered":"delivered","render.notDelivered":"not delivered","render.reasoning":"agent reasoning","tools.read":"Read","tools.write":"Write","tools.edit":"Edit","tools.lines":{one:"{count} line",other:"{count} lines"},"tools.files":{one:"{count} file",other:"{count} files"},"tools.items":{one:"{count} item",other:"{count} items"},"tools.family.shell":"shell command","tools.family.read":"read file","tools.family.write":"write file","tools.family.edit":"edit","tools.family.search":"search","tools.family.web":"web","tools.family.spawn":"spawn agent","tools.family.plan":"plan","tools.family.mcp":"MCP tool","tools.family.other":"tool","tools.showAllLines":"show all ({count} lines)","tools.showOutput":"show all output","tools.moreFiles":"…and {count} more files","tools.binaryContent":"binary content \xb7 {size}","tools.rawRecord":"raw record","tools.noRawRecord":"detail no longer loaded","tools.noOutput":"no output captured","tools.noOutputTip":"the full output lives in the rollout session","tools.stdin":"stdin","tools.stdinPoll":"poll","tools.pollRun":{one:"{count} poll",other:"{count} polls"},"tools.wait":"wait","tools.session":"session","tools.waitingSeconds":"waiting {n}s","tools.wakeup":"scheduled wakeup","tools.cron":"scheduled agent","tools.monitor":"monitor","tools.schedule":"schedule","tools.diffTruncated":"truncated to fit","tools.orchestration":{one:"{count} tool call",other:"{count} tool calls"},"tools.nestedCalls":"nested calls","tools.callId":"call {id}","tools.copyId":"copy id","tools.copyDiff":"Copy diff","tools.copyOutput":"Copy output","tools.source":"source","tools.action":"action {index}","tools.cwd":"cwd","tools.copyCwd":"copy cwd","tools.copyCommand":"Copy command","tools.stdout":"stdout","tools.stderr":"stderr","tools.copyStderr":"Copy stderr","tools.showStderr":"show all stderr","tools.noStderr":"no stderr captured","tools.exitOk":"exit 0","tools.exitCode":"exit {code}","tools.durationSec":"{n}s","tools.durationMin":"{m}m {s}s","tools.durationMs":"{n}ms","tools.ranAt":"{start}–{end}","tools.nestedWaits":{one:"{count} follow-up",other:"{count} follow-ups"},"wakeup.card":"scheduled wakeup","wakeup.wakesAt":"wakes at {time}","wakeup.wasSetFor":"was set for {time}","wakeup.firedAt":"fired at {time}","wakeup.fired":"fired","wakeup.failed":"scheduling failed","wakeup.superseded":"superseded","wakeup.noTime":"wakeup scheduled","wakeup.plan":"wake plan","wakeup.noPlan":"no wake plan given","wakeup.inRel":"in {rel}","wakeup.agoRel":"{rel} ago","wakeup.relSec":{one:"{count}s",other:"{count}s"},"wakeup.relMin":{one:"{count} min",other:"{count} min"},"wakeup.relHour":{one:"{count} h",other:"{count} h"},"wakeup.relDay":{one:"{count} d",other:"{count} d"},"wakeup.chipTitle":"sleeping until {time} — {reason}","flowDialog.engine":"Engine: {label}","flowDialog.modelPlaceholder":"model (default)","flowDialog.model":"Model: {label}","flowDialog.effortDefault":"effort: default","flowDialog.createFailed":"couldn't create the flow ({status})","flowDialog.title":"Start a flow","flowDialog.subtitle":"implement → review \xb7 this conversation becomes the implementer","flowDialog.preset":"preset","flowDialog.rolesManualOpen":"▾ roles manually","flowDialog.rolesManual":"▸ roles manually (model / effort)","flowDialog.spec":"specification and acceptance criteria","flowDialog.specPlaceholder":"Task statement\nAC1: …\nAC2: …","flowDialog.implementer":"implementer","flowDialog.reviewer":"reviewer","flowDialog.diffBase":"diff base","flowDialog.fromHead":"from current HEAD","flowDialog.fromMergeBase":"from merge-base with main","flowDialog.headless":"headless (no pane)","flowDialog.tmuxPane":"tmux pane","flowDialog.transitions":"transitions","flowDialog.auto":"auto","flowDialog.manual":"manual (gate every step)","flowDialog.roundLimit":"round limit","flowDialog.creating":"creating…","flowDialog.start":"▶ Start","flowStrip.startReview":"Start review","flowStrip.spawnReviewer":"Spawn reviewer","flowStrip.relayNotes":"Relay notes","flowStrip.retryRound":"Retry round","flowStrip.anotherRound":"Another round","flowStrip.flow":"Flow","flowStrip.roundsAria":"Review rounds","flowStrip.roundError":"Round {n}: {error}","flowStrip.roundVerdict":"Round {n}: {verdict}","flowStrip.roundInProgress":"Round {n}: in progress","flowStrip.addRoundsTitle":"Add more rounds to the limit","flowStrip.plus2":"+2 rounds","flowStrip.limitTitle":"Round limit: reviews before the loop parks (∞ — unlimited)","flowStrip.limitAria":"Set the round limit to {count}","flowStrip.limitUnlimitedAria":"Unlimited rounds","flowStrip.stopReviewer":"Stop","flowStrip.stopReviewerTitle":"Stop the running reviewer; the round lands in “needs decision”","flowStrip.notePlaceholder":"note for the reviewer…","flowStrip.noteTitle":"Sent to the next reviewer as the round's ready note","flowStrip.autoTitle":"Auto: transitions run themselves. Click — manual.","flowStrip.manualTitle":"Manual: every transition waits for a click. Click — auto.","flowStrip.manualShort":"manual","flowStrip.resume":"Resume flow","flowStrip.pause":"Pause","flowStrip.close":"Close flow","flowHub.aria":"Flow controls — round {n}, {state}","flowHub.ariaNoRound":"Flow controls — {state}","flowHub.controls":"Flow controls","groupOverride.closePanel":"Close controls","groupOverride.flowTitle":"Override \xb7 {name}","groupOverride.pipelineTitle":"Override \xb7 {name}","groupOverride.draftTitle":"Edit draft \xb7 {name}","groupOverride.task":"Task","groupOverride.spec":"Specification","groupOverride.repoDir":"Repository","groupOverride.saveDraft":"Save draft details","groupOverride.savedDraft":"Draft details saved","groupOverride.reviewerRole":"Next reviewer","groupOverride.engine":"Engine","groupOverride.effort":"Effort","groupOverride.effortDefault":"default","groupOverride.model":"Model","groupOverride.modelPlaceholder":"engine default","groupOverride.applyRole":"Update reviewer","groupOverride.nextRoundNote":"Next-round note","groupOverride.notePlaceholder":"What the next reviewer should focus on…","groupOverride.noteUnavailable":"Editable when you start, spawn, or retry a round.","groupOverride.roundLimit":"Round limit","groupOverride.setLimit":"Set","groupOverride.extend":"+1 round","groupOverride.nextStage":"Next stage","groupOverride.draftStage":"Draft stage","groupOverride.addStage":"Add stage","groupOverride.removeStage":"Remove stage","groupOverride.moveStageUp":"Move up","groupOverride.moveStageDown":"Move down","groupOverride.role":"Role","groupOverride.noRole":"No role","groupOverride.stagePrompt":"Stage prompt","groupOverride.applyStage":"Update stage","groupOverride.noEditableStage":"No upcoming stage to edit — every stage has already started.","groupOverride.editStagesOnCanvas":"Edit stages on their cards — role, model, prompt, order, and connections live on each stage's card in the canvas.","groupOverride.savedReviewer":"Reviewer updated for the next round","groupOverride.savedLimit":"Round limit updated","groupOverride.savedExtend":"Added a round","groupOverride.savedRetry":"Retrying the round","groupOverride.savedCancel":"Reviewer stopped","groupOverride.savedStage":"Stage updated for its next run","groupOverride.stagesHeading":"Stages \xb7 execution order","groupOverride.stagesHint":"Drag cards to reorder. The order is the execution chain.","groupOverride.stagesEmpty":"No stages yet — add a stage below to start building.","groupOverride.startNeedsStages":"Add at least 1 stage before starting.","groupOverride.addRunStage":"Add stage","groupOverride.addReviewStage":"Add review loop","groupOverride.dragHandle":"Drag to reorder this stage","groupOverride.runKind":"run","groupOverride.reviewKind":"review loop","groupOverride.reordered":"Stages reordered","groupOverride.stageAdded":"Stage added","groupOverride.stageRemoved":"Stage removed","pipelineBuilder.untitledTask":"New pipeline","pipelineBuilder.createDraft":"Pipeline","pipelineBuilder.createDraftAria":"Add a draft pipeline to the canvas","roundDeck.roundAborted":"Round {n} \xb7 aborted","roundDeck.roundVerdict":"Round {n} \xb7 {verdict}","roundDeck.roundInProgress":"Round {n} \xb7 in progress","roundDeck.aborted":"aborted","roundDeck.reviewInProgress":"review in progress","roundDeck.waitingFirst":"waiting for the first review round…","roundDeck.spawningReviewer":"launching the reviewer — the transcript will appear shortly…","roundDeck.moreRounds":"{count} more round(s) — click the chips on the flow strip","roundDeck.findings":{one:"{count} finding",other:"{count} findings"},"roundDeck.roundsCount":{one:"{count} round",other:"{count} rounds"},"roundDeck.collapseStack":"Collapse review stack ({count} rounds)","roundDeck.expandStack":"Expand review stack ({count} rounds)","roundDeck.groupAria":{one:"Review conversation group \xb7 {count} round",other:"Review conversation group \xb7 {count} rounds"},"roundDeck.groupAriaNamed":{one:"Review group for {name} \xb7 {count} round",other:"Review group for {name} \xb7 {count} rounds"},"subagentTray.label":{one:"{count} subagent",other:"{count} subagents"},"subagentTray.toggle":{one:"Expand the subagent tray ({count} folded subagent)",other:"Expand the subagent tray ({count} folded subagents)"},"subagentTray.collapse":{one:"Collapse the subagent tray ({count} folded subagent)",other:"Collapse the subagent tray ({count} folded subagents)"},"subagentTray.rows":"Folded subagents","subagentTray.open":"Open the {name} subagent transcript","subagentTray.fold":"Fold {name} into the subagent tray","subagentTray.unfold":"Restore {name} to a full card","subagentTray.state.running":"working","subagentTray.state.live":"live","subagentTray.state.silent":"alive but silent","subagentTray.state.closed":"idle","subagentTray.state.dead":"unavailable","flowState.waiting_ready":"waiting for READY","flowState.spawn_pending":"ready to spawn the reviewer","flowState.spawning":"spawning the reviewer","flowState.reviewing":"reviewing","flowState.relay_pending":"verdict ready — relay?","flowState.relaying":"relaying notes","flowState.fixing":"fixing","flowState.approved":"approved","flowState.done_comment":"done with comments","flowState.needs_decision":"needs a decision","flowState.paused":"paused","flowState.closed":"closed","flowState.blocked_rate_limited":"blocked: rate-limited","flowState.rate_limit_until":"resets at {time}","flowState.rate_limit_wait":"waiting for the quota reset","flowModel.failed":"failed ({status})","wfState.provisioning":"provisioning the worktree","wfState.implementing":"stages running","wfState.reviewing":"reviewing","wfState.finishing":"finishing","wfState.approved":"approved","wfState.needs_decision":"needs a decision","wfState.paused":"paused","wfState.closed":"closed","wfModel.failed":"failed ({status})","wfStrip.workflow":"Workflow","wfStrip.stagesAria":"Workflow stages","wfStrip.reviewStage":"review","wfStrip.advance":"Advance","wfStrip.retryStage":"Retry stage","wfStrip.skipStage":"Skip","wfStrip.resume":"Resume workflow","wfStrip.pause":"Pause","wfStrip.close":"Close workflow","pipelineState.draft":"draft","pipelineState.provisioning":"provisioning the worktree","pipelineState.running":"stages running","pipelineState.needs_decision":"needs a decision","pipelineState.paused":"paused","pipelineState.completed":"completed","pipelineState.closed":"closed","pipelineModel.failed":"failed ({status})","pipelineStrip.pipeline":"Pipeline","pipelineStrip.start":"Start pipeline","pipelineStrip.discard":"Discard draft","pipelineStrip.stagesAria":"Pipeline stages","pipelineStrip.reviewStage":"review loop","pipelineStrip.retryStage":"Retry stage","pipelineStrip.skipStage":"Skip","pipelineStrip.resume":"Resume pipeline","pipelineStrip.pause":"Pause pipeline","pipelineStrip.close":"Close pipeline","pipelineStrip.readOnly":"read-only","pipelineStrip.readWrite":"read-write","pipelineStrip.groupAria":"Pipeline {task}","pipelineStrip.baseSha":"Base {sha}","pipelineStrip.baseShaFull":"Full base commit {sha}","pipelineStrip.copyBaseSha":"Copy full base commit {sha}","pipelineStrip.copiedBaseSha":"Full base commit copied","pipelineStrip.copyBaseShaFailed":"Could not copy the base commit","pipelineStrip.moreActions":"More pipeline actions","pipelineStrip.announce":"Pipeline {task}: {state}, stage {stage} {k} of {n}","pipelineStrip.openStage":"Open stage {label}","pipelineStrip.openVerdict":"Open verdict for stage {label}, state {state}","pipelineStrip.openTranscript":"Open transcript for stage {label}, state {state}","pipelineStrip.configureStage":"Configure stage {label}, state {state}","pipelineStrip.configAria":"Configuration for stage {label}","pipelineStrip.closeConfig":"Close stage configuration","pipelineStrip.lineageAria":"Stage lineage from {from} to {to}","pipelineStrip.previousStage":"Open previous stage {label}, state {state}","pipelineStrip.nextStage":"Open next stage {label}, state {state}","pipelineStrip.evidenceAria":"Stage {label} evidence: {verdict}, duration {duration}, model {model}","pipelineStrip.defaultModel":"default model","pipelineStrip.unknownDuration":"duration unavailable","pipelineStrip.linkedTasks":"Linked tasks","pipelineStrip.openTask":"Open linked task {label}","pipelineStrip.roundShort":"R{n}","pipelineStrip.attemptSuffix":"\xd7{n}","stageGraph.roundProgress":"round {round}/{total}","stageGraph.startedNotice":"This stage started while settings were open. Its saved server configuration is now locked.","pipelineStrip.chipAria":"Stage {label}: {state}","pipelineStrip.compactChipAria":"{label}, {state}","pipelineStrip.stageOf":"stage {k}/{n}","pipelineStrip.passEdgeAria":"Pass edge from {from} to {to}","pipelineStrip.failEdgeAria":"Fail edge from {from} to {to}, round {k} of {n}","pipelineStrip.nextEdge":"next","pipelineStrip.nextEdgeAria":"This edge runs next","pipelinePresentation.queued":"Queued","pipelinePresentation.waiting":"Waiting","pipelineShelf.aria":"Pipeline shelf","pipelineShelf.title":"Pipelines","pipelineShelf.edit":"Edit pipeline {task}","pipelineGroup.toggle":"Expand or collapse pipeline {task}","pipelineGroup.openHistory":"Open pipeline history for {task}","pipelineSlot.paneAria":"Planned stage {title}","pipelineSlot.completedAria":"Completed stage {title} — open to review","pipelineSlot.openTranscript":"Open conversation","pipelineSlot.stageOf":"stage {k}/{n}","pipelineSlot.promptLabel":"Stage prompt","pipelineSlot.noPrompt":"Extra context for this agent — the wiring above is automatic.","pipelineSlot.wiringTask":"Automatically receives: the task text","pipelineSlot.wiringPrev":"Automatically receives: the previous stage's output + the task text","pipelineSlot.waiting":"The {role} chat window opens here when this stage starts.","pipelineSlot.starting":"Starting the {role} agent…","pipelineSlot.reviewHint":"Review cycle over the previous stage — its rounds land here.","pipelineSlot.frozen":"This stage already ran — its configuration is locked.","pipelineSlot.saved":"Saved","pipelineSlot.rowAria":"Finished stage {title}","pipelineSlot.reasonSkipped":"Skipped by the operator — the chain moved on","pipelineSlot.rowExpand":"Show the full stage card","pipelineSlot.rowCollapse":"Collapse back to the status row","pipelineTemplates.planBuildReview":"Plan → Build → Review","pipelineTemplates.buildReview":"Build → Review","pipelineTemplates.buildVerify":"Build → Verify","pipelineSlot.addAgent":"Next agent","pipelineSlot.addAgentTitle":"Add the next agent handoff after this stage","pipelineSlot.addReview":"Review cycle","pipelineSlot.addReviewTitle":"Attach a review cycle (hard link) after this stage","pipelineSlot.moveEarlier":"Move {role} earlier in the chain","pipelineSlot.moveLater":"Move {role} later in the chain","pipelineSlot.savePrompt":"Save prompt","pipelineSlot.promptAria":"Stage prompt editor","pipelineSlot.connectHeading":"Connections","pipelineSlot.passEdgeLabel":"On pass, continue to","pipelineSlot.passEdgeEnd":"— completes the pipeline","pipelineSlot.failEdgeLabel":"On fail, loop back to","pipelineSlot.failEdgeNone":"— park for the operator","pipelineSlot.failEdgeSelf":"↺ this stage (retry itself)","pipelineSlot.failEdgeRounds":"Max loop rounds","pipelineSlot.passEdgeFrozen":"This stage already ran — its pass edge is frozen evidence.","pipelineSlot.failEdgeFrozen":"This fail edge was already traversed — it is frozen evidence.","pipelineTemplates.title":"New pipeline","pipelineTemplates.subtitle":"Pick a template. Its pipeline group lands on the board beside the linked task. Stage configuration remains available on demand.","pipelineTemplates.blank":"Blank canvas","pipelineTemplates.blankHint":"Start empty and assemble the stages by hand.","pipelineTemplates.noRole":"no role","pipelineTemplates.repoDir":"Repository directory","pipelineTemplates.checking":"Checking repository…","pipelineTemplates.ready":"Repository ready","pipelineTemplates.creating":"Creating pipeline…","pipelineTemplates.retry":"Retry","pipelinePreflight.empty":"Enter a repository directory","pipelinePreflight.missing":"The directory does not exist: {path}","pipelinePreflight.not_directory":"Choose a directory: {path}","pipelinePreflight.repo_unreadable":"The repository cannot be read: {path}","pipelinePreflight.repo_untraversable":"The repository cannot be opened: {path}","pipelinePreflight.not_git":"Choose a Git repository: {path}","pipelinePreflight.probe_failed":"The repository check could not finish — retry: {path}","pipelinePreflight.git_metadata_unwritable":"Git metadata is read-only: {path}","pipelinePreflight.worktree_parent_unwritable":"Pipeline worktrees cannot be created beside this repository: {path}","pipelineChipState.pending":"pending","pipelineChipState.spawning":"spawning","pipelineChipState.running":"running","pipelineChipState.reviewing":"reviewing","pipelineChipState.committing":"committing","pipelineChipState.passed":"passed","pipelineChipState.failed":"failed","pipelineChipState.needs_decision":"needs a decision","pipelineChipState.skipped":"skipped","pipelineVerdict.pass":"pass","pipelineVerdict.fail":"fail","pipelineVerdict.needsDecision":"needs decision","pipelineVerdict.confidence":"confidence","pipelineVerdict.reviewerSha":"Reviewer SHA {sha}","pipelineVerdict.findings":{one:"{count} finding",other:"{count} findings"},"pipelineVerdict.noFindings":"no findings recorded","pipelineVerdict.more":"+{count} more","pipelineVerdict.openTranscript":"Open transcript","pipelineVerdict.openAttemptTranscript":"Open transcript for attempt {n}","pipelineVerdict.reviewTranscripts":"Review transcripts","pipelineVerdict.openReviewTranscript":"Open review transcript {n}","pipelineVerdict.openFlow":"Open review","pipelineVerdict.retry":"Retry","pipelineVerdict.skip":"Skip","pipelineVerdict.priorAttempts":"Earlier attempts","pipelineVerdict.attemptLine":"Attempt {n}: {status}","pipelineVerdict.title":"Stage {label} verdict","pipelineHub.aria":"Pipeline {task}: {stage} \xb7 {k}/{n}","pipelineHub.controls":"Pipeline controls","pipelineHub.stageOf":"{stage} \xb7 {k}/{n}","pipelineHub.openControls":"Open pipeline controls","pipelineHub.attempt":"attempt {n}","pipelineHub.openDashboard":"Open dashboard strip","dash.pipeline":"Pipeline","dash.newPipeline":"New pipeline","board.historyGroup":"Undo and redo board actions","board.undo":"Undo","board.redo":"Redo","board.undoReopen":"Undo — reopen “{title}”","board.redoReclose":"Redo — close “{title}” again","board.undoNothing":"Nothing to undo","board.redoNothing":"Nothing to redo","scheme.pipeline":"Pipeline","scheme.pipelineTitle":"Start a pipeline from this conversation","board.pipeline":"Pipeline","board.newPipeline":"New pipeline","pipelineMobile.chipAria":"Pipeline {task}","pipelineMobile.position":"{k}/{n}","pipelineMobile.prevStage":"Previous stage {label}, state {state}","pipelineMobile.nextStage":"Next stage {label}, state {state}","pipelineMobile.openVerdict":"Open verdict for {label}, state {state}","pipelineMobile.expandDock":"Expand pipeline {task}","pipelineMobile.collapseDock":"Collapse pipeline {task}","pipelineMobile.summaryOpen":"Open pipelines ({n})","pipelineMobile.summaryCount":{one:"{n} pipeline",other:"{n} pipelines"},"pipelineMobile.summaryActive":"{n} active","pipelineMobile.summaryAttention":"{n} need you","pipelineMobile.summaryCompleted":"{n} done","pipelineMobile.sheetTitle":"Pipelines","pipelineMobile.closeSheet":"Close pipelines","pipelineMobile.completedGroup":{one:"{n} completed",other:"{n} completed"},"wfDraft.paneAria":"Draft of a new workflow","wfDraft.notStarted":"the workflow is not launched yet","wfDraft.newWorkflow":"new workflow","wfDraft.dismiss":"Dismiss the workflow draft","wfDraft.template":"template","wfDraft.templateAria":"Workflow template","wfDraft.repo":"repository","wfDraft.repoAria":"Repository directory","wfDraft.manualMode":"manual: a gate at every stage boundary","wfDraft.hint":"Pick a template and a repository, describe the task — the workflow creates a worktree, runs the stages and the review, then opens a PR.","wfDraft.taskPlaceholder":"the task for the workflow — the brief goes to every stage…","wfDraft.taskAria":"Workflow task brief","wfDraft.footerHint":"worktree \xb7 stages \xb7 review \xb7 PR","wfDraft.finishMerge":"local merge","wfDraft.needDir":"set the repository directory","wfDraft.needTask":"describe the task","wfDraft.launchFailed":"launch failed","wfDraft.launch":"▶ Launch workflow","wfDraft.launching":"launching…","scheme.flowTitle":"Run the implement → review cycle for this conversation","scheme.flow":"Flow","scheme.collapsedTitle":"Collapsed branches and tasks of this conversation","scheme.underneath":"underneath","scheme.handTool":"Hand — drag the canvas (H, or hold Space)","scheme.selectTool":"Select — click and work with conversations (V)","scheme.zoomOut":"Zoom out (−)","scheme.zoom100":"Zoom 100% (1)","scheme.zoomIn":"Zoom in (+)","scheme.fitCurrent":"Fit current work (0)","scheme.fit":"Fit all content (Shift+0, or double-click the background)","scheme.framedCurrent":"Framed current work — {count} items","scheme.framedAll":"Framed all content — {count} items","scheme.offscreenNav":"Off-screen work","scheme.offscreenMore":"Show {count} more off-screen clusters","mobile.mapFrame":"Map framing","mobile.mapAll":"All","mobile.mapCurrent":"Current","scheme.roleImplementer":"Implementer","scheme.roleReviewer":"Reviewer","scheme.roleWorking":"working","scheme.roleWaiting":"waiting","scheme.lassoTool":"Multi-select — draw a box around agents, click cards to toggle","scheme.selectCheckOn":"Add this agent to the selection","scheme.selectCheckOff":"Remove this agent from the selection","scheme.boardAria":"Agent board — arrow keys move between agent windows","scheme.navStack":{one:"{count} quiet branch under {title}",other:"{count} quiet branches under {title}"},"scheme.navStackBare":{one:"{count} quiet branch",other:"{count} quiet branches"},"bulk.selectedCount":{one:"{count} selected",other:"{count} selected"},"bulk.placeholder":"one message to every selected agent…","bulk.textAria":"Broadcast text for the selected agents","bulk.sendAll":"Send to {count} agents","bulk.interrupt":"Interrupt","bulk.stop":"Stop","bulk.stopConfirm":"Stop {count} agents?","bulk.remove":"Clear from board","bulk.removeConfirm":"Close {count} cards?","bulk.flow":"Flow","bulk.fit":"Show selection","bulk.exit":"Exit selection (Esc)","bulk.retryFailed":"Retry failed ({count})","bulk.nodeGone":"node left the board","bulk.flowTitle":"Start a review flow on {count} agents","bulk.flowStart":"Start {count} flows","minimap.title":"Minimap — click or drag to navigate","minimap.stacks":{one:"{count} collapsed stack",other:"{count} collapsed stacks"},"plan.agentPlan":"Agent plan:","plan.stepsAria":"Plan: {done} of {total} steps","plan.nowSuffix":", now: {current}","plan.goal":"goal","plan.goalDone":"goal ✓","plan.goalBlocked":"goal ✖","plan.noObjective":"(objective not recorded in the transcript tail)","plan.tokens":"tokens: {n}","plan.time":"time: {n} min","plan.ctxTitle":"Context window: {pct}% used\n{used} of {window} tokens","plan.ctxSourceRuntime":"Window reported by the agent runtime","plan.ctxSourceRegistry":"Window from the bundled model registry ({version}) — approximate","plan.ctxTitleUnknown":"Context usage: {used} tokens\nWindow unknown for this model — percentage withheld","plan.ctxAria":"Context: {pct} percent of the window used","plan.ctxAriaUnknown":"Context: {used} tokens used, window size unknown","plan.goalAria":"Session goal: {status}","limits.now":"now","limits.inMin":"in {n}m","limits.inHour":"in {n}h","limits.inDay":"in {n}d","limits.asOf":"as of {time}","limits.left":"left","limits.reset":"reset {eta} \xb7 {at}","limits.stale":"data is stale: {stale}","limits.5h":"5h","limits.week":"Week","limits.windowMinutes":"{n}m","limits.windowHours":"{n}h","limits.windowDays":"{n}d","limits.accountsOpenAria":"Codex accounts — switch or add","limits.noDataYet":"no data yet","limits.rateLimited":"Provider is rate-limiting requests.","limits.rateLimitedRetry":"Provider is rate-limiting requests. Retry at {time}.","limits.reauthRequired":"Re-login to Claude is required.","burndown.title":"burndown","burndown.openAria":"Open {engine} burndown chart","burndown.close":"Close chart","burndown.windowAria":"Chart window","burndown.ideal":"even pace","burndown.actual":"remaining","burndown.loading":"Loading history…","burndown.failed":"Couldn't load history.","burndown.empty":"No history yet — the chart fills in as quota is sampled.","burndown.windowUnreported":"This plan reports no {window} window, so there is nothing to chart here.","burndown.buildsFrom":"history builds from {date}","burndown.fast":"{pct}% ahead of pace — burning fast","burndown.slow":"{pct}% under pace — room to spare","burndown.even":"on even pace","burndown.emptyBy":"at this rate, 0% by {at}","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} free","resources.used":"{amount} used","resources.stale":"resource data is stale: {stale}","resources.captured":"captured {age}","resources.openAria":"Agent sessions and memory","resources.title":"Agent sessions","resources.total":"Σ {amount}","resources.empty":"no agent sessions in tmux","resources.orphan":"orphan pane","resources.hostConflict":"duplicate conversation pane","resources.hostConflictHint":"multiple live panes claim this conversation","resources.procs":{one:"{count} process",other:"{count} processes"},"resources.swapShare":"+ {amount} swap","resources.kill":"Kill","resources.confirm":"Sure?","resources.killLiveHint":"the agent is working right now — click to unlock, then confirm","resources.killHint":"kill the tmux pane with its whole process tree","resources.bulkLabel":"idle longer than","resources.bulkKill":"Kill idle","resources.bulkNone":"nothing has been idle that long","resources.hoursN":"{n} h","resources.killAll":"Kill all agents","resources.killAllConfirm":"Confirm — kill {n}?","resources.killAllHint":"force-kill every agent pane, live ones included — a clean slate so the next spawn/message routes cleanly. Your shells and the viewer are left alone.","resources.killAllNone":"no agent sessions to kill","resources.close":"Close","attach.attach":"Attach","attach.readonly":"Read-only","attach.copy":"Copy attach command","attach.copyReadonly":"Copy read-only attach command","attach.hint":"copy the tmux attach command for this pane — paste it into any shell","attach.readonlyHint":"copy a read-only (view-only) attach command — you watch without touching the keys","attach.loading":"resolving…","attach.copied":"attach command copied","attach.copiedReadonly":"read-only command copied","attach.stale":"This pane changed or closed. Refresh and try again.","attach.restarted":"The tmux server restarted. Refresh and try again.","attach.unavailable":"The tmux endpoint is unavailable. Refresh and try again.","attach.badRequest":"Can’t resolve this pane — refresh the list.","attach.network":"Network error — try again.","attach.clipboard":"Couldn’t copy — check clipboard permissions.","attach.refresh":"Refresh","status.awaitingPlan":"awaiting plan approval","status.awaitingAnswer":"awaiting an answer to a question","status.awaitingTerminal":"awaiting a reply in the terminal","status.working":"working…","status.returnedResult":"returned with a result","status.stalled":"interrupted or awaiting permission","status.finishedTurn":"finished the turn — waiting for a reply","status.rateLimited":"rate-limited","status.flow":"flow: {label}","rateLimit.badge":"rate-limited","rateLimit.badgeUntil":"rate-limited until {time}","rateLimit.reseat":"continue on a healthy account","rateLimit.reseatRequested":"reseating…","rateLimit.reseatTitle":"Spawn a successor of this conversation on the healthiest signed-in account; the rate-limited one is parked, attached flows follow.","rateLimit.reseatFailed":"reseat failed","rateLimit.reseatAlready":"already reseated","rateLimit.reseatWaitingTurn":"Reseat queued: waiting for the rate-limited turn to release the pane, then the successor spawns.","dictation.capWarn":"less than a minute of recording left","dictation.capStopped":"Recording stopped at the 10-minute limit; the text will appear in the field.","dictation.failed":"couldn't transcribe","dictation.silence":"silence — nothing recognized","dictation.unsupported":"recording is not supported in this browser","dictation.liveError":"live transcription error","dictation.connectionLost":"transcription connection dropped","dictation.noMic":"no microphone access","overview.branchesLiveIn":{one:"{count} branch running in {projects}",other:"{count} branches running in {projects}"},"overview.projects":{one:"{count} project",other:"{count} projects"},"overview.archived":"\xb7 {count} archived","overview.moreLive":"{count} more live","overview.quiet":"quiet \xb7 last activity {age}","overview.empty":"No logs yet","catalog.unreachable":"catalog unavailable","catalog.errorTitle":"Couldn't load the session catalog","catalog.errorBody":"The viewer server did not answer, so what is running is unknown.","catalog.retry":"Retry","catalog.attempts":{one:"{count} failed attempt",other:"{count} failed attempts"},"orch.chat":"Orchestrator","orch.open":"Open the orchestrator chat","orch.starting":"Starting…","orch.error":"Couldn't open the orchestrator — tap to retry","branch.live":"working","branch.waiting":"finished the turn — waiting for a reply","branch.returned":"returned with a result","branch.stalled":"interrupted or awaiting permission","branch.done":"done — safe to remove","branch.worktree":"Worktree {name}","branch.lastActivity":"Last activity: {age}","branch.lastActivityQuiet":"Marked active, but the transcript is quiet: last activity {age}","branch.handoffTitle":"agent spawned by this conversation's handoff","branch.branchTitle":"branch of this conversation","branch.accountTip":"Account {id} \xb7 {engine} \xb7 {health}","branch.accountTipPlain":"Account {id} \xb7 {engine}","branch.accountAria":"Open accounts for {id}","lineage.parentRemoved":"parent removed","lineage.parentRemovedTitle":"The parent conversation transcript was removed","branch.removeColumn":"Remove column {title}","branch.toggleBackground":"{action} background task {title}","branch.collapse":"Collapse","branch.expand":"Expand","branch.expandFull":"Expand conversation {title} to the full window","branch.collapseFull":"Back to the canvas (Esc)","branch.detailsShow":"Show conversation details","branch.detailsHide":"Hide conversation details","branch.favorite":"Mark as favorite","branch.unfavorite":"Remove from favorites","tree.quiet":"Quiet conversations and tasks","taskStacks.collapse":"Fold the card back into its status stack","readiness.title":"Task readiness","readiness.aria":"Readiness sections for every project task","readiness.legend":"Now — assigned into work \xb7 Review — a review is running or has a verdict \xb7 Blocked — needs a decision \xb7 Planned — inbox/backlog \xb7 Done — finished","readiness.section.now":"Now","readiness.section.review":"In review","readiness.section.blocked":"Blocked","readiness.section.planned":"Planned","readiness.section.done":"Done","readiness.sectionAria":"“{section}” tasks \xb7 {count}","readiness.open":"Open task on the board: {title}","readiness.place":"Place task on the map: {title}","readiness.issueAria":"Open issue #{issue} on GitHub","readiness.agent":"agent","readiness.agentAria":"Open the assigned agent: {title}","readiness.pipeline":"pipeline","readiness.pipelineAria":"Open the linked pipeline stage: {title}","readiness.review":"review","readiness.reviewAria":"Open the linked review: {title}","readiness.state.live":"live","readiness.state.gone":"gone","readiness.state.failed":"failed","launchHistory.title":"Launch history","launchHistory.aria":"Terminal launch receipts","launchHistory.failed":"failed","launchHistory.recovered":"recovered","launchHistory.retryLabel":"Retry","launchHistory.retry":"Retry launch: {title}","workerStack.title":"Collapsed workers","workerStack.aria":"Collapsed worker conversations","workerStack.expandGroup":"Expand review group on the board","workerStack.flow":"Flow","workerStack.pipeline":"Pipeline","workerStack.origin":"Spawned","workerStack.worktree":"Workers","corner.waitingCount":"\xb7 {count} waiting","corner.openSwitchboard":"Open the agent switchboard","task.working":", working","task.interrupted":", interrupted","task.finished":", finished","task.interruptedBadge":"interrupted","task.finishedBadge":"finished","task.stopFailed":"couldn't stop","task.signalSent":"sent {signal} to PID {pid}","task.killRequested":"kill requested","task.confirmKill":"Really kill PID {pid}?","task.confirmKillNamed":"Stop {name}?","task.confirmKillUntitled":"this agent","task.confirmKillYes":"Yes, kill","task.stopAria":"Stop process PID {pid}","task.kill":"Kill","task.backgroundCommand":"Background command","task.commandNotFound":"The command that started this background task wasn't found in the session transcripts","viewer.closeProjects":"Close the project list","viewer.agentWaiting":"Agent is waiting for a reply","viewer.closeNotification":"Close the notification","attention.badge":{one:"{count} waiting",other:"{count} waiting"},"attention.openQueue":"Attention queue — who is blocked on you (N — next)","attention.popoverTitle":"Waiting on you","attention.filterOn":"Show only those waiting on you (F)","attention.filterOff":"Show all nodes (F)","mobile.noConvos":"No conversations yet","mobile.map":"Map","mobile.closeMap":"Close the map","mobile.tapNode":"Tap a node — the conversation opens full-screen","mobile.agent":"agent","mobile.openMap":"Open the project map","mobile.mapLoading":"Loading the map…","mobile.marker.open":"Open {title}","mobile.marker.node":"conversation","mobile.marker.deck":"review","mobile.marker.draft":"draft agent","mobile.marker.stack":"history","mobile.marker.worker":"workers","mobile.marker.task":"task","mobile.marker.pipeline":"pipeline","tasks.failed":"failed ({status})","tasks.tool":"Task — the next click drops a card on the canvas (T)","tasks.untitled":"untitled","tasks.newPlaceholder":"task text… (the first line is the title)","tasks.newTask":"new task","tasks.panelCreate":"Create the task","tasks.unplaced":"unplaced","tasks.placeOnMap":"place on map","tasks.addDue":"deadline","tasks.clearDue":"Clear the deadline","tasks.dueTitle":"Deadline (zone: {zone})","tasks.attachCount":{one:"{count} image",other:"{count} images"},"tasks.draftDiscarded":"draft discarded","tasks.editAria":"Task text","tasks.spawning":"starting…","tasks.deadChip":"the conversation is gone from the list","tasks.failedChip":"delivery failed","tasks.killedChip":"the agent process was killed","tasks.unhostedChip":"the agent isn't running","tasks.migratingChip":"the agent is moving to another account","tasks.source":"source","tasks.sourceTitle":"Captured from","tasks.retry":"retry delivery","tasks.retryLaunch":"retry launch","tasks.retryLaunchAria":"Retry the failed launch for {title}","tasks.retryLaunched":"agent relaunched","tasks.chipFailedTitle":"not delivered: {error}","tasks.handoffChip":"routed into this agent's prompt — not sent yet","tasks.detach":"detach","tasks.detachAria":"Detach {title} from this task","tasks.expand":"Expand task","tasks.collapse":"Collapse task","tasks.openAgent":"open and center the agent pane","tasks.openAgentAria":"Open agent {title}","tasks.openAgentUnavailableAria":"Open agent {title} — unavailable: {reason}","tasks.openSource":"open and center the source conversation","tasks.openSourceAria":"Open source conversation {title}","tasks.openSourceUnavailableAria":"Open source conversation {title} — unavailable: {reason}","tasks.sourceGone":"the source conversation is not on the board","tasks.relatedNav":"Related tasks","tasks.openTaskAria":"Open task {title}","tasks.relatedAssignedTitle":"assigned to this conversation","tasks.relatedSourceTitle":"captured from this conversation","tasks.send":"send","tasks.sendTitle":"Pull the arrow onto an agent's pane to drop the task into its prompt (nothing is sent); click to seed a fresh draft conversation","tasks.linkHanded":"routed into “{title}” — review and send it there","tasks.linkSent":"task sent → “{title}”","tasks.spawn":"agent","tasks.spawnTitle":"Spawn a fresh agent with this task as the brief","tasks.spawnGo":"Launch","tasks.statusTitle":"Status: {label} — click cycles (inbox → assigned → blocked → done)","tasks.status.inbox":"inbox","tasks.status.assigned":"assigned","tasks.status.blocked":"blocked","tasks.status.done":"done","tasks.delete":"delete","tasks.deleteConfirm":"sure?","tasks.deleteAria":"Delete task {title}","tasks.pickerTitle":"Send to","tasks.pickerAllChildren":"⤷ all children","tasks.pickerEmpty":"no conversations in the project","tasks.pickerSend":"Send ({count})","tasks.sendOk":"Delivered {delivered} of {total}","tasks.sendFailPart":"✗ “{title}”: {error}","tasks.spawnOk":"agent started in tmux {target}","tasks.composerToggle":"create a task","tasks.composerToggleTitle":"On — the text becomes a tracked task card assigned to the selection; off — a plain broadcast with no trace","tasks.composerNeedsText":"a task needs text","tasks.panelTitle":"Tasks","tasks.panelToggleAria":"Toggle the task panel","tasks.panelThisProject":"this project","tasks.panelAll":"all","tasks.panelEmpty":"no tasks yet — drop one with the board's task tool (T)","tasks.panelClose":"Close the task panel","favorites.sectionTitle":"Favorites","favorites.empty":"no favorites yet — hover a card and tap its crown","favorites.focusTitle":"Focus {title} on the board","tasks.sheetNew":"new task","tasks.sheetCreate":"Create the task","tasks.sheetBack":"Back to the task list","tasks.sheetTargets":{one:"{count} target",other:"{count} targets"},"tasks.sheetAssignments":"assignments","tasks.sheetEmpty":"no tasks yet","tasks.sheetGone":"the task is gone","tasks.textNotSaved":"the text didn't save — delivery aborted, try again","tasks.emptyTextBlocked":"empty text isn't saved — restore the task text before sending","runtime.live":"live","runtime.reconnecting":"reconnecting","runtime.degraded":"degraded","runtime.offline":"offline","runtime.resynced":"resynced","runtime.connection":"runtime connection","runtime.announce.live":"runtime connection live","runtime.announce.reconnecting":"runtime reconnecting","runtime.announce.degraded":"runtime degraded — polling for updates","runtime.announce.offline":"runtime offline","runtime.announce.resynced":"runtime resynced from a fresh snapshot","runtime.staleSince":"stale {duration}","runtime.lastKnown":"last update {duration} ago","runtime.legacyProvenance":"legacy \xb7 derived state","staging.badge":"Staging","staging.badgeTitle":"Staging instance — isolated state; nothing here touches prod","runtime.drift":"drift: {evidence}","runtime.driftDismiss":"Dismiss","runtime.receipt.pending":"sending…","runtime.receipt.busyRetry":"Couldn’t deliver — agent is busy, we’ll retry","runtime.receipt.summary":"Delivery attempts: {count}","runtime.receipt.pendingCount":"pending: {count}","runtime.receipt.attemptCount":"attempts: {count}","runtime.receipt.problemCount":"issues: {count}","runtime.receipt.showDetails":"Show delivery details","runtime.receipt.hideDetails":"Hide delivery details","runtime.receipt.statusSummary":"Delivery status: {pending}, {problems}.","runtime.receipt.statusPending":{one:"{count} pending message",other:"{count} pending messages"},"runtime.receipt.statusProblems":{one:"{count} issue",other:"{count} issues"},"runtime.receipt.delivering":"delivering…","runtime.receipt.applying":"applying switch…","runtime.receipt.turn-started":"turn started","runtime.receipt.steered":"steered into current turn","runtime.receipt.queued":"queued","runtime.receipt.queuedPos":"queued \xb7 #{position}","runtime.receipt.delivered":"delivered","runtime.receipt.applied":"switch applied","runtime.receipt.interrupted":"interrupted","runtime.receipt.answered":"answered","runtime.receipt.rejected":"rejected: {reason}","runtime.receipt.failed":"failed: {reason}","runtime.receipt.uncertain":"uncertain — recovering","runtime.receipt.retry":"Retry","runtime.receipt.edit":"Edit & resend","runtime.receipt.dismiss":"Dismiss","runtime.attention.title":"needs your decision","runtime.attention.approval":"approval","runtime.attention.permission":"permission","runtime.attention.question":"question","runtime.attention.waiting_heuristic":"possibly waiting","runtime.attention.heuristicNote":"low-confidence signal","runtime.attention.unowned":"no approver attached","runtime.attention.command":"command","runtime.attention.tool":"tool","runtime.attention.approve":"Approve","runtime.attention.deny":"Deny","runtime.attention.answer":"Answer","runtime.attention.answering":"answering…","runtime.attention.expiresIn":"auto-resolves in {seconds}s","runtime.attention.keysHint":"Enter approves \xb7 Esc denies","voice.start":"Start continuous voice conversation","voice.stop":"End voice conversation","voice.connecting":"Connecting voice…","voice.live":"Voice conversation is live \xb7 speak whenever you’re ready","voice.stopping":"Ending voice conversation…","voice.failed":"Voice connection needs attention","voice.panel":"Voice conversation","voice.you":"You","voice.agent":"Agent","voice.progress":"Progress","voice.retry":"Try again","voice.ended":"Voice conversation ended","voice.elapsed":"Call duration","voice.micLevel":"Microphone level","voice.micMute":"Mute microphone","voice.micUnmute":"Unmute microphone","voice.outputMute":"Silence the agent","voice.outputUnmute":"Unsilence the agent","voice.floatSurface":"Voice conversation","voice.float":"Open the floating voice window","voice.dock":"Close the floating window and keep the call","voice.floatUnsupported":"A floating voice window needs a Chromium browser; the call stays here.","attention.return":"Back to where you were","attention.returnLine":"Go back to where you were"}},9554:(e,t,n)=>{"use strict";n.d(t,{PG:()=>a,YP:()=>i});let r={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"},i=0xa00000;function a(e){return r[e]??null}},9992:(e,t,n)=>{"use strict";n.d(t,{$T:()=>s.A,BK:()=>O.A,GO:()=>I.A,JG:()=>f.A,Jl:()=>p.A,Kq:()=>F.A,M6:()=>R.A,MA:()=>d.A,O0:()=>y.A,QR:()=>v.A,Qp:()=>o.A,RE:()=>E.A,TB:()=>D.A,Td:()=>a.A,X:()=>L.A,Zr:()=>k.A,_T:()=>M.A,c9:()=>G,c_:()=>h.A,eW:()=>c.A,gE:()=>C.A,jG:()=>T.A,jy:()=>u.A,kU:()=>w.A,ke:()=>P.A,kr:()=>J.A,kt:()=>$.A,oF:()=>A.A,qk:()=>i.A,rW:()=>g.A,rX:()=>x.A,uB:()=>b.A,vv:()=>S.A,xf:()=>j.A,yQ:()=>m.A,yd:()=>l.A,zg:()=>N.A});var r=n(5155),i=n(6599),a=n(2159),s=n(7218),l=n(9805),o=n(467),c=n(99),d=n(7381),u=n(5045),p=n(9339),m=n(2363),f=n(8780),h=n(6721),x=n(4088),g=n(4962),b=n(5222),v=n(9314),w=n(5182),y=n(4885),k=n(5480),j=n(6210),N=n(9707),S=n(8747),C=n(5796),A=n(4551),I=n(5688),M=n(7979),T=n(6619),$=n(1189),E=n(6851),R=n(852),P=n(4179),O=n(6449),D=n(5738),L=n(9005),F=n(9804),_=n(7990),q=n(8910),z=n(5561),H=n(966),B=n(2750),U=n(6483),K=n(6455),Y=n(5377),W=n(626),J=n(2571);let V={shell:h.A,tool:_.A,"cmd-group":O.A,codex:b.A,claude:E.A,image:j.A,blob:q.A,note:M.A,citation:z.A,message:C.A,shutdown:H.A,plan:B.A,compact:y.A,file:U.A,edit:K.A,search:Y.A,web:W.A,spawn:k.A,clock:i.A};function G({name:e,className:t}){let n=V[e];return(0,r.jsx)(n,{className:t??"h-3.5 w-3.5","aria-hidden":!0})}}},e=>{e.O(0,[9260,8441,3794,7358],()=>e(e.s=9097)),_N_E=e.O()}]);