tower-studio 0.2.5 → 0.2.6

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 (260) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  12. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +39 -39
  13. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
  17. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  18. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  19. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
  20. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  21. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  22. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/standalone/.next/server/app/api/adapters/test/route.js +1 -1
  24. package/.next/standalone/.next/server/app/api/adapters/test/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js +1 -1
  32. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/internal/assistant/route.js +1 -1
  34. package/.next/standalone/.next/server/app/api/internal/assistant/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js +1 -1
  36. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js +1 -1
  40. package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/internal/hooks/stop/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/buffer/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/input/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js +1 -1
  46. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/index.html +1 -1
  50. package/.next/standalone/.next/server/app/index.rsc +14 -14
  51. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  52. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
  53. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  54. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +9 -9
  55. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  56. package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  57. package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +69 -69
  58. package/.next/standalone/.next/server/app/missions/page.js +1 -1
  59. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  62. package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +39 -39
  63. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  65. package/.next/standalone/.next/server/app/onboarding.html +1 -1
  66. package/.next/standalone/.next/server/app/onboarding.rsc +16 -16
  67. package/.next/standalone/.next/server/app/onboarding.segments/_full.segment.rsc +16 -16
  68. package/.next/standalone/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
  69. package/.next/standalone/.next/server/app/onboarding.segments/_index.segment.rsc +9 -9
  70. package/.next/standalone/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  71. package/.next/standalone/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
  72. package/.next/standalone/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
  73. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +1 -1
  74. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +39 -39
  75. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  78. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +52 -52
  79. package/.next/standalone/.next/server/app/settings/page.js +1 -1
  80. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  82. package/.next/standalone/.next/server/app/settings.html +1 -1
  83. package/.next/standalone/.next/server/app/settings.rsc +16 -16
  84. package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +16 -16
  85. package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  86. package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +9 -9
  87. package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  88. package/.next/standalone/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  89. package/.next/standalone/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  90. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  91. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +98 -98
  92. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  94. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  95. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +82 -82
  96. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  98. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  99. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +73 -73
  100. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  102. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  103. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +68 -68
  104. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js +1 -1
  105. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  106. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  107. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  108. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +39 -39
  109. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +1 -1
  112. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +74 -74
  113. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
  114. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
  115. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +2 -2
  116. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +78 -78
  117. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js +1 -1
  118. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  119. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  120. package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  121. package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +59 -59
  122. package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
  123. package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  124. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +1 -1
  125. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.9mj3v._.js +2 -2
  126. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05353yb._.js +1 -1
  127. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05eviiz._.js +2 -2
  128. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__07h7qz8._.js → [root-of-the-server]__09h3i6m._.js} +2 -2
  129. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_a8-jq._.js +1 -1
  130. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0dsv3wl._.js +4 -0
  131. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0c1g5im._.js → [root-of-the-server]__0j~qauc._.js} +2 -2
  132. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0p_ii~p._.js +3 -0
  133. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0puw1af._.js +2 -2
  134. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0ntb7n~._.js → [root-of-the-server]__0qie1gs._.js} +3 -3
  135. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0w2w3x.._.js +20 -0
  136. package/.next/standalone/.next/server/chunks/{_0u-~jqd._.js → _0trog_r._.js} +1 -1
  137. package/.next/standalone/.next/server/chunks/{src_0o_27yu._.js → src_01ztl3b._.js} +2 -2
  138. package/.next/standalone/.next/server/chunks/src_lib_0ba0ntr._.js +1 -1
  139. package/.next/standalone/.next/server/chunks/src_lib_ai_0q-~me1._.js +1 -1
  140. package/.next/standalone/.next/server/chunks/src_lib_ai_0xx6y51._.js +1 -1
  141. package/.next/standalone/.next/server/chunks/src_lib_ai_providers_index_ts_0.y.3vp._.js +1 -1
  142. package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
  143. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0zjarb3._.js → [root-of-the-server]__0-yld.d._.js} +2 -2
  144. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0.5rcav._.js +1 -1
  145. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__006_qh0._.js +1 -1
  146. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02px.0y._.js +1 -1
  147. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__03ebsif._.js +3 -3
  148. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05kq890._.js +1 -1
  149. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0-xoiaj._.js → [root-of-the-server]__079.nog._.js} +2 -2
  150. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ilem~v._.js → [root-of-the-server]__0c4.z1s._.js} +2 -2
  151. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gaa~xc._.js +1 -1
  152. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gcf4k3._.js +1 -1
  153. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ghfuuv._.js +1 -1
  154. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0n8jy_r._.js → [root-of-the-server]__0k3isnk._.js} +2 -2
  155. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0l43.5g._.js +1 -1
  156. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0nwue~m._.js +3 -0
  157. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ps55l6._.js +1 -1
  158. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0q7ho54._.js +1 -1
  159. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qe~p-n._.js +1 -1
  160. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ribsk4._.js +1 -1
  161. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0tf4zp_._.js +1 -1
  162. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__00wymqa._.js → [root-of-the-server]__0vh-egg._.js} +2 -2
  163. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0wjg_.n._.js +1 -1
  164. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0wvyks.._.js +1 -1
  165. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0y.nw7l._.js +1 -1
  166. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0zbmoit._.js +1 -1
  167. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11bequ2._.js +1 -1
  168. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11ko84j._.js +1 -1
  169. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12pnl8n._.js +1 -1
  170. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0cdz55-._.js → [root-of-the-server]__13k4vkg._.js} +2 -2
  171. package/.next/standalone/.next/server/chunks/ssr/{_0j_v~sp._.js → _0-pqb_c._.js} +3 -3
  172. package/.next/standalone/.next/server/chunks/ssr/{_0ybhyal._.js → _00d1y-k._.js} +2 -2
  173. package/.next/standalone/.next/server/chunks/ssr/{_13fpu~5._.js → _03xwww2._.js} +2 -2
  174. package/.next/standalone/.next/server/chunks/ssr/{_0qu2yg4._.js → _049.box._.js} +1 -1
  175. package/.next/standalone/.next/server/chunks/ssr/_04b71ua._.js +1 -1
  176. package/.next/standalone/.next/server/chunks/ssr/{_0xh9m4.._.js → _05-r00y._.js} +3 -3
  177. package/.next/standalone/.next/server/chunks/ssr/{_0_co86q._.js → _054w82_._.js} +2 -2
  178. package/.next/standalone/.next/server/chunks/ssr/_05h.8a~._.js +1 -1
  179. package/.next/standalone/.next/server/chunks/ssr/{_07scffz._.js → _086yn8o._.js} +1 -1
  180. package/.next/standalone/.next/server/chunks/ssr/{_0wxd6t.._.js → _08t2xag._.js} +2 -2
  181. package/.next/standalone/.next/server/chunks/ssr/{_0cie3rm._.js → _0_gqtgq._.js} +1 -1
  182. package/.next/standalone/.next/server/chunks/ssr/_0_l8.dg._.js +1 -1
  183. package/.next/standalone/.next/server/chunks/ssr/{_0l6vadw._.js → _0_~ftjv._.js} +2 -2
  184. package/.next/standalone/.next/server/chunks/ssr/{_0a-rizg._.js → _0ah80pn._.js} +1 -1
  185. package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
  186. package/.next/standalone/.next/server/chunks/ssr/_0ds6nk2._.js +1 -1
  187. package/.next/standalone/.next/server/chunks/ssr/{_079ks~i._.js → _0ep3sg_._.js} +1 -1
  188. package/.next/standalone/.next/server/chunks/ssr/{_108e4..._.js → _0f8jvpw._.js} +1 -1
  189. package/.next/standalone/.next/server/chunks/ssr/{_0-t_os6._.js → _0fri5n~._.js} +2 -2
  190. package/.next/standalone/.next/server/chunks/ssr/_0h_~oum._.js +7 -0
  191. package/.next/standalone/.next/server/chunks/ssr/{_13l5s-p._.js → _0i2usny._.js} +1 -1
  192. package/.next/standalone/.next/server/chunks/ssr/_0i4__mf._.js +1 -1
  193. package/.next/standalone/.next/server/chunks/ssr/_0ihq._v._.js +1 -1
  194. package/.next/standalone/.next/server/chunks/ssr/_0r9w-k8._.js +1 -1
  195. package/.next/standalone/.next/server/chunks/ssr/_0rbctq7._.js +1 -1
  196. package/.next/standalone/.next/server/chunks/ssr/{_00pxhu2._.js → _0rfo51k._.js} +2 -2
  197. package/.next/standalone/.next/server/chunks/ssr/_0rt8hus._.js +1 -1
  198. package/.next/standalone/.next/server/chunks/ssr/{_0lcigjh._.js → _0vqyzrr._.js} +2 -2
  199. package/.next/standalone/.next/server/chunks/ssr/_0~80adm._.js +3 -3
  200. package/.next/standalone/.next/server/chunks/ssr/src_095o8x6._.js +1 -1
  201. package/.next/standalone/.next/server/chunks/ssr/src_13jha60._.js +1 -1
  202. package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
  203. package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
  204. package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
  205. package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
  206. package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
  207. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
  208. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
  209. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
  210. package/.next/standalone/.next/server/chunks/ssr/{src_lib_0h36tj.._.js → src_lib_08n755q._.js} +1 -1
  211. package/.next/standalone/.next/server/chunks/ssr/{src_lib_0h3ouzu._.js → src_lib_0tb2yya._.js} +1 -1
  212. package/.next/standalone/.next/server/chunks/ssr/{src_lib_0~jyveg._.js → src_lib_123jf_a._.js} +1 -1
  213. package/.next/standalone/.next/server/chunks/ssr/{src_lib_0~rxy~0._.js → src_lib_12ulcxj._.js} +1 -1
  214. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  215. package/.next/standalone/.next/server/pages/404.html +1 -1
  216. package/.next/standalone/.next/server/pages/500.html +1 -1
  217. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  218. package/.next/standalone/.next/server/server-reference-manifest.json +274 -274
  219. package/.next/standalone/.next/static/chunks/0.zipr1bga3lu.js +1 -0
  220. package/.next/standalone/.next/static/chunks/{0jk6ji4j.3jod.js → 037-verumdykv.js} +2 -2
  221. package/.next/standalone/.next/static/chunks/04-7c5m91nvj1.js +1 -0
  222. package/.next/standalone/.next/static/chunks/{0~p32xa2eu79e.js → 06shpikm5rcmu.js} +1 -1
  223. package/.next/standalone/.next/static/chunks/{00grznzz_zqq~.js → 07i~~ygu~oi26.js} +1 -1
  224. package/.next/standalone/.next/static/chunks/{00jlfmav1nk82.js → 082cedbq4pp.-.js} +1 -1
  225. package/.next/standalone/.next/static/chunks/089ktlh~nim1x.js +1 -0
  226. package/.next/standalone/.next/static/chunks/{0mijmksouoprl.js → 0ee.~~ae-vl_q.js} +1 -1
  227. package/.next/standalone/.next/static/chunks/{0.p7x9h8h-..l.js → 0fovq74l0wh7c.js} +1 -1
  228. package/.next/standalone/.next/static/chunks/{14se8w2gb9pe0.js → 0hxgzql5.szyz.js} +1 -1
  229. package/.next/standalone/.next/static/chunks/{018vr5fdl426p.js → 0jscst0zjd2az.js} +1 -1
  230. package/.next/standalone/.next/static/chunks/{0z0a_hlsye7mo.js → 0m2lubto0vt0x.js} +1 -1
  231. package/.next/standalone/.next/static/chunks/0mfgulw-d49o9.js +1 -0
  232. package/.next/standalone/.next/static/chunks/{0~2v6ague-7-t.js → 0m~ltp.wfnbf7.js} +2 -2
  233. package/.next/standalone/.next/static/chunks/{15qi~69blu~3u.js → 0nrbltth-7m~e.js} +1 -1
  234. package/.next/standalone/.next/static/chunks/{0a5u1~0._dmx8.js → 0r7jm27~cp-vs.js} +1 -1
  235. package/.next/standalone/.next/static/chunks/0tk-ju9xhoh68.js +5 -0
  236. package/.next/standalone/.next/static/chunks/0v9ahxdsn0mse.js +1 -0
  237. package/.next/standalone/.next/static/chunks/0w9x-ap4dcwy..js +1 -0
  238. package/.next/standalone/.next/static/chunks/17cayeebhpt~w.js +2 -0
  239. package/.next/standalone/.next/static/chunks/{0-wn9b_4jrs.9.js → 186ahmq856rfj.js} +1 -1
  240. package/.next/standalone/package.json +2 -1
  241. package/bin/tower.mjs +3 -0
  242. package/dist/mcp-server.cjs +12 -1
  243. package/package.json +2 -1
  244. package/skills/tower/SKILL.md +381 -0
  245. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-eibah._.js +0 -4
  246. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_q8qjf._.js +0 -20
  247. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vasg9u._.js +0 -3
  248. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__102siqc._.js +0 -3
  249. package/.next/standalone/.next/server/chunks/ssr/_0h0r8fk._.js +0 -7
  250. package/.next/standalone/.next/static/chunks/094hp8ak7su7z.js +0 -2
  251. package/.next/standalone/.next/static/chunks/0fe_jnfm0lqm..js +0 -5
  252. package/.next/standalone/.next/static/chunks/0lq1_ynox5frw.js +0 -1
  253. package/.next/standalone/.next/static/chunks/0qy~pj-p.oh92.js +0 -1
  254. package/.next/standalone/.next/static/chunks/0y_vg.f~zs~zl.js +0 -1
  255. package/.next/standalone/.next/static/chunks/10ih_a9~empst.js +0 -1
  256. package/.next/standalone/.next/static/chunks/16.w_z6.3sf2v.js +0 -1
  257. package/.next/standalone/.next/static/chunks/17wptayhzwy6g.js +0 -1
  258. /package/.next/standalone/.next/static/{eRr9P5hixKpzabeXJ-AvA → VGoiH5uRfCRm6SKXNPZoz}/_buildManifest.js +0 -0
  259. /package/.next/standalone/.next/static/{eRr9P5hixKpzabeXJ-AvA → VGoiH5uRfCRm6SKXNPZoz}/_clientMiddlewareManifest.js +0 -0
  260. /package/.next/standalone/.next/static/{eRr9P5hixKpzabeXJ-AvA → VGoiH5uRfCRm6SKXNPZoz}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[520788,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(940271),f=a.i(951192),g=a.i(699570),h=a.i(866718),i=a.i(429246),j=a.i(412783),k=a.i(786304),l=a.i(563658),m=a.i(814574),n=a.i(368114),o=a.i(369289),p=a.i(711796);let q=(0,p.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var r=a.i(350739);let s=(0,p.default)("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);var t=a.i(190076),u=a.i(705594),v=a.i(264589),w=a.i(54384),x=a.i(774881);let y=(0,p.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var z=a.i(975231);let A=(0,p.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),B=(0,p.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var C=a.i(704494),D=a.i(913284),E=a.i(468862),F=a.i(347165),G=a.i(374932),H=a.i(982879),I=a.i(268637),J=a.i(780410);let K=(0,J.createServerReference)("0013a3cd3a8e31b13f33788cc92b5aba4c68857cd2",J.callServer,void 0,J.findSourceMapURL,"getAvailableTerminalApps");var L=a.i(786801);let M=(0,J.createServerReference)("40c6e66ef80aea7986b4420cdb61fcc6d6e9cc8e99",J.callServer,void 0,J.findSourceMapURL,"createPrompt"),N=(0,J.createServerReference)("607103ca4af153f930a5496a43d259bd122e14a89b",J.callServer,void 0,J.findSourceMapURL,"updatePrompt"),O=(0,J.createServerReference)("40927449a65dd1de23a40d4ec3d79d50156088f42c",J.callServer,void 0,J.findSourceMapURL,"deletePrompt"),P=(0,J.createServerReference)("608fd188ffa4d0e561d9aa23f136e73fd4d0f8d919",J.callServer,void 0,J.findSourceMapURL,"setDefaultPrompt"),Q=(0,J.createServerReference)("004548f97440c3f8c00f6961bdfcc0f20b695dbf92",J.callServer,void 0,J.findSourceMapURL,"getAvailableProviders");var R=a.i(785259),S=a.i(43775);let T=(0,p.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var U=a.i(324954);let V=(0,p.default)("folder-up",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);var W=a.i(161664),X=a.i(811344),Y=a.i(607219),Z=a.i(952313);let $=(0,J.createServerReference)("40c354afc530c4f80532ed796b1e9a5cbaef47aeba",J.callServer,void 0,J.findSourceMapURL,"createBackup"),_=(0,J.createServerReference)("00f35373010efd8a38b31b6aa3439fd80d205fcc2b",J.callServer,void 0,J.findSourceMapURL,"listBackupFiles"),aa=(0,J.createServerReference)("40e0992828ece97557d5ea3f37a136770ba8d4a886",J.callServer,void 0,J.findSourceMapURL,"deleteBackupFile"),ab=(0,J.createServerReference)("405b80e1e1fca5dd7f7cb9a4a7fd2ccf8d189feb57",J.callServer,void 0,J.findSourceMapURL,"restoreBackup"),ac=(0,J.createServerReference)("409f6bbf7591f5c818d3a417bde4d1a535523b1272",J.callServer,void 0,J.findSourceMapURL,"resetSystem"),ad=(0,J.createServerReference)("00aa45fec11672448007dd3e05cb8ec9728285067b",J.callServer,void 0,J.findSourceMapURL,"getBackupDir"),ae=(0,J.createServerReference)("402eb5842ce62c26a005f13f79f07c90b18225d15e",J.callServer,void 0,J.findSourceMapURL,"setBackupDir");function af(){let{t:a,locale:e}=(0,f.useI18n)(),i=(0,d.useRouter)(),[j,k]=(0,c.useState)([]),[l,n]=(0,c.useState)(""),[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!0),[s,t]=(0,c.useState)(null),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)(""),y=(0,c.useRef)(null),[A,B]=(0,c.useState)(!1),[D,E]=(0,c.useState)(""),F=(0,c.useCallback)(async()=>{r(!0);try{let[a,b]=await Promise.all([_(),ad()]);k(a),n(b)}finally{r(!1)}},[]);(0,c.useEffect)(()=>{F()},[F]);let G=async()=>{let b=w.trim()||void 0;v(!1),x(""),t("create");try{await $(b),Z.toast.success(a("settings.backup.createSuccess")),await F()}catch{Z.toast.error(a("settings.backup.createError"))}finally{t(null)}},H=async b=>{if(confirm(a("settings.backup.restoreConfirm"))){t("restore");try{await ab(b),Z.toast.success(a("settings.backup.restoreSuccess"),{action:{label:a("settings.backup.reload"),onClick:()=>window.location.reload()},duration:15e3}),await F()}catch{Z.toast.error(a("settings.backup.restoreError"))}finally{t(null)}}},I=async b=>{if(confirm(a("settings.backup.deleteConfirm")))try{await aa(b),Z.toast.success(a("settings.backup.deleteSuccess")),k(a=>a.filter(a=>a.filename!==b))}catch{Z.toast.error(a("settings.backup.deleteError"))}},J=async b=>{p(!1);try{await ae(b),n(b),Z.toast.success(a("settings.backup.dirSaved")),await F()}catch{Z.toast.error(a("settings.backup.dirError"))}},K=async b=>{let c=b.target.files?.[0];if(c){b.target.value="",t("import");try{let b=new FormData;b.append("file",c);let d=await fetch("/api/internal/backup/import",{method:"POST",body:b});if(!d.ok){let b=await d.json();Z.toast.error("Invalid backup archive"===b.error?a("settings.backup.importInvalid"):(b.error,a("settings.backup.importError")));return}Z.toast.success(a("settings.backup.importSuccess")),await F()}catch{Z.toast.error(a("settings.backup.importError"))}finally{t(null)}}},L=async()=>{if("RESET"===D){B(!1),E(""),t("reset");try{await ac("RESET"),Z.toast.success(a("settings.backup.resetSuccess")),i.push("/")}catch{Z.toast.error(a("settings.backup.resetError"))}finally{t(null)}}},M=null!==s;return(0,b.jsxs)("div",{className:"space-y-6",children:[("restore"===s||"reset"===s)&&(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:(0,b.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,b.jsx)(C.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"restore"===s?a("settings.backup.restoring"):a("settings.backup.resetting")})]})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-base font-semibold",children:a("settings.backup.sectionTitle")}),(0,b.jsxs)("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{children:[a("settings.backup.dir"),":"]}),(0,b.jsx)("code",{className:"rounded bg-muted px-2 py-0.5 text-xs",children:l}),(0,b.jsx)(g.Button,{variant:"ghost",onClick:()=>p(!0),className:"text-xs text-muted-foreground",children:a("settings.backup.dirChange")})]}),(0,b.jsx)(S.FolderBrowserDialog,{open:o,onOpenChange:p,onSelect:J})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(g.Button,{onClick:()=>{x(""),v(!0)},disabled:M,className:"gap-2",children:"create"===s?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-4 w-4 animate-spin"})," ",a("settings.backup.creating")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(T,{className:"h-4 w-4"})," ",a("settings.backup.create")]})}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsxs)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"outline",disabled:M,onClick:()=>y.current?.click(),className:"gap-2"}),children:[(0,b.jsx)(V,{className:"h-4 w-4"}),a("settings.backup.import")]}),(0,b.jsx)(R.TooltipContent,{side:"bottom",sideOffset:4,children:a("settings.backup.importHint")})]}),(0,b.jsx)("input",{ref:y,type:"file",accept:".tar.gz,.gz",className:"hidden",onChange:K})]}),(0,b.jsx)(m.Dialog,{open:u,onOpenChange:v,children:(0,b.jsxs)(m.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(m.DialogHeader,{children:(0,b.jsx)(m.DialogTitle,{children:a("settings.backup.create")})}),(0,b.jsxs)("div",{className:"py-2",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.backup.createLabel")}),(0,b.jsx)(h.Input,{value:w,onChange:a=>x(a.target.value),onKeyDown:a=>"Enter"===a.key&&G(),placeholder:a("settings.backup.createLabelPlaceholder"),className:"mt-1.5",autoFocus:!0})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>v(!1),children:a("common.cancel")}),(0,b.jsx)(g.Button,{onClick:G,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:a("settings.backup.create")})]})]})}),q?(0,b.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,b.jsx)(C.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===j.length?(0,b.jsxs)("div",{className:"flex flex-col items-center gap-2 py-12 text-center",children:[(0,b.jsx)(Y.Archive,{className:"h-10 w-10 text-muted-foreground/30"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:a("settings.backup.empty")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:a("settings.backup.emptyDesc")})]}):(0,b.jsx)("div",{className:"space-y-3",children:j.map(c=>{var d,f;return(0,b.jsx)("div",{className:"group rounded-lg border border-border bg-card p-4 transition-colors hover:bg-accent/30",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[c.label?(0,b.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:c.label}):(0,b.jsx)("span",{className:"truncate text-sm font-medium font-mono text-foreground",children:c.filename}),c.autoBackup&&(0,b.jsx)("span",{className:"shrink-0 rounded-full bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-500 ring-1 ring-amber-500/20",children:a("settings.backup.autoLabel")})]}),c.label&&(0,b.jsx)("div",{className:"mt-0.5 text-[11px] font-mono text-muted-foreground/60",children:c.filename}),(0,b.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:[(d=c.size)<1024?`${d} B`:d<1048576?`${(d/1024).toFixed(1)} KB`:`${(d/1048576).toFixed(1)} MB`," · ",(f=c.createdAt,new Date(f).toLocaleString("zh"===e?"zh-CN":"en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}))]}),c.preview.length>0&&(0,b.jsxs)("div",{className:"mt-1.5 text-xs text-muted-foreground",children:[c.preview.map((a,c)=>(0,b.jsxs)("span",{children:[c>0&&" ",a.workspace,"(",a.projects.join(", "),")"]},c)),c.stats.workspaces>c.preview.length&&(0,b.jsxs)("span",{children:[" ",a("settings.backup.workspaces",{count:String(c.stats.workspaces)})]})]}),(0,b.jsxs)("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[a("settings.backup.projects",{count:String(c.stats.projects)})," · ",a("settings.backup.tasks",{count:String(c.stats.tasks)})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-xs",onClick:()=>H(c.filename),disabled:M,className:"text-muted-foreground hover:text-foreground"}),children:(0,b.jsx)(U.Upload,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(R.TooltipContent,{side:"bottom",sideOffset:4,children:a("settings.backup.restore")})]}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-xs",onClick:()=>I(c.filename),disabled:M,className:"text-muted-foreground hover:text-rose-400"}),children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(R.TooltipContent,{side:"bottom",sideOffset:4,children:a("settings.backup.delete")})]})]})]})},c.filename)})}),(0,b.jsxs)("div",{className:"border-t border-border pt-6",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-rose-400",children:[(0,b.jsx)(X.AlertTriangle,{className:"h-4 w-4"}),a("settings.backup.dangerZone")]}),(0,b.jsx)("p",{className:"mt-2 text-xs text-muted-foreground leading-relaxed",children:a("settings.backup.resetDesc")}),(0,b.jsxs)(g.Button,{variant:"outline",onClick:()=>{E(""),B(!0)},disabled:M,className:"mt-3 border-rose-500/30 text-rose-400 hover:bg-rose-500/10 hover:text-rose-400",children:[(0,b.jsx)(W.RotateCcw,{className:"mr-2 h-3.5 w-3.5"}),a("settings.backup.reset")]})]}),(0,b.jsx)(m.Dialog,{open:A,onOpenChange:B,children:(0,b.jsxs)(m.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:a("settings.backup.resetConfirmTitle")}),(0,b.jsx)(m.DialogDescription,{children:a("settings.backup.resetConfirmDesc")})]}),(0,b.jsxs)("div",{className:"py-2",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.backup.resetConfirmInput")}),(0,b.jsx)(h.Input,{value:D,onChange:a=>E(a.target.value),placeholder:"RESET",className:"mt-1.5 font-mono"})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>B(!1),children:a("common.cancel")}),(0,b.jsx)(g.Button,{disabled:"RESET"!==D,onClick:L,className:"border-rose-500/30 bg-rose-500/10 text-rose-400 hover:bg-rose-500/20",children:a("settings.backup.reset")})]})]})})]})}var ag=a.i(953093);let ah=(0,p.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var ai=a.i(963326),aj=a.i(192369),ak=a.i(627141);function al({extension:a}){let{t:d}=(0,f.useI18n)(),{status:e,loading:h,isInstalling:i,install:j,uninstall:k,refresh:l}=(0,ak.useExtension)(a.id),[m,n]=(0,c.useState)(!1),o=a.icon,p=e.installed,q=async()=>{let b=await j();b.success?Z.toast.success(d("settings.extensions.installSuccess").replace("{name}",a.name)):Z.toast.error(d("settings.extensions.installFailed").replace("{name}",a.name)+(b.error?`: ${b.error.slice(0,200)}`:""))},r=async()=>{let b=await k();b.success?Z.toast.success(d("settings.extensions.uninstallSuccess").replace("{name}",a.name)):Z.toast.error(d("settings.extensions.uninstallFailed").replace("{name}",a.name)+(b.error?`: ${b.error.slice(0,200)}`:""))},s=async()=>{n(!0);try{await l()}finally{n(!1)}};return(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-background ring-1 ring-border",children:(0,b.jsx)(o,{className:"h-5 w-5 text-muted-foreground"})}),(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:a.name}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.description})]})]}),(0,b.jsxs)("span",{className:"shrink-0 rounded-md bg-background px-2 py-0.5 text-xs text-muted-foreground ring-1 ring-border",children:["~",a.sizeMB," MB"]})]}),(0,b.jsx)("div",{className:"mt-4 flex items-center gap-2 text-xs",children:h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:d("common.loading")})]}):p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(D.CheckCircle2,{className:"h-3.5 w-3.5 text-emerald-500"}),(0,b.jsxs)("span",{className:"text-foreground",children:[d("settings.extensions.installed"),e.version?` v${e.version}`:""]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ah,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:d("settings.extensions.notInstalledShort")})]})}),(0,b.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(g.Button,{variant:"default",onClick:q,disabled:i,children:i?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),d("settings.extensions.reinstalling")]}):d("settings.extensions.reinstall")}),(0,b.jsx)(g.Button,{variant:"outline",onClick:r,disabled:i,children:i?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),d("settings.extensions.uninstalling")]}):d("settings.extensions.uninstall")})]}):(0,b.jsx)(g.Button,{variant:"default",onClick:q,disabled:i,children:i?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),d("settings.extensions.installing")]}):d("settings.extensions.install")}),(0,b.jsxs)(g.Button,{variant:"ghost",onClick:s,disabled:m,children:[(0,b.jsx)(aj.RefreshCw,{className:`h-3.5 w-3.5 ${m?"animate-spin":""}`}),d("settings.extensions.recheck")]}),(0,b.jsxs)(g.Button,{variant:"ghost",onClick:()=>{window.open(a.homepageUrl,"_blank","noopener,noreferrer")},children:[(0,b.jsx)(ai.ExternalLink,{className:"h-3.5 w-3.5"}),d("settings.extensions.visitHomepage")]})]})]})}function am(){let{t:a}=(0,f.useI18n)(),c=(0,ag.listExtensionMetadata)();return(0,b.jsxs)("div",{className:"space-y-5",children:[(0,b.jsxs)("header",{children:[(0,b.jsx)("h2",{className:"text-base font-semibold",children:a("settings.extensions.title")}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a("settings.extensions.desc")})]}),(0,b.jsx)("div",{className:"space-y-3",children:c.map(a=>(0,b.jsx)(al,{extension:a},a.id))})]})}function an({options:a,value:c,onChange:d}){return(0,b.jsx)("div",{className:"inline-flex rounded-lg border border-border/50 bg-muted/30 p-1 gap-0.5",children:a.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>d(a.value),className:(0,n.cn)("rounded-md px-3.5 py-1.5 text-sm font-medium transition-all duration-200 cursor-pointer",c===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value))})}function ao({label:a,description:c,children:d,className:e}){return(0,b.jsxs)("div",{className:(0,n.cn)("flex items-center justify-between py-4 border-b border-border/50 last:border-0",e),children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:a}),c&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:c})]}),(0,b.jsx)("div",{className:"shrink-0",children:d})]})}let ap=[{id:"general",labelKey:"settings.general",descKey:"settings.generalDesc",icon:o.Settings,accent:"blue"},{id:"ai-tools",labelKey:"settings.aiTools.title",descKey:"settings.aiTools.cliVerificationDesc",icon:q,accent:"emerald"},{id:"prompts",labelKey:"settings.prompts",descKey:"settings.promptsDesc",icon:r.FileText,accent:"violet"},{id:"config",labelKey:"settings.config",descKey:"settings.configDesc",icon:s,accent:"amber"},{id:"extensions",labelKey:"settings.extensions.title",descKey:"settings.extensions.navDesc",icon:v.Package,accent:"indigo"},{id:"notifications",labelKey:"settings.notifications.title",descKey:"settings.notifications.navDesc",icon:t.Bell,accent:"rose"},{id:"backup",labelKey:"settings.backup.title",descKey:"settings.backup.navDesc",icon:u.HardDrive,accent:"cyan"}],aq={blue:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},emerald:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},violet:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},amber:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},cyan:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},rose:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},indigo:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"}},ar="ai-manager:default-cli-adapter",as={host:"",ownerMatch:"*",localPathTemplate:"",priority:0};function at(){let a=(0,d.useRouter)(),{t:o}=(0,f.useI18n)(),{theme:p,setTheme:q}=(0,e.useTheme)(),{locale:r,setLocale:s}=(0,f.useI18n)(),[t,u]=(0,c.useState)("general"),v=(0,c.useRef)(null),[J,T]=(0,c.useState)({left:0,width:0}),[U,V]=(0,c.useState)(!1),[W,X]=(0,c.useState)("Terminal"),[Y,Z]=(0,c.useState)([]),[$,_]=(0,c.useState)(180),[aa,ab]=(0,c.useState)([]),[ac,ad]=(0,c.useState)("claude"),[ae,ag]=(0,c.useState)(null),[ah,ai]=(0,c.useState)({}),[aj,ak]=(0,c.useState)([]),[al,at]=(0,c.useState)(!1),[au,av]=(0,c.useState)(null),[aw,ax]=(0,c.useState)(null),[ay,az]=(0,c.useState)(""),[aA,aB]=(0,c.useState)(""),[aC,aD]=(0,c.useState)(""),[aE,aF]=(0,c.useState)([]),[aG,aH]=(0,c.useState)(null),[aI,aJ]=(0,c.useState)({...as}),[aK,aL]=(0,c.useState)(!1),[aM,aN]=(0,c.useState)({...as}),[aO,aP]=(0,c.useState)(!1),[aQ,aR]=(0,c.useState)(!1),[aS,aT]=(0,c.useState)(0),[aU,aV]=(0,c.useState)(null),[aW,aX]=(0,c.useState)(null),[aY,aZ]=(0,c.useState)({maxUploadMb:50,maxConcurrent:3,maxReadableMb:5}),[a$,a_]=(0,c.useState)({timeoutSec:30}),[a0,a1]=(0,c.useState)({resultLimit:20,allModeCap:5,debounceMs:250,snippetLength:80,codeTimeoutSec:30}),[a2,a3]=(0,c.useState)({minCols:1,maxCols:5,minRows:1,maxRows:5}),[a4,a5]=(0,c.useState)(null),[a6,a7]=(0,c.useState)(!1),[a8,a9]=(0,c.useState)(""),[ba,bb]=(0,c.useState)(!0);(0,c.useEffect)(()=>V(!0),[]),(0,c.useEffect)(()=>{(0,G.getConfigValue)("terminal.app","Terminal").then(X),(0,G.getConfigValue)("terminal.idleTimeoutSec",180).then(_),K().then(Z)},[]),(0,c.useEffect)(()=>{Q().then(ab);let a=localStorage.getItem(ar);a&&ad(a)},[]),(0,c.useEffect)(()=>{(0,L.getPrompts)().then(ak)},[]);let bc=async()=>{try{let a=await fetch("/api/internal/hooks/install");if(a.ok){let b=await a.json();a5(b)}}catch{}};async function bd(){await (0,H.setConfigValue)("terminal.app",W)}async function be(){let a=Math.max(180,$);_(a),await (0,H.setConfigValue)("terminal.idleTimeoutSec",a)}async function bf(a){if(!ae){ag(a),ai(b=>{let c={...b};return delete c[a],c});try{let b=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a})}),c=await b.json();ai(b=>({...b,[a]:c}))}catch{ai(b=>({...b,[a]:{ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]}}))}finally{ag(null)}}}(0,c.useEffect)(()=>{(0,G.getConfigValue)("git.pathMappingRules",[]).then(a=>{let b=new Set,c=!1,d=a.map(a=>{if(!a.id||b.has(a.id)){c=!0;let d={...a,id:crypto.randomUUID()};return b.add(d.id),d}return b.add(a.id),a});aF(d),c&&(0,H.setConfigValue)("git.pathMappingRules",d)}),(0,G.getConfigValue)("hooks.autoUploadTypes",["png","jpg","jpeg","gif","webp","svg","pdf","md","txt","json"]).then(a=>{a9(a.join(", "))}),bc(),(0,I.getConfigValues)(["system.maxUploadBytes","system.maxConcurrentExecutions","system.maxReadableFileBytes","git.timeoutSec","search.resultLimit","search.allModeCap","search.debounceMs","search.snippetLength","search.codeTimeoutSec","missions.grid.minCols","missions.grid.maxCols","missions.grid.minRows","missions.grid.maxRows"]).then(a=>{let b=a["system.maxUploadBytes"]??0x3200000,c=a["system.maxReadableFileBytes"]??5242880;aZ({maxUploadMb:Math.round(b/1024/1024),maxConcurrent:a["system.maxConcurrentExecutions"]??3,maxReadableMb:Math.round(c/1024/1024)}),a_({timeoutSec:a["git.timeoutSec"]??30}),a1({resultLimit:a["search.resultLimit"]??20,allModeCap:a["search.allModeCap"]??5,debounceMs:a["search.debounceMs"]??250,snippetLength:a["search.snippetLength"]??80,codeTimeoutSec:a["search.codeTimeoutSec"]??30}),a3({minCols:a["missions.grid.minCols"]??1,maxCols:a["missions.grid.maxCols"]??5,minRows:a["missions.grid.minRows"]??1,maxRows:a["missions.grid.maxRows"]??5})})},[]),(0,c.useEffect)(()=>{(0,G.getConfigValue)("notification.enabled",!0).then(bb)},[]);let bg=(0,c.useCallback)(()=>{av(null),az(""),aB(""),aD(""),at(!0)},[]),bh=(0,c.useCallback)(a=>{av(a),az(a.name),aB(a.description??""),aD(a.content),at(!0)},[]),bi=(0,c.useCallback)(async()=>{ay.trim()&&aC.trim()&&(au?await N(au.id,{name:ay.trim(),description:aA.trim()||void 0,content:aC.trim()}):await M({name:ay.trim(),description:aA.trim()||void 0,content:aC.trim()}),at(!1),ak(await (0,L.getPrompts)()),a.refresh())},[ay,aA,aC,au,a]),bj=(0,c.useCallback)(async()=>{aw&&(await O(aw),ax(null),ak(await (0,L.getPrompts)()),a.refresh())},[aw,a]),bk=(0,c.useCallback)(async b=>{await P(b),ak(await (0,L.getPrompts)()),a.refresh()},[a]),bl=async()=>{await (0,H.setConfigValue)("system.maxUploadBytes",1024*aY.maxUploadMb*1024),await (0,H.setConfigValue)("system.maxConcurrentExecutions",aY.maxConcurrent),await (0,H.setConfigValue)("system.maxReadableFileBytes",1024*aY.maxReadableMb*1024)},bm=async()=>{await (0,H.setConfigValue)("git.timeoutSec",a$.timeoutSec)},bn=async()=>{await (0,H.setConfigValue)("search.resultLimit",a0.resultLimit),await (0,H.setConfigValue)("search.allModeCap",a0.allModeCap),await (0,H.setConfigValue)("search.debounceMs",a0.debounceMs),await (0,H.setConfigValue)("search.snippetLength",a0.snippetLength),await (0,H.setConfigValue)("search.codeTimeoutSec",a0.codeTimeoutSec)},bo=async()=>{let a=Math.min(a2.minCols,a2.maxCols),b=Math.max(a2.minCols,a2.maxCols),c=Math.min(a2.minRows,a2.maxRows),d=Math.max(a2.minRows,a2.maxRows);a3({minCols:a,maxCols:b,minRows:c,maxRows:d}),await (0,H.setConfigValue)("missions.grid.minCols",a),await (0,H.setConfigValue)("missions.grid.maxCols",b),await (0,H.setConfigValue)("missions.grid.minRows",c),await (0,H.setConfigValue)("missions.grid.maxRows",d)},bp=async()=>{let a=a8.split(",").map(a=>a.trim()).filter(Boolean);await (0,H.setConfigValue)("hooks.autoUploadTypes",a)},bq=async()=>{if(a4){a7(!0);try{let a=a4.installed?"DELETE":"POST";await fetch("/api/internal/hooks/install",{method:a}),await bc()}finally{a7(!1)}}},br=async()=>{if(!aM.host.trim()||!aM.localPathTemplate.trim())return;let a=aM.localPathTemplate.trim().replace(/\/+$/,""),b=aO?`${a}/{path}`:a,c=[...aE,{id:crypto.randomUUID(),host:aM.host.trim(),ownerMatch:aM.ownerMatch.trim()||"*",localPathTemplate:b,priority:aM.priority}];await (0,H.setConfigValue)("git.pathMappingRules",c),aF(c),aN({...as}),aP(!1),aL(!1)},bs=async a=>{if(!aI.host.trim()||!aI.localPathTemplate.trim())return;let b=aI.localPathTemplate.trim().replace(/\/+$/,""),c=aQ?`${b}/{path}`:b,d=aE.map(b=>b.id===a?{...b,host:aI.host.trim(),ownerMatch:aI.ownerMatch.trim()||"*",localPathTemplate:c,priority:aI.priority}:b);await (0,H.setConfigValue)("git.pathMappingRules",d),aF(d),aH(null),aR(!1)},bt=async a=>{let b=aE.filter(b=>b.id!==a);await (0,H.setConfigValue)("git.pathMappingRules",b),aF(b),aV(null)};async function bu(){let a=!ba;bb(a),await (0,H.setConfigValue)("notification.enabled",a)}let bv=(0,c.useCallback)(()=>{a.back()},[a]);(0,c.useEffect)(()=>{let a=v.current;if(!a)return;let b=a.querySelector(`[data-section="${t}"]`);if(!b)return;let c=a.getBoundingClientRect(),d=b.getBoundingClientRect();T({left:d.left-c.left,width:d.width})},[t]);let bw=ap.find(a=>a.id===t),bx=bw?aq[bw.accent]:aq.blue;return(0,b.jsxs)("div",{className:"flex h-full flex-col bg-background",children:[(0,b.jsx)("div",{className:"flex-shrink-0 border-b bg-card/50 backdrop-blur-sm",children:(0,b.jsxs)("div",{className:"mx-auto max-w-5xl px-6",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between pb-3 pt-5",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:o("settings.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:o("settings.configDesc")})]}),(0,b.jsxs)(g.Button,{variant:"outline",onClick:bv,className:"gap-1.5 bg-card shadow-sm cursor-pointer",children:[(0,b.jsx)(w.X,{className:"h-3.5 w-3.5"}),"ESC"]})]}),(0,b.jsxs)("div",{ref:v,className:"relative flex gap-1 overflow-x-auto",children:[ap.map(a=>{let c=a.icon,d=t===a.id,e=aq[a.accent];return(0,b.jsxs)("button",{"data-section":a.id,onClick:()=>u(a.id),className:(0,n.cn)("relative flex items-center gap-2 rounded-t-lg px-4 py-2.5","text-sm font-medium whitespace-nowrap cursor-pointer","transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",d?`${e.text} bg-background`:"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[(0,b.jsx)("span",{className:(0,n.cn)("flex h-6 w-6 items-center justify-center rounded-md","transition-colors duration-200",d?e.bg:"bg-transparent"),children:(0,b.jsx)(c,{className:"h-3.5 w-3.5"})}),(0,b.jsx)("span",{children:o(a.labelKey)})]},a.id)}),(0,b.jsx)("div",{className:(0,n.cn)("absolute bottom-0 h-0.5 rounded-full","transition-all duration-250 ease-out",bx.indicator),style:{left:J.left,width:J.width}})]})]})}),(0,b.jsx)("div",{className:"flex-1 overflow-auto",children:(0,b.jsxs)("div",{className:"mx-auto max-w-4xl px-6 py-8",children:[bw&&(0,b.jsxs)("div",{className:"mb-6 flex items-start gap-4",children:[(0,b.jsx)("div",{className:(0,n.cn)("flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-xl","ring-1",bx.bg,bx.text,bx.ring),children:(0,b.jsx)(bw.icon,{className:"h-5 w-5"})}),(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold leading-tight",children:o(bw.labelKey)}),(0,b.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:o(bw.descKey)})]})]}),(0,b.jsx)("div",{className:"mb-6 border-t"}),function(){switch(t){case"general":let a;return a=[{value:"light",label:o("settings.themeLight")},{value:"dark",label:o("settings.themeDark")},{value:"system",label:o("settings.themeSystem")}],(0,b.jsxs)("div",{className:"divide-y divide-border/50",children:[(0,b.jsx)(ao,{label:o("settings.theme"),description:o("settings.themeDesc"),children:U?(0,b.jsx)(an,{options:a,value:p??"system",onChange:a=>q(a)}):(0,b.jsx)("div",{className:"inline-flex h-9 rounded-lg border border-border/50 bg-muted/30 p-1 w-[200px]"})}),(0,b.jsx)(ao,{label:o("settings.language"),description:o("settings.languageDesc"),children:(0,b.jsx)(an,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}],value:r,onChange:a=>s(a)})}),(0,b.jsxs)("div",{className:"py-4 border-b border-border/50",children:[(0,b.jsx)("div",{className:"flex items-center justify-between",children:(0,b.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:o("settings.terminal.label")}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:o("settings.terminal.desc")})]})}),(0,b.jsxs)("div",{className:"mt-3 flex flex-col gap-2",children:[Y.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-2",children:Y.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>{X(a.value),(0,H.setConfigValue)("terminal.app",a.value)},className:(0,n.cn)("rounded-lg border px-3.5 py-1.5 text-xs font-medium transition-all duration-200 cursor-pointer",W===a.value?"border-foreground bg-accent text-foreground font-medium":"border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:a.name},a.value))}),(0,b.jsx)("input",{type:"text",value:W,onChange:a=>X(a.target.value),onBlur:bd,placeholder:o("settings.terminal.placeholder"),className:"h-9 w-64 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500/30"})]})]}),(0,b.jsx)(ao,{label:o("settings.terminal.idleTimeout"),description:o("settings.terminal.idleTimeoutDesc"),children:(0,b.jsx)("input",{type:"number",value:$,onChange:a=>_(Number(a.target.value)),onBlur:be,min:180,className:"h-9 w-28 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm text-right focus:outline-none focus:ring-2 focus:ring-blue-500/30"})})]});case"ai-tools":return(0,b.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:aa.map(a=>{let c=ac===a.name,d=ae===a.name,e=ah[a.name];return(0,b.jsx)("li",{children:(0,b.jsxs)("div",{className:"px-5 py-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium",children:a.displayName}),(0,b.jsx)(k.Badge,{variant:"outline",children:o("label.builtin")}),c&&(0,b.jsxs)(k.Badge,{variant:"secondary",className:"shrink-0",children:[(0,b.jsx)(y,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),o("settings.prompts.default")]}),e&&(0,b.jsx)(k.Badge,{variant:e.ok?"secondary":"destructive",className:(0,n.cn)("shrink-0",e.ok&&"bg-green-600 text-white hover:bg-green-700"),children:e.ok?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(D.CheckCircle2,{className:"h-3 w-3 mr-1"}),o("settings.aiTools.testPassed")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(E.XCircle,{className:"h-3 w-3 mr-1"}),o("settings.aiTools.testFailed")]})})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.cli.available&&a.cli.version?`${a.name} \xb7 ${a.cli.version}`:a.name})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[!c&&(0,b.jsxs)(g.Button,{variant:"outline",size:"sm",onClick:()=>{var b;ad(b=a.name),localStorage.setItem(ar,b)},children:[(0,b.jsx)(y,{className:"h-3.5 w-3.5 mr-1.5 text-muted-foreground"}),o("settings.prompts.setDefault")]}),(0,b.jsx)(g.Button,{variant:"outline",size:"sm",onClick:()=>bf(a.name),disabled:d,children:d?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),o("settings.aiTools.testing")]}):o("settings.aiTools.testConnection")})]})]}),e&&(0,b.jsx)("div",{className:"mt-3 rounded-md border border-border bg-muted/30 px-4 py-3",children:(0,b.jsx)("div",{className:"space-y-1.5",children:e.checks.map(c=>(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,b.jsx)("span",{className:(0,n.cn)("w-1.5 h-1.5 rounded-full shrink-0",c.passed?"bg-green-500":"bg-red-500")}),(0,b.jsx)("span",{className:(0,n.cn)(c.passed?"text-foreground":"text-red-700 dark:text-red-300"),children:c.message})]},`${a.name}-${c.name}`))})})]})},a.name)})});case"prompts":return U?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("div",{className:"flex justify-end",children:(0,b.jsxs)(g.Button,{onClick:bg,variant:"default",children:[(0,b.jsx)(x.Plus,{className:"h-4 w-4 mr-2"}),o("settings.prompts.newPrompt")]})}),0===aj.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center rounded-lg border border-dashed border-border/50",children:[(0,b.jsx)("p",{className:"text-muted-foreground",children:o("settings.prompts.empty")}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:o("settings.prompts.emptyHint")})]}):(0,b.jsx)("div",{className:"rounded-xl border border-border/50 divide-y divide-border/50",children:aj.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate",children:a.name}),a.isDefault&&(0,b.jsxs)(k.Badge,{variant:"secondary",className:"shrink-0 rounded-full text-xs",children:[(0,b.jsx)(y,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),o("settings.prompts.default")]})]}),a.description&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:a.description})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 ml-4",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>bk(a.id),title:o("settings.prompts.setDefault"),children:(0,b.jsx)(y,{className:(0,n.cn)("h-4 w-4",a.isDefault?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>bh(a),title:o("settings.prompts.editPrompt"),children:(0,b.jsx)(A,{className:"h-4 w-4"})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>ax(a.id),className:"text-destructive",title:o("settings.prompts.delete"),children:(0,b.jsx)(z.Trash2,{className:"h-4 w-4"})})]})]},a.id))}),(0,b.jsx)(m.Dialog,{open:al,onOpenChange:at,children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:au?o("settings.prompts.editPrompt"):o("settings.prompts.newPrompt")}),(0,b.jsx)(m.DialogDescription,{children:au?o("settings.prompts.editPrompt"):o("settings.prompts.newPrompt")})]}),(0,b.jsxs)("div",{className:"space-y-4 py-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-name",children:o("settings.prompts.promptName")}),(0,b.jsx)(h.Input,{id:"prompt-name",value:ay,onChange:a=>az(a.target.value),placeholder:o("settings.prompts.promptNamePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-description",children:o("settings.prompts.promptDescription")}),(0,b.jsx)(h.Input,{id:"prompt-description",value:aA,onChange:a=>aB(a.target.value),placeholder:o("settings.prompts.promptDescriptionPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-content",children:o("settings.prompts.promptContent")}),(0,b.jsx)(i.Textarea,{id:"prompt-content",value:aC,onChange:a=>aD(a.target.value),placeholder:o("settings.prompts.promptContentPlaceholder"),rows:8,className:"mt-1.5 font-mono text-sm"})]})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>at(!1),children:o("settings.prompts.cancel")}),(0,b.jsx)(g.Button,{onClick:bi,disabled:!ay.trim()||!aC.trim(),children:o("settings.prompts.save")})]})]})}),(0,b.jsx)(m.Dialog,{open:!!aw,onOpenChange:a=>!a&&ax(null),children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:o("settings.prompts.deleteConfirmTitle")}),(0,b.jsx)(m.DialogDescription,{children:o("settings.prompts.deleteConfirmMessage")})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>ax(null),children:o("settings.prompts.cancel")}),(0,b.jsx)(g.Button,{variant:"destructive",onClick:bj,children:o("settings.prompts.delete")})]})]})})]}):(0,b.jsx)("div",{className:"h-32 rounded-lg bg-muted animate-pulse"});case"config":let c,d,e;return(0,b.jsxs)("div",{className:"space-y-8",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.git.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.git.desc")})]}),(0,b.jsxs)(g.Button,{onClick:()=>{aN({...as}),aL(!0)},children:[(0,b.jsx)(x.Plus,{className:"mr-2 h-4 w-4"}),o("settings.config.git.addRule")]})]}),(0,b.jsxs)("div",{className:"space-y-3",children:[0!==aE.length||aK?(0,b.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:aE.map(a=>aG===a.id?(0,b.jsxs)("li",{className:"px-5 py-4 bg-muted/20",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs text-muted-foreground",children:o("settings.config.git.host")}),(0,b.jsx)(h.Input,{value:aI.host,onChange:a=>aJ(b=>({...b,host:a.target.value})),placeholder:o("settings.config.git.hostPlaceholder"),className:"text-sm"})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs text-muted-foreground",children:o("settings.config.git.ownerMatch")}),(0,b.jsx)(h.Input,{value:aI.ownerMatch,onChange:a=>aJ(b=>({...b,ownerMatch:a.target.value})),placeholder:o("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]}),(0,b.jsxs)("div",{className:"space-y-1.5 col-span-2",children:[(0,b.jsx)("label",{className:"block text-xs text-muted-foreground",children:o("settings.config.git.localPathTemplate")}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{value:aI.localPathTemplate,onChange:a=>aJ(b=>({...b,localPathTemplate:a.target.value})),placeholder:o("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono flex-1"}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:aQ?"default":"outline",size:"sm",type:"button",onClick:()=>aR(a=>!a),className:"shrink-0 font-mono",children:"{path}"})}),(0,b.jsx)(R.TooltipContent,{side:"top",className:"max-w-xs",children:(0,b.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,b.jsx)("div",{className:"font-medium",children:o("settings.config.git.pathTooltipTitle")}),(0,b.jsx)("div",{className:"opacity-80",children:o("settings.config.git.pathTooltipDetail")})]})})]}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"outline",size:"icon",type:"button",onClick:()=>aX("edit"),children:(0,b.jsx)(F.FolderOpen,{className:"h-4 w-4"})})}),(0,b.jsx)(R.TooltipContent,{children:o("settings.config.git.pickFolder")})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:aQ?o("onboarding.step3.pathHintFull"):o("onboarding.step3.pathHintRepo")})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs text-muted-foreground",children:o("settings.config.git.priority")}),(0,b.jsx)(h.Input,{type:"number",value:aI.priority,onChange:a=>aJ(b=>({...b,priority:Number(a.target.value)})),className:"text-sm w-24"})]})]}),(0,b.jsxs)("div",{className:"flex justify-end gap-2 mt-3",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"sm",onClick:()=>{aH(null),aR(!1)},children:o("settings.config.git.cancel")}),(0,b.jsx)(g.Button,{size:"sm",onClick:()=>bs(a.id),children:o("settings.config.git.save")})]})]},a.id):(0,b.jsx)("li",{className:"group px-5 py-4 hover:bg-muted/20 transition-colors",children:(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium text-sm",children:a.host}),"*"!==a.ownerMatch&&(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:["/ ",a.ownerMatch]}),(0,b.jsxs)(k.Badge,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:[o("settings.config.git.priority")," ",a.priority]})]}),(0,b.jsx)("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground truncate",children:a.localPathTemplate})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{let b,c,d;return b=a.localPathTemplate,d=(c=/\/\{path\}\/?$/.test(b))?b.replace(/\/?\{path\}\/?$/,"").replace(/\/+$/,""):b,void(aH(a.id),aJ({host:a.host,ownerMatch:a.ownerMatch,localPathTemplate:d,priority:a.priority}),aR(c))},title:o("settings.config.git.edit"),children:(0,b.jsx)(A,{className:"h-4 w-4"})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>aV(a.id),className:"text-destructive",title:o("settings.config.git.delete"),children:(0,b.jsx)(z.Trash2,{className:"h-4 w-4"})})]})]})},a.id))}):(0,b.jsx)("div",{className:"rounded-xl border border-dashed border-border p-8 text-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:o("settings.config.git.noRules")})}),aK&&(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/20 p-5 space-y-4",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.host")}),(0,b.jsx)(h.Input,{value:aM.host,onChange:a=>aN(b=>({...b,host:a.target.value})),placeholder:o("settings.config.git.hostPlaceholder"),className:"text-sm",autoFocus:!0})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.ownerMatch")}),(0,b.jsx)(h.Input,{value:aM.ownerMatch,onChange:a=>aN(b=>({...b,ownerMatch:a.target.value})),placeholder:o("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs font-medium",children:o("settings.config.git.localPathTemplate")}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{value:aM.localPathTemplate,onChange:a=>aN(b=>({...b,localPathTemplate:a.target.value})),placeholder:o("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono flex-1"}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:aO?"default":"outline",size:"sm",type:"button",onClick:()=>aP(a=>!a),className:"shrink-0 font-mono",children:"{path}"})}),(0,b.jsx)(R.TooltipContent,{side:"top",className:"max-w-xs",children:(0,b.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,b.jsx)("div",{className:"font-medium",children:o("settings.config.git.pathTooltipTitle")}),(0,b.jsx)("div",{className:"opacity-80",children:o("settings.config.git.pathTooltipDetail")})]})})]}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"outline",size:"icon",type:"button",onClick:()=>aX("add"),children:(0,b.jsx)(F.FolderOpen,{className:"h-4 w-4"})})}),(0,b.jsx)(R.TooltipContent,{children:o("settings.config.git.pickFolder")})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:aO?o("onboarding.step3.pathHintFull"):o("onboarding.step3.pathHintRepo")})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs font-medium",children:o("settings.config.git.priority")}),(0,b.jsx)(h.Input,{type:"number",value:aM.priority,onChange:a=>aN(b=>({...b,priority:Number(a.target.value)})),className:"text-sm w-24"})]}),aM.localPathTemplate&&(c=aM.localPathTemplate.trim().replace(/\/+$/,""),d=aO?`${c}/{path}`:c,e=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,b.jsxs)("div",{className:"rounded-lg bg-muted/40 border border-border px-4 py-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:o("onboarding.step3.previewLabel")}),(0,b.jsx)("div",{className:"flex gap-1",children:e.map((a,c)=>(0,b.jsx)("button",{type:"button",onClick:()=>aT(c),className:(0,n.cn)("rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors cursor-pointer",aS===c?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"),children:a.label},c))})]}),(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:e[aS].url}),(0,b.jsxs)("p",{className:"font-mono text-sm",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,b.jsx)("span",{className:"text-foreground font-medium",children:function(a,b){if(!a||!b)return"";let c=b.trim(),d=[],e=c.match(/^git@[^:]+:(.+)$/);if(e)d=e[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let a=new URL(c);d=decodeURIComponent(a.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!d.length)return"";let f=d[0],g=d[d.length-1],h=d.join("/");if(a.includes("{path}"))return a.replace("{path}",h).replace("{owner}",f).replace("{repo}",g).replace(/\/+$/,"");let i=a.replace("{owner}",f).replace("{repo}","").replace(/\/+$/,"");return`${i}/${g}`}(d,e[aS].url)})]})]})]})),(0,b.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"sm",onClick:()=>aL(!1),children:o("settings.config.git.cancel")}),(0,b.jsxs)(g.Button,{size:"sm",onClick:br,disabled:!aM.host.trim()||!aM.localPathTemplate.trim(),children:[(0,b.jsx)(B,{className:"h-3.5 w-3.5 mr-1.5"}),o("settings.config.git.save")]})]})]})]})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.system.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.system.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxUpload")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxUploadHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:1,max:500,value:aY.maxUploadMb,onChange:a=>aZ(b=>({...b,maxUploadMb:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"MB"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxConcurrent")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxConcurrentHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aY.maxConcurrent,onChange:a=>aZ(b=>({...b,maxConcurrent:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxReadable")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxReadableHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:1,max:50,value:aY.maxReadableMb,onChange:a=>aZ(b=>({...b,maxReadableMb:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"MB"})]})]})]}),(0,b.jsx)(g.Button,{onClick:bl,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.gitParams.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.gitParams.desc")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.gitParams.timeout")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.gitParams.timeoutHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:5,max:300,value:a$.timeoutSec,onChange:a=>a_(b=>({...b,timeoutSec:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"s"})]})]}),(0,b.jsx)(g.Button,{onClick:bm,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.search.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.search.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.resultLimit")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.resultLimitHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:5,max:100,value:a0.resultLimit,onChange:a=>a1(b=>({...b,resultLimit:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.allModeCap")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.allModeCapHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:1,max:20,value:a0.allModeCap,onChange:a=>a1(b=>({...b,allModeCap:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.debounceMs")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.debounceMsHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:50,max:1e3,value:a0.debounceMs,onChange:a=>a1(b=>({...b,debounceMs:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"ms"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.snippetLength")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.snippetLengthHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:20,max:500,value:a0.snippetLength,onChange:a=>a1(b=>({...b,snippetLength:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.codeTimeout")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.codeTimeoutHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:5,max:300,step:5,value:a0.codeTimeoutSec,onChange:a=>a1(b=>({...b,codeTimeoutSec:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"s"})]})]})]}),(0,b.jsx)(g.Button,{onClick:bn,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.missions.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.missions.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.minCols")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:a2.minCols,onChange:a=>a3(b=>({...b,minCols:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.maxCols")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:a2.maxCols,onChange:a=>a3(b=>({...b,maxCols:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.minRows")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:a2.minRows,onChange:a=>a3(b=>({...b,minRows:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.maxRows")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:a2.maxRows,onChange:a=>a3(b=>({...b,maxRows:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,b.jsx)(g.Button,{onClick:bo,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.hooks.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.hooks.desc")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.hooks.autoUploadTypes")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.hooks.autoUploadTypesHint")})]}),(0,b.jsx)(h.Input,{value:a8,onChange:a=>a9(a.target.value),placeholder:"png, jpg, jpeg, gif, webp, svg, pdf",className:"w-80 rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsx)(g.Button,{onClick:bp,className:"rounded-lg",children:o("common.save")}),(0,b.jsxs)("div",{className:"flex items-center gap-4 pt-4 border-t border-border/50",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:a4?.installed?o("settings.config.hooks.installed"):o("settings.config.hooks.notInstalled")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.hooks.installHint")})]}),(0,b.jsx)(g.Button,{variant:a4?.installed?"destructive":"default",onClick:bq,disabled:a6||!a4,className:"rounded-lg",children:a4?.installed?o("settings.config.hooks.uninstall"):o("settings.config.hooks.install")})]})]}),(0,b.jsx)(m.Dialog,{open:!!aU,onOpenChange:a=>!a&&aV(null),children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:o("settings.config.git.deleteConfirm")}),(0,b.jsx)(m.DialogDescription,{children:o("settings.config.git.deleteConfirmMessage")})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>aV(null),children:o("settings.config.git.cancel")}),(0,b.jsx)(g.Button,{variant:"destructive",onClick:()=>aU&&bt(aU),children:o("settings.config.git.delete")})]})]})})]});case"notifications":return(0,b.jsx)("div",{className:"divide-y divide-border/50",children:(0,b.jsxs)("div",{className:"flex items-center justify-between py-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:o("settings.notifications.enable")}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:o("settings.notifications.enableDesc")})]}),(0,b.jsx)(l.Switch,{checked:ba,onCheckedChange:bu})]})});case"backup":return(0,b.jsx)(af,{});case"extensions":return(0,b.jsx)(am,{})}}()]})}),(0,b.jsx)(S.FolderBrowserDialog,{open:null!==aW,onOpenChange:a=>{a||aX(null)},onSelect:a=>{"add"===aW?aN(b=>({...b,localPathTemplate:a})):"edit"===aW&&aJ(b=>({...b,localPathTemplate:a})),aX(null)}})]})}a.s(["default",0,function(){return(0,b.jsx)(at,{})}],520788)}];
1
+ module.exports=[520788,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(940271),f=a.i(951192),g=a.i(699570),h=a.i(866718),i=a.i(429246),j=a.i(412783),k=a.i(786304),l=a.i(563658),m=a.i(814574),n=a.i(368114),o=a.i(369289),p=a.i(711796);let q=(0,p.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var r=a.i(350739);let s=(0,p.default)("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);var t=a.i(190076),u=a.i(705594),v=a.i(264589),w=a.i(54384),x=a.i(774881);let y=(0,p.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var z=a.i(975231);let A=(0,p.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),B=(0,p.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var C=a.i(704494),D=a.i(913284),E=a.i(468862),F=a.i(347165),G=a.i(723840),H=a.i(204689),I=a.i(417387),J=a.i(780410);let K=(0,J.createServerReference)("0017c96cfbba10eb5558b07c346d467fafc74ba32f",J.callServer,void 0,J.findSourceMapURL,"getAvailableTerminalApps");var L=a.i(650943);let M=(0,J.createServerReference)("40343ae474f890964308647b5803f9734a720deef0",J.callServer,void 0,J.findSourceMapURL,"createPrompt"),N=(0,J.createServerReference)("60bdd2a7ccc15ab629dbd3b67bf89065dc538f8ab7",J.callServer,void 0,J.findSourceMapURL,"updatePrompt"),O=(0,J.createServerReference)("40cd9b519d904a0706b64e8fd24705179724ddd0c3",J.callServer,void 0,J.findSourceMapURL,"deletePrompt"),P=(0,J.createServerReference)("60a34b51fb2262ccba1c2c6ff9922c1590410877d1",J.callServer,void 0,J.findSourceMapURL,"setDefaultPrompt"),Q=(0,J.createServerReference)("00fb534e304521d2ab6e925523e7aeb649ff3ea889",J.callServer,void 0,J.findSourceMapURL,"getAvailableProviders");var R=a.i(785259),S=a.i(43775);let T=(0,p.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var U=a.i(324954);let V=(0,p.default)("folder-up",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);var W=a.i(161664),X=a.i(811344),Y=a.i(607219),Z=a.i(952313);let $=(0,J.createServerReference)("407abd4aa36b770f2265d7cbbaa557a527750b2506",J.callServer,void 0,J.findSourceMapURL,"createBackup"),_=(0,J.createServerReference)("000954c6f27f4d69faa86e15e63685925a4f8faeb2",J.callServer,void 0,J.findSourceMapURL,"listBackupFiles"),aa=(0,J.createServerReference)("40faf7b2db8208042b242644342fd1495a8bf48b1e",J.callServer,void 0,J.findSourceMapURL,"deleteBackupFile"),ab=(0,J.createServerReference)("4048be6d65d70b2ecae5a4768692f2385626bd405f",J.callServer,void 0,J.findSourceMapURL,"restoreBackup"),ac=(0,J.createServerReference)("40034b20322e2ecbaef263acd7b497e2366d115e92",J.callServer,void 0,J.findSourceMapURL,"resetSystem"),ad=(0,J.createServerReference)("007bb940710c3f7bc9a04600b0182aee115892be0d",J.callServer,void 0,J.findSourceMapURL,"getBackupDir"),ae=(0,J.createServerReference)("402438d53819ed830899efe0a550056a3593392d22",J.callServer,void 0,J.findSourceMapURL,"setBackupDir");function af(){let{t:a,locale:e}=(0,f.useI18n)(),i=(0,d.useRouter)(),[j,k]=(0,c.useState)([]),[l,n]=(0,c.useState)(""),[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!0),[s,t]=(0,c.useState)(null),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)(""),y=(0,c.useRef)(null),[A,B]=(0,c.useState)(!1),[D,E]=(0,c.useState)(""),F=(0,c.useCallback)(async()=>{r(!0);try{let[a,b]=await Promise.all([_(),ad()]);k(a),n(b)}finally{r(!1)}},[]);(0,c.useEffect)(()=>{F()},[F]);let G=async()=>{let b=w.trim()||void 0;v(!1),x(""),t("create");try{await $(b),Z.toast.success(a("settings.backup.createSuccess")),await F()}catch{Z.toast.error(a("settings.backup.createError"))}finally{t(null)}},H=async b=>{if(confirm(a("settings.backup.restoreConfirm"))){t("restore");try{await ab(b),Z.toast.success(a("settings.backup.restoreSuccess"),{action:{label:a("settings.backup.reload"),onClick:()=>window.location.reload()},duration:15e3}),await F()}catch{Z.toast.error(a("settings.backup.restoreError"))}finally{t(null)}}},I=async b=>{if(confirm(a("settings.backup.deleteConfirm")))try{await aa(b),Z.toast.success(a("settings.backup.deleteSuccess")),k(a=>a.filter(a=>a.filename!==b))}catch{Z.toast.error(a("settings.backup.deleteError"))}},J=async b=>{p(!1);try{await ae(b),n(b),Z.toast.success(a("settings.backup.dirSaved")),await F()}catch{Z.toast.error(a("settings.backup.dirError"))}},K=async b=>{let c=b.target.files?.[0];if(c){b.target.value="",t("import");try{let b=new FormData;b.append("file",c);let d=await fetch("/api/internal/backup/import",{method:"POST",body:b});if(!d.ok){let b=await d.json();Z.toast.error("Invalid backup archive"===b.error?a("settings.backup.importInvalid"):(b.error,a("settings.backup.importError")));return}Z.toast.success(a("settings.backup.importSuccess")),await F()}catch{Z.toast.error(a("settings.backup.importError"))}finally{t(null)}}},L=async()=>{if("RESET"===D){B(!1),E(""),t("reset");try{await ac("RESET"),Z.toast.success(a("settings.backup.resetSuccess")),i.push("/")}catch{Z.toast.error(a("settings.backup.resetError"))}finally{t(null)}}},M=null!==s;return(0,b.jsxs)("div",{className:"space-y-6",children:[("restore"===s||"reset"===s)&&(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:(0,b.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,b.jsx)(C.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"restore"===s?a("settings.backup.restoring"):a("settings.backup.resetting")})]})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-base font-semibold",children:a("settings.backup.sectionTitle")}),(0,b.jsxs)("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{children:[a("settings.backup.dir"),":"]}),(0,b.jsx)("code",{className:"rounded bg-muted px-2 py-0.5 text-xs",children:l}),(0,b.jsx)(g.Button,{variant:"ghost",onClick:()=>p(!0),className:"text-xs text-muted-foreground",children:a("settings.backup.dirChange")})]}),(0,b.jsx)(S.FolderBrowserDialog,{open:o,onOpenChange:p,onSelect:J})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(g.Button,{onClick:()=>{x(""),v(!0)},disabled:M,className:"gap-2",children:"create"===s?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-4 w-4 animate-spin"})," ",a("settings.backup.creating")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(T,{className:"h-4 w-4"})," ",a("settings.backup.create")]})}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsxs)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"outline",disabled:M,onClick:()=>y.current?.click(),className:"gap-2"}),children:[(0,b.jsx)(V,{className:"h-4 w-4"}),a("settings.backup.import")]}),(0,b.jsx)(R.TooltipContent,{side:"bottom",sideOffset:4,children:a("settings.backup.importHint")})]}),(0,b.jsx)("input",{ref:y,type:"file",accept:".tar.gz,.gz",className:"hidden",onChange:K})]}),(0,b.jsx)(m.Dialog,{open:u,onOpenChange:v,children:(0,b.jsxs)(m.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(m.DialogHeader,{children:(0,b.jsx)(m.DialogTitle,{children:a("settings.backup.create")})}),(0,b.jsxs)("div",{className:"py-2",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.backup.createLabel")}),(0,b.jsx)(h.Input,{value:w,onChange:a=>x(a.target.value),onKeyDown:a=>"Enter"===a.key&&G(),placeholder:a("settings.backup.createLabelPlaceholder"),className:"mt-1.5",autoFocus:!0})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>v(!1),children:a("common.cancel")}),(0,b.jsx)(g.Button,{onClick:G,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:a("settings.backup.create")})]})]})}),q?(0,b.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,b.jsx)(C.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===j.length?(0,b.jsxs)("div",{className:"flex flex-col items-center gap-2 py-12 text-center",children:[(0,b.jsx)(Y.Archive,{className:"h-10 w-10 text-muted-foreground/30"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:a("settings.backup.empty")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:a("settings.backup.emptyDesc")})]}):(0,b.jsx)("div",{className:"space-y-3",children:j.map(c=>{var d,f;return(0,b.jsx)("div",{className:"group rounded-lg border border-border bg-card p-4 transition-colors hover:bg-accent/30",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[c.label?(0,b.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:c.label}):(0,b.jsx)("span",{className:"truncate text-sm font-medium font-mono text-foreground",children:c.filename}),c.autoBackup&&(0,b.jsx)("span",{className:"shrink-0 rounded-full bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-500 ring-1 ring-amber-500/20",children:a("settings.backup.autoLabel")})]}),c.label&&(0,b.jsx)("div",{className:"mt-0.5 text-[11px] font-mono text-muted-foreground/60",children:c.filename}),(0,b.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:[(d=c.size)<1024?`${d} B`:d<1048576?`${(d/1024).toFixed(1)} KB`:`${(d/1048576).toFixed(1)} MB`," · ",(f=c.createdAt,new Date(f).toLocaleString("zh"===e?"zh-CN":"en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}))]}),c.preview.length>0&&(0,b.jsxs)("div",{className:"mt-1.5 text-xs text-muted-foreground",children:[c.preview.map((a,c)=>(0,b.jsxs)("span",{children:[c>0&&" ",a.workspace,"(",a.projects.join(", "),")"]},c)),c.stats.workspaces>c.preview.length&&(0,b.jsxs)("span",{children:[" ",a("settings.backup.workspaces",{count:String(c.stats.workspaces)})]})]}),(0,b.jsxs)("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[a("settings.backup.projects",{count:String(c.stats.projects)})," · ",a("settings.backup.tasks",{count:String(c.stats.tasks)})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-xs",onClick:()=>H(c.filename),disabled:M,className:"text-muted-foreground hover:text-foreground"}),children:(0,b.jsx)(U.Upload,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(R.TooltipContent,{side:"bottom",sideOffset:4,children:a("settings.backup.restore")})]}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-xs",onClick:()=>I(c.filename),disabled:M,className:"text-muted-foreground hover:text-rose-400"}),children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(R.TooltipContent,{side:"bottom",sideOffset:4,children:a("settings.backup.delete")})]})]})]})},c.filename)})}),(0,b.jsxs)("div",{className:"border-t border-border pt-6",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-rose-400",children:[(0,b.jsx)(X.AlertTriangle,{className:"h-4 w-4"}),a("settings.backup.dangerZone")]}),(0,b.jsx)("p",{className:"mt-2 text-xs text-muted-foreground leading-relaxed",children:a("settings.backup.resetDesc")}),(0,b.jsxs)(g.Button,{variant:"outline",onClick:()=>{E(""),B(!0)},disabled:M,className:"mt-3 border-rose-500/30 text-rose-400 hover:bg-rose-500/10 hover:text-rose-400",children:[(0,b.jsx)(W.RotateCcw,{className:"mr-2 h-3.5 w-3.5"}),a("settings.backup.reset")]})]}),(0,b.jsx)(m.Dialog,{open:A,onOpenChange:B,children:(0,b.jsxs)(m.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:a("settings.backup.resetConfirmTitle")}),(0,b.jsx)(m.DialogDescription,{children:a("settings.backup.resetConfirmDesc")})]}),(0,b.jsxs)("div",{className:"py-2",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.backup.resetConfirmInput")}),(0,b.jsx)(h.Input,{value:D,onChange:a=>E(a.target.value),placeholder:"RESET",className:"mt-1.5 font-mono"})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>B(!1),children:a("common.cancel")}),(0,b.jsx)(g.Button,{disabled:"RESET"!==D,onClick:L,className:"border-rose-500/30 bg-rose-500/10 text-rose-400 hover:bg-rose-500/20",children:a("settings.backup.reset")})]})]})})]})}var ag=a.i(953093);let ah=(0,p.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var ai=a.i(963326),aj=a.i(192369),ak=a.i(627141);function al({extension:a}){let{t:d}=(0,f.useI18n)(),{status:e,loading:h,isInstalling:i,install:j,uninstall:k,refresh:l}=(0,ak.useExtension)(a.id),[m,n]=(0,c.useState)(!1),o=a.icon,p=e.installed,q=async()=>{let b=await j();b.success?Z.toast.success(d("settings.extensions.installSuccess").replace("{name}",a.name)):Z.toast.error(d("settings.extensions.installFailed").replace("{name}",a.name)+(b.error?`: ${b.error.slice(0,200)}`:""))},r=async()=>{let b=await k();b.success?Z.toast.success(d("settings.extensions.uninstallSuccess").replace("{name}",a.name)):Z.toast.error(d("settings.extensions.uninstallFailed").replace("{name}",a.name)+(b.error?`: ${b.error.slice(0,200)}`:""))},s=async()=>{n(!0);try{await l()}finally{n(!1)}};return(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-background ring-1 ring-border",children:(0,b.jsx)(o,{className:"h-5 w-5 text-muted-foreground"})}),(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:a.name}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.description})]})]}),(0,b.jsxs)("span",{className:"shrink-0 rounded-md bg-background px-2 py-0.5 text-xs text-muted-foreground ring-1 ring-border",children:["~",a.sizeMB," MB"]})]}),(0,b.jsx)("div",{className:"mt-4 flex items-center gap-2 text-xs",children:h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:d("common.loading")})]}):p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(D.CheckCircle2,{className:"h-3.5 w-3.5 text-emerald-500"}),(0,b.jsxs)("span",{className:"text-foreground",children:[d("settings.extensions.installed"),e.version?` v${e.version}`:""]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ah,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:d("settings.extensions.notInstalledShort")})]})}),(0,b.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(g.Button,{variant:"default",onClick:q,disabled:i,children:i?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),d("settings.extensions.reinstalling")]}):d("settings.extensions.reinstall")}),(0,b.jsx)(g.Button,{variant:"outline",onClick:r,disabled:i,children:i?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),d("settings.extensions.uninstalling")]}):d("settings.extensions.uninstall")})]}):(0,b.jsx)(g.Button,{variant:"default",onClick:q,disabled:i,children:i?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),d("settings.extensions.installing")]}):d("settings.extensions.install")}),(0,b.jsxs)(g.Button,{variant:"ghost",onClick:s,disabled:m,children:[(0,b.jsx)(aj.RefreshCw,{className:`h-3.5 w-3.5 ${m?"animate-spin":""}`}),d("settings.extensions.recheck")]}),(0,b.jsxs)(g.Button,{variant:"ghost",onClick:()=>{window.open(a.homepageUrl,"_blank","noopener,noreferrer")},children:[(0,b.jsx)(ai.ExternalLink,{className:"h-3.5 w-3.5"}),d("settings.extensions.visitHomepage")]})]})]})}function am(){let{t:a}=(0,f.useI18n)(),c=(0,ag.listExtensionMetadata)();return(0,b.jsxs)("div",{className:"space-y-5",children:[(0,b.jsxs)("header",{children:[(0,b.jsx)("h2",{className:"text-base font-semibold",children:a("settings.extensions.title")}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a("settings.extensions.desc")})]}),(0,b.jsx)("div",{className:"space-y-3",children:c.map(a=>(0,b.jsx)(al,{extension:a},a.id))})]})}function an({options:a,value:c,onChange:d}){return(0,b.jsx)("div",{className:"inline-flex rounded-lg border border-border/50 bg-muted/30 p-1 gap-0.5",children:a.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>d(a.value),className:(0,n.cn)("rounded-md px-3.5 py-1.5 text-sm font-medium transition-all duration-200 cursor-pointer",c===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value))})}function ao({label:a,description:c,children:d,className:e}){return(0,b.jsxs)("div",{className:(0,n.cn)("flex items-center justify-between py-4 border-b border-border/50 last:border-0",e),children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:a}),c&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:c})]}),(0,b.jsx)("div",{className:"shrink-0",children:d})]})}let ap=[{id:"general",labelKey:"settings.general",descKey:"settings.generalDesc",icon:o.Settings,accent:"blue"},{id:"ai-tools",labelKey:"settings.aiTools.title",descKey:"settings.aiTools.cliVerificationDesc",icon:q,accent:"emerald"},{id:"prompts",labelKey:"settings.prompts",descKey:"settings.promptsDesc",icon:r.FileText,accent:"violet"},{id:"config",labelKey:"settings.config",descKey:"settings.configDesc",icon:s,accent:"amber"},{id:"extensions",labelKey:"settings.extensions.title",descKey:"settings.extensions.navDesc",icon:v.Package,accent:"indigo"},{id:"notifications",labelKey:"settings.notifications.title",descKey:"settings.notifications.navDesc",icon:t.Bell,accent:"rose"},{id:"backup",labelKey:"settings.backup.title",descKey:"settings.backup.navDesc",icon:u.HardDrive,accent:"cyan"}],aq={blue:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},emerald:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},violet:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},amber:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},cyan:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},rose:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},indigo:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"}},ar="ai-manager:default-cli-adapter",as={host:"",ownerMatch:"*",localPathTemplate:"",priority:0};function at(){let a=(0,d.useRouter)(),{t:o}=(0,f.useI18n)(),{theme:p,setTheme:q}=(0,e.useTheme)(),{locale:r,setLocale:s}=(0,f.useI18n)(),[t,u]=(0,c.useState)("general"),v=(0,c.useRef)(null),[J,T]=(0,c.useState)({left:0,width:0}),[U,V]=(0,c.useState)(!1),[W,X]=(0,c.useState)("Terminal"),[Y,Z]=(0,c.useState)([]),[$,_]=(0,c.useState)(180),[aa,ab]=(0,c.useState)([]),[ac,ad]=(0,c.useState)("claude"),[ae,ag]=(0,c.useState)(null),[ah,ai]=(0,c.useState)({}),[aj,ak]=(0,c.useState)([]),[al,at]=(0,c.useState)(!1),[au,av]=(0,c.useState)(null),[aw,ax]=(0,c.useState)(null),[ay,az]=(0,c.useState)(""),[aA,aB]=(0,c.useState)(""),[aC,aD]=(0,c.useState)(""),[aE,aF]=(0,c.useState)([]),[aG,aH]=(0,c.useState)(null),[aI,aJ]=(0,c.useState)({...as}),[aK,aL]=(0,c.useState)(!1),[aM,aN]=(0,c.useState)({...as}),[aO,aP]=(0,c.useState)(!1),[aQ,aR]=(0,c.useState)(!1),[aS,aT]=(0,c.useState)(0),[aU,aV]=(0,c.useState)(null),[aW,aX]=(0,c.useState)(null),[aY,aZ]=(0,c.useState)({maxUploadMb:50,maxConcurrent:3,maxReadableMb:5}),[a$,a_]=(0,c.useState)({timeoutSec:30}),[a0,a1]=(0,c.useState)({resultLimit:20,allModeCap:5,debounceMs:250,snippetLength:80,codeTimeoutSec:30}),[a2,a3]=(0,c.useState)({minCols:1,maxCols:5,minRows:1,maxRows:5}),[a4,a5]=(0,c.useState)(null),[a6,a7]=(0,c.useState)(!1),[a8,a9]=(0,c.useState)(""),[ba,bb]=(0,c.useState)(!0);(0,c.useEffect)(()=>V(!0),[]),(0,c.useEffect)(()=>{(0,G.getConfigValue)("terminal.app","Terminal").then(X),(0,G.getConfigValue)("terminal.idleTimeoutSec",180).then(_),K().then(Z)},[]),(0,c.useEffect)(()=>{Q().then(ab);let a=localStorage.getItem(ar);a&&ad(a)},[]),(0,c.useEffect)(()=>{(0,L.getPrompts)().then(ak)},[]);let bc=async()=>{try{let a=await fetch("/api/internal/hooks/install");if(a.ok){let b=await a.json();a5(b)}}catch{}};async function bd(){await (0,H.setConfigValue)("terminal.app",W)}async function be(){let a=Math.max(180,$);_(a),await (0,H.setConfigValue)("terminal.idleTimeoutSec",a)}async function bf(a){if(!ae){ag(a),ai(b=>{let c={...b};return delete c[a],c});try{let b=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a})}),c=await b.json();ai(b=>({...b,[a]:c}))}catch{ai(b=>({...b,[a]:{ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]}}))}finally{ag(null)}}}(0,c.useEffect)(()=>{(0,G.getConfigValue)("git.pathMappingRules",[]).then(a=>{let b=new Set,c=!1,d=a.map(a=>{if(!a.id||b.has(a.id)){c=!0;let d={...a,id:crypto.randomUUID()};return b.add(d.id),d}return b.add(a.id),a});aF(d),c&&(0,H.setConfigValue)("git.pathMappingRules",d)}),(0,G.getConfigValue)("hooks.autoUploadTypes",["png","jpg","jpeg","gif","webp","svg","pdf","md","txt","json"]).then(a=>{a9(a.join(", "))}),bc(),(0,I.getConfigValues)(["system.maxUploadBytes","system.maxConcurrentExecutions","system.maxReadableFileBytes","git.timeoutSec","search.resultLimit","search.allModeCap","search.debounceMs","search.snippetLength","search.codeTimeoutSec","missions.grid.minCols","missions.grid.maxCols","missions.grid.minRows","missions.grid.maxRows"]).then(a=>{let b=a["system.maxUploadBytes"]??0x3200000,c=a["system.maxReadableFileBytes"]??5242880;aZ({maxUploadMb:Math.round(b/1024/1024),maxConcurrent:a["system.maxConcurrentExecutions"]??3,maxReadableMb:Math.round(c/1024/1024)}),a_({timeoutSec:a["git.timeoutSec"]??30}),a1({resultLimit:a["search.resultLimit"]??20,allModeCap:a["search.allModeCap"]??5,debounceMs:a["search.debounceMs"]??250,snippetLength:a["search.snippetLength"]??80,codeTimeoutSec:a["search.codeTimeoutSec"]??30}),a3({minCols:a["missions.grid.minCols"]??1,maxCols:a["missions.grid.maxCols"]??5,minRows:a["missions.grid.minRows"]??1,maxRows:a["missions.grid.maxRows"]??5})})},[]),(0,c.useEffect)(()=>{(0,G.getConfigValue)("notification.enabled",!0).then(bb)},[]);let bg=(0,c.useCallback)(()=>{av(null),az(""),aB(""),aD(""),at(!0)},[]),bh=(0,c.useCallback)(a=>{av(a),az(a.name),aB(a.description??""),aD(a.content),at(!0)},[]),bi=(0,c.useCallback)(async()=>{ay.trim()&&aC.trim()&&(au?await N(au.id,{name:ay.trim(),description:aA.trim()||void 0,content:aC.trim()}):await M({name:ay.trim(),description:aA.trim()||void 0,content:aC.trim()}),at(!1),ak(await (0,L.getPrompts)()),a.refresh())},[ay,aA,aC,au,a]),bj=(0,c.useCallback)(async()=>{aw&&(await O(aw),ax(null),ak(await (0,L.getPrompts)()),a.refresh())},[aw,a]),bk=(0,c.useCallback)(async b=>{await P(b),ak(await (0,L.getPrompts)()),a.refresh()},[a]),bl=async()=>{await (0,H.setConfigValue)("system.maxUploadBytes",1024*aY.maxUploadMb*1024),await (0,H.setConfigValue)("system.maxConcurrentExecutions",aY.maxConcurrent),await (0,H.setConfigValue)("system.maxReadableFileBytes",1024*aY.maxReadableMb*1024)},bm=async()=>{await (0,H.setConfigValue)("git.timeoutSec",a$.timeoutSec)},bn=async()=>{await (0,H.setConfigValue)("search.resultLimit",a0.resultLimit),await (0,H.setConfigValue)("search.allModeCap",a0.allModeCap),await (0,H.setConfigValue)("search.debounceMs",a0.debounceMs),await (0,H.setConfigValue)("search.snippetLength",a0.snippetLength),await (0,H.setConfigValue)("search.codeTimeoutSec",a0.codeTimeoutSec)},bo=async()=>{let a=Math.min(a2.minCols,a2.maxCols),b=Math.max(a2.minCols,a2.maxCols),c=Math.min(a2.minRows,a2.maxRows),d=Math.max(a2.minRows,a2.maxRows);a3({minCols:a,maxCols:b,minRows:c,maxRows:d}),await (0,H.setConfigValue)("missions.grid.minCols",a),await (0,H.setConfigValue)("missions.grid.maxCols",b),await (0,H.setConfigValue)("missions.grid.minRows",c),await (0,H.setConfigValue)("missions.grid.maxRows",d)},bp=async()=>{let a=a8.split(",").map(a=>a.trim()).filter(Boolean);await (0,H.setConfigValue)("hooks.autoUploadTypes",a)},bq=async()=>{if(a4){a7(!0);try{let a=a4.installed?"DELETE":"POST";await fetch("/api/internal/hooks/install",{method:a}),await bc()}finally{a7(!1)}}},br=async()=>{if(!aM.host.trim()||!aM.localPathTemplate.trim())return;let a=aM.localPathTemplate.trim().replace(/\/+$/,""),b=aO?`${a}/{path}`:a,c=[...aE,{id:crypto.randomUUID(),host:aM.host.trim(),ownerMatch:aM.ownerMatch.trim()||"*",localPathTemplate:b,priority:aM.priority}];await (0,H.setConfigValue)("git.pathMappingRules",c),aF(c),aN({...as}),aP(!1),aL(!1)},bs=async a=>{if(!aI.host.trim()||!aI.localPathTemplate.trim())return;let b=aI.localPathTemplate.trim().replace(/\/+$/,""),c=aQ?`${b}/{path}`:b,d=aE.map(b=>b.id===a?{...b,host:aI.host.trim(),ownerMatch:aI.ownerMatch.trim()||"*",localPathTemplate:c,priority:aI.priority}:b);await (0,H.setConfigValue)("git.pathMappingRules",d),aF(d),aH(null),aR(!1)},bt=async a=>{let b=aE.filter(b=>b.id!==a);await (0,H.setConfigValue)("git.pathMappingRules",b),aF(b),aV(null)};async function bu(){let a=!ba;bb(a),await (0,H.setConfigValue)("notification.enabled",a)}let bv=(0,c.useCallback)(()=>{a.back()},[a]);(0,c.useEffect)(()=>{let a=v.current;if(!a)return;let b=a.querySelector(`[data-section="${t}"]`);if(!b)return;let c=a.getBoundingClientRect(),d=b.getBoundingClientRect();T({left:d.left-c.left,width:d.width})},[t]);let bw=ap.find(a=>a.id===t),bx=bw?aq[bw.accent]:aq.blue;return(0,b.jsxs)("div",{className:"flex h-full flex-col bg-background",children:[(0,b.jsx)("div",{className:"flex-shrink-0 border-b bg-card/50 backdrop-blur-sm",children:(0,b.jsxs)("div",{className:"mx-auto max-w-5xl px-6",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between pb-3 pt-5",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:o("settings.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:o("settings.configDesc")})]}),(0,b.jsxs)(g.Button,{variant:"outline",onClick:bv,className:"gap-1.5 bg-card shadow-sm cursor-pointer",children:[(0,b.jsx)(w.X,{className:"h-3.5 w-3.5"}),"ESC"]})]}),(0,b.jsxs)("div",{ref:v,className:"relative flex gap-1 overflow-x-auto",children:[ap.map(a=>{let c=a.icon,d=t===a.id,e=aq[a.accent];return(0,b.jsxs)("button",{"data-section":a.id,onClick:()=>u(a.id),className:(0,n.cn)("relative flex items-center gap-2 rounded-t-lg px-4 py-2.5","text-sm font-medium whitespace-nowrap cursor-pointer","transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",d?`${e.text} bg-background`:"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[(0,b.jsx)("span",{className:(0,n.cn)("flex h-6 w-6 items-center justify-center rounded-md","transition-colors duration-200",d?e.bg:"bg-transparent"),children:(0,b.jsx)(c,{className:"h-3.5 w-3.5"})}),(0,b.jsx)("span",{children:o(a.labelKey)})]},a.id)}),(0,b.jsx)("div",{className:(0,n.cn)("absolute bottom-0 h-0.5 rounded-full","transition-all duration-250 ease-out",bx.indicator),style:{left:J.left,width:J.width}})]})]})}),(0,b.jsx)("div",{className:"flex-1 overflow-auto",children:(0,b.jsxs)("div",{className:"mx-auto max-w-4xl px-6 py-8",children:[bw&&(0,b.jsxs)("div",{className:"mb-6 flex items-start gap-4",children:[(0,b.jsx)("div",{className:(0,n.cn)("flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-xl","ring-1",bx.bg,bx.text,bx.ring),children:(0,b.jsx)(bw.icon,{className:"h-5 w-5"})}),(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold leading-tight",children:o(bw.labelKey)}),(0,b.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:o(bw.descKey)})]})]}),(0,b.jsx)("div",{className:"mb-6 border-t"}),function(){switch(t){case"general":let a;return a=[{value:"light",label:o("settings.themeLight")},{value:"dark",label:o("settings.themeDark")},{value:"system",label:o("settings.themeSystem")}],(0,b.jsxs)("div",{className:"divide-y divide-border/50",children:[(0,b.jsx)(ao,{label:o("settings.theme"),description:o("settings.themeDesc"),children:U?(0,b.jsx)(an,{options:a,value:p??"system",onChange:a=>q(a)}):(0,b.jsx)("div",{className:"inline-flex h-9 rounded-lg border border-border/50 bg-muted/30 p-1 w-[200px]"})}),(0,b.jsx)(ao,{label:o("settings.language"),description:o("settings.languageDesc"),children:(0,b.jsx)(an,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}],value:r,onChange:a=>s(a)})}),(0,b.jsxs)("div",{className:"py-4 border-b border-border/50",children:[(0,b.jsx)("div",{className:"flex items-center justify-between",children:(0,b.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:o("settings.terminal.label")}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:o("settings.terminal.desc")})]})}),(0,b.jsxs)("div",{className:"mt-3 flex flex-col gap-2",children:[Y.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-2",children:Y.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>{X(a.value),(0,H.setConfigValue)("terminal.app",a.value)},className:(0,n.cn)("rounded-lg border px-3.5 py-1.5 text-xs font-medium transition-all duration-200 cursor-pointer",W===a.value?"border-foreground bg-accent text-foreground font-medium":"border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:a.name},a.value))}),(0,b.jsx)("input",{type:"text",value:W,onChange:a=>X(a.target.value),onBlur:bd,placeholder:o("settings.terminal.placeholder"),className:"h-9 w-64 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500/30"})]})]}),(0,b.jsx)(ao,{label:o("settings.terminal.idleTimeout"),description:o("settings.terminal.idleTimeoutDesc"),children:(0,b.jsx)("input",{type:"number",value:$,onChange:a=>_(Number(a.target.value)),onBlur:be,min:180,className:"h-9 w-28 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm text-right focus:outline-none focus:ring-2 focus:ring-blue-500/30"})})]});case"ai-tools":return(0,b.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:aa.map(a=>{let c=ac===a.name,d=ae===a.name,e=ah[a.name];return(0,b.jsx)("li",{children:(0,b.jsxs)("div",{className:"px-5 py-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium",children:a.displayName}),(0,b.jsx)(k.Badge,{variant:"outline",children:o("label.builtin")}),c&&(0,b.jsxs)(k.Badge,{variant:"secondary",className:"shrink-0",children:[(0,b.jsx)(y,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),o("settings.prompts.default")]}),e&&(0,b.jsx)(k.Badge,{variant:e.ok?"secondary":"destructive",className:(0,n.cn)("shrink-0",e.ok&&"bg-green-600 text-white hover:bg-green-700"),children:e.ok?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(D.CheckCircle2,{className:"h-3 w-3 mr-1"}),o("settings.aiTools.testPassed")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(E.XCircle,{className:"h-3 w-3 mr-1"}),o("settings.aiTools.testFailed")]})})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.cli.available&&a.cli.version?`${a.name} \xb7 ${a.cli.version}`:a.name})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[!c&&(0,b.jsxs)(g.Button,{variant:"outline",size:"sm",onClick:()=>{var b;ad(b=a.name),localStorage.setItem(ar,b)},children:[(0,b.jsx)(y,{className:"h-3.5 w-3.5 mr-1.5 text-muted-foreground"}),o("settings.prompts.setDefault")]}),(0,b.jsx)(g.Button,{variant:"outline",size:"sm",onClick:()=>bf(a.name),disabled:d,children:d?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),o("settings.aiTools.testing")]}):o("settings.aiTools.testConnection")})]})]}),e&&(0,b.jsx)("div",{className:"mt-3 rounded-md border border-border bg-muted/30 px-4 py-3",children:(0,b.jsx)("div",{className:"space-y-1.5",children:e.checks.map(c=>(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,b.jsx)("span",{className:(0,n.cn)("w-1.5 h-1.5 rounded-full shrink-0",c.passed?"bg-green-500":"bg-red-500")}),(0,b.jsx)("span",{className:(0,n.cn)(c.passed?"text-foreground":"text-red-700 dark:text-red-300"),children:c.message})]},`${a.name}-${c.name}`))})})]})},a.name)})});case"prompts":return U?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("div",{className:"flex justify-end",children:(0,b.jsxs)(g.Button,{onClick:bg,variant:"default",children:[(0,b.jsx)(x.Plus,{className:"h-4 w-4 mr-2"}),o("settings.prompts.newPrompt")]})}),0===aj.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center rounded-lg border border-dashed border-border/50",children:[(0,b.jsx)("p",{className:"text-muted-foreground",children:o("settings.prompts.empty")}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:o("settings.prompts.emptyHint")})]}):(0,b.jsx)("div",{className:"rounded-xl border border-border/50 divide-y divide-border/50",children:aj.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate",children:a.name}),a.isDefault&&(0,b.jsxs)(k.Badge,{variant:"secondary",className:"shrink-0 rounded-full text-xs",children:[(0,b.jsx)(y,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),o("settings.prompts.default")]})]}),a.description&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:a.description})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 ml-4",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>bk(a.id),title:o("settings.prompts.setDefault"),children:(0,b.jsx)(y,{className:(0,n.cn)("h-4 w-4",a.isDefault?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>bh(a),title:o("settings.prompts.editPrompt"),children:(0,b.jsx)(A,{className:"h-4 w-4"})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>ax(a.id),className:"text-destructive",title:o("settings.prompts.delete"),children:(0,b.jsx)(z.Trash2,{className:"h-4 w-4"})})]})]},a.id))}),(0,b.jsx)(m.Dialog,{open:al,onOpenChange:at,children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:au?o("settings.prompts.editPrompt"):o("settings.prompts.newPrompt")}),(0,b.jsx)(m.DialogDescription,{children:au?o("settings.prompts.editPrompt"):o("settings.prompts.newPrompt")})]}),(0,b.jsxs)("div",{className:"space-y-4 py-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-name",children:o("settings.prompts.promptName")}),(0,b.jsx)(h.Input,{id:"prompt-name",value:ay,onChange:a=>az(a.target.value),placeholder:o("settings.prompts.promptNamePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-description",children:o("settings.prompts.promptDescription")}),(0,b.jsx)(h.Input,{id:"prompt-description",value:aA,onChange:a=>aB(a.target.value),placeholder:o("settings.prompts.promptDescriptionPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-content",children:o("settings.prompts.promptContent")}),(0,b.jsx)(i.Textarea,{id:"prompt-content",value:aC,onChange:a=>aD(a.target.value),placeholder:o("settings.prompts.promptContentPlaceholder"),rows:8,className:"mt-1.5 font-mono text-sm"})]})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>at(!1),children:o("settings.prompts.cancel")}),(0,b.jsx)(g.Button,{onClick:bi,disabled:!ay.trim()||!aC.trim(),children:o("settings.prompts.save")})]})]})}),(0,b.jsx)(m.Dialog,{open:!!aw,onOpenChange:a=>!a&&ax(null),children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:o("settings.prompts.deleteConfirmTitle")}),(0,b.jsx)(m.DialogDescription,{children:o("settings.prompts.deleteConfirmMessage")})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>ax(null),children:o("settings.prompts.cancel")}),(0,b.jsx)(g.Button,{variant:"destructive",onClick:bj,children:o("settings.prompts.delete")})]})]})})]}):(0,b.jsx)("div",{className:"h-32 rounded-lg bg-muted animate-pulse"});case"config":let c,d,e;return(0,b.jsxs)("div",{className:"space-y-8",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.git.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.git.desc")})]}),(0,b.jsxs)(g.Button,{onClick:()=>{aN({...as}),aL(!0)},children:[(0,b.jsx)(x.Plus,{className:"mr-2 h-4 w-4"}),o("settings.config.git.addRule")]})]}),(0,b.jsxs)("div",{className:"space-y-3",children:[0!==aE.length||aK?(0,b.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:aE.map(a=>aG===a.id?(0,b.jsxs)("li",{className:"px-5 py-4 bg-muted/20",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs text-muted-foreground",children:o("settings.config.git.host")}),(0,b.jsx)(h.Input,{value:aI.host,onChange:a=>aJ(b=>({...b,host:a.target.value})),placeholder:o("settings.config.git.hostPlaceholder"),className:"text-sm"})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs text-muted-foreground",children:o("settings.config.git.ownerMatch")}),(0,b.jsx)(h.Input,{value:aI.ownerMatch,onChange:a=>aJ(b=>({...b,ownerMatch:a.target.value})),placeholder:o("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]}),(0,b.jsxs)("div",{className:"space-y-1.5 col-span-2",children:[(0,b.jsx)("label",{className:"block text-xs text-muted-foreground",children:o("settings.config.git.localPathTemplate")}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{value:aI.localPathTemplate,onChange:a=>aJ(b=>({...b,localPathTemplate:a.target.value})),placeholder:o("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono flex-1"}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:aQ?"default":"outline",size:"sm",type:"button",onClick:()=>aR(a=>!a),className:"shrink-0 font-mono",children:"{path}"})}),(0,b.jsx)(R.TooltipContent,{side:"top",className:"max-w-xs",children:(0,b.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,b.jsx)("div",{className:"font-medium",children:o("settings.config.git.pathTooltipTitle")}),(0,b.jsx)("div",{className:"opacity-80",children:o("settings.config.git.pathTooltipDetail")})]})})]}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"outline",size:"icon",type:"button",onClick:()=>aX("edit"),children:(0,b.jsx)(F.FolderOpen,{className:"h-4 w-4"})})}),(0,b.jsx)(R.TooltipContent,{children:o("settings.config.git.pickFolder")})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:aQ?o("onboarding.step3.pathHintFull"):o("onboarding.step3.pathHintRepo")})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs text-muted-foreground",children:o("settings.config.git.priority")}),(0,b.jsx)(h.Input,{type:"number",value:aI.priority,onChange:a=>aJ(b=>({...b,priority:Number(a.target.value)})),className:"text-sm w-24"})]})]}),(0,b.jsxs)("div",{className:"flex justify-end gap-2 mt-3",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"sm",onClick:()=>{aH(null),aR(!1)},children:o("settings.config.git.cancel")}),(0,b.jsx)(g.Button,{size:"sm",onClick:()=>bs(a.id),children:o("settings.config.git.save")})]})]},a.id):(0,b.jsx)("li",{className:"group px-5 py-4 hover:bg-muted/20 transition-colors",children:(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium text-sm",children:a.host}),"*"!==a.ownerMatch&&(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:["/ ",a.ownerMatch]}),(0,b.jsxs)(k.Badge,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:[o("settings.config.git.priority")," ",a.priority]})]}),(0,b.jsx)("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground truncate",children:a.localPathTemplate})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{let b,c,d;return b=a.localPathTemplate,d=(c=/\/\{path\}\/?$/.test(b))?b.replace(/\/?\{path\}\/?$/,"").replace(/\/+$/,""):b,void(aH(a.id),aJ({host:a.host,ownerMatch:a.ownerMatch,localPathTemplate:d,priority:a.priority}),aR(c))},title:o("settings.config.git.edit"),children:(0,b.jsx)(A,{className:"h-4 w-4"})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>aV(a.id),className:"text-destructive",title:o("settings.config.git.delete"),children:(0,b.jsx)(z.Trash2,{className:"h-4 w-4"})})]})]})},a.id))}):(0,b.jsx)("div",{className:"rounded-xl border border-dashed border-border p-8 text-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:o("settings.config.git.noRules")})}),aK&&(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/20 p-5 space-y-4",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.host")}),(0,b.jsx)(h.Input,{value:aM.host,onChange:a=>aN(b=>({...b,host:a.target.value})),placeholder:o("settings.config.git.hostPlaceholder"),className:"text-sm",autoFocus:!0})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.ownerMatch")}),(0,b.jsx)(h.Input,{value:aM.ownerMatch,onChange:a=>aN(b=>({...b,ownerMatch:a.target.value})),placeholder:o("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs font-medium",children:o("settings.config.git.localPathTemplate")}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{value:aM.localPathTemplate,onChange:a=>aN(b=>({...b,localPathTemplate:a.target.value})),placeholder:o("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono flex-1"}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:aO?"default":"outline",size:"sm",type:"button",onClick:()=>aP(a=>!a),className:"shrink-0 font-mono",children:"{path}"})}),(0,b.jsx)(R.TooltipContent,{side:"top",className:"max-w-xs",children:(0,b.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,b.jsx)("div",{className:"font-medium",children:o("settings.config.git.pathTooltipTitle")}),(0,b.jsx)("div",{className:"opacity-80",children:o("settings.config.git.pathTooltipDetail")})]})})]}),(0,b.jsxs)(R.Tooltip,{children:[(0,b.jsx)(R.TooltipTrigger,{render:(0,b.jsx)(g.Button,{variant:"outline",size:"icon",type:"button",onClick:()=>aX("add"),children:(0,b.jsx)(F.FolderOpen,{className:"h-4 w-4"})})}),(0,b.jsx)(R.TooltipContent,{children:o("settings.config.git.pickFolder")})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:aO?o("onboarding.step3.pathHintFull"):o("onboarding.step3.pathHintRepo")})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"block text-xs font-medium",children:o("settings.config.git.priority")}),(0,b.jsx)(h.Input,{type:"number",value:aM.priority,onChange:a=>aN(b=>({...b,priority:Number(a.target.value)})),className:"text-sm w-24"})]}),aM.localPathTemplate&&(c=aM.localPathTemplate.trim().replace(/\/+$/,""),d=aO?`${c}/{path}`:c,e=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,b.jsxs)("div",{className:"rounded-lg bg-muted/40 border border-border px-4 py-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:o("onboarding.step3.previewLabel")}),(0,b.jsx)("div",{className:"flex gap-1",children:e.map((a,c)=>(0,b.jsx)("button",{type:"button",onClick:()=>aT(c),className:(0,n.cn)("rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors cursor-pointer",aS===c?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"),children:a.label},c))})]}),(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:e[aS].url}),(0,b.jsxs)("p",{className:"font-mono text-sm",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,b.jsx)("span",{className:"text-foreground font-medium",children:function(a,b){if(!a||!b)return"";let c=b.trim(),d=[],e=c.match(/^git@[^:]+:(.+)$/);if(e)d=e[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let a=new URL(c);d=decodeURIComponent(a.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!d.length)return"";let f=d[0],g=d[d.length-1],h=d.join("/");if(a.includes("{path}"))return a.replace("{path}",h).replace("{owner}",f).replace("{repo}",g).replace(/\/+$/,"");let i=a.replace("{owner}",f).replace("{repo}","").replace(/\/+$/,"");return`${i}/${g}`}(d,e[aS].url)})]})]})]})),(0,b.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"sm",onClick:()=>aL(!1),children:o("settings.config.git.cancel")}),(0,b.jsxs)(g.Button,{size:"sm",onClick:br,disabled:!aM.host.trim()||!aM.localPathTemplate.trim(),children:[(0,b.jsx)(B,{className:"h-3.5 w-3.5 mr-1.5"}),o("settings.config.git.save")]})]})]})]})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.system.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.system.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxUpload")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxUploadHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:1,max:500,value:aY.maxUploadMb,onChange:a=>aZ(b=>({...b,maxUploadMb:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"MB"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxConcurrent")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxConcurrentHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aY.maxConcurrent,onChange:a=>aZ(b=>({...b,maxConcurrent:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxReadable")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxReadableHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:1,max:50,value:aY.maxReadableMb,onChange:a=>aZ(b=>({...b,maxReadableMb:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"MB"})]})]})]}),(0,b.jsx)(g.Button,{onClick:bl,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.gitParams.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.gitParams.desc")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.gitParams.timeout")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.gitParams.timeoutHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:5,max:300,value:a$.timeoutSec,onChange:a=>a_(b=>({...b,timeoutSec:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"s"})]})]}),(0,b.jsx)(g.Button,{onClick:bm,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.search.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.search.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.resultLimit")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.resultLimitHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:5,max:100,value:a0.resultLimit,onChange:a=>a1(b=>({...b,resultLimit:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.allModeCap")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.allModeCapHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:1,max:20,value:a0.allModeCap,onChange:a=>a1(b=>({...b,allModeCap:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.debounceMs")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.debounceMsHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:50,max:1e3,value:a0.debounceMs,onChange:a=>a1(b=>({...b,debounceMs:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"ms"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.snippetLength")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.snippetLengthHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:20,max:500,value:a0.snippetLength,onChange:a=>a1(b=>({...b,snippetLength:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.codeTimeout")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.codeTimeoutHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:5,max:300,step:5,value:a0.codeTimeoutSec,onChange:a=>a1(b=>({...b,codeTimeoutSec:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"s"})]})]})]}),(0,b.jsx)(g.Button,{onClick:bn,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.missions.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.missions.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.minCols")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:a2.minCols,onChange:a=>a3(b=>({...b,minCols:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.maxCols")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:a2.maxCols,onChange:a=>a3(b=>({...b,maxCols:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.minRows")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:a2.minRows,onChange:a=>a3(b=>({...b,minRows:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.maxRows")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:a2.maxRows,onChange:a=>a3(b=>({...b,maxRows:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,b.jsx)(g.Button,{onClick:bo,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.hooks.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.hooks.desc")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.hooks.autoUploadTypes")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.hooks.autoUploadTypesHint")})]}),(0,b.jsx)(h.Input,{value:a8,onChange:a=>a9(a.target.value),placeholder:"png, jpg, jpeg, gif, webp, svg, pdf",className:"w-80 rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsx)(g.Button,{onClick:bp,className:"rounded-lg",children:o("common.save")}),(0,b.jsxs)("div",{className:"flex items-center gap-4 pt-4 border-t border-border/50",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:a4?.installed?o("settings.config.hooks.installed"):o("settings.config.hooks.notInstalled")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.hooks.installHint")})]}),(0,b.jsx)(g.Button,{variant:a4?.installed?"destructive":"default",onClick:bq,disabled:a6||!a4,className:"rounded-lg",children:a4?.installed?o("settings.config.hooks.uninstall"):o("settings.config.hooks.install")})]})]}),(0,b.jsx)(m.Dialog,{open:!!aU,onOpenChange:a=>!a&&aV(null),children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:o("settings.config.git.deleteConfirm")}),(0,b.jsx)(m.DialogDescription,{children:o("settings.config.git.deleteConfirmMessage")})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>aV(null),children:o("settings.config.git.cancel")}),(0,b.jsx)(g.Button,{variant:"destructive",onClick:()=>aU&&bt(aU),children:o("settings.config.git.delete")})]})]})})]});case"notifications":return(0,b.jsx)("div",{className:"divide-y divide-border/50",children:(0,b.jsxs)("div",{className:"flex items-center justify-between py-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:o("settings.notifications.enable")}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:o("settings.notifications.enableDesc")})]}),(0,b.jsx)(l.Switch,{checked:ba,onCheckedChange:bu})]})});case"backup":return(0,b.jsx)(af,{});case"extensions":return(0,b.jsx)(am,{})}}()]})}),(0,b.jsx)(S.FolderBrowserDialog,{open:null!==aW,onOpenChange:a=>{a||aX(null)},onSelect:a=>{"add"===aW?aN(b=>({...b,localPathTemplate:a})):"edit"===aW&&aJ(b=>({...b,localPathTemplate:a})),aX(null)}})]})}a.s(["default",0,function(){return(0,b.jsx)(at,{})}],520788)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_settings_page_tsx_0h9v7dr._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[919647,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(704494),e=a.i(865011),f=a.i(951192),g=a.i(331185),h=a.i(780410);let i=(0,h.createServerReference)("405f146d62681a85b1cb132f6d100d6dd9e4012037",h.callServer,void 0,h.findSourceMapURL,"getProjectAssets");var j=a.i(347165),k=a.i(579834),l=a.i(350739),m=a.i(509405),n=a.i(975231),o=a.i(699570);function p(a){let b=a.match(/(?:^|\/)(?:storage|data)\/assets\/([^/]+)\/([^/]+)$/);return b?`/api/files/assets/${b[1]}/${b[2]}`:a}function q({asset:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g}){var h;let{t:i}=(0,f.useI18n)(),k=p(a.path),r=a.mimeType?.startsWith("image/");return(0,b.jsxs)("div",{className:"flex items-center gap-4 rounded-lg border border-border bg-card px-4 py-3 transition-colors hover:bg-accent/20",children:[(0,b.jsx)(o.Button,{variant:"ghost",onClick:()=>c(a),className:"flex-shrink-0 cursor-pointer p-0 h-auto",children:r?(0,b.jsx)("img",{src:k,alt:a.filename,className:"h-12 w-12 rounded object-cover border border-border"}):(0,b.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded border border-border bg-muted",children:(0,b.jsx)(l.FileText,{className:"h-6 w-6 text-muted-foreground"})})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:a.filename}),a.taskTitle&&a.taskId&&(0,b.jsx)(o.Button,{variant:"ghost",onClick:b=>{b.stopPropagation(),g?.(a.taskId)},className:"flex-shrink-0 bg-blue-500/10 text-blue-600 dark:text-blue-400 text-xs px-1.5 py-0.5 rounded cursor-pointer hover:bg-blue-500/20 transition-colors h-auto",children:a.taskTitle.length>20?`[任务: ${a.taskTitle.slice(0,20)}...]`:`[任务: ${a.taskTitle}]`})]}),a.description&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:a.description}),(0,b.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:null===(h=a.size)?"-":h<1024?`${h} B`:h<1048576?`${(h/1024).toFixed(1)} KB`:h<0x40000000?`${(h/1048576).toFixed(1)} MB`:`${(h/0x40000000).toFixed(1)} GB`}),(0,b.jsx)("span",{children:new Date(a.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>c(a),className:"text-muted-foreground","aria-label":i("assets.preview"),children:(0,b.jsx)(m.Eye,{className:"h-4 w-4"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>d(a),className:"text-muted-foreground","aria-label":i("assets.revealInFinder"),children:(0,b.jsx)(j.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>e(a.id),className:"text-muted-foreground hover:text-rose-400","aria-label":i("assets.delete"),children:(0,b.jsx)(n.Trash2,{className:"h-4 w-4"})})]})]})}function r({assets:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g}){let{t:h}=(0,f.useI18n)();return 0===a.length?(0,b.jsx)(k.EmptyState,{icon:j.FolderOpen,title:h("assets.empty"),description:h("assets.emptyHint")}):(0,b.jsx)("div",{className:"flex flex-col gap-3",children:a.map(a=>(0,b.jsx)(q,{asset:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g},a.id))})}var s=a.i(324954),t=a.i(54384),u=a.i(201537),v=a.i(429246),w=a.i(580701);function x({allWorkspaces:a,initialWsId:d,initialProjectId:e,onUploaded:g}){let h,{t:i}=(0,f.useI18n)(),j=(0,c.useRef)(null),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),[r,y]=(0,c.useState)(d),[z,A]=(0,c.useState)(e),[B,C]=(0,c.useState)(""),D=a.find(a=>a.id===r),E=D?.projects??[],F=()=>{l(!1),q(null),j.current&&(j.current.value="")},G=async()=>{if(p&&z){n(!0);try{let a=new FormData;a.append("file",p),a.append("projectId",z),a.append("description",B.trim()),await (0,u.uploadAsset)(a),g(z),F()}finally{n(!1)}}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(o.Button,{onClick:()=>{y(d),A(e),q(null),C(""),l(!0)},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,b.jsx)(s.Upload,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:i("assets.upload")})]}),k&&(0,b.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,b.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:F}),(0,b.jsxs)("div",{className:"relative w-full max-w-md rounded-lg border border-border bg-card p-6 shadow-lg",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:F,className:"absolute right-3 top-3 text-muted-foreground",children:(0,b.jsx)(t.X,{className:"h-4 w-4"})}),(0,b.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-4",children:i("assets.uploadTitle")}),(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.workspace")}),(0,b.jsxs)(w.Select,{value:r,onValueChange:b=>{var c;let d;return y(c=b??""),d=a.find(a=>a.id===c),void A(d?.projects[0]?.id??null)},children:[(0,b.jsx)(w.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)("span",{className:"truncate",children:D?.name??r})}),(0,b.jsx)(w.SelectContent,{children:a.map(a=>(0,b.jsx)(w.SelectItem,{value:a.id,children:a.name},a.id))})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.project")}),E.length>0?(0,b.jsxs)(w.Select,{value:z??"",onValueChange:a=>A(a??""),children:[(0,b.jsx)(w.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)("span",{className:"truncate",children:(h=E.find(a=>a.id===z))?h.alias?`${h.name} (${h.alias})`:h.name:z})}),(0,b.jsx)(w.SelectContent,{children:E.map(a=>{let c=a.alias?`${a.name} (${a.alias})`:a.name;return(0,b.jsx)(w.SelectItem,{value:a.id,children:c},a.id)})})]}):(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i("assets.noProject")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.file")}),(0,b.jsx)("input",{type:"file",ref:j,onChange:a=>{q(a.target.files?.[0]??null)},className:"hidden"}),(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>{j.current?.click()},className:"flex-1 border-dashed bg-background px-3 py-2 text-xs text-muted-foreground hover:border-primary/50 hover:text-foreground transition-colors text-left justify-start",children:p?p.name:i("assets.selectFile")})]}),(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0 pt-1.5",children:i("assets.description")}),(0,b.jsx)(v.Textarea,{value:B,onChange:a=>C(a.target.value),placeholder:i("assets.descriptionPlaceholder"),className:"flex-1 rounded-md border border-border bg-background px-3 py-2 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-none h-20"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 justify-end mt-6",children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:F,children:i("notes.cancel")}),(0,b.jsx)(o.Button,{onClick:G,disabled:!p||!z||!B.trim()||m,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:i(m?"assets.uploading":"assets.upload")})]})]})]})]})}var y=a.i(986099),z=a.i(912868),A=a.i(10390),B=a.i(91756);let C=(0,a.i(711796).default)("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var D=a.i(161664);function E({imageUrl:a,filename:d,open:e,onOpenChange:g,assets:h,currentIndex:i,onIndexChange:j}){let{t:k}=(0,f.useI18n)(),[l,m]=(0,c.useState)(1),[n,o]=(0,c.useState)({x:0,y:0}),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)(null),[s,u]=(0,c.useState)(!1),v=!!h&&h.length>1&&"number"==typeof i&&!!j,w=v&&i>0,x=v&&i<h.length-1,G=v?h.length:0,H=G>0?Math.ceil(G/10):0,I=v?Math.floor(i/10):0,J=10*I,K=Math.min(J+10,G),L=H>1,M=v&&I>0,N=v&&I<H-1;(0,c.useEffect)(()=>{u(!0)},[]),(0,c.useEffect)(()=>{m(1),o({x:0,y:0})},[a]),(0,c.useEffect)(()=>{if(!e)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[e]);let O=(0,c.useCallback)(()=>g(!1),[g]),P=(0,c.useCallback)(()=>{v&&w&&j(i-1)},[v,w,j,i]),Q=(0,c.useCallback)(()=>{v&&x&&j(i+1)},[v,x,j,i]),R=(0,c.useCallback)(()=>{v&&M&&j((I-1)*10)},[v,M,j,I]),S=(0,c.useCallback)(()=>{v&&N&&j(Math.min((I+1)*10,G-1))},[v,N,j,I,G]),T=(0,c.useCallback)(()=>{m(a=>Math.min(8,1.25*a))},[]),U=(0,c.useCallback)(()=>{m(a=>{let b=Math.max(.1,a/1.25);return b<=1&&o({x:0,y:0}),b})},[]),V=(0,c.useCallback)(()=>{m(1),o({x:0,y:0})},[]);(0,c.useEffect)(()=>{if(!e)return;let a=a=>{switch(a.key){case"Escape":a.preventDefault(),O();break;case"ArrowLeft":v&&(a.preventDefault(),P());break;case"ArrowRight":v&&(a.preventDefault(),Q());break;case"+":case"=":a.preventDefault(),T();break;case"-":case"_":a.preventDefault(),U();break;case"0":a.preventDefault(),V()}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,v,O,P,Q,T,U,V]);let W=(0,c.useRef)(!1),X=()=>{p&&q(!1),r.current=null},Y=p?"cursor-grabbing":"cursor-grab";if(!e||!s)return null;let Z=(0,b.jsxs)("div",{className:"fixed inset-0 z-[100] bg-black/70 dark:bg-black/40 backdrop-blur-md",role:"dialog","aria-modal":"true","aria-label":k("assets.lightbox.zoomFit"),children:[(0,b.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 max-w-[80vw] truncate rounded-md bg-black/40 px-3 py-1 text-xs text-white/80 backdrop-blur-sm pointer-events-none",children:[d,v?` \xb7 ${i+1} / ${h.length}`:""]}),(0,b.jsx)("div",{className:`absolute inset-0 flex items-center justify-center overflow-hidden select-none ${Y}`,onClick:a=>{a.target===a.currentTarget&&O()},onWheel:a=>{a.preventDefault();let b=-a.deltaY>0?1.25:.8;m(a=>{let c=Math.min(8,Math.max(.1,a*b));return c<=1&&o({x:0,y:0}),c})},children:a&&(0,b.jsx)("img",{src:a,alt:d,onClick:a=>{a.stopPropagation(),W.current&&(W.current=!1)},onPointerDown:a=>{0===a.button&&(a.stopPropagation(),W.current=!1,a.target.setPointerCapture?.(a.pointerId),r.current={x:a.clientX,y:a.clientY,panX:n.x,panY:n.y},q(!0))},onPointerMove:a=>{if(!r.current)return;let b=a.clientX-r.current.x,c=a.clientY-r.current.y;Math.abs(b)+Math.abs(c)>5&&(W.current=!0),p&&o({x:r.current.panX+b,y:r.current.panY+c})},onPointerUp:X,onPointerLeave:X,onPointerCancel:X,className:"max-h-[88vh] max-w-[92vw] object-contain pointer-events-auto",style:{transform:`translate3d(${n.x}px, ${n.y}px, 0) scale(${l})`,transformOrigin:"center center",transition:p?"none":"transform 120ms ease-out",willChange:p?"transform":"auto"},draggable:!1})}),(0,b.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex flex-col items-center gap-2 max-w-[92vw]",onClick:a=>a.stopPropagation(),children:[v&&(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-1.5 py-1.5 backdrop-blur-md ring-1 ring-white/10 max-w-[92vw]",children:[L&&(0,b.jsx)(F,{onClick:R,title:`${k("assets.lightbox.prev")} (-10)`,"aria-label":`${k("assets.lightbox.prev")} (-10)`,disabled:!M,children:(0,b.jsx)(B.ChevronsLeft,{className:"h-4 w-4"})}),(0,b.jsx)(F,{onClick:P,title:k("assets.lightbox.prev"),"aria-label":k("assets.lightbox.prev"),disabled:!w,children:(0,b.jsx)(z.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"flex items-center gap-1.5",children:h.slice(J,K).map((a,c)=>{let d=J+c,e=d===i;return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||j(d)},title:a.filename,className:`shrink-0 h-12 w-12 overflow-hidden rounded-md transition-all ${e?"ring-2 ring-white opacity-100 scale-105":"opacity-60 hover:opacity-100 ring-1 ring-white/20"}`,children:(0,b.jsx)("img",{src:a.url,alt:a.filename,className:"h-full w-full object-cover",loading:"lazy",draggable:!1})},a.url+d)})}),(0,b.jsx)(F,{onClick:Q,title:k("assets.lightbox.next"),"aria-label":k("assets.lightbox.next"),disabled:!x,children:(0,b.jsx)(A.ChevronRight,{className:"h-4 w-4"})}),L&&(0,b.jsx)(F,{onClick:S,title:`${k("assets.lightbox.next")} (+10)`,"aria-label":`${k("assets.lightbox.next")} (+10)`,disabled:!N,children:(0,b.jsx)(C,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-2 py-1.5 backdrop-blur-md ring-1 ring-white/10",children:[(0,b.jsxs)("span",{className:"px-2 text-xs text-white/80 tabular-nums select-none min-w-12 text-center",children:[Math.round(100*l),"%"]}),(0,b.jsx)(F,{onClick:V,title:k("assets.lightbox.reset"),"aria-label":k("assets.lightbox.reset"),disabled:1===l&&0===n.x&&0===n.y,children:(0,b.jsx)(D.RotateCcw,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"mx-1 h-5 w-px bg-white/20"}),(0,b.jsx)(F,{onClick:O,title:k("assets.lightbox.close"),"aria-label":k("assets.lightbox.close"),children:(0,b.jsx)(t.X,{className:"h-4 w-4"})})]})]})]});return(0,y.createPortal)(Z,document.body)}function F({children:a,onClick:c,title:d,disabled:e,...f}){return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||c()},title:d,disabled:e,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-white/80 hover:bg-white/15 hover:text-white disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-white/80 transition-colors",...f,children:a})}a.i(757942);var G=a.i(950314),H=a.i(814574);function I({url:a,filename:e,open:g,onOpenChange:h}){let{t:i}=(0,f.useI18n)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!g||!a){k(null),o(null);return}let b=!1;return m(!0),o(null),k(null),fetch(a).then(a=>{let b=a.headers.get("content-length");if(b&&parseInt(b,10)>1048576)throw Error("FILE_TOO_LARGE");return a.text()}).then(a=>{if(a.length>1048576)throw Error("FILE_TOO_LARGE");b||(k(a),m(!1))}).catch(a=>{b||(a instanceof Error&&"FILE_TOO_LARGE"===a.message?o(i("assets.fileTooLarge")):o(i("assets.previewError")),m(!1))}),()=>{b=!0}},[g,a,i]);let p=e.split(".").pop()?.toLowerCase();return(0,b.jsx)(H.Dialog,{open:g,onOpenChange:h,children:(0,b.jsxs)(H.DialogContent,{className:"w-[min(960px,92vw)] max-w-none sm:max-w-none h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0",children:[(0,b.jsx)("h3",{className:"text-sm font-medium truncate px-5 py-3 border-b border-border/50",children:e}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4",children:(()=>{if(l)return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 gap-2",children:[(0,b.jsx)(d.Loader2,{className:"size-5 animate-spin text-muted-foreground"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i("assets.loadingPreview")})]});if(n)return(0,b.jsx)("p",{className:"text-sm text-destructive",children:n});if(null===j)return null;if("md"===p)return(0,b.jsx)("div",{className:"text-sm leading-relaxed",children:(0,b.jsx)(G.Streamdown,{children:j})});if("json"===p){let a;try{a=JSON.stringify(JSON.parse(j),null,2)}catch{a=j}return(0,b.jsx)("pre",{className:"font-mono text-xs whitespace-pre-wrap text-foreground",children:a})}return(0,b.jsx)("pre",{className:"font-mono text-sm whitespace-pre-wrap text-foreground",children:j})})()})]})})}var J=a.i(972420),K=a.i(952313);a.s(["AssetsPageClient",0,function({allWorkspaces:a,initialWorkspaceId:h,initialProjectId:j,initialAssets:k}){let l,{t:m}=(0,f.useI18n)(),[n,o]=(0,c.useTransition)(),[q,s]=(0,c.useState)(h),[t,u]=(0,c.useState)(j),[v,y]=(0,c.useState)(k),[z,A]=(0,c.useState)(null),B=a.find(a=>a.id===q),C=B?.projects??[],D=(0,c.useCallback)(a=>{a?o(async()=>{y(await i(a))}):y([])},[o]),[F,G]=(0,c.useState)(null),H=F?F.mimeType?.startsWith("image/")?"image":/\.(txt|md|json)$/i.test(F.filename)?"text":null:null,L=v.filter(a=>a.mimeType?.startsWith("image/")).map(a=>({id:a.id,url:p(a.path),filename:a.filename})),M=F?L.findIndex(a=>a.id===F.id):-1,N=async a=>{try{let b=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})});if(!b.ok){let a=await b.json().catch(()=>({}));K.toast.error(a.error||"Failed to reveal file")}}catch{K.toast.error("Failed to reveal file")}},O=async a=>{let b=v.find(b=>b.id===a);confirm(m("assets.deleteConfirm",{filename:b?.filename??a}))&&(await (0,g.deleteAsset)(a),D(t))};return(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsx)(e.SubPageNav,{workspaceId:q}),(0,b.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,b.jsxs)(w.Select,{value:q,onValueChange:b=>b&&(b=>{if(b===q)return;s(b);let c=a.find(a=>a.id===b),d=c?.projects[0]??null;u(d?.id??null),D(d?.id??null)})(b),children:[(0,b.jsx)(w.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,b.jsx)("span",{className:"truncate",children:a.find(a=>a.id===q)?.name??q})}),(0,b.jsx)(w.SelectContent,{children:a.map(a=>(0,b.jsx)(w.SelectItem,{value:a.id,children:a.name},a.id))})]}),C.length>0&&(0,b.jsxs)(w.Select,{value:t??"",onValueChange:a=>a&&void(a!==t&&(u(a),D(a))),children:[(0,b.jsx)(w.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,b.jsx)("span",{className:"truncate",children:(l=C.find(a=>a.id===t))?l.alias?`${l.name} (${l.alias})`:l.name:""})}),(0,b.jsx)(w.SelectContent,{children:C.map(a=>(0,b.jsxs)(w.SelectItem,{value:a.id,children:[a.name,a.alias?` (${a.alias})`:""]},a.id))})]}),(0,b.jsx)("div",{className:"ml-auto",children:(0,b.jsx)(x,{allWorkspaces:a,initialWsId:q,initialProjectId:t,onUploaded:a=>{a===t&&D(t)}})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,b.jsxs)("div",{className:`relative ${n?"opacity-40 pointer-events-none":""} transition-opacity`,children:[n&&(0,b.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,b.jsx)(d.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===C.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:m("assets.noProject")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:m("assets.noProjectHint")})]}):(0,b.jsx)(r,{assets:v.map(a=>({...a,taskId:a.task?.id??null,taskTitle:a.task?.title??null})),onPreview:a=>{let b=a.mimeType?.startsWith("image/"),c=/\.(txt|md|json)$/i.test(a.filename);(b||c)&&G(a)},onReveal:N,onDelete:O,onTaskClick:A})]})}),(0,b.jsx)(E,{imageUrl:"image"===H&&M>=0?L[M].url:null,filename:"image"===H&&M>=0?L[M].filename:"",open:"image"===H,onOpenChange:a=>{a||G(null)},assets:L.map(({url:a,filename:b})=>({url:a,filename:b})),currentIndex:M>=0?M:void 0,onIndexChange:a=>{let b=L[a];if(!b)return;let c=v.find(a=>a.id===b.id);c&&G({...c,taskId:c.task?.id??null,taskTitle:c.task?.title??null})}}),(0,b.jsx)(I,{url:"text"===H&&F?p(F.path):null,filename:F?.filename??"",open:"text"===H,onOpenChange:a=>{a||G(null)}}),(0,b.jsx)(J.TaskOverviewDrawer,{open:!!z,onOpenChange:a=>{a||A(null)},taskId:z})]})}],919647)}];
1
+ module.exports=[919647,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(704494),e=a.i(865011),f=a.i(951192),g=a.i(576393),h=a.i(780410);let i=(0,h.createServerReference)("40482a5ba06c5d1dd103d4f177ff15e4ca25d3ad20",h.callServer,void 0,h.findSourceMapURL,"getProjectAssets");var j=a.i(347165),k=a.i(579834),l=a.i(350739),m=a.i(509405),n=a.i(975231),o=a.i(699570);function p(a){let b=a.match(/(?:^|\/)(?:storage|data)\/assets\/([^/]+)\/([^/]+)$/);return b?`/api/files/assets/${b[1]}/${b[2]}`:a}function q({asset:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g}){var h;let{t:i}=(0,f.useI18n)(),k=p(a.path),r=a.mimeType?.startsWith("image/");return(0,b.jsxs)("div",{className:"flex items-center gap-4 rounded-lg border border-border bg-card px-4 py-3 transition-colors hover:bg-accent/20",children:[(0,b.jsx)(o.Button,{variant:"ghost",onClick:()=>c(a),className:"flex-shrink-0 cursor-pointer p-0 h-auto",children:r?(0,b.jsx)("img",{src:k,alt:a.filename,className:"h-12 w-12 rounded object-cover border border-border"}):(0,b.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded border border-border bg-muted",children:(0,b.jsx)(l.FileText,{className:"h-6 w-6 text-muted-foreground"})})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:a.filename}),a.taskTitle&&a.taskId&&(0,b.jsx)(o.Button,{variant:"ghost",onClick:b=>{b.stopPropagation(),g?.(a.taskId)},className:"flex-shrink-0 bg-blue-500/10 text-blue-600 dark:text-blue-400 text-xs px-1.5 py-0.5 rounded cursor-pointer hover:bg-blue-500/20 transition-colors h-auto",children:a.taskTitle.length>20?`[任务: ${a.taskTitle.slice(0,20)}...]`:`[任务: ${a.taskTitle}]`})]}),a.description&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:a.description}),(0,b.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:null===(h=a.size)?"-":h<1024?`${h} B`:h<1048576?`${(h/1024).toFixed(1)} KB`:h<0x40000000?`${(h/1048576).toFixed(1)} MB`:`${(h/0x40000000).toFixed(1)} GB`}),(0,b.jsx)("span",{children:new Date(a.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>c(a),className:"text-muted-foreground","aria-label":i("assets.preview"),children:(0,b.jsx)(m.Eye,{className:"h-4 w-4"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>d(a),className:"text-muted-foreground","aria-label":i("assets.revealInFinder"),children:(0,b.jsx)(j.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>e(a.id),className:"text-muted-foreground hover:text-rose-400","aria-label":i("assets.delete"),children:(0,b.jsx)(n.Trash2,{className:"h-4 w-4"})})]})]})}function r({assets:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g}){let{t:h}=(0,f.useI18n)();return 0===a.length?(0,b.jsx)(k.EmptyState,{icon:j.FolderOpen,title:h("assets.empty"),description:h("assets.emptyHint")}):(0,b.jsx)("div",{className:"flex flex-col gap-3",children:a.map(a=>(0,b.jsx)(q,{asset:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g},a.id))})}var s=a.i(324954),t=a.i(54384),u=a.i(191486),v=a.i(429246),w=a.i(580701);function x({allWorkspaces:a,initialWsId:d,initialProjectId:e,onUploaded:g}){let h,{t:i}=(0,f.useI18n)(),j=(0,c.useRef)(null),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),[r,y]=(0,c.useState)(d),[z,A]=(0,c.useState)(e),[B,C]=(0,c.useState)(""),D=a.find(a=>a.id===r),E=D?.projects??[],F=()=>{l(!1),q(null),j.current&&(j.current.value="")},G=async()=>{if(p&&z){n(!0);try{let a=new FormData;a.append("file",p),a.append("projectId",z),a.append("description",B.trim()),await (0,u.uploadAsset)(a),g(z),F()}finally{n(!1)}}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(o.Button,{onClick:()=>{y(d),A(e),q(null),C(""),l(!0)},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,b.jsx)(s.Upload,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:i("assets.upload")})]}),k&&(0,b.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,b.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:F}),(0,b.jsxs)("div",{className:"relative w-full max-w-md rounded-lg border border-border bg-card p-6 shadow-lg",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:F,className:"absolute right-3 top-3 text-muted-foreground",children:(0,b.jsx)(t.X,{className:"h-4 w-4"})}),(0,b.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-4",children:i("assets.uploadTitle")}),(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.workspace")}),(0,b.jsxs)(w.Select,{value:r,onValueChange:b=>{var c;let d;return y(c=b??""),d=a.find(a=>a.id===c),void A(d?.projects[0]?.id??null)},children:[(0,b.jsx)(w.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)("span",{className:"truncate",children:D?.name??r})}),(0,b.jsx)(w.SelectContent,{children:a.map(a=>(0,b.jsx)(w.SelectItem,{value:a.id,children:a.name},a.id))})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.project")}),E.length>0?(0,b.jsxs)(w.Select,{value:z??"",onValueChange:a=>A(a??""),children:[(0,b.jsx)(w.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)("span",{className:"truncate",children:(h=E.find(a=>a.id===z))?h.alias?`${h.name} (${h.alias})`:h.name:z})}),(0,b.jsx)(w.SelectContent,{children:E.map(a=>{let c=a.alias?`${a.name} (${a.alias})`:a.name;return(0,b.jsx)(w.SelectItem,{value:a.id,children:c},a.id)})})]}):(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i("assets.noProject")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.file")}),(0,b.jsx)("input",{type:"file",ref:j,onChange:a=>{q(a.target.files?.[0]??null)},className:"hidden"}),(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>{j.current?.click()},className:"flex-1 border-dashed bg-background px-3 py-2 text-xs text-muted-foreground hover:border-primary/50 hover:text-foreground transition-colors text-left justify-start",children:p?p.name:i("assets.selectFile")})]}),(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0 pt-1.5",children:i("assets.description")}),(0,b.jsx)(v.Textarea,{value:B,onChange:a=>C(a.target.value),placeholder:i("assets.descriptionPlaceholder"),className:"flex-1 rounded-md border border-border bg-background px-3 py-2 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-none h-20"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 justify-end mt-6",children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:F,children:i("notes.cancel")}),(0,b.jsx)(o.Button,{onClick:G,disabled:!p||!z||!B.trim()||m,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:i(m?"assets.uploading":"assets.upload")})]})]})]})]})}var y=a.i(986099),z=a.i(912868),A=a.i(10390),B=a.i(91756);let C=(0,a.i(711796).default)("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var D=a.i(161664);function E({imageUrl:a,filename:d,open:e,onOpenChange:g,assets:h,currentIndex:i,onIndexChange:j}){let{t:k}=(0,f.useI18n)(),[l,m]=(0,c.useState)(1),[n,o]=(0,c.useState)({x:0,y:0}),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)(null),[s,u]=(0,c.useState)(!1),v=!!h&&h.length>1&&"number"==typeof i&&!!j,w=v&&i>0,x=v&&i<h.length-1,G=v?h.length:0,H=G>0?Math.ceil(G/10):0,I=v?Math.floor(i/10):0,J=10*I,K=Math.min(J+10,G),L=H>1,M=v&&I>0,N=v&&I<H-1;(0,c.useEffect)(()=>{u(!0)},[]),(0,c.useEffect)(()=>{m(1),o({x:0,y:0})},[a]),(0,c.useEffect)(()=>{if(!e)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[e]);let O=(0,c.useCallback)(()=>g(!1),[g]),P=(0,c.useCallback)(()=>{v&&w&&j(i-1)},[v,w,j,i]),Q=(0,c.useCallback)(()=>{v&&x&&j(i+1)},[v,x,j,i]),R=(0,c.useCallback)(()=>{v&&M&&j((I-1)*10)},[v,M,j,I]),S=(0,c.useCallback)(()=>{v&&N&&j(Math.min((I+1)*10,G-1))},[v,N,j,I,G]),T=(0,c.useCallback)(()=>{m(a=>Math.min(8,1.25*a))},[]),U=(0,c.useCallback)(()=>{m(a=>{let b=Math.max(.1,a/1.25);return b<=1&&o({x:0,y:0}),b})},[]),V=(0,c.useCallback)(()=>{m(1),o({x:0,y:0})},[]);(0,c.useEffect)(()=>{if(!e)return;let a=a=>{switch(a.key){case"Escape":a.preventDefault(),O();break;case"ArrowLeft":v&&(a.preventDefault(),P());break;case"ArrowRight":v&&(a.preventDefault(),Q());break;case"+":case"=":a.preventDefault(),T();break;case"-":case"_":a.preventDefault(),U();break;case"0":a.preventDefault(),V()}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,v,O,P,Q,T,U,V]);let W=(0,c.useRef)(!1),X=()=>{p&&q(!1),r.current=null},Y=p?"cursor-grabbing":"cursor-grab";if(!e||!s)return null;let Z=(0,b.jsxs)("div",{className:"fixed inset-0 z-[100] bg-black/70 dark:bg-black/40 backdrop-blur-md",role:"dialog","aria-modal":"true","aria-label":k("assets.lightbox.zoomFit"),children:[(0,b.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 max-w-[80vw] truncate rounded-md bg-black/40 px-3 py-1 text-xs text-white/80 backdrop-blur-sm pointer-events-none",children:[d,v?` \xb7 ${i+1} / ${h.length}`:""]}),(0,b.jsx)("div",{className:`absolute inset-0 flex items-center justify-center overflow-hidden select-none ${Y}`,onClick:a=>{a.target===a.currentTarget&&O()},onWheel:a=>{a.preventDefault();let b=-a.deltaY>0?1.25:.8;m(a=>{let c=Math.min(8,Math.max(.1,a*b));return c<=1&&o({x:0,y:0}),c})},children:a&&(0,b.jsx)("img",{src:a,alt:d,onClick:a=>{a.stopPropagation(),W.current&&(W.current=!1)},onPointerDown:a=>{0===a.button&&(a.stopPropagation(),W.current=!1,a.target.setPointerCapture?.(a.pointerId),r.current={x:a.clientX,y:a.clientY,panX:n.x,panY:n.y},q(!0))},onPointerMove:a=>{if(!r.current)return;let b=a.clientX-r.current.x,c=a.clientY-r.current.y;Math.abs(b)+Math.abs(c)>5&&(W.current=!0),p&&o({x:r.current.panX+b,y:r.current.panY+c})},onPointerUp:X,onPointerLeave:X,onPointerCancel:X,className:"max-h-[88vh] max-w-[92vw] object-contain pointer-events-auto",style:{transform:`translate3d(${n.x}px, ${n.y}px, 0) scale(${l})`,transformOrigin:"center center",transition:p?"none":"transform 120ms ease-out",willChange:p?"transform":"auto"},draggable:!1})}),(0,b.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex flex-col items-center gap-2 max-w-[92vw]",onClick:a=>a.stopPropagation(),children:[v&&(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-1.5 py-1.5 backdrop-blur-md ring-1 ring-white/10 max-w-[92vw]",children:[L&&(0,b.jsx)(F,{onClick:R,title:`${k("assets.lightbox.prev")} (-10)`,"aria-label":`${k("assets.lightbox.prev")} (-10)`,disabled:!M,children:(0,b.jsx)(B.ChevronsLeft,{className:"h-4 w-4"})}),(0,b.jsx)(F,{onClick:P,title:k("assets.lightbox.prev"),"aria-label":k("assets.lightbox.prev"),disabled:!w,children:(0,b.jsx)(z.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"flex items-center gap-1.5",children:h.slice(J,K).map((a,c)=>{let d=J+c,e=d===i;return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||j(d)},title:a.filename,className:`shrink-0 h-12 w-12 overflow-hidden rounded-md transition-all ${e?"ring-2 ring-white opacity-100 scale-105":"opacity-60 hover:opacity-100 ring-1 ring-white/20"}`,children:(0,b.jsx)("img",{src:a.url,alt:a.filename,className:"h-full w-full object-cover",loading:"lazy",draggable:!1})},a.url+d)})}),(0,b.jsx)(F,{onClick:Q,title:k("assets.lightbox.next"),"aria-label":k("assets.lightbox.next"),disabled:!x,children:(0,b.jsx)(A.ChevronRight,{className:"h-4 w-4"})}),L&&(0,b.jsx)(F,{onClick:S,title:`${k("assets.lightbox.next")} (+10)`,"aria-label":`${k("assets.lightbox.next")} (+10)`,disabled:!N,children:(0,b.jsx)(C,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-2 py-1.5 backdrop-blur-md ring-1 ring-white/10",children:[(0,b.jsxs)("span",{className:"px-2 text-xs text-white/80 tabular-nums select-none min-w-12 text-center",children:[Math.round(100*l),"%"]}),(0,b.jsx)(F,{onClick:V,title:k("assets.lightbox.reset"),"aria-label":k("assets.lightbox.reset"),disabled:1===l&&0===n.x&&0===n.y,children:(0,b.jsx)(D.RotateCcw,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"mx-1 h-5 w-px bg-white/20"}),(0,b.jsx)(F,{onClick:O,title:k("assets.lightbox.close"),"aria-label":k("assets.lightbox.close"),children:(0,b.jsx)(t.X,{className:"h-4 w-4"})})]})]})]});return(0,y.createPortal)(Z,document.body)}function F({children:a,onClick:c,title:d,disabled:e,...f}){return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||c()},title:d,disabled:e,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-white/80 hover:bg-white/15 hover:text-white disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-white/80 transition-colors",...f,children:a})}a.i(757942);var G=a.i(950314),H=a.i(814574);function I({url:a,filename:e,open:g,onOpenChange:h}){let{t:i}=(0,f.useI18n)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!g||!a){k(null),o(null);return}let b=!1;return m(!0),o(null),k(null),fetch(a).then(a=>{let b=a.headers.get("content-length");if(b&&parseInt(b,10)>1048576)throw Error("FILE_TOO_LARGE");return a.text()}).then(a=>{if(a.length>1048576)throw Error("FILE_TOO_LARGE");b||(k(a),m(!1))}).catch(a=>{b||(a instanceof Error&&"FILE_TOO_LARGE"===a.message?o(i("assets.fileTooLarge")):o(i("assets.previewError")),m(!1))}),()=>{b=!0}},[g,a,i]);let p=e.split(".").pop()?.toLowerCase();return(0,b.jsx)(H.Dialog,{open:g,onOpenChange:h,children:(0,b.jsxs)(H.DialogContent,{className:"w-[min(960px,92vw)] max-w-none sm:max-w-none h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0",children:[(0,b.jsx)("h3",{className:"text-sm font-medium truncate px-5 py-3 border-b border-border/50",children:e}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4",children:(()=>{if(l)return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 gap-2",children:[(0,b.jsx)(d.Loader2,{className:"size-5 animate-spin text-muted-foreground"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i("assets.loadingPreview")})]});if(n)return(0,b.jsx)("p",{className:"text-sm text-destructive",children:n});if(null===j)return null;if("md"===p)return(0,b.jsx)("div",{className:"text-sm leading-relaxed",children:(0,b.jsx)(G.Streamdown,{children:j})});if("json"===p){let a;try{a=JSON.stringify(JSON.parse(j),null,2)}catch{a=j}return(0,b.jsx)("pre",{className:"font-mono text-xs whitespace-pre-wrap text-foreground",children:a})}return(0,b.jsx)("pre",{className:"font-mono text-sm whitespace-pre-wrap text-foreground",children:j})})()})]})})}var J=a.i(972420),K=a.i(952313);a.s(["AssetsPageClient",0,function({allWorkspaces:a,initialWorkspaceId:h,initialProjectId:j,initialAssets:k}){let l,{t:m}=(0,f.useI18n)(),[n,o]=(0,c.useTransition)(),[q,s]=(0,c.useState)(h),[t,u]=(0,c.useState)(j),[v,y]=(0,c.useState)(k),[z,A]=(0,c.useState)(null),B=a.find(a=>a.id===q),C=B?.projects??[],D=(0,c.useCallback)(a=>{a?o(async()=>{y(await i(a))}):y([])},[o]),[F,G]=(0,c.useState)(null),H=F?F.mimeType?.startsWith("image/")?"image":/\.(txt|md|json)$/i.test(F.filename)?"text":null:null,L=v.filter(a=>a.mimeType?.startsWith("image/")).map(a=>({id:a.id,url:p(a.path),filename:a.filename})),M=F?L.findIndex(a=>a.id===F.id):-1,N=async a=>{try{let b=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})});if(!b.ok){let a=await b.json().catch(()=>({}));K.toast.error(a.error||"Failed to reveal file")}}catch{K.toast.error("Failed to reveal file")}},O=async a=>{let b=v.find(b=>b.id===a);confirm(m("assets.deleteConfirm",{filename:b?.filename??a}))&&(await (0,g.deleteAsset)(a),D(t))};return(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsx)(e.SubPageNav,{workspaceId:q}),(0,b.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,b.jsxs)(w.Select,{value:q,onValueChange:b=>b&&(b=>{if(b===q)return;s(b);let c=a.find(a=>a.id===b),d=c?.projects[0]??null;u(d?.id??null),D(d?.id??null)})(b),children:[(0,b.jsx)(w.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,b.jsx)("span",{className:"truncate",children:a.find(a=>a.id===q)?.name??q})}),(0,b.jsx)(w.SelectContent,{children:a.map(a=>(0,b.jsx)(w.SelectItem,{value:a.id,children:a.name},a.id))})]}),C.length>0&&(0,b.jsxs)(w.Select,{value:t??"",onValueChange:a=>a&&void(a!==t&&(u(a),D(a))),children:[(0,b.jsx)(w.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,b.jsx)("span",{className:"truncate",children:(l=C.find(a=>a.id===t))?l.alias?`${l.name} (${l.alias})`:l.name:""})}),(0,b.jsx)(w.SelectContent,{children:C.map(a=>(0,b.jsxs)(w.SelectItem,{value:a.id,children:[a.name,a.alias?` (${a.alias})`:""]},a.id))})]}),(0,b.jsx)("div",{className:"ml-auto",children:(0,b.jsx)(x,{allWorkspaces:a,initialWsId:q,initialProjectId:t,onUploaded:a=>{a===t&&D(t)}})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,b.jsxs)("div",{className:`relative ${n?"opacity-40 pointer-events-none":""} transition-opacity`,children:[n&&(0,b.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,b.jsx)(d.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===C.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:m("assets.noProject")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:m("assets.noProjectHint")})]}):(0,b.jsx)(r,{assets:v.map(a=>({...a,taskId:a.task?.id??null,taskTitle:a.task?.title??null})),onPreview:a=>{let b=a.mimeType?.startsWith("image/"),c=/\.(txt|md|json)$/i.test(a.filename);(b||c)&&G(a)},onReveal:N,onDelete:O,onTaskClick:A})]})}),(0,b.jsx)(E,{imageUrl:"image"===H&&M>=0?L[M].url:null,filename:"image"===H&&M>=0?L[M].filename:"",open:"image"===H,onOpenChange:a=>{a||G(null)},assets:L.map(({url:a,filename:b})=>({url:a,filename:b})),currentIndex:M>=0?M:void 0,onIndexChange:a=>{let b=L[a];if(!b)return;let c=v.find(a=>a.id===b.id);c&&G({...c,taskId:c.task?.id??null,taskTitle:c.task?.title??null})}}),(0,b.jsx)(I,{url:"text"===H&&F?p(F.path):null,filename:F?.filename??"",open:"text"===H,onOpenChange:a=>{a||G(null)}}),(0,b.jsx)(J.TaskOverviewDrawer,{open:!!z,onOpenChange:a=>{a||A(null)},taskId:z})]})}],919647)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_workspaces_%5BworkspaceId%5D_assets_assets-page-client_tsx_0wyzpam._.js.map