@roackb2/heddle 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/README.md +9 -1
  2. package/dist/src/cli/ask.d.ts +11 -1
  3. package/dist/src/cli/ask.d.ts.map +1 -1
  4. package/dist/src/cli/ask.js +172 -198
  5. package/dist/src/cli/ask.js.map +1 -1
  6. package/dist/src/cli/chat/App.d.ts.map +1 -1
  7. package/dist/src/cli/chat/App.js +17 -146
  8. package/dist/src/cli/chat/App.js.map +1 -1
  9. package/dist/src/cli/chat/adapters/slash-command-context.js +1 -1
  10. package/dist/src/cli/chat/adapters/slash-command-context.js.map +1 -1
  11. package/dist/src/cli/chat/hooks/{tui-agent-turn-lifecycle.d.ts → controllers/run/tui-agent-turn-lifecycle.d.ts} +1 -1
  12. package/dist/src/cli/chat/hooks/controllers/run/tui-agent-turn-lifecycle.d.ts.map +1 -0
  13. package/dist/src/cli/chat/hooks/controllers/run/tui-agent-turn-lifecycle.js.map +1 -0
  14. package/dist/src/cli/chat/hooks/controllers/run/tui-agent-turn-result.d.ts +35 -0
  15. package/dist/src/cli/chat/hooks/controllers/run/tui-agent-turn-result.d.ts.map +1 -0
  16. package/dist/src/cli/chat/hooks/controllers/run/tui-agent-turn-result.js +60 -0
  17. package/dist/src/cli/chat/hooks/controllers/run/tui-agent-turn-result.js.map +1 -0
  18. package/dist/src/cli/chat/hooks/controllers/run/tui-compaction-status.d.ts +24 -0
  19. package/dist/src/cli/chat/hooks/controllers/run/tui-compaction-status.d.ts.map +1 -0
  20. package/dist/src/cli/chat/hooks/{tui-compaction-status.js → controllers/run/tui-compaction-status.js} +12 -24
  21. package/dist/src/cli/chat/hooks/controllers/run/tui-compaction-status.js.map +1 -0
  22. package/dist/src/cli/chat/hooks/{tui-direct-shell-result.d.ts → controllers/run/tui-direct-shell-result.d.ts} +6 -6
  23. package/dist/src/cli/chat/hooks/controllers/run/tui-direct-shell-result.d.ts.map +1 -0
  24. package/dist/src/cli/chat/hooks/{tui-direct-shell-result.js → controllers/run/tui-direct-shell-result.js} +12 -12
  25. package/dist/src/cli/chat/hooks/controllers/run/tui-direct-shell-result.js.map +1 -0
  26. package/dist/src/cli/chat/hooks/controllers/run/tui-direct-shell.d.ts +22 -0
  27. package/dist/src/cli/chat/hooks/controllers/run/tui-direct-shell.d.ts.map +1 -0
  28. package/dist/src/cli/chat/hooks/{tui-direct-shell.js → controllers/run/tui-direct-shell.js} +40 -35
  29. package/dist/src/cli/chat/hooks/controllers/run/tui-direct-shell.js.map +1 -0
  30. package/dist/src/cli/chat/hooks/{tui-drift-observer.d.ts → controllers/run/tui-drift-observer.d.ts} +3 -3
  31. package/dist/src/cli/chat/hooks/controllers/run/tui-drift-observer.d.ts.map +1 -0
  32. package/dist/src/cli/chat/hooks/{tui-drift-observer.js → controllers/run/tui-drift-observer.js} +2 -2
  33. package/dist/src/cli/chat/hooks/controllers/run/tui-drift-observer.js.map +1 -0
  34. package/dist/src/cli/chat/hooks/{tui-ordinary-turn.d.ts → controllers/run/tui-ordinary-turn.d.ts} +8 -5
  35. package/dist/src/cli/chat/hooks/controllers/run/tui-ordinary-turn.d.ts.map +1 -0
  36. package/dist/src/cli/chat/hooks/{tui-ordinary-turn.js → controllers/run/tui-ordinary-turn.js} +14 -13
  37. package/dist/src/cli/chat/hooks/controllers/run/tui-ordinary-turn.js.map +1 -0
  38. package/dist/src/cli/chat/hooks/{tui-run-loop-events.d.ts → controllers/run/tui-run-loop-events.d.ts} +6 -6
  39. package/dist/src/cli/chat/hooks/controllers/run/tui-run-loop-events.d.ts.map +1 -0
  40. package/dist/src/cli/chat/hooks/{tui-run-loop-events.js → controllers/run/tui-run-loop-events.js} +27 -27
  41. package/dist/src/cli/chat/hooks/controllers/run/tui-run-loop-events.js.map +1 -0
  42. package/dist/src/cli/chat/hooks/{tui-tool-approval.d.ts → controllers/run/tui-tool-approval.d.ts} +3 -3
  43. package/dist/src/cli/chat/hooks/controllers/run/tui-tool-approval.d.ts.map +1 -0
  44. package/dist/src/cli/chat/hooks/{tui-tool-approval.js → controllers/run/tui-tool-approval.js} +4 -4
  45. package/dist/src/cli/chat/hooks/controllers/run/tui-tool-approval.js.map +1 -0
  46. package/dist/src/cli/chat/hooks/{useAgentRun.d.ts → controllers/useAgentRunController.d.ts} +14 -11
  47. package/dist/src/cli/chat/hooks/controllers/useAgentRunController.d.ts.map +1 -0
  48. package/dist/src/cli/chat/hooks/{useAgentRun.js → controllers/useAgentRunController.js} +34 -23
  49. package/dist/src/cli/chat/hooks/controllers/useAgentRunController.js.map +1 -0
  50. package/dist/src/cli/chat/hooks/controllers/useChatAppController.d.ts +26 -0
  51. package/dist/src/cli/chat/hooks/controllers/useChatAppController.d.ts.map +1 -0
  52. package/dist/src/cli/chat/hooks/controllers/useChatAppController.js +164 -0
  53. package/dist/src/cli/chat/hooks/controllers/useChatAppController.js.map +1 -0
  54. package/dist/src/cli/chat/hooks/{usePromptSubmission.d.ts → controllers/usePromptSubmissionController.d.ts} +10 -9
  55. package/dist/src/cli/chat/hooks/controllers/usePromptSubmissionController.d.ts.map +1 -0
  56. package/dist/src/cli/chat/hooks/{usePromptSubmission.js → controllers/usePromptSubmissionController.js} +13 -12
  57. package/dist/src/cli/chat/hooks/controllers/usePromptSubmissionController.js.map +1 -0
  58. package/dist/src/cli/chat/hooks/useApprovalFlow.d.ts +1 -1
  59. package/dist/src/cli/chat/hooks/useApprovalFlow.d.ts.map +1 -1
  60. package/dist/src/cli/chat/hooks/useChatDrift.d.ts +4 -4
  61. package/dist/src/cli/chat/hooks/useChatDrift.d.ts.map +1 -1
  62. package/dist/src/cli/chat/hooks/useChatDrift.js +7 -6
  63. package/dist/src/cli/chat/hooks/useChatDrift.js.map +1 -1
  64. package/dist/src/cli/chat/hooks/useChatSessions.d.ts +3 -0
  65. package/dist/src/cli/chat/hooks/useChatSessions.d.ts.map +1 -1
  66. package/dist/src/cli/chat/hooks/useChatSessions.js +66 -87
  67. package/dist/src/cli/chat/hooks/useChatSessions.js.map +1 -1
  68. package/dist/src/cli/chat/submit.d.ts +3 -4
  69. package/dist/src/cli/chat/submit.d.ts.map +1 -1
  70. package/dist/src/cli/chat/submit.js +17 -55
  71. package/dist/src/cli/chat/submit.js.map +1 -1
  72. package/dist/src/cli/chat/utils/runtime.d.ts.map +1 -1
  73. package/dist/src/cli/chat/utils/runtime.js.map +1 -1
  74. package/dist/src/cli/daemon.d.ts +2 -2
  75. package/dist/src/cli/daemon.d.ts.map +1 -1
  76. package/dist/src/cli/daemon.js +2 -2
  77. package/dist/src/cli/daemon.js.map +1 -1
  78. package/dist/src/cli/main.js +3 -3
  79. package/dist/src/cli/main.js.map +1 -1
  80. package/dist/src/cli/remote/control-plane-client.d.ts +8 -4
  81. package/dist/src/cli/remote/control-plane-client.d.ts.map +1 -1
  82. package/dist/src/cli/session.js +1 -1
  83. package/dist/src/cli/session.js.map +1 -1
  84. package/dist/src/core/awareness/domains/coding/collectors/project-signals.d.ts +12 -0
  85. package/dist/src/core/awareness/domains/coding/collectors/project-signals.d.ts.map +1 -0
  86. package/dist/src/core/awareness/domains/coding/collectors/project-signals.js +187 -0
  87. package/dist/src/core/awareness/domains/coding/collectors/project-signals.js.map +1 -0
  88. package/dist/src/core/awareness/domains/coding/collectors/workspace.d.ts +3 -1
  89. package/dist/src/core/awareness/domains/coding/collectors/workspace.d.ts.map +1 -1
  90. package/dist/src/core/awareness/domains/coding/collectors/workspace.js +20 -11
  91. package/dist/src/core/awareness/domains/coding/collectors/workspace.js.map +1 -1
  92. package/dist/src/core/awareness/domains/coding/detectors/go.d.ts +3 -0
  93. package/dist/src/core/awareness/domains/coding/detectors/go.d.ts.map +1 -0
  94. package/dist/src/core/awareness/domains/coding/detectors/go.js +48 -0
  95. package/dist/src/core/awareness/domains/coding/detectors/go.js.map +1 -0
  96. package/dist/src/core/awareness/domains/coding/detectors/javascript.d.ts +3 -0
  97. package/dist/src/core/awareness/domains/coding/detectors/javascript.d.ts.map +1 -0
  98. package/dist/src/core/awareness/domains/coding/detectors/javascript.js +90 -0
  99. package/dist/src/core/awareness/domains/coding/detectors/javascript.js.map +1 -0
  100. package/dist/src/core/awareness/domains/coding/detectors/python.d.ts +3 -0
  101. package/dist/src/core/awareness/domains/coding/detectors/python.d.ts.map +1 -0
  102. package/dist/src/core/awareness/domains/coding/detectors/python.js +79 -0
  103. package/dist/src/core/awareness/domains/coding/detectors/python.js.map +1 -0
  104. package/dist/src/core/awareness/domains/coding/detectors/types.d.ts +18 -0
  105. package/dist/src/core/awareness/domains/coding/detectors/types.d.ts.map +1 -0
  106. package/dist/src/core/awareness/domains/coding/detectors/types.js +2 -0
  107. package/dist/src/core/awareness/domains/coding/detectors/types.js.map +1 -0
  108. package/dist/src/core/awareness/domains/coding/format.d.ts.map +1 -1
  109. package/dist/src/core/awareness/domains/coding/format.js +6 -0
  110. package/dist/src/core/awareness/domains/coding/format.js.map +1 -1
  111. package/dist/src/core/awareness/domains/coding/provider.d.ts.map +1 -1
  112. package/dist/src/core/awareness/domains/coding/provider.js +18 -1
  113. package/dist/src/core/awareness/domains/coding/provider.js.map +1 -1
  114. package/dist/src/core/awareness/domains/coding/types.d.ts +68 -1
  115. package/dist/src/core/awareness/domains/coding/types.d.ts.map +1 -1
  116. package/dist/src/core/awareness/types.d.ts +1 -1
  117. package/dist/src/core/awareness/types.d.ts.map +1 -1
  118. package/dist/src/core/chat/engine/conversation-engine.d.ts.map +1 -1
  119. package/dist/src/core/chat/engine/conversation-engine.js +4 -8
  120. package/dist/src/core/chat/engine/conversation-engine.js.map +1 -1
  121. package/dist/src/core/chat/engine/index.d.ts +1 -1
  122. package/dist/src/core/chat/engine/index.d.ts.map +1 -1
  123. package/dist/src/core/chat/engine/sessions/{storage.d.ts → repository/file-chat-session-repository.d.ts} +17 -18
  124. package/dist/src/core/chat/engine/sessions/repository/file-chat-session-repository.d.ts.map +1 -0
  125. package/dist/src/core/chat/engine/sessions/{storage.js → repository/file-chat-session-repository.js} +70 -51
  126. package/dist/src/core/chat/engine/sessions/repository/file-chat-session-repository.js.map +1 -0
  127. package/dist/src/core/chat/engine/sessions/service.d.ts +43 -4
  128. package/dist/src/core/chat/engine/sessions/service.d.ts.map +1 -1
  129. package/dist/src/core/chat/engine/sessions/service.js +268 -46
  130. package/dist/src/core/chat/engine/sessions/service.js.map +1 -1
  131. package/dist/src/core/chat/engine/sessions/session-record.d.ts +16 -0
  132. package/dist/src/core/chat/engine/sessions/session-record.d.ts.map +1 -0
  133. package/dist/src/core/chat/engine/sessions/session-record.js +60 -0
  134. package/dist/src/core/chat/engine/sessions/session-record.js.map +1 -0
  135. package/dist/src/core/chat/engine/turns/context.d.ts +2 -0
  136. package/dist/src/core/chat/engine/turns/context.d.ts.map +1 -1
  137. package/dist/src/core/chat/engine/turns/context.js +3 -3
  138. package/dist/src/core/chat/engine/turns/context.js.map +1 -1
  139. package/dist/src/core/chat/engine/turns/memory-maintenance.d.ts.map +1 -1
  140. package/dist/src/core/chat/engine/turns/memory-maintenance.js +2 -1
  141. package/dist/src/core/chat/engine/turns/memory-maintenance.js.map +1 -1
  142. package/dist/src/core/chat/engine/turns/persistence.d.ts.map +1 -1
  143. package/dist/src/core/chat/engine/turns/persistence.js +2 -1
  144. package/dist/src/core/chat/engine/turns/persistence.js.map +1 -1
  145. package/dist/src/core/chat/engine/turns/preflight.d.ts.map +1 -1
  146. package/dist/src/core/chat/engine/turns/preflight.js +2 -1
  147. package/dist/src/core/chat/engine/turns/preflight.js.map +1 -1
  148. package/dist/src/core/chat/engine/turns/result.js +1 -1
  149. package/dist/src/core/chat/engine/turns/result.js.map +1 -1
  150. package/dist/src/core/chat/engine/turns/run-conversation-turn.d.ts +10 -0
  151. package/dist/src/core/chat/engine/turns/run-conversation-turn.d.ts.map +1 -1
  152. package/dist/src/core/chat/engine/turns/run-conversation-turn.js +12 -1
  153. package/dist/src/core/chat/engine/turns/run-conversation-turn.js.map +1 -1
  154. package/dist/src/core/chat/engine/turns/service.d.ts +9 -4
  155. package/dist/src/core/chat/engine/turns/service.d.ts.map +1 -1
  156. package/dist/src/core/chat/engine/turns/service.js +29 -28
  157. package/dist/src/core/chat/engine/turns/service.js.map +1 -1
  158. package/dist/src/core/chat/engine/types.d.ts +48 -2
  159. package/dist/src/core/chat/engine/types.d.ts.map +1 -1
  160. package/dist/src/core/chat/types.d.ts +2 -0
  161. package/dist/src/core/chat/types.d.ts.map +1 -1
  162. package/dist/src/core/prompts/system-prompt.d.ts.map +1 -1
  163. package/dist/src/core/prompts/system-prompt.js +1 -0
  164. package/dist/src/core/prompts/system-prompt.js.map +1 -1
  165. package/dist/src/core/tools/toolkits/coding-awareness/project-dashboard.d.ts.map +1 -1
  166. package/dist/src/core/tools/toolkits/coding-awareness/project-dashboard.js +9 -4
  167. package/dist/src/core/tools/toolkits/coding-awareness/project-dashboard.js.map +1 -1
  168. package/dist/src/index.d.ts +1 -1
  169. package/dist/src/index.d.ts.map +1 -1
  170. package/dist/src/index.js.map +1 -1
  171. package/dist/src/server/app.js +3 -3
  172. package/dist/src/server/app.js.map +1 -1
  173. package/dist/src/server/features/control-plane/{services → controllers}/ask.d.ts +5 -1
  174. package/dist/src/server/features/control-plane/controllers/ask.d.ts.map +1 -0
  175. package/dist/src/server/features/control-plane/controllers/ask.js +68 -0
  176. package/dist/src/server/features/control-plane/controllers/ask.js.map +1 -0
  177. package/dist/src/server/features/control-plane/controllers/chat-session-events.d.ts +26 -0
  178. package/dist/src/server/features/control-plane/controllers/chat-session-events.d.ts.map +1 -0
  179. package/dist/src/server/features/control-plane/controllers/chat-session-events.js +49 -0
  180. package/dist/src/server/features/control-plane/controllers/chat-session-events.js.map +1 -0
  181. package/dist/src/server/features/control-plane/controllers/chat-session-presenter.d.ts +12 -0
  182. package/dist/src/server/features/control-plane/controllers/chat-session-presenter.d.ts.map +1 -0
  183. package/dist/src/server/features/control-plane/controllers/chat-session-presenter.js +181 -0
  184. package/dist/src/server/features/control-plane/controllers/chat-session-presenter.js.map +1 -0
  185. package/dist/src/server/features/control-plane/controllers/chat-sessions-controller.d.ts +63 -0
  186. package/dist/src/server/features/control-plane/controllers/chat-sessions-controller.d.ts.map +1 -0
  187. package/dist/src/server/features/control-plane/controllers/chat-sessions-controller.js +285 -0
  188. package/dist/src/server/features/control-plane/controllers/chat-sessions-controller.js.map +1 -0
  189. package/dist/src/server/features/control-plane/controllers/chat-turn-review-presenter.d.ts +13 -0
  190. package/dist/src/server/features/control-plane/controllers/chat-turn-review-presenter.d.ts.map +1 -0
  191. package/dist/src/server/features/control-plane/controllers/chat-turn-review-presenter.js +196 -0
  192. package/dist/src/server/features/control-plane/controllers/chat-turn-review-presenter.js.map +1 -0
  193. package/dist/src/server/features/control-plane/controllers/control-plane-state.d.ts +7 -0
  194. package/dist/src/server/features/control-plane/controllers/control-plane-state.d.ts.map +1 -0
  195. package/dist/src/server/features/control-plane/controllers/control-plane-state.js +64 -0
  196. package/dist/src/server/features/control-plane/controllers/control-plane-state.js.map +1 -0
  197. package/dist/src/server/features/control-plane/controllers/heartbeat.d.ts +12 -0
  198. package/dist/src/server/features/control-plane/controllers/heartbeat.d.ts.map +1 -0
  199. package/dist/src/server/features/control-plane/controllers/heartbeat.js +59 -0
  200. package/dist/src/server/features/control-plane/controllers/heartbeat.js.map +1 -0
  201. package/dist/src/server/features/control-plane/controllers/layout-snapshots.d.ts +13 -0
  202. package/dist/src/server/features/control-plane/controllers/layout-snapshots.d.ts.map +1 -0
  203. package/dist/src/server/features/control-plane/controllers/layout-snapshots.js +70 -0
  204. package/dist/src/server/features/control-plane/controllers/layout-snapshots.js.map +1 -0
  205. package/dist/src/server/features/control-plane/controllers/memory.d.ts +25 -0
  206. package/dist/src/server/features/control-plane/controllers/memory.d.ts.map +1 -0
  207. package/dist/src/server/features/control-plane/controllers/memory.js +44 -0
  208. package/dist/src/server/features/control-plane/controllers/memory.js.map +1 -0
  209. package/dist/src/server/features/control-plane/controllers/workspace-diff.d.ts +18 -0
  210. package/dist/src/server/features/control-plane/controllers/workspace-diff.d.ts.map +1 -0
  211. package/dist/src/server/features/control-plane/controllers/workspace-diff.js +260 -0
  212. package/dist/src/server/features/control-plane/controllers/workspace-diff.js.map +1 -0
  213. package/dist/src/server/features/control-plane/controllers/workspace-files.d.ts +38 -0
  214. package/dist/src/server/features/control-plane/controllers/workspace-files.d.ts.map +1 -0
  215. package/dist/src/server/features/control-plane/controllers/workspace-files.js +139 -0
  216. package/dist/src/server/features/control-plane/controllers/workspace-files.js.map +1 -0
  217. package/dist/src/server/features/control-plane/helpers/read-values.d.ts +7 -0
  218. package/dist/src/server/features/control-plane/helpers/read-values.d.ts.map +1 -0
  219. package/dist/src/server/features/control-plane/helpers/read-values.js +26 -0
  220. package/dist/src/server/features/control-plane/helpers/read-values.js.map +1 -0
  221. package/dist/src/server/features/control-plane/router.d.ts +8 -4
  222. package/dist/src/server/features/control-plane/router.d.ts.map +1 -1
  223. package/dist/src/server/features/control-plane/router.js +59 -40
  224. package/dist/src/server/features/control-plane/router.js.map +1 -1
  225. package/dist/src/server/features/control-plane/types.d.ts +2 -0
  226. package/dist/src/server/features/control-plane/types.d.ts.map +1 -1
  227. package/dist/src/server/index.d.ts +1 -1
  228. package/dist/src/server/index.d.ts.map +1 -1
  229. package/dist/src/server/index.js +1 -1
  230. package/dist/src/server/index.js.map +1 -1
  231. package/dist/src/server/router.d.ts +8 -4
  232. package/dist/src/server/router.d.ts.map +1 -1
  233. package/dist/src/web/assets/{MonacoDiffViewer-vifX8i2F.js → MonacoDiffViewer-D0Ed6GCN.js} +1 -1
  234. package/dist/src/web/assets/{index-vEln1ViW.js → index-B_9nk8kS.js} +2 -2
  235. package/dist/src/web/index.html +1 -1
  236. package/package.json +6 -2
  237. package/dist/src/cli/chat/hooks/tui-agent-turn-lifecycle.d.ts.map +0 -1
  238. package/dist/src/cli/chat/hooks/tui-agent-turn-lifecycle.js.map +0 -1
  239. package/dist/src/cli/chat/hooks/tui-agent-turn-result.d.ts +0 -48
  240. package/dist/src/cli/chat/hooks/tui-agent-turn-result.d.ts.map +0 -1
  241. package/dist/src/cli/chat/hooks/tui-agent-turn-result.js +0 -172
  242. package/dist/src/cli/chat/hooks/tui-agent-turn-result.js.map +0 -1
  243. package/dist/src/cli/chat/hooks/tui-compaction-status.d.ts +0 -24
  244. package/dist/src/cli/chat/hooks/tui-compaction-status.d.ts.map +0 -1
  245. package/dist/src/cli/chat/hooks/tui-compaction-status.js.map +0 -1
  246. package/dist/src/cli/chat/hooks/tui-direct-shell-result.d.ts.map +0 -1
  247. package/dist/src/cli/chat/hooks/tui-direct-shell-result.js.map +0 -1
  248. package/dist/src/cli/chat/hooks/tui-direct-shell.d.ts +0 -22
  249. package/dist/src/cli/chat/hooks/tui-direct-shell.d.ts.map +0 -1
  250. package/dist/src/cli/chat/hooks/tui-direct-shell.js.map +0 -1
  251. package/dist/src/cli/chat/hooks/tui-drift-observer.d.ts.map +0 -1
  252. package/dist/src/cli/chat/hooks/tui-drift-observer.js.map +0 -1
  253. package/dist/src/cli/chat/hooks/tui-ordinary-turn.d.ts.map +0 -1
  254. package/dist/src/cli/chat/hooks/tui-ordinary-turn.js.map +0 -1
  255. package/dist/src/cli/chat/hooks/tui-run-loop-events.d.ts.map +0 -1
  256. package/dist/src/cli/chat/hooks/tui-run-loop-events.js.map +0 -1
  257. package/dist/src/cli/chat/hooks/tui-tool-approval.d.ts.map +0 -1
  258. package/dist/src/cli/chat/hooks/tui-tool-approval.js.map +0 -1
  259. package/dist/src/cli/chat/hooks/useAgentRun.d.ts.map +0 -1
  260. package/dist/src/cli/chat/hooks/useAgentRun.js.map +0 -1
  261. package/dist/src/cli/chat/hooks/usePromptSubmission.d.ts.map +0 -1
  262. package/dist/src/cli/chat/hooks/usePromptSubmission.js.map +0 -1
  263. package/dist/src/cli/chat/state/storage.d.ts +0 -2
  264. package/dist/src/cli/chat/state/storage.d.ts.map +0 -1
  265. package/dist/src/cli/chat/state/storage.js +0 -2
  266. package/dist/src/cli/chat/state/storage.js.map +0 -1
  267. package/dist/src/core/chat/engine/sessions/storage.d.ts.map +0 -1
  268. package/dist/src/core/chat/engine/sessions/storage.js.map +0 -1
  269. package/dist/src/server/features/control-plane/services/ask.d.ts.map +0 -1
  270. package/dist/src/server/features/control-plane/services/ask.js +0 -66
  271. package/dist/src/server/features/control-plane/services/ask.js.map +0 -1
  272. package/dist/src/server/features/control-plane/services/chat-session-events.d.ts +0 -26
  273. package/dist/src/server/features/control-plane/services/chat-session-events.d.ts.map +0 -1
  274. package/dist/src/server/features/control-plane/services/chat-session-events.js +0 -61
  275. package/dist/src/server/features/control-plane/services/chat-session-events.js.map +0 -1
  276. package/dist/src/server/features/control-plane/services/chat-sessions.d.ts +0 -59
  277. package/dist/src/server/features/control-plane/services/chat-sessions.d.ts.map +0 -1
  278. package/dist/src/server/features/control-plane/services/chat-sessions.js +0 -651
  279. package/dist/src/server/features/control-plane/services/chat-sessions.js.map +0 -1
  280. package/dist/src/server/features/control-plane/services/control-plane-state.d.ts +0 -4
  281. package/dist/src/server/features/control-plane/services/control-plane-state.d.ts.map +0 -1
  282. package/dist/src/server/features/control-plane/services/control-plane-state.js +0 -56
  283. package/dist/src/server/features/control-plane/services/control-plane-state.js.map +0 -1
  284. package/dist/src/server/features/control-plane/services/heartbeat.d.ts +0 -9
  285. package/dist/src/server/features/control-plane/services/heartbeat.d.ts.map +0 -1
  286. package/dist/src/server/features/control-plane/services/heartbeat.js +0 -57
  287. package/dist/src/server/features/control-plane/services/heartbeat.js.map +0 -1
  288. package/dist/src/server/features/control-plane/services/layout-snapshots.d.ts +0 -6
  289. package/dist/src/server/features/control-plane/services/layout-snapshots.d.ts.map +0 -1
  290. package/dist/src/server/features/control-plane/services/layout-snapshots.js +0 -68
  291. package/dist/src/server/features/control-plane/services/layout-snapshots.js.map +0 -1
  292. package/dist/src/server/features/control-plane/services/memory.d.ts +0 -22
  293. package/dist/src/server/features/control-plane/services/memory.d.ts.map +0 -1
  294. package/dist/src/server/features/control-plane/services/memory.js +0 -36
  295. package/dist/src/server/features/control-plane/services/memory.js.map +0 -1
  296. package/dist/src/server/features/control-plane/services/workspace-diff.d.ts +0 -4
  297. package/dist/src/server/features/control-plane/services/workspace-diff.d.ts.map +0 -1
  298. package/dist/src/server/features/control-plane/services/workspace-diff.js +0 -258
  299. package/dist/src/server/features/control-plane/services/workspace-diff.js.map +0 -1
  300. package/dist/src/server/features/control-plane/services/workspace-files.d.ts +0 -27
  301. package/dist/src/server/features/control-plane/services/workspace-files.d.ts.map +0 -1
  302. package/dist/src/server/features/control-plane/services/workspace-files.js +0 -137
  303. package/dist/src/server/features/control-plane/services/workspace-files.js.map +0 -1
  304. /package/dist/src/cli/chat/hooks/{tui-agent-turn-lifecycle.js → controllers/run/tui-agent-turn-lifecycle.js} +0 -0
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MonacoDiffViewer-vifX8i2F.js","assets/chunk-DECur_0Z.js","assets/editor.api2-DRhrSk9h.js","assets/editor-Br_kD0ds.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MonacoDiffViewer-D0Ed6GCN.js","assets/chunk-DECur_0Z.js","assets/editor.api2-DRhrSk9h.js","assets/editor-Br_kD0ds.css"])))=>i.map(i=>d[i]);
2
2
  import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=M(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function te(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},F={map:te,forEach:function(e,t,n){te(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return te(e,function(){t++}),t},toArray:function(e){return te(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=F,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,P)}catch(e){P(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),i=n(((e,t)=>{t.exports=r()})),a=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,k=ee.port2;ee.port1.onmessage=D,O=function(){k.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),o=n(((e,t)=>{t.exports=a()})),s=n((e=>{var t=i();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),c=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n((e=>{var t=o(),n=i(),r=c();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(a(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return f(i),e;if(o===r)return f(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function ae(e){return{current:e}}function I(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function L(e,t){ie++,re[ie]=e.current,e.current=t}var oe=ae(null),se=ae(null),ce=ae(null),le=ae(null);function ue(e,t){switch(L(ce,t),L(se,e),L(oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kd(t),e=qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}I(oe),L(oe,e)}function de(){I(oe),I(se),I(ce)}function fe(e){e.memoizedState!==null&&L(le,e);var t=oe.current,n=qd(t,e.type);t!==n&&(L(se,e),L(oe,n))}function pe(e){se.current===e&&(I(oe),I(se)),le.current===e&&(I(le),rp._currentValue=ne)}var me,he;function ge(e){if(me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);me=t&&t[1]||``,he=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+me+e+he}var _e=!1;function ve(e,t){if(!e||_e)return``;_e=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -78,4 +78,4 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
78
78
  `,...a.current()});return/^[\t ]/.test(l)&&(l=EC(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}MC.peek=NC;function MC(e){return e.value||``}function NC(){return`<`}PC.peek=FC;function PC(e,t,n,r){let i=CC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function FC(){return`!`}IC.peek=LC;function IC(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function LC(){return`!`}RC.peek=zC;function RC(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function zC(){return"`"}function BC(e,t){let n=d_(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}VC.peek=HC;function VC(e,t,n,r){let i=CC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(BC(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function HC(e,t,n){return BC(e,n)?`<`:`[`}UC.peek=WC;function UC(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function WC(){return`[`}function GC(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function KC(e){let t=GC(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function qC(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function JC(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function YC(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?qC(n):GC(n),s=e.ordered?o===`.`?`)`:`.`:KC(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),JC(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function XC(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function ZC(e,t,n,r){let i=XC(n),a=n.bulletCurrent||GC(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function QC(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var $C=rx([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function ew(e,t,n,r){return(e.children.some(function(e){return $C(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function tw(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}nw.peek=rw;function nw(e,t,n,r){let i=tw(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=DC(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=EC(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=DC(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+EC(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function rw(e,t,n){return n.options.strong||`*`}function iw(e,t,n,r){return n.safe(e.value,r)}function aw(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function ow(e,t,n){let r=(JC(n)+(n.options.ruleSpaces?` `:``)).repeat(aw(n));return n.options.ruleSpaces?r.slice(0,-1):r}var sw={blockquote:pC,break:_C,code:xC,definition:wC,emphasis:OC,hardBreak:_C,heading:jC,html:MC,image:PC,imageReference:IC,inlineCode:RC,link:VC,linkReference:UC,list:YC,listItem:ZC,paragraph:QC,root:ew,strong:nw,text:iw,thematicBreak:ow};function cw(){return{enter:{table:lw,tableData:pw,tableHeader:pw,tableRow:dw},exit:{codeText:mw,table:uw,tableData:fw,tableHeader:fw,tableRow:fw}}}function lw(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function uw(e){this.exit(e),this.data.inTable=void 0}function dw(e){this.enter({type:`tableRow`,children:[]},e)}function fw(e){this.exit(e)}function pw(e){this.enter({type:`tableCell`,children:[]},e)}function mw(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,hw));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function hw(e,t){return t===`|`?t:e}function gw(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
79
79
  `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
80
80
  `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return uC(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=sw.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function _w(){return{exit:{taskListCheckValueChecked:yw,taskListCheckValueUnchecked:yw,paragraph:bw}}}function vw(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:xw}}}function yw(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function bw(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function xw(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=sw.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Sw(){return[OS(),QS(),rC(),cw(),_w()]}function Cw(e){return{extensions:[kS(),$S(e),iC(),gw(e),vw()]}}var ww={tokenize:Rw,partial:!0},Tw={tokenize:zw,partial:!0},Ew={tokenize:Bw,partial:!0},Dw={tokenize:Vw,partial:!0},Ow={tokenize:Hw,partial:!0},kw={name:`wwwAutolink`,tokenize:Iw,previous:Uw},Aw={name:`protocolAutolink`,tokenize:Lw,previous:Ww},jw={name:`emailAutolink`,tokenize:Fw,previous:Gw},Mw={};function Nw(){return{text:Mw}}for(var Pw=48;Pw<123;)Mw[Pw]=jw,Pw++,Pw===58?Pw=65:Pw===91&&(Pw=97);Mw[43]=jw,Mw[45]=jw,Mw[46]=jw,Mw[95]=jw,Mw[72]=[jw,Aw],Mw[104]=[jw,Aw],Mw[87]=[jw,kw],Mw[119]=[jw,kw];function Fw(e,t,n){let r=this,i,a;return o;function o(t){return!Kw(t)||!Gw.call(r,r.previous)||qw(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Kw(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Ow,u,l)(t):t===45||t===95||E_(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&T_(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Iw(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Uw.call(r,r.previous)||qw(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(ww,e.attempt(Tw,e.attempt(Ew,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Lw(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Ww.call(r,r.previous)&&!qw(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(T_(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||O_(t)||M_(t)||P_(t)||N_(t)?n(t):e.attempt(Tw,e.attempt(Ew,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Rw(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function zw(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Dw,c,s)(t):t===null||M_(t)||P_(t)||t!==45&&N_(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Bw(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Dw,t,a)(o):o===null||M_(o)||P_(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Vw(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||M_(o)||P_(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||M_(e)||P_(e)?t(e):r(e)}function a(e){return T_(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):T_(t)?(e.consume(t),o):n(t)}}function Hw(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return E_(e)?n(e):t(e)}}function Uw(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||M_(e)}function Ww(e){return!T_(e)}function Gw(e){return!(e===47||Kw(e))}function Kw(e){return e===43||e===45||e===46||e===95||E_(e)}function qw(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Jw={tokenize:nT,partial:!0};function Yw(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:$w,continuation:{tokenize:eT},exit:tT}},text:{91:{name:`gfmFootnoteCall`,tokenize:Qw},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Xw,resolveTo:Zw}}}}function Xw(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=w_(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Zw(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Qw(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||M_(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(w_(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return M_(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function $w(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||M_(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=w_(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return M_(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),L_(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function eT(e,t,n){return e.check(Q_,t,e.attempt(Jw,t,n))}function tT(e){e.exit(`gfmFootnoteDefinition`)}function nT(e,t,n){let r=this;return L_(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function rT(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&__(o,o.length,0,G_(s,e.slice(r+1,n),t)),__(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),__(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=W_(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=W_(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var iT=class{constructor(){this.map=[]}add(e,t,n){aT(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function aT(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function oT(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function sT(){return{flow:{null:{name:`table`,tokenize:cT,resolveAll:lT}}}}function cT(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):$(t)?L_(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||M_(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,$(t)?L_(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return $(t)?L_(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return $(t)?L_(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Q(n)?(e.exit(`tableRow`),t(n)):$(n)?L_(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||M_(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function lT(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new iT;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(dT(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=uT(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=uT(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=uT(f,t,o,i,n,d)):(o[0]=o[1],d=uT(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&dT(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=oT(t.events,n))}return e}function uT(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},fT(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=fT(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=fT(t.events,n[2]),a=fT(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},fT(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function dT(e,t,n,r,i){let a=[],o=fT(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function fT(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var pT={name:`tasklistCheck`,tokenize:hT};function mT(){return{text:{91:pT}}}function hT(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return M_(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Q(r)?t(r):$(r)?e.check({tokenize:gT},t,n)(r):n(r)}}function gT(e,t,n){return L_(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function _T(e){return b_([Nw(),Yw(),rT(e),sT(),mT()])}var vT={};function yT(e){let t=this,n=e||vT,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(_T(n)),a.push(Sw()),o.push(Cw(n))}var bT={a:({node:e,...t})=>(0,U.jsx)(`a`,{...t,target:`_blank`,rel:`noreferrer noopener`})};function xT({markdown:e}){return(0,U.jsx)(`div`,{className:`assistant-markdown`,children:(0,U.jsx)(fS,{components:bT,remarkPlugins:[yT,wS],skipHtml:!0,children:e})})}var ST=(0,d.memo)(function({message:e}){let t=e.role===`assistant`&&!!(e.isPending||e.isStreaming),n=e.role===`assistant`?kT(e.text):void 0;return e.role===`user`?(0,U.jsx)(CT,{message:e}):n?(0,U.jsx)(TT,{message:e,result:n,isWorking:t}):(0,U.jsx)(wT,{message:e,variant:DT(e),isWorking:t})});function CT({message:e}){return(0,U.jsx)(`article`,{className:`message-row user`,"data-message-role":`user`,children:(0,U.jsxs)(`div`,{className:`message user-message-card`,children:[(0,U.jsx)(`div`,{className:`message-header user-message-header`,children:(0,U.jsx)(`span`,{children:`You`})}),(0,U.jsx)(`div`,{className:`message-body user-message-body`,children:e.text})]})})}function wT({message:e,variant:t,isWorking:n}){return t===`status`?(0,U.jsx)(`article`,{className:`message-row assistant status`,"data-message-role":`assistant`,"data-message-variant":`status`,children:(0,U.jsxs)(`div`,{className:oo(`message assistant-status-card`,n&&`working`),children:[(0,U.jsxs)(`div`,{className:`message-header assistant-status-header`,children:[(0,U.jsx)(`span`,{children:`Heddle`}),(0,U.jsxs)(`div`,{className:`pills compact-pills`,children:[e.isPending?(0,U.jsx)(Y,{tone:`warn`,children:`working`}):null,e.isStreaming?(0,U.jsx)(Y,{children:`live`}):null]})]}),(0,U.jsx)(`div`,{className:`message-body assistant-status-body`,children:e.text})]})}):(0,U.jsx)(`article`,{className:`message-row assistant article`,"data-message-role":`assistant`,"data-message-variant":`article`,children:(0,U.jsxs)(`div`,{className:`assistant-article-shell`,children:[(0,U.jsxs)(`div`,{className:`message-header assistant-article-header`,children:[(0,U.jsx)(`span`,{children:`Heddle`}),(0,U.jsxs)(`div`,{className:`pills compact-pills`,children:[e.isPending?(0,U.jsx)(Y,{tone:`warn`,children:`working`}):null,e.isStreaming?(0,U.jsx)(Y,{children:`live`}):null]})]}),(0,U.jsx)(`div`,{className:oo(`message-body assistant-article-body`,n&&`working`),children:(0,U.jsx)(xT,{markdown:e.text})})]})})}function TT({message:e,result:t,isWorking:n}){return(0,U.jsx)(`article`,{className:`message-row assistant tool-result`,"data-message-role":`assistant`,"data-message-variant":`tool-result`,children:(0,U.jsxs)(`div`,{className:oo(`message tool-result-card`,n&&`working`),children:[(0,U.jsxs)(`div`,{className:`message-header tool-result-header`,children:[(0,U.jsx)(`span`,{children:`Tool result`}),(0,U.jsxs)(`div`,{className:`pills compact-pills`,children:[(0,U.jsx)(Y,{tone:t.ok===!1?`bad`:`good`,children:t.tool}),e.isPending?(0,U.jsx)(Y,{tone:`warn`,children:`working`}):null,e.isStreaming?(0,U.jsx)(Y,{children:`live`}):null]})]}),(0,U.jsx)(`div`,{className:`message-body tool-result-message-body`,children:(0,U.jsx)(ET,{result:t})})]})})}function ET({result:e}){let t=jT(e.output);return(0,U.jsxs)(`div`,{className:`tool-result-body`,children:[(0,U.jsxs)(`div`,{className:`tool-result-meta`,children:[(0,U.jsx)(Y,{tone:e.ok===!1?`bad`:`good`,children:e.ok===!1?`failed`:`completed`}),e.command?(0,U.jsx)(`span`,{className:`tool-command`,children:e.command}):null]}),e.error?(0,U.jsx)(`p`,{className:`tool-error`,children:e.error}):null,t?(0,U.jsx)(`pre`,{className:`tool-output`,children:t}):(0,U.jsx)(`p`,{className:`muted`,children:`No visible output.`})]})}function DT(e){if(e.id.startsWith(`live-run-status`))return`status`;let t=e.text.trim();return!t||OT(t)?`status`:`article`}function OT(e){return e.length>120?!1:[/^run started/i,/^working…/i,/^approval /i,/^fallback:/i,/^memory update/i,/^memory updating/i,/^compaction /i,/^heddle is working/i,/^[a-z_][a-z0-9_]* finished(?: in \d+ms)?$/i].some(t=>t.test(e))}function kT(e){let t=e.match(/^([a-z][a-z0-9_]*):\s*([\s\S]*)$/);if(!t)return;let[,n,r]=t;if(!MT(n))return;let i=AT(r.trim());if(!i||typeof i!=`object`||Array.isArray(i))return{tool:n,output:r.trim()};let a=i,o=a.output,s=o&&typeof o==`object`&&!Array.isArray(o)?o:void 0;return{tool:n,ok:typeof a.ok==`boolean`?a.ok:void 0,command:typeof s?.command==`string`?s.command:void 0,output:s?.stdout??s?.output??o,error:typeof a.error==`string`?a.error:typeof s?.stderr==`string`&&!s.stdout?s.stderr:void 0}}function AT(e){try{return JSON.parse(e)}catch{return}}function jT(e){if(e!=null)return typeof e==`string`?e.trim()||void 0:JSON.stringify(e,null,2)}function MT(e){return[`edit_file`,`edit_memory_note`,`list_files`,`read_file`,`report_state`,`run_shell_inspect`,`run_shell_mutate`,`search_files`,`search_memory_notes`,`update_plan`,`view_image`,`web_search`].includes(e)}var NT=[{label:`OpenAI · GPT-5.5`,models:[`gpt-5.5`,`gpt-5.5-pro`]},{label:`OpenAI · GPT-5.4`,models:[`gpt-5.4`,`gpt-5.4-pro`,`gpt-5.4-mini`,`gpt-5.4-nano`]},{label:`OpenAI · GPT-5 family`,models:[`gpt-5`,`gpt-5-pro`,`gpt-5-mini`,`gpt-5-nano`]},{label:`OpenAI · Earlier GPT-5 releases`,models:[`gpt-5.2`,`gpt-5.2-pro`,`gpt-5.1`]},{label:`OpenAI · GPT-4.1`,models:[`gpt-4.1`,`gpt-4.1-mini`,`gpt-4.1-nano`]},{label:`OpenAI · Reasoning series`,models:[`o3-pro`,`o3`,`o3-mini`,`o4-mini`]},{label:`OpenAI · Coding-optimized`,models:[`gpt-5.3-codex`,`gpt-5.3-codex-spark`,`gpt-5.2-codex`,`gpt-5.1-codex`,`gpt-5.1-codex-max`,`gpt-5.1-codex-mini`]},{label:`Anthropic · Claude 4`,models:[`claude-opus-4-6`,`claude-sonnet-4-6`,`claude-haiku-4-5`]},{label:`Anthropic · Earlier Claude 4`,models:[`claude-opus-4-1`,`claude-opus-4-0`,`claude-sonnet-4-0`]},{label:`Anthropic · Claude 3.7`,models:[`claude-3-7-sonnet-latest`]},{label:`Anthropic · Claude 3.5`,models:[`claude-3-5-sonnet-latest`,`claude-3-5-haiku-latest`]}],PT=NT.filter(e=>e.label.startsWith(`OpenAI · `)),FT=NT.flatMap(e=>e.models);PT.flatMap(e=>e.models);var IT=[`gpt-5.5`,`gpt-5.4`,`gpt-5.4-mini`,`gpt-5.1-codex`,`gpt-5.1-codex-max`,`gpt-5.2`,`gpt-5.2-codex`,`gpt-5.3-codex`,`gpt-5.3-codex-spark`];new Map(FT.map(e=>[e,RT(e)]));function LT(e){return IT.includes(e.trim())}function RT(e){return e.startsWith(`gpt-5.5`)||e===`gpt-5.4`||e===`gpt-5.4-pro`||e===`gpt-5.4-mini`||e.startsWith(`gpt-5.1`)||e.startsWith(`gpt-5.2`)||e.startsWith(`gpt-5.3`)||e.startsWith(`gpt-5-`)||e===`gpt-5`?4e5:e.startsWith(`gpt-4.1`)?128e3:2e5}var zT=`OAuth mode supports a smaller OpenAI allowlist.`,BT=[`gpt-5.4`,`gpt-5.4-pro`,`gpt-5.4-mini`,`gpt-5.4-nano`,`gpt-5.5`,`gpt-5.5-pro`],VT={"gpt-5.4":`medium`,"gpt-5.4-pro":`medium`,"gpt-5.4-mini":`medium`,"gpt-5.4-nano":`low`,"gpt-5.5":`medium`,"gpt-5.5-pro":`medium`};function HT(e){return BT.includes(e)}function UT(e){return VT[e]}function WT({selectedModel:e,selectedModelUnsupported:t,disabled:n,groups:r,runActive:i,modelOptionsError:a,onSelectModel:o}){return(0,U.jsxs)(Ym,{children:[(0,U.jsx)(Xm,{asChild:!0,children:(0,U.jsxs)(G,{variant:`outline`,size:`sm`,className:oo(`model-select-trigger`,t&&`unsupported`),disabled:n,title:a?`Model options unavailable. Restart the Heddle daemon if this route was just added.`:void 0,children:[(0,U.jsx)(`span`,{children:e||`loading models`}),t?(0,U.jsx)(`span`,{className:`model-select-trigger-reason`,children:`Not supported`}):null]})}),r.length>0?(0,U.jsx)(Zm,{className:`model-select-menu p-2`,align:`end`,children:(0,U.jsx)(`div`,{role:`listbox`,"aria-label":`Model options`,children:r.map(t=>(0,U.jsxs)(`div`,{className:`model-select-group`,children:[(0,U.jsx)(`div`,{className:`model-select-group-label`,children:t.label}),t.resolvedOptions.map(t=>{let n=(0,U.jsxs)(`button`,{className:oo(`model-select-option`,t.id===e&&`selected`,t.disabled&&`disabled`),type:`button`,role:`option`,"aria-selected":t.id===e,"aria-disabled":t.disabled,disabled:t.disabled||i,onClick:()=>{t.disabled||o(t.id)},children:[(0,U.jsxs)(`span`,{children:[t.id===e?`✓ `:``,t.id]}),t.disabled?(0,U.jsx)(`span`,{className:`model-select-option-reason`,children:`Not supported`}):null]},t.id);return t.disabled?(0,U.jsx)(Ef,{children:(0,U.jsxs)(Df,{children:[(0,U.jsx)(Of,{asChild:!0,children:(0,U.jsx)(`span`,{className:`model-select-option-wrapper`,children:n})}),(0,U.jsx)(kf,{children:zT})]})},t.id):n})]},t.label))})}):null]})}var GT=`heddle.controlPlane.sessionPanelWidths`,KT=12,qT=420,JT=220,YT=520,XT=280,ZT=620;function QT(){let e=(0,d.useRef)(null),[t,n]=(0,d.useState)(()=>$T());return(0,d.useEffect)(()=>{window.localStorage.setItem(GT,JSON.stringify(t))},[t]),{shellRef:e,workspaceStyle:{"--session-sidebar-width":`${t.left}px`,"--session-side-width":`${t.right}px`},startPanelResize:(r,i)=>{i.preventDefault();let a=e.current?.getBoundingClientRect().width;if(!a)return;let o=i.clientX,s=t,c=Math.min(YT,a-s.right-qT-KT),l=Math.min(ZT,a-s.left-qT-KT),u=e=>{let t=e.clientX-o;n({left:r===`left`?eE(s.left+t,JT,c):s.left,right:r===`right`?eE(s.right-t,XT,l):s.right})},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d,{once:!0})}}}function $T(){try{let e=window.localStorage.getItem(GT);if(!e)return{left:288,right:344};let t=JSON.parse(e);return{left:eE(typeof t.left==`number`?t.left:288,JT,YT),right:eE(typeof t.right==`number`?t.right:344,XT,ZT)}}catch{return{left:288,right:344}}}function eE(e,t,n){return Math.min(Math.max(e,t),Math.max(t,n))}function tE({onSendPrompt:e}){let t=(0,d.useRef)(null),[n,r]=(0,d.useState)(``),[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)([]),[c,l]=(0,d.useState)(!1),[u,f]=(0,d.useState)(),[p,m]=(0,d.useState)(0);(0,d.useEffect)(()=>{if(!i){s([]),l(!1),f(void 0),m(0);return}let e=!1;l(!0);let t=window.setTimeout(()=>{Ni(i.query).then(t=>{e||(s(t),f(void 0),m(0))}).catch(t=>{e||(s([]),f(t instanceof Error?t.message:String(t)))}).finally(()=>{e||l(!1)})},220);return()=>{e=!0,window.clearTimeout(t)}},[i]);let h=(e,t)=>{r(e),a(nE(e,t??e.length))},g=e=>{if(!i)return;let o=`${n.slice(0,i.start)}@${e.path} ${n.slice(i.end)}`,c=i.start+e.path.length+2;r(o),a(null),s([]),window.requestAnimationFrame(()=>{t.current?.focus(),t.current?.setSelectionRange(c,c)})},_=()=>{let t=n.trim();t&&(r(``),e(t))};return{textareaRef:t,draft:n,mentionQuery:i,mentionSuggestions:o,mentionLoading:c,mentionError:u,activeMentionIndex:p,updateDraft:h,insertMention:g,submitDraft:_,handleComposerKeyDown:e=>{if(i&&(o.length||c)){if(e.key===`ArrowDown`){e.preventDefault(),m(e=>Math.min(e+1,Math.max(o.length-1,0)));return}if(e.key===`ArrowUp`){e.preventDefault(),m(e=>Math.max(e-1,0));return}if(e.key===`Escape`){e.preventDefault(),a(null),s([]);return}if((e.key===`Enter`||e.key===`Tab`)&&o[p]){e.preventDefault(),g(o[p]);return}}if(!(e.key!==`Enter`||e.nativeEvent.isComposing)){if(typeof window<`u`&&window.innerWidth<=760){(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),_());return}!e.shiftKey&&!e.altKey&&(e.preventDefault(),_())}}}}function nE(e,t){let n=e.slice(0,t).match(/(^|\s)@([^\s@]*)$/);if(!n||n.index===void 0)return null;let r=n[1]??``;return{query:n[2]??``,start:n.index+r.length,end:t}}function rE({selectedSessionId:e,onSelectSession:t,onSelectTurn:n}){let[r,i]=(0,d.useState)(`list`);return(0,d.useEffect)(()=>{if(!e){i(`list`);return}i(e=>e===`list`?`chat`:e)},[e]),{mobileView:r,shellClassName:(0,d.useMemo)(()=>oo(`workspace-shell`,`mobile-view-${r}`),[r]),selectSession:e=>{t(e),i(`chat`)},selectTurn:e=>{n(e),i(`review`)},showSessionList:()=>i(`list`),showChatView:()=>i(`chat`),openReviewInspector:()=>i(`review`)}}function iE(e){let t=e.auth?.openai?.type===`oauth`,n=(0,d.useMemo)(()=>e.modelOptions?e.modelOptions.groups.map(e=>({...e,resolvedOptions:(e.options??e.models.map(e=>({id:e,disabled:!1}))).map(e=>{let n=t&&e.id.startsWith(`gpt-`)?!LT(e.id):!1;return{id:e.id,disabled:n,disabledReason:n?`Not supported`:e.disabledReason}})})):[],[e.modelOptions,t]),r=(0,d.useMemo)(()=>n.flatMap(e=>e.resolvedOptions).find(t=>t.id===e.selectedModel),[n,e.selectedModel]),i=(0,d.useMemo)(()=>{let t=e.selectedModel?HT(e.selectedModel):!1,n=e.selectedModel?UT(e.selectedModel):void 0;return[{id:`default`,disabled:!t,label:n?`Default (${n})`:`Default`},{id:`low`,disabled:!t,label:`Low`},{id:`medium`,disabled:!t,label:`Medium`},{id:`high`,disabled:!t,label:`High`},{id:`ultrahigh`,disabled:!0,label:`Ultra high (reserved)`}]},[e.selectedModel]);return{groups:n,selectedModelOption:r,reasoningEffortOptions:i,selectedReasoningEffortOption:(0,d.useMemo)(()=>i.find(t=>t.id===(e.selectedReasoningEffort??`default`)),[i,e.selectedReasoningEffort]),selectorDisabled:e.runActive||!e.modelOptions}}function aE({auth:e,selectedModel:t,selectedReasoningEffort:n,runActive:r}){let[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(),{groups:c,selectedModelOption:l,reasoningEffortOptions:u,selectedReasoningEffortOption:f,selectorDisabled:p}=iE({modelOptions:i,auth:e,selectedModel:t,selectedReasoningEffort:n,runActive:r});return(0,d.useEffect)(()=>{let e=!1;return Ci().then(t=>{e||(a(t),s(void 0))}).catch(t=>{e||(a(null),s(t instanceof Error?t.message:String(t)))}),()=>{e=!0}},[]),{modelOptions:i,modelOptionsError:o,modelOptionGroups:c,selectedModelOption:l,reasoningEffortOptions:u,selectedReasoningEffortOption:f,modelSelectorDisabled:p}}function oE({runActive:e,sessionUpdatedAt:t,turnReview:n,selectedReviewFilePath:r}){let[i,a]=(0,d.useState)(null),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(),[u,f]=(0,d.useState)(),[p,m]=(0,d.useState)({}),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(),[y,b]=(0,d.useState)(0),x=n?.files.find(e=>e.path===r)??n?.files[0],S=i?.files.find(e=>e.path===u)??i?.files[0],C=S?p[S.path]??null:null,w=!!(x?.path&&S?.path===x.path&&x.patch&&C?.patch&&sE(x.patch)!==sE(C.patch));return(0,d.useEffect)(()=>{let e=!1;s(!0);async function t(){try{let t=await Fi();e||(a(t),l(void 0),f(e=>e&&t.files.some(t=>t.path===e)?e:t.files[0]?.path))}catch(t){e||l(t instanceof Error?t.message:String(t))}finally{e||s(!1)}}return t(),()=>{e=!0}},[e,t,y]),(0,d.useEffect)(()=>{let e=i?.files.map(e=>e.path)??[];if(!e.length){m({}),v(void 0),g(!1);return}let t=!1;g(!0);async function n(){try{let n=await Promise.all(e.map(async e=>[e,await R(e)]));t||(m(Object.fromEntries(n)),v(void 0))}catch(e){t||(m({}),v(e instanceof Error?e.message:String(e)))}finally{t||g(!1)}}return n(),()=>{t=!0}},[i,y]),{workspaceChanges:i,workspaceChangesLoading:o,workspaceChangesError:c,selectedWorkspaceFile:S,workspaceFileDiff:C,workspaceFileDiffsByPath:p,workspaceFileDiffLoading:h,workspaceFileDiffError:_,selectedTurnPatchIsStale:w,selectWorkspaceFile:f,refreshWorkspaceReview:()=>b(e=>e+1)}}function sE(e){return e.trim().replace(/\r\n/g,`
81
- `)}var cE=(0,d.lazy)(()=>_(()=>import(`./MonacoDiffViewer-vifX8i2F.js`),__vite__mapDeps([0,1,2,3])));function lE({diff:e,patch:t,fallbackTitle:n=`Raw patch`}){return e?.binary?(0,U.jsx)(nh,{title:`Binary file`,body:`Git reports this as a binary diff, so Heddle cannot render line-level changes.`}):e?.hunks.length?(0,U.jsx)(d.Suspense,{fallback:(0,U.jsx)(uE,{diff:e}),children:(0,U.jsx)(cE,{diff:e})}):t?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(Y,{tone:`warn`,children:n}),(0,U.jsx)(`span`,{className:`min-w-0 text-xs text-muted-foreground`,children:`Structured hunks are unavailable for this patch.`})]}),(0,U.jsx)(sh,{children:t})]}):(0,U.jsx)(nh,{title:`No patch available`,body:`Git reports this file as changed, but no patch text is available for it.`})}function uE({diff:e}){return(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-background font-mono text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-border bg-muted/30 px-3 py-2 font-sans`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:e.path}),e.oldPath?(0,U.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[`from `,e.oldPath]}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,U.jsx)(Y,{children:e.status}),(0,U.jsxs)(Y,{tone:`good`,children:[`+`,e.additions,` / -`,e.deletions]})]})]}),(0,U.jsx)(`div`,{className:`max-h-[44rem] overflow-auto`,children:e.hunks.map((e,t)=>(0,U.jsx)(`table`,{className:`w-full border-collapse`,children:(0,U.jsxs)(`tbody`,{children:[(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:2,className:`border-y border-border bg-muted/40 px-3 py-1 font-mono text-[11px] text-muted-foreground`,children:e.header})}),e.lines.map((t,n)=>(0,U.jsxs)(`tr`,{className:oo(t.type===`added`&&`bg-emerald-500/10`,t.type===`deleted`&&`bg-rose-500/10`),children:[(0,U.jsx)(`td`,{className:`w-14 select-none border-r border-border px-2 py-0.5 text-right text-muted-foreground/70`,children:t.type===`added`?t.newLineNumber:t.oldLineNumber??t.newLineNumber??``}),(0,U.jsx)(`td`,{className:`whitespace-pre px-3 py-0.5 text-foreground`,children:t.content})]},`${e.header}-${t.oldLineNumber??``}-${t.newLineNumber??``}-${n}`))]})},`${e.header}-${t}`))})]})}function dE({workspaceChanges:e,workspaceChangesLoading:t,workspaceChangesError:n,workspaceFileDiffsByPath:r,workspaceFileDiffLoading:i,workspaceFileDiffError:a,selectedTurnPatchIsStale:o,onSelectWorkspaceFile:s,onRefresh:c,onOpenDiff:l}){let u=vE(e?.files??[],r);return(0,U.jsx)(lh,{title:`Current workspace changes`,testId:`review-current-workspace`,actions:(0,U.jsxs)(`div`,{className:`review-section-actions`,children:[o?(0,U.jsx)(hE,{}):null,u.files?.length?(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:i,onClick:()=>l(u),children:`Open full diff`}):null,(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:c,disabled:t||i,children:`Refresh`})]}),children:t?(0,U.jsx)(nh,{title:`Loading workspace diff`,body:`Reading current Git changes from the active workspace.`}):n?(0,U.jsx)(nh,{title:`Workspace diff failed`,body:n}):e?.vcs===`none`?(0,U.jsx)(nh,{title:`Not a git workspace`,body:e.error??`Current workspace changes require a Git-backed project.`}):e?.files.length?(0,U.jsx)(`div`,{className:`detail-stack compact-stack`,children:(0,U.jsx)(gE,{files:e.files,sourceLabel:`current git`,testId:`review-current-file-list`,onSelect:s,renderContent:e=>{let t=r[e.path];return(0,U.jsx)(_E,{loading:i,error:a,diffError:t?.error,patch:t?.patch,diff:t?.diff,unavailableTitle:`No patch available`,unavailableBody:`Git reports this file as changed, but no patch text is available for it.`,loadingTitle:`Loading file diff`,loadingBody:`Reading the selected file patch.`,fallbackTitle:`Raw workspace patch`})}})}):(0,U.jsx)(nh,{title:`Clean workspace`,body:`Git does not report current project file changes.`})})}function fE({sessionDetail:e,selectedTurnId:t,onSelectTurn:n,turnReview:r,turnReviewLoading:i,turnReviewError:a,onSelectReviewFile:o,onOpenDiff:s}){let c=yE(r?.files??[]);return(0,U.jsxs)(lh,{title:`Captured turn diff`,actions:c.files?.length?(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>s(c),children:`Open full diff`}):void 0,children:[e?.turns.length?(0,U.jsx)(`div`,{className:`stack-list compact review-turn-picker`,children:[...e.turns].reverse().map(e=>(0,U.jsx)(jh,{turn:e,active:e.id===t,onClick:()=>n(e.id)},e.id))}):null,i?(0,U.jsx)(nh,{title:`Loading review`,body:`Reading trace-backed review evidence for the selected turn.`}):a?(0,U.jsx)(nh,{title:`Review load failed`,body:a}):r?.files.length?(0,U.jsx)(`div`,{className:`detail-stack compact-stack`,children:(0,U.jsx)(gE,{files:r.files,testId:`review-turn-file-list`,onSelect:o,renderContent:e=>(0,U.jsx)(_E,{patch:`patch`in e?e.patch:void 0,diff:`diff`in e?e.diff:void 0,unavailableTitle:`No patch captured`,unavailableBody:`This file was changed, but the turn did not capture patch text for it.`,fallbackTitle:`Raw turn patch`})})}):r?.diffExcerpt?(0,U.jsx)(sh,{children:r.diffExcerpt}):(0,U.jsx)(nh,{title:`No captured diff`,body:`This selected turn did not save file-level diff evidence. Check Evidence for commands and approvals.`})]})}function pE({turnReview:e,selectedTurn:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(lh,{title:`Review commands`,children:(0,U.jsx)(Mh,{commands:e?.reviewCommands??[],empty:`No git review commands captured for this turn.`})}),(0,U.jsx)(lh,{title:`Verification commands`,children:(0,U.jsx)(Mh,{commands:e?.verificationCommands??[],empty:`No verification commands captured for this turn.`})}),(0,U.jsx)(lh,{title:`Approvals and events`,children:e?.approvals.length?(0,U.jsx)(`div`,{className:`stack-list compact`,children:e.approvals.map((e,t)=>(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`card-title`,children:e.tool}),(0,U.jsx)(`p`,{className:`muted`,children:e.command??`no command details`}),(0,U.jsx)(`div`,{className:`pills`,children:(0,U.jsx)(Y,{tone:e.approved?`good`:`warn`,children:e.approved?`approved`:`rejected`})}),e.reason?(0,U.jsx)(`p`,{className:`summary`,children:e.reason}):null]},`${e.tool}-${e.timestamp??t}`))}):t?.events.length?(0,U.jsx)(`div`,{className:`event-list`,children:t.events.map((e,n)=>(0,U.jsx)(`p`,{className:`event-line`,children:e},`${t.id}-${n}`))}):(0,U.jsx)(nh,{title:`No approvals or events`,body:`Turn-level approvals, tool review, or summarized events will appear here.`})})]})}function mE({diff:e,onClose:t}){return e?(0,U.jsx)(`div`,{className:`diff-dialog-backdrop`,role:`presentation`,onMouseDown:t,children:(0,U.jsxs)(`section`,{className:`diff-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`${e.subtitle}: ${e.title}`,onMouseDown:e=>e.stopPropagation(),children:[(0,U.jsxs)(`header`,{className:`diff-dialog-header`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`topbar-eyebrow`,children:`Diff review`}),(0,U.jsx)(`h2`,{children:e.title}),(0,U.jsx)(`p`,{className:`muted`,children:e.subtitle})]}),(0,U.jsx)(G,{type:`button`,variant:`outline`,onClick:t,children:`Close`})]}),(0,U.jsx)(`div`,{className:`diff-dialog-body`,children:e.files?.length?(0,U.jsx)(`div`,{className:`detail-stack`,children:e.files.map(e=>(0,U.jsx)(lE,{diff:e.diff,patch:e.patch,fallbackTitle:e.fallbackTitle},e.title))}):(0,U.jsx)(lE,{diff:e.diff,patch:e.patch,fallbackTitle:e.fallbackTitle})})]})}):null}function hE(){return(0,U.jsx)(Ef,{delayDuration:120,children:(0,U.jsxs)(Df,{children:[(0,U.jsx)(Of,{asChild:!0,children:(0,U.jsx)(`button`,{className:`stale-diff-button`,type:`button`,"aria-label":`Current workspace differs from captured turn`,children:`i`})}),(0,U.jsx)(kf,{side:`left`,className:`max-w-64`,children:`The selected file also has trace-backed turn evidence, but the current Git patch is different. Treat Current as live workspace state.`})]})})}function gE({files:e,sourceLabel:t,testId:n,onSelect:r,renderContent:i}){let[a,o]=(0,d.useState)([]);return(0,d.useEffect)(()=>{let t=new Set(e.map(e=>e.path));o(e=>e.filter(e=>t.has(e)))},[e]),(0,U.jsx)(`div`,{className:`stack-list compact`,"data-testid":n,children:e.map(e=>{let n=!a.includes(e.path);return(0,U.jsxs)(`article`,{className:oo(`changed-file-review-card`,n&&`active`),children:[(0,U.jsxs)(`button`,{"data-testid":`changed-file-${e.path}`,type:`button`,className:`changed-file-review-header`,"aria-expanded":n,onClick:()=>{r(e.path),o(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path])},children:[(0,U.jsxs)(`span`,{className:`list-button-header`,children:[(0,U.jsx)(`strong`,{children:e.path}),(0,U.jsx)(`span`,{children:e.status})]}),(0,U.jsxs)(`span`,{className:`pills compact-pills`,children:[`source`in e?(0,U.jsx)(Y,{children:e.source}):(0,U.jsx)(Y,{children:t??`current git`}),`additions`in e&&(e.additions!==void 0||e.deletions!==void 0)?(0,U.jsxs)(Y,{tone:`good`,children:[`+`,e.additions??0,` / -`,e.deletions??0]}):null,`binary`in e&&e.binary?(0,U.jsx)(Y,{tone:`warn`,children:`binary`}):null,`truncated`in e&&e.truncated?(0,U.jsx)(Y,{tone:`warn`,children:`truncated`}):null]})]}),n&&i?(0,U.jsx)(`div`,{className:`changed-file-review-body`,children:i(e)}):null]},`${`source`in e?e.source:`workspace`}-${e.path}`)})})}function _E({loading:e,error:t,diffError:n,patch:r,diff:i,unavailableTitle:a,unavailableBody:o,loadingTitle:s=`Loading diff`,loadingBody:c=`Reading the selected file patch.`,fallbackTitle:l}){return e?(0,U.jsx)(nh,{title:s,body:c}):t?(0,U.jsx)(nh,{title:`File diff failed`,body:t}):n?(0,U.jsx)(nh,{title:`File diff unavailable`,body:n}):r?(0,U.jsx)(`div`,{className:`detail-stack compact-stack`,children:(0,U.jsx)(lE,{diff:i,patch:r,fallbackTitle:l})}):(0,U.jsx)(nh,{title:a,body:o})}function vE(e,t){return{title:`Current workspace changes`,subtitle:`Current workspace diff`,fallbackTitle:`Raw workspace patch`,files:e.flatMap(e=>{let n=t[e.path];return n?.patch?[{title:e.path,diff:n.diff,patch:n.patch,fallbackTitle:`Raw workspace patch`}]:[]})}}function yE(e){return{title:`Captured turn changes`,subtitle:`Captured turn diff`,fallbackTitle:`Raw turn patch`,files:e.flatMap(e=>e.patch?[{title:e.path,diff:e.diff,patch:e.patch,fallbackTitle:`Raw turn patch`}]:[])}}function bE({reviewMode:e,onReviewModeChange:t,onShowChatView:n,workspaceChanges:r,workspaceChangesLoading:i,workspaceChangesError:a,workspaceFileDiffsByPath:o,workspaceFileDiffLoading:s,workspaceFileDiffError:c,selectedTurnPatchIsStale:l,onSelectWorkspaceFile:u,onRefreshWorkspaceReview:d,sessionDetail:f,selectedTurnId:p,onSelectTurn:m,turnReview:h,turnReviewLoading:g,turnReviewError:_,onSelectReviewFile:v,selectedTurn:y,onOpenDiff:b}){return(0,U.jsxs)(`aside`,{className:`workspace-side`,children:[(0,U.jsx)(`div`,{className:`mobile-side-header`,children:(0,U.jsx)(`button`,{className:`mobile-nav-button`,type:`button`,onClick:n,children:`← Chat`})}),(0,U.jsxs)(`div`,{className:`side-scroll`,children:[(0,U.jsxs)(`nav`,{className:`side-tabs review-mode-tabs`,role:`tablist`,"aria-label":`Review mode`,children:[(0,U.jsx)(`button`,{className:oo(e===`current`&&`active`),type:`button`,onClick:()=>t(`current`),children:`Current`}),(0,U.jsx)(`button`,{className:oo(e===`turn`&&`active`),type:`button`,onClick:()=>t(`turn`),children:`Turn history`}),(0,U.jsx)(`button`,{className:oo(e===`evidence`&&`active`),type:`button`,onClick:()=>t(`evidence`),children:`Evidence`})]}),e===`current`?(0,U.jsx)(dE,{workspaceChanges:r,workspaceChangesLoading:i,workspaceChangesError:a,workspaceFileDiffsByPath:o,workspaceFileDiffLoading:s,workspaceFileDiffError:c,selectedTurnPatchIsStale:l,onSelectWorkspaceFile:u,onRefresh:d,onOpenDiff:b}):e===`turn`?(0,U.jsx)(fE,{sessionDetail:f,selectedTurnId:p,onSelectTurn:m,turnReview:h,turnReviewLoading:g,turnReviewError:_,onSelectReviewFile:v,onOpenDiff:b}):(0,U.jsx)(pE,{turnReview:h,selectedTurn:y})]})]})}function xE({loading:e,suggestions:t,activeIndex:n,error:r,query:i,onPick:a}){return(0,U.jsxs)(`div`,{className:`mention-menu`,role:`listbox`,"aria-label":`File suggestions`,children:[(0,U.jsxs)(`div`,{className:`mention-menu-header`,children:[(0,U.jsx)(`span`,{children:`@ file`}),(0,U.jsx)(`span`,{children:e?`Searching...`:`${t.length} match${t.length===1?``:`es`}`})]}),r?(0,U.jsx)(`p`,{className:`mention-empty`,children:`File search unavailable. Restart the Heddle daemon if this route was just added.`}):t.length?t.map((e,t)=>(0,U.jsx)(`button`,{className:oo(`mention-option`,t===n&&`active`),type:`button`,role:`option`,"aria-selected":t===n,onMouseDown:t=>{t.preventDefault(),a(e)},children:(0,U.jsxs)(`span`,{children:[`@`,e.path]})},e.path)):(0,U.jsx)(`p`,{className:`mention-empty`,children:e?`Searching workspace files...`:`No files found for "${i}".`})]})}var SE=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`textarea`,{className:Gs(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:n,...t}));SE.displayName=`Textarea`;function CE({activeView:e,title:t,subtitle:n,onBackToSessions:r,onOpenChat:i,onOpenReview:a}){return(0,U.jsxs)(`header`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:r,children:`‹ Sessions`}),(0,U.jsxs)(`div`,{className:`min-w-0 text-center`,children:[(0,U.jsx)(`h2`,{className:`m-0 truncate text-sm font-semibold leading-5 tracking-normal`,children:t}),n?(0,U.jsx)(`p`,{className:`m-0 truncate text-xs leading-4 text-muted-foreground`,children:n}):null]}),(0,U.jsx)(`div`,{className:`w-[76px]`,"aria-hidden":`true`})]}),(0,U.jsxs)(`nav`,{className:`mt-2 grid grid-cols-2 rounded-md bg-muted p-1`,"aria-label":`Session views`,children:[(0,U.jsx)(wE,{active:e===`chat`,onClick:i,children:`Chat`}),(0,U.jsx)(wE,{active:e===`review`,onClick:a,children:`Review`})]})]})}function wE({active:e,onClick:t,children:n}){return(0,U.jsx)(`button`,{type:`button`,className:Gs(`h-8 rounded-md text-xs font-medium text-muted-foreground transition-colors`,e&&`bg-background text-foreground shadow-sm`),"aria-current":e?`page`:void 0,onClick:t,children:n})}var TE=new Set([`run_shell_mutate`,`edit_file`,`write_to_file`,`delete_file`,`apply_patch`]);function EE({approval:e,open:t,onOpenChange:n,onResolve:r}){if(!e||!t)return null;let i=TE.has(e.tool)?`high`:`medium`,a=DE(e.input),o=OE(e.input),s=AE(e.input);return(0,U.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-end`,role:`dialog`,"aria-modal":`true`,"aria-label":`Pending approval details`,children:[(0,U.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/45`,"aria-label":`Close approval details`,onClick:()=>n(!1)}),(0,U.jsxs)(`section`,{className:`relative z-10 flex max-h-[82dvh] w-full flex-col rounded-t-2xl border border-border bg-card`,children:[(0,U.jsx)(`header`,{className:`shrink-0 border-b border-border px-3 py-3`,children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`p`,{className:`m-0 text-sm font-semibold`,children:[`Approval required: `,e.tool]}),(0,U.jsxs)(`p`,{className:`m-0 mt-1 truncate text-xs text-muted-foreground`,children:[`Call ID: `,e.callId]}),(0,U.jsxs)(`p`,{className:`m-0 mt-1 truncate text-xs text-muted-foreground`,children:[`Requested: `,new Date(e.requestedAt).toLocaleString()]})]}),(0,U.jsxs)(W,{variant:i===`high`?`destructive`:`secondary`,children:[i,` risk`]})]})}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:[(0,U.jsxs)(`dl`,{className:`grid gap-2 text-xs`,children:[(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-2 py-2`,children:[(0,U.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Path target`}),(0,U.jsx)(`dd`,{className:`m-0 mt-1 break-all text-muted-foreground`,children:a??`No explicit path in payload`})]}),(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-2 py-2`,children:[(0,U.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Command target`}),(0,U.jsx)(`dd`,{className:`m-0 mt-1 break-all text-muted-foreground`,children:o??`No explicit command in payload`})]})]}),(0,U.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-background`,children:[(0,U.jsx)(`div`,{className:`border-b border-border px-2 py-2 text-xs font-medium`,children:`Raw payload`}),(0,U.jsx)(`pre`,{className:`m-0 max-h-[34dvh] overflow-auto whitespace-pre-wrap break-words px-2 py-2 text-[11px] leading-4 text-muted-foreground`,children:s})]})]}),(0,U.jsx)(`footer`,{className:`sticky bottom-0 z-10 shrink-0 border-t border-border bg-card px-3 py-3 pb-[calc(env(safe-area-inset-bottom)+0.75rem)]`,children:(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsx)(G,{type:`button`,className:`h-11`,onClick:()=>r(!0),children:`Approve`}),(0,U.jsx)(G,{type:`button`,variant:`outline`,className:`h-11`,onClick:()=>r(!1),children:`Deny`})]})})]})]})}function DE(e){let t=kE(e,[`targetFile`,`file_path`,`filePath`,`path`,`paths`,`absolute_path`]);if(t)return t}function OE(e){return kE(e,[`command`,`CommandLine`,`cmd`])}function kE(e,t){if(!(!e||typeof e!=`object`))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`&&!!e.trim());if(e.length>0)return e.slice(0,3).join(`, `)}}}function AE(e){if(e===void 0)return`No payload provided.`;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function jE({activeSession:e,sessionDetail:t,sessionDetailLoading:n,sessionDetailError:r,selectedSessionId:i,runActive:a,runInFlight:o,memoryUpdating:s,authStatus:c,sendPromptError:l,sessionNotice:u,draft:f,pendingApproval:p,conversationScrollRef:m,textareaRef:h,mentionMenu:g,renderMessage:_,onDraftChange:v,onComposerKeyDown:y,onBackToSessions:b,onOpenReview:x,onSubmitPrompt:S,onContinueSession:C,onCancelSessionRun:w,onResolveApproval:T}){let E=!!(i&&!a&&f.trim()),D=!!(i&&!a&&t?.lastContinuePrompt),O=t?.name??e?.name??`Chat session`,ee=(t?.context?.compactionStatus??e?.context?.compactionStatus)===`running`,[k,A]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{p||A(!1)},[p]),(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsx)(CE,{activeView:`chat`,title:O,subtitle:e?`updated ${co(e.updatedAt)}`:`Pick a session`,onBackToSessions:b,onOpenChat:()=>void 0,onOpenReview:x}),(0,U.jsx)(`div`,{ref:m,className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,U.jsx)(`div`,{className:`flex min-h-full flex-col justify-end gap-3`,children:n?(0,U.jsx)(FE,{title:`Loading session`,body:`Fetching conversation state.`}):r?(0,U.jsx)(FE,{title:`Session load failed`,body:r}):t&&t.messages.length?t.messages.map(e=>_(e)):(0,U.jsx)(FE,{title:`No conversation`,body:`Start with a prompt from the composer.`})})}),(0,U.jsx)(ME,{draft:f,disabled:!i||a,runActive:a,runInFlight:o,memoryUpdating:s,authStatus:c,canSend:E,canContinue:D,pendingApproval:p,compacting:ee,onOpenApprovalSheet:()=>A(!0),sendPromptError:l,sessionNotice:u,textareaRef:h,mentionMenu:g,onDraftChange:v,onComposerKeyDown:y,onSubmitPrompt:S,onContinueSession:C,onCancelSessionRun:w}),(0,U.jsx)(EE,{approval:p,open:k,onOpenChange:A,onResolve:e=>{T(e),A(!1)}})]})}function ME({draft:e,disabled:t,runActive:n,runInFlight:r,memoryUpdating:i,authStatus:a,canSend:o,canContinue:s,pendingApproval:c,compacting:l,onOpenApprovalSheet:u,sendPromptError:d,sessionNotice:f,textareaRef:p,mentionMenu:m,onDraftChange:h,onComposerKeyDown:g,onSubmitPrompt:_,onContinueSession:v,onCancelSessionRun:y}){let b=l?`Compacting earlier conversation history into an archive summary.`:d??f??(i?`Memory updating in the background.`:void 0);return(0,U.jsxs)(`footer`,{className:`relative shrink-0 border-t border-border bg-card px-2 py-2`,children:[c?(0,U.jsx)(NE,{approval:c,onOpen:u}):null,m,(0,U.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,U.jsx)(SE,{ref:p,rows:1,value:e,className:`max-h-24 min-h-10 resize-none rounded-md bg-background px-3 py-2 text-base leading-6 md:text-sm md:leading-5`,disabled:t,placeholder:n?`Heddle is working...`:`Message Heddle`,onChange:e=>h(e.target.value,e.target.selectionStart),onClick:t=>h(e,t.currentTarget.selectionStart),onSelect:t=>h(e,t.currentTarget.selectionStart),onKeyDown:g}),(0,U.jsx)(G,{type:`button`,size:`sm`,className:`h-10 shrink-0 px-3`,disabled:!o,onClick:_,children:`Send`})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-2`,children:[(0,U.jsx)(`div`,{className:`min-w-0`,children:b?(0,U.jsx)(`p`,{className:`m-0 truncate text-xs text-muted-foreground`,children:b}):(0,U.jsx)(PE,{runActive:n})}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[a?(0,U.jsx)(W,{variant:`secondary`,children:a}):null,(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,disabled:!s,onClick:v,children:`Continue`}),(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,disabled:!r,onClick:y,children:`Cancel`})]})]})]})}function NE({approval:e,onOpen:t}){return(0,U.jsxs)(`button`,{type:`button`,className:`mb-2 flex w-full items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-left`,onClick:t,"aria-label":`Open pending approval for ${e.tool}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`p`,{className:`m-0 truncate text-xs font-semibold text-foreground`,children:[`Approval required: `,e.tool]}),(0,U.jsx)(`p`,{className:`m-0 truncate text-[11px] text-muted-foreground`,children:`Tap for details and actions`})]}),(0,U.jsx)(W,{variant:`destructive`,className:`shrink-0`,children:`Pending`})]})}function PE({runActive:e}){return(0,U.jsx)(W,{variant:e?`outline`:`secondary`,children:e?`working`:`idle`})}function FE({title:e,body:t}){return(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-card px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`p`,{className:`m-0 mt-1 text-xs text-muted-foreground`,children:t})]})}function IE({activeSession:e,sessionDetail:t,selectedTurnId:n,selectedTurn:r,turnReview:i,turnReviewLoading:a,turnReviewError:o,workspaceChanges:s,workspaceChangesLoading:c,workspaceChangesError:l,selectedWorkspaceFile:u,workspaceFileDiff:f,workspaceFileDiffLoading:p,workspaceFileDiffError:m,onSelectWorkspaceFile:h,onRefreshWorkspaceReview:g,selectedTurnPatchIsStale:_,onOpenDiff:v,onBackToSessions:y,onOpenChat:b,onSelectTurn:x}){let[S,C]=(0,d.useState)(`current`),[w,T]=(0,d.useState)(),E=t?.name??e?.name??`Session`,D=`Review evidence`,O=i?.files.find(e=>e.path===w)??i?.files[0],ee=i?.files[0]?.path;(0,d.useEffect)(()=>{T(ee)},[ee,n,i?.traceFile]);let k=(0,d.useMemo)(()=>i?[{label:`Review`,commands:i.reviewCommands},{label:`Verification`,commands:i.verificationCommands},{label:`Mutation`,commands:i.mutationCommands}]:[],[i]);return(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsx)(CE,{activeView:`review`,title:E,subtitle:e?`${D} · updated ${co(e.updatedAt)}`:D,onBackToSessions:y,onOpenChat:b,onOpenReview:()=>void 0}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`nav`,{className:`grid grid-cols-3 rounded-md bg-muted p-1`,"aria-label":`Review evidence tabs`,children:[(0,U.jsx)(BE,{active:S===`current`,onClick:()=>C(`current`),children:`Current`}),(0,U.jsx)(BE,{active:S===`turn`,onClick:()=>C(`turn`),children:`Turn`}),(0,U.jsx)(BE,{active:S===`evidence`,onClick:()=>C(`evidence`),children:`Evidence`})]}),S===`current`?(0,U.jsx)(LE,{title:`Current workspace changes`,actions:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_?(0,U.jsx)(W,{variant:`outline`,children:`live diff differs`}):null,(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:g,disabled:c||p,children:`Refresh`})]}),children:c?(0,U.jsx)(VE,{title:`Loading workspace diff`,body:`Reading current Git changes from the active workspace.`}):l?(0,U.jsx)(VE,{title:`Workspace diff failed`,body:l}):s?.vcs===`none`?(0,U.jsx)(VE,{title:`Not a git workspace`,body:s.error??`Current workspace changes require a Git-backed project.`}):s?.files.length?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1`,children:s.files.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`shrink-0 rounded-md border px-2 py-1 text-left text-[11px] ${u?.path===e.path?`border-primary bg-primary/5 text-foreground`:`border-border bg-background text-muted-foreground`}`,onClick:()=>h(e.path),children:[(0,U.jsx)(`span`,{className:`block max-w-44 truncate font-medium`,children:e.path}),(0,U.jsxs)(`span`,{className:`block`,children:[e.status,e.additions!==void 0||e.deletions!==void 0?` · +${e.additions??0} / -${e.deletions??0}`:``]})]},`workspace-${e.path}`))}),p?(0,U.jsx)(VE,{title:`Loading file diff`,body:`Reading the selected file patch.`}):m?(0,U.jsx)(VE,{title:`File diff failed`,body:m}):f?.error?(0,U.jsx)(VE,{title:`File diff unavailable`,body:f.error}):f?.patch?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>v({title:u?.path??f.path,subtitle:`Current workspace diff`,diff:f.diff,patch:f.patch,fallbackTitle:`Raw workspace patch`}),children:`Open full diff`}),(0,U.jsx)(lE,{diff:f.diff,patch:f.patch,fallbackTitle:`Raw workspace patch`})]}):(0,U.jsx)(VE,{title:`No patch available`,body:`Git reports this file as changed, but no patch text is available for it.`})]}):(0,U.jsx)(VE,{title:`Clean workspace`,body:`Git does not report current project file changes.`})}):S===`evidence`?(0,U.jsx)(`div`,{className:`space-y-3`,children:a?(0,U.jsx)(VE,{title:`Loading review`,body:`Reading trace-backed review evidence for the selected turn.`}):o?(0,U.jsx)(VE,{title:`Review load failed`,body:o}):(0,U.jsxs)(U.Fragment,{children:[k.map(e=>(0,U.jsx)(RE,{label:e.label,commands:e.commands},e.label)),(0,U.jsx)(zE,{turnReview:i,selectedTurn:r})]})}):(0,U.jsxs)(LE,{title:`Captured turn diff`,children:[t?.turns.length?(0,U.jsx)(`div`,{className:`mb-2 flex gap-2 overflow-x-auto pb-1`,children:[...t.turns].reverse().map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`shrink-0 rounded-md border px-2 py-1 text-left text-[11px] ${e.id===n?`border-primary bg-primary/5 text-foreground`:`border-border bg-background text-muted-foreground`}`,onClick:()=>x(e.id),children:[(0,U.jsx)(`span`,{className:`block max-w-44 truncate font-medium`,children:e.prompt}),(0,U.jsxs)(`span`,{className:`block`,children:[e.outcome,` · `,e.steps,` steps`]})]},e.id))}):null,a?(0,U.jsx)(VE,{title:`Loading review`,body:`Reading trace-backed review evidence for the selected turn.`}):o?(0,U.jsx)(VE,{title:`Review load failed`,body:o}):i?.files.length?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1`,children:i.files.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`shrink-0 rounded-md border px-2 py-1 text-left text-[11px] ${O?.path===e.path?`border-primary bg-primary/5 text-foreground`:`border-border bg-background text-muted-foreground`}`,onClick:()=>T(e.path),children:[(0,U.jsx)(`span`,{className:`block max-w-44 truncate font-medium`,children:e.path}),(0,U.jsxs)(`span`,{className:`block`,children:[e.status,` · `,e.source,e.truncated?` · truncated`:``]})]},`${e.source}-${e.path}`))}),O?.patch?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>v({title:O.path,subtitle:`Captured turn diff`,diff:O.diff,patch:O.patch,fallbackTitle:`Raw turn patch`}),children:`Open full diff`}),(0,U.jsx)(lE,{diff:O.diff,patch:O.patch,fallbackTitle:`Raw turn patch`})]}):(0,U.jsx)(VE,{title:`No patch captured`,body:`This file was changed, but the turn did not capture patch text for it.`})]}):i?.diffExcerpt?(0,U.jsx)(`pre`,{className:`max-h-[52dvh] overflow-auto rounded-md border border-border bg-background p-2 text-[11px] leading-4 text-muted-foreground`,children:i.diffExcerpt}):(0,U.jsx)(VE,{title:`No changed files`,body:`This turn did not capture structured file review data.`})]})]})})]})}function LE({title:e,actions:t,children:n}){return(0,U.jsxs)(`section`,{className:`rounded-md border border-border bg-card px-3 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),t]}),(0,U.jsx)(`div`,{className:`mt-2`,children:n})]})}function RE({label:e,commands:t}){return(0,U.jsx)(LE,{title:`${e} commands`,children:t.length?(0,U.jsx)(`div`,{className:`space-y-2`,children:t.map(t=>(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-2 py-2`,children:[(0,U.jsx)(`p`,{className:`m-0 break-words text-xs font-medium text-foreground`,children:t.command}),(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[(0,U.jsx)(W,{variant:`outline`,children:t.tool}),(0,U.jsxs)(W,{variant:t.exitCode===0?`secondary`:`outline`,children:[`exit `,t.exitCode??`n/a`]})]}),t.stdout?(0,U.jsx)(`pre`,{className:`mt-2 max-h-36 overflow-auto rounded border border-border bg-card p-2 text-[11px] leading-4 text-muted-foreground`,children:t.stdout}):null,t.stderr?(0,U.jsx)(`pre`,{className:`mt-2 max-h-36 overflow-auto rounded border border-border bg-card p-2 text-[11px] leading-4 text-destructive`,children:t.stderr}):null]},`${e}-${t.tool}-${t.command}`))}):(0,U.jsx)(VE,{title:`No commands`,body:`No ${e.toLowerCase()} commands captured for this turn.`})})}function zE({turnReview:e,selectedTurn:t}){return(0,U.jsx)(LE,{title:`Approvals and events`,children:e?.approvals.length?(0,U.jsx)(`div`,{className:`space-y-2`,children:e.approvals.map((e,t)=>(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-2 py-2`,children:[(0,U.jsx)(`p`,{className:`m-0 text-xs font-medium text-foreground`,children:e.tool}),(0,U.jsx)(`p`,{className:`m-0 mt-1 break-words text-[11px] text-muted-foreground`,children:e.command??`no command details`}),(0,U.jsx)(`div`,{className:`mt-1`,children:(0,U.jsx)(W,{variant:e.approved?`secondary`:`destructive`,children:e.approved?`approved`:`rejected`})}),e.reason?(0,U.jsx)(`p`,{className:`m-0 mt-1 text-[11px] text-muted-foreground`,children:e.reason}):null]},`${e.tool}-${e.timestamp??t}`))}):t?.events.length?(0,U.jsx)(`div`,{className:`space-y-1`,children:t.events.map((e,n)=>(0,U.jsx)(`p`,{className:`m-0 rounded-md border border-border bg-background px-2 py-2 text-[11px] text-muted-foreground`,children:e},`${t.id}-${n}`))}):(0,U.jsx)(VE,{title:`No approvals or events`,body:`Turn-level approvals and events will appear here.`})})}function BE({active:e,onClick:t,children:n}){return(0,U.jsx)(`button`,{type:`button`,className:`h-8 rounded-md text-[11px] font-medium ${e?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,"aria-current":e?`page`:void 0,onClick:t,children:n})}function VE({title:e,body:t}){return(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`p`,{className:`m-0 mt-1 text-xs text-muted-foreground`,children:t})]})}function HE({mobileView:e,sessions:t,activeSession:n,sessionDetail:r,sessionDetailLoading:i,sessionDetailError:a,selectedSessionId:o,selectedTurnId:s,selectedTurn:c,turnReview:l,turnReviewLoading:u,turnReviewError:d,runActive:f,runInFlight:p,memoryUpdating:m,authStatus:h,sendPromptError:g,sessionNotice:_,draft:v,pendingApproval:y,conversationScrollRef:b,textareaRef:x,mentionMenu:S,workspaceChanges:C,workspaceChangesLoading:w,workspaceChangesError:T,workspaceFileDiff:E,workspaceFileDiffsByPath:D,workspaceFileDiffLoading:O,workspaceFileDiffError:ee,selectedTurnPatchIsStale:k,expandedDiff:A,creatingSession:j,onCreateSession:M,onSelectSession:te,onSelectTurn:N,onDraftChange:P,onComposerKeyDown:F,onBackToSessions:ne,onOpenReview:re,onSubmitPrompt:ie,onContinueSession:ae,onCancelSessionRun:I,onResolveApproval:L,onSelectWorkspaceFile:oe,onRefreshWorkspaceReview:se,onOpenDiff:ce,onOpenChat:le,onCloseDiff:ue}){return e===`list`?(0,U.jsx)(`section`,{className:`mobile-session-screen mobile-session-list`,children:(0,U.jsxs)(`aside`,{className:`workspace-sidebar mobile-pane`,children:[(0,U.jsx)(ch,{title:`Sessions`,subtitle:`${t.length} saved conversation${t.length===1?``:`s`}`,actions:(0,U.jsx)(`button`,{className:`sidebar-action-button`,type:`button`,"data-testid":`new-session-button`,disabled:j,onClick:()=>void M(),children:j?`Creating…`:`+ New session`})}),(0,U.jsx)(`div`,{className:`sidebar-scroll`,children:t.length?(0,U.jsx)(`div`,{className:`stack-list compact`,children:t.map(e=>(0,U.jsx)(Oh,{session:e,active:e.id===o,onClick:()=>te(e.id)},e.id))}):(0,U.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,U.jsx)(nh,{title:`No sessions`,body:`Create a new web session to start a fresh conversation in the browser.`})})})]})}):e===`chat`?(0,U.jsx)(jE,{activeSession:n,sessionDetail:r,sessionDetailLoading:i,sessionDetailError:a,selectedSessionId:o,runActive:f,runInFlight:p,memoryUpdating:m,authStatus:h,sendPromptError:g,sessionNotice:_,draft:v,pendingApproval:y,conversationScrollRef:b,textareaRef:x,mentionMenu:S,renderMessage:e=>(0,U.jsx)(ST,{message:e},e.id),onDraftChange:P,onComposerKeyDown:F,onBackToSessions:ne,onOpenReview:re,onSubmitPrompt:ie,onContinueSession:()=>void ae(),onCancelSessionRun:()=>void I(),onResolveApproval:e=>void L(e)}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(IE,{activeSession:n,sessionDetail:r,selectedTurnId:s,selectedTurn:c,turnReview:l,turnReviewLoading:u,turnReviewError:d,workspaceChanges:C,workspaceChangesLoading:w,workspaceChangesError:T,workspaceFileDiff:E,workspaceFileDiffsByPath:D,workspaceFileDiffLoading:O,workspaceFileDiffError:ee,onSelectWorkspaceFile:oe,onRefreshWorkspaceReview:se,selectedTurnPatchIsStale:k,onOpenDiff:ce,onBackToSessions:ne,onOpenChat:le,onSelectTurn:N}),(0,U.jsx)(mE,{diff:A,onClose:ue})]})}function UE(e,t){return e?`drift ${t??`unknown`}`:`drift off`}function WE({sessions:e,activeSession:t,sessionDetail:n,sessionDetailLoading:r,sessionDetailError:i,selectedSessionId:a,onSelectSession:o,selectedTurnId:s,onSelectTurn:c,selectedTurn:l,turnReview:u,turnReviewLoading:f,turnReviewError:p,sendingPrompt:m,runInFlight:h,memoryUpdating:g,auth:_,sendPromptError:v,onSendPrompt:y,creatingSession:b,sessionNotice:x,onCreateSession:S,onContinueSession:C,onCancelSessionRun:w,onUpdateSessionSettings:T,pendingApproval:E,onResolveApproval:D}){let O=(0,d.useRef)(null),[ee,k]=(0,d.useState)(),[A,j]=(0,d.useState)(`current`),[M,te]=(0,d.useState)(null),{textareaRef:N,draft:P,mentionQuery:F,mentionSuggestions:ne,mentionLoading:re,mentionError:ie,activeMentionIndex:ae,updateDraft:I,insertMention:L,submitDraft:oe,handleComposerKeyDown:se}=tE({onSendPrompt:y}),{shellRef:ce,workspaceStyle:le,startPanelResize:ue}=QT(),{mobileView:de,shellClassName:fe,selectSession:pe,selectTurn:me,showSessionList:he,showChatView:ge,openReviewInspector:_e}=rE({selectedSessionId:a,onSelectSession:o,onSelectTurn:c}),ve=m||h,ye=Eh(n?.model??t?.model,_),be=n?.context?.compactionStatus??t?.context?.compactionStatus,xe=n?.model??t?.model??``,{modelOptions:Se,modelOptionsError:Ce,modelOptionGroups:we,selectedModelOption:Te,reasoningEffortOptions:Ee,selectedReasoningEffortOption:De,modelSelectorDisabled:Oe}=aE({auth:_,selectedModel:xe,selectedReasoningEffort:n?.reasoningEffort??t?.reasoningEffort,runActive:ve}),{workspaceChanges:ke,workspaceChangesLoading:Ae,workspaceChangesError:je,workspaceFileDiff:Me,workspaceFileDiffsByPath:Ne,workspaceFileDiffLoading:Pe,workspaceFileDiffError:Fe,selectedTurnPatchIsStale:Ie,selectWorkspaceFile:Le,refreshWorkspaceReview:Re}=oE({runActive:ve,sessionUpdatedAt:n?.updatedAt,turnReview:u,selectedReviewFilePath:ee}),ze=u?.files[0]?.path;(0,d.useEffect)(()=>{let e=O.current;if(!e)return;let t,n=window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,t=window.setTimeout(()=>{e.scrollTop=e.scrollHeight},0)});return()=>{window.cancelAnimationFrame(n),t!==void 0&&window.clearTimeout(t)}},[de,a,n?.messages.length,r,i]),(0,d.useEffect)(()=>{k(ze)},[ze,s,u?.traceFile]);let Be=F?(0,U.jsx)(xE,{loading:re,suggestions:ne,activeIndex:ae,error:ie,query:F.query,onPick:L}):null;return typeof window<`u`&&window.innerWidth<=760?(0,U.jsx)(HE,{mobileView:de,sessions:e,activeSession:t,sessionDetail:n,sessionDetailLoading:r,sessionDetailError:i,selectedSessionId:a,selectedTurnId:s,selectedTurn:l,turnReview:u,turnReviewLoading:f,turnReviewError:p,runActive:ve,runInFlight:h,memoryUpdating:g,authStatus:ye,sendPromptError:v,sessionNotice:x,draft:P,pendingApproval:E,conversationScrollRef:O,textareaRef:N,mentionMenu:Be,workspaceChanges:ke,workspaceChangesLoading:Ae,workspaceChangesError:je,workspaceFileDiff:Me,workspaceFileDiffsByPath:Ne,workspaceFileDiffLoading:Pe,workspaceFileDiffError:Fe,selectedTurnPatchIsStale:Ie,expandedDiff:M,creatingSession:b,onCreateSession:S,onSelectSession:pe,onSelectTurn:me,onDraftChange:I,onComposerKeyDown:se,onBackToSessions:he,onOpenReview:_e,onSubmitPrompt:oe,onContinueSession:C,onCancelSessionRun:w,onResolveApproval:D,onSelectWorkspaceFile:Le,onRefreshWorkspaceReview:Re,onOpenDiff:te,onOpenChat:ge,onCloseDiff:()=>te(null)}):(0,U.jsxs)(`section`,{className:fe,ref:ce,style:le,"data-mobile-view":de,children:[(0,U.jsxs)(`aside`,{className:`workspace-sidebar`,children:[(0,U.jsx)(ch,{title:`Sessions`,subtitle:`${e.length} saved conversation${e.length===1?``:`s`}`,actions:(0,U.jsx)(`button`,{className:`sidebar-action-button`,type:`button`,"data-testid":`new-session-button`,disabled:b,onClick:()=>void S(),children:b?`Creating…`:`+ New session`})}),(0,U.jsx)(`div`,{className:`sidebar-scroll`,children:e.length?(0,U.jsx)(`div`,{className:`stack-list compact`,children:e.map(e=>(0,U.jsx)(Oh,{session:e,active:e.id===a,onClick:()=>pe(e.id)},e.id))}):(0,U.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,U.jsx)(nh,{title:`No sessions`,body:`Create a new web session to start a fresh conversation in the browser.`})})})]}),(0,U.jsx)(`button`,{className:`workspace-resizer`,type:`button`,"aria-label":`Resize sessions sidebar`,onPointerDown:e=>ue(`left`,e)}),(0,U.jsxs)(`section`,{className:`workspace-main`,children:[(0,U.jsx)(ch,{title:n?.name??t?.name??`Chat session`,subtitle:t?`${t.id} · updated ${co(t.updatedAt)}`:`Pick a session to inspect its conversation.`,actions:t?(0,U.jsxs)(`div`,{className:`session-controls`,children:[(0,U.jsx)(`button`,{className:`mobile-nav-button`,type:`button`,onClick:he,children:`← Sessions`}),(0,U.jsx)(`button`,{className:`mobile-nav-button mobile-inspector-button`,type:`button`,onClick:_e,children:`Review`}),(0,U.jsxs)(`div`,{className:`model-select-control`,children:[(0,U.jsxs)(`label`,{className:`select-control`,children:[(0,U.jsx)(`span`,{children:`model`}),(0,U.jsx)(WT,{selectedModel:xe,selectedModelUnsupported:!!Te?.disabled,disabled:Oe,groups:we,runActive:ve,modelOptionsError:Ce,onSelectModel:e=>void T({model:e})})]}),Se?null:(0,U.jsx)(`p`,{className:`model-select-description`,children:Ce?`models unavailable`:`loading models`})]}),(0,U.jsxs)(`label`,{className:`select-control`,children:[(0,U.jsx)(`span`,{children:`reasoning`}),(0,U.jsx)(`select`,{value:De?.id??`default`,disabled:Oe,onChange:e=>void T({reasoningEffort:e.target.value===`default`?null:e.target.value}),children:Ee.map(e=>(0,U.jsx)(`option`,{value:e.id,disabled:e.disabled,children:e.label},e.id))})]}),(0,U.jsxs)(Y,{children:[`turns `,t.turnCount]}),be===`running`?(0,U.jsx)(Y,{tone:`warn`,children:`compacting`}):null,(0,U.jsx)(`button`,{className:oo(`drift-button`,(n?.driftEnabled??t.driftEnabled)&&`active`),type:`button`,disabled:ve,onClick:()=>void T({driftEnabled:!(n?.driftEnabled??t.driftEnabled??!0)}),children:UE(n?.driftEnabled??t.driftEnabled,n?.driftLevel??t.driftLevel)}),ve?(0,U.jsx)(Y,{tone:`warn`,children:`working`}):null]}):void 0}),(0,U.jsx)(`div`,{className:`conversation-scroll`,ref:O,children:(0,U.jsxs)(`div`,{className:`conversation-stack`,children:[(0,U.jsx)(`div`,{className:`conversation-spacer`}),r?(0,U.jsx)(nh,{title:`Loading session`,body:`Fetching full conversation state from saved Heddle session storage.`}):i?(0,U.jsx)(nh,{title:`Session load failed`,body:i}):n&&n.messages.length?n.messages.map(e=>(0,U.jsx)(ST,{message:e},e.id)):(0,U.jsx)(nh,{title:`No conversation available`,body:`This session does not have any saved chat messages yet.`})]})}),(0,U.jsxs)(`div`,{className:`composer-shell`,children:[E?(0,U.jsxs)(`div`,{className:`detail-card error-card approval-card`,children:[(0,U.jsxs)(`p`,{className:`card-title`,children:[`Approval required: `,E.tool]}),(0,U.jsxs)(`p`,{className:`muted`,children:[`Call ID: `,E.callId]}),(0,U.jsx)(sh,{children:JSON.stringify(E.input,null,2)}),(0,U.jsxs)(`div`,{className:`pills approval-actions`,children:[(0,U.jsx)(`button`,{className:`primary-button`,type:`button`,onClick:()=>void D(!0),children:`Approve`}),(0,U.jsx)(`button`,{className:`tab-button`,type:`button`,onClick:()=>void D(!1),children:`Deny`})]})]}):null,(0,U.jsx)(`textarea`,{ref:N,value:P,onChange:e=>I(e.target.value,e.target.selectionStart),onClick:e=>I(P,e.currentTarget.selectionStart),onSelect:e=>I(P,e.currentTarget.selectionStart),disabled:!a||ve,placeholder:ve?`Heddle is working…`:`Ask Heddle about this workspace`,onKeyDown:se}),Be,(0,U.jsxs)(`div`,{className:`composer-footer`,children:[(0,U.jsxs)(`div`,{className:`composer-status`,children:[(0,U.jsx)(`p`,{className:`muted`,children:be===`running`?`Compacting earlier conversation history into an archive summary.`:v||x||(ve?`Run in progress. Continue is disabled until this run settles; Cancel interrupts the active run.`:g?`Memory maintenance is updating the workspace catalog in the background.`:(n?.lastContinuePrompt,`Enter sends. Option+Enter or Shift+Enter adds a new line.`))}),(0,U.jsxs)(`div`,{className:`pills compact-pills`,children:[(0,U.jsx)(Y,{tone:b||ve?`warn`:`good`,children:b?`creating session`:ve?`run active`:`idle`}),g?(0,U.jsx)(Y,{tone:`warn`,children:`memory updating`}):null,ye?(0,U.jsx)(Y,{children:ye}):null,n?.lastContinuePrompt?(0,U.jsx)(Y,{children:`continue available`}):(0,U.jsx)(Y,{children:`no continue state yet`})]})]}),(0,U.jsxs)(`div`,{className:`pills composer-actions`,children:[(0,U.jsx)(`button`,{className:`tab-button`,type:`button`,disabled:!a||ve||!n?.lastContinuePrompt,onClick:()=>void C(),title:n?.lastContinuePrompt?`Resume the current transcript from the last saved continue point`:`Continue is available after a prior runnable turn exists`,children:`Continue`}),(0,U.jsx)(`button`,{className:`tab-button`,type:`button`,disabled:!h,onClick:()=>void w(),title:`Interrupt the currently running session`,children:`Cancel`}),(0,U.jsx)(`button`,{className:`primary-button`,type:`button`,disabled:!a||ve||!P.trim(),onClick:oe,children:`Send`})]})]})]})]}),(0,U.jsx)(`button`,{className:`workspace-resizer`,type:`button`,"aria-label":`Resize session inspector`,onPointerDown:e=>ue(`right`,e)}),(0,U.jsx)(bE,{reviewMode:A,onReviewModeChange:j,onShowChatView:ge,workspaceChanges:ke,workspaceChangesLoading:Ae,workspaceChangesError:je,workspaceFileDiffsByPath:Ne,workspaceFileDiffLoading:Pe,workspaceFileDiffError:Fe,selectedTurnPatchIsStale:Ie,onSelectWorkspaceFile:Le,onRefreshWorkspaceReview:Re,sessionDetail:n,selectedTurnId:s,onSelectTurn:me,turnReview:u,turnReviewLoading:f,turnReviewError:p,onSelectReviewFile:k,selectedTurn:l,onOpenDiff:te}),(0,U.jsx)(mE,{diff:M,onClose:()=>te(null)})]})}function GE({selectedTask:e,pendingTaskAction:t}){return{isTaskBusy:!!(e&&t&&t.taskId===e.taskId),selectedTaskExecution:e?ho(e):void 0}}function KE({runs:e,selectedTask:t,selectedTaskRuns:n,selectedRun:r,selectedRunId:i,onSelectRun:a}){return(0,U.jsxs)(`aside`,{className:`workspace-side`,children:[(0,U.jsx)(ch,{title:`Runs`,subtitle:t?`${n.length} run${n.length===1?``:`s`} for this task`:`${e.length} recent run${e.length===1?``:`s`}`}),(0,U.jsxs)(`div`,{className:`side-scroll split-scroll`,children:[(0,U.jsx)(lh,{title:`History`,children:n.length?(0,U.jsx)(`div`,{className:`stack-list compact`,children:n.map(e=>(0,U.jsx)(Ah,{run:e,active:e.id===i,onClick:()=>a(e.id)},e.id))}):(0,U.jsx)(nh,{title:`No runs for this task`,body:`Run-once and scheduled executions will appear here.`})}),(0,U.jsx)(lh,{title:`Run detail`,children:r?(0,U.jsxs)(`div`,{className:`detail-stack compact-stack`,children:[(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`card-title`,children:r.id}),(0,U.jsxs)(`div`,{className:`pills`,children:[(0,U.jsx)(Y,{tone:so(r.status),children:r.status}),(0,U.jsx)(Y,{tone:so(r.decision),children:r.decision}),(0,U.jsx)(Y,{tone:so(r.outcome),children:r.outcome})]}),(0,U.jsx)(`p`,{className:`summary`,children:r.summary})]}),(0,U.jsx)(`div`,{className:`detail-card`,children:(0,U.jsxs)(`div`,{className:`kv-list`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`created`}),(0,U.jsx)(`span`,{className:`kv-value`,children:co(r.createdAt)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`task`}),(0,U.jsx)(`span`,{className:`kv-value`,children:r.taskId})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`usage`}),(0,U.jsx)(`span`,{className:`kv-value`,children:z(r.usage)??`none`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`checkpoint`}),(0,U.jsx)(`span`,{className:`kv-value`,children:r.loadedCheckpoint?`loaded`:`fresh`})]})]})}),r.progress?(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Progress`}),(0,U.jsx)(`p`,{className:`summary`,children:r.progress})]}):null]}):(0,U.jsx)(nh,{title:`No run selected`,body:`Select a run to inspect the latest durable heartbeat result.`})})]})]})}function qE({selectedTask:e,pendingTaskAction:t,isTaskBusy:n,selectedTaskExecution:r,onEnableTask:i,onDisableTask:a,onTriggerTask:o}){return(0,U.jsxs)(`section`,{className:`workspace-main`,children:[(0,U.jsx)(ch,{title:e?.name||e?.taskId||`Task detail`,subtitle:e?`${e.taskId} · next ${co(e.nextRunAt)}`:`Pick a task to inspect prompt, schedule, and recent outcome.`,actions:e?(0,U.jsxs)(`div`,{className:`pills`,children:[(0,U.jsx)(Y,{tone:e.enabled?`good`:void 0,children:e.enabled?`enabled`:`disabled`}),(0,U.jsx)(Y,{tone:r?.tone,children:r?.label??e.status}),e.decision?(0,U.jsx)(Y,{tone:so(e.decision),children:e.decision}):null]}):void 0}),(0,U.jsx)(`div`,{className:`task-detail-scroll`,children:e?(0,U.jsxs)(`div`,{className:`detail-stack`,children:[(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Task prompt`}),(0,U.jsx)(`p`,{className:`summary`,children:e.task}),(0,U.jsxs)(`div`,{className:`pills approval-actions`,children:[(0,U.jsx)(`button`,{type:`button`,className:`sidebar-action-button`,disabled:n||!e.enabled,onClick:()=>{o(e.taskId)},children:n&&t?.action===`trigger`?`Triggering…`:`Run now`}),e.enabled?(0,U.jsx)(`button`,{type:`button`,className:`sidebar-action-button`,disabled:n,onClick:()=>{a(e.taskId)},children:n&&t?.action===`disable`?`Pausing…`:`Pause task`}):(0,U.jsx)(`button`,{type:`button`,className:`sidebar-action-button`,disabled:n,onClick:()=>{i(e.taskId)},children:n&&t?.action===`enable`?`Resuming…`:`Resume task`})]}),(0,U.jsx)(`p`,{className:`summary`,children:r?.detail})]}),(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Runtime status`}),(0,U.jsxs)(`div`,{className:`kv-list`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`execution`}),(0,U.jsx)(`span`,{className:`kv-value`,children:r?.label??e.status})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`model`}),(0,U.jsx)(`span`,{className:`kv-value`,children:e.model??`unset`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`interval`}),(0,U.jsx)(`span`,{className:`kv-value`,children:mo(e.intervalMs)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`last run`}),(0,U.jsx)(`span`,{className:`kv-value`,children:co(e.lastRunAt)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`next run`}),(0,U.jsx)(`span`,{className:`kv-value`,children:co(e.nextRunAt)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`checkpoint`}),(0,U.jsx)(`span`,{className:`kv-value`,children:e.loadedCheckpoint?`loaded`:e.resumable?`resumable`:`none`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`usage`}),(0,U.jsx)(`span`,{className:`kv-value`,children:z(e.usage)??`none`})]})]})]}),e.summary?(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Latest summary`}),(0,U.jsx)(`p`,{className:`summary`,children:e.summary})]}):null,e.progress?(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Progress`}),(0,U.jsx)(`p`,{className:`summary`,children:e.progress})]}):null,e.error?(0,U.jsxs)(`div`,{className:`detail-card error-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Error`}),(0,U.jsx)(`p`,{className:`summary`,children:e.error})]}):null]}):(0,U.jsx)(nh,{title:`No task selected`,body:`Choose a task from the left to inspect its durable prompt and latest run state.`})})]})}function JE({tasks:e,selectedTaskId:t,onSelectTask:n}){return(0,U.jsxs)(`aside`,{className:`workspace-sidebar`,children:[(0,U.jsx)(ch,{title:`Tasks`,subtitle:`${e.length} durable task${e.length===1?``:`s`}`}),(0,U.jsx)(`div`,{className:`sidebar-scroll`,children:e.length?e.map(e=>(0,U.jsx)(kh,{task:e,active:e.taskId===t,onClick:()=>n(e.taskId)},e.taskId)):(0,U.jsx)(nh,{title:`No tasks`,body:`Add a heartbeat task in the CLI, then manage it from this view.`})})]})}function YE({tasks:e,runs:t,selectedTask:n,selectedTaskId:r,onSelectTask:i,selectedRun:a,selectedRunId:o,onSelectRun:s,selectedTaskRuns:c,pendingTaskAction:l,onEnableTask:u,onDisableTask:d,onTriggerTask:f}){let{isTaskBusy:p,selectedTaskExecution:m}=GE({selectedTask:n,pendingTaskAction:l});return(0,U.jsxs)(`section`,{className:`workspace-shell tasks-shell`,children:[(0,U.jsx)(JE,{tasks:e,selectedTaskId:r,onSelectTask:i}),(0,U.jsx)(qE,{selectedTask:n,pendingTaskAction:l,isTaskBusy:p,selectedTaskExecution:m,onEnableTask:u,onDisableTask:d,onTriggerTask:f}),(0,U.jsx)(KE,{runs:t,selectedTask:n,selectedTaskRuns:c,selectedRun:a,selectedRunId:o,onSelectRun:s})]})}function XE({tasks:e,selectedTask:t,selectedTaskId:n,onSelectTask:r,selectedRun:i,selectedRunId:a,onSelectRun:o,selectedTaskRuns:s,pendingTaskAction:c,onEnableTask:l,onDisableTask:u,onTriggerTask:f}){let[p,m]=(0,d.useState)(n?`detail`:`list`),h=!!(t&&c&&c.taskId===t.taskId),g=t?ho(t):void 0;return(0,d.useEffect)(()=>{if(!n){m(`list`);return}m(e=>e===`list`?`detail`:e)},[n]),p===`list`?(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsxs)(`header`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:`Tasks`}),(0,U.jsxs)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:[e.length,` durable task`,e.length===1?``:`s`]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:e.length?(0,U.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let t=ho(e);return(0,U.jsxs)(`button`,{type:`button`,className:`w-full rounded-md border px-3 py-3 text-left ${e.taskId===n?`border-primary bg-primary/5`:`border-border bg-card`}`,onClick:()=>{r(e.taskId),m(`detail`)},children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsx)(`p`,{className:`m-0 line-clamp-2 text-sm font-semibold text-foreground`,children:e.name||e.taskId}),(0,U.jsx)(`p`,{className:`m-0 shrink-0 text-[11px] text-muted-foreground`,children:co(e.nextRunAt)})]}),(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[(0,U.jsx)(W,{variant:e.enabled?`secondary`:`outline`,children:e.enabled?`enabled`:`disabled`}),(0,U.jsx)(W,{variant:`outline`,children:t.label}),e.decision?(0,U.jsx)(W,{variant:`outline`,children:e.decision}):null]}),(0,U.jsx)(`p`,{className:`m-0 mt-2 text-xs text-muted-foreground`,children:e.task})]},e.taskId)})}):(0,U.jsx)(eD,{title:`No tasks`,body:`Add a heartbeat task in the CLI, then manage it from here.`})})]}):p===`runs`?(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsx)(`header`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:()=>m(`detail`),children:`← Task`}),(0,U.jsx)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:`Runs`})]})}),(0,U.jsx)(`nav`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:(0,U.jsxs)(`div`,{className:`grid grid-cols-2 rounded-md bg-muted p-1`,children:[(0,U.jsx)($E,{active:!1,onClick:()=>m(`detail`),children:`Summary`}),(0,U.jsx)($E,{active:!0,children:`Runs`})]})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(ZE,{title:`History`,children:s.length?(0,U.jsx)(`div`,{className:`space-y-2`,children:s.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`w-full rounded-md border px-2 py-2 text-left ${e.id===a?`border-primary bg-primary/5`:`border-border bg-background`}`,onClick:()=>o(e.id),children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsx)(`p`,{className:`m-0 truncate text-xs font-medium text-foreground`,children:e.id}),(0,U.jsx)(`p`,{className:`m-0 shrink-0 text-[11px] text-muted-foreground`,children:co(e.createdAt)})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[(0,U.jsx)(W,{variant:`outline`,children:e.status}),(0,U.jsx)(W,{variant:`outline`,children:e.decision}),(0,U.jsx)(W,{variant:`outline`,children:e.outcome})]})]},e.id))}):(0,U.jsx)(eD,{title:`No runs`,body:`Run-once and scheduled executions appear here.`})}),(0,U.jsx)(ZE,{title:`Run detail`,children:i?(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:i.id}),(0,U.jsx)(`p`,{className:`m-0 text-muted-foreground`,children:i.summary}),(0,U.jsx)(QE,{label:`created`,value:co(i.createdAt)}),(0,U.jsx)(QE,{label:`task`,value:i.taskId}),(0,U.jsx)(QE,{label:`usage`,value:z(i.usage)??`none`}),(0,U.jsx)(QE,{label:`checkpoint`,value:i.loadedCheckpoint?`loaded`:`fresh`}),i.progress?(0,U.jsx)(QE,{label:`progress`,value:i.progress}):null]}):(0,U.jsx)(eD,{title:`No run selected`,body:`Select a run to inspect the latest heartbeat result.`})})]})})]}):(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsx)(`header`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:()=>m(`list`),children:`← Tasks`}),(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:()=>m(`runs`),disabled:!s.length,children:`Runs`})]})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:t?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(ZE,{title:t.name||t.taskId,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,U.jsx)(W,{variant:t.enabled?`secondary`:`outline`,children:t.enabled?`enabled`:`disabled`}),(0,U.jsx)(W,{variant:g?.tone===`good`?`secondary`:`outline`,children:g?.label??t.status}),t.decision?(0,U.jsx)(W,{variant:`outline`,children:t.decision}):null]}),(0,U.jsx)(`p`,{className:`m-0 mt-2 text-xs text-muted-foreground`,children:t.taskId}),(0,U.jsx)(`p`,{className:`m-0 mt-2 text-sm text-foreground`,children:t.task}),(0,U.jsx)(`p`,{className:`m-0 mt-2 text-xs text-muted-foreground`,children:g?.detail}),(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,U.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:h||!t.enabled,onClick:()=>{f(t.taskId)},children:h&&c?.action===`trigger`?`Triggering…`:`Run now`}),t.enabled?(0,U.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:h,onClick:()=>{u(t.taskId)},children:h&&c?.action===`disable`?`Pausing…`:`Pause task`}):(0,U.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:h,onClick:()=>{l(t.taskId)},children:h&&c?.action===`enable`?`Resuming…`:`Resume task`})]})]}),(0,U.jsxs)(ZE,{title:`Runtime status`,children:[(0,U.jsx)(QE,{label:`execution`,value:g?.label??t.status}),(0,U.jsx)(QE,{label:`model`,value:t.model??`unset`}),(0,U.jsx)(QE,{label:`interval`,value:mo(t.intervalMs)}),(0,U.jsx)(QE,{label:`last run`,value:co(t.lastRunAt)}),(0,U.jsx)(QE,{label:`next run`,value:co(t.nextRunAt)}),(0,U.jsx)(QE,{label:`checkpoint`,value:t.loadedCheckpoint?`loaded`:t.resumable?`resumable`:`none`}),(0,U.jsx)(QE,{label:`usage`,value:z(t.usage)??`none`})]}),t.summary?(0,U.jsx)(ZE,{title:`Latest summary`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm text-foreground`,children:t.summary})}):null,t.progress?(0,U.jsx)(ZE,{title:`Progress`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm text-foreground`,children:t.progress})}):null,t.error?(0,U.jsx)(ZE,{title:`Error`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm text-destructive`,children:t.error})}):null]}):(0,U.jsx)(eD,{title:`No task selected`,body:`Choose a task to inspect its durable prompt and latest run state.`})})]})}function ZE({title:e,children:t}){return(0,U.jsxs)(`section`,{className:`rounded-md border border-border bg-card px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`div`,{className:`mt-2`,children:t})]})}function QE({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[92px_minmax(0,1fr)] gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e}),(0,U.jsx)(`span`,{className:`break-words text-foreground`,children:t})]})}function $E({active:e,onClick:t,children:n}){return(0,U.jsx)(`button`,{type:`button`,className:`h-8 rounded-md text-xs font-medium ${e?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,onClick:t,"aria-current":e?`page`:void 0,children:n})}function eD({title:e,body:t}){return(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-card px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`p`,{className:`m-0 mt-1 text-xs text-muted-foreground`,children:t})]})}function tD(e){return wa()?(0,U.jsx)(XE,{...e}):(0,U.jsx)(YE,{...e})}function nD(e){let t=new Map;for(let n of e.workspaces)t.set(n.stateRoot,{...n,relation:`attached`});for(let n of e.knownWorkspaces??[])t.has(n.stateRoot)||t.set(n.stateRoot,{...n,relation:`known`});return Array.from(t.values()).sort((t,n)=>{let r=Number(n.id===e.activeWorkspaceId)-Number(t.id===e.activeWorkspaceId);return r===0?(n.updatedAt??``).localeCompare(t.updatedAt??``):r})}function rD(e){let t=e.trim().replace(/\/+$/,``);return t.split(`/`).filter(Boolean).at(-1)??t}function iD({children:e}){return(0,U.jsx)(`section`,{className:`min-w-0 rounded-2xl border border-border bg-card/95 p-4 shadow-sm sm:p-5`,children:e})}function aD({open:e,selectedPath:t,onOpenChange:n}){let[r,i]=(0,d.useState)(t.trim()||void 0),[a,o]=(0,d.useState)(t.trim()),[s,c]=(0,d.useState)(),[l,u]=(0,d.useState)(),[f,p]=(0,d.useState)(!1),[m,h]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{if(!e)return;let n=t.trim()||void 0;i(n),o(n??``)},[e,t]),(0,d.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,n]),(0,d.useEffect)(()=>{if(!e)return;let t=!1;return p(!0),Pi(r,m).then(e=>{t||(c(e),i(e.path),o(e.path),u(void 0))}).catch(e=>{t||u(e instanceof Error?e.message:String(e))}).finally(()=>{t||p(!1)}),()=>{t=!0}},[e,r,m]),{browsePath:r,setBrowsePath:i,pathInput:a,setPathInput:o,listing:s,error:l,loading:f,includeHidden:m,setIncludeHidden:h}}function oD({label:e,detail:t,entry:n,onOpen:r,onSelect:i}){return(0,U.jsxs)(`div`,{className:`grid gap-3 border-b border-border p-3 last:border-b-0 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left`,onClick:r,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:t}),n?(0,U.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.hasHeddleState?(0,U.jsx)(W,{variant:`secondary`,children:`Heddle workspace`}):null,n.hasGit?(0,U.jsx)(W,{variant:`outline`,children:`git repo`}):null,n.hasPackageJson?(0,U.jsx)(W,{variant:`outline`,children:`package.json`}):null]}):null]}),(0,U.jsxs)(`div`,{className:`flex gap-2 sm:justify-end`,children:[(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:`Open`}),i?(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:`Select`}):null]})]})}function sD({open:e,selectedPath:t,recentWorkspaces:n,onOpenChange:r,onSelectPath:i}){let{browsePath:a,setBrowsePath:o,pathInput:s,setPathInput:c,listing:l,error:u,loading:d,includeHidden:f,setIncludeHidden:p}=aD({open:e,selectedPath:t,onOpenChange:r});if(!e)return null;let m=l?.path??a??t.trim(),h=()=>{m&&(i(m),r(!1))};return(0,U.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-3 backdrop-blur-sm sm:p-6`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,U.jsxs)(`div`,{className:`flex max-h-[min(820px,92vh)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-2xl`,role:`dialog`,"aria-modal":`true`,"aria-label":`Choose workspace folder`,children:[(0,U.jsxs)(`div`,{className:`border-b border-border px-4 py-4 sm:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Workspace folder`}),(0,U.jsx)(`h2`,{className:`mt-1 text-xl font-semibold text-foreground`,children:`Choose a project root`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Navigate folders, pick a repo or existing Heddle workspace, then switch the control plane to it.`})]}),(0,U.jsx)(G,{type:`button`,variant:`outline`,onClick:()=>r(!1),children:`Close`})]}),(0,U.jsxs)(`form`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),o(s.trim()||void 0)},children:[(0,U.jsx)(`input`,{className:`h-11 min-w-0 flex-1 rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground`,value:s,onChange:e=>c(e.target.value),placeholder:`/absolute/path/to/workspace`}),(0,U.jsx)(G,{type:`submit`,variant:`outline`,className:`h-11`,children:`Go`}),(0,U.jsx)(G,{type:`button`,variant:`secondary`,className:`h-11`,disabled:!m,onClick:h,children:`Use this folder`})]})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-6`,children:[n.length?(0,U.jsxs)(`div`,{className:`mb-4 rounded-xl border border-border bg-background/50 p-3`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Recent workspaces`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Choose from Heddle workspaces seen on this machine.`})]}),(0,U.jsx)(W,{variant:`outline`,children:n.length})]}),(0,U.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:n.slice(0,6).map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`rounded-lg border border-border bg-card px-3 py-2 text-left hover:border-primary`,onClick:()=>{i(e.anchorRoot),r(!1)},children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e.name}),(0,U.jsx)(W,{variant:`outline`,children:e.relation})]}),(0,U.jsx)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:e.anchorRoot})]},e.stateRoot))})]}):null,(0,U.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(W,{variant:`outline`,className:`max-w-full truncate`,children:m||`Home`}),l?.parentPath?(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>o(l.parentPath),children:`Up one level`}):null,(0,U.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>p(e.target.checked)}),(0,U.jsx)(`span`,{children:`Show hidden folders`})]}),d?(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Loading...`}):null]}),u?(0,U.jsx)(`div`,{className:`mb-3 rounded-xl border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:u}):null,(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-background/40`,children:[l?.parentPath?(0,U.jsx)(oD,{label:`..`,detail:l.parentPath,onOpen:()=>o(l.parentPath)}):null,l?.entries.map(e=>(0,U.jsx)(oD,{label:e.name,detail:e.path,entry:e,onOpen:()=>o(e.path),onSelect:()=>{i(e.path),r(!1)}},e.path)),l&&!d&&l.entries.length===0?(0,U.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No readable child folders found here. You can still use the current folder.`}):null]})]})]})})}function cD({creatingWorkspace:e,onCreateWorkspace:t,recentWorkspaces:n=[]}){let[r,i]=(0,d.useState)(``),[a,o]=(0,d.useState)(``),[s,c]=(0,d.useState)(!0),[l,u]=(0,d.useState)(!1);return(0,U.jsxs)(iD,{children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Add workspace`}),(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Choose a project`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Register another workspace path and optionally switch the control plane to it.`})]}),(0,U.jsxs)(`form`,{"data-testid":`workspace-create-form`,className:`mt-4 space-y-4`,onSubmit:e=>{e.preventDefault(),!(!t||!r.trim()||!a.trim())&&t({name:r.trim(),anchorRoot:a.trim(),setActive:s}).then(()=>{i(``),o(``),c(!0)})},children:[(0,U.jsxs)(`label`,{className:`block space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Name`}),(0,U.jsx)(`input`,{className:`h-11 w-full rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground`,value:r,onChange:e=>i(e.target.value),placeholder:`Workspace name`,disabled:e,"data-testid":`workspace-create-name`})]}),(0,U.jsxs)(`label`,{className:`block space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Workspace path`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{className:`h-11 min-w-0 flex-1 rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground`,value:a,onChange:e=>o(e.target.value),placeholder:`/absolute/path/to/workspace`,disabled:e,"data-testid":`workspace-create-path`}),(0,U.jsx)(G,{type:`button`,variant:`outline`,className:`h-11 shrink-0`,disabled:e,onClick:()=>u(!0),children:`Choose…`})]})]}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),disabled:e}),(0,U.jsx)(`span`,{children:`Switch to this workspace after creating it`})]}),(0,U.jsx)(G,{type:`submit`,variant:`secondary`,className:`w-full`,disabled:e||!r.trim()||!a.trim(),"data-testid":`workspace-create-submit`,children:e?`Creating…`:`Create workspace`})]}),(0,U.jsx)(sD,{open:l,selectedPath:a,recentWorkspaces:n,onOpenChange:u,onSelectPath:e=>{o(e),r.trim()||i(rD(e))}})]})}function lD({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`dt`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:`break-all text-sm text-foreground`,children:t})]})}function uD({workspaceId:e,initialName:t,disabled:n,pending:r,onRename:i}){let[a,o]=(0,d.useState)(t);(0,d.useEffect)(()=>{o(t)},[t]);let s=a.trim()&&a.trim()!==t;return(0,U.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),!(!i||!s)&&i(e,a.trim())},children:[(0,U.jsx)(`input`,{className:`h-10 min-w-0 flex-1 rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground`,value:a,onChange:e=>o(e.target.value),disabled:n,"aria-label":`Workspace name`}),(0,U.jsx)(G,{type:`submit`,variant:`outline`,size:`sm`,disabled:n||!s,children:r?`Saving…`:`Rename`})]})}function dD({state:e,renamingWorkspaceId:t,onRenameWorkspace:n,onSetActiveWorkspace:r}){return(0,U.jsxs)(iD,{children:[(0,U.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Workspace management`}),(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Attached workspaces`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Switch, rename, and inspect workspaces attached to this control-plane catalog.`})]}),(0,U.jsxs)(W,{variant:`outline`,children:[po(e.workspaces.length),` local`]})]}),(0,U.jsx)(`div`,{className:`space-y-3`,"data-testid":`workspace-list`,children:e.workspaces.map(i=>(0,U.jsx)(`article`,{"data-testid":`workspace-card-${i.id}`,className:`rounded-xl border border-border bg-background/60 p-4`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h3`,{className:`truncate text-base font-semibold text-foreground`,children:i.name}),i.id===e.activeWorkspaceId?(0,U.jsx)(W,{variant:`secondary`,children:`active`}):null,(0,U.jsx)(W,{variant:`outline`,children:i.id})]}),(0,U.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,U.jsx)(lD,{label:`Workspace path`,children:i.anchorRoot}),(0,U.jsx)(lD,{label:`State path`,children:i.stateRoot}),(0,U.jsx)(lD,{label:`Repo roots`,children:i.repoRoots.join(`, `)})]})]}),(0,U.jsxs)(`div`,{className:`flex min-w-[min(100%,260px)] flex-col gap-3`,children:[(0,U.jsx)(uD,{workspaceId:i.id,initialName:i.name,disabled:!n||t===i.id,pending:t===i.id,onRename:n}),(0,U.jsx)(G,{type:`button`,variant:i.id===e.activeWorkspaceId?`secondary`:`outline`,disabled:i.id===e.activeWorkspaceId||!r,onClick:()=>r?.(i.id),children:i.id===e.activeWorkspaceId?`Current workspace`:`Switch to workspace`})]})]})},i.id))})]})}function fD({state:e,recentWorkspaces:t,creatingWorkspace:n,onCreateWorkspace:r,onSetActiveWorkspace:i}){return(0,U.jsxs)(iD,{children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Recent workspaces`}),(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Open workspace`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Workspaces Heddle has seen on this machine, including the current catalog.`})]}),t.length?(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,"data-testid":`recent-workspace-list`,children:t.slice(0,8).map(t=>{let a=t.id===e.activeWorkspaceId,o=t.relation===`attached`;return(0,U.jsxs)(`button`,{type:`button`,className:`w-full rounded-xl border border-border bg-background/60 p-3 text-left hover:border-primary disabled:cursor-not-allowed disabled:opacity-50`,disabled:n||a||(o?!i:!r),onClick:()=>{o?i?.(t.id):r?.({name:t.name,anchorRoot:t.anchorRoot,setActive:!0})},children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:t.name}),a?(0,U.jsx)(W,{variant:`secondary`,children:`active`}):null,(0,U.jsx)(W,{variant:`outline`,children:o?`attached`:`known`})]}),(0,U.jsx)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:t.anchorRoot}),(0,U.jsx)(`span`,{className:`mt-2 block text-[11px] text-muted-foreground`,children:fo(t.stateRoot)})]},t.stateRoot)})}):(0,U.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`No Heddle workspaces are known yet. Run Heddle in a project once, then refresh.`})]})}function pD({state:e,creatingWorkspace:t=!1,renamingWorkspaceId:n,onCreateWorkspace:r,onRenameWorkspace:i,onSetActiveWorkspace:a}){let o=nD(e);return(0,U.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-x-hidden overflow-y-auto px-3 pt-3 pb-[calc(env(safe-area-inset-bottom)+5.5rem)] sm:px-4 sm:pt-4 sm:pb-4`,children:(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-4 xl:grid-cols-[minmax(0,1.4fr)_minmax(320px,0.8fr)]`,children:[(0,U.jsx)(dD,{state:e,renamingWorkspaceId:n,onRenameWorkspace:i,onSetActiveWorkspace:a}),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-4`,children:[(0,U.jsx)(cD,{creatingWorkspace:t,recentWorkspaces:o,onCreateWorkspace:r}),(0,U.jsx)(fD,{state:e,recentWorkspaces:o,creatingWorkspace:t,onCreateWorkspace:r,onSetActiveWorkspace:a})]})]})})}function mD(e){let t=hD(e),n=d.forwardRef((e,n)=>{let{children:r,...i}=e,a=d.Children.toArray(r),o=a.find(_D);if(o){let e=o.props.children,r=a.map(t=>t===o?d.Children.count(e)>1?d.Children.only(null):d.isValidElement(e)?e.props.children:null:t);return(0,U.jsx)(t,{...i,ref:n,children:d.isValidElement(e)?d.cloneElement(e,void 0,r):null})}return(0,U.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function hD(e){let t=d.forwardRef((e,t)=>{let{children:n,...r}=e;if(d.isValidElement(n)){let e=yD(n),i=vD(r,n.props);return n.type!==d.Fragment&&(i.ref=t?Xs(t,e):e),d.cloneElement(n,i)}return d.Children.count(n)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gD=Symbol(`radix.slottable`);function _D(e){return d.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===gD}function vD(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function yD(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function bD(e){let t=e+`CollectionProvider`,[n,r]=dc(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=d.useRef(null),a=d.useRef(new Map).current;return(0,U.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=mD(s),l=d.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,U.jsx)(c,{ref:Zs(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,f=`data-radix-collection-item`,p=mD(u),m=d.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=d.useRef(null),s=Zs(t,o),c=a(u,n);return d.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,U.jsx)(p,{[f]:``,ref:s,children:r})});m.displayName=u;function h(t){let n=a(e+`CollectionConsumer`,t);return d.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:m},h,r]}var xD=`ToastProvider`,[SD,CD,wD]=bD(`Toast`),[TD,ED]=dc(`Toast`,[wD]),[DD,OD]=TD(xD),kD=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=d.useState(null),[l,u]=d.useState(0),f=d.useRef(!1),p=d.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${xD}\`. Expected non-empty \`string\`.`),(0,U.jsx)(SD.Provider,{scope:t,children:(0,U.jsx)(DD,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:d.useCallback(()=>u(e=>e+1),[]),onToastRemove:d.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,children:o})})};kD.displayName=xD;var AD=`ToastViewport`,jD=[`F8`],MD=`toast.viewportPause`,ND=`toast.viewportResume`,PD=d.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=jD,label:i=`Notifications ({hotkey})`,...a}=e,o=OD(AD,n),s=CD(n),c=d.useRef(null),l=d.useRef(null),u=d.useRef(null),f=d.useRef(null),p=Zs(t,f,o.onViewportChange),m=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),h=o.toastCount>0;d.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&f.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),d.useEffect(()=>{let e=c.current,t=f.current;if(h&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(MD);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(ND);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[h,o.isClosePausedRef]);let g=d.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...sO(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return d.useEffect(()=>{let e=f.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=g({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);cO(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,g]),(0,U.jsxs)(Lc,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,m),tabIndex:-1,style:{pointerEvents:h?void 0:`none`},children:[h&&(0,U.jsx)(ID,{ref:l,onFocusFromOutsideViewport:()=>{cO(g({tabbingDirection:`forwards`}))}}),(0,U.jsx)(SD.Slot,{scope:n,children:(0,U.jsx)(yc.ol,{tabIndex:-1,...a,ref:p})}),h&&(0,U.jsx)(ID,{ref:u,onFocusFromOutsideViewport:()=>{cO(g({tabbingDirection:`backwards`}))}})]})});PD.displayName=AD;var FD=`ToastFocusProxy`,ID=d.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=OD(FD,n);return(0,U.jsx)(Rd,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});ID.displayName=FD;var LD=`Toast`,RD=`toast.swipeStart`,zD=`toast.swipeMove`,BD=`toast.swipeCancel`,VD=`toast.swipeEnd`,HD=d.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=Nd({prop:r,defaultProp:i??!0,onChange:a,caller:LD});return(0,U.jsx)(Ed,{present:n||s,children:(0,U.jsx)(GD,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:xc(e.onPause),onResume:xc(e.onResume),onSwipeStart:uc(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:uc(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:uc(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:uc(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});HD.displayName=LD;var[UD,WD]=TD(LD,{onClose(){}}),GD=d.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:p,onSwipeCancel:m,onSwipeEnd:h,...g}=e,_=OD(LD,n),[v,y]=d.useState(null),b=Zs(t,e=>y(e)),x=d.useRef(null),S=d.useRef(null),C=i||_.duration,w=d.useRef(0),T=d.useRef(C),E=d.useRef(0),{onToastAdd:D,onToastRemove:O}=_,ee=xc(()=>{v?.contains(document.activeElement)&&_.viewport?.focus(),o()}),k=d.useCallback(e=>{!e||e===1/0||(window.clearTimeout(E.current),w.current=new Date().getTime(),E.current=window.setTimeout(ee,e))},[ee]);d.useEffect(()=>{let e=_.viewport;if(e){let t=()=>{k(T.current),l?.()},n=()=>{let e=new Date().getTime()-w.current;T.current-=e,window.clearTimeout(E.current),c?.()};return e.addEventListener(MD,n),e.addEventListener(ND,t),()=>{e.removeEventListener(MD,n),e.removeEventListener(ND,t)}}},[_.viewport,C,c,l,k]),d.useEffect(()=>{a&&!_.isClosePausedRef.current&&k(C)},[a,C,_.isClosePausedRef,k]),d.useEffect(()=>(D(),()=>O()),[D,O]);let A=d.useMemo(()=>v?nO(v):null,[v]);return _.viewport?(0,U.jsxs)(U.Fragment,{children:[A&&(0,U.jsx)(KD,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:A}),(0,U.jsx)(UD,{scope:n,onClose:ee,children:f.createPortal((0,U.jsx)(SD.ItemSlot,{scope:n,children:(0,U.jsx)(Ic,{asChild:!0,onEscapeKeyDown:uc(s,()=>{_.isFocusedToastEscapeKeyDownRef.current||ee(),_.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,U.jsx)(yc.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":_.swipeDirection,...g,ref:b,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:uc(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(_.isFocusedToastEscapeKeyDownRef.current=!0,ee()))}),onPointerDown:uc(e.onPointerDown,e=>{e.button===0&&(x.current={x:e.clientX,y:e.clientY})}),onPointerMove:uc(e.onPointerMove,e=>{if(!x.current)return;let t=e.clientX-x.current.x,n=e.clientY-x.current.y,r=!!S.current,i=[`left`,`right`].includes(_.swipeDirection),a=[`left`,`up`].includes(_.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},d={originalEvent:e,delta:l};r?(S.current=l,rO(zD,p,d,{discrete:!1})):iO(l,_.swipeDirection,c)?(S.current=l,rO(RD,u,d,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(x.current=null)}),onPointerUp:uc(e.onPointerUp,e=>{let t=S.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),S.current=null,x.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};iO(t,_.swipeDirection,_.swipeThreshold)?rO(VD,h,r,{discrete:!0}):rO(BD,m,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),_.viewport)})]}):null}),KD=e=>{let{__scopeToast:t,children:n,...r}=e,i=OD(LD,t),[a,o]=d.useState(!1),[s,c]=d.useState(!1);return aO(()=>o(!0)),d.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,U.jsx)(wd,{asChild:!0,children:(0,U.jsx)(Rd,{...r,children:a&&(0,U.jsxs)(U.Fragment,{children:[i.label,` `,n]})})})},qD=`ToastTitle`,JD=d.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,U.jsx)(yc.div,{...r,ref:t})});JD.displayName=qD;var YD=`ToastDescription`,XD=d.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,U.jsx)(yc.div,{...r,ref:t})});XD.displayName=YD;var ZD=`ToastAction`,QD=d.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,U.jsx)(tO,{altText:n,asChild:!0,children:(0,U.jsx)(eO,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ZD}\`. Expected non-empty \`string\`.`),null)});QD.displayName=ZD;var $D=`ToastClose`,eO=d.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=WD($D,n);return(0,U.jsx)(tO,{asChild:!0,children:(0,U.jsx)(yc.button,{type:`button`,...r,ref:t,onClick:uc(e.onClick,i.onClose)})})});eO.displayName=$D;var tO=d.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,U.jsx)(yc.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function nO(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),oO(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...nO(e))}}),t}function rO(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?bc(i,a):i.dispatchEvent(a)}var iO=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function aO(e=()=>{}){let t=xc(e);Rc(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function oO(e){return e.nodeType===e.ELEMENT_NODE}function sO(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function cO(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var lO=kD,uO=PD,dO=HD,fO=JD,pO=XD,mO=eO,hO=lO,gO=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(uO,{ref:n,className:Gs(`fixed top-[max(0.75rem,env(safe-area-inset-top))] z-50 flex max-h-screen w-full flex-col-reverse gap-2 p-3 sm:top-[max(1rem,env(safe-area-inset-top))] md:right-4 md:top-4 md:w-[420px] md:max-w-[420px] md:flex-col`,e),...t}));gO.displayName=uO.displayName;var _O=xo(`group pointer-events-auto relative flex w-full items-start justify-between gap-3 overflow-hidden rounded-md border p-3 pr-6 shadow-2xl ring-1 ring-black/20 transition-all`,{variants:{variant:{info:`border-cyan-400/40 bg-slate-950/96 text-slate-100`,success:`border-emerald-400/45 bg-emerald-950/90 text-emerald-50`,error:`border-red-300/45 bg-red-950/92 text-red-50`}},defaultVariants:{variant:`info`}}),vO=d.forwardRef(({className:e,variant:t,...n},r)=>(0,U.jsx)(dO,{ref:r,className:Gs(_O({variant:t}),e),...n}));vO.displayName=dO.displayName;var yO=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(fO,{ref:n,className:Gs(`text-sm font-semibold`,e),...t}));yO.displayName=fO.displayName;var bO=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(pO,{ref:n,className:Gs(`mt-1 text-xs text-slate-200/90`,e),...t}));bO.displayName=pO.displayName;var xO=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(mO,{ref:n,className:Gs(`absolute right-2 top-2 inline-flex h-6 w-6 items-center justify-center rounded-md border border-white/20 bg-black/25 text-slate-200 transition-colors hover:bg-black/45 hover:text-white`,e),"toast-close":``,...t,children:`×`}));xO.displayName=mO.displayName;var SO=3,CO=7e3,wO=new Map,TO=e=>{if(wO.has(e))return;let t=setTimeout(()=>{wO.delete(e),kO({type:`REMOVE_TOAST`,toastId:e})},CO);wO.set(e,t)};function EO(e,t){switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,SO)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?TO(n):e.toasts.forEach(e=>TO(e.id)),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}}var DO=[],OO={toasts:[]};function kO(e){OO=EO(OO,e),DO.forEach(e=>{e(OO)})}function AO(){return`${Date.now()}-${Math.floor(Math.random()*1e3)}`}function jO(e){let t=AO(),n=()=>kO({type:`DISMISS_TOAST`,toastId:t}),r=e=>kO({type:`UPDATE_TOAST`,toast:{...e,id:t}});kO({type:`ADD_TOAST`,toast:{id:t,title:e.title,body:e.body,tone:e.tone,open:!0}});let i=e.tone===`error`?CO:4200;return setTimeout(n,i),{id:t,dismiss:n,update:r}}function MO(){let[e,t]=d.useState(OO);return d.useEffect(()=>(DO.push(t),()=>{let e=DO.indexOf(t);e>-1&&DO.splice(e,1)}),[]),{...e,toast:jO,dismiss:e=>kO({type:`DISMISS_TOAST`,toastId:e})}}function NO(){let{toasts:e,dismiss:t}=MO();return(0,U.jsxs)(hO,{children:[e.map(e=>(0,U.jsxs)(vO,{open:e.open,onOpenChange:n=>{n||t(e.id)},variant:e.tone??`info`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(yO,{children:e.title}),e.body?(0,U.jsx)(bO,{children:e.body}):null]}),(0,U.jsx)(xO,{"aria-label":`Dismiss notification`})]},e.id)),(0,U.jsx)(gO,{})]})}function PO(){let e=Xi(),{state:t,error:n,refresh:r,setActiveWorkspace:i,createWorkspace:a,renameWorkspace:o}=Wi(),{toasts:s,toast:c}=MO(),l=wa(),u=(0,d.useCallback)(()=>{r()},[r]),f=ro(t?.sessions,c,u,{selectedSessionId:e.routeSessionId,onSelectedSessionIdChange:e.setRouteSessionId,autoSelectSession:e.section===`sessions`}),p=io(t?.heartbeat.tasks,t?.heartbeat.runs,c,u),m=ao({state:t,setActiveWorkspace:i,createWorkspace:a,renameWorkspace:o,notify:c}),h=va({section:e.section,sessionsState:f,error:n,toasts:s,notify:c});(0,d.useEffect)(()=>{e.normalizeRoute()},[e]),(0,d.useEffect)(()=>{window.__HEDDLE_CAPTURE_LAYOUT_SNAPSHOT=async e=>{await h(e?.screenshot??`none`)};let e=e=>{if(!(e.metaKey||e.ctrlKey)||!e.shiftKey||e.key.toLowerCase()!==`d`)return;let t=e.target;t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||(e.preventDefault(),h(`none`))};return window.addEventListener(`keydown`,e),()=>{window.__HEDDLE_CAPTURE_LAYOUT_SNAPSHOT&&delete window.__HEDDLE_CAPTURE_LAYOUT_SNAPSHOT,window.removeEventListener(`keydown`,e)}},[h]);let g=t?FO(t,f,p,m):(0,U.jsx)(th,{title:`Loading state`,children:(0,U.jsx)(`p`,{className:`muted`,children:n??`Reading local Heddle state...`})});return l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(mh,{section:e.section,onSectionChange:e.setSection,state:t,error:n,onSetActiveWorkspace:e=>void m.switchWorkspace(e),onCaptureDebugSnapshot:e=>void h(e),onRefresh:()=>void r(),children:g}),(0,U.jsx)(NO,{})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(uh,{activeSection:e.section,sessionPath:e.routeSessionId?`/sessions/${encodeURIComponent(e.routeSessionId)}`:`/sessions`,state:t,error:n,onSetActiveWorkspace:e=>void m.switchWorkspace(e),onCaptureDebugSnapshot:e=>void h(e),onRefresh:()=>void r(),children:g}),(0,U.jsx)(NO,{})]})}function FO(e,t,n,r){return(0,U.jsxs)(Dt,{children:[(0,U.jsx)(Tt,{path:`/overview`,element:(0,U.jsx)(Ch,{state:e})}),(0,U.jsx)(Tt,{path:`/sessions`,element:(0,U.jsx)(IO,{state:e,sessionsState:t})}),(0,U.jsx)(Tt,{path:`/sessions/:sessionId/*`,element:(0,U.jsx)(IO,{state:e,sessionsState:t})}),(0,U.jsx)(Tt,{path:`/tasks`,element:(0,U.jsx)(tD,{tasks:e.heartbeat.tasks,runs:e.heartbeat.runs,selectedTask:n.selectedTask,selectedTaskId:n.selectedTaskId,onSelectTask:n.setSelectedTaskId,selectedRun:n.selectedRun,selectedRunId:n.selectedRunId,onSelectRun:n.setSelectedRunId,selectedTaskRuns:n.selectedTaskRuns,pendingTaskAction:n.pendingTaskAction,onEnableTask:n.enableTask,onDisableTask:n.disableTask,onTriggerTask:n.triggerTask})}),(0,U.jsx)(Tt,{path:`/workspaces`,element:(0,U.jsx)(pD,{state:e,creatingWorkspace:r.creatingWorkspace,renamingWorkspaceId:r.renamingWorkspaceId,onCreateWorkspace:r.createWorkspace,onRenameWorkspace:r.renameWorkspace,onSetActiveWorkspace:e=>void r.switchWorkspace(e)})}),(0,U.jsx)(Tt,{path:`*`,element:(0,U.jsx)(wt,{to:`/overview`,replace:!0})})]})}function IO({state:e,sessionsState:t}){return(0,U.jsx)(WE,{sessions:e.sessions,activeSession:t.activeSession,sessionDetail:t.sessionDetail,sessionDetailLoading:t.sessionDetailLoading,sessionDetailError:t.sessionDetailError,selectedSessionId:t.selectedSessionId,onSelectSession:t.setSelectedSessionId,selectedTurnId:t.selectedTurnId,onSelectTurn:t.setSelectedTurnId,selectedTurn:t.selectedTurn,turnReview:t.turnReview,turnReviewLoading:t.turnReviewLoading,turnReviewError:t.turnReviewError,sendingPrompt:t.sendingPrompt,runInFlight:t.runInFlight,memoryUpdating:t.memoryUpdating,auth:e.auth,sendPromptError:t.sendPromptError,onSendPrompt:t.sendPrompt,creatingSession:t.creatingSession,sessionNotice:t.sessionNotice,onCreateSession:t.createSession,onContinueSession:t.continueSession,onCancelSessionRun:t.cancelSessionRun,onUpdateSessionSettings:t.updateSessionSettings,pendingApproval:t.pendingApproval,onResolveApproval:t.resolveApproval})}(0,p.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(d.StrictMode,{children:(0,U.jsx)(hn,{children:(0,U.jsx)(PO,{})})}));export{_ as n,i as r,qs as t};
81
+ `)}var cE=(0,d.lazy)(()=>_(()=>import(`./MonacoDiffViewer-D0Ed6GCN.js`),__vite__mapDeps([0,1,2,3])));function lE({diff:e,patch:t,fallbackTitle:n=`Raw patch`}){return e?.binary?(0,U.jsx)(nh,{title:`Binary file`,body:`Git reports this as a binary diff, so Heddle cannot render line-level changes.`}):e?.hunks.length?(0,U.jsx)(d.Suspense,{fallback:(0,U.jsx)(uE,{diff:e}),children:(0,U.jsx)(cE,{diff:e})}):t?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(Y,{tone:`warn`,children:n}),(0,U.jsx)(`span`,{className:`min-w-0 text-xs text-muted-foreground`,children:`Structured hunks are unavailable for this patch.`})]}),(0,U.jsx)(sh,{children:t})]}):(0,U.jsx)(nh,{title:`No patch available`,body:`Git reports this file as changed, but no patch text is available for it.`})}function uE({diff:e}){return(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-background font-mono text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-border bg-muted/30 px-3 py-2 font-sans`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:e.path}),e.oldPath?(0,U.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[`from `,e.oldPath]}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,U.jsx)(Y,{children:e.status}),(0,U.jsxs)(Y,{tone:`good`,children:[`+`,e.additions,` / -`,e.deletions]})]})]}),(0,U.jsx)(`div`,{className:`max-h-[44rem] overflow-auto`,children:e.hunks.map((e,t)=>(0,U.jsx)(`table`,{className:`w-full border-collapse`,children:(0,U.jsxs)(`tbody`,{children:[(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:2,className:`border-y border-border bg-muted/40 px-3 py-1 font-mono text-[11px] text-muted-foreground`,children:e.header})}),e.lines.map((t,n)=>(0,U.jsxs)(`tr`,{className:oo(t.type===`added`&&`bg-emerald-500/10`,t.type===`deleted`&&`bg-rose-500/10`),children:[(0,U.jsx)(`td`,{className:`w-14 select-none border-r border-border px-2 py-0.5 text-right text-muted-foreground/70`,children:t.type===`added`?t.newLineNumber:t.oldLineNumber??t.newLineNumber??``}),(0,U.jsx)(`td`,{className:`whitespace-pre px-3 py-0.5 text-foreground`,children:t.content})]},`${e.header}-${t.oldLineNumber??``}-${t.newLineNumber??``}-${n}`))]})},`${e.header}-${t}`))})]})}function dE({workspaceChanges:e,workspaceChangesLoading:t,workspaceChangesError:n,workspaceFileDiffsByPath:r,workspaceFileDiffLoading:i,workspaceFileDiffError:a,selectedTurnPatchIsStale:o,onSelectWorkspaceFile:s,onRefresh:c,onOpenDiff:l}){let u=vE(e?.files??[],r);return(0,U.jsx)(lh,{title:`Current workspace changes`,testId:`review-current-workspace`,actions:(0,U.jsxs)(`div`,{className:`review-section-actions`,children:[o?(0,U.jsx)(hE,{}):null,u.files?.length?(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,disabled:i,onClick:()=>l(u),children:`Open full diff`}):null,(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:c,disabled:t||i,children:`Refresh`})]}),children:t?(0,U.jsx)(nh,{title:`Loading workspace diff`,body:`Reading current Git changes from the active workspace.`}):n?(0,U.jsx)(nh,{title:`Workspace diff failed`,body:n}):e?.vcs===`none`?(0,U.jsx)(nh,{title:`Not a git workspace`,body:e.error??`Current workspace changes require a Git-backed project.`}):e?.files.length?(0,U.jsx)(`div`,{className:`detail-stack compact-stack`,children:(0,U.jsx)(gE,{files:e.files,sourceLabel:`current git`,testId:`review-current-file-list`,onSelect:s,renderContent:e=>{let t=r[e.path];return(0,U.jsx)(_E,{loading:i,error:a,diffError:t?.error,patch:t?.patch,diff:t?.diff,unavailableTitle:`No patch available`,unavailableBody:`Git reports this file as changed, but no patch text is available for it.`,loadingTitle:`Loading file diff`,loadingBody:`Reading the selected file patch.`,fallbackTitle:`Raw workspace patch`})}})}):(0,U.jsx)(nh,{title:`Clean workspace`,body:`Git does not report current project file changes.`})})}function fE({sessionDetail:e,selectedTurnId:t,onSelectTurn:n,turnReview:r,turnReviewLoading:i,turnReviewError:a,onSelectReviewFile:o,onOpenDiff:s}){let c=yE(r?.files??[]);return(0,U.jsxs)(lh,{title:`Captured turn diff`,actions:c.files?.length?(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>s(c),children:`Open full diff`}):void 0,children:[e?.turns.length?(0,U.jsx)(`div`,{className:`stack-list compact review-turn-picker`,children:[...e.turns].reverse().map(e=>(0,U.jsx)(jh,{turn:e,active:e.id===t,onClick:()=>n(e.id)},e.id))}):null,i?(0,U.jsx)(nh,{title:`Loading review`,body:`Reading trace-backed review evidence for the selected turn.`}):a?(0,U.jsx)(nh,{title:`Review load failed`,body:a}):r?.files.length?(0,U.jsx)(`div`,{className:`detail-stack compact-stack`,children:(0,U.jsx)(gE,{files:r.files,testId:`review-turn-file-list`,onSelect:o,renderContent:e=>(0,U.jsx)(_E,{patch:`patch`in e?e.patch:void 0,diff:`diff`in e?e.diff:void 0,unavailableTitle:`No patch captured`,unavailableBody:`This file was changed, but the turn did not capture patch text for it.`,fallbackTitle:`Raw turn patch`})})}):r?.diffExcerpt?(0,U.jsx)(sh,{children:r.diffExcerpt}):(0,U.jsx)(nh,{title:`No captured diff`,body:`This selected turn did not save file-level diff evidence. Check Evidence for commands and approvals.`})]})}function pE({turnReview:e,selectedTurn:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(lh,{title:`Review commands`,children:(0,U.jsx)(Mh,{commands:e?.reviewCommands??[],empty:`No git review commands captured for this turn.`})}),(0,U.jsx)(lh,{title:`Verification commands`,children:(0,U.jsx)(Mh,{commands:e?.verificationCommands??[],empty:`No verification commands captured for this turn.`})}),(0,U.jsx)(lh,{title:`Approvals and events`,children:e?.approvals.length?(0,U.jsx)(`div`,{className:`stack-list compact`,children:e.approvals.map((e,t)=>(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`card-title`,children:e.tool}),(0,U.jsx)(`p`,{className:`muted`,children:e.command??`no command details`}),(0,U.jsx)(`div`,{className:`pills`,children:(0,U.jsx)(Y,{tone:e.approved?`good`:`warn`,children:e.approved?`approved`:`rejected`})}),e.reason?(0,U.jsx)(`p`,{className:`summary`,children:e.reason}):null]},`${e.tool}-${e.timestamp??t}`))}):t?.events.length?(0,U.jsx)(`div`,{className:`event-list`,children:t.events.map((e,n)=>(0,U.jsx)(`p`,{className:`event-line`,children:e},`${t.id}-${n}`))}):(0,U.jsx)(nh,{title:`No approvals or events`,body:`Turn-level approvals, tool review, or summarized events will appear here.`})})]})}function mE({diff:e,onClose:t}){return e?(0,U.jsx)(`div`,{className:`diff-dialog-backdrop`,role:`presentation`,onMouseDown:t,children:(0,U.jsxs)(`section`,{className:`diff-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`${e.subtitle}: ${e.title}`,onMouseDown:e=>e.stopPropagation(),children:[(0,U.jsxs)(`header`,{className:`diff-dialog-header`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`topbar-eyebrow`,children:`Diff review`}),(0,U.jsx)(`h2`,{children:e.title}),(0,U.jsx)(`p`,{className:`muted`,children:e.subtitle})]}),(0,U.jsx)(G,{type:`button`,variant:`outline`,onClick:t,children:`Close`})]}),(0,U.jsx)(`div`,{className:`diff-dialog-body`,children:e.files?.length?(0,U.jsx)(`div`,{className:`detail-stack`,children:e.files.map(e=>(0,U.jsx)(lE,{diff:e.diff,patch:e.patch,fallbackTitle:e.fallbackTitle},e.title))}):(0,U.jsx)(lE,{diff:e.diff,patch:e.patch,fallbackTitle:e.fallbackTitle})})]})}):null}function hE(){return(0,U.jsx)(Ef,{delayDuration:120,children:(0,U.jsxs)(Df,{children:[(0,U.jsx)(Of,{asChild:!0,children:(0,U.jsx)(`button`,{className:`stale-diff-button`,type:`button`,"aria-label":`Current workspace differs from captured turn`,children:`i`})}),(0,U.jsx)(kf,{side:`left`,className:`max-w-64`,children:`The selected file also has trace-backed turn evidence, but the current Git patch is different. Treat Current as live workspace state.`})]})})}function gE({files:e,sourceLabel:t,testId:n,onSelect:r,renderContent:i}){let[a,o]=(0,d.useState)([]);return(0,d.useEffect)(()=>{let t=new Set(e.map(e=>e.path));o(e=>e.filter(e=>t.has(e)))},[e]),(0,U.jsx)(`div`,{className:`stack-list compact`,"data-testid":n,children:e.map(e=>{let n=!a.includes(e.path);return(0,U.jsxs)(`article`,{className:oo(`changed-file-review-card`,n&&`active`),children:[(0,U.jsxs)(`button`,{"data-testid":`changed-file-${e.path}`,type:`button`,className:`changed-file-review-header`,"aria-expanded":n,onClick:()=>{r(e.path),o(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path])},children:[(0,U.jsxs)(`span`,{className:`list-button-header`,children:[(0,U.jsx)(`strong`,{children:e.path}),(0,U.jsx)(`span`,{children:e.status})]}),(0,U.jsxs)(`span`,{className:`pills compact-pills`,children:[`source`in e?(0,U.jsx)(Y,{children:e.source}):(0,U.jsx)(Y,{children:t??`current git`}),`additions`in e&&(e.additions!==void 0||e.deletions!==void 0)?(0,U.jsxs)(Y,{tone:`good`,children:[`+`,e.additions??0,` / -`,e.deletions??0]}):null,`binary`in e&&e.binary?(0,U.jsx)(Y,{tone:`warn`,children:`binary`}):null,`truncated`in e&&e.truncated?(0,U.jsx)(Y,{tone:`warn`,children:`truncated`}):null]})]}),n&&i?(0,U.jsx)(`div`,{className:`changed-file-review-body`,children:i(e)}):null]},`${`source`in e?e.source:`workspace`}-${e.path}`)})})}function _E({loading:e,error:t,diffError:n,patch:r,diff:i,unavailableTitle:a,unavailableBody:o,loadingTitle:s=`Loading diff`,loadingBody:c=`Reading the selected file patch.`,fallbackTitle:l}){return e?(0,U.jsx)(nh,{title:s,body:c}):t?(0,U.jsx)(nh,{title:`File diff failed`,body:t}):n?(0,U.jsx)(nh,{title:`File diff unavailable`,body:n}):r?(0,U.jsx)(`div`,{className:`detail-stack compact-stack`,children:(0,U.jsx)(lE,{diff:i,patch:r,fallbackTitle:l})}):(0,U.jsx)(nh,{title:a,body:o})}function vE(e,t){return{title:`Current workspace changes`,subtitle:`Current workspace diff`,fallbackTitle:`Raw workspace patch`,files:e.flatMap(e=>{let n=t[e.path];return n?.patch?[{title:e.path,diff:n.diff,patch:n.patch,fallbackTitle:`Raw workspace patch`}]:[]})}}function yE(e){return{title:`Captured turn changes`,subtitle:`Captured turn diff`,fallbackTitle:`Raw turn patch`,files:e.flatMap(e=>e.patch?[{title:e.path,diff:e.diff,patch:e.patch,fallbackTitle:`Raw turn patch`}]:[])}}function bE({reviewMode:e,onReviewModeChange:t,onShowChatView:n,workspaceChanges:r,workspaceChangesLoading:i,workspaceChangesError:a,workspaceFileDiffsByPath:o,workspaceFileDiffLoading:s,workspaceFileDiffError:c,selectedTurnPatchIsStale:l,onSelectWorkspaceFile:u,onRefreshWorkspaceReview:d,sessionDetail:f,selectedTurnId:p,onSelectTurn:m,turnReview:h,turnReviewLoading:g,turnReviewError:_,onSelectReviewFile:v,selectedTurn:y,onOpenDiff:b}){return(0,U.jsxs)(`aside`,{className:`workspace-side`,children:[(0,U.jsx)(`div`,{className:`mobile-side-header`,children:(0,U.jsx)(`button`,{className:`mobile-nav-button`,type:`button`,onClick:n,children:`← Chat`})}),(0,U.jsxs)(`div`,{className:`side-scroll`,children:[(0,U.jsxs)(`nav`,{className:`side-tabs review-mode-tabs`,role:`tablist`,"aria-label":`Review mode`,children:[(0,U.jsx)(`button`,{className:oo(e===`current`&&`active`),type:`button`,onClick:()=>t(`current`),children:`Current`}),(0,U.jsx)(`button`,{className:oo(e===`turn`&&`active`),type:`button`,onClick:()=>t(`turn`),children:`Turn history`}),(0,U.jsx)(`button`,{className:oo(e===`evidence`&&`active`),type:`button`,onClick:()=>t(`evidence`),children:`Evidence`})]}),e===`current`?(0,U.jsx)(dE,{workspaceChanges:r,workspaceChangesLoading:i,workspaceChangesError:a,workspaceFileDiffsByPath:o,workspaceFileDiffLoading:s,workspaceFileDiffError:c,selectedTurnPatchIsStale:l,onSelectWorkspaceFile:u,onRefresh:d,onOpenDiff:b}):e===`turn`?(0,U.jsx)(fE,{sessionDetail:f,selectedTurnId:p,onSelectTurn:m,turnReview:h,turnReviewLoading:g,turnReviewError:_,onSelectReviewFile:v,onOpenDiff:b}):(0,U.jsx)(pE,{turnReview:h,selectedTurn:y})]})]})}function xE({loading:e,suggestions:t,activeIndex:n,error:r,query:i,onPick:a}){return(0,U.jsxs)(`div`,{className:`mention-menu`,role:`listbox`,"aria-label":`File suggestions`,children:[(0,U.jsxs)(`div`,{className:`mention-menu-header`,children:[(0,U.jsx)(`span`,{children:`@ file`}),(0,U.jsx)(`span`,{children:e?`Searching...`:`${t.length} match${t.length===1?``:`es`}`})]}),r?(0,U.jsx)(`p`,{className:`mention-empty`,children:`File search unavailable. Restart the Heddle daemon if this route was just added.`}):t.length?t.map((e,t)=>(0,U.jsx)(`button`,{className:oo(`mention-option`,t===n&&`active`),type:`button`,role:`option`,"aria-selected":t===n,onMouseDown:t=>{t.preventDefault(),a(e)},children:(0,U.jsxs)(`span`,{children:[`@`,e.path]})},e.path)):(0,U.jsx)(`p`,{className:`mention-empty`,children:e?`Searching workspace files...`:`No files found for "${i}".`})]})}var SE=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`textarea`,{className:Gs(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:n,...t}));SE.displayName=`Textarea`;function CE({activeView:e,title:t,subtitle:n,onBackToSessions:r,onOpenChat:i,onOpenReview:a}){return(0,U.jsxs)(`header`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:r,children:`‹ Sessions`}),(0,U.jsxs)(`div`,{className:`min-w-0 text-center`,children:[(0,U.jsx)(`h2`,{className:`m-0 truncate text-sm font-semibold leading-5 tracking-normal`,children:t}),n?(0,U.jsx)(`p`,{className:`m-0 truncate text-xs leading-4 text-muted-foreground`,children:n}):null]}),(0,U.jsx)(`div`,{className:`w-[76px]`,"aria-hidden":`true`})]}),(0,U.jsxs)(`nav`,{className:`mt-2 grid grid-cols-2 rounded-md bg-muted p-1`,"aria-label":`Session views`,children:[(0,U.jsx)(wE,{active:e===`chat`,onClick:i,children:`Chat`}),(0,U.jsx)(wE,{active:e===`review`,onClick:a,children:`Review`})]})]})}function wE({active:e,onClick:t,children:n}){return(0,U.jsx)(`button`,{type:`button`,className:Gs(`h-8 rounded-md text-xs font-medium text-muted-foreground transition-colors`,e&&`bg-background text-foreground shadow-sm`),"aria-current":e?`page`:void 0,onClick:t,children:n})}var TE=new Set([`run_shell_mutate`,`edit_file`,`write_to_file`,`delete_file`,`apply_patch`]);function EE({approval:e,open:t,onOpenChange:n,onResolve:r}){if(!e||!t)return null;let i=TE.has(e.tool)?`high`:`medium`,a=DE(e.input),o=OE(e.input),s=AE(e.input);return(0,U.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-end`,role:`dialog`,"aria-modal":`true`,"aria-label":`Pending approval details`,children:[(0,U.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/45`,"aria-label":`Close approval details`,onClick:()=>n(!1)}),(0,U.jsxs)(`section`,{className:`relative z-10 flex max-h-[82dvh] w-full flex-col rounded-t-2xl border border-border bg-card`,children:[(0,U.jsx)(`header`,{className:`shrink-0 border-b border-border px-3 py-3`,children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`p`,{className:`m-0 text-sm font-semibold`,children:[`Approval required: `,e.tool]}),(0,U.jsxs)(`p`,{className:`m-0 mt-1 truncate text-xs text-muted-foreground`,children:[`Call ID: `,e.callId]}),(0,U.jsxs)(`p`,{className:`m-0 mt-1 truncate text-xs text-muted-foreground`,children:[`Requested: `,new Date(e.requestedAt).toLocaleString()]})]}),(0,U.jsxs)(W,{variant:i===`high`?`destructive`:`secondary`,children:[i,` risk`]})]})}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:[(0,U.jsxs)(`dl`,{className:`grid gap-2 text-xs`,children:[(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-2 py-2`,children:[(0,U.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Path target`}),(0,U.jsx)(`dd`,{className:`m-0 mt-1 break-all text-muted-foreground`,children:a??`No explicit path in payload`})]}),(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-2 py-2`,children:[(0,U.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Command target`}),(0,U.jsx)(`dd`,{className:`m-0 mt-1 break-all text-muted-foreground`,children:o??`No explicit command in payload`})]})]}),(0,U.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-background`,children:[(0,U.jsx)(`div`,{className:`border-b border-border px-2 py-2 text-xs font-medium`,children:`Raw payload`}),(0,U.jsx)(`pre`,{className:`m-0 max-h-[34dvh] overflow-auto whitespace-pre-wrap break-words px-2 py-2 text-[11px] leading-4 text-muted-foreground`,children:s})]})]}),(0,U.jsx)(`footer`,{className:`sticky bottom-0 z-10 shrink-0 border-t border-border bg-card px-3 py-3 pb-[calc(env(safe-area-inset-bottom)+0.75rem)]`,children:(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsx)(G,{type:`button`,className:`h-11`,onClick:()=>r(!0),children:`Approve`}),(0,U.jsx)(G,{type:`button`,variant:`outline`,className:`h-11`,onClick:()=>r(!1),children:`Deny`})]})})]})]})}function DE(e){let t=kE(e,[`targetFile`,`file_path`,`filePath`,`path`,`paths`,`absolute_path`]);if(t)return t}function OE(e){return kE(e,[`command`,`CommandLine`,`cmd`])}function kE(e,t){if(!(!e||typeof e!=`object`))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`&&!!e.trim());if(e.length>0)return e.slice(0,3).join(`, `)}}}function AE(e){if(e===void 0)return`No payload provided.`;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function jE({activeSession:e,sessionDetail:t,sessionDetailLoading:n,sessionDetailError:r,selectedSessionId:i,runActive:a,runInFlight:o,memoryUpdating:s,authStatus:c,sendPromptError:l,sessionNotice:u,draft:f,pendingApproval:p,conversationScrollRef:m,textareaRef:h,mentionMenu:g,renderMessage:_,onDraftChange:v,onComposerKeyDown:y,onBackToSessions:b,onOpenReview:x,onSubmitPrompt:S,onContinueSession:C,onCancelSessionRun:w,onResolveApproval:T}){let E=!!(i&&!a&&f.trim()),D=!!(i&&!a&&t?.lastContinuePrompt),O=t?.name??e?.name??`Chat session`,ee=(t?.context?.compactionStatus??e?.context?.compactionStatus)===`running`,[k,A]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{p||A(!1)},[p]),(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsx)(CE,{activeView:`chat`,title:O,subtitle:e?`updated ${co(e.updatedAt)}`:`Pick a session`,onBackToSessions:b,onOpenChat:()=>void 0,onOpenReview:x}),(0,U.jsx)(`div`,{ref:m,className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,U.jsx)(`div`,{className:`flex min-h-full flex-col justify-end gap-3`,children:n?(0,U.jsx)(FE,{title:`Loading session`,body:`Fetching conversation state.`}):r?(0,U.jsx)(FE,{title:`Session load failed`,body:r}):t&&t.messages.length?t.messages.map(e=>_(e)):(0,U.jsx)(FE,{title:`No conversation`,body:`Start with a prompt from the composer.`})})}),(0,U.jsx)(ME,{draft:f,disabled:!i||a,runActive:a,runInFlight:o,memoryUpdating:s,authStatus:c,canSend:E,canContinue:D,pendingApproval:p,compacting:ee,onOpenApprovalSheet:()=>A(!0),sendPromptError:l,sessionNotice:u,textareaRef:h,mentionMenu:g,onDraftChange:v,onComposerKeyDown:y,onSubmitPrompt:S,onContinueSession:C,onCancelSessionRun:w}),(0,U.jsx)(EE,{approval:p,open:k,onOpenChange:A,onResolve:e=>{T(e),A(!1)}})]})}function ME({draft:e,disabled:t,runActive:n,runInFlight:r,memoryUpdating:i,authStatus:a,canSend:o,canContinue:s,pendingApproval:c,compacting:l,onOpenApprovalSheet:u,sendPromptError:d,sessionNotice:f,textareaRef:p,mentionMenu:m,onDraftChange:h,onComposerKeyDown:g,onSubmitPrompt:_,onContinueSession:v,onCancelSessionRun:y}){let b=l?`Compacting earlier conversation history into an archive summary.`:d??f??(i?`Memory updating in the background.`:void 0);return(0,U.jsxs)(`footer`,{className:`relative shrink-0 border-t border-border bg-card px-2 py-2`,children:[c?(0,U.jsx)(NE,{approval:c,onOpen:u}):null,m,(0,U.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,U.jsx)(SE,{ref:p,rows:1,value:e,className:`max-h-24 min-h-10 resize-none rounded-md bg-background px-3 py-2 text-base leading-6 md:text-sm md:leading-5`,disabled:t,placeholder:n?`Heddle is working...`:`Message Heddle`,onChange:e=>h(e.target.value,e.target.selectionStart),onClick:t=>h(e,t.currentTarget.selectionStart),onSelect:t=>h(e,t.currentTarget.selectionStart),onKeyDown:g}),(0,U.jsx)(G,{type:`button`,size:`sm`,className:`h-10 shrink-0 px-3`,disabled:!o,onClick:_,children:`Send`})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-2`,children:[(0,U.jsx)(`div`,{className:`min-w-0`,children:b?(0,U.jsx)(`p`,{className:`m-0 truncate text-xs text-muted-foreground`,children:b}):(0,U.jsx)(PE,{runActive:n})}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[a?(0,U.jsx)(W,{variant:`secondary`,children:a}):null,(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,disabled:!s,onClick:v,children:`Continue`}),(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,disabled:!r,onClick:y,children:`Cancel`})]})]})]})}function NE({approval:e,onOpen:t}){return(0,U.jsxs)(`button`,{type:`button`,className:`mb-2 flex w-full items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-left`,onClick:t,"aria-label":`Open pending approval for ${e.tool}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`p`,{className:`m-0 truncate text-xs font-semibold text-foreground`,children:[`Approval required: `,e.tool]}),(0,U.jsx)(`p`,{className:`m-0 truncate text-[11px] text-muted-foreground`,children:`Tap for details and actions`})]}),(0,U.jsx)(W,{variant:`destructive`,className:`shrink-0`,children:`Pending`})]})}function PE({runActive:e}){return(0,U.jsx)(W,{variant:e?`outline`:`secondary`,children:e?`working`:`idle`})}function FE({title:e,body:t}){return(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-card px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`p`,{className:`m-0 mt-1 text-xs text-muted-foreground`,children:t})]})}function IE({activeSession:e,sessionDetail:t,selectedTurnId:n,selectedTurn:r,turnReview:i,turnReviewLoading:a,turnReviewError:o,workspaceChanges:s,workspaceChangesLoading:c,workspaceChangesError:l,selectedWorkspaceFile:u,workspaceFileDiff:f,workspaceFileDiffLoading:p,workspaceFileDiffError:m,onSelectWorkspaceFile:h,onRefreshWorkspaceReview:g,selectedTurnPatchIsStale:_,onOpenDiff:v,onBackToSessions:y,onOpenChat:b,onSelectTurn:x}){let[S,C]=(0,d.useState)(`current`),[w,T]=(0,d.useState)(),E=t?.name??e?.name??`Session`,D=`Review evidence`,O=i?.files.find(e=>e.path===w)??i?.files[0],ee=i?.files[0]?.path;(0,d.useEffect)(()=>{T(ee)},[ee,n,i?.traceFile]);let k=(0,d.useMemo)(()=>i?[{label:`Review`,commands:i.reviewCommands},{label:`Verification`,commands:i.verificationCommands},{label:`Mutation`,commands:i.mutationCommands}]:[],[i]);return(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsx)(CE,{activeView:`review`,title:E,subtitle:e?`${D} · updated ${co(e.updatedAt)}`:D,onBackToSessions:y,onOpenChat:b,onOpenReview:()=>void 0}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`nav`,{className:`grid grid-cols-3 rounded-md bg-muted p-1`,"aria-label":`Review evidence tabs`,children:[(0,U.jsx)(BE,{active:S===`current`,onClick:()=>C(`current`),children:`Current`}),(0,U.jsx)(BE,{active:S===`turn`,onClick:()=>C(`turn`),children:`Turn`}),(0,U.jsx)(BE,{active:S===`evidence`,onClick:()=>C(`evidence`),children:`Evidence`})]}),S===`current`?(0,U.jsx)(LE,{title:`Current workspace changes`,actions:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_?(0,U.jsx)(W,{variant:`outline`,children:`live diff differs`}):null,(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:g,disabled:c||p,children:`Refresh`})]}),children:c?(0,U.jsx)(VE,{title:`Loading workspace diff`,body:`Reading current Git changes from the active workspace.`}):l?(0,U.jsx)(VE,{title:`Workspace diff failed`,body:l}):s?.vcs===`none`?(0,U.jsx)(VE,{title:`Not a git workspace`,body:s.error??`Current workspace changes require a Git-backed project.`}):s?.files.length?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1`,children:s.files.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`shrink-0 rounded-md border px-2 py-1 text-left text-[11px] ${u?.path===e.path?`border-primary bg-primary/5 text-foreground`:`border-border bg-background text-muted-foreground`}`,onClick:()=>h(e.path),children:[(0,U.jsx)(`span`,{className:`block max-w-44 truncate font-medium`,children:e.path}),(0,U.jsxs)(`span`,{className:`block`,children:[e.status,e.additions!==void 0||e.deletions!==void 0?` · +${e.additions??0} / -${e.deletions??0}`:``]})]},`workspace-${e.path}`))}),p?(0,U.jsx)(VE,{title:`Loading file diff`,body:`Reading the selected file patch.`}):m?(0,U.jsx)(VE,{title:`File diff failed`,body:m}):f?.error?(0,U.jsx)(VE,{title:`File diff unavailable`,body:f.error}):f?.patch?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>v({title:u?.path??f.path,subtitle:`Current workspace diff`,diff:f.diff,patch:f.patch,fallbackTitle:`Raw workspace patch`}),children:`Open full diff`}),(0,U.jsx)(lE,{diff:f.diff,patch:f.patch,fallbackTitle:`Raw workspace patch`})]}):(0,U.jsx)(VE,{title:`No patch available`,body:`Git reports this file as changed, but no patch text is available for it.`})]}):(0,U.jsx)(VE,{title:`Clean workspace`,body:`Git does not report current project file changes.`})}):S===`evidence`?(0,U.jsx)(`div`,{className:`space-y-3`,children:a?(0,U.jsx)(VE,{title:`Loading review`,body:`Reading trace-backed review evidence for the selected turn.`}):o?(0,U.jsx)(VE,{title:`Review load failed`,body:o}):(0,U.jsxs)(U.Fragment,{children:[k.map(e=>(0,U.jsx)(RE,{label:e.label,commands:e.commands},e.label)),(0,U.jsx)(zE,{turnReview:i,selectedTurn:r})]})}):(0,U.jsxs)(LE,{title:`Captured turn diff`,children:[t?.turns.length?(0,U.jsx)(`div`,{className:`mb-2 flex gap-2 overflow-x-auto pb-1`,children:[...t.turns].reverse().map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`shrink-0 rounded-md border px-2 py-1 text-left text-[11px] ${e.id===n?`border-primary bg-primary/5 text-foreground`:`border-border bg-background text-muted-foreground`}`,onClick:()=>x(e.id),children:[(0,U.jsx)(`span`,{className:`block max-w-44 truncate font-medium`,children:e.prompt}),(0,U.jsxs)(`span`,{className:`block`,children:[e.outcome,` · `,e.steps,` steps`]})]},e.id))}):null,a?(0,U.jsx)(VE,{title:`Loading review`,body:`Reading trace-backed review evidence for the selected turn.`}):o?(0,U.jsx)(VE,{title:`Review load failed`,body:o}):i?.files.length?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1`,children:i.files.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`shrink-0 rounded-md border px-2 py-1 text-left text-[11px] ${O?.path===e.path?`border-primary bg-primary/5 text-foreground`:`border-border bg-background text-muted-foreground`}`,onClick:()=>T(e.path),children:[(0,U.jsx)(`span`,{className:`block max-w-44 truncate font-medium`,children:e.path}),(0,U.jsxs)(`span`,{className:`block`,children:[e.status,` · `,e.source,e.truncated?` · truncated`:``]})]},`${e.source}-${e.path}`))}),O?.patch?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>v({title:O.path,subtitle:`Captured turn diff`,diff:O.diff,patch:O.patch,fallbackTitle:`Raw turn patch`}),children:`Open full diff`}),(0,U.jsx)(lE,{diff:O.diff,patch:O.patch,fallbackTitle:`Raw turn patch`})]}):(0,U.jsx)(VE,{title:`No patch captured`,body:`This file was changed, but the turn did not capture patch text for it.`})]}):i?.diffExcerpt?(0,U.jsx)(`pre`,{className:`max-h-[52dvh] overflow-auto rounded-md border border-border bg-background p-2 text-[11px] leading-4 text-muted-foreground`,children:i.diffExcerpt}):(0,U.jsx)(VE,{title:`No changed files`,body:`This turn did not capture structured file review data.`})]})]})})]})}function LE({title:e,actions:t,children:n}){return(0,U.jsxs)(`section`,{className:`rounded-md border border-border bg-card px-3 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),t]}),(0,U.jsx)(`div`,{className:`mt-2`,children:n})]})}function RE({label:e,commands:t}){return(0,U.jsx)(LE,{title:`${e} commands`,children:t.length?(0,U.jsx)(`div`,{className:`space-y-2`,children:t.map(t=>(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-2 py-2`,children:[(0,U.jsx)(`p`,{className:`m-0 break-words text-xs font-medium text-foreground`,children:t.command}),(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[(0,U.jsx)(W,{variant:`outline`,children:t.tool}),(0,U.jsxs)(W,{variant:t.exitCode===0?`secondary`:`outline`,children:[`exit `,t.exitCode??`n/a`]})]}),t.stdout?(0,U.jsx)(`pre`,{className:`mt-2 max-h-36 overflow-auto rounded border border-border bg-card p-2 text-[11px] leading-4 text-muted-foreground`,children:t.stdout}):null,t.stderr?(0,U.jsx)(`pre`,{className:`mt-2 max-h-36 overflow-auto rounded border border-border bg-card p-2 text-[11px] leading-4 text-destructive`,children:t.stderr}):null]},`${e}-${t.tool}-${t.command}`))}):(0,U.jsx)(VE,{title:`No commands`,body:`No ${e.toLowerCase()} commands captured for this turn.`})})}function zE({turnReview:e,selectedTurn:t}){return(0,U.jsx)(LE,{title:`Approvals and events`,children:e?.approvals.length?(0,U.jsx)(`div`,{className:`space-y-2`,children:e.approvals.map((e,t)=>(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-2 py-2`,children:[(0,U.jsx)(`p`,{className:`m-0 text-xs font-medium text-foreground`,children:e.tool}),(0,U.jsx)(`p`,{className:`m-0 mt-1 break-words text-[11px] text-muted-foreground`,children:e.command??`no command details`}),(0,U.jsx)(`div`,{className:`mt-1`,children:(0,U.jsx)(W,{variant:e.approved?`secondary`:`destructive`,children:e.approved?`approved`:`rejected`})}),e.reason?(0,U.jsx)(`p`,{className:`m-0 mt-1 text-[11px] text-muted-foreground`,children:e.reason}):null]},`${e.tool}-${e.timestamp??t}`))}):t?.events.length?(0,U.jsx)(`div`,{className:`space-y-1`,children:t.events.map((e,n)=>(0,U.jsx)(`p`,{className:`m-0 rounded-md border border-border bg-background px-2 py-2 text-[11px] text-muted-foreground`,children:e},`${t.id}-${n}`))}):(0,U.jsx)(VE,{title:`No approvals or events`,body:`Turn-level approvals and events will appear here.`})})}function BE({active:e,onClick:t,children:n}){return(0,U.jsx)(`button`,{type:`button`,className:`h-8 rounded-md text-[11px] font-medium ${e?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,"aria-current":e?`page`:void 0,onClick:t,children:n})}function VE({title:e,body:t}){return(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-background px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`p`,{className:`m-0 mt-1 text-xs text-muted-foreground`,children:t})]})}function HE({mobileView:e,sessions:t,activeSession:n,sessionDetail:r,sessionDetailLoading:i,sessionDetailError:a,selectedSessionId:o,selectedTurnId:s,selectedTurn:c,turnReview:l,turnReviewLoading:u,turnReviewError:d,runActive:f,runInFlight:p,memoryUpdating:m,authStatus:h,sendPromptError:g,sessionNotice:_,draft:v,pendingApproval:y,conversationScrollRef:b,textareaRef:x,mentionMenu:S,workspaceChanges:C,workspaceChangesLoading:w,workspaceChangesError:T,workspaceFileDiff:E,workspaceFileDiffsByPath:D,workspaceFileDiffLoading:O,workspaceFileDiffError:ee,selectedTurnPatchIsStale:k,expandedDiff:A,creatingSession:j,onCreateSession:M,onSelectSession:te,onSelectTurn:N,onDraftChange:P,onComposerKeyDown:F,onBackToSessions:ne,onOpenReview:re,onSubmitPrompt:ie,onContinueSession:ae,onCancelSessionRun:I,onResolveApproval:L,onSelectWorkspaceFile:oe,onRefreshWorkspaceReview:se,onOpenDiff:ce,onOpenChat:le,onCloseDiff:ue}){return e===`list`?(0,U.jsx)(`section`,{className:`mobile-session-screen mobile-session-list`,children:(0,U.jsxs)(`aside`,{className:`workspace-sidebar mobile-pane`,children:[(0,U.jsx)(ch,{title:`Sessions`,subtitle:`${t.length} saved conversation${t.length===1?``:`s`}`,actions:(0,U.jsx)(`button`,{className:`sidebar-action-button`,type:`button`,"data-testid":`new-session-button`,disabled:j,onClick:()=>void M(),children:j?`Creating…`:`+ New session`})}),(0,U.jsx)(`div`,{className:`sidebar-scroll`,children:t.length?(0,U.jsx)(`div`,{className:`stack-list compact`,children:t.map(e=>(0,U.jsx)(Oh,{session:e,active:e.id===o,onClick:()=>te(e.id)},e.id))}):(0,U.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,U.jsx)(nh,{title:`No sessions`,body:`Create a new web session to start a fresh conversation in the browser.`})})})]})}):e===`chat`?(0,U.jsx)(jE,{activeSession:n,sessionDetail:r,sessionDetailLoading:i,sessionDetailError:a,selectedSessionId:o,runActive:f,runInFlight:p,memoryUpdating:m,authStatus:h,sendPromptError:g,sessionNotice:_,draft:v,pendingApproval:y,conversationScrollRef:b,textareaRef:x,mentionMenu:S,renderMessage:e=>(0,U.jsx)(ST,{message:e},e.id),onDraftChange:P,onComposerKeyDown:F,onBackToSessions:ne,onOpenReview:re,onSubmitPrompt:ie,onContinueSession:()=>void ae(),onCancelSessionRun:()=>void I(),onResolveApproval:e=>void L(e)}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(IE,{activeSession:n,sessionDetail:r,selectedTurnId:s,selectedTurn:c,turnReview:l,turnReviewLoading:u,turnReviewError:d,workspaceChanges:C,workspaceChangesLoading:w,workspaceChangesError:T,workspaceFileDiff:E,workspaceFileDiffsByPath:D,workspaceFileDiffLoading:O,workspaceFileDiffError:ee,onSelectWorkspaceFile:oe,onRefreshWorkspaceReview:se,selectedTurnPatchIsStale:k,onOpenDiff:ce,onBackToSessions:ne,onOpenChat:le,onSelectTurn:N}),(0,U.jsx)(mE,{diff:A,onClose:ue})]})}function UE(e,t){return e?`drift ${t??`unknown`}`:`drift off`}function WE({sessions:e,activeSession:t,sessionDetail:n,sessionDetailLoading:r,sessionDetailError:i,selectedSessionId:a,onSelectSession:o,selectedTurnId:s,onSelectTurn:c,selectedTurn:l,turnReview:u,turnReviewLoading:f,turnReviewError:p,sendingPrompt:m,runInFlight:h,memoryUpdating:g,auth:_,sendPromptError:v,onSendPrompt:y,creatingSession:b,sessionNotice:x,onCreateSession:S,onContinueSession:C,onCancelSessionRun:w,onUpdateSessionSettings:T,pendingApproval:E,onResolveApproval:D}){let O=(0,d.useRef)(null),[ee,k]=(0,d.useState)(),[A,j]=(0,d.useState)(`current`),[M,te]=(0,d.useState)(null),{textareaRef:N,draft:P,mentionQuery:F,mentionSuggestions:ne,mentionLoading:re,mentionError:ie,activeMentionIndex:ae,updateDraft:I,insertMention:L,submitDraft:oe,handleComposerKeyDown:se}=tE({onSendPrompt:y}),{shellRef:ce,workspaceStyle:le,startPanelResize:ue}=QT(),{mobileView:de,shellClassName:fe,selectSession:pe,selectTurn:me,showSessionList:he,showChatView:ge,openReviewInspector:_e}=rE({selectedSessionId:a,onSelectSession:o,onSelectTurn:c}),ve=m||h,ye=Eh(n?.model??t?.model,_),be=n?.context?.compactionStatus??t?.context?.compactionStatus,xe=n?.model??t?.model??``,{modelOptions:Se,modelOptionsError:Ce,modelOptionGroups:we,selectedModelOption:Te,reasoningEffortOptions:Ee,selectedReasoningEffortOption:De,modelSelectorDisabled:Oe}=aE({auth:_,selectedModel:xe,selectedReasoningEffort:n?.reasoningEffort??t?.reasoningEffort,runActive:ve}),{workspaceChanges:ke,workspaceChangesLoading:Ae,workspaceChangesError:je,workspaceFileDiff:Me,workspaceFileDiffsByPath:Ne,workspaceFileDiffLoading:Pe,workspaceFileDiffError:Fe,selectedTurnPatchIsStale:Ie,selectWorkspaceFile:Le,refreshWorkspaceReview:Re}=oE({runActive:ve,sessionUpdatedAt:n?.updatedAt,turnReview:u,selectedReviewFilePath:ee}),ze=u?.files[0]?.path;(0,d.useEffect)(()=>{let e=O.current;if(!e)return;let t,n=window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,t=window.setTimeout(()=>{e.scrollTop=e.scrollHeight},0)});return()=>{window.cancelAnimationFrame(n),t!==void 0&&window.clearTimeout(t)}},[de,a,n?.messages.length,r,i]),(0,d.useEffect)(()=>{k(ze)},[ze,s,u?.traceFile]);let Be=F?(0,U.jsx)(xE,{loading:re,suggestions:ne,activeIndex:ae,error:ie,query:F.query,onPick:L}):null;return typeof window<`u`&&window.innerWidth<=760?(0,U.jsx)(HE,{mobileView:de,sessions:e,activeSession:t,sessionDetail:n,sessionDetailLoading:r,sessionDetailError:i,selectedSessionId:a,selectedTurnId:s,selectedTurn:l,turnReview:u,turnReviewLoading:f,turnReviewError:p,runActive:ve,runInFlight:h,memoryUpdating:g,authStatus:ye,sendPromptError:v,sessionNotice:x,draft:P,pendingApproval:E,conversationScrollRef:O,textareaRef:N,mentionMenu:Be,workspaceChanges:ke,workspaceChangesLoading:Ae,workspaceChangesError:je,workspaceFileDiff:Me,workspaceFileDiffsByPath:Ne,workspaceFileDiffLoading:Pe,workspaceFileDiffError:Fe,selectedTurnPatchIsStale:Ie,expandedDiff:M,creatingSession:b,onCreateSession:S,onSelectSession:pe,onSelectTurn:me,onDraftChange:I,onComposerKeyDown:se,onBackToSessions:he,onOpenReview:_e,onSubmitPrompt:oe,onContinueSession:C,onCancelSessionRun:w,onResolveApproval:D,onSelectWorkspaceFile:Le,onRefreshWorkspaceReview:Re,onOpenDiff:te,onOpenChat:ge,onCloseDiff:()=>te(null)}):(0,U.jsxs)(`section`,{className:fe,ref:ce,style:le,"data-mobile-view":de,children:[(0,U.jsxs)(`aside`,{className:`workspace-sidebar`,children:[(0,U.jsx)(ch,{title:`Sessions`,subtitle:`${e.length} saved conversation${e.length===1?``:`s`}`,actions:(0,U.jsx)(`button`,{className:`sidebar-action-button`,type:`button`,"data-testid":`new-session-button`,disabled:b,onClick:()=>void S(),children:b?`Creating…`:`+ New session`})}),(0,U.jsx)(`div`,{className:`sidebar-scroll`,children:e.length?(0,U.jsx)(`div`,{className:`stack-list compact`,children:e.map(e=>(0,U.jsx)(Oh,{session:e,active:e.id===a,onClick:()=>pe(e.id)},e.id))}):(0,U.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,U.jsx)(nh,{title:`No sessions`,body:`Create a new web session to start a fresh conversation in the browser.`})})})]}),(0,U.jsx)(`button`,{className:`workspace-resizer`,type:`button`,"aria-label":`Resize sessions sidebar`,onPointerDown:e=>ue(`left`,e)}),(0,U.jsxs)(`section`,{className:`workspace-main`,children:[(0,U.jsx)(ch,{title:n?.name??t?.name??`Chat session`,subtitle:t?`${t.id} · updated ${co(t.updatedAt)}`:`Pick a session to inspect its conversation.`,actions:t?(0,U.jsxs)(`div`,{className:`session-controls`,children:[(0,U.jsx)(`button`,{className:`mobile-nav-button`,type:`button`,onClick:he,children:`← Sessions`}),(0,U.jsx)(`button`,{className:`mobile-nav-button mobile-inspector-button`,type:`button`,onClick:_e,children:`Review`}),(0,U.jsxs)(`div`,{className:`model-select-control`,children:[(0,U.jsxs)(`label`,{className:`select-control`,children:[(0,U.jsx)(`span`,{children:`model`}),(0,U.jsx)(WT,{selectedModel:xe,selectedModelUnsupported:!!Te?.disabled,disabled:Oe,groups:we,runActive:ve,modelOptionsError:Ce,onSelectModel:e=>void T({model:e})})]}),Se?null:(0,U.jsx)(`p`,{className:`model-select-description`,children:Ce?`models unavailable`:`loading models`})]}),(0,U.jsxs)(`label`,{className:`select-control`,children:[(0,U.jsx)(`span`,{children:`reasoning`}),(0,U.jsx)(`select`,{value:De?.id??`default`,disabled:Oe,onChange:e=>void T({reasoningEffort:e.target.value===`default`?null:e.target.value}),children:Ee.map(e=>(0,U.jsx)(`option`,{value:e.id,disabled:e.disabled,children:e.label},e.id))})]}),(0,U.jsxs)(Y,{children:[`turns `,t.turnCount]}),be===`running`?(0,U.jsx)(Y,{tone:`warn`,children:`compacting`}):null,(0,U.jsx)(`button`,{className:oo(`drift-button`,(n?.driftEnabled??t.driftEnabled)&&`active`),type:`button`,disabled:ve,onClick:()=>void T({driftEnabled:!(n?.driftEnabled??t.driftEnabled??!0)}),children:UE(n?.driftEnabled??t.driftEnabled,n?.driftLevel??t.driftLevel)}),ve?(0,U.jsx)(Y,{tone:`warn`,children:`working`}):null]}):void 0}),(0,U.jsx)(`div`,{className:`conversation-scroll`,"data-testid":`session-conversation`,ref:O,children:(0,U.jsxs)(`div`,{className:`conversation-stack`,children:[(0,U.jsx)(`div`,{className:`conversation-spacer`}),r?(0,U.jsx)(nh,{title:`Loading session`,body:`Fetching full conversation state from saved Heddle session storage.`}):i?(0,U.jsx)(nh,{title:`Session load failed`,body:i}):n&&n.messages.length?n.messages.map(e=>(0,U.jsx)(ST,{message:e},e.id)):(0,U.jsx)(nh,{title:`No conversation available`,body:`This session does not have any saved chat messages yet.`})]})}),(0,U.jsxs)(`div`,{className:`composer-shell`,children:[E?(0,U.jsxs)(`div`,{className:`detail-card error-card approval-card`,children:[(0,U.jsxs)(`p`,{className:`card-title`,children:[`Approval required: `,E.tool]}),(0,U.jsxs)(`p`,{className:`muted`,children:[`Call ID: `,E.callId]}),(0,U.jsx)(sh,{children:JSON.stringify(E.input,null,2)}),(0,U.jsxs)(`div`,{className:`pills approval-actions`,children:[(0,U.jsx)(`button`,{className:`primary-button`,type:`button`,onClick:()=>void D(!0),children:`Approve`}),(0,U.jsx)(`button`,{className:`tab-button`,type:`button`,onClick:()=>void D(!1),children:`Deny`})]})]}):null,(0,U.jsx)(`textarea`,{ref:N,value:P,onChange:e=>I(e.target.value,e.target.selectionStart),onClick:e=>I(P,e.currentTarget.selectionStart),onSelect:e=>I(P,e.currentTarget.selectionStart),disabled:!a||ve,placeholder:ve?`Heddle is working…`:`Ask Heddle about this workspace`,onKeyDown:se}),Be,(0,U.jsxs)(`div`,{className:`composer-footer`,children:[(0,U.jsxs)(`div`,{className:`composer-status`,children:[(0,U.jsx)(`p`,{className:`muted`,children:be===`running`?`Compacting earlier conversation history into an archive summary.`:v||x||(ve?`Run in progress. Continue is disabled until this run settles; Cancel interrupts the active run.`:g?`Memory maintenance is updating the workspace catalog in the background.`:(n?.lastContinuePrompt,`Enter sends. Option+Enter or Shift+Enter adds a new line.`))}),(0,U.jsxs)(`div`,{className:`pills compact-pills`,children:[(0,U.jsx)(Y,{tone:b||ve?`warn`:`good`,children:b?`creating session`:ve?`run active`:`idle`}),g?(0,U.jsx)(Y,{tone:`warn`,children:`memory updating`}):null,ye?(0,U.jsx)(Y,{children:ye}):null,n?.lastContinuePrompt?(0,U.jsx)(Y,{children:`continue available`}):(0,U.jsx)(Y,{children:`no continue state yet`})]})]}),(0,U.jsxs)(`div`,{className:`pills composer-actions`,"data-testid":`session-composer-actions`,children:[(0,U.jsx)(`button`,{className:`tab-button`,type:`button`,disabled:!a||ve||!n?.lastContinuePrompt,onClick:()=>void C(),title:n?.lastContinuePrompt?`Resume the current transcript from the last saved continue point`:`Continue is available after a prior runnable turn exists`,children:`Continue`}),(0,U.jsx)(`button`,{className:`tab-button`,type:`button`,disabled:!h,onClick:()=>void w(),title:`Interrupt the currently running session`,children:`Cancel`}),(0,U.jsx)(`button`,{className:`primary-button`,type:`button`,disabled:!a||ve||!P.trim(),onClick:oe,children:`Send`})]})]})]})]}),(0,U.jsx)(`button`,{className:`workspace-resizer`,type:`button`,"aria-label":`Resize session inspector`,onPointerDown:e=>ue(`right`,e)}),(0,U.jsx)(bE,{reviewMode:A,onReviewModeChange:j,onShowChatView:ge,workspaceChanges:ke,workspaceChangesLoading:Ae,workspaceChangesError:je,workspaceFileDiffsByPath:Ne,workspaceFileDiffLoading:Pe,workspaceFileDiffError:Fe,selectedTurnPatchIsStale:Ie,onSelectWorkspaceFile:Le,onRefreshWorkspaceReview:Re,sessionDetail:n,selectedTurnId:s,onSelectTurn:me,turnReview:u,turnReviewLoading:f,turnReviewError:p,onSelectReviewFile:k,selectedTurn:l,onOpenDiff:te}),(0,U.jsx)(mE,{diff:M,onClose:()=>te(null)})]})}function GE({selectedTask:e,pendingTaskAction:t}){return{isTaskBusy:!!(e&&t&&t.taskId===e.taskId),selectedTaskExecution:e?ho(e):void 0}}function KE({runs:e,selectedTask:t,selectedTaskRuns:n,selectedRun:r,selectedRunId:i,onSelectRun:a}){return(0,U.jsxs)(`aside`,{className:`workspace-side`,children:[(0,U.jsx)(ch,{title:`Runs`,subtitle:t?`${n.length} run${n.length===1?``:`s`} for this task`:`${e.length} recent run${e.length===1?``:`s`}`}),(0,U.jsxs)(`div`,{className:`side-scroll split-scroll`,children:[(0,U.jsx)(lh,{title:`History`,children:n.length?(0,U.jsx)(`div`,{className:`stack-list compact`,children:n.map(e=>(0,U.jsx)(Ah,{run:e,active:e.id===i,onClick:()=>a(e.id)},e.id))}):(0,U.jsx)(nh,{title:`No runs for this task`,body:`Run-once and scheduled executions will appear here.`})}),(0,U.jsx)(lh,{title:`Run detail`,children:r?(0,U.jsxs)(`div`,{className:`detail-stack compact-stack`,children:[(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`card-title`,children:r.id}),(0,U.jsxs)(`div`,{className:`pills`,children:[(0,U.jsx)(Y,{tone:so(r.status),children:r.status}),(0,U.jsx)(Y,{tone:so(r.decision),children:r.decision}),(0,U.jsx)(Y,{tone:so(r.outcome),children:r.outcome})]}),(0,U.jsx)(`p`,{className:`summary`,children:r.summary})]}),(0,U.jsx)(`div`,{className:`detail-card`,children:(0,U.jsxs)(`div`,{className:`kv-list`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`created`}),(0,U.jsx)(`span`,{className:`kv-value`,children:co(r.createdAt)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`task`}),(0,U.jsx)(`span`,{className:`kv-value`,children:r.taskId})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`usage`}),(0,U.jsx)(`span`,{className:`kv-value`,children:z(r.usage)??`none`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`checkpoint`}),(0,U.jsx)(`span`,{className:`kv-value`,children:r.loadedCheckpoint?`loaded`:`fresh`})]})]})}),r.progress?(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Progress`}),(0,U.jsx)(`p`,{className:`summary`,children:r.progress})]}):null]}):(0,U.jsx)(nh,{title:`No run selected`,body:`Select a run to inspect the latest durable heartbeat result.`})})]})]})}function qE({selectedTask:e,pendingTaskAction:t,isTaskBusy:n,selectedTaskExecution:r,onEnableTask:i,onDisableTask:a,onTriggerTask:o}){return(0,U.jsxs)(`section`,{className:`workspace-main`,children:[(0,U.jsx)(ch,{title:e?.name||e?.taskId||`Task detail`,subtitle:e?`${e.taskId} · next ${co(e.nextRunAt)}`:`Pick a task to inspect prompt, schedule, and recent outcome.`,actions:e?(0,U.jsxs)(`div`,{className:`pills`,children:[(0,U.jsx)(Y,{tone:e.enabled?`good`:void 0,children:e.enabled?`enabled`:`disabled`}),(0,U.jsx)(Y,{tone:r?.tone,children:r?.label??e.status}),e.decision?(0,U.jsx)(Y,{tone:so(e.decision),children:e.decision}):null]}):void 0}),(0,U.jsx)(`div`,{className:`task-detail-scroll`,children:e?(0,U.jsxs)(`div`,{className:`detail-stack`,children:[(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Task prompt`}),(0,U.jsx)(`p`,{className:`summary`,children:e.task}),(0,U.jsxs)(`div`,{className:`pills approval-actions`,children:[(0,U.jsx)(`button`,{type:`button`,className:`sidebar-action-button`,disabled:n||!e.enabled,onClick:()=>{o(e.taskId)},children:n&&t?.action===`trigger`?`Triggering…`:`Run now`}),e.enabled?(0,U.jsx)(`button`,{type:`button`,className:`sidebar-action-button`,disabled:n,onClick:()=>{a(e.taskId)},children:n&&t?.action===`disable`?`Pausing…`:`Pause task`}):(0,U.jsx)(`button`,{type:`button`,className:`sidebar-action-button`,disabled:n,onClick:()=>{i(e.taskId)},children:n&&t?.action===`enable`?`Resuming…`:`Resume task`})]}),(0,U.jsx)(`p`,{className:`summary`,children:r?.detail})]}),(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Runtime status`}),(0,U.jsxs)(`div`,{className:`kv-list`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`execution`}),(0,U.jsx)(`span`,{className:`kv-value`,children:r?.label??e.status})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`model`}),(0,U.jsx)(`span`,{className:`kv-value`,children:e.model??`unset`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`interval`}),(0,U.jsx)(`span`,{className:`kv-value`,children:mo(e.intervalMs)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`last run`}),(0,U.jsx)(`span`,{className:`kv-value`,children:co(e.lastRunAt)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`next run`}),(0,U.jsx)(`span`,{className:`kv-value`,children:co(e.nextRunAt)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`checkpoint`}),(0,U.jsx)(`span`,{className:`kv-value`,children:e.loadedCheckpoint?`loaded`:e.resumable?`resumable`:`none`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`kv-key`,children:`usage`}),(0,U.jsx)(`span`,{className:`kv-value`,children:z(e.usage)??`none`})]})]})]}),e.summary?(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Latest summary`}),(0,U.jsx)(`p`,{className:`summary`,children:e.summary})]}):null,e.progress?(0,U.jsxs)(`div`,{className:`detail-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Progress`}),(0,U.jsx)(`p`,{className:`summary`,children:e.progress})]}):null,e.error?(0,U.jsxs)(`div`,{className:`detail-card error-card`,children:[(0,U.jsx)(`p`,{className:`section-label`,children:`Error`}),(0,U.jsx)(`p`,{className:`summary`,children:e.error})]}):null]}):(0,U.jsx)(nh,{title:`No task selected`,body:`Choose a task from the left to inspect its durable prompt and latest run state.`})})]})}function JE({tasks:e,selectedTaskId:t,onSelectTask:n}){return(0,U.jsxs)(`aside`,{className:`workspace-sidebar`,children:[(0,U.jsx)(ch,{title:`Tasks`,subtitle:`${e.length} durable task${e.length===1?``:`s`}`}),(0,U.jsx)(`div`,{className:`sidebar-scroll`,children:e.length?e.map(e=>(0,U.jsx)(kh,{task:e,active:e.taskId===t,onClick:()=>n(e.taskId)},e.taskId)):(0,U.jsx)(nh,{title:`No tasks`,body:`Add a heartbeat task in the CLI, then manage it from this view.`})})]})}function YE({tasks:e,runs:t,selectedTask:n,selectedTaskId:r,onSelectTask:i,selectedRun:a,selectedRunId:o,onSelectRun:s,selectedTaskRuns:c,pendingTaskAction:l,onEnableTask:u,onDisableTask:d,onTriggerTask:f}){let{isTaskBusy:p,selectedTaskExecution:m}=GE({selectedTask:n,pendingTaskAction:l});return(0,U.jsxs)(`section`,{className:`workspace-shell tasks-shell`,children:[(0,U.jsx)(JE,{tasks:e,selectedTaskId:r,onSelectTask:i}),(0,U.jsx)(qE,{selectedTask:n,pendingTaskAction:l,isTaskBusy:p,selectedTaskExecution:m,onEnableTask:u,onDisableTask:d,onTriggerTask:f}),(0,U.jsx)(KE,{runs:t,selectedTask:n,selectedTaskRuns:c,selectedRun:a,selectedRunId:o,onSelectRun:s})]})}function XE({tasks:e,selectedTask:t,selectedTaskId:n,onSelectTask:r,selectedRun:i,selectedRunId:a,onSelectRun:o,selectedTaskRuns:s,pendingTaskAction:c,onEnableTask:l,onDisableTask:u,onTriggerTask:f}){let[p,m]=(0,d.useState)(n?`detail`:`list`),h=!!(t&&c&&c.taskId===t.taskId),g=t?ho(t):void 0;return(0,d.useEffect)(()=>{if(!n){m(`list`);return}m(e=>e===`list`?`detail`:e)},[n]),p===`list`?(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsxs)(`header`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:`Tasks`}),(0,U.jsxs)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:[e.length,` durable task`,e.length===1?``:`s`]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:e.length?(0,U.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let t=ho(e);return(0,U.jsxs)(`button`,{type:`button`,className:`w-full rounded-md border px-3 py-3 text-left ${e.taskId===n?`border-primary bg-primary/5`:`border-border bg-card`}`,onClick:()=>{r(e.taskId),m(`detail`)},children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsx)(`p`,{className:`m-0 line-clamp-2 text-sm font-semibold text-foreground`,children:e.name||e.taskId}),(0,U.jsx)(`p`,{className:`m-0 shrink-0 text-[11px] text-muted-foreground`,children:co(e.nextRunAt)})]}),(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[(0,U.jsx)(W,{variant:e.enabled?`secondary`:`outline`,children:e.enabled?`enabled`:`disabled`}),(0,U.jsx)(W,{variant:`outline`,children:t.label}),e.decision?(0,U.jsx)(W,{variant:`outline`,children:e.decision}):null]}),(0,U.jsx)(`p`,{className:`m-0 mt-2 text-xs text-muted-foreground`,children:e.task})]},e.taskId)})}):(0,U.jsx)(eD,{title:`No tasks`,body:`Add a heartbeat task in the CLI, then manage it from here.`})})]}):p===`runs`?(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsx)(`header`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:()=>m(`detail`),children:`← Task`}),(0,U.jsx)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:`Runs`})]})}),(0,U.jsx)(`nav`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:(0,U.jsxs)(`div`,{className:`grid grid-cols-2 rounded-md bg-muted p-1`,children:[(0,U.jsx)($E,{active:!1,onClick:()=>m(`detail`),children:`Summary`}),(0,U.jsx)($E,{active:!0,children:`Runs`})]})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(ZE,{title:`History`,children:s.length?(0,U.jsx)(`div`,{className:`space-y-2`,children:s.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`w-full rounded-md border px-2 py-2 text-left ${e.id===a?`border-primary bg-primary/5`:`border-border bg-background`}`,onClick:()=>o(e.id),children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsx)(`p`,{className:`m-0 truncate text-xs font-medium text-foreground`,children:e.id}),(0,U.jsx)(`p`,{className:`m-0 shrink-0 text-[11px] text-muted-foreground`,children:co(e.createdAt)})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[(0,U.jsx)(W,{variant:`outline`,children:e.status}),(0,U.jsx)(W,{variant:`outline`,children:e.decision}),(0,U.jsx)(W,{variant:`outline`,children:e.outcome})]})]},e.id))}):(0,U.jsx)(eD,{title:`No runs`,body:`Run-once and scheduled executions appear here.`})}),(0,U.jsx)(ZE,{title:`Run detail`,children:i?(0,U.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:i.id}),(0,U.jsx)(`p`,{className:`m-0 text-muted-foreground`,children:i.summary}),(0,U.jsx)(QE,{label:`created`,value:co(i.createdAt)}),(0,U.jsx)(QE,{label:`task`,value:i.taskId}),(0,U.jsx)(QE,{label:`usage`,value:z(i.usage)??`none`}),(0,U.jsx)(QE,{label:`checkpoint`,value:i.loadedCheckpoint?`loaded`:`fresh`}),i.progress?(0,U.jsx)(QE,{label:`progress`,value:i.progress}):null]}):(0,U.jsx)(eD,{title:`No run selected`,body:`Select a run to inspect the latest heartbeat result.`})})]})})]}):(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,U.jsx)(`header`,{className:`shrink-0 border-b border-border bg-card px-3 py-2`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:()=>m(`list`),children:`← Tasks`}),(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:()=>m(`runs`),disabled:!s.length,children:`Runs`})]})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:t?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(ZE,{title:t.name||t.taskId,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,U.jsx)(W,{variant:t.enabled?`secondary`:`outline`,children:t.enabled?`enabled`:`disabled`}),(0,U.jsx)(W,{variant:g?.tone===`good`?`secondary`:`outline`,children:g?.label??t.status}),t.decision?(0,U.jsx)(W,{variant:`outline`,children:t.decision}):null]}),(0,U.jsx)(`p`,{className:`m-0 mt-2 text-xs text-muted-foreground`,children:t.taskId}),(0,U.jsx)(`p`,{className:`m-0 mt-2 text-sm text-foreground`,children:t.task}),(0,U.jsx)(`p`,{className:`m-0 mt-2 text-xs text-muted-foreground`,children:g?.detail}),(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,U.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:h||!t.enabled,onClick:()=>{f(t.taskId)},children:h&&c?.action===`trigger`?`Triggering…`:`Run now`}),t.enabled?(0,U.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:h,onClick:()=>{u(t.taskId)},children:h&&c?.action===`disable`?`Pausing…`:`Pause task`}):(0,U.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:h,onClick:()=>{l(t.taskId)},children:h&&c?.action===`enable`?`Resuming…`:`Resume task`})]})]}),(0,U.jsxs)(ZE,{title:`Runtime status`,children:[(0,U.jsx)(QE,{label:`execution`,value:g?.label??t.status}),(0,U.jsx)(QE,{label:`model`,value:t.model??`unset`}),(0,U.jsx)(QE,{label:`interval`,value:mo(t.intervalMs)}),(0,U.jsx)(QE,{label:`last run`,value:co(t.lastRunAt)}),(0,U.jsx)(QE,{label:`next run`,value:co(t.nextRunAt)}),(0,U.jsx)(QE,{label:`checkpoint`,value:t.loadedCheckpoint?`loaded`:t.resumable?`resumable`:`none`}),(0,U.jsx)(QE,{label:`usage`,value:z(t.usage)??`none`})]}),t.summary?(0,U.jsx)(ZE,{title:`Latest summary`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm text-foreground`,children:t.summary})}):null,t.progress?(0,U.jsx)(ZE,{title:`Progress`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm text-foreground`,children:t.progress})}):null,t.error?(0,U.jsx)(ZE,{title:`Error`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm text-destructive`,children:t.error})}):null]}):(0,U.jsx)(eD,{title:`No task selected`,body:`Choose a task to inspect its durable prompt and latest run state.`})})]})}function ZE({title:e,children:t}){return(0,U.jsxs)(`section`,{className:`rounded-md border border-border bg-card px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`div`,{className:`mt-2`,children:t})]})}function QE({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[92px_minmax(0,1fr)] gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e}),(0,U.jsx)(`span`,{className:`break-words text-foreground`,children:t})]})}function $E({active:e,onClick:t,children:n}){return(0,U.jsx)(`button`,{type:`button`,className:`h-8 rounded-md text-xs font-medium ${e?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,onClick:t,"aria-current":e?`page`:void 0,children:n})}function eD({title:e,body:t}){return(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-card px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`p`,{className:`m-0 mt-1 text-xs text-muted-foreground`,children:t})]})}function tD(e){return wa()?(0,U.jsx)(XE,{...e}):(0,U.jsx)(YE,{...e})}function nD(e){let t=new Map;for(let n of e.workspaces)t.set(n.stateRoot,{...n,relation:`attached`});for(let n of e.knownWorkspaces??[])t.has(n.stateRoot)||t.set(n.stateRoot,{...n,relation:`known`});return Array.from(t.values()).sort((t,n)=>{let r=Number(n.id===e.activeWorkspaceId)-Number(t.id===e.activeWorkspaceId);return r===0?(n.updatedAt??``).localeCompare(t.updatedAt??``):r})}function rD(e){let t=e.trim().replace(/\/+$/,``);return t.split(`/`).filter(Boolean).at(-1)??t}function iD({children:e}){return(0,U.jsx)(`section`,{className:`min-w-0 rounded-2xl border border-border bg-card/95 p-4 shadow-sm sm:p-5`,children:e})}function aD({open:e,selectedPath:t,onOpenChange:n}){let[r,i]=(0,d.useState)(t.trim()||void 0),[a,o]=(0,d.useState)(t.trim()),[s,c]=(0,d.useState)(),[l,u]=(0,d.useState)(),[f,p]=(0,d.useState)(!1),[m,h]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{if(!e)return;let n=t.trim()||void 0;i(n),o(n??``)},[e,t]),(0,d.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,n]),(0,d.useEffect)(()=>{if(!e)return;let t=!1;return p(!0),Pi(r,m).then(e=>{t||(c(e),i(e.path),o(e.path),u(void 0))}).catch(e=>{t||u(e instanceof Error?e.message:String(e))}).finally(()=>{t||p(!1)}),()=>{t=!0}},[e,r,m]),{browsePath:r,setBrowsePath:i,pathInput:a,setPathInput:o,listing:s,error:l,loading:f,includeHidden:m,setIncludeHidden:h}}function oD({label:e,detail:t,entry:n,onOpen:r,onSelect:i}){return(0,U.jsxs)(`div`,{className:`grid gap-3 border-b border-border p-3 last:border-b-0 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left`,onClick:r,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e}),(0,U.jsx)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:t}),n?(0,U.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.hasHeddleState?(0,U.jsx)(W,{variant:`secondary`,children:`Heddle workspace`}):null,n.hasGit?(0,U.jsx)(W,{variant:`outline`,children:`git repo`}):null,n.hasPackageJson?(0,U.jsx)(W,{variant:`outline`,children:`package.json`}):null]}):null]}),(0,U.jsxs)(`div`,{className:`flex gap-2 sm:justify-end`,children:[(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:`Open`}),i?(0,U.jsx)(G,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:`Select`}):null]})]})}function sD({open:e,selectedPath:t,recentWorkspaces:n,onOpenChange:r,onSelectPath:i}){let{browsePath:a,setBrowsePath:o,pathInput:s,setPathInput:c,listing:l,error:u,loading:d,includeHidden:f,setIncludeHidden:p}=aD({open:e,selectedPath:t,onOpenChange:r});if(!e)return null;let m=l?.path??a??t.trim(),h=()=>{m&&(i(m),r(!1))};return(0,U.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-3 backdrop-blur-sm sm:p-6`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,U.jsxs)(`div`,{className:`flex max-h-[min(820px,92vh)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-2xl`,role:`dialog`,"aria-modal":`true`,"aria-label":`Choose workspace folder`,children:[(0,U.jsxs)(`div`,{className:`border-b border-border px-4 py-4 sm:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Workspace folder`}),(0,U.jsx)(`h2`,{className:`mt-1 text-xl font-semibold text-foreground`,children:`Choose a project root`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Navigate folders, pick a repo or existing Heddle workspace, then switch the control plane to it.`})]}),(0,U.jsx)(G,{type:`button`,variant:`outline`,onClick:()=>r(!1),children:`Close`})]}),(0,U.jsxs)(`form`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),o(s.trim()||void 0)},children:[(0,U.jsx)(`input`,{className:`h-11 min-w-0 flex-1 rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground`,value:s,onChange:e=>c(e.target.value),placeholder:`/absolute/path/to/workspace`}),(0,U.jsx)(G,{type:`submit`,variant:`outline`,className:`h-11`,children:`Go`}),(0,U.jsx)(G,{type:`button`,variant:`secondary`,className:`h-11`,disabled:!m,onClick:h,children:`Use this folder`})]})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-6`,children:[n.length?(0,U.jsxs)(`div`,{className:`mb-4 rounded-xl border border-border bg-background/50 p-3`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Recent workspaces`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Choose from Heddle workspaces seen on this machine.`})]}),(0,U.jsx)(W,{variant:`outline`,children:n.length})]}),(0,U.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:n.slice(0,6).map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`rounded-lg border border-border bg-card px-3 py-2 text-left hover:border-primary`,onClick:()=>{i(e.anchorRoot),r(!1)},children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e.name}),(0,U.jsx)(W,{variant:`outline`,children:e.relation})]}),(0,U.jsx)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:e.anchorRoot})]},e.stateRoot))})]}):null,(0,U.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(W,{variant:`outline`,className:`max-w-full truncate`,children:m||`Home`}),l?.parentPath?(0,U.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>o(l.parentPath),children:`Up one level`}):null,(0,U.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>p(e.target.checked)}),(0,U.jsx)(`span`,{children:`Show hidden folders`})]}),d?(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Loading...`}):null]}),u?(0,U.jsx)(`div`,{className:`mb-3 rounded-xl border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:u}):null,(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-background/40`,children:[l?.parentPath?(0,U.jsx)(oD,{label:`..`,detail:l.parentPath,onOpen:()=>o(l.parentPath)}):null,l?.entries.map(e=>(0,U.jsx)(oD,{label:e.name,detail:e.path,entry:e,onOpen:()=>o(e.path),onSelect:()=>{i(e.path),r(!1)}},e.path)),l&&!d&&l.entries.length===0?(0,U.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No readable child folders found here. You can still use the current folder.`}):null]})]})]})})}function cD({creatingWorkspace:e,onCreateWorkspace:t,recentWorkspaces:n=[]}){let[r,i]=(0,d.useState)(``),[a,o]=(0,d.useState)(``),[s,c]=(0,d.useState)(!0),[l,u]=(0,d.useState)(!1);return(0,U.jsxs)(iD,{children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Add workspace`}),(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Choose a project`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Register another workspace path and optionally switch the control plane to it.`})]}),(0,U.jsxs)(`form`,{"data-testid":`workspace-create-form`,className:`mt-4 space-y-4`,onSubmit:e=>{e.preventDefault(),!(!t||!r.trim()||!a.trim())&&t({name:r.trim(),anchorRoot:a.trim(),setActive:s}).then(()=>{i(``),o(``),c(!0)})},children:[(0,U.jsxs)(`label`,{className:`block space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Name`}),(0,U.jsx)(`input`,{className:`h-11 w-full rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground`,value:r,onChange:e=>i(e.target.value),placeholder:`Workspace name`,disabled:e,"data-testid":`workspace-create-name`})]}),(0,U.jsxs)(`label`,{className:`block space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Workspace path`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{className:`h-11 min-w-0 flex-1 rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground`,value:a,onChange:e=>o(e.target.value),placeholder:`/absolute/path/to/workspace`,disabled:e,"data-testid":`workspace-create-path`}),(0,U.jsx)(G,{type:`button`,variant:`outline`,className:`h-11 shrink-0`,disabled:e,onClick:()=>u(!0),children:`Choose…`})]})]}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),disabled:e}),(0,U.jsx)(`span`,{children:`Switch to this workspace after creating it`})]}),(0,U.jsx)(G,{type:`submit`,variant:`secondary`,className:`w-full`,disabled:e||!r.trim()||!a.trim(),"data-testid":`workspace-create-submit`,children:e?`Creating…`:`Create workspace`})]}),(0,U.jsx)(sD,{open:l,selectedPath:a,recentWorkspaces:n,onOpenChange:u,onSelectPath:e=>{o(e),r.trim()||i(rD(e))}})]})}function lD({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`dt`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:`break-all text-sm text-foreground`,children:t})]})}function uD({workspaceId:e,initialName:t,disabled:n,pending:r,onRename:i}){let[a,o]=(0,d.useState)(t);(0,d.useEffect)(()=>{o(t)},[t]);let s=a.trim()&&a.trim()!==t;return(0,U.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),!(!i||!s)&&i(e,a.trim())},children:[(0,U.jsx)(`input`,{className:`h-10 min-w-0 flex-1 rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground`,value:a,onChange:e=>o(e.target.value),disabled:n,"aria-label":`Workspace name`}),(0,U.jsx)(G,{type:`submit`,variant:`outline`,size:`sm`,disabled:n||!s,children:r?`Saving…`:`Rename`})]})}function dD({state:e,renamingWorkspaceId:t,onRenameWorkspace:n,onSetActiveWorkspace:r}){return(0,U.jsxs)(iD,{children:[(0,U.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Workspace management`}),(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Attached workspaces`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Switch, rename, and inspect workspaces attached to this control-plane catalog.`})]}),(0,U.jsxs)(W,{variant:`outline`,children:[po(e.workspaces.length),` local`]})]}),(0,U.jsx)(`div`,{className:`space-y-3`,"data-testid":`workspace-list`,children:e.workspaces.map(i=>(0,U.jsx)(`article`,{"data-testid":`workspace-card-${i.id}`,className:`rounded-xl border border-border bg-background/60 p-4`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h3`,{className:`truncate text-base font-semibold text-foreground`,children:i.name}),i.id===e.activeWorkspaceId?(0,U.jsx)(W,{variant:`secondary`,children:`active`}):null,(0,U.jsx)(W,{variant:`outline`,children:i.id})]}),(0,U.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,U.jsx)(lD,{label:`Workspace path`,children:i.anchorRoot}),(0,U.jsx)(lD,{label:`State path`,children:i.stateRoot}),(0,U.jsx)(lD,{label:`Repo roots`,children:i.repoRoots.join(`, `)})]})]}),(0,U.jsxs)(`div`,{className:`flex min-w-[min(100%,260px)] flex-col gap-3`,children:[(0,U.jsx)(uD,{workspaceId:i.id,initialName:i.name,disabled:!n||t===i.id,pending:t===i.id,onRename:n}),(0,U.jsx)(G,{type:`button`,variant:i.id===e.activeWorkspaceId?`secondary`:`outline`,disabled:i.id===e.activeWorkspaceId||!r,onClick:()=>r?.(i.id),children:i.id===e.activeWorkspaceId?`Current workspace`:`Switch to workspace`})]})]})},i.id))})]})}function fD({state:e,recentWorkspaces:t,creatingWorkspace:n,onCreateWorkspace:r,onSetActiveWorkspace:i}){return(0,U.jsxs)(iD,{children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Recent workspaces`}),(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Open workspace`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Workspaces Heddle has seen on this machine, including the current catalog.`})]}),t.length?(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,"data-testid":`recent-workspace-list`,children:t.slice(0,8).map(t=>{let a=t.id===e.activeWorkspaceId,o=t.relation===`attached`;return(0,U.jsxs)(`button`,{type:`button`,className:`w-full rounded-xl border border-border bg-background/60 p-3 text-left hover:border-primary disabled:cursor-not-allowed disabled:opacity-50`,disabled:n||a||(o?!i:!r),onClick:()=>{o?i?.(t.id):r?.({name:t.name,anchorRoot:t.anchorRoot,setActive:!0})},children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:t.name}),a?(0,U.jsx)(W,{variant:`secondary`,children:`active`}):null,(0,U.jsx)(W,{variant:`outline`,children:o?`attached`:`known`})]}),(0,U.jsx)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:t.anchorRoot}),(0,U.jsx)(`span`,{className:`mt-2 block text-[11px] text-muted-foreground`,children:fo(t.stateRoot)})]},t.stateRoot)})}):(0,U.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`No Heddle workspaces are known yet. Run Heddle in a project once, then refresh.`})]})}function pD({state:e,creatingWorkspace:t=!1,renamingWorkspaceId:n,onCreateWorkspace:r,onRenameWorkspace:i,onSetActiveWorkspace:a}){let o=nD(e);return(0,U.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-x-hidden overflow-y-auto px-3 pt-3 pb-[calc(env(safe-area-inset-bottom)+5.5rem)] sm:px-4 sm:pt-4 sm:pb-4`,children:(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-4 xl:grid-cols-[minmax(0,1.4fr)_minmax(320px,0.8fr)]`,children:[(0,U.jsx)(dD,{state:e,renamingWorkspaceId:n,onRenameWorkspace:i,onSetActiveWorkspace:a}),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-4`,children:[(0,U.jsx)(cD,{creatingWorkspace:t,recentWorkspaces:o,onCreateWorkspace:r}),(0,U.jsx)(fD,{state:e,recentWorkspaces:o,creatingWorkspace:t,onCreateWorkspace:r,onSetActiveWorkspace:a})]})]})})}function mD(e){let t=hD(e),n=d.forwardRef((e,n)=>{let{children:r,...i}=e,a=d.Children.toArray(r),o=a.find(_D);if(o){let e=o.props.children,r=a.map(t=>t===o?d.Children.count(e)>1?d.Children.only(null):d.isValidElement(e)?e.props.children:null:t);return(0,U.jsx)(t,{...i,ref:n,children:d.isValidElement(e)?d.cloneElement(e,void 0,r):null})}return(0,U.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function hD(e){let t=d.forwardRef((e,t)=>{let{children:n,...r}=e;if(d.isValidElement(n)){let e=yD(n),i=vD(r,n.props);return n.type!==d.Fragment&&(i.ref=t?Xs(t,e):e),d.cloneElement(n,i)}return d.Children.count(n)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gD=Symbol(`radix.slottable`);function _D(e){return d.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===gD}function vD(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function yD(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function bD(e){let t=e+`CollectionProvider`,[n,r]=dc(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=d.useRef(null),a=d.useRef(new Map).current;return(0,U.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=mD(s),l=d.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,U.jsx)(c,{ref:Zs(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,f=`data-radix-collection-item`,p=mD(u),m=d.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=d.useRef(null),s=Zs(t,o),c=a(u,n);return d.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,U.jsx)(p,{[f]:``,ref:s,children:r})});m.displayName=u;function h(t){let n=a(e+`CollectionConsumer`,t);return d.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:m},h,r]}var xD=`ToastProvider`,[SD,CD,wD]=bD(`Toast`),[TD,ED]=dc(`Toast`,[wD]),[DD,OD]=TD(xD),kD=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=d.useState(null),[l,u]=d.useState(0),f=d.useRef(!1),p=d.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${xD}\`. Expected non-empty \`string\`.`),(0,U.jsx)(SD.Provider,{scope:t,children:(0,U.jsx)(DD,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:d.useCallback(()=>u(e=>e+1),[]),onToastRemove:d.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,children:o})})};kD.displayName=xD;var AD=`ToastViewport`,jD=[`F8`],MD=`toast.viewportPause`,ND=`toast.viewportResume`,PD=d.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=jD,label:i=`Notifications ({hotkey})`,...a}=e,o=OD(AD,n),s=CD(n),c=d.useRef(null),l=d.useRef(null),u=d.useRef(null),f=d.useRef(null),p=Zs(t,f,o.onViewportChange),m=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),h=o.toastCount>0;d.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&f.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),d.useEffect(()=>{let e=c.current,t=f.current;if(h&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(MD);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(ND);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[h,o.isClosePausedRef]);let g=d.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...sO(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return d.useEffect(()=>{let e=f.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=g({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);cO(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,g]),(0,U.jsxs)(Lc,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,m),tabIndex:-1,style:{pointerEvents:h?void 0:`none`},children:[h&&(0,U.jsx)(ID,{ref:l,onFocusFromOutsideViewport:()=>{cO(g({tabbingDirection:`forwards`}))}}),(0,U.jsx)(SD.Slot,{scope:n,children:(0,U.jsx)(yc.ol,{tabIndex:-1,...a,ref:p})}),h&&(0,U.jsx)(ID,{ref:u,onFocusFromOutsideViewport:()=>{cO(g({tabbingDirection:`backwards`}))}})]})});PD.displayName=AD;var FD=`ToastFocusProxy`,ID=d.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=OD(FD,n);return(0,U.jsx)(Rd,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});ID.displayName=FD;var LD=`Toast`,RD=`toast.swipeStart`,zD=`toast.swipeMove`,BD=`toast.swipeCancel`,VD=`toast.swipeEnd`,HD=d.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=Nd({prop:r,defaultProp:i??!0,onChange:a,caller:LD});return(0,U.jsx)(Ed,{present:n||s,children:(0,U.jsx)(GD,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:xc(e.onPause),onResume:xc(e.onResume),onSwipeStart:uc(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:uc(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:uc(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:uc(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});HD.displayName=LD;var[UD,WD]=TD(LD,{onClose(){}}),GD=d.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:p,onSwipeCancel:m,onSwipeEnd:h,...g}=e,_=OD(LD,n),[v,y]=d.useState(null),b=Zs(t,e=>y(e)),x=d.useRef(null),S=d.useRef(null),C=i||_.duration,w=d.useRef(0),T=d.useRef(C),E=d.useRef(0),{onToastAdd:D,onToastRemove:O}=_,ee=xc(()=>{v?.contains(document.activeElement)&&_.viewport?.focus(),o()}),k=d.useCallback(e=>{!e||e===1/0||(window.clearTimeout(E.current),w.current=new Date().getTime(),E.current=window.setTimeout(ee,e))},[ee]);d.useEffect(()=>{let e=_.viewport;if(e){let t=()=>{k(T.current),l?.()},n=()=>{let e=new Date().getTime()-w.current;T.current-=e,window.clearTimeout(E.current),c?.()};return e.addEventListener(MD,n),e.addEventListener(ND,t),()=>{e.removeEventListener(MD,n),e.removeEventListener(ND,t)}}},[_.viewport,C,c,l,k]),d.useEffect(()=>{a&&!_.isClosePausedRef.current&&k(C)},[a,C,_.isClosePausedRef,k]),d.useEffect(()=>(D(),()=>O()),[D,O]);let A=d.useMemo(()=>v?nO(v):null,[v]);return _.viewport?(0,U.jsxs)(U.Fragment,{children:[A&&(0,U.jsx)(KD,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:A}),(0,U.jsx)(UD,{scope:n,onClose:ee,children:f.createPortal((0,U.jsx)(SD.ItemSlot,{scope:n,children:(0,U.jsx)(Ic,{asChild:!0,onEscapeKeyDown:uc(s,()=>{_.isFocusedToastEscapeKeyDownRef.current||ee(),_.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,U.jsx)(yc.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":_.swipeDirection,...g,ref:b,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:uc(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(_.isFocusedToastEscapeKeyDownRef.current=!0,ee()))}),onPointerDown:uc(e.onPointerDown,e=>{e.button===0&&(x.current={x:e.clientX,y:e.clientY})}),onPointerMove:uc(e.onPointerMove,e=>{if(!x.current)return;let t=e.clientX-x.current.x,n=e.clientY-x.current.y,r=!!S.current,i=[`left`,`right`].includes(_.swipeDirection),a=[`left`,`up`].includes(_.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},d={originalEvent:e,delta:l};r?(S.current=l,rO(zD,p,d,{discrete:!1})):iO(l,_.swipeDirection,c)?(S.current=l,rO(RD,u,d,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(x.current=null)}),onPointerUp:uc(e.onPointerUp,e=>{let t=S.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),S.current=null,x.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};iO(t,_.swipeDirection,_.swipeThreshold)?rO(VD,h,r,{discrete:!0}):rO(BD,m,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),_.viewport)})]}):null}),KD=e=>{let{__scopeToast:t,children:n,...r}=e,i=OD(LD,t),[a,o]=d.useState(!1),[s,c]=d.useState(!1);return aO(()=>o(!0)),d.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,U.jsx)(wd,{asChild:!0,children:(0,U.jsx)(Rd,{...r,children:a&&(0,U.jsxs)(U.Fragment,{children:[i.label,` `,n]})})})},qD=`ToastTitle`,JD=d.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,U.jsx)(yc.div,{...r,ref:t})});JD.displayName=qD;var YD=`ToastDescription`,XD=d.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,U.jsx)(yc.div,{...r,ref:t})});XD.displayName=YD;var ZD=`ToastAction`,QD=d.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,U.jsx)(tO,{altText:n,asChild:!0,children:(0,U.jsx)(eO,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ZD}\`. Expected non-empty \`string\`.`),null)});QD.displayName=ZD;var $D=`ToastClose`,eO=d.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=WD($D,n);return(0,U.jsx)(tO,{asChild:!0,children:(0,U.jsx)(yc.button,{type:`button`,...r,ref:t,onClick:uc(e.onClick,i.onClose)})})});eO.displayName=$D;var tO=d.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,U.jsx)(yc.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function nO(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),oO(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...nO(e))}}),t}function rO(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?bc(i,a):i.dispatchEvent(a)}var iO=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function aO(e=()=>{}){let t=xc(e);Rc(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function oO(e){return e.nodeType===e.ELEMENT_NODE}function sO(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function cO(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var lO=kD,uO=PD,dO=HD,fO=JD,pO=XD,mO=eO,hO=lO,gO=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(uO,{ref:n,className:Gs(`fixed top-[max(0.75rem,env(safe-area-inset-top))] z-50 flex max-h-screen w-full flex-col-reverse gap-2 p-3 sm:top-[max(1rem,env(safe-area-inset-top))] md:right-4 md:top-4 md:w-[420px] md:max-w-[420px] md:flex-col`,e),...t}));gO.displayName=uO.displayName;var _O=xo(`group pointer-events-auto relative flex w-full items-start justify-between gap-3 overflow-hidden rounded-md border p-3 pr-6 shadow-2xl ring-1 ring-black/20 transition-all`,{variants:{variant:{info:`border-cyan-400/40 bg-slate-950/96 text-slate-100`,success:`border-emerald-400/45 bg-emerald-950/90 text-emerald-50`,error:`border-red-300/45 bg-red-950/92 text-red-50`}},defaultVariants:{variant:`info`}}),vO=d.forwardRef(({className:e,variant:t,...n},r)=>(0,U.jsx)(dO,{ref:r,className:Gs(_O({variant:t}),e),...n}));vO.displayName=dO.displayName;var yO=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(fO,{ref:n,className:Gs(`text-sm font-semibold`,e),...t}));yO.displayName=fO.displayName;var bO=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(pO,{ref:n,className:Gs(`mt-1 text-xs text-slate-200/90`,e),...t}));bO.displayName=pO.displayName;var xO=d.forwardRef(({className:e,...t},n)=>(0,U.jsx)(mO,{ref:n,className:Gs(`absolute right-2 top-2 inline-flex h-6 w-6 items-center justify-center rounded-md border border-white/20 bg-black/25 text-slate-200 transition-colors hover:bg-black/45 hover:text-white`,e),"toast-close":``,...t,children:`×`}));xO.displayName=mO.displayName;var SO=3,CO=7e3,wO=new Map,TO=e=>{if(wO.has(e))return;let t=setTimeout(()=>{wO.delete(e),kO({type:`REMOVE_TOAST`,toastId:e})},CO);wO.set(e,t)};function EO(e,t){switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,SO)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?TO(n):e.toasts.forEach(e=>TO(e.id)),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}}var DO=[],OO={toasts:[]};function kO(e){OO=EO(OO,e),DO.forEach(e=>{e(OO)})}function AO(){return`${Date.now()}-${Math.floor(Math.random()*1e3)}`}function jO(e){let t=AO(),n=()=>kO({type:`DISMISS_TOAST`,toastId:t}),r=e=>kO({type:`UPDATE_TOAST`,toast:{...e,id:t}});kO({type:`ADD_TOAST`,toast:{id:t,title:e.title,body:e.body,tone:e.tone,open:!0}});let i=e.tone===`error`?CO:4200;return setTimeout(n,i),{id:t,dismiss:n,update:r}}function MO(){let[e,t]=d.useState(OO);return d.useEffect(()=>(DO.push(t),()=>{let e=DO.indexOf(t);e>-1&&DO.splice(e,1)}),[]),{...e,toast:jO,dismiss:e=>kO({type:`DISMISS_TOAST`,toastId:e})}}function NO(){let{toasts:e,dismiss:t}=MO();return(0,U.jsxs)(hO,{children:[e.map(e=>(0,U.jsxs)(vO,{open:e.open,onOpenChange:n=>{n||t(e.id)},variant:e.tone??`info`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(yO,{children:e.title}),e.body?(0,U.jsx)(bO,{children:e.body}):null]}),(0,U.jsx)(xO,{"aria-label":`Dismiss notification`})]},e.id)),(0,U.jsx)(gO,{})]})}function PO(){let e=Xi(),{state:t,error:n,refresh:r,setActiveWorkspace:i,createWorkspace:a,renameWorkspace:o}=Wi(),{toasts:s,toast:c}=MO(),l=wa(),u=(0,d.useCallback)(()=>{r()},[r]),f=ro(t?.sessions,c,u,{selectedSessionId:e.routeSessionId,onSelectedSessionIdChange:e.setRouteSessionId,autoSelectSession:e.section===`sessions`}),p=io(t?.heartbeat.tasks,t?.heartbeat.runs,c,u),m=ao({state:t,setActiveWorkspace:i,createWorkspace:a,renameWorkspace:o,notify:c}),h=va({section:e.section,sessionsState:f,error:n,toasts:s,notify:c});(0,d.useEffect)(()=>{e.normalizeRoute()},[e]),(0,d.useEffect)(()=>{window.__HEDDLE_CAPTURE_LAYOUT_SNAPSHOT=async e=>{await h(e?.screenshot??`none`)};let e=e=>{if(!(e.metaKey||e.ctrlKey)||!e.shiftKey||e.key.toLowerCase()!==`d`)return;let t=e.target;t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||(e.preventDefault(),h(`none`))};return window.addEventListener(`keydown`,e),()=>{window.__HEDDLE_CAPTURE_LAYOUT_SNAPSHOT&&delete window.__HEDDLE_CAPTURE_LAYOUT_SNAPSHOT,window.removeEventListener(`keydown`,e)}},[h]);let g=t?FO(t,f,p,m):(0,U.jsx)(th,{title:`Loading state`,children:(0,U.jsx)(`p`,{className:`muted`,children:n??`Reading local Heddle state...`})});return l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(mh,{section:e.section,onSectionChange:e.setSection,state:t,error:n,onSetActiveWorkspace:e=>void m.switchWorkspace(e),onCaptureDebugSnapshot:e=>void h(e),onRefresh:()=>void r(),children:g}),(0,U.jsx)(NO,{})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(uh,{activeSection:e.section,sessionPath:e.routeSessionId?`/sessions/${encodeURIComponent(e.routeSessionId)}`:`/sessions`,state:t,error:n,onSetActiveWorkspace:e=>void m.switchWorkspace(e),onCaptureDebugSnapshot:e=>void h(e),onRefresh:()=>void r(),children:g}),(0,U.jsx)(NO,{})]})}function FO(e,t,n,r){return(0,U.jsxs)(Dt,{children:[(0,U.jsx)(Tt,{path:`/overview`,element:(0,U.jsx)(Ch,{state:e})}),(0,U.jsx)(Tt,{path:`/sessions`,element:(0,U.jsx)(IO,{state:e,sessionsState:t})}),(0,U.jsx)(Tt,{path:`/sessions/:sessionId/*`,element:(0,U.jsx)(IO,{state:e,sessionsState:t})}),(0,U.jsx)(Tt,{path:`/tasks`,element:(0,U.jsx)(tD,{tasks:e.heartbeat.tasks,runs:e.heartbeat.runs,selectedTask:n.selectedTask,selectedTaskId:n.selectedTaskId,onSelectTask:n.setSelectedTaskId,selectedRun:n.selectedRun,selectedRunId:n.selectedRunId,onSelectRun:n.setSelectedRunId,selectedTaskRuns:n.selectedTaskRuns,pendingTaskAction:n.pendingTaskAction,onEnableTask:n.enableTask,onDisableTask:n.disableTask,onTriggerTask:n.triggerTask})}),(0,U.jsx)(Tt,{path:`/workspaces`,element:(0,U.jsx)(pD,{state:e,creatingWorkspace:r.creatingWorkspace,renamingWorkspaceId:r.renamingWorkspaceId,onCreateWorkspace:r.createWorkspace,onRenameWorkspace:r.renameWorkspace,onSetActiveWorkspace:e=>void r.switchWorkspace(e)})}),(0,U.jsx)(Tt,{path:`*`,element:(0,U.jsx)(wt,{to:`/overview`,replace:!0})})]})}function IO({state:e,sessionsState:t}){return(0,U.jsx)(WE,{sessions:e.sessions,activeSession:t.activeSession,sessionDetail:t.sessionDetail,sessionDetailLoading:t.sessionDetailLoading,sessionDetailError:t.sessionDetailError,selectedSessionId:t.selectedSessionId,onSelectSession:t.setSelectedSessionId,selectedTurnId:t.selectedTurnId,onSelectTurn:t.setSelectedTurnId,selectedTurn:t.selectedTurn,turnReview:t.turnReview,turnReviewLoading:t.turnReviewLoading,turnReviewError:t.turnReviewError,sendingPrompt:t.sendingPrompt,runInFlight:t.runInFlight,memoryUpdating:t.memoryUpdating,auth:e.auth,sendPromptError:t.sendPromptError,onSendPrompt:t.sendPrompt,creatingSession:t.creatingSession,sessionNotice:t.sessionNotice,onCreateSession:t.createSession,onContinueSession:t.continueSession,onCancelSessionRun:t.cancelSessionRun,onUpdateSessionSettings:t.updateSessionSettings,pendingApproval:t.pendingApproval,onResolveApproval:t.resolveApproval})}(0,p.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(d.StrictMode,{children:(0,U.jsx)(hn,{children:(0,U.jsx)(PO,{})})}));export{_ as n,i as r,qs as t};