agent-tower 0.7.2-beta.6 → 0.7.2-beta.8

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 (555) hide show
  1. package/dist/app.d.ts.map +1 -1
  2. package/dist/app.js +4 -1
  3. package/dist/app.js.map +1 -1
  4. package/dist/app.test.js +80 -1
  5. package/dist/app.test.js.map +1 -1
  6. package/dist/cli.js +4 -10
  7. package/dist/cli.js.map +1 -1
  8. package/dist/core/container.d.ts +8 -0
  9. package/dist/core/container.d.ts.map +1 -1
  10. package/dist/core/container.js +42 -0
  11. package/dist/core/container.js.map +1 -1
  12. package/dist/core/event-bus.d.ts +2 -0
  13. package/dist/core/event-bus.d.ts.map +1 -1
  14. package/dist/core/event-bus.js.map +1 -1
  15. package/dist/executors/__tests__/image-utils.test.d.ts +2 -0
  16. package/dist/executors/__tests__/image-utils.test.d.ts.map +1 -0
  17. package/dist/executors/__tests__/image-utils.test.js +25 -0
  18. package/dist/executors/__tests__/image-utils.test.js.map +1 -0
  19. package/dist/executors/base.executor.d.ts +2 -0
  20. package/dist/executors/base.executor.d.ts.map +1 -1
  21. package/dist/executors/base.executor.js +6 -0
  22. package/dist/executors/base.executor.js.map +1 -1
  23. package/dist/executors/image-utils.d.ts.map +1 -1
  24. package/dist/executors/image-utils.js +10 -8
  25. package/dist/executors/image-utils.js.map +1 -1
  26. package/dist/git/git-cli.d.ts +2 -0
  27. package/dist/git/git-cli.d.ts.map +1 -1
  28. package/dist/git/git-cli.js +2 -0
  29. package/dist/git/git-cli.js.map +1 -1
  30. package/dist/git/worktree.manager.d.ts +2 -1
  31. package/dist/git/worktree.manager.d.ts.map +1 -1
  32. package/dist/git/worktree.manager.js +18 -12
  33. package/dist/git/worktree.manager.js.map +1 -1
  34. package/dist/index.js +16 -31
  35. package/dist/index.js.map +1 -1
  36. package/dist/mcp/http-client.d.ts +1 -0
  37. package/dist/mcp/http-client.d.ts.map +1 -1
  38. package/dist/mcp/http-client.js +3 -0
  39. package/dist/mcp/http-client.js.map +1 -1
  40. package/dist/mcp/server.d.ts.map +1 -1
  41. package/dist/mcp/server.js +15 -0
  42. package/dist/mcp/server.js.map +1 -1
  43. package/dist/mcp/tools/sessions.js +2 -2
  44. package/dist/mcp/tools/sessions.js.map +1 -1
  45. package/dist/mcp/tools/workspaces.d.ts.map +1 -1
  46. package/dist/mcp/tools/workspaces.js +2 -1
  47. package/dist/mcp/tools/workspaces.js.map +1 -1
  48. package/dist/middleware/access-auth.d.ts +1 -0
  49. package/dist/middleware/access-auth.d.ts.map +1 -1
  50. package/dist/middleware/access-auth.js +1 -1
  51. package/dist/middleware/access-auth.js.map +1 -1
  52. package/dist/output/__tests__/text-block-lifecycle.test.d.ts +2 -0
  53. package/dist/output/__tests__/text-block-lifecycle.test.d.ts.map +1 -0
  54. package/dist/output/__tests__/text-block-lifecycle.test.js +241 -0
  55. package/dist/output/__tests__/text-block-lifecycle.test.js.map +1 -0
  56. package/dist/output/claude-code-parser.d.ts +3 -0
  57. package/dist/output/claude-code-parser.d.ts.map +1 -1
  58. package/dist/output/claude-code-parser.js +58 -7
  59. package/dist/output/claude-code-parser.js.map +1 -1
  60. package/dist/output/codex-parser.d.ts.map +1 -1
  61. package/dist/output/codex-parser.js +4 -6
  62. package/dist/output/codex-parser.js.map +1 -1
  63. package/dist/output/cursor-agent-parser.d.ts.map +1 -1
  64. package/dist/output/cursor-agent-parser.js +4 -0
  65. package/dist/output/cursor-agent-parser.js.map +1 -1
  66. package/dist/output/gemini-parser.d.ts +18 -0
  67. package/dist/output/gemini-parser.d.ts.map +1 -0
  68. package/dist/output/gemini-parser.js +91 -0
  69. package/dist/output/gemini-parser.js.map +1 -0
  70. package/dist/output/msg-store.d.ts +6 -0
  71. package/dist/output/msg-store.d.ts.map +1 -1
  72. package/dist/output/msg-store.js +17 -0
  73. package/dist/output/msg-store.js.map +1 -1
  74. package/dist/output/text-block-tracker.d.ts +29 -0
  75. package/dist/output/text-block-tracker.d.ts.map +1 -0
  76. package/dist/output/text-block-tracker.js +149 -0
  77. package/dist/output/text-block-tracker.js.map +1 -0
  78. package/dist/output/types.d.ts +9 -0
  79. package/dist/output/types.d.ts.map +1 -1
  80. package/dist/output/types.js +0 -4
  81. package/dist/output/types.js.map +1 -1
  82. package/dist/routes/__tests__/sessions-runtime.test.js +3 -0
  83. package/dist/routes/__tests__/sessions-runtime.test.js.map +1 -1
  84. package/dist/routes/__tests__/team-run-translations.test.d.ts +2 -0
  85. package/dist/routes/__tests__/team-run-translations.test.d.ts.map +1 -0
  86. package/dist/routes/__tests__/team-run-translations.test.js +418 -0
  87. package/dist/routes/__tests__/team-run-translations.test.js.map +1 -0
  88. package/dist/routes/__tests__/translations.test.d.ts +2 -0
  89. package/dist/routes/__tests__/translations.test.d.ts.map +1 -0
  90. package/dist/routes/__tests__/translations.test.js +286 -0
  91. package/dist/routes/__tests__/translations.test.js.map +1 -0
  92. package/dist/routes/__tests__/workspaces.test.js +140 -0
  93. package/dist/routes/__tests__/workspaces.test.js.map +1 -1
  94. package/dist/routes/conversations.d.ts.map +1 -1
  95. package/dist/routes/conversations.js +19 -2
  96. package/dist/routes/conversations.js.map +1 -1
  97. package/dist/routes/index.d.ts.map +1 -1
  98. package/dist/routes/index.js +2 -0
  99. package/dist/routes/index.js.map +1 -1
  100. package/dist/routes/sessions.d.ts.map +1 -1
  101. package/dist/routes/sessions.js +32 -3
  102. package/dist/routes/sessions.js.map +1 -1
  103. package/dist/routes/team-runs.d.ts.map +1 -1
  104. package/dist/routes/team-runs.js +84 -15
  105. package/dist/routes/team-runs.js.map +1 -1
  106. package/dist/routes/translations.d.ts +4 -0
  107. package/dist/routes/translations.d.ts.map +1 -0
  108. package/dist/routes/translations.js +148 -0
  109. package/dist/routes/translations.js.map +1 -0
  110. package/dist/routes/user-input-origin.d.ts +4 -0
  111. package/dist/routes/user-input-origin.d.ts.map +1 -0
  112. package/dist/routes/user-input-origin.js +7 -0
  113. package/dist/routes/user-input-origin.js.map +1 -0
  114. package/dist/routes/workspaces.d.ts.map +1 -1
  115. package/dist/routes/workspaces.js +32 -2
  116. package/dist/routes/workspaces.js.map +1 -1
  117. package/dist/runtime/__tests__/acp-driver-lifecycle.test.js +2 -2
  118. package/dist/runtime/__tests__/acp-driver-lifecycle.test.js.map +1 -1
  119. package/dist/runtime/__tests__/acp-driver-submission.test.d.ts +2 -0
  120. package/dist/runtime/__tests__/acp-driver-submission.test.d.ts.map +1 -0
  121. package/dist/runtime/__tests__/acp-driver-submission.test.js +88 -0
  122. package/dist/runtime/__tests__/acp-driver-submission.test.js.map +1 -0
  123. package/dist/runtime/__tests__/acp-history-reconciler.test.js +244 -0
  124. package/dist/runtime/__tests__/acp-history-reconciler.test.js.map +1 -1
  125. package/dist/runtime/__tests__/acp-projector.test.js +36 -0
  126. package/dist/runtime/__tests__/acp-projector.test.js.map +1 -1
  127. package/dist/runtime/__tests__/claude-cli-control.test.js +20 -0
  128. package/dist/runtime/__tests__/claude-cli-control.test.js.map +1 -1
  129. package/dist/runtime/__tests__/cli-driver-submission.test.d.ts +2 -0
  130. package/dist/runtime/__tests__/cli-driver-submission.test.d.ts.map +1 -0
  131. package/dist/runtime/__tests__/cli-driver-submission.test.js +61 -0
  132. package/dist/runtime/__tests__/cli-driver-submission.test.js.map +1 -0
  133. package/dist/runtime/__tests__/codex-cli-control.test.js +25 -0
  134. package/dist/runtime/__tests__/codex-cli-control.test.js.map +1 -1
  135. package/dist/runtime/acp/acp-driver.js +38 -1
  136. package/dist/runtime/acp/acp-driver.js.map +1 -1
  137. package/dist/runtime/acp/history-reconciler.d.ts.map +1 -1
  138. package/dist/runtime/acp/history-reconciler.js +95 -36
  139. package/dist/runtime/acp/history-reconciler.js.map +1 -1
  140. package/dist/runtime/acp/projector.d.ts +5 -2
  141. package/dist/runtime/acp/projector.d.ts.map +1 -1
  142. package/dist/runtime/acp/projector.js +50 -23
  143. package/dist/runtime/acp/projector.js.map +1 -1
  144. package/dist/runtime/claude-cli-control.d.ts +4 -1
  145. package/dist/runtime/claude-cli-control.d.ts.map +1 -1
  146. package/dist/runtime/claude-cli-control.js +3 -1
  147. package/dist/runtime/claude-cli-control.js.map +1 -1
  148. package/dist/runtime/cli-driver.js +21 -7
  149. package/dist/runtime/cli-driver.js.map +1 -1
  150. package/dist/runtime/cli-parser.d.ts.map +1 -1
  151. package/dist/runtime/cli-parser.js +3 -0
  152. package/dist/runtime/cli-parser.js.map +1 -1
  153. package/dist/runtime/codex-cli-control.d.ts +4 -1
  154. package/dist/runtime/codex-cli-control.d.ts.map +1 -1
  155. package/dist/runtime/codex-cli-control.js +9 -6
  156. package/dist/runtime/codex-cli-control.js.map +1 -1
  157. package/dist/runtime/codex-cli-projector.d.ts +1 -1
  158. package/dist/runtime/codex-cli-projector.d.ts.map +1 -1
  159. package/dist/runtime/codex-cli-projector.js +4 -2
  160. package/dist/runtime/codex-cli-projector.js.map +1 -1
  161. package/dist/runtime/contracts.d.ts +15 -2
  162. package/dist/runtime/contracts.d.ts.map +1 -1
  163. package/dist/runtime/runtime-coordinator.d.ts.map +1 -1
  164. package/dist/runtime/runtime-coordinator.js +34 -1
  165. package/dist/runtime/runtime-coordinator.js.map +1 -1
  166. package/dist/services/__tests__/conflict-admission.test.d.ts +2 -0
  167. package/dist/services/__tests__/conflict-admission.test.d.ts.map +1 -0
  168. package/dist/services/__tests__/conflict-admission.test.js +37 -0
  169. package/dist/services/__tests__/conflict-admission.test.js.map +1 -0
  170. package/dist/services/__tests__/conflict-recovery-key.test.d.ts +2 -0
  171. package/dist/services/__tests__/conflict-recovery-key.test.d.ts.map +1 -0
  172. package/dist/services/__tests__/conflict-recovery-key.test.js +143 -0
  173. package/dist/services/__tests__/conflict-recovery-key.test.js.map +1 -0
  174. package/dist/services/__tests__/message-delivery.integration.test.d.ts +2 -0
  175. package/dist/services/__tests__/message-delivery.integration.test.d.ts.map +1 -0
  176. package/dist/services/__tests__/message-delivery.integration.test.js +1137 -0
  177. package/dist/services/__tests__/message-delivery.integration.test.js.map +1 -0
  178. package/dist/services/__tests__/review-team-user-counterexamples.test.d.ts +2 -0
  179. package/dist/services/__tests__/review-team-user-counterexamples.test.d.ts.map +1 -0
  180. package/dist/services/__tests__/review-team-user-counterexamples.test.js +200 -0
  181. package/dist/services/__tests__/review-team-user-counterexamples.test.js.map +1 -0
  182. package/dist/services/__tests__/session-manager.lifecycle.test.js +37 -0
  183. package/dist/services/__tests__/session-manager.lifecycle.test.js.map +1 -1
  184. package/dist/services/__tests__/session-manager.team-run.test.js +19 -2
  185. package/dist/services/__tests__/session-manager.team-run.test.js.map +1 -1
  186. package/dist/services/__tests__/team-initial-delivery.integration.test.d.ts +2 -0
  187. package/dist/services/__tests__/team-initial-delivery.integration.test.d.ts.map +1 -0
  188. package/dist/services/__tests__/team-initial-delivery.integration.test.js +469 -0
  189. package/dist/services/__tests__/team-initial-delivery.integration.test.js.map +1 -0
  190. package/dist/services/__tests__/team-reconciler.service.test.js +102 -101
  191. package/dist/services/__tests__/team-reconciler.service.test.js.map +1 -1
  192. package/dist/services/__tests__/team-room-delivery.test.d.ts +2 -0
  193. package/dist/services/__tests__/team-room-delivery.test.d.ts.map +1 -0
  194. package/dist/services/__tests__/team-room-delivery.test.js +670 -0
  195. package/dist/services/__tests__/team-room-delivery.test.js.map +1 -0
  196. package/dist/services/__tests__/team-user-delivery.integration.test.d.ts +2 -0
  197. package/dist/services/__tests__/team-user-delivery.integration.test.d.ts.map +1 -0
  198. package/dist/services/__tests__/team-user-delivery.integration.test.js +622 -0
  199. package/dist/services/__tests__/team-user-delivery.integration.test.js.map +1 -0
  200. package/dist/services/__tests__/translation-client.test.d.ts +2 -0
  201. package/dist/services/__tests__/translation-client.test.d.ts.map +1 -0
  202. package/dist/services/__tests__/translation-client.test.js +240 -0
  203. package/dist/services/__tests__/translation-client.test.js.map +1 -0
  204. package/dist/services/__tests__/translation-protection.test.d.ts +2 -0
  205. package/dist/services/__tests__/translation-protection.test.d.ts.map +1 -0
  206. package/dist/services/__tests__/translation-protection.test.js +156 -0
  207. package/dist/services/__tests__/translation-protection.test.js.map +1 -0
  208. package/dist/services/__tests__/translation-queue.test.d.ts +2 -0
  209. package/dist/services/__tests__/translation-queue.test.d.ts.map +1 -0
  210. package/dist/services/__tests__/translation-queue.test.js +277 -0
  211. package/dist/services/__tests__/translation-queue.test.js.map +1 -0
  212. package/dist/services/__tests__/translation-room-admission.test.d.ts +2 -0
  213. package/dist/services/__tests__/translation-room-admission.test.d.ts.map +1 -0
  214. package/dist/services/__tests__/translation-room-admission.test.js +371 -0
  215. package/dist/services/__tests__/translation-room-admission.test.js.map +1 -0
  216. package/dist/services/__tests__/translation-session-blocks.test.d.ts +2 -0
  217. package/dist/services/__tests__/translation-session-blocks.test.d.ts.map +1 -0
  218. package/dist/services/__tests__/translation-session-blocks.test.js +367 -0
  219. package/dist/services/__tests__/translation-session-blocks.test.js.map +1 -0
  220. package/dist/services/__tests__/translation-settings.service.test.d.ts +2 -0
  221. package/dist/services/__tests__/translation-settings.service.test.d.ts.map +1 -0
  222. package/dist/services/__tests__/translation-settings.service.test.js +154 -0
  223. package/dist/services/__tests__/translation-settings.service.test.js.map +1 -0
  224. package/dist/services/__tests__/translation.service.test.d.ts +2 -0
  225. package/dist/services/__tests__/translation.service.test.d.ts.map +1 -0
  226. package/dist/services/__tests__/translation.service.test.js +480 -0
  227. package/dist/services/__tests__/translation.service.test.js.map +1 -0
  228. package/dist/services/access-auth.service.d.ts +1 -0
  229. package/dist/services/access-auth.service.d.ts.map +1 -1
  230. package/dist/services/access-auth.service.js +8 -0
  231. package/dist/services/access-auth.service.js.map +1 -1
  232. package/dist/services/attachment-context.d.ts +7 -1
  233. package/dist/services/attachment-context.d.ts.map +1 -1
  234. package/dist/services/attachment-context.js +23 -2
  235. package/dist/services/attachment-context.js.map +1 -1
  236. package/dist/services/conflict-admission.d.ts +37 -0
  237. package/dist/services/conflict-admission.d.ts.map +1 -0
  238. package/dist/services/conflict-admission.js +97 -0
  239. package/dist/services/conflict-admission.js.map +1 -0
  240. package/dist/services/conflict-resolution-context.d.ts +33 -0
  241. package/dist/services/conflict-resolution-context.d.ts.map +1 -0
  242. package/dist/services/conflict-resolution-context.js +434 -0
  243. package/dist/services/conflict-resolution-context.js.map +1 -0
  244. package/dist/services/message-delivery.service.d.ts +195 -0
  245. package/dist/services/message-delivery.service.d.ts.map +1 -0
  246. package/dist/services/message-delivery.service.js +956 -0
  247. package/dist/services/message-delivery.service.js.map +1 -0
  248. package/dist/services/project.service.d.ts +1 -1
  249. package/dist/services/session-manager.d.ts +94 -74
  250. package/dist/services/session-manager.d.ts.map +1 -1
  251. package/dist/services/session-manager.js +91 -17
  252. package/dist/services/session-manager.js.map +1 -1
  253. package/dist/services/task.service.d.ts +26 -20
  254. package/dist/services/task.service.d.ts.map +1 -1
  255. package/dist/services/task.service.js +9 -26
  256. package/dist/services/task.service.js.map +1 -1
  257. package/dist/services/team-room-delivery.d.ts +541 -0
  258. package/dist/services/team-room-delivery.d.ts.map +1 -0
  259. package/dist/services/team-room-delivery.js +123 -0
  260. package/dist/services/team-room-delivery.js.map +1 -0
  261. package/dist/services/team-run.service.d.ts +83 -0
  262. package/dist/services/team-run.service.d.ts.map +1 -1
  263. package/dist/services/team-run.service.js +207 -18
  264. package/dist/services/team-run.service.js.map +1 -1
  265. package/dist/services/team-scheduler.service.d.ts +3 -0
  266. package/dist/services/team-scheduler.service.d.ts.map +1 -1
  267. package/dist/services/team-scheduler.service.js +65 -11
  268. package/dist/services/team-scheduler.service.js.map +1 -1
  269. package/dist/services/team-task-input.d.ts +37 -0
  270. package/dist/services/team-task-input.d.ts.map +1 -0
  271. package/dist/services/team-task-input.js +98 -0
  272. package/dist/services/team-task-input.js.map +1 -0
  273. package/dist/services/team-task-input.service.d.ts +72 -0
  274. package/dist/services/team-task-input.service.d.ts.map +1 -0
  275. package/dist/services/team-task-input.service.js +205 -0
  276. package/dist/services/team-task-input.service.js.map +1 -0
  277. package/dist/services/translation-client.d.ts +31 -0
  278. package/dist/services/translation-client.d.ts.map +1 -0
  279. package/dist/services/translation-client.js +169 -0
  280. package/dist/services/translation-client.js.map +1 -0
  281. package/dist/services/translation-errors.d.ts +14 -0
  282. package/dist/services/translation-errors.d.ts.map +1 -0
  283. package/dist/services/translation-errors.js +16 -0
  284. package/dist/services/translation-errors.js.map +1 -0
  285. package/dist/services/translation-protection.d.ts +27 -0
  286. package/dist/services/translation-protection.d.ts.map +1 -0
  287. package/dist/services/translation-protection.js +547 -0
  288. package/dist/services/translation-protection.js.map +1 -0
  289. package/dist/services/translation-queue.d.ts +49 -0
  290. package/dist/services/translation-queue.d.ts.map +1 -0
  291. package/dist/services/translation-queue.js +211 -0
  292. package/dist/services/translation-queue.js.map +1 -0
  293. package/dist/services/translation-settings.service.d.ts +152 -0
  294. package/dist/services/translation-settings.service.d.ts.map +1 -0
  295. package/dist/services/translation-settings.service.js +174 -0
  296. package/dist/services/translation-settings.service.js.map +1 -0
  297. package/dist/services/translation.service.d.ts +168 -0
  298. package/dist/services/translation.service.d.ts.map +1 -0
  299. package/dist/services/translation.service.js +861 -0
  300. package/dist/services/translation.service.js.map +1 -0
  301. package/dist/services/workspace.service.d.ts +84 -93
  302. package/dist/services/workspace.service.d.ts.map +1 -1
  303. package/dist/services/workspace.service.js +69 -5
  304. package/dist/services/workspace.service.js.map +1 -1
  305. package/dist/socket/__tests__/socket-gateway.test.js +131 -1
  306. package/dist/socket/__tests__/socket-gateway.test.js.map +1 -1
  307. package/dist/socket/socket-gateway.d.ts +6 -0
  308. package/dist/socket/socket-gateway.d.ts.map +1 -1
  309. package/dist/socket/socket-gateway.js +312 -6
  310. package/dist/socket/socket-gateway.js.map +1 -1
  311. package/dist/utils/database-schema.d.ts +9 -0
  312. package/dist/utils/database-schema.d.ts.map +1 -0
  313. package/dist/utils/database-schema.js +434 -0
  314. package/dist/utils/database-schema.js.map +1 -0
  315. package/dist/utils/database-schema.test.d.ts +2 -0
  316. package/dist/utils/database-schema.test.d.ts.map +1 -0
  317. package/dist/utils/database-schema.test.js +359 -0
  318. package/dist/utils/database-schema.test.js.map +1 -0
  319. package/dist/utils/database-team-foundation.test.d.ts +2 -0
  320. package/dist/utils/database-team-foundation.test.d.ts.map +1 -0
  321. package/dist/utils/database-team-foundation.test.js +467 -0
  322. package/dist/utils/database-team-foundation.test.js.map +1 -0
  323. package/dist/utils/owned-child-process.test.js +6 -3
  324. package/dist/utils/owned-child-process.test.js.map +1 -1
  325. package/dist/utils/text-preview.d.ts +4 -0
  326. package/dist/utils/text-preview.d.ts.map +1 -0
  327. package/dist/utils/text-preview.js +21 -0
  328. package/dist/utils/text-preview.js.map +1 -0
  329. package/dist/web/assets/AgentDemoPage-CtCYXopw.js +1 -0
  330. package/dist/web/assets/{AgentEnvironmentSettingsPage-BnWVgvNe.js → AgentEnvironmentSettingsPage-DSWN546Y.js} +1 -1
  331. package/dist/web/assets/AttachmentPreview-DRG5_cfN.js +2 -0
  332. package/dist/web/assets/BranchSelect-Dxs7HnMM.js +1 -0
  333. package/dist/web/assets/BrandLogo-Ilm880Xs.js +1 -0
  334. package/dist/web/assets/ConversationPage-B55Bj_ft.js +1 -0
  335. package/dist/web/assets/CreateTaskInput-CxWPeToI.js +1 -0
  336. package/dist/web/assets/{DemoPage-BwX2SvcN.js → DemoPage-Dyn-U9JO.js} +3 -3
  337. package/dist/web/assets/DesignSystemPage-BxypsRUZ.js +12 -0
  338. package/dist/web/assets/EditableTaskTitle-Dh-SmvFW.js +70 -0
  339. package/dist/web/assets/{ExecutionPermissionSelector-DeeNd4Kh.js → ExecutionPermissionSelector-CQ_GNxR0.js} +10 -10
  340. package/dist/web/assets/GeneralSettingsPage-CzoejPZP.js +1 -0
  341. package/dist/web/assets/{LoadingPreviewPage-BxEFnEQh.js → LoadingPreviewPage-BlW2PJhI.js} +1 -1
  342. package/dist/web/assets/McpSettingsPage-DD7EqD4L.js +1 -0
  343. package/dist/web/assets/MemberAvatar-B2pAdWUi.js +1 -0
  344. package/dist/web/assets/MobileTaskDetail-CvmNW0BQ.js +3 -0
  345. package/dist/web/assets/NotificationSettingsPage-BIqldIRf.js +1 -0
  346. package/dist/web/assets/ProfileSettingsPage-DMxpHmF1.js +3 -0
  347. package/dist/web/assets/ProjectKanbanPage-CHW79td4.js +12 -0
  348. package/dist/web/assets/ProjectSettingsPage-DKiEUkoa.js +2 -0
  349. package/dist/web/assets/ProviderSettingsPage-DZT7wyE2.js +67 -0
  350. package/dist/web/assets/SettingsMasterDetail-DnF0lsV1.js +1 -0
  351. package/dist/web/assets/TaskDetail-D_970BDY.js +1 -0
  352. package/dist/web/assets/TeamSettingsPage-BJIEZ7xL.js +1 -0
  353. package/dist/web/assets/TranslationSettingsPage-D3mazqEW.js +1 -0
  354. package/dist/web/assets/arc-hUh7ykl8.js +1 -0
  355. package/dist/web/assets/{architectureDiagram-3BPJPVTR-B5EIiXuX.js → architectureDiagram-3BPJPVTR-CcV9CLkm.js} +1 -1
  356. package/dist/web/assets/{at-sign-BE17rU5b.js → at-sign-B-nhoGyH.js} +1 -1
  357. package/dist/web/assets/{blockDiagram-GPEHLZMM-GFwnvSLM.js → blockDiagram-GPEHLZMM-5q3Y9y0e.js} +1 -1
  358. package/dist/web/assets/{c4Diagram-AAUBKEIU-iJfLTxEa.js → c4Diagram-AAUBKEIU-CorBXi06.js} +1 -1
  359. package/dist/web/assets/channel-By24WpLg.js +1 -0
  360. package/dist/web/assets/check-DqPSoX0r.js +1 -0
  361. package/dist/web/assets/{chevron-down-BaQEBzp3.js → chevron-down-CPnvItQw.js} +1 -1
  362. package/dist/web/assets/{chevron-up-D0y6skqr.js → chevron-up-B8PE5N0G.js} +1 -1
  363. package/dist/web/assets/{chunk-2J33WTMH-CDxRPp-8.js → chunk-2J33WTMH-BUf5B4z4.js} +1 -1
  364. package/dist/web/assets/{chunk-4BX2VUAB-mzPbgyiz.js → chunk-4BX2VUAB-CdnOHkro.js} +1 -1
  365. package/dist/web/assets/{chunk-55IACEB6-KNAJbQyw.js → chunk-55IACEB6-U7edZDpP.js} +1 -1
  366. package/dist/web/assets/{chunk-727SXJPM-BqGfqkDK.js → chunk-727SXJPM-B64Tuhla.js} +1 -1
  367. package/dist/web/assets/{chunk-AQP2D5EJ-D27ue-H0.js → chunk-AQP2D5EJ-dXfe56jB.js} +1 -1
  368. package/dist/web/assets/{chunk-FMBD7UC4-DRza-3q8.js → chunk-FMBD7UC4-DDYbxc1Q.js} +1 -1
  369. package/dist/web/assets/{chunk-ND2GUHAM-CUgkviLu.js → chunk-ND2GUHAM-BQDGMv0R.js} +1 -1
  370. package/dist/web/assets/{chunk-QZHKN3VN-BAlOJwZb.js → chunk-QZHKN3VN-DB8q4xAj.js} +1 -1
  371. package/dist/web/assets/classDiagram-4FO5ZUOK-DxHoimtR.js +1 -0
  372. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-DxHoimtR.js +1 -0
  373. package/dist/web/assets/code-block-OCS4YCEC-BSdICyOa.js +2 -0
  374. package/dist/web/assets/confirm-dialog-DxEBZEbV.js +1 -0
  375. package/dist/web/assets/content-CMUL3HGx.js +2 -0
  376. package/dist/web/assets/{copy-DejkmIHZ.js → copy-DyxlXxiU.js} +1 -1
  377. package/dist/web/assets/{cose-bilkent-S5V4N54A-8TBY7BP_.js → cose-bilkent-S5V4N54A-Dx6eMnll.js} +1 -1
  378. package/dist/web/assets/cssMode-ZnNWfjZ6.js +1 -0
  379. package/dist/web/assets/{dagre-BM42HDAG-CkMzDiim.js → dagre-BM42HDAG-Cxe8pLgD.js} +1 -1
  380. package/dist/web/assets/{diagram-2AECGRRQ-CAOQJ2N1.js → diagram-2AECGRRQ-RMsswEBe.js} +1 -1
  381. package/dist/web/assets/{diagram-5GNKFQAL-DKhE0hiI.js → diagram-5GNKFQAL-Bi4E0hzx.js} +1 -1
  382. package/dist/web/assets/{diagram-KO2AKTUF-DBdkXSpa.js → diagram-KO2AKTUF-Mv6CDCyn.js} +1 -1
  383. package/dist/web/assets/{diagram-LMA3HP47-DRi2t32c.js → diagram-LMA3HP47-CJ3qKNzK.js} +1 -1
  384. package/dist/web/assets/{diagram-OG6HWLK6-DtP92tI1.js → diagram-OG6HWLK6-D8SBY4ft.js} +1 -1
  385. package/dist/web/assets/dialog-BYdeYC2Y.js +5 -0
  386. package/dist/web/assets/{erDiagram-TEJ5UH35-DWFKXtst.js → erDiagram-TEJ5UH35-DwVSCU6X.js} +1 -1
  387. package/dist/web/assets/{flowDiagram-I6XJVG4X-LDE0h4ri.js → flowDiagram-I6XJVG4X-CyipYAWd.js} +1 -1
  388. package/dist/web/assets/{freemarker2-CLksOOZX.js → freemarker2-DbH_yMCO.js} +2 -2
  389. package/dist/web/assets/{ganttDiagram-6RSMTGT7-DD2RfdyV.js → ganttDiagram-6RSMTGT7-CsC6Wjt4.js} +1 -1
  390. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-DkKrR8ex.js → gitGraphDiagram-PVQCEYII-E5jNbqlq.js} +1 -1
  391. package/dist/web/assets/{globe-CD4g63c9.js → globe-B2rgTPH3.js} +1 -1
  392. package/dist/web/assets/handlebars-C5VY_S-z.js +1 -0
  393. package/dist/web/assets/hooks-Ct0srfV-.js +1 -0
  394. package/dist/web/assets/html-e5uLnAgN.js +1 -0
  395. package/dist/web/assets/htmlMode-BeNiGozX.js +1 -0
  396. package/dist/web/assets/icon-button-BEMJj_6T.js +1 -0
  397. package/dist/web/assets/index-0XPZayUU.css +1 -0
  398. package/dist/web/assets/index-BYPOXP6w.js +1 -0
  399. package/dist/web/assets/{index-D_QVcsLn.js → index-C-M0QDqc.js} +5 -5
  400. package/dist/web/assets/index-CAjqC8pT.js +41 -0
  401. package/dist/web/assets/index-CPGzLjEC.js +1 -0
  402. package/dist/web/assets/index-Cm6snkmR.js +122 -0
  403. package/dist/web/assets/index-DNdMmXBr.js +1 -0
  404. package/dist/web/assets/index-DppwrK2G.js +1 -0
  405. package/dist/web/assets/index-IMdA08Ok.js +1 -0
  406. package/dist/web/assets/index-kr6U6_pi.js +1 -0
  407. package/dist/web/assets/{infoDiagram-5YYISTIA-BdPA9Xfi.js → infoDiagram-5YYISTIA-5_0wrRXl.js} +1 -1
  408. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-220u4uiv.js → ishikawaDiagram-YF4QCWOH-aQujIFZw.js} +5 -5
  409. package/dist/web/assets/javascript-D7QVj9jR.js +1 -0
  410. package/dist/web/assets/{journeyDiagram-JHISSGLW-BvE0Y3tZ.js → journeyDiagram-JHISSGLW-ClMzHdqI.js} +1 -1
  411. package/dist/web/assets/jsonMode-nHmLVf-n.js +7 -0
  412. package/dist/web/assets/{kanban-definition-UN3LZRKU-Q0JH1P6D.js → kanban-definition-UN3LZRKU-BFVlt0tz.js} +1 -1
  413. package/dist/web/assets/kbd-Bfq5K6Ux.js +1 -0
  414. package/dist/web/assets/{key-round-DZm1FLLr.js → key-round-BqsaQdce.js} +1 -1
  415. package/dist/web/assets/{layers-Dda7MM7a.js → layers-DI4vFJ4F.js} +1 -1
  416. package/dist/web/assets/{linear-Dr6SfnSn.js → linear-DZ-6PAPS.js} +1 -1
  417. package/dist/web/assets/{link-BUeSP3T7.js → link-BU4PN723.js} +1 -1
  418. package/dist/web/assets/liquid-BPIyogoj.js +1 -0
  419. package/dist/web/assets/{lspLanguageFeatures-Bbp4PWlJ.js → lspLanguageFeatures-DH4Z8jiM.js} +1 -1
  420. package/dist/web/assets/mdx-CI8yO2pV.js +1 -0
  421. package/dist/web/assets/menu-C3uB3M7p.js +1 -0
  422. package/dist/web/assets/menu-styles-DWynpVVz.js +1 -0
  423. package/dist/web/assets/mermaid-NOHMQCX5-BqeX1osS.js +123 -0
  424. package/dist/web/assets/{message-square-CFriSt4D.js → message-square-E5K8E3A-.js} +1 -1
  425. package/dist/web/assets/{mindmap-definition-RKZ34NQL-bvDaNfKs.js → mindmap-definition-RKZ34NQL-C7dea0db.js} +1 -1
  426. package/dist/web/assets/modal-Cz1iIVeD.js +1 -0
  427. package/dist/web/assets/{monaco-BuDK9Fat.js → monaco-DM3DuGN5.js} +3 -3
  428. package/dist/web/assets/{paperclip-BOSklTt7.js → paperclip-COXNce_v.js} +1 -1
  429. package/dist/web/assets/{pencil-BRQ9W_a-.js → pencil-BFc4n44f.js} +1 -1
  430. package/dist/web/assets/people-BaCetIqh.js +1 -0
  431. package/dist/web/assets/{pieDiagram-4H26LBE5-BQCca9Cq.js → pieDiagram-4H26LBE5-2q5medug.js} +2 -2
  432. package/dist/web/assets/popover-CJCQLoGu.js +1 -0
  433. package/dist/web/assets/python-CSxVPG9p.js +1 -0
  434. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-BEM2U7Cd.js → quadrantDiagram-W4KKPZXB-DHPEM56s.js} +1 -1
  435. package/dist/web/assets/razor-CVoIieeS.js +1 -0
  436. package/dist/web/assets/{requirementDiagram-4Y6WPE33-CcmFIALZ.js → requirementDiagram-4Y6WPE33-B_KyH7PP.js} +1 -1
  437. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-D9Nrfbqk.js → sankeyDiagram-5OEKKPKP-CrqkZAYW.js} +1 -1
  438. package/dist/web/assets/search-CkiBPir_.js +1 -0
  439. package/dist/web/assets/search-field-CbM2P2KE.js +1 -0
  440. package/dist/web/assets/select-Br0TAs7A.js +1 -0
  441. package/dist/web/assets/select-DJsEG0jq.js +1 -0
  442. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-5udQDi0x.js → sequenceDiagram-3UESZ5HK-BRTm1WQA.js} +1 -1
  443. package/dist/web/assets/{server-DJaSJ9m1.js → server-DYeSE1wn.js} +1 -1
  444. package/dist/web/assets/stateDiagram-AJRCARHV-qN49iyR2.js +1 -0
  445. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-B1clBPkJ.js +1 -0
  446. package/dist/web/assets/{textarea-Ft9KMoEI.js → textarea-B7vtoRE3.js} +1 -1
  447. package/dist/web/assets/{timeline-definition-PNZ67QCA-DXS236a-.js → timeline-definition-PNZ67QCA-BzarcDi3.js} +1 -1
  448. package/dist/web/assets/toggles-jo27o0AH.js +1 -0
  449. package/dist/web/assets/tooltip-DbVtCXcO.js +1 -0
  450. package/dist/web/assets/track-C0vxnITw.js +1 -0
  451. package/dist/web/assets/{trash-2-Bc-URu8c.js → trash-2-CUM-XX8B.js} +1 -1
  452. package/dist/web/assets/tsMode-7D3gqep6.js +11 -0
  453. package/dist/web/assets/typescript-CbOVEQNg.js +1 -0
  454. package/dist/web/assets/{upload-C9Z4jLtv.js → upload-CJ6jVmte.js} +1 -1
  455. package/dist/web/assets/use-profiles-B0xXAf7Z.js +1 -0
  456. package/dist/web/assets/{use-projects-DI27nNwl.js → use-projects-BlTwWxkY.js} +1 -1
  457. package/dist/web/assets/{use-providers-DB9ghBPq.js → use-providers-FMSfyTD1.js} +1 -1
  458. package/dist/web/assets/use-translation-settings-BOlszecX.js +1 -0
  459. package/dist/web/assets/use-workspaces-DYrEp0Lw.js +1 -0
  460. package/dist/web/assets/useNormalizedLogs-D0N8MJdH.js +1 -0
  461. package/dist/web/assets/useTokenUsage-WB3ZQ25v.js +1 -0
  462. package/dist/web/assets/{vennDiagram-CIIHVFJN-BzyNrP06.js → vennDiagram-CIIHVFJN-B6oZetvf.js} +1 -1
  463. package/dist/web/assets/{wardley-L42UT6IY-BQ4SyU9_.js → wardley-L42UT6IY-Bzuhm76f.js} +1 -1
  464. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-CcCqmB58.js → wardleyDiagram-YWT4CUSO-DaC-FUf5.js} +1 -1
  465. package/dist/web/assets/xml-Cfa9tkdT.js +1 -0
  466. package/dist/web/assets/{xychartDiagram-2RQKCTM6-RWm1MtQk.js → xychartDiagram-2RQKCTM6-CCvRIJRL.js} +1 -1
  467. package/dist/web/assets/yaml-C86f7VLL.js +1 -0
  468. package/dist/web/index.html +2 -2
  469. package/node_modules/@agent-tower/shared/dist/index.d.ts +1 -0
  470. package/node_modules/@agent-tower/shared/dist/index.d.ts.map +1 -1
  471. package/node_modules/@agent-tower/shared/dist/index.js +1 -0
  472. package/node_modules/@agent-tower/shared/dist/index.js.map +1 -1
  473. package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts +11 -0
  474. package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts.map +1 -1
  475. package/node_modules/@agent-tower/shared/dist/log-adapter.js +2 -0
  476. package/node_modules/@agent-tower/shared/dist/log-adapter.js.map +1 -1
  477. package/node_modules/@agent-tower/shared/dist/socket/events.d.ts +5 -2
  478. package/node_modules/@agent-tower/shared/dist/socket/events.d.ts.map +1 -1
  479. package/node_modules/@agent-tower/shared/dist/socket/events.js +2 -0
  480. package/node_modules/@agent-tower/shared/dist/socket/events.js.map +1 -1
  481. package/node_modules/@agent-tower/shared/dist/translation.d.ts +306 -0
  482. package/node_modules/@agent-tower/shared/dist/translation.d.ts.map +1 -0
  483. package/node_modules/@agent-tower/shared/dist/translation.js +8 -0
  484. package/node_modules/@agent-tower/shared/dist/translation.js.map +1 -0
  485. package/node_modules/@agent-tower/shared/dist/types.d.ts +23 -0
  486. package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
  487. package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
  488. package/package.json +1 -1
  489. package/prisma/migrations/20261016000000_add_translation_foundation/migration.sql +104 -0
  490. package/prisma/migrations/20261016010000_add_message_deliveries/migration.sql +158 -0
  491. package/prisma/migrations/20261019000000_add_room_translation_eligibility/migration.sql +3 -0
  492. package/prisma/migrations/20261019100000_add_team_delivery_foundation/migration.sql +217 -0
  493. package/prisma/schema.prisma +224 -0
  494. package/dist/web/assets/AgentDemoPage-D0LQRcXm.js +0 -1
  495. package/dist/web/assets/AgentLogo-BDyW3ihb.js +0 -1
  496. package/dist/web/assets/BranchSelect-Dmp5hq0i.js +0 -1
  497. package/dist/web/assets/BrandLogo-YGT4Vlw5.js +0 -1
  498. package/dist/web/assets/ConversationPage-BhapUYGe.js +0 -3
  499. package/dist/web/assets/CreateTaskInput-GLF3Oyc1.js +0 -1
  500. package/dist/web/assets/DesignSystemPage-j-1-1JtQ.js +0 -16
  501. package/dist/web/assets/EditableTaskTitle-mHT39coo.js +0 -70
  502. package/dist/web/assets/GeneralSettingsPage-BBe3EXcj.js +0 -1
  503. package/dist/web/assets/McpSettingsPage-DDA8yUxu.js +0 -1
  504. package/dist/web/assets/MemberAvatar-CCRbS97s.js +0 -1
  505. package/dist/web/assets/MobileTaskDetail-BOIFPybn.js +0 -5
  506. package/dist/web/assets/NotificationSettingsPage-B2kUnE8w.js +0 -1
  507. package/dist/web/assets/ProfileSettingsPage-DPZpUoFd.js +0 -3
  508. package/dist/web/assets/ProjectKanbanPage-DQnwUBFg.js +0 -12
  509. package/dist/web/assets/ProjectSettingsPage-CcXAOYb7.js +0 -2
  510. package/dist/web/assets/ProviderSettingsPage-BAIRvcAS.js +0 -67
  511. package/dist/web/assets/SettingsMasterDetail-BuxwsR9R.js +0 -1
  512. package/dist/web/assets/TaskDetail-B3pOSx3f.js +0 -3
  513. package/dist/web/assets/TeamSettingsPage-DoWmzvKu.js +0 -1
  514. package/dist/web/assets/agent-meta-MzuGtqxl.js +0 -1
  515. package/dist/web/assets/arc-Bm_QIbJA.js +0 -1
  516. package/dist/web/assets/arrow-down-BVePf1ZM.js +0 -1
  517. package/dist/web/assets/channel-CYYV7_Oi.js +0 -1
  518. package/dist/web/assets/check-qs0S_9rB.js +0 -1
  519. package/dist/web/assets/circle-alert-Cbvy2cMo.js +0 -1
  520. package/dist/web/assets/classDiagram-4FO5ZUOK-Cl-3ikxt.js +0 -1
  521. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-Cl-3ikxt.js +0 -1
  522. package/dist/web/assets/code-block-OCS4YCEC-CO23R1Os.js +0 -2
  523. package/dist/web/assets/confirm-dialog-BrgNTypL.js +0 -1
  524. package/dist/web/assets/cssMode-hzDRnxMx.js +0 -1
  525. package/dist/web/assets/gauge-CPlvCZUV.js +0 -1
  526. package/dist/web/assets/handlebars-C1M9t0Lo.js +0 -1
  527. package/dist/web/assets/html-DKVKQovh.js +0 -1
  528. package/dist/web/assets/htmlMode-BSWjg5ir.js +0 -1
  529. package/dist/web/assets/index-BnqdwOEH.css +0 -1
  530. package/dist/web/assets/index-CMJV-mgF.js +0 -122
  531. package/dist/web/assets/javascript-WwrMY2Bg.js +0 -1
  532. package/dist/web/assets/jsonMode-Dz0hnnvg.js +0 -7
  533. package/dist/web/assets/liquid-CzGEh0ls.js +0 -1
  534. package/dist/web/assets/mdx-y6S3OMMk.js +0 -1
  535. package/dist/web/assets/mermaid-NOHMQCX5-C72362la.js +0 -123
  536. package/dist/web/assets/modal-DeigO7aN.js +0 -1
  537. package/dist/web/assets/play-Mxkwq69n.js +0 -1
  538. package/dist/web/assets/python-CMnGKsU9.js +0 -1
  539. package/dist/web/assets/razor-mLurbGgY.js +0 -1
  540. package/dist/web/assets/select-DKS02St6.js +0 -1
  541. package/dist/web/assets/stateDiagram-AJRCARHV-D-cF1NGV.js +0 -1
  542. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-a4ugQnZs.js +0 -1
  543. package/dist/web/assets/status-styles-sQm4KLdp.js +0 -1
  544. package/dist/web/assets/switch-7LWQ_sEx.js +0 -1
  545. package/dist/web/assets/task-CDYaC_No.js +0 -42
  546. package/dist/web/assets/task-priority-acVgTiil.js +0 -1
  547. package/dist/web/assets/tsMode-Vr3bndW1.js +0 -11
  548. package/dist/web/assets/typescript-BfjoaUSn.js +0 -1
  549. package/dist/web/assets/use-attachments-EypT-7PI.js +0 -2
  550. package/dist/web/assets/use-profiles-nMPGwy3v.js +0 -1
  551. package/dist/web/assets/use-workspaces-d4n9m9cX.js +0 -1
  552. package/dist/web/assets/useNormalizedLogs-DRoPbP0w.js +0 -1
  553. package/dist/web/assets/useTokenUsage-4qTDa8SY.js +0 -1
  554. package/dist/web/assets/xml-BGVoPR0b.js +0 -1
  555. package/dist/web/assets/yaml-eFhNavrs.js +0 -1
@@ -1 +0,0 @@
1
- import{u as te,a as ne,b as le,d as ie,e as re,f as oe,g as ce,r as t,t as m,j as s,S as de,h as ue,i as A,k as G,B as g,I as z}from"./index-CMJV-mgF.js";import{S as U}from"./select-DKS02St6.js";import{T as me}from"./textarea-Ft9KMoEI.js";import{S as ge}from"./switch-7LWQ_sEx.js";import{u as pe}from"./use-providers-DB9ghBPq.js";import"./chevron-down-BaQEBzp3.js";import"./check-qs0S_9rB.js";const fe=[{value:"zh-CN",label:"简体中文"},{value:"en",label:"English"}],N="__follow_task__",R=8;function W(P,y){return P instanceof Error?P.message:y}function je(){const{locale:P,setLocale:y,t:e}=te(),{data:p}=ne(),{data:H}=pe(),{data:w}=le(),{data:r}=ie(),u=re(),i=oe(),S=ce(),[K,D]=t.useState(N),[E,k]=t.useState(""),[V,j]=t.useState(!1),[d,_]=t.useState(""),[o,L]=t.useState(""),[C,I]=t.useState(""),[M,f]=t.useState(!1),[q,h]=t.useState(!1),[b,l]=t.useState(null);t.useEffect(()=>{!p||!w||(D(p.commitMessageProviderId||N),k(p.commitMessagePrompt||w.prompt),j(!1))},[p,w]),t.useEffect(()=>{r&&(f(r.enabled),h(!1),l(null),_(""),L(""),I(""))},[r?.enabled]);const J=[{value:N,label:e("跟随任务")},...(H??[]).filter(a=>a.availability.type!=="NOT_FOUND").map(a=>({value:a.provider.id,label:a.provider.name}))],x=r?.enabled??!1,n=!x&&M?"enable":x&&!M?"disable":x&&q?"change":"idle",O=n!=="idle",Q=e(O?n==="disable"?"将关闭":n==="enable"?"将启用":"已启用":x?"已启用":"未启用"),X=t.useCallback(a=>{D(a);const v=a===N?null:a;u.mutate({commitMessageProviderId:v},{onError:()=>m.error(e("保存失败"))})},[u,e]),Y=t.useCallback(()=>{const a=E.trim()||null;u.mutate({commitMessagePrompt:a},{onSuccess:()=>{j(!1),m.success(e("已保存"))},onError:()=>m.error(e("保存失败"))})},[E,u,e]),c=t.useCallback(()=>{_(""),L(""),I("")},[]),Z=t.useCallback(()=>{f(r?.enabled??!1),h(!1),l(null),c()},[r?.enabled,c]),F=t.useCallback(a=>{if((a==="change"||a==="disable")&&!d)return l(e("请输入当前密码")),!1;if(a==="enable"||a==="change"){if(o.length<R)return l(e("密码至少需要 8 个字符")),!1;if(o!==C)return l(e("两次输入不一致")),!1}return l(null),!0},[C,d,o,e]),B=t.useCallback(()=>{if(n==="idle"||!F(n))return;const a=n==="disable"?{enabled:!1,currentPassword:d}:n==="enable"?{enabled:!0,newPassword:o}:{currentPassword:d,newPassword:o};i.mutate(a,{onSuccess:v=>{f(v.enabled),h(!1),l(null),c(),m.success(e(n==="disable"?"已关闭":"已保存"))},onError:v=>{const T=W(v,e("保存失败"));T.toLowerCase().includes("current password")?l(e("当前密码不正确")):T.toLowerCase().includes("at least 8")?l(e("密码至少需要 8 个字符")):l(T)}})},[n,c,d,o,e,i,F]),$=t.useCallback(a=>{!r||i.isPending||(f(a),h(!1),l(null),c())},[r,c,i.isPending]),ee=t.useCallback(()=>{S.mutate(void 0,{onSuccess:()=>m.success(e("已退出登录")),onError:a=>m.error(W(a,e("退出登录失败")))})},[S,e]),se=t.useCallback(a=>{a.preventDefault(),B()},[B]),ae=t.useCallback(()=>{!r||i.isPending||(f(!0),h(!0),l(null),c())},[r,c,i.isPending]);return s.jsxs(de,{children:[s.jsx(ue,{title:e("通用设置"),className:"mb-1"}),s.jsx("div",{className:"divide-y divide-border/60",children:s.jsx(A,{label:e("显示语言"),description:e("界面语言会保存到本地数据库,重启后继续生效。"),align:"center",children:s.jsx(U,{value:P,onChange:a=>y(a),options:fe})})}),s.jsx(G,{className:"mt-8 mb-1",children:e("访问安全")}),s.jsx("div",{className:"divide-y divide-border/60",children:s.jsx(A,{label:e("访问密码"),description:e("开启后,进入 Agent Tower 需要输入密码。"),controlWidth:"fixed",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:Q}),s.jsx(ge,{checked:M,onCheckedChange:$,disabled:!r||i.isPending,"aria-label":e("访问密码")})]}),x&&n==="idle"&&s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[s.jsx(g,{type:"button",size:"sm",variant:"outline",className:"w-full sm:w-auto",onClick:ae,disabled:i.isPending,children:e("修改密码")}),s.jsx(g,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:ee,disabled:S.isPending,children:S.isPending?e("退出中..."):e("退出登录")})]}),O&&s.jsxs("form",{className:"space-y-2",onSubmit:se,children:[(n==="change"||n==="disable")&&s.jsx(z,{type:"password",autoComplete:"current-password",placeholder:e("当前密码"),value:d,onChange:a=>{_(a.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&!d)}),(n==="enable"||n==="change")&&s.jsxs(s.Fragment,{children:[s.jsx(z,{type:"password",autoComplete:"new-password",placeholder:e(n==="enable"?"访问密码":"新密码"),value:o,onChange:a=>{L(a.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o.length<R)}),s.jsx(z,{type:"password",autoComplete:"new-password",placeholder:e("确认密码"),value:C,onChange:a=>{I(a.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o!==C)})]}),(n==="change"||n==="disable")&&s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e(n==="disable"?"关闭后不再要求访问密码。":"保存后其他已登录页面需要重新输入。")}),b&&s.jsx("p",{className:"text-xs text-destructive",children:b}),s.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-1 sm:flex-row sm:justify-end",children:[s.jsx(g,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:Z,disabled:i.isPending,children:e("取消")}),s.jsx(g,{type:"submit",size:"sm",className:"w-full sm:w-auto",disabled:i.isPending,children:i.isPending?e("保存中..."):e(n==="disable"?"关闭访问密码":"保存")})]})]})]})})}),s.jsx(G,{className:"mt-8 mb-1",children:e("Git Commit Message")}),s.jsxs("div",{className:"divide-y divide-border/60",children:[s.jsx(A,{label:e("Agent 渠道"),description:e('"跟随任务"表示使用当前任务所用的 Agent 渠道。选择具体渠道可使用更经济的模型。'),children:s.jsx(U,{value:K,onChange:X,options:J})}),s.jsx(A,{label:e("提示词模板"),description:e("自定义生成 commit message 的提示词。留空则使用内置默认模板。"),children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(me,{value:E,onChange:a=>{k(a.target.value),j(!0)},rows:5,className:"font-mono resize-y"}),V&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(g,{size:"sm",variant:"ghost",onClick:()=>{k(p?.commitMessagePrompt||w?.prompt||""),j(!1)},children:e("取消")}),s.jsx(g,{size:"sm",onClick:Y,disabled:u.isPending,children:u.isPending?e("保存中..."):e("保存")})]})]})})]})]})}export{je as GeneralSettingsPage};
@@ -1 +0,0 @@
1
- import{m as c,q as m,p as o,u,r as p,t as n,j as e,S as a,E as g,B as l,Z as f}from"./index-CMJV-mgF.js";import{C as j}from"./copy-DejkmIHZ.js";import{S as b}from"./server-DJaSJ9m1.js";import{C as h}from"./check-qs0S_9rB.js";function N(){return c({queryKey:m.system.mcpConfig,queryFn:()=>o.get("/system/mcp-config")})}function C({mode:s,label:t}){const r=s==="desktop-packaged";return e.jsx("span",{className:`inline-flex items-center rounded-md px-2 py-1 text-[11px] font-medium ${r?"bg-emerald-50 text-emerald-700":"bg-amber-50 text-amber-700"}`,children:t})}function w(){const{t:s}=u(),{data:t,isLoading:r,isError:i,refetch:d}=N(),x=p.useCallback(async()=>{if(t?.configJson)try{await navigator.clipboard.writeText(t.configJson),n.success(s("MCP 配置已复制"))}catch{n.error(s("复制 MCP 配置失败"))}},[t?.configJson,s]);return r?e.jsx(a,{children:e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(g,{className:"h-5 w-5 animate-spin text-neutral-500"})})}):i||!t?e.jsxs(a,{children:[e.jsx("h2",{className:"mb-1 text-base font-semibold text-neutral-900",children:s("MCP 配置")}),e.jsx("div",{className:"mt-5 rounded-lg border border-red-100 bg-red-50 px-4 py-3 text-sm text-red-700",children:s("MCP 配置加载失败")}),e.jsx(l,{className:"mt-4",size:"sm",variant:"outline",onClick:()=>{d()},children:s("重试")})]}):e.jsxs(a,{children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-neutral-900",children:s("MCP 配置")}),e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-neutral-500",children:s("复制下面的 JSON 到支持 MCP 的客户端配置中。桌面打包版使用 App 内置 runtime,不需要全局安装 agent-tower。")})]}),e.jsxs(l,{size:"sm",onClick:x,children:[e.jsx(j,{size:14}),s("复制配置")]})]}),e.jsxs("div",{className:"space-y-3 border-b border-neutral-100 pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(C,{mode:t.runtimeMode,label:t.runtimeMode==="desktop-packaged"?s("桌面打包 runtime"):s("工作区 runtime")}),e.jsx("span",{className:"text-[12px] text-neutral-400",children:t.serverName})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-neutral-100 bg-neutral-50/70 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-[11px] font-medium uppercase text-neutral-400",children:[e.jsx(f,{size:12}),"Command"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-neutral-800",children:t.command})]}),e.jsxs("div",{className:"rounded-lg border border-neutral-100 bg-neutral-50/70 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-[11px] font-medium uppercase text-neutral-400",children:[e.jsx(b,{size:12}),"Entry"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-neutral-800",children:t.args.at(-1)??""})]})]})]}),e.jsxs("div",{className:"pt-5",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("label",{className:"text-[12px] font-medium text-neutral-600",children:"mcpServers JSON"}),t.runtimeMode==="desktop-packaged"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-emerald-600",children:[e.jsx(h,{size:12}),s("无需全局 CLI")]})]}),e.jsx("textarea",{readOnly:!0,value:t.configJson,rows:14,className:"w-full resize-y rounded-lg border border-neutral-200 bg-neutral-950 px-3 py-3 font-mono text-[12px] leading-relaxed text-neutral-100 outline-none"}),e.jsx("p",{className:"mt-2 text-[11px] leading-relaxed text-neutral-400",children:s("当前版本只生成通用 MCP 配置,不会自动修改 Claude、Codex 或其他第三方客户端配置文件。")})]})]})}export{w as McpSettingsPage};
@@ -1 +0,0 @@
1
- import{r as i,j as n,l as o}from"./index-CMJV-mgF.js";function d(r){const t=r.trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);return e.length>=2?`${e[0][0]??""}${e[1][0]??""}`.toUpperCase():Array.from(t).slice(0,2).join("").toUpperCase()}function a(r){const t=r.trim();return/^#([0-9a-f]{3,8})$/i.test(t)||/^rgba?\(/i.test(t)||/^hsla?\(/i.test(t)}function l(r){const t=r.trim();return t.startsWith("/")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:image/")||t.startsWith("blob:")}function h(r,t){const e=r?.trim()??"";return!e||a(e)||l(e)?d(t):e.length<=2?e.toUpperCase():e.slice(0,2).toUpperCase()}function p(r){const t=r?.trim()??"";if(!(!t||!a(t)))return{backgroundColor:t,color:"#ffffff"}}function g({name:r,avatar:t,className:e}){const[u,c]=i.useState(null),s=t?.trim()??"",f=!!s&&l(s)&&u!==s,m=i.useMemo(()=>h(s,r),[r,s]);return f?n.jsx("img",{src:s,alt:r,loading:"lazy",onError:()=>c(s),className:o("h-7 w-7 shrink-0 rounded-full border border-neutral-200 bg-white object-cover",e)}):n.jsx("div",{className:o("flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-neutral-200 bg-neutral-100 text-[10px] font-semibold text-neutral-600",e),style:p(s),"aria-label":r,children:m})}export{g as M};
@@ -1,5 +0,0 @@
1
- import{u as U,j as e,E as K,r as n,l as D,p as Dt,q as Qe,ac as Ne,a7 as bs,o as vs,a3 as js,a4 as ys,a5 as Ns,ad as ks,a6 as ws,s as At,B as He,ab as Cs,Q as Is}from"./index-CMJV-mgF.js";import{C as we,W as Ss,S as W}from"./agent-meta-MzuGtqxl.js";import{a as Rt,Q as As,s as Rs}from"./mermaid-NOHMQCX5-C72362la.js";import{u as Ts,a as Es,R as Ms,P as Ps,T as Os}from"./useTokenUsage-4qTDa8SY.js";import{u as Ls,a as Ws,L as Tt,T as Et}from"./useNormalizedLogs-DRoPbP0w.js";import{g as Ds}from"./ExecutionPermissionSelector-DeeNd4Kh.js";import{u as zs,A as Bs}from"./use-attachments-EypT-7PI.js";import{u as Fs,a as Gs,b as Us,d as qs,e as Vs,S as Mt}from"./CreateTaskInput-GLF3Oyc1.js";import{b as zt,G as Xe,m as Hs,n as $s,o as _s,p as Ks,u as Qs,r as Xs,g as ke,c as Ys,e as Zs,a as Js,f as en,W as tn,E as sn,h as nn,S as an,R as rn,T as ln,j as on,q as cn,s as dn,i as un,k as mn,l as xn}from"./EditableTaskTitle-mHT39coo.js";import{C as Ce}from"./chevron-down-BaQEBzp3.js";import{H as Bt,F as Ft,C as pn,P as $e}from"./play-Mxkwq69n.js";import{a as hn,b as fn,c as gn}from"./use-workspaces-d4n9m9cX.js";import{u as bn}from"./use-providers-DB9ghBPq.js";import{D as vn}from"./ProjectKanbanPage-DQnwUBFg.js";import{U as ie}from"./status-styles-sQm4KLdp.js";import{M as Gt}from"./message-square-CFriSt4D.js";import{T as jn}from"./trash-2-Bc-URu8c.js";import{A as Pt}from"./arrow-down-BVePf1ZM.js";import{P as yn}from"./paperclip-BOSklTt7.js";import{A as Nn}from"./task-priority-acVgTiil.js";import"./gauge-CPlvCZUV.js";import"./AgentLogo-BDyW3ihb.js";import"./check-qs0S_9rB.js";import"./use-projects-DI27nNwl.js";import"./MemberAvatar-CCRbS97s.js";import"./BrandLogo-YGT4Vlw5.js";import"./chevron-up-D0y6skqr.js";import"./at-sign-BE17rU5b.js";import"./confirm-dialog-BrgNTypL.js";import"./modal-DeigO7aN.js";import"./select-DKS02St6.js";import"./layers-Dda7MM7a.js";import"./textarea-Ft9KMoEI.js";import"./server-DJaSJ9m1.js";import"./task-CDYaC_No.js";import"./copy-DejkmIHZ.js";import"./upload-C9Z4jLtv.js";import"./globe-CD4g63c9.js";import"./BranchSelect-Dmp5hq0i.js";import"./pencil-BRQ9W_a-.js";import"./circle-alert-Cbvy2cMo.js";const Ot={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function kn(t){const r=t.split("/");return r[r.length-1]||t}function wn(t){const r=t.lastIndexOf("/");return r>0?t.slice(0,r):""}function Cn({workingDir:t,filePath:r,type:c}){const{t:d}=U(),{data:v,isLoading:x,isError:f}=Hs(t,r,c);if(x)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[e.jsx(K,{size:14,className:"animate-spin"}),e.jsx("span",{className:"text-xs",children:d("Loading diff...")})]});if(f)return e.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:d("Failed to load diff.")});const i=v?.diff||"";if(!i.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:d("No diff content available.")});const g=i.split(`
2
- `);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:g.map((l,C)=>{let b="",N="text-neutral-400";return l.startsWith("+")&&!l.startsWith("+++")?(b="bg-emerald-950/40",N="text-emerald-400"):l.startsWith("-")&&!l.startsWith("---")?(b="bg-red-950/40",N="text-red-400"):l.startsWith("@@")&&(b="bg-blue-950/30",N="text-blue-400"),e.jsx("div",{className:D("px-3 whitespace-pre",b,N),children:l},C)})})}function In({entry:t,type:r,workingDir:c}){const[d,v]=n.useState(!1),x=Ot[t.status]||Ot.M,f=wn(t.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>v(i=>!i),className:D("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-neutral-50",d&&"bg-neutral-50"),children:[e.jsx("span",{className:D("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",x),children:t.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:kn(t.path)}),f&&e.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:f})]}),e.jsx("span",{className:"text-neutral-400 shrink-0",children:d?e.jsx(Ce,{size:14}):e.jsx(we,{size:14})})]}),d&&e.jsx(Cn,{workingDir:c,filePath:t.path,type:r})]})}function Lt({title:t,entries:r,type:c,workingDir:d,defaultOpen:v}){const{t:x}=U(),[f,i]=n.useState(v);return r.length===0?null:e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>i(g=>!g),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-neutral-50",children:[e.jsx("span",{className:"text-neutral-400",children:f?e.jsx(Ce,{size:14}):e.jsx(we,{size:14})}),e.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:x(t)}),e.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:r.length})]}),f&&e.jsx("div",{className:"divide-y divide-neutral-100",children:r.map(g=>e.jsx(In,{entry:g,type:c,workingDir:d},`${c}:${g.path}`))})]})}function Sn({workingDir:t}){const{t:r}=U(),{data:c,isLoading:d,isError:v}=zt(t);if(!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:r("No workspace selected.")});if(d)return e.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[e.jsx(K,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-sm",children:r("Loading changes...")})]});if(v)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:r("Failed to load changes.")});const x=c?.uncommitted||[],f=c?.committed||[];return x.length+f.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[e.jsx(Xe,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:r("No pending changes")})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin overscroll-y-contain",children:[e.jsx(Lt,{title:"Uncommitted",entries:x,type:"uncommitted",workingDir:t,defaultOpen:!0}),e.jsx(Lt,{title:"Committed",entries:f,type:"committed",workingDir:t,defaultOpen:!1})]})}const _e=50,Wt={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function An(t){const c=Math.floor(Date.now()/1e3)-t;return c<60?Ne("{count}s ago",{count:c}):c<3600?Ne("{count}m ago",{count:Math.floor(c/60)}):c<86400?Ne("{count}h ago",{count:Math.floor(c/3600)}):c<604800?Ne("{count}d ago",{count:Math.floor(c/86400)}):new Date(t*1e3).toLocaleDateString()}function Rn(t){const r=t.split("/");return r[r.length-1]||t}function Tn(t){const r=t.lastIndexOf("/");return r>0?t.slice(0,r):""}function En({workingDir:t,hash:r,filePath:c}){const{t:d}=U(),{data:v,isLoading:x,isError:f}=Ks(t,r,c);if(x)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[e.jsx(K,{size:14,className:"animate-spin"}),e.jsx("span",{className:"text-xs",children:d("Loading diff...")})]});if(f)return e.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:d("Failed to load diff.")});const i=v?.diff||"";if(!i.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:d("No diff content available.")});const g=i.split(`
3
- `);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:g.map((l,C)=>{let b="",N="text-neutral-400";return l.startsWith("+")&&!l.startsWith("+++")?(b="bg-emerald-950/40",N="text-emerald-400"):l.startsWith("-")&&!l.startsWith("---")?(b="bg-red-950/40",N="text-red-400"):l.startsWith("@@")&&(b="bg-blue-950/30",N="text-blue-400"),e.jsx("div",{className:D("px-3 whitespace-pre",b,N),children:l},C)})})}function Mn({entry:t,workingDir:r,hash:c}){const[d,v]=n.useState(!1),x=Wt[t.status]||Wt.M,f=Tn(t.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>v(i=>!i),className:D("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-neutral-50",d&&"bg-neutral-50"),children:[e.jsx("span",{className:D("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",x),children:t.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Rn(t.path)}),f&&e.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:f})]}),e.jsx("span",{className:"text-neutral-400 shrink-0",children:d?e.jsx(Ce,{size:14}):e.jsx(we,{size:14})})]}),d&&e.jsx(En,{workingDir:r,hash:c,filePath:t.path})]})}function Pn({commit:t,workingDir:r}){const{t:c}=U(),[d,v]=n.useState(!1),{data:x,isLoading:f}=_s(r,d?t.hash:null),i=x?.files||[];return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>v(g=>!g),className:D("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-neutral-50",d&&"bg-neutral-50"),children:[e.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:e.jsx("div",{className:D("w-2.5 h-2.5 rounded-full shrink-0",d?"bg-blue-500":"bg-neutral-300")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-mono text-blue-600 shrink-0",children:t.shortHash}),e.jsx("span",{className:"text-sm text-neutral-900 truncate flex-1",children:t.message})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"text-[11px] text-neutral-500 truncate",children:t.author}),e.jsx("span",{className:"text-[11px] text-neutral-400",children:An(t.timestamp)})]})]}),e.jsx("span",{className:"text-neutral-400 shrink-0 pt-0.5",children:d?e.jsx(Ce,{size:14}):e.jsx(we,{size:14})})]}),d&&e.jsxs("div",{className:"pl-4 border-l-2 border-blue-100 ml-[22px]",children:[t.body&&e.jsx("div",{className:"px-3 py-2 text-xs text-neutral-600 whitespace-pre-wrap leading-4",children:t.body}),f?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-neutral-400",children:[e.jsx(K,{size:14,className:"animate-spin"}),e.jsx("span",{className:"text-xs",children:c("Loading files...")})]}):i.length===0?e.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:c("No files changed")}):e.jsx("div",{className:"divide-y divide-neutral-100",children:i.map(g=>e.jsx(Mn,{entry:g,workingDir:r,hash:t.hash},g.path))})]})]})}function On({workingDir:t}){const{t:r}=U(),{data:c,isLoading:d,isError:v,fetchNextPage:x,hasNextPage:f,isFetchingNextPage:i}=$s({queryKey:Qe.git.log(t||""),queryFn:({pageParam:l=0})=>Dt.get("/git/log",{params:{workingDir:t||"",limit:String(_e),skip:String(l)}}),initialPageParam:0,getNextPageParam:(l,C)=>l.commits.length<_e?void 0:C.length*_e,enabled:!!t}),g=c?.pages.flatMap(l=>l.commits)||[];return t?d?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[e.jsx(K,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-sm",children:r("Loading history...")})]}):v?e.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:r("Failed to load history.")}):g.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[e.jsx(Bt,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:r("No commit history")})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin overscroll-y-contain",children:[e.jsx("div",{className:"divide-y divide-neutral-100",children:g.map(l=>e.jsx(Pn,{commit:l,workingDir:t},l.hash))}),f&&e.jsx("button",{type:"button",onClick:()=>x(),disabled:i,className:"w-full py-4 text-sm text-neutral-500 active:text-neutral-700 active:bg-neutral-50 flex items-center justify-center gap-2",children:i?e.jsxs(e.Fragment,{children:[e.jsx(K,{size:14,className:"animate-spin"})," ",r("Loading...")]}):r("Load more")})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:r("No workspace selected.")})}const Ln=Is(),Wn=t=>t.includes("://")||t.startsWith("/api/")?t:t.startsWith("/")?`${Ln}/attachments/by-path?path=${encodeURIComponent(t)}`:t;function Dn({status:t}){const r={[ie.Running]:"bg-blue-500",[ie.Review]:"bg-amber-500",[ie.Pending]:"bg-neutral-400",[ie.Done]:"bg-emerald-500",[ie.Cancelled]:"bg-neutral-400"};return e.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${r[t]}`})}const zn=[{key:"chat",label:"Chat",icon:Gt},{key:"changes",label:"Changes",icon:Xe},{key:"history",label:"History",icon:Bt},{key:"workspace",label:"Workspace",icon:Ft}],Bn=[{key:"chat",label:"Team room",icon:Gt},{key:"team-status",label:"Team Status",icon:ks},{key:"changes",label:"Changes",icon:Xe},{key:"workspace",label:"Workspace",icon:Ft}];function Sa({task:t,onBack:r,onDeleteTask:c,onTaskPriorityChange:d,isDeleting:v,autoStartState:x,onAutoStartRecovered:f}){const{t:i}=U(),g=bs(s=>s.setVisibleContext),[l,C]=n.useState("chat"),[b,N]=n.useState(""),[Ut,le]=n.useState(!1),[qt,Ie]=n.useState(!1),[Se,Ae]=n.useState(!1),[T,Re]=n.useState(null),[Q,X]=n.useState(void 0),Ye=n.useRef(0),[Vt,Te]=n.useState(),Ee=n.useRef(null),Me=n.useRef(null),Y=n.useRef(null),Ze=n.useRef(null),{scrollRef:z,contentRef:Je,isAtBottom:et,scrollToBottom:oe,stopScroll:tt}=Ts({resize:"smooth",initial:"instant"}),q=vs();n.useEffect(()=>{if(!Se)return;const s=a=>{Me.current&&!Me.current.contains(a.target)&&Ae(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[Se]);const{data:o,isLoading:Ht}=hn(t.id),Z=Qs(t.id),st=Z?.status==="completed"&&x?.status!=="failed"?null:x,Pe=!!(st||Z&&Z.status!=="completed"),{data:ce}=js(t.id),{data:$t}=ys(ce?.id??""),nt=Ns(ce?.id??""),h=ce??null,M=t.isGitRepo!==!1&&t.worktreeReady!==!1,Oe=n.useMemo(()=>(h?Bn:zn).filter(s=>M||s.key!=="changes"&&s.key!=="history"),[M,h]),_t=ce===null,{data:J,isLoading:Kt}=ws(t.id,_t),k=!!t.projectArchivedAt,at=!!t.projectRepoDeletedAt,Le=i(at?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。");n.useEffect(()=>{X(void 0),Re(null),Te(void 0)},[t.id]),n.useEffect(()=>{h&&l==="history"&&C("chat"),!h&&l==="team-status"&&C("chat"),Oe.some(s=>s.key===l)||C("chat")},[l,Oe,h]);const B=n.useMemo(()=>Xs(o,h,Q),[Q,h,o]);n.useEffect(()=>{Q&&!o?.some(s=>s.id===Q)&&X(void 0)},[Q,o]);const w=n.useMemo(()=>o?.find(s=>s.id===B),[B,o]),A=n.useMemo(()=>{if(o){if(w)return ke(w);for(const s of o)if(s.status==="ACTIVE"&&ke(s))return ke(s);return ke(o[0])}},[w,o]),E=w?.status===Ss.ACTIVE?w.id:void 0,We=M&&Ys(w,h),De=w?.branchName??"",rt=w?.commitMessage,ze=n.useMemo(()=>Zs(w,o,t?.mainBranch??""),[w,t?.mainBranch,o]),ee=!!(We&&E&&A&&!k),{data:P,isLoading:Qt}=fn(E??"",{enabled:ee}),{data:it}=zt(A,{enabled:ee}),Xt=it?.committed?.length,[lt,ot]=n.useState(!1),[ct,dt]=n.useState(null);n.useEffect(()=>{const s=M&&(l==="changes"||l==="chat"&&ee)?"changes":M&&l==="history"?"history":null;if(!E||!A||!s){g(null);return}return g({workspaceId:E,workingDir:A,tab:s}),()=>{g(null)}},[l,M,E,g,ee,A]);const I=n.useMemo(()=>P?.conflictOp&&P.conflictedFiles.length>0?{conflictOp:P.conflictOp,conflictedFiles:P.conflictedFiles}:ct,[P?.conflictOp,P?.conflictedFiles,ct]),ut=I?.targetWorkspaceId??E,Yt=I?.targetWorktreePath??w?.worktreePath,Zt=I?.sourceBranch??De,Jt=I?.targetBranch??ze,es=w?.sessions??[],Be=n.useCallback(s=>{dt(s??null),ot(!0)},[]),mt=n.useCallback(()=>t?.id?q.invalidateQueries({queryKey:Qe.workspaces.list(t.id)}):Promise.resolve(),[t?.id,q]),Fe=n.useCallback(async()=>q.fetchQuery({queryKey:Qe.tasks.body(t.id),queryFn:()=>Dt.get(`/tasks/${t.id}/body`)}),[q,t.id]),S=n.useMemo(()=>{if(!o)return null;const s=o.filter(p=>p.status==="ACTIVE"&&Array.isArray(p.sessions)).flatMap(p=>p.sessions??[]),a=p=>{const $=p.createdAt,_=p.endedAt??p.startedAt??$;if(!_)return 0;const ye=Date.parse(_);return Number.isNaN(ye)?0:ye},u=p=>{const $=s.filter(_=>p.includes(_.status));return $.length===0?null:$.sort((_,ye)=>a(ye)-a(_))[0]??null},m=u([W.RUNNING])??u([W.PENDING])??u([W.COMPLETED,W.FAILED,W.CANCELLED]);if(m)return m;const L=o.filter(p=>(p.status==="ABANDONED"||p.status==="MERGED"||p.status==="HIBERNATED")&&Array.isArray(p.sessions)).flatMap(p=>p.sessions??[]).filter(p=>[W.COMPLETED,W.FAILED,W.CANCELLED].includes(p.status));return L.length===0?null:L.sort((p,$)=>a($)-a(p))[0]??null},[o]),j=S?.id??"",de=h?T??"":j,ts=n.useMemo(()=>{if(!T||!o)return null;for(const s of o){const a=s.sessions?.find(u=>u.id===T);if(a)return a}return null},[T,o]),Ge=n.useMemo(()=>{if(!T||!h?.invocations)return null;const s=h.invocations.filter(a=>a.sessionId===T);return s.length===0?null:s.sort((a,u)=>{const m=Date.parse(a.updatedAt??a.createdAt??""),R=Date.parse(u.updatedAt??u.createdAt??"");return(Number.isNaN(R)?0:R)-(Number.isNaN(m)?0:m)})[0]??null},[T,h?.invocations]),ss=n.useMemo(()=>!Ge?.memberId||!h?.members?null:h.members.find(s=>s.id===Ge.memberId)??null,[Ge?.memberId,h?.members]),y=T?ts:S??null,V=y?.id,H=n.useMemo(()=>{if(y?.workspaceId)return y.workspaceId;if(!(!y||!o))return o.find(s=>s.sessions?.some(a=>a.id===y.id))?.id},[y,o]),ue=n.useCallback((s,a)=>{const m=(a&&o?.some(R=>R.id===a)?a:void 0)??H??B??void 0;m&&X(m),Ye.current+=1,Te({id:Ye.current,source:s,workspaceId:m}),C("workspace")},[H,B,o]),Ue=n.useCallback((s,a)=>{ue({kind:"web",url:s},a)},[ue]),qe=n.useCallback((s,a,u)=>{ue({kind:"visualization",sessionId:s,file:a},u)},[ue]),xt=n.useCallback(s=>{Ue(s,H)},[H,Ue]),pt=n.useCallback(s=>{V&&qe(V,s,H)},[V,H,qe]),{isActive:te,isCancelling:se}=Fs(V??"",y?.status),ns=n.useMemo(()=>!S||!o?!1:!o.some(a=>a.status==="ACTIVE"&&a.sessions?.some(u=>u.id===S.id)),[S,o]),{data:me}=bn(),[ht,as]=n.useState(null),xe=ht?.sessionId===j?ht.providerId:S?.providerId??null,pe=S?Ds(me,xe):void 0,rs=n.useCallback(s=>{as({sessionId:j,providerId:s})},[j]),F=Gs({agentType:S?.agentType,workingDir:A,input:b,setInput:N,textareaRef:Y,minHeight:40,maxHeight:140}),G=Js({agentType:S?.agentType,workingDir:A,input:b,setInput:N,textareaRef:Y,minHeight:40,maxHeight:140}),he=A&&w?w.id:void 0,fe=Us(),ft=gn(),O=qs(),{isConnected:gt,isLoadingSnapshot:bt,isOutputActive:vt,lastExitAt:jt,logs:ne,entries:is,attach:ge}=Ls({sessionId:de,sessionStatus:y?.status,sessionStartedAt:y?.startedAt??y?.createdAt,sessionEndedAt:y?.endedAt??(te?null:y?.updatedAt),onExit:n.useCallback(()=>{q.invalidateQueries({queryKey:["workspaces"]})},[q])}),{todos:be}=Ws(is),{files:ls,addFiles:ve,removeFile:os,clear:yt,buildMarkdownLinks:Nt,hasFiles:ae,isUploading:je}=zs(),cs=n.useMemo(()=>en(y),[y?.tokenUsage]),kt=Es(ne,cs);n.useEffect(()=>{de&&gt&&ge()},[de,gt,ge]);const wt=n.useRef(null);n.useEffect(()=>{if(wt.current!==t.id&&z.current){const s=z.current;requestAnimationFrame(()=>{s.scrollTop=s.scrollHeight})}wt.current=t.id},[t.id,z]);const Ve=n.useRef(!1),Ct=n.useCallback(async()=>{if(!b.trim()&&!ae||!j||Ve.current||O.isPending||se||je||pe)return;Ve.current=!0;const s=Nt(),a=[b.trim(),s].filter(Boolean).join(`
4
-
5
- `);N(""),yt(),Y.current&&(Y.current.style.height="40px"),fe.mutate({id:j,message:a,providerId:xe??void 0},{onSuccess:()=>ge(),onError:()=>N(u=>u||a),onSettled:()=>{Ve.current=!1}})},[b,j,fe,ge,ae,je,Nt,yt,xe,pe,O.isPending,se]),ds=n.useCallback(()=>{!j||O.isPending||O.mutate(j)},[j,O]),us=n.useCallback(s=>nt.mutateAsync(s),[nt]),It=n.useCallback(s=>{Re(s),C("chat"),requestAnimationFrame(()=>{oe()})},[oe]),ms=n.useCallback(()=>{Re(null)},[]),xs=n.useCallback(()=>{C("changes")},[]),St=ee&&E?e.jsx(tn,{projectId:t?.projectId??"",workspaceId:E,branchName:De,targetBranch:ze,commitMessage:rt,changes:it,gitStatus:P,isGitStatusLoading:Qt,canRunGitOperations:We,onOpenChanges:xs,onRefreshCommitMessage:mt,onConflict:Be,className:"mb-2"}):null,ps=n.useCallback(s=>{const a=s.target.files;a&&a.length>0&&ve(Array.from(a)),s.target.value=""},[ve]),hs=n.useCallback(s=>{const a=s.clipboardData.items,u=[];for(const m of a)if(m.kind==="file"){const R=m.getAsFile();R&&u.push(R)}u.length>0&&(s.preventDefault(),ve(u))},[ve]),fs=n.useCallback(s=>{N(s.target.value);const a=s.target;a.style.height="auto",a.style.height=`${Math.max(40,Math.min(a.scrollHeight,140))}px`},[]),gs=n.useCallback(()=>{he&&ft.mutate({workspaceId:he})},[ft,he]),re=n.useRef(null);return n.useEffect(()=>{const s=window.visualViewport;if(!s)return;let a=!1;const u=()=>{re.current&&(re.current.style.height=`${s.height}px`,re.current.style.top=`${s.offsetTop}px`)},m=()=>u(),R=()=>{a||u()},L=()=>{a=!0},p=()=>{a=!1,requestAnimationFrame(u)};return s.addEventListener("resize",m),s.addEventListener("scroll",R),document.addEventListener("touchstart",L,{passive:!0}),document.addEventListener("touchend",p,{passive:!0}),document.addEventListener("touchcancel",p,{passive:!0}),()=>{s.removeEventListener("resize",m),s.removeEventListener("scroll",R),document.removeEventListener("touchstart",L),document.removeEventListener("touchend",p),document.removeEventListener("touchcancel",p)}},[]),n.useEffect(()=>{const s=re.current;if(!s)return;const a=u=>{let m=u.target;for(;m&&m!==s;){if(m.tagName==="TEXTAREA"){if(m.scrollHeight>m.clientHeight)return;m=m.parentElement;continue}const L=window.getComputedStyle(m).overflowY;if((L==="auto"||L==="scroll")&&m.scrollHeight>m.clientHeight)return;m=m.parentElement}u.preventDefault()};return s.addEventListener("touchmove",a,{passive:!1}),()=>s.removeEventListener("touchmove",a)},[]),e.jsxs("div",{ref:re,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[e.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[e.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[e.jsx("button",{onClick:r,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:e.jsx(At,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(sn,{taskId:t.id,title:t.title,readOnly:k,titleClassName:"text-[13px] font-bold text-neutral-900 truncate leading-tight",compact:!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[e.jsx("span",{className:`truncate font-medium ${t.projectColor}`,children:t.projectName}),t.projectArchivedAt&&e.jsx("span",{className:"rounded-full bg-neutral-100 px-1.5 py-0.5 text-[10px] font-medium text-neutral-500",children:t.projectRepoDeletedAt?i("源码已删除"):i("已删除")}),e.jsx("span",{className:"text-neutral-300",children:"/"}),e.jsx("span",{className:"font-mono truncate",children:t.branch})]})]}),e.jsx(Dn,{status:t.status}),e.jsx(Vs,{value:t.priority,compact:!0,onChange:!k&&d?s=>d(t.id,s):void 0}),e.jsx("button",{onClick:gs,disabled:!he||k,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:e.jsx(pn,{size:16})}),c&&!k&&e.jsxs("div",{className:"relative",ref:Me,children:[e.jsx("button",{onClick:()=>Ae(s=>!s),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:e.jsx(nn,{size:16})}),Se&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:e.jsxs("button",{onClick:()=>{Ie(!0),Ae(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 active:bg-red-50",children:[e.jsx(jn,{size:15}),e.jsx("span",{children:i("删除任务")})]})})]})]}),e.jsx("div",{className:"flex border-t border-neutral-100",children:Oe.map(({key:s,label:a,icon:u})=>e.jsxs("button",{onClick:()=>C(s),className:`flex min-w-0 flex-1 items-center justify-center gap-1 px-1 py-2 text-[11px] font-medium transition-colors ${l===s?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[e.jsx(u,{size:13,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:i(a)})]},s))})]}),l==="chat"&&(h?e.jsx("main",{className:"flex-1 min-h-0 overflow-hidden",children:T?e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-white",children:[e.jsxs("div",{className:"relative z-20 flex shrink-0 items-center justify-between gap-3 overflow-visible border-b border-neutral-200 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-neutral-900",children:i("Invocation details")}),e.jsx("div",{className:"truncate text-[11px] text-neutral-500",children:T})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(an,{session:y,providers:me,usage:kt,compact:!0,providerIdFallback:ss?.providerId,agentTypeFallback:y?.agentType,tokenTooltipSide:"bottom"}),e.jsxs(He,{type:"button",size:"xs",variant:"ghost",className:"h-7 gap-1 rounded-lg border border-neutral-200/70 bg-white/60 px-1.5 text-[11px] font-medium text-neutral-500 hover:border-neutral-300 hover:bg-neutral-100 hover:text-neutral-900 active:bg-neutral-100",onClick:ms,children:[e.jsx(At,{size:12}),e.jsx("span",{children:i("Team room")})]})]})]}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:z,className:"h-full overflow-y-auto overflow-x-hidden scrollbar-app-thin overscroll-y-contain px-3 pt-3 pb-2",children:e.jsx("div",{ref:Je,children:bt?e.jsx(Ke,{label:i("Loading logs...")}):ne.length===0?e.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:i(te?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(Tt,{children:e.jsx(Rt,{logs:ne,downloadSessionId:V,isOutputActive:vt,lastExitAt:jt,onUserToggleDetails:tt,scrollElementRef:z,onOpenPreviewUrl:xt,onOpenVisualization:pt})})})}),!et&&e.jsxs("button",{onClick:()=>oe(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":i("Scroll to bottom"),children:[e.jsx(Pt,{size:12}),e.jsx("span",{children:i("回到底部")})]})]}),be.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:e.jsx(Et,{todos:be,compact:!0})})]}):e.jsx(rn,{teamRun:h,messages:$t??h.messages??[],readOnly:k,readOnlyMessage:Le,onSendMessage:us,onViewInvocationSession:It,changeSummaryBar:St,compactComposer:!0,workingDir:A,onOpenPreviewUrl:Ue,onOpenVisualization:qe})}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:z,className:"h-full overflow-y-auto overflow-x-hidden scrollbar-app-thin overscroll-y-contain px-3 pt-3 pb-2",children:e.jsxs("div",{ref:Je,children:[e.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:Kt?e.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:i("Loading...")}):J?.body?e.jsx("div",{className:"text-[13px] text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:e.jsx(As,{urlTransform:Wn,components:Rs,children:J.body})}):e.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),!k&&e.jsx(ln,{state:st,setupProgress:Z,sessionStarted:!!S?.startedAt,onRetry:j&&x?.status==="failed"?async()=>{await Fe(),le(!0)}:void 0,compact:!0},t.id),Ht?(!Pe||k)&&e.jsx(Ke,{label:"Loading..."}):j?bt?e.jsx(Ke,{label:"Loading logs..."}):ne.length===0?e.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:te?"Waiting for agent output...":"No logs recorded."}):e.jsx(Tt,{children:e.jsx(Rt,{logs:ne,downloadSessionId:V,isOutputActive:vt,lastExitAt:jt,onUserToggleDetails:tt,scrollElementRef:z,onOpenPreviewUrl:xt,onOpenVisualization:pt})}):!Pe||x?.status==="failed"||Z?.status==="failed"||k?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(!Pe||k)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:e.jsx($e,{size:20,className:"text-neutral-400 ml-0.5"})}),e.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:i("尚未启动 Agent")}),e.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:k?Le:i("选择一个 Agent 来执行此任务")})]}),!k&&(!x||x.status==="failed")&&e.jsxs(He,{onClick:async()=>{await Fe(),le(!0)},disabled:!!(x&&x.status!=="failed"),children:[e.jsx($e,{size:16,className:"mr-1.5"}),x?.status==="failed"?i("重试启动 Agent"):i("启动 Agent")]})]}):null]})}),!et&&e.jsxs("button",{onClick:()=>oe(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":"Scroll to bottom",children:[e.jsx(Pt,{size:12}),e.jsx("span",{children:i("回到底部")})]})]}),be.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:e.jsx(Et,{todos:be,compact:!0})}),k?e.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:e.jsx("div",{className:"rounded-xl border border-neutral-200 bg-neutral-50 px-3 py-2 text-xs text-neutral-500",children:Le})}):ns?e.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-neutral-200 bg-neutral-50 px-3 py-2",children:[e.jsx("span",{className:"text-xs text-neutral-500",children:i("代码已合并,以上为历史沟通记录")}),e.jsxs(He,{size:"sm",onClick:async()=>{await Fe(),le(!0)},children:[e.jsx($e,{size:14,className:"mr-1.5"}),i("启动新 Agent")]})]})}):j&&e.jsxs("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:[St,e.jsx(Ms,{sessionId:de||j,compact:!0}),e.jsxs("div",{ref:Ee,className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[e.jsx(Bs,{files:ls,onRemove:os}),e.jsx("textarea",{ref:Y,value:b,onChange:fs,onPaste:hs,onKeyDown:s=>{G.handleKeyDown(s)||F.handleKeyDown(s)||s.key==="Enter"&&!s.shiftKey&&!s.repeat&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229&&(s.preventDefault(),Ct())},rows:1,placeholder:te?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-neutral-900 placeholder-neutral-400",style:{minHeight:40,maxHeight:140}}),e.jsx("input",{ref:Ze,type:"file",multiple:!0,className:"hidden",onChange:ps}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[e.jsx("div",{className:"flex items-center gap-0.5",children:e.jsx("button",{onClick:()=>Ze.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:e.jsx(yn,{size:15})})}),e.jsxs("div",{className:"flex items-center gap-1",children:[S&&me&&e.jsx(Ps,{providers:me,currentProviderId:xe,agentType:S.agentType,runtimeType:S.runtimeType,onSelect:rs}),e.jsx(Os,{usage:kt}),te&&!b.trim()&&!ae?e.jsx("button",{onClick:ds,disabled:O.isPending||se,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:e.jsx(Cs,{size:12})}):e.jsx("button",{onClick:Ct,disabled:!b.trim()&&!ae||je||fe.isPending||O.isPending||se||!!pe,className:`p-1.5 rounded-lg transition-colors ${(b.trim()||ae)&&!je&&!fe.isPending&&!O.isPending&&!se&&!pe?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:e.jsx(Nn,{size:15})})]})]})]}),e.jsx(Mt,{open:F.query!==null,anchorRef:Ee,commands:F.filteredCommands,selectedIndex:F.selectedIndex,query:F.query??"",hasCatalog:F.allCommands.length>0,compact:!0,onSelect:F.applyCommand}),e.jsx(Mt,{open:G.query!==null,anchorRef:Ee,commands:G.filteredSkills,selectedIndex:G.selectedIndex,query:G.query??"",hasCatalog:G.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",compact:!0,onSelect:G.applySkill})]})]})),l==="team-status"&&h&&e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(on,{teamRun:h,workspaces:o,selectedWorkspaceId:B,onSelectWorkspace:X,onViewInvocationSession:It})}),l==="changes"&&M&&e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[o&&o.length>1&&e.jsx("div",{className:"shrink-0 border-b border-neutral-100 bg-white px-3 py-2",children:e.jsx(cn,{workspaces:o,teamRun:h,selectedWorkspaceId:B,onSelectWorkspace:X,className:"w-full",buttonClassName:"w-full max-w-none min-w-0 justify-start"})}),We&&E&&e.jsx("div",{className:"shrink-0",children:e.jsx(dn,{projectId:t.projectId,workspaceId:E,branchName:De,targetBranch:ze,commitMessage:rt,committedFileCount:Xt,onRefreshCommitMessage:mt,onConflict:Be,onResolveConflicts:()=>Be()})}),e.jsx(Sn,{workingDir:A})]}),l==="history"&&e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsx(On,{workingDir:A})}),l==="workspace"&&e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(un,{sessionId:j||void 0,workspaceId:B,workingDir:A,projectId:t.projectId,className:"h-full",hideChanges:!0,gitAvailable:M,readOnly:k,repoDeleted:at,previewRequest:Vt,onPreviewRequestHandled:s=>{Te(a=>a?.id===s?void 0:a)}})}),!k&&e.jsx(mn,{isOpen:Ut,onClose:()=>le(!1),taskId:t.id,projectId:t.projectId,taskTitle:J?.title??t.title,taskDescription:J?.body??"",taskPrompt:J?.prompt,projectIsGitRepo:t.isGitRepo,projectWorktreeReady:t.worktreeReady,projectGitReason:t.reason,onStarted:()=>f?.(t.id)}),e.jsx(vn,{isOpen:qt,onClose:()=>Ie(!1),onConfirm:()=>{c?.(t.id),Ie(!1)},taskId:t.id,taskTitle:t.title,workspaces:o,isLoading:v}),lt&&I&&ut&&e.jsx(xn,{open:lt,onOpenChange:s=>{ot(s),s||dt(null)},workspaceId:ut,conflictOp:I.conflictOp,conflictedFiles:I.conflictedFiles,sourceBranch:Zt,targetBranch:Jt,operation:P?.operation,worktreePath:Yt,mergeAborted:I.mergeAborted,mergeStrategy:I.mergeStrategy,sourceWorkspaceId:I.sourceWorkspaceId,targetWorkspaceId:I.targetWorkspaceId,sourceWorktreePath:I.sourceWorktreePath,targetWorktreePath:I.targetWorktreePath,sessions:es,currentSessionId:h?void 0:j,teamRunId:h?.id})]})}function Ke({label:t}){return e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:t})]})}export{Sa as MobileTaskDetail};
@@ -1 +0,0 @@
1
- import{m as F,o as P,n as k,q as v,p as h,u as R,r as o,j as e,S as g,U as B,h as q,i as j,V as W,I as d,B as z,E as L,W as A,k as K,Y as M}from"./index-CMJV-mgF.js";import{S as Q}from"./select-DKS02St6.js";import{S as O}from"./switch-7LWQ_sEx.js";import{M as D}from"./message-square-CFriSt4D.js";import{C as H}from"./circle-alert-Cbvy2cMo.js";import{L as V}from"./link-BUeSP3T7.js";import"./chevron-down-BaQEBzp3.js";import"./check-qs0S_9rB.js";function Y(){return F({queryKey:v.notifications.settings,queryFn:()=>h.get("/notifications/settings")})}function G(){const t=P();return k({mutationFn:a=>h.put("/notifications/settings",a),onSuccess:()=>{t.invalidateQueries({queryKey:v.notifications.settings})}})}function J(){return k({mutationFn:t=>h.post("/notifications/test",t)})}function ae(){const{t}=R(),{data:a,isLoading:T}=Y(),l=G(),n=J(),N=[{value:"none",label:t("关闭")},{value:"feishu",label:t("飞书 Webhook")}],[i,x]=o.useState({webhookUrl:"",baseUrl:"",titleTemplate:"",bodyTemplate:""}),[m,p]=o.useState(!1),[f,r]=o.useState("idle"),u=o.useRef(void 0);if(o.useEffect(()=>{a&&!m&&x({webhookUrl:a.feishuWebhookUrl??"",baseUrl:a.thirdPartyBaseUrl??"",titleTemplate:a.taskInReviewTitleTemplate??"",bodyTemplate:a.taskInReviewBodyTemplate??""})},[a,m]),o.useEffect(()=>(n.isSuccess?(r("success"),u.current=setTimeout(()=>r("idle"),3e3)):n.isError&&(r("error"),u.current=setTimeout(()=>r("idle"),5e3)),()=>clearTimeout(u.current)),[n.isSuccess,n.isError]),T)return e.jsx(g,{children:e.jsx(B,{rows:3})});const y=a?.osNotificationEnabled??!0,b=a?.thirdPartyChannel??"none",c=(s,I)=>{x(E=>({...E,[s]:I})),p(!0)},S=s=>{l.mutate({osNotificationEnabled:s})},C=s=>{l.mutate({thirdPartyChannel:s})},U=()=>{l.mutate({feishuWebhookUrl:i.webhookUrl.trim()||null,thirdPartyBaseUrl:i.baseUrl.trim()||null,taskInReviewTitleTemplate:i.titleTemplate.trim()||"Agent Tower",taskInReviewBodyTemplate:i.bodyTemplate.trim()||t('✅ "{taskTitle}" 已完成,等待审查')},{onSuccess:()=>p(!1)})},w=()=>{i.webhookUrl.trim()&&n.mutate({channel:"feishu",webhookUrl:i.webhookUrl.trim(),baseUrl:i.baseUrl.trim()||void 0})};return e.jsxs(g,{children:[e.jsx(q,{title:t("通知设置"),className:"mb-1"}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsx(j,{icon:W,label:t("桌面通知"),description:t("任务完成时弹出系统通知"),align:"center",controlWidth:"auto",children:e.jsx(O,{checked:y,onCheckedChange:S,"aria-label":t("桌面通知")})}),e.jsxs("div",{className:"py-5",children:[e.jsx(j,{icon:D,label:t("第三方通知"),description:t("推送到外部渠道(飞书群机器人等)"),align:"center",className:"py-0",children:e.jsx(Q,{value:b,onChange:s=>C(s),options:N})}),b==="feishu"&&e.jsxs("div",{className:"mt-4 space-y-4 sm:pl-11",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-webhook-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Webhook URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"feishu-webhook-url",value:i.webhookUrl,onChange:s=>c("webhookUrl",s.target.value),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"min-w-0 flex-1 font-mono"}),e.jsxs(z,{size:"sm",variant:"outline",onClick:w,disabled:!i.webhookUrl.trim()||n.isPending,className:"h-auto shrink-0",children:[n.isPending&&e.jsx(L,{size:12,className:"mr-1 animate-spin motion-reduce:animate-none"}),t("测试")]})]}),f==="success"&&e.jsxs("div",{role:"status",className:"mt-2 flex items-center gap-1.5 text-xs text-success",children:[e.jsx(A,{size:12,"aria-hidden":"true"}),t("测试消息发送成功")]}),f==="error"&&e.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-xs text-destructive",children:[e.jsx(H,{size:12,"aria-hidden":"true"}),t("发送失败,请检查 Webhook 地址")]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-base-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(V,{size:11,"aria-hidden":"true"}),t("跳转地址")]})}),e.jsx(d,{id:"feishu-base-url",value:i.baseUrl,onChange:s=>c("baseUrl",s.target.value),placeholder:"http://localhost:5173",className:"font-mono"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t('通知卡片中的"查看任务"按钮跳转地址前缀')})]})]})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(K,{children:t("通知模板")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("支持变量: {taskTitle}, {taskId}, {projectId}, {projectName}, {status}",{taskTitle:"{taskTitle}",taskId:"{taskId}",projectId:"{projectId}",projectName:"{projectName}",status:"{status}"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-title-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("标题")}),e.jsx(d,{id:"notification-title-template",value:i.titleTemplate,onChange:s=>c("titleTemplate",s.target.value),placeholder:"Agent Tower"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-body-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("内容")}),e.jsx(d,{id:"notification-body-template",value:i.bodyTemplate,onChange:s=>c("bodyTemplate",s.target.value),placeholder:t('✅ "{taskTitle}" 已完成,等待审查')})]})]})]})]}),m&&e.jsx(M,{saving:l.isPending,onSave:U})]})}export{ae as NotificationSettingsPage};
@@ -1,3 +0,0 @@
1
- import{u as T,r as g,j as e,S,h as J,v as M,w,I as U,B as E,x as p,l as P}from"./index-CMJV-mgF.js";import{u as _,a as z,b as B,c as F}from"./use-profiles-nMPGwy3v.js";import{M as G}from"./modal-DeigO7aN.js";import{C as $}from"./confirm-dialog-BrgNTypL.js";import{T as R}from"./textarea-Ft9KMoEI.js";import{L as H}from"./layers-Dda7MM7a.js";import{C as q}from"./chevron-down-BaQEBzp3.js";import{P as K,T as Q}from"./trash-2-Bc-URu8c.js";import{P as W}from"./pencil-BRQ9W_a-.js";function X(t){const a=Object.entries(t);return a.length===0?"(empty)":a.map(([m,c])=>`${m}: ${JSON.stringify(c)}`).join(", ")}const y={CLAUDE_CODE:"Claude Code",GEMINI_CLI:"Gemini CLI",CURSOR_AGENT:"Cursor Agent"};function Y({agentType:t,variants:a,isBuiltIn:m,onEdit:c,onNew:h,onDelete:j}){const{t:n}=T(),[r,b]=g.useState(!0),u=Object.entries(a);return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 bg-muted/40 px-4 py-3",children:[e.jsxs("button",{type:"button",onClick:()=>b(i=>!i),"aria-expanded":r,className:"flex items-center gap-3 rounded-md transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:y[t]??t}),e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[u.length," ",n("个变体")]}),e.jsx(q,{size:14,"aria-hidden":"true",className:P("text-muted-foreground transition-transform motion-reduce:transition-none",r&&"rotate-180")})]}),e.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsx(K,{size:12,"aria-hidden":"true"}),n("新增")]})]}),r&&e.jsxs("div",{className:"divide-y divide-border/60",children:[u.map(([i,x])=>{const f=m(i);return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-muted/40",children:[e.jsx("span",{className:P("inline-flex shrink-0 items-center rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide",i==="DEFAULT"?"bg-primary/[0.06] text-primary":"bg-muted text-muted-foreground"),children:i}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:X(x)}),f&&e.jsx("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground/70",children:n("内置")}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx("button",{onClick:()=>c(i,x),className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",title:n("编辑"),"aria-label":n("编辑"),children:e.jsx(W,{size:12})}),!f&&e.jsx("button",{onClick:()=>j(i),className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",title:n("删除"),"aria-label":n("删除"),children:e.jsx(Q,{size:12})})]})]},i)}),u.length===0&&e.jsx("div",{className:"px-4 py-4 text-center text-xs text-muted-foreground",children:n("暂无变体")})]})]})}function Z(){return e.jsxs("div",{role:"status","aria-label":"Loading",children:[e.jsx(p,{className:"h-7 w-36"}),e.jsx(p,{className:"mt-2 h-3.5 w-72 max-w-full"}),e.jsx("div",{className:"mt-5 space-y-3",children:Array.from({length:2}).map((t,a)=>e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center gap-3 bg-muted/40 px-4 py-3",children:[e.jsx(p,{className:"h-4 w-28"}),e.jsx(p,{className:"h-3 w-14"})]}),e.jsx("div",{className:"divide-y divide-border/60",children:Array.from({length:2}).map((m,c)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[e.jsx(p,{className:"h-5 w-16 rounded"}),e.jsx(p,{className:"h-3.5 flex-1"})]},c))})]},a))})]})}function de(){const{t}=T(),{data:a,isLoading:m}=_(),{data:c}=z(),h=B(),j=F(),[n,r]=g.useState(null),[b,u]=g.useState(""),[i,x]=g.useState(""),[f,v]=g.useState(""),[o,N]=g.useState(null),k=(s,l,d)=>{r({agentType:s,variant:l,config:d,isNew:!1}),x(l),u(JSON.stringify(d,null,2)),v("")},O=s=>{r({agentType:s,variant:"",config:{},isNew:!0}),x(""),u(`{
2
-
3
- }`),v("")},D=()=>{if(!(!n||!i.trim()))try{const s=JSON.parse(b);v(""),h.mutate({agentType:n.agentType,variant:i.trim().toUpperCase(),config:s},{onSuccess:()=>r(null)})}catch{v(t("JSON 格式错误"))}},L=(s,l)=>{N({agentType:s,variant:l})},A=()=>{o&&j.mutate({agentType:o.agentType,variant:o.variant},{onSettled:()=>N(null)})},I=(s,l)=>!!c?.executors[s]?.[l];if(m)return e.jsx(S,{children:e.jsx(Z,{})});const C=a?.executors??{};return e.jsxs(S,{children:[e.jsx(J,{title:t("Profile 配置"),description:t("管理 Agent 执行器的配置变体。每个变体定义一组运行参数。"),className:"mb-4"}),e.jsx("div",{className:"space-y-3",children:Object.entries(C).map(([s,l])=>e.jsx(Y,{agentType:s,variants:l,isBuiltIn:d=>I(s,d),onEdit:(d,V)=>k(s,d,V),onNew:()=>O(s),onDelete:d=>L(s,d)},s))}),Object.keys(C).length===0&&e.jsx(M,{icon:H,message:t("暂无 Profile 配置")}),e.jsx(G,{isOpen:!!n,onClose:()=>r(null),title:n?.isNew?t("新增 Variant — {agentType}",{agentType:y[n.agentType]??n.agentType}):t("编辑 {variant}",{variant:n?.variant??""}),action:e.jsxs(e.Fragment,{children:[e.jsx(E,{variant:"outline",onClick:()=>r(null),children:t("取消")}),e.jsx(E,{onClick:D,disabled:h.isPending,children:h.isPending?t("保存中..."):t("保存")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{label:t("Variant 名称"),htmlFor:"profile-variant-name",children:e.jsx(U,{id:"profile-variant-name",value:i,onChange:s=>x(s.target.value),disabled:!n?.isNew,placeholder:t("例如: CUSTOM"),className:"font-mono"})}),e.jsxs(w,{label:t("配置 (JSON)"),htmlFor:"profile-variant-json",children:[e.jsx(R,{id:"profile-variant-json",value:b,onChange:s=>{u(s.target.value),v("")},rows:6,className:"resize-none font-mono","aria-invalid":!!f}),f&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:f})]})]})}),e.jsx($,{isOpen:o!==null,onClose:()=>{j.isPending||N(null)},onConfirm:A,title:t("删除 Profile Variant"),description:o?t('确定删除 "{name}"?此操作不可撤销。',{name:`${y[o.agentType]??o.agentType} / ${o.variant}`}):"",confirmText:t("删除"),cancelText:t("取消"),variant:"danger",isLoading:j.isPending})]})}export{de as ProfileSettingsPage};
@@ -1,12 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TaskDetail-B3pOSx3f.js","assets/index-CMJV-mgF.js","assets/index-BnqdwOEH.css","assets/agent-meta-MzuGtqxl.js","assets/mermaid-NOHMQCX5-C72362la.js","assets/use-attachments-EypT-7PI.js","assets/chevron-down-BaQEBzp3.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/useTokenUsage-4qTDa8SY.js","assets/CreateTaskInput-GLF3Oyc1.js","assets/use-projects-DI27nNwl.js","assets/MemberAvatar-CCRbS97s.js","assets/use-providers-DB9ghBPq.js","assets/check-qs0S_9rB.js","assets/trash-2-Bc-URu8c.js","assets/AgentLogo-BDyW3ihb.js","assets/ExecutionPermissionSelector-DeeNd4Kh.js","assets/task-priority-acVgTiil.js","assets/BrandLogo-YGT4Vlw5.js","assets/paperclip-BOSklTt7.js","assets/gauge-CPlvCZUV.js","assets/useNormalizedLogs-DRoPbP0w.js","assets/EditableTaskTitle-mHT39coo.js","assets/chevron-up-D0y6skqr.js","assets/arrow-down-BVePf1ZM.js","assets/at-sign-BE17rU5b.js","assets/confirm-dialog-BrgNTypL.js","assets/modal-DeigO7aN.js","assets/select-DKS02St6.js","assets/layers-Dda7MM7a.js","assets/message-square-CFriSt4D.js","assets/textarea-Ft9KMoEI.js","assets/play-Mxkwq69n.js","assets/server-DJaSJ9m1.js","assets/task-CDYaC_No.js","assets/status-styles-sQm4KLdp.js","assets/copy-DejkmIHZ.js","assets/use-workspaces-d4n9m9cX.js","assets/circle-alert-Cbvy2cMo.js","assets/upload-C9Z4jLtv.js","assets/globe-CD4g63c9.js","assets/BranchSelect-Dmp5hq0i.js","assets/pencil-BRQ9W_a-.js","assets/EditableTaskTitle-DcpNTP1B.css","assets/MobileTaskDetail-BOIFPybn.js"])))=>i.map(i=>d[i]);
2
- import{c as Gr,r as u,au as z,D as He,u as Me,j as o,l as me,av as Wr,af as or,aj as Qr,m as Yr,o as Ft,n as fn,q as he,p as $e,E as Cn,T as Hr,X as Sn,ak as Xr,t as ze,aw as qr,a1 as Vr,ax as Jr,ay as Zr,az as es,ah as En,ai as Nn,aA as ir}from"./index-CMJV-mgF.js";import{S as Rn,C as ts,T as Tt,a as et,f as De,A as Re}from"./agent-meta-MzuGtqxl.js";import{C as ns}from"./confirm-dialog-BrgNTypL.js";import{a as rs,F as ss}from"./use-workspaces-d4n9m9cX.js";import{S as mt,U as ne,a as os,F as is}from"./status-styles-sQm4KLdp.js";import{h as jn,i as as,c as ls,C as kn}from"./CreateTaskInput-GLF3Oyc1.js";import{T as cs,S as ar}from"./task-priority-acVgTiil.js";import{C as gt}from"./check-qs0S_9rB.js";import{T as us,P as ds}from"./trash-2-Bc-URu8c.js";import{S as fs,B as Tn}from"./BrandLogo-YGT4Vlw5.js";import{M as hs}from"./message-square-CFriSt4D.js";import{L as nn}from"./layers-Dda7MM7a.js";import{e as ms,a as gs}from"./use-projects-DI27nNwl.js";import{C as An}from"./copy-DejkmIHZ.js";import{u as ps}from"./use-providers-DB9ghBPq.js";import{M as Dn}from"./modal-DeigO7aN.js";import{a as Ht}from"./ExecutionPermissionSelector-DeeNd4Kh.js";import{C as vs}from"./chevron-down-BaQEBzp3.js";const xs=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Mn=Gr("smartphone",xs),_t=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function hn(e){return"nodeType"in e}function ve(e){var t,n;return e?tt(e)?e:hn(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mn(e){const{Document:t}=ve(e);return e instanceof t}function bt(e){return tt(e)?!1:e instanceof ve(e).HTMLElement}function lr(e){return e instanceof ve(e).SVGElement}function nt(e){return e?tt(e)?e.document:hn(e)?mn(e)?e:bt(e)||lr(e)?e.ownerDocument:document:document:document}const Fe=_t?u.useLayoutEffect:u.useEffect;function Bt(e){const t=u.useRef(e);return Fe(()=>{t.current=e}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),c=0;c<n;c++)r[c]=arguments[c];return t.current==null?void 0:t.current(...r)},[])}function bs(){const e=u.useRef(null),t=u.useCallback((r,c)=>{e.current=setInterval(r,c)},[]),n=u.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function pt(e,t){t===void 0&&(t=[e]);const n=u.useRef(e);return Fe(()=>{n.current!==e&&(n.current=e)},t),n}function yt(e,t){const n=u.useRef();return u.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function At(e){const t=Bt(e),n=u.useRef(null),r=u.useCallback(c=>{c!==n.current&&t?.(c,n.current),n.current=c},[]);return[n,r]}function Dt(e){const t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}let Xt={};function Ut(e,t){return u.useMemo(()=>{if(t)return t;const n=Xt[e]==null?0:Xt[e]+1;return Xt[e]=n,e+"-"+n},[e,t])}function cr(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),c=1;c<n;c++)r[c-1]=arguments[c];return r.reduce((a,h)=>{const f=Object.entries(h);for(const[s,i]of f){const l=a[s];l!=null&&(a[s]=l+e*i)}return a},{...t})}}const Ze=cr(1),Mt=cr(-1);function ys(e){return"clientX"in e&&"clientY"in e}function gn(e){if(!e)return!1;const{KeyboardEvent:t}=ve(e.target);return t&&e instanceof t}function ws(e){if(!e)return!1;const{TouchEvent:t}=ve(e.target);return t&&e instanceof t}function It(e){if(ws(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ys(e)?{x:e.clientX,y:e.clientY}:null}const vt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[vt.Translate.toString(e),vt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),In="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Cs(e){return e.matches(In)?e:e.querySelector(In)}const Ss={display:"none"};function Es(e){let{id:t,value:n}=e;return z.createElement("div",{id:t,style:Ss},n)}function Ns(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const c={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return z.createElement("div",{id:t,style:c,role:"status","aria-live":r,"aria-atomic":!0},n)}function Rs(){const[e,t]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const ur=u.createContext(null);function js(e){const t=u.useContext(ur);u.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ks(){const[e]=u.useState(()=>new Set),t=u.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[u.useCallback(r=>{let{type:c,event:a}=r;e.forEach(h=>{var f;return(f=h[c])==null?void 0:f.call(h,a)})},[e]),t]}const Ts={draggable:`
3
- To pick up a draggable item, press the space bar.
4
- While dragging, use the arrow keys to move the item.
5
- Press space again to drop the item in its new position, or press escape to cancel.
6
- `},As={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Ds(e){let{announcements:t=As,container:n,hiddenTextDescribedById:r,screenReaderInstructions:c=Ts}=e;const{announce:a,announcement:h}=Rs(),f=Ut("DndLiveRegion"),[s,i]=u.useState(!1);if(u.useEffect(()=>{i(!0)},[]),js(u.useMemo(()=>({onDragStart(d){let{active:m}=d;a(t.onDragStart({active:m}))},onDragMove(d){let{active:m,over:p}=d;t.onDragMove&&a(t.onDragMove({active:m,over:p}))},onDragOver(d){let{active:m,over:p}=d;a(t.onDragOver({active:m,over:p}))},onDragEnd(d){let{active:m,over:p}=d;a(t.onDragEnd({active:m,over:p}))},onDragCancel(d){let{active:m,over:p}=d;a(t.onDragCancel({active:m,over:p}))}}),[a,t])),!s)return null;const l=z.createElement(z.Fragment,null,z.createElement(Es,{id:r,value:c.draggable}),z.createElement(Ns,{id:f,announcement:h}));return n?He.createPortal(l,n):l}var le;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(le||(le={}));function Pt(){}function Ms(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Is(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const je=Object.freeze({x:0,y:0});function Ps(e,t){const n=It(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Os(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Ls(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function zs(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),c=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),h=c-r,f=a-n;if(r<c&&n<a){const s=t.width*t.height,i=e.width*e.height,l=h*f,d=l/(s+i-l);return Number(d.toFixed(4))}return 0}const Fs=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const c=[];for(const a of r){const{id:h}=a,f=n.get(h);if(f){const s=zs(f,t);s>0&&c.push({id:h,data:{droppableContainer:a,value:s}})}}return c.sort(Os)};function _s(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function dr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:je}function Bs(e){return function(n){for(var r=arguments.length,c=new Array(r>1?r-1:0),a=1;a<r;a++)c[a-1]=arguments[a];return c.reduce((h,f)=>({...h,top:h.top+e*f.y,bottom:h.bottom+e*f.y,left:h.left+e*f.x,right:h.right+e*f.x}),{...n})}}const Us=Bs(1);function fr(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function $s(e,t,n){const r=fr(t);if(!r)return e;const{scaleX:c,scaleY:a,x:h,y:f}=r,s=e.left-h-(1-c)*parseFloat(n),i=e.top-f-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),l=c?e.width/c:e.width,d=a?e.height/a:e.height;return{width:l,height:d,top:i,right:s+l,bottom:i+d,left:s}}const Ks={ignoreTransform:!1};function wt(e,t){t===void 0&&(t=Ks);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:i,transformOrigin:l}=ve(e).getComputedStyle(e);i&&(n=$s(n,i,l))}const{top:r,left:c,width:a,height:h,bottom:f,right:s}=n;return{top:r,left:c,width:a,height:h,bottom:f,right:s}}function Pn(e){return wt(e,{ignoreTransform:!0})}function Gs(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ws(e,t){return t===void 0&&(t=ve(e).getComputedStyle(e)),t.position==="fixed"}function Qs(e,t){t===void 0&&(t=ve(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(c=>{const a=t[c];return typeof a=="string"?n.test(a):!1})}function pn(e,t){const n=[];function r(c){if(t!=null&&n.length>=t||!c)return n;if(mn(c)&&c.scrollingElement!=null&&!n.includes(c.scrollingElement))return n.push(c.scrollingElement),n;if(!bt(c)||lr(c)||n.includes(c))return n;const a=ve(e).getComputedStyle(c);return c!==e&&Qs(c,a)&&n.push(c),Ws(c,a)?n:r(c.parentNode)}return e?r(e):n}function hr(e){const[t]=pn(e,1);return t??null}function qt(e){return!_t||!e?null:tt(e)?e:hn(e)?mn(e)||e===nt(e).scrollingElement?window:bt(e)?e:null:null}function mr(e){return tt(e)?e.scrollX:e.scrollLeft}function gr(e){return tt(e)?e.scrollY:e.scrollTop}function rn(e){return{x:mr(e),y:gr(e)}}var ue;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ue||(ue={}));function pr(e){return!_t||!e?!1:e===document.scrollingElement}function vr(e){const t={x:0,y:0},n=pr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},c=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,h=e.scrollTop>=r.y,f=e.scrollLeft>=r.x;return{isTop:c,isLeft:a,isBottom:h,isRight:f,maxScroll:r,minScroll:t}}const Ys={x:.2,y:.2};function Hs(e,t,n,r,c){let{top:a,left:h,right:f,bottom:s}=n;r===void 0&&(r=10),c===void 0&&(c=Ys);const{isTop:i,isBottom:l,isLeft:d,isRight:m}=vr(e),p={x:0,y:0},g={x:0,y:0},v={height:t.height*c.y,width:t.width*c.x};return!i&&a<=t.top+v.height?(p.y=ue.Backward,g.y=r*Math.abs((t.top+v.height-a)/v.height)):!l&&s>=t.bottom-v.height&&(p.y=ue.Forward,g.y=r*Math.abs((t.bottom-v.height-s)/v.height)),!m&&f>=t.right-v.width?(p.x=ue.Forward,g.x=r*Math.abs((t.right-v.width-f)/v.width)):!d&&h<=t.left+v.width&&(p.x=ue.Backward,g.x=r*Math.abs((t.left+v.width-h)/v.width)),{direction:p,speed:g}}function Xs(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:h}=window;return{top:0,left:0,right:a,bottom:h,width:a,height:h}}const{top:t,left:n,right:r,bottom:c}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:c,width:e.clientWidth,height:e.clientHeight}}function xr(e){return e.reduce((t,n)=>Ze(t,rn(n)),je)}function qs(e){return e.reduce((t,n)=>t+mr(n),0)}function Vs(e){return e.reduce((t,n)=>t+gr(n),0)}function br(e,t){if(t===void 0&&(t=wt),!e)return;const{top:n,left:r,bottom:c,right:a}=t(e);hr(e)&&(c<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Js=[["x",["left","right"],qs],["y",["top","bottom"],Vs]];class vn{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=pn(n),c=xr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,h,f]of Js)for(const s of h)Object.defineProperty(this,s,{get:()=>{const i=f(r),l=c[a]-i;return this.rect[s]+l},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class dt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var c;(c=this.target)==null||c.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Zs(e){const{EventTarget:t}=ve(e);return e instanceof t?e:nt(e)}function Vt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Se;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Se||(Se={}));function On(e){e.preventDefault()}function eo(e){e.stopPropagation()}var q;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(q||(q={}));const yr={start:[q.Space,q.Enter],cancel:[q.Esc],end:[q.Space,q.Enter,q.Tab]},to=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case q.Right:return{...n,x:n.x+25};case q.Left:return{...n,x:n.x-25};case q.Down:return{...n,y:n.y+25};case q.Up:return{...n,y:n.y-25}}};class wr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new dt(nt(n)),this.windowListeners=new dt(ve(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Se.Resize,this.handleCancel),this.windowListeners.add(Se.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Se.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&br(r),n(je)}handleKeyDown(t){if(gn(t)){const{active:n,context:r,options:c}=this.props,{keyboardCodes:a=yr,coordinateGetter:h=to,scrollBehavior:f="smooth"}=c,{code:s}=t;if(a.end.includes(s)){this.handleEnd(t);return}if(a.cancel.includes(s)){this.handleCancel(t);return}const{collisionRect:i}=r.current,l=i?{x:i.left,y:i.top}:je;this.referenceCoordinates||(this.referenceCoordinates=l);const d=h(t,{active:n,context:r.current,currentCoordinates:l});if(d){const m=Mt(d,l),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const v of g){const x=t.code,{isTop:S,isRight:y,isLeft:b,isBottom:E,maxScroll:R,minScroll:D}=vr(v),j=Xs(v),C={x:Math.min(x===q.Right?j.right-j.width/2:j.right,Math.max(x===q.Right?j.left:j.left+j.width/2,d.x)),y:Math.min(x===q.Down?j.bottom-j.height/2:j.bottom,Math.max(x===q.Down?j.top:j.top+j.height/2,d.y))},P=x===q.Right&&!y||x===q.Left&&!b,k=x===q.Down&&!E||x===q.Up&&!S;if(P&&C.x!==d.x){const T=v.scrollLeft+m.x,F=x===q.Right&&T<=R.x||x===q.Left&&T>=D.x;if(F&&!m.y){v.scrollTo({left:T,behavior:f});return}F?p.x=v.scrollLeft-T:p.x=x===q.Right?v.scrollLeft-R.x:v.scrollLeft-D.x,p.x&&v.scrollBy({left:-p.x,behavior:f});break}else if(k&&C.y!==d.y){const T=v.scrollTop+m.y,F=x===q.Down&&T<=R.y||x===q.Up&&T>=D.y;if(F&&!m.x){v.scrollTo({top:T,behavior:f});return}F?p.y=v.scrollTop-T:p.y=x===q.Down?v.scrollTop-R.y:v.scrollTop-D.y,p.y&&v.scrollBy({top:-p.y,behavior:f});break}}this.handleMove(t,Ze(Mt(d,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}wr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=yr,onActivation:c}=t,{active:a}=n;const{code:h}=e.nativeEvent;if(r.start.includes(h)){const f=a.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),c?.({event:e.nativeEvent}),!0)}return!1}}];function Ln(e){return!!(e&&"distance"in e)}function zn(e){return!!(e&&"delay"in e)}class xn{constructor(t,n,r){var c;r===void 0&&(r=Zs(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:a}=t,{target:h}=a;this.props=t,this.events=n,this.document=nt(h),this.documentListeners=new dt(this.document),this.listeners=new dt(r),this.windowListeners=new dt(ve(h)),this.initialCoordinates=(c=It(a))!=null?c:je,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Se.Resize,this.handleCancel),this.windowListeners.add(Se.DragStart,On),this.windowListeners.add(Se.VisibilityChange,this.handleCancel),this.windowListeners.add(Se.ContextMenu,On),this.documentListeners.add(Se.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Ln(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:c}=this.props;c(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Se.Click,eo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Se.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:c,props:a}=this,{onMove:h,options:{activationConstraint:f}}=a;if(!c)return;const s=(n=It(t))!=null?n:je,i=Mt(c,s);if(!r&&f){if(Ln(f)){if(f.tolerance!=null&&Vt(i,f.tolerance))return this.handleCancel();if(Vt(i,f.distance))return this.handleStart()}if(zn(f)&&Vt(i,f.tolerance))return this.handleCancel();this.handlePending(f,i);return}t.cancelable&&t.preventDefault(),h(s)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===q.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const no={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class bn extends xn{constructor(t){const{event:n}=t,r=nt(n.target);super(t,no,r)}}bn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const ro={move:{name:"mousemove"},end:{name:"mouseup"}};var sn;(function(e){e[e.RightClick=2]="RightClick"})(sn||(sn={}));class so extends xn{constructor(t){super(t,ro,nt(t.event.target))}}so.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===sn.RightClick?!1:(r?.({event:n}),!0)}}];const Jt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class oo extends xn{constructor(t){super(t,Jt)}static setup(){return window.addEventListener(Jt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Jt.move.name,t)};function t(){}}}oo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:c}=n;return c.length>1?!1:(r?.({event:n}),!0)}}];var ft;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ft||(ft={}));var Ot;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ot||(Ot={}));function io(e){let{acceleration:t,activator:n=ft.Pointer,canScroll:r,draggingRect:c,enabled:a,interval:h=5,order:f=Ot.TreeOrder,pointerCoordinates:s,scrollableAncestors:i,scrollableAncestorRects:l,delta:d,threshold:m}=e;const p=lo({delta:d,disabled:!a}),[g,v]=bs(),x=u.useRef({x:0,y:0}),S=u.useRef({x:0,y:0}),y=u.useMemo(()=>{switch(n){case ft.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case ft.DraggableRect:return c}},[n,c,s]),b=u.useRef(null),E=u.useCallback(()=>{const D=b.current;if(!D)return;const j=x.current.x*S.current.x,C=x.current.y*S.current.y;D.scrollBy(j,C)},[]),R=u.useMemo(()=>f===Ot.TreeOrder?[...i].reverse():i,[f,i]);u.useEffect(()=>{if(!a||!i.length||!y){v();return}for(const D of R){if(r?.(D)===!1)continue;const j=i.indexOf(D),C=l[j];if(!C)continue;const{direction:P,speed:k}=Hs(D,C,y,t,m);for(const T of["x","y"])p[T][P[T]]||(k[T]=0,P[T]=0);if(k.x>0||k.y>0){v(),b.current=D,g(E,h),x.current=k,S.current=P;return}}x.current={x:0,y:0},S.current={x:0,y:0},v()},[t,E,r,v,a,h,JSON.stringify(y),JSON.stringify(p),g,i,R,l,JSON.stringify(m)])}const ao={x:{[ue.Backward]:!1,[ue.Forward]:!1},y:{[ue.Backward]:!1,[ue.Forward]:!1}};function lo(e){let{delta:t,disabled:n}=e;const r=Dt(t);return yt(c=>{if(n||!r||!c)return ao;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ue.Backward]:c.x[ue.Backward]||a.x===-1,[ue.Forward]:c.x[ue.Forward]||a.x===1},y:{[ue.Backward]:c.y[ue.Backward]||a.y===-1,[ue.Forward]:c.y[ue.Forward]||a.y===1}}},[n,t,r])}function co(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return yt(c=>{var a;return t==null?null:(a=r??c)!=null?a:null},[r,t])}function uo(e,t){return u.useMemo(()=>e.reduce((n,r)=>{const{sensor:c}=r,a=c.activators.map(h=>({eventName:h.eventName,handler:t(h.handler,r)}));return[...n,...a]},[]),[e,t])}var xt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(xt||(xt={}));var on;(function(e){e.Optimized="optimized"})(on||(on={}));const Fn=new Map;function fo(e,t){let{dragging:n,dependencies:r,config:c}=t;const[a,h]=u.useState(null),{frequency:f,measure:s,strategy:i}=c,l=u.useRef(e),d=x(),m=pt(d),p=u.useCallback(function(S){S===void 0&&(S=[]),!m.current&&h(y=>y===null?S:y.concat(S.filter(b=>!y.includes(b))))},[m]),g=u.useRef(null),v=yt(S=>{if(d&&!n)return Fn;if(!S||S===Fn||l.current!==e||a!=null){const y=new Map;for(let b of e){if(!b)continue;if(a&&a.length>0&&!a.includes(b.id)&&b.rect.current){y.set(b.id,b.rect.current);continue}const E=b.node.current,R=E?new vn(s(E),E):null;b.rect.current=R,R&&y.set(b.id,R)}return y}return S},[e,a,n,d,s]);return u.useEffect(()=>{l.current=e},[e]),u.useEffect(()=>{d||p()},[n,d]),u.useEffect(()=>{a&&a.length>0&&h(null)},[JSON.stringify(a)]),u.useEffect(()=>{d||typeof f!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},f))},[f,d,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:a!=null};function x(){switch(i){case xt.Always:return!1;case xt.BeforeDragging:return n;default:return!n}}}function yn(e,t){return yt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ho(e,t){return yn(e,t)}function mo(e){let{callback:t,disabled:n}=e;const r=Bt(t),c=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return u.useEffect(()=>()=>c?.disconnect(),[c]),c}function $t(e){let{callback:t,disabled:n}=e;const r=Bt(t),c=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return u.useEffect(()=>()=>c?.disconnect(),[c]),c}function go(e){return new vn(wt(e),e)}function _n(e,t,n){t===void 0&&(t=go);const[r,c]=u.useState(null);function a(){c(s=>{if(!e)return null;if(e.isConnected===!1){var i;return(i=s??n)!=null?i:null}const l=t(e);return JSON.stringify(s)===JSON.stringify(l)?s:l})}const h=mo({callback(s){if(e)for(const i of s){const{type:l,target:d}=i;if(l==="childList"&&d instanceof HTMLElement&&d.contains(e)){a();break}}}}),f=$t({callback:a});return Fe(()=>{a(),e?(f?.observe(e),h?.observe(document.body,{childList:!0,subtree:!0})):(f?.disconnect(),h?.disconnect())},[e]),r}function po(e){const t=yn(e);return dr(e,t)}const Bn=[];function vo(e){const t=u.useRef(e),n=yt(r=>e?r&&r!==Bn&&e&&t.current&&e.parentNode===t.current.parentNode?r:pn(e):Bn,[e]);return u.useEffect(()=>{t.current=e},[e]),n}function xo(e){const[t,n]=u.useState(null),r=u.useRef(e),c=u.useCallback(a=>{const h=qt(a.target);h&&n(f=>f?(f.set(h,rn(h)),new Map(f)):null)},[]);return u.useEffect(()=>{const a=r.current;if(e!==a){h(a);const f=e.map(s=>{const i=qt(s);return i?(i.addEventListener("scroll",c,{passive:!0}),[i,rn(i)]):null}).filter(s=>s!=null);n(f.length?new Map(f):null),r.current=e}return()=>{h(e),h(a)};function h(f){f.forEach(s=>{const i=qt(s);i?.removeEventListener("scroll",c)})}},[c,e]),u.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,h)=>Ze(a,h),je):xr(e):je,[e,t])}function Un(e,t){t===void 0&&(t=[]);const n=u.useRef(null);return u.useEffect(()=>{n.current=null},t),u.useEffect(()=>{const r=e!==je;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Mt(e,n.current):je}function bo(e){u.useEffect(()=>{if(!_t)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function yo(e,t){return u.useMemo(()=>e.reduce((n,r)=>{let{eventName:c,handler:a}=r;return n[c]=h=>{a(h,t)},n},{}),[e,t])}function Cr(e){return u.useMemo(()=>e?Gs(e):null,[e])}const $n=[];function wo(e,t){t===void 0&&(t=wt);const[n]=e,r=Cr(n?ve(n):null),[c,a]=u.useState($n);function h(){a(()=>e.length?e.map(s=>pr(s)?r:new vn(t(s),s)):$n)}const f=$t({callback:h});return Fe(()=>{f?.disconnect(),h(),e.forEach(s=>f?.observe(s))},[e]),c}function Sr(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return bt(t)?t:e}function Co(e){let{measure:t}=e;const[n,r]=u.useState(null),c=u.useCallback(i=>{for(const{target:l}of i)if(bt(l)){r(d=>{const m=t(l);return d?{...d,width:m.width,height:m.height}:m});break}},[t]),a=$t({callback:c}),h=u.useCallback(i=>{const l=Sr(i);a?.disconnect(),l&&a?.observe(l),r(l?t(l):null)},[t,a]),[f,s]=At(h);return u.useMemo(()=>({nodeRef:f,rect:n,setRef:s}),[n,f,s])}const So=[{sensor:bn,options:{}},{sensor:wr,options:{}}],Eo={current:{}},jt={draggable:{measure:Pn},droppable:{measure:Pn,strategy:xt.WhileDragging,frequency:on.Optimized},dragOverlay:{measure:wt}};class ht extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const No={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ht,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Pt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:jt,measureDroppableContainers:Pt,windowRect:null,measuringScheduled:!1},Er={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Pt,draggableNodes:new Map,over:null,measureDroppableContainers:Pt},Ct=u.createContext(Er),Nr=u.createContext(No);function Ro(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ht}}}function jo(e,t){switch(t.type){case le.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case le.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case le.DragEnd:case le.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case le.RegisterDroppable:{const{element:n}=t,{id:r}=n,c=new ht(e.droppable.containers);return c.set(r,n),{...e,droppable:{...e.droppable,containers:c}}}case le.SetDroppableDisabled:{const{id:n,key:r,disabled:c}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const h=new ht(e.droppable.containers);return h.set(n,{...a,disabled:c}),{...e,droppable:{...e.droppable,containers:h}}}case le.UnregisterDroppable:{const{id:n,key:r}=t,c=e.droppable.containers.get(n);if(!c||r!==c.key)return e;const a=new ht(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function ko(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:c}=u.useContext(Ct),a=Dt(r),h=Dt(n?.id);return u.useEffect(()=>{if(!t&&!r&&a&&h!=null){if(!gn(a)||document.activeElement===a.target)return;const f=c.get(h);if(!f)return;const{activatorNode:s,node:i}=f;if(!s.current&&!i.current)return;requestAnimationFrame(()=>{for(const l of[s.current,i.current]){if(!l)continue;const d=Cs(l);if(d){d.focus();break}}})}},[r,t,c,h,a]),null}function Rr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((c,a)=>a({transform:c,...r}),n):n}function To(e){return u.useMemo(()=>({draggable:{...jt.draggable,...e?.draggable},droppable:{...jt.droppable,...e?.droppable},dragOverlay:{...jt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ao(e){let{activeNode:t,measure:n,initialRect:r,config:c=!0}=e;const a=u.useRef(!1),{x:h,y:f}=typeof c=="boolean"?{x:c,y:c}:c;Fe(()=>{if(!h&&!f||!t){a.current=!1;return}if(a.current||!r)return;const i=t?.node.current;if(!i||i.isConnected===!1)return;const l=n(i),d=dr(l,r);if(h||(d.x=0),f||(d.y=0),a.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const m=hr(i);m&&m.scrollBy({top:d.y,left:d.x})}},[t,h,f,r,n])}const Kt=u.createContext({...je,scaleX:1,scaleY:1});var Ue;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ue||(Ue={}));const Do=u.memo(function(t){var n,r,c,a;let{id:h,accessibility:f,autoScroll:s=!0,children:i,sensors:l=So,collisionDetection:d=Fs,measuring:m,modifiers:p,...g}=t;const v=u.useReducer(jo,void 0,Ro),[x,S]=v,[y,b]=ks(),[E,R]=u.useState(Ue.Uninitialized),D=E===Ue.Initialized,{draggable:{active:j,nodes:C,translate:P},droppable:{containers:k}}=x,T=j!=null?C.get(j):null,F=u.useRef({initial:null,translated:null}),X=u.useMemo(()=>{var H;return j!=null?{id:j,data:(H=T?.data)!=null?H:Eo,rect:F}:null},[j,T]),N=u.useRef(null),[O,V]=u.useState(null),[U,M]=u.useState(null),_=pt(g,Object.values(g)),$=Ut("DndDescribedBy",h),oe=u.useMemo(()=>k.getEnabled(),[k]),ce=To(m),{droppableRects:ee,measureDroppableContainers:A,measuringScheduled:Q}=fo(oe,{dragging:D,dependencies:[P.x,P.y],config:ce.droppable}),L=co(C,j),re=u.useMemo(()=>U?It(U):null,[U]),G=Y(),K=ho(L,ce.draggable.measure);Ao({activeNode:j!=null?C.get(j):null,config:G.layoutShiftCompensation,initialRect:K,measure:ce.draggable.measure});const ie=_n(L,ce.draggable.measure,K),ke=_n(L?L.parentElement:null),be=u.useRef({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=k.getNodeFor((n=be.current.over)==null?void 0:n.id),ye=Co({measure:ce.dragOverlay.measure}),qe=(r=ye.nodeRef.current)!=null?r:L,Ee=D?(c=ye.rect)!=null?c:ie:null,St=!!(ye.nodeRef.current&&ye.rect),Ve=po(St?null:ie),Ke=Cr(qe?ve(qe):null),Ne=vo(D?Te??L:null),Ge=wo(Ne),We=Rr(p,{transform:{x:P.x-Ve.x,y:P.y-Ve.y,scaleX:1,scaleY:1},activatorEvent:U,active:X,activeNodeRect:ie,containerNodeRect:ke,draggingNodeRect:Ee,over:be.current.over,overlayNodeRect:ye.rect,scrollableAncestors:Ne,scrollableAncestorRects:Ge,windowRect:Ke}),Ae=re?Ze(re,P):null,rt=xo(Ne),st=Un(rt),Et=Un(rt,[ie]),Ie=Ze(We,st),Pe=Ee?Us(Ee,We):null,Qe=X&&Pe?d({active:X,collisionRect:Pe,droppableRects:ee,droppableContainers:oe,pointerCoordinates:Ae}):null,Nt=Ls(Qe,"id"),[we,Oe]=u.useState(null),Gt=St?We:Ze(We,Et),Wt=_s(Gt,(a=we?.rect)!=null?a:null,ie),ot=u.useRef(null),Rt=u.useCallback((H,Z)=>{let{sensor:J,options:pe}=Z;if(N.current==null)return;const te=C.get(N.current);if(!te)return;const de=H.nativeEvent,xe=new J({active:N.current,activeNode:te,event:de,options:pe,context:be,onAbort(ae){if(!C.get(ae))return;const{onDragAbort:ge}=_.current,Ce={id:ae};ge?.(Ce),y({type:"onDragAbort",event:Ce})},onPending(ae,fe,ge,Ce){if(!C.get(ae))return;const{onDragPending:it}=_.current,Be={id:ae,constraint:fe,initialCoordinates:ge,offset:Ce};it?.(Be),y({type:"onDragPending",event:Be})},onStart(ae){const fe=N.current;if(fe==null)return;const ge=C.get(fe);if(!ge)return;const{onDragStart:Ce}=_.current,Le={activatorEvent:de,active:{id:fe,data:ge.data,rect:F}};He.unstable_batchedUpdates(()=>{Ce?.(Le),R(Ue.Initializing),S({type:le.DragStart,initialCoordinates:ae,active:fe}),y({type:"onDragStart",event:Le}),V(ot.current),M(de)})},onMove(ae){S({type:le.DragMove,coordinates:ae})},onEnd:_e(le.DragEnd),onCancel:_e(le.DragCancel)});ot.current=xe;function _e(ae){return async function(){const{active:ge,collisions:Ce,over:Le,scrollAdjustedTranslate:it}=be.current;let Be=null;if(ge&&it){const{cancelDrop:at}=_.current;Be={activatorEvent:de,active:ge,collisions:Ce,delta:it,over:Le},ae===le.DragEnd&&typeof at=="function"&&await Promise.resolve(at(Be))&&(ae=le.DragCancel)}N.current=null,He.unstable_batchedUpdates(()=>{S({type:ae}),R(Ue.Uninitialized),Oe(null),V(null),M(null),ot.current=null;const at=ae===le.DragEnd?"onDragEnd":"onDragCancel";if(Be){const Yt=_.current[at];Yt?.(Be),y({type:at,event:Be})}})}}},[C]),Qt=u.useCallback((H,Z)=>(J,pe)=>{const te=J.nativeEvent,de=C.get(pe);if(N.current!==null||!de||te.dndKit||te.defaultPrevented)return;const xe={active:de};H(J,Z.options,xe)===!0&&(te.dndKit={capturedBy:Z.sensor},N.current=pe,Rt(J,Z))},[C,Rt]),w=uo(l,Qt);bo(l),Fe(()=>{ie&&E===Ue.Initializing&&R(Ue.Initialized)},[ie,E]),u.useEffect(()=>{const{onDragMove:H}=_.current,{active:Z,activatorEvent:J,collisions:pe,over:te}=be.current;if(!Z||!J)return;const de={active:Z,activatorEvent:J,collisions:pe,delta:{x:Ie.x,y:Ie.y},over:te};He.unstable_batchedUpdates(()=>{H?.(de),y({type:"onDragMove",event:de})})},[Ie.x,Ie.y]),u.useEffect(()=>{const{active:H,activatorEvent:Z,collisions:J,droppableContainers:pe,scrollAdjustedTranslate:te}=be.current;if(!H||N.current==null||!Z||!te)return;const{onDragOver:de}=_.current,xe=pe.get(Nt),_e=xe&&xe.rect.current?{id:xe.id,rect:xe.rect.current,data:xe.data,disabled:xe.disabled}:null,ae={active:H,activatorEvent:Z,collisions:J,delta:{x:te.x,y:te.y},over:_e};He.unstable_batchedUpdates(()=>{Oe(_e),de?.(ae),y({type:"onDragOver",event:ae})})},[Nt]),Fe(()=>{be.current={activatorEvent:U,active:X,activeNode:L,collisionRect:Pe,collisions:Qe,droppableRects:ee,draggableNodes:C,draggingNode:qe,draggingNodeRect:Ee,droppableContainers:k,over:we,scrollableAncestors:Ne,scrollAdjustedTranslate:Ie},F.current={initial:Ee,translated:Pe}},[X,L,Qe,Pe,C,qe,Ee,ee,k,we,Ne,Ie]),io({...G,delta:P,draggingRect:Pe,pointerCoordinates:Ae,scrollableAncestors:Ne,scrollableAncestorRects:Ge});const I=u.useMemo(()=>({active:X,activeNode:L,activeNodeRect:ie,activatorEvent:U,collisions:Qe,containerNodeRect:ke,dragOverlay:ye,draggableNodes:C,droppableContainers:k,droppableRects:ee,over:we,measureDroppableContainers:A,scrollableAncestors:Ne,scrollableAncestorRects:Ge,measuringConfiguration:ce,measuringScheduled:Q,windowRect:Ke}),[X,L,ie,U,Qe,ke,ye,C,k,ee,we,A,Ne,Ge,ce,Q,Ke]),W=u.useMemo(()=>({activatorEvent:U,activators:w,active:X,activeNodeRect:ie,ariaDescribedById:{draggable:$},dispatch:S,draggableNodes:C,over:we,measureDroppableContainers:A}),[U,w,X,ie,S,$,C,we,A]);return z.createElement(ur.Provider,{value:b},z.createElement(Ct.Provider,{value:W},z.createElement(Nr.Provider,{value:I},z.createElement(Kt.Provider,{value:Wt},i)),z.createElement(ko,{disabled:f?.restoreFocus===!1})),z.createElement(Ds,{...f,hiddenTextDescribedById:$}));function Y(){const H=O?.autoScrollEnabled===!1,Z=typeof s=="object"?s.enabled===!1:s===!1,J=D&&!H&&!Z;return typeof s=="object"?{...s,enabled:J}:{enabled:J}}}),Mo=u.createContext(null),Kn="button",Io="Draggable";function Po(e){let{id:t,data:n,disabled:r=!1,attributes:c}=e;const a=Ut(Io),{activators:h,activatorEvent:f,active:s,activeNodeRect:i,ariaDescribedById:l,draggableNodes:d,over:m}=u.useContext(Ct),{role:p=Kn,roleDescription:g="draggable",tabIndex:v=0}=c??{},x=s?.id===t,S=u.useContext(x?Kt:Mo),[y,b]=At(),[E,R]=At(),D=yo(h,t),j=pt(n);Fe(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:E,data:j}),()=>{const P=d.get(t);P&&P.key===a&&d.delete(t)}),[d,t]);const C=u.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&p===Kn?!0:void 0,"aria-roledescription":g,"aria-describedby":l.draggable}),[r,p,v,x,g,l.draggable]);return{active:s,activatorEvent:f,activeNodeRect:i,attributes:C,isDragging:x,listeners:r?void 0:D,node:y,over:m,setNodeRef:b,setActivatorNodeRef:R,transform:S}}function Oo(){return u.useContext(Nr)}const Lo="Droppable",zo={timeout:25};function Fo(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:c}=e;const a=Ut(Lo),{active:h,dispatch:f,over:s,measureDroppableContainers:i}=u.useContext(Ct),l=u.useRef({disabled:n}),d=u.useRef(!1),m=u.useRef(null),p=u.useRef(null),{disabled:g,updateMeasurementsFor:v,timeout:x}={...zo,...c},S=pt(v??r),y=u.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{i(Array.isArray(S.current)?S.current:[S.current]),p.current=null},x)},[x]),b=$t({callback:y,disabled:g||!h}),E=u.useCallback((C,P)=>{b&&(P&&(b.unobserve(P),d.current=!1),C&&b.observe(C))},[b]),[R,D]=At(E),j=pt(t);return u.useEffect(()=>{!b||!R.current||(b.disconnect(),d.current=!1,b.observe(R.current))},[R,b]),u.useEffect(()=>(f({type:le.RegisterDroppable,element:{id:r,key:a,disabled:n,node:R,rect:m,data:j}}),()=>f({type:le.UnregisterDroppable,key:a,id:r})),[r]),u.useEffect(()=>{n!==l.current.disabled&&(f({type:le.SetDroppableDisabled,id:r,key:a,disabled:n}),l.current.disabled=n)},[r,a,n,f]),{active:h,rect:m,isOver:s?.id===r,node:R,over:s,setNodeRef:D}}function _o(e){let{animation:t,children:n}=e;const[r,c]=u.useState(null),[a,h]=u.useState(null),f=Dt(n);return!n&&!r&&f&&c(f),Fe(()=>{if(!a)return;const s=r?.key,i=r?.props.id;if(s==null||i==null){c(null);return}Promise.resolve(t(i,a)).then(()=>{c(null)})},[t,r,a]),z.createElement(z.Fragment,null,n,r?u.cloneElement(r,{ref:h}):null)}const Bo={x:0,y:0,scaleX:1,scaleY:1};function Uo(e){let{children:t}=e;return z.createElement(Ct.Provider,{value:Er},z.createElement(Kt.Provider,{value:Bo},t))}const $o={position:"fixed",touchAction:"none"},Ko=e=>gn(e)?"transform 250ms ease":void 0,Go=u.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:c,children:a,className:h,rect:f,style:s,transform:i,transition:l=Ko}=e;if(!f)return null;const d=c?i:{...i,scaleX:1,scaleY:1},m={...$o,width:f.width,height:f.height,top:f.top,left:f.left,transform:vt.Transform.toString(d),transformOrigin:c&&r?Ps(r,f):void 0,transition:typeof l=="function"?l(r):l,...s};return z.createElement(n,{className:h,style:m,ref:t},a)}),Wo=e=>t=>{let{active:n,dragOverlay:r}=t;const c={},{styles:a,className:h}=e;if(a!=null&&a.active)for(const[f,s]of Object.entries(a.active))s!==void 0&&(c[f]=n.node.style.getPropertyValue(f),n.node.style.setProperty(f,s));if(a!=null&&a.dragOverlay)for(const[f,s]of Object.entries(a.dragOverlay))s!==void 0&&r.node.style.setProperty(f,s);return h!=null&&h.active&&n.node.classList.add(h.active),h!=null&&h.dragOverlay&&r.node.classList.add(h.dragOverlay),function(){for(const[s,i]of Object.entries(c))n.node.style.setProperty(s,i);h!=null&&h.active&&n.node.classList.remove(h.active)}},Qo=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:vt.Transform.toString(t)},{transform:vt.Transform.toString(n)}]},Yo={duration:250,easing:"ease",keyframes:Qo,sideEffects:Wo({styles:{active:{opacity:"0"}}})};function Ho(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:c}=e;return Bt((a,h)=>{if(t===null)return;const f=n.get(a);if(!f)return;const s=f.node.current;if(!s)return;const i=Sr(h);if(!i)return;const{transform:l}=ve(h).getComputedStyle(h),d=fr(l);if(!d)return;const m=typeof t=="function"?t:Xo(t);return br(s,c.draggable.measure),m({active:{id:a,data:f.data,node:s,rect:c.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:h,rect:c.dragOverlay.measure(i)},droppableContainers:r,measuringConfiguration:c,transform:d})})}function Xo(e){const{duration:t,easing:n,sideEffects:r,keyframes:c}={...Yo,...e};return a=>{let{active:h,dragOverlay:f,transform:s,...i}=a;if(!t)return;const l={x:f.rect.left-h.rect.left,y:f.rect.top-h.rect.top},d={scaleX:s.scaleX!==1?h.rect.width*s.scaleX/f.rect.width:1,scaleY:s.scaleY!==1?h.rect.height*s.scaleY/f.rect.height:1},m={x:s.x-l.x,y:s.y-l.y,...d},p=c({...i,active:h,dragOverlay:f,transform:{initial:s,final:m}}),[g]=p,v=p[p.length-1];if(JSON.stringify(g)===JSON.stringify(v))return;const x=r?.({active:h,dragOverlay:f,...i}),S=f.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{S.onfinish=()=>{x?.(),y()}})}}let Gn=0;function qo(e){return u.useMemo(()=>{if(e!=null)return Gn++,Gn},[e])}const Vo=z.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:c,transition:a,modifiers:h,wrapperElement:f="div",className:s,zIndex:i=999}=e;const{activatorEvent:l,active:d,activeNodeRect:m,containerNodeRect:p,draggableNodes:g,droppableContainers:v,dragOverlay:x,over:S,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:E,windowRect:R}=Oo(),D=u.useContext(Kt),j=qo(d?.id),C=Rr(h,{activatorEvent:l,active:d,activeNodeRect:m,containerNodeRect:p,draggingNodeRect:x.rect,over:S,overlayNodeRect:x.rect,scrollableAncestors:b,scrollableAncestorRects:E,transform:D,windowRect:R}),P=yn(m),k=Ho({config:r,draggableNodes:g,droppableContainers:v,measuringConfiguration:y}),T=P?x.setRef:void 0;return z.createElement(Uo,null,z.createElement(_o,{animation:k},d&&j?z.createElement(Go,{key:j,id:d.id,ref:T,as:f,activatorEvent:l,adjustScale:t,className:s,transition:a,rect:P,style:{zIndex:i,...c},transform:C},n):null))}),jr=768;function Jo(e){const t=window.matchMedia(`(max-width: ${jr-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function Zo(){return window.innerWidth<jr}function ei(){return!1}function kr(){return u.useSyncExternalStore(Jo,Zo,ei)}function ti(e,t){const n=[];if(!e||e.length===0)return n;const r=e.some(a=>a.status==="ACTIVE");return e.some(a=>a.sessions?.some(h=>h.status===Rn.RUNNING||h.status===Rn.PENDING))&&n.push(t("正在运行的 Agent 将被停止")),r&&(n.push(t("分支上未合并的变更将丢失")),n.push(t("关联的工作目录(worktree)将被清理"))),n}function ni({isOpen:e,onClose:t,onConfirm:n,taskId:r,taskTitle:c,workspaces:a,isLoading:h}){const{t:f}=Me(),{data:s,isLoading:i}=rs(a===void 0&&e?r:""),l=a??s,d=a===void 0&&e&&i,m=u.useMemo(()=>ti(l,f),[l,f]);return o.jsx(ns,{isOpen:e,onClose:t,onConfirm:n,title:f("删除任务"),description:o.jsxs(o.Fragment,{children:[o.jsx("p",{children:f("确认删除任务「{title}」?此操作不可撤销。",{title:c})}),d?o.jsx("p",{className:"mt-2 text-xs text-neutral-400",children:f("加载中...")}):m.length>0?o.jsx("ul",{className:"mt-2 space-y-1",children:m.map((p,g)=>o.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[o.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),o.jsx("span",{children:p})]},g))}):null]}),confirmText:f("删除"),variant:"danger",isLoading:h||d})}const ri="flex w-full min-w-0 items-center gap-2.5 rounded-md px-2 text-sm text-left transition-[background-color,box-shadow,color] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",si="h-8 pointer-coarse:h-10";function ct(e){return me(ri,si,e?"bg-background text-foreground shadow-xs ring-1 ring-border/80":"text-foreground/80 hover:bg-accent hover:text-foreground active:bg-foreground/[0.06]")}const an=60,ln=60*an,Zt=24*ln,Wn=new Map;function oi(e){let t=Wn.get(e);return t||(t={monthDay:new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}),yearMonth:new Intl.DateTimeFormat(e,{year:"numeric",month:"numeric"})},Wn.set(e,t)),t}function ii(e,t,n){const r=new Date(e);if(!Number.isFinite(r.getTime()))return"—";const c=new Date,a=Math.max(0,Math.floor((c.getTime()-r.getTime())/1e3));if(a<an)return t("now");if(a<ln)return t("{count}m",{count:Math.floor(a/an)});if(a<Zt)return t("{count}h",{count:Math.floor(a/ln)});if(a<7*Zt)return t("{count}d",{count:Math.floor(a/Zt)});const h=oi(n);return(r.getFullYear()===c.getFullYear()?h.monthDay:h.yearMonth).format(r)}let ai;function li(e,t,n){const r=e.replace(/\s+/g," ").trim();if(n(r)<=t)return r;if(n("…")>t)return"";const c=typeof Intl.Segmenter>"u"?Array.from(r):Array.from((ai??=new Intl.Segmenter(void 0,{granularity:"grapheme"})).segment(r),f=>f.segment);let a=0,h=c.length;for(;a<h;){const f=Math.ceil((a+h)/2);n(`${c.slice(0,f).join("")}…`)<=t?a=f:h=f-1}return`${c.slice(0,a).join("")}…`}const ut=new Map,kt=new Set;let Ye;function Qn(){for(const e of kt)ut.get(e)?.(document.visibilityState!=="hidden")}function ci(e,t){if(typeof IntersectionObserver>"u")return()=>{};if(!Ye){const n=new IntersectionObserver(r=>{if(Ye===n)for(const c of r){const a=ut.get(c.target);if(!a)continue;const h=c.isIntersecting&&c.intersectionRatio>0;h?kt.add(c.target):kt.delete(c.target),a(h&&document.visibilityState!=="hidden")}});Ye=n,document.addEventListener("visibilitychange",Qn)}return ut.set(e,t),Ye.observe(e),()=>{ut.delete(e),kt.delete(e),Ye?.unobserve(e),ut.size===0&&(Ye?.disconnect(),Ye=void 0,document.removeEventListener("visibilitychange",Qn))}}const cn=4200,Yn=cn*.4,ui=1e3/30;function di(e){try{return e?.getContext("2d")??null}catch{return null}}function fi({hostRef:e,text:t,variant:n,animate:r}){const c=u.useRef(null);return u.useLayoutEffect(()=>{const a=e.current,h=c.current,f=di(h);if(!a||!h||!f)return;const s=a.closest(".task-row"),i=matchMedia("(prefers-reduced-motion: reduce)"),l=matchMedia("(hover: hover)");let d=0,m,p=0,g=0,v=0,x=0,S=0,y=0,b="",E="",R="",D=!1;function j(){cancelAnimationFrame(d),clearTimeout(m),d=0,m=void 0}function C(N){if(!(!f||!a)){if(f.clearRect(0,0,v,x),f.globalCompositeOperation="source-over",n==="project"){const O=f.createLinearGradient(y*.6,0,y*2.6,0);O.addColorStop(0,b),O.addColorStop(1,E),f.fillStyle=O}else f.fillStyle=b;if(f.fillText(R,0,S),n==="running"&&N<1){const O=(-1.5+1.5*N)*v,V=f.createLinearGradient(O,0,O+v*2.5,0);V.addColorStop(0,"rgba(0, 0, 0, 1)"),V.addColorStop(.4,"rgba(0, 0, 0, 1)"),V.addColorStop(.5,"rgba(0, 0, 0, 0.4)"),V.addColorStop(.6,"rgba(0, 0, 0, 1)"),V.addColorStop(1,"rgba(0, 0, 0, 1)"),f.globalCompositeOperation="destination-in",f.fillStyle=V,f.fillRect(0,0,v,x),f.globalCompositeOperation="source-over"}a.dataset.gradientReady="true"}}function P(N){if(D)return;const O=(N-p)%cn;N-g>=ui&&(C(Math.min(O/Yn,1)),g=N),O>=Yn?(C(1),m=setTimeout(()=>{d=requestAnimationFrame(P)},cn-O)):d=requestAnimationFrame(P)}function k(){if(j(),!a||!h||!f||D||(delete a.dataset.gradientReady,v=a.clientWidth,x=a.clientHeight,!v||!x))return;const N=getComputedStyle(a),O=Math.min(window.devicePixelRatio||1,3);h.width=Math.ceil(v*O),h.height=Math.ceil(x*O),f.setTransform(O,0,0,O,0,0),f.font=`${N.fontStyle} ${N.fontWeight} ${N.fontSize} ${N.fontFamily}`,f.textBaseline="alphabetic",y=Number.parseFloat(N.fontSize);const V=f.measureText("Mg"),U=V.fontBoundingBoxAscent??y*.8,M=V.fontBoundingBoxDescent??y*.2;S=(x-U-M)/2+U,b=N.color,E=N.getPropertyValue("--muted-foreground").trim()||b,R=li(t,v,$=>f.measureText($).width);try{C(1)}catch{return}const _=i.matches||s?.matches(":focus-visible")||l.matches&&s?.matches(":hover");n==="running"&&r&&!_&&(p=performance.now(),g=0,d=requestAnimationFrame(P))}const T=typeof ResizeObserver>"u"?void 0:new ResizeObserver(k);T?.observe(a);const F=new MutationObserver(k);F.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style"]}),F.observe(a,{attributes:!0,attributeFilter:["class","style"]});const X=()=>{j(),delete a.dataset.gradientReady};h.addEventListener("contextlost",X),h.addEventListener("contextrestored",k),i.addEventListener("change",k),l.addEventListener("change",k);for(const N of["pointerenter","pointerleave","focus","blur"])s?.addEventListener(N,k);return window.addEventListener("resize",k),document.fonts?.addEventListener("loadingdone",k),k(),()=>{D=!0,j(),T?.disconnect(),F.disconnect(),i.removeEventListener("change",k),l.removeEventListener("change",k);for(const N of["pointerenter","pointerleave","focus","blur"])s?.removeEventListener(N,k);window.removeEventListener("resize",k),document.fonts?.removeEventListener("loadingdone",k),h.removeEventListener("contextlost",X),h.removeEventListener("contextrestored",k),delete a.dataset.gradientReady,h.width=0,h.height=0}},[e,t,n,r]),o.jsx("canvas",{ref:c,className:"task-gradient-text__canvas","aria-hidden":"true"})}function Hn({text:e,variant:t,animate:n=!0,className:r}){const c=u.useRef(null),[a,h]=u.useState(!1);return u.useEffect(()=>{if(c.current)return ci(c.current,h)},[]),o.jsxs("span",{ref:c,className:me("task-gradient-text",r),"data-text-effect":t,children:[o.jsx("span",{className:"task-gradient-text__text",children:e}),a&&o.jsx(fi,{hostRef:c,text:e,variant:t,animate:n})]})}const Tr=u.createContext(null),hi=3e4;function mi(e=hi){const[,t]=u.useState(0);u.useEffect(()=>{const n=setInterval(()=>t(r=>r+1),e);return()=>clearInterval(n)},[e])}function gi(e){const t=Wr(e,9,"..");if(t===e)return e;const n=t.slice(0,-2),r=n.search(/[-_.\s][^-_.\s]*$/);return`${r>=3?n.slice(0,r):n}..`}const en="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] text-foreground/80 transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:outline-none",Xn="px-2 pb-1 pt-1.5 text-[11px] font-medium text-muted-foreground",qn=o.jsx("div",{className:"-mx-1 my-1 h-px bg-border/60"});function pi({task:e,status:t,isSelected:n,project:r,showProject:c,onSelectTask:a,onTaskStatusChange:h,onDeleteTask:f,onTaskPriorityChange:s,disableDrag:i}){const{t:l,locale:d}=Me(),m=u.useContext(Tr),p=u.useRef(null),g=!!e.projectArchivedAt,v=g||!!i,{attributes:x,listeners:S,setNodeRef:y,isDragging:b}=Po({id:e.id,data:{task:e,fromStatus:t},disabled:v}),E=u.useCallback(M=>{p.current=M,y(M),m&&(M?m.registry.set(e.id,M):m.registry.delete(e.id))},[y,m,e.id]);u.useEffect(()=>()=>{m?.registry.delete(e.id)},[e.id,m]);const[R,D]=u.useState(null),[j,C]=u.useState(!1),P=u.useRef(null),k=u.useRef(null),T=u.useCallback(M=>{g||!h&&!f&&!s||(M.preventDefault(),D({x:M.clientX,y:M.clientY}))},[g,h,f,s]),F=u.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null)},[]),X=u.useCallback(M=>{if(!i||g||!h&&!f)return;const _=M.touches[0];if(!_)return;const{clientX:$,clientY:oe}=_;k.current=setTimeout(()=>{k.current=null,D({x:$,y:oe})},500)},[i,g,h,f]);u.useEffect(()=>{if(!R)return;const M=()=>D(null),_=oe=>{P.current&&!P.current.contains(oe.target)&&M()},$=oe=>{oe.key==="Escape"&&M()};return document.addEventListener("mousedown",_),document.addEventListener("touchstart",_),document.addEventListener("keydown",$),window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("touchstart",_),document.removeEventListener("keydown",$),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[R]),u.useLayoutEffect(()=>{const M=P.current;if(!R||!M)return;const _=8;M.style.left=`${Math.max(_,Math.min(R.x,window.innerWidth-M.offsetWidth-_))}px`,M.style.top=`${Math.max(_,Math.min(R.y,window.innerHeight-M.offsetHeight-_))}px`},[R]);const N=r?r.name:void 0,O=c?r:void 0,V=e.updatedAt?ii(e.updatedAt,l,d):null,{titleClass:U}=mt[t];return o.jsxs(o.Fragment,{children:[o.jsxs("button",{ref:E,type:"button",onClick:()=>a(e.id),onContextMenu:T,onTouchStart:X,onTouchEnd:F,onTouchMove:F,title:O?`${e.title} · ${O.name}`:e.title,"aria-label":N?`${e.title} — ${N}`:e.title,"aria-current":n||void 0,"data-sidebar-item":"",className:me("task-row animate-task-enter",ct(n),b&&"opacity-30"),...v?{}:S,...v?{}:x,children:[t===ne.Running?o.jsx(Hn,{text:e.title,variant:"running",animate:!n,className:me("min-w-0 flex-1 truncate",U)}):o.jsx("span",{className:me("min-w-0 flex-1 truncate",U),children:e.title}),e.priority!==void 0&&e.priority!==Tt.NORMAL&&o.jsx(jn,{priority:e.priority}),e.projectArchivedAt&&o.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full bg-foreground/[0.06] px-1.5 py-0.5 text-[10px] font-medium leading-none text-muted-foreground",children:e.projectRepoDeletedAt?l("源码已删除"):l("已删除")}),(V||O)&&o.jsx("span",{className:"task-row-meta",children:o.jsxs("span",{className:"flex items-center gap-1",children:[O&&o.jsx("span",{className:"shrink-0 whitespace-nowrap rounded bg-foreground/[0.05] px-1 py-0.5 text-[10px] font-medium leading-none @max-[22rem]:hidden",children:o.jsx(Hn,{text:gi(O.name),variant:"project",className:O.color})}),V&&o.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:V})]})})]}),R&&o.jsxs("div",{ref:P,role:"menu",className:"fixed z-[100] w-48 rounded-lg border border-border bg-popover p-1 shadow-lg shadow-black/5 animate-in fade-in zoom-in-95 duration-100",children:[h&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Xn,children:l("Move to")}),os.filter(M=>M!==t).map(M=>{const{icon:_,label:$,accentClass:oe}=mt[M];return o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(e.id,M),D(null)},className:en,children:[o.jsx(_,{className:me("size-3.5 shrink-0",oe)}),o.jsx("span",{children:l($)})]},M)})]}),s&&o.jsxs(o.Fragment,{children:[h&&qn,o.jsx("div",{className:Xn,children:l("Priority")}),cs.map(M=>{const _=(e.priority??Tt.NORMAL)===M.value;return o.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":_,onClick:()=>{s(e.id,M.value),D(null)},className:en,children:[o.jsx(jn,{priority:M.value}),o.jsx("span",{className:"flex-1",children:l(M.label)}),_&&o.jsx(gt,{className:"size-3.5 shrink-0 text-foreground","aria-hidden":!0})]},M.value)})]}),f&&o.jsxs(o.Fragment,{children:[(h||s)&&qn,o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{C(!0),D(null)},className:me(en,"text-destructive hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10"),children:[o.jsx(us,{className:"size-3.5 shrink-0","aria-hidden":!0}),o.jsx("span",{children:l("Delete Task")})]})]})]}),o.jsx(ni,{isOpen:j,onClose:()=>C(!1),onConfirm:()=>{f?.(e.id),C(!1)},taskId:e.id,taskTitle:e.title})]})}const vi=u.memo(function({title:t,tasks:n,status:r,defaultOpen:c,selectedTaskId:a,onSelectTask:h,projects:f,showProject:s=!0,isDragging:i,dragFromStatus:l,onTaskStatusChange:d,onDeleteTask:m,onTaskPriorityChange:p,disableDrag:g}){const{t:v}=Me(),[x,S]=u.useState(c);mi();const y=n.length===0,b=i&&l===r,E=i&&l!==r,{setNodeRef:R,isOver:D}=Fo({id:`group-${r}`,data:{status:r}}),j=r===ne.Review,C=v(t),{icon:P,accentClass:k}=mt[r],T=u.useId(),F=i?b:x,X=F&&!E&&!y;return o.jsxs("div",{className:X?"mb-4":"mb-2","data-task-group-status":r,children:[o.jsx("div",{className:"sticky top-0 z-10 bg-sidebar px-2",children:o.jsxs("button",{type:"button",onClick:()=>!i&&S(N=>!N),"aria-expanded":x,"data-sidebar-item":"",className:"group/header flex h-7 w-full items-center gap-1 rounded-md px-2 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[o.jsx(P,{className:me("mr-0.5 size-3.5 shrink-0",k)}),o.jsx("span",{id:T,className:"truncate",children:C}),o.jsx(ts,{size:12,"aria-hidden":!0,className:me("shrink-0 text-muted-foreground/60 transition-transform duration-150 group-hover/header:text-muted-foreground",F&&"rotate-90")}),j&&!y?o.jsx("span",{className:"ml-auto rounded-full bg-warning/15 px-1.5 text-[11px] font-semibold leading-4 tabular-nums text-warning",children:n.length}):o.jsx("span",{className:"ml-auto text-[11px] font-normal tabular-nums text-muted-foreground/80",children:n.length})]})}),E&&o.jsx("div",{ref:R,className:me("mx-2 mt-0.5 flex h-9 items-center justify-center rounded-md border border-dashed text-xs font-medium transition-colors duration-150",D?"border-info/50 bg-info/5 text-info":"border-border bg-foreground/[0.02] text-muted-foreground"),children:D?v("Drop into {title}",{title:C}):v("Drop here")}),X&&o.jsx("div",{ref:b?void 0:R,role:"group","aria-labelledby":T,className:"mt-0.5 flex flex-col gap-px px-2",children:n.map(N=>{const O=a===N.id,V=N.projectId?f.find(U=>U.id===N.projectId):void 0;return o.jsx(pi,{task:N,status:r,isSelected:O,project:V,showProject:s,onSelectTask:h,onTaskStatusChange:N.projectArchivedAt?void 0:d,onDeleteTask:N.projectArchivedAt?void 0:m,onTaskPriorityChange:N.projectArchivedAt?void 0:p,disableDrag:g},N.id)})})]})}),xi=12,bi=50;function yi({isOpen:e,onClose:t,tasks:n,projects:r,onSelectTask:c}){const{t:a}=Me(),[h,f]=u.useState(""),[s,i]=u.useState(0),l=u.useRef(null);u.useEffect(()=>{e&&(f(""),i(0))},[e]);const d=u.useMemo(()=>{const g=h.trim().toLowerCase();return g?n.filter(v=>v.title.toLowerCase().includes(g)).slice(0,bi):n.slice(0,xi)},[n,h]);u.useEffect(()=>{i(0)},[h]),u.useEffect(()=>{l.current?.children[s]?.scrollIntoView({block:"nearest"})},[s]);const m=u.useCallback(g=>{c(g),t()},[c,t]),p=u.useCallback(g=>{if(g.key==="Escape")g.preventDefault(),t();else if(g.key==="ArrowDown")g.preventDefault(),i(v=>Math.min(v+1,d.length-1));else if(g.key==="ArrowUp")g.preventDefault(),i(v=>Math.max(v-1,0));else if(g.key==="Enter"&&!g.nativeEvent.isComposing){g.preventDefault();const v=d[s];v&&m(v.id)}},[t,d,s,m]);return e?o.jsxs("div",{className:"fixed inset-0 z-90",role:"dialog","aria-modal":"true",children:[o.jsx("div",{className:"absolute inset-0 bg-black/20",onClick:t}),o.jsxs("div",{className:"absolute left-1/2 top-[18vh] w-[min(560px,calc(100vw-2rem))] -translate-x-1/2 bg-popover rounded-xl border border-border shadow-lg overflow-hidden animate-in fade-in zoom-in-95 duration-100",children:[o.jsxs("div",{className:"flex items-center gap-2.5 px-4 border-b border-border/60",children:[o.jsx(ar,{size:15,className:"text-muted-foreground/70 shrink-0"}),o.jsx("input",{value:h,onChange:g=>f(g.target.value),onKeyDown:p,placeholder:a("Search tasks..."),"aria-label":a("Search tasks..."),autoFocus:!0,className:"flex-1 py-3 bg-transparent border-none focus:outline-none text-sm text-foreground placeholder-muted-foreground/60"})]}),d.length>0?o.jsxs(o.Fragment,{children:[!h.trim()&&o.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[11px] font-medium text-muted-foreground/70",children:a("Recent tasks")}),o.jsx("div",{ref:l,className:"max-h-[46vh] overflow-y-auto scrollbar-app-thin pb-1.5 pt-0.5",children:d.map((g,v)=>{const x=r.find(b=>b.id===g.projectId),{icon:S,iconClass:y}=mt[g.status];return o.jsxs("button",{onClick:()=>m(g.id),onMouseEnter:()=>i(v),className:`w-full flex items-center gap-2.5 px-4 py-2 text-left transition-colors
7
- ${v===s?"bg-accent":""}`,children:[o.jsx(S,{className:`${y} size-4 shrink-0`}),o.jsx("span",{className:"flex-1 min-w-0 truncate text-sm text-foreground/90",title:g.title,children:g.title}),x&&o.jsx("span",{className:"shrink-0 max-w-[120px] truncate text-xs text-muted-foreground/70",children:x.name})]},g.id)})})]}):o.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground/70",children:a("No matching tasks")})]})]}):null}const wi=260,Ci=220;function Si(e){const t={[ne.Review]:[],[ne.Running]:[],[ne.Pending]:[],[ne.Done]:[],[ne.Cancelled]:[]};for(const n of e)t[n.status].push(n);return t[ne.Review].sort((n,r)=>(r.priority??Tt.NORMAL)-(n.priority??Tt.NORMAL)),t}const Ei=[{status:ne.Review,title:"Review",defaultOpen:!0},{status:ne.Running,title:"Running",defaultOpen:!0},{status:ne.Pending,title:"Pending",defaultOpen:!1},{status:ne.Done,title:"Done",defaultOpen:!1},{status:ne.Cancelled,title:"Cancelled",defaultOpen:!1}];function Ni(){return o.jsx("div",{className:"flex-1 overflow-hidden px-2 pt-3 motion-safe:animate-pulse","aria-hidden":!0,children:[3,4].map((e,t)=>o.jsxs("div",{className:"mb-4",children:[o.jsxs("div",{className:"flex h-7 items-center gap-1.5 px-2",children:[o.jsx("div",{className:"size-3.5 shrink-0 rounded-full bg-foreground/[0.06]"}),o.jsx("div",{className:"h-2.5 w-12 rounded-full bg-foreground/[0.06]"})]}),Array.from({length:e}).map((n,r)=>o.jsxs("div",{className:"flex h-8 items-center gap-2.5 px-2 pointer-coarse:h-10",children:[o.jsx("div",{className:"h-3 rounded-full bg-foreground/[0.06]",style:{width:`${64-(r+t)%3*14}%`}}),o.jsx("div",{className:"ml-auto h-2.5 w-8 shrink-0 rounded-full bg-foreground/[0.05]"})]},r))]},t))})}function Vn({tasks:e=[],projects:t=[],selectedTaskId:n,onSelectTask:r,filterProjectId:c,setFilterProjectId:a,width:h=320,onCreateTask:f,onCreateProject:s,isCreateActive:i,onTaskStatusChange:l,onDeleteTask:d,onTaskPriorityChange:m,isLoading:p=!1}){const{t:g}=Me(),{preserveDesktopSearch:v}=or(),x=kr(),[S,y]=u.useState(null),[b,E]=u.useState(null),[R,D]=u.useState(!1),j=u.useRef(new Map),C=u.useRef(new Set),P=u.useRef(new Map),k=u.useMemo(()=>({registry:j.current}),[]),T=u.useCallback(A=>{A.remove(),C.current.delete(A)},[]),F=c?e.filter(A=>A.projectId===c):e,X=u.useCallback((A,Q)=>{const L=document.querySelector(`[data-task-group-status="${A}"]`);if(!L)return null;const G=(L.querySelector("button")??L).getBoundingClientRect();return G.width===0||G.height===0?null:new DOMRect(G.left,G.bottom+2,Q.width,Q.height)},[]),N=u.useCallback((A,Q,L,re=!1)=>{const G=document.createElement("div");G.setAttribute("aria-hidden","true"),G.innerHTML=L,G.querySelectorAll("[data-gradient-ready]").forEach(Te=>Te.removeAttribute("data-gradient-ready")),G.querySelectorAll(".task-gradient-text__canvas").forEach(Te=>Te.remove());const K=G.firstElementChild;K&&(K.style.cssText="",K.className=K.className.replace(/\bopacity-\S*/g,"").replace(/\banimate-task-enter\b/g,""),K.style.pointerEvents="none",K.style.width=`${A.width}px`,K.style.height=`${A.height}px`,K.style.margin="0",K.style.backgroundColor="var(--background)",K.style.borderRadius="0.5rem",K.style.boxShadow="0 4px 6px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border)",K.style.opacity="0.96",K.style.transition="none",K.setAttribute("tabindex","-1")),Object.assign(G.style,{position:"fixed",left:`${A.left}px`,top:`${A.top}px`,width:`${A.width}px`,height:`${A.height}px`,zIndex:"9999",pointerEvents:"none",overflow:"visible",transformOrigin:"top left",willChange:"transform, opacity"}),document.body.appendChild(G),C.current.add(G);const ie=Q.left-A.left,ke=Q.top-A.top;G.animate([{transform:"translate(0, 0)",opacity:.96,offset:0},{transform:`translate(${ie}px, ${ke}px)`,opacity:re?.12:.96,offset:1}],{duration:re?Ci:wi,easing:"cubic-bezier(0.2, 0, 0, 1)",fill:"forwards"}).finished.then(()=>T(G),()=>T(G))},[T]);u.useLayoutEffect(()=>{const A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=new Map;for(const L of F){const re=j.current.get(L.id);if(!re)continue;const G={status:L.status,rect:re.getBoundingClientRect(),html:re.outerHTML};if(Q.set(L.id,G),A)continue;const K=P.current.get(L.id);if(!K||K.status===L.status)continue;const ie=G.rect.left-K.rect.left,ke=G.rect.top-K.rect.top;Math.abs(ie)<1&&Math.abs(ke)<1||N(K.rect,G.rect,K.html)}if(!A)for(const[L,re]of P.current){if(Q.has(L))continue;const G=F.find(ie=>ie.id===L);if(!G||G.status===re.status)continue;const K=X(G.status,re.rect);K&&N(re.rect,K,re.html,!0)}P.current=Q},[F,N,X]),u.useEffect(()=>()=>{for(const A of C.current)A.remove();C.current.clear()},[]);const O=Is(Ms(bn,{activationConstraint:{distance:8}})),V=u.useCallback(A=>{const Q=A.active.data.current?.task,L=A.active.data.current?.fromStatus;Q&&y(Q),L&&E(L)},[]),U=u.useCallback(A=>{y(null),E(null);const{active:Q,over:L}=A;if(!L)return;const re=Q.data.current?.task,G=Q.data.current?.fromStatus,K=L.data.current?.status;!re||!G||!K||re.projectArchivedAt||G!==K&&l?.(re.id,K)},[l]),$=!!!(c?t.find(A=>A.id===c)??null:null)?.archivedAt,oe=Si(F),ce=S?mt[S.status]:null,ee=u.useCallback(A=>{if(A.key!=="ArrowDown"&&A.key!=="ArrowUp"||A.altKey||A.ctrlKey||A.metaKey||A.shiftKey)return;const Q=Array.from(A.currentTarget.querySelectorAll("[data-sidebar-item]:not(:disabled)")),L=Q.indexOf(A.target);L!==-1&&(A.preventDefault(),Q[L+(A.key==="ArrowDown"?1:-1)]?.focus())},[]);return o.jsxs("div",{className:"@container h-full flex flex-col flex-shrink-0",style:{width:h},onKeyDown:ee,children:[o.jsxs("div",{className:"px-2 pt-2 pb-1 flex flex-col gap-px flex-shrink-0",children:[s&&o.jsxs("button",{type:"button",onClick:s,"data-sidebar-item":"",className:ct(!1),children:[o.jsx(is,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:g("New Project")})]}),o.jsxs("button",{type:"button",onClick:f,disabled:!$,"aria-current":i||void 0,"data-sidebar-item":"",className:me(ct(!!i),"disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent"),title:$?void 0:g("Deleted projects are read-only"),children:[o.jsx(fs,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:g("New Task")})]}),o.jsxs("button",{type:"button",onClick:()=>D(!0),"data-sidebar-item":"",className:ct(!1),children:[o.jsx(ar,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:g("Search")})]}),o.jsxs(Qr,{to:v("/conversations"),"data-sidebar-item":"",className:ct(!1),children:[o.jsx(hs,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:g("对话")})]})]}),p?o.jsx(Ni,{}):F.length===0?o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 pb-[10vh] text-center select-none",children:[o.jsx(nn,{size:36,className:"text-muted-foreground/40 mb-3",strokeWidth:1.5}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:g("No tasks")}),$&&f?o.jsx("button",{type:"button",onClick:f,className:"px-3.5 py-1.5 rounded-md bg-brand text-brand-foreground text-xs font-medium hover:bg-brand/90 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2",children:g("New Task")}):null]}):o.jsx(Tr.Provider,{value:k,children:o.jsxs(Do,{sensors:O,onDragStart:V,onDragEnd:U,children:[o.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin scroll-pt-8 relative",children:o.jsx("div",{className:"pt-3 pb-4",children:Ei.map(({status:A,title:Q,defaultOpen:L})=>o.jsx(vi,{title:Q,tasks:oe[A],status:A,defaultOpen:L,selectedTaskId:n,onSelectTask:r,projects:t,showProject:!c,isDragging:S!==null,dragFromStatus:b,onTaskStatusChange:l,onDeleteTask:d,onTaskPriorityChange:m,disableDrag:x},A))})}),o.jsx(Vo,{dropAnimation:null,children:S&&ce?o.jsxs("div",{className:"flex h-8 w-fit max-w-[280px] items-center gap-2.5 rounded-md bg-background px-2 text-sm text-foreground shadow-[0_12px_16px_-4px_rgba(36,36,36,0.08)] ring-1 ring-border/80",children:[o.jsx(ce.icon,{className:me("size-4 shrink-0",ce.iconClass)}),o.jsx("span",{className:"truncate",title:S.title,children:S.title})]}):null})]})}),!p&&o.jsxs("div",{className:"h-9 px-4 flex flex-shrink-0 items-center justify-between border-t border-border/60 text-xs text-muted-foreground",children:[o.jsx("span",{className:"tabular-nums",children:g("{count} tasks",{count:F.length})}),c?o.jsx("button",{type:"button",onClick:()=>a(null),className:"rounded-sm hover:text-foreground underline decoration-border underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:g("Clear filter")}):null]}),o.jsx(yi,{isOpen:R,onClose:()=>D(!1),tasks:F,projects:t,onSelectTask:r})]})}function wn(e){switch(e){case De.TODO:return ne.Pending;case De.IN_PROGRESS:return ne.Running;case De.IN_REVIEW:return ne.Review;case De.DONE:return ne.Done;case De.CANCELLED:return ne.Cancelled}}function Ri(e){switch(e){case ne.Pending:return De.TODO;case ne.Running:return De.IN_PROGRESS;case ne.Review:return De.IN_REVIEW;case ne.Done:return De.DONE;case ne.Cancelled:return De.CANCELLED}}function ji(e){switch(e){case Re.CLAUDE_CODE:return"Claude Code";case Re.GEMINI_CLI:return"Gemini CLI";case Re.CURSOR_AGENT:return"Cursor Agent";case Re.CODEX:return"Codex";case Re.QWEN_CODE:return"Qwen Code";case Re.KIRO_CLI:return"Kiro CLI";case Re.OPENCODE:return"OpenCode";case Re.PI_CODING_AGENT:return"Pi Coding Agent";case Re.GROK_BUILD:return"Grok Build";case Re.MINION_CODE:return"Minion Code";case Re.DEEPSEEK_HERMES:return"DeepSeek Harness"}}const Lt=["text-indigo-600","text-emerald-600","text-rose-600","text-amber-600","text-cyan-600","text-violet-600","text-teal-600","text-pink-600"];function Ar(e,t){let n=0;for(let r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r)|0;return Math.abs(n)%t}function ki(e){return{id:e.id,name:e.name,color:e.color||Lt[Ar(e.name,Lt.length)],isGitRepo:e.isGitRepo,worktreeReady:e.worktreeReady,reason:e.reason,archivedAt:e.archivedAt??null,repoDeletedAt:e.repoDeletedAt??null}}function Ti(e,t){const n=e.preferredWorkspace?e.preferredWorkspace.workspaceKind===et.MAIN_DIRECTORY?"Project directory":e.preferredWorkspace.branchName:"—";return{id:e.id,projectId:e.projectId,title:e.title,status:wn(e.status),priority:e.priority,agent:e.latestAgentType?ji(e.latestAgentType):"—",branch:n,description:"",updatedAt:new Date(e.updatedAt).toISOString(),isGitRepo:t?.isGitRepo,worktreeReady:t?.worktreeReady,reason:t?.reason,projectArchivedAt:t?.archivedAt??null,projectRepoDeletedAt:t?.repoDeletedAt??null}}function Ai(e,t){const n=e.preferredWorkspace?e.preferredWorkspace.workspaceKind===et.MAIN_DIRECTORY?"Project directory":e.preferredWorkspace.branchName:"—";return{id:e.id,projectId:t.id,projectName:t.name,projectColor:t.color||Lt[Ar(t.name,Lt.length)],title:e.title,status:wn(e.status),priority:e.priority,branch:n,mainBranch:t.mainBranch??"main",description:"",isGitRepo:t.isGitRepo,worktreeReady:t.worktreeReady,reason:t.reason,projectArchivedAt:t.archivedAt??null,projectRepoDeletedAt:t.repoDeletedAt??null}}var Di=Object.defineProperty,zt=Object.getOwnPropertySymbols,Dr=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable,Jn=(e,t,n)=>t in e?Di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,un=(e,t)=>{for(var n in t||(t={}))Dr.call(t,n)&&Jn(e,n,t[n]);if(zt)for(var n of zt(t))Mr.call(t,n)&&Jn(e,n,t[n]);return e},dn=(e,t)=>{var n={};for(var r in e)Dr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zt)for(var r of zt(e))t.indexOf(r)<0&&Mr.call(e,r)&&(n[r]=e[r]);return n};var Xe;(e=>{const t=class B{constructor(s,i,l,d){if(this.version=s,this.errorCorrectionLevel=i,this.modules=[],this.isFunction=[],s<B.MIN_VERSION||s>B.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=s*4+17;let m=[];for(let g=0;g<this.size;g++)m.push(!1);for(let g=0;g<this.size;g++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(l);if(this.drawCodewords(p),d==-1){let g=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const x=this.getPenaltyScore();x<g&&(d=v,g=x),this.applyMask(v)}}c(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(s,i){const l=e.QrSegment.makeSegments(s);return B.encodeSegments(l,i)}static encodeBinary(s,i){const l=e.QrSegment.makeBytes(s);return B.encodeSegments([l],i)}static encodeSegments(s,i,l=1,d=40,m=-1,p=!0){if(!(B.MIN_VERSION<=l&&l<=d&&d<=B.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let g,v;for(g=l;;g++){const b=B.getNumDataCodewords(g,i)*8,E=h.getTotalBits(s,g);if(E<=b){v=E;break}if(g>=d)throw new RangeError("Data too long")}for(const b of[B.Ecc.MEDIUM,B.Ecc.QUARTILE,B.Ecc.HIGH])p&&v<=B.getNumDataCodewords(g,b)*8&&(i=b);let x=[];for(const b of s){n(b.mode.modeBits,4,x),n(b.numChars,b.mode.numCharCountBits(g),x);for(const E of b.getData())x.push(E)}c(x.length==v);const S=B.getNumDataCodewords(g,i)*8;c(x.length<=S),n(0,Math.min(4,S-x.length),x),n(0,(8-x.length%8)%8,x),c(x.length%8==0);for(let b=236;x.length<S;b^=253)n(b,8,x);let y=[];for(;y.length*8<x.length;)y.push(0);return x.forEach((b,E)=>y[E>>>3]|=b<<7-(E&7)),new B(g,i,y,m)}getModule(s,i){return 0<=s&&s<this.size&&0<=i&&i<this.size&&this.modules[i][s]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const s=this.getAlignmentPatternPositions(),i=s.length;for(let l=0;l<i;l++)for(let d=0;d<i;d++)l==0&&d==0||l==0&&d==i-1||l==i-1&&d==0||this.drawAlignmentPattern(s[l],s[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(s){const i=this.errorCorrectionLevel.formatBits<<3|s;let l=i;for(let m=0;m<10;m++)l=l<<1^(l>>>9)*1335;const d=(i<<10|l)^21522;c(d>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,r(d,m));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,r(d,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,r(d,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,r(d,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let s=this.version;for(let l=0;l<12;l++)s=s<<1^(s>>>11)*7973;const i=this.version<<12|s;c(i>>>18==0);for(let l=0;l<18;l++){const d=r(i,l),m=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(m,p,d),this.setFunctionModule(p,m,d)}}drawFinderPattern(s,i){for(let l=-4;l<=4;l++)for(let d=-4;d<=4;d++){const m=Math.max(Math.abs(d),Math.abs(l)),p=s+d,g=i+l;0<=p&&p<this.size&&0<=g&&g<this.size&&this.setFunctionModule(p,g,m!=2&&m!=4)}}drawAlignmentPattern(s,i){for(let l=-2;l<=2;l++)for(let d=-2;d<=2;d++)this.setFunctionModule(s+d,i+l,Math.max(Math.abs(d),Math.abs(l))!=1)}setFunctionModule(s,i,l){this.modules[i][s]=l,this.isFunction[i][s]=!0}addEccAndInterleave(s){const i=this.version,l=this.errorCorrectionLevel;if(s.length!=B.getNumDataCodewords(i,l))throw new RangeError("Invalid argument");const d=B.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i],m=B.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i],p=Math.floor(B.getNumRawDataModules(i)/8),g=d-p%d,v=Math.floor(p/d);let x=[];const S=B.reedSolomonComputeDivisor(m);for(let b=0,E=0;b<d;b++){let R=s.slice(E,E+v-m+(b<g?0:1));E+=R.length;const D=B.reedSolomonComputeRemainder(R,S);b<g&&R.push(0),x.push(R.concat(D))}let y=[];for(let b=0;b<x[0].length;b++)x.forEach((E,R)=>{(b!=v-m||R>=g)&&y.push(E[b])});return c(y.length==p),y}drawCodewords(s){if(s.length!=Math.floor(B.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let i=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let d=0;d<this.size;d++)for(let m=0;m<2;m++){const p=l-m,v=(l+1&2)==0?this.size-1-d:d;!this.isFunction[v][p]&&i<s.length*8&&(this.modules[v][p]=r(s[i>>>3],7-(i&7)),i++)}}c(i==s.length*8)}applyMask(s){if(s<0||s>7)throw new RangeError("Mask value out of range");for(let i=0;i<this.size;i++)for(let l=0;l<this.size;l++){let d;switch(s){case 0:d=(l+i)%2==0;break;case 1:d=i%2==0;break;case 2:d=l%3==0;break;case 3:d=(l+i)%3==0;break;case 4:d=(Math.floor(l/3)+Math.floor(i/2))%2==0;break;case 5:d=l*i%2+l*i%3==0;break;case 6:d=(l*i%2+l*i%3)%2==0;break;case 7:d=((l+i)%2+l*i%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[i][l]&&d&&(this.modules[i][l]=!this.modules[i][l])}}getPenaltyScore(){let s=0;for(let m=0;m<this.size;m++){let p=!1,g=0,v=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[m][x]==p?(g++,g==5?s+=B.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),p||(s+=this.finderPenaltyCountPatterns(v)*B.PENALTY_N3),p=this.modules[m][x],g=1);s+=this.finderPenaltyTerminateAndCount(p,g,v)*B.PENALTY_N3}for(let m=0;m<this.size;m++){let p=!1,g=0,v=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[x][m]==p?(g++,g==5?s+=B.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),p||(s+=this.finderPenaltyCountPatterns(v)*B.PENALTY_N3),p=this.modules[x][m],g=1);s+=this.finderPenaltyTerminateAndCount(p,g,v)*B.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let p=0;p<this.size-1;p++){const g=this.modules[m][p];g==this.modules[m][p+1]&&g==this.modules[m+1][p]&&g==this.modules[m+1][p+1]&&(s+=B.PENALTY_N2)}let i=0;for(const m of this.modules)i=m.reduce((p,g)=>p+(g?1:0),i);const l=this.size*this.size,d=Math.ceil(Math.abs(i*20-l*10)/l)-1;return c(0<=d&&d<=9),s+=d*B.PENALTY_N4,c(0<=s&&s<=2568888),s}getAlignmentPatternPositions(){if(this.version==1)return[];{const s=Math.floor(this.version/7)+2,i=this.version==32?26:Math.ceil((this.version*4+4)/(s*2-2))*2;let l=[6];for(let d=this.size-7;l.length<s;d-=i)l.splice(1,0,d);return l}}static getNumRawDataModules(s){if(s<B.MIN_VERSION||s>B.MAX_VERSION)throw new RangeError("Version number out of range");let i=(16*s+128)*s+64;if(s>=2){const l=Math.floor(s/7)+2;i-=(25*l-10)*l-55,s>=7&&(i-=36)}return c(208<=i&&i<=29648),i}static getNumDataCodewords(s,i){return Math.floor(B.getNumRawDataModules(s)/8)-B.ECC_CODEWORDS_PER_BLOCK[i.ordinal][s]*B.NUM_ERROR_CORRECTION_BLOCKS[i.ordinal][s]}static reedSolomonComputeDivisor(s){if(s<1||s>255)throw new RangeError("Degree out of range");let i=[];for(let d=0;d<s-1;d++)i.push(0);i.push(1);let l=1;for(let d=0;d<s;d++){for(let m=0;m<i.length;m++)i[m]=B.reedSolomonMultiply(i[m],l),m+1<i.length&&(i[m]^=i[m+1]);l=B.reedSolomonMultiply(l,2)}return i}static reedSolomonComputeRemainder(s,i){let l=i.map(d=>0);for(const d of s){const m=d^l.shift();l.push(0),i.forEach((p,g)=>l[g]^=B.reedSolomonMultiply(p,m))}return l}static reedSolomonMultiply(s,i){if(s>>>8||i>>>8)throw new RangeError("Byte out of range");let l=0;for(let d=7;d>=0;d--)l=l<<1^(l>>>7)*285,l^=(i>>>d&1)*s;return c(l>>>8==0),l}finderPenaltyCountPatterns(s){const i=s[1];c(i<=this.size*3);const l=i>0&&s[2]==i&&s[3]==i*3&&s[4]==i&&s[5]==i;return(l&&s[0]>=i*4&&s[6]>=i?1:0)+(l&&s[6]>=i*4&&s[0]>=i?1:0)}finderPenaltyTerminateAndCount(s,i,l){return s&&(this.finderPenaltyAddHistory(i,l),i=0),i+=this.size,this.finderPenaltyAddHistory(i,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(s,i){i[0]==0&&(s+=this.size),i.pop(),i.unshift(s)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(f,s,i){if(s<0||s>31||f>>>s)throw new RangeError("Value out of range");for(let l=s-1;l>=0;l--)i.push(f>>>l&1)}function r(f,s){return(f>>>s&1)!=0}function c(f){if(!f)throw new Error("Assertion error")}const a=class se{constructor(s,i,l){if(this.mode=s,this.numChars=i,this.bitData=l,i<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(s){let i=[];for(const l of s)n(l,8,i);return new se(se.Mode.BYTE,s.length,i)}static makeNumeric(s){if(!se.isNumeric(s))throw new RangeError("String contains non-numeric characters");let i=[];for(let l=0;l<s.length;){const d=Math.min(s.length-l,3);n(parseInt(s.substring(l,l+d),10),d*3+1,i),l+=d}return new se(se.Mode.NUMERIC,s.length,i)}static makeAlphanumeric(s){if(!se.isAlphanumeric(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");let i=[],l;for(l=0;l+2<=s.length;l+=2){let d=se.ALPHANUMERIC_CHARSET.indexOf(s.charAt(l))*45;d+=se.ALPHANUMERIC_CHARSET.indexOf(s.charAt(l+1)),n(d,11,i)}return l<s.length&&n(se.ALPHANUMERIC_CHARSET.indexOf(s.charAt(l)),6,i),new se(se.Mode.ALPHANUMERIC,s.length,i)}static makeSegments(s){return s==""?[]:se.isNumeric(s)?[se.makeNumeric(s)]:se.isAlphanumeric(s)?[se.makeAlphanumeric(s)]:[se.makeBytes(se.toUtf8ByteArray(s))]}static makeEci(s){let i=[];if(s<0)throw new RangeError("ECI assignment value out of range");if(s<128)n(s,8,i);else if(s<16384)n(2,2,i),n(s,14,i);else if(s<1e6)n(6,3,i),n(s,21,i);else throw new RangeError("ECI assignment value out of range");return new se(se.Mode.ECI,0,i)}static isNumeric(s){return se.NUMERIC_REGEX.test(s)}static isAlphanumeric(s){return se.ALPHANUMERIC_REGEX.test(s)}getData(){return this.bitData.slice()}static getTotalBits(s,i){let l=0;for(const d of s){const m=d.mode.numCharCountBits(i);if(d.numChars>=1<<m)return 1/0;l+=4+m+d.bitData.length}return l}static toUtf8ByteArray(s){s=encodeURI(s);let i=[];for(let l=0;l<s.length;l++)s.charAt(l)!="%"?i.push(s.charCodeAt(l)):(i.push(parseInt(s.substring(l+1,l+3),16)),l+=2);return i}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let h=a;e.QrSegment=a})(Xe||(Xe={}));(e=>{(t=>{const n=class{constructor(c,a){this.ordinal=c,this.formatBits=a}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(Xe||(Xe={}));(e=>{(t=>{const n=class{constructor(c,a){this.modeBits=c,this.numBitsCharCount=a}numCharCountBits(c){return this.numBitsCharCount[Math.floor((c+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(Xe||(Xe={}));var Je=Xe;var Mi={L:Je.QrCode.Ecc.LOW,M:Je.QrCode.Ecc.MEDIUM,Q:Je.QrCode.Ecc.QUARTILE,H:Je.QrCode.Ecc.HIGH},Ir=128,Pr="L",Or="#FFFFFF",Lr="#000000",zr=!1,Fr=1,Ii=4,Pi=0,Oi=.1;function _r(e,t=0){const n=[];return e.forEach(function(r,c){let a=null;r.forEach(function(h,f){if(!h&&a!==null){n.push(`M${a+t} ${c+t}h${f-a}v1H${a+t}z`),a=null;return}if(f===r.length-1){if(!h)return;a===null?n.push(`M${f+t},${c+t} h1v1H${f+t}z`):n.push(`M${a+t},${c+t} h${f+1-a}v1H${a+t}z`);return}h&&a===null&&(a=f)})}),n.join("")}function Br(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((c,a)=>a<t.x||a>=t.x+t.w?c:!1))}function Li(e,t,n,r){if(r==null)return null;const c=e.length+n*2,a=Math.floor(t*Oi),h=c/t,f=(r.width||a)*h,s=(r.height||a)*h,i=r.x==null?e.length/2-f/2:r.x*h,l=r.y==null?e.length/2-s/2:r.y*h,d=r.opacity==null?1:r.opacity;let m=null;if(r.excavate){let g=Math.floor(i),v=Math.floor(l),x=Math.ceil(f+i-g),S=Math.ceil(s+l-v);m={x:g,y:v,w:x,h:S}}const p=r.crossOrigin;return{x:i,y:l,h:s,w:f,excavation:m,opacity:d,crossOrigin:p}}function zi(e,t){return t!=null?Math.max(Math.floor(t),0):e?Ii:Pi}function Ur({value:e,level:t,minVersion:n,includeMargin:r,marginSize:c,imageSettings:a,size:h,boostLevel:f}){let s=z.useMemo(()=>{const g=(Array.isArray(e)?e:[e]).reduce((v,x)=>(v.push(...Je.QrSegment.makeSegments(x)),v),[]);return Je.QrCode.encodeSegments(g,Mi[t],n,void 0,void 0,f)},[e,t,n,f]);const{cells:i,margin:l,numCells:d,calculatedImageSettings:m}=z.useMemo(()=>{let p=s.getModules();const g=zi(r,c),v=p.length+g*2,x=Li(p,h,g,a);return{cells:p,margin:g,numCells:v,calculatedImageSettings:x}},[s,h,a,r,c]);return{qrcode:s,margin:l,cells:i,numCells:d,calculatedImageSettings:m}}var Fi=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),_i=z.forwardRef(function(t,n){const r=t,{value:c,size:a=Ir,level:h=Pr,bgColor:f=Or,fgColor:s=Lr,includeMargin:i=zr,minVersion:l=Fr,boostLevel:d,marginSize:m,imageSettings:p}=r,v=dn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=v,S=dn(v,["style"]),y=p?.src,b=z.useRef(null),E=z.useRef(null),R=z.useCallback(N=>{b.current=N,typeof n=="function"?n(N):n&&(n.current=N)},[n]),[D,j]=z.useState(!1),{margin:C,cells:P,numCells:k,calculatedImageSettings:T}=Ur({value:c,level:h,minVersion:l,boostLevel:d,includeMargin:i,marginSize:m,imageSettings:p,size:a});z.useEffect(()=>{if(b.current!=null){const N=b.current,O=N.getContext("2d");if(!O)return;let V=P;const U=E.current,M=T!=null&&U!==null&&U.complete&&U.naturalHeight!==0&&U.naturalWidth!==0;M&&T.excavation!=null&&(V=Br(P,T.excavation));const _=window.devicePixelRatio||1;N.height=N.width=a*_;const $=a/k*_;O.scale($,$),O.fillStyle=f,O.fillRect(0,0,k,k),O.fillStyle=s,Fi?O.fill(new Path2D(_r(V,C))):P.forEach(function(oe,ce){oe.forEach(function(ee,A){ee&&O.fillRect(A+C,ce+C,1,1)})}),T&&(O.globalAlpha=T.opacity),M&&O.drawImage(U,T.x+C,T.y+C,T.w,T.h)}}),z.useEffect(()=>{j(!1)},[y]);const F=un({height:a,width:a},x);let X=null;return y!=null&&(X=z.createElement("img",{src:y,key:y,style:{display:"none"},onLoad:()=>{j(!0)},ref:E,crossOrigin:T?.crossOrigin})),z.createElement(z.Fragment,null,z.createElement("canvas",un({style:F,height:a,width:a,ref:R,role:"img"},S)),X)});_i.displayName="QRCodeCanvas";var $r=z.forwardRef(function(t,n){const r=t,{value:c,size:a=Ir,level:h=Pr,bgColor:f=Or,fgColor:s=Lr,includeMargin:i=zr,minVersion:l=Fr,boostLevel:d,title:m,marginSize:p,imageSettings:g}=r,v=dn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:x,cells:S,numCells:y,calculatedImageSettings:b}=Ur({value:c,level:h,minVersion:l,boostLevel:d,includeMargin:i,marginSize:p,imageSettings:g,size:a});let E=S,R=null;g!=null&&b!=null&&(b.excavation!=null&&(E=Br(S,b.excavation)),R=z.createElement("image",{href:g.src,height:b.h,width:b.w,x:b.x+x,y:b.y+x,preserveAspectRatio:"none",opacity:b.opacity,crossOrigin:b.crossOrigin}));const D=_r(E,x);return z.createElement("svg",un({height:a,width:a,viewBox:`0 0 ${y} ${y}`,ref:n,role:"img"},v),!!m&&z.createElement("title",null,m),z.createElement("path",{fill:f,d:`M0,0 h${y}v${y}H0z`,shapeRendering:"crispEdges"}),z.createElement("path",{fill:s,d:D,shapeRendering:"crispEdges"}),R)});$r.displayName="QRCodeSVG";function Kr(){return parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10)}function Bi(){return Yr({queryKey:he.tunnel.status,queryFn:()=>$e.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?5e3:!1})}function Ui(){const e=Ft();return fn({mutationFn:()=>$e.post("/tunnel/start",{port:Kr()}),onSuccess:()=>{e.invalidateQueries({queryKey:he.tunnel.status})}})}function $i(){const e=Ft();return fn({mutationFn:()=>$e.post("/tunnel/regenerate",{port:Kr()}),onSuccess:()=>{e.invalidateQueries({queryKey:he.tunnel.status})}})}function Ki(){const e=Ft();return fn({mutationFn:()=>$e.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:he.tunnel.status})}})}function Gi(e){if(!e||e.status==="stopped")return{button:"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100",dot:"",label:"Use Agent Tower on your phone",icon:"idle"};switch(e.status){case"healthy":case"checking":return{button:"text-emerald-600 hover:bg-emerald-50",dot:"bg-emerald-500",label:e.status==="healthy"?"Tunnel healthy":"Checking tunnel health",icon:"ok"};case"degraded":case"localUnhealthy":case"linkReplaced":return{button:"text-amber-600 hover:bg-amber-50",dot:"bg-amber-500",label:"Tunnel needs attention",icon:"warn"};case"exited":case"error":return{button:"text-red-600 hover:bg-red-50",dot:"bg-red-500",label:"Tunnel unavailable",icon:"error"};case"starting":return{button:"text-amber-600 hover:bg-amber-50",dot:"bg-amber-500",label:"Tunnel starting",icon:"loading"}}}function Wi(e){if(!e||e.status==="stopped")return"Tunnel is off";switch(e.status){case"healthy":return"Tunnel healthy";case"checking":return"Checking tunnel health";case"degraded":return"Observing original link";case"localUnhealthy":return"Local service unavailable";case"exited":return"Tunnel process exited";case"error":return"Tunnel error";case"linkReplaced":return"New link generated";case"starting":return"Tunnel starting"}}function Qi(e){if(!e||e.status==="stopped")return"Start a temporary Quick Tunnel when you need to share this Agent Tower session.";switch(e.status){case"healthy":return"The Cloudflare tunnel is running and the local Agent Tower health check passed.";case"checking":return"The Cloudflare tunnel is running. Agent Tower is waiting for the first local health check.";case"degraded":return"The original public URL is currently unreachable. Agent Tower is watching for it to recover and will not generate a new link automatically.";case"localUnhealthy":return"The local Agent Tower target is not responding, so the tunnel cannot be considered healthy.";case"exited":return"The tunnel process has exited. The old Quick Tunnel link is unlikely to recover.";case"error":return"The tunnel reported an error. Check the diagnostics before generating a new link.";case"linkReplaced":return"A new Quick Tunnel link was generated. The old link and token are no longer valid.";case"starting":return"Agent Tower is asking Cloudflare Quick Tunnel for a temporary public URL."}}function Zn(e){if(!e)return"Never";const t=new Date(e).getTime();if(!Number.isFinite(t))return e;const n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`${n}s ago`;const r=Math.round(n/60);if(r<60)return`${r}m ago`;const c=Math.round(r/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}function lt(e){const t=e?.trim();return t||null}function Yi(e){if(!e)return"";const t=[lt(e.lastLocalError),lt(e.lastRemoteError),lt(e.lastError)].filter(c=>c!==null),n=lt(e.lastProcessOutput),r=!!n&&(e.status==="error"||e.status==="exited"||!!lt(e.lastError));return n&&r&&t.push(n),t.join(`
8
- `)}function er(){const{t:e}=Me(),{data:t}=Bi(),n=Ui(),r=Ki(),c=$i(),[a,h]=u.useState(!1),[f,s]=u.useState(null),i=u.useRef(null),[l,d]=u.useState({top:0,right:0}),[m,p]=u.useState(!1),[g,v]=u.useState(!1),x=t?.status!==void 0&&t.status!=="stopped",S=n.isPending||t?.status==="starting",y=c.isPending,b=t?.shareableUrl,E=t?.token,R=Gi(t),D=Wi(t),j=Yi(t);u.useEffect(()=>{if(a&&i.current){const N=i.current.getBoundingClientRect();d({top:N.bottom+8,right:window.innerWidth-N.right})}},[a]);const C=u.useCallback(()=>{h(!0)},[x]),P=u.useCallback(()=>{n.mutate(void 0,{onSuccess:()=>h(!0)})},[n]),k=u.useCallback(()=>{b&&(navigator.clipboard.writeText(b),s("url"),setTimeout(()=>s(null),2e3))},[b]),T=u.useCallback(()=>{E&&(navigator.clipboard.writeText(E),s("token"),setTimeout(()=>s(null),2e3))},[E]),F=u.useCallback(()=>{r.mutate(),h(!1),p(!1),v(!1)},[r]),X=u.useCallback(()=>{c.mutate(void 0,{onSuccess:()=>{v(!1),h(!0)}})},[c]);return o.jsxs("div",{className:"relative",children:[o.jsx("button",{ref:i,onClick:C,disabled:S,className:`p-1.5 rounded-md transition-colors ${R.button}`,title:e(R.label),children:S?o.jsx(Cn,{size:16,className:"animate-spin"}):R.icon==="warn"?o.jsx(Hr,{size:16}):o.jsx(Mn,{size:16})}),x&&!S&&o.jsx("span",{className:`absolute top-0.5 right-0.5 w-2 h-2 ${R.dot} rounded-full`}),a&&!x&&He.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>h(!1)}),o.jsxs("div",{className:"fixed z-[101] w-80 max-w-[calc(100vw-1rem)] bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:l.top,right:l.right},children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"mt-0.5 flex size-7 items-center justify-center rounded-md bg-neutral-100 text-neutral-700",children:o.jsx(Mn,{size:16})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-neutral-900",children:e("Use Agent Tower on your phone")}),o.jsx("p",{className:"mt-1 text-xs leading-relaxed text-neutral-500",children:e("After enabling the tunnel, you can scan a QR code with your phone to visit this Agent Tower instance, assign tasks, and check agent status.")})]})]}),o.jsx("button",{onClick:()=>h(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:o.jsx(Sn,{size:14})})]}),o.jsxs("button",{onClick:P,disabled:S,className:"mt-3 w-full px-3 py-2 text-xs font-medium text-white bg-neutral-900 hover:bg-neutral-800 rounded-md transition-colors disabled:opacity-50 flex items-center justify-center gap-1.5",children:[S&&o.jsx(Cn,{size:13,className:"animate-spin"}),e(S?"Starting tunnel...":"Enable phone access")]})]})]}),document.body),a&&x&&He.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>h(!1)}),o.jsxs("div",{className:"fixed z-[101] w-96 max-w-[calc(100vw-1rem)] bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:l.top,right:l.right},children:[o.jsxs("div",{className:"flex items-start justify-between mb-2",children:[o.jsxs("div",{children:[o.jsxs("span",{className:`text-xs font-medium flex items-center gap-1.5 ${t?.status==="healthy"||t?.status==="checking"?"text-emerald-600":t?.status==="exited"||t?.status==="error"?"text-red-600":"text-amber-600"}`,children:[o.jsx("span",{className:`w-1.5 h-1.5 ${R.dot} rounded-full inline-block`}),e(D)]}),o.jsx("p",{className:"mt-1 text-xs text-neutral-500 leading-relaxed",children:e(Qi(t))})]}),o.jsx("button",{onClick:()=>h(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:o.jsx(Sn,{size:14})})]}),E&&o.jsxs("div",{className:"flex items-center gap-1.5 mb-2 px-2 py-1 bg-neutral-50 rounded text-xs text-neutral-700",children:[o.jsx(as,{size:12}),o.jsx("span",{children:e("Token protected")})]}),b&&o.jsx("div",{className:"flex justify-center py-3",children:o.jsx($r,{value:b,size:160})}),b||t?.url?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{readOnly:!0,value:b??t?.url??"",className:"flex-1 min-w-0 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-700 select-all",onFocus:N=>N.target.select()}),o.jsx("button",{onClick:k,disabled:!b,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors disabled:opacity-40",title:e("Copy shareable link"),children:f==="url"?o.jsx(gt,{size:14,className:"text-emerald-500"}):o.jsx(An,{size:14})})]}):o.jsx("div",{className:"rounded-md border border-neutral-200 bg-neutral-50 px-2 py-1.5 text-xs text-neutral-500",children:e("No tunnel link available")}),o.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{className:"rounded-md border border-neutral-200 px-2 py-1.5",children:[o.jsx("div",{className:"text-neutral-500",children:e("Last checked")}),o.jsx("div",{className:"mt-0.5 text-neutral-800",children:Zn(t?.lastCheckedAt)})]}),o.jsxs("div",{className:"rounded-md border border-neutral-200 px-2 py-1.5",children:[o.jsx("div",{className:"text-neutral-500",children:e("Last healthy")}),o.jsx("div",{className:"mt-0.5 text-neutral-800",children:Zn(t?.lastHealthyAt)})]})]}),j&&o.jsx("div",{className:"mt-2 rounded-md border border-amber-200 bg-amber-50 px-2 py-1.5 text-xs text-amber-800 whitespace-pre-wrap break-words max-h-28 overflow-auto",children:j}),t?.status==="degraded"&&o.jsx("div",{className:"mt-2 rounded-md border border-amber-200 bg-amber-50 px-2 py-1.5 text-xs text-amber-800",children:e("Agent Tower is keeping the same URL and waiting for Cloudflare Quick Tunnel to recover.")}),t?.status==="linkReplaced"&&o.jsx("div",{className:"mt-2 rounded-md border border-amber-200 bg-amber-50 px-2 py-1.5 text-xs text-amber-800",children:e("The previous tunnel link and token are no longer valid.")}),E&&o.jsxs("div",{className:"mt-2",children:[o.jsx("button",{onClick:()=>p(!m),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:e(m?"Hide token":"Show token")}),m&&o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[o.jsx("code",{className:"flex-1 min-w-0 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-600 break-all",children:E}),o.jsx("button",{onClick:T,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:e("Copy token"),children:f==="token"?o.jsx(gt,{size:14,className:"text-emerald-500"}):o.jsx(An,{size:14})})]})]}),g&&o.jsxs("div",{className:"mt-3 rounded-md border border-red-200 bg-red-50 p-2 text-xs text-red-700",children:[o.jsx("div",{children:e("Generating a new link will invalidate the current link. People using the old URL must receive the new one.")}),o.jsxs("div",{className:"mt-2 flex gap-2",children:[o.jsx("button",{onClick:()=>v(!1),className:"flex-1 px-2 py-1 rounded-md bg-white text-neutral-700 border border-neutral-200 hover:bg-neutral-50",children:e("Cancel")}),o.jsx("button",{onClick:X,disabled:y,className:"flex-1 px-2 py-1 rounded-md bg-red-600 text-white hover:bg-red-700 disabled:opacity-50",children:e(y?"Generating...":"Regenerate link")})]})]}),!g&&o.jsxs("button",{onClick:()=>v(!0),disabled:y||t?.canRegenerate===!1,className:"mt-3 w-full px-3 py-1.5 text-xs text-amber-700 hover:bg-amber-50 rounded-md transition-colors disabled:opacity-40 flex items-center justify-center gap-1.5",children:[o.jsx(Xr,{size:13}),e("Regenerate link")]}),o.jsx("button",{onClick:F,disabled:r.isPending,className:"mt-2 w-full px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 rounded-md transition-colors",children:r.isPending?e("Stopping..."):e("Stop Tunnel")})]})]}),document.body)]})}function tn({isOpen:e,onClose:t}){const{t:n}=Me(),r=ms(),[c,a]=u.useState(""),[h,f]=u.useState(""),[s,i]=u.useState(null),[l,d]=u.useState(!1),[m,p]=u.useState(!1),g=c.trim(),v=h.trim(),x=l||r.isPending,S=u.useMemo(()=>!!(g&&v&&!x),[g,v,x]),y=u.useCallback(()=>{a(""),f(""),i(null),p(!1)},[]),b=u.useCallback(()=>{x||(y(),t())},[x,t,y]);u.useEffect(()=>{e||y()},[e,y]);const E=u.useCallback(async C=>{try{await r.mutateAsync({name:g,repoPath:v,initEmptyRepo:C}),y(),t()}catch(P){const k=P instanceof Error?P.message:n("Failed to create project");i(k),ze.error(k)}},[r,t,y,n,g,v]),R=u.useCallback(async()=>{if(!(!g||!v||x)){i(null),d(!0);try{const C=await $e.get("/filesystem/validate",{params:{path:v}});if(!C.valid){i(C.error??n("Selected path is not a valid directory"));return}if(C.isGitRepo){await E(!1);return}if(C.reason==="no_git"&&C.isEmpty){p(!0);return}if(C.reason==="no_git"){await E(!1);return}await E(!1)}catch(C){i(C instanceof Error?C.message:n("Could not check project path"))}finally{d(!1)}}},[E,x,n,g,v]),D=u.useCallback(()=>{p(!1),E(!1)},[E]),j=u.useCallback(()=>{p(!1),E(!0)},[E]);return o.jsxs(o.Fragment,{children:[o.jsx(Dn,{isOpen:e,onClose:b,title:n("Create New Project"),action:o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:b,disabled:x,className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:n("Cancel")}),o.jsx("button",{onClick:R,disabled:!S,className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${S?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:l?n("Checking..."):r.isPending?n("Creating..."):n("Create Project")})]}),children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:n("Project Name")}),o.jsx("input",{type:"text",value:c,onChange:C=>a(C.target.value),placeholder:n("e.g., Agent Tower"),disabled:x,className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors disabled:bg-neutral-50 disabled:text-neutral-400",autoFocus:!0})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:n("Project Path")}),o.jsx(ss,{value:h,onChange:f,validationMode:"directory"})]}),s&&o.jsx("p",{className:"text-xs text-red-500 leading-relaxed",children:s})]})}),o.jsx(Dn,{isOpen:m,onClose:()=>{r.isPending||p(!1)},title:n("Initialize Git repository?"),action:o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>p(!1),disabled:r.isPending,className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:n("Cancel")}),o.jsx("button",{onClick:D,disabled:r.isPending,className:"px-4 py-2 text-sm font-medium rounded-lg border border-neutral-200 text-neutral-700 hover:bg-neutral-50 transition-colors disabled:opacity-50",children:n("Create Local Project")}),o.jsx("button",{onClick:j,disabled:r.isPending,className:"px-4 py-2 text-sm font-medium rounded-lg bg-neutral-900 text-white hover:bg-black transition-colors disabled:opacity-50",children:r.isPending?n("Creating..."):n("Initialize and Create")})]}),children:o.jsxs("div",{className:"space-y-3 text-sm text-neutral-600 leading-relaxed",children:[o.jsx("p",{children:n("This directory is empty and does not have Git version control yet. Agent Tower can initialize Git and create the initial commit before creating the project.")}),o.jsx("p",{children:n("You can also create it as a local project now. Local projects only support local Solo tasks until Git is initialized.")})]})})]})}function tr(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function Hi(e){return e.map((t,n)=>({project:t,index:n,activityTime:tr(t.lastActivityAt??t.createdAt),createdTime:tr(t.createdAt)})).sort((t,n)=>{const r=n.activityTime-t.activityTime;if(r!==0)return r;const c=n.createdTime-t.createdTime;return c!==0?c:t.index-n.index}).map(({project:t})=>t)}const Xi=u.lazy(()=>ir(()=>import("./TaskDetail-B3pOSx3f.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43])).then(e=>({default:e.TaskDetail}))),qi=u.lazy(()=>ir(()=>import("./MobileTaskDetail-BOIFPybn.js"),__vite__mapDeps([44,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43])).then(e=>({default:e.MobileTaskDetail})));function nr(){const{t:e}=Me();return o.jsx("div",{role:"status",className:"flex flex-1 items-center justify-center bg-background p-4 text-sm text-muted-foreground",children:e("Loading...")})}function rr({projects:e,filterProjectId:t,setFilterProjectId:n,onCreateProject:r,className:c}){const{t:a}=Me(),[h,f]=u.useState(!1),s=e.filter(l=>!l.archivedAt),i=t?e.find(l=>l.id===t)??null:null;return o.jsxs("div",{className:me("relative flex items-center min-w-0",c),children:[o.jsx("span",{className:"mx-1.5 text-muted-foreground/40 select-none",children:"/"}),o.jsxs("button",{onClick:()=>f(l=>!l),className:"flex items-center gap-1.5 px-2 py-1 rounded-md text-sm text-foreground/90 hover:bg-accent transition-colors min-w-0",children:[i?o.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${i.color.replace("text-","bg-")}`}):o.jsx(nn,{size:13,className:"text-muted-foreground shrink-0"}),o.jsx("span",{className:"truncate max-w-[200px] font-medium",children:i?i.name:a("All Projects")}),o.jsx(vs,{size:13,className:`text-muted-foreground/70 shrink-0 transition-transform duration-200 ${h?"rotate-180":""}`})]}),h?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>f(!1)}),o.jsxs("div",{className:"absolute left-4 top-full mt-1.5 w-60 bg-popover border border-border rounded-lg shadow-lg shadow-black/5 z-40 py-1 animate-in fade-in zoom-in-95 duration-100 origin-top-left",children:[o.jsxs("button",{onClick:()=>{n(null),f(!1)},className:"w-full text-left px-3 py-1.5 text-[13px] flex items-center gap-2 hover:bg-accent/50 transition-colors",children:[o.jsx(nn,{size:13,className:"text-muted-foreground shrink-0"}),o.jsx("span",{className:`flex-1 truncate ${t===null?"text-foreground font-medium":"text-muted-foreground"}`,children:a("All Projects")}),t===null?o.jsx(gt,{size:14,className:"text-foreground shrink-0"}):null]}),o.jsx("div",{className:"h-px bg-border/60 my-1 mx-2"}),o.jsx("div",{className:"max-h-[40vh] overflow-y-auto scrollbar-app-thin",children:s.map(l=>{const d=t===l.id;return o.jsxs("button",{onClick:()=>{n(l.id),f(!1)},className:"w-full text-left px-3 py-1.5 text-[13px] flex items-center gap-2 hover:bg-accent/50 transition-colors",children:[o.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${l.color.replace("text-","bg-")}`}),o.jsx("span",{className:`flex-1 truncate ${d?"text-foreground font-medium":"text-muted-foreground"}`,children:l.name}),d?o.jsx(gt,{size:14,className:"text-foreground shrink-0"}):null]},l.id)})}),o.jsx("div",{className:"h-px bg-border/60 my-1 mx-2"}),o.jsxs("button",{onClick:()=>{f(!1),r()},className:"w-full text-left px-3 py-1.5 text-[13px] flex items-center gap-2 text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors",children:[o.jsx(ds,{size:13}),o.jsx("span",{children:a("Create New Project...")})]})]})]}):null]})}const Vi=260,Ji=600,sr=400,Zi=100,ea=1e3;function ta(e){const t=e.workspaces?.find(r=>r.status==="ACTIVE")??e.workspaces?.[0],n=t?.sessions?.at(-1);return{id:e.id,projectId:e.projectId,title:e.titlePreview??e.title,status:e.status,priority:e.priority,...t?{preferredWorkspace:{...t.workspaceKind===et.MAIN_DIRECTORY?{workspaceKind:et.MAIN_DIRECTORY}:{},branchName:t.branchName}}:{},...n?{latestAgentType:n.agentType}:{},...e.workspaces?.some(r=>r.sessions?.some(c=>c.status==="RUNNING"||c.status==="PENDING"))?{hasRunningSession:!0}:{},updatedAt:e.updatedAt?new Date(e.updatedAt).getTime():Date.now()}}function na(){const{t:e,locale:t}=Me(),[n,r]=u.useState(null),[c,a]=u.useState(null),[h,f]=u.useState(sr),[s,i]=u.useState(!1),[l,d]=u.useState("idle"),[m,p]=u.useState({}),g=u.useRef(!1),v=u.useRef(0),x=u.useRef(sr),S=u.useRef(null),y=Ft(),{data:b,isLoading:E}=ps(),{data:R,isLoading:D}=gs({limit:Zi}),j=u.useMemo(()=>R?.data??[],[R?.data]),C=c&&j.some(w=>w.id===c)?c:null,{data:P,isLoading:k}=qr({...C?{projectId:C}:{},limit:ea}),T=u.useMemo(()=>P?.data??[],[P?.data]),[F,X]=u.useState([]),N=u.useMemo(()=>{if(F.length===0)return T;const w=new Set(T.map(I=>I.id));return[...F.filter(I=>!w.has(I.id)),...T]},[T,F]),[O,V]=u.useState(null),U=u.useMemo(()=>n&&N.some(w=>w.id===n)?n:O&&n===O?O:null,[n,N,O]);u.useEffect(()=>{O&&N.some(w=>w.id===O)&&V(null)},[O,N]),u.useEffect(()=>{if(F.length===0)return;const w=new Set(T.map(I=>I.id));F.some(I=>w.has(I.id))&&X(I=>I.filter(W=>!w.has(W.id)))},[T,F]);const M=u.useMemo(()=>Hi(j),[j]),_=u.useMemo(()=>M.map(ki),[M]),$=u.useMemo(()=>M.filter(w=>!w.archivedAt),[M]),oe=u.useMemo(()=>{if(!b)return[];const w=localStorage.getItem("providerUsageCount"),I=w?JSON.parse(w):{};return[...b].sort((W,Y)=>{const H=W.availability.type!=="NOT_FOUND",Z=Y.availability.type!=="NOT_FOUND";if(H!==Z)return H?-1:1;const J=I[W.provider.id]??0;return(I[Y.provider.id]??0)-J})},[b]),ce=u.useMemo(()=>N.map(w=>Ti(w,j.find(I=>I.id===w.projectId))),[j,N]),ee=u.useMemo(()=>{if(!U)return null;const w=N.find(W=>W.id===U);if(!w)return null;const I=j.find(W=>W.id===w.projectId);if(!I){const W=w.preferredWorkspace?w.preferredWorkspace.workspaceKind===et.MAIN_DIRECTORY?"Project directory":w.preferredWorkspace.branchName:"—";return{id:w.id,projectId:w.projectId,projectName:"Unknown",projectColor:"text-muted-foreground",title:w.title,status:wn(w.status),priority:w.priority,branch:W,mainBranch:"main",description:"",isGitRepo:!1,worktreeReady:!1,reason:"NO_GIT",projectArchivedAt:null,projectRepoDeletedAt:null}}return Ai(w,I)},[U,N,j]),A=Vr(),Q=Jr(),L=Zr(),re=es(),G=ls(),K=u.useCallback(w=>{const I=ta(w);X(W=>W.some(Y=>Y.id===w.id)?W.map(Y=>Y.id===w.id?I:Y):[I,...W]),y.setQueryData(he.tasks.detail(w.id),w),V(w.id),r(w.id)},[y]),ie=u.useCallback((w,I,W)=>{const Y=w.id,H=[w.title,w.description].filter(Boolean).join(`
9
-
10
- `),Z=W===et.WORKTREE?$.find(J=>J.id===w.projectId)?.setupScript??null:null;p(J=>({...J,[Y]:{status:"creating-workspace",setupScript:Z}})),(async()=>{try{const J=await $e.post(`/tasks/${Y}/workspaces`,{workspaceKind:W});p(te=>({...te,[Y]:{status:"creating-session",setupScript:Z}}));const pe=await $e.post(`/workspaces/${J.id}/sessions`,{providerId:I,prompt:H});p(te=>({...te,[Y]:{status:"starting-session",setupScript:Z}})),await G.mutateAsync(pe.id),await y.invalidateQueries({queryKey:he.workspaces.list(Y)}),await y.invalidateQueries({queryKey:he.workspaces.setupProgress(Y)}),await y.invalidateQueries({queryKey:he.tasks.all}),p(te=>{const{[Y]:de,...xe}=te;return xe})}catch(J){const pe=J instanceof Error?J.message:e("启动 Agent 失败");p(te=>({...te,[Y]:{status:"failed",error:pe,setupScript:Z}})),ze.error(e("任务已创建,但启动 Agent 失败,可在详情中重试")),y.invalidateQueries({queryKey:he.workspaces.list(Y)}),y.invalidateQueries({queryKey:he.tasks.all})}})()},[$,y,G,e]),ke=u.useCallback(w=>{p(I=>{const{[w]:W,...Y}=I;return Y}),y.invalidateQueries({queryKey:he.workspaces.list(w)}),y.invalidateQueries({queryKey:he.tasks.all})},[y]),be=u.useCallback(w=>{Q.mutate(w,{onSuccess:()=>{U===w&&r(null),p(I=>{const{[w]:W,...Y}=I;return Y}),X(I=>I.filter(W=>W.id!==w)),y.invalidateQueries({queryKey:he.tasks.all})},onError:()=>{ze.error(e("删除任务失败"))}})},[Q,U,y,e]),Te=u.useCallback((w,I)=>{L.mutate({id:w,status:Ri(I)},{onError:()=>{ze.error(e("状态变更失败,该操作不被允许"))}})},[L,e]),ye=u.useCallback((w,I)=>{re.mutate({id:w,priority:I},{onError:()=>{ze.error(e("优先级变更失败"))}})},[re,e]),qe=u.useCallback(w=>{w.preventDefault(),g.current=!0,v.current=w.clientX,x.current=h,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[h]);u.useEffect(()=>{const w=W=>{if(!g.current)return;const Y=W.clientX-v.current,H=Math.max(Vi,Math.min(Ji,x.current+Y));f(H)},I=()=>{g.current&&(g.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",w),document.addEventListener("mouseup",I),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",I)}},[]);const Ee=u.useCallback(()=>{i(!0)},[]),St=u.useCallback(()=>{if($.length===0){ze.error(e("没有可用项目,请先创建或恢复项目"));return}r(null)},[$,e]),Ve=u.useCallback(()=>{i(!1)},[]),Ke=u.useCallback(async w=>{const{title:I,description:W,projectId:Y,providerId:H,mode:Z,workspaceMode:J,teamRunMode:pe,teamTemplateId:te,memberPresetIds:de,attachmentLinks:xe,priority:_e}=w,ae=[W,xe].filter(Boolean).join(`
11
-
12
- `);let fe=null;try{if(d("creating-task"),fe=await $e.post(`/projects/${Y}/tasks`,{title:I,description:ae||void 0,priority:_e}),localStorage.setItem("lastSelectedProjectId",Y),Z==="SOLO"&&H){localStorage.setItem("lastSelectedProviderId",H);const Ce=localStorage.getItem("providerUsageCount"),Le=Ce?JSON.parse(Ce):{};Le[H]=(Le[H]??0)+1,localStorage.setItem("providerUsageCount",JSON.stringify(Le))}Z==="TEAM"?(d("creating-teamrun"),await A.mutateAsync({taskId:fe.id,mode:pe,...te?{teamTemplateId:te}:{},...de.length>0?{memberPresetIds:de}:{}})):H&&ie(fe,H,J),C&&Y!==C&&a(null),K(fe),d("idle"),y.invalidateQueries({queryKey:he.tasks.all}),y.invalidateQueries({queryKey:he.projects.all})}catch(ge){if(d("idle"),fe&&Z==="TEAM"){try{await Q.mutateAsync(fe.id)}catch{}throw ze.error(e("TeamRun 创建失败,请检查团队配置后重试")),ge}else if(fe)C&&Y!==C&&a(null),K(fe),y.invalidateQueries({queryKey:he.tasks.all}),y.invalidateQueries({queryKey:he.projects.all});else throw ze.error(ge instanceof Error?ge.message:e("Failed to create task")),ge}},[$,A,ie,Q,y,e,C,K]),Ne=D||k,Ge=u.useMemo(()=>$.map(w=>({id:w.id,name:w.name,color:_.find(I=>I.id===w.id)?.color,repoPath:w.repoPath,isGitRepo:w.isGitRepo,worktreeReady:w.worktreeReady,reason:w.reason})),[$,_]),We=u.useMemo(()=>oe.map(w=>{const I=Ht(w);return{id:w.provider.id,name:w.provider.name,agentType:w.provider.agentType,available:!I,permissionMode:w.provider.executionPermission,reason:I}}),[oe]),Ae=u.useMemo(()=>{if(C&&$.find(I=>I.id===C))return C;const w=localStorage.getItem("lastSelectedProjectId");return w&&$.find(I=>I.id===w)?w:$[0]?.id??""},[$,C]),[rt,st]=u.useState(Ae);u.useEffect(()=>{st(Ae)},[Ae]);const Et=u.useMemo(()=>$.find(w=>w.id===rt)?.name??$.find(w=>w.id===Ae)?.name??e("Project"),[$,rt,Ae,e]),Ie=t==="zh-CN"?`你需要在 ${Et} 中做点什么?`:`What do you need to do in ${Et}?`,Pe=u.useMemo(()=>{const w=localStorage.getItem("lastSelectedProviderId");return w&&oe.find(W=>W.provider.id===w&&!Ht(W))?w:oe.find(W=>!Ht(W))?.provider.id??""},[oe]),Qe=kr(),[Nt,we]=u.useState(!1),{usesIntegratedTitlebar:Oe,desktopPlatform:Gt,hasMacTrafficLights:Wt}=or(),ot=Oe&&Gt==="win32",Rt=u.useCallback(()=>{if($.length===0){ze.error(e("没有可用项目,请先创建或恢复项目"));return}we(!0)},[$,e]),Qt=u.useCallback(async w=>{await Ke(w),we(!1)},[Ke]);return Qe?Nt?o.jsxs("div",{className:"flex flex-col h-dvh bg-background overflow-hidden text-sm",children:[o.jsx("header",{className:"h-12 border-b border-border/60 flex items-center px-4 shrink-0",children:o.jsx("button",{onClick:()=>we(!1),className:"text-sm text-muted-foreground active:text-foreground",children:e("Cancel")})}),o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-4 pb-[8vh]",children:[o.jsx("h1",{className:"max-w-full text-center text-[20px] font-medium tracking-tight leading-snug text-foreground mb-5 break-words",children:Ie}),o.jsx(kn,{projects:Ge,providers:We,isProvidersLoading:E,onSubmit:Qt,defaultProjectId:Ae,defaultProviderId:Pe,onProjectChange:st,createStep:l})]})]}):U&&ee?o.jsxs(o.Fragment,{children:[o.jsx(u.Suspense,{fallback:o.jsx("div",{className:"flex h-dvh",children:o.jsx(nr,{})}),children:o.jsx(qi,{task:ee,onBack:()=>r(null),onDeleteTask:ee.projectArchivedAt?void 0:be,onTaskPriorityChange:ee.projectArchivedAt?void 0:ye,isDeleting:Q.isPending,autoStartState:m[ee.id]??null,onAutoStartRecovered:ke})}),o.jsx(tn,{isOpen:s,onClose:Ve})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col h-dvh bg-sidebar overflow-hidden text-sm",children:[o.jsxs("header",{className:"h-12 bg-sidebar flex items-center px-4 justify-between shrink-0 z-20",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(Tn,{}),o.jsx(rr,{projects:_,filterProjectId:C,setFilterProjectId:a,onCreateProject:Ee})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(er,{}),o.jsx("button",{onClick:()=>Nn.getState().openSettings(),className:"p-1.5 text-muted-foreground/70 active:text-foreground rounded-md",children:o.jsx(En,{size:16})})]})]}),o.jsx(Vn,{tasks:ce,projects:_,selectedTaskId:null,onSelectTask:r,filterProjectId:C,setFilterProjectId:a,width:"100%",onCreateTask:Rt,onCreateProject:Ee,onTaskStatusChange:Te,onTaskPriorityChange:ye,isLoading:Ne&&ce.length===0})]}),o.jsx(tn,{isOpen:s,onClose:Ve})]}):o.jsxs("div",{ref:S,className:"flex flex-col h-screen bg-sidebar overflow-hidden text-sm",children:[o.jsxs("header",{className:me("h-12 bg-sidebar flex items-center px-4 justify-between flex-shrink-0 z-20 relative",Oe&&"app-region-drag",ot&&"pr-[150px]"),children:[o.jsxs("div",{className:me("flex items-center gap-2 min-w-0",Wt&&"pl-[72px]"),children:[o.jsx(Tn,{}),o.jsx(rr,{projects:_,filterProjectId:C,setFilterProjectId:a,onCreateProject:Ee,className:Oe?"app-region-no-drag":void 0})]}),o.jsxs("div",{className:me("flex items-center gap-1",Oe&&"app-region-no-drag"),children:[o.jsx("div",{className:Oe?"app-region-no-drag":void 0,children:o.jsx(er,{})}),o.jsx("button",{onClick:()=>Nn.getState().openSettings(),className:me("p-1.5 text-muted-foreground/70 hover:text-foreground hover:bg-accent rounded-md transition-colors",Oe&&"app-region-no-drag"),children:o.jsx(En,{size:16})})]})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx(Vn,{tasks:ce,projects:_,selectedTaskId:U,onSelectTask:r,filterProjectId:C,setFilterProjectId:a,width:h,onCreateTask:St,onCreateProject:Ee,isCreateActive:!U,onTaskStatusChange:Te,onDeleteTask:be,onTaskPriorityChange:ye,isLoading:Ne&&ce.length===0}),o.jsx("div",{onMouseDown:qe,className:"w-1 cursor-col-resize hover:bg-border active:bg-ring/40 transition-colors z-50 -ml-[2px] flex-shrink-0 h-full",title:e("Drag to resize")}),o.jsx("div",{className:"flex-1 flex min-w-0 mb-2 mr-2 rounded-xl border border-border/50 bg-background overflow-hidden",children:U&&ee?o.jsx(u.Suspense,{fallback:o.jsx(nr,{}),children:o.jsx(Xi,{task:ee,onDeleteTask:ee.projectArchivedAt?void 0:be,isDeleting:Q.isPending,onTaskStatusChange:ee.projectArchivedAt?void 0:Te,onTaskPriorityChange:ee.projectArchivedAt?void 0:ye,autoStartState:m[ee.id]??null,onAutoStartRecovered:ke})}):U&&!ee?o.jsx("div",{className:"flex-1 flex items-center justify-center bg-background min-w-0",children:o.jsx("span",{className:"text-sm text-muted-foreground/70",children:e("Loading...")})}):o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center bg-background min-w-0 px-8 pb-[10vh]",children:o.jsxs("div",{className:"w-full max-w-2xl flex flex-col items-center animate-[fadeInUp_0.5s_cubic-bezier(0.16,1,0.3,1)]",children:[o.jsx("h1",{className:"max-w-full text-center text-[26px] font-medium tracking-tight leading-snug text-foreground mb-6 break-words",children:Ie}),o.jsx(kn,{projects:Ge,providers:We,isProvidersLoading:E,onSubmit:Ke,defaultProjectId:Ae,defaultProviderId:Pe,onProjectChange:st,createStep:l})]})})})]}),o.jsx(tn,{isOpen:s,onClose:Ve})]})}const Sa=Object.freeze(Object.defineProperty({__proto__:null,ProjectKanbanPage:na},Symbol.toStringTag,{value:"Module"}));export{ni as D,Sa as P};
@@ -1,2 +0,0 @@
1
- import{u as I,r as a,p as ue,j as e,X as se,B as R,ak as me,t as O,S as $,al as xe,h as Q,v as H,l as U,T as pe,Y as he,aa as fe}from"./index-CMJV-mgF.js";import{u as re,a as ge,b as je,c as be}from"./use-projects-DI27nNwl.js";import{F as X}from"./task-CDYaC_No.js";import{F as Y}from"./task-priority-acVgTiil.js";import{P as ne,T as ve}from"./trash-2-Bc-URu8c.js";import{F as Ne}from"./status-styles-sQm4KLdp.js";import{M as V}from"./modal-DeigO7aN.js";import{f as ye,F as Pe}from"./use-workspaces-d4n9m9cX.js";import{S as ke}from"./SettingsMasterDetail-BuxwsR9R.js";import{B as we}from"./BranchSelect-Dmp5hq0i.js";import"./arrow-down-BVePf1ZM.js";import"./check-qs0S_9rB.js";import"./copy-DejkmIHZ.js";import"./agent-meta-MzuGtqxl.js";import"./AgentLogo-BDyW3ihb.js";import"./circle-alert-Cbvy2cMo.js";import"./chevron-down-BaQEBzp3.js";function Se({value:t,onChange:x,repoPath:o,placeholder:v,disabled:i,disabledMessage:l}){const{t:u}=I(),[d,b]=a.useState(""),[m,n]=a.useState([]),[p,f]=a.useState(!1),[g,y]=a.useState(-1),P=a.useRef(null),A=a.useRef(null),D=a.useRef(void 0),q=a.useCallback(async s=>{if(i||!o||!s){n([]),f(!1);return}try{const c=await ue.get("/filesystem/complete",{params:{basePath:o,prefix:s}});n(c.results),f(c.results.length>0),y(-1)}catch{n([]),f(!1)}},[i,o]);a.useEffect(()=>{if(clearTimeout(D.current),!d){n([]),f(!1);return}return D.current=setTimeout(()=>q(d),200),()=>clearTimeout(D.current)},[d,q]),a.useEffect(()=>{const s=c=>{A.current&&!A.current.contains(c.target)&&P.current&&!P.current.contains(c.target)&&f(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{if(i)return;const c=s.trim();!c||t.includes(c)||(x([...t,c]),b(""),f(!1),P.current?.focus())},S=s=>{i||x(t.filter((c,z)=>z!==s))},F=s=>{i||(s.type==="directory"?(b(s.path),P.current?.focus()):w(s.path))},M=(s,c)=>{i||(c.stopPropagation(),w(s.path.replace(/\/$/,"")))},E=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||i||(p&&m.length>0?s.key==="ArrowDown"?(s.preventDefault(),y(c=>Math.min(c+1,m.length-1))):s.key==="ArrowUp"?(s.preventDefault(),y(c=>Math.max(c-1,-1))):s.key==="Enter"?(s.preventDefault(),g>=0?F(m[g]):w(d)):s.key==="Escape"&&f(!1):s.key==="Enter"&&(s.preventDefault(),w(d)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((s,c)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(X,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(Y,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>S(c),disabled:i,className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0 disabled:cursor-not-allowed disabled:hover:text-neutral-300",children:e.jsx(se,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:P,type:"text",value:d,onChange:s=>b(s.target.value),onKeyDown:E,onFocus:()=>{d&&m.length>0&&f(!0)},placeholder:v??u("输入文件路径..."),disabled:i,className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300 disabled:cursor-not-allowed disabled:bg-neutral-50 disabled:text-neutral-400"}),e.jsxs("button",{onClick:()=>w(d),disabled:i||!d.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(ne,{size:14}),e.jsx("span",{children:u("添加")})]})]}),p&&e.jsx("div",{ref:A,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:m.map((s,c)=>e.jsxs("button",{onClick:()=>F(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${c===g?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(Y,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(X,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:z=>M(s,z),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:u("添加此目录"),children:e.jsx(Ne,{size:14})})]},s.path))})]}),i&&l&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:l})]})}function Ce({value:t,onChange:x}){const{t:o}=I(),[v,i]=a.useState(""),[l,u]=a.useState(""),d=()=>{const n=v.trim(),p=l.trim();!n||!p||(x([...t,{name:n,command:p}]),i(""),u(""))},b=n=>{x(t.filter((p,f)=>f!==n))},m=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),d())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((n,p)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:n.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:n.command}),e.jsx("button",{onClick:()=>b(p),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(se,{size:14})})]},p))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:v,onChange:n=>i(n.target.value),onKeyDown:m,placeholder:o("名称"),className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:l,onChange:n=>u(n.target.value),onKeyDown:m,placeholder:o("命令"),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:d,disabled:!v.trim()||!l.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(ne,{size:14}),e.jsx("span",{children:o("添加")})]})]})]})}function Re({projectId:t}){const{t:x}=I(),o=ye(t);return e.jsxs("div",{className:"py-5 first:pt-0 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:x("Default base branch")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:x("New task and TeamRun main workspaces start from this branch. Existing workspaces keep their base branch.")})]}),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>{o.refetch()},disabled:o.isFetching,"aria-label":x("Refresh"),children:e.jsx(me,{size:13,className:o.isFetching?"animate-spin":""})})]}),o.isPending?e.jsx("p",{className:"text-xs text-muted-foreground",children:x("Loading...")}):o.isError?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:x("Could not load branches. Refresh to try again.")}):o.data&&e.jsx(De,{projectId:t,mainBranch:o.data.mainBranch,branches:o.data.branches,isRefreshing:o.isFetching,onRefresh:()=>{o.refetch()}},`${t}:${o.data.mainBranch}`)]})}function De({projectId:t,mainBranch:x,branches:o,isRefreshing:v,onRefresh:i}){const{t:l}=I(),u=a.useId(),[d,b]=a.useState(x),m=re(),n=async()=>{try{await m.mutateAsync({id:t,mainBranch:d}),O.success(l("Default base branch saved"))}catch{}};return e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{htmlFor:u,className:"block text-xs font-medium",children:l("Default base branch")}),e.jsx(we,{id:u,label:l("Default base branch"),value:d,branches:o,disabled:m.isPending,isRefreshing:v,onOpen:i,onChange:p=>{b(p),m.reset()}}),m.isError&&e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:l("Could not save the default base branch. Refresh and choose an existing local branch.")}),e.jsx(R,{size:"sm",onClick:()=>{n()},disabled:d===x||!o.includes(d)||m.isPending||v,children:m.isPending?l("Saving"):l("Save default base branch")})]})}function Z(t){return t?t.split(",").map(x=>x.trim()).filter(Boolean):[]}function ee(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function te(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function Je(){const{t}=I(),{data:x,isLoading:o}=ge({limit:100,includeArchived:!0}),v=re(),i=je(),l=be(),[u,d]=a.useState(""),[b,m]=a.useState(null),[n,p]=a.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[f,g]=a.useState(!1),[y,P]=a.useState(null),[A,D]=a.useState(!1),[q,w]=a.useState(!1),[S,F]=a.useState(!1),[M,E]=a.useState(!1),[s,c]=a.useState(""),[z,_]=a.useState(!1),C=x?.data??[],N=a.useMemo(()=>C.filter(r=>!r.archivedAt),[C]),B=a.useMemo(()=>C.filter(r=>r.archivedAt),[C]),j=N.find(r=>r.id===u),L=a.useMemo(()=>C.find(r=>r.id===y)??null,[y,C]);if(a.useEffect(()=>{!u&&N.length>0&&d(N[0].id)},[N,u]),a.useEffect(()=>{if(b){N.some(r=>r.id===b)&&(d(b),m(null));return}u&&!N.some(r=>r.id===u)&&(d(N[0]?.id??""),g(!1))},[N,b,u]),a.useEffect(()=>{j&&!f&&p({copyFiles:Z(j.copyFiles),setupScript:j.setupScript??"",quickCommands:ee(j.quickCommands)})},[j,f]),o)return e.jsx($,{className:"max-w-5xl",children:e.jsx(xe,{})});if(C.length===0)return e.jsxs($,{className:"max-w-5xl",children:[e.jsx(Q,{title:t("项目配置")}),e.jsx(H,{message:t("暂无项目,请先创建项目")})]});const ae=()=>{u&&v.mutate({id:u,copyFiles:n.copyFiles.length>0?n.copyFiles.join(", "):null,setupScript:n.setupScript.trim()||null,quickCommands:n.quickCommands.length>0?JSON.stringify(n.quickCommands):null},{onSuccess:()=>g(!1)})},ie=r=>{m(null),d(r),g(!1),_(!0)},oe=()=>{j&&(P(j.id),F(!1),E(!1),D(!0))},G=()=>{i.isPending||(D(!1),P(null),F(!1),E(!1))},le=async()=>{if(y)try{await i.mutateAsync({id:y,deleteRepo:S}),O.success(t(S?"项目已删除,并清理了本地文件":"项目已删除")),g(!1),G()}catch{}},ce=r=>{const h=B.find(k=>k.id===r);P(r),c(h?.repoDeletedAt?h.repoPath:""),w(!0)},W=()=>{l.isPending||(w(!1),P(null),c(""))},de=async()=>{if(!(!y||L?.repoDeletedAt&&!s.trim()))try{const h=await l.mutateAsync({id:y,repoPath:s.trim()||void 0});O.success(t("项目已恢复"));for(const k of h.warnings)O.warning(k);g(!1),m(h.project.id),d(h.project.id),W()}catch{}},J=L?.name??t("this project"),K=!!L?.repoDeletedAt,T=j?.isGitRepo!==!1&&j?.worktreeReady!==!1;return e.jsxs(e.Fragment,{children:[e.jsxs($,{className:"max-w-5xl",children:[e.jsx(Q,{title:t("项目配置")}),N.length===0&&B.length===0?e.jsx(H,{message:t("暂无项目,请先创建项目")}):e.jsx(ke,{items:N,selectedId:u,onSelectItem:ie,getItemId:r=>r.id,mobileShowDetail:z,onMobileBack:()=>_(!1),renderListItem:(r,h)=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:U("h-2 w-2 rounded-full shrink-0",h?"bg-primary-foreground/60":te(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:U("truncate text-[11px] font-mono",h?"text-primary-foreground/70":"text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:B.length>0?()=>e.jsxs("div",{className:"pt-3 mt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 mb-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t("已删除")}),e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:B.length})]}),B.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>ce(r.id),disabled:l.isPending,className:"shrink-0 text-[11px] hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","aria-label":t("恢复项目"),children:e.jsx(fe,{size:12})})]},r.id))]}):void 0,renderDetail:r=>r?e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:U("h-2.5 w-2.5 rounded-full shrink-0",te(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isGitRepo===!1&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:t("Local project")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),r.isGitRepo===!1&&e.jsx("div",{className:"mb-5 rounded-lg border border-info/25 bg-info/8 px-3 py-2 text-xs leading-relaxed text-info/90",children:t("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun.")}),e.jsxs("div",{className:"divide-y divide-border/60",children:[T&&e.jsx(Re,{projectId:r.id},r.id),e.jsxs("div",{className:"py-5 first:pt-0",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("自动复制文件")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 时自动从主仓库复制的文件或目录,适用于 .env、node_modules 等不在 git 管理中的文件。支持 glob。")})]}),e.jsx(Se,{value:n.copyFiles,onChange:h=>{p(k=>({...k,copyFiles:h})),g(!0)},repoPath:r.repoPath,disabled:!T,disabledMessage:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:h=>{p(k=>({...k,setupScript:h.target.value})),g(!0)},placeholder:`pnpm install
2
- pnpm run setup`,rows:4,disabled:!T,className:"w-full rounded-lg border border-input bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-none disabled:cursor-not-allowed disabled:opacity-50"}),!T&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("常用命令")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("在终端中可快速执行的命令,不会自动运行。")})]}),e.jsx(Ce,{value:n.quickCommands,onChange:h=>{p(k=>({...k,quickCommands:h})),g(!0)}})]})]}),e.jsx("div",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/10 p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(pe,{size:15,className:"text-destructive mt-0.5 shrink-0","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:t("删除项目")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("项目将从默认列表隐藏,历史记录保留。可选同时删除本地文件。")})]})]}),e.jsxs(R,{size:"sm",variant:"destructive",className:"shrink-0",onClick:oe,disabled:i.isPending||l.isPending,children:[e.jsx(ve,{size:13}),t("删除项目")]})]})}),f&&e.jsx(he,{saving:v.isPending,onSave:ae,onCancel:()=>{j&&p({copyFiles:Z(j.copyFiles),setupScript:j.setupScript??"",quickCommands:ee(j.quickCommands)}),g(!1)},className:"-mx-5"})]}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:N.length>0?t("选择一个项目查看配置"):t("当前没有可配置的项目")})})]}),e.jsx(V,{isOpen:A,onClose:G,title:t("Delete Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(R,{variant:"outline",onClick:G,disabled:i.isPending,children:t("Cancel")}),e.jsx(R,{variant:"destructive",onClick:le,disabled:i.isPending||S&&!M,children:i.isPending?t("Deleting..."):t("Delete Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t("项目「{title}」将从默认项目列表隐藏,但历史任务、workspace 和会话记录仍会保留。",{title:J})}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted px-3 py-3",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:r=>{F(r.target.checked),r.target.checked||E(!1)},className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t("同时删除本地项目文件")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("勾选后会删除项目路径指向的本地目录,并禁用代码/Git 相关能力。")})]})]}),S&&e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:t("勾选后会连项目文件一起删除,请谨慎选择。")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("恢复该项目时需要重新绑定一个有效的项目路径。")}),e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-xs text-foreground",children:[e.jsx("input",{type:"checkbox",checked:M,onChange:r=>E(r.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsx("span",{children:t("我已确认这会删除本地项目文件")})]})]}),i.isError&&e.jsx("p",{className:"text-xs text-destructive",children:i.error instanceof Error?i.error.message:t("Failed to delete project")})]})}),e.jsx(V,{isOpen:q,onClose:W,title:t("Restore Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(R,{variant:"outline",onClick:W,disabled:l.isPending,children:t("Cancel")}),e.jsx(R,{onClick:de,disabled:l.isPending||K&&!s.trim(),children:l.isPending?t("Restoring..."):t("Restore Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:K?t("项目「{title}」的本地项目文件已删除。恢复前需要重新绑定一个有效的项目路径。",{title:J}):t("恢复后,项目会重新出现在默认项目列表中。")}),K&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1.5",children:t("Project Path")}),e.jsx(Pe,{value:s,onChange:c,validationMode:"directory"}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("Agent Tower 会尽量校验项目 identity;如果 remote URL 或目录名不同,会给出警告但允许继续。")})]}),l.isError&&e.jsx("p",{className:"text-xs text-destructive",children:l.error instanceof Error?l.error.message:t("Failed to restore project")})]})})]})}export{Je as ProjectSettingsPage};