agent-tower 0.7.2 → 0.7.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/dist/executors/__tests__/providers.test.js +53 -0
  2. package/dist/executors/__tests__/providers.test.js.map +1 -1
  3. package/dist/executors/providers.d.ts +2 -0
  4. package/dist/executors/providers.d.ts.map +1 -1
  5. package/dist/executors/providers.js +3 -2
  6. package/dist/executors/providers.js.map +1 -1
  7. package/dist/git/base-branch.d.ts +3 -0
  8. package/dist/git/base-branch.d.ts.map +1 -0
  9. package/dist/git/base-branch.js +17 -0
  10. package/dist/git/base-branch.js.map +1 -0
  11. package/dist/git/worktree.manager.d.ts +2 -0
  12. package/dist/git/worktree.manager.d.ts.map +1 -1
  13. package/dist/git/worktree.manager.js +29 -8
  14. package/dist/git/worktree.manager.js.map +1 -1
  15. package/dist/git/worktree.manager.test.js +38 -0
  16. package/dist/git/worktree.manager.test.js.map +1 -1
  17. package/dist/mcp/http-client.d.ts +4 -6
  18. package/dist/mcp/http-client.d.ts.map +1 -1
  19. package/dist/mcp/http-client.js +6 -0
  20. package/dist/mcp/http-client.js.map +1 -1
  21. package/dist/mcp/tools/__tests__/providers.test.d.ts +2 -0
  22. package/dist/mcp/tools/__tests__/providers.test.d.ts.map +1 -0
  23. package/dist/mcp/tools/__tests__/providers.test.js +22 -0
  24. package/dist/mcp/tools/__tests__/providers.test.js.map +1 -0
  25. package/dist/mcp/tools/__tests__/tasks.test.d.ts +2 -0
  26. package/dist/mcp/tools/__tests__/tasks.test.d.ts.map +1 -0
  27. package/dist/mcp/tools/__tests__/tasks.test.js +49 -0
  28. package/dist/mcp/tools/__tests__/tasks.test.js.map +1 -0
  29. package/dist/mcp/tools/providers.d.ts.map +1 -1
  30. package/dist/mcp/tools/providers.js +3 -2
  31. package/dist/mcp/tools/providers.js.map +1 -1
  32. package/dist/mcp/tools/tasks.d.ts.map +1 -1
  33. package/dist/mcp/tools/tasks.js +31 -2
  34. package/dist/mcp/tools/tasks.js.map +1 -1
  35. package/dist/mcp/types.d.ts +27 -0
  36. package/dist/mcp/types.d.ts.map +1 -1
  37. package/dist/mcp/types.js +13 -0
  38. package/dist/mcp/types.js.map +1 -1
  39. package/dist/output/__tests__/text-block-lifecycle.test.js +37 -0
  40. package/dist/output/__tests__/text-block-lifecycle.test.js.map +1 -1
  41. package/dist/output/text-block-tracker.d.ts.map +1 -1
  42. package/dist/output/text-block-tracker.js +24 -1
  43. package/dist/output/text-block-tracker.js.map +1 -1
  44. package/dist/prompts/task-handoff.d.ts +6 -0
  45. package/dist/prompts/task-handoff.d.ts.map +1 -0
  46. package/dist/prompts/task-handoff.js +17 -0
  47. package/dist/prompts/task-handoff.js.map +1 -0
  48. package/dist/prompts/task-handoff.test.d.ts +2 -0
  49. package/dist/prompts/task-handoff.test.d.ts.map +1 -0
  50. package/dist/prompts/task-handoff.test.js +27 -0
  51. package/dist/prompts/task-handoff.test.js.map +1 -0
  52. package/dist/prompts/workspace-background-service-policy.d.ts +6 -0
  53. package/dist/prompts/workspace-background-service-policy.d.ts.map +1 -1
  54. package/dist/prompts/workspace-background-service-policy.js +2 -1
  55. package/dist/prompts/workspace-background-service-policy.js.map +1 -1
  56. package/dist/routes/__tests__/providers.test.js +67 -0
  57. package/dist/routes/__tests__/providers.test.js.map +1 -1
  58. package/dist/routes/__tests__/task-handoff.test.d.ts +2 -0
  59. package/dist/routes/__tests__/task-handoff.test.d.ts.map +1 -0
  60. package/dist/routes/__tests__/task-handoff.test.js +185 -0
  61. package/dist/routes/__tests__/task-handoff.test.js.map +1 -0
  62. package/dist/routes/__tests__/tasks.test.js +46 -0
  63. package/dist/routes/__tests__/tasks.test.js.map +1 -1
  64. package/dist/routes/providers.d.ts.map +1 -1
  65. package/dist/routes/providers.js +8 -0
  66. package/dist/routes/providers.js.map +1 -1
  67. package/dist/routes/tasks.d.ts.map +1 -1
  68. package/dist/routes/tasks.js +60 -2
  69. package/dist/routes/tasks.js.map +1 -1
  70. package/dist/runtime/acp/history-reconciler.js +1 -1
  71. package/dist/runtime/acp/history-reconciler.js.map +1 -1
  72. package/dist/services/__tests__/session-manager.lifecycle.test.js +171 -1
  73. package/dist/services/__tests__/session-manager.lifecycle.test.js.map +1 -1
  74. package/dist/services/__tests__/task.service.test.js +142 -76
  75. package/dist/services/__tests__/task.service.test.js.map +1 -1
  76. package/dist/services/__tests__/translation-protection.test.js +48 -18
  77. package/dist/services/__tests__/translation-protection.test.js.map +1 -1
  78. package/dist/services/__tests__/translation-session-blocks.test.js +66 -2
  79. package/dist/services/__tests__/translation-session-blocks.test.js.map +1 -1
  80. package/dist/services/__tests__/workspace-background-service.service.test.js +74 -26
  81. package/dist/services/__tests__/workspace-background-service.service.test.js.map +1 -1
  82. package/dist/services/__tests__/workspace.service.test.js +70 -0
  83. package/dist/services/__tests__/workspace.service.test.js.map +1 -1
  84. package/dist/services/message-delivery.service.d.ts +4 -1
  85. package/dist/services/message-delivery.service.d.ts.map +1 -1
  86. package/dist/services/project.service.d.ts +3 -0
  87. package/dist/services/project.service.d.ts.map +1 -1
  88. package/dist/services/provider-config.service.d.ts.map +1 -1
  89. package/dist/services/provider-config.service.js +1 -0
  90. package/dist/services/provider-config.service.js.map +1 -1
  91. package/dist/services/session-manager.d.ts +15 -5
  92. package/dist/services/session-manager.d.ts.map +1 -1
  93. package/dist/services/session-manager.js +19 -3
  94. package/dist/services/session-manager.js.map +1 -1
  95. package/dist/services/task-cleanup.service.d.ts +2 -0
  96. package/dist/services/task-cleanup.service.d.ts.map +1 -1
  97. package/dist/services/task-cleanup.service.js +2 -2
  98. package/dist/services/task-cleanup.service.js.map +1 -1
  99. package/dist/services/task-handoff.service.d.ts +18 -0
  100. package/dist/services/task-handoff.service.d.ts.map +1 -0
  101. package/dist/services/task-handoff.service.js +87 -0
  102. package/dist/services/task-handoff.service.js.map +1 -0
  103. package/dist/services/task.service.d.ts +45 -18
  104. package/dist/services/task.service.d.ts.map +1 -1
  105. package/dist/services/task.service.js +215 -160
  106. package/dist/services/task.service.js.map +1 -1
  107. package/dist/services/team-run.service.d.ts +3 -0
  108. package/dist/services/team-run.service.d.ts.map +1 -1
  109. package/dist/services/team-task-input.service.d.ts +3 -0
  110. package/dist/services/team-task-input.service.d.ts.map +1 -1
  111. package/dist/services/translation-protection.d.ts +3 -1
  112. package/dist/services/translation-protection.d.ts.map +1 -1
  113. package/dist/services/translation-protection.js +21 -67
  114. package/dist/services/translation-protection.js.map +1 -1
  115. package/dist/services/translation-settings.service.d.ts +4 -4
  116. package/dist/services/translation.service.d.ts.map +1 -1
  117. package/dist/services/translation.service.js +44 -20
  118. package/dist/services/translation.service.js.map +1 -1
  119. package/dist/services/workspace-background-service.service.d.ts +1 -3
  120. package/dist/services/workspace-background-service.service.d.ts.map +1 -1
  121. package/dist/services/workspace-background-service.service.js +17 -65
  122. package/dist/services/workspace-background-service.service.js.map +1 -1
  123. package/dist/services/workspace.service.d.ts +21 -6
  124. package/dist/services/workspace.service.d.ts.map +1 -1
  125. package/dist/services/workspace.service.js +56 -11
  126. package/dist/services/workspace.service.js.map +1 -1
  127. package/dist/web/assets/AgentDemoPage-JXetlNBf.js +1 -0
  128. package/dist/web/assets/{AgentEnvironmentSettingsPage-GHjKIWpb.js → AgentEnvironmentSettingsPage-CdYyUCwJ.js} +1 -1
  129. package/dist/web/assets/AttachmentPreview-DMS-PM-1.js +2 -0
  130. package/dist/web/assets/BranchSelect-BAq4L2ZS.js +1 -0
  131. package/dist/web/assets/BrandLogo--kWXXJtZ.js +1 -0
  132. package/dist/web/assets/ConversationPage-CvC4RyB5.js +1 -0
  133. package/dist/web/assets/CreateTaskInput-DjVxCAfc.js +1 -0
  134. package/dist/web/assets/{DemoPage-DK-ikg1_.js → DemoPage-cDVTGOp8.js} +3 -3
  135. package/dist/web/assets/DesignSystemPage-BI54IkKi.js +12 -0
  136. package/dist/web/assets/{ExecutionPermissionSelector-B8befbxJ.js → ExecutionPermissionSelector-f1UYIm1z.js} +1 -1
  137. package/dist/web/assets/GeneralSettingsPage-C0yto6C_.js +1 -0
  138. package/dist/web/assets/{LoadingPreviewPage-BDlf89rJ.js → LoadingPreviewPage-BiJSaHUi.js} +1 -1
  139. package/dist/web/assets/McpSettingsPage-BbHwZtyj.js +1 -0
  140. package/dist/web/assets/{MemberAvatar-YVr_erAr.js → MemberAvatar-BLezO3vS.js} +1 -1
  141. package/dist/web/assets/MobileTaskDetail-M_Kke9rL.js +3 -0
  142. package/dist/web/assets/NotificationSettingsPage-CiKoL2Kv.js +1 -0
  143. package/dist/web/assets/{ProfileSettingsPage-CHe4LlRp.js → ProfileSettingsPage-DCB48cPS.js} +2 -2
  144. package/dist/web/assets/ProjectKanbanPage-soDqevjQ.js +12 -0
  145. package/dist/web/assets/ProjectSettingsPage-COvIVq1h.js +2 -0
  146. package/dist/web/assets/ProviderSettingsPage-CPuJcZDg.js +67 -0
  147. package/dist/web/assets/{SettingsMasterDetail-DjWR9Sqk.js → SettingsMasterDetail-Cv7YaRJB.js} +1 -1
  148. package/dist/web/assets/TaskDetail-CqhPxvg3.js +1 -0
  149. package/dist/web/assets/TaskHandoffPanel-CxH3Mgyd.js +70 -0
  150. package/dist/web/assets/TeamSettingsPage-D-XDefNd.js +1 -0
  151. package/dist/web/assets/{TranslationSettingsPage-Cod9c4Ug.js → TranslationSettingsPage-BPHI-SZW.js} +1 -1
  152. package/dist/web/assets/{arc-DEy33vTc.js → arc-CC81aLuf.js} +1 -1
  153. package/dist/web/assets/{architectureDiagram-3BPJPVTR-Ky1D1LBk.js → architectureDiagram-3BPJPVTR-DL08XGaN.js} +1 -1
  154. package/dist/web/assets/{at-sign-C48_y345.js → at-sign-DYPIlD6D.js} +1 -1
  155. package/dist/web/assets/{blockDiagram-GPEHLZMM-BNgB7kNT.js → blockDiagram-GPEHLZMM-B4IW5WxI.js} +1 -1
  156. package/dist/web/assets/{c4Diagram-AAUBKEIU-4GMrPMgQ.js → c4Diagram-AAUBKEIU-Cj4d_FqK.js} +1 -1
  157. package/dist/web/assets/channel-CUa8oyzC.js +1 -0
  158. package/dist/web/assets/check-DaZqOL8l.js +1 -0
  159. package/dist/web/assets/{chevron-down-3y5Aiolp.js → chevron-down-DNhYsNAt.js} +1 -1
  160. package/dist/web/assets/{chevron-up-DqaYcjpq.js → chevron-up-CjrLieBR.js} +1 -1
  161. package/dist/web/assets/chip-Cf92J-pQ.js +1 -0
  162. package/dist/web/assets/{chunk-2J33WTMH-C439hRe_.js → chunk-2J33WTMH-DeCj8QSD.js} +1 -1
  163. package/dist/web/assets/{chunk-4BX2VUAB-D8GK3M3t.js → chunk-4BX2VUAB-k-6rzQmQ.js} +1 -1
  164. package/dist/web/assets/{chunk-55IACEB6-Dl4UhJ8X.js → chunk-55IACEB6-qMTCQ5bX.js} +1 -1
  165. package/dist/web/assets/{chunk-727SXJPM-BSEeayBq.js → chunk-727SXJPM-CMnu18d1.js} +1 -1
  166. package/dist/web/assets/{chunk-AQP2D5EJ-B6chbZfT.js → chunk-AQP2D5EJ-C0mFbUMn.js} +1 -1
  167. package/dist/web/assets/{chunk-FMBD7UC4-DaLkiLdQ.js → chunk-FMBD7UC4-u6-_M137.js} +1 -1
  168. package/dist/web/assets/{chunk-ND2GUHAM-DeQwZAAT.js → chunk-ND2GUHAM-DHrIE_8H.js} +1 -1
  169. package/dist/web/assets/{chunk-QZHKN3VN-CLRr4YRM.js → chunk-QZHKN3VN-aTyC0wZq.js} +1 -1
  170. package/dist/web/assets/classDiagram-4FO5ZUOK-BAx111NO.js +1 -0
  171. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BAx111NO.js +1 -0
  172. package/dist/web/assets/{code-block-OCS4YCEC-CnoxUpOx.js → code-block-OCS4YCEC-CBIOQOMH.js} +1 -1
  173. package/dist/web/assets/confirm-dialog-DWeBZLJW.js +1 -0
  174. package/dist/web/assets/content-JM9E1MeD.js +2 -0
  175. package/dist/web/assets/{copy-HRMhTkIG.js → copy-D0gl9kF8.js} +1 -1
  176. package/dist/web/assets/{cose-bilkent-S5V4N54A-C1UiYzfk.js → cose-bilkent-S5V4N54A-xLyliSgU.js} +1 -1
  177. package/dist/web/assets/cssMode-DO5UnQ64.js +1 -0
  178. package/dist/web/assets/{dagre-BM42HDAG-CTJpBgye.js → dagre-BM42HDAG-CbNpoO2d.js} +1 -1
  179. package/dist/web/assets/{diagram-2AECGRRQ-Dj1_TEYp.js → diagram-2AECGRRQ-CG3hKxAX.js} +1 -1
  180. package/dist/web/assets/{diagram-5GNKFQAL-V-KUpwqh.js → diagram-5GNKFQAL-mQu9M28s.js} +1 -1
  181. package/dist/web/assets/{diagram-KO2AKTUF-CXG1ZIeX.js → diagram-KO2AKTUF-BSeEp_Uw.js} +1 -1
  182. package/dist/web/assets/{diagram-LMA3HP47-BZSJUwk9.js → diagram-LMA3HP47-D6yRdao-.js} +1 -1
  183. package/dist/web/assets/{diagram-OG6HWLK6-CCr4gq4u.js → diagram-OG6HWLK6-BUBUW9wD.js} +1 -1
  184. package/dist/web/assets/dialog-D1lkhqVL.js +5 -0
  185. package/dist/web/assets/{erDiagram-TEJ5UH35-Djtyzh6z.js → erDiagram-TEJ5UH35-BQSZgRqq.js} +1 -1
  186. package/dist/web/assets/file-BijjwxRR.js +1 -0
  187. package/dist/web/assets/{flowDiagram-I6XJVG4X-BmSVSiXJ.js → flowDiagram-I6XJVG4X-D-eqyr5Y.js} +1 -1
  188. package/dist/web/assets/folder-picker-Czxm0_S9.js +1 -0
  189. package/dist/web/assets/{freemarker2-DdptX5f1.js → freemarker2-B4RvEa_U.js} +2 -2
  190. package/dist/web/assets/{ganttDiagram-6RSMTGT7-r5vQX-b5.js → ganttDiagram-6RSMTGT7-BWGkCt_x.js} +1 -1
  191. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-Zj9aloh9.js → gitGraphDiagram-PVQCEYII-DGVc49pR.js} +1 -1
  192. package/dist/web/assets/{globe-B9I-jHBB.js → globe-Ce01-45x.js} +1 -1
  193. package/dist/web/assets/handlebars-oyT7drqS.js +1 -0
  194. package/dist/web/assets/html-CxxWf2Qk.js +1 -0
  195. package/dist/web/assets/htmlMode-RfAHh5Jj.js +1 -0
  196. package/dist/web/assets/index-BMZFF1UJ.js +1 -0
  197. package/dist/web/assets/index-BN53vGxp.css +1 -0
  198. package/dist/web/assets/index-Cc3qXMhU.js +122 -0
  199. package/dist/web/assets/{index-Bhvt-E6d.js → index-DWrSDMX2.js} +2 -2
  200. package/dist/web/assets/{index-DkRy6eNX.js → index-Dh-tgeaL.js} +4 -4
  201. package/dist/web/assets/{index-B1oVmCie.js → index-Disv1kQS.js} +1 -1
  202. package/dist/web/assets/{index-DcOU2m2F.js → index-DyJfPc4O.js} +1 -1
  203. package/dist/web/assets/{index-Dk3bRQAK.js → index-Pt4TsHjm.js} +1 -1
  204. package/dist/web/assets/{index-CThFsQNP.js → index-T38iVLEb.js} +1 -1
  205. package/dist/web/assets/{index-BtUQYU5l.js → index-hpHE1jXY.js} +1 -1
  206. package/dist/web/assets/{infoDiagram-5YYISTIA-BHtVaxZx.js → infoDiagram-5YYISTIA-DLPs3dV_.js} +1 -1
  207. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-BYmwjkbC.js → ishikawaDiagram-YF4QCWOH-d_OrnwDY.js} +1 -1
  208. package/dist/web/assets/javascript-BNXtViSL.js +1 -0
  209. package/dist/web/assets/{journeyDiagram-JHISSGLW-c8BBqqRS.js → journeyDiagram-JHISSGLW-EtU1st_0.js} +1 -1
  210. package/dist/web/assets/jsonMode-Bqh5vIxx.js +7 -0
  211. package/dist/web/assets/{kanban-definition-UN3LZRKU-D4Vr-oFT.js → kanban-definition-UN3LZRKU-ZWzUnsFK.js} +1 -1
  212. package/dist/web/assets/{kbd-C88ut3t9.js → kbd-IjDGsZ2B.js} +1 -1
  213. package/dist/web/assets/{key-round-Cjbj2qNa.js → key-round-CbnAuUxp.js} +1 -1
  214. package/dist/web/assets/{layers-eaHAVcc3.js → layers-Pdy9vZ6K.js} +1 -1
  215. package/dist/web/assets/{linear-opi90s0L.js → linear-D7n23wcA.js} +1 -1
  216. package/dist/web/assets/{link-BSGb85gq.js → link-Bl1ZbjFh.js} +1 -1
  217. package/dist/web/assets/liquid-Ds47iVLN.js +1 -0
  218. package/dist/web/assets/{lspLanguageFeatures-DWu2Ubf0.js → lspLanguageFeatures-Dcch3bsp.js} +1 -1
  219. package/dist/web/assets/mdx-CM7ky-2B.js +1 -0
  220. package/dist/web/assets/{menu--sjyisSg.js → menu-DubntFHq.js} +1 -1
  221. package/dist/web/assets/{mermaid-NOHMQCX5-BSNbBj78.js → mermaid-NOHMQCX5-nBsnjgeU.js} +54 -54
  222. package/dist/web/assets/{message-square-BLEJN6p7.js → message-square-BE-pW0m_.js} +1 -1
  223. package/dist/web/assets/{mindmap-definition-RKZ34NQL-BN3ZjBh-.js → mindmap-definition-RKZ34NQL-ClHORNTt.js} +1 -1
  224. package/dist/web/assets/modal-CHLtZWvx.js +1 -0
  225. package/dist/web/assets/{monaco-BkuNyOkP.js → monaco-BbAmalE2.js} +3 -3
  226. package/dist/web/assets/nav-row-DH7rNq1V.js +1 -0
  227. package/dist/web/assets/{paperclip-CTNoXpUW.js → paperclip-YP3Bk1lI.js} +1 -1
  228. package/dist/web/assets/{pencil-Cp70ZwtG.js → pencil-BFDuhbtW.js} +1 -1
  229. package/dist/web/assets/{people-DT78SebR.js → people-DEeNaaLt.js} +1 -1
  230. package/dist/web/assets/{pieDiagram-4H26LBE5-CfmFHpPI.js → pieDiagram-4H26LBE5-BUOaKIyP.js} +1 -1
  231. package/dist/web/assets/popover-CUmBEXxL.js +1 -0
  232. package/dist/web/assets/provider-selection-DSu7SCI7.js +1 -0
  233. package/dist/web/assets/python-BODTtU6m.js +1 -0
  234. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-CeaumJAa.js → quadrantDiagram-W4KKPZXB-Caezg-U2.js} +1 -1
  235. package/dist/web/assets/razor-CHm8DY1p.js +1 -0
  236. package/dist/web/assets/{requirementDiagram-4Y6WPE33-BWWCDXCE.js → requirementDiagram-4Y6WPE33-BtdP3Ka6.js} +1 -1
  237. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-DAJut743.js → sankeyDiagram-5OEKKPKP-Bv74oA-n.js} +1 -1
  238. package/dist/web/assets/{search-DniD_AGC.js → search-ClmOQd4H.js} +1 -1
  239. package/dist/web/assets/{select-BPdJrr5M.js → select-BB7QG08o.js} +1 -1
  240. package/dist/web/assets/{select-B5RYunTs.js → select-CYtYPr-c.js} +1 -1
  241. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-CynjRGW4.js → sequenceDiagram-3UESZ5HK-DuNPl-dg.js} +1 -1
  242. package/dist/web/assets/{server-xswxWpKD.js → server-bEB_DY55.js} +1 -1
  243. package/dist/web/assets/{stateDiagram-AJRCARHV-amAtpx9w.js → stateDiagram-AJRCARHV-B72HAgBJ.js} +1 -1
  244. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-Bu3l_CgB.js +1 -0
  245. package/dist/web/assets/{textarea-BVyPl9rM.js → textarea-BqYPvoO-.js} +1 -1
  246. package/dist/web/assets/{timeline-definition-PNZ67QCA-DZ9W7WlP.js → timeline-definition-PNZ67QCA-DTmHUgmQ.js} +1 -1
  247. package/dist/web/assets/{toggles-QcIz43DP.js → toggles-a5fkwT_D.js} +1 -1
  248. package/dist/web/assets/tooltip-DuyJMci9.js +1 -0
  249. package/dist/web/assets/{track-Ckye0-tt.js → track-DCjyrv3n.js} +1 -1
  250. package/dist/web/assets/{trash-2-CvUJsbtT.js → trash-2-CIyBqaVy.js} +1 -1
  251. package/dist/web/assets/tsMode-C1UXAkMh.js +11 -0
  252. package/dist/web/assets/typescript-Biht2wHb.js +1 -0
  253. package/dist/web/assets/{upload-CsXAmAun.js → upload-D05XS5-G.js} +1 -1
  254. package/dist/web/assets/use-profiles-CrWTyz1G.js +1 -0
  255. package/dist/web/assets/{use-providers-Td1-gyrN.js → use-providers-Dv1Nk6s7.js} +1 -1
  256. package/dist/web/assets/{use-translation-settings-NYM0lmBx.js → use-translation-settings-CcUnipVO.js} +1 -1
  257. package/dist/web/assets/useNormalizedLogs-D9W1cT4R.js +1 -0
  258. package/dist/web/assets/useTokenUsage-CZ5mDshD.js +1 -0
  259. package/dist/web/assets/{vennDiagram-CIIHVFJN-CB2Ubvy9.js → vennDiagram-CIIHVFJN-ByoNydXe.js} +1 -1
  260. package/dist/web/assets/{wardley-L42UT6IY-BXOkk77I.js → wardley-L42UT6IY-BqdMkOLl.js} +1 -1
  261. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-VA6ywdQQ.js → wardleyDiagram-YWT4CUSO-AO22HrEF.js} +1 -1
  262. package/dist/web/assets/xml-NLGqNFDv.js +1 -0
  263. package/dist/web/assets/{xychartDiagram-2RQKCTM6-FNcvDj5G.js → xychartDiagram-2RQKCTM6-vzPgjgqW.js} +1 -1
  264. package/dist/web/assets/yaml-AWlGS_Ig.js +1 -0
  265. package/dist/web/index.html +2 -2
  266. package/node_modules/@agent-tower/shared/dist/index.d.ts +1 -0
  267. package/node_modules/@agent-tower/shared/dist/index.d.ts.map +1 -1
  268. package/node_modules/@agent-tower/shared/dist/index.js +1 -0
  269. package/node_modules/@agent-tower/shared/dist/index.js.map +1 -1
  270. package/node_modules/@agent-tower/shared/dist/task-handoff.d.ts +12 -0
  271. package/node_modules/@agent-tower/shared/dist/task-handoff.d.ts.map +1 -0
  272. package/node_modules/@agent-tower/shared/dist/task-handoff.js +2 -0
  273. package/node_modules/@agent-tower/shared/dist/task-handoff.js.map +1 -0
  274. package/node_modules/@agent-tower/shared/dist/translation.d.ts +12 -0
  275. package/node_modules/@agent-tower/shared/dist/translation.d.ts.map +1 -1
  276. package/node_modules/@agent-tower/shared/dist/translation.js +19 -0
  277. package/node_modules/@agent-tower/shared/dist/translation.js.map +1 -1
  278. package/node_modules/@agent-tower/shared/dist/types.d.ts +28 -1
  279. package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
  280. package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
  281. package/package.json +1 -1
  282. package/prisma/migrations/20261023000000_add_task_base_branch/migration.sql +2 -0
  283. package/prisma/migrations/20261023010000_add_subtasks/migration.sql +2 -0
  284. package/prisma/migrations/20261026000000_add_task_handoff/migration.sql +1 -0
  285. package/prisma/schema.prisma +6 -0
  286. package/dist/web/assets/AgentDemoPage-BfXkNCdN.js +0 -1
  287. package/dist/web/assets/AttachmentPreview-CLN1lnLe.js +0 -2
  288. package/dist/web/assets/BranchSelect-Cofp8vYf.js +0 -1
  289. package/dist/web/assets/BrandLogo-BUimEX-9.js +0 -1
  290. package/dist/web/assets/ConversationPage-R7vNaOQv.js +0 -1
  291. package/dist/web/assets/CreateTaskInput-CasITF8y.js +0 -1
  292. package/dist/web/assets/DesignSystemPage-BhjNs2vP.js +0 -12
  293. package/dist/web/assets/EditableTaskTitle-BJ9Rxggf.js +0 -70
  294. package/dist/web/assets/GeneralSettingsPage-RMN2al8I.js +0 -1
  295. package/dist/web/assets/McpSettingsPage-CPNxFF67.js +0 -1
  296. package/dist/web/assets/MobileTaskDetail-QNUHMq7u.js +0 -3
  297. package/dist/web/assets/NotificationSettingsPage-BEyuyu3Z.js +0 -1
  298. package/dist/web/assets/ProjectKanbanPage-Bt_01giW.js +0 -12
  299. package/dist/web/assets/ProjectSettingsPage-cus6Ns97.js +0 -2
  300. package/dist/web/assets/ProviderSettingsPage-DqA_B1Ey.js +0 -67
  301. package/dist/web/assets/TaskDetail-rEXNe2h3.js +0 -1
  302. package/dist/web/assets/TeamSettingsPage-DwWROtW6.js +0 -1
  303. package/dist/web/assets/channel-DTP-syjA.js +0 -1
  304. package/dist/web/assets/check-BmiJ7qMY.js +0 -1
  305. package/dist/web/assets/classDiagram-4FO5ZUOK-CUKgurLa.js +0 -1
  306. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CUKgurLa.js +0 -1
  307. package/dist/web/assets/confirm-dialog-ltNBFYCs.js +0 -1
  308. package/dist/web/assets/content-DPQMfMae.js +0 -2
  309. package/dist/web/assets/cssMode-DkuSsGeg.js +0 -1
  310. package/dist/web/assets/dialog-CuFEdqLg.js +0 -5
  311. package/dist/web/assets/handlebars-B34f-LAf.js +0 -1
  312. package/dist/web/assets/hooks-BLxb16IA.js +0 -1
  313. package/dist/web/assets/html-CnvOQ63o.js +0 -1
  314. package/dist/web/assets/htmlMode-RdxZ8Svp.js +0 -1
  315. package/dist/web/assets/icon-button-CYiKa-7C.js +0 -1
  316. package/dist/web/assets/index-0XPZayUU.css +0 -1
  317. package/dist/web/assets/index-BJObbxud.js +0 -122
  318. package/dist/web/assets/index-DZLnTISJ.js +0 -1
  319. package/dist/web/assets/javascript-BhombDEO.js +0 -1
  320. package/dist/web/assets/jsonMode-BJGOUeaV.js +0 -7
  321. package/dist/web/assets/liquid-Czy1WpPz.js +0 -1
  322. package/dist/web/assets/mdx-DhXfoSnM.js +0 -1
  323. package/dist/web/assets/modal-CSGOqphK.js +0 -1
  324. package/dist/web/assets/popover-BiVxGGgp.js +0 -1
  325. package/dist/web/assets/python-DIcQDjcf.js +0 -1
  326. package/dist/web/assets/razor-DYK6Rxer.js +0 -1
  327. package/dist/web/assets/search-field-CQLDXLeA.js +0 -1
  328. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-V-lSceg1.js +0 -1
  329. package/dist/web/assets/tooltip-CPqGK_WZ.js +0 -1
  330. package/dist/web/assets/tsMode-c5x0d47n.js +0 -11
  331. package/dist/web/assets/typescript-i7eYblLt.js +0 -1
  332. package/dist/web/assets/use-profiles-DuXaBRju.js +0 -1
  333. package/dist/web/assets/use-projects-Ddz0knyr.js +0 -1
  334. package/dist/web/assets/use-workspaces-CdJZLmGh.js +0 -1
  335. package/dist/web/assets/useNormalizedLogs--RbVywYa.js +0 -1
  336. package/dist/web/assets/useTokenUsage-DDXf7E4p.js +0 -1
  337. package/dist/web/assets/xml-D2EGActB.js +0 -1
  338. package/dist/web/assets/yaml-jeiIZSL4.js +0 -1
  339. /package/dist/web/assets/{EditableTaskTitle-DcpNTP1B.css → TaskHandoffPanel-DcpNTP1B.css} +0 -0
@@ -1,4 +1,4 @@
1
- import{bd as B,a_ as M,be as U,u as z,r as S,j as p,n as T}from"./index-BJObbxud.js";import{C as Z}from"./chevron-down-3y5Aiolp.js";import{C as Y}from"./check-BmiJ7qMY.js";const q=["ASK","AUTO_SANDBOX","FULL_ACCESS"];function L(e){return q.includes(e)}function Se(e){const n=[],i=e.config??{},t=[],r=(a,c="INVALID_ENUM")=>{n.push({field:"executionPermission",code:c,message:a})};for(const a of["permissionMode","acpPermissionMode"])i[a]!==void 0&&(i[a]==="ASK"?t.push("ASK"):i[a]==="UNRESTRICTED"||i[a]==="AUTO_APPROVE"?t.push("FULL_ACCESS"):r(`${a} contains an invalid legacy permission mode`));const o=B(e.agentType)?.executionPermission.path;o&&i[o]!==void 0&&(typeof i[o]!="boolean"?r(`${o} must be true or false`,"INVALID_TYPE"):t.push(i[o]?"FULL_ACCESS":"ASK"));const s=e.executionPermission;s!==void 0&&!L(s)&&r("executionPermission must be ASK, AUTO_SANDBOX or FULL_ACCESS");const l=L(s)?s:t[0]??"ASK";return t.some(a=>a!==l)&&r("Legacy permission fields conflict with executionPermission","CONFLICT"),(e.executionPermissionReviewRequired||n.length===0&&s===void 0&&l==="ASK"&&e.agentType===M.CODEX)&&r("Legacy Codex permissions did not establish an explicit reviewer policy. Select an execution permission mode.","LEGACY_PERMISSION_REVIEW_REQUIRED"),{mode:l,diagnostics:n}}function _e(e,n){const i={...n};delete i.permissionMode,delete i.acpPermissionMode;const t=B(e)?.executionPermission.path;return t&&delete i[t],i}function G(e,n){let i=e.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function J(e,n,i){let t=e.split(/\r\n|\n|\r/g),r="",o=(Math.log10(n+1)|0)+1;for(let s=n-1;s<=n+1;s++){let l=t[s-1];l&&(r+=s.toString().padEnd(o," "),r+=": ",r+=l,r+=`
1
+ import{bh as B,b4 as M,bi as U,u as z,r as S,j as p,l as T}from"./index-Cc3qXMhU.js";import{C as Z}from"./chevron-down-DNhYsNAt.js";import{C as Y}from"./check-DaZqOL8l.js";const q=["ASK","AUTO_SANDBOX","FULL_ACCESS"];function L(e){return q.includes(e)}function Se(e){const n=[],i=e.config??{},t=[],r=(a,c="INVALID_ENUM")=>{n.push({field:"executionPermission",code:c,message:a})};for(const a of["permissionMode","acpPermissionMode"])i[a]!==void 0&&(i[a]==="ASK"?t.push("ASK"):i[a]==="UNRESTRICTED"||i[a]==="AUTO_APPROVE"?t.push("FULL_ACCESS"):r(`${a} contains an invalid legacy permission mode`));const o=B(e.agentType)?.executionPermission.path;o&&i[o]!==void 0&&(typeof i[o]!="boolean"?r(`${o} must be true or false`,"INVALID_TYPE"):t.push(i[o]?"FULL_ACCESS":"ASK"));const s=e.executionPermission;s!==void 0&&!L(s)&&r("executionPermission must be ASK, AUTO_SANDBOX or FULL_ACCESS");const l=L(s)?s:t[0]??"ASK";return t.some(a=>a!==l)&&r("Legacy permission fields conflict with executionPermission","CONFLICT"),(e.executionPermissionReviewRequired||n.length===0&&s===void 0&&l==="ASK"&&e.agentType===M.CODEX)&&r("Legacy Codex permissions did not establish an explicit reviewer policy. Select an execution permission mode.","LEGACY_PERMISSION_REVIEW_REQUIRED"),{mode:l,diagnostics:n}}function _e(e,n){const i={...n};delete i.permissionMode,delete i.acpPermissionMode;const t=B(e)?.executionPermission.path;return t&&delete i[t],i}function G(e,n){let i=e.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function J(e,n,i){let t=e.split(/\r\n|\n|\r/g),r="",o=(Math.log10(n+1)|0)+1;for(let s=n-1;s<=n+1;s++){let l=t[s-1];l&&(r+=s.toString().padEnd(o," "),r+=": ",r+=l,r+=`
2
2
  `,s===n&&(r+=" ".repeat(o+i+2),r+=`^
3
3
  `))}return r}class m extends Error{line;column;codeblock;constructor(n,i){const[t,r]=G(i.toml,i.ptr),o=J(i.toml,t,r);super(`Invalid TOML document: ${n}
4
4
 
@@ -0,0 +1 @@
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 a,S as de,h as ue,i as A,k as W,B as p,I as D}from"./index-Cc3qXMhU.js";import{S as H}from"./select-BB7QG08o.js";import{T as me}from"./textarea-BqYPvoO-.js";import{S as pe}from"./toggles-a5fkwT_D.js";import{u as ge}from"./use-providers-Dv1Nk6s7.js";import{i as fe}from"./provider-selection-DSu7SCI7.js";import"./select-CYtYPr-c.js";import"./menu-styles-DWynpVVz.js";import"./chevron-down-DNhYsNAt.js";import"./check-DaZqOL8l.js";import"./index-BMZFF1UJ.js";import"./index-DWrSDMX2.js";import"./index-Disv1kQS.js";import"./index-T38iVLEb.js";import"./index-Pt4TsHjm.js";import"./index-hpHE1jXY.js";const he=[{value:"zh-CN",label:"简体中文"},{value:"en",label:"English"}],N="__follow_task__",K=8;function V(P,y){return P instanceof Error?P.message:y}function Me(){const{locale:P,setLocale:y,t:e}=te(),{data:g}=ne(),{data:O}=ge(),{data:w}=le(),{data:r}=ie(),u=re(),i=oe(),S=ce(),[E,F]=t.useState(N),[k,_]=t.useState(""),[q,j]=t.useState(!1),[d,L]=t.useState(""),[o,I]=t.useState(""),[C,M]=t.useState(""),[T,f]=t.useState(!1),[J,h]=t.useState(!1),[b,l]=t.useState(null);t.useEffect(()=>{!g||!w||(F(g.commitMessageProviderId||N),_(g.commitMessagePrompt||w.prompt),j(!1))},[g,w]),t.useEffect(()=>{r&&(f(r.enabled),h(!1),l(null),L(""),I(""),M(""))},[r?.enabled]);const B=[{value:N,label:e("跟随任务")},...(O??[]).filter(fe).filter(s=>s.availability.type!=="NOT_FOUND").map(s=>({value:s.provider.id,label:s.provider.name}))],x=r?.enabled??!1,n=!x&&T?"enable":x&&!T?"disable":x&&J?"change":"idle",G=n!=="idle",Q=e(G?n==="disable"?"将关闭":n==="enable"?"将启用":"已启用":x?"已启用":"未启用"),X=t.useCallback(s=>{F(s);const v=s===N?null:s;u.mutate({commitMessageProviderId:v},{onError:()=>m.error(e("保存失败"))})},[u,e]),Y=t.useCallback(()=>{const s=k.trim()||null;u.mutate({commitMessagePrompt:s},{onSuccess:()=>{j(!1),m.success(e("已保存"))},onError:()=>m.error(e("保存失败"))})},[k,u,e]),c=t.useCallback(()=>{L(""),I(""),M("")},[]),Z=t.useCallback(()=>{f(r?.enabled??!1),h(!1),l(null),c()},[r?.enabled,c]),U=t.useCallback(s=>{if((s==="change"||s==="disable")&&!d)return l(e("请输入当前密码")),!1;if(s==="enable"||s==="change"){if(o.length<K)return l(e("密码至少需要 8 个字符")),!1;if(o!==C)return l(e("两次输入不一致")),!1}return l(null),!0},[C,d,o,e]),R=t.useCallback(()=>{if(n==="idle"||!U(n))return;const s=n==="disable"?{enabled:!1,currentPassword:d}:n==="enable"?{enabled:!0,newPassword:o}:{currentPassword:d,newPassword:o};i.mutate(s,{onSuccess:v=>{f(v.enabled),h(!1),l(null),c(),m.success(e(n==="disable"?"已关闭":"已保存"))},onError:v=>{const z=V(v,e("保存失败"));z.toLowerCase().includes("current password")?l(e("当前密码不正确")):z.toLowerCase().includes("at least 8")?l(e("密码至少需要 8 个字符")):l(z)}})},[n,c,d,o,e,i,U]),$=t.useCallback(s=>{!r||i.isPending||(f(s),h(!1),l(null),c())},[r,c,i.isPending]),ee=t.useCallback(()=>{S.mutate(void 0,{onSuccess:()=>m.success(e("已退出登录")),onError:s=>m.error(V(s,e("退出登录失败")))})},[S,e]),se=t.useCallback(s=>{s.preventDefault(),R()},[R]),ae=t.useCallback(()=>{!r||i.isPending||(f(!0),h(!0),l(null),c())},[r,c,i.isPending]);return a.jsxs(de,{children:[a.jsx(ue,{title:e("通用设置"),className:"mb-1"}),a.jsx("div",{className:"divide-y divide-border/60",children:a.jsx(A,{label:e("显示语言"),description:e("界面语言会保存到本地数据库,重启后继续生效。"),align:"center",children:a.jsx(H,{value:P,onChange:s=>y(s),options:he})})}),a.jsx(W,{className:"mt-8 mb-1",children:e("访问安全")}),a.jsx("div",{className:"divide-y divide-border/60",children:a.jsx(A,{label:e("访问密码"),description:e("开启后,进入 Agent Tower 需要输入密码。"),controlWidth:"fixed",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-sm font-medium text-foreground",children:Q}),a.jsx(pe,{checked:T,onCheckedChange:$,disabled:!r||i.isPending,"aria-label":e("访问密码")})]}),x&&n==="idle"&&a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[a.jsx(p,{type:"button",size:"sm",variant:"outline",className:"w-full sm:w-auto",onClick:ae,disabled:i.isPending,children:e("修改密码")}),a.jsx(p,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:ee,disabled:S.isPending,children:S.isPending?e("退出中..."):e("退出登录")})]}),G&&a.jsxs("form",{className:"space-y-2",onSubmit:se,children:[(n==="change"||n==="disable")&&a.jsx(D,{type:"password",autoComplete:"current-password",placeholder:e("当前密码"),value:d,onChange:s=>{L(s.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&!d)}),(n==="enable"||n==="change")&&a.jsxs(a.Fragment,{children:[a.jsx(D,{type:"password",autoComplete:"new-password",placeholder:e(n==="enable"?"访问密码":"新密码"),value:o,onChange:s=>{I(s.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o.length<K)}),a.jsx(D,{type:"password",autoComplete:"new-password",placeholder:e("确认密码"),value:C,onChange:s=>{M(s.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o!==C)})]}),(n==="change"||n==="disable")&&a.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e(n==="disable"?"关闭后不再要求访问密码。":"保存后其他已登录页面需要重新输入。")}),b&&a.jsx("p",{className:"text-xs text-destructive-ink",children:b}),a.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-1 sm:flex-row sm:justify-end",children:[a.jsx(p,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:Z,disabled:i.isPending,children:e("取消")}),a.jsx(p,{type:"submit",size:"sm",className:"w-full sm:w-auto",disabled:i.isPending,children:i.isPending?e("保存中..."):e(n==="disable"?"关闭访问密码":"保存")})]})]})]})})}),a.jsx(W,{className:"mt-8 mb-1",children:e("Git Commit Message")}),a.jsxs("div",{className:"divide-y divide-border/60",children:[a.jsx(A,{label:e("Agent 渠道"),description:e('"跟随任务"表示使用当前任务所用的 Agent 渠道。选择具体渠道可使用更经济的模型。'),children:a.jsx(H,{value:B.some(s=>s.value===E)?E:"",placeholder:O?.find(s=>s.provider.id===E)?.provider.name,onChange:X,options:B})}),a.jsx(A,{label:e("提示词模板"),description:e("自定义生成 commit message 的提示词。留空则使用内置默认模板。"),children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(me,{value:k,onChange:s=>{_(s.target.value),j(!0)},rows:5,className:"font-mono resize-y"}),q&&a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(p,{size:"sm",variant:"ghost",onClick:()=>{_(g?.commitMessagePrompt||w?.prompt||""),j(!1)},children:e("取消")}),a.jsx(p,{size:"sm",onClick:Y,disabled:u.isPending,children:u.isPending?e("保存中..."):e("保存")})]})]})})]})]})}export{Me as GeneralSettingsPage};
@@ -1 +1 @@
1
- import{u as f,r as o,L as u,j as e,R as h,X as b}from"./index-BJObbxud.js";function p(){const{t:s}=f(),[a,c]=o.useState(null),x=o.useRef(null),d=o.useRef(null),i=o.useRef(null),t=a?u.find(r=>r.id===a):null,l=o.useCallback(()=>{c(null)},[]);return o.useEffect(()=>{if(!t){i.current?.focus(),i.current=null;return}d.current?.focus();const r=n=>{if(n.key==="Escape"){n.preventDefault(),l();return}n.key==="Tab"&&(n.preventDefault(),d.current?.focus())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,l]),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("style",{children:h}),e.jsx("header",{className:"border-b border-border px-6 py-4",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Loading Animation Preview"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("10 个首屏加载动画候选 · 颜色遵循 Agent Tower 设计规范 · 点击卡片查看全屏效果")})]})}),e.jsxs("main",{className:"max-w-6xl mx-auto px-6 py-8",inert:t?!0:void 0,"aria-hidden":t?!0:void 0,children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:u.map((r,n)=>{const m=r.component;return e.jsxs("button",{onClick:g=>{i.current=g.currentTarget,c(r.id)},className:"group relative flex flex-col bg-card border border-border rounded-lg p-5 text-left transition-shadow hover:shadow-md focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",children:[e.jsxs("span",{className:"absolute top-3 right-3 text-[11px] font-semibold text-muted-foreground/60 tabular-nums",children:["#",n+1]}),e.jsx("div",{className:"flex items-center justify-center h-28 mb-4",children:e.jsx(m,{})}),e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:r.name}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:s(r.description)})]},r.id)})}),e.jsxs("div",{className:"mt-10 p-5 border border-border rounded-lg bg-muted/30",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground mb-2",children:s("设计推荐")}),e.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1.5 leading-relaxed",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("首选:Charcoal Breathe (#10)")})," — ",s("品牌感最强,Charcoal 色块+Tower 图标呼吸,用户对产品的第一印象即品牌本身。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选A:Tower Pulse (#1)")})," — ",s("品牌图标直接出现,脉冲节奏稳定,不浮夸,适合工作台场景。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选B:Terminal Cursor (#4)")})," — ",s("终端光标闪烁,贴合 Agent/终端协作的核心场景,开发者亲切感强。")]})]})]})]}),t&&e.jsxs("div",{ref:x,className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:r=>{r.target===r.currentTarget&&l()},role:"dialog","aria-modal":"true","aria-label":s("全屏预览:{name}",{name:t.name}),children:[e.jsx("button",{ref:d,onClick:l,className:"absolute top-4 right-4 p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none","aria-label":s("关闭预览"),children:e.jsx(b,{size:20})}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx("div",{className:"scale-[2] origin-center",children:e.jsx(t.component,{})}),e.jsxs("div",{className:"text-center mt-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:t.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-sm",children:s(t.description)})]}),e.jsx("span",{className:"text-xs text-muted-foreground/60 mt-2",children:s("按 Esc 或点击关闭按钮退出")})]})]})]})}export{p as LoadingPreviewPage};
1
+ import{u as f,r as o,L as u,j as e,R as h,X as b}from"./index-Cc3qXMhU.js";function p(){const{t:s}=f(),[a,c]=o.useState(null),x=o.useRef(null),d=o.useRef(null),i=o.useRef(null),t=a?u.find(r=>r.id===a):null,l=o.useCallback(()=>{c(null)},[]);return o.useEffect(()=>{if(!t){i.current?.focus(),i.current=null;return}d.current?.focus();const r=n=>{if(n.key==="Escape"){n.preventDefault(),l();return}n.key==="Tab"&&(n.preventDefault(),d.current?.focus())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,l]),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("style",{children:h}),e.jsx("header",{className:"border-b border-border px-6 py-4",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Loading Animation Preview"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("10 个首屏加载动画候选 · 颜色遵循 Agent Tower 设计规范 · 点击卡片查看全屏效果")})]})}),e.jsxs("main",{className:"max-w-6xl mx-auto px-6 py-8",inert:t?!0:void 0,"aria-hidden":t?!0:void 0,children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:u.map((r,n)=>{const m=r.component;return e.jsxs("button",{onClick:g=>{i.current=g.currentTarget,c(r.id)},className:"group relative flex flex-col bg-card border border-border rounded-lg p-5 text-left transition-shadow hover:shadow-md focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",children:[e.jsxs("span",{className:"absolute top-3 right-3 text-[11px] font-semibold text-muted-foreground/60 tabular-nums",children:["#",n+1]}),e.jsx("div",{className:"flex items-center justify-center h-28 mb-4",children:e.jsx(m,{})}),e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:r.name}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:s(r.description)})]},r.id)})}),e.jsxs("div",{className:"mt-10 p-5 border border-border rounded-lg bg-muted/30",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground mb-2",children:s("设计推荐")}),e.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1.5 leading-relaxed",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("首选:Charcoal Breathe (#10)")})," — ",s("品牌感最强,Charcoal 色块+Tower 图标呼吸,用户对产品的第一印象即品牌本身。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选A:Tower Pulse (#1)")})," — ",s("品牌图标直接出现,脉冲节奏稳定,不浮夸,适合工作台场景。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选B:Terminal Cursor (#4)")})," — ",s("终端光标闪烁,贴合 Agent/终端协作的核心场景,开发者亲切感强。")]})]})]})]}),t&&e.jsxs("div",{ref:x,className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:r=>{r.target===r.currentTarget&&l()},role:"dialog","aria-modal":"true","aria-label":s("全屏预览:{name}",{name:t.name}),children:[e.jsx("button",{ref:d,onClick:l,className:"absolute top-4 right-4 p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none","aria-label":s("关闭预览"),children:e.jsx(b,{size:20})}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx("div",{className:"scale-[2] origin-center",children:e.jsx(t.component,{})}),e.jsxs("div",{className:"text-center mt-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:t.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-sm",children:s(t.description)})]}),e.jsx("span",{className:"text-xs text-muted-foreground/60 mt-2",children:s("按 Esc 或点击关闭按钮退出")})]})]})]})}export{p as LoadingPreviewPage};
@@ -0,0 +1 @@
1
+ import{m as l,q as m,p as x,u,r as g,t as a,j as e,S as n,a3 as p,B as i,ac as f}from"./index-Cc3qXMhU.js";import{C as j}from"./copy-D0gl9kF8.js";import{S as b}from"./server-bEB_DY55.js";import{C as h}from"./check-DaZqOL8l.js";function N(){return l({queryKey:m.system.mcpConfig,queryFn:()=>x.get("/system/mcp-config")})}function v({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-xs font-medium ${r?"bg-success/10 text-success-ink":"bg-warning/10 text-warning-ink"}`,children:t})}function M(){const{t:s}=u(),{data:t,isLoading:r,isError:d,refetch:o}=N(),c=g.useCallback(async()=>{if(t?.configJson)try{await navigator.clipboard.writeText(t.configJson),a.success(s("MCP 配置已复制"))}catch{a.error(s("复制 MCP 配置失败"))}},[t?.configJson,s]);return r?e.jsx(n,{children:e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(p,{className:"h-5 w-5 animate-spin motion-reduce:[animation-duration:2.4s] text-muted-foreground"})})}):d||!t?e.jsxs(n,{children:[e.jsx("h2",{className:"mb-1 text-base font-semibold text-foreground",children:s("MCP 配置")}),e.jsx("div",{className:"mt-5 rounded-lg border border-destructive/25 bg-destructive/10 px-4 py-3 text-sm text-destructive-ink",children:s("MCP 配置加载失败")}),e.jsx(i,{className:"mt-4",size:"sm",variant:"outline",onClick:()=>{o()},children:s("重试")})]}):e.jsxs(n,{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-foreground",children:s("MCP 配置")}),e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-muted-foreground",children:s("复制下面的 JSON 到支持 MCP 的客户端配置中。桌面打包版使用 App 内置 runtime,不需要全局安装 agent-tower。")})]}),e.jsxs(i,{size:"sm",onClick:c,children:[e.jsx(j,{size:14}),s("复制配置")]})]}),e.jsxs("div",{className:"space-y-3 border-b border-border/60 pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(v,{mode:t.runtimeMode,label:t.runtimeMode==="desktop-packaged"?s("桌面打包 runtime"):s("工作区 runtime")}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:t.serverName})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-border/60 bg-muted/35 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e.jsx(f,{size:12}),"Command"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-foreground",children:t.command})]}),e.jsxs("div",{className:"rounded-lg border border-border/60 bg-muted/35 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e.jsx(b,{size:12}),"Entry"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-foreground",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-foreground/70",children:"mcpServers JSON"}),t.runtimeMode==="desktop-packaged"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-success-ink",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-border bg-foreground/[0.025] px-3 py-3 font-mono text-[12px] leading-relaxed text-foreground outline-none"}),e.jsx("p",{className:"mt-2 text-xs leading-relaxed text-muted-foreground",children:s("当前版本只生成通用 MCP 配置,不会自动修改 Claude、Codex 或其他第三方客户端配置文件。")})]})]})}export{M as McpSettingsPage};
@@ -1 +1 @@
1
- import{r as m,j as c,n as f}from"./index-BJObbxud.js";import{A as u}from"./people-DT78SebR.js";function p(s){const t=s.trim();if(!t)return"?";const r=t.split(/\s+/).filter(Boolean);return r.length>=2?`${r[0][0]??""}${r[1][0]??""}`.toUpperCase():Array.from(t).slice(0,2).join("").toUpperCase()}function l(s){const t=s.trim();return/^#([0-9a-f]{3,8})$/i.test(t)||/^rgba?\(/i.test(t)||/^hsla?\(/i.test(t)}function i(s){const t=s.trim();return t.startsWith("/")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:image/")||t.startsWith("blob:")}function x(s,t){const r=s?.trim()??"";return!r||l(r)||i(r)?p(t):r.length<=2?r.toUpperCase():r.slice(0,2).toUpperCase()}function d({name:s,avatar:t,size:r,className:n}){const e=t?.trim()??"",o=m.useMemo(()=>{const a=x(e,s);return r==="xs"&&/[\u3400-\u9fff]/.test(a)?Array.from(a)[0]:a},[s,e,r]);return c.jsx(u,{name:s,src:e&&i(e)?e:void 0,initials:o,size:r,className:f(!r&&"size-7 text-[10px]",n)})}export{d as M};
1
+ import{r as m,j as c,l as f}from"./index-Cc3qXMhU.js";import{A as u}from"./people-DEeNaaLt.js";function p(s){const t=s.trim();if(!t)return"?";const r=t.split(/\s+/).filter(Boolean);return r.length>=2?`${r[0][0]??""}${r[1][0]??""}`.toUpperCase():Array.from(t).slice(0,2).join("").toUpperCase()}function l(s){const t=s.trim();return/^#([0-9a-f]{3,8})$/i.test(t)||/^rgba?\(/i.test(t)||/^hsla?\(/i.test(t)}function i(s){const t=s.trim();return t.startsWith("/")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:image/")||t.startsWith("blob:")}function x(s,t){const r=s?.trim()??"";return!r||l(r)||i(r)?p(t):r.length<=2?r.toUpperCase():r.slice(0,2).toUpperCase()}function d({name:s,avatar:t,size:r,className:n}){const e=t?.trim()??"",o=m.useMemo(()=>{const a=x(e,s);return r==="xs"&&/[\u3400-\u9fff]/.test(a)?Array.from(a)[0]:a},[s,e,r]);return c.jsx(u,{name:s,src:e&&i(e)?e:void 0,initials:o,size:r,className:f(!r&&"size-7 text-[10px]",n)})}export{d as M};
@@ -0,0 +1,3 @@
1
+ import{u as V,j as e,aA as X,r as n,a2 as Ee,l as Re,aB as jt,p as Ws,q as Je,aC as Te,aq as yt,o as Nt,ak as kt,al as Ct,am as wt,aD as It,an as St,ao as Pt,ar as Tt,ap as z,s as Ts,B as Qe,av as As,aw as At,a3 as Rt,ax as Et,ay as ue,a0 as Mt}from"./index-Cc3qXMhU.js";import{b as zs,G as es,q as Ot,D as Bs,s as Lt,t as Dt,u as Wt,r as zt,g as Ae,c as Bt,e as Ft,f as Gt,a as qt,h as Ut,W as Vt,C as Ht,E as $t,i as Kt,S as _t,T as Rs,R as Qt,j as Xt,l as Yt,v as Zt,w as Jt,k as en,m as sn,n as tn,o as nn,p as rn}from"./TaskHandoffPanel-CxH3Mgyd.js";import{a as Es,Q as on,s as an}from"./mermaid-NOHMQCX5-nBsnjgeU.js";import{u as ln,a as cn,R as dn,P as un,T as mn}from"./useTokenUsage-CZ5mDshD.js";import{u as xn,a as pn,L as Ms,T as Os}from"./useNormalizedLogs-D9W1cT4R.js";import{g as fn}from"./ExecutionPermissionSelector-f1UYIm1z.js";import{u as hn,A as gn}from"./AttachmentPreview-DMS-PM-1.js";import{u as bn,a as vn,b as jn,d as yn,e as Nn,S as Ls}from"./CreateTaskInput-DjVxCAfc.js";import{F as Fs,H as Gs,a as qs,C as kn,P as Xe}from"./content-JM9E1MeD.js";import{C as Me}from"./chevron-down-DNhYsNAt.js";import{a as Cn,b as wn,c as In}from"./BranchSelect-BAq4L2ZS.js";import{u as Sn}from"./use-providers-Dv1Nk6s7.js";import{D as Pn}from"./ProjectKanbanPage-soDqevjQ.js";import{M as Us}from"./message-square-BE-pW0m_.js";import{P as Tn,T as An}from"./trash-2-CIyBqaVy.js";import{P as Rn}from"./paperclip-YP3Bk1lI.js";import"./use-translation-settings-CcUnipVO.js";import"./MemberAvatar-BLezO3vS.js";import"./people-DEeNaaLt.js";import"./chevron-up-CjrLieBR.js";import"./at-sign-DYPIlD6D.js";import"./check-DaZqOL8l.js";import"./tooltip-DuyJMci9.js";import"./kbd-IjDGsZ2B.js";import"./index-DWrSDMX2.js";import"./index-Disv1kQS.js";import"./index-Pt4TsHjm.js";import"./BrandLogo--kWXXJtZ.js";import"./popover-CUmBEXxL.js";import"./search-ClmOQd4H.js";import"./index-DyJfPc4O.js";import"./index-hpHE1jXY.js";import"./index-BMZFF1UJ.js";import"./confirm-dialog-DWeBZLJW.js";import"./dialog-D1lkhqVL.js";import"./modal-CHLtZWvx.js";import"./select-BB7QG08o.js";import"./select-CYtYPr-c.js";import"./menu-styles-DWynpVVz.js";import"./index-T38iVLEb.js";import"./provider-selection-DSu7SCI7.js";import"./layers-Pdy9vZ6K.js";import"./textarea-BqYPvoO-.js";import"./menu-DubntFHq.js";import"./server-bEB_DY55.js";import"./upload-D05XS5-G.js";import"./globe-Ce01-45x.js";import"./pencil-BFDuhbtW.js";import"./copy-D0gl9kF8.js";import"./track-DCjyrv3n.js";import"./file-BijjwxRR.js";import"./chip-Cf92J-pQ.js";import"./folder-picker-Czxm0_S9.js";function En(s){const o=s.split("/");return o[o.length-1]||s}function Mn(s){const o=s.lastIndexOf("/");return o>0?s.slice(0,o):""}function On({workingDir:s,filePath:o,type:c}){const{t:l}=V(),{data:g,isLoading:f,isError:h}=Ot(s,o,c);if(f)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-muted-foreground",children:[e.jsx(X,{}),e.jsx("span",{className:"text-xs",children:l("Loading diff...")})]});if(h)return e.jsx("div",{className:"px-3 py-3 text-xs text-destructive-ink",children:l("Failed to load diff.")});const p=g?.diff||"";if(!p.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:l("No diff content available.")});const b=p.split(`
2
+ `);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin mx-3 mb-3 rounded-lg border border-border/60 bg-background py-1 font-mono text-xs leading-5",children:e.jsx("div",{className:"min-w-max",children:b.map((a,I)=>e.jsx(Bs,{line:a,lineNum:I+1},I))})})}function Ln({entry:s,type:o,workingDir:c}){const[l,g]=n.useState(!1),f=Mn(s.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>g(h=>!h),className:Re("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-accent",l&&"bg-muted/50"),children:[e.jsx(Fs,{status:s.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground truncate block",children:En(s.path)}),f&&e.jsx("span",{className:"text-[11px] text-muted-foreground truncate block",children:f})]}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:l?e.jsx(Me,{size:14}):e.jsx(Ee,{size:14})})]}),l&&e.jsx(On,{workingDir:c,filePath:s.path,type:o})]})}function Ds({title:s,entries:o,type:c,workingDir:l,defaultOpen:g}){const{t:f}=V(),[h,p]=n.useState(g);return o.length===0?null:e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>p(b=>!b),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-accent",children:[e.jsx("span",{className:"text-muted-foreground",children:h?e.jsx(Me,{size:14}):e.jsx(Ee,{size:14})}),e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:f(s)}),e.jsx("span",{className:"text-[11px] tabular-nums bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:o.length})]}),h&&e.jsx("div",{className:"divide-y divide-border/60",children:o.map(b=>e.jsx(Ln,{entry:b,type:c,workingDir:l},`${c}:${b.path}`))})]})}function Dn({workingDir:s}){const{t:o}=V(),{data:c,isLoading:l,isError:g}=zs(s);if(!s)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:o("No workspace selected.")});if(l)return e.jsxs("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:[e.jsx(X,{size:"md",className:"mr-2"}),e.jsx("span",{className:"text-sm",children:o("Loading changes...")})]});if(g)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-sm",children:o("Failed to load changes.")});const f=c?.uncommitted||[],h=c?.committed||[];return f.length+h.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground py-16",children:[e.jsx(es,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:o("No pending changes")})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin overscroll-y-contain",children:[e.jsx(Ds,{title:"Uncommitted",entries:f,type:"uncommitted",workingDir:s,defaultOpen:!0}),e.jsx(Ds,{title:"Committed",entries:h,type:"committed",workingDir:s,defaultOpen:!1})]})}const Ye=50;function Wn(s){const c=Math.floor(Date.now()/1e3)-s;return c<60?Te("{count}s ago",{count:c}):c<3600?Te("{count}m ago",{count:Math.floor(c/60)}):c<86400?Te("{count}h ago",{count:Math.floor(c/3600)}):c<604800?Te("{count}d ago",{count:Math.floor(c/86400)}):new Date(s*1e3).toLocaleDateString()}function zn(s){const o=s.split("/");return o[o.length-1]||s}function Bn(s){const o=s.lastIndexOf("/");return o>0?s.slice(0,o):""}function Fn({workingDir:s,hash:o,filePath:c}){const{t:l}=V(),{data:g,isLoading:f,isError:h}=Dt(s,o,c);if(f)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-muted-foreground",children:[e.jsx(X,{}),e.jsx("span",{className:"text-xs",children:l("Loading diff...")})]});if(h)return e.jsx("div",{className:"px-3 py-3 text-xs text-destructive-ink",children:l("Failed to load diff.")});const p=g?.diff||"";if(!p.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:l("No diff content available.")});const b=p.split(`
3
+ `);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin mx-3 mb-3 rounded-lg border border-border/60 bg-background py-1 font-mono text-xs leading-5",children:e.jsx("div",{className:"min-w-max",children:b.map((a,I)=>e.jsx(Bs,{line:a,lineNum:I+1},I))})})}function Gn({entry:s,workingDir:o,hash:c}){const[l,g]=n.useState(!1),f=Bn(s.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>g(h=>!h),className:Re("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-accent",l&&"bg-muted/50"),children:[e.jsx(Fs,{status:s.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground truncate block",children:zn(s.path)}),f&&e.jsx("span",{className:"text-[11px] text-muted-foreground truncate block",children:f})]}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:l?e.jsx(Me,{size:14}):e.jsx(Ee,{size:14})})]}),l&&e.jsx(Fn,{workingDir:o,hash:c,filePath:s.path})]})}function qn({commit:s,workingDir:o}){const{t:c}=V(),[l,g]=n.useState(!1),{data:f,isLoading:h}=Lt(o,l?s.hash:null),p=f?.files||[];return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>g(b=>!b),className:Re("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-accent",l&&"bg-muted/50"),children:[e.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:e.jsx("div",{className:Re("w-2.5 h-2.5 rounded-full shrink-0",l?"bg-info":"bg-foreground/15")})}),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-muted-foreground shrink-0",children:s.shortHash}),e.jsx("span",{className:"text-sm text-foreground truncate flex-1",children:s.message})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:s.author}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:Wn(s.timestamp)})]})]}),e.jsx("span",{className:"text-muted-foreground shrink-0 pt-0.5",children:l?e.jsx(Me,{size:14}):e.jsx(Ee,{size:14})})]}),l&&e.jsxs("div",{className:"pl-4 border-l-2 border-border ml-[22px]",children:[s.body&&e.jsx("div",{className:"px-3 py-2 text-xs text-foreground/70 whitespace-pre-wrap leading-4",children:s.body}),h?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-muted-foreground",children:[e.jsx(X,{}),e.jsx("span",{className:"text-xs",children:c("Loading files...")})]}):p.length===0?e.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:c("No files changed")}):e.jsx("div",{className:"divide-y divide-border/60",children:p.map(b=>e.jsx(Gn,{entry:b,workingDir:o,hash:s.hash},b.path))})]})]})}function Un({workingDir:s}){const{t:o}=V(),{data:c,isLoading:l,isError:g,fetchNextPage:f,hasNextPage:h,isFetchingNextPage:p}=jt({queryKey:Je.git.log(s||""),queryFn:({pageParam:a=0})=>Ws.get("/git/log",{params:{workingDir:s||"",limit:String(Ye),skip:String(a)}}),initialPageParam:0,getNextPageParam:(a,I)=>a.commits.length<Ye?void 0:I.length*Ye,enabled:!!s}),b=c?.pages.flatMap(a=>a.commits)||[];return s?l?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:[e.jsx(X,{size:"md",className:"mr-2"}),e.jsx("span",{className:"text-sm",children:o("Loading history...")})]}):g?e.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-sm",children:o("Failed to load history.")}):b.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground py-16",children:[e.jsx(Gs,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:o("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-border/60",children:b.map(a=>e.jsx(qn,{commit:a,workingDir:s},a.hash))}),h&&e.jsx("button",{type:"button",onClick:()=>f(),disabled:p,className:"w-full py-4 text-sm text-muted-foreground active:text-foreground/80 active:bg-accent flex items-center justify-center gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(X,{})," ",o("Loading...")]}):o("Load more")})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:o("No workspace selected.")})}const Vn=Mt(),Hn=s=>s.includes("://")||s.startsWith("/api/")?s:s.startsWith("/")?`${Vn}/attachments/by-path?path=${encodeURIComponent(s)}`:s;function $n({status:s}){const o={[ue.Running]:"bg-info",[ue.Review]:"bg-warning",[ue.Pending]:"bg-muted-foreground/60",[ue.Done]:"bg-success",[ue.Cancelled]:"bg-muted-foreground/60"};return e.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${o[s]}`})}const Kn=[{key:"chat",label:"Chat",icon:Us},{key:"changes",label:"Changes",icon:es},{key:"history",label:"History",icon:Gs},{key:"workspace",label:"Workspace",icon:qs}],_n=[{key:"chat",label:"Team room",icon:Us},{key:"team-status",label:"Team Status",icon:It},{key:"changes",label:"Changes",icon:es},{key:"workspace",label:"Workspace",icon:qs}];function _r({task:s,onBack:o,onSelectTask:c,onCreateSubtask:l,onDeleteTask:g,onTaskPriorityChange:f,isDeleting:h,autoStartState:p,onAutoStartRecovered:b}){const{t:a}=V(),I=yt(t=>t.setVisibleContext),[C,B]=n.useState("chat"),[R,me]=n.useState(""),[Vs,xe]=n.useState(!1),[Hs,Oe]=n.useState(!1),[Le,pe]=n.useState(!1),[A,De]=n.useState(null),[Y,H]=n.useState(void 0),ss=n.useRef(0),[$s,We]=n.useState(),ze=n.useRef(null),Be=n.useRef(null),Z=n.useRef(null),ts=n.useRef(null),{scrollRef:F,contentRef:ns,isAtBottom:rs,scrollToBottom:fe,stopScroll:os}=ln({resize:"smooth",initial:"instant"}),$=Nt();n.useEffect(()=>{if(!Le)return;const t=r=>{Be.current&&!Be.current.contains(r.target)&&pe(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[Le]);const{data:i,isLoading:Ks}=Cn(s.id),J=Wt(s.id),as=J?.status==="completed"&&p?.status!=="failed"?null:p,Fe=!!(as||J&&J.status!=="completed"),{data:he}=kt(s.id),{data:_s}=Ct(he?.id??""),is=wt(he?.id??""),m=he??null,E=s.isGitRepo!==!1&&s.worktreeReady!==!1,Ge=n.useMemo(()=>(m?_n:Kn).filter(t=>E||t.key!=="changes"&&t.key!=="history"),[E,m]),Qs=he===null,{data:ee,isLoading:Xs}=St(s.id,Qs),j=!!s.projectArchivedAt,ls=!!s.projectRepoDeletedAt,qe=a(ls?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。");n.useEffect(()=>{H(void 0),De(null),We(void 0)},[s.id]),n.useEffect(()=>{m&&C==="history"&&B("chat"),!m&&C==="team-status"&&B("chat"),Ge.some(t=>t.key===C)||B("chat")},[C,Ge,m]);const G=n.useMemo(()=>zt(i,m,Y),[Y,m,i]);n.useEffect(()=>{Y&&!i?.some(t=>t.id===Y)&&H(void 0)},[Y,i]);const y=n.useMemo(()=>i?.find(t=>t.id===G),[G,i]),S=n.useMemo(()=>{if(i){if(y)return Ae(y);for(const t of i)if(t.status==="ACTIVE"&&Ae(t))return Ae(t);return Ae(i[0])}},[y,i]),P=y?.status===Pt.ACTIVE?y.id:void 0,Ue=E&&Bt(y,m),se=y?.branchName??"",cs=y?.commitMessage,te=n.useMemo(()=>Ft(y,i,s?.mainBranch??""),[y,s?.mainBranch,i]),ne=!!(Ue&&P&&S&&!j),{data:M,isLoading:Ys}=wn(P??"",{enabled:ne}),{data:ds}=zs(S,{enabled:ne}),Zs=ds?.committed?.length,re=Gt((i??[]).map(t=>t.id),!m),{pendingConflictDetails:oe}=re,us=!!oe;n.useEffect(()=>{const t=E&&(C==="changes"||C==="chat"&&ne)?"changes":E&&C==="history"?"history":null;if(!P||!S||!t){I(null);return}return I({workspaceId:P,workingDir:S,tab:t}),()=>{I(null)}},[C,E,P,I,ne,S]);const N=n.useMemo(()=>oe||(M?.conflictOp&&M.conflictedFiles.length>0?Tt({conflictOp:M.conflictOp,conflictedFiles:M.conflictedFiles,resolutionContextToken:M.resolutionContextToken,sourceWorkspaceId:P,sourceWorktreePath:y?.worktreePath,sourceBranch:se,targetBranch:te}):oe),[M,oe,P,y?.worktreePath,se,te]),ms=N?.targetWorkspaceId??P,Js=N?.targetWorktreePath??y?.worktreePath,et=N?.sourceBranch??se,st=N?.targetBranch??te,tt=y?.sessions??[],ge=n.useCallback(t=>{const r=t??N;r&&re.openDialog(r)},[N,re]),xs=n.useCallback(()=>s?.id?$.invalidateQueries({queryKey:Je.workspaces.list(s.id)}):Promise.resolve(),[s?.id,$]),Ve=n.useCallback(async()=>$.fetchQuery({queryKey:Je.tasks.body(s.id),queryFn:()=>Ws.get(`/tasks/${s.id}/body`)}),[$,s.id]),w=n.useMemo(()=>{if(!i)return null;const t=i.filter(x=>x.status==="ACTIVE"&&Array.isArray(x.sessions)).flatMap(x=>x.sessions??[]),r=x=>{const _=x.createdAt,Q=x.endedAt??x.startedAt??_;if(!Q)return 0;const Pe=Date.parse(Q);return Number.isNaN(Pe)?0:Pe},d=x=>{const _=t.filter(Q=>x.includes(Q.status));return _.length===0?null:_.sort((Q,Pe)=>r(Pe)-r(Q))[0]??null},u=d([z.RUNNING])??d([z.PENDING])??d([z.COMPLETED,z.FAILED,z.CANCELLED]);if(u)return u;const W=i.filter(x=>(x.status==="ABANDONED"||x.status==="MERGED"||x.status==="HIBERNATED")&&Array.isArray(x.sessions)).flatMap(x=>x.sessions??[]).filter(x=>[z.COMPLETED,z.FAILED,z.CANCELLED].includes(x.status));return W.length===0?null:W.sort((x,_)=>r(_)-r(x))[0]??null},[i]),v=w?.id??"",be=m?A??"":v,nt=n.useMemo(()=>{if(!A||!i)return null;for(const t of i){const r=t.sessions?.find(d=>d.id===A);if(r)return r}return null},[A,i]),He=n.useMemo(()=>{if(!A||!m?.invocations)return null;const t=m.invocations.filter(r=>r.sessionId===A);return t.length===0?null:t.sort((r,d)=>{const u=Date.parse(r.updatedAt??r.createdAt??""),T=Date.parse(d.updatedAt??d.createdAt??"");return(Number.isNaN(T)?0:T)-(Number.isNaN(u)?0:u)})[0]??null},[A,m?.invocations]),rt=n.useMemo(()=>!He?.memberId||!m?.members?null:m.members.find(t=>t.id===He.memberId)??null,[He?.memberId,m?.members]),k=A?nt:w??null,O=k?.id,K=n.useMemo(()=>{if(k?.workspaceId)return k.workspaceId;if(!(!k||!i))return i.find(t=>t.sessions?.some(r=>r.id===k.id))?.id},[k,i]),ve=n.useCallback((t,r)=>{const u=(r&&i?.some(T=>T.id===r)?r:void 0)??K??G??void 0;u&&H(u),ss.current+=1,We({id:ss.current,source:t,workspaceId:u}),B("workspace")},[K,G,i]),$e=n.useCallback((t,r)=>{ve({kind:"web",url:t},r)},[ve]),Ke=n.useCallback((t,r,d)=>{ve({kind:"visualization",sessionId:t,file:r},d)},[ve]),ps=n.useCallback(t=>{$e(t,K)},[K,$e]),fs=n.useCallback(t=>{O&&Ke(O,t,K)},[O,K,Ke]),{isActive:ae,isCancelling:ie}=bn(O??"",k?.status),ot=n.useMemo(()=>!w||!i?!1:!i.some(r=>r.status==="ACTIVE"&&r.sessions?.some(d=>d.id===w.id)),[w,i]),{data:je}=Sn(),[hs,at]=n.useState(null),ye=hs?.sessionId===v?hs.providerId:w?.providerId??null,Ne=w?fn(je,ye):void 0,it=n.useCallback(t=>{at({sessionId:v,providerId:t})},[v]),q=vn({agentType:w?.agentType,workingDir:S,input:R,setInput:me,textareaRef:Z,minHeight:40,maxHeight:140}),U=qt({agentType:w?.agentType,workingDir:S,input:R,setInput:me,textareaRef:Z,minHeight:40,maxHeight:140}),ke=S&&y?y.id:void 0,L=jn(),gs=In(),D=yn(),{isConnected:bs,isLoadingSnapshot:vs,isOutputActive:js,lastExitAt:ys,logs:le,entries:lt,attach:Ce}=xn({sessionId:be,sessionStatus:k?.status,sessionStartedAt:k?.startedAt??k?.createdAt,sessionEndedAt:k?.endedAt??(ae?null:k?.updatedAt),onExit:n.useCallback(()=>{$.invalidateQueries({queryKey:["workspaces"]})},[$])}),{todos:we}=pn(lt),{files:ct,addFiles:Ie,removeFile:dt,clear:Ns,getDoneAttachments:ks,hasFiles:ce,isUploading:Se}=hn(),ut=n.useMemo(()=>Ut(k),[k?.tokenUsage]),Cs=cn(le,ut);n.useEffect(()=>{be&&bs&&Ce()},[be,bs,Ce]);const ws=n.useRef(null);n.useEffect(()=>{if(ws.current!==s.id&&F.current){const t=F.current;requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}ws.current=s.id},[s.id,F]);const _e=n.useRef(!1),Is=n.useCallback(async()=>{if(!R.trim()&&!ce||!v||_e.current||D.isPending||ie||Se||Ne)return;_e.current=!0;const t=ks().map(d=>d.id),r=R.trim()||(t.length?" ":"");me(""),Ns(),Z.current&&(Z.current.style.height="40px"),L.mutate({id:v,message:r,attachmentIds:t,providerId:ye??void 0},{onSuccess:()=>Ce(),onSettled:()=>{_e.current=!1}})},[R,v,L,Ce,ce,Se,ks,Ns,ye,Ne,D.isPending,ie]),mt=n.useCallback(()=>{!v||D.isPending||D.mutate(v)},[v,D]),xt=n.useCallback(t=>is.mutateAsync(t),[is]),Ss=n.useCallback(t=>{De(t),B("chat"),requestAnimationFrame(()=>{fe()})},[fe]),pt=n.useCallback(()=>{De(null)},[]),ft=n.useCallback(()=>{B("changes")},[]),Ps=ne&&P?e.jsx(Vt,{projectId:s?.projectId??"",workspaceId:P,branchName:se,targetBranch:te,commitMessage:cs,changes:ds,gitStatus:M,isGitStatusLoading:Ys,canRunGitOperations:Ue,onOpenChanges:ft,onRefreshCommitMessage:xs,onConflict:ge,className:"mb-2"}):null,ht=n.useCallback(t=>{const r=t.target.files;r&&r.length>0&&Ie(Array.from(r)),t.target.value=""},[Ie]),gt=n.useCallback(t=>{const r=t.clipboardData.items,d=[];for(const u of r)if(u.kind==="file"){const T=u.getAsFile();T&&d.push(T)}d.length>0&&(t.preventDefault(),Ie(d))},[Ie]),bt=n.useCallback(t=>{me(t.target.value);const r=t.target;r.style.height="auto",r.style.height=`${Math.max(40,Math.min(r.scrollHeight,140))}px`},[]),vt=n.useCallback(()=>{ke&&gs.mutate({workspaceId:ke})},[gs,ke]),de=n.useRef(null);return n.useEffect(()=>{const t=window.visualViewport;if(!t)return;let r=!1;const d=()=>{de.current&&(de.current.style.height=`${t.height}px`,de.current.style.top=`${t.offsetTop}px`)},u=()=>d(),T=()=>{r||d()},W=()=>{r=!0},x=()=>{r=!1,requestAnimationFrame(d)};return t.addEventListener("resize",u),t.addEventListener("scroll",T),document.addEventListener("touchstart",W,{passive:!0}),document.addEventListener("touchend",x,{passive:!0}),document.addEventListener("touchcancel",x,{passive:!0}),()=>{t.removeEventListener("resize",u),t.removeEventListener("scroll",T),document.removeEventListener("touchstart",W),document.removeEventListener("touchend",x),document.removeEventListener("touchcancel",x)}},[]),n.useEffect(()=>{const t=de.current;if(!t)return;const r=d=>{let u=d.target;for(;u&&u!==t;){if(u.tagName==="TEXTAREA"){if(u.scrollHeight>u.clientHeight)return;u=u.parentElement;continue}const W=window.getComputedStyle(u).overflowY;if((W==="auto"||W==="scroll")&&u.scrollHeight>u.clientHeight)return;u=u.parentElement}d.preventDefault()};return t.addEventListener("touchmove",r,{passive:!1}),()=>t.removeEventListener("touchmove",r)},[]),e.jsxs("div",{ref:de,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-background overflow-hidden overscroll-none",children:[!m&&e.jsx(Ht,{recovery:re,onRecover:t=>{H(t.sourceWorkspaceId),ge(t)}}),e.jsxs("header",{className:"shrink-0 bg-background border-b border-border z-20",children:[e.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[e.jsx("button",{onClick:o,className:"p-1.5 -ml-0.5 text-foreground/70 active:text-foreground",children:e.jsx(Ts,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx($t,{taskId:s.id,title:s.title,readOnly:j,titleClassName:"text-[13px] font-semibold text-foreground truncate leading-tight",compact:!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground leading-tight",children:[e.jsx("span",{className:`truncate font-medium ${s.projectColor}`,children:s.projectName}),s.projectArchivedAt&&e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:s.projectRepoDeletedAt?a("源码已删除"):a("已删除")}),e.jsx("span",{className:"text-muted-foreground",children:"/"}),e.jsx("span",{className:"font-mono truncate",children:s.branch})]})]}),e.jsx($n,{status:s.status}),e.jsx(Nn,{value:s.priority,compact:!0,onChange:!j&&f?t=>f(s.id,t):void 0}),e.jsx("button",{onClick:vt,disabled:!ke||j,className:"p-1.5 text-muted-foreground active:text-foreground disabled:opacity-30",children:e.jsx(kn,{size:16})}),(g||l)&&!j&&e.jsxs("div",{className:"relative",ref:Be,children:[e.jsx("button",{onClick:()=>pe(t=>!t),className:"p-1.5 text-muted-foreground active:text-foreground","aria-label":"More actions",children:e.jsx(Kt,{size:16})}),Le&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-40 bg-background rounded-lg border border-border shadow-popover z-50 py-1",children:[l&&!s.parentTaskId&&e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-muted/50",onClick:()=>{pe(!1),l(s.id)},children:[e.jsx(Tn,{size:15}),e.jsx("span",{children:a("Create subtask")})]}),e.jsxs("button",{onClick:()=>{Oe(!0),pe(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-destructive-ink active:bg-destructive/10",children:[e.jsx(An,{size:15}),e.jsx("span",{children:a("删除任务")})]})]})]})]}),e.jsx("div",{className:"flex border-t border-border/60",children:Ge.map(({key:t,label:r,icon:d})=>e.jsxs("button",{onClick:()=>B(t),className:`flex min-w-0 flex-1 items-center justify-center gap-1 px-1 py-2 text-xs font-medium transition-colors ${C===t?"text-foreground border-b-2 border-foreground":"text-muted-foreground border-b-2 border-transparent"}`,children:[e.jsx(d,{size:13,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:a(r)})]},t))})]}),C==="chat"&&(m?e.jsx("main",{className:"flex-1 min-h-0 overflow-hidden",children:A?e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[e.jsxs("div",{className:"relative z-20 flex shrink-0 items-center justify-between gap-3 overflow-visible border-b border-border px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground",children:a("Invocation details")}),e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:A})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(_t,{session:k,providers:je,usage:Cs,compact:!0,providerIdFallback:rt?.providerId,agentTypeFallback:k?.agentType,tokenTooltipSide:"bottom"}),e.jsxs(Qe,{type:"button",size:"xs",variant:"ghost",className:"h-7 gap-1 rounded-lg border border-border bg-background/60 px-1.5 text-xs font-medium text-muted-foreground hover:border-foreground/20 hover:bg-accent hover:text-foreground active:bg-accent",onClick:pt,children:[e.jsx(Ts,{size:12}),e.jsx("span",{children:a("Team room")})]})]})]}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:F,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:ns,children:[!m&&s&&e.jsx(Rs,{taskId:s.id}),vs?e.jsx(Ze,{label:a("Loading logs...")}):le.length===0&&!v?e.jsx("div",{className:"text-muted-foreground text-center py-8 text-sm",children:a(ae?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(Ms,{children:e.jsx(Es,{logs:le,sessionId:O,downloadSessionId:O,isOutputActive:js,lastExitAt:ys,onUserToggleDetails:os,scrollElementRef:F,onOpenPreviewUrl:ps,onOpenVisualization:fs})})]})}),!rs&&e.jsxs("button",{onClick:()=>fe(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-foreground/70 active:bg-background transition-all","aria-label":a("Scroll to bottom"),children:[e.jsx(As,{size:12}),e.jsx("span",{children:a("回到底部")})]})]}),we.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-background shrink-0 border-t border-border/60",children:e.jsx(Os,{todos:we,compact:!0})})]}):e.jsx(Qt,{teamRun:m,messages:_s??m.messages??[],readOnly:j,readOnlyMessage:qe,onSendMessage:xt,onViewInvocationSession:Ss,changeSummaryBar:Ps,compactComposer:!0,workingDir:S,onOpenPreviewUrl:$e,onOpenVisualization:Ke})}):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:F,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:ns,children:[!m&&s&&e.jsx(Rs,{taskId:s.id}),e.jsx("div",{className:"mb-3 pb-2 border-b border-border/60",children:Xs?e.jsx("p",{className:"text-[13px] text-muted-foreground italic",children:a("Loading...")}):ee?.body?e.jsx("div",{className:"text-[13px] text-muted-foreground leading-relaxed prose prose-sm max-w-none",children:e.jsx(on,{urlTransform:Hn,components:an,children:ee.body})}):e.jsx("p",{className:"text-[13px] text-muted-foreground italic",children:"No description"})}),!j&&e.jsx(Xt,{state:as,setupProgress:J,sessionStarted:!!w?.startedAt,onRetry:v&&p?.status==="failed"?async()=>{await Ve(),xe(!0)}:void 0,compact:!0},s.id),Ks?(!Fe||j)&&e.jsx(Ze,{label:"Loading..."}):v?vs?e.jsx(Ze,{label:"Loading logs..."}):le.length===0&&!v?e.jsx("div",{className:"text-muted-foreground text-center py-8 text-sm",children:ae?"Waiting for agent output...":"No logs recorded."}):e.jsx(Ms,{children:e.jsx(Es,{logs:le,sessionId:O,downloadSessionId:O,isOutputActive:js,lastExitAt:ys,onUserToggleDetails:os,scrollElementRef:F,onOpenPreviewUrl:ps,onOpenVisualization:fs})}):!Fe||p?.status==="failed"||J?.status==="failed"||j?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(!Fe||j)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-12 h-12 bg-muted/50 rounded-xl border border-border/60 flex items-center justify-center mb-4",children:e.jsx(Xe,{size:20,className:"text-muted-foreground/70 ml-0.5"})}),e.jsx("h3",{className:"text-sm font-medium text-foreground mb-1",children:a("尚未启动 Agent")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-5 max-w-[240px]",children:j?qe:a("选择一个 Agent 来执行此任务")})]}),!j&&(!p||p.status==="failed")&&e.jsxs(Qe,{onClick:async()=>{await Ve(),xe(!0)},disabled:!!(p&&p.status!=="failed"),children:[e.jsx(Xe,{size:16,className:"mr-1.5"}),p?.status==="failed"?a("重试启动 Agent"):a("启动 Agent")]})]}):null]})}),!rs&&e.jsxs("button",{onClick:()=>fe(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-foreground/70 active:bg-background transition-all","aria-label":"Scroll to bottom",children:[e.jsx(As,{size:12}),e.jsx("span",{children:a("回到底部")})]})]}),we.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-background shrink-0 border-t border-border/60",children:e.jsx(Os,{todos:we,compact:!0})}),j?e.jsx("div",{className:"px-3 py-2 bg-background shrink-0 border-t border-border/60",children:e.jsx("div",{className:"rounded-xl border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground",children:qe})}):ot?e.jsx("div",{className:"px-3 py-2 bg-background shrink-0 border-t border-border/60",children:e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-border bg-muted/50 px-3 py-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:a("代码已合并,以上为历史沟通记录")}),e.jsxs(Qe,{size:"sm",onClick:async()=>{await Ve(),xe(!0)},children:[e.jsx(Xe,{size:14,className:"mr-1.5"}),a("启动新 Agent")]})]})}):v&&e.jsxs("div",{className:"px-3 py-2 bg-background shrink-0 border-t border-border/60",children:[Ps,e.jsx(dn,{sessionId:be||v,compact:!0}),e.jsxs("div",{ref:ze,className:"relative bg-background rounded-xl border border-border shadow-raised focus-within:border-ring",children:[e.jsx(gn,{files:ct,onRemove:dt}),e.jsx("textarea",{ref:Z,value:R,onChange:bt,onPaste:gt,onKeyDown:t=>{U.handleKeyDown(t)||q.handleKeyDown(t)||t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229&&(t.preventDefault(),Is())},rows:1,placeholder:ae?"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-foreground placeholder:text-muted-foreground/70",style:{minHeight:40,maxHeight:140}}),e.jsx("input",{ref:ts,type:"file",multiple:!0,className:"hidden",onChange:ht}),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:()=>ts.current?.click(),className:"p-1 text-muted-foreground active:text-foreground/70 rounded-lg",children:e.jsx(Rn,{size:15})})}),e.jsxs("div",{className:"flex items-center gap-1",children:[w&&je&&e.jsx(un,{providers:je,currentProviderId:ye,agentType:w.agentType,runtimeType:w.runtimeType,onSelect:it}),e.jsx(mn,{usage:Cs}),ae&&!L.isPending&&!R.trim()&&!ce?e.jsx("button",{onClick:mt,disabled:D.isPending||ie,"aria-label":a("Stop"),className:"p-1.5 rounded-lg bg-destructive-ink text-white active:bg-destructive-ink/90 disabled:opacity-50",children:e.jsx(At,{size:12})}):e.jsx("button",{onClick:Is,"aria-label":a(L.isPending?"发送中...":"Send"),"aria-busy":L.isPending,disabled:!R.trim()&&!ce||Se||L.isPending||D.isPending||ie||!!Ne,className:`p-1.5 rounded-lg transition-colors ${(R.trim()||ce)&&!Se&&!L.isPending&&!D.isPending&&!ie&&!Ne?"bg-primary text-primary-foreground active:bg-primary":"bg-transparent text-muted-foreground"}`,children:L.isPending?e.jsx(Rt,{size:15,className:"animate-spin"}):e.jsx(Et,{size:15})})]})]})]}),e.jsx(Ls,{open:q.query!==null,anchorRef:ze,commands:q.filteredCommands,selectedIndex:q.selectedIndex,query:q.query??"",hasCatalog:q.allCommands.length>0,compact:!0,onSelect:q.applyCommand}),e.jsx(Ls,{open:U.query!==null,anchorRef:ze,commands:U.filteredSkills,selectedIndex:U.selectedIndex,query:U.query??"",hasCatalog:U.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",compact:!0,onSelect:U.applySkill})]})]})),C==="team-status"&&m&&e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(Yt,{teamRun:m,workspaces:i,selectedWorkspaceId:G,onSelectWorkspace:H,onViewInvocationSession:Ss})}),C==="changes"&&E&&e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[i&&i.length>1&&e.jsx("div",{className:"shrink-0 border-b border-border/60 bg-background px-3 py-2",children:e.jsx(Zt,{workspaces:i,teamRun:m,selectedWorkspaceId:G,onSelectWorkspace:H,className:"w-full",buttonClassName:"w-full max-w-none min-w-0 justify-start"})}),Ue&&P&&e.jsx("div",{className:"shrink-0",children:e.jsx(Jt,{projectId:s.projectId,workspaceId:P,branchName:se,targetBranch:te,commitMessage:cs,committedFileCount:Zs,onRefreshCommitMessage:xs,onConflict:ge,onResolveConflicts:()=>ge()})}),e.jsx(Dn,{workingDir:S})]}),C==="history"&&e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsx(Un,{workingDir:S})}),C==="workspace"&&e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(en,{handoff:e.jsx(tn,{taskId:s.id,readOnly:j},s.id),subtasks:e.jsx(sn,{task:s,onSelectTask:c,onCreateSubtask:l},s.id),sessionId:v||void 0,workspaceId:G,workingDir:S,projectId:s.projectId,className:"h-full",hideChanges:!0,gitAvailable:E,readOnly:j,repoDeleted:ls,previewRequest:$s,onPreviewRequestHandled:t=>{We(r=>r?.id===t?void 0:r)}})}),!j&&e.jsx(nn,{isOpen:Vs,onClose:()=>xe(!1),taskId:s.id,projectId:s.projectId,taskTitle:ee?.title??s.title,taskDescription:ee?.body??"",taskPrompt:ee?.prompt,projectIsGitRepo:s.isGitRepo,projectWorktreeReady:s.worktreeReady,projectGitReason:s.reason,onStarted:()=>b?.(s.id)}),e.jsx(Pn,{isOpen:Hs,onClose:()=>Oe(!1),onConfirm:t=>{g?.(s.id,t),Oe(!1)},taskId:s.id,taskTitle:s.title,workspaces:i,isLoading:h}),us&&N&&ms&&e.jsx(rn,{open:us,onOpenChange:t=>{t||re.closeDialog()},workspaceId:ms,conflictOp:N.conflictOp,conflictedFiles:N.conflictedFiles,resolutionContextToken:N.resolutionContextToken,sourceBranch:et,targetBranch:st,operation:M?.operation,worktreePath:Js,mergeAborted:N.mergeAborted,mergeStrategy:N.mergeStrategy,sourceWorkspaceId:N.sourceWorkspaceId,targetWorkspaceId:N.targetWorkspaceId,sourceWorktreePath:N.sourceWorktreePath,targetWorktreePath:N.targetWorktreePath,sessions:tt,currentSessionId:m?void 0:v,teamRunId:m?.id})]})}function Ze({label:s}){return e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground",children:[e.jsxs("svg",{className:"animate-spin motion-reduce:[animation-duration:2.4s] 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:s})]})}export{_r as MobileTaskDetail};
@@ -0,0 +1 @@
1
+ import{m as P,o as E,n as k,q as v,p as h,u as R,r as o,j as e,S as g,a7 as B,h as q,i as j,a8 as W,I as d,B as z,a3 as L,a9 as A,a4 as K,k as M,aa as Q}from"./index-Cc3qXMhU.js";import{S as O}from"./select-BB7QG08o.js";import{S as D}from"./toggles-a5fkwT_D.js";import{M as H}from"./message-square-BE-pW0m_.js";import{L as G}from"./link-Bl1ZbjFh.js";import"./select-CYtYPr-c.js";import"./menu-styles-DWynpVVz.js";import"./chevron-down-DNhYsNAt.js";import"./check-DaZqOL8l.js";import"./index-BMZFF1UJ.js";import"./index-DWrSDMX2.js";import"./index-Disv1kQS.js";import"./index-T38iVLEb.js";import"./index-Pt4TsHjm.js";import"./index-hpHE1jXY.js";function J(){return P({queryKey:v.notifications.settings,queryFn:()=>h.get("/notifications/settings")})}function V(){const t=E();return k({mutationFn:a=>h.put("/notifications/settings",a),onSuccess:()=>{t.invalidateQueries({queryKey:v.notifications.settings})}})}function X(){return k({mutationFn:t=>h.post("/notifications/test",t)})}function me(){const{t}=R(),{data:a,isLoading:T}=J(),l=V(),n=X(),N=[{value:"none",label:t("关闭")},{value:"feishu",label:t("飞书 Webhook")}],[i,p]=o.useState({webhookUrl:"",baseUrl:"",titleTemplate:"",bodyTemplate:""}),[m,x]=o.useState(!1),[f,r]=o.useState("idle"),u=o.useRef(void 0);if(o.useEffect(()=>{a&&!m&&p({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)=>{p(F=>({...F,[s]:I})),x(!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:()=>x(!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(D,{checked:y,onCheckedChange:S,"aria-label":t("桌面通知")})}),e.jsxs("div",{className:"py-5",children:[e.jsx(j,{icon:H,label:t("第三方通知"),description:t("推送到外部渠道(飞书群机器人等)"),align:"center",className:"py-0",children:e.jsx(O,{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-ink",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-ink",children:[e.jsx(K,{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(G,{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(M,{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(Q,{saving:l.isPending,onSave:U})]})}export{me as NotificationSettingsPage};
@@ -1,3 +1,3 @@
1
- import{u as T,r as g,j as e,i as S,k as V,G,H as w,I as M,B as E,J as p,n as P}from"./index-BJObbxud.js";import{u as U,a as _,b as z,c as B}from"./use-profiles-DuXaBRju.js";import{M as F}from"./modal-CSGOqphK.js";import{C as $}from"./confirm-dialog-ltNBFYCs.js";import{T as R}from"./textarea-BVyPl9rM.js";import{L as H}from"./layers-eaHAVcc3.js";import{C as q}from"./chevron-down-3y5Aiolp.js";import{P as K,T as Q}from"./trash-2-CvUJsbtT.js";import{P as W}from"./pencil-Cp70ZwtG.js";import"./dialog-CuFEdqLg.js";import"./index-Bhvt-E6d.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-xs 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-xs 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-xs font-semibold",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-xs font-medium text-muted-foreground",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 ue(){const{t}=T(),{data:a,isLoading:m}=U(),{data:c}=_(),h=z(),j=B(),[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(`{
1
+ import{u as T,r as g,j as e,S,h as J,E as F,F as w,I as G,B as E,G as p,l as P}from"./index-Cc3qXMhU.js";import{u as M,a as U,b as _,c as z}from"./use-profiles-CrWTyz1G.js";import{M as B}from"./modal-CHLtZWvx.js";import{C as $}from"./confirm-dialog-DWeBZLJW.js";import{T as R}from"./textarea-BqYPvoO-.js";import{L as H}from"./layers-Pdy9vZ6K.js";import{C as q}from"./chevron-down-DNhYsNAt.js";import{P as K,T as Q}from"./trash-2-CIyBqaVy.js";import{P as W}from"./pencil-BFDuhbtW.js";import"./dialog-D1lkhqVL.js";import"./index-DWrSDMX2.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-xs 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-xs 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-xs font-semibold",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-xs font-medium text-muted-foreground",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 ue(){const{t}=T(),{data:a,isLoading:m}=M(),{data:c}=U(),h=_(),j=z(),[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
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(V,{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,J)=>k(s,d,J),onNew:()=>O(s),onDelete:d=>L(s,d)},s))}),Object.keys(C).length===0&&e.jsx(G,{icon:H,message:t("暂无 Profile 配置")}),e.jsx(F,{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(M,{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-ink",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{ue as ProfileSettingsPage};
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(F,{icon:H,message:t("暂无 Profile 配置")}),e.jsx(B,{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(G,{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-ink",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{ue as ProfileSettingsPage};
@@ -0,0 +1,12 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TaskDetail-CqhPxvg3.js","assets/index-Cc3qXMhU.js","assets/index-BN53vGxp.css","assets/TaskHandoffPanel-CxH3Mgyd.js","assets/trash-2-CIyBqaVy.js","assets/mermaid-NOHMQCX5-nBsnjgeU.js","assets/AttachmentPreview-DMS-PM-1.js","assets/tooltip-DuyJMci9.js","assets/kbd-IjDGsZ2B.js","assets/index-DWrSDMX2.js","assets/index-Disv1kQS.js","assets/index-Pt4TsHjm.js","assets/use-translation-settings-CcUnipVO.js","assets/copy-D0gl9kF8.js","assets/index-DyJfPc4O.js","assets/chevron-down-DNhYsNAt.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/use-providers-Dv1Nk6s7.js","assets/MemberAvatar-BLezO3vS.js","assets/people-DEeNaaLt.js","assets/chevron-up-CjrLieBR.js","assets/at-sign-DYPIlD6D.js","assets/paperclip-YP3Bk1lI.js","assets/check-DaZqOL8l.js","assets/useTokenUsage-CZ5mDshD.js","assets/CreateTaskInput-DjVxCAfc.js","assets/BranchSelect-BAq4L2ZS.js","assets/popover-CUmBEXxL.js","assets/search-ClmOQd4H.js","assets/menu-styles-DWynpVVz.js","assets/BrandLogo--kWXXJtZ.js","assets/index-hpHE1jXY.js","assets/index-BMZFF1UJ.js","assets/ExecutionPermissionSelector-f1UYIm1z.js","assets/menu-DubntFHq.js","assets/provider-selection-DSu7SCI7.js","assets/confirm-dialog-DWeBZLJW.js","assets/dialog-D1lkhqVL.js","assets/modal-CHLtZWvx.js","assets/select-BB7QG08o.js","assets/select-CYtYPr-c.js","assets/index-T38iVLEb.js","assets/layers-Pdy9vZ6K.js","assets/message-square-BE-pW0m_.js","assets/textarea-BqYPvoO-.js","assets/content-JM9E1MeD.js","assets/file-BijjwxRR.js","assets/server-bEB_DY55.js","assets/upload-D05XS5-G.js","assets/globe-Ce01-45x.js","assets/pencil-BFDuhbtW.js","assets/TaskHandoffPanel-DcpNTP1B.css","assets/useNormalizedLogs-D9W1cT4R.js","assets/track-DCjyrv3n.js","assets/chip-Cf92J-pQ.js","assets/folder-picker-Czxm0_S9.js","assets/MobileTaskDetail-M_Kke9rL.js"])))=>i.map(i=>d[i]);
2
+ import{c as tr,aX as Xr,p as Be,r as u,ab as F,aF as ht,as as Ye,bm as Ae,ay as re,b4 as Se,u as De,bn as nr,j as o,a5 as Ne,ap as Sn,az as nt,l as ie,a2 as rr,bo as Mt,bp as qr,bq as Vr,br as Jr,aN as sr,N as Zr,m as es,o as $t,n as hn,q as fe,X as ts,aA as ns,ae as rs,aj as Dt,aT as ss,t as Te,bs as os,bt as is,ai as as,bu as ls,bv as cs,bw as us,aP as Nn,aQ as En,bx as or}from"./index-Cc3qXMhU.js";import{C as ds}from"./confirm-dialog-DWeBZLJW.js";import{a as fs,k as hs,h as ms}from"./BranchSelect-BAq4L2ZS.js";import{f as gs,g as kn,j as jn,s as mt,k as ps,c as vs,C as Rn}from"./CreateTaskInput-DjVxCAfc.js";import{P as ir,T as bs}from"./trash-2-CIyBqaVy.js";import{C as bt}from"./check-DaZqOL8l.js";import{S as ar}from"./search-ClmOQd4H.js";import{F as xs}from"./chip-Cf92J-pQ.js";import{S as ys,I as Jt,B as Tn}from"./BrandLogo--kWXXJtZ.js";import{M as ws}from"./message-square-BE-pW0m_.js";import{L as an}from"./layers-Pdy9vZ6K.js";import{c as Cs,P as Ss,a as Ns,b as Es,I as ks}from"./popover-CUmBEXxL.js";import{C as An}from"./copy-D0gl9kF8.js";import{u as js}from"./use-providers-Dv1Nk6s7.js";import{i as Rs}from"./provider-selection-DSu7SCI7.js";import{F as Ts}from"./folder-picker-Czxm0_S9.js";import{M as Dn}from"./modal-CHLtZWvx.js";import{a as dt}from"./ExecutionPermissionSelector-f1UYIm1z.js";import{C as As}from"./chevron-down-DNhYsNAt.js";const Ds=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],Is=tr("list-tree",Ds);const Ms=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],In=tr("smartphone",Ms),Zt=new Map;async function Ps(e,t,n){const r=`tower:task-start:${e}:${JSON.stringify(t)}`;let a=Zt.get(r);if(!a)try{const h=sessionStorage.getItem(r);h&&(a=JSON.parse(h))}catch{}a??={creationId:Xr()},Zt.set(r,a);const c=()=>{try{sessionStorage.setItem(r,JSON.stringify(a))}catch{}};c(),a.workspace||(n.onStep?.("creating-workspace"),a.workspace=await n.createWorkspace(a.creationId),c()),a.session||(n.onStep?.("creating-session"),a.session=await Be.post(`/workspaces/${a.workspace.id}/sessions`,{providerId:t.providerId,prompt:t.prompt,retryTask:t.retryTask,clientSubmissionId:a.creationId}),c()),n.onStep?.("starting-session"),await n.startSession(a.session.id),Zt.delete(r);try{sessionStorage.removeItem(r)}catch{}return{workspace:a.workspace,session:a.session}}const Kt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function st(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function mn(e){return"nodeType"in e}function pe(e){var t,n;return e?st(e)?e:mn(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function gn(e){const{Document:t}=pe(e);return e instanceof t}function Ct(e){return st(e)?!1:e instanceof pe(e).HTMLElement}function lr(e){return e instanceof pe(e).SVGElement}function ot(e){return e?st(e)?e.document:mn(e)?gn(e)?e:Ct(e)||lr(e)?e.ownerDocument:document:document:document}const Fe=Kt?u.useLayoutEffect:u.useEffect;function Gt(e){const t=u.useRef(e);return Fe(()=>{t.current=e}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t.current==null?void 0:t.current(...r)},[])}function Os(){const e=u.useRef(null),t=u.useCallback((r,a)=>{e.current=setInterval(r,a)},[]),n=u.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function xt(e,t){t===void 0&&(t=[e]);const n=u.useRef(e);return Fe(()=>{n.current!==e&&(n.current=e)},t),n}function St(e,t){const n=u.useRef();return u.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Pt(e){const t=Gt(e),n=u.useRef(null),r=u.useCallback(a=>{a!==n.current&&t?.(a,n.current),n.current=a},[]);return[n,r]}function Ot(e){const t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}let en={};function Wt(e,t){return u.useMemo(()=>{if(t)return t;const n=en[e]==null?0:en[e]+1;return en[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),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((c,h)=>{const f=Object.entries(h);for(const[s,i]of f){const l=c[s];l!=null&&(c[s]=l+e*i)}return c},{...t})}}const rt=cr(1),Lt=cr(-1);function Ls(e){return"clientX"in e&&"clientY"in e}function pn(e){if(!e)return!1;const{KeyboardEvent:t}=pe(e.target);return t&&e instanceof t}function zs(e){if(!e)return!1;const{TouchEvent:t}=pe(e.target);return t&&e instanceof t}function zt(e){if(zs(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 Ls(e)?{x:e.clientX,y:e.clientY}:null}const yt=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[yt.Translate.toString(e),yt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Mn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Bs(e){return e.matches(Mn)?e:e.querySelector(Mn)}const Fs={display:"none"};function _s(e){let{id:t,value:n}=e;return F.createElement("div",{id:t,style:Fs},n)}function Us(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const a={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 F.createElement("div",{id:t,style:a,role:"status","aria-live":r,"aria-atomic":!0},n)}function $s(){const[e,t]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const ur=u.createContext(null);function Ks(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 Gs(){const[e]=u.useState(()=>new Set),t=u.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[u.useCallback(r=>{let{type:a,event:c}=r;e.forEach(h=>{var f;return(f=h[a])==null?void 0:f.call(h,c)})},[e]),t]}const Ws={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
+ `},Qs={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 Ys(e){let{announcements:t=Qs,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=Ws}=e;const{announce:c,announcement:h}=$s(),f=Wt("DndLiveRegion"),[s,i]=u.useState(!1);if(u.useEffect(()=>{i(!0)},[]),Ks(u.useMemo(()=>({onDragStart(d){let{active:m}=d;c(t.onDragStart({active:m}))},onDragMove(d){let{active:m,over:p}=d;t.onDragMove&&c(t.onDragMove({active:m,over:p}))},onDragOver(d){let{active:m,over:p}=d;c(t.onDragOver({active:m,over:p}))},onDragEnd(d){let{active:m,over:p}=d;c(t.onDragEnd({active:m,over:p}))},onDragCancel(d){let{active:m,over:p}=d;c(t.onDragCancel({active:m,over:p}))}}),[c,t])),!s)return null;const l=F.createElement(F.Fragment,null,F.createElement(_s,{id:r,value:a.draggable}),F.createElement(Us,{id:f,announcement:h}));return n?ht.createPortal(l,n):l}var ae;(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"})(ae||(ae={}));function Bt(){}function Hs(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Xs(){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 Ee=Object.freeze({x:0,y:0});function qs(e,t){const n=zt(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 Vs(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Js(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),a=Math.min(t.left+t.width,e.left+e.width),c=Math.min(t.top+t.height,e.top+e.height),h=a-r,f=c-n;if(r<a&&n<c){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 eo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const c of r){const{id:h}=c,f=n.get(h);if(f){const s=Zs(f,t);s>0&&a.push({id:h,data:{droppableContainer:c,value:s}})}}return a.sort(Vs)};function to(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}:Ee}function no(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),c=1;c<r;c++)a[c-1]=arguments[c];return a.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 ro=no(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 so(e,t,n){const r=fr(t);if(!r)return e;const{scaleX:a,scaleY:c,x:h,y:f}=r,s=e.left-h-(1-a)*parseFloat(n),i=e.top-f-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),l=a?e.width/a:e.width,d=c?e.height/c:e.height;return{width:l,height:d,top:i,right:s+l,bottom:i+d,left:s}}const oo={ignoreTransform:!1};function Nt(e,t){t===void 0&&(t=oo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:i,transformOrigin:l}=pe(e).getComputedStyle(e);i&&(n=so(n,i,l))}const{top:r,left:a,width:c,height:h,bottom:f,right:s}=n;return{top:r,left:a,width:c,height:h,bottom:f,right:s}}function Pn(e){return Nt(e,{ignoreTransform:!0})}function io(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ao(e,t){return t===void 0&&(t=pe(e).getComputedStyle(e)),t.position==="fixed"}function lo(e,t){t===void 0&&(t=pe(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const c=t[a];return typeof c=="string"?n.test(c):!1})}function vn(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(gn(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Ct(a)||lr(a)||n.includes(a))return n;const c=pe(e).getComputedStyle(a);return a!==e&&lo(a,c)&&n.push(a),ao(a,c)?n:r(a.parentNode)}return e?r(e):n}function hr(e){const[t]=vn(e,1);return t??null}function tn(e){return!Kt||!e?null:st(e)?e:mn(e)?gn(e)||e===ot(e).scrollingElement?window:Ct(e)?e:null:null}function mr(e){return st(e)?e.scrollX:e.scrollLeft}function gr(e){return st(e)?e.scrollY:e.scrollTop}function ln(e){return{x:mr(e),y:gr(e)}}var he;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(he||(he={}));function pr(e){return!Kt||!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},a=e.scrollTop<=t.y,c=e.scrollLeft<=t.x,h=e.scrollTop>=r.y,f=e.scrollLeft>=r.x;return{isTop:a,isLeft:c,isBottom:h,isRight:f,maxScroll:r,minScroll:t}}const co={x:.2,y:.2};function uo(e,t,n,r,a){let{top:c,left:h,right:f,bottom:s}=n;r===void 0&&(r=10),a===void 0&&(a=co);const{isTop:i,isBottom:l,isLeft:d,isRight:m}=vr(e),p={x:0,y:0},g={x:0,y:0},x={height:t.height*a.y,width:t.width*a.x};return!i&&c<=t.top+x.height?(p.y=he.Backward,g.y=r*Math.abs((t.top+x.height-c)/x.height)):!l&&s>=t.bottom-x.height&&(p.y=he.Forward,g.y=r*Math.abs((t.bottom-x.height-s)/x.height)),!m&&f>=t.right-x.width?(p.x=he.Forward,g.x=r*Math.abs((t.right-x.width-f)/x.width)):!d&&h<=t.left+x.width&&(p.x=he.Backward,g.x=r*Math.abs((t.left+x.width-h)/x.width)),{direction:p,speed:g}}function fo(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:h}=window;return{top:0,left:0,right:c,bottom:h,width:c,height:h}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function br(e){return e.reduce((t,n)=>rt(t,ln(n)),Ee)}function ho(e){return e.reduce((t,n)=>t+mr(n),0)}function mo(e){return e.reduce((t,n)=>t+gr(n),0)}function xr(e,t){if(t===void 0&&(t=Nt),!e)return;const{top:n,left:r,bottom:a,right:c}=t(e);hr(e)&&(a<=0||c<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const go=[["x",["left","right"],ho],["y",["top","bottom"],mo]];class bn{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=vn(n),a=br(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,h,f]of go)for(const s of h)Object.defineProperty(this,s,{get:()=>{const i=f(r),l=a[c]-i;return this.rect[s]+l},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class gt{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 a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function po(e){const{EventTarget:t}=pe(e);return e instanceof t?e:ot(e)}function nn(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 Ce;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ce||(Ce={}));function On(e){e.preventDefault()}function vo(e){e.stopPropagation()}var te;(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"})(te||(te={}));const yr={start:[te.Space,te.Enter],cancel:[te.Esc],end:[te.Space,te.Enter,te.Tab]},bo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case te.Right:return{...n,x:n.x+25};case te.Left:return{...n,x:n.x-25};case te.Down:return{...n,y:n.y+25};case te.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 gt(ot(n)),this.windowListeners=new gt(pe(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ce.Resize,this.handleCancel),this.windowListeners.add(Ce.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ce.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&xr(r),n(Ee)}handleKeyDown(t){if(pn(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:c=yr,coordinateGetter:h=bo,scrollBehavior:f="smooth"}=a,{code:s}=t;if(c.end.includes(s)){this.handleEnd(t);return}if(c.cancel.includes(s)){this.handleCancel(t);return}const{collisionRect:i}=r.current,l=i?{x:i.left,y:i.top}:Ee;this.referenceCoordinates||(this.referenceCoordinates=l);const d=h(t,{active:n,context:r.current,currentCoordinates:l});if(d){const m=Lt(d,l),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const x of g){const v=t.code,{isTop:k,isRight:C,isLeft:y,isBottom:R,maxScroll:N,minScroll:M}=vr(x),P=fo(x),S={x:Math.min(v===te.Right?P.right-P.width/2:P.right,Math.max(v===te.Right?P.left:P.left+P.width/2,d.x)),y:Math.min(v===te.Down?P.bottom-P.height/2:P.bottom,Math.max(v===te.Down?P.top:P.top+P.height/2,d.y))},z=v===te.Right&&!C||v===te.Left&&!y,_=v===te.Down&&!R||v===te.Up&&!k;if(z&&S.x!==d.x){const O=x.scrollLeft+m.x,G=v===te.Right&&O<=N.x||v===te.Left&&O>=M.x;if(G&&!m.y){x.scrollTo({left:O,behavior:f});return}G?p.x=x.scrollLeft-O:p.x=v===te.Right?x.scrollLeft-N.x:x.scrollLeft-M.x,p.x&&x.scrollBy({left:-p.x,behavior:f});break}else if(_&&S.y!==d.y){const O=x.scrollTop+m.y,G=v===te.Down&&O<=N.y||v===te.Up&&O>=M.y;if(G&&!m.x){x.scrollTo({top:O,behavior:f});return}G?p.y=x.scrollTop-O:p.y=v===te.Down?x.scrollTop-N.y:x.scrollTop-M.y,p.y&&x.scrollBy({top:-p.y,behavior:f});break}}this.handleMove(t,rt(Lt(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:a}=t,{active:c}=n;const{code:h}=e.nativeEvent;if(r.start.includes(h)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),a?.({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 a;r===void 0&&(r=po(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:c}=t,{target:h}=c;this.props=t,this.events=n,this.document=ot(h),this.documentListeners=new gt(this.document),this.listeners=new gt(r),this.windowListeners=new gt(pe(h)),this.initialCoordinates=(a=zt(c))!=null?a:Ee,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(Ce.Resize,this.handleCancel),this.windowListeners.add(Ce.DragStart,On),this.windowListeners.add(Ce.VisibilityChange,this.handleCancel),this.windowListeners.add(Ce.ContextMenu,On),this.documentListeners.add(Ce.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:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ce.Click,vo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ce.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:c}=this,{onMove:h,options:{activationConstraint:f}}=c;if(!a)return;const s=(n=zt(t))!=null?n:Ee,i=Lt(a,s);if(!r&&f){if(Ln(f)){if(f.tolerance!=null&&nn(i,f.tolerance))return this.handleCancel();if(nn(i,f.distance))return this.handleStart()}if(zn(f)&&nn(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===te.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const xo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class yn extends xn{constructor(t){const{event:n}=t,r=ot(n.target);super(t,xo,r)}}yn.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 yo={move:{name:"mousemove"},end:{name:"mouseup"}};var cn;(function(e){e[e.RightClick=2]="RightClick"})(cn||(cn={}));class wo extends xn{constructor(t){super(t,yo,ot(t.event.target))}}wo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===cn.RightClick?!1:(r?.({event:n}),!0)}}];const rn={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Co extends xn{constructor(t){super(t,rn)}static setup(){return window.addEventListener(rn.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(rn.move.name,t)};function t(){}}}Co.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var pt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(pt||(pt={}));var Ft;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ft||(Ft={}));function So(e){let{acceleration:t,activator:n=pt.Pointer,canScroll:r,draggingRect:a,enabled:c,interval:h=5,order:f=Ft.TreeOrder,pointerCoordinates:s,scrollableAncestors:i,scrollableAncestorRects:l,delta:d,threshold:m}=e;const p=Eo({delta:d,disabled:!c}),[g,x]=Os(),v=u.useRef({x:0,y:0}),k=u.useRef({x:0,y:0}),C=u.useMemo(()=>{switch(n){case pt.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case pt.DraggableRect:return a}},[n,a,s]),y=u.useRef(null),R=u.useCallback(()=>{const M=y.current;if(!M)return;const P=v.current.x*k.current.x,S=v.current.y*k.current.y;M.scrollBy(P,S)},[]),N=u.useMemo(()=>f===Ft.TreeOrder?[...i].reverse():i,[f,i]);u.useEffect(()=>{if(!c||!i.length||!C){x();return}for(const M of N){if(r?.(M)===!1)continue;const P=i.indexOf(M),S=l[P];if(!S)continue;const{direction:z,speed:_}=uo(M,S,C,t,m);for(const O of["x","y"])p[O][z[O]]||(_[O]=0,z[O]=0);if(_.x>0||_.y>0){x(),y.current=M,g(R,h),v.current=_,k.current=z;return}}v.current={x:0,y:0},k.current={x:0,y:0},x()},[t,R,r,x,c,h,JSON.stringify(C),JSON.stringify(p),g,i,N,l,JSON.stringify(m)])}const No={x:{[he.Backward]:!1,[he.Forward]:!1},y:{[he.Backward]:!1,[he.Forward]:!1}};function Eo(e){let{delta:t,disabled:n}=e;const r=Ot(t);return St(a=>{if(n||!r||!a)return No;const c={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[he.Backward]:a.x[he.Backward]||c.x===-1,[he.Forward]:a.x[he.Forward]||c.x===1},y:{[he.Backward]:a.y[he.Backward]||c.y===-1,[he.Forward]:a.y[he.Forward]||c.y===1}}},[n,t,r])}function ko(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return St(a=>{var c;return t==null?null:(c=r??a)!=null?c:null},[r,t])}function jo(e,t){return u.useMemo(()=>e.reduce((n,r)=>{const{sensor:a}=r,c=a.activators.map(h=>({eventName:h.eventName,handler:t(h.handler,r)}));return[...n,...c]},[]),[e,t])}var wt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(wt||(wt={}));var un;(function(e){e.Optimized="optimized"})(un||(un={}));const Bn=new Map;function Ro(e,t){let{dragging:n,dependencies:r,config:a}=t;const[c,h]=u.useState(null),{frequency:f,measure:s,strategy:i}=a,l=u.useRef(e),d=v(),m=xt(d),p=u.useCallback(function(k){k===void 0&&(k=[]),!m.current&&h(C=>C===null?k:C.concat(k.filter(y=>!C.includes(y))))},[m]),g=u.useRef(null),x=St(k=>{if(d&&!n)return Bn;if(!k||k===Bn||l.current!==e||c!=null){const C=new Map;for(let y of e){if(!y)continue;if(c&&c.length>0&&!c.includes(y.id)&&y.rect.current){C.set(y.id,y.rect.current);continue}const R=y.node.current,N=R?new bn(s(R),R):null;y.rect.current=N,N&&C.set(y.id,N)}return C}return k},[e,c,n,d,s]);return u.useEffect(()=>{l.current=e},[e]),u.useEffect(()=>{d||p()},[n,d]),u.useEffect(()=>{c&&c.length>0&&h(null)},[JSON.stringify(c)]),u.useEffect(()=>{d||typeof f!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},f))},[f,d,p,...r]),{droppableRects:x,measureDroppableContainers:p,measuringScheduled:c!=null};function v(){switch(i){case wt.Always:return!1;case wt.BeforeDragging:return n;default:return!n}}}function wn(e,t){return St(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function To(e,t){return wn(e,t)}function Ao(e){let{callback:t,disabled:n}=e;const r=Gt(t),a=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(r)},[r,n]);return u.useEffect(()=>()=>a?.disconnect(),[a]),a}function Qt(e){let{callback:t,disabled:n}=e;const r=Gt(t),a=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(r)},[n]);return u.useEffect(()=>()=>a?.disconnect(),[a]),a}function Do(e){return new bn(Nt(e),e)}function Fn(e,t,n){t===void 0&&(t=Do);const[r,a]=u.useState(null);function c(){a(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=Ao({callback(s){if(e)for(const i of s){const{type:l,target:d}=i;if(l==="childList"&&d instanceof HTMLElement&&d.contains(e)){c();break}}}}),f=Qt({callback:c});return Fe(()=>{c(),e?(f?.observe(e),h?.observe(document.body,{childList:!0,subtree:!0})):(f?.disconnect(),h?.disconnect())},[e]),r}function Io(e){const t=wn(e);return dr(e,t)}const _n=[];function Mo(e){const t=u.useRef(e),n=St(r=>e?r&&r!==_n&&e&&t.current&&e.parentNode===t.current.parentNode?r:vn(e):_n,[e]);return u.useEffect(()=>{t.current=e},[e]),n}function Po(e){const[t,n]=u.useState(null),r=u.useRef(e),a=u.useCallback(c=>{const h=tn(c.target);h&&n(f=>f?(f.set(h,ln(h)),new Map(f)):null)},[]);return u.useEffect(()=>{const c=r.current;if(e!==c){h(c);const f=e.map(s=>{const i=tn(s);return i?(i.addEventListener("scroll",a,{passive:!0}),[i,ln(i)]):null}).filter(s=>s!=null);n(f.length?new Map(f):null),r.current=e}return()=>{h(e),h(c)};function h(f){f.forEach(s=>{const i=tn(s);i?.removeEventListener("scroll",a)})}},[a,e]),u.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,h)=>rt(c,h),Ee):br(e):Ee,[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!==Ee;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Lt(e,n.current):Ee}function Oo(e){u.useEffect(()=>{if(!Kt)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 Lo(e,t){return u.useMemo(()=>e.reduce((n,r)=>{let{eventName:a,handler:c}=r;return n[a]=h=>{c(h,t)},n},{}),[e,t])}function Cr(e){return u.useMemo(()=>e?io(e):null,[e])}const $n=[];function zo(e,t){t===void 0&&(t=Nt);const[n]=e,r=Cr(n?pe(n):null),[a,c]=u.useState($n);function h(){c(()=>e.length?e.map(s=>pr(s)?r:new bn(t(s),s)):$n)}const f=Qt({callback:h});return Fe(()=>{f?.disconnect(),h(),e.forEach(s=>f?.observe(s))},[e]),a}function Sr(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ct(t)?t:e}function Bo(e){let{measure:t}=e;const[n,r]=u.useState(null),a=u.useCallback(i=>{for(const{target:l}of i)if(Ct(l)){r(d=>{const m=t(l);return d?{...d,width:m.width,height:m.height}:m});break}},[t]),c=Qt({callback:a}),h=u.useCallback(i=>{const l=Sr(i);c?.disconnect(),l&&c?.observe(l),r(l?t(l):null)},[t,c]),[f,s]=Pt(h);return u.useMemo(()=>({nodeRef:f,rect:n,setRef:s}),[n,f,s])}const Fo=[{sensor:yn,options:{}},{sensor:wr,options:{}}],_o={current:{}},It={draggable:{measure:Pn},droppable:{measure:Pn,strategy:wt.WhileDragging,frequency:un.Optimized},dragOverlay:{measure:Nt}};class vt 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 Uo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new vt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Bt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:It,measureDroppableContainers:Bt,windowRect:null,measuringScheduled:!1},Nr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Bt,draggableNodes:new Map,over:null,measureDroppableContainers:Bt},Et=u.createContext(Nr),Er=u.createContext(Uo);function $o(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vt}}}function Ko(e,t){switch(t.type){case ae.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ae.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 ae.DragEnd:case ae.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ae.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new vt(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case ae.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,c=e.droppable.containers.get(n);if(!c||r!==c.key)return e;const h=new vt(e.droppable.containers);return h.set(n,{...c,disabled:a}),{...e,droppable:{...e.droppable,containers:h}}}case ae.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const c=new vt(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function Go(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=u.useContext(Et),c=Ot(r),h=Ot(n?.id);return u.useEffect(()=>{if(!t&&!r&&c&&h!=null){if(!pn(c)||document.activeElement===c.target)return;const f=a.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=Bs(l);if(d){d.focus();break}}})}},[r,t,a,h,c]),null}function kr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,c)=>c({transform:a,...r}),n):n}function Wo(e){return u.useMemo(()=>({draggable:{...It.draggable,...e?.draggable},droppable:{...It.droppable,...e?.droppable},dragOverlay:{...It.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Qo(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const c=u.useRef(!1),{x:h,y:f}=typeof a=="boolean"?{x:a,y:a}:a;Fe(()=>{if(!h&&!f||!t){c.current=!1;return}if(c.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),c.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 Yt=u.createContext({...Ee,scaleX:1,scaleY:1});var $e;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})($e||($e={}));const Yo=u.memo(function(t){var n,r,a,c;let{id:h,accessibility:f,autoScroll:s=!0,children:i,sensors:l=Fo,collisionDetection:d=eo,measuring:m,modifiers:p,...g}=t;const x=u.useReducer(Ko,void 0,$o),[v,k]=x,[C,y]=Gs(),[R,N]=u.useState($e.Uninitialized),M=R===$e.Initialized,{draggable:{active:P,nodes:S,translate:z},droppable:{containers:_}}=v,O=P!=null?S.get(P):null,G=u.useRef({initial:null,translated:null}),B=u.useMemo(()=>{var le;return P!=null?{id:P,data:(le=O?.data)!=null?le:_o,rect:G}:null},[P,O]),V=u.useRef(null),[Q,J]=u.useState(null),[Y,H]=u.useState(null),W=xt(g,Object.values(g)),ne=Wt("DndDescribedBy",h),ge=u.useMemo(()=>_.getEnabled(),[_]),q=Wo(m),{droppableRects:Z,measureDroppableContainers:me,measuringScheduled:T}=Ro(ge,{dragging:M,dependencies:[z.x,z.y],config:q.droppable}),I=ko(S,P),U=u.useMemo(()=>Y?zt(Y):null,[Y]),w=Vt(),E=To(I,q.draggable.measure);Qo({activeNode:P!=null?S.get(P):null,config:w.layoutShiftCompensation,initialRect:E,measure:q.draggable.measure});const D=Fn(I,q.draggable.measure,E),se=Fn(I?I.parentElement:null),ve=u.useRef({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Xe=_.getNodeFor((n=ve.current.over)==null?void 0:n.id),be=Bo({measure:q.dragOverlay.measure}),Ie=(r=be.nodeRef.current)!=null?r:I,Me=M?(a=be.rect)!=null?a:D:null,it=!!(be.nodeRef.current&&be.rect),Ke=Io(it?null:D),Ge=Cr(Ie?pe(Ie):null),xe=Mo(M?Xe??I:null),qe=zo(xe),Pe=kr(p,{transform:{x:z.x-Ke.x,y:z.y-Ke.y,scaleX:1,scaleY:1},activatorEvent:Y,active:B,activeNodeRect:D,containerNodeRect:se,draggingNodeRect:Me,over:ve.current.over,overlayNodeRect:be.rect,scrollableAncestors:xe,scrollableAncestorRects:qe,windowRect:Ge}),kt=U?rt(U,z):null,Ve=Po(xe),at=Un(Ve),jt=Un(Ve,[D]),Oe=rt(Pe,at),Le=Me?ro(Me,Pe):null,ye=B&&Le?d({active:B,collisionRect:Le,droppableRects:Z,droppableContainers:ge,pointerCoordinates:kt}):null,lt=Js(ye,"id"),[we,ct]=u.useState(null),Rt=it?Pe:rt(Pe,jt),Tt=to(Rt,(c=we?.rect)!=null?c:null,D),We=u.useRef(null),At=u.useCallback((le,ce)=>{let{sensor:ue,options:ke}=ce;if(V.current==null)return;const b=S.get(V.current);if(!b)return;const j=le.nativeEvent,A=new ue({active:V.current,activeNode:b,event:j,options:ke,context:ve,onAbort(K){if(!S.get(K))return;const{onDragAbort:X}=W.current,de={id:K};X?.(de),C({type:"onDragAbort",event:de})},onPending(K,ee,X,de){if(!S.get(K))return;const{onDragPending:_e}=W.current,Re={id:K,constraint:ee,initialCoordinates:X,offset:de};_e?.(Re),C({type:"onDragPending",event:Re})},onStart(K){const ee=V.current;if(ee==null)return;const X=S.get(ee);if(!X)return;const{onDragStart:de}=W.current,je={activatorEvent:j,active:{id:ee,data:X.data,rect:G}};ht.unstable_batchedUpdates(()=>{de?.(je),N($e.Initializing),k({type:ae.DragStart,initialCoordinates:K,active:ee}),C({type:"onDragStart",event:je}),J(We.current),H(j)})},onMove(K){k({type:ae.DragMove,coordinates:K})},onEnd:L(ae.DragEnd),onCancel:L(ae.DragCancel)});We.current=A;function L(K){return async function(){const{active:X,collisions:de,over:je,scrollAdjustedTranslate:_e}=ve.current;let Re=null;if(X&&_e){const{cancelDrop:Qe}=W.current;Re={activatorEvent:j,active:X,collisions:de,delta:_e,over:je},K===ae.DragEnd&&typeof Qe=="function"&&await Promise.resolve(Qe(Re))&&(K=ae.DragCancel)}V.current=null,ht.unstable_batchedUpdates(()=>{k({type:K}),N($e.Uninitialized),ct(null),J(null),H(null),We.current=null;const Qe=K===ae.DragEnd?"onDragEnd":"onDragCancel";if(Re){const ut=W.current[Qe];ut?.(Re),C({type:Qe,event:Re})}})}}},[S]),Je=u.useCallback((le,ce)=>(ue,ke)=>{const b=ue.nativeEvent,j=S.get(ke);if(V.current!==null||!j||b.dndKit||b.defaultPrevented)return;const A={active:j};le(ue,ce.options,A)===!0&&(b.dndKit={capturedBy:ce.sensor},V.current=ke,At(ue,ce))},[S,At]),ze=jo(l,Je);Oo(l),Fe(()=>{D&&R===$e.Initializing&&N($e.Initialized)},[D,R]),u.useEffect(()=>{const{onDragMove:le}=W.current,{active:ce,activatorEvent:ue,collisions:ke,over:b}=ve.current;if(!ce||!ue)return;const j={active:ce,activatorEvent:ue,collisions:ke,delta:{x:Oe.x,y:Oe.y},over:b};ht.unstable_batchedUpdates(()=>{le?.(j),C({type:"onDragMove",event:j})})},[Oe.x,Oe.y]),u.useEffect(()=>{const{active:le,activatorEvent:ce,collisions:ue,droppableContainers:ke,scrollAdjustedTranslate:b}=ve.current;if(!le||V.current==null||!ce||!b)return;const{onDragOver:j}=W.current,A=ke.get(lt),L=A&&A.rect.current?{id:A.id,rect:A.rect.current,data:A.data,disabled:A.disabled}:null,K={active:le,activatorEvent:ce,collisions:ue,delta:{x:b.x,y:b.y},over:L};ht.unstable_batchedUpdates(()=>{ct(L),j?.(K),C({type:"onDragOver",event:K})})},[lt]),Fe(()=>{ve.current={activatorEvent:Y,active:B,activeNode:I,collisionRect:Le,collisions:ye,droppableRects:Z,draggableNodes:S,draggingNode:Ie,draggingNodeRect:Me,droppableContainers:_,over:we,scrollableAncestors:xe,scrollAdjustedTranslate:Oe},G.current={initial:Me,translated:Le}},[B,I,ye,Le,S,Ie,Me,Z,_,we,xe,Oe]),So({...w,delta:z,draggingRect:Le,pointerCoordinates:kt,scrollableAncestors:xe,scrollableAncestorRects:qe});const Xt=u.useMemo(()=>({active:B,activeNode:I,activeNodeRect:D,activatorEvent:Y,collisions:ye,containerNodeRect:se,dragOverlay:be,draggableNodes:S,droppableContainers:_,droppableRects:Z,over:we,measureDroppableContainers:me,scrollableAncestors:xe,scrollableAncestorRects:qe,measuringConfiguration:q,measuringScheduled:T,windowRect:Ge}),[B,I,D,Y,ye,se,be,S,_,Z,we,me,xe,qe,q,T,Ge]),qt=u.useMemo(()=>({activatorEvent:Y,activators:ze,active:B,activeNodeRect:D,ariaDescribedById:{draggable:ne},dispatch:k,draggableNodes:S,over:we,measureDroppableContainers:me}),[Y,ze,B,D,k,ne,S,we,me]);return F.createElement(ur.Provider,{value:y},F.createElement(Et.Provider,{value:qt},F.createElement(Er.Provider,{value:Xt},F.createElement(Yt.Provider,{value:Tt},i)),F.createElement(Go,{disabled:f?.restoreFocus===!1})),F.createElement(Ys,{...f,hiddenTextDescribedById:ne}));function Vt(){const le=Q?.autoScrollEnabled===!1,ce=typeof s=="object"?s.enabled===!1:s===!1,ue=M&&!le&&!ce;return typeof s=="object"?{...s,enabled:ue}:{enabled:ue}}}),Ho=u.createContext(null),Kn="button",Xo="Draggable";function qo(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const c=Wt(Xo),{activators:h,activatorEvent:f,active:s,activeNodeRect:i,ariaDescribedById:l,draggableNodes:d,over:m}=u.useContext(Et),{role:p=Kn,roleDescription:g="draggable",tabIndex:x=0}=a??{},v=s?.id===t,k=u.useContext(v?Yt:Ho),[C,y]=Pt(),[R,N]=Pt(),M=Lo(h,t),P=xt(n);Fe(()=>(d.set(t,{id:t,key:c,node:C,activatorNode:R,data:P}),()=>{const z=d.get(t);z&&z.key===c&&d.delete(t)}),[d,t]);const S=u.useMemo(()=>({role:p,tabIndex:x,"aria-disabled":r,"aria-pressed":v&&p===Kn?!0:void 0,"aria-roledescription":g,"aria-describedby":l.draggable}),[r,p,x,v,g,l.draggable]);return{active:s,activatorEvent:f,activeNodeRect:i,attributes:S,isDragging:v,listeners:r?void 0:M,node:C,over:m,setNodeRef:y,setActivatorNodeRef:N,transform:k}}function Vo(){return u.useContext(Er)}const Jo="Droppable",Zo={timeout:25};function ei(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const c=Wt(Jo),{active:h,dispatch:f,over:s,measureDroppableContainers:i}=u.useContext(Et),l=u.useRef({disabled:n}),d=u.useRef(!1),m=u.useRef(null),p=u.useRef(null),{disabled:g,updateMeasurementsFor:x,timeout:v}={...Zo,...a},k=xt(x??r),C=u.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{i(Array.isArray(k.current)?k.current:[k.current]),p.current=null},v)},[v]),y=Qt({callback:C,disabled:g||!h}),R=u.useCallback((S,z)=>{y&&(z&&(y.unobserve(z),d.current=!1),S&&y.observe(S))},[y]),[N,M]=Pt(R),P=xt(t);return u.useEffect(()=>{!y||!N.current||(y.disconnect(),d.current=!1,y.observe(N.current))},[N,y]),u.useEffect(()=>(f({type:ae.RegisterDroppable,element:{id:r,key:c,disabled:n,node:N,rect:m,data:P}}),()=>f({type:ae.UnregisterDroppable,key:c,id:r})),[r]),u.useEffect(()=>{n!==l.current.disabled&&(f({type:ae.SetDroppableDisabled,id:r,key:c,disabled:n}),l.current.disabled=n)},[r,c,n,f]),{active:h,rect:m,isOver:s?.id===r,node:N,over:s,setNodeRef:M}}function ti(e){let{animation:t,children:n}=e;const[r,a]=u.useState(null),[c,h]=u.useState(null),f=Ot(n);return!n&&!r&&f&&a(f),Fe(()=>{if(!c)return;const s=r?.key,i=r?.props.id;if(s==null||i==null){a(null);return}Promise.resolve(t(i,c)).then(()=>{a(null)})},[t,r,c]),F.createElement(F.Fragment,null,n,r?u.cloneElement(r,{ref:h}):null)}const ni={x:0,y:0,scaleX:1,scaleY:1};function ri(e){let{children:t}=e;return F.createElement(Et.Provider,{value:Nr},F.createElement(Yt.Provider,{value:ni},t))}const si={position:"fixed",touchAction:"none"},oi=e=>pn(e)?"transform 250ms ease":void 0,ii=u.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:c,className:h,rect:f,style:s,transform:i,transition:l=oi}=e;if(!f)return null;const d=a?i:{...i,scaleX:1,scaleY:1},m={...si,width:f.width,height:f.height,top:f.top,left:f.left,transform:yt.Transform.toString(d),transformOrigin:a&&r?qs(r,f):void 0,transition:typeof l=="function"?l(r):l,...s};return F.createElement(n,{className:h,style:m,ref:t},c)}),ai=e=>t=>{let{active:n,dragOverlay:r}=t;const a={},{styles:c,className:h}=e;if(c!=null&&c.active)for(const[f,s]of Object.entries(c.active))s!==void 0&&(a[f]=n.node.style.getPropertyValue(f),n.node.style.setProperty(f,s));if(c!=null&&c.dragOverlay)for(const[f,s]of Object.entries(c.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(a))n.node.style.setProperty(s,i);h!=null&&h.active&&n.node.classList.remove(h.active)}},li=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:yt.Transform.toString(t)},{transform:yt.Transform.toString(n)}]},ci={duration:250,easing:"ease",keyframes:li,sideEffects:ai({styles:{active:{opacity:"0"}}})};function ui(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:a}=e;return Gt((c,h)=>{if(t===null)return;const f=n.get(c);if(!f)return;const s=f.node.current;if(!s)return;const i=Sr(h);if(!i)return;const{transform:l}=pe(h).getComputedStyle(h),d=fr(l);if(!d)return;const m=typeof t=="function"?t:di(t);return xr(s,a.draggable.measure),m({active:{id:c,data:f.data,node:s,rect:a.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:h,rect:a.dragOverlay.measure(i)},droppableContainers:r,measuringConfiguration:a,transform:d})})}function di(e){const{duration:t,easing:n,sideEffects:r,keyframes:a}={...ci,...e};return c=>{let{active:h,dragOverlay:f,transform:s,...i}=c;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=a({...i,active:h,dragOverlay:f,transform:{initial:s,final:m}}),[g]=p,x=p[p.length-1];if(JSON.stringify(g)===JSON.stringify(x))return;const v=r?.({active:h,dragOverlay:f,...i}),k=f.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(C=>{k.onfinish=()=>{v?.(),C()}})}}let Gn=0;function fi(e){return u.useMemo(()=>{if(e!=null)return Gn++,Gn},[e])}const hi=F.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:a,transition:c,modifiers:h,wrapperElement:f="div",className:s,zIndex:i=999}=e;const{activatorEvent:l,active:d,activeNodeRect:m,containerNodeRect:p,draggableNodes:g,droppableContainers:x,dragOverlay:v,over:k,measuringConfiguration:C,scrollableAncestors:y,scrollableAncestorRects:R,windowRect:N}=Vo(),M=u.useContext(Yt),P=fi(d?.id),S=kr(h,{activatorEvent:l,active:d,activeNodeRect:m,containerNodeRect:p,draggingNodeRect:v.rect,over:k,overlayNodeRect:v.rect,scrollableAncestors:y,scrollableAncestorRects:R,transform:M,windowRect:N}),z=wn(m),_=ui({config:r,draggableNodes:g,droppableContainers:x,measuringConfiguration:C}),O=z?v.setRef:void 0;return F.createElement(ri,null,F.createElement(ti,{animation:_},d&&P?F.createElement(ii,{key:P,id:d.id,ref:O,as:f,activatorEvent:l,adjustScale:t,className:s,transition:c,rect:z,style:{zIndex:i,...a},transform:S},n):null))}),jr=768;function mi(e){const t=window.matchMedia(`(max-width: ${jr-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function gi(){return window.innerWidth<jr}function pi(){return!1}function Rr(){return u.useSyncExternalStore(mi,gi,pi)}function Ht(e){switch(e){case Ae.TODO:return re.Pending;case Ae.IN_PROGRESS:return re.Running;case Ae.IN_REVIEW:return re.Review;case Ae.DONE:return re.Done;case Ae.CANCELLED:return re.Cancelled}}function vi(e){switch(e){case re.Pending:return Ae.TODO;case re.Running:return Ae.IN_PROGRESS;case re.Review:return Ae.IN_REVIEW;case re.Done:return Ae.DONE;case re.Cancelled:return Ae.CANCELLED}}function Tr(e){switch(e){case Se.CLAUDE_CODE:return"Claude Code";case Se.GEMINI_CLI:return"Gemini CLI";case Se.CURSOR_AGENT:return"Cursor Agent";case Se.CODEX:return"Codex";case Se.QWEN_CODE:return"Qwen Code";case Se.KIRO_CLI:return"Kiro CLI";case Se.OPENCODE:return"OpenCode";case Se.PI_CODING_AGENT:return"Pi Coding Agent";case Se.GROK_BUILD:return"Grok Build";case Se.MINION_CODE:return"Minion Code";case Se.DEEPSEEK_HERMES:return"DeepSeek Harness"}}const _t=["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 bi(e,t){return e?.find(n=>n.status==="ACTIVE")??e?.[0]}function xi(e){return e?e.workspaceKind===Ye.MAIN_DIRECTORY?"Project directory":e.branchName:"—"}function yi(e){return{id:e.id,name:e.name,color:e.color||_t[Ar(e.name,_t.length)],isGitRepo:e.isGitRepo,worktreeReady:e.worktreeReady,reason:e.reason,archivedAt:e.archivedAt??null,repoDeletedAt:e.repoDeletedAt??null}}function wi(e){const t=bi(e);if(!t)return{agent:"—",branch:"—"};const n=xi(t),r=t.sessions;if(r&&r.length>0){const a=r[r.length-1];return{agent:Tr(a.agentType),branch:n}}return{agent:"—",branch:n}}function Ci(e){const{agent:t,branch:n}=wi(e.workspaces),r=e.project;return{id:e.id,parentTaskId:e.parentTaskId,subtaskCount:e.subtaskCount,projectId:e.projectId,title:e.titlePreview??e.title,status:Ht(e.status),priority:e.priority,agent:t,branch:n,description:e.contentPreview??e.description??"",updatedAt:e.updatedAt,isGitRepo:r?.isGitRepo,worktreeReady:r?.worktreeReady,reason:r?.reason,projectArchivedAt:r?.archivedAt??null,projectRepoDeletedAt:r?.repoDeletedAt??null}}function Dr(e,t){const n=e.preferredWorkspace?e.preferredWorkspace.workspaceKind===Ye.MAIN_DIRECTORY?"Project directory":e.preferredWorkspace.branchName:"—";return{id:e.id,parentTaskId:e.parentTaskId,subtaskCount:e.subtaskCount,runningSubtaskCount:e.runningSubtaskCount,projectId:e.projectId,title:e.title,status:Ht(e.status),priority:e.priority,agent:e.latestAgentType?Tr(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 Si(e,t){const n=e.preferredWorkspace?e.preferredWorkspace.workspaceKind===Ye.MAIN_DIRECTORY?"Project directory":e.preferredWorkspace.branchName:"—";return{id:e.id,parentTaskId:e.parentTaskId,subtaskCount:e.subtaskCount,projectId:t.id,projectName:t.name,projectColor:t.color||_t[Ar(t.name,_t.length)],title:e.title,status:Ht(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}}const Ir=u.createContext(null);function Ni(e,t){const n=[];if(!e||e.length===0)return n;const r=e.some(c=>c.status==="ACTIVE");return e.some(c=>c.sessions?.some(h=>h.status===Sn.RUNNING||h.status===Sn.PENDING))&&n.push(t("正在运行的 Agent 将被停止")),r&&(n.push(t("分支上未合并的变更将丢失")),n.push(t("关联的工作目录(worktree)将被清理"))),n}function Ei({isOpen:e,onClose:t,onConfirm:n,taskId:r,taskTitle:a,workspaces:c,isLoading:h}){const{t:f}=De(),{data:s,isLoading:i}=fs(c===void 0&&e?r:""),l=nr(r,e),d=l.data?.pages[0]?.total??0,m=c??s,p=c===void 0&&e&&i,g=u.useMemo(()=>Ni(m,f),[m,f]);return o.jsx(ds,{isOpen:e,onClose:t,onConfirm:()=>n(d),title:f("删除任务"),description:o.jsxs(o.Fragment,{children:[o.jsx("p",{children:d>0?f("Delete “{title}” and its {count} subtasks? This cannot be undone.",{title:a,count:d}):f("确认删除任务「{title}」?此操作不可撤销。",{title:a})}),d>0&&o.jsx("p",{className:"mt-2 text-warning-ink",children:f("All related Agents and services will stop. Their worktrees and owned branches will be deleted.")}),l.isError&&o.jsx(Ne,{variant:"ghost",size:"sm",onClick:()=>l.refetch(),children:f("Could not load subtasks. Retry")}),l.isFetching&&o.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f("Loading...")}),p?o.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f("加载中...")}):g.length>0?o.jsx("ul",{className:"mt-2 space-y-1",children:g.map((x,v)=>o.jsxs("li",{className:"flex items-start gap-1.5 text-warning-ink",children:[o.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-warning"}),o.jsx("span",{children:x})]},v))}):null]}),confirmText:d>0?f("Delete all"):f("删除"),variant:"danger",isLoading:h,confirmDisabled:p||l.isFetching||l.isError||!l.data})}const ki=3e4;function ji(e=ki){const[,t]=u.useState(0);u.useEffect(()=>{const n=setInterval(()=>t(r=>r+1),e);return()=>clearInterval(n)},[e])}function Ri(e){const t=Jr(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 et="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",Wn="px-2 pb-1 pt-1.5 text-xs font-medium text-muted-foreground",sn=o.jsx("div",{className:"-mx-1 my-1 h-px bg-border/60"});function Mr({task:e,status:t,isSelected:n,project:r,showProject:a,onSelectTask:c,onTaskStatusChange:h,onDeleteTask:f,onTaskPriorityChange:s,disableDrag:i,onCreateSubtask:l,selectedTaskId:d,expandForSelection:m,selectedChildTask:p}){const{t:g,locale:x}=De(),[v,k]=u.useState({open:!1}),C=v.open||!!(m&&v.selection!==d),y=nr(e.id,C&&!e.parentTaskId),R=y.data?.pages[0]?.total??e.subtaskCount??0,N=y.data?.pages.flatMap(w=>w.data).map(w=>Dr(w))??[];p?.parentTaskId===e.id&&!N.some(w=>w.id===p.id)&&N.push(p);const M=u.useContext(Ir),P=u.useRef(null),S=!!e.projectArchivedAt,z=S||!!i,{attributes:_,listeners:O,setNodeRef:G,isDragging:B}=qo({id:e.id,data:{task:e,fromStatus:t},disabled:z}),V=u.useCallback(w=>{P.current=w,G(w),M&&(w?M.registry.set(e.id,w):M.registry.delete(e.id))},[G,M,e.id]);u.useEffect(()=>()=>{M?.registry.delete(e.id)},[e.id,M]);const[Q,J]=u.useState(null),[Y,H]=u.useState(!1),W=u.useRef(null),ne=u.useRef(null),ge=u.useCallback(w=>{S||!h&&!f&&!s&&!l||(w.preventDefault(),J({x:w.clientX,y:w.clientY}))},[S,h,f,s,l,J]),q=u.useCallback(()=>{ne.current&&(clearTimeout(ne.current),ne.current=null)},[]),Z=u.useCallback(w=>{if(!i||S||!h&&!f&&!l)return;const E=w.touches[0];if(!E)return;const{clientX:D,clientY:se}=E;ne.current=setTimeout(()=>{ne.current=null,J({x:D,y:se})},500)},[i,S,h,f,l,J]);u.useEffect(()=>{if(!Q)return;const w=()=>J(null),E=se=>{W.current&&!W.current.contains(se.target)&&w()},D=se=>{se.key==="Escape"&&w()};return document.addEventListener("mousedown",E),document.addEventListener("touchstart",E),document.addEventListener("keydown",D),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("touchstart",E),document.removeEventListener("keydown",D),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[Q]),u.useLayoutEffect(()=>{const w=W.current;if(!Q||!w)return;const E=8;w.style.left=`${Math.max(E,Math.min(Q.x,window.innerWidth-w.offsetWidth-E))}px`,w.style.top=`${Math.max(E,Math.min(Q.y,window.innerHeight-w.offsetHeight-E))}px`},[Q]);const me=r?r.name:void 0,T=a?r:void 0,I=e.updatedAt?gs(e.updatedAt,g,x):null,{titleClass:U}=nt[t];return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[o.jsxs("button",{ref:V,type:"button",onClick:()=>c(e.id),onContextMenu:ge,onTouchStart:Z,onTouchEnd:q,onTouchMove:q,title:T?`${e.title} · ${T.name}`:e.title,"aria-label":me?`${e.title} — ${me}`:e.title,"aria-current":n||void 0,"data-sidebar-item":"",className:ie("task-row animate-task-enter",mt(n),"min-w-0 flex-1",B&&"opacity-30"),...z?{}:O,...z?{}:_,children:[e.parentTaskId&&(()=>{const{icon:w,accentClass:E,label:D}=nt[t];return o.jsx("span",{className:"shrink-0",title:g(D),"aria-label":g(D),children:o.jsx(w,{className:ie("size-3.5",E)})})})(),t===re.Running?o.jsx(kn,{text:e.title,variant:"running",animate:!n,className:ie("min-w-0 flex-1 truncate",U)}):o.jsx("span",{className:ie("min-w-0 flex-1 truncate",U),children:e.title}),e.priority!==void 0&&e.priority!==Mt.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-xs font-medium leading-none text-muted-foreground",children:e.projectRepoDeletedAt?g("源码已删除"):g("已删除")}),(I||T)&&o.jsx("span",{className:"task-row-meta",children:o.jsxs("span",{className:"flex items-center gap-1",children:[T&&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(kn,{text:Ri(T.name),variant:"project",className:T.color})}),I&&o.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:I})]})})]}),!e.parentTaskId&&R>0&&o.jsxs("button",{type:"button","data-sidebar-item":"","aria-expanded":C,"aria-label":g("Subtasks of {title}",{title:e.title}),title:g("{count} subtasks, {running} running",{count:R,running:e.runningSubtaskCount??0}),onClick:()=>k({selection:d,open:!C}),className:"flex h-8 shrink-0 items-center gap-1 rounded-md px-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 pointer-coarse:h-10",children:[o.jsx(Is,{size:14}),o.jsx("span",{className:"tabular-nums",children:R}),o.jsx(rr,{size:12,className:ie("transition-transform",C&&"rotate-90")})]})]}),!e.parentTaskId&&C&&o.jsxs("div",{className:"ml-4 border-l border-border/60 pl-1",role:"group","aria-label":g("Subtasks of {title}",{title:e.title}),children:[y.isLoading&&o.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:g("Loading...")}),y.isError&&o.jsx("button",{type:"button",className:et,onClick:()=>y.refetch(),children:g("Could not load subtasks. Retry")}),N.map(w=>o.jsx(Mr,{task:{...w,projectArchivedAt:e.projectArchivedAt},status:w.status,isSelected:d===w.id,project:r,showProject:!1,onSelectTask:c,onTaskStatusChange:h,onDeleteTask:f,onTaskPriorityChange:s,disableDrag:i},w.id)),y.hasNextPage&&o.jsx("button",{type:"button",className:et,disabled:y.isFetchingNextPage,onClick:()=>y.fetchNextPage(),children:g("Load more")})]}),Q&&o.jsxs("div",{ref:W,role:"menu",className:"fixed z-[100] w-48 rounded-lg border border-border bg-popover p-1 shadow-popover shadow-black/5 animate-in fade-in zoom-in-95 duration-100",children:[l&&!e.parentTaskId&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",role:"menuitem",className:et,onClick:()=>{l(e.id),J(null)},children:[o.jsx(ir,{className:"size-3.5 shrink-0"}),o.jsx("span",{children:g("Create subtask")})]}),sn]}),h&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Wn,children:g("Move to")}),qr.filter(w=>w!==t).map(w=>{const{icon:E,label:D,accentClass:se}=nt[w];return o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(e.id,w),J(null)},className:et,children:[o.jsx(E,{className:ie("size-3.5 shrink-0",se)}),o.jsx("span",{children:g(D)})]},w)})]}),s&&o.jsxs(o.Fragment,{children:[h&&sn,o.jsx("div",{className:Wn,children:g("Priority")}),Vr.map(w=>{const E=(e.priority??Mt.NORMAL)===w.value;return o.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":E,onClick:()=>{s(e.id,w.value),J(null)},className:et,children:[o.jsx(jn,{priority:w.value}),o.jsx("span",{className:"flex-1",children:g(w.label)}),E&&o.jsx(bt,{className:"size-3.5 shrink-0 text-foreground","aria-hidden":!0})]},w.value)})]}),f&&o.jsxs(o.Fragment,{children:[(h||s)&&sn,o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{H(!0),J(null)},className:ie(et,"text-destructive-ink hover:bg-destructive/10 hover:text-destructive-ink focus-visible:bg-destructive/10"),children:[o.jsx(bs,{className:"size-3.5 shrink-0","aria-hidden":!0}),o.jsx("span",{children:g("Delete Task")})]})]})]}),o.jsx(Ei,{isOpen:Y,onClose:()=>H(!1),onConfirm:w=>{f?.(e.id,w),H(!1)},taskId:e.id,taskTitle:e.title})]})}const Ti=u.memo(function({title:t,tasks:n,status:r,defaultOpen:a,selectedTaskId:c,selectedParentTaskId:h,selectedChildTask:f,onCreateSubtask:s,onSelectTask:i,projects:l,showProject:d=!0,isDragging:m,dragFromStatus:p,onTaskStatusChange:g,onDeleteTask:x,onTaskPriorityChange:v,disableDrag:k}){const{t:C}=De(),[y,R]=u.useState({selection:null,open:a}),N=y.open||!!(c&&y.selection!==c&&n.some(H=>H.id===c||H.id===h));ji();const M=n.length===0,P=m&&p===r,S=m&&p!==r,{setNodeRef:z,isOver:_}=ei({id:`group-${r}`,data:{status:r}}),O=r===re.Review,G=C(t),{icon:B,accentClass:V}=nt[r],Q=u.useId(),J=m?P:N,Y=J&&!S&&!M;return o.jsxs("div",{className:Y?"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:()=>!m&&R({selection:c,open:!N}),"aria-expanded":N,"data-sidebar-item":"",className:"group/header flex h-8 w-full items-center gap-1 rounded-md px-2 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 pointer-coarse:h-10 pointer-coarse:text-[15px]",children:[o.jsx(B,{className:ie("mr-1.5 size-4 shrink-0 -translate-y-px",V)}),o.jsx("span",{id:Q,className:"truncate",children:G}),o.jsx(rr,{size:14,"aria-hidden":!0,className:ie("shrink-0 text-muted-foreground transition-transform duration-150 group-hover/header:text-muted-foreground",J&&"rotate-90")}),O&&!M?o.jsx("span",{className:"ml-auto rounded-full bg-warning/15 px-1.5 text-xs font-semibold leading-5 tabular-nums text-warning-ink",children:n.length}):o.jsx("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground",children:n.length})]})}),S&&o.jsx("div",{ref:z,className:ie("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",_?"border-foreground/30 bg-foreground/[0.04] text-foreground/80":"border-border bg-foreground/[0.02] text-muted-foreground"),children:_?C("Drop into {title}",{title:G}):C("Drop here")}),Y&&o.jsx("div",{ref:P?void 0:z,role:"group","aria-labelledby":Q,className:"mt-0.5 flex flex-col gap-px px-2",children:n.map(H=>{const W=c===H.id,ne=H.projectId?l.find(ge=>ge.id===H.projectId):void 0;return o.jsx(Mr,{selectedTaskId:c,selectedChildTask:f,expandForSelection:h===H.id,onCreateSubtask:H.projectArchivedAt?void 0:s,task:H,status:r,isSelected:W,project:ne,showProject:d,onSelectTask:i,onTaskStatusChange:H.projectArchivedAt?void 0:g,onDeleteTask:H.projectArchivedAt?void 0:x,onTaskPriorityChange:H.projectArchivedAt?void 0:v,disableDrag:k},H.id)})})]})}),Ai=12,Di=50;function Ii({isOpen:e,onClose:t,tasks:n,projects:r,onSelectTask:a}){const{t:c}=De(),[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(x=>x.title.toLowerCase().includes(g)).slice(0,Di):n.slice(0,Ai)},[n,h]);u.useEffect(()=>{i(0)},[h]),u.useEffect(()=>{l.current?.children[s]?.scrollIntoView({block:"nearest"})},[s]);const m=u.useCallback(g=>{a(g),t()},[a,t]),p=u.useCallback(g=>{if(g.key==="Escape")g.preventDefault(),t();else if(g.key==="ArrowDown")g.preventDefault(),i(x=>Math.min(x+1,d.length-1));else if(g.key==="ArrowUp")g.preventDefault(),i(x=>Math.max(x-1,0));else if(g.key==="Enter"&&!g.nativeEvent.isComposing){g.preventDefault();const x=d[s];x&&m(x.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-popover 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:c("Search tasks..."),"aria-label":c("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-xs font-medium text-muted-foreground",children:c("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,x)=>{const v=r.find(y=>y.id===g.projectId),{icon:k,iconClass:C}=nt[g.status];return o.jsxs("button",{onClick:()=>m(g.id),onMouseEnter:()=>i(x),className:`w-full flex items-center gap-2.5 px-4 py-2 text-left transition-colors
7
+ ${x===s?"bg-accent":""}`,children:[o.jsx(k,{className:`${C} size-4 shrink-0`}),o.jsxs("span",{className:"flex-1 min-w-0 truncate text-sm text-foreground/90",title:g.title,children:[g.title,g.parentTaskId&&o.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c("Parent task: {title}",{title:n.find(y=>y.id===g.parentTaskId)?.title??"…"})})]}),v&&o.jsx("span",{className:"shrink-0 max-w-[120px] truncate text-xs text-muted-foreground",children:v.name})]},g.id)})})]}):o.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:c("No matching tasks")})]})]}):null}const Mi=260,Pi=220;function Oi(e){const t={[re.Review]:[],[re.Running]:[],[re.Pending]:[],[re.Done]:[],[re.Cancelled]:[]};for(const n of e)t[n.status].push(n);return t[re.Review].sort((n,r)=>(r.priority??Mt.NORMAL)-(n.priority??Mt.NORMAL)),t}const Li=[{status:re.Review,title:"Review",defaultOpen:!0},{status:re.Running,title:"Running",defaultOpen:!0},{status:re.Pending,title:"Pending",defaultOpen:!1},{status:re.Done,title:"Done",defaultOpen:!1},{status:re.Cancelled,title:"Cancelled",defaultOpen:!1}];function zi(){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-8 items-center gap-2.5 px-2 pointer-coarse:h-10",children:[o.jsx("div",{className:"size-4 shrink-0 rounded-full bg-foreground/[0.06]"}),o.jsx("div",{className:"h-3 w-14 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 Qn({tasks:e=[],projects:t=[],selectedTaskId:n,selectedParentTaskId:r,onCreateSubtask:a,onSelectTask:c,filterProjectId:h,setFilterProjectId:f,width:s=320,onCreateTask:i,onCreateProject:l,isCreateActive:d,onTaskStatusChange:m,onDeleteTask:p,onTaskPriorityChange:g,isLoading:x=!1}){const{t:v}=De(),{preserveDesktopSearch:k}=sr(),C=Rr(),[y,R]=u.useState(null),[N,M]=u.useState(null),[P,S]=u.useState(!1),z=u.useRef(new Set),_=u.useRef(new Map),[O]=u.useState(()=>({registry:new Map})),G=u.useCallback(T=>{T.remove(),z.current.delete(T)},[]),B=h?e.filter(T=>T.projectId===h):e,V=u.useCallback((T,I)=>{const U=document.querySelector(`[data-task-group-status="${T}"]`);if(!U)return null;const E=(U.querySelector("button")??U).getBoundingClientRect();return E.width===0||E.height===0?null:new DOMRect(E.left,E.bottom+2,I.width,I.height)},[]),Q=u.useCallback((T,I,U,w=!1)=>{const E=document.createElement("div");E.setAttribute("aria-hidden","true"),E.innerHTML=U,E.querySelectorAll("[data-gradient-ready]").forEach(be=>be.removeAttribute("data-gradient-ready")),E.querySelectorAll(".task-gradient-text__canvas").forEach(be=>be.remove());const D=E.firstElementChild;D&&(D.style.cssText="",D.className=D.className.replace(/\bopacity-\S*/g,"").replace(/\banimate-task-enter\b/g,""),D.style.pointerEvents="none",D.style.width=`${T.width}px`,D.style.height=`${T.height}px`,D.style.margin="0",D.style.backgroundColor="var(--background)",D.style.borderRadius="0.5rem",D.style.boxShadow="var(--shadow-popover), 0 0 0 1px var(--border)",D.style.opacity="0.96",D.style.transition="none",D.setAttribute("tabindex","-1")),Object.assign(E.style,{position:"fixed",left:`${T.left}px`,top:`${T.top}px`,width:`${T.width}px`,height:`${T.height}px`,zIndex:"9999",pointerEvents:"none",overflow:"visible",transformOrigin:"top left",willChange:"transform, opacity"}),document.body.appendChild(E),z.current.add(E);const se=I.left-T.left,ve=I.top-T.top;E.animate([{transform:"translate(0, 0)",opacity:.96,offset:0},{transform:`translate(${se}px, ${ve}px)`,opacity:w?.12:.96,offset:1}],{duration:w?Pi:Mi,easing:"cubic-bezier(0.2, 0, 0, 1)",fill:"forwards"}).finished.then(()=>G(E),()=>G(E))},[G]);u.useLayoutEffect(()=>{const T=window.matchMedia("(prefers-reduced-motion: reduce)").matches,I=new Map;for(const U of B){const w=O.registry.get(U.id);if(!w)continue;const E={status:U.status,rect:w.getBoundingClientRect(),html:w.outerHTML};if(I.set(U.id,E),T)continue;const D=_.current.get(U.id);if(!D||D.status===U.status)continue;const se=E.rect.left-D.rect.left,ve=E.rect.top-D.rect.top;Math.abs(se)<1&&Math.abs(ve)<1||Q(D.rect,E.rect,D.html)}if(!T)for(const[U,w]of _.current){if(I.has(U))continue;const E=B.find(se=>se.id===U);if(!E||E.status===w.status)continue;const D=V(E.status,w.rect);D&&Q(w.rect,D,w.html,!0)}_.current=I},[B,Q,V,O]),u.useEffect(()=>()=>{for(const T of z.current)T.remove();z.current.clear()},[]);const J=Xs(Hs(yn,{activationConstraint:{distance:8}})),Y=u.useCallback(T=>{const I=T.active.data.current?.task,U=T.active.data.current?.fromStatus;I&&R(I),U&&M(U)},[]),H=u.useCallback(T=>{R(null),M(null);const{active:I,over:U}=T;if(!U)return;const w=I.data.current?.task,E=I.data.current?.fromStatus,D=U.data.current?.status;!w||!E||!D||w.projectArchivedAt||E!==D&&m?.(w.id,D)},[m]),ge=!!!(h?t.find(T=>T.id===h)??null:null)?.archivedAt,q=Oi(B.filter(T=>!T.parentTaskId)),Z=y?nt[y.status]:null,me=u.useCallback(T=>{if(T.key!=="ArrowDown"&&T.key!=="ArrowUp"||T.altKey||T.ctrlKey||T.metaKey||T.shiftKey)return;const I=Array.from(T.currentTarget.querySelectorAll("[data-sidebar-item]:not(:disabled)")),U=I.indexOf(T.target);U!==-1&&(T.preventDefault(),I[U+(T.key==="ArrowDown"?1:-1)]?.focus())},[]);return o.jsxs("div",{className:"@container h-full flex flex-col flex-shrink-0",style:{width:s},onKeyDown:me,children:[o.jsxs("div",{className:"px-2 pt-2 pb-1 flex flex-col gap-px flex-shrink-0",children:[l&&o.jsxs("button",{type:"button",onClick:l,"data-sidebar-item":"",className:mt(!1),children:[o.jsx(xs,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:v("New Project")})]}),o.jsxs("button",{type:"button",onClick:i,disabled:!ge,"aria-current":d||void 0,"data-sidebar-item":"",className:ie(mt(!!d),"disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent"),title:ge?void 0:v("Deleted projects are read-only"),children:[o.jsx(ys,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:v("New Task")})]}),o.jsxs("button",{type:"button",onClick:()=>S(!0),"data-sidebar-item":"",className:mt(!1),children:[o.jsx(ar,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:v("Search")})]}),o.jsxs(Zr,{to:k("/conversations"),"data-sidebar-item":"",className:mt(!1),children:[o.jsx(ws,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:v("对话")})]})]}),x?o.jsx(zi,{}):B.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(an,{size:36,"aria-hidden":"true",className:"text-muted-foreground/50 mb-3",strokeWidth:1.5}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:v("No tasks")}),ge&&i?o.jsx("button",{type:"button",onClick:i,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:v("New Task")}):null]}):o.jsx(Ir.Provider,{value:O,children:o.jsxs(Yo,{sensors:J,onDragStart:Y,onDragEnd:H,children:[o.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin scroll-pt-8 pointer-coarse:scroll-pt-10 relative",children:o.jsx("div",{className:"pt-3 pb-4",children:Li.map(({status:T,title:I,defaultOpen:U})=>o.jsx(Ti,{title:I,tasks:q[T],status:T,defaultOpen:U,selectedTaskId:n,selectedChildTask:e.find(w=>w.id===n&&w.parentTaskId),selectedParentTaskId:r??e.find(w=>w.id===n)?.parentTaskId,onCreateSubtask:a,onSelectTask:c,projects:t,showProject:!h,isDragging:y!==null,dragFromStatus:N,onTaskStatusChange:m,onDeleteTask:p,onTaskPriorityChange:g,disableDrag:C},T))})}),o.jsx(hi,{dropAnimation:null,children:y&&Z?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-overlay ring-1 ring-border/80",children:[o.jsx(Z.icon,{className:ie("size-4 shrink-0",Z.iconClass)}),o.jsx("span",{className:"truncate",title:y.title,children:y.title})]}):null})]})}),!x&&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:v("{count} tasks",{count:B.length})}),h?o.jsx("button",{type:"button",onClick:()=>f(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:v("Clear filter")}):null]}),o.jsx(Ii,{isOpen:P,onClose:()=>S(!1),tasks:B,projects:t,onSelectTask:c})]})}var Bi=Object.defineProperty,Ut=Object.getOwnPropertySymbols,Pr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,Yn=(e,t,n)=>t in e?Bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dn=(e,t)=>{for(var n in t||(t={}))Pr.call(t,n)&&Yn(e,n,t[n]);if(Ut)for(var n of Ut(t))Or.call(t,n)&&Yn(e,n,t[n]);return e},fn=(e,t)=>{var n={};for(var r in e)Pr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ut)for(var r of Ut(e))t.indexOf(r)<0&&Or.call(e,r)&&(n[r]=e[r]);return n};var He;(e=>{const t=class ${constructor(s,i,l,d){if(this.version=s,this.errorCorrectionLevel=i,this.modules=[],this.isFunction=[],s<$.MIN_VERSION||s>$.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 x=0;x<8;x++){this.applyMask(x),this.drawFormatBits(x);const v=this.getPenaltyScore();v<g&&(d=x,g=v),this.applyMask(x)}}a(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 $.encodeSegments(l,i)}static encodeBinary(s,i){const l=e.QrSegment.makeBytes(s);return $.encodeSegments([l],i)}static encodeSegments(s,i,l=1,d=40,m=-1,p=!0){if(!($.MIN_VERSION<=l&&l<=d&&d<=$.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let g,x;for(g=l;;g++){const y=$.getNumDataCodewords(g,i)*8,R=h.getTotalBits(s,g);if(R<=y){x=R;break}if(g>=d)throw new RangeError("Data too long")}for(const y of[$.Ecc.MEDIUM,$.Ecc.QUARTILE,$.Ecc.HIGH])p&&x<=$.getNumDataCodewords(g,y)*8&&(i=y);let v=[];for(const y of s){n(y.mode.modeBits,4,v),n(y.numChars,y.mode.numCharCountBits(g),v);for(const R of y.getData())v.push(R)}a(v.length==x);const k=$.getNumDataCodewords(g,i)*8;a(v.length<=k),n(0,Math.min(4,k-v.length),v),n(0,(8-v.length%8)%8,v),a(v.length%8==0);for(let y=236;v.length<k;y^=253)n(y,8,v);let C=[];for(;C.length*8<v.length;)C.push(0);return v.forEach((y,R)=>C[R>>>3]|=y<<7-(R&7)),new $(g,i,C,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;a(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;a(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!=$.getNumDataCodewords(i,l))throw new RangeError("Invalid argument");const d=$.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i],m=$.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i],p=Math.floor($.getNumRawDataModules(i)/8),g=d-p%d,x=Math.floor(p/d);let v=[];const k=$.reedSolomonComputeDivisor(m);for(let y=0,R=0;y<d;y++){let N=s.slice(R,R+x-m+(y<g?0:1));R+=N.length;const M=$.reedSolomonComputeRemainder(N,k);y<g&&N.push(0),v.push(N.concat(M))}let C=[];for(let y=0;y<v[0].length;y++)v.forEach((R,N)=>{(y!=x-m||N>=g)&&C.push(R[y])});return a(C.length==p),C}drawCodewords(s){if(s.length!=Math.floor($.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,x=(l+1&2)==0?this.size-1-d:d;!this.isFunction[x][p]&&i<s.length*8&&(this.modules[x][p]=r(s[i>>>3],7-(i&7)),i++)}}a(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,x=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[m][v]==p?(g++,g==5?s+=$.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,x),p||(s+=this.finderPenaltyCountPatterns(x)*$.PENALTY_N3),p=this.modules[m][v],g=1);s+=this.finderPenaltyTerminateAndCount(p,g,x)*$.PENALTY_N3}for(let m=0;m<this.size;m++){let p=!1,g=0,x=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[v][m]==p?(g++,g==5?s+=$.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,x),p||(s+=this.finderPenaltyCountPatterns(x)*$.PENALTY_N3),p=this.modules[v][m],g=1);s+=this.finderPenaltyTerminateAndCount(p,g,x)*$.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+=$.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 a(0<=d&&d<=9),s+=d*$.PENALTY_N4,a(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<$.MIN_VERSION||s>$.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 a(208<=i&&i<=29648),i}static getNumDataCodewords(s,i){return Math.floor($.getNumRawDataModules(s)/8)-$.ECC_CODEWORDS_PER_BLOCK[i.ordinal][s]*$.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]=$.reedSolomonMultiply(i[m],l),m+1<i.length&&(i[m]^=i[m+1]);l=$.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]^=$.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 a(l>>>8==0),l}finderPenaltyCountPatterns(s){const i=s[1];a(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 a(f){if(!f)throw new Error("Assertion error")}const c=class oe{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 oe(oe.Mode.BYTE,s.length,i)}static makeNumeric(s){if(!oe.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 oe(oe.Mode.NUMERIC,s.length,i)}static makeAlphanumeric(s){if(!oe.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=oe.ALPHANUMERIC_CHARSET.indexOf(s.charAt(l))*45;d+=oe.ALPHANUMERIC_CHARSET.indexOf(s.charAt(l+1)),n(d,11,i)}return l<s.length&&n(oe.ALPHANUMERIC_CHARSET.indexOf(s.charAt(l)),6,i),new oe(oe.Mode.ALPHANUMERIC,s.length,i)}static makeSegments(s){return s==""?[]:oe.isNumeric(s)?[oe.makeNumeric(s)]:oe.isAlphanumeric(s)?[oe.makeAlphanumeric(s)]:[oe.makeBytes(oe.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 oe(oe.Mode.ECI,0,i)}static isNumeric(s){return oe.NUMERIC_REGEX.test(s)}static isAlphanumeric(s){return oe.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}};c.NUMERIC_REGEX=/^[0-9]*$/,c.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,c.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let h=c;e.QrSegment=c})(He||(He={}));(e=>{(t=>{const n=class{constructor(a,c){this.ordinal=a,this.formatBits=c}};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={}))})(He||(He={}));(e=>{(t=>{const n=class{constructor(a,c){this.modeBits=a,this.numBitsCharCount=c}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+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={}))})(He||(He={}));var tt=He;var Fi={L:tt.QrCode.Ecc.LOW,M:tt.QrCode.Ecc.MEDIUM,Q:tt.QrCode.Ecc.QUARTILE,H:tt.QrCode.Ecc.HIGH},Lr=128,zr="L",Br="#FFFFFF",Fr="#000000",_r=!1,Ur=1,_i=4,Ui=0,$i=.1;function $r(e,t=0){const n=[];return e.forEach(function(r,a){let c=null;r.forEach(function(h,f){if(!h&&c!==null){n.push(`M${c+t} ${a+t}h${f-c}v1H${c+t}z`),c=null;return}if(f===r.length-1){if(!h)return;c===null?n.push(`M${f+t},${a+t} h1v1H${f+t}z`):n.push(`M${c+t},${a+t} h${f+1-c}v1H${c+t}z`);return}h&&c===null&&(c=f)})}),n.join("")}function Kr(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((a,c)=>c<t.x||c>=t.x+t.w?a:!1))}function Ki(e,t,n,r){if(r==null)return null;const a=e.length+n*2,c=Math.floor(t*$i),h=a/t,f=(r.width||c)*h,s=(r.height||c)*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),x=Math.floor(l),v=Math.ceil(f+i-g),k=Math.ceil(s+l-x);m={x:g,y:x,w:v,h:k}}const p=r.crossOrigin;return{x:i,y:l,h:s,w:f,excavation:m,opacity:d,crossOrigin:p}}function Gi(e,t){return t!=null?Math.max(Math.floor(t),0):e?_i:Ui}function Gr({value:e,level:t,minVersion:n,includeMargin:r,marginSize:a,imageSettings:c,size:h,boostLevel:f}){let s=F.useMemo(()=>{const g=(Array.isArray(e)?e:[e]).reduce((x,v)=>(x.push(...tt.QrSegment.makeSegments(v)),x),[]);return tt.QrCode.encodeSegments(g,Fi[t],n,void 0,void 0,f)},[e,t,n,f]);const{cells:i,margin:l,numCells:d,calculatedImageSettings:m}=F.useMemo(()=>{let p=s.getModules();const g=Gi(r,a),x=p.length+g*2,v=Ki(p,h,g,c);return{cells:p,margin:g,numCells:x,calculatedImageSettings:v}},[s,h,c,r,a]);return{qrcode:s,margin:l,cells:i,numCells:d,calculatedImageSettings:m}}var Wi=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Qi=F.forwardRef(function(t,n){const r=t,{value:a,size:c=Lr,level:h=zr,bgColor:f=Br,fgColor:s=Fr,includeMargin:i=_r,minVersion:l=Ur,boostLevel:d,marginSize:m,imageSettings:p}=r,x=fn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=x,k=fn(x,["style"]),C=p?.src,y=F.useRef(null),R=F.useRef(null),N=F.useCallback(V=>{y.current=V,typeof n=="function"?n(V):n&&(n.current=V)},[n]),[M,P]=F.useState(!1),{margin:S,cells:z,numCells:_,calculatedImageSettings:O}=Gr({value:a,level:h,minVersion:l,boostLevel:d,includeMargin:i,marginSize:m,imageSettings:p,size:c});F.useEffect(()=>{if(y.current!=null){const V=y.current,Q=V.getContext("2d");if(!Q)return;let J=z;const Y=R.current,H=O!=null&&Y!==null&&Y.complete&&Y.naturalHeight!==0&&Y.naturalWidth!==0;H&&O.excavation!=null&&(J=Kr(z,O.excavation));const W=window.devicePixelRatio||1;V.height=V.width=c*W;const ne=c/_*W;Q.scale(ne,ne),Q.fillStyle=f,Q.fillRect(0,0,_,_),Q.fillStyle=s,Wi?Q.fill(new Path2D($r(J,S))):z.forEach(function(ge,q){ge.forEach(function(Z,me){Z&&Q.fillRect(me+S,q+S,1,1)})}),O&&(Q.globalAlpha=O.opacity),H&&Q.drawImage(Y,O.x+S,O.y+S,O.w,O.h)}}),F.useEffect(()=>{P(!1)},[C]);const G=dn({height:c,width:c},v);let B=null;return C!=null&&(B=F.createElement("img",{src:C,key:C,style:{display:"none"},onLoad:()=>{P(!0)},ref:R,crossOrigin:O?.crossOrigin})),F.createElement(F.Fragment,null,F.createElement("canvas",dn({style:G,height:c,width:c,ref:N,role:"img"},k)),B)});Qi.displayName="QRCodeCanvas";var Wr=F.forwardRef(function(t,n){const r=t,{value:a,size:c=Lr,level:h=zr,bgColor:f=Br,fgColor:s=Fr,includeMargin:i=_r,minVersion:l=Ur,boostLevel:d,title:m,marginSize:p,imageSettings:g}=r,x=fn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:k,numCells:C,calculatedImageSettings:y}=Gr({value:a,level:h,minVersion:l,boostLevel:d,includeMargin:i,marginSize:p,imageSettings:g,size:c});let R=k,N=null;g!=null&&y!=null&&(y.excavation!=null&&(R=Kr(k,y.excavation)),N=F.createElement("image",{href:g.src,height:y.h,width:y.w,x:y.x+v,y:y.y+v,preserveAspectRatio:"none",opacity:y.opacity,crossOrigin:y.crossOrigin}));const M=$r(R,v);return F.createElement("svg",dn({height:c,width:c,viewBox:`0 0 ${C} ${C}`,ref:n,role:"img"},x),!!m&&F.createElement("title",null,m),F.createElement("path",{fill:f,d:`M0,0 h${C}v${C}H0z`,shapeRendering:"crispEdges"}),F.createElement("path",{fill:s,d:M,shapeRendering:"crispEdges"}),N)});Wr.displayName="QRCodeSVG";function Qr(){return parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10)}function Yi(){return es({queryKey:fe.tunnel.status,queryFn:()=>Be.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?5e3:!1})}function Hi(){const e=$t();return hn({mutationFn:()=>Be.post("/tunnel/start",{port:Qr()}),onSuccess:()=>{e.invalidateQueries({queryKey:fe.tunnel.status})}})}function Xi(){const e=$t();return hn({mutationFn:()=>Be.post("/tunnel/regenerate",{port:Qr()}),onSuccess:()=>{e.invalidateQueries({queryKey:fe.tunnel.status})}})}function qi(){const e=$t();return hn({mutationFn:()=>Be.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:fe.tunnel.status})}})}function Vi(e){if(!e||e.status==="stopped")return{button:"text-muted-foreground hover:text-foreground hover:bg-accent",dot:"",label:"Use Agent Tower on your phone",icon:"idle"};switch(e.status){case"healthy":case"checking":return{button:"text-success-ink hover:bg-success/10",dot:"bg-success",label:e.status==="healthy"?"Tunnel healthy":"Checking tunnel health",icon:"ok"};case"degraded":case"localUnhealthy":case"linkReplaced":return{button:"text-warning-ink hover:bg-warning/10",dot:"bg-warning",label:"Tunnel needs attention",icon:"warn"};case"exited":case"error":return{button:"text-destructive-ink hover:bg-destructive/10",dot:"bg-destructive",label:"Tunnel unavailable",icon:"error"};case"starting":return{button:"text-warning-ink hover:bg-warning/10",dot:"bg-warning",label:"Tunnel starting",icon:"loading"}}}function Ji(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 Zi(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 Hn(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 a=Math.round(r/60);return a<24?`${a}h ago`:`${Math.round(a/24)}d ago`}function ft(e){const t=e?.trim();return t||null}function ea(e){if(!e)return"";const t=[ft(e.lastLocalError),ft(e.lastRemoteError),ft(e.lastError)].filter(a=>a!==null),n=ft(e.lastProcessOutput),r=!!n&&(e.status==="error"||e.status==="exited"||!!ft(e.lastError));return n&&r&&t.push(n),t.join(`
8
+ `)}function Xn(){const{t:e}=De(),{data:t}=Yi(),n=Hi(),r=qi(),a=Xi(),[c,h]=u.useState(!1),[f,s]=u.useState(null),[i,l]=u.useState(!1),[d,m]=u.useState(!1),p=t?.status!==void 0&&t.status!=="stopped",g=n.isPending||t?.status==="starting",x=a.isPending,v=t?.shareableUrl,k=t?.token,C=Vi(t),y=Ji(t),R=ea(t),N=t?.status==="healthy"||t?.status==="checking"?"text-success-ink":t?.status==="exited"||t?.status==="error"?"text-destructive-ink":"text-warning-ink",M=u.useCallback(()=>{n.mutate(void 0,{onSuccess:()=>h(!0)})},[n]),P=u.useCallback(()=>{v&&(navigator.clipboard.writeText(v),s("url"),setTimeout(()=>s(null),2e3))},[v]),S=u.useCallback(()=>{k&&(navigator.clipboard.writeText(k),s("token"),setTimeout(()=>s(null),2e3))},[k]),z=u.useCallback(()=>{r.mutate(),h(!1),l(!1),m(!1)},[r]),_=u.useCallback(()=>{a.mutate(void 0,{onSuccess:()=>{m(!1),h(!0)}})},[a]),O=o.jsx(Cs,{asChild:!0,children:o.jsx(Jt,{size:"xs",label:e("Close"),className:"-mr-1 -mt-0.5 shrink-0",children:o.jsx(ts,{})})});return o.jsxs(Ss,{open:c,onOpenChange:h,children:[o.jsxs("div",{className:"relative",children:[o.jsx(Ns,{asChild:!0,children:o.jsx("button",{type:"button",disabled:g,className:ie("p-1.5 rounded-md transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/60",C.button),title:e(C.label),"aria-label":e(C.label),children:g?o.jsx(ns,{size:"md"}):C.icon==="warn"?o.jsx(rs,{size:16}):o.jsx(In,{size:16})})}),p&&!g&&o.jsx("span",{className:`pointer-events-none absolute top-0.5 right-0.5 w-2 h-2 ${C.dot} rounded-full`})]}),o.jsx(Es,{align:"end",className:ie("max-w-[calc(100vw-1rem)]",p?"w-96":"w-80"),children:p?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("span",{className:ie("flex items-center gap-1.5 text-xs font-medium",N),children:[o.jsx("span",{className:`inline-block w-1.5 h-1.5 ${C.dot} rounded-full`}),e(y)]}),o.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:e(Zi(t))})]}),O]}),k&&o.jsxs("div",{className:"mb-2 flex items-center gap-1.5 rounded-md bg-muted/50 px-2 py-1 text-xs text-foreground/80",children:[o.jsx(ps,{size:12}),o.jsx("span",{children:e("Token protected")})]}),v&&o.jsx("div",{className:"flex justify-center py-3",children:o.jsx(Wr,{value:v,size:160})}),v||t?.url?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ks,{size:"sm",readOnly:!0,value:v??t?.url??"",onFocus:G=>G.target.select(),"aria-label":e("Copy shareable link"),className:"select-all text-xs"}),o.jsx(Jt,{size:"sm",label:e("Copy shareable link"),onClick:P,disabled:!v,children:f==="url"?o.jsx(bt,{className:"text-success"}):o.jsx(An,{})})]}):o.jsx("div",{className:"rounded-md border border-border bg-muted/50 px-2 py-1.5 text-xs text-muted-foreground",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-border px-2 py-1.5",children:[o.jsx("div",{className:"text-muted-foreground",children:e("Last checked")}),o.jsx("div",{className:"mt-0.5 text-foreground",children:Hn(t?.lastCheckedAt)})]}),o.jsxs("div",{className:"rounded-md border border-border px-2 py-1.5",children:[o.jsx("div",{className:"text-muted-foreground",children:e("Last healthy")}),o.jsx("div",{className:"mt-0.5 text-foreground",children:Hn(t?.lastHealthyAt)})]})]}),R&&o.jsx(Dt,{tone:"warning",size:"sm",className:"mt-2 max-h-28 overflow-auto",children:o.jsx("div",{className:"whitespace-pre-wrap break-words",children:R})}),t?.status==="degraded"&&o.jsx(Dt,{tone:"warning",size:"sm",className:"mt-2",children:e("Agent Tower is keeping the same URL and waiting for Cloudflare Quick Tunnel to recover.")}),t?.status==="linkReplaced"&&o.jsx(Dt,{tone:"warning",size:"sm",className:"mt-2",children:e("The previous tunnel link and token are no longer valid.")}),k&&o.jsxs("div",{className:"mt-2",children:[o.jsx("button",{type:"button",onClick:()=>l(!i),className:"rounded-sm text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:e(i?"Hide token":"Show token")}),i&&o.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 break-all rounded-md border border-border bg-muted/50 px-2 py-1.5 text-xs text-foreground/80",children:k}),o.jsx(Jt,{size:"sm",label:e("Copy token"),onClick:S,className:"shrink-0",children:f==="token"?o.jsx(bt,{className:"text-success"}):o.jsx(An,{})})]})]}),d?o.jsxs(Dt,{tone:"danger",size:"sm",className:"mt-3",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(Ne,{variant:"secondary",size:"xs",className:"flex-1",onClick:()=>m(!1),children:e("Cancel")}),o.jsx(Ne,{variant:"primary",tone:"danger",size:"xs",className:"flex-1",onClick:_,loading:x,children:e(x?"Generating...":"Regenerate link")})]})]}):o.jsxs(Ne,{variant:"ghost",size:"sm",block:!0,className:"mt-3",onClick:()=>m(!0),disabled:x||t?.canRegenerate===!1,children:[o.jsx(ss,{}),e("Regenerate link")]}),o.jsx(Ne,{variant:"ghost",tone:"danger",size:"sm",block:!0,className:"mt-1",onClick:z,loading:r.isPending,children:r.isPending?e("Stopping..."):e("Stop Tunnel")})]}):o.jsxs(o.Fragment,{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 shrink-0 items-center justify-center rounded-md bg-muted text-foreground/80",children:o.jsx(In,{size:16})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-foreground",children:e("Use Agent Tower on your phone")}),o.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",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]}),o.jsx(Ne,{variant:"primary",size:"sm",block:!0,className:"mt-3",onClick:M,loading:g,children:e(g?"Starting tunnel...":"Enable phone access")})]})})]})}function on({isOpen:e,onClose:t}){const{t:n}=De(),r=hs(),[a,c]=u.useState(""),[h,f]=u.useState(""),[s,i]=u.useState(null),[l,d]=u.useState(!1),[m,p]=u.useState(!1),g=a.trim(),x=h.trim(),v=l||r.isPending,k=u.useMemo(()=>!!(g&&x&&!v),[g,x,v]),C=u.useCallback(()=>{c(""),f(""),i(null),p(!1)},[]),y=u.useCallback(()=>{v||(C(),t())},[v,t,C]);u.useEffect(()=>{e||C()},[e,C]);const R=u.useCallback(async S=>{try{await r.mutateAsync({name:g,repoPath:x,initEmptyRepo:S}),C(),t()}catch(z){const _=z instanceof Error?z.message:n("Failed to create project");i(_),Te.error(_)}},[r,t,C,n,g,x]),N=u.useCallback(async()=>{if(!(!g||!x||v)){i(null),d(!0);try{const S=await Be.get("/filesystem/validate",{params:{path:x}});if(!S.valid){i(S.error??n("Selected path is not a valid directory"));return}if(S.isGitRepo){await R(!1);return}if(S.reason==="no_git"&&S.isEmpty){p(!0);return}if(S.reason==="no_git"){await R(!1);return}await R(!1)}catch(S){i(S instanceof Error?S.message:n("Could not check project path"))}finally{d(!1)}}},[R,v,n,g,x]),M=u.useCallback(()=>{p(!1),R(!1)},[R]),P=u.useCallback(()=>{p(!1),R(!0)},[R]);return o.jsxs(o.Fragment,{children:[o.jsx(Dn,{isOpen:e,onClose:y,title:n("Create New Project"),action:o.jsxs(o.Fragment,{children:[o.jsx(Ne,{onClick:y,disabled:v,children:n("Cancel")}),o.jsx(Ne,{variant:"primary",onClick:N,disabled:!k,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-foreground/80 mb-1.5",children:n("Project Name")}),o.jsx("input",{type:"text",value:a,onChange:S=>c(S.target.value),placeholder:n("e.g., Agent Tower"),disabled:v,className:"w-full px-3 py-2 border border-border rounded-lg text-sm focus:outline-none focus:border-ring transition-colors disabled:bg-muted/50 disabled:text-muted-foreground",autoFocus:!0})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-1.5",children:n("Project Path")}),o.jsx(Ts,{value:h,onChange:f,validationMode:"directory"})]}),s&&o.jsx("p",{className:"text-xs text-destructive-ink 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(Ne,{onClick:()=>p(!1),disabled:r.isPending,children:n("Cancel")}),o.jsx(Ne,{onClick:M,disabled:r.isPending,children:n("Create Local Project")}),o.jsx(Ne,{variant:"primary",onClick:P,disabled:r.isPending,children:r.isPending?n("Creating..."):n("Initialize and Create")})]}),children:o.jsxs("div",{className:"space-y-3 text-sm text-foreground/70 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 qn(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function ta(e){return e.map((t,n)=>({project:t,index:n,activityTime:qn(t.lastActivityAt??t.createdAt),createdTime:qn(t.createdAt)})).sort((t,n)=>{const r=n.activityTime-t.activityTime;if(r!==0)return r;const a=n.createdTime-t.createdTime;return a!==0?a:t.index-n.index}).map(({project:t})=>t)}const Yr="providerLastUsedAt";function na(){const e={};try{const t=localStorage.getItem(Yr),n=t?JSON.parse(t):{};if(n&&typeof n=="object"&&!Array.isArray(n))for(const[r,a]of Object.entries(n))typeof a=="number"&&Number.isFinite(a)&&a>0&&(e[r]=a)}catch{}try{const t=localStorage.getItem("lastSelectedProviderId");t&&Object.keys(e).length===0&&(e[t]=1)}catch{}return e}function ra(e){try{localStorage.setItem(Yr,JSON.stringify(e))}catch{}}const sa=u.lazy(()=>or(()=>import("./TaskDetail-CqhPxvg3.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,44,45,46,47,48,49,50,51,52,53,54,55])).then(e=>({default:e.TaskDetail}))),oa=u.lazy(()=>or(()=>import("./MobileTaskDetail-M_Kke9rL.js"),__vite__mapDeps([56,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,44,45,46,47,48,49,50,51,52,53,54,55])).then(e=>({default:e.MobileTaskDetail})));function Vn(){const{t:e}=De();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 Jn({projects:e,filterProjectId:t,setFilterProjectId:n,onCreateProject:r,className:a}){const{t:c}=De(),[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:ie("relative flex items-center min-w-0",a),children:[o.jsx("span",{className:"mx-1.5 text-muted-foreground 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(an,{size:13,className:"text-muted-foreground shrink-0"}),o.jsx("span",{className:"truncate max-w-[200px] font-medium",children:i?i.name:c("All Projects")}),o.jsx(As,{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-popover 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(an,{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:c("All Projects")}),t===null?o.jsx(bt,{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(bt,{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(ir,{size:13}),o.jsx("span",{children:c("Create New Project...")})]})]})]}):null]})}const ia=260,aa=600,Zn=400,la=100,ca=1e3;function er(e){const t=e.workspaces?.find(r=>r.status==="ACTIVE")??e.workspaces?.[0],n=t?.sessions?.at(-1);return{id:e.id,parentTaskId:e.parentTaskId,subtaskCount:e.subtaskCount,projectId:e.projectId,title:e.titlePreview??e.title,status:e.status,priority:e.priority,...t?{preferredWorkspace:{...t.workspaceKind===Ye.MAIN_DIRECTORY?{workspaceKind:Ye.MAIN_DIRECTORY}:{},branchName:t.branchName}}:{},...n?{latestAgentType:n.agentType}:{},...e.workspaces?.some(r=>r.sessions?.some(a=>a.status==="RUNNING"||a.status==="PENDING"))?{hasRunningSession:!0}:{},updatedAt:e.updatedAt?new Date(e.updatedAt).getTime():Date.now()}}function ua(){const{t:e,locale:t}=De(),[n,r]=u.useState(void 0),a=u.useRef(0),[c,h]=u.useState(null),[f,s]=u.useState(null),[i,l]=u.useState(Zn),[d,m]=u.useState(!1),[p,g]=u.useState("idle"),[x,v]=u.useState({}),k=u.useRef(!1),C=u.useRef(0),y=u.useRef(Zn),R=u.useRef(null),N=$t(),{data:M,isLoading:P}=js(),[S,z]=u.useState(na),{data:_,isLoading:O}=ms({limit:la}),G=u.useMemo(()=>_?.data??[],[_?.data]),B=f&&G.some(b=>b.id===f)?f:null,{data:V,isLoading:Q}=os({...B?{projectId:B}:{},limit:ca}),J=u.useMemo(()=>[...V?.data??[],...V?.parents??[]],[V]),[Y,H]=u.useState([]),W=u.useMemo(()=>{if(Y.length===0)return J;const b=new Set(J.map(j=>j.id));return[...Y.filter(j=>!b.has(j.id)),...J]},[J,Y]),[ne,ge]=u.useState(null),q=is(c&&!W.some(b=>b.id===c)?c:""),Z=u.useMemo(()=>c&&W.some(b=>b.id===c)?c:ne&&c===ne?ne:c&&(q.isLoading||q.data&&(!B||q.data.projectId===B))?c:null,[c,W,ne,q.data,q.isLoading,B]);u.useEffect(()=>{ne&&W.some(b=>b.id===ne)&&ge(null)},[ne,W]),u.useEffect(()=>{if(Y.length===0)return;const b=new Set(J.map(j=>j.id));Y.some(j=>b.has(j.id))&&H(j=>j.filter(A=>!b.has(A.id)))},[J,Y]);const me=u.useMemo(()=>ta(G),[G]),T=u.useMemo(()=>me.map(yi),[me]),I=u.useMemo(()=>me.filter(b=>!b.archivedAt),[me]),U=u.useMemo(()=>M?M.filter(Rs).sort((b,j)=>{const A=!dt(b),L=!dt(j);return A!==L?A?-1:1:(S[j.provider.id]??0)-(S[b.provider.id]??0)}):[],[M,S]),w=u.useMemo(()=>{const b=W.map(j=>Dr(j,G.find(A=>A.id===j.projectId)));return q.data&&Z===q.data.id&&!b.some(j=>j.id===q.data.id)&&b.push(Ci(q.data)),b},[G,W,q.data,Z]),E=u.useMemo(()=>{if(!Z)return null;const b=W.find(A=>A.id===Z)??(q.data?er(q.data):void 0);if(!b)return null;const j=G.find(A=>A.id===b.projectId);if(!j){const A=b.preferredWorkspace?b.preferredWorkspace.workspaceKind===Ye.MAIN_DIRECTORY?"Project directory":b.preferredWorkspace.branchName:"—";return{id:b.id,parentTaskId:b.parentTaskId,subtaskCount:b.subtaskCount,projectId:b.projectId,projectName:"Unknown",projectColor:"text-muted-foreground",title:b.title,status:Ht(b.status),priority:b.priority,branch:A,mainBranch:"main",description:"",isGitRepo:!1,worktreeReady:!1,reason:"NO_GIT",projectArchivedAt:null,projectRepoDeletedAt:null}}return Si(b,j)},[Z,W,G,q.data]),D=as(),se=ls(),ve=cs(),Xe=us(),be=vs(),Ie=u.useCallback(b=>{const j=er(b);H(A=>A.some(L=>L.id===b.id)?A.map(L=>L.id===b.id?j:L):[j,...A]),N.setQueryData(fe.tasks.detail(b.id),b),ge(b.id),h(b.id)},[N]),Me=u.useCallback((b,j,A)=>{const L=b.id,K=[b.title,b.description].filter(Boolean).join(`
9
+
10
+ `),ee=A===Ye.WORKTREE?I.find(X=>X.id===b.projectId)?.setupScript??null:null;v(X=>({...X,[L]:{status:"creating-workspace",setupScript:ee}})),(async()=>{try{await Ps(L,{providerId:j,prompt:K,workspaceKind:A},{createWorkspace:X=>Be.post(`/tasks/${L}/workspaces`,{clientSubmissionId:X,workspaceKind:A}),startSession:X=>be.mutateAsync(X),onStep:X=>v(de=>({...de,[L]:{status:X,setupScript:ee}}))}),await N.invalidateQueries({queryKey:fe.workspaces.list(L)}),await N.invalidateQueries({queryKey:fe.workspaces.setupProgress(L)}),await N.invalidateQueries({queryKey:fe.tasks.all}),v(X=>{const de={...X};return delete de[L],de})}catch(X){const de=X instanceof Error?X.message:e("启动 Agent 失败");v(je=>({...je,[L]:{status:"failed",error:de,setupScript:ee}})),Te.error(e("任务已创建,但启动 Agent 失败,可在详情中重试")),N.invalidateQueries({queryKey:fe.workspaces.list(L)}),N.invalidateQueries({queryKey:fe.tasks.all})}})()},[I,N,be,e]),it=u.useCallback(b=>{v(j=>{const A={...j};return delete A[b],A}),N.invalidateQueries({queryKey:fe.workspaces.list(b)}),N.invalidateQueries({queryKey:fe.tasks.all})},[N]),Ke=u.useCallback((b,j)=>{const A=new Set([b,...W.filter(L=>L.parentTaskId===b).map(L=>L.id)]);se.mutate({id:b,expectedSubtaskCount:j},{onSuccess:()=>{(Z===b||E?.parentTaskId===b)&&h(null),v(L=>{const K={...L};for(const ee of A)delete K[ee];return K}),H(L=>L.filter(K=>K.id!==b&&K.parentTaskId!==b)),N.invalidateQueries({queryKey:fe.tasks.all})},onError:L=>{Te.error(L instanceof Error?e(L.message):e("删除任务失败"))}})},[se,Z,E?.parentTaskId,W,N,e]),Ge=u.useCallback((b,j)=>{ve.mutate({id:b,status:vi(j)},{onError:()=>{Te.error(e("状态变更失败,该操作不被允许"))}})},[ve,e]),xe=u.useCallback((b,j)=>{Xe.mutate({id:b,priority:j},{onError:()=>{Te.error(e("优先级变更失败"))}})},[Xe,e]),qe=u.useCallback(b=>{b.preventDefault(),k.current=!0,C.current=b.clientX,y.current=i,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[i]);u.useEffect(()=>{const b=A=>{if(!k.current)return;const L=A.clientX-C.current,K=Math.max(ia,Math.min(aa,y.current+L));l(K)},j=()=>{k.current&&(k.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",b),document.addEventListener("mouseup",j),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",j)}},[]);const Pe=u.useCallback(()=>{m(!0)},[]),kt=u.useCallback(()=>{if(a.current++,r(void 0),I.length===0){Te.error(e("没有可用项目,请先创建或恢复项目"));return}h(null)},[I,e]),Ve=u.useCallback(()=>{m(!1)},[]),at=u.useCallback(async b=>{const{title:j,description:A,projectId:L,providerId:K,mode:ee,workspaceMode:X,teamRunMode:de,teamTemplateId:je,memberPresetIds:_e,attachmentLinks:Re,priority:Qe,baseBranch:ut}=b,Hr=[A,Re].filter(Boolean).join(`
11
+
12
+ `);let Ue=null;try{if(g("creating-task"),Ue=await Be.post(`/projects/${L}/tasks`,{title:j,description:Hr||void 0,priority:Qe,baseBranch:ut,parentTaskId:b.parentTaskId}),localStorage.setItem("lastSelectedProjectId",L),ee==="SOLO"&&K){localStorage.setItem("lastSelectedProviderId",K);const Cn={...S,[K]:Date.now()};ra(Cn),z(Cn)}ee==="TEAM"?(g("creating-teamrun"),await D.mutateAsync({taskId:Ue.id,mode:de,...je?{teamTemplateId:je}:{},..._e.length>0?{memberPresetIds:_e}:{}})):K&&Me(Ue,K,X),B&&L!==B&&s(null),Ie(Ue),r(void 0),g("idle"),N.invalidateQueries({queryKey:fe.tasks.all}),N.invalidateQueries({queryKey:fe.projects.all})}catch(Ze){if(g("idle"),Ue&&ee==="TEAM")Ie(Ue),N.invalidateQueries({queryKey:fe.tasks.all}),Te.error(Ze instanceof Error?Ze.message:e("TeamRun 创建失败,请检查团队配置后重试"));else if(Ue)B&&L!==B&&s(null),Ie(Ue),N.invalidateQueries({queryKey:fe.tasks.all}),N.invalidateQueries({queryKey:fe.projects.all});else throw Te.error(Ze instanceof Error?Ze.message:e("Failed to create task")),Ze}},[D,Me,N,e,B,Ie,S]),jt=O||Q,Oe=u.useMemo(()=>I.filter(b=>!n||b.id===n.projectId).map(b=>({id:b.id,name:b.name,color:T.find(j=>j.id===b.id)?.color,repoPath:b.repoPath,mainBranch:b.mainBranch,isGitRepo:b.isGitRepo,worktreeReady:b.worktreeReady,reason:b.reason})),[I,T,n]),Le=u.useMemo(()=>U.map(b=>{const j=dt(b);return{id:b.provider.id,name:b.provider.name,agentType:b.provider.agentType,available:!j,permissionMode:b.provider.executionPermission,reason:j}}),[U]),ye=u.useMemo(()=>{if(n)return n.projectId;if(B&&I.find(j=>j.id===B))return B;const b=localStorage.getItem("lastSelectedProjectId");return b&&I.find(j=>j.id===b)?b:I[0]?.id??""},[I,B,n]),[lt,we]=u.useState(ye);u.useEffect(()=>{we(ye)},[ye]);const ct=u.useMemo(()=>I.find(b=>b.id===lt)?.name??I.find(b=>b.id===ye)?.name??e("Project"),[I,lt,ye,e]),Rt=n?e("Create subtask"):t==="zh-CN"?`你需要在 ${ct} 中做点什么?`:`What do you need to do in ${ct}?`,Tt=u.useMemo(()=>{const b=localStorage.getItem("lastSelectedProviderId");return b&&U.find(A=>A.provider.id===b&&!dt(A))?b:U.find(A=>!dt(A))?.provider.id??""},[U]),We=Rr(),[At,Je]=u.useState(!1),{usesIntegratedTitlebar:ze,desktopPlatform:Xt,hasMacTrafficLights:qt}=sr(),Vt=ze&&Xt==="win32",le=u.useCallback(()=>{if(a.current++,r(void 0),I.length===0){Te.error(e("没有可用项目,请先创建或恢复项目"));return}Je(!0)},[I,e]),ce=u.useCallback(b=>{a.current++,r(void 0),h(b)},[]),ue=u.useCallback(async b=>{const j=++a.current;try{const A=await Be.get(`/tasks/${b}`);if(j!==a.current)return;const L=(A.workspaces?.filter(ee=>!ee.parentWorkspaceId&&ee.status!=="ABANDONED")??[]).sort((ee,X)=>(X.createdAt??"").localeCompare(ee.createdAt??"")),K=L.find(ee=>ee.status==="ACTIVE")??L.find(ee=>ee.status==="HIBERNATED")??L[0];r({id:b,title:A.titlePreview??A.title,projectId:A.projectId,baseBranch:K?.branchName||A.baseBranch}),h(null),We&&Je(!0)}catch(A){j===a.current&&Te.error(A instanceof Error?A.message:e("Failed to create task"))}},[We,e]),ke=u.useCallback(async b=>{await at(b),Je(!1)},[at]);return We?At?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:()=>{a.current++,n&&h(n.id),r(void 0),Je(!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-[22px] font-medium tracking-tight leading-snug text-foreground mb-5 break-words",children:Rt}),o.jsx(Rn,{parentTask:n,projects:Oe,providers:Le,isProvidersLoading:P,onSubmit:ke,defaultProjectId:ye,defaultProviderId:Tt,onProjectChange:we,createStep:p},n?.id??"root")]})]}):Z&&E?o.jsxs(o.Fragment,{children:[o.jsx(u.Suspense,{fallback:o.jsx("div",{className:"flex h-dvh",children:o.jsx(Vn,{})}),children:o.jsx(oa,{task:E,onSelectTask:ce,onCreateSubtask:ue,onBack:()=>h(null),onDeleteTask:E.projectArchivedAt?void 0:Ke,onTaskPriorityChange:E.projectArchivedAt?void 0:xe,isDeleting:se.isPending,autoStartState:x[E.id]??null,onAutoStartRecovered:it})}),o.jsx(on,{isOpen:d,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(Jn,{projects:T,filterProjectId:B,setFilterProjectId:s,onCreateProject:Pe})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Xn,{}),o.jsx("button",{onClick:()=>En.getState().openSettings(),className:"p-1.5 text-muted-foreground active:text-foreground rounded-md",children:o.jsx(Nn,{size:16})})]})]}),o.jsx(Qn,{tasks:w,projects:T,selectedTaskId:null,onSelectTask:ce,onCreateSubtask:ue,selectedParentTaskId:E?.parentTaskId,filterProjectId:B,setFilterProjectId:s,width:"100%",onDeleteTask:Ke,onCreateTask:le,onCreateProject:Pe,onTaskStatusChange:Ge,onTaskPriorityChange:xe,isLoading:jt&&w.length===0})]}),o.jsx(on,{isOpen:d,onClose:Ve})]}):o.jsxs("div",{ref:R,className:"flex flex-col h-screen bg-sidebar overflow-hidden text-sm",children:[o.jsxs("header",{className:ie("h-12 bg-sidebar flex items-center px-4 justify-between flex-shrink-0 z-20 relative",ze&&"app-region-drag",Vt&&"pr-[150px]"),children:[o.jsxs("div",{className:ie("flex items-center gap-2 min-w-0",qt&&"pl-[72px]"),children:[o.jsx(Tn,{}),o.jsx(Jn,{projects:T,filterProjectId:B,setFilterProjectId:s,onCreateProject:Pe,className:ze?"app-region-no-drag":void 0})]}),o.jsxs("div",{className:ie("flex items-center gap-1",ze&&"app-region-no-drag"),children:[o.jsx("div",{className:ze?"app-region-no-drag":void 0,children:o.jsx(Xn,{})}),o.jsx("button",{onClick:()=>En.getState().openSettings(),className:ie("p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded-md transition-colors",ze&&"app-region-no-drag"),children:o.jsx(Nn,{size:16})})]})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx(Qn,{tasks:w,projects:T,selectedTaskId:Z,onSelectTask:ce,onCreateSubtask:ue,selectedParentTaskId:E?.parentTaskId,filterProjectId:B,setFilterProjectId:s,width:i,onCreateTask:kt,onCreateProject:Pe,isCreateActive:!Z,onTaskStatusChange:Ge,onDeleteTask:Ke,onTaskPriorityChange:xe,isLoading:jt&&w.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:Z&&E?o.jsx(u.Suspense,{fallback:o.jsx(Vn,{}),children:o.jsx(sa,{task:E,onSelectTask:ce,onCreateSubtask:ue,onDeleteTask:E.projectArchivedAt?void 0:Ke,isDeleting:se.isPending,onTaskStatusChange:E.projectArchivedAt?void 0:Ge,onTaskPriorityChange:E.projectArchivedAt?void 0:xe,autoStartState:x[E.id]??null,onAutoStartRecovered:it})}):Z&&!E?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",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:Rt}),o.jsx(Rn,{parentTask:n,projects:Oe,providers:Le,isProvidersLoading:P,onSubmit:at,defaultProjectId:ye,defaultProviderId:Tt,onProjectChange:we,createStep:p},n?.id??"root")]})})})]}),o.jsx(on,{isOpen:d,onClose:Ve})]})}const Ia=Object.freeze(Object.defineProperty({__proto__:null,ProjectKanbanPage:ua},Symbol.toStringTag,{value:"Module"}));export{Ei as D,Is as L,Ia as P,Ht as m,Ps as t};